/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/

"use strict";
var __create2 = Object.create;
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __getProtoOf2 = Object.getPrototypeOf;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __typeError = (msg) => {
  throw TypeError(msg);
};
var __defNormalProp2 = (obj, key4, value2) => key4 in obj ? __defProp2(obj, key4, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key4] = value2;
var __esm = (fn, res2) => function __init() {
  return fn && (res2 = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res2;
};
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export2 = (target, all) => {
  for (var name in all)
    __defProp2(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key4 of __getOwnPropNames2(from))
      if (!__hasOwnProp2.call(to, key4) && key4 !== except)
        __defProp2(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc2(from, key4)) || desc.enumerable });
  }
  return to;
};
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key4, value2) => __defNormalProp2(obj, typeof key4 !== "symbol" ? key4 + "" : key4, value2);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value2) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
var __privateSet = (obj, member, value2, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value2) : member.set(obj, value2), value2);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);

// src/user.ts
var import_obsidian, User;
var init_user = __esm({
  "src/user.ts"() {
    "use strict";
    import_obsidian = require("obsidian");
    User = class {
      constructor(plugin2) {
        this.plugin = plugin2;
        this.app = this.plugin.app;
        this.apiUrl = this.plugin.apiUrl;
        this.name = this.plugin.settings.username;
        this.password = this.plugin.settings.password;
        this.token = this.plugin.settings.userToken;
      }
      getName() {
        return this.name;
      }
      async getToken() {
        return this.token;
      }
      async logout() {
        this.token = "";
        this.plugin.settings.userToken = "";
        await this.plugin.saveSettings();
      }
      async login() {
        this.name = this.plugin.settings.username;
        this.password = this.plugin.settings.password;
        if (!this.name || !this.password) {
          new import_obsidian.Notice(this.plugin.i18n.t("messages.enter_email_password"), 5e3);
          return;
        }
        try {
          const loginUrl = `${this.apiUrl}/api/login`;
          const response = await (0, import_obsidian.requestUrl)({
            url: loginUrl,
            method: "POST",
            headers: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            body: `email=${encodeURIComponent(this.name)}&password=${encodeURIComponent(this.password)}`
          });
          if (response.status !== 201) {
            throw new Error(`Login failed: ${response.text}`);
          }
          this.token = response.json.data[0];
          this.plugin.settings.userToken = this.token;
          await this.plugin.saveSettings();
        } catch (error2) {
          console.error("Failed to login:", error2);
          new import_obsidian.Notice(this.plugin.i18n.t("messages.login_failed"), 5e3);
        }
      }
      /**
       * Login with provided credentials (programmatic login)
       * Used for license activation flow where credentials are derived from license key
       * 
       * @param email - User email
       * @param password - User password
       * @returns Token if successful, null otherwise
       */
      async loginWithCredentials(email, password) {
        try {
          const loginUrl = `${this.apiUrl}/api/login`;
          const response = await (0, import_obsidian.requestUrl)({
            url: loginUrl,
            method: "POST",
            headers: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            body: `email=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`
          });
          if (response.status !== 201) {
            console.error(`Login failed with status ${response.status}: ${response.text}`);
            return null;
          }
          const token = response.json.data[0];
          this.name = email;
          this.password = password;
          this.token = token;
          this.plugin.settings.username = email;
          this.plugin.settings.password = password;
          this.plugin.settings.userToken = token;
          await this.plugin.saveSettings();
          return token;
        } catch (error2) {
          console.error("Failed to login with credentials:", error2);
          return null;
        }
      }
      async register() {
        this.name = this.plugin.settings.username;
        this.password = this.plugin.settings.password;
        if (!this.name || !this.password) {
          new import_obsidian.Notice(this.plugin.i18n.t("messages.enter_email_password"), 5e3);
          return;
        }
        const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        if (!emailRegex.test(this.name)) {
          new import_obsidian.Notice(this.plugin.i18n.t("messages.enter_valid_email"), 5e3);
          return;
        }
        try {
          const registerUrl = `${this.apiUrl}/api/user`;
          const response = await (0, import_obsidian.requestUrl)({
            url: registerUrl,
            method: "POST",
            headers: {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            body: `email=${encodeURIComponent(this.name)}&password=${encodeURIComponent(this.password)}`
          });
          if (response.status !== 201) {
            throw new Error(`Registration failed: ${response.text}`);
          }
          this.token = response.json.data[0];
          this.plugin.settings.userToken = this.token;
          await this.plugin.saveSettings();
        } catch (error2) {
          console.error("Failed to register user:", error2);
          new import_obsidian.Notice(this.plugin.i18n.t("messages.register_failed"), 5e3);
        }
      }
    };
  }
});

// src/styles/license-settings.css
var init_license_settings = __esm({
  "src/styles/license-settings.css"() {
  }
});

// src/i18n/utils.ts
function detectLanguage(app) {
  var _a6, _b4, _c2, _d, _e;
  try {
    let obsidianLang = (_b4 = (_a6 = app.vault) == null ? void 0 : _a6.config) == null ? void 0 : _b4.lang;
    if (!obsidianLang) {
      obsidianLang = (_d = (_c2 = app.vault) == null ? void 0 : _c2.config) == null ? void 0 : _d.language;
    }
    if (!obsidianLang && typeof window !== "undefined" && window.moment) {
      obsidianLang = window.moment.locale();
    }
    if (!obsidianLang && document.documentElement.lang) {
      obsidianLang = document.documentElement.lang;
    }
    if (obsidianLang) {
      const normalized = normalizeLanguageCode(obsidianLang);
      if (normalized && isValidLanguageCode(normalized)) {
        return normalized;
      }
    }
  } catch (error2) {
    console.warn("Failed to get Obsidian language setting:", error2);
  }
  try {
    const browserLang = navigator.language || ((_e = navigator.languages) == null ? void 0 : _e[0]);
    if (browserLang) {
      const normalized = normalizeLanguageCode(browserLang);
      if (normalized && isValidLanguageCode(normalized)) {
        return normalized;
      }
    }
  } catch (error2) {
    console.warn("Failed to get browser language:", error2);
  }
  return DEFAULT_LANGUAGE;
}
function normalizeLanguageCode(langCode) {
  if (!langCode) return null;
  const normalized = langCode.toLowerCase().replace(/[_]/g, "-");
  const mappings = {
    // Chinese variants
    "zh": "zh-cn",
    "zh-cn": "zh-cn",
    "zh-hans": "zh-cn",
    "zh-hans-cn": "zh-cn",
    "zh-chs": "zh-cn",
    "zh-simplified": "zh-cn",
    "chinese": "zh-cn",
    "chinese-simplified": "zh-cn",
    // Traditional Chinese (future support)
    "zh-hant": "zh-tw",
    "zh-tw": "zh-tw",
    "zh-cht": "zh-tw",
    "zh-traditional": "zh-tw",
    "chinese-traditional": "zh-tw",
    // English variants
    "en": "en",
    "en-us": "en",
    "en-gb": "en",
    "en-au": "en",
    "en-ca": "en",
    "english": "en",
    // Spanish variants
    "es": "es",
    "es-es": "es",
    "es-mx": "es",
    "es-ar": "es",
    "spanish": "es",
    // French variants
    "fr": "fr",
    "fr-fr": "fr",
    "fr-ca": "fr",
    "french": "fr",
    // German variants
    "de": "de",
    "de-de": "de",
    "de-at": "de",
    "de-ch": "de",
    "german": "de",
    // Japanese variants
    "ja": "ja",
    "ja-jp": "ja",
    "japanese": "ja",
    // Korean variants
    "ko": "ko",
    "ko-kr": "ko",
    "korean": "ko",
    // Portuguese variants
    "pt": "pt",
    "pt-pt": "pt",
    "pt-br": "pt",
    "portuguese": "pt"
  };
  if (mappings[normalized]) {
    return mappings[normalized];
  }
  for (const [key4, value2] of Object.entries(mappings)) {
    if (normalized.startsWith(key4 + "-") || normalized.startsWith(key4 + "_")) {
      return value2;
    }
  }
  return null;
}
function isValidLanguageCode(code) {
  return AVAILABLE_LANGUAGES.some((lang) => lang.code === code);
}
function interpolateTemplate(template, params) {
  if (!params) return template;
  return template.replace(/\{\{(\w+)\}\}/g, (match3, key4) => {
    return params[key4] !== void 0 ? String(params[key4]) : match3;
  });
}
function getNestedValue(obj, path8) {
  return path8.split(".").reduce((current, key4) => {
    return current && current[key4] !== void 0 ? current[key4] : void 0;
  }, obj);
}
var AVAILABLE_LANGUAGES, DEFAULT_LANGUAGE;
var init_utils = __esm({
  "src/i18n/utils.ts"() {
    "use strict";
    AVAILABLE_LANGUAGES = [
      {
        code: "en",
        name: "English",
        nativeName: "English"
      },
      {
        code: "zh-cn",
        name: "Chinese (Simplified)",
        nativeName: "\u7B80\u4F53\u4E2D\u6587"
      },
      {
        code: "es",
        name: "Spanish",
        nativeName: "Espa\xF1ol"
      },
      {
        code: "fr",
        name: "French",
        nativeName: "Fran\xE7ais"
      },
      {
        code: "de",
        name: "German",
        nativeName: "Deutsch"
      },
      {
        code: "ja",
        name: "Japanese",
        nativeName: "\u65E5\u672C\u8A9E"
      },
      {
        code: "ko",
        name: "Korean",
        nativeName: "\uD55C\uAD6D\uC5B4"
      },
      {
        code: "pt",
        name: "Portuguese",
        nativeName: "Portugu\xEAs"
      }
    ];
    DEFAULT_LANGUAGE = "en";
  }
});

// src/i18n/locales/en.ts
var en;
var init_en = __esm({
  "src/i18n/locales/en.ts"() {
    "use strict";
    en = {
      settings: {
        welcome_back: "Welcome Back!",
        welcome: "Welcome!",
        logged_in_as: "Logged in as: {{username}}",
        please_enter_credentials: "Please enter your credentials.",
        email: "Email",
        email_desc: "Enter your email address",
        email_placeholder: "your@email.com",
        password: "Password",
        password_desc: "Enter your password",
        password_placeholder: "password",
        register: "Register",
        login: "Login",
        logout: "Logout",
        // License Settings
        license: "License",
        license_key: "License Key",
        license_key_placeholder: "MDF-XXXX-XXXX-XXXX",
        activate: "Activate",
        activating: "Activating\u2026",
        license_active: "License Active",
        plan: "Plan",
        valid_until: "Valid Until",
        devices: "Devices",
        devices_registered: "Registered devices on this license",
        storage_usage: "Storage Usage",
        storage_usage_desc: "Total disk space usage",
        sync: "Sync",
        publish: "Publish",
        enabled: "Enabled",
        disabled: "Disabled",
        details: "Details",
        hide_details: "Hide Details",
        license_invalid_format: "Invalid license key format. Expected: MDF-XXXX-XXXX-XXXX",
        license_activation_failed: "License activation failed. Please check your license key.",
        license_activated_success: "License activated successfully!",
        click_to_refresh_license_info: "Click to refresh license info",
        refreshing: "Refreshing...",
        license_info_refreshed: "License info updated",
        refresh_failed: "Failed to refresh license info",
        // Trial License
        trial_license: "Request Trial License",
        trial_email: "Email for Trial",
        trial_email_placeholder: "your@email.com",
        trial_request: "Request Trial",
        trial_requesting: "Requesting...",
        trial_request_success: "Trial license created! License key has been filled in above.",
        trial_request_failed: "Failed to request trial license. Please try again.",
        trial_invalid_email: "Please enter a valid email address",
        // Pricing button
        pricing_details: "Pricing Details",
        // Sync Settings (License-based)
        sync_enabled: "Sync is enabled",
        sync_description: "Your data is securely synced across devices.",
        sync_first_time_title: "This is your first time using sync.",
        sync_first_time_desc: "Choose how you want to set up sync on this device.",
        upload_local_to_cloud: "Upload local data to cloud",
        download_from_cloud: "Download data from cloud",
        sync_data_available: "Data is available in the cloud.",
        sync_uploading: "Uploading...",
        sync_downloading: "Downloading...",
        sync_resetting: "Resetting...",
        sync_upload_success: "Local data uploaded to cloud successfully!",
        sync_download_success: "Cloud data downloaded successfully!",
        sync_operation_failed: "Sync operation failed. Please try again.",
        // UI Display Settings
        show_editor_status: "Show Editor Status Display",
        show_editor_status_desc: "Show sync status in the top-right corner of the editor (always shown on mobile)",
        hide_editor_status: "Hide Editor Status Display",
        reconnect_sync: "Reconnect Sync",
        sync_settings: "Sync Settings",
        // Security Settings
        security: "Security",
        encryption_enabled: "End-to-end encryption is enabled",
        encryption_password: "Encryption Password",
        encryption_password_desc: "Enter the encryption password from your first activation to decrypt cloud data",
        encryption_password_placeholder: "Enter encryption password",
        encryption_password_required: "Please enter the encryption password first",
        show_password: "Show",
        hide_password: "Hide",
        // Selective Sync Settings
        selective_sync: "Selective Sync",
        sync_images: "Sync Images",
        sync_images_desc: "Sync image files: bmp, png, jpg, jpeg, gif, svg, webp, avif.",
        sync_audio: "Sync Audio",
        sync_audio_desc: "Sync audio files: mp3, wav, m4a, 3gp, flac, ogg, oga, opus.",
        sync_video: "Sync Video",
        sync_video_desc: "Sync video files: mp4, webm, ogv, mov, mkv.",
        sync_pdf: "Sync PDF",
        sync_pdf_desc: "Sync PDF files.",
        sync_themes: "Sync Themes",
        sync_themes_desc: "Sync Obsidian themes from .obsidian/themes folder.",
        sync_snippets: "Sync Snippets",
        sync_snippets_desc: "Sync CSS snippets from .obsidian/snippets folder.",
        sync_plugins: "Sync Plugins",
        sync_plugins_desc: "Sync Obsidian plugins from .obsidian/plugins folder.",
        ignore_patterns: "Ignore Patterns",
        ignore_patterns_desc: "Files and folders matching these patterns will not be synced. Use gitignore format.",
        ignore_patterns_placeholder: "e.g. images/, *.tmp",
        ignore_patterns_add: "Add Rule",
        ignore_patterns_delete: "Delete Rule",
        ignore_patterns_custom_rule: "Custom rule",
        // Publish settings
        publish_settings: "Publish Settings",
        publish_method: "Publish Method",
        publish_method_desc: "Choose how you want to publish your site",
        publish_method_mdfriday: "MDFriday Subdomain",
        publish_method_netlify: "Netlify",
        publish_method_ftp: "FTP",
        publish_method_mdfriday_custom: "MDFriday Custom Domain",
        license_required: "Please upgrade your plan to use this feature",
        upgrade_for_mdfshare: "Please upgrade your plan to use MDFriday Share",
        upgrade_for_subdomain: "Please upgrade your plan to use MDFriday Subdomain",
        upgrade_for_custom_domain: "Please upgrade your plan to use MDFriday Custom Domain",
        upgrade_for_enterprise: "Please upgrade to Enterprise plan and configure enterprise server URL",
        // Netlify settings
        netlify_settings: "Netlify Settings",
        netlify_access_token: "Personal Access Token",
        netlify_access_token_desc: "Your Netlify personal access token for API authentication",
        netlify_access_token_placeholder: "Enter your Netlify access token",
        netlify_project_id: "Project ID",
        netlify_project_id_desc: "The ID of your Netlify project/site",
        netlify_project_id_placeholder: "Enter your project ID",
        // FTP settings
        ftp_settings: "FTP Settings",
        ftp_server: "Server Address",
        ftp_server_desc: "FTP server domain or IP address",
        ftp_server_placeholder: "e.g. ftp.example.com",
        ftp_username: "Username",
        ftp_username_desc: "FTP login username",
        ftp_username_placeholder: "Enter username",
        ftp_password: "Password",
        ftp_password_desc: "FTP login password",
        ftp_password_placeholder: "Enter password",
        ftp_remote_dir: "Remote Directory",
        ftp_remote_dir_desc: "Target directory path for upload",
        ftp_remote_dir_placeholder: "e.g. /www/site",
        ftp_ignore_cert: "Ignore Certificate Verification",
        ftp_ignore_cert_desc: "Enable for self-signed certificates, recommended",
        ftp_test_connection: "Test FTP Connection",
        ftp_test_connection_desc: "Test if current FTP settings are correct",
        ftp_test_connection_testing: "Testing...",
        ftp_test_connection_success: "Connection Successful",
        ftp_test_connection_failed: "Connection Failed",
        // MDFriday Subdomain Settings
        mdfriday_app: "MDFriday Subdomain",
        mdfriday_app_desc: "Configure your personal subdomain for publishing sites",
        // MDFriday Custom Domain Settings
        mdfriday_custom_domain: "MDFriday Custom Domain",
        custom_domain_desc: "Your custom domain",
        custom_domain_placeholder: "Enter your custom domain (e.g. example.com)",
        domain_check: "Check DNS",
        domain_checking: "Checking...",
        domain_check_success: "Domain DNS is configured correctly",
        domain_check_failed: "Domain DNS check failed",
        domain_save: "Save",
        domain_saving: "Saving...",
        domain_saved: "Custom domain saved successfully",
        domain_save_failed: "Failed to save custom domain",
        domain_https_check: "Check HTTPS",
        domain_https_checking: "Checking...",
        domain_https_ready: "HTTPS is fully operational",
        domain_https_pending: "HTTPS certificate is being issued (1-2 minutes)",
        domain_https_error: "HTTPS certificate error",
        domain_https_check_failed: "Failed to check HTTPS status",
        subdomain: "Subdomain",
        subdomain_desc: "Your personal subdomain for MDFriday Subdomain",
        subdomain_placeholder: "Enter subdomain",
        subdomain_check: "Check",
        subdomain_checking: "Checking...",
        subdomain_update: "Update",
        subdomain_updating: "Updating...",
        subdomain_available: "Subdomain is available",
        subdomain_unavailable: "Subdomain is already taken",
        subdomain_updated: "Subdomain updated successfully!",
        subdomain_update_failed: "Failed to update subdomain: {{error}}",
        subdomain_check_failed: "Failed to check subdomain availability",
        subdomain_invalid: "Subdomain can only contain lowercase letters, numbers, and hyphens",
        subdomain_invalid_format: "Subdomain can only contain lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen",
        subdomain_too_short: "Subdomain must be at least 4 characters",
        subdomain_too_long: "Subdomain must be at most 32 characters",
        subdomain_same: "Subdomain is the same as current",
        subdomain_reserved: "This subdomain is reserved and cannot be used",
        // General settings
        general_settings: "General Settings",
        download_server: "Download Server",
        download_server_desc: "Choose the server for downloading themes and resources",
        download_server_global: "Global",
        download_server_east: "East",
        // Enterprise settings
        enterprise_settings: "Enterprise Settings",
        enterprise_server_url: "Enterprise Server URL",
        enterprise_server_url_desc: "Custom server URL for enterprise users. Leave empty to use default server.",
        // MDFriday Account
        mdfriday_account: "MDFriday Account (Optional)",
        mdfriday_account_desc: "Sign in to access advanced features like theme marketplace and cloud publishing.",
        // Danger Zone - Reset
        danger_zone: "Danger Zone",
        reset_sync_title: "Reset cloud data",
        reset_sync_message: "This will permanently delete all your cloud sync data and published sites. Your local files will not be affected. A new encryption password will be generated.",
        reset_sync_button: "Reset Cloud Data",
        reset_input_placeholder: "Type RESET to confirm",
        reset_sync_success: "Cloud data reset successfully! You can now upload your local data.",
        reset_sync_failed: "Failed to reset cloud data: {{error}}"
      },
      ui: {
        // Server view
        desktop_only_title: "Desktop Only",
        desktop_only_message: "We're sorry, only desktop is supported at this time.",
        mobile_coming_soon: "Mobile and Tablet is coming soon.\nThank you for your patience and understanding!",
        // Site builder
        multilingual_content: "Multilingual Content",
        content_path: "Content Path",
        language: "Language",
        default_language: "Default Language",
        clear: "Clear",
        clear_all_content: "Clear all content",
        default: "Default",
        no_content_selected: "No content selected",
        no_content_selected_hint: 'Right-click on a folder or file and select "Publish to Web" to get started',
        remove_language: "Remove language",
        site_name: "Site Name",
        site_name_placeholder: "Enter site name",
        site_assets: "Site Assets",
        site_assets_placeholder: "No assets folder set",
        site_assets_hint: 'Right-click on a folder and select "Set as Site Assets" to configure',
        clear_assets: "Clear",
        advanced_settings: "Advanced Settings",
        site_path: "Site Path",
        site_path_placeholder: "/",
        site_path_hint: 'Specify the base path for your site. Use "/" for root deployment.',
        site_password: "Site Password",
        site_password_placeholder: "Enter site password",
        site_password_hint: "Set a site-level access password (optional)",
        google_analytics_id: "Google Analytics ID",
        google_analytics_placeholder: "G-XXXXXXXXXX",
        google_analytics_hint: "Your Google Analytics measurement ID (optional)",
        disqus_shortname: "Disqus Shortname",
        disqus_placeholder: "your-site-shortname",
        disqus_hint: "Your Disqus shortname for comments (optional)",
        theme: "Theme",
        change_theme: "Change Theme",
        download_sample: "Download Sample",
        downloading_sample: "Downloading...",
        // Preview section
        preview: "Preview",
        preview_building: "Building preview...",
        preview_success: "Preview ready!",
        preview_failed: "Preview build failed",
        generate_preview: "Generate Preview",
        regenerate_preview: "Regenerate Preview",
        preview_link: "Preview link:",
        export_site: "Export Site",
        exporting: "Exporting...",
        export_site_dialog_title: "Save Site Archive",
        // Publish section
        publish: "Publish",
        publish_method: "Publish Method",
        publish_option_mdfriday_share: "MDFriday Share",
        publish_option_mdfriday_app: "MDFriday Subdomain",
        publish_option_mdfriday_custom: "MDFriday Custom Domain",
        publish_option_mdfriday_enterprise: "MDFriday Enterprise",
        publish_option_netlify: "Netlify",
        publish_option_ftp: "FTP Upload",
        mdfriday_share_hint: "MDFriday Share allows you to share your site instantly. Your site will be published to your personal MDFriday space.",
        mdfriday_app_hint: "MDFriday Subdomain publishes your site to your personal subdomain. Your site will be available at your-subdomain.mdfriday.com.",
        mdfriday_custom_hint: "MDFriday Custom Domain publishes your site to your custom domain. Make sure DNS is configured correctly.",
        mdfriday_enterprise_hint: "MDFriday Enterprise publishes your site to your enterprise server. Make sure enterprise server URL is configured.",
        mdfriday_license_required: "This feature requires an activated license. Please activate your license in Settings.",
        publish_building: "Publishing...",
        publish_success: "Published successfully!",
        publish_failed: "Publish failed",
        published_successfully: "\u2705 Published successfully!",
        // Server section
        server_start: "Start Server",
        server_stop: "Stop Server",
        server_running: "Server Running",
        server_stopped: "Server Stopped"
      },
      menu: {
        publish_to_web: "Publish to Web",
        set_as_site_assets: "Set as Site Assets",
        quick_share: "Quick Share"
      },
      commands: {},
      theme: {
        choose_theme: "Choose a Theme",
        search_themes: "Search themes...",
        filter_by_tags: "Filter by tags:",
        clear_filters: "Clear filters",
        loading_themes: "Loading themes...",
        loading_tags: "Loading tags...",
        loading_initial: "Initializing theme library...",
        loading_search: "Searching themes...",
        loading_error: "Loading failed, please retry",
        no_themes_found: "No themes found",
        view_demo: "View Demo",
        live_demo: "Live Demo",
        use_it: "Use It",
        current: "Current",
        free: "Free",
        starter: "Starter",
        enjoy: "Enjoy",
        creator: "Creator",
        pro: "Pro",
        enterprise: "Enterprise",
        by_author: "by {{author}}",
        retry: "Retry"
      },
      projects: {
        manage_projects: "Manage Projects",
        project_list: "Projects",
        no_projects: "No projects saved yet",
        select_project_to_view: "Select a project to view details",
        configuration: "Configuration",
        build_history: "Build History",
        no_build_history: "No build history",
        apply_to_panel: "Apply to Panel",
        delete_project: "Delete",
        delete_project_permanent: "Delete this project",
        danger_zone: "Danger Zone",
        clear_history_title: "Clear preview history",
        clear_history_message: "This will permanently delete all preview directories and build history for this project. Exported sites and published sites will not be affected.",
        clear_preview_history: "Clear all previews",
        confirm_clear_history: "Are you sure you want to delete all preview files? This will free up disk space but cannot be undone.",
        preview_history_cleared: "Preview history cleared successfully. {{count}} directories deleted.",
        no_preview_files: "No preview files found to delete.",
        delete_warning_title: "Delete project",
        delete_warning_message: "Once you delete a project, all its configuration and build history will be permanently removed. This action cannot be undone.",
        confirm_delete: 'Are you sure you want to delete project "{{name}}"?',
        project_applied: "Project configuration applied successfully",
        project_applied_no_content: "Project configuration applied. Content paths not found - please right-click folders/files to add content.",
        project_deleted: "Project deleted successfully",
        view_site: "View Site",
        export_build: "Export",
        preview_not_found: "Preview directory not found. It may have been deleted.",
        just_now: "Just now",
        minutes_ago: "{{count}} minutes ago",
        hours_ago: "{{count}} hours ago",
        days_ago: "{{count}} days ago"
      },
      messages: {
        desktop_only_notice: "Only desktop is supported at this time.",
        sync_not_enabled: "Sync is not enabled. Please enable it in settings first.",
        publishing_desktop_only: "Publishing is only available on desktop",
        site_assets_desktop_only: "Setting site assets is only available on desktop",
        theme_selection_desktop_only: "Theme selection is only available on desktop",
        project_management_desktop_only: "Project management is only available on desktop",
        quick_share_desktop_only: "Quick share is only available on desktop",
        preview_url_copied: "Preview URL copied to clipboard",
        publish_url_copied: "Publish URL copied to clipboard",
        build_started: "Build started",
        build_completed: "Build completed successfully",
        build_failed: "Build failed",
        publish_started: "Publishing started",
        publish_completed: "Published successfully",
        publish_failed: "Publishing failed",
        // Preview messages
        no_folder_selected: "No folder selected",
        no_folder_or_file_selected: "No folder or file selected",
        must_select_folder_type: 'Content type mismatch: You previously selected a folder, but now selected a file. To publish files, click the "Clear" button in the top-right to remove previous selections, then select files only.',
        must_select_file_type: 'Content type mismatch: You previously selected a file, but now selected a folder. To publish folders, click the "Clear" button in the top-right to remove previous selections, then select folders only.',
        all_content_cleared: "All content cleared successfully",
        language_added_successfully: "Language content added successfully",
        please_use_publish_first: 'Please use "Publish to Web" on a folder or file first to get started',
        add_language_instruction: 'Right-click on a folder or file and select "Publish to Web" to add more languages',
        preview_generated_successfully: "Preview generated successfully!",
        preview_failed: "Preview failed: {{error}}",
        please_generate_preview_first: "Please generate preview first",
        preview_data_missing: "Preview data is missing",
        site_published_successfully: "Site published successfully!",
        publishing_failed: "Publishing failed: {{error}}",
        site_exported_successfully: "Site exported successfully to: {{path}}",
        export_failed: "Export failed: {{error}}",
        incremental_upload_stats: "Incremental upload: {{uploaded}} uploaded, {{deleted}} deleted, {{unchanged}} unchanged (~{{saved}}% time saved)",
        // Netlify messages
        netlify_settings_missing: "Please configure Netlify settings first",
        netlify_deploy_failed: "Netlify deployment failed: {{error}}",
        netlify_deploy_success: "Site deployed to Netlify successfully!",
        // FTP messages
        ftp_settings_missing: "Please configure FTP settings first",
        ftp_upload_failed: "FTP upload failed: {{error}}",
        ftp_upload_success: "Site uploaded to FTP server successfully!",
        ftp_fallback_to_plain: "Server does not support encryption, switched to plain FTP",
        ftp_fallback_to_full: "\u26A0\uFE0F Incremental upload failed, trying full upload as fallback...",
        // Quick share messages
        no_markdown_file: "Please open a Markdown file first",
        license_required_for_share: "Please activate your license to use Quick Share",
        quick_share_starting: "\u{1F680} Preparing quick share...",
        preview_failed_generic: "Preview generation failed",
        quick_share_ready: "\u2705 Ready to share! Click 'Publish' to share your note",
        quick_share_failed: "Quick share failed: {{error}}",
        // User messages
        enter_email_password: "Please enter your email and password",
        enter_valid_email: "Please enter a valid email address",
        login_failed: "Failed to login",
        register_failed: "Failed to register user",
        // Site assets messages
        invalid_assets_folder: "Invalid assets folder",
        site_assets_set_successfully: "Site assets set successfully",
        site_assets_cleared: "Site assets cleared",
        // Sample download messages
        sample_downloaded_successfully: 'Theme sample "{{themeName}}" downloaded successfully! Saved to folder: {{folderName}}',
        sample_download_failed: "Sample download failed: {{error}}",
        // Structured folder messages
        structured_folder_processed: 'Structured folder "{{folderName}}" detected, automatically added {{contentCount}} language contents',
        static_folder_detected: "and detected static assets folder",
        // General messages
        failed_to_create_post: "Failed to create post.",
        failed_to_create_resource: "Failed to create resource."
      },
      info: {
        service_description: "You own it \u2014 your notes, your themes, your cloud.\nMDFriday lets you build and publish with full control.",
        learn_more: "Learn more"
      },
      common: {
        loading: "Loading...",
        success: "Success",
        error: "Error",
        cancel: "Cancel",
        confirm: "Confirm",
        save: "Save",
        close: "Close",
        copy: "Copy",
        copied: "Copied!"
      }
    };
  }
});

// src/i18n/locales/zh-cn.ts
var zhCn;
var init_zh_cn = __esm({
  "src/i18n/locales/zh-cn.ts"() {
    "use strict";
    zhCn = {
      settings: {
        welcome_back: "\u6B22\u8FCE\u56DE\u6765\uFF01",
        welcome: "\u6B22\u8FCE\uFF01",
        logged_in_as: "\u5DF2\u767B\u5F55\u7528\u6237\uFF1A{{username}}",
        please_enter_credentials: "\u8BF7\u8F93\u5165\u60A8\u7684\u767B\u5F55\u4FE1\u606F\u3002",
        email: "\u90AE\u7BB1",
        email_desc: "\u8BF7\u8F93\u5165\u60A8\u7684\u90AE\u7BB1\u5730\u5740",
        email_placeholder: "your@email.com",
        password: "\u5BC6\u7801",
        password_desc: "\u8BF7\u8F93\u5165\u60A8\u7684\u5BC6\u7801",
        password_placeholder: "\u5BC6\u7801",
        register: "\u6CE8\u518C",
        login: "\u767B\u5F55",
        logout: "\u9000\u51FA\u767B\u5F55",
        // License Settings
        license: "\u8BB8\u53EF\u8BC1",
        license_key: "\u8BB8\u53EF\u8BC1\u5BC6\u94A5",
        license_key_placeholder: "MDF-XXXX-XXXX-XXXX",
        activate: "\u6FC0\u6D3B",
        activating: "\u6FC0\u6D3B\u4E2D\u2026",
        license_active: "\u8BB8\u53EF\u8BC1\u5DF2\u6FC0\u6D3B",
        plan: "\u5957\u9910",
        valid_until: "\u6709\u6548\u671F\u81F3",
        devices: "\u8BBE\u5907",
        devices_registered: "\u5DF2\u6CE8\u518C\u8BBE\u5907\u6570",
        storage_usage: "\u5B58\u50A8\u7528\u91CF",
        storage_usage_desc: "\u603B\u78C1\u76D8\u7A7A\u95F4\u4F7F\u7528\u91CF",
        sync: "\u540C\u6B65",
        publish: "\u53D1\u5E03",
        enabled: "\u5DF2\u542F\u7528",
        disabled: "\u672A\u542F\u7528",
        details: "\u8BE6\u60C5",
        hide_details: "\u9690\u85CF\u8BE6\u60C5",
        license_invalid_format: "\u8BB8\u53EF\u8BC1\u5BC6\u94A5\u683C\u5F0F\u65E0\u6548\u3002\u6B63\u786E\u683C\u5F0F\uFF1AMDF-XXXX-XXXX-XXXX",
        license_activation_failed: "\u8BB8\u53EF\u8BC1\u6FC0\u6D3B\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u8BB8\u53EF\u8BC1\u5BC6\u94A5\u3002",
        license_activated_success: "\u8BB8\u53EF\u8BC1\u6FC0\u6D3B\u6210\u529F\uFF01",
        click_to_refresh_license_info: "\u70B9\u51FB\u5237\u65B0\u8BB8\u53EF\u8BC1\u4FE1\u606F",
        refreshing: "\u6B63\u5728\u5237\u65B0...",
        license_info_refreshed: "\u8BB8\u53EF\u8BC1\u4FE1\u606F\u5DF2\u66F4\u65B0",
        refresh_failed: "\u5237\u65B0\u8BB8\u53EF\u8BC1\u4FE1\u606F\u5931\u8D25",
        // Trial License
        trial_license: "\u7533\u8BF7\u8BD5\u7528\u8BB8\u53EF\u8BC1",
        trial_email: "\u63A5\u6536\u8BD5\u7528\u7801\u7684\u90AE\u7BB1",
        trial_email_placeholder: "your@email.com",
        trial_request: "\u7533\u8BF7\u8BD5\u7528",
        trial_requesting: "\u7533\u8BF7\u4E2D...",
        trial_request_success: "\u8BD5\u7528\u8BB8\u53EF\u8BC1\u521B\u5EFA\u6210\u529F\uFF01\u8BB8\u53EF\u8BC1\u5BC6\u94A5\u5DF2\u586B\u5165\u4E0A\u65B9\u3002",
        trial_request_failed: "\u7533\u8BF7\u8BD5\u7528\u8BB8\u53EF\u8BC1\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
        trial_invalid_email: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740",
        // Pricing button
        pricing_details: "\u5957\u9910\u8BE6\u60C5",
        // Sync Settings (License-based)
        sync_enabled: "\u540C\u6B65\u5DF2\u542F\u7528",
        sync_description: "\u60A8\u7684\u6570\u636E\u5DF2\u5B89\u5168\u540C\u6B65\u81F3\u5404\u8BBE\u5907\u3002",
        sync_first_time_title: "\u8FD9\u662F\u60A8\u9996\u6B21\u4F7F\u7528\u540C\u6B65\u529F\u80FD\u3002",
        sync_first_time_desc: "\u8BF7\u9009\u62E9\u5982\u4F55\u5728\u6B64\u8BBE\u5907\u4E0A\u8BBE\u7F6E\u540C\u6B65\u3002",
        upload_local_to_cloud: "\u4E0A\u4F20\u672C\u5730\u6570\u636E\u5230\u4E91\u7AEF",
        download_from_cloud: "\u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u6570\u636E",
        sync_data_available: "\u4E91\u7AEF\u5DF2\u6709\u6570\u636E\u53EF\u4F9B\u4E0B\u8F7D\u3002",
        sync_uploading: "\u4E0A\u4F20\u4E2D...",
        sync_downloading: "\u4E0B\u8F7D\u4E2D...",
        sync_resetting: "\u91CD\u7F6E\u4E2D...",
        sync_upload_success: "\u672C\u5730\u6570\u636E\u5DF2\u6210\u529F\u4E0A\u4F20\u5230\u4E91\u7AEF\uFF01",
        sync_download_success: "\u4E91\u7AEF\u6570\u636E\u5DF2\u6210\u529F\u4E0B\u8F7D\uFF01",
        sync_operation_failed: "\u540C\u6B65\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
        // UI Display Settings
        show_editor_status: "\u663E\u793A\u7F16\u8F91\u5668\u5185\u72B6\u6001",
        show_editor_status_desc: "\u5728\u7F16\u8F91\u5668\u53F3\u4E0A\u89D2\u663E\u793A\u540C\u6B65\u72B6\u6001\u4FE1\u606F\uFF08\u79FB\u52A8\u7AEF\u59CB\u7EC8\u663E\u793A\uFF09",
        hide_editor_status: "\u9690\u85CF\u7F16\u8F91\u5668\u5185\u72B6\u6001",
        reconnect_sync: "\u91CD\u65B0\u8FDE\u63A5\u540C\u6B65",
        sync_settings: "\u540C\u6B65\u8BBE\u7F6E",
        // Security Settings
        security: "\u5B89\u5168",
        encryption_enabled: "\u7AEF\u5230\u7AEF\u52A0\u5BC6\u5DF2\u542F\u7528",
        encryption_password: "\u52A0\u5BC6\u5BC6\u7801",
        encryption_password_desc: "\u8F93\u5165\u9996\u6B21\u6FC0\u6D3B\u65F6\u7684\u52A0\u5BC6\u5BC6\u7801\u4EE5\u89E3\u5BC6\u4E91\u7AEF\u6570\u636E",
        encryption_password_placeholder: "\u8BF7\u8F93\u5165\u52A0\u5BC6\u5BC6\u7801",
        encryption_password_required: "\u8BF7\u5148\u8F93\u5165\u52A0\u5BC6\u5BC6\u7801",
        show_password: "\u663E\u793A",
        hide_password: "\u9690\u85CF",
        // Selective Sync Settings
        selective_sync: "\u9009\u62E9\u6027\u540C\u6B65",
        sync_images: "\u540C\u6B65\u56FE\u7247",
        sync_images_desc: "\u540C\u6B65\u4EE5\u4E0B\u7C7B\u578B\u7684\u56FE\u7247\u6587\u4EF6\uFF1Abmp, png, jpg, jpeg, gif, svg, webp, avif\u3002",
        sync_audio: "\u540C\u6B65\u97F3\u9891",
        sync_audio_desc: "\u540C\u6B65\u4EE5\u4E0B\u7C7B\u578B\u7684\u97F3\u9891\u6587\u4EF6\uFF1Amp3, wav, m4a, 3gp, flac, ogg, oga, opus\u3002",
        sync_video: "\u540C\u6B65\u89C6\u9891",
        sync_video_desc: "\u540C\u6B65\u4EE5\u4E0B\u7C7B\u578B\u7684\u89C6\u9891\u6587\u4EF6\uFF1Amp4, webm, ogv, mov, mkv\u3002",
        sync_pdf: "\u540C\u6B65 PDF",
        sync_pdf_desc: "\u540C\u6B65 PDF \u6587\u4EF6\u3002",
        sync_themes: "\u540C\u6B65\u4E3B\u9898",
        sync_themes_desc: "\u540C\u6B65 .obsidian/themes \u6587\u4EF6\u5939\u4E2D\u7684 Obsidian \u4E3B\u9898\u3002",
        sync_snippets: "\u540C\u6B65\u4EE3\u7801\u7247\u6BB5",
        sync_snippets_desc: "\u540C\u6B65 .obsidian/snippets \u6587\u4EF6\u5939\u4E2D\u7684 CSS \u4EE3\u7801\u7247\u6BB5\u3002",
        sync_plugins: "\u540C\u6B65\u63D2\u4EF6",
        sync_plugins_desc: "\u540C\u6B65 .obsidian/plugins \u6587\u4EF6\u5939\u4E2D\u7684 Obsidian \u63D2\u4EF6\u3002",
        ignore_patterns: "\u5FFD\u7565\u89C4\u5219",
        ignore_patterns_desc: "\u5339\u914D\u8FD9\u4E9B\u89C4\u5219\u7684\u6587\u4EF6\u548C\u6587\u4EF6\u5939\u5C06\u4E0D\u4F1A\u88AB\u540C\u6B65\u3002\u4F7F\u7528 gitignore \u683C\u5F0F\u3002",
        ignore_patterns_placeholder: "\u4F8B\u5982 images/, *.tmp",
        ignore_patterns_add: "\u6DFB\u52A0\u89C4\u5219",
        ignore_patterns_delete: "\u5220\u9664\u89C4\u5219",
        ignore_patterns_custom_rule: "\u81EA\u5B9A\u4E49\u89C4\u5219",
        // Publish settings
        publish_settings: "\u53D1\u5E03\u8BBE\u7F6E",
        publish_method: "\u53D1\u5E03\u65B9\u5F0F",
        publish_method_desc: "\u9009\u62E9\u60A8\u60F3\u8981\u53D1\u5E03\u7F51\u7AD9\u7684\u65B9\u5F0F",
        publish_method_mdfriday: "MDFriday \u5B50\u57DF\u540D",
        publish_method_netlify: "Netlify",
        publish_method_ftp: "FTP",
        publish_method_mdfriday_custom: "MDFriday \u81EA\u5B9A\u4E49\u57DF\u540D",
        license_required: "\u8BF7\u5347\u7EA7\u60A8\u7684\u5957\u9910\u4EE5\u4F7F\u7528\u6B64\u529F\u80FD",
        upgrade_for_mdfshare: "\u8BF7\u5347\u7EA7\u60A8\u7684\u5957\u9910\u4EE5\u4F7F\u7528 MDFriday \u5206\u4EAB\u529F\u80FD",
        upgrade_for_subdomain: "\u8BF7\u5347\u7EA7\u60A8\u7684\u5957\u9910\u4EE5\u4F7F\u7528 MDFriday \u5B50\u57DF\u540D\u529F\u80FD",
        upgrade_for_custom_domain: "\u8BF7\u5347\u7EA7\u60A8\u7684\u5957\u9910\u4EE5\u4F7F\u7528 MDFriday \u81EA\u5B9A\u4E49\u57DF\u540D\u529F\u80FD",
        upgrade_for_enterprise: "\u8BF7\u5347\u7EA7\u5230\u4F01\u4E1A\u7248\u5957\u9910\u5E76\u914D\u7F6E\u4F01\u4E1A\u670D\u52A1\u5668\u5730\u5740",
        // Netlify settings
        netlify_settings: "Netlify \u8BBE\u7F6E",
        netlify_access_token: "\u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C",
        netlify_access_token_desc: "\u60A8\u7684 Netlify \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\uFF0C\u7528\u4E8E API \u8BA4\u8BC1",
        netlify_access_token_placeholder: "\u8BF7\u8F93\u5165\u60A8\u7684 Netlify \u8BBF\u95EE\u4EE4\u724C",
        netlify_project_id: "\u9879\u76EE ID",
        netlify_project_id_desc: "\u60A8\u7684 Netlify \u9879\u76EE/\u7AD9\u70B9\u7684 ID",
        netlify_project_id_placeholder: "\u8BF7\u8F93\u5165\u60A8\u7684\u9879\u76EE ID",
        // FTP settings
        ftp_settings: "FTP \u8BBE\u7F6E",
        ftp_server: "\u670D\u52A1\u5668\u5730\u5740",
        ftp_server_desc: "FTP \u670D\u52A1\u5668\u57DF\u540D\u6216 IP \u5730\u5740",
        ftp_server_placeholder: "\u4F8B\u5982\uFF1Aftp.example.com",
        ftp_username: "\u7528\u6237\u540D",
        ftp_username_desc: "FTP \u767B\u5F55\u7528\u6237\u540D",
        ftp_username_placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D",
        ftp_password: "\u5BC6\u7801",
        ftp_password_desc: "FTP \u767B\u5F55\u5BC6\u7801",
        ftp_password_placeholder: "\u8BF7\u8F93\u5165\u5BC6\u7801",
        ftp_remote_dir: "\u8FDC\u7A0B\u76EE\u5F55",
        ftp_remote_dir_desc: "\u4E0A\u4F20\u7684\u76EE\u6807\u76EE\u5F55\u8DEF\u5F84",
        ftp_remote_dir_placeholder: "\u4F8B\u5982\uFF1A/www/site",
        ftp_ignore_cert: "\u5FFD\u7565\u8BC1\u4E66\u9A8C\u8BC1",
        ftp_ignore_cert_desc: "\u9002\u914D\u81EA\u7B7E\u540D\u8BC1\u4E66\uFF0C\u5EFA\u8BAE\u5F00\u542F",
        ftp_test_connection: "\u6D4B\u8BD5 FTP \u8FDE\u63A5",
        ftp_test_connection_desc: "\u6D4B\u8BD5\u5F53\u524D FTP \u8BBE\u7F6E\u662F\u5426\u6B63\u786E",
        ftp_test_connection_testing: "\u6D4B\u8BD5\u4E2D...",
        ftp_test_connection_success: "\u8FDE\u63A5\u6210\u529F",
        ftp_test_connection_failed: "\u8FDE\u63A5\u5931\u8D25",
        // MDFriday 子域名设置
        mdfriday_app: "MDFriday \u5B50\u57DF\u540D",
        mdfriday_app_desc: "\u914D\u7F6E\u60A8\u7684\u4E2A\u4EBA\u5B50\u57DF\u540D\uFF0C\u7528\u4E8E\u53D1\u5E03\u7AD9\u70B9",
        // MDFriday 自定义域名设置
        mdfriday_custom_domain: "MDFriday \u81EA\u5B9A\u4E49\u57DF\u540D",
        custom_domain_desc: "\u60A8\u7684\u81EA\u5B9A\u4E49\u57DF\u540D",
        custom_domain_placeholder: "\u8F93\u5165\u60A8\u7684\u81EA\u5B9A\u4E49\u57DF\u540D\uFF08\u4F8B\u5982 example.com\uFF09",
        domain_check: "\u68C0\u67E5 DNS",
        domain_checking: "\u68C0\u67E5\u4E2D...",
        domain_check_success: "\u57DF\u540D DNS \u914D\u7F6E\u6B63\u786E",
        domain_check_failed: "\u57DF\u540D DNS \u68C0\u67E5\u5931\u8D25",
        domain_save: "\u4FDD\u5B58",
        domain_saving: "\u4FDD\u5B58\u4E2D...",
        domain_saved: "\u81EA\u5B9A\u4E49\u57DF\u540D\u4FDD\u5B58\u6210\u529F",
        domain_save_failed: "\u4FDD\u5B58\u81EA\u5B9A\u4E49\u57DF\u540D\u5931\u8D25",
        domain_https_check: "\u68C0\u67E5 HTTPS",
        domain_https_checking: "\u68C0\u67E5\u4E2D...",
        domain_https_ready: "HTTPS \u5DF2\u5B8C\u5168\u5C31\u7EEA",
        domain_https_pending: "HTTPS \u8BC1\u4E66\u6B63\u5728\u7B7E\u53D1\u4E2D\uFF081-2\u5206\u949F\uFF09",
        domain_https_error: "HTTPS \u8BC1\u4E66\u9519\u8BEF",
        domain_https_check_failed: "HTTPS \u72B6\u6001\u68C0\u67E5\u5931\u8D25",
        subdomain: "\u5B50\u57DF\u540D",
        subdomain_desc: "\u60A8\u7684 MDFriday \u5B50\u57DF\u540D",
        subdomain_placeholder: "\u8F93\u5165\u5B50\u57DF\u540D",
        subdomain_check: "\u68C0\u67E5",
        subdomain_checking: "\u68C0\u67E5\u4E2D...",
        subdomain_update: "\u66F4\u65B0",
        subdomain_updating: "\u66F4\u65B0\u4E2D...",
        subdomain_available: "\u5B50\u57DF\u540D\u53EF\u7528",
        subdomain_unavailable: "\u5B50\u57DF\u540D\u5DF2\u88AB\u5360\u7528",
        subdomain_updated: "\u5B50\u57DF\u540D\u66F4\u65B0\u6210\u529F\uFF01",
        subdomain_update_failed: "\u5B50\u57DF\u540D\u66F4\u65B0\u5931\u8D25\uFF1A{{error}}",
        subdomain_check_failed: "\u68C0\u67E5\u5B50\u57DF\u540D\u53EF\u7528\u6027\u5931\u8D25",
        subdomain_invalid: "\u5B50\u57DF\u540D\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",
        subdomain_invalid_format: "\u5B50\u57DF\u540D\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u4EE5\u8FDE\u5B57\u7B26\u5F00\u5934\u6216\u7ED3\u5C3E",
        subdomain_too_short: "\u5B50\u57DF\u540D\u957F\u5EA6\u81F3\u5C11 4 \u4E2A\u5B57\u7B26",
        subdomain_too_long: "\u5B50\u57DF\u540D\u957F\u5EA6\u6700\u591A 32 \u4E2A\u5B57\u7B26",
        subdomain_same: "\u5B50\u57DF\u540D\u4E0E\u5F53\u524D\u76F8\u540C",
        subdomain_reserved: "\u8BE5\u5B50\u57DF\u540D\u4E3A\u4FDD\u7559\u57DF\u540D\uFF0C\u65E0\u6CD5\u4F7F\u7528",
        // General settings
        general_settings: "\u901A\u7528\u8BBE\u7F6E",
        download_server: "\u4E0B\u8F7D\u670D\u52A1\u5668",
        download_server_desc: "\u9009\u62E9\u4E0B\u8F7D\u4E3B\u9898\u548C\u8D44\u6E90\u7684\u670D\u52A1\u5668",
        download_server_global: "\u5168\u7403",
        download_server_east: "\u4E1C\u533A",
        // 企业设置
        enterprise_settings: "\u4F01\u4E1A\u8BBE\u7F6E",
        enterprise_server_url: "\u4F01\u4E1A\u670D\u52A1\u5668\u5730\u5740",
        enterprise_server_url_desc: "\u4F01\u4E1A\u7528\u6237\u81EA\u5B9A\u4E49\u670D\u52A1\u5668\u5730\u5740\u3002\u7559\u7A7A\u5219\u4F7F\u7528\u9ED8\u8BA4\u670D\u52A1\u5668\u3002",
        // MDFriday Account
        mdfriday_account: "MDFriday \u8D26\u6237\uFF08\u53EF\u9009\uFF09",
        mdfriday_account_desc: "\u767B\u5F55\u4EE5\u4F7F\u7528\u9AD8\u7EA7\u529F\u80FD\uFF0C\u5982\u4E3B\u9898\u5E02\u573A\u548C\u4E91\u7AEF\u53D1\u5E03\u3002",
        // Danger Zone - Reset
        danger_zone: "\u5371\u9669\u533A\u57DF",
        reset_sync_title: "\u91CD\u7F6E\u4E91\u7AEF\u6570\u636E",
        reset_sync_message: "\u6B64\u64CD\u4F5C\u5C06\u6C38\u4E45\u5220\u9664\u60A8\u7684\u6240\u6709\u4E91\u7AEF\u540C\u6B65\u6570\u636E\u548C\u5DF2\u53D1\u5E03\u7684\u7AD9\u70B9\u3002\u672C\u5730\u6587\u4EF6\u4E0D\u53D7\u5F71\u54CD\u3002\u91CD\u7F6E\u540E\u5C06\u751F\u6210\u65B0\u7684\u52A0\u5BC6\u5BC6\u7801\u3002",
        reset_sync_button: "\u91CD\u7F6E\u4E91\u7AEF\u6570\u636E",
        reset_input_placeholder: "\u8F93\u5165 RESET \u786E\u8BA4",
        reset_sync_success: "\u4E91\u7AEF\u6570\u636E\u91CD\u7F6E\u6210\u529F\uFF01\u60A8\u73B0\u5728\u53EF\u4EE5\u4E0A\u4F20\u672C\u5730\u6570\u636E\u3002",
        reset_sync_failed: "\u91CD\u7F6E\u4E91\u7AEF\u6570\u636E\u5931\u8D25\uFF1A{{error}}"
      },
      ui: {
        // Server view
        desktop_only_title: "\u4EC5\u652F\u6301\u684C\u9762\u7248",
        desktop_only_message: "\u62B1\u6B49\uFF0C\u76EE\u524D\u4EC5\u652F\u6301\u684C\u9762\u7248\u672C\u3002",
        mobile_coming_soon: "\u79FB\u52A8\u7AEF\u548C\u5E73\u677F\u7AEF\u5373\u5C06\u63A8\u51FA\u3002\n\u611F\u8C22\u60A8\u7684\u8010\u5FC3\u7B49\u5F85\u548C\u7406\u89E3\uFF01",
        // Site builder
        multilingual_content: "\u591A\u8BED\u8A00\u5185\u5BB9",
        content_path: "\u5185\u5BB9\u8DEF\u5F84",
        language: "\u8BED\u8A00",
        default_language: "\u9ED8\u8BA4\u8BED\u8A00",
        clear: "\u6E05\u7A7A",
        clear_all_content: "\u6E05\u7A7A\u6240\u6709\u5185\u5BB9",
        default: "\u9ED8\u8BA4",
        no_content_selected: "\u672A\u9009\u62E9\u5185\u5BB9",
        no_content_selected_hint: '\u53F3\u952E\u70B9\u51FB\u6587\u4EF6\u5939\u6216\u6587\u4EF6\u5E76\u9009\u62E9"\u53D1\u5E03\u5230\u7F51\u7AD9"\u5F00\u59CB',
        remove_language: "\u79FB\u9664\u8BED\u8A00",
        site_name: "\u7AD9\u70B9\u540D\u79F0",
        site_name_placeholder: "\u8BF7\u8F93\u5165\u7AD9\u70B9\u540D\u79F0",
        site_assets: "\u7AD9\u70B9\u8D44\u6E90",
        site_assets_placeholder: "\u672A\u8BBE\u7F6E\u8D44\u6E90\u6587\u4EF6\u5939",
        site_assets_hint: '\u53F3\u952E\u70B9\u51FB\u6587\u4EF6\u5939\u5E76\u9009\u62E9"\u8BBE\u4E3A\u7AD9\u70B9\u8D44\u6E90"\u6765\u8BBE\u7F6E',
        clear_assets: "\u6E05\u9664",
        advanced_settings: "\u9AD8\u7EA7\u8BBE\u7F6E",
        site_path: "\u7AD9\u70B9\u8DEF\u5F84",
        site_path_placeholder: "/",
        site_path_hint: '\u6307\u5B9A\u7AD9\u70B9\u7684\u57FA\u7840\u8DEF\u5F84\u3002\u4F7F\u7528 "/" \u8868\u793A\u6839\u8DEF\u5F84\u90E8\u7F72\u3002',
        site_password: "\u7AD9\u70B9\u5BC6\u7801",
        site_password_placeholder: "\u8F93\u5165\u7AD9\u70B9\u5BC6\u7801",
        site_password_hint: "\u8BBE\u7F6E\u7AD9\u70B9\u7EA7\u522B\u7684\u8BBF\u95EE\u5BC6\u7801\uFF08\u53EF\u9009\uFF09",
        google_analytics_id: "Google Analytics ID",
        google_analytics_placeholder: "G-XXXXXXXXXX",
        google_analytics_hint: "\u60A8\u7684 Google Analytics \u6D4B\u91CF ID\uFF08\u53EF\u9009\uFF09",
        disqus_shortname: "Disqus \u77ED\u540D\u79F0",
        disqus_placeholder: "your-site-shortname",
        disqus_hint: "\u60A8\u7684 Disqus \u77ED\u540D\u79F0\uFF0C\u7528\u4E8E\u8BC4\u8BBA\u529F\u80FD\uFF08\u53EF\u9009\uFF09",
        theme: "\u4E3B\u9898",
        change_theme: "\u66F4\u6362\u4E3B\u9898",
        download_sample: "\u4E0B\u8F7D\u6837\u4F8B",
        downloading_sample: "\u4E0B\u8F7D\u4E2D...",
        // Preview section
        preview: "\u9884\u89C8",
        preview_building: "\u6B63\u5728\u6784\u5EFA\u9884\u89C8...",
        preview_success: "\u9884\u89C8\u5DF2\u5C31\u7EEA\uFF01",
        preview_failed: "\u9884\u89C8\u6784\u5EFA\u5931\u8D25",
        generate_preview: "\u751F\u6210\u9884\u89C8",
        regenerate_preview: "\u91CD\u65B0\u751F\u6210\u9884\u89C8",
        preview_link: "\u9884\u89C8\u94FE\u63A5\uFF1A",
        export_site: "\u5BFC\u51FA\u7AD9\u70B9",
        exporting: "\u5BFC\u51FA\u4E2D...",
        export_site_dialog_title: "\u4FDD\u5B58\u7AD9\u70B9\u538B\u7F29\u5305",
        // Publish section
        publish: "\u53D1\u5E03",
        publish_method: "\u53D1\u5E03\u65B9\u5F0F",
        publish_option_mdfriday_share: "MDFriday \u5206\u4EAB",
        publish_option_mdfriday_app: "MDFriday \u5B50\u57DF\u540D",
        publish_option_mdfriday_custom: "MDFriday \u81EA\u5B9A\u4E49\u57DF\u540D",
        publish_option_mdfriday_enterprise: "MDFriday \u4F01\u4E1A\u7248",
        publish_option_netlify: "Netlify",
        publish_option_ftp: "FTP \u4E0A\u4F20",
        mdfriday_share_hint: "MDFriday \u5206\u4EAB\u5141\u8BB8\u60A8\u5373\u65F6\u5206\u4EAB\u7AD9\u70B9\u3002\u60A8\u7684\u7AD9\u70B9\u5C06\u53D1\u5E03\u5230\u60A8\u7684\u4E2A\u4EBA MDFriday \u7A7A\u95F4\u3002",
        mdfriday_app_hint: "MDFriday \u5B50\u57DF\u540D\u5C06\u60A8\u7684\u7AD9\u70B9\u53D1\u5E03\u5230\u4E2A\u4EBA\u5B50\u57DF\u540D\u3002\u60A8\u7684\u7AD9\u70B9\u5C06\u53EF\u901A\u8FC7 your-subdomain.mdfriday.com \u8BBF\u95EE\u3002",
        mdfriday_custom_hint: "MDFriday \u81EA\u5B9A\u4E49\u57DF\u540D\u5C06\u60A8\u7684\u7AD9\u70B9\u53D1\u5E03\u5230\u60A8\u7684\u81EA\u5B9A\u4E49\u57DF\u540D\u3002\u8BF7\u786E\u4FDD DNS \u5DF2\u6B63\u786E\u914D\u7F6E\u3002",
        mdfriday_enterprise_hint: "MDFriday \u4F01\u4E1A\u7248\u5C06\u60A8\u7684\u7AD9\u70B9\u53D1\u5E03\u5230\u4F01\u4E1A\u670D\u52A1\u5668\u3002\u8BF7\u786E\u4FDD\u5DF2\u914D\u7F6E\u4F01\u4E1A\u670D\u52A1\u5668\u5730\u5740\u3002",
        mdfriday_license_required: "\u6B64\u529F\u80FD\u9700\u8981\u6FC0\u6D3B\u8BB8\u53EF\u8BC1\u3002\u8BF7\u5728\u8BBE\u7F6E\u4E2D\u6FC0\u6D3B\u60A8\u7684\u8BB8\u53EF\u8BC1\u3002",
        publish_building: "\u6B63\u5728\u53D1\u5E03...",
        publish_success: "\u53D1\u5E03\u6210\u529F\uFF01",
        publish_failed: "\u53D1\u5E03\u5931\u8D25",
        published_successfully: "\u2705 \u53D1\u5E03\u6210\u529F\uFF01",
        // Server section
        server_start: "\u542F\u52A8\u670D\u52A1\u5668",
        server_stop: "\u505C\u6B62\u670D\u52A1\u5668",
        server_running: "\u670D\u52A1\u5668\u8FD0\u884C\u4E2D",
        server_stopped: "\u670D\u52A1\u5668\u5DF2\u505C\u6B62"
      },
      menu: {
        publish_to_web: "\u53D1\u5E03\u5230\u7F51\u7EDC",
        set_as_site_assets: "\u8BBE\u4E3A\u7AD9\u70B9\u8D44\u6E90",
        quick_share: "\u5FEB\u901F\u5206\u4EAB"
      },
      commands: {},
      theme: {
        choose_theme: "\u9009\u62E9\u4E3B\u9898",
        search_themes: "\u641C\u7D22\u4E3B\u9898...",
        filter_by_tags: "\u6309\u6807\u7B7E\u7B5B\u9009\uFF1A",
        clear_filters: "\u6E05\u9664\u7B5B\u9009",
        loading_themes: "\u6B63\u5728\u52A0\u8F7D\u4E3B\u9898...",
        loading_tags: "\u6B63\u5728\u52A0\u8F7D\u6807\u7B7E...",
        loading_initial: "\u6B63\u5728\u521D\u59CB\u5316\u4E3B\u9898\u5E93...",
        loading_search: "\u6B63\u5728\u641C\u7D22\u4E3B\u9898...",
        loading_error: "\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",
        no_themes_found: "\u672A\u627E\u5230\u4E3B\u9898",
        view_demo: "\u67E5\u770B\u6F14\u793A",
        live_demo: "\u5728\u7EBF\u6F14\u793A",
        use_it: "\u4F7F\u7528",
        current: "\u5F53\u524D",
        free: "\u514D\u8D39",
        starter: "\u5165\u95E8\u7248",
        enjoy: "\u4EAB\u53D7\u7248",
        creator: "\u521B\u4F5C\u8005",
        pro: "\u4E13\u4E1A\u7248",
        enterprise: "\u4F01\u4E1A\u7248",
        by_author: "\u4F5C\u8005\uFF1A{{author}}",
        retry: "\u91CD\u8BD5"
      },
      projects: {
        manage_projects: "\u7BA1\u7406\u9879\u76EE",
        project_list: "\u9879\u76EE\u5217\u8868",
        no_projects: "\u6682\u65E0\u5DF2\u4FDD\u5B58\u7684\u9879\u76EE",
        select_project_to_view: "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9879\u76EE\u4EE5\u67E5\u770B\u8BE6\u60C5",
        configuration: "\u914D\u7F6E\u4FE1\u606F",
        build_history: "\u6784\u5EFA\u5386\u53F2",
        no_build_history: "\u6682\u65E0\u6784\u5EFA\u5386\u53F2",
        apply_to_panel: "\u5E94\u7528\u5230\u9762\u677F",
        delete_project: "\u5220\u9664",
        delete_project_permanent: "\u5220\u9664\u6B64\u9879\u76EE",
        danger_zone: "\u5371\u9669\u533A\u57DF",
        clear_history_title: "\u6E05\u7A7A\u9884\u89C8\u5386\u53F2",
        clear_history_message: "\u6B64\u64CD\u4F5C\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u9879\u76EE\u7684\u6240\u6709\u9884\u89C8\u76EE\u5F55\u548C\u6784\u5EFA\u5386\u53F2\u8BB0\u5F55\uFF0C\u4F46\u4E0D\u4F1A\u5F71\u54CD\u5DF2\u5BFC\u51FA\u548C\u5DF2\u53D1\u5E03\u7684\u7AD9\u70B9\u3002",
        clear_preview_history: "\u6E05\u7A7A\u6240\u6709\u9884\u89C8",
        confirm_clear_history: "\u786E\u5B9A\u8981\u5220\u9664\u6240\u6709\u9884\u89C8\u6587\u4EF6\u5417\uFF1F\u6B64\u64CD\u4F5C\u53EF\u91CA\u653E\u78C1\u76D8\u7A7A\u95F4\uFF0C\u4F46\u65E0\u6CD5\u64A4\u9500\u3002",
        preview_history_cleared: "\u9884\u89C8\u5386\u53F2\u5DF2\u6E05\u7A7A\uFF0C\u5171\u5220\u9664 {{count}} \u4E2A\u76EE\u5F55",
        no_preview_files: "\u672A\u627E\u5230\u9700\u8981\u5220\u9664\u7684\u9884\u89C8\u6587\u4EF6",
        delete_warning_title: "\u5220\u9664\u9879\u76EE",
        delete_warning_message: "\u5220\u9664\u9879\u76EE\u540E\uFF0C\u6240\u6709\u914D\u7F6E\u4FE1\u606F\u548C\u6784\u5EFA\u5386\u53F2\u5C06\u88AB\u6C38\u4E45\u79FB\u9664\uFF0C\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002",
        confirm_delete: '\u786E\u5B9A\u8981\u5220\u9664\u9879\u76EE "{{name}}" \u5417\uFF1F',
        project_applied: "\u9879\u76EE\u914D\u7F6E\u5E94\u7528\u6210\u529F",
        project_applied_no_content: "\u9879\u76EE\u914D\u7F6E\u5DF2\u5E94\u7528\uFF0C\u4F46\u5185\u5BB9\u8DEF\u5F84\u672A\u627E\u5230 - \u8BF7\u53F3\u952E\u70B9\u51FB\u6587\u4EF6\u5939/\u6587\u4EF6\u6DFB\u52A0\u5185\u5BB9",
        project_deleted: "\u9879\u76EE\u5DF2\u6210\u529F\u5220\u9664",
        view_site: "\u67E5\u770B\u7AD9\u70B9",
        export_build: "\u5BFC\u51FA",
        preview_not_found: "\u9884\u89C8\u76EE\u5F55\u672A\u627E\u5230\uFF0C\u53EF\u80FD\u5DF2\u88AB\u5220\u9664",
        just_now: "\u521A\u521A",
        minutes_ago: "{{count}} \u5206\u949F\u524D",
        hours_ago: "{{count}} \u5C0F\u65F6\u524D",
        days_ago: "{{count}} \u5929\u524D"
      },
      messages: {
        desktop_only_notice: "\u76EE\u524D\u4EC5\u652F\u6301\u684C\u9762\u7248\u672C\u3002",
        sync_not_enabled: "\u540C\u6B65\u672A\u542F\u7528\u3002\u8BF7\u5148\u5728\u8BBE\u7F6E\u4E2D\u542F\u7528\u540C\u6B65\u3002",
        publishing_desktop_only: "\u53D1\u5E03\u529F\u80FD\u4EC5\u5728\u684C\u9762\u7248\u672C\u53EF\u7528",
        site_assets_desktop_only: "\u8BBE\u7F6E\u7AD9\u70B9\u8D44\u6E90\u4EC5\u5728\u684C\u9762\u7248\u672C\u53EF\u7528",
        theme_selection_desktop_only: "\u4E3B\u9898\u9009\u62E9\u4EC5\u5728\u684C\u9762\u7248\u672C\u53EF\u7528",
        project_management_desktop_only: "\u9879\u76EE\u7BA1\u7406\u4EC5\u5728\u684C\u9762\u7248\u672C\u53EF\u7528",
        quick_share_desktop_only: "\u5FEB\u901F\u5206\u4EAB\u4EC5\u5728\u684C\u9762\u7248\u672C\u53EF\u7528",
        preview_url_copied: "\u9884\u89C8\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
        publish_url_copied: "\u53D1\u5E03\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
        build_started: "\u5F00\u59CB\u6784\u5EFA",
        build_completed: "\u6784\u5EFA\u6210\u529F\u5B8C\u6210",
        build_failed: "\u6784\u5EFA\u5931\u8D25",
        publish_started: "\u5F00\u59CB\u53D1\u5E03",
        publish_completed: "\u53D1\u5E03\u6210\u529F",
        publish_failed: "\u53D1\u5E03\u5931\u8D25",
        // Preview messages
        no_folder_selected: "\u672A\u9009\u62E9\u6587\u4EF6\u5939",
        no_folder_or_file_selected: "\u672A\u9009\u62E9\u6587\u4EF6\u5939\u6216\u6587\u4EF6",
        must_select_folder_type: '\u5185\u5BB9\u7C7B\u578B\u4E0D\u5339\u914D\uFF1A\u60A8\u4E4B\u524D\u9009\u62E9\u4E86\u6587\u4EF6\u5939\uFF0C\u73B0\u5728\u9009\u62E9\u4E86\u6587\u4EF6\u3002\u8981\u53D1\u5E03\u6587\u4EF6\uFF0C\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2\u7684"\u6E05\u7A7A"\u6309\u94AE\u79FB\u9664\u4E4B\u524D\u7684\u9009\u62E9\uFF0C\u7136\u540E\u53EA\u9009\u62E9\u6587\u4EF6\u3002',
        must_select_file_type: '\u5185\u5BB9\u7C7B\u578B\u4E0D\u5339\u914D\uFF1A\u60A8\u4E4B\u524D\u9009\u62E9\u4E86\u6587\u4EF6\uFF0C\u73B0\u5728\u9009\u62E9\u4E86\u6587\u4EF6\u5939\u3002\u8981\u53D1\u5E03\u6587\u4EF6\u5939\uFF0C\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2\u7684"\u6E05\u7A7A"\u6309\u94AE\u79FB\u9664\u4E4B\u524D\u7684\u9009\u62E9\uFF0C\u7136\u540E\u53EA\u9009\u62E9\u6587\u4EF6\u5939\u3002',
        all_content_cleared: "\u6240\u6709\u5185\u5BB9\u5DF2\u6210\u529F\u6E05\u7A7A",
        language_added_successfully: "\u8BED\u8A00\u5185\u5BB9\u6DFB\u52A0\u6210\u529F",
        please_use_publish_first: '\u8BF7\u5148\u5728\u6587\u4EF6\u5939\u6216\u6587\u4EF6\u4E0A\u4F7F\u7528"\u53D1\u5E03\u5230\u7F51\u7AD9"\u529F\u80FD',
        add_language_instruction: '\u53F3\u952E\u70B9\u51FB\u6587\u4EF6\u5939\u6216\u6587\u4EF6\u5E76\u9009\u62E9"\u53D1\u5E03\u5230\u7F51\u7AD9"\u4EE5\u6DFB\u52A0\u66F4\u591A\u8BED\u8A00',
        preview_generated_successfully: "\u9884\u89C8\u751F\u6210\u6210\u529F\uFF01",
        preview_failed: "\u9884\u89C8\u5931\u8D25\uFF1A{{error}}",
        please_generate_preview_first: "\u8BF7\u5148\u751F\u6210\u9884\u89C8",
        preview_data_missing: "\u9884\u89C8\u6570\u636E\u7F3A\u5931",
        site_published_successfully: "\u7AD9\u70B9\u53D1\u5E03\u6210\u529F\uFF01",
        publishing_failed: "\u53D1\u5E03\u5931\u8D25\uFF1A{{error}}",
        site_exported_successfully: "\u7AD9\u70B9\u5BFC\u51FA\u6210\u529F\u81F3\uFF1A{{path}}",
        export_failed: "\u5BFC\u51FA\u5931\u8D25\uFF1A{{error}}",
        incremental_upload_stats: "\u589E\u91CF\u4E0A\u4F20\uFF1A\u5DF2\u4E0A\u4F20 {{uploaded}} \u4E2A\uFF0C\u5DF2\u5220\u9664 {{deleted}} \u4E2A\uFF0C\u672A\u53D8\u5316 {{unchanged}} \u4E2A\uFF08\u8282\u7701\u7EA6 {{saved}}% \u65F6\u95F4\uFF09",
        // Netlify messages
        netlify_settings_missing: "\u8BF7\u5148\u914D\u7F6E Netlify \u8BBE\u7F6E",
        netlify_deploy_failed: "Netlify \u90E8\u7F72\u5931\u8D25\uFF1A{{error}}",
        netlify_deploy_success: "\u7AD9\u70B9\u5DF2\u6210\u529F\u90E8\u7F72\u5230 Netlify\uFF01",
        // FTP messages
        ftp_settings_missing: "\u8BF7\u5148\u914D\u7F6E FTP \u8BBE\u7F6E",
        ftp_upload_failed: "FTP \u4E0A\u4F20\u5931\u8D25\uFF1A{{error}}",
        ftp_upload_success: "\u7AD9\u70B9\u5DF2\u6210\u529F\u4E0A\u4F20\u5230 FTP \u670D\u52A1\u5668\uFF01",
        ftp_fallback_to_plain: "\u670D\u52A1\u5668\u4E0D\u652F\u6301\u52A0\u5BC6\uFF0C\u5DF2\u5207\u6362\u5230\u666E\u901A FTP",
        ftp_fallback_to_full: "\u26A0\uFE0F \u589E\u91CF\u4E0A\u4F20\u5931\u8D25\uFF0C\u6B63\u5728\u5C1D\u8BD5\u5B8C\u6574\u4E0A\u4F20\u4F5C\u4E3A\u5907\u9009\u65B9\u6848...",
        // Quick share messages
        no_markdown_file: "\u8BF7\u5148\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6",
        license_required_for_share: "\u8BF7\u5148\u6FC0\u6D3B\u8BB8\u53EF\u8BC1\u4EE5\u4F7F\u7528\u5FEB\u901F\u5206\u4EAB\u529F\u80FD",
        quick_share_starting: "\u{1F680} \u6B63\u5728\u51C6\u5907\u5FEB\u901F\u5206\u4EAB...",
        preview_failed_generic: "\u9884\u89C8\u751F\u6210\u5931\u8D25",
        quick_share_ready: "\u2705 \u51C6\u5907\u5C31\u7EEA\uFF01\u70B9\u51FB\u300C\u53D1\u5E03\u300D\u5373\u53EF\u5206\u4EAB\u60A8\u7684\u7B14\u8BB0",
        quick_share_failed: "\u5FEB\u901F\u5206\u4EAB\u5931\u8D25\uFF1A{{error}}",
        // User messages
        enter_email_password: "\u8BF7\u8F93\u5165\u60A8\u7684\u90AE\u7BB1\u548C\u5BC6\u7801",
        enter_valid_email: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740",
        login_failed: "\u767B\u5F55\u5931\u8D25",
        register_failed: "\u6CE8\u518C\u7528\u6237\u5931\u8D25",
        // Site assets messages
        invalid_assets_folder: "\u65E0\u6548\u7684\u8D44\u6E90\u6587\u4EF6\u5939",
        site_assets_set_successfully: "\u7AD9\u70B9\u8D44\u6E90\u8BBE\u7F6E\u6210\u529F",
        site_assets_cleared: "\u7AD9\u70B9\u8D44\u6E90\u5DF2\u6E05\u9664",
        // Sample download messages
        sample_downloaded_successfully: '\u4E3B\u9898\u6837\u4F8B "{{themeName}}" \u4E0B\u8F7D\u6210\u529F\uFF01\u5DF2\u4FDD\u5B58\u5230\u6587\u4EF6\u5939\uFF1A{{folderName}}',
        sample_download_failed: "\u6837\u4F8B\u4E0B\u8F7D\u5931\u8D25\uFF1A{{error}}",
        // Structured folder messages
        structured_folder_processed: '\u68C0\u6D4B\u5230\u7ED3\u6784\u5316\u6587\u4EF6\u5939 "{{folderName}}"\uFF0C\u5DF2\u81EA\u52A8\u6DFB\u52A0 {{contentCount}} \u4E2A\u8BED\u8A00\u5185\u5BB9',
        static_folder_detected: "\u5E76\u68C0\u6D4B\u5230\u9759\u6001\u8D44\u6E90\u6587\u4EF6\u5939",
        // General messages
        failed_to_create_post: "\u521B\u5EFA\u6587\u7AE0\u5931\u8D25\u3002",
        failed_to_create_resource: "\u521B\u5EFA\u8D44\u6E90\u5931\u8D25\u3002"
      },
      info: {
        service_description: "\u4F60\u7684\u6570\u636E\uFF0C\u4F60\u638C\u63A7 \u2014\u2014 \u4F60\u7684\u7B14\u8BB0\u3001\u4F60\u7684\u4E3B\u9898\u3001\u4F60\u7684\u4E91\u7AEF\u3002\nMDFriday \u8BA9\u4F60\u81EA\u7531\u6784\u5EFA\u4E0E\u53D1\u5E03\uFF0C\u5B8C\u5168\u638C\u63E1\u5168\u6D41\u7A0B\u3002",
        learn_more: "\u4E86\u89E3\u66F4\u591A"
      },
      common: {
        loading: "\u52A0\u8F7D\u4E2D...",
        success: "\u6210\u529F",
        error: "\u9519\u8BEF",
        cancel: "\u53D6\u6D88",
        confirm: "\u786E\u8BA4",
        save: "\u4FDD\u5B58",
        close: "\u5173\u95ED",
        copy: "\u590D\u5236",
        copied: "\u5DF2\u590D\u5236\uFF01"
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/common/logger.js
function setGlobalLogFunction(logger) {
  _logger = logger;
}
function Logger(message, level, key4) {
  _logger(message, level, key4);
}
function __logger(message, baseLevel, flagsOrKey, key4) {
  let level = baseLevel;
  if (typeof flagsOrKey == "string") {
    key4 = flagsOrKey;
  } else if (flagsOrKey !== void 0) {
    level |= flagsOrKey;
  }
  _logger(message, level, key4);
}
function info(message, flagsOrKey, key4) {
  __logger(message, LEVEL_INFO, flagsOrKey, key4);
}
var LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_KIND_DEBUG, LOG_KIND_VERBOSE, LOG_KIND_WARNING, LOG_KIND_ERROR, LEVEL_INFO, defaultLoggerEnv, defaultLogger, _logger;
var init_logger = __esm({
  "node_modules/octagonal-wheels/dist/common/logger.js"() {
    LOG_LEVEL_DEBUG = -1;
    LOG_LEVEL_VERBOSE = 16;
    LOG_LEVEL_INFO = 32;
    LOG_LEVEL_NOTICE = 64;
    LOG_KIND_DEBUG = 1;
    LOG_KIND_VERBOSE = 2;
    LOG_KIND_WARNING = 4;
    LOG_KIND_ERROR = 8;
    LEVEL_INFO = LOG_LEVEL_INFO;
    defaultLoggerEnv = {
      minLogLevel: LOG_LEVEL_INFO
    };
    defaultLogger = function defaultLogger2(message, level = LEVEL_INFO, key4) {
      if (level < defaultLoggerEnv.minLogLevel) {
        return;
      }
      const now = /* @__PURE__ */ new Date();
      const timestamp = now.toLocaleString();
      const messageContent = typeof message == "string" ? message : message instanceof Error ? `${message.name}:${message.message}` : JSON.stringify(message, null, 2);
      const newMessage = `${timestamp}	${level}	${messageContent}`;
      if (level & LOG_KIND_DEBUG) {
        console.debug(newMessage);
      } else if (level & LOG_KIND_WARNING) {
        console.warn(newMessage);
      } else if (level & LOG_KIND_ERROR) {
        console.error(newMessage);
      } else if (level & LOG_KIND_VERBOSE) {
        console.info(newMessage);
      } else {
        console.log(newMessage);
      }
      if (message instanceof Error) {
        console.dir(message.stack);
      }
    };
    _logger = defaultLogger;
  }
});

// src/sync/core/common/logger.ts
var init_logger2 = __esm({
  "src/sync/core/common/logger.ts"() {
    "use strict";
    init_logger();
  }
});

// src/sync/core/common/messagesJson/en.json
var en_default;
var init_en2 = __esm({
  "src/sync/core/common/messagesJson/en.json"() {
    en_default = {
      "(BETA) Always overwrite with a newer file": "(BETA) Always overwrite with a newer file",
      "(Beta) Use ignore files": "(Beta) Use ignore files",
      "(Days passed, 0 to disable automatic-deletion)": "(Days passed, 0 to disable automatic-deletion)",
      "(ex. Read chunks online) If this option is enabled, LiveSync reads chunks online directly instead of replicating them locally. Increasing Custom chunk size is recommended.": "(ex. Read chunks online) If this option is enabled, LiveSync reads chunks online directly instead of replicating them locally. Increasing Custom chunk size is recommended.",
      "(MB) If this is set, changes to local and remote files that are larger than this will be skipped. If the file becomes smaller again, a newer one will be used.": "(MB) If this is set, changes to local and remote files that are larger than this will be skipped. If the file becomes smaller again, a newer one will be used.",
      "(Mega chars)": "(Mega chars)",
      "(Not recommended) If set, credentials will be stored in the file.": "(Not recommended) If set, credentials will be stored in the file.",
      "(Obsolete) Use an old adapter for compatibility": "(Obsolete) Use an old adapter for compatibility",
      "Access Key": "Access Key",
      "Always prompt merge conflicts": "Always prompt merge conflicts",
      "Apply Latest Change if Conflicting": "Apply Latest Change if Conflicting",
      "Apply preset configuration": "Apply preset configuration",
      "Automatically Sync all files when opening Obsidian.": "Automatically Sync all files when opening Obsidian.",
      "Batch database update": "Batch database update",
      "Batch limit": "Batch limit",
      "Batch size": "Batch size",
      "Batch size of on-demand fetching": "Batch size of on-demand fetching",
      "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.": "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.",
      "Bucket Name": "Bucket Name",
      "cmdConfigSync.showCustomizationSync": "Show Customization sync",
      "Comma separated `.gitignore, .dockerignore`": "Comma separated `.gitignore, .dockerignore`",
      "Compute revisions for chunks": "Compute revisions for chunks",
      "Data Compression": "Data Compression",
      "Database Name": "Database Name",
      "Database suffix": "Database suffix",
      "Delay conflict resolution of inactive files": "Delay conflict resolution of inactive files",
      "Delay merge conflict prompt for inactive files.": "Delay merge conflict prompt for inactive files.",
      "Delete old metadata of deleted files on start-up": "Delete old metadata of deleted files on start-up",
      "Device name": "Device name",
      "dialog.yourLanguageAvailable": "Self-hosted LiveSync had translations for your language, so the %{Display language} setting was enabled.\n\nNote: Not all messages are translated. We are waiting for your contributions!\nNote 2: If you create an Issue, **please revert to %{lang-def}** and then take screenshots, messages and logs. This can be done in the setting dialogue.\nMay you find it easy to use!",
      "dialog.yourLanguageAvailable.btnRevertToDefault": "Keep %{lang-def}",
      "dialog.yourLanguageAvailable.Title": " Translation is available!",
      "Disables logging, only shows notifications. Please disable if you report an issue.": "Disables logging, only shows notifications. Please disable if you report an issue.",
      "Display Language": "Display Language",
      "Do not check configuration mismatch before replication": "Do not check configuration mismatch before replication",
      "Do not keep metadata of deleted files.": "Do not keep metadata of deleted files.",
      "Do not split chunks in the background": "Do not split chunks in the background",
      "Do not use internal API": "Do not use internal API",
      "Doctor.Button.DismissThisVersion": "No, and do not ask again until the next release",
      "Doctor.Button.Fix": "Fix it",
      "Doctor.Button.FixButNoRebuild": "Fix it but no rebuild",
      "Doctor.Button.No": "No",
      "Doctor.Button.Skip": "Leave it as is",
      "Doctor.Button.Yes": "Yes",
      "Doctor.Dialogue.Main": "Hi! Config Doctor has been activated because of ${activateReason}!\nAnd, unfortunately some configurations were detected as potential problems.\nPlease be assured. Let's solve them one by one.\n\nTo let you know ahead of time, we will ask you about the following items.\n\n${issues}\n\nShall we get started?",
      "Doctor.Dialogue.MainFix": "\n## ${name}\n\n| Current | Ideal |\n|:---:|:---:|\n| ${current} | ${ideal} |\n\n**Recommendation Level:** ${level}\n\n### Why this has been detected?\n\n${reason}\n\n${note}\n\nFix this to the ideal value?",
      "Doctor.Dialogue.Title": "Self-hosted LiveSync Config Doctor",
      "Doctor.Dialogue.TitleAlmostDone": "Almost done!",
      "Doctor.Dialogue.TitleFix": "Fix issue ${current}/${total}",
      "Doctor.Level.Must": "Must",
      "Doctor.Level.Necessary": "Necessary",
      "Doctor.Level.Optional": "Optional",
      "Doctor.Level.Recommended": "Recommended",
      "Doctor.Message.NoIssues": "No issues detected!",
      "Doctor.Message.RebuildLocalRequired": "Attention! A local database rebuild is required to apply this!",
      "Doctor.Message.RebuildRequired": "Attention! A rebuild is required to apply this!",
      "Doctor.Message.SomeSkipped": "We left some issues as is. Shall I ask you again on next startup?",
      "Doctor.RULES.E2EE_V02500.REASON": "The End-to-End Encryption has got now more robust and faster. Also because, the previous E2EE was found to be compromised in a re-conducted code review. It should be applied as soon as possible. Really apologises for your inconvenience. And, this setting is not forward compatible. All synchronised devices must be updated to v0.25.0 or higher. Rebuilds are not required and will be converted from the new transfer to the new format, However, it is recommended to rebuild whenever possible.",
      "Enable advanced features": "Enable advanced features",
      "Enable customization sync": "Enable customization sync",
      "Enable Developers' Debug Tools.": "Enable Developers' Debug Tools.",
      "Enable edge case treatment features": "Enable edge case treatment features",
      "Enable poweruser features": "Enable poweruser features",
      "Enable this if your Object Storage doesn't support CORS": "Enable this if your Object Storage doesn't support CORS",
      "Enable this option to automatically apply the most recent change to documents even when it conflicts": "Enable this option to automatically apply the most recent change to documents even when it conflicts",
      "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.": "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.",
      "Encrypting sensitive configuration items": "Encrypting sensitive configuration items",
      "Encryption phassphrase. If changed, you should overwrite the server's database with the new (encrypted) files.": "Encryption phassphrase. If changed, you should overwrite the server's database with the new (encrypted) files.",
      "End-to-End Encryption": "End-to-End Encryption",
      "Endpoint URL": "Endpoint URL",
      "Enhance chunk size": "Enhance chunk size",
      "Fetch chunks on demand": "Fetch chunks on demand",
      "Fetch database with previous behaviour": "Fetch database with previous behaviour",
      Filename: "Filename",
      "Forces the file to be synced when opened.": "Forces the file to be synced when opened.",
      "Handle files as Case-Sensitive": "Handle files as Case-Sensitive",
      "If disabled(toggled), chunks will be split on the UI thread (Previous behaviour).": "If disabled(toggled), chunks will be split on the UI thread (Previous behaviour).",
      "If enabled per-filed efficient customization sync will be used. We need a small migration when enabling this. And all devices should be updated to v0.23.18. Once we enabled this, we lost a compatibility with old versions.": "If enabled per-filed efficient customization sync will be used. We need a small migration when enabling this. And all devices should be updated to v0.23.18. Once we enabled this, we lost a compatibility with old versions.",
      "If enabled, chunks will be split into no more than 100 items. However, dedupe is slightly weaker.": "If enabled, chunks will be split into no more than 100 items. However, dedupe is slightly weaker.",
      "If enabled, newly created chunks are temporarily kept within the document, and graduated to become independent chunks once stabilised.": "If enabled, newly created chunks are temporarily kept within the document, and graduated to become independent chunks once stabilised.",
      "If enabled, the file under 1kb will be processed in the UI thread.": "If enabled, the file under 1kb will be processed in the UI thread.",
      "If enabled, the notification of hidden files change will be suppressed.": "If enabled, the notification of hidden files change will be suppressed.",
      "If this enabled, all chunks will be stored with the revision made from its content. (Previous behaviour)": "If this enabled, all chunks will be stored with the revision made from its content. (Previous behaviour)",
      "If this enabled, All files are handled as case-Sensitive (Previous behaviour).": "If this enabled, All files are handled as case-Sensitive (Previous behaviour).",
      "If this enabled, chunks will be split into semantically meaningful segments. Not all platforms support this feature.": "If this enabled, chunks will be split into semantically meaningful segments. Not all platforms support this feature.",
      "If this is set, changes to local files which are matched by the ignore files will be skipped. Remote changes are determined using local ignore files.": "If this is set, changes to local files which are matched by the ignore files will be skipped. Remote changes are determined using local ignore files.",
      "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.": "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.",
      "Ignore files": "Ignore files",
      "Incubate Chunks in Document": "Incubate Chunks in Document",
      "Interval (sec)": "Interval (sec)",
      "K.exp": "Experimental",
      "K.long_p2p_sync": "%{title_p2p_sync} (%{exp})",
      "K.P2P": "%{Peer}-to-%{Peer}",
      "K.Peer": "Peer",
      "K.ScanCustomization": "Scan customization",
      "K.short_p2p_sync": "P2P Sync (%{exp})",
      "K.title_p2p_sync": "Peer-to-Peer Sync",
      "Keep empty folder": "Keep empty folder",
      lang_def: "Default",
      "lang-de": "Deutsche",
      "lang-def": "%{lang_def}",
      "lang-es": "Espa\xF1ol",
      "lang-ja": "\u65E5\u672C\u8A9E",
      "lang-ko": "\uD55C\uAD6D\uC5B4",
      "lang-ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
      "lang-zh": "\u7B80\u4F53\u4E2D\u6587",
      "lang-zh-tw": "\u7E41\u9AD4\u4E2D\u6587",
      "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.": "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.",
      "liveSyncReplicator.beforeLiveSync": "Before LiveSync, start OneShot once...",
      "liveSyncReplicator.cantReplicateLowerValue": "We can't replicate more lower value.",
      "liveSyncReplicator.checkingLastSyncPoint": "Looking for the point last synchronized point.",
      "liveSyncReplicator.couldNotConnectTo": "Could not connect to ${uri} : ${name}\n(${db})",
      "liveSyncReplicator.couldNotConnectToRemoteDb": "Could not connect to remote database: ${d}",
      "liveSyncReplicator.couldNotConnectToServer": "Could not connect to server.",
      "liveSyncReplicator.couldNotConnectToURI": "Could not connect to ${uri}:${dbRet}",
      "liveSyncReplicator.couldNotMarkResolveRemoteDb": "Could not mark resolve remote database.",
      "liveSyncReplicator.liveSyncBegin": "LiveSync begin...",
      "liveSyncReplicator.lockRemoteDb": "Lock remote database to prevent data corruption",
      "liveSyncReplicator.markDeviceResolved": "Mark this device as 'resolved'.",
      "liveSyncReplicator.oneShotSyncBegin": "OneShot Sync begin... (${syncMode})",
      "liveSyncReplicator.remoteDbCorrupted": "Remote database is newer or corrupted, make sure to latest version of self-hosted-livesync installed",
      "liveSyncReplicator.remoteDbCreatedOrConnected": "Remote Database Created or Connected",
      "liveSyncReplicator.remoteDbDestroyed": "Remote Database Destroyed",
      "liveSyncReplicator.remoteDbDestroyError": "Something happened on Remote Database Destroy:",
      "liveSyncReplicator.remoteDbMarkedResolved": "Remote database has been marked resolved.",
      "liveSyncReplicator.replicationClosed": "Replication closed",
      "liveSyncReplicator.replicationInProgress": "Replication is already in progress",
      "liveSyncReplicator.retryLowerBatchSize": "Retry with lower batch size:${batch_size}/${batches_limit}",
      "liveSyncReplicator.unlockRemoteDb": "Unlock remote database to prevent data corruption",
      "liveSyncSetting.errorNoSuchSettingItem": "No such setting item: ${key}",
      "liveSyncSetting.originalValue": "Original: ${value}",
      "liveSyncSetting.valueShouldBeInRange": "The value should ${min} < value < ${max}",
      "liveSyncSettings.btnApply": "Apply",
      "logPane.autoScroll": "Auto scroll",
      "logPane.logWindowOpened": "Log window opened",
      "logPane.pause": "Pause",
      "logPane.title": "Self-hosted LiveSync Log",
      "logPane.wrap": "Wrap",
      "Maximum delay for batch database updating": "Maximum delay for batch database updating",
      "Maximum file size": "Maximum file size",
      "Maximum Incubating Chunk Size": "Maximum Incubating Chunk Size",
      "Maximum Incubating Chunks": "Maximum Incubating Chunks",
      "Maximum Incubation Period": "Maximum Incubation Period",
      "MB (0 to disable).": "MB (0 to disable).",
      "Memory cache size (by total characters)": "Memory cache size (by total characters)",
      "Memory cache size (by total items)": "Memory cache size (by total items)",
      "Minimum delay for batch database updating": "Minimum delay for batch database updating",
      "moduleCheckRemoteSize.logCheckingStorageSizes": "Checking storage sizes",
      "moduleCheckRemoteSize.logCurrentStorageSize": "Remote storage size: ${measuredSize}",
      "moduleCheckRemoteSize.logExceededWarning": "Remote storage size: ${measuredSize} exceeded ${notifySize}",
      "moduleCheckRemoteSize.logThresholdEnlarged": "Threshold has been enlarged to ${size}MB",
      "moduleCheckRemoteSize.msgConfirmRebuild": "This may take a bit of a long time. Do you really want to rebuild everything now?",
      "moduleCheckRemoteSize.msgDatabaseGrowing": "**Your database is getting larger!** But do not worry, we can address it now. The time before running out of space on the remote storage.\n\n| Measured size | Configured size |\n| --- | --- |\n| ${estimatedSize} | ${maxSize} |\n\n> [!MORE]-\n> If you have been using it for many years, there may be unreferenced chunks - that is, garbage - accumulating in the database. Therefore, we recommend rebuilding everything. It will probably become much smaller.\n>\n> If the volume of your vault is simply increasing, it is better to rebuild everything after organizing the files. Self-hosted LiveSync does not delete the actual data even if you delete it to speed up the process. It is roughly [documented](https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/tech_info.md).\n>\n> If you don't mind the increase, you can increase the notification limit by 100MB. This is the case if you are running it on your own server. However, it is better to rebuild everything from time to time.\n>\n\n> [!WARNING]\n> If you perform rebuild everything, make sure all devices are synchronised. The plug-in will merge as much as possible, though.\n",
      "moduleCheckRemoteSize.msgSetDBCapacity": "We can set a maximum database capacity warning, **to take action before running out of space on the remote storage**.\nDo you want to enable this?\n\n> [!MORE]-\n> - 0: Do not warn about storage size.\n>   This is recommended if you have enough space on the remote storage especially you have self-hosted. And you can check the storage size and rebuild manually.\n> - 800: Warn if the remote storage size exceeds 800MB.\n>   This is recommended if you are using fly.io with 1GB limit or IBM Cloudant.\n> - 2000: Warn if the remote storage size exceeds 2GB.\n\nIf we have reached the limit, we will be asked to enlarge the limit step by step.\n",
      "moduleCheckRemoteSize.option2GB": "2GB (Standard)",
      "moduleCheckRemoteSize.option800MB": "800MB (Cloudant, fly.io)",
      "moduleCheckRemoteSize.optionAskMeLater": "Ask me later",
      "moduleCheckRemoteSize.optionDismiss": "Dismiss",
      "moduleCheckRemoteSize.optionIncreaseLimit": "increase to ${newMax}MB",
      "moduleCheckRemoteSize.optionNoWarn": "No, never warn please",
      "moduleCheckRemoteSize.optionRebuildAll": "Rebuild Everything Now",
      "moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded": "Remote storage size exceeded the limit",
      "moduleCheckRemoteSize.titleDatabaseSizeNotify": "Setting up database size notification",
      "moduleInputUIObsidian.defaultTitleConfirmation": "Confirmation",
      "moduleInputUIObsidian.defaultTitleSelect": "Select",
      "moduleInputUIObsidian.optionNo": "No",
      "moduleInputUIObsidian.optionYes": "Yes",
      "moduleLiveSyncMain.logAdditionalSafetyScan": "Additional safety scan...",
      "moduleLiveSyncMain.logLoadingPlugin": "Loading plugin...",
      "moduleLiveSyncMain.logPluginInitCancelled": "Plugin initialisation was cancelled by a module",
      "moduleLiveSyncMain.logPluginVersion": "Self-hosted LiveSync v${manifestVersion} ${packageVersion}",
      "moduleLiveSyncMain.logReadChangelog": "LiveSync has updated, please read the changelog!",
      "moduleLiveSyncMain.logSafetyScanCompleted": "Additional safety scan completed",
      "moduleLiveSyncMain.logSafetyScanFailed": "Additional safety scan has failed on a module",
      "moduleLiveSyncMain.logUnloadingPlugin": "Unloading plugin...",
      "moduleLiveSyncMain.logVersionUpdate": "LiveSync has been updated, In case of breaking updates, all automatic synchronization has been temporarily disabled. Ensure that all devices are up to date before enabling.",
      "moduleLiveSyncMain.msgScramEnabled": "Self-hosted LiveSync has been configured to ignore some events. Is this correct?\n\n| Type | Status | Note |\n|:---:|:---:|---|\n| Storage Events | ${fileWatchingStatus} | Every modification will be ignored |\n| Database Events | ${parseReplicationStatus} | Every synchronised change will be postponed |\n\nDo you want to resume them and restart Obsidian?\n\n> [!DETAILS]-\n> These flags are set by the plug-in while rebuilding, or fetching. If the process ends abnormally, it may be kept unintended.\n> If you are not sure, you can try to rerun these processes. Make sure to back your vault up.\n",
      "moduleLiveSyncMain.optionKeepLiveSyncDisabled": "Keep LiveSync disabled",
      "moduleLiveSyncMain.optionResumeAndRestart": "Resume and restart Obsidian",
      "moduleLiveSyncMain.titleScramEnabled": "Scram Enabled",
      "moduleLocalDatabase.logWaitingForReady": "Waiting for ready...",
      "moduleLog.showLog": "Show Log",
      "moduleMigration.docUri": "https://github.com/vrtmrz/obsidian-livesync/blob/main/README.md#how-to-use",
      "moduleMigration.fix0256.buttons.checkItLater": "Check it later",
      "moduleMigration.fix0256.buttons.DismissForever": "I have fixed it, and do not ask again",
      "moduleMigration.fix0256.buttons.fix": "Fix",
      "moduleMigration.fix0256.message": 'Due to a recent bug (in v0.25.6), some files may not have been saved correctly in the sync database.\nWe have scanned our files and found some that need to be fixed.\n\n**Files ready to be fixed:**\n\n${files}\n\nThese files have size-matched original file on the storage, and are likely to be recoverable.\nWe can use them to fix the database, please click the "Fix" button below to fix them.\n\n${messageUnrecoverable}\n\nIf you want to run it again, you can do so from Hatch.\n',
      "moduleMigration.fix0256.messageUnrecoverable": "**Files cannot be fixed on this device:**\n\n${filesNotRecoverable}\n\nThese files have inconsistent metadata, and cannot be fixed on this device (mostly we cannot determine which is correct).\nTo restore them, please check your other devices (also by this feature) or restore them manually from a backup.\n",
      "moduleMigration.fix0256.title": "Broken files has been detected",
      "moduleMigration.insecureChunkExist.buttons.fetch": "I already rebuilt the remote. Fetch from the remote",
      "moduleMigration.insecureChunkExist.buttons.later": "I will do it later",
      "moduleMigration.insecureChunkExist.buttons.rebuild": "Rebuild Everything",
      "moduleMigration.insecureChunkExist.laterMessage": "We strongly recommend to treat this as soon as possible!",
      "moduleMigration.insecureChunkExist.message": "Some chunks are not securely stored and are not encrypted in databases.\n**Please rebuild the database to fix this issue**.\n\nIf your Remote Database is not configured with SSL, or using less-secure credentials, **you are at risk of exposing sensitive data**.\n\nNote: Please upgrade your Self-hosted LiveSync v0.25.6 or higher on all your devices, and back your vault up surely.\nNote2: Rebuild Everything and Fetch consumes a bit of time and traffic, please do it in off-peak hours and ensure a stable network connection.\n",
      "moduleMigration.insecureChunkExist.title": "Insecure chunks found!",
      "moduleMigration.logBulkSendCorrupted": "Send chunks in bulk has been enabled, however, this feature had been corrupted. Sorry for your inconvenience. Automatically disabled.",
      "moduleMigration.logFetchRemoteTweakFailed": "Failed to fetch remote tweak values",
      "moduleMigration.logLocalDatabaseNotReady": "Something went wrong! The local database is not ready",
      "moduleMigration.logMigratedSameBehaviour": "Migrated to db:${current} with the same behaviour as before",
      "moduleMigration.logMigrationFailed": "Migration failed or cancelled from ${old} to ${current}",
      "moduleMigration.logRedflag2CreationFail": "Failed to create redflag2",
      "moduleMigration.logRemoteTweakUnavailable": "Could not get remote tweak values",
      "moduleMigration.logSetupCancelled": "The setup has been cancelled, Self-hosted LiveSync waiting for your setup!",
      "moduleMigration.msgFetchRemoteAgain": "As you may already know, the self-hosted LiveSync has changed its default behaviour and database structure.\n\nAnd thankfully, with your time and efforts, the remote database appears to have already been migrated. Congratulations!\n\nHowever, we need a bit more. The configuration of this device is not compatible with the remote database. We will need to fetch the remote database again. Should we fetch from the remote again now?\n\n___Note: We cannot synchronise until the configuration has been changed and the database has been fetched again.___\n___Note2: The chunks are completely immutable, we can fetch only the metadata and difference.___",
      "moduleMigration.msgInitialSetup": "Your device has **not been set up yet**. Let me guide you through the setup process.\n\nPlease keep in mind that every dialogue content can be copied to the clipboard. If you need to refer to it later, you can paste it into a note in Obsidian. You can also translate it into your language using a translation tool.\n\nFirst, do you have **Setup URI**?\n\nNote: If you do not know what it is, please refer to the [documentation](${URI_DOC}).",
      "moduleMigration.msgRecommendSetupUri": "We strongly recommend that you generate a set-up URI and use it.\nIf you do not have knowledge about it, please refer to the [documentation](${URI_DOC}) (Sorry again, but it is important).\n\nHow do you want to set it up manually?",
      "moduleMigration.msgSinceV02321": "Since v0.23.21, the self-hosted LiveSync has changed the default behaviour and database structure. The following changes have been made:\n\n1. **Case sensitivity of filenames**\n   The handling of filenames is now case-insensitive. This is a beneficial change for most platforms, other than Linux and iOS, which do not manage filename case sensitivity effectively.\n   (On These, a warning will be displayed for files with the same name but different cases).\n\n2. **Revision handling of the chunks**\n   Chunks are immutable, which allows their revisions to be fixed. This change will enhance the performance of file saving.\n\n___However, to enable either of these changes, both remote and local databases need to be rebuilt. This process takes a few minutes, and we recommend doing it when you have ample time.___\n\n- If you wish to maintain the previous behaviour, you can skip this process by using `${KEEP}`.\n- If you do not have enough time, please choose `${DISMISS}`. You will be prompted again later.\n- If you have rebuilt the database on another device, please select `${DISMISS}` and try synchronizing again. Since a difference has been detected, you will be prompted again.",
      "moduleMigration.optionAdjustRemote": "Adjust to remote",
      "moduleMigration.optionDecideLater": "Decide it later",
      "moduleMigration.optionEnableBoth": "Enable both",
      "moduleMigration.optionEnableFilenameCaseInsensitive": "Enable only #1",
      "moduleMigration.optionEnableFixedRevisionForChunks": "Enable only #2",
      "moduleMigration.optionHaveSetupUri": "Yes, I have",
      "moduleMigration.optionKeepPreviousBehaviour": "Keep previous behaviour",
      "moduleMigration.optionManualSetup": "Set it up all manually",
      "moduleMigration.optionNoAskAgain": "No, please ask again",
      "moduleMigration.optionNoSetupUri": "No, I do not have",
      "moduleMigration.optionRemindNextLaunch": "Remind me at the next launch",
      "moduleMigration.optionSetupViaP2P": "Use %{short_p2p_sync} to set up",
      "moduleMigration.optionSetupWizard": "Take me into the setup wizard",
      "moduleMigration.optionYesFetchAgain": "Yes, fetch again",
      "moduleMigration.titleCaseSensitivity": "Case Sensitivity",
      "moduleMigration.titleRecommendSetupUri": "Recommendation to use Setup URI",
      "moduleMigration.titleWelcome": "Welcome to Self-hosted LiveSync",
      "moduleObsidianMenu.replicate": "Replicate",
      "Move remotely deleted files to the trash, instead of deleting.": "Move remotely deleted files to the trash, instead of deleting.",
      'Not all messages have been translated. And, please revert to "Default" when reporting errors.': 'Not all messages have been translated. And, please revert to "Default" when reporting errors.',
      "Notify all setting files": "Notify all setting files",
      "Notify customized": "Notify customized",
      "Notify when other device has newly customized.": "Notify when other device has newly customized.",
      "Notify when the estimated remote storage size exceeds on start up": "Notify when the estimated remote storage size exceeds on start up",
      "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.": "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.",
      "Number of changes to sync at a time. Defaults to 50. Minimum is 2.": "Number of changes to sync at a time. Defaults to 50. Minimum is 2.",
      "obsidianLiveSyncSettingTab.btnApply": "Apply",
      "obsidianLiveSyncSettingTab.btnCheck": "Check",
      "obsidianLiveSyncSettingTab.btnCopy": "Copy",
      "obsidianLiveSyncSettingTab.btnDisable": "Disable",
      "obsidianLiveSyncSettingTab.btnDiscard": "Discard",
      "obsidianLiveSyncSettingTab.btnEnable": "Enable",
      "obsidianLiveSyncSettingTab.btnFix": "Fix",
      "obsidianLiveSyncSettingTab.btnGotItAndUpdated": "I got it and updated.",
      "obsidianLiveSyncSettingTab.btnNext": "Next",
      "obsidianLiveSyncSettingTab.btnStart": "Start",
      "obsidianLiveSyncSettingTab.btnTest": "Test",
      "obsidianLiveSyncSettingTab.btnUse": "Use",
      "obsidianLiveSyncSettingTab.buttonFetch": "Fetch",
      "obsidianLiveSyncSettingTab.buttonNext": "Next",
      "obsidianLiveSyncSettingTab.defaultLanguage": "Default",
      "obsidianLiveSyncSettingTab.descConnectSetupURI": "This is the recommended method to set up Self-hosted LiveSync with a Setup URI.",
      "obsidianLiveSyncSettingTab.descCopySetupURI": "Perfect for setting up a new device!",
      "obsidianLiveSyncSettingTab.descEnableLiveSync": "Only enable this after configuring either of the above two options or completing all configuration manually.",
      "obsidianLiveSyncSettingTab.descFetchConfigFromRemote": "Fetch necessary settings from already configured remote server.",
      "obsidianLiveSyncSettingTab.descManualSetup": "Not recommended, but useful if you don't have a Setup URI",
      "obsidianLiveSyncSettingTab.descTestDatabaseConnection": "Open database connection. If the remote database is not found and you have permission to create a database, the database will be created.",
      "obsidianLiveSyncSettingTab.descValidateDatabaseConfig": "Checks and fixes any potential issues with the database config.",
      "obsidianLiveSyncSettingTab.errAccessForbidden": "\u2757 Access forbidden.",
      "obsidianLiveSyncSettingTab.errCannotContinueTest": "We could not continue the test.",
      "obsidianLiveSyncSettingTab.errCorsCredentials": "\u2757 cors.credentials is wrong",
      "obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials": "\u2757 CORS is not allowing credentials",
      "obsidianLiveSyncSettingTab.errCorsOrigins": "\u2757 cors.origins is wrong",
      "obsidianLiveSyncSettingTab.errEnableCors": "\u2757 httpd.enable_cors is wrong",
      "obsidianLiveSyncSettingTab.errEnableCorsChttpd": "\u2757 chttpd.enable_cors is wrong",
      "obsidianLiveSyncSettingTab.errMaxDocumentSize": "\u2757 couchdb.max_document_size is low)",
      "obsidianLiveSyncSettingTab.errMaxRequestSize": "\u2757 chttpd.max_http_request_size is low)",
      "obsidianLiveSyncSettingTab.errMissingWwwAuth": "\u2757 httpd.WWW-Authenticate is missing",
      "obsidianLiveSyncSettingTab.errRequireValidUser": "\u2757 chttpd.require_valid_user is wrong.",
      "obsidianLiveSyncSettingTab.errRequireValidUserAuth": "\u2757 chttpd_auth.require_valid_user is wrong.",
      "obsidianLiveSyncSettingTab.labelDisabled": "\u23F9\uFE0F : Disabled",
      "obsidianLiveSyncSettingTab.labelEnabled": "\u{1F501} : Enabled",
      "obsidianLiveSyncSettingTab.levelAdvanced": " (Advanced)",
      "obsidianLiveSyncSettingTab.levelEdgeCase": " (Edge Case)",
      "obsidianLiveSyncSettingTab.levelPowerUser": " (Power User)",
      "obsidianLiveSyncSettingTab.linkOpenInBrowser": "Open in browser",
      "obsidianLiveSyncSettingTab.linkPageTop": "Page Top",
      "obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting": "Tips and Troubleshooting",
      "obsidianLiveSyncSettingTab.linkTroubleshooting": "/docs/troubleshooting.md",
      "obsidianLiveSyncSettingTab.logCannotUseCloudant": "This feature cannot be used with IBM Cloudant.",
      "obsidianLiveSyncSettingTab.logCheckingConfigDone": "Checking configuration done",
      "obsidianLiveSyncSettingTab.logCheckingConfigFailed": "Checking configuration failed",
      "obsidianLiveSyncSettingTab.logCheckingDbConfig": "Checking database configuration",
      "obsidianLiveSyncSettingTab.logCheckPassphraseFailed": "ERROR: Failed to check passphrase with the remote server:\n${db}.",
      "obsidianLiveSyncSettingTab.logConfiguredDisabled": "Configured synchronization mode: DISABLED",
      "obsidianLiveSyncSettingTab.logConfiguredLiveSync": "Configured synchronization mode: LiveSync",
      "obsidianLiveSyncSettingTab.logConfiguredPeriodic": "Configured synchronization mode: Periodic",
      "obsidianLiveSyncSettingTab.logCouchDbConfigFail": "CouchDB Configuration: ${title} failed",
      "obsidianLiveSyncSettingTab.logCouchDbConfigSet": "CouchDB Configuration: ${title} -> Set ${key} to ${value}",
      "obsidianLiveSyncSettingTab.logCouchDbConfigUpdated": "CouchDB Configuration: ${title} successfully updated",
      "obsidianLiveSyncSettingTab.logDatabaseConnected": "Database connected",
      "obsidianLiveSyncSettingTab.logEncryptionNoPassphrase": "You cannot enable encryption without a passphrase",
      "obsidianLiveSyncSettingTab.logEncryptionNoSupport": "Your device does not support encryption.",
      "obsidianLiveSyncSettingTab.logErrorOccurred": "An error occurred!!",
      "obsidianLiveSyncSettingTab.logEstimatedSize": "Estimated size: ${size}",
      "obsidianLiveSyncSettingTab.logPassphraseInvalid": "Passphrase is not valid, please fix it.",
      "obsidianLiveSyncSettingTab.logPassphraseNotCompatible": "ERROR: Passphrase is not compatible with the remote server! Please check it again!",
      "obsidianLiveSyncSettingTab.logRebuildNote": "Syncing has been disabled, fetch and re-enabled if desired.",
      "obsidianLiveSyncSettingTab.logSelectAnyPreset": "Select any preset.",
      "obsidianLiveSyncSettingTab.msgAreYouSureProceed": "Are you sure to proceed?",
      "obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied": "Changes need to be applied!",
      "obsidianLiveSyncSettingTab.msgConfigCheck": "--Config check--",
      "obsidianLiveSyncSettingTab.msgConfigCheckFailed": "The configuration check has failed. Do you want to continue anyway?",
      "obsidianLiveSyncSettingTab.msgConnectionCheck": "--Connection check--",
      "obsidianLiveSyncSettingTab.msgConnectionProxyNote": "If you're having trouble with the Connection-check (even after checking config), please check your reverse proxy configuration.",
      "obsidianLiveSyncSettingTab.msgCurrentOrigin": "Current origin: ${origin}",
      "obsidianLiveSyncSettingTab.msgDiscardConfirmation": "Do you really want to discard existing settings and databases?",
      "obsidianLiveSyncSettingTab.msgDone": "--Done--",
      "obsidianLiveSyncSettingTab.msgEnableCors": "Set httpd.enable_cors",
      "obsidianLiveSyncSettingTab.msgEnableCorsChttpd": "Set chttpd.enable_cors",
      "obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation": "We recommend enabling End-To-End Encryption, and Path Obfuscation. Are you sure you want to continue without encryption?",
      "obsidianLiveSyncSettingTab.msgFetchConfigFromRemote": "Do you want to fetch the config from the remote server?",
      "obsidianLiveSyncSettingTab.msgGenerateSetupURI": "All done! Do you want to generate a setup URI to set up other devices?",
      "obsidianLiveSyncSettingTab.msgIfConfigNotPersistent": "If the server configuration is not persistent (e.g., running on docker), the values here may change. Once you are able to connect, please update the settings in the server's local.ini.",
      "obsidianLiveSyncSettingTab.msgInvalidPassphrase": "Your encryption passphrase might be invalid. Are you sure you want to continue?",
      "obsidianLiveSyncSettingTab.msgNewVersionNote": "Here due to an upgrade notification? Please review the version history. If you're satisfied, click the button. A new update will prompt this again.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSInfo": "Configured as non-HTTPS URI. Be warned that this may not work on mobile devices.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSWarning": "Cannot connect to non-HTTPS URI. Please update your config and try again.",
      "obsidianLiveSyncSettingTab.msgNotice": "---Notice---",
      "obsidianLiveSyncSettingTab.msgObjectStorageWarning": "WARNING: This feature is a Work In Progress, so please keep in mind the following:\n- Append only architecture. A rebuild is required to shrink the storage.\n- A bit fragile.\n- When first syncing, all history will be transferred from the remote. Be mindful of data caps and slow speeds.\n- Only differences are synced live.\n\nIf you run into any issues, or have ideas about this feature, please create a issue on GitHub.\nI appreciate you for your great dedication.",
      "obsidianLiveSyncSettingTab.msgOriginCheck": "Origin check: ${org}",
      "obsidianLiveSyncSettingTab.msgRebuildRequired": "Rebuilding Databases are required to apply the changes.. Please select the method to apply the changes.\n\n<details>\n<summary>Legends</summary>\n\n| Symbol | Meaning |\n|: ------ :| ------- |\n| \u21D4 | Up to Date |\n| \u21C4 | Synchronise to balance |\n| \u21D0,\u21D2 | Transfer to overwrite |\n| \u21E0,\u21E2 | Transfer to overwrite from other side |\n\n</details>\n\n## ${OPTION_REBUILD_BOTH}\nAt a glance:  \u{1F4C4} \u21D2\xB9 \u{1F4BB} \u21D2\xB2 \u{1F6F0}\uFE0F \u21E2\u207F \u{1F4BB} \u21C4\u207F\u207A\xB9 \u{1F4C4}\nReconstruct both the local and remote databases using existing files from this device.\nThis causes a lockout other devices, and they need to perform fetching.\n## ${OPTION_FETCH}\nAt a glance: \u{1F4C4} \u21C4\xB2 \u{1F4BB} \u21D0\xB9 \u{1F6F0}\uFE0F \u21D4 \u{1F4BB} \u21D4 \u{1F4C4}\nInitialise the local database and reconstruct it using data fetched from the remote database.\nThis case includes the case which you have rebuilt the remote database.\n## ${OPTION_ONLY_SETTING}\nStore only the settings. **Caution: This may lead to data corruption**; database reconstruction is generally necessary.",
      "obsidianLiveSyncSettingTab.msgSelectAndApplyPreset": "Please select and apply any preset item to complete the wizard.",
      "obsidianLiveSyncSettingTab.msgSetCorsCredentials": "Set cors.credentials",
      "obsidianLiveSyncSettingTab.msgSetCorsOrigins": "Set cors.origins",
      "obsidianLiveSyncSettingTab.msgSetMaxDocSize": "Set couchdb.max_document_size",
      "obsidianLiveSyncSettingTab.msgSetMaxRequestSize": "Set chttpd.max_http_request_size",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUser": "Set chttpd.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth": "Set chttpd_auth.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSettingModified": 'The setting "${setting}" was modified from another device. Click {HERE} to reload settings. Click elsewhere to ignore changes.',
      "obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync": 'These settings are unable to be changed during synchronization. Please disable all syncing in the "Sync Settings" to unlock.',
      "obsidianLiveSyncSettingTab.msgSetWwwAuth": "Set httpd.WWW-Authenticate",
      "obsidianLiveSyncSettingTab.nameApplySettings": "Apply Settings",
      "obsidianLiveSyncSettingTab.nameConnectSetupURI": "Connect with Setup URI",
      "obsidianLiveSyncSettingTab.nameCopySetupURI": "Copy the current settings to a Setup URI",
      "obsidianLiveSyncSettingTab.nameDisableHiddenFileSync": "Disable Hidden files sync",
      "obsidianLiveSyncSettingTab.nameDiscardSettings": "Discard existing settings and databases",
      "obsidianLiveSyncSettingTab.nameEnableHiddenFileSync": "Enable Hidden files sync",
      "obsidianLiveSyncSettingTab.nameEnableLiveSync": "Enable LiveSync",
      "obsidianLiveSyncSettingTab.nameHiddenFileSynchronization": "Hidden file synchronization",
      "obsidianLiveSyncSettingTab.nameManualSetup": "Manual Setup",
      "obsidianLiveSyncSettingTab.nameTestConnection": "Test Connection",
      "obsidianLiveSyncSettingTab.nameTestDatabaseConnection": "Test Database Connection",
      "obsidianLiveSyncSettingTab.nameValidateDatabaseConfig": "Validate Database Configuration",
      "obsidianLiveSyncSettingTab.okAdminPrivileges": "\u2714 You have administrator privileges.",
      "obsidianLiveSyncSettingTab.okCorsCredentials": "\u2714 cors.credentials is ok.",
      "obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin": "CORS credentials OK",
      "obsidianLiveSyncSettingTab.okCorsOriginMatched": "\u2714 CORS origin OK",
      "obsidianLiveSyncSettingTab.okCorsOrigins": "\u2714 cors.origins is ok.",
      "obsidianLiveSyncSettingTab.okEnableCors": "\u2714 httpd.enable_cors is ok.",
      "obsidianLiveSyncSettingTab.okEnableCorsChttpd": "\u2714 chttpd.enable_cors is ok.",
      "obsidianLiveSyncSettingTab.okMaxDocumentSize": "\u2714 couchdb.max_document_size is ok.",
      "obsidianLiveSyncSettingTab.okMaxRequestSize": "\u2714 chttpd.max_http_request_size is ok.",
      "obsidianLiveSyncSettingTab.okRequireValidUser": "\u2714 chttpd.require_valid_user is ok.",
      "obsidianLiveSyncSettingTab.okRequireValidUserAuth": "\u2714 chttpd_auth.require_valid_user is ok.",
      "obsidianLiveSyncSettingTab.okWwwAuth": "\u2714 httpd.WWW-Authenticate is ok.",
      "obsidianLiveSyncSettingTab.optionApply": "Apply",
      "obsidianLiveSyncSettingTab.optionCancel": "Cancel",
      "obsidianLiveSyncSettingTab.optionCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.optionDisableAllAutomatic": "Disable all automatic",
      "obsidianLiveSyncSettingTab.optionFetchFromRemote": "Fetch from Remote",
      "obsidianLiveSyncSettingTab.optionHere": "HERE",
      "obsidianLiveSyncSettingTab.optionLiveSync": "LiveSync",
      "obsidianLiveSyncSettingTab.optionMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.optionOkReadEverything": "OK, I have read everything.",
      "obsidianLiveSyncSettingTab.optionOnEvents": "On events",
      "obsidianLiveSyncSettingTab.optionPeriodicAndEvents": "Periodic and on events",
      "obsidianLiveSyncSettingTab.optionPeriodicWithBatch": "Periodic w/ batch",
      "obsidianLiveSyncSettingTab.optionRebuildBoth": "Rebuild Both from This Device",
      "obsidianLiveSyncSettingTab.optionSaveOnlySettings": "(Danger) Save Only Settings",
      "obsidianLiveSyncSettingTab.panelChangeLog": "Change Log",
      "obsidianLiveSyncSettingTab.panelGeneralSettings": "General Settings",
      "obsidianLiveSyncSettingTab.panelPrivacyEncryption": "Privacy & Encryption",
      "obsidianLiveSyncSettingTab.panelRemoteConfiguration": "Remote Configuration",
      "obsidianLiveSyncSettingTab.panelSetup": "Setup",
      "obsidianLiveSyncSettingTab.serverVersion": "Server info: ${info}",
      "obsidianLiveSyncSettingTab.titleActiveRemoteServer": "Active Remote Server",
      "obsidianLiveSyncSettingTab.titleAppearance": "Appearance",
      "obsidianLiveSyncSettingTab.titleConflictResolution": "Conflict resolution",
      "obsidianLiveSyncSettingTab.titleCongratulations": "Congratulations!",
      "obsidianLiveSyncSettingTab.titleCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.titleDeletionPropagation": "Deletion Propagation",
      "obsidianLiveSyncSettingTab.titleEncryptionNotEnabled": "Encryption is not enabled",
      "obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid": "Encryption Passphrase Invalid",
      "obsidianLiveSyncSettingTab.titleExtraFeatures": "Enable extra and advanced features",
      "obsidianLiveSyncSettingTab.titleFetchConfig": "Fetch Config",
      "obsidianLiveSyncSettingTab.titleFetchConfigFromRemote": "Fetch config from remote server",
      "obsidianLiveSyncSettingTab.titleFetchSettings": "Fetch Settings",
      "obsidianLiveSyncSettingTab.titleHiddenFiles": "Hidden Files",
      "obsidianLiveSyncSettingTab.titleLogging": "Logging",
      "obsidianLiveSyncSettingTab.titleMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.titleNotification": "Notification",
      "obsidianLiveSyncSettingTab.titleOnlineTips": "Online Tips",
      "obsidianLiveSyncSettingTab.titleQuickSetup": "Quick Setup",
      "obsidianLiveSyncSettingTab.titleRebuildRequired": "Rebuild Required",
      "obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed": "Remote Configuration Check Failed",
      "obsidianLiveSyncSettingTab.titleRemoteServer": "Remote Server",
      "obsidianLiveSyncSettingTab.titleReset": "Reset",
      "obsidianLiveSyncSettingTab.titleSetupOtherDevices": "To setup other devices",
      "obsidianLiveSyncSettingTab.titleSynchronizationMethod": "Synchronization Method",
      "obsidianLiveSyncSettingTab.titleSynchronizationPreset": "Synchronization Preset",
      "obsidianLiveSyncSettingTab.titleSyncSettings": "Sync Settings",
      "obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown": "Sync Settings via Markdown",
      "obsidianLiveSyncSettingTab.titleUpdateThinning": "Update Thinning",
      "obsidianLiveSyncSettingTab.warnCorsOriginUnmatched": "\u26A0 CORS Origin is unmatched ${from}->${to}",
      "obsidianLiveSyncSettingTab.warnNoAdmin": "\u26A0 You do not have administrator privileges.",
      "P2P.AskPassphraseForDecrypt": "The remote peer shared the configuration. Please input the passphrase to decrypt the configuration.",
      "P2P.AskPassphraseForShare": "The remote peer requested this device configuration. Please input the passphrase to share the configuration. You can ignore the request by cancelling this dialogue.",
      "P2P.DisabledButNeed": "%{title_p2p_sync} is disabled. Do you really want to enable it?",
      "P2P.FailedToOpen": "Failed to open P2P connection to the signaling server.",
      "P2P.NoAutoSyncPeers": "No auto-sync peers found. Please set peers on the %{long_p2p_sync} pane.",
      "P2P.NoKnownPeers": "No peers has been detected, waiting incoming other peers...",
      "P2P.Note.description": " This replicator allows us to synchronise our vault with other devices\nusing a peer-to-peer connection. We can        use this to synchronise our vault with our other devices without using a cloud service.\nThis replicator is based on Trystero. It also uses a signaling server to establish a connection between devices. The signaling server is used to exchange connection information between devices. It does (or,should) not know or store any of our data.\n\nThe signaling server can be hosted by anyone. This is just a Nostr relay. For the sake of simplicity and checking the behaviour of the replicator, an instance of the signaling server is hosted by vrtmrz. You can use the experimental server provided by vrtmrz, or you can use any other server.\n\nBy the way, even if the signaling server does not store our data, it can see the connection information of some of our devices. Please be aware of this. Also, be cautious when using the server provided by someone else.",
      "P2P.Note.important_note": "The Experimental Implementation of the Peer-to-Peer Replicator.",
      "P2P.Note.important_note_sub": "This feature is still in the experimental stage. Please be aware that this feature may not work as expected. Furthermore, it may have some bugs, security issues, and other issues. Please use this feature at your own risk. Please contribute to the development of this feature.",
      "P2P.Note.Summary": "What is this  feature? (and some important notes, please read once)",
      "P2P.NotEnabled": "%{title_p2p_sync} is not enabled. We cannot open a new connection.",
      "P2P.P2PReplication": "%{P2P} Replication",
      "P2P.PaneTitle": "%{long_p2p_sync}",
      "P2P.ReplicatorInstanceMissing": "P2P Sync replicator is not found, possibly not have been configured or enabled.",
      "P2P.SeemsOffline": "Peer ${name} seems offline, skipped.",
      "P2P.SyncAlreadyRunning": "P2P Sync is already running.",
      "P2P.SyncCompleted": "P2P Sync completed.",
      "P2P.SyncStartedWith": "P2P Sync with ${name} have been started.",
      Passphrase: "Passphrase",
      "Passphrase of sensitive configuration items": "Passphrase of sensitive configuration items",
      password: "password",
      Password: "Password",
      "Path Obfuscation": "Path Obfuscation",
      "Per-file-saved customization sync": "Per-file-saved customization sync",
      "Periodic Sync interval": "Periodic Sync interval",
      Presets: "Presets",
      "Process small files in the foreground": "Process small files in the foreground",
      "RedFlag.Fetch.Method.Desc": "How do you want to fetch?\n- %{RedFlag.Fetch.Method.FetchSafer}.\n  **Low Traffic**, **High CPU**, **Low Risk**\n  Recommended if ...\n  - Files possibly inconsistent\n  - Files were not so much\n- %{RedFlag.Fetch.Method.FetchSmoother}.\n  **Low Traffic**, **Moderate CPU**, **Low to Moderate Risk**\n  Recommended if ...\n  - Files probably consistent\n  - You have a lot of files.\n- %{RedFlag.Fetch.Method.FetchTraditional}.\n  **High Traffic**, **Low CPU**, **Low to Moderate Risk**\n\n>[!INFO]- Details\n> ## %{RedFlag.Fetch.Method.FetchSafer}.\n> **Low Traffic**, **High CPU**, **Low Risk**\n> This option first creates a local database using existing local files before fetching data from the remote source.\n> If matching files exist both locally and remotely, only the differences between them will be transferred.\n> However, files present in both locations will initially be handled as conflicted files. They will be resolved automatically if they are not actually conflicted, but this process may take time.\n> This is generally the safest method, minimizing data loss risk.\n> ## %{RedFlag.Fetch.Method.FetchSmoother}.\n> **Low Traffic**, **Moderate CPU**, **Low to Moderate Risk** (depending operation)\n> This option first creates chunks from local files for the database, then fetches data. Consequently, only chunks missing locally are transferred. However, all metadata is taken from the remote source.\n> Local files are then compared against this metadata at launch. The content considered newer will overwrite the older one (by modified time). This outcome is then synchronised back to the remote database.\n> This is generally safe if local files are genuinely the latest timestamp. However, it can cause problems if a file has a newer timestamp but older content (like the initial `welcome.md`).\n> This uses less CPU and faster than \"%{RedFlag.Fetch.Method.FetchSafer}\", but it may lead to data loss if not used carefully.\n> ## %{RedFlag.Fetch.Method.FetchTraditional}.\n> **High Traffic**, **Low CPU**, **Low to Moderate Risk** (depending operation)\n> All things will be fetched from the remote.\n> Similar to the %{RedFlag.Fetch.Method.FetchSmoother}, but all chunks are fetched from the remote source.\n> This is the most traditional way to fetch, typically consuming the most network traffic and time. It also carries a similar risk of overwriting remote files to the '%{RedFlag.Fetch.Method.FetchSmoother}' option.\n> However, it is often considered the most stable method because it is the longest-established and most straightforward approach.",
      "RedFlag.Fetch.Method.FetchSafer": "Create a local database once before fetching",
      "RedFlag.Fetch.Method.FetchSmoother": "Create local file chunks before fetching",
      "RedFlag.Fetch.Method.FetchTraditional": "Fetch everything from the remote",
      "RedFlag.Fetch.Method.Title": "How do you want to fetch?",
      "RedFlag.FetchRemoteConfig.Buttons.Cancel": "No, use local settings",
      "RedFlag.FetchRemoteConfig.Buttons.Fetch": "Yes, fetch and apply remote settings",
      "RedFlag.FetchRemoteConfig.Message": "Do you want to fetch and apply remotely stored preference settings to the device?",
      "RedFlag.FetchRemoteConfig.Title": "Fetch Remote Configuration",
      "Reducing the frequency with which on-disk changes are reflected into the DB": "Reducing the frequency with which on-disk changes are reflected into the DB",
      Region: "Region",
      "Remote server type": "Remote server type",
      "Remote Type": "Remote Type",
      "Replicator.Dialogue.Locked.Action.Dismiss": "Cancel for reconfirmation",
      "Replicator.Dialogue.Locked.Action.Fetch": "Reset Synchronisation on This Device",
      "Replicator.Dialogue.Locked.Action.Unlock": "Unlock the remote database",
      "Replicator.Dialogue.Locked.Message": "Remote database is locked. This is due to a rebuild on one of the terminals.\nThe device is therefore asked to withhold the connection to avoid database corruption.\n\nThere are three options that we can do:\n\n- %{Replicator.Dialogue.Locked.Action.Fetch}\n  The most preferred and reliable way. This will dispose the local database once, and reset all synchronisation information from the remote database again, In most case, we can perform this safely. However, it takes some time and should be done in stable network.\n- %{Replicator.Dialogue.Locked.Action.Unlock}\n  This method can only be used if we are already reliably synchronised by other replication methods. This does not simply mean that we have the same files. If you are not sure, you should avoid it.\n- %{Replicator.Dialogue.Locked.Action.Dismiss}\n    This will cancel the operation. And we will asked again on next request.\n",
      "Replicator.Dialogue.Locked.Message.Fetch": "Fetch all has been scheduled. Plug-in will be restarted to perform it.",
      "Replicator.Dialogue.Locked.Message.Unlocked": "The remote database has been unlocked. Please retry the operation.",
      "Replicator.Dialogue.Locked.Title": "Locked",
      "Replicator.Message.Cleaned": "Database cleaning up is in process. replication has been cancelled",
      "Replicator.Message.InitialiseFatalError": "No replicator is available, this is the fatal error.",
      "Replicator.Message.Pending": "Some file events are pending. Replication has been cancelled.",
      "Replicator.Message.SomeModuleFailed": "Replication has been cancelled by some module failure",
      "Replicator.Message.VersionUpFlash": "An update has been detected. Please open the Settings dialogue and check the Change Log. Replication has been cancelled.",
      "Requires restart of Obsidian": "Requires restart of Obsidian",
      "Requires restart of Obsidian.": "Requires restart of Obsidian.",
      "Save settings to a markdown file. You will be notified when new settings arrive. You can set different files by the platform.": "Save settings to a markdown file. You will be notified when new settings arrive. You can set different files by the platform.",
      "Saving will be performed forcefully after this number of seconds.": "Saving will be performed forcefully after this number of seconds.",
      "Scan changes on customization sync": "Scan changes on customization sync",
      "Scan customization automatically": "Scan customization automatically",
      "Scan customization before replicating.": "Scan customization before replicating.",
      "Scan customization every 1 minute.": "Scan customization every 1 minute.",
      "Scan customization periodically": "Scan customization periodically",
      "Scan for hidden files before replication": "Scan for hidden files before replication",
      "Scan hidden files periodically": "Scan hidden files periodically",
      "Seconds, 0 to disable": "Seconds, 0 to disable",
      "Seconds. Saving to the local database will be delayed until this value after we stop typing or saving.": "Seconds. Saving to the local database will be delayed until this value after we stop typing or saving.",
      "Secret Key": "Secret Key",
      "Server URI": "Server URI",
      "Setting.GenerateKeyPair.Desc": 'We have generated a key pair!\n\nNote: This key pair will never be shown again. Please save it in a safe place. If you have lost it, you need to generate a new key pair.\nNote 2: The public key is in spki format, and the Private key is in pkcs8 format. For the sake of convenience, newlines are converted to `\\n` in public key.\nNote 3: The public key should be configured in the remote database, and the private key should be configured in local devices.\n\n>[!FOR YOUR EYES ONLY]-\n> <div class="sls-keypair">\n>\n> ### Public Key\n> ```\n${public_key}\n> ```\n>\n> ### Private Key\n> ```\n${private_key}\n> ```\n>\n> </div>\n\n>[!Both for copying]-\n>\n> <div class="sls-keypair">\n>\n> ```\n${public_key}\n${private_key}\n> ```\n>\n> </div>\n\n',
      "Setting.GenerateKeyPair.Title": "New key pair has been generated!",
      "Setting.TroubleShooting": "TroubleShooting",
      "Setting.TroubleShooting.Doctor": "Setting Doctor",
      "Setting.TroubleShooting.Doctor.Desc": "Detects non optimal settings. (Same as during migration)",
      "Setting.TroubleShooting.ScanBrokenFiles": "Scan for broken files",
      "Setting.TroubleShooting.ScanBrokenFiles.Desc": "Scans for files that are not stored correctly in the database.",
      "SettingTab.Message.AskRebuild": "Your changes require fetching from the remote database. Do you want to proceed?",
      "Setup.Apply.Buttons.ApplyAndFetch": "Apply and Fetch",
      "Setup.Apply.Buttons.ApplyAndMerge": "Apply and Merge",
      "Setup.Apply.Buttons.ApplyAndRebuild": "Apply and Rebuild",
      "Setup.Apply.Buttons.Cancel": "Discard and Cancel",
      "Setup.Apply.Buttons.OnlyApply": "Only Apply",
      "Setup.Apply.Message": "The new configuration is ready. Let us proceed to apply it.\nThere are several ways to apply this:\n\n- Apply and Fetch\n  Configure this device as a new client. After applying, synchronise from the remote server.\n- Apply and Merge\n  Configure on a device that already has the file. It processes the local files and transfers the differences. Conflicts may arise.\n- Apply and Rebuild\n  Rebuild the remote using local files. This is typically done if the server becomes corrupted or we wish to start from scratch.\n  Other devices will be locked and required to re-fetch.\n- Only Apply\n  Apply only. Conflicts may arise if a rebuild is required.",
      "Setup.Apply.Title": "Apply new configuration from the ${method}",
      "Setup.Apply.WarningRebuildRecommended": "NOTE: after adjusting the settings, it has been determined that a rebuild is required; Just Import is not recommended.",
      "Setup.Doctor.Buttons.No": "No, please use the settings in the URI as is",
      "Setup.Doctor.Buttons.Yes": "Yes, please consult the doctor",
      "Setup.Doctor.Message": "Self-hosted LiveSync has gradually become longer in history and some recommended settings have changed.\n\nNow, setup is a very good time to do this.\n\nDo you want to run Doctor to check if the imported settings are optimal compared to the latest state?",
      "Setup.Doctor.Title": "Do you want to consult the doctor?",
      "Setup.FetchRemoteConf.Buttons.Fetch": "Yes, please fetch the configuration",
      "Setup.FetchRemoteConf.Buttons.Skip": "No, please use the settings in the URI",
      "Setup.FetchRemoteConf.Message": "If we have already synchronised once with another device, the remote database stores the suitable configuration values between the synchronised devices. The plug-in would like to retrieve them for robust configuration.\n\nHowever, we have to make sure the one thing. Are we currently in a situation where we can access the network safely and retrieve the settings?\n\nNote: Mostly, you are safe to do this, that your remote database is hosted with a SSL certificate, and your network is not compromised.",
      "Setup.FetchRemoteConf.Title": "Fetch configuration from remote database?",
      "Setup.QRCode": 'We have generated a QR code to transfer the settings. Please scan the QR code with your phone or other device.\nNote: The QR code is not encrypted, so be careful to open this.\n\n>[!FOR YOUR EYES ONLY]-\n> <div class="sls-qr">${qr_image}</div>',
      "Setup.ShowQRCode": "Show QR code",
      "Setup.ShowQRCode.Desc": "Show QR code to transfer the settings.",
      "Should we keep folders that don't have any files inside?": "Should we keep folders that don't have any files inside?",
      "Should we only check for conflicts when a file is opened?": "Should we only check for conflicts when a file is opened?",
      "Should we prompt you about conflicting files when a file is opened?": "Should we prompt you about conflicting files when a file is opened?",
      "Should we prompt you for every single merge, even if we can safely merge automatcially?": "Should we prompt you for every single merge, even if we can safely merge automatcially?",
      "Show only notifications": "Show only notifications",
      "Show status as icons only": "Show status as icons only",
      "Show status inside the editor": "Show status inside the editor",
      "Show status on the status bar": "Show status on the status bar",
      "Show verbose log. Please enable if you report an issue.": "Show verbose log. Please enable if you report an issue.",
      "Starts synchronisation when a file is saved.": "Starts synchronisation when a file is saved.",
      "Stop reflecting database changes to storage files.": "Stop reflecting database changes to storage files.",
      "Stop watching for file changes.": "Stop watching for file changes.",
      "Suppress notification of hidden files change": "Suppress notification of hidden files change",
      "Suspend database reflecting": "Suspend database reflecting",
      "Suspend file watching": "Suspend file watching",
      "Sync after merging file": "Sync after merging file",
      "Sync automatically after merging files": "Sync automatically after merging files",
      "Sync Mode": "Sync Mode",
      "Sync on Editor Save": "Sync on Editor Save",
      "Sync on File Open": "Sync on File Open",
      "Sync on Save": "Sync on Save",
      "Sync on Startup": "Sync on Startup",
      "Testing only - Resolve file conflicts by syncing newer copies of the file, this can overwrite modified files. Be Warned.": "Testing only - Resolve file conflicts by syncing newer copies of the file, this can overwrite modified files. Be Warned.",
      "The delay for consecutive on-demand fetches": "The delay for consecutive on-demand fetches",
      "The Hash algorithm for chunk IDs": "The Hash algorithm for chunk IDs",
      "The maximum duration for which chunks can be incubated within the document. Chunks exceeding this period will graduate to independent chunks.": "The maximum duration for which chunks can be incubated within the document. Chunks exceeding this period will graduate to independent chunks.",
      "The maximum number of chunks that can be incubated within the document. Chunks exceeding this number will immediately graduate to independent chunks.": "The maximum number of chunks that can be incubated within the document. Chunks exceeding this number will immediately graduate to independent chunks.",
      "The maximum total size of chunks that can be incubated within the document. Chunks exceeding this size will immediately graduate to independent chunks.": "The maximum total size of chunks that can be incubated within the document. Chunks exceeding this size will immediately graduate to independent chunks.",
      "This passphrase will not be copied to another device. It will be set to `Default` until you configure it again.": "This passphrase will not be copied to another device. It will be set to `Default` until you configure it again.",
      "TweakMismatchResolve.Action.Dismiss": "Dismiss",
      "TweakMismatchResolve.Action.UseConfigured": "Use configured settings",
      "TweakMismatchResolve.Action.UseMine": "Update remote database settings",
      "TweakMismatchResolve.Action.UseMineAcceptIncompatible": "Update remote database settings but keep as is",
      "TweakMismatchResolve.Action.UseMineWithRebuild": "Update remote database settings and rebuild again",
      "TweakMismatchResolve.Action.UseRemote": "Apply settings to this device",
      "TweakMismatchResolve.Action.UseRemoteAcceptIncompatible": "Apply settings to this device, but and ignore incompatibility",
      "TweakMismatchResolve.Action.UseRemoteWithRebuild": "Apply settings to this device, and fetch again",
      "TweakMismatchResolve.Message.Main": "\nThe settings in the remote database are as follows. These values are configured by other devices, which are synchronised with this device at least once.\n\nIf you want to use these settings, please select %{TweakMismatchResolve.Action.UseConfigured}.\nIf you want to keep the settings of this device, please select %{TweakMismatchResolve.Action.Dismiss}.\n\n${table}\n\n>[!TIP]\n> If you want to synchronise all settings, please use `Sync settings via markdown` after applying minimal configuration with this feature.\n\n${additionalMessage}",
      "TweakMismatchResolve.Message.MainTweakResolving": "Your configuration has not been matched with the one on the remote server.\n\nFollowing configuration should be matched:\n\n${table}\n\nLet us know your decision.\n\n${additionalMessage}",
      "TweakMismatchResolve.Message.UseRemote.WarningRebuildRecommended": "\n>[!NOTICE]\n> Some changes are compatible but may consume extra storage and transfer volumes. A rebuild is recommended. However, a rebuild may not be performed at present, but may be implemented in future maintenance.\n> ***Please ensure that you have time and are connected to a stable network to apply!***",
      "TweakMismatchResolve.Message.UseRemote.WarningRebuildRequired": "\n>[!WARNING]\n> Some remote configurations are not compatible with the local database of this device. Rebuilding the local database will be required.\n> ***Please ensure that you have time and are connected to a stable network to apply!***",
      "TweakMismatchResolve.Message.WarningIncompatibleRebuildRecommended": "\n>[!NOTICE]\n> We have detected that some of the values are different to make incompatible the local database with the remote database.\n> Some changes are compatible but may consume extra storage and transfer volumes. A rebuild is recommended. However, a rebuild may not be performed at present, but may be implemented in future maintenance.\n> If you want to rebuild, it takes a few minutes or more. **Make sure it is safe to perform it now.**",
      "TweakMismatchResolve.Message.WarningIncompatibleRebuildRequired": "\n>[!WARNING]\n> We have detected that some of the values are different to make incompatible the local database with the remote database.\n> Either local or remote rebuilds are required. Both of them takes a few minutes or more. **Make sure it is safe to perform it now.**",
      "TweakMismatchResolve.Table": "| Value name | This device | On Remote |\n|: --- |: ---- :|: ---- :|\n${rows}\n\n",
      "TweakMismatchResolve.Table.Row": "| ${name} | ${self} | ${remote} |",
      "TweakMismatchResolve.Title": "Configuration Mismatch Detected",
      "TweakMismatchResolve.Title.TweakResolving": "Configuration Mismatch Detected",
      "TweakMismatchResolve.Title.UseRemoteConfig": "Use Remote Configuration",
      "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.": "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.",
      "Use Custom HTTP Handler": "Use Custom HTTP Handler",
      "Use dynamic iteration count": "Use dynamic iteration count",
      "Use Segmented-splitter": "Use Segmented-splitter",
      "Use splitting-limit-capped chunk splitter": "Use splitting-limit-capped chunk splitter",
      "Use the trash bin": "Use the trash bin",
      "Use timeouts instead of heartbeats": "Use timeouts instead of heartbeats",
      username: "username",
      Username: "Username",
      "Verbose Log": "Verbose Log",
      "Warning! This will have a serious impact on performance. And the logs will not be synchronised under the default name. Please be careful with logs; they often contain your confidential information.": "Warning! This will have a serious impact on performance. And the logs will not be synchronised under the default name. Please be careful with logs; they often contain your confidential information.",
      "When you save a file in the editor, start a sync automatically": "When you save a file in the editor, start a sync automatically",
      "Write credentials in the file": "Write credentials in the file",
      "Write logs into the file": "Write logs into the file",
      "fridaySync.saltChanged.title": "Remote Database Reset Detected",
      "fridaySync.saltChanged.message": "The remote database encryption key has changed. This usually means the remote database has been reset or rebuilt. Local data cannot sync with the new database. Please use 'Fetch from Server' to re-sync your data, or clear your local database and sync again.",
      "fridaySync.decryptionErrors.aggregated": "Detected ${count} decryption errors. The remote database may have been reset. Please use 'Fetch from Server' to re-sync your data.",
      "fridaySync.saltCheck.failed": "Failed to verify remote database status",
      "fridaySync.rebuildRemote.rebuilding": "Uploading your files to server...",
      "fridaySync.rebuildRemote.scanFailed": "Failed to prepare files for upload",
      "fridaySync.rebuildRemote.resettingRemote": "Preparing server...",
      "fridaySync.rebuildRemote.pushingData": "Uploading files (this may take a few minutes)...",
      "fridaySync.rebuildRemote.filesPrepared": "Prepared ${count} files for upload",
      "fridaySync.rebuildRemote.uploadingProgress": "\u2191 Uploading files: ${sending} (${done} completed)",
      "fridaySync.rebuildRemote.uploadFailed": "Upload failed",
      "fridaySync.rebuildRemote.success": "Upload complete!",
      "fridaySync.rebuildRemote.failed": "Upload failed",
      "fridaySync.rebuildRemote.failedConnection": "Upload failed. Please check your connection.",
      "fridaySync.sync.failed": "Sync failed. Please check your connection.",
      "fridaySync.pull.pulling": "Pulling from server...",
      "fridaySync.pull.completed": "Pull completed",
      "fridaySync.pull.failed": "Pull failed",
      "fridaySync.pull.failedConnection": "Pull failed. Please check your connection.",
      "fridaySync.push.pushing": "Pushing to server...",
      "fridaySync.push.completed": "Push completed",
      "fridaySync.push.failed": "Push failed",
      "fridaySync.push.failedConnection": "Push failed. Please check your connection.",
      "fridaySync.fetch.fetching": "Downloading from server (this may take a while)...",
      "fridaySync.fetch.starting": "Starting download from server...",
      "fridaySync.fetch.downloading": "Downloading files from server (this may take a while)...",
      "fridaySync.fetch.writingFiles": "Writing files to vault...",
      "fridaySync.fetch.downloadComplete": "Download complete!",
      "fridaySync.fetch.downloadFailed": "Download from server failed",
      "fridaySync.fetch.fetchingMissingChunks": "Found ${count} missing chunks, fetching from remote...",
      "fridaySync.fetch.chunkFetchComplete": "Chunk fetching complete: ${count} chunks fetched",
      "fridaySync.fetch.completed": "Download complete!",
      "fridaySync.fetch.failed": "Download failed",
      "fridaySync.fetch.failedConnection": "Download failed. Please check your connection.",
      "fridaySync.fetch.fetchingChunks": "Fetching missing chunks from remote...",
      "fridaySync.fetch.scanningChunks": "Scanning database for referenced chunks...",
      "fridaySync.fetch.chunksFetched": "Fetched chunks: ${fetched} / ${total}",
      "fridaySync.rebuild.localDbNotInitialized": "Local database not initialized",
      "fridaySync.rebuild.missingChunks": "${count} files could not be read (missing data). Examples: ${examples}${more}",
      "fridaySync.rebuild.complete": "Rebuild complete: ${count} files written (${created} new, ${updated} updated)",
      "fridaySync.rebuild.failed": "Rebuild failed. Please try again.",
      "fridaySync.hiddenFileSync.scanningStorage": "[HiddenFileSync] Scanning storage changes...",
      "fridaySync.hiddenFileSync.storageScanComplete": "[HiddenFileSync] Storage scan complete",
      "fridaySync.hiddenFileSync.scanningDatabase": "[HiddenFileSync] Scanning database changes...",
      "fridaySync.hiddenFileSync.databaseScanComplete": "[HiddenFileSync] Database scan complete",
      "fridaySync.hiddenFileSync.initComplete": "[HiddenFileSync] Initialization complete",
      "fridaySync.error.networkUnavailable": "Cannot connect to sync server. Will retry when network is available.",
      "fridaySync.error.authFailed": "Authentication failed. Please check your credentials in Settings.",
      "fridaySync.error.timeout": "Connection timeout. Will retry...",
      "fridaySync.network.offline": "Network offline - changes will sync when connection is restored",
      "fridaySync.network.reconnecting": "Reconnecting to sync server...",
      "fridaySync.network.reconnected": "Reconnected and sync restarted",
      "fridaySync.offline.changesTracked": "${count} changes tracked while offline",
      "fridaySync.offline.applyingChanges": "Applying ${count} offline changes...",
      "fridaySync.error.cannotConnectServer": "Cannot connect to sync server. Your changes will be saved locally and synced when connection is restored.",
      "fridaySync.error.serverTimeout": "Connection to sync server timed out. Will retry automatically.",
      "fridaySync.status.offlineMode": "Offline mode - changes saved locally",
      "fridaySync.status.reconnecting": "Reconnecting to sync server...",
      "fridaySync.error.noCacheOffline": "First-time setup requires server connection",
      "fridaySync.error.firstTimeNeedsConnection": "First-time setup requires server connection. Please connect to network and restart sync.",
      "fridaySync.offline.workingMode": "Working offline - changes will sync when connected",
      "fridaySync.saltChanged.syncBlocked": "Synchronization is blocked because the remote database has been reset. Please use 'Fetch from Server' in Settings to re-sync.",
      "fridaySync.saltChanged.actionRequired": "Remote database has been reset. Please go to Settings \u2192 'Fetch from Server' to re-sync your vault.",
      "fridaySync.saltChanged.deviceAccepted": "Device is now accepted by remote database. Synchronization can continue.",
      "fridaySync.saltChanged.suspendingReflection": "Preparing to download files...",
      "fridaySync.saltChanged.resumingReflection": "Download complete, writing files to vault...",
      "liveSyncReplicator.replicationDenied": "Sync access denied. Please check your credentials.",
      "liveSyncReplicator.replicationErrored": "Sync error occurred",
      "liveSyncReplicator.syncFileSizeError": "Sync failed due to file size. Please check the log for details.",
      "liveSyncReplicator.connectedSuccessfully": "Connected to ${dbName} successfully",
      "liveSyncReplicator.couldNotRetrieveMilestone": "Could not retrieve remote milestone",
      "fridaySync.progress.uploadingFiles": "Uploading files (${current}/${total})",
      "fridaySync.progress.downloadingFiles": "Downloading files (${current}/${total})",
      "fridaySync.progress.writingFiles": "Writing files (${current}/${total})",
      "fridaySync.progress.syncing": "Syncing...",
      "fridaySync.progress.syncCompleted": "Sync completed \u2713"
    };
  }
});

// src/sync/core/common/messages/def.ts
var PartialMessages;
var init_def = __esm({
  "src/sync/core/common/messages/def.ts"() {
    "use strict";
    init_en2();
    PartialMessages = {
      def: en_default
    };
  }
});

// src/sync/core/common/messagesJson/es.json
var es_default;
var init_es = __esm({
  "src/sync/core/common/messagesJson/es.json"() {
    es_default = {
      "(BETA) Always overwrite with a newer file": "(BETA) Sobrescribir siempre con archivo m\xE1s nuevo",
      "(Beta) Use ignore files": "(Beta) Usar archivos de ignorar",
      "(Days passed, 0 to disable automatic-deletion)": "(D\xEDas transcurridos, 0 para desactivar)",
      "(ex. Read chunks online) If this option is enabled, LiveSync reads chunks online directly instead of replicating them locally. Increasing Custom chunk size is recommended.": "(Ej: Leer chunks online) Lee chunks directamente en l\xEDnea. Aumente tama\xF1o de chunks personalizados",
      "(MB) If this is set, changes to local and remote files that are larger than this will be skipped. If the file becomes smaller again, a newer one will be used.": "(MB) Saltar cambios en archivos locales/remotos mayores a este tama\xF1o. Si se reduce, se usar\xE1 versi\xF3n nueva",
      "(Mega chars)": "(Millones de caracteres)",
      "(Not recommended) If set, credentials will be stored in the file.": "(No recomendado) Almacena credenciales en el archivo",
      "(Obsolete) Use an old adapter for compatibility": "(Obsoleto) Usar adaptador antiguo",
      "Access Key": "Clave de acceso",
      "Always prompt merge conflicts": "Siempre preguntar en conflictos",
      "Apply Latest Change if Conflicting": "Aplicar \xFAltimo cambio en conflictos",
      "Apply preset configuration": "Aplicar configuraci\xF3n predefinida",
      "Automatically Sync all files when opening Obsidian.": "Sincronizar autom\xE1ticamente todos los archivos al abrir Obsidian",
      "Batch database update": "Actualizaci\xF3n por lotes de BD",
      "Batch limit": "L\xEDmite de lotes",
      "Batch size": "Tama\xF1o de lote",
      "Batch size of on-demand fetching": "Tama\xF1o de lote para obtenci\xF3n bajo demanda",
      "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.": "Antes de v0.17.16 us\xE1bamos adaptador antiguo. Nuevo adaptador requiere reconstruir BD local. Desactive cuando pueda",
      "Bucket Name": "Nombre del bucket",
      "cmdConfigSync.showCustomizationSync": "Mostrar sincronizaci\xF3n de personalizaci\xF3n",
      "Comma separated `.gitignore, .dockerignore`": "Separados por comas: `.gitignore, .dockerignore`",
      "Compute revisions for chunks (Previous behaviour)": "Calcular revisiones para chunks (comportamiento anterior)",
      "Data Compression": "Compresi\xF3n de datos",
      "Database Name": "Nombre de la base de datos",
      "Database suffix": "Sufijo de base de datos",
      "Delay conflict resolution of inactive files": "Retrasar resoluci\xF3n de conflictos en archivos inactivos",
      "Delay merge conflict prompt for inactive files.": "Retrasar aviso de fusi\xF3n para archivos inactivos",
      "Delete old metadata of deleted files on start-up": "Borrar metadatos viejos al iniciar",
      "Device name": "Nombre del dispositivo",
      "Disables logging, only shows notifications. Please disable if you report an issue.": "Desactiva registros, solo muestra notificaciones. Desact\xEDvelo si reporta un problema.",
      "Display Language": "Idioma de visualizaci\xF3n",
      "Do not check configuration mismatch before replication": "No verificar incompatibilidades antes de replicar",
      "Do not keep metadata of deleted files.": "No conservar metadatos de archivos borrados",
      "Do not split chunks in the background": "No dividir chunks en segundo plano",
      "Do not use internal API": "No usar API interna",
      "Enable advanced features": "Habilitar caracter\xEDsticas avanzadas",
      "Enable customization sync": "Habilitar sincronizaci\xF3n de personalizaci\xF3n",
      "Enable Developers' Debug Tools.": "Habilitar herramientas de depuraci\xF3n",
      "Enable edge case treatment features": "Habilitar manejo de casos l\xEDmite",
      "Enable poweruser features": "Habilitar funciones para usuarios avanzados",
      "Enable this if your Object Storage doesn't support CORS": "Habilitar si su almacenamiento no soporta CORS",
      "Enable this option to automatically apply the most recent change to documents even when it conflicts": "Aplicar cambios recientes autom\xE1ticamente aunque generen conflictos",
      "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.": "Cifrar contenido en la base de datos remota. Se recomienda habilitar si usa la sincronizaci\xF3n del plugin.",
      "Encrypting sensitive configuration items": "Cifrando elementos sensibles",
      "Encryption phassphrase. If changed, you should overwrite the server's database with the new (encrypted) files.": "Frase de cifrado. Si la cambia, sobrescriba la base del servidor con los nuevos archivos cifrados.",
      "End-to-End Encryption": "Cifrado de extremo a extremo",
      "Endpoint URL": "URL del endpoint",
      "Enhance chunk size": "Mejorar tama\xF1o de chunks",
      "Fetch chunks on demand": "Obtener chunks bajo demanda",
      "Fetch database with previous behaviour": "Obtener BD con comportamiento anterior",
      Filename: "Nombre de archivo",
      "Forces the file to be synced when opened.": "Forzar sincronizaci\xF3n al abrir archivo",
      "Handle files as Case-Sensitive": "Manejar archivos como sensibles a may\xFAsculas",
      "If disabled(toggled), chunks will be split on the UI thread (Previous behaviour).": "Si se desactiva, chunks se dividen en hilo UI (comportamiento anterior)",
      "If enabled per-filed efficient customization sync will be used. We need a small migration when enabling this. And all devices should be updated to v0.23.18. Once we enabled this, we lost a compatibility with old versions.": "Habilita sincronizaci\xF3n eficiente por archivo. Requiere migraci\xF3n y actualizar todos dispositivos a v0.23.18. Pierde compatibilidad con versiones antiguas",
      "If enabled, chunks will be split into no more than 100 items. However, dedupe is slightly weaker.": "Divide chunks en m\xE1ximo 100 \xEDtems. Menos eficiente en deduplicaci\xF3n",
      "If enabled, newly created chunks are temporarily kept within the document, and graduated to become independent chunks once stabilised.": "Chunks nuevos se mantienen temporalmente en el documento hasta estabilizarse",
      "If enabled, the file under 1kb will be processed in the UI thread.": "Archivos <1kb se procesan en hilo UI",
      "If enabled, the notification of hidden files change will be suppressed.": "Si se habilita, se suprimir\xE1 la notificaci\xF3n de cambios en archivos ocultos.",
      "If this enabled, all chunks will be stored with the revision made from its content. (Previous behaviour)": "Si se habilita, todos los chunks se almacenan con la revisi\xF3n hecha desde su contenido. (comportamiento anterior)",
      "If this enabled, All files are handled as case-Sensitive (Previous behaviour).": "Si se habilita, todos los archivos se manejan como sensibles a may\xFAsculas (comportamiento anterior)",
      "If this enabled, chunks will be split into semantically meaningful segments. Not all platforms support this feature.": "Divide chunks en segmentos sem\xE1nticos. No todos los sistemas lo soportan",
      "If this is set, changes to local files which are matched by the ignore files will be skipped. Remote changes are determined using local ignore files.": "Saltar cambios en archivos locales que coincidan con ignore files. Cambios remotos usan ignore files locales",
      "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.": "Mantiene conexi\xF3n 60s. Si no hay cambios, reinicia socket. \xDAtil con proxies limitantes",
      "Ignore files": "Archivos a ignorar",
      "Incubate Chunks in Document": "Incubar chunks en documento",
      "Interval (sec)": "Intervalo (segundos)",
      "Keep empty folder": "Mantener carpetas vac\xEDas",
      "lang-de": "Alem\xE1n",
      "lang-es": "Espa\xF1ol",
      "lang-ja": "Japon\xE9s",
      "lang-ru": "Ruso",
      "lang-zh": "Chino simplificado",
      "lang-zh-tw": "Chino tradicional",
      "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.": "LiveSync no puede manejar m\xFAltiples b\xF3vedas con mismo nombre sin prefijo. Se configura autom\xE1ticamente",
      "liveSyncReplicator.beforeLiveSync": "Antes de LiveSync, inicia OneShot...",
      "liveSyncReplicator.cantReplicateLowerValue": "No podemos replicar un valor m\xE1s bajo.",
      "liveSyncReplicator.checkingLastSyncPoint": "Buscando el \xFAltimo punto sincronizado.",
      "liveSyncReplicator.couldNotConnectTo": "No se pudo conectar a ${uri} : ${name} \n(${db})",
      "liveSyncReplicator.couldNotConnectToRemoteDb": "No se pudo conectar a base de datos remota: ${d}",
      "liveSyncReplicator.couldNotConnectToServer": "No se pudo conectar al servidor.",
      "liveSyncReplicator.couldNotConnectToURI": "No se pudo conectar a ${uri}:${dbRet}",
      "liveSyncReplicator.couldNotMarkResolveRemoteDb": "No se pudo marcar como resuelta la base de datos remota.",
      "liveSyncReplicator.liveSyncBegin": "Inicio de LiveSync...",
      "liveSyncReplicator.lockRemoteDb": "Bloquear base de datos remota para prevenir corrupci\xF3n de datos",
      "liveSyncReplicator.markDeviceResolved": "Marcar este dispositivo como 'resuelto'.",
      "liveSyncReplicator.oneShotSyncBegin": "Inicio de sincronizaci\xF3n OneShot... (${syncMode})",
      "liveSyncReplicator.remoteDbCorrupted": "La base de datos remota es m\xE1s nueva o est\xE1 da\xF1ada, aseg\xFArese de tener la \xFAltima versi\xF3n de self-hosted-livesync instalada",
      "liveSyncReplicator.remoteDbCreatedOrConnected": "Base de datos remota creada o conectada",
      "liveSyncReplicator.remoteDbDestroyed": "Base de datos remota destruida",
      "liveSyncReplicator.remoteDbDestroyError": "Algo ocurri\xF3 al destruir base de datos remota:",
      "liveSyncReplicator.remoteDbMarkedResolved": "Base de datos remota marcada como resuelta.",
      "liveSyncReplicator.replicationClosed": "Replicaci\xF3n cerrada",
      "liveSyncReplicator.replicationInProgress": "Replicaci\xF3n en curso",
      "liveSyncReplicator.retryLowerBatchSize": "Reintentar con tama\xF1o de lote m\xE1s bajo:${batch_size}/${batches_limit}",
      "liveSyncReplicator.unlockRemoteDb": "Desbloquear base de datos remota para prevenir corrupci\xF3n de datos",
      "liveSyncSetting.errorNoSuchSettingItem": "No existe el ajuste: ${key}",
      "liveSyncSetting.originalValue": "Original: ${value}",
      "liveSyncSetting.valueShouldBeInRange": "El valor debe estar entre ${min} y ${max}",
      "liveSyncSettings.btnApply": "Aplicar",
      "logPane.autoScroll": "Autodesplazamiento",
      "logPane.logWindowOpened": "Ventana de registro abierta",
      "logPane.pause": "Pausar",
      "logPane.title": "Registro de Self-hosted LiveSync",
      "logPane.wrap": "Ajustar",
      "Maximum delay for batch database updating": "Retraso m\xE1ximo para actualizaci\xF3n por lotes",
      "Maximum file size": "Tama\xF1o m\xE1ximo de archivo",
      "Maximum Incubating Chunk Size": "Tama\xF1o m\xE1ximo de chunks incubados",
      "Maximum Incubating Chunks": "M\xE1ximo de chunks incubados",
      "Maximum Incubation Period": "Periodo m\xE1ximo de incubaci\xF3n",
      "MB (0 to disable).": "MB (0 para desactivar)",
      "Memory cache size (by total characters)": "Tama\xF1o cach\xE9 memoria (por caracteres)",
      "Memory cache size (by total items)": "Tama\xF1o cach\xE9 memoria (por \xEDtems)",
      "Minimum delay for batch database updating": "Retraso m\xEDnimo para actualizaci\xF3n por lotes",
      "moduleCheckRemoteSize.logCheckingStorageSizes": "Comprobando tama\xF1os de almacenamiento",
      "moduleCheckRemoteSize.logCurrentStorageSize": "Tama\xF1o del almacenamiento remoto: ${measuredSize}",
      "moduleCheckRemoteSize.logExceededWarning": "Tama\xF1o del almacenamiento remoto: ${measuredSize} super\xF3 ${notifySize}",
      "moduleCheckRemoteSize.logThresholdEnlarged": "El umbral se ha ampliado a ${size}MB",
      "moduleCheckRemoteSize.msgConfirmRebuild": "Esto puede llevar un poco de tiempo. \xBFRealmente quieres reconstruir todo ahora?",
      "moduleCheckRemoteSize.msgDatabaseGrowing": "**\xA1Tu base de datos est\xE1 creciendo!** Pero no te preocupes, podemos abordarlo ahora. El tiempo antes de quedarse sin espacio en el almacenamiento remoto.\n\n| Tama\xF1o medido | Tama\xF1o configurado |\n| --- | --- |\n| ${estimatedSize} | ${maxSize} |\n\n> [!MORE]-\n> Si lo has estado utilizando durante muchos a\xF1os, puede haber fragmentos no referenciados - es decir, basura - acumul\xE1ndose en la base de datos. Por lo tanto, recomendamos reconstruir todo. Probablemente se volver\xE1 mucho m\xE1s peque\xF1o.\n>\n> Si el volumen de tu b\xF3veda simplemente est\xE1 aumentando, es mejor reconstruir todo despu\xE9s de organizar los archivos. Self-hosted LiveSync no elimina los datos reales incluso si los eliminas para acelerar el proceso. Est\xE1 aproximadamente [documentado](https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/tech_info.md).\n>\n> Si no te importa el aumento, puedes aumentar el l\xEDmite de notificaci\xF3n en 100 MB. Este es el caso si lo est\xE1s ejecutando en tu propio servidor. Sin embargo, es mejor reconstruir todo de vez en cuando.\n>\n\n> [!WARNING]\n> Si realizas la reconstrucci\xF3n completa, aseg\xFArate de que todos los dispositivos est\xE9n sincronizados. El complemento fusionar\xE1 tanto como sea posible, sin embargo.\n",
      "moduleCheckRemoteSize.msgSetDBCapacity": "Podemos configurar una advertencia de capacidad m\xE1xima de base de datos, **para tomar medidas antes de quedarse sin espacio en el almacenamiento remoto**.\n\xBFQuieres habilitar esto?\n\n> [!MORE]-\n> - 0: No advertir sobre el tama\xF1o del almacenamiento.\n>   Esto es recomendado si tienes suficiente espacio en el almacenamiento remoto, especialmente si lo tienes autoalojado. Y puedes comprobar el tama\xF1o del almacenamiento y reconstruir manualmente.\n> - 800: Advertir si el tama\xF1o del almacenamiento remoto supera los 800 MB.\n>   Esto es recomendado si est\xE1s usando fly.io con un l\xEDmite de 1 GB o IBM Cloudant.\n> - 2000: Advertir si el tama\xF1o del almacenamiento remoto supera los 2 GB.\n\nSi hemos alcanzado el l\xEDmite, se nos pedir\xE1 que aumentemos el l\xEDmite paso a paso.\n",
      "moduleCheckRemoteSize.option2GB": "2GB (Est\xE1ndar)",
      "moduleCheckRemoteSize.option800MB": "800MB (Cloudant, fly.io)",
      "moduleCheckRemoteSize.optionAskMeLater": "Preg\xFAntame m\xE1s tarde",
      "moduleCheckRemoteSize.optionDismiss": "Descartar",
      "moduleCheckRemoteSize.optionIncreaseLimit": "aumentar a ${newMax}MB",
      "moduleCheckRemoteSize.optionNoWarn": "No, nunca advertir por favor",
      "moduleCheckRemoteSize.optionRebuildAll": "Reconstruir todo ahora",
      "moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded": "El tama\xF1o del almacenamiento remoto super\xF3 el l\xEDmite",
      "moduleCheckRemoteSize.titleDatabaseSizeNotify": "Configuraci\xF3n de notificaci\xF3n de tama\xF1o de base de datos",
      "moduleInputUIObsidian.defaultTitleConfirmation": "Confirmaci\xF3n",
      "moduleInputUIObsidian.defaultTitleSelect": "Seleccionar",
      "moduleInputUIObsidian.optionNo": "No",
      "moduleInputUIObsidian.optionYes": "S\xED",
      "moduleLiveSyncMain.logAdditionalSafetyScan": "Escan\xE9o de seguridad adicional...",
      "moduleLiveSyncMain.logLoadingPlugin": "Cargando complemento...",
      "moduleLiveSyncMain.logPluginInitCancelled": "La inicializaci\xF3n del complemento fue cancelada por un m\xF3dulo",
      "moduleLiveSyncMain.logPluginVersion": "Self-hosted LiveSync v${manifestVersion} ${packageVersion}",
      "moduleLiveSyncMain.logReadChangelog": "LiveSync se ha actualizado, \xA1por favor lee el registro de cambios!",
      "moduleLiveSyncMain.logSafetyScanCompleted": "Escan\xE9o de seguridad adicional completado",
      "moduleLiveSyncMain.logSafetyScanFailed": "El escaneo de seguridad adicional ha fallado en un m\xF3dulo",
      "moduleLiveSyncMain.logUnloadingPlugin": "Descargando complemento...",
      "moduleLiveSyncMain.logVersionUpdate": "LiveSync se ha actualizado, en caso de actualizaciones que rompan, toda la sincronizaci\xF3n autom\xE1tica se ha desactivado temporalmente. Aseg\xFArate de que todos los dispositivos est\xE9n actualizados antes de habilitar.",
      "moduleLiveSyncMain.msgScramEnabled": "Self-hosted LiveSync se ha configurado para ignorar algunos eventos. \xBFEs esto correcto?\n\n| Tipo | Estado | Nota |\n|:---:|:---:|---|\n| Eventos de almacenamiento | ${fileWatchingStatus} | Se ignorar\xE1 cada modificaci\xF3n |\n| Eventos de base de datos | ${parseReplicationStatus} | Cada cambio sincronizado se pospondr\xE1 |\n\n\xBFQuieres reanudarlos y reiniciar Obsidian?\n\n> [!DETAILS]-\n> Estas banderas son establecidas por el complemento mientras se reconstruye o se obtiene. Si el proceso termina de forma anormal, puede mantenerse sin querer.\n> Si no est\xE1s seguro, puedes intentar volver a ejecutar estos procesos. Aseg\xFArate de hacer una copia de seguridad de tu b\xF3veda.\n",
      "moduleLiveSyncMain.optionKeepLiveSyncDisabled": "Mantener LiveSync desactivado",
      "moduleLiveSyncMain.optionResumeAndRestart": "Reanudar y reiniciar Obsidian",
      "moduleLiveSyncMain.titleScramEnabled": "Scram habilitado",
      "moduleLocalDatabase.logWaitingForReady": "Esperando a que la base de datos est\xE9 lista...",
      "moduleLog.showLog": "Mostrar registro",
      "moduleMigration.docUri": "https://github.com/vrtmrz/obsidian-livesync/blob/main/README_ES.md#how-to-use",
      "moduleMigration.logBulkSendCorrupted": "El env\xEDo de fragmentos en bloque se ha habilitado, sin embargo, esta funci\xF3n se ha corrompido. Disculpe las molestias. Deshabilitado autom\xE1ticamente.",
      "moduleMigration.logFetchRemoteTweakFailed": "Error al obtener los valores de ajuste remoto",
      "moduleMigration.logLocalDatabaseNotReady": "\xA1Algo sali\xF3 mal! La base de datos local no est\xE1 lista",
      "moduleMigration.logMigratedSameBehaviour": "Migrado a db:${current} con el mismo comportamiento que antes",
      "moduleMigration.logMigrationFailed": "La migraci\xF3n fall\xF3 o se cancel\xF3 de ${old} a ${current}",
      "moduleMigration.logRedflag2CreationFail": "Error al crear redflag2",
      "moduleMigration.logRemoteTweakUnavailable": "No se pudieron obtener los valores de ajuste remoto",
      "moduleMigration.logSetupCancelled": "La configuraci\xF3n ha sido cancelada, \xA1Self-hosted LiveSync est\xE1 esperando tu configuraci\xF3n!",
      "moduleMigration.msgFetchRemoteAgain": "Como ya sabr\xE1s, Self-hosted LiveSync ha cambiado su comportamiento predeterminado y la estructura de la base de datos.\n\nAfortunadamente, con tu tiempo y esfuerzo, la base de datos remota parece haber sido ya migrada. \xA1Felicidades!\n\nSin embargo, necesitamos un poco m\xE1s. La configuraci\xF3n de este dispositivo no es compatible con la base de datos remota. Necesitaremos volver a obtener la base de datos remota. \xBFDebemos obtenerla nuevamente ahora?\n\n___Nota: No podemos sincronizar hasta que la configuraci\xF3n haya sido cambiada y la base de datos haya sido obtenida nuevamente.___\n___Nota2: Los fragmentos son completamente inmutables, solo podemos obtener los metadatos y diferencias.___",
      "moduleMigration.msgInitialSetup": "Tu dispositivo **a\xFAn no ha sido configurado**. Perm\xEDteme guiarte a trav\xE9s del proceso de configuraci\xF3n.\n\nTen en cuenta que todo el contenido del di\xE1logo se puede copiar al portapapeles. Si necesitas consultarlo m\xE1s tarde, puedes pegarlo en una nota en Obsidian. Tambi\xE9n puedes traducirlo a tu idioma utilizando una herramienta de traducci\xF3n.\n\nPrimero, \xBFtienes **URI de configuraci\xF3n**?\n\nNota: Si no sabes qu\xE9 es, consulta la [documentaci\xF3n](${URI_DOC}).",
      "moduleMigration.msgRecommendSetupUri": "Te recomendamos encarecidamente que generes una URI de configuraci\xF3n y la utilices.\nSi no tienes conocimientos al respecto, consulta la [documentaci\xF3n](${URI_DOC}) (Lo siento de nuevo, pero es importante).\n\n\xBFC\xF3mo quieres configurarlo manualmente?",
      "moduleMigration.msgSinceV02321": "Desde la versi\xF3n v0.23.21, Self-hosted LiveSync ha cambiado el comportamiento predeterminado y la estructura de la base de datos. Se han realizado los siguientes cambios:\n\n1. **Sensibilidad a may\xFAsculas de los nombres de archivo**\n    El manejo de los nombres de archivo ahora no distingue entre may\xFAsculas y min\xFAsculas. Este cambio es beneficioso para la mayor\xEDa de las plataformas, excepto Linux y iOS, que no gestionan efectivamente la sensibilidad a may\xFAsculas de los nombres de archivo.\n    (En estos, se mostrar\xE1 una advertencia para archivos con el mismo nombre pero diferentes may\xFAsculas).\n\n2. **Manejo de revisiones de los fragmentos**\n    Los fragmentos son inmutables, lo que permite que sus revisiones sean fijas. Este cambio mejorar\xE1 el rendimiento al guardar archivos.\n\n___Sin embargo, para habilitar cualquiera de estos cambios, es necesario reconstruir tanto las bases de datos remota como la local. Este proceso toma unos minutos, y recomendamos hacerlo cuando tengas tiempo suficiente.___\n\n- Si deseas mantener el comportamiento anterior, puedes omitir este proceso usando `${KEEP}`.\n- Si no tienes suficiente tiempo, por favor elige `${DISMISS}`. Se te pedir\xE1 nuevamente m\xE1s tarde.\n- Si has reconstruido la base de datos en otro dispositivo, selecciona `${DISMISS}` e intenta sincronizar nuevamente. Dado que se ha detectado una diferencia, se te solicitar\xE1 nuevamente.",
      "moduleMigration.optionAdjustRemote": "Ajustar al remoto",
      "moduleMigration.optionDecideLater": "Decidirlo m\xE1s tarde",
      "moduleMigration.optionEnableBoth": "Habilitar ambos",
      "moduleMigration.optionEnableFilenameCaseInsensitive": "Habilitar solo #1",
      "moduleMigration.optionEnableFixedRevisionForChunks": "Habilitar solo #2",
      "moduleMigration.optionHaveSetupUri": "S\xED, tengo",
      "moduleMigration.optionKeepPreviousBehaviour": "Mantener comportamiento anterior",
      "moduleMigration.optionManualSetup": "Configurarlo todo manualmente",
      "moduleMigration.optionNoAskAgain": "No, por favor preg\xFAntame de nuevo",
      "moduleMigration.optionNoSetupUri": "No, no tengo",
      "moduleMigration.optionRemindNextLaunch": "Record\xE1rmelo en el pr\xF3ximo inicio",
      "moduleMigration.optionSetupWizard": "Ll\xE9vame al asistente de configuraci\xF3n",
      "moduleMigration.optionYesFetchAgain": "S\xED, obtener nuevamente",
      "moduleMigration.titleCaseSensitivity": "Sensibilidad a may\xFAsculas",
      "moduleMigration.titleRecommendSetupUri": "Recomendaci\xF3n de uso de URI de configuraci\xF3n",
      "moduleMigration.titleWelcome": "Bienvenido a Self-hosted LiveSync",
      "moduleObsidianMenu.replicate": "Replicar",
      "Move remotely deleted files to the trash, instead of deleting.": "Mover archivos borrados remotos a papelera en lugar de eliminarlos",
      'Not all messages have been translated. And, please revert to "Default" when reporting errors.': 'No todos los mensajes est\xE1n traducidos. Por favor, vuelva a "Predeterminado" al reportar errores.',
      "Notify all setting files": "Notificar todos los archivos de configuraci\xF3n",
      "Notify customized": "Notificar personalizaciones",
      "Notify when other device has newly customized.": "Notificar cuando otro dispositivo personalice",
      "Notify when the estimated remote storage size exceeds on start up": "Notificar cuando el tama\xF1o estimado del almacenamiento remoto exceda al iniciar",
      "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.": "N\xFAmero de lotes a procesar. Default 40, m\xEDnimo 2. Controla documentos en memoria",
      "Number of changes to sync at a time. Defaults to 50. Minimum is 2.": "N\xFAmero de cambios a sincronizar simult\xE1neamente. Default 50, m\xEDnimo 2",
      "obsidianLiveSyncSettingTab.btnApply": "Aplicar",
      "obsidianLiveSyncSettingTab.btnCheck": "Verificar",
      "obsidianLiveSyncSettingTab.btnCopy": "Copiar",
      "obsidianLiveSyncSettingTab.btnDisable": "Desactivar",
      "obsidianLiveSyncSettingTab.btnDiscard": "Descartar",
      "obsidianLiveSyncSettingTab.btnEnable": "Activar",
      "obsidianLiveSyncSettingTab.btnFix": "Corregir",
      "obsidianLiveSyncSettingTab.btnGotItAndUpdated": "Lo entend\xED y actualic\xE9.",
      "obsidianLiveSyncSettingTab.btnNext": "Siguiente",
      "obsidianLiveSyncSettingTab.btnStart": "Iniciar",
      "obsidianLiveSyncSettingTab.btnTest": "Probar",
      "obsidianLiveSyncSettingTab.btnUse": "Usar",
      "obsidianLiveSyncSettingTab.buttonFetch": "Obtener",
      "obsidianLiveSyncSettingTab.buttonNext": "Siguiente",
      "obsidianLiveSyncSettingTab.defaultLanguage": "Predeterminado",
      "obsidianLiveSyncSettingTab.descConnectSetupURI": "Este es el m\xE9todo recomendado para configurar Self-hosted LiveSync con una URI de configuraci\xF3n.",
      "obsidianLiveSyncSettingTab.descCopySetupURI": "\xA1Perfecto para configurar un nuevo dispositivo!",
      "obsidianLiveSyncSettingTab.descEnableLiveSync": "Solo habilita esto despu\xE9s de configurar cualquiera de las dos opciones anteriores o completar toda la configuraci\xF3n manualmente.",
      "obsidianLiveSyncSettingTab.descFetchConfigFromRemote": "Obtener las configuraciones necesarias del servidor remoto ya configurado.",
      "obsidianLiveSyncSettingTab.descManualSetup": "No recomendado, pero \xFAtil si no tienes una URI de configuraci\xF3n",
      "obsidianLiveSyncSettingTab.descTestDatabaseConnection": "Abrir conexi\xF3n a la base de datos. Si no se encuentra la base de datos remota y tienes permiso para crear una base de datos, se crear\xE1 la base de datos.",
      "obsidianLiveSyncSettingTab.descValidateDatabaseConfig": "Verifica y soluciona cualquier problema potencial con la configuraci\xF3n de la base de datos.",
      "obsidianLiveSyncSettingTab.errAccessForbidden": "Acceso prohibido.",
      "obsidianLiveSyncSettingTab.errCannotContinueTest": "No se pudo continuar con la prueba.",
      "obsidianLiveSyncSettingTab.errCorsCredentials": "\u2757 cors.credentials es incorrecto",
      "obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials": "CORS no permite credenciales",
      "obsidianLiveSyncSettingTab.errCorsOrigins": "\u2757 cors.origins es incorrecto",
      "obsidianLiveSyncSettingTab.errEnableCors": "\u2757 httpd.enable_cors es incorrecto",
      "obsidianLiveSyncSettingTab.errMaxDocumentSize": "\u2757 couchdb.max_document_size es bajo)",
      "obsidianLiveSyncSettingTab.errMaxRequestSize": "\u2757 chttpd.max_http_request_size es bajo)",
      "obsidianLiveSyncSettingTab.errMissingWwwAuth": "\u2757 httpd.WWW-Authenticate falta",
      "obsidianLiveSyncSettingTab.errRequireValidUser": "\u2757 chttpd.require_valid_user es incorrecto.",
      "obsidianLiveSyncSettingTab.errRequireValidUserAuth": "\u2757 chttpd_auth.require_valid_user es incorrecto.",
      "obsidianLiveSyncSettingTab.labelDisabled": "\u23F9\uFE0F : Desactivado",
      "obsidianLiveSyncSettingTab.labelEnabled": "\u{1F501} : Activado",
      "obsidianLiveSyncSettingTab.levelAdvanced": " (avanzado)",
      "obsidianLiveSyncSettingTab.levelEdgeCase": " (excepci\xF3n)",
      "obsidianLiveSyncSettingTab.levelPowerUser": " (experto)",
      "obsidianLiveSyncSettingTab.linkOpenInBrowser": "Abrir en el navegador",
      "obsidianLiveSyncSettingTab.linkPageTop": "Ir arriba",
      "obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting": "Consejos y soluci\xF3n de problemas",
      "obsidianLiveSyncSettingTab.linkTroubleshooting": "/docs/es/troubleshooting.md",
      "obsidianLiveSyncSettingTab.logCannotUseCloudant": "Esta funci\xF3n no se puede utilizar con IBM Cloudant.",
      "obsidianLiveSyncSettingTab.logCheckingConfigDone": "Verificaci\xF3n de configuraci\xF3n completada",
      "obsidianLiveSyncSettingTab.logCheckingConfigFailed": "La verificaci\xF3n de configuraci\xF3n fall\xF3",
      "obsidianLiveSyncSettingTab.logCheckingDbConfig": "Verificando la configuraci\xF3n de la base de datos",
      "obsidianLiveSyncSettingTab.logCheckPassphraseFailed": "ERROR: Error al comprobar la frase de contrase\xF1a con el servidor remoto: \n${db}.",
      "obsidianLiveSyncSettingTab.logConfiguredDisabled": "Modo de sincronizaci\xF3n configurado: DESACTIVADO",
      "obsidianLiveSyncSettingTab.logConfiguredLiveSync": "Modo de sincronizaci\xF3n configurado: Sincronizaci\xF3n en Vivo",
      "obsidianLiveSyncSettingTab.logConfiguredPeriodic": "Modo de sincronizaci\xF3n configurado: Peri\xF3dico",
      "obsidianLiveSyncSettingTab.logCouchDbConfigFail": "Configuraci\xF3n de CouchDB: ${title} fall\xF3",
      "obsidianLiveSyncSettingTab.logCouchDbConfigSet": "Configuraci\xF3n de CouchDB: ${title} -> Establecer ${key} en ${value}",
      "obsidianLiveSyncSettingTab.logCouchDbConfigUpdated": "Configuraci\xF3n de CouchDB: ${title} actualizado correctamente",
      "obsidianLiveSyncSettingTab.logDatabaseConnected": "Base de datos conectada",
      "obsidianLiveSyncSettingTab.logEncryptionNoPassphrase": "No puedes habilitar el cifrado sin una frase de contrase\xF1a",
      "obsidianLiveSyncSettingTab.logEncryptionNoSupport": "Tu dispositivo no admite el cifrado.",
      "obsidianLiveSyncSettingTab.logErrorOccurred": "\xA1Ocurri\xF3 un error!",
      "obsidianLiveSyncSettingTab.logEstimatedSize": "Tama\xF1o estimado: ${size}",
      "obsidianLiveSyncSettingTab.logPassphraseInvalid": "La frase de contrase\xF1a no es v\xE1lida, por favor corr\xEDgela.",
      "obsidianLiveSyncSettingTab.logPassphraseNotCompatible": "ERROR: \xA1La frase de contrase\xF1a no es compatible con el servidor remoto! \xA1Por favor, rev\xEDsala de nuevo!",
      "obsidianLiveSyncSettingTab.logRebuildNote": "La sincronizaci\xF3n ha sido desactivada, obt\xE9n y vuelve a activar si lo deseas.",
      "obsidianLiveSyncSettingTab.logSelectAnyPreset": "Selecciona cualquier preestablecido.",
      "obsidianLiveSyncSettingTab.msgAreYouSureProceed": "\xBFEst\xE1s seguro de proceder?",
      "obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied": "\xA1Los cambios deben aplicarse!",
      "obsidianLiveSyncSettingTab.msgConfigCheck": "--Verificaci\xF3n de configuraci\xF3n--",
      "obsidianLiveSyncSettingTab.msgConfigCheckFailed": "La verificaci\xF3n de configuraci\xF3n ha fallado. \xBFQuieres continuar de todos modos?",
      "obsidianLiveSyncSettingTab.msgConnectionCheck": "--Verificaci\xF3n de conexi\xF3n--",
      "obsidianLiveSyncSettingTab.msgConnectionProxyNote": "Si tienes problemas con la verificaci\xF3n de conexi\xF3n (incluso despu\xE9s de verificar la configuraci\xF3n), por favor verifica la configuraci\xF3n de tu proxy reverso.",
      "obsidianLiveSyncSettingTab.msgCurrentOrigin": "Origen actual: {origin}",
      "obsidianLiveSyncSettingTab.msgDiscardConfirmation": "\xBFRealmente deseas descartar las configuraciones y bases de datos existentes?",
      "obsidianLiveSyncSettingTab.msgDone": "--Hecho--",
      "obsidianLiveSyncSettingTab.msgEnableCors": "Configurar httpd.enable_cors",
      "obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation": "Recomendamos habilitar el cifrado de extremo a extremo y la obfuscaci\xF3n de ruta. \xBFEst\xE1s seguro de querer continuar sin cifrado?",
      "obsidianLiveSyncSettingTab.msgFetchConfigFromRemote": "\xBFQuieres obtener la configuraci\xF3n del servidor remoto?",
      "obsidianLiveSyncSettingTab.msgGenerateSetupURI": "\xA1Todo listo! \xBFQuieres generar un URI de configuraci\xF3n para configurar otros dispositivos?",
      "obsidianLiveSyncSettingTab.msgIfConfigNotPersistent": "Si la configuraci\xF3n del servidor no es persistente (por ejemplo, ejecut\xE1ndose en docker), los valores aqu\xED pueden cambiar. Una vez que puedas conectarte, por favor actualiza las configuraciones en el local.ini del servidor.",
      "obsidianLiveSyncSettingTab.msgInvalidPassphrase": "Tu frase de contrase\xF1a de cifrado podr\xEDa ser inv\xE1lida. \xBFEst\xE1s seguro de querer continuar?",
      "obsidianLiveSyncSettingTab.msgNewVersionNote": "\xBFAqu\xED debido a una notificaci\xF3n de actualizaci\xF3n? Por favor, revise el historial de versiones. Si est\xE1 satisfecho, haga clic en el bot\xF3n. Una nueva actualizaci\xF3n volver\xE1 a mostrar esto.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSInfo": "Configurado como URI que no es HTTPS. Ten en cuenta que esto puede no funcionar en dispositivos m\xF3viles.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSWarning": "No se puede conectar a URI que no sean HTTPS. Por favor, actualiza tu configuraci\xF3n y vuelve a intentarlo.",
      "obsidianLiveSyncSettingTab.msgNotice": "---Aviso---",
      "obsidianLiveSyncSettingTab.msgObjectStorageWarning": "ADVERTENCIA: Esta caracter\xEDstica est\xE1 en desarrollo, as\xED que por favor ten en cuenta lo siguiente:\n- Arquitectura de solo anexado. Se requiere una reconstrucci\xF3n para reducir el almacenamiento.\n- Un poco fr\xE1gil.\n- Al sincronizar por primera vez, todo el historial ser\xE1 transferido desde el remoto. Ten en cuenta los l\xEDmites de datos y las velocidades lentas.\n- Solo las diferencias se sincronizan en vivo.\n\nSi encuentras alg\xFAn problema o tienes ideas sobre esta caracter\xEDstica, por favor crea un issue en GitHub.\nAprecio mucho tu gran dedicaci\xF3n.",
      "obsidianLiveSyncSettingTab.msgOriginCheck": "Verificaci\xF3n de origen: {org}",
      "obsidianLiveSyncSettingTab.msgRebuildRequired": "Es necesario reconstruir las bases de datos para aplicar los cambios. Por favor selecciona el m\xE9todo para aplicar los cambios.\n\n<details>\n<summary>Legendas</summary>\n\n| S\xEDmbolo | Significado |\n|: ------ :| ------- |\n| \u21D4 | Actualizado |\n| \u21C4 | Sincronizar para equilibrar |\n| \u21D0,\u21D2 | Transferir para sobrescribir |\n| \u21E0,\u21E2 | Transferir para sobrescribir desde otro lado |\n\n</details>\n\n## ${OPTION_REBUILD_BOTH}\nA simple vista:  \u{1F4C4} \u21D2\xB9 \u{1F4BB} \u21D2\xB2 \u{1F6F0}\uFE0F \u21E2\u207F \u{1F4BB} \u21C4\u207F\u207A\xB9 \u{1F4C4}\nReconstruir tanto la base de datos local como la remota utilizando los archivos existentes de este dispositivo.\nEsto bloquea a otros dispositivos, y necesitan realizar la obtenci\xF3n.\n## ${OPTION_FETCH}\nA simple vista: \u{1F4C4} \u21C4\xB2 \u{1F4BB} \u21D0\xB9 \u{1F6F0}\uFE0F \u21D4 \u{1F4BB} \u21D4 \u{1F4C4}\nInicializa la base de datos local y la reconstruye utilizando los datos obtenidos de la base de datos remota.\nEste caso incluye el caso en el que has reconstruido la base de datos remota.\n## ${OPTION_ONLY_SETTING}\nAlmacena solo la configuraci\xF3n. **Precauci\xF3n: esto puede provocar corrupci\xF3n de datos**; generalmente es necesario reconstruir la base de datos.",
      "obsidianLiveSyncSettingTab.msgSelectAndApplyPreset": "Por favor, selecciona y aplica cualquier elemento preestablecido para completar el asistente.",
      "obsidianLiveSyncSettingTab.msgSetCorsCredentials": "Configurar cors.credentials",
      "obsidianLiveSyncSettingTab.msgSetCorsOrigins": "Configurar cors.origins",
      "obsidianLiveSyncSettingTab.msgSetMaxDocSize": "Configurar couchdb.max_document_size",
      "obsidianLiveSyncSettingTab.msgSetMaxRequestSize": "Configurar chttpd.max_http_request_size",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUser": "Configurar chttpd.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth": "Configurar chttpd_auth.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSettingModified": 'La configuraci\xF3n "${setting}" fue modificada desde otro dispositivo. Haz clic {HERE} para recargar la configuraci\xF3n. Haz clic en otro lugar para ignorar los cambios.',
      "obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync": 'Estas configuraciones no se pueden cambiar durante la sincronizaci\xF3n. Por favor, deshabilita toda la sincronizaci\xF3n en las "Configuraciones de Sincronizaci\xF3n" para desbloquear.',
      "obsidianLiveSyncSettingTab.msgSetWwwAuth": "Configurar httpd.WWW-Authenticate",
      "obsidianLiveSyncSettingTab.nameApplySettings": "Aplicar configuraciones",
      "obsidianLiveSyncSettingTab.nameConnectSetupURI": "Conectar con URI de configuraci\xF3n",
      "obsidianLiveSyncSettingTab.nameCopySetupURI": "Copiar la configuraci\xF3n actual a una URI de configuraci\xF3n",
      "obsidianLiveSyncSettingTab.nameDisableHiddenFileSync": "Desactivar sincronizaci\xF3n de archivos ocultos",
      "obsidianLiveSyncSettingTab.nameDiscardSettings": "Descartar configuraciones y bases de datos existentes",
      "obsidianLiveSyncSettingTab.nameEnableHiddenFileSync": "Activar sincronizaci\xF3n de archivos ocultos",
      "obsidianLiveSyncSettingTab.nameEnableLiveSync": "Activar LiveSync",
      "obsidianLiveSyncSettingTab.nameHiddenFileSynchronization": "Sincronizaci\xF3n de archivos ocultos",
      "obsidianLiveSyncSettingTab.nameManualSetup": "Configuraci\xF3n manual",
      "obsidianLiveSyncSettingTab.nameTestConnection": "Probar conexi\xF3n",
      "obsidianLiveSyncSettingTab.nameTestDatabaseConnection": "Probar Conexi\xF3n de Base de Datos",
      "obsidianLiveSyncSettingTab.nameValidateDatabaseConfig": "Validar Configuraci\xF3n de la Base de Datos",
      "obsidianLiveSyncSettingTab.okAdminPrivileges": "\u2714 Tienes privilegios de administrador.",
      "obsidianLiveSyncSettingTab.okCorsCredentials": "\u2714 cors.credentials est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin": "CORS credenciales OK",
      "obsidianLiveSyncSettingTab.okCorsOriginMatched": "\u2714 Origen de CORS correcto",
      "obsidianLiveSyncSettingTab.okCorsOrigins": "\u2714 cors.origins est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okEnableCors": "\u2714 httpd.enable_cors est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okMaxDocumentSize": "\u2714 couchdb.max_document_size est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okMaxRequestSize": "\u2714 chttpd.max_http_request_size est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okRequireValidUser": "\u2714 chttpd.require_valid_user est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okRequireValidUserAuth": "\u2714 chttpd_auth.require_valid_user est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.okWwwAuth": "\u2714 httpd.WWW-Authenticate est\xE1 correcto.",
      "obsidianLiveSyncSettingTab.optionApply": "Aplicar",
      "obsidianLiveSyncSettingTab.optionCancel": "Cancelar",
      "obsidianLiveSyncSettingTab.optionCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.optionDisableAllAutomatic": "Desactivar lo autom\xE1tico",
      "obsidianLiveSyncSettingTab.optionFetchFromRemote": "Obtener del remoto",
      "obsidianLiveSyncSettingTab.optionHere": "AQU\xCD",
      "obsidianLiveSyncSettingTab.optionLiveSync": "LiveSync",
      "obsidianLiveSyncSettingTab.optionMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.optionOkReadEverything": "OK, he le\xEDdo todo.",
      "obsidianLiveSyncSettingTab.optionOnEvents": "En eventos",
      "obsidianLiveSyncSettingTab.optionPeriodicAndEvents": "Peri\xF3dico y en eventos",
      "obsidianLiveSyncSettingTab.optionPeriodicWithBatch": "Peri\xF3dico con lote",
      "obsidianLiveSyncSettingTab.optionRebuildBoth": "Reconstructuir ambos desde este dispositivo",
      "obsidianLiveSyncSettingTab.optionSaveOnlySettings": "(Peligro) Guardar solo configuraci\xF3n",
      "obsidianLiveSyncSettingTab.panelChangeLog": "Registro de cambios",
      "obsidianLiveSyncSettingTab.panelGeneralSettings": "Configuraciones Generales",
      "obsidianLiveSyncSettingTab.panelPrivacyEncryption": "Privacidad y Cifrado",
      "obsidianLiveSyncSettingTab.panelRemoteConfiguration": "Configuraci\xF3n remota",
      "obsidianLiveSyncSettingTab.panelSetup": "Configuraci\xF3n",
      "obsidianLiveSyncSettingTab.titleAppearance": "Apariencia",
      "obsidianLiveSyncSettingTab.titleConflictResolution": "Resoluci\xF3n de conflictos",
      "obsidianLiveSyncSettingTab.titleCongratulations": "\xA1Felicidades!",
      "obsidianLiveSyncSettingTab.titleCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.titleDeletionPropagation": "Propagaci\xF3n de eliminaci\xF3n",
      "obsidianLiveSyncSettingTab.titleEncryptionNotEnabled": "El cifrado no est\xE1 habilitado",
      "obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid": "La frase de contrase\xF1a de cifrado es inv\xE1lida",
      "obsidianLiveSyncSettingTab.titleExtraFeatures": "Habilitar funciones extras y avanzadas",
      "obsidianLiveSyncSettingTab.titleFetchConfig": "Obtener configuraci\xF3n",
      "obsidianLiveSyncSettingTab.titleFetchConfigFromRemote": "Obtener configuraci\xF3n del servidor remoto",
      "obsidianLiveSyncSettingTab.titleFetchSettings": "Obtener configuraciones",
      "obsidianLiveSyncSettingTab.titleHiddenFiles": "Archivos ocultos",
      "obsidianLiveSyncSettingTab.titleLogging": "Registro",
      "obsidianLiveSyncSettingTab.titleMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.titleNotification": "Notificaci\xF3n",
      "obsidianLiveSyncSettingTab.titleOnlineTips": "Consejos en l\xEDnea",
      "obsidianLiveSyncSettingTab.titleQuickSetup": "Configuraci\xF3n r\xE1pida",
      "obsidianLiveSyncSettingTab.titleRebuildRequired": "Reconstrucci\xF3n necesaria",
      "obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed": "La verificaci\xF3n de configuraci\xF3n remota fall\xF3",
      "obsidianLiveSyncSettingTab.titleRemoteServer": "Servidor remoto",
      "obsidianLiveSyncSettingTab.titleReset": "Reiniciar",
      "obsidianLiveSyncSettingTab.titleSetupOtherDevices": "Para configurar otros dispositivos",
      "obsidianLiveSyncSettingTab.titleSynchronizationMethod": "M\xE9todo de sincronizaci\xF3n",
      "obsidianLiveSyncSettingTab.titleSynchronizationPreset": "Preestablecimiento de sincronizaci\xF3n",
      "obsidianLiveSyncSettingTab.titleSyncSettings": "Configuraciones de Sincronizaci\xF3n",
      "obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown": "Configuraci\xF3n de sincronizaci\xF3n a trav\xE9s de Markdown",
      "obsidianLiveSyncSettingTab.titleUpdateThinning": "Actualizaci\xF3n de adelgazamiento",
      "obsidianLiveSyncSettingTab.warnCorsOriginUnmatched": "\u26A0 El origen de CORS no coincide: {from}->{to}",
      "obsidianLiveSyncSettingTab.warnNoAdmin": "\u26A0 No tienes privilegios de administrador.",
      Passphrase: "Frase de contrase\xF1a",
      "Passphrase of sensitive configuration items": "Frase para elementos sensibles",
      password: "contrase\xF1a",
      Password: "Contrase\xF1a",
      "Path Obfuscation": "Ofuscaci\xF3n de rutas",
      "Per-file-saved customization sync": "Sincronizaci\xF3n de personalizaci\xF3n por archivo",
      "Periodic Sync interval": "Intervalo de sincronizaci\xF3n peri\xF3dica",
      Presets: "Preconfiguraciones",
      "Process small files in the foreground": "Procesar archivos peque\xF1os en primer plano",
      "Reducing the frequency with which on-disk changes are reflected into the DB": "Reducir frecuencia de actualizaciones de disco a BD",
      Region: "Regi\xF3n",
      "Remote server type": "Tipo de servidor remoto",
      "Remote Type": "Tipo de remoto",
      "Requires restart of Obsidian": "Requiere reiniciar Obsidian",
      "Requires restart of Obsidian.": "Requiere reiniciar Obsidian",
      "Save settings to a markdown file. You will be notified when new settings arrive. You can set different files by the platform.": "Guardar configuraci\xF3n en archivo markdown. Se notificar\xE1n nuevos ajustes. Puede definir diferentes archivos por plataforma",
      "Saving will be performed forcefully after this number of seconds.": "Guardado forzado tras esta cantidad de segundos",
      "Scan changes on customization sync": "Escanear cambios en sincronizaci\xF3n de personalizaci\xF3n",
      "Scan customization automatically": "Escanear personalizaci\xF3n autom\xE1ticamente",
      "Scan customization before replicating.": "Escanear personalizaci\xF3n antes de replicar",
      "Scan customization every 1 minute.": "Escanear personalizaci\xF3n cada 1 minuto",
      "Scan customization periodically": "Escanear personalizaci\xF3n peri\xF3dicamente",
      "Scan for hidden files before replication": "Escanear archivos ocultos antes de replicar",
      "Scan hidden files periodically": "Escanear archivos ocultos peri\xF3dicamente",
      "Seconds, 0 to disable": "Segundos, 0 para desactivar",
      "Seconds. Saving to the local database will be delayed until this value after we stop typing or saving.": "Segundos. Guardado en BD local se retrasar\xE1 hasta este valor tras dejar de escribir/guardar",
      "Secret Key": "Clave secreta",
      "Server URI": "URI del servidor",
      "Should we keep folders that don't have any files inside?": "\xBFMantener carpetas vac\xEDas?",
      "Should we only check for conflicts when a file is opened?": "\xBFSolo comprobar conflictos al abrir archivo?",
      "Should we prompt you about conflicting files when a file is opened?": "\xBFNotificar sobre conflictos al abrir archivo?",
      "Should we prompt you for every single merge, even if we can safely merge automatcially?": "\xBFPreguntar en cada fusi\xF3n aunque sea autom\xE1tica?",
      "Show only notifications": "Mostrar solo notificaciones",
      "Show status as icons only": "Mostrar estado solo con \xEDconos",
      "Show status inside the editor": "Mostrar estado dentro del editor",
      "Show status on the status bar": "Mostrar estado en la barra de estado",
      "Show verbose log. Please enable if you report an issue.": "Mostrar registro detallado. Act\xEDvelo si reporta un problema.",
      "Starts synchronisation when a file is saved.": "Inicia sincronizaci\xF3n al guardar un archivo",
      "Stop reflecting database changes to storage files.": "Dejar de reflejar cambios de BD en archivos",
      "Stop watching for file changes.": "Dejar de monitorear cambios en archivos",
      "Suppress notification of hidden files change": "Suprimir notificaciones de cambios en archivos ocultos",
      "Suspend database reflecting": "Suspender reflejo de base de datos",
      "Suspend file watching": "Suspender monitorizaci\xF3n de archivos",
      "Sync after merging file": "Sincronizar tras fusionar archivo",
      "Sync automatically after merging files": "Sincronizar autom\xE1ticamente tras fusionar archivos",
      "Sync Mode": "Modo de sincronizaci\xF3n",
      "Sync on Editor Save": "Sincronizar al guardar en editor",
      "Sync on File Open": "Sincronizar al abrir archivo",
      "Sync on Save": "Sincronizar al guardar",
      "Sync on Startup": "Sincronizar al iniciar",
      "Testing only - Resolve file conflicts by syncing newer copies of the file, this can overwrite modified files. Be Warned.": "Solo pruebas - Resolver conflictos sincronizando copias nuevas (puede sobrescribir modificaciones)",
      "The delay for consecutive on-demand fetches": "Retraso entre obtenciones consecutivas",
      "The Hash algorithm for chunk IDs": "Algoritmo hash para IDs de chunks",
      "The maximum duration for which chunks can be incubated within the document. Chunks exceeding this period will graduate to independent chunks.": "Duraci\xF3n m\xE1xima para incubar chunks. Excedentes se independizan",
      "The maximum number of chunks that can be incubated within the document. Chunks exceeding this number will immediately graduate to independent chunks.": "N\xFAmero m\xE1ximo de chunks que pueden incubarse en el documento. Excedentes se independizan",
      "The maximum total size of chunks that can be incubated within the document. Chunks exceeding this size will immediately graduate to independent chunks.": "Tama\xF1o total m\xE1ximo de chunks incubados. Excedentes se independizan",
      "This passphrase will not be copied to another device. It will be set to `Default` until you configure it again.": "Esta frase no se copia a otros dispositivos. Usar\xE1 `Default` hasta reconfigurar",
      "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.": "Nombre \xFAnico entre dispositivos sincronizados. Para editarlo, desactive sincronizaci\xF3n de personalizaci\xF3n",
      "Use Custom HTTP Handler": "Usar manejador HTTP personalizado",
      "Use dynamic iteration count": "Usar conteo de iteraciones din\xE1mico",
      "Use Segmented-splitter": "Usar divisor segmentado",
      "Use splitting-limit-capped chunk splitter": "Usar divisor de chunks con l\xEDmite",
      "Use the trash bin": "Usar papelera",
      "Use timeouts instead of heartbeats": "Usar timeouts en lugar de latidos",
      username: "nombre de usuario",
      Username: "Usuario",
      "Verbose Log": "Registro detallado",
      "Warning! This will have a serious impact on performance. And the logs will not be synchronised under the default name. Please be careful with logs; they often contain your confidential information.": "\xA1Advertencia! Impacta rendimiento. Los logs no se sincronizan con nombre predeterminado. Contienen informaci\xF3n confidencial",
      "When you save a file in the editor, start a sync automatically": "Iniciar sincronizaci\xF3n autom\xE1tica al guardar en editor",
      "Write credentials in the file": "Escribir credenciales en archivo",
      "Write logs into the file": "Escribir logs en archivo"
    };
  }
});

// src/sync/core/common/messages/es.ts
var PartialMessages2;
var init_es2 = __esm({
  "src/sync/core/common/messages/es.ts"() {
    "use strict";
    init_es();
    PartialMessages2 = {
      es: es_default
    };
  }
});

// src/sync/core/common/messagesJson/ja.json
var ja_default;
var init_ja = __esm({
  "src/sync/core/common/messagesJson/ja.json"() {
    ja_default = {
      "(BETA) Always overwrite with a newer file": "(\u30D9\u30FC\u30BF\u6A5F\u80FD) \u5E38\u306B\u65B0\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u3067\u4E0A\u66F8\u304D\u3059\u308B",
      "(Beta) Use ignore files": "(\u30D9\u30FC\u30BF\u6A5F\u80FD) \u7121\u8996\u30D5\u30A1\u30A4\u30EB(ignore)\u306E\u4F7F\u7528",
      "(Obsolete) Use an old adapter for compatibility": "\u53E4\u3044\u30A2\u30C0\u30D7\u30BF\u30FC\u3092\u5229\u7528\uFF08\u4E92\u63DB\u6027\u91CD\u8996\uFF09",
      "Access Key": "\u30A2\u30AF\u30BB\u30B9\u30AD\u30FC",
      "Always prompt merge conflicts": "\u5E38\u306B\u7AF6\u5408\u306F\u624B\u52D5\u3067\u89E3\u6C7A\u3059\u308B",
      "Apply Latest Change if Conflicting": "\u66F8\u985E\u5185\u306B\u7AF6\u5408\u304C\u767A\u751F\u3057\u3066\u3082\u3001\u5E38\u306B\u540C\u671F\u5185\u5BB9\u3092\u53CD\u6620\u3059\u308B",
      "Apply preset configuration": "\u521D\u671F\u8A2D\u5B9A\u5024\u306B\u623B\u3059",
      "Batch database update": "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u30D0\u30C3\u30C1\u66F4\u65B0",
      "Batch limit": "\u30D0\u30C3\u30C1\u306E\u4E0A\u9650",
      "Batch size": "\u30D0\u30C3\u30C1\u5BB9\u91CF",
      "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.": "v0.17.6\u307E\u3067\u306F\u3001\u53E4\u3044\u30A2\u30C0\u30D7\u30BF\u30FC\u3092\u30ED\u30FC\u30AB\u30EB\u7528\u306E\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u4F7F\u7528\u3057\u3066\u3044\u307E\u3057\u305F\u3002\u73FE\u5728\u306F\u65B0\u3057\u3044\u30A2\u30C0\u30D7\u30BF\u30FC\u3092\u63A8\u5968\u3057\u3066\u3044\u307E\u3059\u3002\u3057\u304B\u3057\u3001\u53E4\u3044\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u518D\u69CB\u7BC9\u3059\u308B\u305F\u3081\u306B\u306F\u5FC5\u8981\u3067\u3059\u3002\u6709\u52B9\u306E\u307E\u307E\u306B\u3057\u3066\u304A\u304F\u3068\u3001\u30EA\u30E2\u30FC\u30C8\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304B\u3089\u30D5\u30A7\u30C3\u30C1\u3059\u308B\u5834\u5408\u306B\u3001\u3053\u306E\u8A2D\u5B9A\u3092\u7121\u52B9\u306B\u3059\u308B\u304B\u8CEA\u554F\u304C\u3042\u308A\u307E\u3059\u3002",
      "Bucket Name": "\u30D0\u30B1\u30C3\u30C8\u540D",
      "Data Compression": "\u30C7\u30FC\u30BF\u5727\u7E2E",
      "Database Name": "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D",
      "Database suffix": "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u63A5\u5C3E\u8A5E(\u30B5\u30D5\u30A3\u30C3\u30AF\u30B9)",
      "Delay conflict resolution of inactive files": "\u7121\u52B9\u306A\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u7AF6\u5408\u89E3\u6C7A\u3092\u5148\u9001\u308A\u3059\u308B",
      "Delay merge conflict prompt for inactive files.": "\u624B\u52D5\u3067\u7121\u52B9\u306A\u30D5\u30A1\u30A4\u30EB\u306E\u7AF6\u5408\u3092\u89E3\u6C7A\u3059\u308B",
      "Delete old metadata of deleted files on start-up": "\u524A\u9664\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u30AF\u30EA\u30FC\u30F3\u30CA\u30C3\u30D7\u3059\u308B",
      "Device name": "\u30C7\u30D0\u30A4\u30B9\u30CD\u30FC\u30E0",
      "dialog.yourLanguageAvailable": "Self-hosted LiveSync \u306B\u3054\u5229\u7528\u306E\u8A00\u8A9E\u306E\u7FFB\u8A33\u304C\u3042\u308A\u307E\u3057\u305F\u306E\u3067\u3001%{Display Language}\u304C\u9069\u7528\u3055\u308C\u307E\u3057\u305F\u3002\n\n\u3054\u6CE8\u610F\uFF1A \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u7FFB\u8A33\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u3042\u306A\u305F\u306E\u30B3\u30F3\u30C8\u30EA\u30D3\u30E5\u30FC\u30B7\u30E7\u30F3\u3092\u304A\u5F85\u3061\u3057\u3066\u3044\u307E\u3059\uFF01\n\u305D\u306E\uFF12\uFF1A Issue\u3092\u4F5C\u6210\u3059\u308B\u969B\u306B\u306F\u3001 %{Display Language} \u3092\u4E00\u65E6 %{lang-def} \u306B\u623B\u3057\u3066\u304B\u3089\u3001\u30AD\u30E3\u30D7\u30C1\u30E3\u3084\u30E1\u30C3\u30BB\u30FC\u30B8\u3001\u30ED\u30B0\u3092\u53CE\u96C6\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u30C0\u30A4\u30A2\u30ED\u30B0\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u3059\u3002\n\n\u3053\u308C\u3067\u4FBF\u5229\u306B\u4F7F\u7528\u3067\u304D\u308C\u3070\u5E78\u3044\u3067\u3059\u3002",
      "Display Language": "\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9\u306E\u8868\u793A\u8A00\u8A9E",
      "Do not keep metadata of deleted files.": "\u524A\u9664\u6E08\u307F\u30D5\u30A1\u30A4\u30EB\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u4FDD\u6301\u3057\u306A\u3044",
      "Do not use internal API": "\u5185\u90E8API\u3092\u4F7F\u7528\u3057\u306A\u3044",
      "Enable customization sync": "\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u540C\u671F\u3092\u6709\u52B9",
      "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.": "\u30EA\u30E2\u30FC\u30C8\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u6697\u53F7\u5316\uFF08\u30AA\u30F3\u306B\u3059\u308B\u3053\u3068\u3092\u304A\u52E7\u3081\u3057\u307E\u3059\uFF09",
      "Encrypting sensitive configuration items": "\u6A5F\u5FAE\u8A2D\u5B9A\u9805\u76EE\u306E\u6697\u53F7\u5316",
      "End-to-End Encryption": "E2E\u6697\u53F7\u5316",
      "Endpoint URL": "\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8URL",
      "Enhance chunk size": "\u30C1\u30E3\u30F3\u30AF\u30B5\u30A4\u30BA\u3092\u6700\u65B0\u306B\u3059\u308B",
      "Fetch chunks on demand": "\u30E6\u30FC\u30B6\u30FC\u306E\u30BF\u30A4\u30DF\u30F3\u30B0\u3067\u30C1\u30E3\u30F3\u30AF\u306E\u66F4\u65B0\u3092\u78BA\u8A8D\u3059\u308B",
      "Fetch database with previous behaviour": "\u4EE5\u524D\u306E\u624B\u6CD5\u3067\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u53D6\u5F97",
      Filename: "\u30D5\u30A1\u30A4\u30EB\u540D",
      "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.": "PouchDB\u306E\u63A5\u7D9A\u309260\u79D2\u9593\u7DAD\u6301\u3057\u3001\u305D\u306E\u9593\u306B\u5909\u66F4\u304C\u306A\u3044\u5834\u5408\u3001\u63A5\u7D9A\u3092\u5207\u65AD\u3057\u3066\u30BD\u30B1\u30C3\u30C8\u3092\u518D\u3073\u958B\u304D\u307E\u3059\u3002\u30D7\u30ED\u30AD\u30B7\u306B\u3088\u308B\u30EA\u30AF\u30A8\u30B9\u30C8\u6642\u9593\u5236\u9650\u304C\u3042\u308A\u3001\u306A\u304A\u304B\u3064\u30EA\u30BD\u30FC\u30B9\u306E\u4F7F\u7528\u91CF\u304C\u5897\u3048\u308B\u53EF\u80FD\u6027\u304C\u3042\u308B\u5834\u5408\u306B\u4FBF\u5229\u3067\u3059\u3002",
      "Ignore files": "\u7121\u8996\u30D5\u30A1\u30A4\u30EB",
      "Incubate Chunks in Document": "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5185\u3067\u30CF\u30C3\u30C1\u30F3\u30B0\u3092\u884C\u3046",
      "Interval (sec)": "\u79D2",
      "Keep empty folder": "\u7A7A\u30D5\u30A9\u30EB\u30C0\u306E\u7DAD\u6301",
      "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.": "LiveSync\u306F\u3001\u63A5\u982D\u8A5E\u306E\u306A\u3044\u540C\u540D\u306E\u4FDD\u7BA1\u5EAB\u3092\u6271\u3046\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u306E\u8A2D\u5B9A\u306F\u3001\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002",
      "Maximum file size": "\u6700\u5927\u30D5\u30A1\u30A4\u30EB\u5BB9\u91CF",
      "Maximum Incubating Chunk Size": "\u4FDD\u6301\u3059\u308B\u30C1\u30E3\u30F3\u30AF\u306E\u6700\u5927\u30B5\u30A4\u30BA",
      "Maximum Incubating Chunks": "\u6700\u5927\u30CF\u30C3\u30C1\u30F3\u30B0\u6570",
      "Maximum Incubation Period": "\u6700\u5927\u4FDD\u6301\u671F\u9650",
      "Memory cache size (by total characters)": "\u5168\u4F53\u3067\u30AD\u30E3\u30C3\u30B7\u30E5\u3059\u308B\u6587\u5B57\u6570",
      "Memory cache size (by total items)": "\u5168\u4F53\u306E\u30AD\u30E3\u30C3\u30B7\u30E5\u30B5\u30A4\u30BA",
      "moduleLocalDatabase.logWaitingForReady": "\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044...",
      'Not all messages have been translated. And, please revert to "Default" when reporting errors.': '\u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u7FFB\u8A33\u3055\u308C\u3066\u3044\u308B\u308F\u3051\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u307E\u305F\u3001Issue\u5831\u544A\u306E\u969B\u306B\u306F\u3044\u3063\u305F\u3093"Default"\u306B\u623B\u3057\u3066\u304F\u3060\u3055\u3044',
      "Notify all setting files": "\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u901A\u77E5",
      "Notify customized": "\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u304C\u884C\u308F\u308C\u305F\u3089\u901A\u77E5\u3059\u308B",
      "Notify when other device has newly customized.": "\u5225\u306E\u7AEF\u672B\u304C\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3092\u884C\u306A\u3063\u305F\u3089\u901A\u77E5\u3059\u308B",
      "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.": "1\u5EA6\u306B\u51E6\u7406\u3059\u308B\u30D0\u30C3\u30C1\u306E\u6570\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F40\u3001\u6700\u5C0F\u306F2\u3002\u3053\u306E\u6570\u5024\u306F\u3001\u3069\u308C\u3060\u3051\u306E\u5BB9\u91CF\u306E\u66F8\u985E\u304C\u30E1\u30E2\u30EA\u306B\u4FDD\u5B58\u3055\u308C\u308B\u304B\u3082\u5B9A\u7FA9\u3057\u307E\u3059\u3002",
      Passphrase: "\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA",
      "Passphrase of sensitive configuration items": "\u6A5F\u5FAE\u8A2D\u5B9A\u9805\u76EE\u306B\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA\u3092\u4F7F\u7528",
      password: "\u30D1\u30B9\u30EF\u30FC\u30C9",
      Password: "\u30D1\u30B9\u30EF\u30FC\u30C9",
      "Path Obfuscation": "\u30D1\u30B9\u306E\u96E3\u8AAD\u5316",
      "Periodic Sync interval": "\u5B9A\u6642\u540C\u671F\u306E\u611F\u899A",
      Presets: "\u30D7\u30EA\u30BB\u30C3\u30C8",
      Region: "\u30EA\u30FC\u30B8\u30E7\u30F3",
      "Remote server type": "\u30EA\u30E2\u30FC\u30C8\u306E\u7A2E\u5225",
      "Remote Type": "\u540C\u671F\u65B9\u5F0F",
      "Scan changes on customization sync": "\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3055\u308C\u305F\u540C\u671F\u6642\u306B\u3001\u5909\u66F4\u3092\u30B9\u30AD\u30E3\u30F3\u3059\u308B",
      "Scan customization automatically": "\u81EA\u52D5\u7684\u306B\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3092\u30B9\u30AD\u30E3\u30F3",
      "Scan customization before replicating.": "\u30EC\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u524D\u306B\u3001\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3092\u30B9\u30AD\u30E3\u30F3",
      "Scan customization every 1 minute.": "\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u306E\u30B9\u30AD\u30E3\u30F3\u30921\u5206\u3054\u3068\u306B\u884C\u3046",
      "Scan customization periodically": "\u5B9A\u671F\u7684\u306B\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3092\u30B9\u30AD\u30E3\u30F3",
      "Scan for hidden files before replication": "\u30EC\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u958B\u59CB\u524D\u306B\u3001\u96A0\u3057\u30D5\u30A1\u30A4\u30EB\u306E\u30B9\u30AD\u30E3\u30F3\u3092\u884C\u3046",
      "Scan hidden files periodically": "\u5B9A\u671F\u7684\u306B\u96A0\u3057\u30D5\u30A1\u30A4\u30EB\u306E\u30B9\u30AD\u30E3\u30F3\u3092\u884C\u3046",
      "Secret Key": "\u30B7\u30FC\u30AF\u30EC\u30C3\u30C8\u30AD\u30FC",
      "Server URI": "URI",
      "Show only notifications": "\u901A\u77E5\u306E\u307F\u8868\u793A",
      "Show status as icons only": "\u30B9\u30C6\u30FC\u30BF\u30B9\u8868\u793A\u3092\u30A2\u30A4\u30B3\u30F3\u306E\u307F\u306B\u3059\u308B",
      "Show status inside the editor": "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u30A8\u30C7\u30A3\u30BF\u5185\u306B\u8868\u793A",
      "Show status on the status bar": "\u30B9\u30C6\u30FC\u30BF\u30B9\u30D0\u30FC\u306B\u3001\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8868\u793A",
      "Show verbose log. Please enable if you report an issue.": "\u30A8\u30E9\u30FC\u4EE5\u5916\u306E\u8A73\u7D30\u30ED\u30B0\u9805\u76EE\u3082\u8868\u793A\u3059\u308B\u3002\u554F\u984C\u304C\u767A\u751F\u3057\u305F\u5834\u5408\u306F\u6709\u52B9\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
      "Stop reflecting database changes to storage files.": "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u5909\u66F4\u3092\u30B9\u30C8\u30EC\u30FC\u30B8\u30D5\u30A1\u30A4\u30EB\u306B\u53CD\u6620\u3055\u305B\u306A\u3044",
      "Stop watching for file changes.": "\u76E3\u8996\u306E\u505C\u6B62",
      "Suspend database reflecting": "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u53CD\u6620\u306E\u4E00\u6642\u505C\u6B62",
      "Suspend file watching": "\u76E3\u8996\u306E\u4E00\u6642\u505C\u6B62",
      "Sync after merging file": "\u30D5\u30A1\u30A4\u30EB\u304C\u30DE\u30FC\u30B8(\u7D71\u5408)\u3055\u308C\u305F\u6642\u306B\u540C\u671F",
      "Sync Mode": "\u540C\u671F\u30E2\u30FC\u30C9",
      "Sync on Editor Save": "\u30A8\u30C7\u30A3\u30BF\u3067\u306E\u4FDD\u5B58\u6642\u306B\u3001\u540C\u671F\u3055\u308C\u307E\u3059",
      "Sync on File Open": "\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3044\u305F\u6642\u306B\u540C\u671F",
      "Sync on Save": "\u4FDD\u5B58\u6642\u306B\u540C\u671F",
      "Sync on Startup": "\u8D77\u52D5\u6642\u540C\u671F",
      "The Hash algorithm for chunk IDs": "\u30C1\u30E3\u30F3\u30AFID\u306E\u30CF\u30C3\u30B7\u30E5\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0",
      "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.": "\u4E00\u610F\u306E\u540D\u79F0\u3092\u3001\u3059\u3079\u3066\u306E\u7AEF\u672B\u306B\u8A2D\u5B9A\u3057\u307E\u3059\u3002\u3053\u306E\u8A2D\u5B9A\u3092\u5909\u66F4\u3057\u305F\u5834\u5408\u3001\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u540C\u671F\u6A5F\u80FD\u3092\u7121\u52B9\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
      "Use Custom HTTP Handler": "\u30AB\u30B9\u30BF\u30E0HTTP\u30CF\u30F3\u30C9\u30E9\u30FC\u306E\u5229\u7528",
      "Use dynamic iteration count": "\u52D5\u7684\u306A\u7E70\u308A\u8FD4\u3057\u56DE\u6570",
      "Use the trash bin": "\u30B4\u30DF\u7BB1\u3092\u4F7F\u7528",
      "Use timeouts instead of heartbeats": "\u30CF\u30FC\u30C8\u30D3\u30FC\u30C8\u306E\u4EE3\u308F\u308A\u306B\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3092\u4F7F\u7528",
      username: "\u30E6\u30FC\u30B6\u30FC\u540D",
      Username: "\u30E6\u30FC\u30B6\u30FC\u540D",
      "Verbose Log": "\u30A8\u30E9\u30FC\u4EE5\u5916\u306E\u30ED\u30B0\u9805\u76EE",
      "When you save a file in the editor, start a sync automatically": "\u30A8\u30C7\u30A3\u30BF\u3067\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3059\u308B\u3068\u3001\u81EA\u52D5\u7684\u306B\u540C\u671F\u3092\u958B\u59CB\u3057\u307E\u3059",
      "Write credentials in the file": "\u30AF\u30EC\u30C7\u30F3\u30B7\u30E3\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u5185\u4FDD\u5B58",
      "Write logs into the file": "\u30D5\u30A1\u30A4\u30EB\u306B\u30ED\u30B0\u3092\u8A18\u9332"
    };
  }
});

// src/sync/core/common/messages/ja.ts
var PartialMessages3;
var init_ja2 = __esm({
  "src/sync/core/common/messages/ja.ts"() {
    "use strict";
    init_ja();
    PartialMessages3 = {
      ja: ja_default
    };
  }
});

// src/sync/core/common/messagesJson/ko.json
var ko_default;
var init_ko = __esm({
  "src/sync/core/common/messagesJson/ko.json"() {
    ko_default = {
      "(BETA) Always overwrite with a newer file": "(\uBCA0\uD0C0) \uD56D\uC0C1 \uC0C8\uB85C\uC6B4 \uD30C\uC77C\uB85C \uB36E\uC5B4\uC4F0\uAE30",
      "(Beta) Use ignore files": "(\uBCA0\uD0C0) \uC81C\uC678 \uADDC\uCE59 \uD30C\uC77C \uC0AC\uC6A9",
      "(Days passed, 0 to disable automatic-deletion)": "(\uC9C0\uB09C \uC77C\uC218, 0\uC73C\uB85C \uC124\uC815\uD558\uBA74 \uC790\uB3D9 \uC0AD\uC81C \uBE44\uD65C\uC131\uD654)",
      "(ex. Read chunks online) If this option is enabled, LiveSync reads chunks online directly instead of replicating them locally. Increasing Custom chunk size is recommended.": "(\uC608: \uCCAD\uD06C\uB97C \uC6D0\uACA9\uC5D0\uC11C \uC77D\uC74C) \uC774 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uBA74, LiveSync\uB294 \uCCAD\uD06C\uB97C \uB85C\uCEEC\uC5D0 \uBCF5\uC81C\uD558\uC9C0 \uC54A\uACE0 \uC6D0\uACA9\uC5D0\uC11C \uC9C1\uC811 \uC77D\uC2B5\uB2C8\uB2E4. \uCEE4\uC2A4\uD140 \uCCAD\uD06C \uD06C\uAE30\uB97C \uD0A4\uC6B0\uB294 \uAC83\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4.",
      "(MB) If this is set, changes to local and remote files that are larger than this will be skipped. If the file becomes smaller again, a newer one will be used.": "(MB) \uC774 \uAC12\uC774 \uC124\uC815\uB418\uBA74, \uC774\uBCF4\uB2E4 \uD070 \uB85C\uCEEC \uBC0F \uC6D0\uACA9 \uD30C\uC77C\uC758 \uBCC0\uACBD \uC0AC\uD56D\uC740 \uAC74\uB108\uB701\uB2C8\uB2E4. \uD30C\uC77C\uC774 \uB2E4\uC2DC \uC791\uC544\uC9C0\uBA74 \uB354 \uC0C8\uB85C\uC6B4 \uD30C\uC77C\uC774 \uC0AC\uC6A9\uB429\uB2C8\uB2E4.",
      "(Mega chars)": "(\uBA54\uAC00 \uBB38\uC790)",
      "(Not recommended) If set, credentials will be stored in the file.": "(\uAD8C\uC7A5\uD558\uC9C0 \uC54A\uC74C) \uC124\uC815\uD55C \uACBD\uC6B0 \uC790\uACA9 \uC99D\uBA85\uC774 \uD30C\uC77C\uC5D0 \uC800\uC7A5\uB429\uB2C8\uB2E4.",
      "(Obsolete) Use an old adapter for compatibility": "(\uC0AC\uC6A9 \uC911\uB2E8) \uD638\uD658\uC131\uC744 \uC704\uD574 \uC774\uC804 \uC5B4\uB311\uD130 \uC0AC\uC6A9",
      "Access Key": "\uC561\uC138\uC2A4 \uD0A4",
      "Always prompt merge conflicts": "\uD56D\uC0C1 \uBCD1\uD569 \uCDA9\uB3CC \uC54C\uB9BC",
      "Apply Latest Change if Conflicting": "\uCDA9\uB3CC \uC2DC \uCD5C\uC2E0 \uBCC0\uACBD \uC0AC\uD56D \uC801\uC6A9",
      "Apply preset configuration": "\uD504\uB9AC\uC14B \uAD6C\uC131 \uC801\uC6A9",
      "Automatically Sync all files when opening Obsidian.": "Obsidian\uC744 \uC5F4 \uB54C \uBAA8\uB4E0 \uD30C\uC77C\uC744 \uC790\uB3D9\uC73C\uB85C \uB3D9\uAE30\uD654\uD569\uB2C8\uB2E4.",
      "Batch database update": "\uC77C\uAD04 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5C5\uB370\uC774\uD2B8",
      "Batch limit": "\uC77C\uAD04 \uC81C\uD55C",
      "Batch size": "\uC77C\uAD04 \uD06C\uAE30",
      "Batch size of on-demand fetching": "\uD544\uC694 \uC2DC \uAC00\uC838\uC62C \uCCAD\uD06C \uBB36\uC74C \uD06C\uAE30",
      "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.": "v0.17.16 \uC774\uC804\uC5D0\uB294 \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0 \uC774\uC804 \uC5B4\uB311\uD130\uB97C \uC0AC\uC6A9\uD588\uC2B5\uB2C8\uB2E4. \uC774\uC81C\uB294 \uC0C8\uB85C\uC6B4 \uC5B4\uB311\uD130\uB97C \uAD8C\uC7A5\uD569\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uCDA9\uBD84\uD55C \uC2DC\uAC04\uC774 \uC788\uC744 \uB54C \uC774 \uD1A0\uAE00\uC744 \uBE44\uD65C\uC131\uD654\uD574 \uC8FC\uC138\uC694. \uD65C\uC131\uD654\uB41C \uC0C1\uD0DC\uB85C \uB450\uBA74 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uAC00\uC838\uC62C \uB54C\uB3C4 \uC774\uB97C \uBE44\uD65C\uC131\uD654\uD558\uB77C\uB294 \uBA54\uC2DC\uC9C0\uAC00 \uB098\uD0C0\uB0A9\uB2C8\uB2E4.",
      "Bucket Name": "\uBC84\uD0B7 \uC774\uB984",
      "cmdConfigSync.showCustomizationSync": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654 \uD45C\uC2DC",
      "Comma separated `.gitignore, .dockerignore`": "\uC27C\uD45C\uB85C \uAD6C\uBD84\uB41C `.gitignore, .dockerignore`",
      "Compute revisions for chunks": "\uCCAD\uD06C\uC5D0 \uB300\uD55C \uB9AC\uBE44\uC804 \uACC4\uC0B0",
      "Data Compression": "\uB370\uC774\uD130 \uC555\uCD95",
      "Database Name": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC774\uB984",
      "Database suffix": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC811\uBBF8\uC0AC",
      "Delay conflict resolution of inactive files": "\uBE44\uD65C\uC131 \uD30C\uC77C\uC758 \uCDA9\uB3CC \uD574\uACB0 \uC9C0\uC5F0",
      "Delay merge conflict prompt for inactive files.": "\uBE44\uD65C\uC131 \uD30C\uC77C\uC758 \uBCD1\uD569 \uCDA9\uB3CC \uD504\uB86C\uD504\uD2B8 \uC9C0\uC5F0.",
      "Delete old metadata of deleted files on start-up": "\uC2DC\uC791 \uC2DC \uC0AD\uC81C\uB41C \uD30C\uC77C\uC758 \uC624\uB798\uB41C \uBA54\uD0C0\uB370\uC774\uD130 \uC0AD\uC81C",
      "Device name": "\uAE30\uAE30 \uC774\uB984",
      "dialog.yourLanguageAvailable": "Self-hosted LiveSync\uC5D0\uC11C \uADC0\uD558\uC758 \uC5B8\uC5B4\uB85C \uBC88\uC5ED\uC744 \uC81C\uACF5\uD558\uBBC0\uB85C %{Display language} \uC124\uC815\uC774 \uD65C\uC131\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n\n\uCC38\uACE0: \uBAA8\uB4E0 \uBA54\uC2DC\uC9C0\uAC00 \uBC88\uC5ED\uB418\uC9C0\uB294 \uC54A\uC2B5\uB2C8\uB2E4. \uADC0\uD558\uC758 \uAE30\uC5EC\uB97C \uAE30\uB2E4\uB9AC\uACE0 \uC788\uC2B5\uB2C8\uB2E4!\n\uCC38\uACE0 2: \uC774\uC288\uB97C \uC0DD\uC131\uD558\uB294 \uACBD\uC6B0 **%{lang-def}\uB85C \uB418\uB3CC\uB9B0 \uD6C4** \uC2A4\uD06C\uB9B0\uC0F7, \uBA54\uC2DC\uC9C0, \uB85C\uADF8\uB97C \uAC00\uC838\uC640 \uC8FC\uC138\uC694. \uC774\uB294 \uC124\uC815 \uB300\uD654 \uC0C1\uC790\uC5D0\uC11C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\uAC04\uD3B8\uD558\uAC8C \uC0AC\uC6A9\uD558\uC2E4 \uC218 \uC788\uC5C8\uC73C\uBA74 \uC88B\uACA0\uC2B5\uB2C8\uB2E4!",
      "dialog.yourLanguageAvailable.btnRevertToDefault": "%{lang-def} \uC720\uC9C0",
      "dialog.yourLanguageAvailable.Title": " \uBC88\uC5ED\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4!",
      "Disables logging, only shows notifications. Please disable if you report an issue.": "\uB85C\uAE45\uC744 \uBE44\uD65C\uC131\uD654\uD558\uACE0 \uC54C\uB9BC\uB9CC \uD45C\uC2DC\uD569\uB2C8\uB2E4. \uBB38\uC81C\uB97C \uC2E0\uACE0\uD558\uB294 \uACBD\uC6B0 \uBE44\uD65C\uC131\uD654\uD574 \uC8FC\uC138\uC694.",
      "Display Language": "\uD45C\uC2DC \uC5B8\uC5B4",
      "Do not check configuration mismatch before replication": "\uBCF5\uC81C \uC804 \uAD6C\uC131 \uBD88\uC77C\uCE58 \uD655\uC778 \uC548 \uD568",
      "Do not keep metadata of deleted files.": "\uC0AD\uC81C\uB41C \uD30C\uC77C\uC758 \uBA54\uD0C0\uB370\uC774\uD130\uB97C \uBCF4\uAD00\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
      "Do not split chunks in the background": "\uBC31\uADF8\uB77C\uC6B4\uB4DC\uC5D0\uC11C \uCCAD\uD06C \uBD84\uD560 \uC548 \uD568",
      "Do not use internal API": "\uB0B4\uBD80 API \uC0AC\uC6A9 \uC548 \uD568",
      "Doctor.Button.DismissThisVersion": "\uC544\uB2C8\uC694, \uB2E4\uC74C \uB9B4\uB9AC\uC2A4\uAE4C\uC9C0 \uB2E4\uC2DC \uBB3B\uC9C0 \uC54A\uC74C",
      "Doctor.Button.Fix": "\uC218\uC815",
      "Doctor.Button.FixButNoRebuild": "\uC218\uC815\uD558\uC9C0\uB9CC \uC7AC\uAD6C\uCD95\uD558\uC9C0 \uC54A\uC74C",
      "Doctor.Button.No": "\uC544\uB2C8\uC694",
      "Doctor.Button.Skip": "\uADF8\uB300\uB85C \uB450\uAE30",
      "Doctor.Button.Yes": "\uC608",
      "Doctor.Dialogue.Main": "\uC548\uB155\uD558\uC138\uC694! ${activateReason} \uB85C \uC778\uD574 \uAD6C\uC131 \uC9C4\uB2E8 \uB9C8\uBC95\uC0AC\uAC00 \uD65C\uC131\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4!\n\uADF8\uB9AC\uACE0 \uC77C\uBD80 \uAD6C\uC131\uC774 \uC7A0\uC7AC\uC801\uC778 \uBB38\uC81C\uB85C \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n\uC548\uC2EC\uD558\uC138\uC694. \uD558\uB098\uC529 \uD574\uACB0\uD574 \uBD05\uC2DC\uB2E4.\n\n\uB300\uC0C1 \uD56D\uBAA9\uC740 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n\n${issues}\n\n\uC2DC\uC791\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Doctor.Dialogue.MainFix": "**\uAD6C\uC131 \uC774\uB984:** `${name}`\n**\uD604\uC7AC \uAC12:** `${current}`, **\uC774\uC0C1\uC801\uC778 \uAC12:** `${ideal}`\n**\uAD8C\uC7A5 \uC218\uC900:** ${level}\n**\uC65C \uC774\uAC83\uC774 \uAC10\uC9C0\uB418\uC5C8\uB098\uC694?**\n${reason}\n\n\n${note}\n\n\uC774\uC0C1\uC801\uC778 \uAC12\uC73C\uB85C \uC218\uC815\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Doctor.Dialogue.Title": "Self-hosted LiveSync \uAD6C\uC131 \uC9C4\uB2E8 \uB9C8\uBC95\uC0AC",
      "Doctor.Dialogue.TitleAlmostDone": "\uAC70\uC758 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!",
      "Doctor.Dialogue.TitleFix": "\uBB38\uC81C \uD574\uACB0 ${current}/${total}",
      "Doctor.Level.Must": "\uD544\uC218",
      "Doctor.Level.Necessary": "\uD544\uC218",
      "Doctor.Level.Optional": "\uC120\uD0DD\uC0AC\uD56D",
      "Doctor.Level.Recommended": "\uAD8C\uC7A5",
      "Doctor.Message.NoIssues": "\uBB38\uC81C\uAC00 \uAC10\uC9C0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4!",
      "Doctor.Message.RebuildLocalRequired": "\uC8FC\uC758! \uC774\uB97C \uC801\uC6A9\uD558\uB824\uBA74 \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4!",
      "Doctor.Message.RebuildRequired": "\uC8FC\uC758! \uC774\uB97C \uC801\uC6A9\uD558\uB824\uBA74 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4!",
      "Doctor.Message.SomeSkipped": "\uC77C\uBD80 \uBB38\uC81C\uB97C \uADF8\uB300\uB85C \uB450\uC5C8\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uC2DC\uC791 \uC2DC \uB2E4\uC2DC \uC9C8\uBB38\uD560\uAE4C\uC694?",
      "Enable advanced features": "\uACE0\uAE09 \uAE30\uB2A5 \uD65C\uC131\uD654",
      "Enable customization sync": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654 \uD65C\uC131\uD654",
      "Enable Developers' Debug Tools.": "\uAC1C\uBC1C\uC790 \uB514\uBC84\uADF8 \uB3C4\uAD6C \uD65C\uC131\uD654",
      "Enable edge case treatment features": "\uD2B9\uC218 \uC0AC\uB840 \uCC98\uB9AC \uAE30\uB2A5 \uD65C\uC131\uD654",
      "Enable poweruser features": "\uD30C\uC6CC \uC720\uC800 \uAE30\uB2A5 \uD65C\uC131\uD654",
      "Enable this if your Object Storage doesn't support CORS": "\uAC1D\uCCB4 \uC2A4\uD1A0\uB9AC\uC9C0\uAC00 CORS\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uACBD\uC6B0 \uD65C\uC131\uD654\uD558\uC138\uC694",
      "Enable this option to automatically apply the most recent change to documents even when it conflicts": "\uC774 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uBA74 \uCDA9\uB3CC\uC774 \uC788\uC5B4\uB3C4 \uBB38\uC11C\uC5D0 \uAC00\uC7A5 \uCD5C\uADFC \uBCC0\uACBD \uC0AC\uD56D\uC744 \uC790\uB3D9\uC73C\uB85C \uC801\uC6A9\uD569\uB2C8\uB2E4",
      "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC758 \uB0B4\uC6A9\uC744 \uC554\uD638\uD654\uD569\uB2C8\uB2E4. \uD50C\uB7EC\uADF8\uC778\uC758 \uB3D9\uAE30\uD654 \uAE30\uB2A5\uC744 \uC0AC\uC6A9\uD558\uB294 \uACBD\uC6B0 \uD65C\uC131\uD654\uB97C \uAD8C\uC7A5\uD569\uB2C8\uB2E4.",
      "Encrypting sensitive configuration items": "\uBBFC\uAC10\uD55C \uAD6C\uC131 \uD56D\uBAA9 \uC554\uD638\uD654",
      "Encryption phassphrase. If changed, you should overwrite the server's database with the new (encrypted) files.": "\uD328\uC2A4\uD504\uB808\uC774\uC988\uB294 \uC554\uD638\uD654\uC5D0 \uC0AC\uC6A9\uB418\uB294 \uAE34 \uC554\uD638 \uBB38\uAD6C\uC785\uB2C8\uB2E4. \uBCC0\uACBD\uD55C \uACBD\uC6B0, \uC554\uD638\uD654\uB41C \uC0C8 \uD30C\uC77C\uB85C \uC11C\uBC84\uC758 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uB36E\uC5B4\uC368\uC57C \uD569\uB2C8\uB2E4.",
      "End-to-End Encryption": "\uC885\uB2E8\uAC04 \uC554\uD638\uD654",
      "Endpoint URL": "\uC5D4\uB4DC\uD3EC\uC778\uD2B8 URL",
      "Enhance chunk size": "\uCCAD\uD06C \uD06C\uAE30 \uD5A5\uC0C1",
      "Fetch chunks on demand": "\uD544\uC694 \uC2DC \uCCAD\uD06C \uC6D0\uACA9 \uAC00\uC838\uC624\uAE30",
      "Fetch database with previous behaviour": "\uC774\uC804 \uB3D9\uC791\uC73C\uB85C \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAC00\uC838\uC624\uAE30",
      Filename: "\uD30C\uC77C\uBA85",
      "Forces the file to be synced when opened.": "\uD30C\uC77C\uC744 \uC5F4 \uB54C \uAC15\uC81C\uB85C \uB3D9\uAE30\uD654\uD569\uB2C8\uB2E4.",
      "Handle files as Case-Sensitive": "\uD30C\uC77C\uC744 \uB300\uC18C\uBB38\uC790 \uAD6C\uBD84\uC73C\uB85C \uCC98\uB9AC",
      "If disabled(toggled), chunks will be split on the UI thread (Previous behaviour).": "\uBE44\uD65C\uC131\uD654(\uD1A0\uAE00)\uB418\uBA74 \uCCAD\uD06C\uB294 UI \uC2A4\uB808\uB4DC\uC5D0\uC11C \uBD84\uD560\uB429\uB2C8\uB2E4 (\uC774\uC804 \uB3D9\uC791).",
      "If enabled per-filed efficient customization sync will be used. We need a small migration when enabling this. And all devices should be updated to v0.23.18. Once we enabled this, we lost a compatibility with old versions.": "\uD65C\uC131\uD654\uD558\uBA74 \uD30C\uC77C\uBCC4 \uD6A8\uC728\uC801\uC778 \uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654\uAC00 \uC0AC\uC6A9\uB429\uB2C8\uB2E4. \uC774\uB97C \uD65C\uC131\uD654\uD560 \uB54C \uC18C\uADDC\uBAA8 \uB370\uC774\uD130 \uAD6C\uC870 \uC804\uD658\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uBAA8\uB4E0 \uAE30\uAE30\uB97C v0.23.18\uB85C \uC5C5\uB370\uC774\uD2B8\uD574\uC57C \uD569\uB2C8\uB2E4. \uC774\uB97C \uD65C\uC131\uD654\uD558\uBA74 \uC774\uC804 \uBC84\uC804\uACFC\uC758 \uD638\uD658\uC131\uC774 \uC0AC\uB77C\uC9D1\uB2C8\uB2E4.",
      "If enabled, chunks will be split into no more than 100 items. However, dedupe is slightly weaker.": "\uD65C\uC131\uD654\uD558\uBA74 \uCCAD\uD06C\uB294 \uCD5C\uB300 100\uAC1C \uD56D\uBAA9\uC73C\uB85C \uBD84\uD560\uB429\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uC911\uBCF5 \uC81C\uAC70 \uAE30\uB2A5\uC774 \uC57D\uAC04 \uC57D\uD574\uC9D1\uB2C8\uB2E4.",
      "If enabled, newly created chunks are temporarily kept within the document, and graduated to become independent chunks once stabilised.": "\uD65C\uC131\uD654\uD558\uBA74 \uC0C8\uB85C \uC0DD\uC131\uB41C \uBCC0\uACBD \uAE30\uB85D(\uCCAD\uD06C)\uC740 \uBB38\uC11C \uC548\uC5D0 \uC784\uC2DC\uB85C \uBCF4\uAD00\uB418\uBA70, \uC77C\uC815 \uC870\uAC74\uC744 \uB9CC\uC871\uD558\uBA74 \uC790\uB3D9\uC73C\uB85C \uBB38\uC11C \uBC16\uC73C\uB85C \uBD84\uB9AC\uB418\uC5B4 \uC800\uC7A5\uB429\uB2C8\uB2E4.",
      "If enabled, the file under 1kb will be processed in the UI thread.": "\uD65C\uC131\uD654\uD558\uBA74 1kb \uBBF8\uB9CC\uC758 \uD30C\uC77C\uC740 UI \uC2A4\uB808\uB4DC\uC5D0\uC11C \uCC98\uB9AC\uB429\uB2C8\uB2E4.",
      "If enabled, the notification of hidden files change will be suppressed.": "\uD65C\uC131\uD654\uD558\uBA74 \uC228\uACA8\uC9C4 \uD30C\uC77C \uBCC0\uACBD \uC54C\uB9BC\uC774 \uC5B5\uC81C\uB429\uB2C8\uB2E4.",
      "If this enabled, all chunks will be stored with the revision made from its content. (Previous behaviour)": "\uC774 \uC635\uC158\uC774 \uD65C\uC131\uD654\uB418\uBA74 \uBAA8\uB4E0 \uCCAD\uD06C\uB294 \uCF58\uD150\uCE20\uC5D0\uC11C \uC0DD\uC131\uB41C \uB9AC\uBE44\uC804\uACFC \uD568\uAED8 \uC800\uC7A5\uB429\uB2C8\uB2E4. (\uC774\uC804 \uB3D9\uC791)",
      "If this enabled, All files are handled as case-Sensitive (Previous behaviour).": "\uC774 \uC635\uC158\uC774 \uD65C\uC131\uD654\uB418\uBA74 \uBAA8\uB4E0 \uD30C\uC77C\uC774 \uB300\uC18C\uBB38\uC790\uB97C \uAD6C\uBD84\uD558\uC5EC \uCC98\uB9AC\uB429\uB2C8\uB2E4 (\uC774\uC804 \uB3D9\uC791).",
      "If this enabled, chunks will be split into semantically meaningful segments. Not all platforms support this feature.": "\uC774 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uBA74 \uCCAD\uD06C\uAC00 \uBB38\uB2E8\uC774\uB098 \uC758\uBBF8 \uB2E8\uC704\uB85C \uB098\uB258\uC5B4 \uC800\uC7A5\uB429\uB2C8\uB2E4. \uB2E8, \uC774 \uAE30\uB2A5\uC740 \uC77C\uBD80 \uD50C\uB7AB\uD3FC\uC5D0\uC11C\uB294 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "If this is set, changes to local files which are matched by the ignore files will be skipped. Remote changes are determined using local ignore files.": "\uC774 \uC635\uC158\uC744 \uD65C\uC131\uD654\uD558\uBA74, \uC81C\uC678 \uADDC\uCE59 \uD30C\uC77C\uC5D0 \uC77C\uCE58\uD558\uB294 \uB85C\uCEEC \uD30C\uC77C\uC758 \uBCC0\uACBD \uC0AC\uD56D\uC740 \uAC74\uB108\uB701\uB2C8\uB2E4. \uC6D0\uACA9 \uBCC0\uACBD \uC5EC\uBD80 \uB610\uD55C \uB85C\uCEEC\uC758 \uC81C\uC678 \uADDC\uCE59 \uD30C\uC77C\uC5D0 \uB530\uB77C \uD310\uB2E8\uB429\uB2C8\uB2E4.",
      "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.": "\uC774 \uC635\uC158\uC774 \uD65C\uC131\uD654\uB418\uBA74 PouchDB\uB294 \uC5F0\uACB0\uC744 \uB354\uC774\uC0C1 \uBB34\uD55C\uD788 \uC5F4\uC5B4\uB450\uC9C0 \uC54A\uACE0 60\uCD08 \uB3D9\uC548 \uC720\uC9C0\uD569\uB2C8\uB2E4. \uADF8 \uC2DC\uAC04 \uB0B4\uC5D0 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uC5C6\uC73C\uBA74 \uC18C\uCF13\uC744 \uB2EB\uACE0 \uB2E4\uC2DC \uC5FD\uB2C8\uB2E4. \uD504\uB85D\uC2DC\uAC00 \uC694\uCCAD \uC9C0\uC18D \uC2DC\uAC04\uC744 \uC81C\uD55C\uD560 \uB54C \uC720\uC6A9\uD558\uC9C0\uB9CC \uB9AC\uC18C\uC2A4 \uC0AC\uC6A9\uB7C9\uC774 \uC99D\uAC00\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "Ignore files": "\uC81C\uC678 \uADDC\uCE59 \uD30C\uC77C",
      "Incubate Chunks in Document": "\uBB38\uC11C \uB0B4 \uBCC0\uACBD \uAE30\uB85D \uC784\uC2DC \uBCF4\uAD00",
      "Interval (sec)": "\uAC04\uACA9 (\uCD08)",
      "K.exp": "\uC2E4\uD5D8 \uAE30\uB2A5",
      "K.long_p2p_sync": "%{title_p2p_sync} (%{exp})",
      "K.P2P": "%{Peer}-to-%{Peer}",
      "K.Peer": "\uD53C\uC5B4",
      "K.ScanCustomization": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uAC80\uC0C9",
      "K.short_p2p_sync": "P2P \uB3D9\uAE30\uD654 (%{exp})",
      "K.title_p2p_sync": "\uD53C\uC5B4 \uD22C \uD53C\uC5B4(P2P) \uB3D9\uAE30\uD654",
      "Keep empty folder": "\uBE48 \uD3F4\uB354 \uC720\uC9C0",
      lang_def: "Default",
      "lang-de": "Deutsche",
      "lang-def": "%{lang_def}",
      "lang-es": "Espa\xF1ol",
      "lang-ja": "\u65E5\u672C\u8A9E",
      "lang-ko": "\uD55C\uAD6D\uC5B4",
      "lang-ru": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
      "lang-zh": "\u7B80\u4F53\u4E2D\u6587",
      "lang-zh-tw": "\u7E41\u9AD4\u4E2D\u6587",
      "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.": "LiveSync\uB294 \uC11C\uB85C \uB2E4\uB978 \uC811\uB450\uC0AC \uC5C6\uC774 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uC5EC\uB7EC \uBCFC\uD2B8\uB97C \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774\uB294 \uC790\uB3D9\uC73C\uB85C \uAD6C\uC131\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.",
      "liveSyncReplicator.beforeLiveSync": "LiveSync \uC804\uC5D0 OneShot\uC744 \uBA3C\uC800 \uC2DC\uC791\uD569\uB2C8\uB2E4...",
      "liveSyncReplicator.cantReplicateLowerValue": "\uB354 \uB0AE\uC740 \uAC12\uC73C\uB85C \uBCF5\uC81C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "liveSyncReplicator.checkingLastSyncPoint": "\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uB3D9\uAE30\uD654\uB41C \uC9C0\uC810\uC744 \uCC3E\uACE0 \uC788\uC2B5\uB2C8\uB2E4.",
      "liveSyncReplicator.couldNotConnectTo": "${uri}\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${name} \n(${db})",
      "liveSyncReplicator.couldNotConnectToRemoteDb": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${d}",
      "liveSyncReplicator.couldNotConnectToServer": "\uC11C\uBC84\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "liveSyncReplicator.couldNotConnectToURI": "${uri}\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${dbRet}",
      "liveSyncReplicator.couldNotMarkResolveRemoteDb": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uD574\uACB0\uB428\uC73C\uB85C \uD45C\uC2DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "liveSyncReplicator.liveSyncBegin": "LiveSync \uC2DC\uC791...",
      "liveSyncReplicator.lockRemoteDb": "\uB370\uC774\uD130 \uC190\uC0C1\uC744 \uBC29\uC9C0\uD558\uAE30 \uC704\uD574 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC7A0\uAE09\uB2C8\uB2E4",
      "liveSyncReplicator.markDeviceResolved": "\uC774 \uAE30\uAE30\uB97C '\uD574\uACB0\uB428'\uC73C\uB85C \uD45C\uC2DC\uD569\uB2C8\uB2E4.",
      "liveSyncReplicator.oneShotSyncBegin": "OneShot \uB3D9\uAE30\uD654 \uC2DC\uC791... (${syncMode})",
      "liveSyncReplicator.remoteDbCorrupted": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uB354 \uCD5C\uC2E0\uC774\uAC70\uB098 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uCD5C\uC2E0 \uBC84\uC804\uC758 self-hosted-livesync\uAC00 \uC124\uCE58\uB418\uC5B4 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uC138\uC694",
      "liveSyncReplicator.remoteDbCreatedOrConnected": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uC0DD\uC131\uB418\uAC70\uB098 \uC5F0\uACB0\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "liveSyncReplicator.remoteDbDestroyed": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "liveSyncReplicator.remoteDbDestroyError": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC0AD\uC81C \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4:",
      "liveSyncReplicator.remoteDbMarkedResolved": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uD574\uACB0\uB428\uC73C\uB85C \uD45C\uC2DC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "liveSyncReplicator.replicationClosed": "\uBCF5\uC81C\uAC00 \uC885\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "liveSyncReplicator.replicationInProgress": "\uBCF5\uC81C\uAC00 \uC774\uBBF8 \uC9C4\uD589 \uC911\uC785\uB2C8\uB2E4",
      "liveSyncReplicator.retryLowerBatchSize": "\uB354 \uB0AE\uC740 \uC77C\uAD04 \uD06C\uAE30\uB85C \uC7AC\uC2DC\uB3C4: ${batch_size}/${batches_limit}",
      "liveSyncReplicator.unlockRemoteDb": "\uB370\uC774\uD130 \uC190\uC0C1\uC744 \uBC29\uC9C0\uD558\uAE30 \uC704\uD574 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC7A0\uAE08 \uD574\uC81C\uD569\uB2C8\uB2E4",
      "liveSyncSetting.errorNoSuchSettingItem": "\uD574\uB2F9 \uC124\uC815 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${key}",
      "liveSyncSetting.originalValue": "\uC6D0\uBCF8: ${value}",
      "liveSyncSetting.valueShouldBeInRange": "\uAC12\uC740 ${min} < \uAC12 < ${max} \uBC94\uC704\uC5D0 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4",
      "liveSyncSettings.btnApply": "\uC801\uC6A9",
      "logPane.autoScroll": "\uC790\uB3D9 \uC2A4\uD06C\uB864",
      "logPane.logWindowOpened": "\uB85C\uADF8 \uCC3D\uC774 \uC5F4\uB838\uC2B5\uB2C8\uB2E4",
      "logPane.pause": "\uC77C\uC2DC \uC911\uB2E8",
      "logPane.title": "Self-hosted LiveSync \uB85C\uADF8",
      "logPane.wrap": "\uC904 \uBC14\uAFC8",
      "Maximum delay for batch database updating": "\uC77C\uAD04 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5C5\uB370\uC774\uD2B8 \uCD5C\uB300 \uC9C0\uC5F0",
      "Maximum file size": "\uCD5C\uB300 \uD30C\uC77C \uD06C\uAE30",
      "Maximum Incubating Chunk Size": "\uC784\uC2DC \uBCF4\uAD00 \uBCC0\uACBD \uAE30\uB85D\uC758 \uCD5C\uB300 \uD06C\uAE30",
      "Maximum Incubating Chunks": "\uC784\uC2DC \uBCF4\uAD00 \uC911\uC778 \uBCC0\uACBD \uAE30\uB85D \uCD5C\uB300 \uC218",
      "Maximum Incubation Period": "\uBCC0\uACBD \uAE30\uB85D \uC784\uC2DC \uBCF4\uAD00 \uCD5C\uB300 \uC2DC\uAC04",
      "MB (0 to disable).": "MB (0\uC73C\uB85C \uC124\uC815\uD558\uBA74 \uBE44\uD65C\uC131\uD654).",
      "Memory cache size (by total characters)": "\uBA54\uBAA8\uB9AC \uCE90\uC2DC \uD06C\uAE30 (\uCD1D \uBB38\uC790 \uC218)",
      "Memory cache size (by total items)": "\uBA54\uBAA8\uB9AC \uCE90\uC2DC \uD06C\uAE30 (\uCD1D \uD56D\uBAA9 \uC218)",
      "Minimum delay for batch database updating": "\uC77C\uAD04 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5C5\uB370\uC774\uD2B8 \uCD5C\uC18C \uC9C0\uC5F0",
      "moduleCheckRemoteSize.logCheckingStorageSizes": "\uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30 \uD655\uC778 \uC911",
      "moduleCheckRemoteSize.logCurrentStorageSize": "\uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30: ${measuredSize}",
      "moduleCheckRemoteSize.logExceededWarning": "\uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30: ${measuredSize}\uAC00 ${notifySize}\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4",
      "moduleCheckRemoteSize.logThresholdEnlarged": "\uC784\uACC4\uAC12\uC774 ${size}MB\uB85C \uC99D\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "moduleCheckRemoteSize.msgConfirmRebuild": "\uC2DC\uAC04\uC774 \uAF64 \uC624\uB798 \uAC78\uB9B4 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC815\uB9D0 \uC9C0\uAE08 \uBAA8\uB4E0 \uAC83\uC744 \uC7AC\uAD6C\uCD95\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "moduleCheckRemoteSize.msgDatabaseGrowing": "**\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC6A9\uB7C9\uC774 \uC810\uC810 \uCEE4\uC9C0\uACE0 \uC788\uC2B5\uB2C8\uB2E4!** \uD558\uC9C0\uB9CC \uAC71\uC815\uD558\uC9C0 \uB9C8\uC138\uC694. \uC544\uC9C1 \uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uACF5\uAC04\uC774 \uC644\uC804\uD788 \uBD80\uC871\uD574\uC9C4 \uAC74 \uC544\uB2D9\uB2C8\uB2E4.\n\n| \uCE21\uC815\uB41C \uD06C\uAE30 | \uC124\uC815\uB41C \uD55C\uB3C4 |\n| --- | --- |\n| ${estimatedSize} | ${maxSize} |\n\n> [!MORE]-\n> \uC624\uB79C \uAE30\uAC04 \uC0AC\uC6A9\uD588\uB2E4\uBA74 \uCC38\uC870\uB418\uC9C0 \uC54A\uB294 \uCCAD\uD06C, \uC989 '\uC4F0\uB808\uAE30 \uB370\uC774\uD130'\uAC00 \uC313\uC600\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC774 \uACBD\uC6B0 \uC804\uCCB4 \uC7AC\uAD6C\uC131\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4. \uC6A9\uB7C9\uC774 \uD6E8\uC52C \uC904\uC5B4\uB4E4 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> \n> \uB2E8\uC21C\uD788 \uBCFC\uD2B8 \uC790\uCCB4 \uC6A9\uB7C9\uC774 \uCEE4\uC9C0\uACE0 \uC788\uB294 \uAC83\uC774\uB77C\uBA74, \uBA3C\uC800 \uD30C\uC77C\uC744 \uC815\uB9AC\uD55C \uD6C4 \uC804\uCCB4\uB97C \uC7AC\uAD6C\uC131\uD558\uB294 \uAC83\uC774 \uC88B\uC2B5\uB2C8\uB2E4. Self-hosted LiveSync\uB294 \uCC98\uB9AC \uC18D\uB3C4\uB97C \uC704\uD574 \uC0AD\uC81C\uD574\uB3C4 \uC2E4\uC81C \uB370\uC774\uD130\uB97C \uBC14\uB85C \uC9C0\uC6B0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC774 \uB0B4\uC6A9\uC740 [\uAE30\uC220 \uBB38\uC11C](https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/tech_info.md)\uC5D0 \uAC04\uB7B5\uD788 \uC815\uB9AC\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.\n> \n> \uC6A9\uB7C9 \uC99D\uAC00\uAC00 \uAD1C\uCC2E\uB2E4\uBA74 \uC54C\uB9BC \uC784\uACC4\uCE58\uB97C 100MB \uB2E8\uC704\uB85C \uB192\uC77C \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC9C1\uC811 \uC11C\uBC84\uB97C \uC6B4\uC601\uD558\uB294 \uACBD\uC6B0\uC5D0 \uC801\uD569\uD55C \uBC29\uBC95\uC785\uB2C8\uB2E4. \uB2E4\uB9CC, \uAC00\uB054\uC740 \uC804\uCCB4 \uC7AC\uAD6C\uC131\uC744 \uD574\uC8FC\uB294 \uAC83\uC774 \uBC14\uB78C\uC9C1\uD569\uB2C8\uB2E4.\n\n> [!WARNING]\n> \uC804\uCCB4 \uC7AC\uAD6C\uC131\uC744 \uC2E4\uD589\uD560 \uACBD\uC6B0, \uBAA8\uB4E0 \uAE30\uAE30\uAC00 \uBC18\uB4DC\uC2DC \uB3D9\uAE30\uD654\uB418\uC5B4 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4. \uD50C\uB7EC\uADF8\uC778\uC774 \uCD5C\uB300\uD55C \uBCD1\uD569\uD558\uB824\uACE0 \uC2DC\uB3C4\uD558\uAE34 \uD558\uC9C0\uB9CC \uC644\uC804\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "moduleCheckRemoteSize.msgSetDBCapacity": "**\uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uACF5\uAC04\uC774 \uBD80\uC871\uD574\uC9C0\uAE30 \uC804\uC5D0 \uBBF8\uB9AC \uC870\uCE58\uD560 \uC218 \uC788\uB3C4\uB85D** \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC6A9\uB7C9 \uACBD\uACE0\uB97C \uC124\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\uC774 \uAE30\uB2A5\uC744 \uD65C\uC131\uD654\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?\n\n> [!MORE]-\n> - 0: \uC2A4\uD1A0\uB9AC\uC9C0 \uC6A9\uB7C9\uC5D0 \uB300\uD55C \uACBD\uACE0 \uC5C6\uC74C\n>   \uC790\uCCB4 \uC11C\uBC84\uB97C \uC0AC\uC6A9\uD558\uB294 \uB4F1 \uC5EC\uC720 \uACF5\uAC04\uC774 \uCDA9\uBD84\uD55C \uACBD\uC6B0\uC5D0 \uAD8C\uC7A5\uB429\uB2C8\uB2E4. \uC2A4\uD1A0\uB9AC\uC9C0 \uC6A9\uB7C9\uC744 \uC9C1\uC811 \uD655\uC778\uD558\uACE0 \uC218\uB3D9\uC73C\uB85C \uC7AC\uAD6C\uC131\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> - 800: \uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC6A9\uB7C9\uC774 800MB\uB97C \uCD08\uACFC\uD558\uBA74 \uACBD\uACE0\n>   1GB \uC81C\uD55C\uC774 \uC788\uB294 fly.io\uB098 IBM Cloudant \uC0AC\uC6A9 \uC2DC \uAD8C\uC7A5\uB429\uB2C8\uB2E4.\n> - 2000: \uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC6A9\uB7C9\uC774 2GB\uB97C \uCD08\uACFC\uD558\uBA74 \uACBD\uACE0\n\n\uC124\uC815\uD55C \uC6A9\uB7C9 \uD55C\uB3C4\uC5D0 \uB3C4\uB2EC\uD558\uBA74, \uB2E8\uACC4\uC801\uC73C\uB85C \uACBD\uACE0 \uD55C\uB3C4\uB97C \uB298\uB9B4\uC9C0 \uC5EC\uBD80\uB97C \uBB3B\uAC8C \uB429\uB2C8\uB2E4.\n",
      "moduleCheckRemoteSize.option2GB": "2GB (\uD45C\uC900)",
      "moduleCheckRemoteSize.option800MB": "800MB (Cloudant, fly.io)",
      "moduleCheckRemoteSize.optionAskMeLater": "\uB098\uC911\uC5D0 \uBB3C\uC5B4\uBCF4\uAE30",
      "moduleCheckRemoteSize.optionDismiss": "\uBB34\uC2DC",
      "moduleCheckRemoteSize.optionIncreaseLimit": "${newMax}MB\uB85C \uC99D\uAC00",
      "moduleCheckRemoteSize.optionNoWarn": "\uC544\uB2C8\uC694, \uACBD\uACE0\uD558\uC9C0 \uB9C8\uC138\uC694",
      "moduleCheckRemoteSize.optionRebuildAll": "\uC9C0\uAE08 \uBAA8\uB4E0 \uAC83 \uC7AC\uAD6C\uCD95",
      "moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded": "\uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30\uAC00 \uC81C\uD55C\uC744 \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4",
      "moduleCheckRemoteSize.titleDatabaseSizeNotify": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uD06C\uAE30 \uC54C\uB9BC \uC124\uC815",
      "moduleInputUIObsidian.defaultTitleConfirmation": "\uD655\uC778",
      "moduleInputUIObsidian.defaultTitleSelect": "\uC120\uD0DD",
      "moduleInputUIObsidian.optionNo": "\uC544\uB2C8\uC694",
      "moduleInputUIObsidian.optionYes": "\uC608",
      "moduleLiveSyncMain.logAdditionalSafetyScan": "\uCD94\uAC00 \uC548\uC804 \uAC80\uC0AC \uC911...",
      "moduleLiveSyncMain.logLoadingPlugin": "\uD50C\uB7EC\uADF8\uC778 \uB85C\uB529 \uC911...",
      "moduleLiveSyncMain.logPluginInitCancelled": "\uBAA8\uB4C8\uC5D0 \uC758\uD574 \uD50C\uB7EC\uADF8\uC778 \uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "moduleLiveSyncMain.logPluginVersion": "Self-hosted LiveSync v${manifestVersion} ${packageVersion}",
      "moduleLiveSyncMain.logReadChangelog": "LiveSync\uAC00 \uC5C5\uB370\uC774\uD2B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uBCC0\uACBD\uC0AC\uD56D\uC744 \uC77D\uC5B4\uBCF4\uC138\uC694!",
      "moduleLiveSyncMain.logSafetyScanCompleted": "\uCD94\uAC00 \uC548\uC804 \uAC80\uC0AC\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "moduleLiveSyncMain.logSafetyScanFailed": "\uBAA8\uB4C8\uC5D0\uC11C \uCD94\uAC00 \uC548\uC804 \uAC80\uC0AC\uAC00 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
      "moduleLiveSyncMain.logUnloadingPlugin": "\uD50C\uB7EC\uADF8\uC778 \uC5B8\uB85C\uB529 \uC911...",
      "moduleLiveSyncMain.logVersionUpdate": "LiveSync\uAC00 \uC5C5\uB370\uC774\uD2B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD638\uD658\uC131 \uBB38\uC81C\uAC00 \uC788\uB294 \uC5C5\uB370\uC774\uD2B8\uC758 \uACBD\uC6B0 \uBAA8\uB4E0 \uC790\uB3D9 \uB3D9\uAE30\uD654\uAC00 \uC77C\uC2DC\uC801\uC73C\uB85C \uBE44\uD65C\uC131\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD65C\uC131\uD654\uD558\uAE30 \uC804\uC5D0 \uBAA8\uB4E0 \uAE30\uAE30\uAC00 \uCD5C\uC2E0 \uC0C1\uD0DC\uC778\uC9C0 \uD655\uC778\uD558\uC138\uC694.",
      "moduleLiveSyncMain.msgScramEnabled": "Self-hosted LiveSync\uAC00 \uC77C\uBD80 \uC774\uBCA4\uD2B8\uB97C \uBB34\uC2DC\uD558\uB3C4\uB85D \uC124\uC815\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uC774 \uC124\uC815\uC774 \uB9DE\uC2B5\uB2C8\uAE4C?\n\n| \uC720\uD615 | \uC0C1\uD0DC | \uC124\uBA85 |\n|:---:|:---:|---|\n| \uC2A4\uD1A0\uB9AC\uC9C0 \uC774\uBCA4\uD2B8 | ${fileWatchingStatus} | \uBAA8\uB4E0 \uC218\uC815 \uC0AC\uD56D\uC774 \uBB34\uC2DC\uB429\uB2C8\uB2E4 |\n| \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC774\uBCA4\uD2B8 | ${parseReplicationStatus} | \uBAA8\uB4E0 \uB3D9\uAE30\uD654 \uBCC0\uACBD\uC774 \uC9C0\uC5F0\uB429\uB2C8\uB2E4 |\n\n\uC774\uBCA4\uD2B8 \uAC10\uC9C0\uB97C \uB2E4\uC2DC \uD65C\uC131\uD654\uD558\uACE0 Obsidian\uC744 \uC7AC\uC2DC\uC791\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?\n\n> [!DETAILS]-\n> \uC774\uB7EC\uD55C \uC124\uC815\uC740 \uD50C\uB7EC\uADF8\uC778\uC774 \uC7AC\uAD6C\uC131 \uB610\uB294 \uB370\uC774\uD130 \uAC00\uC838\uC624\uAE30 \uC911\uC5D0 \uC790\uB3D9\uC73C\uB85C \uC124\uC815\uD55C \uAC83\uC785\uB2C8\uB2E4. \uD504\uB85C\uC138\uC2A4\uAC00 \uBE44\uC815\uC0C1\uC801\uC73C\uB85C \uC885\uB8CC\uB418\uBA74 \uC774 \uC0C1\uD0DC\uAC00 \uC758\uB3C4\uCE58 \uC54A\uAC8C \uC720\uC9C0\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> \uC0C1\uD0DC\uAC00 \uD655\uC2E4\uD558\uC9C0 \uC54A\uB2E4\uBA74 \uC774 \uACFC\uC815\uC744 \uB2E4\uC2DC \uC2E4\uD589\uD574 \uBCF4\uC138\uC694. \uC7AC\uC2DC\uC791 \uC804\uC5D0 \uBC18\uB4DC\uC2DC \uBCFC\uD2B8\uB97C \uBC31\uC5C5\uD574 \uC8FC\uC138\uC694.",
      "moduleLiveSyncMain.optionKeepLiveSyncDisabled": "LiveSync \uBE44\uD65C\uC131\uD654 \uC720\uC9C0",
      "moduleLiveSyncMain.optionResumeAndRestart": "\uC7AC\uAC1C \uD6C4 Obsidian \uC7AC\uC2DC\uC791",
      "moduleLiveSyncMain.titleScramEnabled": "Scram \uD65C\uC131\uD654\uB428",
      "moduleLocalDatabase.logWaitingForReady": "\uC900\uBE44 \uB300\uAE30 \uC911...",
      "moduleLog.showLog": "\uB85C\uADF8 \uD45C\uC2DC",
      "moduleMigration.docUri": "https://github.com/vrtmrz/obsidian-livesync/blob/main/README.md#how-to-use",
      "moduleMigration.logBulkSendCorrupted": "\uCCAD\uD06C \uC77C\uAD04 \uC804\uC1A1\uC774 \uD65C\uC131\uD654\uB418\uC5C8\uC9C0\uB9CC, \uC774 \uAE30\uB2A5\uC5D0 \uBB38\uC81C\uAC00 \uC788\uC5C8\uC2B5\uB2C8\uB2E4. \uBD88\uD3B8\uC744 \uB4DC\uB824 \uC8C4\uC1A1\uD569\uB2C8\uB2E4. \uC790\uB3D9\uC73C\uB85C \uBE44\uD65C\uC131\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "moduleMigration.logFetchRemoteTweakFailed": "\uC6D0\uACA9 \uC870\uC815 \uAC12\uC744 \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logLocalDatabaseNotReady": "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uC900\uBE44\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logMigratedSameBehaviour": "\uC774\uC804\uACFC \uAC19\uC740 \uBC29\uC2DD\uC73C\uB85C \uB3D9\uC791\uD558\uB3C4\uB85D db:${current}\uB85C \uB370\uC774\uD130 \uAD6C\uC870 \uC804\uD658\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logMigrationFailed": "${old}\uC5D0\uC11C ${current}\uB85C\uC758 \uB370\uC774\uD130 \uAD6C\uC870 \uC804\uD658\uC774 \uC2E4\uD328\uD588\uAC70\uB098 \uC911\uB2E8\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logRedflag2CreationFail": "redflag2 \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logRemoteTweakUnavailable": "\uC6D0\uACA9 \uC870\uC815 \uAC12\uC744 \uAC00\uC838\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
      "moduleMigration.logSetupCancelled": "\uC124\uC815\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4. Self-hosted LiveSync\uAC00 \uC124\uC815\uC744 \uAE30\uB2E4\uB9AC\uACE0 \uC788\uC2B5\uB2C8\uB2E4!",
      "moduleMigration.msgFetchRemoteAgain": "\uC774\uBBF8 \uC54C\uACE0 \uACC4\uC2DC\uACA0\uC9C0\uB9CC, Self-hosted LiveSync\uC758 \uAE30\uBCF8 \uB3D9\uC791 \uBC29\uC2DD\uACFC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAD6C\uC870\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n\n\uB2E4\uD589\uD788\uB3C4 \uC5EC\uB7EC\uBD84\uC758 \uB178\uB825 \uB355\uBD84\uC5D0 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB294 \uC774\uBBF8 \uC131\uACF5\uC801\uC73C\uB85C \uB370\uC774\uD130 \uAD6C\uC870 \uC804\uD658\uC774 \uC644\uB8CC\uB41C \uAC83\uC73C\uB85C \uBCF4\uC785\uB2C8\uB2E4. \uCD95\uD558\uB4DC\uB9BD\uB2C8\uB2E4!\n\n\uD558\uC9C0\uB9CC \uC544\uC9C1 \uC77C\uBD80 \uCD94\uAC00 \uC791\uC5C5\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uC774 \uAE30\uAE30\uC758 \uC124\uC815\uC774 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC640 \uD638\uD658\uB418\uC9C0 \uC54A\uC73C\uBBC0\uB85C, \uC6D0\uACA9 \uB370\uC774\uD130\uB97C \uB2E4\uC2DC \uAC00\uC838\uC640\uC57C \uD569\uB2C8\uB2E4. \uC9C0\uAE08 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uB2E4\uC2DC \uAC00\uC838\uC624\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?\n\n___\uCC38\uACE0: \uC124\uC815\uC774 \uBCC0\uACBD\uB418\uACE0 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uB2E4\uC2DC \uBD88\uB7EC\uC624\uAE30 \uC804\uAE4C\uC9C0\uB294 \uB3D9\uAE30\uD654\uAC00 \uBD88\uAC00\uB2A5\uD569\uB2C8\uB2E4.___\n___\uCC38\uACE02: \uCCAD\uD06C\uB294 \uBCC0\uACBD\uC774 \uBD88\uAC00\uB2A5\uD55C \uAD6C\uC870\uC774\uBBC0\uB85C, \uBA54\uD0C0\uB370\uC774\uD130\uC640 \uCC28\uC774\uC810\uB9CC \uAC00\uC838\uC62C \uC218 \uC788\uC2B5\uB2C8\uB2E4.___",
      "moduleMigration.msgInitialSetup": "\uC774 \uAE30\uAE30\uB294 **\uC544\uC9C1 \uCD08\uAE30 \uC124\uC815\uC774 \uC644\uB8CC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4**. \uC9C0\uAE08\uBD80\uD130 \uC124\uC815 \uACFC\uC815\uC744 \uC548\uB0B4\uD574 \uB4DC\uB9AC\uACA0\uC2B5\uB2C8\uB2E4.\n\n\uBAA8\uB4E0 \uB300\uD654 \uB0B4\uC6A9\uC740 \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uB098\uC911\uC5D0 \uCC38\uACE0\uD558\uB824\uBA74 Obsidian \uB178\uD2B8\uC5D0 \uBD99\uC5EC\uB123\uAC70\uB098 \uBC88\uC5ED \uB3C4\uAD6C\uB97C \uD65C\uC6A9\uD574 \uBC88\uC5ED\uD558\uC154\uB3C4 \uB429\uB2C8\uB2E4.\n\n\uBA3C\uC800, **Setup URI**\uB97C \uAC00\uC9C0\uACE0 \uACC4\uC2E0\uAC00\uC694?\n\n\uCC38\uACE0: Setup URI\uAC00 \uBB34\uC5C7\uC778\uC9C0 \uC798 \uBAA8\uB974\uC2DC\uACA0\uB2E4\uBA74 [\uBB38\uC11C](${URI_DOC})\uB97C \uCC38\uACE0\uD574 \uC8FC\uC138\uC694.",
      "moduleMigration.msgRecommendSetupUri": "Setup URI\uB97C \uC0DD\uC131\uD574 \uC0AC\uC6A9\uD558\uB294 \uAC83\uC744 \uAC15\uB825\uD788 \uAD8C\uC7A5\uD569\uB2C8\uB2E4.\nSetup URI\uAC00 \uBB34\uC5C7\uC778\uC9C0 \uC798 \uBAA8\uB974\uC2DC\uACA0\uB2E4\uBA74 [\uBB38\uC11C](${URI_DOC})\uB97C \uCC38\uACE0\uD574 \uC8FC\uC138\uC694. \uC911\uC694\uD55C \uB0B4\uC6A9\uC774\uB2C8 \uAF2D \uD655\uC778\uD558\uC2DC\uAE30 \uBC14\uB78D\uB2C8\uB2E4.\n\n\uC9C1\uC811 \uC218\uB3D9 \uC124\uC815\uC744 \uC9C4\uD589\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "moduleMigration.msgSinceV02321": "v0.23.21\uBD80\uD130 Self-hosted LiveSync\uC758 \uAE30\uBCF8 \uB3D9\uC791 \uBC29\uC2DD\uACFC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAD6C\uC870\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC8FC\uC694 \uBCC0\uACBD\uC0AC\uD56D\uC740 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4:\n\n1. **\uD30C\uC77C\uBA85 \uB300\uC18C\uBB38\uC790 \uAD6C\uBD84 \uCC98\uB9AC**\n   \uC774\uC81C \uD30C\uC77C\uBA85\uC740 \uB300\uC18C\uBB38\uC790\uB97C \uAD6C\uBD84\uD558\uC9C0 \uC54A\uACE0 \uCC98\uB9AC\uB429\uB2C8\uB2E4. \uC774\uB294 \uD30C\uC77C\uBA85 \uAD6C\uBD84\uC744 \uC81C\uB300\uB85C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 Linux \uBC0F iOS\uB97C \uC81C\uC678\uD55C \uB300\uBD80\uBD84\uC758 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uC720\uB9AC\uD55C \uBCC0\uD654\uC785\uB2C8\uB2E4.\n   (Linux\uB098 iOS\uC5D0\uC11C\uB294 \uB300\uC18C\uBB38\uC790\uB9CC \uB2E4\uB978 \uD30C\uC77C\uC774 \uC874\uC7AC\uD560 \uACBD\uC6B0 \uACBD\uACE0\uAC00 \uD45C\uC2DC\uB429\uB2C8\uB2E4)\n\n2. **\uCCAD\uD06C \uB9AC\uBE44\uC804 \uAD00\uB9AC \uBC29\uC2DD \uAC1C\uC120**\n   \uCCAD\uD06C\uB294 \uBCC0\uACBD \uBD88\uAC00\uB2A5\uD55C(immutable) \uAD6C\uC870\uB85C \uACE0\uC815\uB418\uBA70, \uC774\uB97C \uD1B5\uD574 \uB9AC\uBE44\uC804 \uCC98\uB9AC\uAC00 \uC548\uC815\uD654\uB418\uACE0 \uD30C\uC77C \uC800\uC7A5 \uC131\uB2A5\uC774 \uD5A5\uC0C1\uB429\uB2C8\uB2E4.\n\n___\uB2E8, \uC704 \uAE30\uB2A5\uC744 \uD65C\uC131\uD654\uD558\uB824\uBA74 \uC6D0\uACA9 \uBC0F \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uBAA8\uB450 \uC7AC\uAD6C\uC131\uD574\uC57C \uD569\uB2C8\uB2E4. \uC774 \uACFC\uC815\uC740 \uC218 \uBD84\uC774 \uC18C\uC694\uB418\uBBC0\uB85C \uC5EC\uC720\uAC00 \uC788\uC744 \uB54C \uC2E4\uD589\uD558\uC2DC\uB294 \uAC83\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4.___\n\n- \uAE30\uC874 \uBC29\uC2DD\uB300\uB85C \uC720\uC9C0\uD558\uB824\uBA74 `${KEEP}`\uC744 \uC120\uD0DD\uD574 \uC774 \uACFC\uC815\uC744 \uAC74\uB108\uB6F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n- \uC2DC\uAC04\uC774 \uBD80\uC871\uD558\uB2E4\uBA74 `${DISMISS}`\uB97C \uB20C\uB7EC\uC8FC\uC2DC\uBA74 \uB098\uC911\uC5D0 \uB2E4\uC2DC \uC548\uB0B4\uB4DC\uB9AC\uACA0\uC2B5\uB2C8\uB2E4.\n- \uC774\uBBF8 \uB2E4\uB978 \uAE30\uAE30\uC5D0\uC11C \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC7AC\uAD6C\uC131\uD558\uC168\uB2E4\uBA74 `${DISMISS}`\uB97C \uC120\uD0DD\uD55C \uB4A4 \uB2E4\uC2DC \uB3D9\uAE30\uD654\uD574 \uBCF4\uC138\uC694. \uCC28\uC774\uC810\uC774 \uAC10\uC9C0\uB418\uBA74 \uB2E4\uC2DC \uC548\uB0B4\uB4DC\uB9AC\uACA0\uC2B5\uB2C8\uB2E4.",
      "moduleMigration.optionAdjustRemote": "\uC6D0\uACA9\uC5D0 \uB9DE\uCD94\uAE30",
      "moduleMigration.optionDecideLater": "\uB098\uC911\uC5D0 \uACB0\uC815\uD558\uAE30",
      "moduleMigration.optionEnableBoth": "\uB458 \uB2E4 \uD65C\uC131\uD654",
      "moduleMigration.optionEnableFilenameCaseInsensitive": "#1\uB9CC \uD65C\uC131\uD654",
      "moduleMigration.optionEnableFixedRevisionForChunks": "#2\uB9CC \uD65C\uC131\uD654",
      "moduleMigration.optionHaveSetupUri": "\uC608, \uC788\uC2B5\uB2C8\uB2E4",
      "moduleMigration.optionKeepPreviousBehaviour": "\uC774\uC804 \uB3D9\uC791 \uC720\uC9C0",
      "moduleMigration.optionManualSetup": "\uBAA8\uB4E0 \uAC83\uC744 \uC218\uB3D9\uC73C\uB85C \uC124\uC815",
      "moduleMigration.optionNoAskAgain": "\uC544\uB2C8\uC694 (\uB098\uC911\uC5D0 \uB2E4\uC2DC \uBB3C\uC5B4\uBCF4\uAE30)",
      "moduleMigration.optionNoSetupUri": "\uC544\uB2C8\uC694, \uC5C6\uC2B5\uB2C8\uB2E4",
      "moduleMigration.optionRemindNextLaunch": "\uB2E4\uC74C \uC2DC\uC791 \uC2DC \uC54C\uB9BC",
      "moduleMigration.optionSetupViaP2P": "%{short_p2p_sync}\uB97C \uC0AC\uC6A9\uD558\uC5EC \uC124\uC815",
      "moduleMigration.optionSetupWizard": "\uC124\uC815 \uB9C8\uBC95\uC0AC\uB85C \uC548\uB0B4",
      "moduleMigration.optionYesFetchAgain": "\uC608 (\uB2E4\uC2DC \uAC00\uC838\uC624\uAE30)",
      "moduleMigration.titleCaseSensitivity": "\uB300\uC18C\uBB38\uC790 \uAD6C\uBD84",
      "moduleMigration.titleRecommendSetupUri": "Setup URI \uC0AC\uC6A9 \uAD8C\uC7A5",
      "moduleMigration.titleWelcome": "Self-hosted LiveSync\uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4",
      "moduleObsidianMenu.replicate": "\uBCF5\uC81C",
      "Move remotely deleted files to the trash, instead of deleting.": "\uC6D0\uACA9\uC5D0\uC11C \uC0AD\uC81C\uB41C \uD30C\uC77C\uC744 \uC0AD\uC81C\uD558\uB294 \uB300\uC2E0 \uD734\uC9C0\uD1B5\uC73C\uB85C \uC774\uB3D9\uD569\uB2C8\uB2E4.",
      'Not all messages have been translated. And, please revert to "Default" when reporting errors.': '\uBAA8\uB4E0 \uBA54\uC2DC\uC9C0\uAC00 \uBC88\uC5ED\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uC624\uB958 \uC2E0\uACE0 \uC2DC "\uAE30\uBCF8\uAC12"\uC73C\uB85C \uB418\uB3CC\uB824 \uC8FC\uC138\uC694.',
      "Notify all setting files": "\uBAA8\uB4E0 \uC124\uC815 \uD30C\uC77C \uC54C\uB9BC",
      "Notify customized": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uC54C\uB9BC",
      "Notify when other device has newly customized.": "\uB2E4\uB978 \uAE30\uAE30\uC5D0\uC11C \uC0C8\uB85C\uC6B4 \uC0AC\uC6A9\uC790 \uC124\uC815\uC774 \uC788\uC744 \uB54C \uC54C\uB9BC\uC744 \uBC1B\uC2B5\uB2C8\uB2E4.",
      "Notify when the estimated remote storage size exceeds on start up": "\uC2DC\uC791 \uC2DC \uC608\uC0C1 \uC6D0\uACA9 \uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30\uAC00 \uCD08\uACFC\uB418\uBA74 \uC54C\uB9BC",
      "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.": "\uD55C \uBC88\uC5D0 \uCC98\uB9AC\uD560 \uC77C\uAD04 \uCC98\uB9AC \uC218\uC785\uB2C8\uB2E4. \uAE30\uBCF8\uAC12\uC740 40\uC785\uB2C8\uB2E4. \uCD5C\uC18C\uAC12\uC740 2\uC785\uB2C8\uB2E4. \uC774\uB294 \uC77C\uAD04 \uD06C\uAE30\uC640 \uD568\uAED8 \uBA54\uBAA8\uB9AC\uC5D0 \uBCF4\uAD00\uB418\uB294 \uBB38\uC11C \uC218\uB97C \uC81C\uC5B4\uD569\uB2C8\uB2E4.",
      "Number of changes to sync at a time. Defaults to 50. Minimum is 2.": "\uD55C \uBC88\uC5D0 \uB3D9\uAE30\uD654\uD560 \uBCC0\uACBD \uC0AC\uD56D\uC758 \uC218\uC785\uB2C8\uB2E4. \uAE30\uBCF8\uAC12\uC740 50\uC785\uB2C8\uB2E4. \uCD5C\uC18C\uAC12\uC740 2\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.btnApply": "\uC801\uC6A9",
      "obsidianLiveSyncSettingTab.btnCheck": "\uD655\uC778",
      "obsidianLiveSyncSettingTab.btnCopy": "\uBCF5\uC0AC",
      "obsidianLiveSyncSettingTab.btnDisable": "\uBE44\uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.btnDiscard": "\uC0AD\uC81C",
      "obsidianLiveSyncSettingTab.btnEnable": "\uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.btnFix": "\uC218\uC815",
      "obsidianLiveSyncSettingTab.btnGotItAndUpdated": "\uC54C\uACA0\uC2B5\uB2C8\uB2E4. \uC5C5\uB370\uC774\uD2B8\uD588\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.btnNext": "\uB2E4\uC74C",
      "obsidianLiveSyncSettingTab.btnStart": "\uC2DC\uC791",
      "obsidianLiveSyncSettingTab.btnTest": "\uD14C\uC2A4\uD2B8",
      "obsidianLiveSyncSettingTab.btnUse": "\uC0AC\uC6A9",
      "obsidianLiveSyncSettingTab.buttonFetch": "\uAC00\uC838\uC624\uAE30",
      "obsidianLiveSyncSettingTab.buttonNext": "\uB2E4\uC74C",
      "obsidianLiveSyncSettingTab.defaultLanguage": "\uAE30\uBCF8\uAC12",
      "obsidianLiveSyncSettingTab.descConnectSetupURI": "\uC774\uAC83\uC740 Setup URI\uB85C Self-hosted LiveSync\uB97C \uC124\uC815\uD558\uB294 \uAD8C\uC7A5 \uBC29\uBC95\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.descCopySetupURI": "\uC0C8 \uAE30\uAE30 \uC124\uC815\uC5D0 \uC644\uBCBD\uD569\uB2C8\uB2E4!",
      "obsidianLiveSyncSettingTab.descEnableLiveSync": "\uC704\uC758 \uB450 \uC635\uC158 \uC911 \uD558\uB098\uB97C \uAD6C\uC131\uD558\uAC70\uB098 \uBAA8\uB4E0 \uAD6C\uC131\uC744 \uC218\uB3D9\uC73C\uB85C \uC644\uB8CC\uD55C \uD6C4\uC5D0\uB9CC \uD65C\uC131\uD654\uD558\uC138\uC694.",
      "obsidianLiveSyncSettingTab.descFetchConfigFromRemote": "\uC774\uBBF8 \uAD6C\uC131\uB41C \uC6D0\uACA9 \uC11C\uBC84\uC5D0\uC11C \uD544\uC694\uD55C \uC124\uC815\uC744 \uAC00\uC838\uC635\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.descManualSetup": "\uAD8C\uC7A5\uD558\uC9C0 \uC54A\uC9C0\uB9CC Setup URI\uAC00 \uC5C6\uB294 \uACBD\uC6B0\uC5D0 \uC720\uC6A9\uD569\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.descTestDatabaseConnection": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5F0\uACB0\uC744 \uC5FD\uB2C8\uB2E4. \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uACE0 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC0DD\uC131 \uAD8C\uD55C\uC774 \uC788\uB294 \uACBD\uC6B0, \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uC0DD\uC131\uB429\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.descValidateDatabaseConfig": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAD6C\uC131\uC758 \uC7A0\uC7AC\uC801 \uBB38\uC81C\uB97C \uD655\uC778\uD558\uACE0 \uC218\uC815\uD569\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.errAccessForbidden": "\u2757 \uC561\uC138\uC2A4\uAC00 \uAE08\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.errCannotContinueTest": "\uD14C\uC2A4\uD2B8\uB97C \uACC4\uC18D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.errCorsCredentials": "\u2757 cors.credentials\uAC00 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials": "\u2757 CORS\uC5D0\uC11C \uC790\uACA9 \uC99D\uBA85\uC744 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.errCorsOrigins": "\u2757 cors.origins\uAC00 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.errEnableCors": "\u2757 httpd.enable_cors\uAC00 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.errMaxDocumentSize": "\u2757 couchdb.max_document_size\uAC00 \uB0AE\uC2B5\uB2C8\uB2E4)",
      "obsidianLiveSyncSettingTab.errMaxRequestSize": "\u2757 chttpd.max_http_request_size\uAC00 \uB0AE\uC2B5\uB2C8\uB2E4)",
      "obsidianLiveSyncSettingTab.errMissingWwwAuth": "\u2757 httpd.WWW-Authenticate\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.errRequireValidUser": "\u2757 chttpd.require_valid_user\uAC00 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.errRequireValidUserAuth": "\u2757 chttpd_auth.require_valid_user\uAC00 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.labelDisabled": "\u23F9\uFE0F : \uBE44\uD65C\uC131\uD654\uB428",
      "obsidianLiveSyncSettingTab.labelEnabled": "\u{1F501} : \uD65C\uC131\uD654\uB428",
      "obsidianLiveSyncSettingTab.levelAdvanced": " (\uACE0\uAE09)",
      "obsidianLiveSyncSettingTab.levelEdgeCase": " (\uD2B9\uC218 \uC0AC\uB840)",
      "obsidianLiveSyncSettingTab.levelPowerUser": " (\uD30C\uC6CC \uC720\uC800)",
      "obsidianLiveSyncSettingTab.linkOpenInBrowser": "\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uC5F4\uAE30",
      "obsidianLiveSyncSettingTab.linkPageTop": "\uD398\uC774\uC9C0 \uC0C1\uB2E8",
      "obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting": "\uD301 \uBC0F \uBB38\uC81C \uD574\uACB0",
      "obsidianLiveSyncSettingTab.linkTroubleshooting": "/docs/troubleshooting.md",
      "obsidianLiveSyncSettingTab.logCannotUseCloudant": "\uC774 \uAE30\uB2A5\uC740 IBM Cloudant\uC640 \uD568\uAED8 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.logCheckingConfigDone": "\uAD6C\uC131 \uD655\uC778 \uC644\uB8CC",
      "obsidianLiveSyncSettingTab.logCheckingConfigFailed": "\uAD6C\uC131 \uD655\uC778 \uC2E4\uD328",
      "obsidianLiveSyncSettingTab.logCheckingDbConfig": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAD6C\uC131 \uD655\uC778 \uC911",
      "obsidianLiveSyncSettingTab.logCheckPassphraseFailed": "\uC624\uB958: \uC6D0\uACA9 \uC11C\uBC84\uC640 \uD328\uC2A4\uD504\uB808\uC774\uC988 \uD655\uC778\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4: \n${db}.",
      "obsidianLiveSyncSettingTab.logConfiguredDisabled": "\uAD6C\uC131\uB41C \uB3D9\uAE30\uD654 \uBAA8\uB4DC: \uBE44\uD65C\uC131\uD654\uB428",
      "obsidianLiveSyncSettingTab.logConfiguredLiveSync": "\uAD6C\uC131\uB41C \uB3D9\uAE30\uD654 \uBAA8\uB4DC: LiveSync",
      "obsidianLiveSyncSettingTab.logConfiguredPeriodic": "\uAD6C\uC131\uB41C \uB3D9\uAE30\uD654 \uBAA8\uB4DC: \uC8FC\uAE30\uC801",
      "obsidianLiveSyncSettingTab.logCouchDbConfigFail": "CouchDB \uAD6C\uC131: ${title} \uC2E4\uD328",
      "obsidianLiveSyncSettingTab.logCouchDbConfigSet": "CouchDB \uAD6C\uC131: ${title} -> ${key}\uB97C ${value}\uB85C \uC124\uC815",
      "obsidianLiveSyncSettingTab.logCouchDbConfigUpdated": "CouchDB \uAD6C\uC131: ${title} \uC131\uACF5\uC801\uC73C\uB85C \uC5C5\uB370\uC774\uD2B8\uB428",
      "obsidianLiveSyncSettingTab.logDatabaseConnected": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5F0\uACB0\uB428",
      "obsidianLiveSyncSettingTab.logEncryptionNoPassphrase": "\uD328\uC2A4\uD504\uB808\uC774\uC988 \uC5C6\uC774\uB294 \uC554\uD638\uD654\uB97C \uD65C\uC131\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
      "obsidianLiveSyncSettingTab.logEncryptionNoSupport": "\uAE30\uAE30\uAC00 \uC554\uD638\uD654\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.logErrorOccurred": "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4!",
      "obsidianLiveSyncSettingTab.logEstimatedSize": "\uC608\uC0C1 \uD06C\uAE30: ${size}",
      "obsidianLiveSyncSettingTab.logPassphraseInvalid": "\uD328\uC2A4\uD504\uB808\uC774\uC988\uAC00 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC218\uC815\uD574 \uC8FC\uC138\uC694.",
      "obsidianLiveSyncSettingTab.logPassphraseNotCompatible": "\uC624\uB958: \uD328\uC2A4\uD504\uB808\uC774\uC988\uAC00 \uC6D0\uACA9 \uC11C\uBC84\uC640 \uD638\uD658\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4! \uB2E4\uC2DC \uD655\uC778\uD574 \uC8FC\uC138\uC694!",
      "obsidianLiveSyncSettingTab.logRebuildNote": "\uB3D9\uAE30\uD654\uAC00 \uBE44\uD65C\uC131\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC6D0\uD558\uB294 \uACBD\uC6B0 \uAC00\uC838\uC624\uAE30 \uD6C4 \uB2E4\uC2DC \uD65C\uC131\uD654\uD558\uC138\uC694.",
      "obsidianLiveSyncSettingTab.logSelectAnyPreset": "\uD504\uB9AC\uC14B\uC744 \uC120\uD0DD\uD558\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgAreYouSureProceed": "\uC815\uB9D0\uB85C \uC9C4\uD589\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied": "\uBCC0\uACBD\uC0AC\uD56D\uC744 \uC801\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4!",
      "obsidianLiveSyncSettingTab.msgConfigCheck": "--\uAD6C\uC131 \uD655\uC778--",
      "obsidianLiveSyncSettingTab.msgConfigCheckFailed": "\uAD6C\uC131 \uD655\uC778\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uADF8\uB798\uB3C4 \uACC4\uC18D\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgConnectionCheck": "--\uC5F0\uACB0 \uD655\uC778--",
      "obsidianLiveSyncSettingTab.msgConnectionProxyNote": "\uAD6C\uC131 \uD655\uC778 \uD6C4\uC5D0\uB3C4 \uC5F0\uACB0 \uD655\uC778\uC5D0 \uBB38\uC81C\uAC00 \uC788\uB294 \uACBD\uC6B0, \uB9AC\uBC84\uC2A4 \uD504\uB85D\uC2DC \uAD6C\uC131\uC744 \uD655\uC778\uD574 \uC8FC\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgCurrentOrigin": "\uD604\uC7AC \uC6D0\uC810: {origin}",
      "obsidianLiveSyncSettingTab.msgDiscardConfirmation": "\uC815\uB9D0\uB85C \uAE30\uC874 \uC124\uC815\uACFC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgDone": "--\uC644\uB8CC--",
      "obsidianLiveSyncSettingTab.msgEnableCors": "httpd.enable_cors \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation": "\uC885\uB2E8\uAC04 \uC554\uD638\uD654\uC640 \uACBD\uB85C \uB09C\uB3C5\uD654\uB97C \uD65C\uC131\uD654\uD558\uB294 \uAC83\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4. \uC815\uB9D0\uB85C \uC554\uD638\uD654 \uC5C6\uC774 \uACC4\uC18D\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgFetchConfigFromRemote": "\uC6D0\uACA9 \uC11C\uBC84\uC5D0\uC11C \uAD6C\uC131\uC744 \uAC00\uC838\uC624\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgGenerateSetupURI": "\uBAA8\uB4E0 \uC791\uC5C5\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4! \uB2E4\uB978 \uAE30\uAE30\uB97C \uC124\uC815\uD558\uAE30 \uC704\uD574 Setup URI\uB97C \uC0DD\uC131\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgIfConfigNotPersistent": "\uC11C\uBC84 \uC124\uC815\uC774 \uC601\uAD6C\uC801\uC73C\uB85C \uC800\uC7A5\uB418\uC9C0 \uC54A\uB294 \uD658\uACBD(\uC608: Docker\uC5D0\uC11C \uC2E4\uD589 \uC911)\uC5D0\uC11C\uB294 \uC774\uACF3\uC758 \uAC12\uB4E4\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC5F0\uACB0\uC774 \uAC00\uB2A5\uD574\uC9C0\uBA74 \uC11C\uBC84\uC758 local.ini \uD30C\uC77C\uC5D0\uC11C \uC124\uC815\uC744 \uC218\uB3D9\uC73C\uB85C \uC5C5\uB370\uC774\uD2B8\uD574 \uC8FC\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgInvalidPassphrase": "\uC554\uD638\uD654 \uD328\uC2A4\uD504\uB808\uC774\uC988\uAC00 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC815\uB9D0\uB85C \uACC4\uC18D\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "obsidianLiveSyncSettingTab.msgNewVersionNote": "\uC5C5\uADF8\uB808\uC774\uB4DC \uC54C\uB9BC\uC73C\uB85C \uC5EC\uAE30\uC5D0 \uC624\uC168\uB098\uC694? \uBC84\uC804 \uAE30\uB85D\uC744 \uAC80\uD1A0\uD574 \uC8FC\uC138\uC694. \uB9CC\uC871\uD558\uC2E0\uB2E4\uBA74 \uBC84\uD2BC\uC744 \uD074\uB9AD\uD558\uC138\uC694. \uC0C8\uB85C\uC6B4 \uC5C5\uB370\uC774\uD2B8 \uC2DC \uB2E4\uC2DC \uC548\uB0B4\uB429\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSInfo": "\uBE44 HTTPS URI\uB85C \uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uBAA8\uBC14\uC77C \uAE30\uAE30\uC5D0\uC11C\uB294 \uC791\uB3D9\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC73C\uB2C8 \uC8FC\uC758\uD558\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgNonHTTPSWarning": "\uBE44 HTTPS URI\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uAD6C\uC131\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uACE0 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgNotice": "---\uACF5\uC9C0\uC0AC\uD56D---",
      "obsidianLiveSyncSettingTab.msgObjectStorageWarning": "\u26A0\uFE0F \uC8FC\uC758: \uC774 \uAE30\uB2A5\uC740 \uC544\uC9C1 \uAC1C\uBC1C \uC911(WIP)\uC785\uB2C8\uB2E4. \uB2E4\uC74C \uC0AC\uD56D\uC744 \uC720\uC758\uD574 \uC8FC\uC138\uC694:\n- \uCD94\uAC00 \uC804\uC6A9 \uAD6C\uC870(append-only)\uB85C \uB3D9\uC791\uD569\uB2C8\uB2E4. \uC800\uC7A5 \uC6A9\uB7C9\uC744 \uC904\uC774\uB824\uBA74 \uB370\uC774\uD130 \uC7AC\uAD6C\uC131\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.\n- \uAE30\uB2A5\uC774 \uB2E4\uC18C \uBD88\uC548\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n- \uCD5C\uCD08 \uB3D9\uAE30\uD654 \uC2DC, \uC804\uCCB4 \uD788\uC2A4\uD1A0\uB9AC\uAC00 \uC6D0\uACA9 \uC11C\uBC84\uC5D0\uC11C \uC804\uC1A1\uB429\uB2C8\uB2E4. \uB370\uC774\uD130 \uC6A9\uB7C9 \uC81C\uD55C \uBC0F \uB290\uB9B0 \uC18D\uB3C4\uC5D0 \uC720\uC758\uD574 \uC8FC\uC138\uC694.\n- \uC2E4\uC2DC\uAC04 \uB3D9\uAE30\uD654\uB294 \uBCC0\uACBD\uB41C \uBD80\uBD84\uB9CC \uCC98\uB9AC\uB429\uB2C8\uB2E4.\n\n\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uAC70\uB098 \uAC1C\uC120 \uC544\uC774\uB514\uC5B4\uAC00 \uC788\uC73C\uC2DC\uBA74 GitHub\uC5D0 \uC774\uC288\uB97C \uB4F1\uB85D\uD574 \uC8FC\uC138\uC694.\n\uAE30\uC5EC\uC5D0 \uAE4A\uC774 \uAC10\uC0AC\uB4DC\uB9BD\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.msgOriginCheck": "\uC6D0\uC810 \uD655\uC778: {org}",
      "obsidianLiveSyncSettingTab.msgRebuildRequired": "\uBCC0\uACBD\uC0AC\uD56D\uC744 \uC801\uC6A9\uD558\uB824\uBA74 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC7AC\uAD6C\uCD95\uD574\uC57C \uD569\uB2C8\uB2E4. \uC544\uB798 \uC911 \uD55C \uAC00\uC9C0 \uBC29\uBC95\uC744 \uC120\uD0DD\uD574 \uC8FC\uC138\uC694.\n\n<details>\n<summary>\uBC94\uB840</summary>\n\n| \uAE30\uD638 | \uC758\uBBF8 |\n|: ------ :| ------- |\n| \u21D4 | \uCD5C\uC2E0 \uC0C1\uD0DC |\n| \u21C4 | \uB3D9\uAE30\uD654 \uADE0\uD615 \uC720\uC9C0 |\n| \u21D0,\u21D2 | \uB36E\uC5B4\uC4F0\uAE30 \uBC29\uC2DD\uC758 \uC804\uC1A1 |\n| \u21E0,\u21E2 | \uC0C1\uB300\uD3B8\uC5D0\uC11C \uAC00\uC838\uC640 \uB36E\uC5B4\uC4F0\uAE30 |\n\n</details>\n\n## ${OPTION_REBUILD_BOTH}\n\uAC1C\uC694: \u{1F4C4} \u21D2\xB9 \u{1F4BB} \u21D2\xB2 \u{1F6F0}\uFE0F \u21E2\u207F \u{1F4BB} \u21C4\u207F\u207A\xB9 \u{1F4C4}\n\uC774 \uAE30\uAE30\uC758 \uAE30\uC874 \uD30C\uC77C\uC744 \uAE30\uBC18\uC73C\uB85C \uB85C\uCEEC\uACFC \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uBAA8\uB450 \uC7AC\uAD6C\uCD95\uD569\uB2C8\uB2E4.\n\uC774 \uACFC\uC815\uC5D0\uC11C \uB2E4\uB978 \uAE30\uAE30\uB294 \uC77C\uC2DC\uC801\uC73C\uB85C \uC811\uADFC\uC774 \uC81C\uD55C\uB418\uBA70, \uAC00\uC838\uC624\uAE30 \uC791\uC5C5\uC744 \uBCC4\uB3C4\uB85C \uC218\uD589\uD574\uC57C \uD569\uB2C8\uB2E4.\n\n## ${OPTION_FETCH}\n\uAC1C\uC694: \u{1F4C4} \u21C4\xB2 \u{1F4BB} \u21D0\xB9 \u{1F6F0}\uFE0F \u21D4 \u{1F4BB} \u21D4 \u{1F4C4}\n\uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uCD08\uAE30\uD654\uD55C \uD6C4, \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uB370\uC774\uD130\uB97C \uAC00\uC838\uC640 \uC7AC\uAD6C\uCD95\uD569\uB2C8\uB2E4.\n\uC774\uB294 \uC6D0\uACA9 \uCE21\uC5D0\uC11C \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uBA3C\uC800 \uC7AC\uAD6C\uCD95\uD55C \uACBD\uC6B0\uC5D0\uB3C4 \uD574\uB2F9\uB429\uB2C8\uB2E4.\n\n## ${OPTION_ONLY_SETTING}\n\uC124\uC815\uB9CC \uC800\uC7A5\uD569\uB2C8\uB2E4. **\u26A0\uFE0F \uC8FC\uC758: \uC774 \uBC29\uBC95\uC740 \uB370\uC774\uD130 \uC190\uC0C1\uC744 \uC77C\uC73C\uD0AC \uC218 \uC788\uC2B5\uB2C8\uB2E4.** \uC77C\uBC18\uC801\uC73C\uB85C\uB294 \uC804\uCCB4 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.msgSelectAndApplyPreset": "\uB9C8\uBC95\uC0AC\uB97C \uC644\uB8CC\uD558\uB824\uBA74 \uD504\uB9AC\uC14B \uD56D\uBAA9\uC744 \uC120\uD0DD\uD558\uACE0 \uC801\uC6A9\uD574 \uC8FC\uC138\uC694.",
      "obsidianLiveSyncSettingTab.msgSetCorsCredentials": "cors.credentials \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSetCorsOrigins": "cors.origins \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSetMaxDocSize": "couchdb.max_document_size \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSetMaxRequestSize": "chttpd.max_http_request_size \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUser": "chttpd.require_valid_user = true\uB85C \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth": "chttpd_auth.require_valid_user = true\uB85C \uC124\uC815",
      "obsidianLiveSyncSettingTab.msgSettingModified": '"${setting}" \uC124\uC815\uC774 \uB2E4\uB978 \uAE30\uAE30\uC5D0\uC11C \uC218\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC124\uC815\uC744 \uB2E4\uC2DC \uB85C\uB4DC\uD558\uB824\uBA74 {HERE}\uB97C \uD074\uB9AD\uD558\uC138\uC694. \uBCC0\uACBD\uC0AC\uD56D\uC744 \uBB34\uC2DC\uD558\uB824\uBA74 \uB2E4\uB978 \uACF3\uC744 \uD074\uB9AD\uD558\uC138\uC694.',
      "obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync": '\uB3D9\uAE30\uD654 \uC911\uC5D0\uB294 \uC774 \uC124\uC815\uB4E4\uC744 \uBCC0\uACBD\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC7A0\uAE08\uC744 \uD574\uC81C\uD558\uB824\uBA74 "\uB3D9\uAE30\uD654 \uC124\uC815"\uC5D0\uC11C \uBAA8\uB4E0 \uB3D9\uAE30\uD654\uB97C \uBE44\uD65C\uC131\uD654\uD574 \uC8FC\uC138\uC694.',
      "obsidianLiveSyncSettingTab.msgSetWwwAuth": "httpd.WWW-Authenticate \uC124\uC815",
      "obsidianLiveSyncSettingTab.nameApplySettings": "\uC124\uC815 \uC801\uC6A9",
      "obsidianLiveSyncSettingTab.nameConnectSetupURI": "Setup URI\uB85C \uC5F0\uACB0",
      "obsidianLiveSyncSettingTab.nameCopySetupURI": "\uD604\uC7AC \uC124\uC815\uC744 Setup URI\uB85C \uBCF5\uC0AC",
      "obsidianLiveSyncSettingTab.nameDisableHiddenFileSync": "\uC228\uAE40 \uD30C\uC77C \uB3D9\uAE30\uD654 \uBE44\uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.nameDiscardSettings": "\uAE30\uC874 \uC124\uC815 \uBC0F \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC0AD\uC81C",
      "obsidianLiveSyncSettingTab.nameEnableHiddenFileSync": "\uC228\uAE40 \uD30C\uC77C \uB3D9\uAE30\uD654 \uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.nameEnableLiveSync": "LiveSync \uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.nameHiddenFileSynchronization": "\uC228\uAE40 \uD30C\uC77C \uB3D9\uAE30\uD654",
      "obsidianLiveSyncSettingTab.nameManualSetup": "\uC218\uB3D9 \uC124\uC815",
      "obsidianLiveSyncSettingTab.nameTestConnection": "\uC5F0\uACB0 \uD14C\uC2A4\uD2B8",
      "obsidianLiveSyncSettingTab.nameTestDatabaseConnection": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC5F0\uACB0 \uD14C\uC2A4\uD2B8",
      "obsidianLiveSyncSettingTab.nameValidateDatabaseConfig": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uAD6C\uC131 \uAC80\uC99D",
      "obsidianLiveSyncSettingTab.okAdminPrivileges": "\u2714 \uAD00\uB9AC\uC790 \uAD8C\uD55C\uC774 \uC788\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okCorsCredentials": "\u2714 cors.credentials\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin": "CORS \uC790\uACA9 \uC99D\uBA85 \uC815\uC0C1",
      "obsidianLiveSyncSettingTab.okCorsOriginMatched": "\u2714 CORS \uC6D0\uC810 \uC815\uC0C1",
      "obsidianLiveSyncSettingTab.okCorsOrigins": "\u2714 cors.origins\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okEnableCors": "\u2714 httpd.enable_cors\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okMaxDocumentSize": "\u2714 couchdb.max_document_size\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okMaxRequestSize": "\u2714 chttpd.max_http_request_size\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okRequireValidUser": "\u2714 chttpd.require_valid_user\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okRequireValidUserAuth": "\u2714 chttpd_auth.require_valid_user\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.okWwwAuth": "\u2714 httpd.WWW-Authenticate\uAC00 \uC815\uC0C1\uC785\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.optionApply": "\uC801\uC6A9",
      "obsidianLiveSyncSettingTab.optionCancel": "\uCDE8\uC18C",
      "obsidianLiveSyncSettingTab.optionCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.optionDisableAllAutomatic": "\uBAA8\uB4E0 \uC790\uB3D9 \uBE44\uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.optionFetchFromRemote": "\uC6D0\uACA9\uC5D0\uC11C \uAC00\uC838\uC624\uAE30",
      "obsidianLiveSyncSettingTab.optionHere": "\uC5EC\uAE30",
      "obsidianLiveSyncSettingTab.optionLiveSync": "LiveSync",
      "obsidianLiveSyncSettingTab.optionMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.optionOkReadEverything": "\uB124, \uBAA8\uB4E0 \uAC83\uC744 \uC77D\uC5C8\uC2B5\uB2C8\uB2E4.",
      "obsidianLiveSyncSettingTab.optionOnEvents": "\uC774\uBCA4\uD2B8 \uC2DC",
      "obsidianLiveSyncSettingTab.optionPeriodicAndEvents": "\uC8FC\uAE30\uC801 \uBC0F \uC774\uBCA4\uD2B8 \uC2DC",
      "obsidianLiveSyncSettingTab.optionPeriodicWithBatch": "\uC8FC\uAE30\uC801 w/ \uC77C\uAD04",
      "obsidianLiveSyncSettingTab.optionRebuildBoth": "\uC774 \uAE30\uAE30\uC5D0\uC11C \uB458 \uB2E4 \uC7AC\uAD6C\uCD95",
      "obsidianLiveSyncSettingTab.optionSaveOnlySettings": "(\uC704\uD5D8) \uC124\uC815\uB9CC \uC800\uC7A5",
      "obsidianLiveSyncSettingTab.panelChangeLog": "\uBCC0\uACBD \uB85C\uADF8",
      "obsidianLiveSyncSettingTab.panelGeneralSettings": "\uC77C\uBC18 \uC124\uC815",
      "obsidianLiveSyncSettingTab.panelPrivacyEncryption": "\uAC1C\uC778\uC815\uBCF4 \uBCF4\uD638 \uBC0F \uC554\uD638\uD654",
      "obsidianLiveSyncSettingTab.panelRemoteConfiguration": "\uC6D0\uACA9 \uAD6C\uC131",
      "obsidianLiveSyncSettingTab.panelSetup": "\uC124\uC815",
      "obsidianLiveSyncSettingTab.titleAppearance": "\uC678\uAD00",
      "obsidianLiveSyncSettingTab.titleConflictResolution": "\uCDA9\uB3CC \uD574\uACB0",
      "obsidianLiveSyncSettingTab.titleCongratulations": "\uCD95\uD558\uD569\uB2C8\uB2E4!",
      "obsidianLiveSyncSettingTab.titleCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.titleDeletionPropagation": "\uC0AD\uC81C \uC804\uD30C",
      "obsidianLiveSyncSettingTab.titleEncryptionNotEnabled": "\uC554\uD638\uD654\uAC00 \uD65C\uC131\uD654\uB418\uC9C0 \uC54A\uC74C",
      "obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid": "\uC554\uD638\uD654 \uD328\uC2A4\uD504\uB808\uC774\uC988 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC74C",
      "obsidianLiveSyncSettingTab.titleExtraFeatures": "\uCD94\uAC00 \uBC0F \uACE0\uAE09 \uAE30\uB2A5 \uD65C\uC131\uD654",
      "obsidianLiveSyncSettingTab.titleFetchConfig": "\uAD6C\uC131 \uAC00\uC838\uC624\uAE30",
      "obsidianLiveSyncSettingTab.titleFetchConfigFromRemote": "\uC6D0\uACA9 \uC11C\uBC84\uC5D0\uC11C \uAD6C\uC131 \uAC00\uC838\uC624\uAE30",
      "obsidianLiveSyncSettingTab.titleFetchSettings": "\uC124\uC815 \uAC00\uC838\uC624\uAE30",
      "obsidianLiveSyncSettingTab.titleHiddenFiles": "\uC228\uAE40 \uD30C\uC77C",
      "obsidianLiveSyncSettingTab.titleLogging": "\uB85C\uAE45",
      "obsidianLiveSyncSettingTab.titleMinioS3R2": "Minio,S3,R2",
      "obsidianLiveSyncSettingTab.titleNotification": "\uC54C\uB9BC",
      "obsidianLiveSyncSettingTab.titleOnlineTips": "\uC628\uB77C\uC778 \uD301",
      "obsidianLiveSyncSettingTab.titleQuickSetup": "\uBE60\uB978 \uC124\uC815",
      "obsidianLiveSyncSettingTab.titleRebuildRequired": "\uC7AC\uAD6C\uCD95 \uD544\uC694",
      "obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed": "\uC6D0\uACA9 \uAD6C\uC131 \uD655\uC778 \uC2E4\uD328",
      "obsidianLiveSyncSettingTab.titleRemoteServer": "\uC6D0\uACA9 \uC11C\uBC84",
      "obsidianLiveSyncSettingTab.titleReset": "\uB9AC\uC14B",
      "obsidianLiveSyncSettingTab.titleSetupOtherDevices": "\uB2E4\uB978 \uAE30\uAE30 \uC124\uC815",
      "obsidianLiveSyncSettingTab.titleSynchronizationMethod": "\uB3D9\uAE30\uD654 \uBC29\uBC95",
      "obsidianLiveSyncSettingTab.titleSynchronizationPreset": "\uB3D9\uAE30\uD654 \uD504\uB9AC\uC14B",
      "obsidianLiveSyncSettingTab.titleSyncSettings": "\uB3D9\uAE30\uD654 \uC124\uC815",
      "obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown": "\uB9C8\uD06C\uB2E4\uC6B4\uC744 \uD1B5\uD55C \uB3D9\uAE30\uD654 \uC124\uC815",
      "obsidianLiveSyncSettingTab.titleUpdateThinning": "\uC5C5\uB370\uC774\uD2B8 \uC18E\uC544\uB0B4\uAE30",
      "obsidianLiveSyncSettingTab.warnCorsOriginUnmatched": "\u26A0 CORS \uC6D0\uC810\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 {from}->{to}",
      "obsidianLiveSyncSettingTab.warnNoAdmin": "\u26A0 \uAD00\uB9AC\uC790 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "P2P.AskPassphraseForDecrypt": "\uC6D0\uACA9 \uD53C\uC5B4\uAC00 \uAD6C\uC131\uC744 \uACF5\uC720\uD588\uC2B5\uB2C8\uB2E4. \uAD6C\uC131\uC744 \uBCF5\uD638\uD654\uD558\uB824\uBA74 \uD328\uC2A4\uD504\uB808\uC774\uC988\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694.",
      "P2P.AskPassphraseForShare": "\uC6D0\uACA9 \uD53C\uC5B4\uAC00 \uC774 \uAE30\uAE30\uC758 \uAD6C\uC131\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4. \uAD6C\uC131\uC744 \uACF5\uC720\uD558\uB824\uBA74 \uD328\uC2A4\uD504\uB808\uC774\uC988\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694. \uC774 \uB300\uD654\uC0C1\uC790\uB97C \uCDE8\uC18C\uD558\uC5EC \uC694\uCCAD\uC744 \uBB34\uC2DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "P2P.DisabledButNeed": "%{title_p2p_sync}\uAC00 \uBE44\uD65C\uC131\uD654\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uC815\uB9D0\uB85C \uD65C\uC131\uD654\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "P2P.FailedToOpen": "\uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84\uC5D0 P2P \uC5F0\uACB0\uC744 \uC5F4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "P2P.NoAutoSyncPeers": "\uC790\uB3D9 \uB3D9\uAE30\uD654 \uD53C\uC5B4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. %{long_p2p_sync} \uCC3D\uC5D0\uC11C \uD53C\uC5B4\uB97C \uC124\uC815\uD574 \uC8FC\uC138\uC694.",
      "P2P.NoKnownPeers": "\uD53C\uC5B4\uAC00 \uAC10\uC9C0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uB2E4\uB978 \uD53C\uC5B4\uC758 \uC811\uC18D\uC744 \uAE30\uB2E4\uB9AC\uACE0 \uC788\uC2B5\uB2C8\uB2E4...",
      "P2P.Note.description": "\uC774 \uBCF5\uC81C\uAE30\uB294 \uD53C\uC5B4 \uD22C \uD53C\uC5B4(P2P) \uC5F0\uACB0\uC744 \uD1B5\uD574 \uB2E4\uB978 \uAE30\uAE30\uB4E4\uACFC \uBCFC\uD2B8\uB97C \uB3D9\uAE30\uD654\uD560 \uC218 \uC788\uB3C4\uB85D \uD569\uB2C8\uB2E4. \uD074\uB77C\uC6B0\uB4DC \uC11C\uBE44\uC2A4\uB97C \uAC70\uCE58\uC9C0 \uC54A\uACE0\uB3C4 \uAE30\uAE30\uAC04 \uB3D9\uAE30\uD654\uB97C \uAD6C\uD604\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\n\uC774 \uBCF5\uC81C\uAE30\uB294 Trystero\uB97C \uAE30\uBC18\uC73C\uB85C \uD558\uBA70, \uAE30\uAE30 \uAC04 \uC5F0\uACB0\uC744 \uC124\uC815\uD558\uAE30 \uC704\uD574 \uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4. \uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84\uB294 \uB2E8\uC21C\uD788 \uC5F0\uACB0 \uC815\uBCF4\uB97C \uAD50\uD658\uD558\uB294 \uC6A9\uB3C4\uB85C\uB9CC \uC0AC\uC6A9\uB418\uBA70, \uC0AC\uC6A9\uC790 \uB370\uC774\uD130\uB97C \uC800\uC7A5\uD558\uAC70\uB098 \uC811\uADFC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (\uB610\uB294 \uADF8\uB798\uC57C\uB9CC \uD569\uB2C8\uB2E4).\n\n\uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84\uB294 \uB204\uAD6C\uB098 \uC6B4\uC601\uD560 \uC218 \uC788\uC73C\uBA70, \uC774\uB294 \uB2E8\uC21C\uD55C Nostr \uB9B4\uB808\uC774\uC785\uB2C8\uB2E4. \uD3B8\uC758\uC131\uACFC \uBCF5\uC81C\uAE30\uC758 \uC791\uB3D9 \uD655\uC778\uC744 \uC704\uD574 `vrtmrz`\uAC00 \uC790\uCCB4\uC801\uC73C\uB85C \uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84 \uC778\uC2A4\uD134\uC2A4\uB97C \uC6B4\uC601 \uC911\uC785\uB2C8\uB2E4. \uC0AC\uC6A9\uC790\uB294 `vrtmrz`\uAC00 \uC81C\uACF5\uD558\uB294 \uC2E4\uD5D8\uC6A9 \uC11C\uBC84\uB97C \uC0AC\uC6A9\uD560 \uC218\uB3C4 \uC788\uACE0, \uBCC4\uB3C4\uB85C \uC790\uC2E0\uB9CC\uC758 \uC11C\uBC84\uB97C \uC124\uC815\uD560 \uC218\uB3C4 \uC788\uC2B5\uB2C8\uB2E4.\n\n\uCC38\uACE0\uB85C, \uC2DC\uADF8\uB110\uB9C1 \uC11C\uBC84\uB294 \uC0AC\uC6A9\uC790 \uB370\uC774\uD130\uB97C \uC800\uC7A5\uD558\uC9C0 \uC54A\uB354\uB77C\uB3C4 \uC77C\uBD80 \uAE30\uAE30\uC758 \uC5F0\uACB0 \uC815\uBCF4\uB294 \uBCFC \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC774 \uC810\uC744 \uC720\uC758\uD574 \uC8FC\uC138\uC694. \uD2B9\uD788 \uD0C0\uC778\uC774 \uC6B4\uC601\uD558\uB294 \uC11C\uBC84\uB97C \uC0AC\uC6A9\uD560 \uACBD\uC6B0 \uC8FC\uC758\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.",
      "P2P.Note.important_note": "\uD53C\uC5B4 \uD22C \uD53C\uC5B4(P2P) \uBCF5\uC81C\uAE30\uC758 \uC2E4\uD5D8\uC801 \uAD6C\uD604\uC785\uB2C8\uB2E4.",
      "P2P.Note.important_note_sub": "\uC774 \uAE30\uB2A5\uC740 \uC544\uC9C1 \uC2E4\uD5D8 \uB2E8\uACC4\uC5D0 \uC788\uC2B5\uB2C8\uB2E4. \uC774 \uAE30\uB2A5\uC774 \uC608\uC0C1\uB300\uB85C \uC791\uB3D9\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC74C\uC744 \uC54C\uC544\uC8FC\uC138\uC694. \uB610\uD55C \uBC84\uADF8, \uBCF4\uC548 \uBB38\uC81C \uBC0F \uAE30\uD0C0 \uBB38\uC81C\uAC00 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC774 \uAE30\uB2A5\uC744 \uC0AC\uC6A9\uD560 \uB54C\uB294 \uBCF8\uC778\uC758 \uCC45\uC784 \uD558\uC5D0 \uC0AC\uC6A9\uD558\uC138\uC694. \uC774 \uAE30\uB2A5\uC758 \uAC1C\uBC1C\uC5D0 \uAE30\uC5EC\uD574 \uC8FC\uC138\uC694.",
      "P2P.Note.Summary": "\uC774 \uAE30\uB2A5\uC740 \uBB34\uC5C7\uC778\uAC00\uC694? (\uC124\uBA85\uACFC \uCC38\uACE0\uC0AC\uD56D\uC774 \uC801\uD600\uC788\uC2B5\uB2C8\uB2E4. \uD55C \uBC88 \uC77D\uC5B4\uBCF4\uC138\uC694!)",
      "P2P.NotEnabled": "%{title_p2p_sync}\uAC00 \uD65C\uC131\uD654\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uC0C8\uB85C\uC6B4 \uC5F0\uACB0\uC744 \uC5F4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
      "P2P.P2PReplication": "%{P2P} \uBCF5\uC81C",
      "P2P.PaneTitle": "%{long_p2p_sync}",
      "P2P.ReplicatorInstanceMissing": "P2P \uB3D9\uAE30\uD654 \uBCF5\uC81C\uAE30\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uAD6C\uC131\uB418\uC9C0 \uC54A\uC558\uAC70\uB098 \uD65C\uC131\uD654\uB418\uC9C0 \uC54A\uC558\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "P2P.SeemsOffline": "\uD53C\uC5B4 ${name}\uC774(\uAC00) \uC624\uD504\uB77C\uC778\uC778 \uAC83 \uAC19\uC2B5\uB2C8\uB2E4. \uAC74\uB108\uB701\uB2C8\uB2E4.",
      "P2P.SyncAlreadyRunning": "P2P \uB3D9\uAE30\uD654\uAC00 \uC774\uBBF8 \uC2E4\uD589 \uC911\uC785\uB2C8\uB2E4.",
      "P2P.SyncCompleted": "P2P \uB3D9\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "P2P.SyncStartedWith": "${name}\uACFC\uC758 P2P \uB3D9\uAE30\uD654\uAC00 \uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      Passphrase: "\uD328\uC2A4\uD504\uB808\uC774\uC988",
      "Passphrase of sensitive configuration items": "\uBBFC\uAC10\uD55C \uAD6C\uC131 \uD56D\uBAA9\uC758 \uD328\uC2A4\uD504\uB808\uC774\uC988",
      password: "\uBE44\uBC00\uBC88\uD638",
      Password: "\uBE44\uBC00\uBC88\uD638",
      "Path Obfuscation": "\uACBD\uB85C \uB09C\uB3C5\uD654",
      "Per-file-saved customization sync": "\uD30C\uC77C\uBCC4 \uC800\uC7A5 \uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654",
      "Periodic Sync interval": "\uC8FC\uAE30\uC801 \uB3D9\uAE30\uD654 \uAC04\uACA9",
      Presets: "\uD504\uB9AC\uC14B",
      "Process small files in the foreground": "\uD3EC\uADF8\uB77C\uC6B4\uB4DC\uC5D0\uC11C \uC791\uC740 \uD30C\uC77C \uCC98\uB9AC",
      "RedFlag.Fetch.Method.Desc": "\uC5B4\uB5BB\uAC8C \uAC00\uC838\uC624\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?\n- %{RedFlag.Fetch.Method.FetchSafer}. (\uAD8C\uC7A5)\n  **\uB0AE\uC740 \uD2B8\uB798\uD53D**, **\uB192\uC740 CPU**, **\uB0AE\uC740 \uC704\uD5D8**\n- %{RedFlag.Fetch.Method.FetchSmoother}.\n  **\uB0AE\uC740 \uD2B8\uB798\uD53D**, **\uBCF4\uD1B5 CPU**, **\uB0AE\uC74C\uC5D0\uC11C \uBCF4\uD1B5 \uC704\uD5D8**\n- %{RedFlag.Fetch.Method.FetchTraditional}.\n  **\uB192\uC740 \uD2B8\uB798\uD53D**, **\uB0AE\uC740 CPU**, **\uB0AE\uC74C\uC5D0\uC11C \uBCF4\uD1B5 \uC704\uD5D8**\n\n>[!INFO]- \uC138\uBD80 \uC0AC\uD56D\n> ## %{RedFlag.Fetch.Method.FetchSafer}. (\uAD8C\uC7A5)\n> **\uB0AE\uC740 \uD2B8\uB798\uD53D**, **\uB192\uC740 CPU**, **\uB0AE\uC740 \uC704\uD5D8**\n> \uC774 \uC635\uC158\uC740 \uC6D0\uACA9 \uC18C\uC2A4\uC5D0\uC11C \uB370\uC774\uD130\uB97C \uAC00\uC838\uC624\uAE30 \uC804\uC5D0 \uAE30\uC874 \uB85C\uCEEC \uD30C\uC77C\uC744 \uC0AC\uC6A9\uD558\uC5EC \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uBA3C\uC800 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n> \uB85C\uCEEC\uACFC \uC6D0\uACA9 \uBAA8\uB450\uC5D0 \uC77C\uCE58\uD558\uB294 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB458 \uC0AC\uC774\uC758 \uCC28\uC774\uC810\uB9CC \uC804\uC1A1\uB429\uB2C8\uB2E4.\n> \uD558\uC9C0\uB9CC \uB450 \uC704\uCE58 \uBAA8\uB450\uC5D0 \uC788\uB294 \uD30C\uC77C\uC740 \uCD08\uAE30\uC5D0 \uCDA9\uB3CC \uD30C\uC77C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4. \uC2E4\uC81C\uB85C \uCDA9\uB3CC\uD558\uC9C0 \uC54A\uB294\uB2E4\uBA74 \uC790\uB3D9\uC73C\uB85C \uD574\uACB0\uB418\uC9C0\uB9CC \uC774 \uACFC\uC815\uC740 \uC2DC\uAC04\uC774 \uAC78\uB9B4 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> \uC774\uB294 \uC77C\uBC18\uC801\uC73C\uB85C \uAC00\uC7A5 \uC548\uC804\uD55C \uBC29\uBC95\uC73C\uB85C \uB370\uC774\uD130 \uC190\uC2E4 \uC704\uD5D8\uC744 \uCD5C\uC18C\uD654\uD569\uB2C8\uB2E4.\n> ## %{RedFlag.Fetch.Method.FetchSmoother}.\n> **\uB0AE\uC740 \uD2B8\uB798\uD53D**, **\uBCF4\uD1B5 CPU**, **\uB0AE\uC74C\uC5D0\uC11C \uBCF4\uD1B5 \uC704\uD5D8** (\uC791\uC5C5\uC5D0 \uB530\uB77C)\n> \uC774 \uC635\uC158\uC740 \uBA3C\uC800 \uB85C\uCEEC \uD30C\uC77C\uC5D0\uC11C \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC6A9 \uCCAD\uD06C\uB97C \uC0DD\uC131\uD55C \uB2E4\uC74C \uB370\uC774\uD130\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4. \uB530\uB77C\uC11C \uB85C\uCEEC\uC5D0 \uC5C6\uB294 \uCCAD\uD06C\uB9CC \uC804\uC1A1\uB429\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uBAA8\uB4E0 \uBA54\uD0C0\uB370\uC774\uD130\uB294 \uC6D0\uACA9 \uC18C\uC2A4\uC5D0\uC11C \uAC00\uC838\uC635\uB2C8\uB2E4.\n> \uADF8\uB7F0 \uB2E4\uC74C \uB85C\uCEEC \uD30C\uC77C\uC774 \uC2DC\uC791 \uC2DC \uC774 \uBA54\uD0C0\uB370\uC774\uD130\uC640 \uBE44\uAD50\uB429\uB2C8\uB2E4. \uB354 \uC0C8\uB85C\uC6B4 \uAC83\uC73C\uB85C \uAC04\uC8FC\uB418\uB294 \uCF58\uD150\uCE20\uAC00 \uC624\uB798\uB41C \uAC83\uC744 \uB36E\uC5B4\uC501\uB2C8\uB2E4(\uC218\uC815 \uC2DC\uAC04 \uAE30\uC900). \uC774 \uACB0\uACFC\uB294 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0 \uB2E4\uC2DC \uB3D9\uAE30\uD654\uB429\uB2C8\uB2E4.\n> \uB85C\uCEEC \uD30C\uC77C\uC774 \uC2E4\uC81C\uB85C \uCD5C\uC2E0 \uD0C0\uC784\uC2A4\uD0EC\uD504\uB77C\uBA74 \uC77C\uBC18\uC801\uC73C\uB85C \uC548\uC804\uD569\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uD30C\uC77C\uC774 \uB354 \uC0C8\uB85C\uC6B4 \uD0C0\uC784\uC2A4\uD0EC\uD504\uB97C \uAC00\uC9C0\uACE0 \uC788\uC9C0\uB9CC \uB354 \uC624\uB798\uB41C \uCF58\uD150\uCE20\uB97C \uAC00\uC9C0\uACE0 \uC788\uB2E4\uBA74(\uCD08\uAE30 `welcome.md`\uCC98\uB7FC) \uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> \uC774\uB294 \"%{RedFlag.Fetch.Method.FetchSafer}\"\uBCF4\uB2E4 CPU\uB97C \uB35C \uC0AC\uC6A9\uD558\uACE0 \uB354 \uBE60\uB974\uC9C0\uB9CC \uC8FC\uC758 \uAE4A\uAC8C \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC73C\uBA74 \uB370\uC774\uD130 \uC190\uC2E4\uB85C \uC774\uC5B4\uC9C8 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> ## %{RedFlag.Fetch.Method.FetchTraditional}.\n> **\uB192\uC740 \uD2B8\uB798\uD53D**, **\uB0AE\uC740 CPU**, **\uB0AE\uC74C\uC5D0\uC11C \uBCF4\uD1B5 \uC704\uD5D8** (\uC791\uC5C5\uC5D0 \uB530\uB77C)\n> \uBAA8\uB4E0 \uAC83\uC774 \uC6D0\uACA9\uC5D0\uC11C \uAC00\uC838\uC640\uC9D1\uB2C8\uB2E4.\n> %{RedFlag.Fetch.Method.FetchSmoother}\uC640 \uC720\uC0AC\uD558\uC9C0\uB9CC \uBAA8\uB4E0 \uCCAD\uD06C\uAC00 \uC6D0\uACA9 \uC18C\uC2A4\uC5D0\uC11C \uAC00\uC838\uC640\uC9D1\uB2C8\uB2E4.\n> \uC774\uB294 \uAC00\uC7A5 \uC804\uD1B5\uC801\uC778 \uAC00\uC838\uC624\uAE30 \uBC29\uBC95\uC73C\uB85C \uC77C\uBC18\uC801\uC73C\uB85C \uAC00\uC7A5 \uB9CE\uC740 \uB124\uD2B8\uC6CC\uD06C \uD2B8\uB798\uD53D\uACFC \uC2DC\uAC04\uC744 \uC18C\uBAA8\uD569\uB2C8\uB2E4. \uB610\uD55C '%{RedFlag.Fetch.Method.FetchSmoother}' \uC635\uC158\uACFC \uC720\uC0AC\uD558\uAC8C \uC6D0\uACA9 \uD30C\uC77C\uC744 \uB36E\uC5B4\uC4F8 \uC704\uD5D8\uC774 \uC788\uC2B5\uB2C8\uB2E4.\n> \uD558\uC9C0\uB9CC \uAC00\uC7A5 \uC624\uB798\uB418\uACE0 \uAC00\uC7A5 \uC9C1\uC811\uC801\uC778 \uC811\uADFC \uBC29\uC2DD\uC774\uAE30 \uB54C\uBB38\uC5D0 \uC885\uC885 \uAC00\uC7A5 \uC548\uC815\uC801\uC778 \uBC29\uBC95\uC73C\uB85C \uAC04\uC8FC\uB429\uB2C8\uB2E4.",
      "RedFlag.Fetch.Method.FetchSafer": "\uAC00\uC838\uC624\uAE30 \uC804\uC5D0 \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uD55C \uBC88 \uC0DD\uC131",
      "RedFlag.Fetch.Method.FetchSmoother": "\uAC00\uC838\uC624\uAE30 \uC804\uC5D0 \uB85C\uCEEC \uD30C\uC77C \uCCAD\uD06C \uC0DD\uC131",
      "RedFlag.Fetch.Method.FetchTraditional": "\uC6D0\uACA9\uC5D0\uC11C \uBAA8\uB4E0 \uAC83 \uAC00\uC838\uC624\uAE30",
      "RedFlag.Fetch.Method.Title": "\uC5B4\uB5BB\uAC8C \uAC00\uC838\uC624\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Reducing the frequency with which on-disk changes are reflected into the DB": "\uB514\uC2A4\uD06C \uBCC0\uACBD \uC0AC\uD56D\uC774 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0 \uBC18\uC601\uB418\uB294 \uBE48\uB3C4\uB97C \uC904\uC785\uB2C8\uB2E4",
      Region: "\uC9C0\uC5ED",
      "Remote server type": "\uC6D0\uACA9 \uC11C\uBC84 \uC720\uD615",
      "Remote Type": "\uC6D0\uACA9 \uC720\uD615",
      "Replicator.Dialogue.Locked.Action.Dismiss": "\uC7AC\uD655\uC778\uC744 \uC704\uD574 \uCDE8\uC18C",
      "Replicator.Dialogue.Locked.Action.Fetch": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uBAA8\uB4E0 \uAC83\uC744 \uB2E4\uC2DC \uAC00\uC838\uC624\uAE30",
      "Replicator.Dialogue.Locked.Action.Unlock": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7A0\uAE08 \uD574\uC81C",
      "Replicator.Dialogue.Locked.Message": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uC7A0\uACA8 \uC788\uC2B5\uB2C8\uB2E4. \uC774\uB294 \uC77C\uBD80 \uD130\uBBF8\uB110\uC5D0\uC11C \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uC7AC\uAD6C\uCD95\uD588\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n\uB530\uB77C\uC11C \uD604\uC7AC \uAE30\uAE30\uB294 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC190\uC0C1\uC744 \uBC29\uC9C0\uD558\uAE30 \uC704\uD574 \uC5F0\uACB0\uC744 \uC77C\uC2DC\uC801\uC73C\uB85C \uBCF4\uB958\uD574\uC57C \uD569\uB2C8\uB2E4.\n\n\uC120\uD0DD\uD560 \uC218 \uC788\uB294 \uC138 \uAC00\uC9C0 \uBC29\uBC95\uC774 \uC788\uC2B5\uB2C8\uB2E4:\n\n- %{Replicator.Dialogue.Locked.Action.Fetch}\n  \uAC00\uC7A5 \uAD8C\uC7A5\uB418\uACE0 \uC2E0\uB8B0\uD560 \uC218 \uC788\uB294 \uBC29\uBC95\uC785\uB2C8\uB2E4. \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uB97C \uCD08\uAE30\uD654\uD55C \uB4A4, \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC758 \uC804\uCCB4 \uB370\uC774\uD130\uB97C \uB2E4\uC2DC \uAC00\uC838\uC635\uB2C8\uB2E4. \uB300\uBD80\uBD84\uC758 \uACBD\uC6B0 \uC548\uC804\uD558\uAC8C \uC218\uD589\uD560 \uC218 \uC788\uC73C\uB098, \uC2DC\uAC04\uC774 \uB2E4\uC18C \uAC78\uB9AC\uBA70 \uC548\uC815\uC801\uC778 \uB124\uD2B8\uC6CC\uD06C \uD658\uACBD\uC5D0\uC11C \uC9C4\uD589\uD574\uC57C \uD569\uB2C8\uB2E4.\n- %{Replicator.Dialogue.Locked.Action.Unlock}\n  \uC774 \uBC29\uBC95\uC740 \uB2E4\uB978 \uB3D9\uAE30\uD654 \uBC29\uC2DD\uC73C\uB85C \uC774\uBBF8 \uC644\uC804\uD558\uACE0 \uC548\uC815\uC801\uC73C\uB85C \uB3D9\uAE30\uD654\uB41C \uACBD\uC6B0\uC5D0\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uB2E8\uC21C\uD788 \uD30C\uC77C\uC774 \uAC19\uB2E4\uB294 \uC758\uBBF8\uAC00 \uC544\uB2C8\uBBC0\uB85C, \uD655\uC2E0\uC774 \uC5C6\uB2E4\uBA74 \uC0AC\uC6A9\uC744 \uD53C\uD558\uB294 \uAC83\uC774 \uC88B\uC2B5\uB2C8\uB2E4.\n- %{Replicator.Dialogue.Locked.Action.Dismiss}\n  \uC774\uBC88 \uC791\uC5C5\uC744 \uCDE8\uC18C\uD558\uACE0, \uB2E4\uC74C \uC694\uCCAD \uC2DC \uB2E4\uC2DC \uC548\uB0B4\uBC1B\uC2B5\uB2C8\uB2E4.\n",
      "Replicator.Dialogue.Locked.Message.Fetch": "\uBAA8\uB4E0 \uAC83 \uAC00\uC838\uC624\uAE30\uAC00 \uC608\uC57D\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC774\uB97C \uC218\uD589\uD558\uAE30 \uC704\uD574 \uD50C\uB7EC\uADF8\uC778\uC774 \uC7AC\uC2DC\uC791\uB429\uB2C8\uB2E4.",
      "Replicator.Dialogue.Locked.Message.Unlocked": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7A0\uAE08\uC774 \uD574\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC791\uC5C5\uC744 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
      "Replicator.Dialogue.Locked.Title": "\uC7A0\uAE40",
      "Replicator.Message.Cleaned": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC815\uB9AC\uAC00 \uC9C4\uD589 \uC911\uC785\uB2C8\uB2E4. \uBCF5\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "Replicator.Message.InitialiseFatalError": "\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBCF5\uC81C\uAE30\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uCE58\uBA85\uC801\uC778 \uC624\uB958\uC785\uB2C8\uB2E4.",
      "Replicator.Message.Pending": "\uC77C\uBD80 \uD30C\uC77C \uC774\uBCA4\uD2B8\uAC00 \uB300\uAE30 \uC911\uC785\uB2C8\uB2E4. \uBCF5\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "Replicator.Message.SomeModuleFailed": "\uC77C\uBD80 \uBAA8\uB4C8 \uC2E4\uD328\uB85C \uBCF5\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
      "Replicator.Message.VersionUpFlash": "\uC124\uC815\uC744 \uC5F4\uACE0 \uBA54\uC2DC\uC9C0\uB97C \uD655\uC778\uD574 \uC8FC\uC138\uC694. \uBCF5\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
      "Requires restart of Obsidian": "Obsidian \uC7AC\uC2DC\uC791 \uD544\uC694",
      "Requires restart of Obsidian.": "Obsidian \uC7AC\uC2DC\uC791\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.",
      "Save settings to a markdown file. You will be notified when new settings arrive. You can set different files by the platform.": "\uC124\uC815\uC744 \uB9C8\uD06C\uB2E4\uC6B4 \uD30C\uC77C\uC5D0 \uC800\uC7A5\uD569\uB2C8\uB2E4. \uC0C8\uB85C\uC6B4 \uC124\uC815\uC774 \uB3C4\uCC29\uD558\uBA74 \uC54C\uB9BC\uC744 \uBC1B\uAC8C \uB429\uB2C8\uB2E4. \uD50C\uB7AB\uD3FC\uBCC4\uB85C \uB2E4\uB978 \uD30C\uC77C\uC744 \uC124\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
      "Saving will be performed forcefully after this number of seconds.": "\uC774 \uC2DC\uAC04(\uCD08) \uD6C4\uC5D0 \uAC15\uC81C\uB85C \uC800\uC7A5\uC774 \uC218\uD589\uB429\uB2C8\uB2E4.",
      "Scan changes on customization sync": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654 \uC2DC \uBCC0\uACBD \uC0AC\uD56D \uAC80\uC0C9",
      "Scan customization automatically": "\uC0AC\uC6A9\uC790 \uC124\uC815 \uC790\uB3D9 \uAC80\uC0C9",
      "Scan customization before replicating.": "\uBCF5\uC81C\uD558\uAE30 \uC804\uC5D0 \uC0AC\uC6A9\uC790 \uC124\uC815\uC744 \uAC80\uC0C9\uD569\uB2C8\uB2E4.",
      "Scan customization every 1 minute.": "1\uBD84\uB9C8\uB2E4 \uC0AC\uC6A9\uC790 \uC124\uC815\uC744 \uAC80\uC0C9\uD569\uB2C8\uB2E4.",
      "Scan customization periodically": "\uC8FC\uAE30\uC801\uC73C\uB85C \uC0AC\uC6A9\uC790 \uC124\uC815 \uAC80\uC0C9",
      "Scan for hidden files before replication": "\uBCF5\uC81C \uC804 \uC228\uACA8\uC9C4 \uD30C\uC77C \uAC80\uC0C9",
      "Scan hidden files periodically": "\uC8FC\uAE30\uC801\uC73C\uB85C \uC228\uACA8\uC9C4 \uD30C\uC77C \uAC80\uC0C9",
      "Seconds, 0 to disable": "\uCD08 \uB2E8\uC704, 0\uC73C\uB85C \uC124\uC815\uD558\uBA74 \uBE44\uD65C\uC131\uD654",
      "Seconds. Saving to the local database will be delayed until this value after we stop typing or saving.": "\uCD08 \uB2E8\uC704\uC785\uB2C8\uB2E4. \uD0C0\uC774\uD551\uC774\uB098 \uC800\uC7A5\uC744 \uC911\uB2E8\uD55C \uD6C4 \uC774 \uC2DC\uAC04\uB3D9\uC548 \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC800\uC7A5\uC774 \uC9C0\uC5F0\uB429\uB2C8\uB2E4.",
      "Secret Key": "\uC2DC\uD06C\uB9BF \uD0A4",
      "Server URI": "\uC11C\uBC84 URI",
      "Setting.GenerateKeyPair.Desc": '\uD0A4 \uD398\uC5B4\uB97C \uC0DD\uC131\uD588\uC2B5\uB2C8\uB2E4!\n\n\uCC38\uACE0: \uC774 \uD0A4 \uD398\uC5B4\uB294 \uB2E4\uC2DC \uD45C\uC2DC\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC548\uC804\uD55C \uACF3\uC5D0 \uC800\uC7A5\uD574 \uC8FC\uC138\uC694. \uBD84\uC2E4\uD558\uBA74 \uC0C8 \uD0A4 \uD398\uC5B4\uB97C \uC0DD\uC131\uD574\uC57C \uD569\uB2C8\uB2E4.\n\uCC38\uACE0 2: \uACF5\uAC1C \uD0A4\uB294 spki \uD615\uC2DD\uC774\uACE0, \uAC1C\uC778 \uD0A4\uB294 pkcs8 \uD615\uC2DD\uC785\uB2C8\uB2E4. \uD3B8\uC758\uC0C1 \uACF5\uAC1C \uD0A4\uC758 \uC904 \uBC14\uAFC8\uC740 `\\n`\uC73C\uB85C \uBCC0\uD658\uB429\uB2C8\uB2E4.\n\uCC38\uACE0 3: \uACF5\uAC1C \uD0A4\uB294 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uAD6C\uC131\uB418\uC5B4\uC57C \uD558\uACE0, \uAC1C\uC778 \uD0A4\uB294 \uB85C\uCEEC \uAE30\uAE30\uC5D0\uC11C \uAD6C\uC131\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.\n\n>[!FOR YOUR EYES ONLY]-\n> <div class="sls-keypair">\n>\n> ### \uACF5\uAC1C \uD0A4\n> ```\n${public_key}\n> ```\n>\n> ### \uAC1C\uC778 \uD0A4\n> ```\n${private_key}\n> ```\n>\n> </div>\n\n>[!Both for copying]-\n>\n> <div class="sls-keypair">\n>\n> ```\n${public_key}\n${private_key}\n> ```\n>\n> </div>\n\n\n',
      "Setting.GenerateKeyPair.Title": "\uC0C8 \uD0A4 \uD398\uC5B4\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4!",
      "Setting.TroubleShooting": "\uBB38\uC81C \uD574\uACB0",
      "Setting.TroubleShooting.Doctor": "\uC124\uC815 \uC9C4\uB2E8 \uB9C8\uBC95\uC0AC",
      "Setting.TroubleShooting.Doctor.Desc": "\uCD5C\uC801\uD654\uB418\uC9C0 \uC54A\uC740 \uC124\uC815\uC744 \uAC10\uC9C0\uD569\uB2C8\uB2E4. (\uB370\uC774\uD130 \uAD6C\uC870 \uC804\uD658 \uC2DC\uC640 \uB3D9\uC77C)",
      "SettingTab.Message.AskRebuild": "\uBCC0\uACBD \uC0AC\uD56D\uC744 \uC801\uC6A9\uD558\uB824\uBA74 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0\uC11C \uAC00\uC838\uC640\uC57C \uD569\uB2C8\uB2E4. \uACC4\uC18D \uC9C4\uD589\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Setup.QRCode": '\uC124\uC815\uC744 \uC804\uC1A1\uD558\uAE30 \uC704\uD55C QR \uCF54\uB4DC\uB97C \uC0DD\uC131\uD588\uC2B5\uB2C8\uB2E4. \uD734\uB300\uD3F0\uC774\uB098 \uB2E4\uB978 \uAE30\uAE30\uB85C QR \uCF54\uB4DC\uB97C \uC2A4\uCE94\uD574 \uC8FC\uC138\uC694.\n\uCC38\uACE0: QR \uCF54\uB4DC\uB294 \uC554\uD638\uD654\uB418\uC9C0 \uC54A\uC558\uC73C\uBBC0\uB85C \uC5F4 \uB54C \uC8FC\uC758\uD558\uC138\uC694.\n\n>[!FOR YOUR EYES ONLY]-\n> <div class="sls-qr">${qr_image}</div>',
      "Setup.ShowQRCode": "QR \uCF54\uB4DC \uD45C\uC2DC",
      "Setup.ShowQRCode.Desc": "\uC124\uC815\uC744 \uC804\uC1A1\uD558\uAE30 \uC704\uD55C QR \uCF54\uB4DC\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.",
      "Should we keep folders that don't have any files inside?": "\uB0B4\uBD80\uC5D0 \uD30C\uC77C\uC774 \uC5C6\uB294 \uD3F4\uB354\uB97C \uC720\uC9C0\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Should we only check for conflicts when a file is opened?": "\uD30C\uC77C\uC744 \uC5F4 \uB54C\uB9CC \uCDA9\uB3CC\uC744 \uD655\uC778\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Should we prompt you about conflicting files when a file is opened?": "\uD30C\uC77C\uC744 \uC5F4 \uB54C \uCDA9\uB3CC\uD558\uB294 \uD30C\uC77C\uC5D0 \uB300\uD574 \uC54C\uB9BC\uC744 \uD45C\uC2DC\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Should we prompt you for every single merge, even if we can safely merge automatcially?": "\uC548\uC804\uD558\uAC8C \uC790\uB3D9 \uBCD1\uD569\uD560 \uC218 \uC788\uB294 \uACBD\uC6B0\uC5D0\uB3C4 \uBAA8\uB4E0 \uBCD1\uD569\uC5D0 \uB300\uD574 \uC54C\uB9BC\uC744 \uBC1B\uC73C\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
      "Show only notifications": "\uC54C\uB9BC\uB9CC \uD45C\uC2DC",
      "Show status as icons only": "\uC544\uC774\uCF58\uC73C\uB85C\uB9CC \uC0C1\uD0DC \uD45C\uC2DC",
      "Show status inside the editor": "\uD3B8\uC9D1\uAE30 \uB0B4\uBD80\uC5D0 \uC0C1\uD0DC \uD45C\uC2DC",
      "Show status on the status bar": "\uC0C1\uD0DC \uBC14\uC5D0 \uC0C1\uD0DC \uD45C\uC2DC",
      "Show verbose log. Please enable if you report an issue.": "\uC790\uC138\uD55C \uB85C\uADF8\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4. \uBB38\uC81C\uB97C \uC2E0\uACE0\uD558\uB294 \uACBD\uC6B0 \uD65C\uC131\uD654\uD574 \uC8FC\uC138\uC694.",
      "Starts synchronisation when a file is saved.": "\uD30C\uC77C\uC774 \uC800\uC7A5\uB420 \uB54C \uB3D9\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4.",
      "Stop reflecting database changes to storage files.": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uBCC0\uACBD \uC0AC\uD56D\uC744 \uC2A4\uD1A0\uB9AC\uC9C0 \uD30C\uC77C\uC5D0 \uBC18\uC601\uD558\uB294 \uAC83\uC744 \uC911\uB2E8\uD569\uB2C8\uB2E4.",
      "Stop watching for file changes.": "\uD30C\uC77C \uBCC0\uACBD \uC0AC\uD56D \uAC10\uC2DC\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.",
      "Suppress notification of hidden files change": "\uC228\uACA8\uC9C4 \uD30C\uC77C \uBCC0\uACBD \uC54C\uB9BC \uC5B5\uC81C",
      "Suspend database reflecting": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uBC18\uC601 \uC77C\uC2DC \uC911\uB2E8",
      "Suspend file watching": "\uD30C\uC77C \uAC10\uC2DC \uC77C\uC2DC \uC911\uB2E8",
      "Sync after merging file": "\uD30C\uC77C \uBCD1\uD569 \uD6C4 \uB3D9\uAE30\uD654",
      "Sync automatically after merging files": "\uD30C\uC77C \uBCD1\uD569 \uD6C4 \uC790\uB3D9\uC73C\uB85C \uB3D9\uAE30\uD654",
      "Sync Mode": "\uB3D9\uAE30\uD654 \uBAA8\uB4DC",
      "Sync on Editor Save": "\uD3B8\uC9D1\uAE30 \uC800\uC7A5 \uC2DC \uB3D9\uAE30\uD654",
      "Sync on File Open": "\uD30C\uC77C \uC5F4\uAE30 \uC2DC \uB3D9\uAE30\uD654",
      "Sync on Save": "\uC800\uC7A5 \uC2DC \uB3D9\uAE30\uD654",
      "Sync on Startup": "\uC2DC\uC791 \uC2DC \uB3D9\uAE30\uD654",
      "Testing only - Resolve file conflicts by syncing newer copies of the file, this can overwrite modified files. Be Warned.": "\uD14C\uC2A4\uD2B8 \uC804\uC6A9 - \uD30C\uC77C\uC758 \uC0C8\uB85C\uC6B4 \uC0AC\uBCF8\uC744 \uB3D9\uAE30\uD654\uD558\uC5EC \uD30C\uC77C \uCDA9\uB3CC\uC744 \uD574\uACB0\uD558\uBA70, \uC218\uC815\uB41C \uD30C\uC77C\uC744 \uB36E\uC5B4\uC4F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC8FC\uC758\uD558\uC138\uC694.",
      "The delay for consecutive on-demand fetches": "\uC5F0\uC18D \uCCAD\uD06C \uC694\uCCAD \uAC04 \uB300\uAE30 \uC2DC\uAC04",
      "The Hash algorithm for chunk IDs": "\uCCAD\uD06C ID\uC6A9 \uD574\uC2DC \uC54C\uACE0\uB9AC\uC998",
      "The maximum duration for which chunks can be incubated within the document. Chunks exceeding this period will graduate to independent chunks.": "\uBCC0\uACBD \uAE30\uB85D\uC774 \uBB38\uC11C\uC5D0 \uD568\uAED8 \uBCF4\uAD00\uB420 \uC218 \uC788\uB294 \uCD5C\uB300 \uC2DC\uAC04\uC785\uB2C8\uB2E4. \uCD08\uACFC \uC2DC \uBB38\uC11C\uC5D0\uC11C \uBD84\uB9AC\uB418\uC5B4 \uAC1C\uBCC4\uB85C \uC800\uC7A5\uB429\uB2C8\uB2E4.",
      "The maximum number of chunks that can be incubated within the document. Chunks exceeding this number will immediately graduate to independent chunks.": "\uBB38\uC11C \uC548\uC5D0 \uC784\uC2DC\uB85C \uBCF4\uAD00\uD560 \uC218 \uC788\uB294 \uBCC0\uACBD \uAE30\uB85D\uC758 \uCD5C\uB300 \uAC1C\uC218\uC785\uB2C8\uB2E4. \uC774 \uC218\uB97C \uCD08\uACFC\uD558\uBA74 \uC989\uC2DC \uB3C5\uB9BD\uB41C \uCCAD\uD06C\uB85C \uBD84\uB9AC\uB418\uC5B4 \uC800\uC7A5\uB429\uB2C8\uB2E4.",
      "The maximum total size of chunks that can be incubated within the document. Chunks exceeding this size will immediately graduate to independent chunks.": "\uBB38\uC11C \uC548\uC5D0 \uC784\uC2DC\uB85C \uBCF4\uAD00\uD560 \uC218 \uC788\uB294 \uBCC0\uACBD \uAE30\uB85D\uC758 \uC804\uCCB4 \uD06C\uAE30 \uC81C\uD55C\uC785\uB2C8\uB2E4. \uCD08\uACFC \uC2DC \uC790\uB3D9\uC73C\uB85C \uBD84\uB9AC\uB429\uB2C8\uB2E4.",
      "This passphrase will not be copied to another device. It will be set to `Default` until you configure it again.": "\uC774 \uD328\uC2A4\uD504\uB808\uC774\uC988\uB294 \uB2E4\uB978 \uAE30\uAE30\uB85C \uBCF5\uC0AC\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uAD6C\uC131\uD560 \uB54C\uAE4C\uC9C0 `\uAE30\uBCF8\uAC12`\uC73C\uB85C \uC124\uC815\uB429\uB2C8\uB2E4.",
      "TweakMismatchResolve.Action.Dismiss": "\uBB34\uC2DC",
      "TweakMismatchResolve.Action.UseConfigured": "\uAD6C\uC131\uB41C \uC124\uC815 \uC0AC\uC6A9",
      "TweakMismatchResolve.Action.UseMine": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC124\uC815 \uC5C5\uB370\uC774\uD2B8",
      "TweakMismatchResolve.Action.UseMineAcceptIncompatible": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC124\uC815 \uC5C5\uB370\uC774\uD2B8\uD558\uC9C0\uB9CC \uADF8\uB300\uB85C \uC720\uC9C0",
      "TweakMismatchResolve.Action.UseMineWithRebuild": "\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC124\uC815 \uC5C5\uB370\uC774\uD2B8\uD558\uACE0 \uB2E4\uC2DC \uC7AC\uAD6C\uCD95",
      "TweakMismatchResolve.Action.UseRemote": "\uC774 \uAE30\uAE30\uC5D0 \uC124\uC815 \uC801\uC6A9",
      "TweakMismatchResolve.Action.UseRemoteAcceptIncompatible": "\uC774 \uAE30\uAE30\uC5D0 \uC124\uC815 \uC801\uC6A9\uD558\uC9C0\uB9CC \uD638\uD658\uC131 \uBB38\uC81C \uBB34\uC2DC",
      "TweakMismatchResolve.Action.UseRemoteWithRebuild": "\uC774 \uAE30\uAE30\uC5D0 \uC124\uC815 \uC801\uC6A9\uD558\uACE0 \uB2E4\uC2DC \uAC00\uC838\uC624\uAE30",
      "TweakMismatchResolve.Message.Main": "\n\uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC758 \uC124\uC815\uC740 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4. \uC774 \uAC12\uB4E4\uC740 \uC774 \uAE30\uAE30\uC640 \uCD5C\uC18C \uD55C \uBC88 \uB3D9\uAE30\uD654\uB41C \uB2E4\uB978 \uAE30\uAE30\uC5D0\uC11C \uAD6C\uC131\uB41C \uAC83\uC785\uB2C8\uB2E4.\n\n\uC774 \uC124\uC815\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 %{TweakMismatchResolve.Action.UseConfigured}\uB97C \uC120\uD0DD\uD574 \uC8FC\uC138\uC694.\n\uC774 \uAE30\uAE30\uC758 \uC124\uC815\uC744 \uC720\uC9C0\uD558\uB824\uBA74 %{TweakMismatchResolve.Action.Dismiss}\uB97C \uC120\uD0DD\uD574 \uC8FC\uC138\uC694.\n\n${table}\n\n>[!TIP]\n> \uBAA8\uB4E0 \uC124\uC815\uC744 \uB3D9\uAE30\uD654\uD558\uB824\uBA74 \uC774 \uAE30\uB2A5\uC73C\uB85C \uCD5C\uC18C \uAD6C\uC131\uC744 \uC801\uC6A9\uD55C \uD6C4 `\uB9C8\uD06C\uB2E4\uC6B4\uC744 \uD1B5\uD55C \uC124\uC815 \uB3D9\uAE30\uD654`\uB97C \uC0AC\uC6A9\uD574 \uC8FC\uC138\uC694.\n\n${additionalMessage}",
      "TweakMismatchResolve.Message.MainTweakResolving": "\uAD6C\uC131\uC774 \uC6D0\uACA9 \uC11C\uBC84\uC758 \uAC83\uACFC \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\n\uB2E4\uC74C \uAD6C\uC131\uC774 \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4:\n\n${table}\n\n\uACB0\uC815\uC744 \uC54C\uB824\uC8FC\uC138\uC694.\n\n${additionalMessage}",
      "TweakMismatchResolve.Message.UseRemote.WarningRebuildRecommended": "\n>[!NOTICE]\n> \uC77C\uBD80 \uBCC0\uACBD\uC0AC\uD56D\uC740 \uD638\uD658 \uAC00\uB2A5\uD558\uC9C0\uB9CC \uCD94\uAC00 \uC2A4\uD1A0\uB9AC\uC9C0 \uBC0F \uC804\uC1A1\uB7C9\uC744 \uC18C\uBAA8\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC7AC\uAD6C\uCD95\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uD604\uC7AC \uC7AC\uAD6C\uCD95\uC744 \uC218\uD589\uD558\uC9C0 \uC54A\uB354\uB77C\uB3C4 \uD5A5\uD6C4 \uC720\uC9C0\uBCF4\uC218\uC5D0\uC11C \uAD6C\uD604\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> ***\uC2DC\uAC04\uC801 \uC5EC\uC720\uAC00 \uC788\uACE0 \uC548\uC815\uC801\uC778 \uB124\uD2B8\uC6CC\uD06C\uC5D0 \uC5F0\uACB0\uB41C \uC0C1\uD0DC\uC5D0\uC11C \uC801\uC6A9\uD574 \uC8FC\uC138\uC694!***",
      "TweakMismatchResolve.Message.UseRemote.WarningRebuildRequired": "\n>[!WARNING]\n> \uC77C\uBD80 \uC6D0\uACA9 \uAD6C\uC131\uC774 \uC774 \uAE30\uAE30\uC758 \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC640 \uD638\uD658\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.\n> ***\uC2DC\uAC04\uC801 \uC5EC\uC720\uAC00 \uC788\uACE0 \uC548\uC815\uC801\uC778 \uB124\uD2B8\uC6CC\uD06C\uC5D0 \uC5F0\uACB0\uB41C \uC0C1\uD0DC\uC5D0\uC11C \uC801\uC6A9\uD574 \uC8FC\uC138\uC694!***",
      "TweakMismatchResolve.Message.WarningIncompatibleRebuildRecommended": "\n>[!NOTICE]\n> \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC640 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uD638\uD658\uB418\uC9C0 \uC54A\uB3C4\uB85D \uB9CC\uB4DC\uB294 \uAC12\uB4E4\uC774 \uB2E4\uB978 \uAC83\uC744 \uAC10\uC9C0\uD588\uC2B5\uB2C8\uB2E4.\n> \uC77C\uBD80 \uBCC0\uACBD\uC0AC\uD56D\uC740 \uD638\uD658 \uAC00\uB2A5\uD558\uC9C0\uB9CC \uCD94\uAC00 \uC2A4\uD1A0\uB9AC\uC9C0 \uBC0F \uC804\uC1A1\uB7C9\uC744 \uC18C\uBAA8\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC7AC\uAD6C\uCD95\uC744 \uAD8C\uC7A5\uD569\uB2C8\uB2E4. \uD558\uC9C0\uB9CC \uD604\uC7AC \uC7AC\uAD6C\uCD95\uC744 \uC218\uD589\uD558\uC9C0 \uC54A\uB354\uB77C\uB3C4 \uD5A5\uD6C4 \uC720\uC9C0\uBCF4\uC218\uC5D0\uC11C \uAD6C\uD604\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n> \uC7AC\uAD6C\uCD95\uC744 \uC6D0\uD55C\uB2E4\uBA74 \uBA87 \uBD84 \uC774\uC0C1 \uC18C\uC694\uB429\uB2C8\uB2E4. **\uC9C0\uAE08 \uC218\uD589\uD574\uB3C4 \uC548\uC804\uD55C\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.**",
      "TweakMismatchResolve.Message.WarningIncompatibleRebuildRequired": "\n>[!WARNING]\n> \uB85C\uCEEC \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC640 \uC6D0\uACA9 \uB370\uC774\uD130\uBCA0\uC774\uC2A4\uAC00 \uD638\uD658\uB418\uC9C0 \uC54A\uB3C4\uB85D \uB9CC\uB4DC\uB294 \uAC12\uB4E4\uC774 \uB2E4\uB978 \uAC83\uC744 \uAC10\uC9C0\uD588\uC2B5\uB2C8\uB2E4.\n> \uB85C\uCEEC \uB610\uB294 \uC6D0\uACA9 \uC7AC\uAD6C\uCD95\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uB458 \uB2E4 \uBA87 \uBD84 \uC774\uC0C1 \uC18C\uC694\uB429\uB2C8\uB2E4. **\uC9C0\uAE08 \uC218\uD589\uD574\uB3C4 \uC548\uC804\uD55C\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.**",
      "TweakMismatchResolve.Table": "| \uAC12 \uC774\uB984 | \uC774 \uAE30\uAE30 | \uC6D0\uACA9 |\n|: --- |: ---- :|: ---- :|\n${rows}\n\n",
      "TweakMismatchResolve.Table.Row": "| ${name} | ${self} | ${remote} |",
      "TweakMismatchResolve.Title": "\uAD6C\uC131 \uBD88\uC77C\uCE58 \uAC10\uC9C0",
      "TweakMismatchResolve.Title.TweakResolving": "\uAD6C\uC131 \uBD88\uC77C\uCE58 \uAC10\uC9C0",
      "TweakMismatchResolve.Title.UseRemoteConfig": "\uC6D0\uACA9 \uAD6C\uC131 \uC0AC\uC6A9",
      "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.": "\uBAA8\uB4E0 \uB3D9\uAE30\uD654\uB41C \uAE30\uAE30 \uAC04 \uACE0\uC720 \uC774\uB984\uC785\uB2C8\uB2E4. \uC774 \uC124\uC815\uC744 \uD3B8\uC9D1\uD558\uB824\uBA74 \uC0AC\uC6A9\uC790 \uC124\uC815 \uB3D9\uAE30\uD654\uB97C \uD55C \uBC88 \uBE44\uD65C\uC131\uD654\uD574 \uC8FC\uC138\uC694.",
      "Use Custom HTTP Handler": "\uCEE4\uC2A4\uD140 HTTP \uD578\uB4E4\uB7EC \uC0AC\uC6A9",
      "Use dynamic iteration count": "\uB3D9\uC801 \uBC18\uBCF5 \uD69F\uC218 \uC0AC\uC6A9",
      "Use Segmented-splitter": "\uC758\uBBF8 \uAE30\uBC18 \uBD84\uD560 \uC0AC\uC6A9",
      "Use splitting-limit-capped chunk splitter": "\uBD84\uD560 \uC81C\uD55C \uC0C1\uD55C \uCCAD\uD06C \uBD84\uD560\uAE30 \uC0AC\uC6A9",
      "Use the trash bin": "\uD734\uC9C0\uD1B5 \uC0AC\uC6A9",
      "Use timeouts instead of heartbeats": "\uD558\uD2B8\uBE44\uD2B8 \uB300\uC2E0 \uD0C0\uC784\uC544\uC6C3 \uC0AC\uC6A9",
      username: "\uC0AC\uC6A9\uC790\uBA85",
      Username: "\uC0AC\uC6A9\uC790\uBA85",
      "Verbose Log": "\uC790\uC138\uD55C \uB85C\uADF8",
      "Warning! This will have a serious impact on performance. And the logs will not be synchronised under the default name. Please be careful with logs; they often contain your confidential information.": "\uACBD\uACE0! \uC774\uB294 \uC131\uB2A5\uC5D0 \uC2EC\uAC01\uD55C \uC601\uD5A5\uC744 \uBBF8\uCE69\uB2C8\uB2E4. \uB85C\uADF8\uB294 \uAE30\uBCF8 \uC774\uB984\uC73C\uB85C \uB3D9\uAE30\uD654\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB85C\uADF8\uC5D0\uB294 \uC885\uC885 \uAE30\uBC00 \uC815\uBCF4\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC73C\uBBC0\uB85C \uC8FC\uC758\uD574 \uC8FC\uC138\uC694.",
      "When you save a file in the editor, start a sync automatically": "\uD3B8\uC9D1\uAE30\uC5D0\uC11C \uD30C\uC77C\uC744 \uC800\uC7A5\uD560 \uB54C \uC790\uB3D9\uC73C\uB85C \uB3D9\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4",
      "Write credentials in the file": "\uD30C\uC77C\uC5D0 \uC790\uACA9 \uC99D\uBA85 \uC800\uC7A5",
      "Write logs into the file": "\uD30C\uC77C\uC5D0 \uB85C\uADF8 \uAE30\uB85D"
    };
  }
});

// src/sync/core/common/messages/ko.ts
var PartialMessages4;
var init_ko2 = __esm({
  "src/sync/core/common/messages/ko.ts"() {
    "use strict";
    init_ko();
    PartialMessages4 = {
      ko: ko_default
    };
  }
});

// src/sync/core/common/messagesJson/ru.json
var ru_default;
var init_ru = __esm({
  "src/sync/core/common/messagesJson/ru.json"() {
    ru_default = {};
  }
});

// src/sync/core/common/messages/ru.ts
var PartialMessages5;
var init_ru2 = __esm({
  "src/sync/core/common/messages/ru.ts"() {
    "use strict";
    init_ru();
    PartialMessages5 = {
      ru: ru_default
    };
  }
});

// src/sync/core/common/messagesJson/zh.json
var zh_default;
var init_zh = __esm({
  "src/sync/core/common/messagesJson/zh.json"() {
    zh_default = {
      "(BETA) Always overwrite with a newer file": "\u59CB\u7EC8\u4F7F\u7528\u66F4\u65B0\u7684\u6587\u4EF6\u8986\u76D6\uFF08\u6D4B\u8BD5\u7248\uFF09",
      "(Beta) Use ignore files": "\uFF08\u6D4B\u8BD5\u7248\uFF09\u4F7F\u7528\u5FFD\u7565\u6587\u4EF6",
      "(Days passed, 0 to disable automatic-deletion)": "\uFF08\u5DF2\u8FC7\u5929\u6570\uFF0C0\u4E3A\u7981\u7528\u81EA\u52A8\u5220\u9664\uFF09",
      "(ex. Read chunks online) If this option is enabled, LiveSync reads chunks online directly instead of replicating them locally. Increasing Custom chunk size is recommended.": "\uFF08\u4F8B\u5982\uFF0C\u5728\u7EBF\u8BFB\u53D6\u5757\uFF09\u5982\u679C\u542F\u7528\u6B64\u9009\u9879\uFF0CLiveSync \u5C06\u76F4\u63A5\u5728\u7EBF\u8BFB\u53D6\u5757\uFF0C\u800C\u4E0D\u662F\u5728\u672C\u5730\u590D\u5236\u5757\u3002\u5EFA\u8BAE\u589E\u52A0\u81EA\u5B9A\u4E49\u5757\u5927\u5C0F",
      "(MB) If this is set, changes to local and remote files that are larger than this will be skipped. If the file becomes smaller again, a newer one will be used.": "\uFF08MB\uFF09\u5982\u679C\u8BBE\u7F6E\u4E86\u6B64\u9879\uFF0C\u5927\u4E8E\u6B64\u5927\u5C0F\u7684\u672C\u5730\u548C\u8FDC\u7A0B\u6587\u4EF6\u7684\u66F4\u6539\u5C06\u88AB\u8DF3\u8FC7\u3002\u5982\u679C\u6587\u4EF6\u518D\u6B21\u53D8\u5C0F\uFF0C\u5C06\u4F7F\u7528\u66F4\u65B0\u7684\u6587\u4EF6",
      "(Mega chars)": "\uFF08\u767E\u4E07\u5B57\u7B26\uFF09",
      "(Not recommended) If set, credentials will be stored in the file.": "\uFF08\u4E0D\u5EFA\u8BAE\uFF09\u5982\u679C\u8BBE\u7F6E\uFF0C\u51ED\u636E\u5C06\u5B58\u50A8\u5728\u6587\u4EF6\u4E2D\u3002",
      "(Obsolete) Use an old adapter for compatibility": "\uFF08\u5DF2\u5F03\u7528\uFF09\u4E3A\u517C\u5BB9\u6027\u4F7F\u7528\u65E7\u9002\u914D\u5668",
      "Access Key": "Access Key",
      "Always prompt merge conflicts": "\u59CB\u7EC8\u63D0\u793A\u5408\u5E76\u51B2\u7A81",
      "Apply Latest Change if Conflicting": "\u5982\u679C\u51B2\u7A81\u5219\u5E94\u7528\u6700\u65B0\u66F4\u6539",
      "Apply preset configuration": "\u5E94\u7528\u9884\u8BBE\u914D\u7F6E",
      "Automatically Sync all files when opening Obsidian.": "\u6253\u5F00 Obsidian \u65F6\u81EA\u52A8\u540C\u6B65\u6240\u6709\u6587\u4EF6\u3002",
      "Batch database update": "\u6279\u91CF\u6570\u636E\u5E93\u66F4\u65B0",
      "Batch limit": "\u6279\u91CF\u9650\u5236",
      "Batch size": "\u6279\u91CF\u5927\u5C0F",
      "Batch size of on-demand fetching": "\u6309\u9700\u83B7\u53D6\u7684\u6279\u91CF\u5927\u5C0F",
      "Before v0.17.16, we used an old adapter for the local database. Now the new adapter is preferred. However, it needs local database rebuilding. Please disable this toggle when you have enough time. If leave it enabled, also while fetching from the remote database, you will be asked to disable this.": "\u5728 v0.17.16 \u4E4B\u524D\uFF0C\u6211\u4EEC\u4F7F\u7528\u65E7\u9002\u914D\u5668\u4F5C\u4E3A\u672C\u5730\u6570\u636E\u5E93\u3002\u73B0\u5728\u9996\u9009\u65B0\u9002\u914D\u5668\u3002\u4F46\u662F\uFF0C\u5B83\u9700\u8981\u91CD\u5EFA\u672C\u5730\u6570\u636E\u5E93\u3002\u8BF7\u5728\u6709\u8DB3\u591F\u65F6\u95F4\u65F6\u7981\u7528\u6B64\u5F00\u5173\u3002\u5982\u679C\u4FDD\u6301\u542F\u7528\u72B6\u6001\uFF0C\u5E76\u4E14\u5728\u4ECE\u8FDC\u7A0B\u6570\u636E\u5E93\u83B7\u53D6\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u8981\u6C42\u60A8\u7981\u7528\u6B64\u5F00\u5173\u3002",
      "Bucket Name": "Bucket Name",
      "Comma separated `.gitignore, .dockerignore`": "\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4F8B\u5982 `.gitignore, .dockerignore`",
      "Compute revisions for chunks (Previous behaviour)": "\u4E3A chunks \u8BA1\u7B97\u4FEE\u8BA2\u7248\u672C\uFF08\u4EE5\u524D\u7684\u884C\u4E3A\uFF09",
      "Data Compression": "\u6570\u636E\u538B\u7F29\uFF08\u5B9E\u9A8C\u6027\uFF09",
      "Database Name": "\u6570\u636E\u5E93\u540D\u79F0",
      "Database suffix": "\u6570\u636E\u5E93\u540E\u7F00",
      "Delay conflict resolution of inactive files": "\u63A8\u8FDF\u89E3\u51B3\u4E0D\u6D3B\u52A8\u6587\u4EF6",
      "Delay merge conflict prompt for inactive files.": "\u63A8\u8FDF\u624B\u52A8\u89E3\u51B3\u4E0D\u6D3B\u52A8\u6587\u4EF6",
      "Delete old metadata of deleted files on start-up": "\u542F\u52A8\u65F6\u5220\u9664\u5DF2\u5220\u9664\u6587\u4EF6\u7684\u65E7\u5143\u6570\u636E",
      "Device name": "\u8BBE\u5907\u540D\u79F0",
      "Disables logging, only shows notifications. Please disable if you report an issue.": "\u7981\u7528\u65E5\u5FD7\u8BB0\u5F55\uFF0C\u4EC5\u663E\u793A\u901A\u77E5\u3002\u5982\u679C\u60A8\u62A5\u544A\u95EE\u9898\uFF0C\u8BF7\u7981\u7528\u6B64\u9009\u9879\u3002",
      "Display Language": "\u663E\u793A\u8BED\u8A00",
      "Do not check configuration mismatch before replication": "\u5728\u590D\u5236\u524D\u4E0D\u68C0\u67E5\u914D\u7F6E\u4E0D\u5339\u914D",
      "Do not keep metadata of deleted files.": "\u4E0D\u4FDD\u7559\u5DF2\u5220\u9664\u6587\u4EF6\u7684\u5143\u6570\u636E\u3002",
      "Do not split chunks in the background": "\u4E0D\u5728\u540E\u53F0\u5206\u5272 chunks",
      "Do not use internal API": "\u4E0D\u4F7F\u7528\u5185\u90E8 API",
      "Enable advanced features": "\u542F\u7528\u9AD8\u7EA7\u529F\u80FD",
      "Enable customization sync": "\u542F\u7528\u81EA\u5B9A\u4E49\u540C\u6B65",
      "Enable Developers' Debug Tools.": "\u542F\u7528\u5F00\u53D1\u8005\u8C03\u8BD5\u5DE5\u5177\u3002",
      "Enable edge case treatment features": "\u542F\u7528\u8FB9\u7F18\u60C5\u51B5\u5904\u7406\u529F\u80FD",
      "Enable poweruser features": "\u542F\u7528\u9AD8\u7EA7\u7528\u6237\u529F\u80FD",
      "Enable this if your Object Storage doesn't support CORS": "\u5982\u679C\u60A8\u7684\u5BF9\u8C61\u5B58\u50A8\u4E0D\u652F\u6301 CORS\uFF0C\u8BF7\u542F\u7528\u6B64\u529F\u80FD\u3002",
      "Enable this option to automatically apply the most recent change to documents even when it conflicts": "\u542F\u7528\u6B64\u9009\u9879\u53EF\u5728\u6587\u6863\u51B2\u7A81\u65F6\u81EA\u52A8\u5E94\u7528\u6700\u65B0\u7684\u66F4\u6539",
      "Encrypt contents on the remote database. If you use the plugin's synchronization feature, enabling this is recommended.": "\u52A0\u5BC6\u8FDC\u7A0B\u6570\u636E\u5E93\u4E2D\u7684\u5185\u5BB9\u3002\u5982\u679C\u60A8\u4F7F\u7528\u63D2\u4EF6\u7684\u540C\u6B65\u529F\u80FD\uFF0C\u5219\u5EFA\u8BAE\u542F\u7528\u6B64\u529F\u80FD\u3002",
      "Encrypting sensitive configuration items": "\u52A0\u5BC6\u654F\u611F\u914D\u7F6E\u9879",
      "Encryption phassphrase. If changed, you should overwrite the server's database with the new (encrypted) files.": "\u52A0\u5BC6\u5BC6\u7801\u3002\u5982\u679C\u66F4\u6539\uFF0C\u60A8\u5E94\u8BE5\u7528\u65B0\u7684\uFF08\u52A0\u5BC6\u7684\uFF09\u6587\u4EF6\u8986\u76D6\u670D\u52A1\u5668\u7684\u6570\u636E\u5E93\u3002",
      "End-to-End Encryption": "\u7AEF\u5230\u7AEF\u52A0\u5BC6",
      "Endpoint URL": "Endpoint URL",
      "Enhance chunk size": "\u589E\u5F3A\u5757\u5927\u5C0F",
      "Fetch chunks on demand": "\u6309\u9700\u83B7\u53D6\u5757",
      "Fetch database with previous behaviour": "\u4F7F\u7528\u4EE5\u524D\u7684\u884C\u4E3A\u83B7\u53D6\u6570\u636E\u5E93",
      Filename: "\u6587\u4EF6\u540D",
      "Forces the file to be synced when opened.": "\u6253\u5F00\u6587\u4EF6\u65F6\u5F3A\u5236\u540C\u6B65\u8BE5\u6587\u4EF6\u3002",
      "Handle files as Case-Sensitive": "\u5C06\u6587\u4EF6\u89C6\u4E3A\u533A\u5206\u5927\u5C0F\u5199",
      "If disabled(toggled), chunks will be split on the UI thread (Previous behaviour).": "\u5982\u679C\u7981\u7528\uFF08\u5207\u6362\uFF09\uFF0Cchunks \u5C06\u5728 UI \u7EBF\u7A0B\u4E0A\u5206\u5272\uFF08\u4EE5\u524D\u7684\u884C\u4E3A\uFF09\u3002",
      "If enabled per-filed efficient customization sync will be used. We need a small migration when enabling this. And all devices should be updated to v0.23.18. Once we enabled this, we lost a compatibility with old versions.": "\u5982\u679C\u542F\u7528\uFF0C\u5C06\u4F7F\u7528\u57FA\u4E8E\u6587\u4EF6\u7684\u3001\u9AD8\u6548\u7684\u81EA\u5B9A\u4E49\u540C\u6B65\u3002\u542F\u7528\u6B64\u529F\u80FD\u9700\u8981\u8FDB\u884C\u4E00\u6B21\u5C0F\u7684\u8FC1\u79FB\u3002\u6240\u6709\u8BBE\u5907\u90FD\u5E94\u66F4\u65B0\u5230 v0.23.18\u3002\u4E00\u65E6\u542F\u7528\u6B64\u529F\u80FD\uFF0C\u6211\u4EEC\u5C06\u5931\u53BB\u4E0E\u65E7\u7248\u672C\u7684\u517C\u5BB9\u6027\u3002",
      "If enabled, chunks will be split into no more than 100 items. However, dedupe is slightly weaker.": "\u5982\u679C\u542F\u7528\uFF0C\u6570\u636E\u5757\u5C06\u88AB\u5206\u5272\u6210\u4E0D\u8D85\u8FC7 100 \u9879\u3002\u4F46\u662F\uFF0C\u53BB\u91CD\u6548\u679C\u4F1A\u7A0D\u5F31\u3002",
      "If enabled, newly created chunks are temporarily kept within the document, and graduated to become independent chunks once stabilised.": "\u5982\u679C\u542F\u7528\uFF0C\u65B0\u521B\u5EFA\u7684\u6570\u636E\u5757\u5C06\u6682\u65F6\u4FDD\u7559\u5728\u6587\u6863\u4E2D\uFF0C\u5E76\u5728\u7A33\u5B9A\u540E\u6210\u4E3A\u72EC\u7ACB\u6570\u636E\u5757\u3002",
      "If enabled, the file under 1kb will be processed in the UI thread.": "\u5982\u679C\u542F\u7528\uFF0C\u5C0F\u4E8E 1kb \u7684\u6587\u4EF6\u5C06\u5728 UI \u7EBF\u7A0B\u4E2D\u5904\u7406\u3002",
      "If enabled, the notification of hidden files change will be suppressed.": "\u5982\u679C\u542F\u7528\uFF0C\u9690\u85CF\u6587\u4EF6\u66F4\u6539\u7684\u901A\u77E5\u5C06\u88AB\u6291\u5236\u3002",
      "If this enabled, all chunks will be stored with the revision made from its content. (Previous behaviour)": "\u5982\u679C\u542F\u7528\uFF0C\u6240\u6709 chunks \u5C06\u4F7F\u7528\u6839\u636E\u5176\u5185\u5BB9\u751F\u6210\u7684\u4FEE\u8BA2\u7248\u672C\u5B58\u50A8\u3002\uFF08\u4EE5\u524D\u7684\u884C\u4E3A\uFF09",
      "If this enabled, All files are handled as case-Sensitive (Previous behaviour).": "\u5982\u679C\u542F\u7528\uFF0C\u6240\u6709\u6587\u4EF6\u90FD\u5C06\u89C6\u4E3A\u533A\u5206\u5927\u5C0F\u5199\uFF08\u4EE5\u524D\u7684\u884C\u4E3A\uFF09\u3002",
      "If this enabled, chunks will be split into semantically meaningful segments. Not all platforms support this feature.": "\u5982\u679C\u542F\u7528\u6B64\u529F\u80FD\uFF0C\u6570\u636E\u5757\u5C06\u88AB\u5206\u5272\u6210\u5177\u6709\u8BED\u4E49\u610F\u4E49\u7684\u6BB5\u843D\u3002\u5E76\u975E\u6240\u6709\u5E73\u53F0\u90FD\u652F\u6301\u6B64\u529F\u80FD\u3002",
      "If this is set, changes to local files which are matched by the ignore files will be skipped. Remote changes are determined using local ignore files.": "\u5982\u679C\u8BBE\u7F6E\u4E86\u6B64\u9879\uFF0C\u4E0E\u5FFD\u7565\u6587\u4EF6\u5339\u914D\u7684\u672C\u5730\u6587\u4EF6\u7684\u66F4\u6539\u5C06\u88AB\u8DF3\u8FC7\u3002\u8FDC\u7A0B\u66F4\u6539\u4F7F\u7528\u672C\u5730\u5FFD\u7565\u6587\u4EF6\u786E\u5B9A",
      "If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.": "\u5982\u679C\u542F\u7528\u6B64\u9009\u9879\uFF0CPouchDB \u5C06\u4FDD\u6301\u8FDE\u63A5\u6253\u5F00 60 \u79D2\uFF0C\u5982\u679C\u5728\u6B64\u65F6\u95F4\u5185\u6CA1\u6709\u66F4\u6539\u5230\u8FBE\uFF0C\u5219\u5173\u95ED\u5E76\u91CD\u65B0\u6253\u5F00\u5957\u63A5\u5B57\uFF0C\u800C\u4E0D\u662F\u65E0\u9650\u671F\u4FDD\u6301\u6253\u5F00\u3002\u5F53\u4EE3\u7406\u9650\u5236\u8BF7\u6C42\u6301\u7EED\u65F6\u95F4\u65F6\u6709\u7528\uFF0C\u4F46\u53EF\u80FD\u4F1A\u589E\u52A0\u8D44\u6E90\u4F7F\u7528\u3002",
      "Ignore files": "\u5FFD\u7565\u6587\u4EF6",
      "Incubate Chunks in Document": "\u5728\u6587\u6863\u4E2D\u5B75\u5316\u5757\uFF08\u6D4B\u8BD5\u7248\uFF09",
      "Interval (sec)": "\u95F4\u9694\uFF08\u79D2\uFF09",
      "Keep empty folder": "\u4FDD\u7559\u7A7A\u6587\u4EF6\u5939",
      "lang-de": "\u5FB7\u8BED",
      "lang-es": "\u897F\u73ED\u7259\u8BED",
      "lang-ja": "\u65E5\u8BED",
      "lang-ru": "\u4FC4\u8BED",
      "lang-zh": "\u7B80\u4F53\u4E2D\u6587",
      "lang-zh-tw": "\u7E41\u9AD4\u4E2D\u6587",
      "LiveSync could not handle multiple vaults which have same name without different prefix, This should be automatically configured.": "LiveSync \u65E0\u6CD5\u5904\u7406\u5177\u6709\u76F8\u540C\u540D\u79F0\u4F46\u6CA1\u6709\u4E0D\u540C\u524D\u7F00\u7684\u591A\u4E2A\u5E93\u3002\u8FD9\u5E94\u8BE5\u81EA\u52A8\u914D\u7F6E\u3002",
      "logPane.autoScroll": "\u81EA\u52A8\u6EDA\u52A8",
      "logPane.pause": "\u6682\u505C",
      "logPane.title": "Self-hosted LiveSync \u65E5\u5FD7",
      "logPane.wrap": "\u81EA\u52A8\u6362\u884C",
      "Maximum delay for batch database updating": "\u6279\u91CF\u6570\u636E\u5E93\u66F4\u65B0\u7684\u6700\u5927\u5EF6\u8FDF",
      "Maximum file size": "\u6700\u5927\u6587\u4EF6\u5927\u5C0F",
      "Maximum Incubating Chunk Size": "\u6700\u5927\u5B75\u5316\u5757\u5927\u5C0F",
      "Maximum Incubating Chunks": "\u6700\u5927\u5B75\u5316\u5757\u6570",
      "Maximum Incubation Period": "\u6700\u5927\u5B75\u5316\u671F",
      "MB (0 to disable).": "MB\uFF080\u4E3A\u7981\u7528\uFF09\u3002",
      "Memory cache size (by total characters)": "\u5185\u5B58\u7F13\u5B58\u5927\u5C0F\uFF08\u6309\u603B\u5B57\u7B26\u6570\uFF09",
      "Memory cache size (by total items)": "\u5185\u5B58\u7F13\u5B58\u5927\u5C0F\uFF08\u6309\u603B\u9879\u76EE\u6570\uFF09",
      "Minimum delay for batch database updating": "\u6279\u91CF\u6570\u636E\u5E93\u66F4\u65B0\u7684\u6700\u5C0F\u5EF6\u8FDF",
      "moduleCheckRemoteSize.logCheckingStorageSizes": "\u6B63\u5728\u68C0\u67E5\u5B58\u50A8\u5927\u5C0F",
      "moduleCheckRemoteSize.logCurrentStorageSize": "\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\uFF1A${measuredSize}",
      "moduleCheckRemoteSize.logExceededWarning": "\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\uFF1A${measuredSize} \u8D85\u8FC7 ${notifySize}",
      "moduleCheckRemoteSize.logThresholdEnlarged": "\u9608\u503C\u5DF2\u6269\u5927\u5230 ${size}MB",
      "moduleCheckRemoteSize.msgConfirmRebuild": "\u8FD9\u53EF\u80FD\u9700\u8981\u4E00\u4E9B\u65F6\u95F4\u3002\u60A8\u771F\u7684\u60F3\u73B0\u5728\u91CD\u5EFA\u6240\u6709\u5185\u5BB9\u5417\uFF1F",
      "moduleCheckRemoteSize.msgDatabaseGrowing": "**\u60A8\u7684\u6570\u636E\u5E93\u6B63\u5728\u53D8\u5927\uFF01** \u4F46\u522B\u62C5\u5FC3\uFF0C\u6211\u4EEC\u73B0\u5728\u53EF\u4EE5\u89E3\u51B3\u5B83\u3002\u5728\u8FDC\u7A0B\u5B58\u50A8\u7A7A\u95F4\u7528\u5B8C\u4E4B\u524D\u8FD8\u6709\u65F6\u95F4\u3002\n\n| \u6D4B\u91CF\u5927\u5C0F | \u914D\u7F6E\u5927\u5C0F |\n| --- | --- |\n| ${estimatedSize} | ${maxSize} |\n\n> [!MORE]-\n> \u5982\u679C\u60A8\u5DF2\u7ECF\u4F7F\u7528\u4E86\u5F88\u591A\u5E74\uFF0C\u6570\u636E\u5E93\u4E2D\u53EF\u80FD\u4F1A\u79EF\u7D2F\u672A\u5F15\u7528\u7684 chunks\u2014\u2014\u4E5F\u5C31\u662F\u5783\u573E\u3002\u56E0\u6B64\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u91CD\u5EFA\u6240\u6709\u5185\u5BB9\u3002\u5B83\u53EF\u80FD\u4F1A\u53D8\u5F97\u5C0F\u5F97\u591A\u3002\n> \n> \u5982\u679C\u60A8\u7684\u5E93\u5BB9\u91CF\u53EA\u662F\u5728\u589E\u52A0\uFF0C\u6700\u597D\u5728\u6574\u7406\u6587\u4EF6\u540E\u91CD\u5EFA\u6240\u6709\u5185\u5BB9\u3002\u5373\u4F7F\u60A8\u4E3A\u4E86\u52A0\u901F\u8FC7\u7A0B\u5220\u9664\u4E86\u6587\u4EF6\uFF0CSelf-hosted LiveSync \u4E5F\u4E0D\u4F1A\u5220\u9664\u5B9E\u9645\u6570\u636E\u3002\u8FD9\u5927\u81F4[\u6709\u6587\u6863\u8BB0\u5F55](https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/tech_info.md)\u3002\n> \n> \u5982\u679C\u60A8\u4E0D\u4ECB\u610F\u589E\u52A0\uFF0C\u53EF\u4EE5\u5C06\u901A\u77E5\u9650\u5236\u589E\u52A0 100MB\u3002\u5982\u679C\u60A8\u5728\u81EA\u5DF1\u7684\u670D\u52A1\u5668\u4E0A\u8FD0\u884C\uFF0C\u5C31\u662F\u8FD9\u79CD\u60C5\u51B5\u3002\u4F46\u662F\uFF0C\u6700\u597D\u8FD8\u662F\u4E0D\u65F6\u5730\u91CD\u5EFA\u6240\u6709\u5185\u5BB9\u3002\n> \n\n> [!WARNING]\n> \u5982\u679C\u60A8\u6267\u884C\u91CD\u5EFA\u6240\u6709\u5185\u5BB9\uFF0C\u8BF7\u786E\u4FDD\u6240\u6709\u8BBE\u5907\u90FD\u5DF2\u540C\u6B65\u3002\u5C3D\u7BA1\u5982\u6B64\uFF0C\u63D2\u4EF6\u4F1A\u5C3D\u53EF\u80FD\u5730\u5408\u5E76\u3002\n",
      "moduleCheckRemoteSize.msgSetDBCapacity": "\u6211\u4EEC\u53EF\u4EE5\u8BBE\u7F6E\u4E00\u4E2A\u6700\u5927\u6570\u636E\u5E93\u5BB9\u91CF\u8B66\u544A\uFF0C**\u4EE5\u4FBF\u5728\u8FDC\u7A0B\u5B58\u50A8\u7A7A\u95F4\u8017\u5C3D\u524D\u91C7\u53D6\u884C\u52A8**\u3002\n\u60A8\u60F3\u542F\u7528\u8FD9\u4E2A\u529F\u80FD\u5417\uFF1F\n\n> [!MORE]-\n> - 0: \u4E0D\u8B66\u544A\u5B58\u50A8\u5927\u5C0F\u3002\n>   \u5982\u679C\u60A8\u5728\u8FDC\u7A0B\u5B58\u50A8\uFF08\u5C24\u5176\u662F\u81EA\u6258\u7BA1\uFF09\u4E0A\u6709\u8DB3\u591F\u7684\u7A7A\u95F4\uFF0C\u5219\u63A8\u8350\u6B64\u9009\u9879\u3002\u60A8\u53EF\u4EE5\u624B\u52A8\u68C0\u67E5\u5B58\u50A8\u5927\u5C0F\u5E76\u91CD\u5EFA\u3002\n> - 800: \u5982\u679C\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\u8D85\u8FC7 800MB \u5219\u53D1\u51FA\u8B66\u544A\u3002\n>   \u5982\u679C\u60A8\u4F7F\u7528\u7684\u662F fly.io\uFF081GB \u9650\u5236\uFF09\u6216 IBM Cloudant\uFF0C\u5219\u63A8\u8350\u6B64\u9009\u9879\u3002\n> - 2000: \u5982\u679C\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\u8D85\u8FC7 2GB \u5219\u53D1\u51FA\u8B66\u544A\u3002\n\n\u5982\u679C\u8FBE\u5230\u9650\u5236\uFF0C\u7CFB\u7EDF\u4F1A\u8981\u6C42\u6211\u4EEC\u9010\u6B65\u589E\u5927\u9650\u5236\u3002\n",
      "moduleCheckRemoteSize.option2GB": "2GB (\u6807\u51C6)",
      "moduleCheckRemoteSize.option800MB": "800MB (Cloudant, fly.io)",
      "moduleCheckRemoteSize.optionAskMeLater": "\u7A0D\u540E\u95EE\u6211",
      "moduleCheckRemoteSize.optionDismiss": "\u5FFD\u7565",
      "moduleCheckRemoteSize.optionIncreaseLimit": "\u589E\u52A0\u5230 ${newMax}MB",
      "moduleCheckRemoteSize.optionNoWarn": "\u4E0D\uFF0C\u8BF7\u6C38\u8FDC\u4E0D\u8981\u8B66\u544A",
      "moduleCheckRemoteSize.optionRebuildAll": "\u7ACB\u5373\u91CD\u5EFA\u6240\u6709\u5185\u5BB9",
      "moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded": "\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\u8D85\u51FA\u9650\u5236",
      "moduleCheckRemoteSize.titleDatabaseSizeNotify": "\u8BBE\u7F6E\u6570\u636E\u5E93\u5927\u5C0F\u901A\u77E5",
      "moduleInputUIObsidian.defaultTitleConfirmation": "\u786E\u8BA4",
      "moduleInputUIObsidian.defaultTitleSelect": "\u9009\u62E9",
      "moduleInputUIObsidian.optionNo": "\u5426",
      "moduleInputUIObsidian.optionYes": "\u662F",
      "moduleLiveSyncMain.logAdditionalSafetyScan": "\u989D\u5916\u7684\u5B89\u5168\u626B\u63CF...",
      "moduleLiveSyncMain.logLoadingPlugin": "\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6...",
      "moduleLiveSyncMain.logPluginInitCancelled": "\u63D2\u4EF6\u521D\u59CB\u5316\u88AB\u67D0\u4E2A\u6A21\u5757\u53D6\u6D88",
      "moduleLiveSyncMain.logPluginVersion": "Self-hosted LiveSync v${manifestVersion} ${packageVersion}",
      "moduleLiveSyncMain.logReadChangelog": "LiveSync \u5DF2\u66F4\u65B0\uFF0C\u8BF7\u9605\u8BFB\u66F4\u65B0\u65E5\u5FD7\uFF01",
      "moduleLiveSyncMain.logSafetyScanCompleted": "\u989D\u5916\u7684\u5B89\u5168\u626B\u63CF\u5B8C\u6210",
      "moduleLiveSyncMain.logSafetyScanFailed": "\u989D\u5916\u7684\u5B89\u5168\u626B\u63CF\u5728\u67D0\u4E2A\u6A21\u5757\u4E0A\u5931\u8D25",
      "moduleLiveSyncMain.logUnloadingPlugin": "\u6B63\u5728\u5378\u8F7D\u63D2\u4EF6...",
      "moduleLiveSyncMain.logVersionUpdate": "LiveSync \u5DF2\u66F4\u65B0\uFF0C\u5982\u679C\u5B58\u5728\u7834\u574F\u6027\u66F4\u65B0\uFF0C\u6240\u6709\u81EA\u52A8\u540C\u6B65\u5DF2\u6682\u65F6\u7981\u7528\u3002\u8BF7\u786E\u4FDD\u6240\u6709\u8BBE\u5907\u90FD\u66F4\u65B0\u5230\u6700\u65B0\u7248\u672C\u540E\u518D\u542F\u7528\u3002",
      "moduleLiveSyncMain.msgScramEnabled": "Self-hosted LiveSync \u5DF2\u88AB\u914D\u7F6E\u4E3A\u5FFD\u7565\u67D0\u4E9B\u4E8B\u4EF6\u3002\u8FD9\u6837\u5BF9\u5417\uFF1F\n\n| \u7C7B\u578B | \u72B6\u6001 | \u8BF4\u660E |\n|:---:|:---:|---|\n| \u5B58\u50A8\u4E8B\u4EF6 | ${fileWatchingStatus} | \u6240\u6709\u4FEE\u6539\u90FD\u5C06\u88AB\u5FFD\u7565 |\n| \u6570\u636E\u5E93\u4E8B\u4EF6 | ${parseReplicationStatus} | \u6240\u6709\u540C\u6B65\u7684\u66F4\u6539\u90FD\u5C06\u88AB\u63A8\u8FDF |\n\n\u60A8\u60F3\u6062\u590D\u5B83\u4EEC\u5E76\u91CD\u542F Obsidian \u5417\uFF1F\n\n> [!DETAILS]-\n> \u8FD9\u4E9B\u6807\u5FD7\u662F\u5728\u91CD\u5EFA\u6216\u83B7\u53D6\u65F6\u7531\u63D2\u4EF6\u8BBE\u7F6E\u7684\u3002\u5982\u679C\u8FC7\u7A0B\u5F02\u5E38\u7ED3\u675F\uFF0C\u5B83\u4EEC\u53EF\u80FD\u4F1A\u88AB\u65E0\u610F\u4E2D\u4FDD\u7559\u3002\n> \u5982\u679C\u60A8\u4E0D\u786E\u5B9A\uFF0C\u53EF\u4EE5\u5C1D\u8BD5\u91CD\u65B0\u8FD0\u884C\u8FD9\u4E9B\u8FC7\u7A0B\u3002\u8BF7\u786E\u4FDD\u5907\u4EFD\u60A8\u7684\u5E93\u3002\n",
      "moduleLiveSyncMain.optionKeepLiveSyncDisabled": "\u4FDD\u6301 LiveSync \u7981\u7528",
      "moduleLiveSyncMain.optionResumeAndRestart": "\u6062\u590D\u5E76\u91CD\u542F Obsidian",
      "moduleLiveSyncMain.titleScramEnabled": "\u7D27\u6025\u505C\u6B62\u5DF2\u542F\u7528",
      "moduleLocalDatabase.logWaitingForReady": "\u7B49\u5F85\u5C31\u7EEA...",
      "moduleMigration.docUri": "https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/zh/README_zh.md#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8",
      "moduleMigration.logBulkSendCorrupted": "\u5DF2\u542F\u7528\u6279\u91CF\u53D1\u9001 chunks\uFF0C\u4F46\u6B64\u529F\u80FD\u5DF2\u635F\u574F\u3002\u7ED9\u60A8\u5E26\u6765\u4E0D\u4FBF\uFF0C\u6211\u4EEC\u6DF1\u8868\u6B49\u610F\u3002\u5DF2\u81EA\u52A8\u7981\u7528\u3002",
      "moduleMigration.logFetchRemoteTweakFailed": "\u83B7\u53D6\u8FDC\u7A0B\u8C03\u6574\u503C\u5931\u8D25",
      "moduleMigration.logLocalDatabaseNotReady": "\u51FA\u9519\u4E86\uFF01\u672C\u5730\u6570\u636E\u5E93\u5C1A\u672A\u51C6\u5907\u597D",
      "moduleMigration.logMigratedSameBehaviour": "\u5DF2\u8FC1\u79FB\u5230 db:${current}\uFF0C\u884C\u4E3A\u4E0E\u4E4B\u524D\u76F8\u540C",
      "moduleMigration.logMigrationFailed": "\u4ECE ${old} \u5230 ${current} \u7684\u8FC1\u79FB\u5931\u8D25\u6216\u5DF2\u53D6\u6D88",
      "moduleMigration.logRedflag2CreationFail": "\u521B\u5EFA redflag2 \u5931\u8D25",
      "moduleMigration.logRemoteTweakUnavailable": "\u65E0\u6CD5\u83B7\u53D6\u8FDC\u7A0B\u8C03\u6574\u503C",
      "moduleMigration.logSetupCancelled": "\u8BBE\u7F6E\u5DF2\u53D6\u6D88\uFF0CSelf-hosted LiveSync \u6B63\u5728\u7B49\u5F85\u60A8\u7684\u8BBE\u7F6E\uFF01",
      "moduleMigration.msgFetchRemoteAgain": "\u60A8\u53EF\u80FD\u5DF2\u7ECF\u77E5\u9053\uFF0CSelf-hosted LiveSync \u66F4\u6539\u4E86\u5176\u9ED8\u8BA4\u884C\u4E3A\u548C\u6570\u636E\u5E93\u7ED3\u6784\u3002\n\n\u503C\u5F97\u5E86\u5E78\u7684\u662F\uFF0C\u5728\u60A8\u7684\u65F6\u95F4\u548C\u52AA\u529B\u4E0B\uFF0C\u8FDC\u7A0B\u6570\u636E\u5E93\u4F3C\u4E4E\u5DF2\u7ECF\u8FC1\u79FB\u5B8C\u6210\u3002\u606D\u559C\uFF01\n\n\u4F46\u662F\uFF0C\u6211\u4EEC\u8FD8\u9700\u8981\u4E00\u70B9\u70B9\u64CD\u4F5C\u3002\u6B64\u8BBE\u5907\u7684\u914D\u7F6E\u4E0E\u8FDC\u7A0B\u6570\u636E\u5E93\u4E0D\u517C\u5BB9\u3002\u6211\u4EEC\u9700\u8981\u518D\u6B21\u4ECE\u8FDC\u7A0B\u6570\u636E\u5E93\u83B7\u53D6\u3002\u6211\u4EEC\u73B0\u5728\u5E94\u8BE5\u518D\u6B21\u4ECE\u8FDC\u7A0B\u83B7\u53D6\u5417\uFF1F\n\n___\u6CE8\u610F\uFF1A\u5728\u66F4\u6539\u914D\u7F6E\u5E76\u518D\u6B21\u83B7\u53D6\u6570\u636E\u5E93\u4E4B\u524D\uFF0C\u6211\u4EEC\u65E0\u6CD5\u8FDB\u884C\u540C\u6B65\u3002___\n___\u6CE8\u610F2\uFF1Achunks \u662F\u5B8C\u5168\u4E0D\u53EF\u53D8\u7684\uFF0C\u6211\u4EEC\u53EA\u80FD\u83B7\u53D6\u5143\u6570\u636E\u548C\u5DEE\u5F02\u3002___",
      "moduleMigration.msgInitialSetup": "\u60A8\u7684\u8BBE\u5907**\u5C1A\u672A\u8BBE\u7F6E**\u3002\u8BA9\u6211\u5F15\u5BFC\u60A8\u5B8C\u6210\u8BBE\u7F6E\u8FC7\u7A0B\u3002\n\n\u8BF7\u8BB0\u4F4F\uFF0C\u6BCF\u4E2A\u5BF9\u8BDD\u6846\u5185\u5BB9\u90FD\u53EF\u4EE5\u590D\u5236\u5230\u526A\u8D34\u677F\u3002\u5982\u679C\u4EE5\u540E\u9700\u8981\u53C2\u8003\uFF0C\u53EF\u4EE5\u5C06\u5176\u7C98\u8D34\u5230 Obsidian \u7684\u7B14\u8BB0\u4E2D\u3002\u60A8\u4E5F\u53EF\u4EE5\u4F7F\u7528\u7FFB\u8BD1\u5DE5\u5177\u5C06\u5176\u7FFB\u8BD1\u6210\u60A8\u7684\u8BED\u8A00\u3002\n\n\u9996\u5148\uFF0C\u60A8\u6709**\u8BBE\u7F6E URI** \u5417\uFF1F\n\n\u6CE8\u610F\uFF1A\u5982\u679C\u60A8\u4E0D\u77E5\u9053\u8FD9\u662F\u4EC0\u4E48\uFF0C\u8BF7\u53C2\u9605[\u6587\u6863](${URI_DOC})\u3002",
      "moduleMigration.msgRecommendSetupUri": "\u6211\u4EEC\u5F3A\u70C8\u5EFA\u8BAE\u60A8\u751F\u6210\u4E00\u4E2A\u8BBE\u7F6E URI \u5E76\u4F7F\u7528\u5B83\u3002\n\u5982\u679C\u60A8\u5BF9\u6B64\u4E0D\u4E86\u89E3\uFF0C\u8BF7\u53C2\u9605[\u6587\u6863](${URI_DOC})\uFF08\u518D\u6B21\u62B1\u6B49\uFF0C\u4F46\u8FD9\u5F88\u91CD\u8981\uFF09\u3002\n\n\u60A8\u60F3\u5982\u4F55\u624B\u52A8\u8BBE\u7F6E\uFF1F",
      "moduleMigration.msgSinceV02321": "\u81EA v0.23.21 \u8D77\uFF0CSelf-hosted LiveSync \u66F4\u6539\u4E86\u9ED8\u8BA4\u884C\u4E3A\u548C\u6570\u636E\u5E93\u7ED3\u6784\u3002\u8FDB\u884C\u4E86\u4EE5\u4E0B\u66F4\u6539\uFF1A\n\n1. **\u6587\u4EF6\u540D\u7684\u533A\u5206\u5927\u5C0F\u5199** \n\u73B0\u5728\u5904\u7406\u6587\u4EF6\u540D\u65F6\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u3002\u8FD9\u5BF9\u4E8E\u5927\u591A\u6570\u5E73\u53F0\u6765\u8BF4\u662F\u4E00\u4E2A\u6709\u76CA\u7684\u66F4\u6539\uFF0C\u9664\u4E86 Linux \u548C iOS\uFF0C\u5B83\u4EEC\u4E0D\u80FD\u6709\u6548\u5730\u7BA1\u7406\u6587\u4EF6\u540D\u7684\u5927\u5C0F\u5199\u654F\u611F\u6027\u3002\n\uFF08\u5728\u8FD9\u4E9B\u5E73\u53F0\u4E0A\uFF0C\u5BF9\u4E8E\u540D\u79F0\u76F8\u540C\u4F46\u5927\u5C0F\u5199\u4E0D\u540C\u7684\u6587\u4EF6\u5C06\u663E\u793A\u8B66\u544A\uFF09\u3002\n\n2. **chunks \u7684\u7248\u672C\u5904\u7406** \nchunks \u662F\u4E0D\u53EF\u53D8\u7684\uFF0C\u8FD9\u4F7F\u5F97\u5B83\u4EEC\u7684\u7248\u672C\u53EF\u4EE5\u56FA\u5B9A\u3002\u6B64\u66F4\u6539\u5C06\u63D0\u9AD8\u6587\u4EF6\u4FDD\u5B58\u7684\u6027\u80FD\u3002\n\n___\u7136\u800C\uFF0C\u8981\u542F\u7528\u8FD9\u4E9B\u66F4\u6539\u4E2D\u7684\u4EFB\u4F55\u4E00\u4E2A\uFF0C\u90FD\u9700\u8981\u91CD\u5EFA\u8FDC\u7A0B\u548C\u672C\u5730\u6570\u636E\u5E93\u3002\u8FD9\u4E2A\u8FC7\u7A0B\u9700\u8981\u51E0\u5206\u949F\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u60A8\u5728\u6709\u5145\u8DB3\u65F6\u95F4\u65F6\u8FDB\u884C\u3002___\n\n- \u5982\u679C\u60A8\u5E0C\u671B\u4FDD\u6301\u4EE5\u524D\u7684\u884C\u4E3A\uFF0C\u53EF\u4EE5\u4F7F\u7528 `${KEEP}` \u8DF3\u8FC7\u6B64\u8FC7\u7A0B\u3002\n- \u5982\u679C\u60A8\u6CA1\u6709\u8DB3\u591F\u7684\u65F6\u95F4\uFF0C\u8BF7\u9009\u62E9 `${DISMISS}`\u3002\u7A0D\u540E\u4F1A\u518D\u6B21\u63D0\u793A\u60A8\u3002\n- \u5982\u679C\u60A8\u5DF2\u5728\u53E6\u4E00\u53F0\u8BBE\u5907\u4E0A\u91CD\u5EFA\u4E86\u6570\u636E\u5E93\uFF0C\u8BF7\u9009\u62E9 `${DISMISS}` \u5E76\u5C1D\u8BD5\u518D\u6B21\u540C\u6B65\u3002\u7531\u4E8E\u68C0\u6D4B\u5230\u5DEE\u5F02\uFF0C\u7CFB\u7EDF\u4F1A\u518D\u6B21\u63D0\u793A\u60A8\u3002",
      "moduleMigration.optionAdjustRemote": "\u8C03\u6574\u5230\u8FDC\u7A0B\u8BBE\u7F6E",
      "moduleMigration.optionDecideLater": "\u7A0D\u540E\u51B3\u5B9A",
      "moduleMigration.optionEnableBoth": "\u542F\u7528\u4E24\u8005",
      "moduleMigration.optionEnableFilenameCaseInsensitive": "\u4EC5\u542F\u7528 #1",
      "moduleMigration.optionEnableFixedRevisionForChunks": "\u4EC5\u542F\u7528 #2",
      "moduleMigration.optionHaveSetupUri": "\u662F\u7684\uFF0C\u6211\u6709",
      "moduleMigration.optionKeepPreviousBehaviour": "\u4FDD\u6301\u4EE5\u524D\u7684\u884C\u4E3A",
      "moduleMigration.optionManualSetup": "\u5168\u90E8\u624B\u52A8\u8BBE\u7F6E",
      "moduleMigration.optionNoAskAgain": "\u4E0D\uFF0C\u8BF7\u7A0D\u540E\u518D\u6B21\u8BE2\u95EE",
      "moduleMigration.optionNoSetupUri": "\u4E0D\uFF0C\u6211\u6CA1\u6709",
      "moduleMigration.optionRemindNextLaunch": "\u4E0B\u6B21\u542F\u52A8\u65F6\u63D0\u9192\u6211",
      "moduleMigration.optionSetupWizard": "\u5E26\u6211\u8FDB\u5165\u8BBE\u7F6E\u5411\u5BFC",
      "moduleMigration.optionYesFetchAgain": "\u662F\u7684\uFF0C\u518D\u6B21\u83B7\u53D6",
      "moduleMigration.titleCaseSensitivity": "\u5927\u5C0F\u5199\u654F\u611F\u6027",
      "moduleMigration.titleRecommendSetupUri": "\u63A8\u8350\u4F7F\u7528\u8BBE\u7F6E URI",
      "moduleMigration.titleWelcome": "\u6B22\u8FCE\u4F7F\u7528 Self-hosted LiveSync",
      "Move remotely deleted files to the trash, instead of deleting.": "\u5C06\u8FDC\u7A0B\u5220\u9664\u7684\u6587\u4EF6\u79FB\u81F3\u56DE\u6536\u7AD9\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5220\u9664\u3002",
      'Not all messages have been translated. And, please revert to "Default" when reporting errors.': '\u5E76\u975E\u6240\u6709\u6D88\u606F\u90FD\u5DF2\u7FFB\u8BD1\u3002\u8BF7\u5728\u62A5\u544A\u9519\u8BEF\u65F6\u6062\u590D\u4E3A"Default"',
      "Notify all setting files": "\u901A\u77E5\u6240\u6709\u8BBE\u7F6E\u6587\u4EF6",
      "Notify customized": "\u901A\u77E5\u81EA\u5B9A\u4E49\u8BBE\u7F6E",
      "Notify when other device has newly customized.": "\u5F53\u5176\u4ED6\u8BBE\u5907\u6709\u65B0\u7684\u81EA\u5B9A\u4E49\u8BBE\u7F6E\u65F6\u901A\u77E5\u3002",
      "Notify when the estimated remote storage size exceeds on start up": "\u542F\u52A8\u65F6\u5F53\u4F30\u8BA1\u7684\u8FDC\u7A0B\u5B58\u50A8\u5927\u5C0F\u8D85\u51FA\u65F6\u901A\u77E5",
      "Number of batches to process at a time. Defaults to 40. Minimum is 2. This along with batch size controls how many docs are kept in memory at a time.": "\u4E00\u6B21\u5904\u7406\u7684\u6279\u91CF\u6570\u91CF\u3002\u9ED8\u8BA4\u4E3A 40\u3002\u6700\u5C0F\u4E3A 2\u3002\u6B64\u8BBE\u7F6E\u4E0E\u6279\u91CF\u5927\u5C0F\u4E00\u8D77\u63A7\u5236\u4E00\u6B21\u5728\u5185\u5B58\u4E2D\u4FDD\u7559\u591A\u5C11\u6587\u6863\u3002",
      "Number of changes to sync at a time. Defaults to 50. Minimum is 2.": "\u4E00\u6B21\u540C\u6B65\u7684\u66F4\u6539\u6570\u91CF\u3002\u9ED8\u8BA4\u4E3A 50\u3002\u6700\u5C0F\u4E3A 2\u3002",
      "obsidianLiveSyncSettingTab.btnApply": "\u5E94\u7528",
      "obsidianLiveSyncSettingTab.btnCheck": "\u68C0\u67E5",
      "obsidianLiveSyncSettingTab.btnCopy": "\u590D\u5236",
      "obsidianLiveSyncSettingTab.btnDisable": "\u7981\u7528",
      "obsidianLiveSyncSettingTab.btnDiscard": "\u4E22\u5F03",
      "obsidianLiveSyncSettingTab.btnEnable": "\u542F\u7528",
      "obsidianLiveSyncSettingTab.btnFix": "\u4FEE\u590D",
      "obsidianLiveSyncSettingTab.btnGotItAndUpdated": "\u6211\u660E\u767D\u4E86\u5E76\u4E14\u5DF2\u66F4\u65B0\u3002",
      "obsidianLiveSyncSettingTab.btnNext": "\u4E0B\u4E00\u6B65",
      "obsidianLiveSyncSettingTab.btnStart": "\u5F00\u59CB",
      "obsidianLiveSyncSettingTab.btnTest": "\u6D4B\u8BD5",
      "obsidianLiveSyncSettingTab.btnUse": "\u4F7F\u7528",
      "obsidianLiveSyncSettingTab.buttonFetch": "\u83B7\u53D6",
      "obsidianLiveSyncSettingTab.buttonNext": "\u4E0B\u4E00\u6B65",
      "obsidianLiveSyncSettingTab.defaultLanguage": "\u9ED8\u8BA4",
      "obsidianLiveSyncSettingTab.descConnectSetupURI": "\u8FD9\u662F\u4F7F\u7528\u8BBE\u7F6E URI \u8BBE\u7F6E Self-hosted LiveSync \u7684\u63A8\u8350\u65B9\u6CD5\u3002",
      "obsidianLiveSyncSettingTab.descCopySetupURI": "\u975E\u5E38\u9002\u5408\u8BBE\u7F6E\u65B0\u8BBE\u5907\uFF01",
      "obsidianLiveSyncSettingTab.descEnableLiveSync": "\u4EC5\u5728\u914D\u7F6E\u4E86\u4E0A\u8FF0\u4E24\u4E2A\u9009\u9879\u4E4B\u4E00\u6216\u624B\u52A8\u5B8C\u6210\u6240\u6709\u914D\u7F6E\u540E\u542F\u7528\u6B64\u9009\u9879\u3002",
      "obsidianLiveSyncSettingTab.descFetchConfigFromRemote": "\u4ECE\u5DF2\u914D\u7F6E\u7684\u8FDC\u7A0B\u670D\u52A1\u5668\u83B7\u53D6\u5FC5\u8981\u7684\u8BBE\u7F6E\u3002",
      "obsidianLiveSyncSettingTab.descManualSetup": "\u4E0D\u63A8\u8350\uFF0C\u4F46\u5982\u679C\u60A8\u6CA1\u6709\u8BBE\u7F6E URI \u5219\u5F88\u6709\u7528",
      "obsidianLiveSyncSettingTab.descTestDatabaseConnection": "\u6253\u5F00\u6570\u636E\u5E93\u8FDE\u63A5\u3002\u5982\u679C\u672A\u627E\u5230\u8FDC\u7A0B\u6570\u636E\u5E93\u5E76\u4E14\u60A8\u6709\u521B\u5EFA\u6570\u636E\u5E93\u7684\u6743\u9650\uFF0C\u5219\u5C06\u521B\u5EFA\u6570\u636E\u5E93\u3002",
      "obsidianLiveSyncSettingTab.descValidateDatabaseConfig": "\u68C0\u67E5\u5E76\u4FEE\u590D\u6570\u636E\u5E93\u914D\u7F6E\u4E2D\u7684\u4EFB\u4F55\u6F5C\u5728\u95EE\u9898\u3002",
      "obsidianLiveSyncSettingTab.errAccessForbidden": "\u2757 \u8BBF\u95EE\u88AB\u7981\u6B62\u3002",
      "obsidianLiveSyncSettingTab.errCannotContinueTest": "\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u6D4B\u8BD5\u3002",
      "obsidianLiveSyncSettingTab.errCorsCredentials": "\u2757 cors.credentials \u8BBE\u7F6E\u9519\u8BEF",
      "obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials": "\u2757 CORS \u4E0D\u5141\u8BB8\u51ED\u636E",
      "obsidianLiveSyncSettingTab.errCorsOrigins": "\u2757 cors.origins \u8BBE\u7F6E\u9519\u8BEF",
      "obsidianLiveSyncSettingTab.errEnableCors": "\u2757 httpd.enable_cors \u8BBE\u7F6E\u9519\u8BEF",
      "obsidianLiveSyncSettingTab.errMaxDocumentSize": "\u2757 couchdb.max_document_size \u8BBE\u7F6E\u8FC7\u4F4E)",
      "obsidianLiveSyncSettingTab.errMaxRequestSize": "\u2757 chttpd.max_http_request_size \u8BBE\u7F6E\u8FC7\u4F4E)",
      "obsidianLiveSyncSettingTab.errMissingWwwAuth": "\u2757 \u7F3A\u5C11 httpd.WWW-Authenticate \u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.errRequireValidUser": "\u2757 chttpd.require_valid_user \u8BBE\u7F6E\u9519\u8BEF\u3002",
      "obsidianLiveSyncSettingTab.errRequireValidUserAuth": "\u2757 chttpd_auth.require_valid_user \u8BBE\u7F6E\u9519\u8BEF\u3002",
      "obsidianLiveSyncSettingTab.labelDisabled": "\u23F9\uFE0F : \u5DF2\u7981\u7528",
      "obsidianLiveSyncSettingTab.labelEnabled": "\u{1F501} : \u5DF2\u542F\u7528",
      "obsidianLiveSyncSettingTab.levelAdvanced": "\uFF08\u8FDB\u9636\uFF09",
      "obsidianLiveSyncSettingTab.levelEdgeCase": "\uFF08\u8FB9\u7F18\u60C5\u51B5\uFF09",
      "obsidianLiveSyncSettingTab.levelPowerUser": "\uFF08\u9AD8\u7EA7\u7528\u6237\uFF09",
      "obsidianLiveSyncSettingTab.linkOpenInBrowser": "\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00",
      "obsidianLiveSyncSettingTab.linkPageTop": "\u9875\u9762\u9876\u90E8",
      "obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting": "\u63D0\u793A\u548C\u6545\u969C\u6392\u9664",
      "obsidianLiveSyncSettingTab.linkTroubleshooting": "/docs/troubleshooting.md",
      "obsidianLiveSyncSettingTab.logCannotUseCloudant": "\u6B64\u529F\u80FD\u4E0D\u80FD\u4E0E IBM Cloudant \u4E00\u8D77\u4F7F\u7528\u3002",
      "obsidianLiveSyncSettingTab.logCheckingConfigDone": "\u914D\u7F6E\u68C0\u67E5\u5B8C\u6210",
      "obsidianLiveSyncSettingTab.logCheckingConfigFailed": "\u914D\u7F6E\u68C0\u67E5\u5931\u8D25",
      "obsidianLiveSyncSettingTab.logCheckingDbConfig": "\u6B63\u5728\u68C0\u67E5\u6570\u636E\u5E93\u914D\u7F6E",
      "obsidianLiveSyncSettingTab.logCheckPassphraseFailed": "\u9519\u8BEF\uFF1A\u65E0\u6CD5\u4F7F\u7528\u8FDC\u7A0B\u670D\u52A1\u5668\u68C0\u67E5\u5BC6\u7801\uFF1A\n${db}\u3002",
      "obsidianLiveSyncSettingTab.logConfiguredDisabled": "\u914D\u7F6E\u7684\u540C\u6B65\u6A21\u5F0F\uFF1A\u5DF2\u7981\u7528",
      "obsidianLiveSyncSettingTab.logConfiguredLiveSync": "\u914D\u7F6E\u7684\u540C\u6B65\u6A21\u5F0F\uFF1ALiveSync",
      "obsidianLiveSyncSettingTab.logConfiguredPeriodic": "\u914D\u7F6E\u7684\u540C\u6B65\u6A21\u5F0F\uFF1A\u5B9A\u671F",
      "obsidianLiveSyncSettingTab.logCouchDbConfigFail": "CouchDB \u914D\u7F6E\uFF1A${title} \u5931\u8D25",
      "obsidianLiveSyncSettingTab.logCouchDbConfigSet": "CouchDB \u914D\u7F6E\uFF1A${title} -> \u8BBE\u7F6E ${key} \u4E3A ${value}",
      "obsidianLiveSyncSettingTab.logCouchDbConfigUpdated": "CouchDB \u914D\u7F6E\uFF1A${title} \u6210\u529F\u66F4\u65B0",
      "obsidianLiveSyncSettingTab.logDatabaseConnected": "\u6570\u636E\u5E93\u5DF2\u8FDE\u63A5",
      "obsidianLiveSyncSettingTab.logEncryptionNoPassphrase": "\u6CA1\u6709\u5BC6\u7801\u65E0\u6CD5\u542F\u7528\u52A0\u5BC6",
      "obsidianLiveSyncSettingTab.logEncryptionNoSupport": "\u60A8\u7684\u8BBE\u5907\u4E0D\u652F\u6301\u52A0\u5BC6\u3002",
      "obsidianLiveSyncSettingTab.logErrorOccurred": "\u53D1\u751F\u9519\u8BEF\uFF01\uFF01",
      "obsidianLiveSyncSettingTab.logEstimatedSize": "\u4F30\u8BA1\u5927\u5C0F\uFF1A${size}",
      "obsidianLiveSyncSettingTab.logPassphraseInvalid": "\u5BC6\u7801\u65E0\u6548\uFF0C\u8BF7\u4FEE\u6B63\u3002",
      "obsidianLiveSyncSettingTab.logPassphraseNotCompatible": "\u9519\u8BEF\uFF1A\u5BC6\u7801\u4E0E\u8FDC\u7A0B\u670D\u52A1\u5668\u4E0D\u517C\u5BB9\uFF01\u8BF7\u518D\u6B21\u68C0\u67E5\uFF01",
      "obsidianLiveSyncSettingTab.logRebuildNote": "\u540C\u6B65\u5DF2\u7981\u7528\uFF0C\u5982\u679C\u9700\u8981\uFF0C\u8BF7\u83B7\u53D6\u5E76\u91CD\u65B0\u542F\u7528\u3002",
      "obsidianLiveSyncSettingTab.logSelectAnyPreset": "\u9009\u62E9\u4EFB\u4F55\u9884\u8BBE\u3002",
      "obsidianLiveSyncSettingTab.msgAreYouSureProceed": "\u60A8\u786E\u5B9A\u8981\u7EE7\u7EED\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied": "\u9700\u8981\u5E94\u7528\u66F4\u6539\uFF01",
      "obsidianLiveSyncSettingTab.msgConfigCheck": "--\u914D\u7F6E\u68C0\u67E5--",
      "obsidianLiveSyncSettingTab.msgConfigCheckFailed": "\u914D\u7F6E\u68C0\u67E5\u5931\u8D25\u3002\u60A8\u4ECD\u8981\u7EE7\u7EED\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgConnectionCheck": "--\u8FDE\u63A5\u68C0\u67E5--",
      "obsidianLiveSyncSettingTab.msgConnectionProxyNote": "\u5982\u679C\u60A8\u5728\u8FDE\u63A5\u68C0\u67E5\u65F6\u9047\u5230\u95EE\u9898\uFF08\u5373\u4F7F\u68C0\u67E5\u4E86\u914D\u7F6E\u540E\uFF09\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u53CD\u5411\u4EE3\u7406\u914D\u7F6E\u3002",
      "obsidianLiveSyncSettingTab.msgCurrentOrigin": "\u5F53\u524D\u6E90: {origin}",
      "obsidianLiveSyncSettingTab.msgDiscardConfirmation": "\u60A8\u771F\u7684\u8981\u4E22\u5F03\u73B0\u6709\u7684\u8BBE\u7F6E\u548C\u6570\u636E\u5E93\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgDone": "--\u5B8C\u6210--",
      "obsidianLiveSyncSettingTab.msgEnableCors": "\u8BBE\u7F6E httpd.enable_cors",
      "obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation": "\u6211\u4EEC\u5EFA\u8BAE\u542F\u7528\u7AEF\u5230\u7AEF\u52A0\u5BC6\u548C\u8DEF\u5F84\u6DF7\u6DC6\u3002\u60A8\u786E\u5B9A\u8981\u5728\u6CA1\u6709\u52A0\u5BC6\u7684\u60C5\u51B5\u4E0B\u7EE7\u7EED\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgFetchConfigFromRemote": "\u60A8\u60F3\u4ECE\u8FDC\u7A0B\u670D\u52A1\u5668\u83B7\u53D6\u914D\u7F6E\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgGenerateSetupURI": "\u5168\u90E8\u5B8C\u6210\uFF01\u60A8\u60F3\u751F\u6210\u4E00\u4E2A\u8BBE\u7F6E URI \u6765\u8BBE\u7F6E\u5176\u4ED6\u8BBE\u5907\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgIfConfigNotPersistent": "\u5982\u679C\u670D\u52A1\u5668\u914D\u7F6E\u4E0D\u662F\u6301\u4E45\u7684\uFF08\u4F8B\u5982\uFF0C\u5728 docker \u4E0A\u8FD0\u884C\uFF09\uFF0C\u6B64\u5904\u7684\u503C\u53EF\u80FD\u4F1A\u66F4\u6539\u3002\u4E00\u65E6\u80FD\u591F\u8FDE\u63A5\uFF0C\u8BF7\u66F4\u65B0\u670D\u52A1\u5668 local.ini \u4E2D\u7684\u8BBE\u7F6E\u3002",
      "obsidianLiveSyncSettingTab.msgInvalidPassphrase": "\u60A8\u7684\u52A0\u5BC6\u5BC6\u7801\u53EF\u80FD\u65E0\u6548\u3002\u60A8\u786E\u5B9A\u8981\u7EE7\u7EED\u5417\uFF1F",
      "obsidianLiveSyncSettingTab.msgNewVersionNote": "\u56E0\u4E3A\u5347\u7EA7\u901A\u77E5\u6765\u5230\u8FD9\u91CC\uFF1F\u8BF7\u67E5\u770B\u7248\u672C\u5386\u53F2\u3002\u5982\u679C\u60A8\u6EE1\u610F\uFF0C\u8BF7\u70B9\u51FB\u6309\u94AE\u3002\u65B0\u7684\u66F4\u65B0\u5C06\u518D\u6B21\u63D0\u793A\u6B64\u4FE1\u606F\u3002",
      "obsidianLiveSyncSettingTab.msgNonHTTPSInfo": "\u914D\u7F6E\u4E3A\u975E HTTPS URI\u3002\u8BF7\u6CE8\u610F\uFF0C\u8FD9\u53EF\u80FD\u5728\u79FB\u52A8\u8BBE\u5907\u4E0A\u65E0\u6CD5\u5DE5\u4F5C\u3002",
      "obsidianLiveSyncSettingTab.msgNonHTTPSWarning": "\u65E0\u6CD5\u8FDE\u63A5\u5230\u975E HTTPS URI\u3002\u8BF7\u66F4\u65B0\u60A8\u7684\u914D\u7F6E\u5E76\u91CD\u8BD5\u3002",
      "obsidianLiveSyncSettingTab.msgNotice": "---\u6CE8\u610F---",
      "obsidianLiveSyncSettingTab.msgObjectStorageWarning": "\u8B66\u544A\uFF1A\u6B64\u529F\u80FD\u4ECD\u5728\u5F00\u53D1\u4E2D\uFF0C\u8BF7\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A\n- \u4EC5\u8FFD\u52A0\u67B6\u6784\u3002\u9700\u8981\u91CD\u5EFA\u624D\u80FD\u7F29\u5C0F\u5B58\u50A8\u7A7A\u95F4\u3002\n- \u6709\u70B9\u8106\u5F31\u3002\n- \u9996\u6B21\u540C\u6B65\u65F6\uFF0C\u6240\u6709\u5386\u53F2\u8BB0\u5F55\u5C06\u4ECE\u8FDC\u7A0B\u4F20\u8F93\u3002\u6CE8\u610F\u6570\u636E\u4E0A\u9650\u548C\u6162\u901F\u3002\n- \u53EA\u6709\u5DEE\u5F02\u4F1A\u5B9E\u65F6\u540C\u6B65\u3002\n\n\u5982\u679C\u60A8\u9047\u5230\u4EFB\u4F55\u95EE\u9898\uFF0C\u6216\u5BF9\u6B64\u529F\u80FD\u6709\u4EFB\u4F55\u60F3\u6CD5\uFF0C\u8BF7\u5728 GitHub \u4E0A\u521B\u5EFA issue\u3002\n\u611F\u8C22\u60A8\u7684\u5DE8\u5927\u8D21\u732E\u3002",
      "obsidianLiveSyncSettingTab.msgOriginCheck": "\u6E90\u68C0\u67E5: {org}",
      "obsidianLiveSyncSettingTab.msgRebuildRequired": "\u9700\u8981\u91CD\u5EFA\u6570\u636E\u5E93\u4EE5\u5E94\u7528\u66F4\u6539\u3002\u8BF7\u9009\u62E9\u5E94\u7528\u66F4\u6539\u7684\u65B9\u6CD5\u3002\n\n<details>\n<summary>\u56FE\u4F8B</summary>\n\n| \u7B26\u53F7 | \u542B\u4E49 |\n|: ------ :| ------- |\n| \u21D4 | \u6700\u65B0 |\n| \u21C4 | \u540C\u6B65\u4EE5\u5E73\u8861 |\n| \u21D0,\u21D2 | \u4F20\u8F93\u4EE5\u8986\u76D6 |\n| \u21E0,\u21E2 | \u4ECE\u53E6\u4E00\u4FA7\u4F20\u8F93\u4EE5\u8986\u76D6 |\n\n</details>\n\n## ${OPTION_REBUILD_BOTH}\n\u6982\u89C8\uFF1A\u{1F4C4} \u21D2\xB9 \u{1F4BB} \u21D2\xB2 \u{1F6F0}\uFE0F \u21E2\u207F \u{1F4BB} \u21C4\u207F\u207A\xB9 \u{1F4C4}\n\u4F7F\u7528\u6B64\u8BBE\u5907\u7684\u73B0\u6709\u6587\u4EF6\u91CD\u5EFA\u672C\u5730\u548C\u8FDC\u7A0B\u6570\u636E\u5E93\u3002\n\u8FD9\u5C06\u5BFC\u81F4\u5176\u4ED6\u8BBE\u5907\u88AB\u9501\u5B9A\uFF0C\u5E76\u4E14\u5B83\u4EEC\u9700\u8981\u6267\u884C\u83B7\u53D6\u64CD\u4F5C\u3002\n## ${OPTION_FETCH}\n\u6982\u89C8\uFF1A\u{1F4C4} \u21C4\xB2 \u{1F4BB} \u21D0\xB9 \u{1F6F0}\uFE0F \u21D4 \u{1F4BB} \u21D4 \u{1F4C4}\n\u521D\u59CB\u5316\u672C\u5730\u6570\u636E\u5E93\u5E76\u4F7F\u7528\u4ECE\u8FDC\u7A0B\u6570\u636E\u5E93\u83B7\u53D6\u7684\u6570\u636E\u91CD\u5EFA\u5B83\u3002\n\u8FD9\u79CD\u60C5\u51B5\u5305\u62EC\u60A8\u5DF2\u7ECF\u91CD\u5EFA\u4E86\u8FDC\u7A0B\u6570\u636E\u5E93\u7684\u60C5\u51B5\u3002\n## ${OPTION_ONLY_SETTING}\n\u4EC5\u5B58\u50A8\u8BBE\u7F6E\u3002**\u6CE8\u610F\uFF1A\u8FD9\u53EF\u80FD\u5BFC\u81F4\u6570\u636E\u635F\u574F**\uFF1B\u901A\u5E38\u9700\u8981\u91CD\u5EFA\u6570\u636E\u5E93\u3002",
      "obsidianLiveSyncSettingTab.msgSelectAndApplyPreset": "\u8BF7\u9009\u62E9\u5E76\u5E94\u7528\u4EFB\u4F55\u9884\u8BBE\u9879\u4EE5\u5B8C\u6210\u5411\u5BFC\u3002",
      "obsidianLiveSyncSettingTab.msgSetCorsCredentials": "\u8BBE\u7F6E cors.credentials",
      "obsidianLiveSyncSettingTab.msgSetCorsOrigins": "\u8BBE\u7F6E cors.origins",
      "obsidianLiveSyncSettingTab.msgSetMaxDocSize": "\u8BBE\u7F6E couchdb.max_document_size",
      "obsidianLiveSyncSettingTab.msgSetMaxRequestSize": "\u8BBE\u7F6E chttpd.max_http_request_size",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUser": "\u8BBE\u7F6E chttpd.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth": "\u8BBE\u7F6E chttpd_auth.require_valid_user = true",
      "obsidianLiveSyncSettingTab.msgSettingModified": '\u8BBE\u7F6E "${setting}" \u5DF2\u4ECE\u53E6\u4E00\u53F0\u8BBE\u5907\u4FEE\u6539\u3002\u70B9\u51FB {HERE} \u91CD\u65B0\u52A0\u8F7D\u8BBE\u7F6E\u3002\u70B9\u51FB\u5176\u4ED6\u5730\u65B9\u5FFD\u7565\u66F4\u6539\u3002',
      "obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync": "\u8FD9\u4E9B\u8BBE\u7F6E\u5728\u540C\u6B65\u671F\u95F4\u65E0\u6CD5\u66F4\u6539\u3002\u8BF7\u5728\u201C\u540C\u6B65\u8BBE\u7F6E\u201D\u4E2D\u7981\u7528\u6240\u6709\u540C\u6B65\u4EE5\u89E3\u9501\u3002",
      "obsidianLiveSyncSettingTab.msgSetWwwAuth": "\u8BBE\u7F6E httpd.WWW-Authenticate",
      "obsidianLiveSyncSettingTab.nameApplySettings": "\u5E94\u7528\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.nameConnectSetupURI": "\u4F7F\u7528\u8BBE\u7F6E URI \u8FDE\u63A5",
      "obsidianLiveSyncSettingTab.nameCopySetupURI": "\u5C06\u5F53\u524D\u8BBE\u7F6E\u590D\u5236\u4E3A\u8BBE\u7F6E URI",
      "obsidianLiveSyncSettingTab.nameDisableHiddenFileSync": "\u7981\u7528\u9690\u85CF\u6587\u4EF6\u540C\u6B65",
      "obsidianLiveSyncSettingTab.nameDiscardSettings": "\u4E22\u5F03\u73B0\u6709\u8BBE\u7F6E\u548C\u6570\u636E\u5E93",
      "obsidianLiveSyncSettingTab.nameEnableHiddenFileSync": "\u542F\u7528\u9690\u85CF\u6587\u4EF6\u540C\u6B65",
      "obsidianLiveSyncSettingTab.nameEnableLiveSync": "\u542F\u7528 LiveSync",
      "obsidianLiveSyncSettingTab.nameHiddenFileSynchronization": "\u9690\u85CF\u6587\u4EF6\u540C\u6B65",
      "obsidianLiveSyncSettingTab.nameManualSetup": "\u624B\u52A8\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.nameTestConnection": "\u6D4B\u8BD5\u8FDE\u63A5",
      "obsidianLiveSyncSettingTab.nameTestDatabaseConnection": "\u6D4B\u8BD5\u6570\u636E\u5E93\u8FDE\u63A5",
      "obsidianLiveSyncSettingTab.nameValidateDatabaseConfig": "\u9A8C\u8BC1\u6570\u636E\u5E93\u914D\u7F6E",
      "obsidianLiveSyncSettingTab.okAdminPrivileges": "\u2714 \u60A8\u62E5\u6709\u7BA1\u7406\u5458\u6743\u9650\u3002",
      "obsidianLiveSyncSettingTab.okCorsCredentials": "\u2714 cors.credentials \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin": "CORS \u51ED\u636E\u6B63\u5E38",
      "obsidianLiveSyncSettingTab.okCorsOriginMatched": "\u2714 CORS \u6E90\u6B63\u5E38",
      "obsidianLiveSyncSettingTab.okCorsOrigins": "\u2714 cors.origins \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okEnableCors": "\u2714 httpd.enable_cors \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okMaxDocumentSize": "\u2714 couchdb.max_document_size \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okMaxRequestSize": "\u2714 chttpd.max_http_request_size \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okRequireValidUser": "\u2714 chttpd.require_valid_user \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okRequireValidUserAuth": "\u2714 chttpd_auth.require_valid_user \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.okWwwAuth": "\u2714 httpd.WWW-Authenticate \u8BBE\u7F6E\u6B63\u786E\u3002",
      "obsidianLiveSyncSettingTab.optionApply": "\u5E94\u7528",
      "obsidianLiveSyncSettingTab.optionCancel": "\u53D6\u6D88",
      "obsidianLiveSyncSettingTab.optionCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.optionDisableAllAutomatic": "\u7981\u7528\u6240\u6709\u81EA\u52A8\u540C\u6B65",
      "obsidianLiveSyncSettingTab.optionFetchFromRemote": "\u4ECE\u8FDC\u7A0B\u83B7\u53D6",
      "obsidianLiveSyncSettingTab.optionHere": "\u8FD9\u91CC",
      "obsidianLiveSyncSettingTab.optionLiveSync": "LiveSync",
      "obsidianLiveSyncSettingTab.optionMinioS3R2": "Minio, S3, R2",
      "obsidianLiveSyncSettingTab.optionOkReadEverything": "\u597D\u7684\uFF0C\u6211\u5DF2\u7ECF\u9605\u8BFB\u4E86\u6240\u6709\u5185\u5BB9\u3002",
      "obsidianLiveSyncSettingTab.optionOnEvents": "\u57FA\u4E8E\u4E8B\u4EF6",
      "obsidianLiveSyncSettingTab.optionPeriodicAndEvents": "\u5B9A\u671F\u548C\u57FA\u4E8E\u4E8B\u4EF6",
      "obsidianLiveSyncSettingTab.optionPeriodicWithBatch": "\u5B9A\u671F\u4E0E\u6279\u91CF",
      "obsidianLiveSyncSettingTab.optionRebuildBoth": "\u4ECE\u6B64\u8BBE\u5907\u91CD\u5EFA\u4E24\u8005",
      "obsidianLiveSyncSettingTab.optionSaveOnlySettings": "\uFF08\u5371\u9669\uFF09\u4EC5\u4FDD\u5B58\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.panelChangeLog": "\u66F4\u65B0\u65E5\u5FD7",
      "obsidianLiveSyncSettingTab.panelGeneralSettings": "\u5E38\u89C4\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.panelPrivacyEncryption": "\u9690\u79C1\u4E0E\u52A0\u5BC6",
      "obsidianLiveSyncSettingTab.panelRemoteConfiguration": "\u8FDC\u7A0B\u914D\u7F6E",
      "obsidianLiveSyncSettingTab.panelSetup": "\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.titleAppearance": "\u5916\u89C2",
      "obsidianLiveSyncSettingTab.titleConflictResolution": "\u51B2\u7A81\u89E3\u51B3",
      "obsidianLiveSyncSettingTab.titleCongratulations": "\u606D\u559C\uFF01",
      "obsidianLiveSyncSettingTab.titleCouchDB": "CouchDB",
      "obsidianLiveSyncSettingTab.titleDeletionPropagation": "\u5220\u9664\u4F20\u64AD",
      "obsidianLiveSyncSettingTab.titleEncryptionNotEnabled": "\u672A\u542F\u7528\u52A0\u5BC6",
      "obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid": "\u52A0\u5BC6\u5BC6\u7801\u65E0\u6548",
      "obsidianLiveSyncSettingTab.titleExtraFeatures": "\u542F\u7528\u989D\u5916\u548C\u9AD8\u7EA7\u529F\u80FD",
      "obsidianLiveSyncSettingTab.titleFetchConfig": "\u83B7\u53D6\u914D\u7F6E",
      "obsidianLiveSyncSettingTab.titleFetchConfigFromRemote": "\u4ECE\u8FDC\u7A0B\u670D\u52A1\u5668\u83B7\u53D6\u914D\u7F6E",
      "obsidianLiveSyncSettingTab.titleFetchSettings": "\u83B7\u53D6\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.titleHiddenFiles": "\u9690\u85CF\u6587\u4EF6",
      "obsidianLiveSyncSettingTab.titleLogging": "\u65E5\u5FD7\u8BB0\u5F55",
      "obsidianLiveSyncSettingTab.titleMinioS3R2": "Minio, S3, R2",
      "obsidianLiveSyncSettingTab.titleNotification": "\u901A\u77E5",
      "obsidianLiveSyncSettingTab.titleOnlineTips": "\u5728\u7EBF\u63D0\u793A",
      "obsidianLiveSyncSettingTab.titleQuickSetup": "\u5FEB\u901F\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.titleRebuildRequired": "\u9700\u8981\u91CD\u5EFA",
      "obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed": "\u8FDC\u7A0B\u914D\u7F6E\u68C0\u67E5\u5931\u8D25",
      "obsidianLiveSyncSettingTab.titleRemoteServer": "\u8FDC\u7A0B\u670D\u52A1\u5668",
      "obsidianLiveSyncSettingTab.titleReset": "\u91CD\u7F6E",
      "obsidianLiveSyncSettingTab.titleSetupOtherDevices": "\u8BBE\u7F6E\u5176\u4ED6\u8BBE\u5907",
      "obsidianLiveSyncSettingTab.titleSynchronizationMethod": "\u540C\u6B65\u65B9\u6CD5",
      "obsidianLiveSyncSettingTab.titleSynchronizationPreset": "\u540C\u6B65\u9884\u8BBE",
      "obsidianLiveSyncSettingTab.titleSyncSettings": "\u540C\u6B65\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown": "\u901A\u8FC7 Markdown \u540C\u6B65\u8BBE\u7F6E",
      "obsidianLiveSyncSettingTab.titleUpdateThinning": "\u66F4\u65B0\u9891\u7387\u9650\u5236",
      "obsidianLiveSyncSettingTab.warnCorsOriginUnmatched": "\u26A0 CORS \u6E90\u4E0D\u5339\u914D {from}->{to}",
      "obsidianLiveSyncSettingTab.warnNoAdmin": "\u26A0 \u60A8\u6CA1\u6709\u7BA1\u7406\u5458\u6743\u9650\u3002",
      Passphrase: "\u5BC6\u7801",
      "Passphrase of sensitive configuration items": "\u654F\u611F\u914D\u7F6E\u9879\u7684\u5BC6\u7801",
      password: "\u5BC6\u7801",
      Password: "\u5BC6\u7801",
      "Path Obfuscation": "\u8DEF\u5F84\u6DF7\u6DC6",
      "Per-file-saved customization sync": "\u6309\u6587\u4EF6\u4FDD\u5B58\u7684\u81EA\u5B9A\u4E49\u540C\u6B65",
      "Periodic Sync interval": "\u5B9A\u671F\u540C\u6B65\u95F4\u9694",
      Presets: "\u9884\u8BBE",
      "Process small files in the foreground": "\u5728\u524D\u53F0\u5904\u7406\u5C0F\u6587\u4EF6",
      "Reducing the frequency with which on-disk changes are reflected into the DB": "\u964D\u4F4E\u5C06\u78C1\u76D8\u4E0A\u7684\u66F4\u6539\u53CD\u6620\u5230\u6570\u636E\u5E93\u4E2D\u7684\u9891\u7387",
      Region: "Region",
      "Remote server type": "\u8FDC\u7A0B\u670D\u52A1\u5668\u7C7B\u578B",
      "Remote Type": "\u8FDC\u7A0B\u7C7B\u578B",
      "Requires restart of Obsidian": "\u9700\u8981\u91CD\u542F Obsidian",
      "Requires restart of Obsidian.": "\u9700\u8981\u91CD\u542F Obsidian\u3002",
      "Save settings to a markdown file. You will be notified when new settings arrive. You can set different files by the platform.": "\u5C06\u8BBE\u7F6E\u4FDD\u5B58\u5230\u4E00\u4E2A Markdown \u6587\u4EF6\u4E2D\u3002\u5F53\u65B0\u8BBE\u7F6E\u5230\u8FBE\u65F6\uFF0C\u60A8\u5C06\u6536\u5230\u901A\u77E5\u3002\u60A8\u53EF\u4EE5\u6839\u636E\u5E73\u53F0\u8BBE\u7F6E\u4E0D\u540C\u7684\u6587\u4EF6\u3002",
      "Saving will be performed forcefully after this number of seconds.": "\u5728\u6B64\u79D2\u6570\u540E\u5C06\u5F3A\u5236\u6267\u884C\u4FDD\u5B58\u3002",
      "Scan changes on customization sync": "\u5728\u81EA\u5B9A\u4E49\u540C\u6B65\u65F6\u626B\u63CF\u66F4\u6539",
      "Scan customization automatically": "\u81EA\u52A8\u626B\u63CF\u81EA\u5B9A\u4E49\u8BBE\u7F6E",
      "Scan customization before replicating.": "\u5728\u590D\u5236\u524D\u626B\u63CF\u81EA\u5B9A\u4E49\u8BBE\u7F6E\u3002",
      "Scan customization every 1 minute.": "\u6BCF1\u5206\u949F\u626B\u63CF\u81EA\u5B9A\u4E49\u8BBE\u7F6E\u3002",
      "Scan customization periodically": "\u5B9A\u671F\u626B\u63CF\u81EA\u5B9A\u4E49\u8BBE\u7F6E",
      "Scan for hidden files before replication": "\u590D\u5236\u524D\u626B\u63CF\u9690\u85CF\u6587\u4EF6",
      "Scan hidden files periodically": "\u5B9A\u671F\u626B\u63CF\u9690\u85CF\u6587\u4EF6",
      "Seconds, 0 to disable": "\u79D2\uFF0C0\u4E3A\u7981\u7528",
      "Seconds. Saving to the local database will be delayed until this value after we stop typing or saving.": "\u79D2\u3002\u5728\u6211\u4EEC\u505C\u6B62\u8F93\u5165\u6216\u4FDD\u5B58\u540E\uFF0C\u4FDD\u5B58\u5230\u672C\u5730\u6570\u636E\u5E93\u5C06\u5EF6\u8FDF\u6B64\u503C\u3002",
      "Secret Key": "Secret Key",
      "Server URI": "\u670D\u52A1\u5668 URI",
      "Should we keep folders that don't have any files inside?": "\u6211\u4EEC\u662F\u5426\u5E94\u8BE5\u4FDD\u7559\u5185\u90E8\u6CA1\u6709\u4EFB\u4F55\u6587\u4EF6\u7684\u6587\u4EF6\u5939\uFF1F",
      "Should we only check for conflicts when a file is opened?": "\u6211\u4EEC\u662F\u5426\u5E94\u8BE5\u4EC5\u5728\u6587\u4EF6\u6253\u5F00\u65F6\u68C0\u67E5\u51B2\u7A81\uFF1F",
      "Should we prompt you about conflicting files when a file is opened?": "\u5F53\u6587\u4EF6\u6253\u5F00\u65F6\uFF0C\u662F\u5426\u63D0\u793A\u51B2\u7A81\u6587\u4EF6\uFF1F",
      "Should we prompt you for every single merge, even if we can safely merge automatcially?": "\u5373\u4F7F\u6211\u4EEC\u53EF\u4EE5\u5B89\u5168\u5730\u81EA\u52A8\u5408\u5E76\uFF0C\u662F\u5426\u4E5F\u5E94\u8BE5\u4E3A\u6BCF\u4E00\u6B21\u5408\u5E76\u63D0\u793A\u60A8\uFF1F",
      "Show only notifications": "\u4EC5\u663E\u793A\u901A\u77E5",
      "Show status as icons only": "\u4EC5\u4EE5\u56FE\u6807\u663E\u793A\u72B6\u6001",
      "Show status inside the editor": "\u5728\u7F16\u8F91\u5668\u5185\u663E\u793A\u72B6\u6001",
      "Show status on the status bar": "\u5728\u72B6\u6001\u680F\u4E0A\u663E\u793A\u72B6\u6001",
      "Show verbose log. Please enable if you report an issue.": "\u663E\u793A\u8BE6\u7EC6\u65E5\u5FD7\u3002\u5982\u679C\u60A8\u62A5\u544A\u95EE\u9898\uFF0C\u8BF7\u542F\u7528\u6B64\u9009\u9879\u3002",
      "Starts synchronisation when a file is saved.": "\u5F53\u6587\u4EF6\u4FDD\u5B58\u65F6\u542F\u52A8\u540C\u6B65\u3002",
      "Stop reflecting database changes to storage files.": "\u505C\u6B62\u5C06\u6570\u636E\u5E93\u66F4\u6539\u53CD\u6620\u5230\u5B58\u50A8\u6587\u4EF6\u3002",
      "Stop watching for file changes.": "\u505C\u6B62\u76D1\u89C6\u6587\u4EF6\u66F4\u6539\u3002",
      "Suppress notification of hidden files change": "\u6291\u5236\u9690\u85CF\u6587\u4EF6\u66F4\u6539\u7684\u901A\u77E5",
      "Suspend database reflecting": "\u6682\u505C\u6570\u636E\u5E93\u53CD\u6620",
      "Suspend file watching": "\u6682\u505C\u6587\u4EF6\u76D1\u89C6",
      "Sync after merging file": "\u5408\u5E76\u6587\u4EF6\u540E\u540C\u6B65",
      "Sync automatically after merging files": "\u5408\u5E76\u6587\u4EF6\u540E\u81EA\u52A8\u540C\u6B65",
      "Sync Mode": "\u540C\u6B65\u6A21\u5F0F",
      "Sync on Editor Save": "\u7F16\u8F91\u5668\u4FDD\u5B58\u65F6\u540C\u6B65",
      "Sync on File Open": "\u6253\u5F00\u6587\u4EF6\u65F6\u540C\u6B65",
      "Sync on Save": "\u4FDD\u5B58\u65F6\u540C\u6B65",
      "Sync on Startup": "\u542F\u52A8\u65F6\u540C\u6B65",
      "Testing only - Resolve file conflicts by syncing newer copies of the file, this can overwrite modified files. Be Warned.": "\u4EC5\u4F9B\u6D4B\u8BD5 - \u901A\u8FC7\u540C\u6B65\u6587\u4EF6\u7684\u8F83\u65B0\u526F\u672C\u6765\u89E3\u51B3\u6587\u4EF6\u51B2\u7A81\uFF0C\u8FD9\u53EF\u80FD\u4F1A\u8986\u76D6\u4FEE\u6539\u8FC7\u7684\u6587\u4EF6\u3002\u8BF7\u6CE8\u610F\u3002",
      "The delay for consecutive on-demand fetches": "\u8FDE\u7EED\u6309\u9700\u83B7\u53D6\u7684\u5EF6\u8FDF",
      "The Hash algorithm for chunk IDs": "\u5757 ID \u7684\u54C8\u5E0C\u7B97\u6CD5\uFF08\u5B9E\u9A8C\u6027\uFF09",
      "The maximum duration for which chunks can be incubated within the document. Chunks exceeding this period will graduate to independent chunks.": "\u6587\u6863\u4E2D\u53EF\u4EE5\u5B75\u5316\u7684\u6570\u636E\u5757\u7684\u6700\u5927\u6301\u7EED\u65F6\u95F4\u3002\u8D85\u8FC7\u6B64\u65F6\u95F4\u7684\u6570\u636E\u5757\u5C06\u6210\u4E3A\u72EC\u7ACB\u6570\u636E\u5757\u3002",
      "The maximum number of chunks that can be incubated within the document. Chunks exceeding this number will immediately graduate to independent chunks.": "\u6587\u6863\u4E2D\u53EF\u4EE5\u5B75\u5316\u7684\u6570\u636E\u5757\u7684\u6700\u5927\u6570\u91CF\u3002\u8D85\u8FC7\u6B64\u6570\u91CF\u7684\u6570\u636E\u5757\u5C06\u7ACB\u5373\u6210\u4E3A\u72EC\u7ACB\u6570\u636E\u5757\u3002",
      "The maximum total size of chunks that can be incubated within the document. Chunks exceeding this size will immediately graduate to independent chunks.": "\u6587\u6863\u4E2D\u53EF\u4EE5\u5B75\u5316\u7684\u6570\u636E\u5757\u7684\u6700\u5927\u603B\u5927\u5C0F\u3002\u8D85\u8FC7\u6B64\u5927\u5C0F\u7684\u6570\u636E\u5757\u5C06\u7ACB\u5373\u6210\u4E3A\u72EC\u7ACB\u6570\u636E\u5757\u3002",
      "This passphrase will not be copied to another device. It will be set to `Default` until you configure it again.": "\u6B64\u5BC6\u7801\u4E0D\u4F1A\u590D\u5236\u5230\u53E6\u4E00\u53F0\u8BBE\u5907\u3002\u5728\u60A8\u518D\u6B21\u914D\u7F6E\u4E4B\u524D\uFF0C\u5B83\u5C06\u8BBE\u7F6E\u4E3A `Default`\u3002",
      "Unique name between all synchronized devices. To edit this setting, please disable customization sync once.": "\u6240\u6709\u540C\u6B65\u8BBE\u5907\u4E4B\u95F4\u7684\u552F\u4E00\u540D\u79F0\u3002\u8981\u7F16\u8F91\u6B64\u8BBE\u7F6E\uFF0C\u8BF7\u9996\u5148\u7981\u7528\u81EA\u5B9A\u4E49\u540C\u6B65",
      "Use Custom HTTP Handler": "\u4F7F\u7528\u81EA\u5B9A\u4E49 HTTP \u5904\u7406\u7A0B\u5E8F",
      "Use dynamic iteration count": "\u4F7F\u7528\u52A8\u6001\u8FED\u4EE3\u6B21\u6570",
      "Use Segmented-splitter": "\u4F7F\u7528\u5206\u6BB5\u5206\u5272\u5668",
      "Use splitting-limit-capped chunk splitter": "\u4F7F\u7528\u5206\u5272\u9650\u5236\u4E0A\u9650\u7684\u5757\u5206\u5272\u5668",
      "Use the trash bin": "\u4F7F\u7528\u56DE\u6536\u7AD9",
      "Use timeouts instead of heartbeats": "\u4F7F\u7528\u8D85\u65F6\u800C\u4E0D\u662F\u5FC3\u8DF3",
      username: "\u7528\u6237\u540D",
      Username: "\u7528\u6237\u540D",
      "Verbose Log": "\u8BE6\u7EC6\u65E5\u5FD7",
      "Warning! This will have a serious impact on performance. And the logs will not be synchronised under the default name. Please be careful with logs; they often contain your confidential information.": "\u8B66\u544A\uFF01\u8FD9\u5C06\u4E25\u91CD\u5F71\u54CD\u6027\u80FD\u3002\u5E76\u4E14\u65E5\u5FD7\u4E0D\u4F1A\u4EE5\u9ED8\u8BA4\u540D\u79F0\u540C\u6B65\u3002\u8BF7\u5C0F\u5FC3\u5904\u7406\u65E5\u5FD7\uFF1B\u5B83\u4EEC\u901A\u5E38\u5305\u542B\u60A8\u7684\u654F\u611F\u4FE1\u606F\u3002",
      "When you save a file in the editor, start a sync automatically": "\u5F53\u60A8\u5728\u7F16\u8F91\u5668\u4E2D\u4FDD\u5B58\u6587\u4EF6\u65F6\uFF0C\u81EA\u52A8\u5F00\u59CB\u540C\u6B65",
      "Write credentials in the file": "\u5C06\u51ED\u636E\u5199\u5165\u6587\u4EF6",
      "Write logs into the file": "\u5C06\u65E5\u5FD7\u5199\u5165\u6587\u4EF6",
      "fridaySync.saltChanged.title": "\u68C0\u6D4B\u5230\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u91CD\u7F6E",
      "fridaySync.saltChanged.message": "\u8FDC\u7A0B\u6570\u636E\u5E93\u7684\u52A0\u5BC6\u5BC6\u94A5\u5DF2\u66F4\u6539\u3002\u8FD9\u901A\u5E38\u610F\u5473\u7740\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u88AB\u91CD\u7F6E\u6216\u91CD\u5EFA\u3002\u672C\u5730\u6570\u636E\u65E0\u6CD5\u4E0E\u65B0\u6570\u636E\u5E93\u540C\u6B65\u3002\u8BF7\u4F7F\u7528\u300C\u4ECE\u670D\u52A1\u5668\u83B7\u53D6\u300D\u529F\u80FD\u91CD\u65B0\u540C\u6B65\u6570\u636E\uFF0C\u6216\u6E05\u7A7A\u672C\u5730\u6570\u636E\u5E93\u540E\u91CD\u65B0\u540C\u6B65\u3002",
      "fridaySync.decryptionErrors.aggregated": "\u68C0\u6D4B\u5230 ${count} \u4E2A\u89E3\u5BC6\u9519\u8BEF\u3002\u8FDC\u7A0B\u6570\u636E\u5E93\u53EF\u80FD\u5DF2\u88AB\u91CD\u7F6E\u3002\u8BF7\u4F7F\u7528\u300C\u4ECE\u670D\u52A1\u5668\u83B7\u53D6\u300D\u529F\u80FD\u91CD\u65B0\u540C\u6B65\u6570\u636E\u3002",
      "fridaySync.saltCheck.failed": "\u9A8C\u8BC1\u8FDC\u7A0B\u6570\u636E\u5E93\u72B6\u6001\u5931\u8D25",
      "fridaySync.rebuildRemote.rebuilding": "\u6B63\u5728\u4E0A\u4F20\u60A8\u7684\u6587\u4EF6\u5230\u670D\u52A1\u5668...",
      "fridaySync.rebuildRemote.scanFailed": "\u51C6\u5907\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25",
      "fridaySync.rebuildRemote.resettingRemote": "\u6B63\u5728\u51C6\u5907\u670D\u52A1\u5668...",
      "fridaySync.rebuildRemote.pushingData": "\u6B63\u5728\u4E0A\u4F20\u6587\u4EF6\uFF08\u53EF\u80FD\u9700\u8981\u51E0\u5206\u949F\uFF09...",
      "fridaySync.rebuildRemote.filesPrepared": "\u5DF2\u51C6\u5907 ${count} \u4E2A\u6587\u4EF6\u7528\u4E8E\u4E0A\u4F20",
      "fridaySync.rebuildRemote.uploadingProgress": "\u2191 \u6B63\u5728\u4E0A\u4F20\u6587\u4EF6\uFF1A${sending} \u4E2A\uFF08\u5DF2\u5B8C\u6210 ${done} \u4E2A\uFF09",
      "fridaySync.rebuildRemote.uploadFailed": "\u4E0A\u4F20\u5931\u8D25",
      "fridaySync.rebuildRemote.success": "\u4E0A\u4F20\u5B8C\u6210\uFF01",
      "fridaySync.rebuildRemote.failed": "\u4E0A\u4F20\u5931\u8D25",
      "fridaySync.rebuildRemote.failedConnection": "\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u3002",
      "fridaySync.sync.failed": "\u540C\u6B65\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u3002",
      "fridaySync.pull.pulling": "\u6B63\u5728\u4ECE\u670D\u52A1\u5668\u62C9\u53D6...",
      "fridaySync.pull.completed": "\u62C9\u53D6\u5B8C\u6210",
      "fridaySync.pull.failed": "\u62C9\u53D6\u5931\u8D25",
      "fridaySync.pull.failedConnection": "\u62C9\u53D6\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u3002",
      "fridaySync.push.pushing": "\u6B63\u5728\u63A8\u9001\u5230\u670D\u52A1\u5668...",
      "fridaySync.push.completed": "\u63A8\u9001\u5B8C\u6210",
      "fridaySync.push.failed": "\u63A8\u9001\u5931\u8D25",
      "fridaySync.push.failedConnection": "\u63A8\u9001\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u3002",
      "fridaySync.fetch.fetching": "\u6B63\u5728\u4ECE\u670D\u52A1\u5668\u4E0B\u8F7D\uFF08\u53EF\u80FD\u9700\u8981\u4E00\u4E9B\u65F6\u95F4\uFF09...",
      "fridaySync.fetch.starting": "\u5F00\u59CB\u4ECE\u670D\u52A1\u5668\u4E0B\u8F7D...",
      "fridaySync.fetch.downloading": "\u6B63\u5728\u4ECE\u670D\u52A1\u5668\u4E0B\u8F7D\u6587\u4EF6\uFF08\u53EF\u80FD\u9700\u8981\u4E00\u4E9B\u65F6\u95F4\uFF09...",
      "fridaySync.fetch.writingFiles": "\u6B63\u5728\u5199\u5165\u6587\u4EF6\u5230 Vault...",
      "fridaySync.fetch.downloadComplete": "\u4E0B\u8F7D\u5B8C\u6210\uFF01",
      "fridaySync.fetch.downloadFailed": "\u4ECE\u670D\u52A1\u5668\u4E0B\u8F7D\u5931\u8D25",
      "fridaySync.fetch.fetchingMissingChunks": "\u53D1\u73B0 ${count} \u4E2A\u7F3A\u5931\u6570\u636E\u5757\uFF0C\u6B63\u5728\u4ECE\u8FDC\u7A0B\u83B7\u53D6...",
      "fridaySync.fetch.chunkFetchComplete": "\u6570\u636E\u5757\u83B7\u53D6\u5B8C\u6210\uFF1A\u5DF2\u83B7\u53D6 ${count} \u4E2A\u6570\u636E\u5757",
      "fridaySync.fetch.completed": "\u4E0B\u8F7D\u5B8C\u6210\uFF01",
      "fridaySync.fetch.failed": "\u4E0B\u8F7D\u5931\u8D25",
      "fridaySync.fetch.failedConnection": "\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u3002",
      "fridaySync.fetch.fetchingChunks": "\u6B63\u5728\u4ECE\u8FDC\u7A0B\u83B7\u53D6\u7F3A\u5931\u7684\u6570\u636E\u5757...",
      "fridaySync.fetch.scanningChunks": "\u6B63\u5728\u626B\u63CF\u6570\u636E\u5E93\u4E2D\u5F15\u7528\u7684\u6570\u636E\u5757...",
      "fridaySync.fetch.chunksFetched": "\u5DF2\u83B7\u53D6\u6570\u636E\u5757\uFF1A${fetched} / ${total}",
      "fridaySync.rebuild.localDbNotInitialized": "\u672C\u5730\u6570\u636E\u5E93\u672A\u521D\u59CB\u5316",
      "fridaySync.rebuild.missingChunks": "${count} \u4E2A\u6587\u4EF6\u65E0\u6CD5\u8BFB\u53D6\uFF08\u7F3A\u5931\u6570\u636E\uFF09\u3002\u793A\u4F8B: ${examples}${more}",
      "fridaySync.rebuild.complete": "\u91CD\u5EFA\u5B8C\u6210\uFF1A\u5DF2\u5199\u5165 ${count} \u4E2A\u6587\u4EF6\uFF08${created} \u4E2A\u65B0\u6587\u4EF6\uFF0C${updated} \u4E2A\u66F4\u65B0\uFF09",
      "fridaySync.rebuild.failed": "\u91CD\u5EFA\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
      "fridaySync.hiddenFileSync.scanningStorage": "[\u9690\u85CF\u6587\u4EF6\u540C\u6B65] \u6B63\u5728\u626B\u63CF\u5B58\u50A8\u53D8\u66F4...",
      "fridaySync.hiddenFileSync.storageScanComplete": "[\u9690\u85CF\u6587\u4EF6\u540C\u6B65] \u5B58\u50A8\u626B\u63CF\u5B8C\u6210",
      "fridaySync.hiddenFileSync.scanningDatabase": "[\u9690\u85CF\u6587\u4EF6\u540C\u6B65] \u6B63\u5728\u626B\u63CF\u6570\u636E\u5E93\u53D8\u66F4...",
      "fridaySync.hiddenFileSync.databaseScanComplete": "[\u9690\u85CF\u6587\u4EF6\u540C\u6B65] \u6570\u636E\u5E93\u626B\u63CF\u5B8C\u6210",
      "fridaySync.hiddenFileSync.initComplete": "[\u9690\u85CF\u6587\u4EF6\u540C\u6B65] \u521D\u59CB\u5316\u5B8C\u6210",
      "fridaySync.error.networkUnavailable": "\u65E0\u6CD5\u8FDE\u63A5\u5230\u540C\u6B65\u670D\u52A1\u5668\u3002\u7F51\u7EDC\u6062\u590D\u540E\u5C06\u81EA\u52A8\u91CD\u8BD5\u3002",
      "fridaySync.error.authFailed": "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\u3002\u8BF7\u5728\u8BBE\u7F6E\u4E2D\u68C0\u67E5\u60A8\u7684\u51ED\u636E\u3002",
      "fridaySync.error.timeout": "\u8FDE\u63A5\u8D85\u65F6\u3002\u5C06\u81EA\u52A8\u91CD\u8BD5...",
      "fridaySync.network.offline": "\u7F51\u7EDC\u79BB\u7EBF - \u8FDE\u63A5\u6062\u590D\u540E\u5C06\u540C\u6B65\u66F4\u6539",
      "fridaySync.network.reconnecting": "\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u540C\u6B65\u670D\u52A1\u5668...",
      "fridaySync.network.reconnected": "\u5DF2\u91CD\u65B0\u8FDE\u63A5\u5E76\u91CD\u542F\u540C\u6B65",
      "fridaySync.offline.changesTracked": "\u79BB\u7EBF\u671F\u95F4\u5DF2\u8DDF\u8E2A ${count} \u4E2A\u66F4\u6539",
      "fridaySync.offline.applyingChanges": "\u6B63\u5728\u5E94\u7528 ${count} \u4E2A\u79BB\u7EBF\u66F4\u6539...",
      "fridaySync.error.cannotConnectServer": "\u65E0\u6CD5\u8FDE\u63A5\u540C\u6B65\u670D\u52A1\u5668\u3002\u60A8\u7684\u4FEE\u6539\u5C06\u4FDD\u5B58\u5728\u672C\u5730\uFF0C\u6062\u590D\u8FDE\u63A5\u540E\u4F1A\u81EA\u52A8\u540C\u6B65\u3002",
      "fridaySync.error.serverTimeout": "\u8FDE\u63A5\u540C\u6B65\u670D\u52A1\u5668\u8D85\u65F6\u3002\u5C06\u81EA\u52A8\u91CD\u8BD5\u3002",
      "fridaySync.status.offlineMode": "\u79BB\u7EBF\u6A21\u5F0F - \u4FEE\u6539\u5DF2\u4FDD\u5B58\u5230\u672C\u5730",
      "fridaySync.status.reconnecting": "\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u540C\u6B65\u670D\u52A1\u5668...",
      "fridaySync.error.noCacheOffline": "\u9996\u6B21\u4F7F\u7528\u9700\u8981\u8FDE\u63A5\u670D\u52A1\u5668",
      "fridaySync.error.firstTimeNeedsConnection": "\u9996\u6B21\u4F7F\u7528\u9700\u8981\u8FDE\u63A5\u670D\u52A1\u5668\u3002\u8BF7\u8FDE\u63A5\u7F51\u7EDC\u540E\u91CD\u65B0\u542F\u52A8\u540C\u6B65\u3002",
      "fridaySync.offline.workingMode": "\u79BB\u7EBF\u5DE5\u4F5C\u4E2D - \u8FDE\u63A5\u540E\u81EA\u52A8\u540C\u6B65",
      "fridaySync.saltChanged.syncBlocked": "\u7531\u4E8E\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u88AB\u91CD\u7F6E\uFF0C\u540C\u6B65\u5DF2\u88AB\u963B\u6B62\u3002\u8BF7\u524D\u5F80\u8BBE\u7F6E\u2192'\u4ECE\u4E91\u7AEF\u4E0B\u8F7D'\u6765\u91CD\u65B0\u540C\u6B65\u3002",
      "fridaySync.saltChanged.actionRequired": "\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u88AB\u91CD\u7F6E\u3002\u8BF7\u524D\u5F80\u8BBE\u7F6E\u2192'\u4ECE\u4E91\u7AEF\u4E0B\u8F7D'\u6765\u91CD\u65B0\u540C\u6B65\u60A8\u7684\u5E93\u3002",
      "fridaySync.saltChanged.deviceAccepted": "\u8BBE\u5907\u5DF2\u88AB\u8FDC\u7A0B\u6570\u636E\u5E93\u63A5\u53D7\u3002\u53EF\u4EE5\u7EE7\u7EED\u540C\u6B65\u3002",
      "fridaySync.saltChanged.suspendingReflection": "\u6B63\u5728\u51C6\u5907\u4E0B\u8F7D\u6587\u4EF6...",
      "fridaySync.saltChanged.resumingReflection": "\u4E0B\u8F7D\u5B8C\u6210\uFF0C\u6B63\u5728\u5199\u5165\u6587\u4EF6\u5230 Vault...",
      "liveSyncReplicator.beforeLiveSync": "\u5728 LiveSync \u4E4B\u524D\uFF0C\u5148\u542F\u52A8\u4E00\u6B21 OneShot...",
      "liveSyncReplicator.cantReplicateLowerValue": "\u65E0\u6CD5\u4F7F\u7528\u66F4\u4F4E\u7684\u503C\u8FDB\u884C\u540C\u6B65\u3002",
      "liveSyncReplicator.checkingLastSyncPoint": "\u6B63\u5728\u67E5\u627E\u4E0A\u6B21\u540C\u6B65\u70B9\u3002",
      "liveSyncReplicator.couldNotConnectTo": "\u65E0\u6CD5\u8FDE\u63A5\u5230 ${uri} : ${name}\n(${db})",
      "liveSyncReplicator.couldNotConnectToRemoteDb": "\u65E0\u6CD5\u8FDE\u63A5\u5230\u8FDC\u7A0B\u6570\u636E\u5E93\uFF1A${d}",
      "liveSyncReplicator.couldNotConnectToServer": "\u65E0\u6CD5\u8FDE\u63A5\u5230\u670D\u52A1\u5668\u3002",
      "liveSyncReplicator.couldNotConnectToURI": "\u65E0\u6CD5\u8FDE\u63A5\u5230 ${uri}:${dbRet}",
      "liveSyncReplicator.couldNotMarkResolveRemoteDb": "\u65E0\u6CD5\u6807\u8BB0\u8FDC\u7A0B\u6570\u636E\u5E93\u4E3A\u5DF2\u89E3\u51B3\u3002",
      "liveSyncReplicator.liveSyncBegin": "LiveSync \u5F00\u59CB...",
      "liveSyncReplicator.lockRemoteDb": "\u9501\u5B9A\u8FDC\u7A0B\u6570\u636E\u5E93\u4EE5\u9632\u6B62\u6570\u636E\u635F\u574F",
      "liveSyncReplicator.markDeviceResolved": "\u5C06\u6B64\u8BBE\u5907\u6807\u8BB0\u4E3A\u300C\u5DF2\u89E3\u51B3\u300D\u3002",
      "liveSyncReplicator.oneShotSyncBegin": "OneShot \u540C\u6B65\u5F00\u59CB... (${syncMode})",
      "liveSyncReplicator.remoteDbCorrupted": "\u8FDC\u7A0B\u6570\u636E\u5E93\u8F83\u65B0\u6216\u5DF2\u635F\u574F\uFF0C\u8BF7\u786E\u4FDD\u5DF2\u5B89\u88C5\u6700\u65B0\u7248\u672C\u7684 self-hosted-livesync",
      "liveSyncReplicator.remoteDbCreatedOrConnected": "\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u521B\u5EFA\u6216\u5DF2\u8FDE\u63A5",
      "liveSyncReplicator.remoteDbDestroyed": "\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u9500\u6BC1",
      "liveSyncReplicator.remoteDbDestroyError": "\u9500\u6BC1\u8FDC\u7A0B\u6570\u636E\u5E93\u65F6\u53D1\u751F\u9519\u8BEF\uFF1A",
      "liveSyncReplicator.remoteDbMarkedResolved": "\u8FDC\u7A0B\u6570\u636E\u5E93\u5DF2\u6807\u8BB0\u4E3A\u5DF2\u89E3\u51B3\u3002",
      "liveSyncReplicator.replicationClosed": "\u540C\u6B65\u5DF2\u5173\u95ED",
      "liveSyncReplicator.replicationInProgress": "\u540C\u6B65\u5DF2\u5728\u8FDB\u884C\u4E2D",
      "liveSyncReplicator.retryLowerBatchSize": "\u4F7F\u7528\u66F4\u5C0F\u7684\u6279\u6B21\u5927\u5C0F\u91CD\u8BD5\uFF1A${batch_size}/${batches_limit}",
      "liveSyncReplicator.unlockRemoteDb": "\u89E3\u9501\u8FDC\u7A0B\u6570\u636E\u5E93\u4EE5\u9632\u6B62\u6570\u636E\u635F\u574F",
      "liveSyncReplicator.replicationDenied": "\u540C\u6B65\u8BBF\u95EE\u88AB\u62D2\u7EDD\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u51ED\u636E\u3002",
      "liveSyncReplicator.replicationErrored": "\u540C\u6B65\u9519\u8BEF",
      "liveSyncReplicator.syncFileSizeError": "\u7531\u4E8E\u6587\u4EF6\u5927\u5C0F\u540C\u6B65\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u65E5\u5FD7\u4E86\u89E3\u8BE6\u60C5\u3002",
      "liveSyncReplicator.connectedSuccessfully": "\u6210\u529F\u8FDE\u63A5\u5230 ${dbName}",
      "liveSyncReplicator.couldNotRetrieveMilestone": "\u65E0\u6CD5\u68C0\u7D22\u8FDC\u7A0B\u91CC\u7A0B\u7891",
      "fridaySync.progress.uploadingFiles": "\u4E0A\u4F20\u6587\u4EF6 (${current}/${total})",
      "fridaySync.progress.downloadingFiles": "\u4E0B\u8F7D\u6587\u4EF6 (${current}/${total})",
      "fridaySync.progress.writingFiles": "\u5199\u5165\u6587\u4EF6 (${current}/${total})",
      "fridaySync.progress.syncing": "\u6B63\u5728\u540C\u6B65...",
      "fridaySync.progress.syncCompleted": "\u540C\u6B65\u5B8C\u6210 \u2713"
    };
  }
});

// src/sync/core/common/messages/zh.ts
var PartialMessages6;
var init_zh2 = __esm({
  "src/sync/core/common/messages/zh.ts"() {
    "use strict";
    init_zh();
    PartialMessages6 = {
      zh: zh_default
    };
  }
});

// src/sync/core/common/messagesJson/zh-tw.json
var zh_tw_default;
var init_zh_tw = __esm({
  "src/sync/core/common/messagesJson/zh-tw.json"() {
    zh_tw_default = {};
  }
});

// src/sync/core/common/messages/zh-tw.ts
var PartialMessages7;
var init_zh_tw2 = __esm({
  "src/sync/core/common/messages/zh-tw.ts"() {
    "use strict";
    init_zh_tw();
    PartialMessages7 = {
      "zw-th": zh_tw_default
    };
  }
});

// src/sync/core/common/messages/combinedMessages.dev.ts
var messages, w, _allMessages;
var init_combinedMessages_dev = __esm({
  "src/sync/core/common/messages/combinedMessages.dev.ts"() {
    "use strict";
    init_def();
    init_es2();
    init_ja2();
    init_ko2();
    init_ru2();
    init_zh2();
    init_zh_tw2();
    messages = {
      ...PartialMessages,
      ...PartialMessages2,
      ...PartialMessages3,
      ...PartialMessages4,
      ...PartialMessages5,
      ...PartialMessages6,
      ...PartialMessages7
    };
    w = Object.entries(messages).map(
      ([lang, messageDefs]) => Object.entries(messageDefs).map(([key4, value2]) => [key4, [lang, value2]])
    ).flat();
    _allMessages = w.reduce(
      (acc, [key4, value2]) => {
        if (!acc[key4]) acc[key4] = {};
        acc[key4][value2[0]] = value2[1];
        return acc;
      },
      {}
    );
  }
});

// src/sync/core/common/rosetta.ts
function expandKeywords(message, lang, recurseLimit = 10) {
  if (recurseLimit <= 0) {
    Logger(
      `ExpandKeywords hit the recursion limit, returning the current state. but this is not expected. May recursive referenced.`
    );
    return message;
  }
  const keywords = Object.entries(message).map(([key4, value2]) => [key4, value2[lang]]).map(([key4, value2]) => [`${key4.startsWith("K.") ? key4.substring("K.".length) : key4}`, value2]).map(
    ([key4, value2]) => [
      [`%{${key4}}`, value2]
      // [`%{${key}.upper}`, [value[0].toLocaleUpperCase(langCode) + value.substring(1)]],
      // [`%{${key}.lower}`, [value[0].toLocaleLowerCase(langCode) + value.substring(1)]],
    ]
  ).flat().sort((a, b) => {
    var _a6, _b4, _c2, _d;
    return ((_b4 = (_a6 = a[1]) == null ? void 0 : _a6.length) != null ? _b4 : 0) - ((_d = (_c2 = b[1]) == null ? void 0 : _c2.length) != null ? _d : 0);
  });
  const ret = {
    ...message
  };
  let isChanged = false;
  for (const key4 of Object.keys(message)) {
    if (!(lang in ret[key4])) continue;
    for (const [keyword, replacement] of keywords) {
      if (ret[key4][lang].includes(keyword)) {
        ret[key4][lang] = ret[key4][lang].split(keyword).join(replacement);
        isChanged = true;
      }
    }
  }
  if (isChanged) return expandKeywords(ret, lang, recurseLimit--);
  return ret;
}
var expandedMessage, allMessages;
var init_rosetta = __esm({
  "src/sync/core/common/rosetta.ts"() {
    "use strict";
    init_logger2();
    init_combinedMessages_dev();
    expandedMessage = {
      ...expandKeywords(_allMessages, "def"),
      ...expandKeywords(_allMessages, "es"),
      ...expandKeywords(_allMessages, "ja"),
      ...expandKeywords(_allMessages, "ko"),
      ...expandKeywords(_allMessages, "ru"),
      ...expandKeywords(_allMessages, "zh"),
      ...expandKeywords(_allMessages, "zh-tw")
    };
    allMessages = expandedMessage;
  }
});

// src/sync/core/common/i18n.ts
function setLang(lang) {
  if (lang === currentLang) return;
  currentLang = lang;
  msgCache.clear();
}
function _getMessage(key4, lang) {
  var _a6;
  if (key4.trim() == "") return key4;
  const msgs = (_a6 = allMessages[key4]) != null ? _a6 : void 0;
  if (lang == "") {
    lang = "def";
  }
  let msg = msgs == null ? void 0 : msgs[lang];
  if (!msg) {
    if (!missingTranslations.contains(key4)) {
      __onMissingTranslations(key4);
      missingTranslations.push(key4);
    }
    msg = msgs == null ? void 0 : msgs.def;
  }
  return msg != null ? msg : key4;
}
function getMessage(key4) {
  if (msgCache.has(key4)) return msgCache.get(key4);
  const msg = _getMessage(key4, currentLang);
  msgCache.set(key4, msg);
  return msg;
}
function $t(message, lang) {
  if (lang !== void 0) {
    return _getMessage(message, lang);
  }
  return getMessage(message);
}
function $msg(key4, params = {}, lang) {
  let msg = $t(key4, lang);
  for (const [placeholder, value2] of Object.entries(params)) {
    const regex2 = new RegExp(`\\\${${placeholder}}`, "g");
    msg = msg.replace(regex2, value2);
  }
  return msg;
}
var currentLang, missingTranslations, __onMissingTranslations, msgCache;
var init_i18n = __esm({
  "src/sync/core/common/i18n.ts"() {
    "use strict";
    init_rosetta();
    currentLang = "";
    missingTranslations = [];
    __onMissingTranslations = (key4) => console.warn(key4);
    msgCache = /* @__PURE__ */ new Map();
  }
});

// src/i18n/service.ts
function mapToSyncLang(lang) {
  const mapping = {
    "en": "def",
    "zh-cn": "zh",
    "es": "es",
    "de": "de",
    "ja": "ja",
    "ko": "ko",
    "fr": "def",
    // No French in sync module, fallback to default
    "pt": "def"
    // No Portuguese in sync module, fallback to default
  };
  return mapping[lang] || "def";
}
var I18nService;
var init_service = __esm({
  "src/i18n/service.ts"() {
    "use strict";
    init_utils();
    init_en();
    init_zh_cn();
    init_i18n();
    I18nService = class {
      constructor(plugin2) {
        this.currentLanguage = DEFAULT_LANGUAGE;
        this.translations = {
          "en": en,
          "zh-cn": zhCn,
          // For languages without translations, fallback to English
          "es": en,
          "fr": en,
          "de": en,
          "ja": en,
          "ko": en,
          "pt": en
        };
        this.ready = false;
        /**
         * Translation function with parameter interpolation support
         */
        this.t = (key4, params) => {
          if (!this.ready) {
            console.warn("I18n service not ready, returning key:", key4);
            return key4;
          }
          const currentTranslations = this.translations[this.currentLanguage];
          if (!currentTranslations) {
            console.warn(`No translations found for language '${this.currentLanguage}'`);
            return key4;
          }
          const translation = getNestedValue(currentTranslations, key4);
          if (translation === void 0) {
            if (this.currentLanguage !== "en") {
              const fallbackTranslation = getNestedValue(this.translations["en"], key4);
              if (fallbackTranslation !== void 0) {
                console.warn(`Missing translation for key '${key4}' in '${this.currentLanguage}', using English fallback`);
                return interpolateTemplate(fallbackTranslation, params);
              }
            }
            console.warn(`Missing translation for key '${key4}' in '${this.currentLanguage}'`);
            return key4;
          }
          if (typeof translation !== "string") {
            console.warn(`Translation for key '${key4}' is not a string:`, translation);
            return key4;
          }
          return interpolateTemplate(translation, params);
        };
        this.plugin = plugin2;
        this.app = plugin2.app;
      }
      /**
       * Initialize the i18n service
       */
      async init() {
        try {
          const detectedLanguage = detectLanguage(this.app);
          this.setLanguageInternal(detectedLanguage);
          this.ready = true;
        } catch (error2) {
          console.error("Failed to initialize i18n service:", error2);
          this.currentLanguage = DEFAULT_LANGUAGE;
          this.ready = true;
        }
      }
      /**
       * Get current language
       */
      getCurrentLanguage() {
        return this.currentLanguage;
      }
      /**
       * Set current language (internal method)
       */
      setLanguageInternal(language) {
        if (!this.translations[language]) {
          console.warn(`Language '${language}' not supported, falling back to '${DEFAULT_LANGUAGE}'`);
          language = DEFAULT_LANGUAGE;
        }
        this.currentLanguage = language;
        const syncLang = mapToSyncLang(language);
        setLang(syncLang);
        this.plugin.app.workspace.trigger("friday:language-changed", language);
      }
      /**
       * Set current language (for manual language switching, if needed in future)
       */
      async setLanguage(language) {
        this.setLanguageInternal(language);
      }
      /**
       * Get available languages
       */
      getAvailableLanguages() {
        return [...AVAILABLE_LANGUAGES];
      }
      /**
       * Check if service is ready
       */
      isReady() {
        return this.ready;
      }
      /**
       * Get translation for a specific language (useful for language switching preview)
       */
      getTranslationForLanguage(key4, language, params) {
        const translations = this.translations[language];
        if (!translations) {
          return key4;
        }
        const translation = getNestedValue(translations, key4);
        if (translation === void 0 || typeof translation !== "string") {
          return key4;
        }
        return interpolateTemplate(translation, params);
      }
      /**
       * Reload translations (useful for development)
       */
      async reload() {
        this.ready = false;
        await this.init();
      }
      /**
       * Get formatted language name for display
       */
      getLanguageDisplayName(code) {
        const targetCode = code || this.currentLanguage;
        const info3 = AVAILABLE_LANGUAGES.find((lang) => lang.code === targetCode);
        return info3 ? info3.nativeName === info3.name ? info3.name : `${info3.name} (${info3.nativeName})` : targetCode;
      }
      /**
       * Check if a translation key exists
       */
      hasTranslation(key4, language) {
        const targetLanguage = language || this.currentLanguage;
        const translations = this.translations[targetLanguage];
        if (!translations) return false;
        const translation = getNestedValue(translations, key4);
        return translation !== void 0 && typeof translation === "string";
      }
    };
  }
});

// src/i18n/index.ts
var init_i18n2 = __esm({
  "src/i18n/index.ts"() {
    "use strict";
    init_service();
    init_utils();
    init_en();
    init_zh_cn();
  }
});

// node_modules/octagonal-wheels/dist/common/polyfill.js
var _a, FallbackWeakRef, FallbackFinalizationRegistry;
var init_polyfill = __esm({
  "node_modules/octagonal-wheels/dist/common/polyfill.js"() {
    FallbackWeakRef = "WeakRef" in globalThis ? globalThis.WeakRef : (_a = class WeakRef {
      constructor(target) {
        Object.defineProperty(this, "__target", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.__target = target;
      }
      deref() {
        return this.__target;
      }
    }, // If WeakRef implementation has been missing, we will use a simple polyfill
    // This is for old iOS devices that do not support WeakRef (before Safari 14.5), and for Android devices that use old WebView engines.
    // I know that Obsidian now supports Safari 14.5 and above now, but I will keep this for compatibility with older versions.
    // Note: This is a `StrongRef`. It is not a `WeakRef` in the true sense. Just for compatibility.
    //@ts-ignore
    Object.defineProperty(_a, "__", {
      enumerable: true,
      configurable: true,
      writable: true,
      value: console.warn("WeakRef is not supported in this environment. Using a fallback implementation. This may cause memory leaks. Please consider upgrading your browser or Node.js version. If you are on Android, please consider changing your WebView engine to a newer version. It is on the Developer Settings.")
    }), _a);
    FallbackFinalizationRegistry = "FinalizationRegistry" in globalThis ? globalThis.FinalizationRegistry : class PolyfillFinalizationRegistry {
      constructor(callback) {
      }
      register(target, heldValue, unregisterToken) {
      }
      unregister(unregisterToken) {
        return true;
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/encoding/encodeobject.js
var prefixMapObject, decodePrefixMapObject, prefixMapNumber, decodePrefixMapNumber;
var init_encodeobject = __esm({
  "node_modules/octagonal-wheels/dist/encoding/encodeobject.js"() {
    prefixMapObject = {
      s: {
        1: "V",
        2: "W",
        3: "X",
        4: "Y",
        5: "Z"
      },
      o: {
        1: "v",
        2: "w",
        3: "x",
        4: "y",
        5: "z"
      }
    };
    decodePrefixMapObject = Object.fromEntries(Object.entries(prefixMapObject).flatMap(([prefix, map2]) => Object.entries(map2).map(([len, char2]) => [char2, { prefix, len: parseInt(len) }])));
    prefixMapNumber = {
      n: {
        1: "a",
        2: "b",
        3: "c",
        4: "d",
        5: "e"
      },
      N: {
        1: "A",
        2: "B",
        3: "C",
        4: "D",
        5: "E"
      }
    };
    decodePrefixMapNumber = Object.fromEntries(Object.entries(prefixMapNumber).flatMap(([prefix, map2]) => Object.entries(map2).map(([len, char2]) => [char2, { prefix, len: parseInt(len) }])));
  }
});

// node_modules/octagonal-wheels/dist/object.js
function extractObject(template, obj) {
  const ret = { ...template };
  for (const key4 in ret) {
    ret[key4] = obj[key4];
  }
  return ret;
}
function isObjectDifferent(a, b, ignoreUndefined = false) {
  if (typeof a !== typeof b) {
    return true;
  }
  if (typeof a === "object") {
    if (a === null || b === null) {
      return a !== b;
    }
    const keys2 = [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])];
    if (ignoreUndefined) {
      return keys2.map((key4) => (a == null ? void 0 : a[key4]) !== void 0 && (b == null ? void 0 : b[key4]) !== void 0 && isObjectDifferent(a == null ? void 0 : a[key4], b == null ? void 0 : b[key4])).some((e2) => e2 == true);
    }
    return keys2.map((key4) => isObjectDifferent(key4 in a ? a[key4] : SYMBOL_A, key4 in b ? b[key4] : SYMBOL_B)).some((e2) => e2 == true);
  } else {
    return a !== b;
  }
}
var SYMBOL_A, SYMBOL_B;
var init_object = __esm({
  "node_modules/octagonal-wheels/dist/object.js"() {
    init_encodeobject();
    SYMBOL_A = Symbol("a");
    SYMBOL_B = Symbol("b");
  }
});

// node_modules/octagonal-wheels/dist/dataobject/reactive_v2.js
function reactiveSource(initialValue) {
  return _reactive({ initialValue });
}
function reactive(expression, initialValue) {
  return _reactive({ expression, initialValue });
}
function resetTopologicalSortCacheFor(ids) {
  ids.forEach((id) => topologicalSortCache.delete(id));
  topologicalSortCache.forEach((value2, key4) => {
    if (!ids.includes(key4)) {
      topologicalSortCache.delete(key4);
    }
  });
}
function topologicalSort(startNode) {
  if (topologicalSortCache.has(startNode.id)) {
    const ref = topologicalSortCache.get(startNode.id);
    if (ref) {
      const result2 = ref.map((e2) => e2.instance.deref()).filter((e2) => e2);
      if (result2.length === ref.length) {
        return result2;
      }
    }
  }
  const visited = /* @__PURE__ */ new Set();
  const sorted = [];
  const recursionStack = /* @__PURE__ */ new Set();
  function visit(node) {
    if (visited.has(node)) {
      return;
    }
    if (recursionStack.has(node)) {
      throw new Error("Circular dependency detected!");
    }
    visited.add(node);
    recursionStack.add(node);
    for (const dependant of node.dependants) {
      visit(dependant);
    }
    sorted.push(node);
    recursionStack.delete(node);
  }
  visit(startNode);
  const result = sorted.reverse();
  topologicalSortCache.set(startNode.id, result.map((e2) => ({ id: e2.id, instance: new FallbackWeakRef(e2) })));
  return result;
}
function _reactive({ expression, initialValue, isSource }) {
  let value2;
  let _isDirty = false;
  const id = _reactiveSourceId++;
  const changeHandlers = /* @__PURE__ */ new Set();
  const instance = {
    id,
    dependants: /* @__PURE__ */ new Set(),
    _markDirty() {
      if (_isDirty)
        return;
      _isDirty = true;
    },
    markDirty() {
      const sorted = topologicalSort(instance);
      sorted.forEach((node) => node._markDirty());
    },
    _rippleChanged() {
      changeHandlers.forEach((e2) => e2(instance));
    },
    rippleChanged() {
      const sorted = topologicalSort(instance);
      sorted.forEach((node) => node._rippleChanged());
    },
    markClean() {
      _isDirty = false;
    },
    get isDirty() {
      return _isDirty;
    },
    get value() {
      if (context) {
        if (!instance.dependants.has(context)) {
          instance.dependants.add(context);
          resetTopologicalSortCacheFor([instance.id, context.id]);
        }
      }
      if (_isDirty) {
        if (expression) {
          const oldValue = value2;
          const newValue = expression();
          if (isObjectDifferent(oldValue, newValue)) {
            value2 = newValue;
          }
        }
        instance.markClean();
      }
      return value2;
    },
    set value(newValue) {
      if (_isDirty && !expression) {
        value2 = newValue;
      } else if (isObjectDifferent(value2, newValue)) {
        value2 = newValue;
        if (!_isDirty) {
          instance.markDirty();
          instance.rippleChanged();
        }
      }
    },
    onChanged(handler) {
      changeHandlers.add(handler);
    },
    offChanged(handler) {
      changeHandlers.delete(handler);
    }
  };
  value2 = initialize();
  function initialize() {
    const previousContext = context;
    context = instance;
    const r = expression ? expression(initialValue) : initialValue;
    context = previousContext;
    return r;
  }
  return instance;
}
function computed(expression) {
  const v = reactive(expression);
  return () => v.value;
}
var context, topologicalSortCache, _reactiveSourceId;
var init_reactive_v2 = __esm({
  "node_modules/octagonal-wheels/dist/dataobject/reactive_v2.js"() {
    init_polyfill();
    init_object();
    topologicalSortCache = /* @__PURE__ */ new Map();
    _reactiveSourceId = 0;
  }
});

// node_modules/octagonal-wheels/dist/dataobject/reactive.js
var init_reactive = __esm({
  "node_modules/octagonal-wheels/dist/dataobject/reactive.js"() {
    init_reactive_v2();
  }
});

// node_modules/octagonal-wheels/dist/common/const.js
var RESULT_TIMED_OUT, RESULT_NOT_FOUND;
var init_const = __esm({
  "node_modules/octagonal-wheels/dist/common/const.js"() {
    RESULT_TIMED_OUT = Symbol("timed out");
    RESULT_NOT_FOUND = Symbol("NotFound");
  }
});

// src/sync/core/common/types.ts
function calculateChunkTimeout(chunkCount) {
  const BASE_TIMEOUT = 1e4;
  const BATCH_SIZE2 = 100;
  const TIMEOUT_PER_BATCH = 35e3;
  const MAX_TIMEOUT = 3e5;
  const numBatches = Math.ceil(chunkCount / BATCH_SIZE2);
  const calculated = BASE_TIMEOUT + numBatches * TIMEOUT_PER_BATCH;
  return Math.min(calculated, MAX_TIMEOUT);
}
function isMetaEntry(entry) {
  return "children" in entry;
}
var MAX_DOC_SIZE_BIN, VER, LEAF_WAIT_ONLY_REMOTE, LEAF_WAIT_TIMEOUT_SEQUENTIAL_REPLICATOR, REPLICATION_BUSY_TIMEOUT, CANCELLED, AUTO_MERGED, NOT_CONFLICTED, MISSING_OR_ERROR, LEAVE_TO_SUBSEQUENT, TIME_ARGUMENT_INFINITY, VERSIONING_DOCID, MILESTONE_DOCID, NODEINFO_DOCID, SETTING_VERSION_SUPPORT_CASE_INSENSITIVE, CURRENT_SETTING_VERSION, RemoteTypes, REMOTE_COUCHDB, REMOTE_MINIO, REMOTE_P2P, P2P_DEFAULT_SETTINGS, E2EEAlgorithms, HashAlgorithms, ChunkAlgorithms, DEFAULT_SETTINGS, PREFERRED_BASE, PREFERRED_SETTING_CLOUDANT, PREFERRED_SETTING_SELF_HOSTED, PREFERRED_JOURNAL_SYNC, EntryTypes, NoteTypes, ChunkTypes, TweakValuesShouldMatchedTemplate, TweakValuesRecommendedTemplate, TweakValuesDefault, TweakValuesTemplate, DEVICE_ID_PREFERRED, PREFIXMD_LOGFILE, PREFIXMD_LOGFILE_UC, FlagFilesOriginal, FlagFilesHumanReadable, FLAGMD_REDFLAG, FLAGMD_REDFLAG2, FLAGMD_REDFLAG2_HR, FLAGMD_REDFLAG3, FLAGMD_REDFLAG3_HR, SYNCINFO_ID, SALT_OF_ID, SEED_MURMURHASH, IDPrefixes, PREFIX_OBFUSCATED, PREFIX_ENCRYPTED_CHUNK, ProtocolVersions, DOCID_SYNC_PARAMETERS, DEFAULT_SYNC_PARAMETERS, SuffixDatabaseName;
var init_types = __esm({
  "src/sync/core/common/types.ts"() {
    "use strict";
    init_logger();
    init_const();
    MAX_DOC_SIZE_BIN = 102400;
    VER = 12;
    LEAF_WAIT_ONLY_REMOTE = 5e3;
    LEAF_WAIT_TIMEOUT_SEQUENTIAL_REPLICATOR = 5e3;
    REPLICATION_BUSY_TIMEOUT = 3e6;
    CANCELLED = Symbol("cancelled");
    AUTO_MERGED = Symbol("auto_merged");
    NOT_CONFLICTED = Symbol("not_conflicted");
    MISSING_OR_ERROR = Symbol("missing_or_error");
    LEAVE_TO_SUBSEQUENT = Symbol("leave_to_subsequent_proc");
    TIME_ARGUMENT_INFINITY = Symbol("infinity");
    VERSIONING_DOCID = "obsydian_livesync_version";
    MILESTONE_DOCID = "_local/obsydian_livesync_milestone";
    NODEINFO_DOCID = "_local/obsydian_livesync_nodeinfo";
    SETTING_VERSION_SUPPORT_CASE_INSENSITIVE = 10;
    CURRENT_SETTING_VERSION = SETTING_VERSION_SUPPORT_CASE_INSENSITIVE;
    RemoteTypes = {
      REMOTE_COUCHDB: "",
      REMOTE_MINIO: "MINIO",
      REMOTE_P2P: "ONLY_P2P"
    };
    REMOTE_COUCHDB = RemoteTypes.REMOTE_COUCHDB;
    REMOTE_MINIO = RemoteTypes.REMOTE_MINIO;
    REMOTE_P2P = RemoteTypes.REMOTE_P2P;
    P2P_DEFAULT_SETTINGS = {
      P2P_Enabled: false,
      P2P_AutoAccepting: 0 /* NONE */,
      P2P_AppID: "self-hosted-livesync",
      P2P_roomID: "",
      P2P_passphrase: "",
      P2P_relays: "wss://exp-relay.vrtmrz.net/",
      P2P_AutoBroadcast: false,
      P2P_AutoStart: false,
      P2P_AutoSyncPeers: "",
      P2P_AutoWatchPeers: "",
      P2P_SyncOnReplication: "",
      P2P_RebuildFrom: "",
      P2P_AutoAcceptingPeers: "",
      P2P_AutoDenyingPeers: "",
      P2P_IsHeadless: false,
      P2P_DevicePeerName: "",
      P2P_turnServers: "",
      P2P_turnUsername: "",
      P2P_turnCredential: ""
    };
    E2EEAlgorithms = {
      V1: "",
      V2: "v2",
      ForceV1: "forceV1"
    };
    HashAlgorithms = {
      XXHASH32: "xxhash32",
      XXHASH64: "xxhash64",
      MIXED_PUREJS: "mixed-purejs",
      SHA1: "sha1",
      LEGACY: ""
    };
    ChunkAlgorithms = {
      V1: "v1",
      V2: "v2",
      V2Segmenter: "v2-segmenter",
      RabinKarp: "v3-rabin-karp"
    };
    DEFAULT_SETTINGS = {
      remoteType: REMOTE_COUCHDB,
      useCustomRequestHandler: false,
      couchDB_URI: "",
      couchDB_USER: "",
      couchDB_PASSWORD: "",
      couchDB_DBNAME: "",
      liveSync: false,
      syncOnSave: false,
      syncOnStart: false,
      savingDelay: 200,
      lessInformationInLog: false,
      gcDelay: 300,
      versionUpFlash: "",
      minimumChunkSize: 20,
      longLineThreshold: 250,
      showVerboseLog: false,
      suspendFileWatching: false,
      trashInsteadDelete: true,
      periodicReplication: false,
      periodicReplicationInterval: 60,
      syncOnFileOpen: false,
      encrypt: false,
      passphrase: "",
      usePathObfuscation: false,
      doNotDeleteFolder: false,
      resolveConflictsByNewerFile: false,
      batchSave: false,
      batchSaveMinimumDelay: 5,
      batchSaveMaximumDelay: 60,
      deviceAndVaultName: "",
      usePluginSettings: false,
      showOwnPlugins: false,
      showStatusOnEditor: true,
      showStatusOnStatusbar: true,
      showOnlyIconsOnEditor: false,
      hideFileWarningNotice: false,
      usePluginSync: false,
      autoSweepPlugins: false,
      autoSweepPluginsPeriodic: false,
      notifyPluginOrSettingUpdated: false,
      checkIntegrityOnSave: false,
      batch_size: 25,
      batches_limit: 25,
      useHistory: false,
      disableRequestURI: false,
      skipOlderFilesOnSync: true,
      checkConflictOnlyOnOpen: false,
      showMergeDialogOnlyOnActive: false,
      syncInternalFiles: false,
      syncInternalFilesBeforeReplication: false,
      syncInternalFilesIgnorePatterns: "\\/node_modules\\/, \\/\\.git\\/, \\/obsidian-livesync\\/",
      syncInternalFilesTargetPatterns: "",
      syncInternalFilesInterval: 60,
      additionalSuffixOfDatabaseName: "",
      ignoreVersionCheck: false,
      lastReadUpdates: 0,
      deleteMetadataOfDeletedFiles: false,
      syncIgnoreRegEx: "",
      syncOnlyRegEx: "",
      customChunkSize: 0,
      readChunksOnline: true,
      watchInternalFileChanges: true,
      automaticallyDeleteMetadataOfDeletedFiles: 0,
      disableMarkdownAutoMerge: false,
      writeDocumentsIfConflicted: false,
      useDynamicIterationCount: false,
      syncAfterMerge: false,
      configPassphraseStore: "",
      encryptedPassphrase: "",
      encryptedCouchDBConnection: "",
      permitEmptyPassphrase: false,
      useIndexedDBAdapter: false,
      useTimeouts: false,
      writeLogToTheFile: false,
      doNotPaceReplication: false,
      hashCacheMaxCount: 300,
      hashCacheMaxAmount: 50,
      concurrencyOfReadChunksOnline: 40,
      minimumIntervalOfReadChunksOnline: 50,
      hashAlg: "xxhash64",
      suspendParseReplicationResult: false,
      doNotSuspendOnFetching: false,
      useIgnoreFiles: false,
      ignoreFiles: ".gitignore",
      syncOnEditorSave: false,
      pluginSyncExtendedSetting: {},
      syncMaxSizeInMB: 50,
      settingSyncFile: "",
      writeCredentialsForSettingSync: false,
      notifyAllSettingSyncFile: false,
      isConfigured: void 0,
      settingVersion: CURRENT_SETTING_VERSION,
      enableCompression: false,
      accessKey: "",
      bucket: "",
      endpoint: "",
      region: "auto",
      secretKey: "",
      useEden: false,
      maxChunksInEden: 10,
      maxTotalLengthInEden: 1024,
      maxAgeInEden: 10,
      disableCheckingConfigMismatch: false,
      displayLanguage: "",
      /**
       * @deprecated
       */
      enableChunkSplitterV2: false,
      disableWorkerForGeneratingChunks: false,
      processSmallFilesInUIThread: false,
      notifyThresholdOfRemoteStorageSize: -1,
      usePluginSyncV2: false,
      usePluginEtc: false,
      handleFilenameCaseSensitive: void 0,
      doNotUseFixedRevisionForChunks: true,
      showLongerLogInsideEditor: false,
      sendChunksBulk: false,
      sendChunksBulkMaxSize: 1,
      /**
       * @deprecated
       * This setting is no longer used and will be removed in the future.
       */
      useSegmenter: false,
      useAdvancedMode: false,
      usePowerUserMode: false,
      useEdgeCaseMode: false,
      enableDebugTools: false,
      suppressNotifyHiddenFilesChange: false,
      syncMinimumInterval: 2e3,
      ...P2P_DEFAULT_SETTINGS,
      doctorProcessedVersion: "",
      bucketCustomHeaders: "",
      couchDB_CustomHeaders: "",
      useJWT: false,
      jwtAlgorithm: "",
      jwtKey: "",
      jwtKid: "",
      jwtSub: "",
      jwtExpDuration: 5,
      useRequestAPI: false,
      bucketPrefix: "",
      chunkSplitterVersion: "",
      E2EEAlgorithm: E2EEAlgorithms.V2,
      processSizeMismatchedFiles: false,
      forcePathStyle: true,
      syncInternalFileOverwritePatterns: "",
      useOnlyLocalChunk: false
    };
    PREFERRED_BASE = {
      syncMaxSizeInMB: 50,
      chunkSplitterVersion: "v3-rabin-karp",
      doNotUseFixedRevisionForChunks: false,
      usePluginSyncV2: true,
      handleFilenameCaseSensitive: false,
      E2EEAlgorithm: E2EEAlgorithms.V2
    };
    PREFERRED_SETTING_CLOUDANT = {
      ...PREFERRED_BASE,
      customChunkSize: 0,
      sendChunksBulkMaxSize: 1,
      concurrencyOfReadChunksOnline: 100,
      minimumIntervalOfReadChunksOnline: 333
    };
    PREFERRED_SETTING_SELF_HOSTED = {
      ...PREFERRED_BASE,
      customChunkSize: 50,
      sendChunksBulkMaxSize: 1,
      concurrencyOfReadChunksOnline: 30,
      minimumIntervalOfReadChunksOnline: 25
    };
    PREFERRED_JOURNAL_SYNC = {
      ...PREFERRED_BASE,
      customChunkSize: 10,
      concurrencyOfReadChunksOnline: 30,
      minimumIntervalOfReadChunksOnline: 25
    };
    EntryTypes = {
      NOTE_LEGACY: "notes",
      NOTE_BINARY: "newnote",
      NOTE_PLAIN: "plain",
      INTERNAL_FILE: "internalfile",
      CHUNK: "leaf",
      CHUNK_PACK: "chunkpack",
      VERSION_INFO: "versioninfo",
      SYNC_INFO: "syncinfo",
      SYNC_PARAMETERS: "sync-parameters",
      MILESTONE_INFO: "milestoneinfo",
      NODE_INFO: "nodeinfo"
    };
    NoteTypes = [EntryTypes.NOTE_LEGACY, EntryTypes.NOTE_BINARY, EntryTypes.NOTE_PLAIN];
    ChunkTypes = [EntryTypes.CHUNK, EntryTypes.CHUNK_PACK];
    TweakValuesShouldMatchedTemplate = {
      minimumChunkSize: 20,
      longLineThreshold: 250,
      encrypt: false,
      usePathObfuscation: false,
      enableCompression: false,
      useEden: false,
      customChunkSize: 0,
      useDynamicIterationCount: false,
      hashAlg: "xxhash64",
      enableChunkSplitterV2: false,
      maxChunksInEden: 10,
      maxTotalLengthInEden: 1024,
      maxAgeInEden: 10,
      usePluginSyncV2: false,
      handleFilenameCaseSensitive: false,
      doNotUseFixedRevisionForChunks: true,
      useSegmenter: false,
      E2EEAlgorithm: E2EEAlgorithms.V2,
      chunkSplitterVersion: ChunkAlgorithms.RabinKarp
    };
    TweakValuesRecommendedTemplate = {
      useIgnoreFiles: false,
      useCustomRequestHandler: false,
      batch_size: 25,
      batches_limit: 25,
      // useIndexedDBAdapter: false,
      useTimeouts: false,
      readChunksOnline: true,
      hashCacheMaxCount: 300,
      hashCacheMaxAmount: 50,
      concurrencyOfReadChunksOnline: 40,
      minimumIntervalOfReadChunksOnline: 50,
      ignoreFiles: ".gitignore",
      syncMaxSizeInMB: 50,
      enableChunkSplitterV2: false,
      usePluginSyncV2: true,
      handleFilenameCaseSensitive: false,
      doNotUseFixedRevisionForChunks: false,
      E2EEAlgorithm: E2EEAlgorithms.V2,
      chunkSplitterVersion: ChunkAlgorithms.RabinKarp
    };
    TweakValuesDefault = {
      usePluginSyncV2: false,
      E2EEAlgorithm: DEFAULT_SETTINGS.E2EEAlgorithm,
      chunkSplitterVersion: DEFAULT_SETTINGS.chunkSplitterVersion
    };
    TweakValuesTemplate = { ...TweakValuesRecommendedTemplate, ...TweakValuesShouldMatchedTemplate };
    DEVICE_ID_PREFERRED = "PREFERRED";
    PREFIXMD_LOGFILE = "livesync_log_";
    PREFIXMD_LOGFILE_UC = "LIVESYNC_LOG_";
    FlagFilesOriginal = {
      SUSPEND_ALL: "redflag.md",
      REBUILD_ALL: "redflag2.md",
      FETCH_ALL: "redflag3.md"
    };
    FlagFilesHumanReadable = {
      REBUILD_ALL: "flag_rebuild.md",
      FETCH_ALL: "flag_fetch.md"
    };
    FLAGMD_REDFLAG = FlagFilesOriginal.SUSPEND_ALL;
    FLAGMD_REDFLAG2 = FlagFilesOriginal.REBUILD_ALL;
    FLAGMD_REDFLAG2_HR = FlagFilesHumanReadable.REBUILD_ALL;
    FLAGMD_REDFLAG3 = FlagFilesOriginal.FETCH_ALL;
    FLAGMD_REDFLAG3_HR = FlagFilesHumanReadable.FETCH_ALL;
    SYNCINFO_ID = "syncinfo";
    SALT_OF_ID = "a83hrf7fy7sa8g31";
    SEED_MURMURHASH = 305419896;
    IDPrefixes = {
      Obfuscated: "f:",
      Chunk: "h:",
      EncryptedChunk: "h:+"
    };
    PREFIX_OBFUSCATED = "f:";
    PREFIX_ENCRYPTED_CHUNK = "h:+";
    ProtocolVersions = {
      UNSET: void 0,
      LEGACY: 1,
      ADVANCED_E2EE: 2
    };
    DOCID_SYNC_PARAMETERS = "_local/obsidian_livesync_sync_parameters";
    DEFAULT_SYNC_PARAMETERS = {
      _id: DOCID_SYNC_PARAMETERS,
      type: EntryTypes["SYNC_PARAMETERS"],
      protocolVersion: ProtocolVersions.ADVANCED_E2EE,
      pbkdf2salt: ""
    };
    SuffixDatabaseName = "-livesync-v2";
  }
});

// node_modules/octagonal-wheels/dist/binary/base64.js
function base64ToArrayBufferNative(base64) {
  if (base64.length === 0)
    return new ArrayBuffer(0);
  try {
    if (typeof base64 == "string")
      return Uint8Array.fromBase64(base64).buffer;
    const bufItems = base64.map((e2) => Uint8Array.fromBase64(e2).buffer);
    const len = bufItems.reduce((p, c) => p + c.byteLength, 0);
    const joinedArray = new Uint8Array(len);
    let offset = 0;
    bufItems.forEach((e2) => {
      joinedArray.set(new Uint8Array(e2), offset);
      offset += e2.byteLength;
    });
    return joinedArray.buffer;
  } catch (ex) {
    Logger("Base64 Decode error", LOG_LEVEL_VERBOSE);
    Logger(ex, LOG_LEVEL_VERBOSE);
    return new ArrayBuffer(0);
  }
}
function base64ToArrayBufferBrowser(base64) {
  if (typeof base64 == "string")
    return base64ToArrayBufferInternalBrowser(base64);
  const bufItems = base64.map((e2) => base64ToArrayBufferInternalBrowser(e2));
  const len = bufItems.reduce((p, c) => p + c.byteLength, 0);
  const joinedArray = new Uint8Array(len);
  let offset = 0;
  bufItems.forEach((e2) => {
    joinedArray.set(new Uint8Array(e2), offset);
    offset += e2.byteLength;
  });
  return joinedArray.buffer;
}
function base64ToArrayBufferInternalBrowser(base64) {
  try {
    const binary_string = globalThis.atob(base64);
    const len = binary_string.length;
    const bytes = new Uint8Array(len);
    for (let i = 0; i < len; i++) {
      bytes[i] = binary_string.charCodeAt(i);
    }
    return bytes.buffer;
  } catch (ex) {
    Logger("Base64 Decode error", LOG_LEVEL_VERBOSE);
    Logger(ex, LOG_LEVEL_VERBOSE);
    return new ArrayBuffer(0);
  }
}
function arrayBufferToBase64internalBrowser(buffer) {
  return new Promise((res2, rej) => {
    const blob = new Blob([buffer], { type: "application/octet-binary" });
    const reader = new FileReader();
    reader.onload = function(evt) {
      var _a6, _b4;
      const dataURI = ((_b4 = (_a6 = evt.target) == null ? void 0 : _a6.result) == null ? void 0 : _b4.toString()) || "";
      if (buffer.byteLength != 0 && (dataURI == "" || dataURI == "data:"))
        return rej(new TypeError("Could not parse the encoded string"));
      const result = dataURI.substring(dataURI.indexOf(",") + 1);
      res2(result);
    };
    reader.readAsDataURL(blob);
  });
}
async function arrayBufferToBase64SingleBrowser(buffer) {
  const buf = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
  if (buf.byteLength < QUANTUM)
    return btoa(String.fromCharCode.apply(null, [...buf]));
  return await arrayBufferToBase64internalBrowser(buf);
}
function arrayBufferToBase64SingleNative(buffer) {
  const buf = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
  return Promise.resolve(buf.toBase64());
}
function writeString(string) {
  if (string.length > 128) {
    const buf = te.encode(string);
    return buf;
  }
  const buffer = new Uint8Array(string.length * 4);
  const length = string.length;
  let index6 = 0;
  let chr = 0;
  let idx2 = 0;
  while (idx2 < length) {
    chr = string.charCodeAt(idx2++);
    if (chr < 128) {
      buffer[index6++] = chr;
    } else if (chr < 2048) {
      buffer[index6++] = 192 | chr >>> 6;
      buffer[index6++] = 128 | chr & 63;
    } else if (chr < 55296 || chr > 57343) {
      buffer[index6++] = 224 | chr >>> 12;
      buffer[index6++] = 128 | chr >>> 6 & 63;
      buffer[index6++] = 128 | chr & 63;
    } else {
      chr = (chr - 55296 << 10 | string.charCodeAt(idx2++) - 56320) + 65536;
      buffer[index6++] = 240 | chr >>> 18;
      buffer[index6++] = 128 | chr >>> 12 & 63;
      buffer[index6++] = 128 | chr >>> 6 & 63;
      buffer[index6++] = 128 | chr & 63;
    }
  }
  return buffer.slice(0, index6);
}
function readString(buffer) {
  const length = buffer.length;
  if (length > 128)
    return td.decode(buffer);
  let index6 = 0;
  const end = length;
  let string = "";
  while (index6 < end) {
    const chunk = [];
    const cEnd = Math.min(index6 + QUANTUM, end);
    while (index6 < cEnd) {
      const chr = buffer[index6++];
      if (chr < 128) {
        chunk.push(chr);
      } else if ((chr & 224) === 192) {
        chunk.push((chr & 31) << 6 | buffer[index6++] & 63);
      } else if ((chr & 240) === 224) {
        chunk.push((chr & 15) << 12 | (buffer[index6++] & 63) << 6 | buffer[index6++] & 63);
      } else if ((chr & 248) === 240) {
        let code = (chr & 7) << 18 | (buffer[index6++] & 63) << 12 | (buffer[index6++] & 63) << 6 | buffer[index6++] & 63;
        if (code < 65536) {
          chunk.push(code);
        } else {
          code -= 65536;
          chunk.push((code >>> 10) + 55296, (code & 1023) + 56320);
        }
      }
    }
    string += String.fromCharCode(...chunk);
  }
  return string;
}
function tryConvertBase64ToArrayBufferBrowser(base64) {
  try {
    const b64F = base64.replace(/\r|\n/g, "");
    if (!regexpBase64.test(b64F)) {
      return false;
    }
    const binary_string = globalThis.atob(b64F);
    if (globalThis.btoa(binary_string) !== b64F) {
      return false;
    }
    const len = binary_string.length;
    const bytes = new Uint8Array(len);
    for (let i = 0; i < len; i++) {
      bytes[i] = binary_string.charCodeAt(i);
    }
    return bytes.buffer;
  } catch (e2) {
    return false;
  }
}
function tryConvertBase64ToArrayBufferNative(base64) {
  try {
    const b64F = base64.replace(/\r|\n/g, "");
    if (!regexpBase64.test(b64F)) {
      return false;
    }
    const buf = Uint8Array.fromBase64(b64F);
    if (buf.toBase64() !== b64F) {
      return false;
    }
    return buf.byteLength > 0 ? buf.buffer : false;
  } catch (e2) {
    return false;
  }
}
var isProposalArrayBufferBase64Available, base64ToArrayBuffer, encodeChunkSize, arrayBufferToBase64Single, QUANTUM, te, td, regexpBase64, tryConvertBase64ToArrayBuffer;
var init_base64 = __esm({
  "node_modules/octagonal-wheels/dist/binary/base64.js"() {
    init_logger();
    isProposalArrayBufferBase64Available = typeof Uint8Array !== "undefined" && //@ts-ignore: Not typed in project target level
    typeof Uint8Array.prototype.toBase64 === "function" && //@ts-ignore: Not typed in project target level
    typeof Uint8Array.fromBase64 === "function";
    base64ToArrayBuffer = isProposalArrayBufferBase64Available ? base64ToArrayBufferNative : base64ToArrayBufferBrowser;
    encodeChunkSize = 3 * 5e7;
    arrayBufferToBase64Single = isProposalArrayBufferBase64Available ? arrayBufferToBase64SingleNative : arrayBufferToBase64SingleBrowser;
    QUANTUM = 32768;
    te = new TextEncoder();
    td = new TextDecoder();
    regexpBase64 = /^[A-Za-z0-9+/]+=*$/;
    tryConvertBase64ToArrayBuffer = isProposalArrayBufferBase64Available ? tryConvertBase64ToArrayBufferNative : tryConvertBase64ToArrayBufferBrowser;
  }
});

// node_modules/octagonal-wheels/dist/collection.js
function* arrayToChunkedArray(arr, chunkLength) {
  const source2 = [...arr];
  while (source2.length) {
    const s = source2.splice(0, chunkLength);
    yield s;
  }
}
function unique(arr) {
  return [...new Set(arr)];
}
function* range(from, to) {
  for (let i = from; i <= to; i++) {
    yield i;
  }
  return;
}
var init_collection = __esm({
  "node_modules/octagonal-wheels/dist/collection.js"() {
  }
});

// node_modules/octagonal-wheels/dist/binary/encodedUTF16.js
function decodeToArrayBuffer(src) {
  if (src.length == 1)
    return _decodeToArrayBuffer(src[0]);
  const bufItems = src.map((e2) => _decodeToArrayBuffer(e2));
  const len = bufItems.reduce((p, c) => p + c.byteLength, 0);
  const joinedArray = new Uint8Array(len);
  let offset = 0;
  bufItems.forEach((e2) => {
    joinedArray.set(new Uint8Array(e2), offset);
    offset += e2.byteLength;
  });
  return joinedArray.buffer;
}
function _decodeToArrayBuffer(src) {
  const out = new Uint8Array(src.length);
  const len = src.length;
  for (let i = 0; i < len; i++) {
    const char2 = src.charCodeAt(i);
    if (char2 >= 38 && char2 <= 126 && char2 != 58) {
      out[i] = char2;
    } else {
      out[i] = revTable[char2];
    }
  }
  return out.buffer;
}
var BINARY_CHUNK_MAX, table, revTable;
var init_encodedUTF16 = __esm({
  "node_modules/octagonal-wheels/dist/binary/encodedUTF16.js"() {
    init_collection();
    BINARY_CHUNK_MAX = 1024 * 1024 * 30;
    table = {};
    revTable = {};
    [...range(192, 447)].forEach((e2, i) => {
      table[i] = e2;
      revTable[e2] = i;
    });
  }
});

// node_modules/octagonal-wheels/dist/binary/hex.js
function uint8ArrayToHexStringBrowser(src) {
  return [...src].map((e2) => numMap[e2]).join("");
}
function uint8ArrayToHexStringNative(src) {
  return src.toHex();
}
var revMap, numMap, isProposalArrayBufferBase64Available2, uint8ArrayToHexString;
var init_hex = __esm({
  "node_modules/octagonal-wheels/dist/binary/hex.js"() {
    revMap = {};
    numMap = {};
    for (let i = 0; i < 256; i++) {
      revMap[`00${i.toString(16)}`.slice(-2)] = i;
      numMap[i] = `00${i.toString(16)}`.slice(-2);
    }
    isProposalArrayBufferBase64Available2 = typeof Uint8Array !== "undefined" && //@ts-ignore: Not typed in project target level
    typeof Uint8Array.prototype.toBase64 === "function" && //@ts-ignore: Not typed in project target level
    typeof Uint8Array.fromBase64 === "function";
    uint8ArrayToHexString = isProposalArrayBufferBase64Available2 ? uint8ArrayToHexStringNative : uint8ArrayToHexStringBrowser;
  }
});

// node_modules/octagonal-wheels/dist/binary/index.js
function decodeBinary(src) {
  if (src.length == 0)
    return new Uint8Array().buffer;
  if (typeof src === "string") {
    if (src[0] === "%") {
      return _decodeToArrayBuffer(src.substring(1));
    }
  } else {
    if (src[0][0] === "%") {
      const [head2, ...last] = src;
      return decodeToArrayBuffer([head2.substring(1), ...last]);
    }
  }
  return base64ToArrayBuffer(src);
}
var init_binary = __esm({
  "node_modules/octagonal-wheels/dist/binary/index.js"() {
    init_base64();
    init_base64();
    init_encodedUTF16();
    init_encodedUTF16();
    init_hex();
  }
});

// node_modules/octagonal-wheels/dist/string.js
var init_string = __esm({
  "node_modules/octagonal-wheels/dist/string.js"() {
  }
});

// src/sync/core/string_and_binary/convert.ts
var init_convert = __esm({
  "src/sync/core/string_and_binary/convert.ts"() {
    "use strict";
    init_binary();
    init_hex();
    init_encodedUTF16();
    init_binary();
    init_string();
  }
});

// src/sync/core/pouchdb/utils_couchdb.ts
function isErrorOfMissingDoc(ex) {
  return (ex && (ex == null ? void 0 : ex.status)) == 404;
}
var init_utils_couchdb = __esm({
  "src/sync/core/pouchdb/utils_couchdb.ts"() {
    "use strict";
    init_convert();
  }
});

// node_modules/octagonal-wheels/dist/promises.js
async function isSomeResolved(promises6) {
  if (promises6.length == 0)
    return false;
  return await Promise.race([...promises6, Promise.resolve(UNRESOLVED)]) !== UNRESOLVED;
}
function polyfillPromiseWithResolvers() {
  let resolve;
  let reject;
  const promise = new Promise((res2, rej) => {
    resolve = res2;
    reject = rej;
  });
  return { promise, resolve, reject };
}
function nativePromiseWithResolvers() {
  const p = Promise.withResolvers();
  const { promise, resolve, reject } = p;
  return { promise, resolve, reject };
}
function fireAndForget(p) {
  if (typeof p == "function")
    return fireAndForget(p());
  p.then(noop).catch(noop);
}
function yieldMicrotask() {
  return new Promise((res2) => queueMicrotask(res2));
}
function cancelableDelay(timeout, cancel = TIMED_OUT_SIGNAL) {
  let timer = void 0;
  const promise = promiseWithResolvers();
  timer = setTimeout(() => {
    timer = void 0;
    promise.resolve(cancel);
  }, timeout);
  return {
    promise: promise.promise,
    cancel() {
      if (timer) {
        clearTimeout(timer);
        timer = void 0;
      }
    }
  };
}
var delay, UNRESOLVED, polyfilledFunc, promiseWithResolvers, promiseWithResolver, noop, TIMED_OUT_SIGNAL;
var init_promises = __esm({
  "node_modules/octagonal-wheels/dist/promises.js"() {
    delay = (ms, result) => {
      return new Promise((res2) => {
        setTimeout(() => {
          res2(result);
        }, ms);
      });
    };
    UNRESOLVED = Symbol("UNRESOLVED");
    polyfilledFunc = "withResolvers" in Promise ? nativePromiseWithResolvers : polyfillPromiseWithResolvers;
    promiseWithResolvers = polyfilledFunc;
    promiseWithResolver = polyfilledFunc;
    noop = () => {
    };
    TIMED_OUT_SIGNAL = Symbol("timed out");
  }
});

// src/sync/core/common/LSError.ts
var LiveSyncError, LiveSyncFatalError;
var init_LSError = __esm({
  "src/sync/core/common/LSError.ts"() {
    "use strict";
    LiveSyncError = class _LiveSyncError extends Error {
      /**
       * Constructs a new LiveSyncError instance.
       * @param message The error message to be displayed.
       */
      constructor(message, options) {
        super(message);
        this.name = this.constructor.name;
        if (options == null ? void 0 : options.cause) {
          this.cause = options.cause instanceof Error ? options.cause : new Error(`${options.cause}`);
        }
        if ((options == null ? void 0 : options.status) !== void 0) {
          this.overrideStatus = options.status;
        }
      }
      /**
       * Returns the HTTP status code associated with the error, if available.
       * If the error has a status property, it returns that; otherwise, it defaults to 500 (Internal Server Error).
       * @returns {number} The HTTP status code.
       */
      get status() {
        if (this.overrideStatus !== void 0) {
          return this.overrideStatus;
        }
        if (this.cause && "status" in this.cause) {
          return this.cause.status;
        }
        return 500;
      }
      /**
       * Determines whether an error is caused by a specific error class.
       * @param error The error to examine.
       * @param errorClass The error class to compare against.
       * @returns True if the error is caused by the specified error class; otherwise, false.
       * @example
       * LiveSyncError.isCausedBy(someSyncParamsFetchError, SyncParamsNotFoundError); // Returns true if the error is caused by SyncParamsNotFoundError; this is usually represented as SyncParamsFetchError at the uppermost layer.
       */
      static isCausedBy(error2, errorClass) {
        if (!error2) {
          return false;
        }
        if (error2 instanceof errorClass) {
          return true;
        }
        if (error2.cause) {
          return _LiveSyncError.isCausedBy(error2.cause, errorClass);
        }
        return false;
      }
      /**
       * Creates a new instance of the error class from an existing error.
       * @param error The error to wrap.
       * @returns A new instance of the error class with the original error's message and stack trace.
       */
      static fromError(error2) {
        if (error2 instanceof this) {
          return error2;
        }
        const instance = new this(`${this.name}: ${error2 == null ? void 0 : error2.message}`, { cause: error2 });
        if (error2 == null ? void 0 : error2.stack) {
          instance.stack = error2.stack;
        } else {
          instance.stack = new Error().stack;
        }
        return instance;
      }
    };
    LiveSyncFatalError = class extends LiveSyncError {
    };
  }
});

// src/sync/core/managers/ChunkFetcher.ts
var EVENT_MISSING_CHUNKS, EVENT_MISSING_CHUNK_REMOTE, BATCH_SIZE, ChunkFetcher;
var init_ChunkFetcher = __esm({
  "src/sync/core/managers/ChunkFetcher.ts"() {
    "use strict";
    init_promises();
    init_collection();
    init_logger2();
    init_types();
    init_ChunkManager();
    EVENT_MISSING_CHUNKS = "missingChunks";
    EVENT_MISSING_CHUNK_REMOTE = "missingChunkRemote";
    BATCH_SIZE = 100;
    ChunkFetcher = class {
      constructor(options) {
        this.queue = [];
        this.abort = new AbortController();
        this.onEventHandler = this.onEvent.bind(this);
        /**
         * Processing requests
         */
        this.currentProcessing = 0;
        /**
         * Time of the last request to the remote server.
         * This is used to manage the interval between requests.
         * Even if concurrency allows, every start of a request will ensure that the interval is respected.
         */
        this.previousRequestTime = 0;
        this.options = options;
        this.chunkManager.addListener(EVENT_MISSING_CHUNKS, this.onEventHandler, {
          signal: this.abort.signal
        });
      }
      get chunkManager() {
        return this.options.chunkManager;
      }
      get interval() {
        return this.options.settings.minimumIntervalOfReadChunksOnline || DEFAULT_SETTINGS.minimumIntervalOfReadChunksOnline;
      }
      get concurrency() {
        return this.options.settings.concurrencyOfReadChunksOnline || DEFAULT_SETTINGS.concurrencyOfReadChunksOnline;
      }
      destroy() {
        this.abort.abort();
        this.queue = [];
      }
      onEvent(ids) {
        this.queue = unique([...this.queue, ...ids]);
        if (this.canRequestMore()) {
          setTimeout(() => void this.requestMissingChunks(), 1);
        }
      }
      canRequestMore() {
        return this.currentProcessing < this.concurrency && this.queue.length > 0;
      }
      async requestMissingChunks() {
        if (!this.canRequestMore()) {
          return;
        }
        try {
          let isValidChunk2 = function(chunk) {
            return chunk && typeof (chunk == null ? void 0 : chunk._id) === "string" && typeof (chunk == null ? void 0 : chunk.data) === "string";
          };
          var isValidChunk = isValidChunk2;
          this.currentProcessing++;
          const requestIDs = this.queue.splice(0, BATCH_SIZE);
          const now = Date.now();
          const timeSinceLastRequest = now - this.previousRequestTime;
          this.previousRequestTime = now;
          const timeToWait = Math.max(this.interval - timeSinceLastRequest, 0);
          if (timeToWait > 0) await delay(timeToWait);
          const replicator = this.options.getActiveReplicator();
          if (!replicator) {
            Logger("No active replicator was found to request missing chunks.", LOG_LEVEL_VERBOSE);
            return;
          }
          const fetched = await replicator.fetchRemoteChunks(requestIDs, false);
          if (!fetched) {
            Logger(`No chunks were found for the following IDs: ${requestIDs.join(", ")}`, LOG_LEVEL_VERBOSE);
            for (const chunkID of requestIDs) {
              this.chunkManager.emitEvent(EVENT_MISSING_CHUNK_REMOTE, chunkID);
            }
            return;
          }
          const chunks = fetched.filter((chunk) => isValidChunk2(chunk));
          if (chunks.length !== fetched.length) {
            Logger(
              `Some fetched chunks are invalid and will be ignored: (${fetched.length - chunks.length} / ${fetched.length}).`,
              LOG_LEVEL_VERBOSE
            );
            for (const chunk of fetched) {
              if (!isValidChunk2(chunk)) {
                Logger(`Invalid chunk: ${JSON.stringify(chunk)}`, LOG_LEVEL_VERBOSE);
              }
            }
          }
          if (chunks.length === 0) {
            Logger(`No valid chunks were found for the following IDs: ${requestIDs.join(", ")}`, LOG_LEVEL_VERBOSE);
          }
          const missingIDs = requestIDs.filter((id) => !chunks.some((chunk) => chunk._id === id));
          try {
            if (chunks.length === 0) {
              return;
            }
            Logger(`Writing fetched chunks (${chunks.length}) to the database...`, LOG_LEVEL_VERBOSE);
            const result = await this.chunkManager.write(
              chunks,
              {
                skipCache: true,
                force: true
                // Force writing to ensure the chunks with existing _rev.
              },
              "ChunkFetcher"
            );
            if (result.result === true) {
              Logger(`Fetched chunks were stored successfully: ${chunks.length}`, LOG_LEVEL_VERBOSE);
            } else {
              Logger(
                `Fetched chunks could not be stored: ${chunks.map((chunk) => chunk._id).join(", ")}`,
                LOG_LEVEL_VERBOSE
              );
            }
          } catch (error2) {
            Logger(`An error occurred while storing fetched chunks: ${error2}`, LOG_LEVEL_VERBOSE);
          } finally {
            for (const chunk of chunks) {
              this.chunkManager.emitEvent(EVENT_CHUNK_FETCHED, chunk);
            }
            for (const chunkID of missingIDs) {
              this.chunkManager.emitEvent(EVENT_MISSING_CHUNK_REMOTE, chunkID);
            }
          }
        } finally {
          this.currentProcessing--;
          this.previousRequestTime = Date.now();
          if (this.queue.length > 0) {
            setTimeout(() => void this.requestMissingChunks(), 0);
          }
        }
      }
    };
  }
});

// src/sync/core/managers/ChunkManager.ts
function buildChunkMap(chunks) {
  const map2 = /* @__PURE__ */ new Map();
  for (const chunk of chunks) {
    map2.set(chunk._id, chunk);
  }
  return map2;
}
function withTimeout(proc, timeout, onTimedOut) {
  return new Promise((resolve, reject) => {
    const timer = setTimeout(() => {
      resolve(onTimedOut());
    }, timeout);
    proc.then(resolve).catch(reject).finally(() => {
      clearTimeout(timer);
    });
  });
}
function getError(error2) {
  if (error2 instanceof Error) {
    return error2;
  }
  if ("error" in error2 && error2.error instanceof Error) {
    return error2.error;
  }
  return void 0;
}
function isMissingError(error2) {
  if ("status" in error2 && error2.status === 404) {
    return true;
  }
  if ("error" in error2 && error2.error === "not_found") {
    return true;
  }
  if ("error" in error2) {
    return isMissingError(error2.error);
  }
  return false;
}
function isChunkDoc(doc) {
  return doc && typeof doc._id === "string" && doc.type === "leaf";
}
var DEFAULT_MAX_CACHE_SIZE, HotPackProcessResults, DEFAULT_TIMEOUT, EVENT_CHUNK_FETCHED, ChunkManager;
var init_ChunkManager = __esm({
  "src/sync/core/managers/ChunkManager.ts"() {
    "use strict";
    init_polyfill();
    init_logger2();
    init_promises();
    init_LSError();
    init_ChunkFetcher();
    DEFAULT_MAX_CACHE_SIZE = 1e5;
    HotPackProcessResults = {
      OK: true,
      FAILED: false,
      FALLBACK: Symbol("fallback")
      // Fallback if hot pack fails
    };
    DEFAULT_TIMEOUT = 15e3;
    EVENT_CHUNK_FETCHED = "chunkFetched";
    ChunkManager = class {
      constructor(options) {
        this.eventTarget = new EventTarget();
        this.maxCacheSize = DEFAULT_MAX_CACHE_SIZE;
        // Maximum cache size
        this.caches = /* @__PURE__ */ new Map();
        this.waitingMap = /* @__PURE__ */ new Map();
        // Queue for pending reads
        this.allocCount = 0;
        // Count of allocated chunks
        this.derefCount = 0;
        this.onChunkArrivedHandler = this.onChunkArrived.bind(this);
        this.onChangeHandler = this.onChange.bind(this);
        this.onMissingChunkRemoteHandler = this.onMissingChunkRemote.bind(this);
        this.abort = new AbortController();
        this.initialised = Promise.resolve();
        this.concurrentTransactions = 0;
        this.stabilised = Promise.resolve();
        this.options = options;
        this.caches = /* @__PURE__ */ new Map();
        this.changeHandler = this.changeManager.addCallback(this.onChangeHandler);
        this.addListener(EVENT_CHUNK_FETCHED, this.onChunkArrivedHandler, { signal: this.abort.signal });
        this.addListener(EVENT_MISSING_CHUNK_REMOTE, this.onMissingChunkRemoteHandler, { signal: this.abort.signal });
        this.initialised = this._initialise();
      }
      get changeManager() {
        return this.options.changeManager;
      }
      get database() {
        return this.options.database;
      }
      // Map for cache
      addListener(type, listener, options) {
        const callback = (ev) => {
          listener.call(this, ev.detail);
        };
        this.eventTarget.addEventListener(type, callback, options);
        return () => {
          this.eventTarget.removeEventListener(type, callback, options);
        };
      }
      emitEvent(type, detail) {
        const event2 = new CustomEvent(type, { detail });
        this.eventTarget.dispatchEvent(event2);
      }
      // Count of dereferenced chunks
      clearCaches() {
        this.caches.clear();
        this.allocCount = 0;
        this.derefCount = 0;
      }
      getCachedChunk(id) {
        if (!this.caches.has(id)) {
          return false;
        }
        const weakRef = this.caches.get(id);
        if (weakRef) {
          const cachedChunk = weakRef.deref();
          if (cachedChunk) {
            return cachedChunk;
          } else {
            this.derefCount++;
            this.deleteCachedChunk(id);
            return false;
          }
        }
        return false;
      }
      getChunkIDFromCache(data) {
        for (const [id, weakRef] of this.caches) {
          const chunk = weakRef.deref();
          if (chunk) {
            if (chunk.data === data) {
              return id;
            }
          } else {
            this.derefCount++;
            this.deleteCachedChunk(id);
          }
        }
        return false;
      }
      cacheChunk(chunk) {
        var _a6;
        if (this.getCachedChunk(chunk._id)) {
          this.reorderChunk(chunk._id);
          return;
        }
        this.caches.set(chunk._id, new FallbackWeakRef(chunk));
        this.allocCount++;
        const maxCacheSize = (_a6 = this.maxCacheSize) != null ? _a6 : DEFAULT_MAX_CACHE_SIZE;
        if (this.caches.size > maxCacheSize) {
          do {
            const firstKey = this.caches.keys().next().value;
            if (firstKey) {
              this.caches.delete(firstKey);
            }
          } while (this.caches.size > maxCacheSize);
        }
      }
      reorderChunk(id) {
        const chunk = this.getCachedChunk(id);
        if (chunk) {
          this.caches.delete(id);
          this.caches.set(id, new FallbackWeakRef(chunk));
        }
      }
      deleteCachedChunk(id) {
        if (this.caches.has(id)) {
          this.caches.delete(id);
        }
      }
      _enqueueWaiting(id, timeout) {
        const previous = this.waitingMap.get(id);
        if (previous) {
          return previous.resolver.promise;
        }
        const resolver = promiseWithResolver();
        this.waitingMap.set(id, { resolver });
        return withTimeout(resolver.promise, timeout, () => {
          const current = this.waitingMap.get(id);
          if (current && current.resolver === resolver) {
            this.waitingMap.delete(id);
          }
          return false;
        });
      }
      onChunkArrived(doc, deleted = false) {
        const id = doc._id;
        if (this.waitingMap.has(id)) {
          const queue2 = this.waitingMap.get(id);
          this.waitingMap.delete(id);
          if (doc._deleted || deleted) {
            queue2.resolver.resolve(false);
          } else {
            queue2.resolver.resolve(doc);
            this.cacheChunk(doc);
          }
        } else {
        }
      }
      onChange(change) {
        const doc = change.doc;
        if (!doc || !doc._id) {
          return;
        }
        if (doc.type !== "leaf") {
          return;
        }
        this.onChunkArrived(doc, change.deleted);
      }
      onMissingChunkRemote(id) {
        if (this.waitingMap.has(id)) {
          const queue2 = this.waitingMap.get(id);
          this.waitingMap.delete(id);
          queue2.resolver.resolve(false);
        }
      }
      async _initialise() {
        Logger("ChunkManager initialised", LOG_LEVEL_VERBOSE);
        return await Promise.resolve();
      }
      destroy() {
        this.abort.abort();
        this.changeHandler();
        this.caches.clear();
        this.waitingMap.clear();
      }
      async readSingle(id, options) {
        var _a6;
        if (!options.skipCache) {
          const cachedChunk = this.getCachedChunk(id);
          if (cachedChunk) {
            this.reorderChunk(id);
            return cachedChunk;
          }
        }
        try {
          const result = await this.database.get(id);
          if (result && isChunkDoc(result)) {
            this.cacheChunk(result);
            return result;
          }
        } catch (error2) {
          if (!isMissingError(error2)) {
            throw new LiveSyncError(`Failed to read chunk ${id}`, { status: 404, cause: error2 });
          }
        }
        const timeout = (_a6 = options.timeout) != null ? _a6 : DEFAULT_TIMEOUT;
        if (timeout > 0) {
          const ret = this._enqueueWaiting(id, timeout);
          if (!options.preventRemoteRequest) {
            this.emitEvent(EVENT_MISSING_CHUNKS, [id]);
          }
          return ret;
        }
        return false;
      }
      _readFromCache(readIds, resultMap) {
        const cachedChunks = [...readIds].map((id) => this.getCachedChunk(id)).filter((chunk) => chunk !== false);
        for (const chunk of cachedChunks) {
          this.reorderChunk(chunk._id);
          resultMap.set(chunk._id, chunk);
          readIds.delete(chunk._id);
        }
      }
      async _readFromDatabase(readIds, resultMap) {
        const results = await this.database.allDocs({ keys: [...readIds], include_docs: true });
        for (const row of results.rows) {
          if ("doc" in row && row.doc) {
            const chunk = row.doc;
            resultMap.set(chunk._id, chunk);
            readIds.delete(chunk._id);
            this.cacheChunk(chunk);
          } else if (!isMissingError(row)) {
            throw new LiveSyncError(`Failed to read chunk ${row.key}`, { status: 404, cause: getError(row) });
          }
        }
      }
      async _waitForArrival(options, readIds, resultMap) {
        var _a6;
        const timeout = (_a6 = options.timeout) != null ? _a6 : DEFAULT_TIMEOUT;
        if (timeout > 0) {
          const tasks3 = [...readIds].map((id) => {
            return this._enqueueWaiting(id, timeout);
          });
          if (!options.preventRemoteRequest) {
            this.emitEvent(EVENT_MISSING_CHUNKS, [...readIds]);
          }
          const results = await Promise.all(tasks3);
          for (const chunk of results) {
            if (chunk) {
              resultMap.set(chunk._id, chunk);
              readIds.delete(chunk._id);
              this.cacheChunk(chunk);
            }
          }
        }
      }
      _readPreloadedChunks(preloadedChunks, readIds, resultMap) {
        for (const [id, chunk] of Object.entries(preloadedChunks)) {
          if (isChunkDoc(chunk)) {
            this.cacheChunk(chunk);
            resultMap.set(id, chunk);
            readIds.delete(id);
          }
        }
      }
      async read(ids, options, preloadedChunks) {
        const order = [...ids];
        const resultMap = new Map(ids.map((id) => [id, false]));
        const readIds = /* @__PURE__ */ new Set([...resultMap.keys()]);
        if (preloadedChunks) {
          this._readPreloadedChunks(preloadedChunks, readIds, resultMap);
        }
        if (!options.skipCache) {
          this._readFromCache(readIds, resultMap);
        }
        if (readIds.size > 0) {
          await this._readFromDatabase(readIds, resultMap);
        }
        if (readIds.size > 0) {
          await this._waitForArrival(options, readIds, resultMap);
        }
        return order.map((id) => resultMap.get(id) || false);
      }
      async write(chunks, options, origin) {
        let storeChunks = chunks;
        const writeResult = {
          result: true,
          processed: {
            cached: 0,
            hotPack: 0,
            written: 0,
            duplicated: 0
          }
        };
        const total = storeChunks.length;
        if (!options.skipCache) {
          storeChunks = storeChunks.filter((chunk) => {
            const cached = this.getCachedChunk(chunk._id);
            if (cached) {
              this.reorderChunk(chunk._id);
              return false;
            }
            return true;
          });
        }
        const afterPhase1 = storeChunks.length;
        writeResult.processed.cached = total - afterPhase1;
        if (storeChunks.length === 0) {
          return writeResult;
        }
        const result = await this.database.bulkDocs(storeChunks, { new_edits: !(options == null ? void 0 : options.force) });
        const failed2 = result.filter((res2) => "error" in res2);
        if (failed2.some((res2) => res2.status !== 409)) {
          throw new LiveSyncError(`Failed to write chunks: ${failed2.map((res2) => res2.error).join(", ")}`, {
            status: 500
          });
        }
        const conflictedChunkIDs = failed2.filter((res2) => typeof res2.id === "string").map((res2) => res2.id);
        if (conflictedChunkIDs.length > 0) {
          writeResult.processed.duplicated = conflictedChunkIDs.length;
          const conflictedChunks = (await this.read(conflictedChunkIDs, { skipCache: false, timeout: 0 })).filter(
            (chunk) => chunk !== false
          );
          const originalChunks = buildChunkMap(chunks);
          for (const chunk of conflictedChunks) {
            const originalChunk = originalChunks.get(chunk._id);
            if (originalChunk && originalChunk.data === chunk.data) {
              this.cacheChunk(chunk);
            } else {
              this.deleteCachedChunk(chunk._id);
              throw new LiveSyncFatalError(
                `Inconsistent chunk data for ${chunk._id}: local data differs from remote data. This is a fatal error.`
              );
            }
          }
        }
        let actualWritten = result.length - failed2.length;
        if ((options == null ? void 0 : options.force) && result.length === 0 && storeChunks.length > 0) {
          actualWritten = storeChunks.length;
        }
        writeResult.processed.written = actualWritten;
        for (const chunk of storeChunks) {
          this.cacheChunk(chunk);
        }
        return writeResult;
      }
      async transaction(callback) {
        await this.initialised;
        await this.stabilised;
        this.concurrentTransactions++;
        try {
          const result = await callback();
          return result;
        } finally {
          this.concurrentTransactions--;
          if (this.concurrentTransactions === 0) {
            Logger(`All transactions completed. Performing stabilisation.`, LOG_LEVEL_VERBOSE);
            await this._stabilise();
          } else {
            Logger(`Transaction completed. Remaining: ${this.concurrentTransactions}`, LOG_LEVEL_VERBOSE);
          }
        }
      }
      async _stabilise() {
        const pr = promiseWithResolver();
        this.stabilised = pr.promise;
        try {
          await this.__stabilise();
        } finally {
          pr.resolve();
        }
      }
      __stabilise() {
        return Promise.resolve();
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/events/EventHub.js
var EventHub;
var init_EventHub = __esm({
  "node_modules/octagonal-wheels/dist/events/EventHub.js"() {
    init_polyfill();
    EventHub = class {
      /**
       * Creates an instance of the EventHub.
       * @param emitter - An optional EventTarget to use as the event emitter. If not provided, a dedicated new EventTarget will be created. i.e., it can share the same emitter with other EventHubs (e.g., for a global event bus, or separately built apps via window object).
       */
      constructor(emitter) {
        Object.defineProperty(this, "_emitter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_assigned", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        Object.defineProperty(this, "_allAssigned", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        this._emitter = emitter != null ? emitter : new EventTarget();
      }
      _issueSignal(key4, callback) {
        var _a6;
        let assigned = this._assigned.get(key4);
        if (assigned === void 0) {
          assigned = /* @__PURE__ */ new WeakMap();
        }
        const controllerRef = assigned.get(callback);
        let controller = controllerRef == null ? void 0 : controllerRef.deref();
        if (!controller || controller.signal.aborted) {
          controller = new AbortController();
          const refController = new FallbackWeakRef(controller);
          controller.signal.addEventListener("abort", () => {
            var _a7, _b4;
            (_a7 = this._assigned.get(key4)) == null ? void 0 : _a7.delete(callback);
            (_b4 = this._allAssigned.get(key4)) == null ? void 0 : _b4.delete(refController);
          }, { once: true });
          assigned.set(callback, refController);
          this._assigned.set(key4, assigned);
          const allAssigned = (_a6 = this._allAssigned.get(key4)) != null ? _a6 : /* @__PURE__ */ new Set();
          allAssigned.add(refController);
          this._allAssigned.set(key4, allAssigned);
          return controller;
        }
        return controller;
      }
      emitEvent(event2, data) {
        this._emitter.dispatchEvent(new CustomEvent(`${event2.toString()}`, { detail: data != null ? data : void 0 }));
      }
      on(event2, callback, options) {
        const onEvent = (e2) => void callback(e2, e2 instanceof CustomEvent ? e2 == null ? void 0 : e2.detail : void 0);
        const key4 = event2;
        const controller = this._issueSignal(key4, callback);
        this._emitter.addEventListener(key4, onEvent, { ...options, signal: controller.signal });
        return () => this.off(event2, callback);
      }
      /**
       * Removes an event listener for a specific event.
       * @param event
       * @param callback
       */
      off(event2, callback) {
        var _a6, _b4;
        const key4 = event2;
        if (callback) {
          const w2 = (_a6 = this._assigned.get(key4)) == null ? void 0 : _a6.get(callback);
          const controller = w2 == null ? void 0 : w2.deref();
          controller == null ? void 0 : controller.abort();
        } else {
          (_b4 = this._allAssigned.get(key4)) == null ? void 0 : _b4.forEach((w2) => {
            const controller = w2.deref();
            controller == null ? void 0 : controller.abort();
          });
        }
      }
      /**
       * Removes all event listeners.
       */
      offAll() {
        for (const [key4] of this._allAssigned) {
          this.off(key4);
        }
      }
      onEvent(event2, callback, options) {
        const onEvent = (e2) => void callback(e2 instanceof CustomEvent ? e2 == null ? void 0 : e2.detail : void 0);
        const key4 = event2;
        const controller = this._issueSignal(key4, callback);
        this._emitter.addEventListener(key4, onEvent, { ...options, signal: controller.signal });
        return () => this.off(event2, callback);
      }
      once(event2, callback) {
        return this.on(event2, callback, { once: true });
      }
      onceEvent(event2, callback) {
        return this.on(event2, (_, data) => callback(data), { once: true });
      }
      waitFor(event2) {
        return new Promise((resolve) => {
          this.onceEvent(event2, (data) => {
            resolve(data);
          });
        });
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/events/CustomEventTargets.js
var init_CustomEventTargets = __esm({
  "node_modules/octagonal-wheels/dist/events/CustomEventTargets.js"() {
  }
});

// node_modules/octagonal-wheels/dist/events.js
var init_events = __esm({
  "node_modules/octagonal-wheels/dist/events.js"() {
    init_EventHub();
    init_CustomEventTargets();
  }
});

// src/sync/core/hub/hub.ts
var eventHub;
var init_hub = __esm({
  "src/sync/core/hub/hub.ts"() {
    "use strict";
    init_events();
    eventHub = new EventHub();
  }
});

// src/sync/core/pouchdb/LiveSyncLocalDB.ts
function getNoFromRev(rev3) {
  if (!rev3) return 0;
  return parseInt(rev3.split("-")[0]);
}
var REMOTE_CHUNK_FETCHED, LiveSyncLocalDB;
var init_LiveSyncLocalDB = __esm({
  "src/sync/core/pouchdb/LiveSyncLocalDB.ts"() {
    "use strict";
    init_types();
    init_logger2();
    init_utils_couchdb();
    init_ChunkManager();
    init_hub();
    init_polyfill();
    REMOTE_CHUNK_FETCHED = "remote-chunk-fetched";
    LiveSyncLocalDB = class {
      constructor(dbname, env) {
        this.isReady = false;
        this.needScanning = false;
        this.auth = {
          username: "",
          password: ""
        };
        this.dbname = dbname;
        this.env = env;
        this.refreshSettings();
      }
      get managers() {
        return this.env.managers;
      }
      clearCaches() {
        this.managers.clearCaches();
      }
      async _prepareHashFunctions() {
        var _a6;
        await ((_a6 = this.managers) == null ? void 0 : _a6.prepareHashFunction());
      }
      onunload() {
        void this.env.services.databaseEvents.onUnloadDatabase(this);
        this.localDatabase.removeAllListeners();
      }
      refreshSettings() {
        const settings = this.env.getSettings();
        this.settings = settings;
        void this._prepareHashFunctions();
      }
      async close() {
        var _a6;
        Logger("Database closed (by close)");
        this.isReady = false;
        (_a6 = this.offRemoteChunkFetchedHandler) == null ? void 0 : _a6.call(this);
        if (this.localDatabase != null) {
          await this.localDatabase.close();
        }
        await this.env.services.databaseEvents.onUnloadDatabase(this);
      }
      onNewLeaf(chunk) {
        var _a6;
        (_a6 = this.managers.chunkManager) == null ? void 0 : _a6.emitEvent(EVENT_CHUNK_FETCHED, chunk);
      }
      async initializeDatabase() {
        await this._prepareHashFunctions();
        if (this.localDatabase != null) await this.localDatabase.close();
        this.localDatabase = null;
        this.localDatabase = this.env.services.database.createPouchDBInstance(
          this.dbname + SuffixDatabaseName,
          {
            auto_compaction: false,
            revs_limit: 100,
            deterministic_revs: true
          }
        );
        if (!await this.env.services.databaseEvents.onDatabaseInitialisation(this)) {
          Logger("Initializing Database has been failed on some module", LOG_LEVEL_NOTICE);
        }
        Logger("Opening Database...");
        Logger("Database info", LOG_LEVEL_VERBOSE);
        Logger(await this.localDatabase.info(), LOG_LEVEL_VERBOSE);
        await this.managers.initManagers();
        this.localDatabase.on("close", () => {
          var _a6;
          Logger("Database closed.");
          this.isReady = false;
          this.localDatabase.removeAllListeners();
          (_a6 = this.env.services.replicator.getActiveReplicator()) == null ? void 0 : _a6.closeReplication();
          void this.managers.teardownManagers();
        });
        const _instance2 = new FallbackWeakRef(this);
        const unload = eventHub.onEvent(REMOTE_CHUNK_FETCHED, (chunk) => {
          var _a6;
          if (_instance2.deref() == null) {
            unload();
          }
          (_a6 = _instance2.deref()) == null ? void 0 : _a6.onNewLeaf(chunk);
        });
        this.offRemoteChunkFetchedHandler = unload;
        this.isReady = true;
        Logger("Database is now ready.");
        return true;
      }
      /**
       * Retrieve all used and existing chunks in the database.
       * @param includeDeleted  include deleted chunks in the result.
       * @returns {used: Set<string>, existing: Map<string, EntryLeaf>} used: Set of chunk ids that are used in the database. existing: Map of chunk id and EntryLeaf that are existing in the database.
       */
      async allChunks(includeDeleted = false) {
        const used = /* @__PURE__ */ new Set();
        const existing = /* @__PURE__ */ new Map();
        let since = 0;
        do {
          const changes3 = await this.localDatabase.changes({
            since,
            limit: 100,
            include_docs: true,
            conflicts: true,
            style: includeDeleted ? "all_docs" : "main_only"
          });
          if (changes3.results.length == 0) {
            break;
          }
          for (const change of changes3.results) {
            const doc = change.doc;
            if (doc.type == "leaf") {
              if (doc._deleted) {
                if (!includeDeleted) {
                  continue;
                }
              }
              existing.set(doc._id, doc);
            }
            if ("children" in doc) {
              if (change.deleted) {
                if (!doc._conflicts || doc._conflicts.length == 0) {
                  continue;
                }
              }
              doc.children.forEach((e2) => used.add(e2));
              if (doc._conflicts) {
                const revs = await this.localDatabase.get(doc._id, { revs: true, revs_info: true });
                const mineRevInfo = revs._revs_info || [];
                const keepRevs = /* @__PURE__ */ new Set();
                for (const conflict of doc._conflicts) {
                  const conflictedRevs = await this.localDatabase.get(doc._id, {
                    rev: conflict,
                    revs: true,
                    revs_info: true
                  });
                  const conflictedRevInfo = conflictedRevs._revs_info || [];
                  const diffRevs = mineRevInfo.filter(
                    (e2) => !conflictedRevInfo.some((f3) => f3.rev == e2.rev && f3.status == e2.status)
                  );
                  const diffRevs2 = conflictedRevInfo.filter(
                    (e2) => !mineRevInfo.some((f3) => f3.rev == e2.rev && f3.status == e2.status)
                  );
                  const diffRevs3 = diffRevs.concat(diffRevs2);
                  const sameRevs = mineRevInfo.filter((e2) => conflictedRevInfo.some((f3) => f3.rev == e2.rev && f3.status == e2.status)).filter((e2) => e2.status == "available").sort((a, b) => getNoFromRev(b.rev) - getNoFromRev(a.rev));
                  const sameRevsTop = sameRevs.length > 0 ? [sameRevs[0].rev] : [];
                  const keepRevList = [
                    ...diffRevs3.filter((e2) => e2.status == "available").map((e2) => e2.rev),
                    ...sameRevsTop
                  ];
                  keepRevList.forEach((e2) => keepRevs.add(e2));
                }
                const detail = await this.localDatabase.bulkGet({
                  docs: [...keepRevs.values()].map((e2) => ({ id: doc._id, rev: e2 }))
                });
                for (const e2 of detail.results) {
                  if ("docs" in e2) {
                    const docs = e2.docs;
                    for (const doc2 of docs) {
                      if ("ok" in doc2) {
                        if ("children" in doc2.ok) {
                          doc2.ok.children.forEach((e3) => used.add(e3));
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          since = changes3.results[changes3.results.length - 1].seq;
        } while (true);
        return { used, existing };
      }
      async resetDatabase() {
        var _a6;
        await this.managers.teardownManagers();
        (_a6 = this.env.services.replicator.getActiveReplicator()) == null ? void 0 : _a6.closeReplication();
        if (!await this.env.services.databaseEvents.onResetDatabase(this)) {
          Logger("Database reset has been prevented or failed on some modules.", LOG_LEVEL_INFO);
          return false;
        }
        Logger("Database closed for reset Database.");
        this.isReady = false;
        await this.localDatabase.destroy();
        this.localDatabase = null;
        await this.initializeDatabase();
        Logger("Local Database Reset", LOG_LEVEL_INFO);
        return true;
      }
      async *findEntries(startKey, endKey, opt) {
        const pageLimit = 100;
        let nextKey = startKey;
        if (endKey == "") endKey = "\u{10FFFF}";
        let req = this.allDocsRaw({ limit: pageLimit, startkey: nextKey, endkey: endKey, include_docs: true, ...opt });
        do {
          const docs = await req;
          if (docs.rows.length === 0) {
            break;
          }
          nextKey = `${docs.rows[docs.rows.length - 1].id}`;
          req = this.allDocsRaw({
            limit: pageLimit,
            skip: 1,
            startkey: nextKey,
            endkey: endKey,
            include_docs: true,
            ...opt
          });
          for (const row of docs.rows) {
            const doc = row.doc;
            if (!("type" in doc)) {
              continue;
            }
            if (doc.type == "newnote" || doc.type == "plain") {
              yield doc;
            }
          }
        } while (nextKey != "");
      }
      async *findAllDocs(opt) {
        const targets = [
          () => this.findEntries("", "_", opt != null ? opt : {}),
          () => this.findEntries("_\u{10FFFF}", "h:", opt != null ? opt : {}),
          () => this.findEntries(`h:\u{10FFFF}`, "", opt != null ? opt : {})
        ];
        for (const targetFun of targets) {
          yield* targetFun();
        }
      }
      async *findEntryNames(startKey, endKey, opt) {
        const pageLimit = 100;
        let nextKey = startKey;
        if (endKey == "") endKey = "\u{10FFFF}";
        let req = this.allDocsRaw({ limit: pageLimit, startkey: nextKey, endkey: endKey, ...opt });
        do {
          const docs = await req;
          if (docs.rows.length == 0) {
            nextKey = "";
            break;
          }
          nextKey = `${docs.rows[docs.rows.length - 1].key}`;
          req = this.allDocsRaw({ limit: pageLimit, skip: 1, startkey: nextKey, endkey: endKey, ...opt });
          for (const row of docs.rows) {
            yield row.id;
          }
        } while (nextKey != "");
      }
      async *findAllDocNames(opt) {
        const targets = [
          () => this.findEntryNames("", "_", opt != null ? opt : {}),
          () => this.findEntryNames("_\u{10FFFF}", "h:", opt != null ? opt : {}),
          () => this.findEntryNames(`h:\u{10FFFF}`, "i:", opt != null ? opt : {}),
          () => this.findEntryNames(`i:\u{10FFFF}`, "ix:", opt != null ? opt : {}),
          () => this.findEntryNames(`ix:\u{10FFFF}`, "ps:", opt != null ? opt : {}),
          () => this.findEntryNames(`ps:\u{10FFFF}`, "", opt != null ? opt : {})
        ];
        for (const targetFun of targets) {
          const target = targetFun();
          for await (const f3 of target) {
            if (f3.startsWith("_")) continue;
            if (f3 == VERSIONING_DOCID) continue;
            yield f3;
          }
        }
      }
      async *findAllNormalDocs(opt) {
        const targets = [
          () => this.findEntries("", "_", opt != null ? opt : {}),
          () => this.findEntries("_\u{10FFFF}", "h:", opt != null ? opt : {}),
          () => this.findEntries(`h:\u{10FFFF}`, "i:", opt != null ? opt : {}),
          () => this.findEntries(`i:\u{10FFFF}`, "ix:", opt != null ? opt : {}),
          () => this.findEntries(`ix:\u{10FFFF}`, "ps:", opt != null ? opt : {}),
          () => this.findEntries(`ps:\u{10FFFF}`, "", opt != null ? opt : {})
        ];
        for (const targetFun of targets) {
          const target = targetFun();
          for await (const f3 of target) {
            if (f3._id.startsWith("_")) continue;
            if (f3.type != "newnote" && f3.type != "plain") continue;
            yield f3;
          }
        }
      }
      async removeRevision(docId, revision) {
        try {
          const doc = await this.localDatabase.get(docId, { rev: revision });
          doc._deleted = true;
          await this.localDatabase.put(doc);
          return true;
        } catch (ex) {
          if (isErrorOfMissingDoc(ex)) {
            Logger(`Remove revision: Missing target revision, ${docId}-${revision}`, LOG_LEVEL_VERBOSE);
          }
        }
        return false;
      }
      getRaw(docId, options) {
        return this.localDatabase.get(docId, options || {});
      }
      removeRaw(docId, revision, options) {
        return this.localDatabase.remove(docId, revision, options || {});
      }
      putRaw(doc, options) {
        return this.localDatabase.put(doc, options || {});
      }
      allDocsRaw(options) {
        return this.localDatabase.allDocs(options);
      }
      bulkDocsRaw(docs, options) {
        return this.localDatabase.bulkDocs(docs, options || {});
      }
      // For compatibility
      isTargetFile(filenameSrc) {
        return this.managers.entryManager.isTargetFile(filenameSrc);
      }
      async getDBEntryMeta(path8, opt, includeDeleted = false) {
        return await this.managers.entryManager.getDBEntryMeta(path8, opt, includeDeleted);
      }
      async getDBEntry(path8, opt, dump = false, waitForReady = true, includeDeleted = false) {
        return await this.managers.entryManager.getDBEntry(path8, opt, dump, waitForReady, includeDeleted);
      }
      async getDBEntryFromMeta(meta, dump = false, waitForReady = true) {
        return await this.managers.entryManager.getDBEntryFromMeta(meta, dump, waitForReady);
      }
      async deleteDBEntry(path8, opt) {
        return await this.managers.entryManager.deleteDBEntry(path8, opt);
      }
      async putDBEntry(note, onlyChunks) {
        return await this.managers.entryManager.putDBEntry(note, onlyChunks);
      }
      async getConflictedDoc(path8, rev3) {
        return await this.managers.conflictManager.getConflictedDoc(path8, rev3);
      }
      async tryAutoMerge(path8, enableMarkdownAutoMerge) {
        return await this.managers.conflictManager.tryAutoMerge(path8, enableMarkdownAutoMerge);
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/memory/LRUCache.js
var LRUCache;
var init_LRUCache = __esm({
  "node_modules/octagonal-wheels/dist/memory/LRUCache.js"() {
    init_logger();
    LRUCache = class {
      /**
       * Creates a new instance of the LRUCache class.
       * @param maxCache The maximum number of items to cache.
       * @param maxCacheLength The maximum length of the cached values.
       * @param forwardOnly True if we only need to cache forward values.
       */
      constructor(maxCache, maxCacheLength, forwardOnly = false) {
        Object.defineProperty(this, "cache", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map([])
        });
        Object.defineProperty(this, "revCache", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map([])
        });
        Object.defineProperty(this, "maxCache", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 200
        });
        Object.defineProperty(this, "maxCachedLength", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 5e7
        });
        Object.defineProperty(this, "cachedLength", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "enableReversed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: true
        });
        this.maxCache = maxCache || 200;
        this.maxCachedLength = (maxCacheLength || 1) * 1e6;
        this.enableReversed = !forwardOnly;
        Logger(`Cache initialized ${this.maxCache} / ${this.maxCachedLength}`, LOG_LEVEL_VERBOSE);
      }
      /**
       * Clears the cache.
       */
      clear() {
        this.cache.clear();
        this.revCache.clear();
      }
      /**
       * Checks if the cache contains the specified key.
       * @param key The key to check.
       * @returns A boolean indicating whether the cache contains the key.
       */
      has(key4) {
        return this.cache.has(key4);
      }
      /**
       * Gets the value associated with the specified key from the cache.
       * @param key The key to retrieve the value for.
       * @returns The value associated with the key, or undefined if the key is not found.
       * @remarks After calling this method, the key will be updated to recently used.
       */
      get(key4) {
        const v = this.cache.get(key4);
        if (v) {
          this.cache.delete(key4);
          this.cache.set(key4, v);
          if (this.enableReversed) {
            this.revCache.delete(v);
            this.revCache.set(v, key4);
          }
        }
        return v;
      }
      /**
       * Gets the key associated with the specified value from the cache.
       * @param value The value to retrieve the key for.
       * @returns The key associated with the value, or undefined if the value is not found.
       * @remarks After calling this method, the key will be updated to recently used.
       */
      revGet(value2) {
        const key4 = this.revCache.get(value2);
        if (key4) {
          this.cache.delete(key4);
          this.revCache.delete(value2);
          this.cache.set(key4, value2);
          this.revCache.set(value2, key4);
        }
        return key4;
      }
      /**
       * Sets the value associated with the specified key in the cache.
       * @param key The key to set the value for.
       * @param value The value to set.
       */
      set(key4, value2) {
        this.cache.set(key4, value2);
        if (this.enableReversed)
          this.revCache.set(value2, key4);
        this.cachedLength += `${value2}`.length;
        if (this.cache.size > this.maxCache || this.cachedLength > this.maxCachedLength) {
          for (const [key5, value3] of this.cache) {
            this.cache.delete(key5);
            if (this.enableReversed)
              this.revCache.delete(value3);
            this.cachedLength -= `${value3}`.length;
            if (this.cache.size <= this.maxCache && this.cachedLength <= this.maxCachedLength)
              break;
          }
        }
      }
    };
  }
});

// node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
  "node_modules/balanced-match/index.js"(exports2, module2) {
    "use strict";
    module2.exports = balanced;
    function balanced(a, b, str) {
      if (a instanceof RegExp) a = maybeMatch(a, str);
      if (b instanceof RegExp) b = maybeMatch(b, str);
      var r = range2(a, b, str);
      return r && {
        start: r[0],
        end: r[1],
        pre: str.slice(0, r[0]),
        body: str.slice(r[0] + a.length, r[1]),
        post: str.slice(r[1] + b.length)
      };
    }
    function maybeMatch(reg, str) {
      var m2 = str.match(reg);
      return m2 ? m2[0] : null;
    }
    balanced.range = range2;
    function range2(a, b, str) {
      var begs, beg, left, right, result;
      var ai = str.indexOf(a);
      var bi = str.indexOf(b, ai + 1);
      var i = ai;
      if (ai >= 0 && bi > 0) {
        if (a === b) {
          return [ai, bi];
        }
        begs = [];
        left = str.length;
        while (i >= 0 && !result) {
          if (i == ai) {
            begs.push(i);
            ai = str.indexOf(a, i + 1);
          } else if (begs.length == 1) {
            result = [begs.pop(), bi];
          } else {
            beg = begs.pop();
            if (beg < left) {
              left = beg;
              right = bi;
            }
            bi = str.indexOf(b, i + 1);
          }
          i = ai < bi && ai >= 0 ? ai : bi;
        }
        if (begs.length) {
          result = [left, right];
        }
      }
      return result;
    }
  }
});

// node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
  "node_modules/brace-expansion/index.js"(exports2, module2) {
    var balanced = require_balanced_match();
    module2.exports = expandTop;
    var escSlash = "\0SLASH" + Math.random() + "\0";
    var escOpen = "\0OPEN" + Math.random() + "\0";
    var escClose = "\0CLOSE" + Math.random() + "\0";
    var escComma = "\0COMMA" + Math.random() + "\0";
    var escPeriod = "\0PERIOD" + Math.random() + "\0";
    function numeric(str) {
      return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
    }
    function escapeBraces(str) {
      return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
    }
    function unescapeBraces(str) {
      return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
    }
    function parseCommaParts(str) {
      if (!str)
        return [""];
      var parts = [];
      var m2 = balanced("{", "}", str);
      if (!m2)
        return str.split(",");
      var pre = m2.pre;
      var body = m2.body;
      var post = m2.post;
      var p = pre.split(",");
      p[p.length - 1] += "{" + body + "}";
      var postParts = parseCommaParts(post);
      if (post.length) {
        p[p.length - 1] += postParts.shift();
        p.push.apply(p, postParts);
      }
      parts.push.apply(parts, p);
      return parts;
    }
    function expandTop(str) {
      if (!str)
        return [];
      if (str.substr(0, 2) === "{}") {
        str = "\\{\\}" + str.substr(2);
      }
      return expand2(escapeBraces(str), true).map(unescapeBraces);
    }
    function embrace(str) {
      return "{" + str + "}";
    }
    function isPadded(el) {
      return /^-?0\d/.test(el);
    }
    function lte(i, y) {
      return i <= y;
    }
    function gte(i, y) {
      return i >= y;
    }
    function expand2(str, isTop) {
      var expansions = [];
      var m2 = balanced("{", "}", str);
      if (!m2) return [str];
      var pre = m2.pre;
      var post = m2.post.length ? expand2(m2.post, false) : [""];
      if (/\$$/.test(m2.pre)) {
        for (var k = 0; k < post.length; k++) {
          var expansion = pre + "{" + m2.body + "}" + post[k];
          expansions.push(expansion);
        }
      } else {
        var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m2.body);
        var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m2.body);
        var isSequence = isNumericSequence || isAlphaSequence;
        var isOptions = m2.body.indexOf(",") >= 0;
        if (!isSequence && !isOptions) {
          if (m2.post.match(/,(?!,).*\}/)) {
            str = m2.pre + "{" + m2.body + escClose + m2.post;
            return expand2(str);
          }
          return [str];
        }
        var n3;
        if (isSequence) {
          n3 = m2.body.split(/\.\./);
        } else {
          n3 = parseCommaParts(m2.body);
          if (n3.length === 1) {
            n3 = expand2(n3[0], false).map(embrace);
            if (n3.length === 1) {
              return post.map(function(p) {
                return m2.pre + n3[0] + p;
              });
            }
          }
        }
        var N;
        if (isSequence) {
          var x = numeric(n3[0]);
          var y = numeric(n3[1]);
          var width = Math.max(n3[0].length, n3[1].length);
          var incr = n3.length == 3 ? Math.abs(numeric(n3[2])) : 1;
          var test = lte;
          var reverse = y < x;
          if (reverse) {
            incr *= -1;
            test = gte;
          }
          var pad2 = n3.some(isPadded);
          N = [];
          for (var i = x; test(i, y); i += incr) {
            var c;
            if (isAlphaSequence) {
              c = String.fromCharCode(i);
              if (c === "\\")
                c = "";
            } else {
              c = String(i);
              if (pad2) {
                var need = width - c.length;
                if (need > 0) {
                  var z = new Array(need + 1).join("0");
                  if (i < 0)
                    c = "-" + z + c.slice(1);
                  else
                    c = z + c;
                }
              }
            }
            N.push(c);
          }
        } else {
          N = [];
          for (var j = 0; j < n3.length; j++) {
            N.push.apply(N, expand2(n3[j], false));
          }
        }
        for (var j = 0; j < N.length; j++) {
          for (var k = 0; k < post.length; k++) {
            var expansion = pre + N[j] + post[k];
            if (!isTop || isSequence || expansion)
              expansions.push(expansion);
          }
        }
      }
      return expansions;
    }
  }
});

// node_modules/minimatch/dist/esm/assert-valid-pattern.js
var MAX_PATTERN_LENGTH, assertValidPattern;
var init_assert_valid_pattern = __esm({
  "node_modules/minimatch/dist/esm/assert-valid-pattern.js"() {
    MAX_PATTERN_LENGTH = 1024 * 64;
    assertValidPattern = (pattern) => {
      if (typeof pattern !== "string") {
        throw new TypeError("invalid pattern");
      }
      if (pattern.length > MAX_PATTERN_LENGTH) {
        throw new TypeError("pattern is too long");
      }
    };
  }
});

// node_modules/minimatch/dist/esm/brace-expressions.js
var posixClasses, braceEscape, regexpEscape, rangesToString, parseClass;
var init_brace_expressions = __esm({
  "node_modules/minimatch/dist/esm/brace-expressions.js"() {
    posixClasses = {
      "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
      "[:alpha:]": ["\\p{L}\\p{Nl}", true],
      "[:ascii:]": ["\\x00-\\x7f", false],
      "[:blank:]": ["\\p{Zs}\\t", true],
      "[:cntrl:]": ["\\p{Cc}", true],
      "[:digit:]": ["\\p{Nd}", true],
      "[:graph:]": ["\\p{Z}\\p{C}", true, true],
      "[:lower:]": ["\\p{Ll}", true],
      "[:print:]": ["\\p{C}", true],
      "[:punct:]": ["\\p{P}", true],
      "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
      "[:upper:]": ["\\p{Lu}", true],
      "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
      "[:xdigit:]": ["A-Fa-f0-9", false]
    };
    braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
    regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    rangesToString = (ranges) => ranges.join("");
    parseClass = (glob, position) => {
      const pos2 = position;
      if (glob.charAt(pos2) !== "[") {
        throw new Error("not in a brace expression");
      }
      const ranges = [];
      const negs = [];
      let i = pos2 + 1;
      let sawStart = false;
      let uflag = false;
      let escaping = false;
      let negate = false;
      let endPos = pos2;
      let rangeStart = "";
      WHILE: while (i < glob.length) {
        const c = glob.charAt(i);
        if ((c === "!" || c === "^") && i === pos2 + 1) {
          negate = true;
          i++;
          continue;
        }
        if (c === "]" && sawStart && !escaping) {
          endPos = i + 1;
          break;
        }
        sawStart = true;
        if (c === "\\") {
          if (!escaping) {
            escaping = true;
            i++;
            continue;
          }
        }
        if (c === "[" && !escaping) {
          for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
            if (glob.startsWith(cls, i)) {
              if (rangeStart) {
                return ["$.", false, glob.length - pos2, true];
              }
              i += cls.length;
              if (neg)
                negs.push(unip);
              else
                ranges.push(unip);
              uflag = uflag || u;
              continue WHILE;
            }
          }
        }
        escaping = false;
        if (rangeStart) {
          if (c > rangeStart) {
            ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
          } else if (c === rangeStart) {
            ranges.push(braceEscape(c));
          }
          rangeStart = "";
          i++;
          continue;
        }
        if (glob.startsWith("-]", i + 1)) {
          ranges.push(braceEscape(c + "-"));
          i += 2;
          continue;
        }
        if (glob.startsWith("-", i + 1)) {
          rangeStart = c;
          i += 2;
          continue;
        }
        ranges.push(braceEscape(c));
        i++;
      }
      if (endPos < i) {
        return ["", false, 0, false];
      }
      if (!ranges.length && !negs.length) {
        return ["$.", false, glob.length - pos2, true];
      }
      if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
        const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
        return [regexpEscape(r), false, endPos - pos2, false];
      }
      const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
      const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
      const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
      return [comb, uflag, endPos - pos2, true];
    };
  }
});

// node_modules/minimatch/dist/esm/unescape.js
var unescape2;
var init_unescape = __esm({
  "node_modules/minimatch/dist/esm/unescape.js"() {
    unescape2 = (s, { windowsPathsNoEscape = false } = {}) => {
      return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
    };
  }
});

// node_modules/minimatch/dist/esm/ast.js
var types, isExtglobType, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _AST, AST;
var init_ast = __esm({
  "node_modules/minimatch/dist/esm/ast.js"() {
    init_brace_expressions();
    init_unescape();
    types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
    isExtglobType = (c) => types.has(c);
    startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
    startNoDot = "(?!\\.)";
    addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
    justDots = /* @__PURE__ */ new Set(["..", "."]);
    reSpecials = new Set("().*{}+?[]^$\\!");
    regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    qmark = "[^/]";
    star = qmark + "*?";
    starNoEmpty = qmark + "+?";
    _AST = class _AST {
      constructor(type, parent, options = {}) {
        __privateAdd(this, _AST_instances);
        __publicField(this, "type");
        __privateAdd(this, _root);
        __privateAdd(this, _hasMagic);
        __privateAdd(this, _uflag, false);
        __privateAdd(this, _parts, []);
        __privateAdd(this, _parent);
        __privateAdd(this, _parentIndex);
        __privateAdd(this, _negs);
        __privateAdd(this, _filledNegs, false);
        __privateAdd(this, _options);
        __privateAdd(this, _toString);
        // set to true if it's an extglob with no children
        // (which really means one child of '')
        __privateAdd(this, _emptyExt, false);
        this.type = type;
        if (type)
          __privateSet(this, _hasMagic, true);
        __privateSet(this, _parent, parent);
        __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
        __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
        __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
        if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
          __privateGet(this, _negs).push(this);
        __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
      }
      get hasMagic() {
        if (__privateGet(this, _hasMagic) !== void 0)
          return __privateGet(this, _hasMagic);
        for (const p of __privateGet(this, _parts)) {
          if (typeof p === "string")
            continue;
          if (p.type || p.hasMagic)
            return __privateSet(this, _hasMagic, true);
        }
        return __privateGet(this, _hasMagic);
      }
      // reconstructs the pattern
      toString() {
        if (__privateGet(this, _toString) !== void 0)
          return __privateGet(this, _toString);
        if (!this.type) {
          return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
        } else {
          return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
        }
      }
      push(...parts) {
        for (const p of parts) {
          if (p === "")
            continue;
          if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
            throw new Error("invalid part: " + p);
          }
          __privateGet(this, _parts).push(p);
        }
      }
      toJSON() {
        var _a6;
        const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
        if (this.isStart() && !this.type)
          ret.unshift([]);
        if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a6 = __privateGet(this, _parent)) == null ? void 0 : _a6.type) === "!")) {
          ret.push({});
        }
        return ret;
      }
      isStart() {
        var _a6;
        if (__privateGet(this, _root) === this)
          return true;
        if (!((_a6 = __privateGet(this, _parent)) == null ? void 0 : _a6.isStart()))
          return false;
        if (__privateGet(this, _parentIndex) === 0)
          return true;
        const p = __privateGet(this, _parent);
        for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
          const pp = __privateGet(p, _parts)[i];
          if (!(pp instanceof _AST && pp.type === "!")) {
            return false;
          }
        }
        return true;
      }
      isEnd() {
        var _a6, _b4, _c2;
        if (__privateGet(this, _root) === this)
          return true;
        if (((_a6 = __privateGet(this, _parent)) == null ? void 0 : _a6.type) === "!")
          return true;
        if (!((_b4 = __privateGet(this, _parent)) == null ? void 0 : _b4.isEnd()))
          return false;
        if (!this.type)
          return (_c2 = __privateGet(this, _parent)) == null ? void 0 : _c2.isEnd();
        const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
        return __privateGet(this, _parentIndex) === pl - 1;
      }
      copyIn(part) {
        if (typeof part === "string")
          this.push(part);
        else
          this.push(part.clone(this));
      }
      clone(parent) {
        const c = new _AST(this.type, parent);
        for (const p of __privateGet(this, _parts)) {
          c.copyIn(p);
        }
        return c;
      }
      static fromGlob(pattern, options = {}) {
        var _a6;
        const ast = new _AST(null, void 0, options);
        __privateMethod(_a6 = _AST, _AST_static, parseAST_fn).call(_a6, pattern, ast, 0, options);
        return ast;
      }
      // returns the regular expression if there's magic, or the unescaped
      // string if not.
      toMMPattern() {
        if (this !== __privateGet(this, _root))
          return __privateGet(this, _root).toMMPattern();
        const glob = this.toString();
        const [re, body, hasMagic, uflag] = this.toRegExpSource();
        const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
        if (!anyMagic) {
          return body;
        }
        const flags2 = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
        return Object.assign(new RegExp(`^${re}$`, flags2), {
          _src: re,
          _glob: glob
        });
      }
      get options() {
        return __privateGet(this, _options);
      }
      // returns the string match, the regexp source, whether there's magic
      // in the regexp (so a regular expression is required) and whether or
      // not the uflag is needed for the regular expression (for posix classes)
      // TODO: instead of injecting the start/end at this point, just return
      // the BODY of the regexp, along with the start/end portions suitable
      // for binding the start/end in either a joined full-path makeRe context
      // (where we bind to (^|/), or a standalone matchPart context (where
      // we bind to ^, and not /).  Otherwise slashes get duped!
      //
      // In part-matching mode, the start is:
      // - if not isStart: nothing
      // - if traversal possible, but not allowed: ^(?!\.\.?$)
      // - if dots allowed or not possible: ^
      // - if dots possible and not allowed: ^(?!\.)
      // end is:
      // - if not isEnd(): nothing
      // - else: $
      //
      // In full-path matching mode, we put the slash at the START of the
      // pattern, so start is:
      // - if first pattern: same as part-matching mode
      // - if not isStart(): nothing
      // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
      // - if dots allowed or not possible: /
      // - if dots possible and not allowed: /(?!\.)
      // end is:
      // - if last pattern, same as part-matching mode
      // - else nothing
      //
      // Always put the (?:$|/) on negated tails, though, because that has to be
      // there to bind the end of the negated pattern portion, and it's easier to
      // just stick it in now rather than try to inject it later in the middle of
      // the pattern.
      //
      // We can just always return the same end, and leave it up to the caller
      // to know whether it's going to be used joined or in parts.
      // And, if the start is adjusted slightly, can do the same there:
      // - if not isStart: nothing
      // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
      // - if dots allowed or not possible: (?:/|^)
      // - if dots possible and not allowed: (?:/|^)(?!\.)
      //
      // But it's better to have a simpler binding without a conditional, for
      // performance, so probably better to return both start options.
      //
      // Then the caller just ignores the end if it's not the first pattern,
      // and the start always gets applied.
      //
      // But that's always going to be $ if it's the ending pattern, or nothing,
      // so the caller can just attach $ at the end of the pattern when building.
      //
      // So the todo is:
      // - better detect what kind of start is needed
      // - return both flavors of starting pattern
      // - attach $ at the end of the pattern when creating the actual RegExp
      //
      // Ah, but wait, no, that all only applies to the root when the first pattern
      // is not an extglob. If the first pattern IS an extglob, then we need all
      // that dot prevention biz to live in the extglob portions, because eg
      // +(*|.x*) can match .xy but not .yx.
      //
      // So, return the two flavors if it's #root and the first child is not an
      // AST, otherwise leave it to the child AST to handle it, and there,
      // use the (?:^|/) style of start binding.
      //
      // Even simplified further:
      // - Since the start for a join is eg /(?!\.) and the start for a part
      // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
      // or start or whatever) and prepend ^ or / at the Regexp construction.
      toRegExpSource(allowDot) {
        var _a6;
        const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
        if (__privateGet(this, _root) === this)
          __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
        if (!this.type) {
          const noEmpty = this.isStart() && this.isEnd();
          const src = __privateGet(this, _parts).map((p) => {
            var _a7;
            const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a7 = _AST, _AST_static, parseGlob_fn).call(_a7, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
            __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
            __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
            return re;
          }).join("");
          let start2 = "";
          if (this.isStart()) {
            if (typeof __privateGet(this, _parts)[0] === "string") {
              const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
              if (!dotTravAllowed) {
                const aps = addPatternStart;
                const needNoTrav = (
                  // dots are allowed, and the pattern starts with [ or .
                  dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
                  src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
                  src.startsWith("\\.\\.") && aps.has(src.charAt(4))
                );
                const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
                start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
              }
            }
          }
          let end = "";
          if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a6 = __privateGet(this, _parent)) == null ? void 0 : _a6.type) === "!") {
            end = "(?:$|\\/)";
          }
          const final2 = start2 + src + end;
          return [
            final2,
            unescape2(src),
            __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
            __privateGet(this, _uflag)
          ];
        }
        const repeated = this.type === "*" || this.type === "+";
        const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
        let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
        if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
          const s = this.toString();
          __privateSet(this, _parts, [s]);
          this.type = null;
          __privateSet(this, _hasMagic, void 0);
          return [s, unescape2(this.toString()), false, false];
        }
        let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
        if (bodyDotAllowed === body) {
          bodyDotAllowed = "";
        }
        if (bodyDotAllowed) {
          body = `(?:${body})(?:${bodyDotAllowed})*?`;
        }
        let final = "";
        if (this.type === "!" && __privateGet(this, _emptyExt)) {
          final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
        } else {
          const close = this.type === "!" ? (
            // !() must match something,but !(x) can match ''
            "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
          ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
          final = start + body + close;
        }
        return [
          final,
          unescape2(body),
          __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
          __privateGet(this, _uflag)
        ];
      }
    };
    _root = new WeakMap();
    _hasMagic = new WeakMap();
    _uflag = new WeakMap();
    _parts = new WeakMap();
    _parent = new WeakMap();
    _parentIndex = new WeakMap();
    _negs = new WeakMap();
    _filledNegs = new WeakMap();
    _options = new WeakMap();
    _toString = new WeakMap();
    _emptyExt = new WeakMap();
    _AST_instances = new WeakSet();
    fillNegs_fn = function() {
      if (this !== __privateGet(this, _root))
        throw new Error("should only call on root");
      if (__privateGet(this, _filledNegs))
        return this;
      this.toString();
      __privateSet(this, _filledNegs, true);
      let n3;
      while (n3 = __privateGet(this, _negs).pop()) {
        if (n3.type !== "!")
          continue;
        let p = n3;
        let pp = __privateGet(p, _parent);
        while (pp) {
          for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
            for (const part of __privateGet(n3, _parts)) {
              if (typeof part === "string") {
                throw new Error("string part in extglob AST??");
              }
              part.copyIn(__privateGet(pp, _parts)[i]);
            }
          }
          p = pp;
          pp = __privateGet(p, _parent);
        }
      }
      return this;
    };
    _AST_static = new WeakSet();
    parseAST_fn = function(str, ast, pos2, opt) {
      var _a6, _b4;
      let escaping = false;
      let inBrace = false;
      let braceStart = -1;
      let braceNeg = false;
      if (ast.type === null) {
        let i2 = pos2;
        let acc2 = "";
        while (i2 < str.length) {
          const c = str.charAt(i2++);
          if (escaping || c === "\\") {
            escaping = !escaping;
            acc2 += c;
            continue;
          }
          if (inBrace) {
            if (i2 === braceStart + 1) {
              if (c === "^" || c === "!") {
                braceNeg = true;
              }
            } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
              inBrace = false;
            }
            acc2 += c;
            continue;
          } else if (c === "[") {
            inBrace = true;
            braceStart = i2;
            braceNeg = false;
            acc2 += c;
            continue;
          }
          if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
            ast.push(acc2);
            acc2 = "";
            const ext2 = new _AST(c, ast);
            i2 = __privateMethod(_a6 = _AST, _AST_static, parseAST_fn).call(_a6, str, ext2, i2, opt);
            ast.push(ext2);
            continue;
          }
          acc2 += c;
        }
        ast.push(acc2);
        return i2;
      }
      let i = pos2 + 1;
      let part = new _AST(null, ast);
      const parts = [];
      let acc = "";
      while (i < str.length) {
        const c = str.charAt(i++);
        if (escaping || c === "\\") {
          escaping = !escaping;
          acc += c;
          continue;
        }
        if (inBrace) {
          if (i === braceStart + 1) {
            if (c === "^" || c === "!") {
              braceNeg = true;
            }
          } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
            inBrace = false;
          }
          acc += c;
          continue;
        } else if (c === "[") {
          inBrace = true;
          braceStart = i;
          braceNeg = false;
          acc += c;
          continue;
        }
        if (isExtglobType(c) && str.charAt(i) === "(") {
          part.push(acc);
          acc = "";
          const ext2 = new _AST(c, part);
          part.push(ext2);
          i = __privateMethod(_b4 = _AST, _AST_static, parseAST_fn).call(_b4, str, ext2, i, opt);
          continue;
        }
        if (c === "|") {
          part.push(acc);
          acc = "";
          parts.push(part);
          part = new _AST(null, ast);
          continue;
        }
        if (c === ")") {
          if (acc === "" && __privateGet(ast, _parts).length === 0) {
            __privateSet(ast, _emptyExt, true);
          }
          part.push(acc);
          acc = "";
          ast.push(...parts, part);
          return i;
        }
        acc += c;
      }
      ast.type = null;
      __privateSet(ast, _hasMagic, void 0);
      __privateSet(ast, _parts, [str.substring(pos2 - 1)]);
      return i;
    };
    partsToRegExp_fn = function(dot) {
      return __privateGet(this, _parts).map((p) => {
        if (typeof p === "string") {
          throw new Error("string type in extglob ast??");
        }
        const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
        __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
        return re;
      }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
    };
    parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
      let escaping = false;
      let re = "";
      let uflag = false;
      for (let i = 0; i < glob.length; i++) {
        const c = glob.charAt(i);
        if (escaping) {
          escaping = false;
          re += (reSpecials.has(c) ? "\\" : "") + c;
          continue;
        }
        if (c === "\\") {
          if (i === glob.length - 1) {
            re += "\\\\";
          } else {
            escaping = true;
          }
          continue;
        }
        if (c === "[") {
          const [src, needUflag, consumed, magic] = parseClass(glob, i);
          if (consumed) {
            re += src;
            uflag = uflag || needUflag;
            i += consumed - 1;
            hasMagic = hasMagic || magic;
            continue;
          }
        }
        if (c === "*") {
          if (noEmpty && glob === "*")
            re += starNoEmpty;
          else
            re += star;
          hasMagic = true;
          continue;
        }
        if (c === "?") {
          re += qmark;
          hasMagic = true;
          continue;
        }
        re += regExpEscape(c);
      }
      return [re, unescape2(glob), !!hasMagic, uflag];
    };
    __privateAdd(_AST, _AST_static);
    AST = _AST;
  }
});

// node_modules/minimatch/dist/esm/escape.js
var escape2;
var init_escape = __esm({
  "node_modules/minimatch/dist/esm/escape.js"() {
    escape2 = (s, { windowsPathsNoEscape = false } = {}) => {
      return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
    };
  }
});

// node_modules/minimatch/dist/esm/index.js
var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path2, sep, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
var init_esm = __esm({
  "node_modules/minimatch/dist/esm/index.js"() {
    import_brace_expansion = __toESM2(require_brace_expansion(), 1);
    init_assert_valid_pattern();
    init_ast();
    init_escape();
    init_unescape();
    init_ast();
    init_escape();
    init_unescape();
    minimatch = (p, pattern, options = {}) => {
      assertValidPattern(pattern);
      if (!options.nocomment && pattern.charAt(0) === "#") {
        return false;
      }
      return new Minimatch(pattern, options).match(p);
    };
    starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
    starDotExtTest = (ext2) => (f3) => !f3.startsWith(".") && f3.endsWith(ext2);
    starDotExtTestDot = (ext2) => (f3) => f3.endsWith(ext2);
    starDotExtTestNocase = (ext2) => {
      ext2 = ext2.toLowerCase();
      return (f3) => !f3.startsWith(".") && f3.toLowerCase().endsWith(ext2);
    };
    starDotExtTestNocaseDot = (ext2) => {
      ext2 = ext2.toLowerCase();
      return (f3) => f3.toLowerCase().endsWith(ext2);
    };
    starDotStarRE = /^\*+\.\*+$/;
    starDotStarTest = (f3) => !f3.startsWith(".") && f3.includes(".");
    starDotStarTestDot = (f3) => f3 !== "." && f3 !== ".." && f3.includes(".");
    dotStarRE = /^\.\*+$/;
    dotStarTest = (f3) => f3 !== "." && f3 !== ".." && f3.startsWith(".");
    starRE = /^\*+$/;
    starTest = (f3) => f3.length !== 0 && !f3.startsWith(".");
    starTestDot = (f3) => f3.length !== 0 && f3 !== "." && f3 !== "..";
    qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
    qmarksTestNocase = ([$0, ext2 = ""]) => {
      const noext = qmarksTestNoExt([$0]);
      if (!ext2)
        return noext;
      ext2 = ext2.toLowerCase();
      return (f3) => noext(f3) && f3.toLowerCase().endsWith(ext2);
    };
    qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
      const noext = qmarksTestNoExtDot([$0]);
      if (!ext2)
        return noext;
      ext2 = ext2.toLowerCase();
      return (f3) => noext(f3) && f3.toLowerCase().endsWith(ext2);
    };
    qmarksTestDot = ([$0, ext2 = ""]) => {
      const noext = qmarksTestNoExtDot([$0]);
      return !ext2 ? noext : (f3) => noext(f3) && f3.endsWith(ext2);
    };
    qmarksTest = ([$0, ext2 = ""]) => {
      const noext = qmarksTestNoExt([$0]);
      return !ext2 ? noext : (f3) => noext(f3) && f3.endsWith(ext2);
    };
    qmarksTestNoExt = ([$0]) => {
      const len = $0.length;
      return (f3) => f3.length === len && !f3.startsWith(".");
    };
    qmarksTestNoExtDot = ([$0]) => {
      const len = $0.length;
      return (f3) => f3.length === len && f3 !== "." && f3 !== "..";
    };
    defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
    path2 = {
      win32: { sep: "\\" },
      posix: { sep: "/" }
    };
    sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
    minimatch.sep = sep;
    GLOBSTAR = Symbol("globstar **");
    minimatch.GLOBSTAR = GLOBSTAR;
    qmark2 = "[^/]";
    star2 = qmark2 + "*?";
    twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
    twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
    filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
    minimatch.filter = filter;
    ext = (a, b = {}) => Object.assign({}, a, b);
    defaults = (def) => {
      if (!def || typeof def !== "object" || !Object.keys(def).length) {
        return minimatch;
      }
      const orig = minimatch;
      const m2 = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
      return Object.assign(m2, {
        Minimatch: class Minimatch extends orig.Minimatch {
          constructor(pattern, options = {}) {
            super(pattern, ext(def, options));
          }
          static defaults(options) {
            return orig.defaults(ext(def, options)).Minimatch;
          }
        },
        AST: class AST extends orig.AST {
          /* c8 ignore start */
          constructor(type, parent, options = {}) {
            super(type, parent, ext(def, options));
          }
          /* c8 ignore stop */
          static fromGlob(pattern, options = {}) {
            return orig.AST.fromGlob(pattern, ext(def, options));
          }
        },
        unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
        escape: (s, options = {}) => orig.escape(s, ext(def, options)),
        filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
        defaults: (options) => orig.defaults(ext(def, options)),
        makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
        braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
        match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
        sep: orig.sep,
        GLOBSTAR
      });
    };
    minimatch.defaults = defaults;
    braceExpand = (pattern, options = {}) => {
      assertValidPattern(pattern);
      if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
        return [pattern];
      }
      return (0, import_brace_expansion.default)(pattern);
    };
    minimatch.braceExpand = braceExpand;
    makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
    minimatch.makeRe = makeRe;
    match = (list, pattern, options = {}) => {
      const mm = new Minimatch(pattern, options);
      list = list.filter((f3) => mm.match(f3));
      if (mm.options.nonull && !list.length) {
        list.push(pattern);
      }
      return list;
    };
    minimatch.match = match;
    globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
    regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    Minimatch = class {
      constructor(pattern, options = {}) {
        __publicField(this, "options");
        __publicField(this, "set");
        __publicField(this, "pattern");
        __publicField(this, "windowsPathsNoEscape");
        __publicField(this, "nonegate");
        __publicField(this, "negate");
        __publicField(this, "comment");
        __publicField(this, "empty");
        __publicField(this, "preserveMultipleSlashes");
        __publicField(this, "partial");
        __publicField(this, "globSet");
        __publicField(this, "globParts");
        __publicField(this, "nocase");
        __publicField(this, "isWindows");
        __publicField(this, "platform");
        __publicField(this, "windowsNoMagicRoot");
        __publicField(this, "regexp");
        assertValidPattern(pattern);
        options = options || {};
        this.options = options;
        this.pattern = pattern;
        this.platform = options.platform || defaultPlatform;
        this.isWindows = this.platform === "win32";
        this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
        if (this.windowsPathsNoEscape) {
          this.pattern = this.pattern.replace(/\\/g, "/");
        }
        this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
        this.regexp = null;
        this.negate = false;
        this.nonegate = !!options.nonegate;
        this.comment = false;
        this.empty = false;
        this.partial = !!options.partial;
        this.nocase = !!this.options.nocase;
        this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
        this.globSet = [];
        this.globParts = [];
        this.set = [];
        this.make();
      }
      hasMagic() {
        if (this.options.magicalBraces && this.set.length > 1) {
          return true;
        }
        for (const pattern of this.set) {
          for (const part of pattern) {
            if (typeof part !== "string")
              return true;
          }
        }
        return false;
      }
      debug(..._) {
      }
      make() {
        const pattern = this.pattern;
        const options = this.options;
        if (!options.nocomment && pattern.charAt(0) === "#") {
          this.comment = true;
          return;
        }
        if (!pattern) {
          this.empty = true;
          return;
        }
        this.parseNegate();
        this.globSet = [...new Set(this.braceExpand())];
        if (options.debug) {
          this.debug = (...args) => console.error(...args);
        }
        this.debug(this.pattern, this.globSet);
        const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
        this.globParts = this.preprocess(rawGlobParts);
        this.debug(this.pattern, this.globParts);
        let set2 = this.globParts.map((s, _, __) => {
          if (this.isWindows && this.windowsNoMagicRoot) {
            const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
            const isDrive = /^[a-z]:/i.test(s[0]);
            if (isUNC) {
              return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
            } else if (isDrive) {
              return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
            }
          }
          return s.map((ss) => this.parse(ss));
        });
        this.debug(this.pattern, set2);
        this.set = set2.filter((s) => s.indexOf(false) === -1);
        if (this.isWindows) {
          for (let i = 0; i < this.set.length; i++) {
            const p = this.set[i];
            if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
              p[2] = "?";
            }
          }
        }
        this.debug(this.pattern, this.set);
      }
      // various transforms to equivalent pattern sets that are
      // faster to process in a filesystem walk.  The goal is to
      // eliminate what we can, and push all ** patterns as far
      // to the right as possible, even if it increases the number
      // of patterns that we have to process.
      preprocess(globParts) {
        if (this.options.noglobstar) {
          for (let i = 0; i < globParts.length; i++) {
            for (let j = 0; j < globParts[i].length; j++) {
              if (globParts[i][j] === "**") {
                globParts[i][j] = "*";
              }
            }
          }
        }
        const { optimizationLevel = 1 } = this.options;
        if (optimizationLevel >= 2) {
          globParts = this.firstPhasePreProcess(globParts);
          globParts = this.secondPhasePreProcess(globParts);
        } else if (optimizationLevel >= 1) {
          globParts = this.levelOneOptimize(globParts);
        } else {
          globParts = this.adjascentGlobstarOptimize(globParts);
        }
        return globParts;
      }
      // just get rid of adjascent ** portions
      adjascentGlobstarOptimize(globParts) {
        return globParts.map((parts) => {
          let gs = -1;
          while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
            let i = gs;
            while (parts[i + 1] === "**") {
              i++;
            }
            if (i !== gs) {
              parts.splice(gs, i - gs);
            }
          }
          return parts;
        });
      }
      // get rid of adjascent ** and resolve .. portions
      levelOneOptimize(globParts) {
        return globParts.map((parts) => {
          parts = parts.reduce((set2, part) => {
            const prev = set2[set2.length - 1];
            if (part === "**" && prev === "**") {
              return set2;
            }
            if (part === "..") {
              if (prev && prev !== ".." && prev !== "." && prev !== "**") {
                set2.pop();
                return set2;
              }
            }
            set2.push(part);
            return set2;
          }, []);
          return parts.length === 0 ? [""] : parts;
        });
      }
      levelTwoFileOptimize(parts) {
        if (!Array.isArray(parts)) {
          parts = this.slashSplit(parts);
        }
        let didSomething = false;
        do {
          didSomething = false;
          if (!this.preserveMultipleSlashes) {
            for (let i = 1; i < parts.length - 1; i++) {
              const p = parts[i];
              if (i === 1 && p === "" && parts[0] === "")
                continue;
              if (p === "." || p === "") {
                didSomething = true;
                parts.splice(i, 1);
                i--;
              }
            }
            if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
              didSomething = true;
              parts.pop();
            }
          }
          let dd = 0;
          while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
            const p = parts[dd - 1];
            if (p && p !== "." && p !== ".." && p !== "**") {
              didSomething = true;
              parts.splice(dd - 1, 2);
              dd -= 2;
            }
          }
        } while (didSomething);
        return parts.length === 0 ? [""] : parts;
      }
      // First phase: single-pattern processing
      // <pre> is 1 or more portions
      // <rest> is 1 or more portions
      // <p> is any portion other than ., .., '', or **
      // <e> is . or ''
      //
      // **/.. is *brutal* for filesystem walking performance, because
      // it effectively resets the recursive walk each time it occurs,
      // and ** cannot be reduced out by a .. pattern part like a regexp
      // or most strings (other than .., ., and '') can be.
      //
      // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
      // <pre>/<e>/<rest> -> <pre>/<rest>
      // <pre>/<p>/../<rest> -> <pre>/<rest>
      // **/**/<rest> -> **/<rest>
      //
      // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
      // this WOULD be allowed if ** did follow symlinks, or * didn't
      firstPhasePreProcess(globParts) {
        let didSomething = false;
        do {
          didSomething = false;
          for (let parts of globParts) {
            let gs = -1;
            while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
              let gss = gs;
              while (parts[gss + 1] === "**") {
                gss++;
              }
              if (gss > gs) {
                parts.splice(gs + 1, gss - gs);
              }
              let next2 = parts[gs + 1];
              const p = parts[gs + 2];
              const p2 = parts[gs + 3];
              if (next2 !== "..")
                continue;
              if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
                continue;
              }
              didSomething = true;
              parts.splice(gs, 1);
              const other = parts.slice(0);
              other[gs] = "**";
              globParts.push(other);
              gs--;
            }
            if (!this.preserveMultipleSlashes) {
              for (let i = 1; i < parts.length - 1; i++) {
                const p = parts[i];
                if (i === 1 && p === "" && parts[0] === "")
                  continue;
                if (p === "." || p === "") {
                  didSomething = true;
                  parts.splice(i, 1);
                  i--;
                }
              }
              if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
                didSomething = true;
                parts.pop();
              }
            }
            let dd = 0;
            while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
              const p = parts[dd - 1];
              if (p && p !== "." && p !== ".." && p !== "**") {
                didSomething = true;
                const needDot = dd === 1 && parts[dd + 1] === "**";
                const splin = needDot ? ["."] : [];
                parts.splice(dd - 1, 2, ...splin);
                if (parts.length === 0)
                  parts.push("");
                dd -= 2;
              }
            }
          }
        } while (didSomething);
        return globParts;
      }
      // second phase: multi-pattern dedupes
      // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
      // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
      // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
      //
      // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
      // ^-- not valid because ** doens't follow symlinks
      secondPhasePreProcess(globParts) {
        for (let i = 0; i < globParts.length - 1; i++) {
          for (let j = i + 1; j < globParts.length; j++) {
            const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
            if (matched) {
              globParts[i] = [];
              globParts[j] = matched;
              break;
            }
          }
        }
        return globParts.filter((gs) => gs.length);
      }
      partsMatch(a, b, emptyGSMatch = false) {
        let ai = 0;
        let bi = 0;
        let result = [];
        let which = "";
        while (ai < a.length && bi < b.length) {
          if (a[ai] === b[bi]) {
            result.push(which === "b" ? b[bi] : a[ai]);
            ai++;
            bi++;
          } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
            result.push(a[ai]);
            ai++;
          } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
            result.push(b[bi]);
            bi++;
          } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
            if (which === "b")
              return false;
            which = "a";
            result.push(a[ai]);
            ai++;
            bi++;
          } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
            if (which === "a")
              return false;
            which = "b";
            result.push(b[bi]);
            ai++;
            bi++;
          } else {
            return false;
          }
        }
        return a.length === b.length && result;
      }
      parseNegate() {
        if (this.nonegate)
          return;
        const pattern = this.pattern;
        let negate = false;
        let negateOffset = 0;
        for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
          negate = !negate;
          negateOffset++;
        }
        if (negateOffset)
          this.pattern = pattern.slice(negateOffset);
        this.negate = negate;
      }
      // set partial to true to test if, for example,
      // "/a/b" matches the start of "/*/b/*/d"
      // Partial means, if you run out of file before you run
      // out of pattern, then that's fine, as long as all
      // the parts match.
      matchOne(file, pattern, partial = false) {
        const options = this.options;
        if (this.isWindows) {
          const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
          const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
          const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
          const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
          const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
          const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
          if (typeof fdi === "number" && typeof pdi === "number") {
            const [fd2, pd] = [file[fdi], pattern[pdi]];
            if (fd2.toLowerCase() === pd.toLowerCase()) {
              pattern[pdi] = fd2;
              if (pdi > fdi) {
                pattern = pattern.slice(pdi);
              } else if (fdi > pdi) {
                file = file.slice(fdi);
              }
            }
          }
        }
        const { optimizationLevel = 1 } = this.options;
        if (optimizationLevel >= 2) {
          file = this.levelTwoFileOptimize(file);
        }
        this.debug("matchOne", this, { file, pattern });
        this.debug("matchOne", file.length, pattern.length);
        for (var fi = 0, pi = 0, fl2 = file.length, pl = pattern.length; fi < fl2 && pi < pl; fi++, pi++) {
          this.debug("matchOne loop");
          var p = pattern[pi];
          var f3 = file[fi];
          this.debug(pattern, p, f3);
          if (p === false) {
            return false;
          }
          if (p === GLOBSTAR) {
            this.debug("GLOBSTAR", [pattern, p, f3]);
            var fr = fi;
            var pr = pi + 1;
            if (pr === pl) {
              this.debug("** at the end");
              for (; fi < fl2; fi++) {
                if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
                  return false;
              }
              return true;
            }
            while (fr < fl2) {
              var swallowee = file[fr];
              this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
              if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
                this.debug("globstar found match!", fr, fl2, swallowee);
                return true;
              } else {
                if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
                  this.debug("dot detected!", file, fr, pattern, pr);
                  break;
                }
                this.debug("globstar swallow a segment, and continue");
                fr++;
              }
            }
            if (partial) {
              this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
              if (fr === fl2) {
                return true;
              }
            }
            return false;
          }
          let hit;
          if (typeof p === "string") {
            hit = f3 === p;
            this.debug("string match", p, f3, hit);
          } else {
            hit = p.test(f3);
            this.debug("pattern match", p, f3, hit);
          }
          if (!hit)
            return false;
        }
        if (fi === fl2 && pi === pl) {
          return true;
        } else if (fi === fl2) {
          return partial;
        } else if (pi === pl) {
          return fi === fl2 - 1 && file[fi] === "";
        } else {
          throw new Error("wtf?");
        }
      }
      braceExpand() {
        return braceExpand(this.pattern, this.options);
      }
      parse(pattern) {
        assertValidPattern(pattern);
        const options = this.options;
        if (pattern === "**")
          return GLOBSTAR;
        if (pattern === "")
          return "";
        let m2;
        let fastTest = null;
        if (m2 = pattern.match(starRE)) {
          fastTest = options.dot ? starTestDot : starTest;
        } else if (m2 = pattern.match(starDotExtRE)) {
          fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m2[1]);
        } else if (m2 = pattern.match(qmarksRE)) {
          fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m2);
        } else if (m2 = pattern.match(starDotStarRE)) {
          fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
        } else if (m2 = pattern.match(dotStarRE)) {
          fastTest = dotStarTest;
        }
        const re = AST.fromGlob(pattern, this.options).toMMPattern();
        if (fastTest && typeof re === "object") {
          Reflect.defineProperty(re, "test", { value: fastTest });
        }
        return re;
      }
      makeRe() {
        if (this.regexp || this.regexp === false)
          return this.regexp;
        const set2 = this.set;
        if (!set2.length) {
          this.regexp = false;
          return this.regexp;
        }
        const options = this.options;
        const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
        const flags2 = new Set(options.nocase ? ["i"] : []);
        let re = set2.map((pattern) => {
          const pp = pattern.map((p) => {
            if (p instanceof RegExp) {
              for (const f3 of p.flags.split(""))
                flags2.add(f3);
            }
            return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
          });
          pp.forEach((p, i) => {
            const next2 = pp[i + 1];
            const prev = pp[i - 1];
            if (p !== GLOBSTAR || prev === GLOBSTAR) {
              return;
            }
            if (prev === void 0) {
              if (next2 !== void 0 && next2 !== GLOBSTAR) {
                pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next2;
              } else {
                pp[i] = twoStar;
              }
            } else if (next2 === void 0) {
              pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
            } else if (next2 !== GLOBSTAR) {
              pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next2;
              pp[i + 1] = GLOBSTAR;
            }
          });
          return pp.filter((p) => p !== GLOBSTAR).join("/");
        }).join("|");
        const [open, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
        re = "^" + open + re + close + "$";
        if (this.negate)
          re = "^(?!" + re + ").+$";
        try {
          this.regexp = new RegExp(re, [...flags2].join(""));
        } catch (ex) {
          this.regexp = false;
        }
        return this.regexp;
      }
      slashSplit(p) {
        if (this.preserveMultipleSlashes) {
          return p.split("/");
        } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
          return ["", ...p.split(/\/+/)];
        } else {
          return p.split(/\/+/);
        }
      }
      match(f3, partial = this.partial) {
        this.debug("match", f3, this.pattern);
        if (this.comment) {
          return false;
        }
        if (this.empty) {
          return f3 === "";
        }
        if (f3 === "/" && partial) {
          return true;
        }
        const options = this.options;
        if (this.isWindows) {
          f3 = f3.split("\\").join("/");
        }
        const ff = this.slashSplit(f3);
        this.debug(this.pattern, "split", ff);
        const set2 = this.set;
        this.debug(this.pattern, "set", set2);
        let filename = ff[ff.length - 1];
        if (!filename) {
          for (let i = ff.length - 2; !filename && i >= 0; i--) {
            filename = ff[i];
          }
        }
        for (let i = 0; i < set2.length; i++) {
          const pattern = set2[i];
          let file = ff;
          if (options.matchBase && pattern.length === 1) {
            file = [filename];
          }
          const hit = this.matchOne(file, pattern, partial);
          if (hit) {
            if (options.flipNegate) {
              return true;
            }
            return !this.negate;
          }
        }
        if (options.flipNegate) {
          return false;
        }
        return this.negate;
      }
      static defaults(def) {
        return minimatch.defaults(def).Minimatch;
      }
    };
    minimatch.AST = AST;
    minimatch.Minimatch = Minimatch;
    minimatch.escape = escape2;
    minimatch.unescape = unescape2;
  }
});

// src/sync/core/mods.ts
async function getWebCrypto() {
  if (webcrypto) {
    return webcrypto;
  }
  if (globalThis.crypto) {
    webcrypto = globalThis.crypto;
    return webcrypto;
  } else {
    const module2 = await import("crypto");
    webcrypto = module2.webcrypto;
    return webcrypto;
  }
}
var webcrypto;
var init_mods = __esm({
  "src/sync/core/mods.ts"() {
    "use strict";
  }
});

// src/sync/core/string_and_binary/path.ts
function isFilePath(path8) {
  if (path8.indexOf(":") === -1) return true;
  return false;
}
function stripAllPrefixes(prefixedPath) {
  if (isFilePath(prefixedPath)) return prefixedPath;
  const [, body] = expandFilePathPrefix(prefixedPath);
  return stripAllPrefixes(body);
}
function addPrefix(path8, prefix) {
  if (prefix && path8.startsWith(prefix)) return path8;
  return `${prefix != null ? prefix : ""}${path8}`;
}
function expandFilePathPrefix(path8) {
  let [prefix, body] = path8.split(":", 2);
  if (!body) {
    body = prefix;
    prefix = "";
  } else {
    prefix = prefix + ":";
  }
  return [prefix, body];
}
function expandDocumentIDPrefix(id) {
  let [prefix, body] = id.split(":", 2);
  if (!body) {
    body = prefix;
    prefix = "";
  } else {
    prefix = prefix + ":";
  }
  return [prefix, body];
}
function hashString(key4) {
  return _hashString(key4);
}
async function path2id_base(filenameSrc, obfuscatePassphrase, caseInsensitive) {
  if (filenameSrc.startsWith(PREFIX_OBFUSCATED)) return `${filenameSrc}`;
  let filename = `${filenameSrc}`;
  const newPrefix = obfuscatePassphrase ? PREFIX_OBFUSCATED : "";
  if (caseInsensitive) {
    filename = filename.toLowerCase();
  }
  let x = filename;
  if (x.startsWith("_")) x = "/" + x;
  if (!obfuscatePassphrase) {
    return newPrefix + x;
  }
  const [prefix, body] = expandFilePathPrefix(x);
  if (body.startsWith(PREFIX_OBFUSCATED)) return newPrefix + x;
  const hashedPassphrase = await hashString(obfuscatePassphrase);
  const out = await hashString(`${hashedPassphrase}:${filename}`);
  return prefix + newPrefix + out;
}
function id2path_base(id, entry) {
  if (entry && (entry == null ? void 0 : entry.path)) {
    return id2path_base(entry.path);
  }
  if (id.startsWith(PREFIX_OBFUSCATED)) throw new Error("Entry has been obfuscated!");
  const [prefix, body] = expandDocumentIDPrefix(id);
  if (body.startsWith(PREFIX_OBFUSCATED)) throw new Error("Entry has been obfuscated!");
  if (body.startsWith("/")) {
    return body.substring(1);
  }
  return prefix + body;
}
function getPath(entry) {
  return id2path_base(entry._id, entry);
}
function shouldBeIgnored(filename) {
  if (filename == FLAGMD_REDFLAG) {
    return true;
  }
  if (filename == FLAGMD_REDFLAG2) {
    return true;
  }
  if (filename == FLAGMD_REDFLAG2_HR) {
    return true;
  }
  if (filename == FLAGMD_REDFLAG3) {
    return true;
  }
  if (filename == FLAGMD_REDFLAG3_HR) {
    return true;
  }
  if (filename.startsWith(PREFIXMD_LOGFILE)) {
    return true;
  }
  if (filename.startsWith(PREFIXMD_LOGFILE_UC)) {
    return true;
  }
  return false;
}
function isPlainText(filename) {
  if (filename.endsWith(".md")) return true;
  if (filename.endsWith(".txt")) return true;
  if (filename.endsWith(".svg")) return true;
  if (filename.endsWith(".html")) return true;
  if (filename.endsWith(".csv")) return true;
  if (filename.endsWith(".css")) return true;
  if (filename.endsWith(".js")) return true;
  if (filename.endsWith(".xml")) return true;
  if (filename.endsWith(".canvas")) return true;
  return false;
}
function shouldSplitAsPlainText(filename) {
  if (filename.endsWith(".md")) return true;
  if (filename.endsWith(".txt")) return true;
  if (filename.endsWith(".canvas")) return true;
  return false;
}
function isAccepted(path8, ignore) {
  if (path8.indexOf("./") !== -1 || path8.indexOf("../") !== -1) {
    return false;
  }
  const patterns = ignore.map((e2) => e2.trim()).filter((e2) => e2.length > 0 && !e2.startsWith("#"));
  let result = void 0;
  for (const pattern of patterns) {
    if (pattern.endsWith("/")) {
      if (minimatch(path8, `${pattern}**`, matchOpts)) {
        return false;
      }
    }
    const newResult = pattern.startsWith("!");
    const matched = minimatch(path8, pattern, matchOpts) || !pattern.endsWith("/") && minimatch(path8, pattern + "/**", matchOpts);
    if (matched) {
      result = newResult;
    }
  }
  return result;
}
var _hashString, matchOpts;
var init_path = __esm({
  "src/sync/core/string_and_binary/path.ts"() {
    "use strict";
    init_esm();
    init_mods();
    init_types();
    init_utils2();
    init_convert();
    init_collection();
    _hashString = memorizeFuncWithLRUCache(async (key4) => {
      const buff = writeString(key4);
      const webcrypto6 = await getWebCrypto();
      let digest = await webcrypto6.subtle.digest("SHA-256", buff);
      const len = key4.length;
      for (let i = 0; i < len; i++) {
        digest = await webcrypto6.subtle.digest("SHA-256", buff);
      }
      return uint8ArrayToHexString(new Uint8Array(digest));
    });
    matchOpts = { platform: "linux", dot: true, flipNegate: true, nocase: true };
  }
});

// node_modules/octagonal-wheels/dist/concurrency/semaphore_v2.js
function Semaphore(limit) {
  let counter = 0;
  const _limit = limit;
  const queue2 = [];
  const semaphore = {
    get waiting() {
      return queue2.length;
    },
    async tryAcquire(quantity = 1, timeout) {
      if (counter < _limit) {
        counter += quantity;
        return () => {
          this.release(quantity);
        };
      }
      const d = cancelableDelay(timeout, TIMED_OUT_SIGNAL);
      const aq = this.acquire(quantity);
      const p = await Promise.race([d.promise, aq]);
      if (p === TIMED_OUT_SIGNAL) {
        fireAndForget(() => aq.then((release) => release()));
        return false;
      }
      return p;
    },
    async acquire(quantity = 1) {
      if (counter < _limit) {
        counter += quantity;
        return () => this.release();
      }
      const n3 = promiseWithResolvers();
      queue2.push(n3);
      await n3.promise;
      return () => {
        this.release(quantity);
      };
    },
    release(quantity = 1) {
      if (queue2.length > 0) {
        const next2 = queue2.shift();
        if (next2) {
          fireAndForget(async () => await yieldMicrotask().then(() => next2.resolve()));
        }
      } else {
        if (counter > 0) {
          counter -= quantity;
        }
      }
    }
  };
  return semaphore;
}
var init_semaphore_v2 = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/semaphore_v2.js"() {
    init_promises();
  }
});

// node_modules/octagonal-wheels/dist/concurrency/semaphore.js
var init_semaphore = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/semaphore.js"() {
    init_semaphore_v2();
  }
});

// node_modules/octagonal-wheels/dist/bureau/SlipBoard.js
var SlipBoard, globalSlipBoard;
var init_SlipBoard = __esm({
  "node_modules/octagonal-wheels/dist/bureau/SlipBoard.js"() {
    init_promises();
    init_const();
    SlipBoard = class {
      constructor() {
        Object.defineProperty(this, "_clip", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
      }
      /**
       * Checks if a specific key is awaiting.
       *
       * @template ET - The type of the events.
       * @template K - The key of the event in the events type.
       * @param {SlipType<ET, K>} type - The key representing the event type.
       * @param {string} key - The key representing the specific sub-event.
       * @returns {boolean} - Returns `true` if the event and sub-event combination is awaiting, otherwise `false`.
       */
      isAwaiting(type, key4) {
        return this._clip.has(`${String(type)}:${key4}`);
      }
      /**
       * Issues a slip of process and proceeds with the provided options.
       *
       * @template T - The type of the result expected from the process.
       * @param {string} type - The type of the process to be issued.
       * @param {string} [key=""] - An optional key to identify the process.
       * @param {SlipProcessOptions<T>} opt - The options for the process, including the callback to be executed.
       * @returns {Promise<T>} - A promise that resolves with the result of the process.
       *
       * @remarks
       * - If the process is not already awaiting, it will be issued and the callback will be executed.
       * - If the callback succeeds, the result will be submitted.
       * - If the callback fails, the error handling depends on the options provided:
       *   - If `submitAsSuccess` is true, the error (or transformed error) will be submitted as a success.
       *   - If `dropSlipWithRisks` is true, the process will be deleted from the clip.
       *   - Otherwise, the error will be rejected.
       * - The method returns a promise that resolves with the next result of the process.
       */
      issueAndProceed(type, key4 = "", opt) {
        if (!this.isAwaiting(type, key4)) {
          fireAndForget(async () => {
            try {
              const ret = await opt.callback();
              this.submit(type, key4, ret);
            } catch (ex) {
              if (opt.submitAsSuccess) {
                this.submit(type, key4, opt.transformError ? opt.transformError(ex) : ex);
              } else {
                if (opt.dropSlipWithRisks) {
                  this._clip.delete(type);
                } else {
                  this.reject(type, key4, ex);
                }
              }
            }
          });
        }
        return this.awaitNext(type, key4);
      }
      /**
       * Waits for the next event of the specified type and key, with an optional timeout.
       *
       * @template ET - The type of the events.
       * @template K - The key of the event type.
       * @param {SlipType<ET, K>} type - The type of the event to wait for.
       * @param {string} [key=""] - The key associated with the event.
       * @param {number} [timeout] - The optional timeout in milliseconds.
       * @returns {Promise<void | ET[K] | TIMED_OUT_SIGNAL>} A promise that resolves with the event data,
       * resolves with `TIMED_OUT_SIGNAL` if the timeout is reached, or resolves to void if no event is found.
       */
      async awaitNext(type, key4 = "", { timeout, onNotAwaited } = { timeout: void 0, onNotAwaited: void 0 }) {
        let taskPromise = this._clip.get(`${String(type)}:${key4}`);
        if (!taskPromise) {
          taskPromise = promiseWithResolvers();
          taskPromise.promise = taskPromise.promise.then((ret) => {
            return ret;
          }).finally(() => {
            this._clip.delete(`${String(type)}:${key4}`);
          });
          this._clip.set(`${String(type)}:${key4}`, taskPromise);
          if (onNotAwaited) {
            fireAndForget(async () => (await yieldMicrotask(), onNotAwaited()));
          }
        }
        if (timeout) {
          const cDelay = cancelableDelay(timeout);
          return Promise.race([
            cDelay.promise,
            taskPromise.promise.then((ret) => ret).finally(() => cDelay.cancel())
          ]);
        }
        return await taskPromise.promise;
      }
      /**
       * Submits an event of a specified type with optional data.
       *
       * @template ET - The type of events.
       * @template K - The key of the event type in ET.
       * @param {SlipType<ET, K>} type - The type of the event to submit.
       * @param {string} [key=""] - An optional key associated with the event.
       * @param {SlipDataType<ET, K>} [data] - Optional data to be passed with the event.
       * @returns {void}
       */
      submit(type, key4, data) {
        const taskPromise = this._clip.get(`${String(type)}:${key4}`);
        if (taskPromise) {
          taskPromise.resolve(data);
        }
      }
      /**
       * Submits an event of a specified type to all listeners.
       *
       * @template ET - The type of events.
       * @template K - The key of the event type in ET.
       * @param {SlipType<ET, K>} type - The type of the event to submit.
       * @param {string} prefix - The prefix to match the keys of the listeners.
       * @param {SlipDataType<ET, K>} [data] - Optional data to be passed with the event.
       * @returns {void}
       */
      submitToAll(type, prefix, data) {
        for (const [key4, taskPromise] of this._clip.entries()) {
          if (`${String(key4)}`.startsWith(`${String(type)}:${prefix}`)) {
            taskPromise.resolve(data);
          }
        }
      }
      /**
       * Rejects a task promise associated with a specific event type and key.
       *
       * @template ET - The type of events.
       * @template K - The keys of the events.
       * @param {SlipType<ET, K>} type - The type of the event.
       * @param {string} [key=""] - The key associated with the event. Defaults to an empty string.
       * @param {any} reason - The reason for rejecting the promise.
       */
      reject(type, key4 = "", reason) {
        const taskPromise = this._clip.get(`${String(type)}:${key4}`);
        if (taskPromise) {
          taskPromise.reject(reason);
        }
      }
    };
    globalSlipBoard = new SlipBoard();
  }
});

// node_modules/octagonal-wheels/dist/messagepassing/signal.js
var init_signal = __esm({
  "node_modules/octagonal-wheels/dist/messagepassing/signal.js"() {
    init_SlipBoard();
  }
});

// node_modules/octagonal-wheels/dist/function.js
var init_function = __esm({
  "node_modules/octagonal-wheels/dist/function.js"() {
  }
});

// node_modules/octagonal-wheels/dist/number.js
function sizeToHumanReadable(size) {
  const units = ["B", "KB", "MB", "GB", "TB"];
  let i = 0;
  while (size >= 1024 && i < units.length) {
    size /= 1024;
    i++;
  }
  return size.toFixed(2) + units[i];
}
var init_number = __esm({
  "node_modules/octagonal-wheels/dist/number.js"() {
  }
});

// src/sync/core/common/utils.ts
function resolveWithIgnoreKnownError(p, def) {
  return new Promise((res2, rej) => {
    p.then(res2).catch((ex) => isErrorOfMissingDoc(ex) ? res2(def) : rej(ex));
  });
}
function getDocData(doc) {
  return typeof doc == "string" ? doc : doc.join("");
}
function getDocDataAsArray(doc) {
  return typeof doc == "string" ? [doc] : doc;
}
function isTextBlob(blob) {
  return blob.type === "text/plain";
}
function createTextBlob(data) {
  const d = Array.isArray(data) ? data : [data];
  return new Blob(d, { endings: "transparent", type: "text/plain" });
}
function createBinaryBlob(data) {
  return new Blob([data], { endings: "transparent", type: "application/octet-stream" });
}
function createBlob(data) {
  if (data instanceof Blob) return data;
  if (data instanceof Uint8Array || data instanceof ArrayBuffer) return createBinaryBlob(data);
  return createTextBlob(data);
}
function isTextDocument(doc) {
  if (doc.type == "plain") return true;
  if (doc.datatype == "plain") return true;
  if (isPlainText(doc.path)) return true;
  return false;
}
function readAsBlob(doc) {
  if (isTextDocument(doc)) {
    return createTextBlob(doc.data);
  } else {
    return createBinaryBlob(decodeBinary(doc.data));
  }
}
function readContent(doc) {
  if (isTextDocument(doc)) {
    return getDocData(doc.data);
  } else {
    return decodeBinary(doc.data);
  }
}
async function isDocContentSame(docA, docB) {
  const blob1 = createBlob(docA);
  const blob2 = createBlob(docB);
  if (blob1.size != blob2.size) return false;
  if (isIndexDBCmpExist) {
    return globalThis.indexedDB.cmp(await blob1.arrayBuffer(), await blob2.arrayBuffer()) === 0;
  }
  const checkQuantum = 1e4;
  const length = blob1.size;
  let i = 0;
  while (i < length) {
    const ab1 = await blob1.slice(i, i + checkQuantum).arrayBuffer();
    const ab2 = await blob2.slice(i, i + checkQuantum).arrayBuffer();
    i += checkQuantum;
    if (await arrayBufferToBase64Single(ab1) != await arrayBufferToBase64Single(ab2)) return false;
  }
  return true;
}
function isObfuscatedEntry(doc) {
  if (doc._id.startsWith(PREFIX_OBFUSCATED)) {
    return true;
  }
  return false;
}
function isEncryptedChunkEntry(doc) {
  if (doc._id.startsWith(PREFIX_ENCRYPTED_CHUNK)) {
    return true;
  }
  return false;
}
function isSyncInfoEntry(doc) {
  if (doc._id == SYNCINFO_ID) {
    return true;
  }
  return false;
}
function memorizeFuncWithLRUCache(func) {
  const cache = new LRUCache(100, 1e5, true);
  return (key4) => {
    const isExists = cache.has(key4);
    if (isExists) return cache.get(key4);
    const value2 = func(key4);
    cache.set(key4, value2);
    return value2;
  };
}
function determineTypeFromBlob(data) {
  return isTextBlob(data) ? "plain" : "newnote";
}
async function wrapException(func) {
  try {
    return await func();
  } catch (ex) {
    if (ex instanceof Error) {
      return ex;
    }
    return new Error(ex);
  }
}
function isSensibleMargeApplicable(path8) {
  if (path8.endsWith(".md")) return true;
  return false;
}
function isObjectMargeApplicable(path8) {
  if (path8.endsWith(".canvas")) return true;
  if (path8.endsWith(".json")) return true;
  return false;
}
function tryParseJSON(str, fallbackValue) {
  try {
    return JSON.parse(str);
  } catch (e2) {
    return fallbackValue;
  }
}
function unorderedArrayToObject(obj) {
  return obj.map((e2) => ({ [e2.id]: e2 })).reduce((p, c) => ({ ...p, ...c }), {});
}
function objectToUnorderedArray(obj) {
  const entries = Object.entries(obj);
  if (entries.some((e2) => {
    var _a6;
    return e2[0] != ((_a6 = e2[1]) == null ? void 0 : _a6.id);
  })) throw new Error("Item looks like not unordered array");
  return entries.map((e2) => e2[1]);
}
function generatePatchUnorderedArray(from, to) {
  if (from.every((e2) => typeof e2 == "object" && "id" in e2) && to.every((e2) => typeof e2 == "object" && "id" in e2)) {
    const fObj = unorderedArrayToObject(from);
    const tObj = unorderedArrayToObject(to);
    const diff = generatePatchObj(fObj, tObj);
    if (Object.keys(diff).length > 0) {
      return { [MARK_ISARRAY]: diff };
    } else {
      return {};
    }
  }
  return { [MARK_SWAPPED]: to };
}
function generatePatchObj(from, to) {
  const entries = Object.entries(from);
  const tempMap = new Map(entries);
  const ret = {};
  const newEntries = Object.entries(to);
  for (const [key4, value2] of newEntries) {
    if (!tempMap.has(key4)) {
      ret[key4] = value2;
      tempMap.delete(key4);
    } else {
      const v = tempMap.get(key4);
      if (typeof v !== typeof value2 || Array.isArray(v) !== Array.isArray(value2)) {
        ret[key4] = { [MARK_SWAPPED]: value2 };
      } else {
        if (v === null && value2 === null) {
        } else if (v === null && value2 !== null) {
          ret[key4] = { [MARK_SWAPPED]: value2 };
        } else if (v !== null && value2 === null) {
          ret[key4] = { [MARK_SWAPPED]: value2 };
        } else if (typeof v == "object" && typeof value2 == "object" && !Array.isArray(v) && !Array.isArray(value2)) {
          const wk2 = generatePatchObj(v, value2);
          if (Object.keys(wk2).length > 0) ret[key4] = wk2;
        } else if (typeof v == "object" && typeof value2 == "object" && Array.isArray(v) && Array.isArray(value2)) {
          const wk2 = generatePatchUnorderedArray(v, value2);
          if (Object.keys(wk2).length > 0) ret[key4] = wk2;
        } else if (typeof v != "object" && typeof value2 != "object") {
          if (JSON.stringify(tempMap.get(key4)) !== JSON.stringify(value2)) {
            ret[key4] = value2;
          }
        } else {
          if (JSON.stringify(tempMap.get(key4)) !== JSON.stringify(value2)) {
            ret[key4] = { [MARK_SWAPPED]: value2 };
          }
        }
      }
      tempMap.delete(key4);
    }
  }
  for (const [key4] of tempMap) {
    ret[key4] = MARK_DELETED;
  }
  return ret;
}
function applyPatch(from, patch) {
  const ret = from;
  const patches = Object.entries(patch);
  for (const [key4, value2] of patches) {
    if (value2 == MARK_DELETED) {
      delete ret[key4];
      continue;
    }
    if (value2 === null) {
      ret[key4] = null;
      continue;
    }
    if (typeof value2 == "object") {
      if (MARK_SWAPPED in value2) {
        ret[key4] = value2[MARK_SWAPPED];
        continue;
      }
      if (MARK_ISARRAY in value2) {
        if (!(key4 in ret)) ret[key4] = [];
        if (!Array.isArray(ret[key4])) {
          throw new Error("Patch target type is mismatched (array to something)");
        }
        const orgArrayObject = unorderedArrayToObject(ret[key4]);
        const appliedObject = applyPatch(orgArrayObject, value2[MARK_ISARRAY]);
        const appliedArray = objectToUnorderedArray(appliedObject);
        ret[key4] = [...appliedArray];
      } else {
        if (!(key4 in ret)) {
          ret[key4] = value2;
          continue;
        }
        ret[key4] = applyPatch(ret[key4], value2);
      }
    } else {
      ret[key4] = value2;
    }
  }
  return ret;
}
function flattenObject(obj, path8 = []) {
  if (typeof obj != "object") return [[path8.join("."), obj]];
  if (obj === null) return [[path8.join("."), null]];
  if (Array.isArray(obj)) return [[path8.join("."), JSON.stringify(obj)]];
  const e2 = Object.entries(obj);
  const ret = [];
  for (const [key4, value2] of e2) {
    const p = flattenObject(value2, [...path8, key4]);
    ret.push(...p);
  }
  return ret;
}
function parseHeaderValues(strHeader) {
  const headers = {};
  const lines = strHeader.split("\n");
  for (const line of lines) {
    const [key4, value2] = line.split(":", 2).map((e2) => e2.trim());
    if (key4 && value2) {
      headers[key4] = value2;
    }
  }
  return headers;
}
function parseCustomRegExp(regexp) {
  if (regexp.startsWith("!!")) {
    return [true, regexp.slice(2)];
  }
  return [false, regexp];
}
function parseCustomRegExpList(list, flags2, delimiter2) {
  const d = delimiter2 != null ? delimiter2 : ",";
  const items = list.replace(/\n| /g, "").split(d).filter((e2) => e2);
  return items.map((e2) => new CustomRegExp(e2, flags2));
}
function getFileRegExp(settings, key4) {
  const flagCase = settings.handleFilenameCaseSensitive ? "" : "i";
  if (key4 === "syncInternalFilesIgnorePatterns" || key4 === "syncInternalFilesTargetPatterns" || key4 === "syncInternalFileOverwritePatterns") {
    const regExp2 = settings[key4];
    return parseCustomRegExpList(regExp2, flagCase, ",");
  }
  const regExp = settings[key4];
  return parseCustomRegExpList(regExp, flagCase, "|[]|");
}
var _a2, isIndexDBCmpExist, globalConcurrencyController, MARK_OPERATOR, MARK_DELETED, MARK_ISARRAY, MARK_SWAPPED, CustomRegExp;
var init_utils2 = __esm({
  "src/sync/core/common/utils.ts"() {
    "use strict";
    init_LRUCache();
    init_path();
    init_semaphore();
    init_convert();
    init_types();
    init_utils_couchdb();
    init_string();
    init_binary();
    init_promises();
    init_collection();
    init_object();
    init_signal();
    init_function();
    init_number();
    isIndexDBCmpExist = typeof ((_a2 = globalThis == null ? void 0 : globalThis.indexedDB) == null ? void 0 : _a2.cmp) !== "undefined";
    globalConcurrencyController = Semaphore(50);
    MARK_OPERATOR = ``;
    MARK_DELETED = `${MARK_OPERATOR}__DELETED`;
    MARK_ISARRAY = `${MARK_OPERATOR}__ARRAY`;
    MARK_SWAPPED = `${MARK_OPERATOR}__SWAP`;
    CustomRegExp = class {
      constructor(regexp, flags2) {
        const [negate, exp] = parseCustomRegExp(regexp);
        this.pattern = exp;
        this.regexp = new RegExp(exp, flags2);
        this.negate = negate;
      }
      test(str) {
        return this.negate ? !this.regexp.test(str) : this.regexp.test(str);
      }
    };
  }
});

// src/sync/core/pouchdb/negotiation.ts
async function countCompromisedChunks(db) {
  try {
    Logger(`Counting compromised chunks...`, LOG_LEVEL_VERBOSE);
    const task1 = db.find(SELECTOR_COMPROMISED_CHUNK_1);
    const task2 = db.find(SELECTOR_COMPROMISED_CHUNK_2);
    const [result1, result2] = await Promise.all([task1, task2]);
    return result1.docs.length + result2.docs.length;
  } catch (ex) {
    Logger(`Error counting compromised chunks!`, LOG_LEVEL_INFO);
    Logger(ex, LOG_LEVEL_VERBOSE);
    return false;
  }
}
var checkRemoteVersion, bumpRemoteVersion, SELECTOR_COMPROMISED_CHUNK_1, SELECTOR_COMPROMISED_CHUNK_2;
var init_negotiation = __esm({
  "src/sync/core/pouchdb/negotiation.ts"() {
    "use strict";
    init_logger2();
    init_types();
    init_utils2();
    init_utils_couchdb();
    checkRemoteVersion = async (db, migrate, barrier = VER) => {
      try {
        const versionInfo = await db.get(VERSIONING_DOCID);
        if (versionInfo.type != "versioninfo") {
          return false;
        }
        const version2 = versionInfo.version;
        if (version2 < barrier) {
          const versionUpResult = await migrate(version2, barrier);
          if (versionUpResult) {
            await bumpRemoteVersion(db);
            return true;
          }
        }
        if (version2 == barrier) return true;
        return false;
      } catch (ex) {
        if (isErrorOfMissingDoc(ex)) {
          if (await bumpRemoteVersion(db)) {
            return true;
          }
          return false;
        }
        throw ex;
      }
    };
    bumpRemoteVersion = async (db, barrier = VER) => {
      const vi = {
        _id: VERSIONING_DOCID,
        version: barrier,
        type: "versioninfo"
        // pbkdf2salt: "", // this will be set later.
      };
      const versionInfo = await resolveWithIgnoreKnownError(db.get(VERSIONING_DOCID), vi);
      if (versionInfo.type != "versioninfo") {
        return false;
      }
      vi._rev = versionInfo._rev;
      await db.put(vi);
      return true;
    };
    SELECTOR_COMPROMISED_CHUNK_1 = {
      selector: {
        _id: {
          $lt: "h:"
        },
        type: "leaf"
      }
    };
    SELECTOR_COMPROMISED_CHUNK_2 = {
      selector: {
        _id: {
          $gt: "h;"
        },
        type: "leaf"
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/encryption/encryptionv3.js
var webcrypto2, SALT_STR, SALT, _nonceV3, bufV3;
var init_encryptionv3 = __esm({
  "node_modules/octagonal-wheels/dist/encryption/encryptionv3.js"() {
    init_base64();
    init_hex();
    webcrypto2 = globalThis.crypto;
    SALT_STR = "fancySyncForYou!";
    SALT = new TextEncoder().encode(SALT_STR);
    _nonceV3 = new Uint32Array(1);
    bufV3 = new Uint8Array(12);
  }
});

// node_modules/octagonal-wheels/dist/memory/memo.js
function memoWithMap(bufferLength, fn, keyFunction) {
  if (bufferLength <= 0) {
    throw new Error("Buffer length must be greater than 0");
  }
  const cache = /* @__PURE__ */ new Map();
  const getKey3 = (args) => {
    return args.length > 0 && typeof args[0] === "string" ? args[0] : JSON.stringify(args, (key4, value2) => value2 === void 0 ? UNDEFINED : value2);
  };
  return function(...args) {
    const key4 = keyFunction ? keyFunction(args) : getKey3(args);
    if (cache.has(key4)) {
      const hitPromise = cache.get(key4);
      cache.delete(key4);
      cache.set(key4, hitPromise);
      return hitPromise;
    }
    const newPromise = fn(...args);
    cache.set(key4, newPromise);
    newPromise.catch(() => {
      if (cache.get(key4) === newPromise) {
        cache.delete(key4);
      }
    });
    if (cache.size > bufferLength) {
      const oldestKey = cache.keys().next().value;
      if (oldestKey)
        cache.delete(oldestKey);
    }
    return newPromise;
  };
}
var UNDEFINED;
var init_memo = __esm({
  "node_modules/octagonal-wheels/dist/memory/memo.js"() {
    UNDEFINED = Symbol("undefined");
  }
});

// node_modules/octagonal-wheels/dist/encryption/hkdf.js
function createPBKDF2Salt() {
  return webcrypto3.getRandomValues(new Uint8Array(PBKDF2_SALT_LENGTH));
}
var webcrypto3, PBKDF2_ITERATIONS, PBKDF2_SALT_LENGTH, deriveMasterKey;
var init_hkdf = __esm({
  "node_modules/octagonal-wheels/dist/encryption/hkdf.js"() {
    init_base64();
    init_hex();
    init_collection();
    init_logger();
    init_memo();
    webcrypto3 = globalThis.crypto;
    PBKDF2_ITERATIONS = 31e4;
    PBKDF2_SALT_LENGTH = 32;
    deriveMasterKey = memoWithMap(10, async (passphrase, pbkdf2Salt) => {
      const binaryPassphrase = writeString(passphrase);
      const keyMaterial = await webcrypto3.subtle.importKey("raw", binaryPassphrase, {
        name: "PBKDF2",
        length: 256
        // Length of the key in bits
      }, false, ["deriveKey"]);
      const masterKeyRaw = await webcrypto3.subtle.deriveKey(
        {
          name: "PBKDF2",
          salt: pbkdf2Salt,
          iterations: PBKDF2_ITERATIONS,
          hash: "SHA-256"
        },
        keyMaterial,
        // Output the "raw" key
        { name: "AES-GCM", length: 256 },
        true,
        // extractable
        ["encrypt", "decrypt"]
        // The master key is used for encryption/decryption
      );
      const masterKeyBuffer = await webcrypto3.subtle.exportKey("raw", masterKeyRaw);
      const hkdfKey = await webcrypto3.subtle.importKey("raw", masterKeyBuffer, { name: "HKDF" }, false, [
        "deriveKey"
      ]);
      return hkdfKey;
    }, ([passphrase, salt]) => {
      return `${passphrase}-${uint8ArrayToHexString(salt)}`;
    });
  }
});

// node_modules/octagonal-wheels/dist/encryption/obfuscatePath.js
async function obfuscatePath(path8, passphrase, autoCalculateIterations) {
  const dataBuf = writeString(path8);
  const [key4, salt, iv] = await getKeyForObfuscatePath(passphrase, dataBuf, autoCalculateIterations);
  const encryptedDataArrayBuffer = await webcrypto4.subtle.encrypt({
    name: "AES-GCM",
    iv
  }, key4, dataBuf);
  const encryptedData2 = await arrayBufferToBase64Single(new Uint8Array(encryptedDataArrayBuffer));
  const ret = `%${uint8ArrayToHexString(iv)}${uint8ArrayToHexString(salt)}${encryptedData2}`;
  return ret;
}
function isPathProbablyObfuscated(path8) {
  return path8.startsWith("%") && path8.length > 64;
}
async function getKeyForObfuscatePath(passphrase, dataBuf, autoCalculateIterations) {
  const passphraseLen = 15 - passphrase.length;
  const iteration = autoCalculateIterations ? (passphraseLen > 0 ? passphraseLen : 0) * 1e3 + 121 - passphraseLen : 1e5;
  const passphraseBin = new TextEncoder().encode(passphrase);
  const digest = await webcrypto4.subtle.digest({ name: "SHA-256" }, passphraseBin);
  const buf2 = new Uint8Array(await webcrypto4.subtle.digest({ name: "SHA-256" }, new Uint8Array([...dataBuf, ...passphraseBin])));
  const salt = buf2.slice(0, 16);
  const iv = buf2.slice(16, 32);
  const keyMaterial = await webcrypto4.subtle.importKey("raw", digest, { name: "PBKDF2" }, false, ["deriveKey"]);
  const key4 = await webcrypto4.subtle.deriveKey({
    name: "PBKDF2",
    salt,
    iterations: iteration,
    hash: "SHA-256"
  }, keyMaterial, { name: "AES-GCM", length: 256 }, false, ["encrypt"]);
  return [key4, salt, iv];
}
var webcrypto4;
var init_obfuscatePath = __esm({
  "node_modules/octagonal-wheels/dist/encryption/obfuscatePath.js"() {
    init_base64();
    init_hex();
    webcrypto4 = globalThis.crypto;
  }
});

// node_modules/octagonal-wheels/dist/encryption/encryption.js
var KEY_RECYCLE_COUNT, nonceBuffer, webcrypto5, keyGCCount;
var init_encryption = __esm({
  "node_modules/octagonal-wheels/dist/encryption/encryption.js"() {
    init_binary();
    init_base64();
    init_hex();
    init_logger();
    init_encryptionv3();
    init_hkdf();
    init_obfuscatePath();
    KEY_RECYCLE_COUNT = 100;
    nonceBuffer = new Uint32Array(1);
    webcrypto5 = globalThis.crypto;
    keyGCCount = KEY_RECYCLE_COUNT * 5;
  }
});

// inline-worker:__inline-worker
function inlineWorker(scriptText) {
  let blob = new Blob([scriptText], { type: "text/javascript" });
  let url = URL.createObjectURL(blob);
  let worker = new Worker(url);
  URL.revokeObjectURL(url);
  return worker;
}
var init_inline_worker = __esm({
  "inline-worker:__inline-worker"() {
  }
});

// src/sync/core/worker/bg.worker.ts?worker
function Worker2() {
  return inlineWorker('var C=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),rt=e=>{throw TypeError(e)};var K=function(e,t){this[0]=e,this[1]=t},G=(e,t,n)=>{var r=(i,s,c,y)=>{try{var u=n[i](s),l=(s=u.value)instanceof K,A=u.done;Promise.resolve(l?s[0]:s).then(g=>l?r(i==="return"?i:"next",s[1]?{done:g.done,value:g.value}:g,c,y):c({value:g,done:A})).catch(g=>r("throw",g,c,y))}catch(g){y(g)}},o=i=>a[i]=s=>new Promise((c,y)=>r(i,s,c,y)),a={};return n=n.apply(e,t),a[C("asyncIterator")]=()=>a,o("next"),o("throw"),o("return"),a},S=e=>{var t=e[C("asyncIterator")],n=!1,r,o={};return t==null?(t=e[C("iterator")](),r=a=>o[a]=i=>t[a](i)):(t=t.call(e),r=a=>o[a]=i=>{if(n){if(n=!1,a==="throw")throw i;return i}return n=!0,{done:!1,value:new K(new Promise(s=>{var c=t[a](i);c instanceof Object||rt("Object expected"),s(c)}),1)}}),o[C("iterator")]=()=>o,r("next"),"throw"in t?r("throw"):o.throw=a=>{throw a},"return"in t&&r("return"),o},Q=(e,t,n)=>(t=e[C("asyncIterator")])?t.call(e):(e=e[C("iterator")](),t={},n=(r,o)=>(o=e[r])&&(t[r]=a=>new Promise((i,s,c)=>(a=o.call(e,a),c=a.done,Promise.resolve(a.value).then(y=>i({value:y,done:c}),s)))),n("next"),n("return"),t);var nt={minLogLevel:32},ot=function(t,n=32,r){if(n<nt.minLogLevel)return;let a=new Date().toLocaleString(),i=typeof t=="string"?t:t instanceof Error?`${t.name}:${t.message}`:JSON.stringify(t,null,2),s=`${a}	${n}	${i}`;n&1?console.debug(s):n&4?console.warn(s):n&8?console.error(s):n&2?console.info(s):console.log(s),t instanceof Error&&console.dir(t.stack)},at=ot;function T(e,t,n){at(e,t,n)}var de=typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.toBase64=="function"&&typeof Uint8Array.fromBase64=="function";function ge(e){if(e.length===0)return new ArrayBuffer(0);try{if(typeof e=="string")return Uint8Array.fromBase64(e).buffer;let t=e.map(a=>Uint8Array.fromBase64(a).buffer),n=t.reduce((a,i)=>a+i.byteLength,0),r=new Uint8Array(n),o=0;return t.forEach(a=>{r.set(new Uint8Array(a),o),o+=a.byteLength}),r.buffer}catch(t){return T("Base64 Decode error",16),T(t,16),new ArrayBuffer(0)}}function he(e){if(typeof e=="string")return O(e);let t=e.map(a=>O(a)),n=t.reduce((a,i)=>a+i.byteLength,0),r=new Uint8Array(n),o=0;return t.forEach(a=>{r.set(new Uint8Array(a),o),o+=a.byteLength}),r.buffer}var v=de?ge:he;function O(e){try{let t=globalThis.atob(e),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.charCodeAt(o);return r.buffer}catch(t){return T("Base64 Decode error",16),T(t,16),new ArrayBuffer(0)}}var wr=3*5e7;function it(e){return new Promise((t,n)=>{let r=new Blob([e],{type:"application/octet-binary"}),o=new FileReader;o.onload=function(a){var c,y;let i=((y=(c=a.target)==null?void 0:c.result)==null?void 0:y.toString())||"";if(e.byteLength!=0&&(i==""||i=="data:"))return n(new TypeError("Could not parse the encoded string"));let s=i.substring(i.indexOf(",")+1);t(s)},o.readAsDataURL(r)})}async function we(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return t.byteLength<Ae?btoa(String.fromCharCode.apply(null,[...t])):await it(t)}function me(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return Promise.resolve(t.toBase64())}var m=de?me:we;var Ae=32768,st=new TextEncoder,ct=new TextDecoder;function E(e){if(e.length>128)return st.encode(e);let t=new Uint8Array(e.length*4),n=e.length,r=0,o=0,a=0;for(;a<n;)o=e.charCodeAt(a++),o<128?t[r++]=o:o<2048?(t[r++]=192|o>>>6,t[r++]=128|o&63):o<55296||o>57343?(t[r++]=224|o>>>12,t[r++]=128|o>>>6&63,t[r++]=128|o&63):(o=(o-55296<<10|e.charCodeAt(a++)-56320)+65536,t[r++]=240|o>>>18,t[r++]=128|o>>>12&63,t[r++]=128|o>>>6&63,t[r++]=128|o&63);return t.slice(0,r)}function b(e){let t=e.length;if(t>128)return ct.decode(e);let n=0,r=t,o="";for(;n<r;){let a=[],i=Math.min(n+Ae,r);for(;n<i;){let s=e[n++];if(s<128)a.push(s);else if((s&224)===192)a.push((s&31)<<6|e[n++]&63);else if((s&240)===224)a.push((s&15)<<12|(e[n++]&63)<<6|e[n++]&63);else if((s&248)===240){let c=(s&7)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63;c<65536?a.push(c):(c-=65536,a.push((c>>>10)+55296,(c&1023)+56320))}}o+=String.fromCharCode(...a)}return o}function*Ee(e,t){for(let n=e;n<=t;n++)yield n}var br=1024*1024*30,yt={},be={};[...Ee(192,447)].forEach((e,t)=>{yt[t]=e,be[e]=t});function ee(e){if(e.length==1)return F(e[0]);let t=e.map(a=>F(a)),n=t.reduce((a,i)=>a+i.byteLength,0),r=new Uint8Array(n),o=0;return t.forEach(a=>{r.set(new Uint8Array(a),o),o+=a.byteLength}),r.buffer}function F(e){let t=new Uint8Array(e.length),n=e.length;for(let r=0;r<n;r++){let o=e.charCodeAt(r);o>=38&&o<=126&&o!=58?t[r]=o:t[r]=be[o]}return t.buffer}var Be={},xe={};for(let e=0;e<256;e++)Be[`00${e.toString(16)}`.slice(-2)]=e,xe[e]=`00${e.toString(16)}`.slice(-2);var Se=typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.toBase64=="function"&&typeof Uint8Array.fromBase64=="function",P=Se?Te:Le;function Te(e){return Uint8Array.fromHex(e)}function Le(e){let t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=Be[e[r*2]+e[r*2+1]];return n}var x=Se?Ke:_e;function _e(e){return[...e].map(t=>xe[t]).join("")}function Ke(e){return e.toHex()}function te(e){if(e.length==0)return new Uint8Array().buffer;if(typeof e=="string"){if(e[0]==="%")return F(e.substring(1))}else if(e[0][0]==="%"){let[t,...n]=e;return ee([t.substring(1),...n])}return v(e)}function M(e){return e.type==="text/plain"}function*pt(e,t){let n="";e:do{let r=e.shift();if(typeof r=="undefined"){yield n;break e}if(r.startsWith("```")||r.startsWith(" ```")||r.startsWith("  ```")||r.startsWith("   ```")){yield n,n=r+(e.length!=0?`\n`:"");t:do{let s=e.shift();if(typeof s=="undefined")break t;n+=s+(e.length!=0?`\n`:"")}while(e.length>0&&!(e[0].startsWith("```")||e[0].startsWith(" ```")||e[0].startsWith("  ```")||e[0].startsWith("   ```")));let o=n.endsWith("="),a=n.length>2048,i=e.shift();if(typeof i!="undefined"&&(n+=i,n+=e.length!=0?`\n`:""),!o&&!a){let s=/(.*?[;,:<])/g,c=n.split(s).filter(y=>y!="");for(let y of c)yield y}else yield n;n=""}else n+=r+(e.length!=0?`\n`:""),(n.length>=t||e.length==0||e[0]=="#"||n[0]=="#")&&(yield n,n="")}while(e.length>0)}var De=10,Ue="Segmenter"in Intl?new Intl.Segmenter(navigator.language,{granularity:"sentence"}):void 0;function*k(e,t){let n=e;do{let r=t,o=n.substring(0,r);n=n.substring(r),yield o}while(n!="")}function*Pe(e,t,n){let r=Ue.segment(e),o="",a="";for(let i of r){let s=i.segment;o==s||a.length<n?(a+=s,o=s):(o=s,a.length>0&&(yield*S(k(a,t))),a=s)}a.length>0&&(yield*S(k(a,t)))}function*dt(e){for(let t of e){let n=-1,r=-1;do{if(r=t.indexOf(`\n`,n),r==-1){yield t.substring(n);break}for(;t[r]==`\n`;)r++;yield t.substring(n,r),n=r}while(r!=-1)}}function gt(e,t,n){let o=dt(typeof e=="string"?[e]:e),a=0,i=!1,s=!1;return function*(){let c=[];for(let y of o)y.startsWith("````")?a==0?(a=4,s=!0):a==4&&(a=0,i=!0):y.startsWith("```")&&(a==0?(a=3,s=!0):a==3&&(a=0,i=!0)),s&&(c.length>0&&(yield*S(Pe(c.join(""),t,n)),c.length=0),s=!1),c.push(y),i&&(c.length>0&&(yield*S(k(c.join(""),t)),c.length=0),i=!1);c.length>0&&(a==0?yield*S(Pe(c.join(""),t,n)):yield*S(k(c.join(""),t)))}}function ht(e,t,n){return function*(){yield*S(k(e,t))}}function wt(e,t,n,r,o){return!o||!Ue?mt(e,t,n,r):n?gt(e,t,r):ht(e,t,r)}function mt(e,t,n,r){let o=typeof e=="string"?[e]:e;return function*(){for(let i of o)if(n){let s=i.split(`\n`),c=pt(s,r);for(let y of c){let u=y;do{let l=t;u.charCodeAt(l-1)!=u.codePointAt(l-1)&&l++,yield u.substring(0,l),u=u.substring(l)}while(u!="")}}else{let s=i;do{let c=t,y=s.substring(0,c);s=s.substring(c),yield y}while(s!="")}}}function*At(e,t,n=25,r){let o="",a=!1,i=t.length;for(let s of e){let c=s.length;if(r&&c>r){yield o+s,a=!1,o="";continue}let y=-1,u=0;e:do{if(y=s.indexOf(t,u),y==-1)break e;o+=s.slice(u,y)+t,o.length>n?(yield o,o="",a=!1):a=!0,u=y+i}while(y<c);(u!=y||u==-1&&y==-1)&&(o+=s.slice(u),a=!0)}a&&(yield o)}function*ve(e,t){let n=e.length;if(n>t){let r=0;do{let o=r+t;if(o>n){yield e.substring(r);break}for(;e.charCodeAt(o-1)!=e.codePointAt(o-1);)o++;yield e.substring(r,o),r=o}while(r<n)}else yield e}function*Et(e,t){for(let n of e)yield*S(ve(n,t))}function*bt(e){for(let t of e)yield t}var Bt=100;async function Ce(e,t,n,r,o,a){if(e.size==0)return function*(){};if(M(e)){let g=await e.text();if(!n){let d=ve(g,t);return function*(){yield*S(d)}}let U=g.length,f=r;for(;U/f>Bt;)f+=r;let B=bt([g]),h=At(B,`\n`,f),p=Et(h,t);return function*(){yield*S(p)}}let i=!1,s=0;o&&o.endsWith(".pdf")?s=47:o&&o.endsWith(".json")&&(i=!0,s=44);let u=Math.max(i?100:1e5,Math.min(1e8,e.size)),l=1,A=u;for(;A>10;)A/=12.5,l++;return r=Math.floor(10**(l-1)),function(){return G(this,null,function*(){let U=e.size,f=0,B=new Uint8Array(yield new K(e.arrayBuffer()));do{let h=f+r,p=f+t,d,w=B.indexOf(s,h);w==-1&&(w=B.indexOf(De,h)),w==-1?d=p:d=w<p?w:p,yield yield new K(m(B.slice(f,d))),f=d}while(f<U)})}}async function Ie(e,t,n,r,o,a){if(M(e))return wt(await e.text(),t,n,r,a!=null?a:!1);let i=0,s=!1;o&&o.endsWith(".pdf")?i=47:o&&o.endsWith(".json")&&(s=!0,i=44);let u=Math.max(s?100:1e5,Math.min(1e8,e.size)),l=1,A=u;for(;A>10;)A/=12.5,l++;return r=Math.floor(10**(l-1)),function(){return G(this,null,function*(){let U=e.size,f=0;do{let B=t,h=new Uint8Array(yield new K(e.slice(f,f+t).arrayBuffer())),p=h.indexOf(i,r);B=p==-1?t:Math.min(t,p),p==-1&&(p=h.indexOf(De,r));let d=h.slice(0,B);f+=d.length,yield yield new K(m(d))}while(f<U)})}}async function Ne(e,t,n,r,o,a){let i=n||M(e),s=i?128:1024*4,c=i?20:12,y=Math.max(s,Math.floor(e.size/c)),u=Math.min(t,y*5),l=Math.min(Math.max(Math.floor(y/4),r),u),A=48,g=y,U=1,f=31,B=1;for(let Z=0;Z<A-1;Z++)B=Math.imul(B,f);let h=new Uint8Array(await e.arrayBuffer()),p=0,d=0,w=0,z=M(e),N=h.length;return function(){return G(this,null,function*(){for(;p<N;){let le=h[p];if(p>=w+A){let H=h[p-A],tt=Math.imul(H,B);d=d-tt|0,d=Math.imul(d,f),d=d+le|0}else d=Math.imul(d,f),d=d+le|0;let pe=p-w+1,q=!1;if(pe>=l&&(d>>>0)%g===U&&(q=!0),pe>=u&&(q=!0),q){let H=!0;z&&p+1<N&&(h[p+1]&192)===128&&(H=!1),H&&(z?yield Promise.resolve(b(h.subarray(w,p+1))):yield yield new K(m(h.subarray(w,p+1))),w=p+1)}p++}w<N&&(z?yield Promise.resolve(b(h.subarray(w,N))):yield yield new K(m(h.subarray(w,N))))})}}function V(e,t,n){self.postMessage({key:e,seq:t,result:n})}function xt(e){let t=e,n=0;return function(r){r===null?(n===0&&V(t,n++,""),V(t,n++,null)):V(t,n++,r)}}async function ke(e){let t=e.key,n=e.dataSrc,r=e.pieceSize,o=e.plainSplit,a=e.minimumChunkSize,i=e.filename,s=e.useSegmenter,y=await(e.splitVersion==3?Ne:e.splitVersion==2?Ce:Ie)(n,r,o,a,i,s),u=xt(t);try{for(var l=Q(y()),A,g,U;A=!(g=await l.next()).done;A=!1){let f=g.value;u(f)}}catch(g){U=[g]}finally{try{A&&(g=l.return)&&await g.call(l)}finally{if(U)throw U[0]}}u(null)}var R=globalThis.crypto,St="fancySyncForYou!",Tt=new TextEncoder().encode(St);var an=new Uint32Array(1),sn=new Uint8Array(12);async function Oe(e){let t=new TextEncoder().encode(e),r=(await R.subtle.digest("SHA-256",new Uint8Array([...t,...Tt]))).slice(0,16),o=await R.subtle.importKey("raw",t,"PBKDF2",!1,["deriveBits","deriveKey"]),a={name:"PBKDF2",hash:"SHA-256",salt:r,iterations:1e5};return await R.subtle.deriveKey(a,o,{name:"AES-GCM",length:256},!1,["decrypt","encrypt"])}var He="",Ge;async function ne(e,t){He!==t&&(Ge=await Oe(t),He=t);let n=e.substring(2,26),r=e.substring(26),o=P(n),a=v(r),i=await R.subtle.decrypt({name:"AES-GCM",iv:o},Ge,a);return b(new Uint8Array(i))}var Lt=Symbol("undefined");function W(e,t,n){if(e<=0)throw new Error("Buffer length must be greater than 0");let r=new Map,o=a=>a.length>0&&typeof a[0]=="string"?a[0]:JSON.stringify(a,(i,s)=>s===void 0?Lt:s);return function(...a){let i=n?n(a):o(a);if(r.has(i)){let c=r.get(i);return r.delete(i),r.set(i,c),c}let s=t(...a);if(r.set(i,s),s.catch(()=>{r.get(i)===s&&r.delete(i)}),r.size>e){let c=r.keys().next().value;c&&r.delete(c)}return s}}var D=globalThis.crypto,I=12,_t=31e4,$=32;var Fe=128,Y="%=";var Kt=W(10,async(e,t)=>{let n=E(e),r=await D.subtle.importKey("raw",n,{name:"PBKDF2",length:256},!1,["deriveKey"]),o=await D.subtle.deriveKey({name:"PBKDF2",salt:t,iterations:_t,hash:"SHA-256"},r,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),a=await D.subtle.exportKey("raw",o);return await D.subtle.importKey("raw",a,{name:"HKDF"},!1,["deriveKey"])},([e,t])=>`${e}-${x(t)}`);async function Me(e,t,n){let r=await Kt(e,t);return await D.subtle.deriveKey({name:"HKDF",salt:n,info:new Uint8Array,hash:"SHA-256"},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Pt(e,t,n){return await D.subtle.encrypt({name:"AES-GCM",iv:t,tagLength:Fe},e,n)}async function Dt(e,t,n){let r=D.getRandomValues(new Uint8Array($)),o=await Me(t,n,r),a=D.getRandomValues(new Uint8Array(I)),i=await Pt(o,a,e),s=new Uint8Array(i);return[a,r,s]}async function Ut(e,t,n){let[r,o,a]=await Dt(e,t,n),i=r.length+o.length+a.length,s=new Uint8Array(i);return s.set(r,0),s.set(o,r.length),s.set(a,r.length+o.length),s}async function Ve(e,t,n){let r=E(e),o=await Ut(r,t,n),a=await m(o);return`${Y}${a}`}async function vt(e,t,n,r,o){let a=await Me(o,t,n),i=await D.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:Fe},a,r);return new Uint8Array(i)}async function Ct(e,t,n){if(e.length<I+$)throw new Error("Invalid binary data length. Expected at least ivLength + saltLength bytes.");let r=e.slice(0,I),o=e.slice(I,I+$),a=e.slice(I+$);return await vt(r,n,o,a,t)}async function Re(e,t,n){if(!e.startsWith(Y))throw new Error(`Invalid input format. Expected input to start with \'${Y}\'.`);let r=Y.length,o=v(e.slice(r)),a=await Ct(new Uint8Array(o),t,n);return b(a)}var An=globalThis.crypto;var We=new Map,j=new Map,ie=100,X,oe=new Uint32Array(1),L=globalThis.crypto;async function Gt(e,t){let n=`${e}-${t}`,r=We.get(n);if(r){if(r.count--,r.count>0)return[r.key,r.salt];r.count--}let o=15-e.length,a=t?(o>0?o:0)*1e3+121-o:1e5,i=new TextEncoder().encode(e),s=await L.subtle.digest({name:"SHA-256"},i),c=await L.subtle.importKey("raw",s,{name:"PBKDF2"},!1,["deriveKey"]),y=L.getRandomValues(new Uint8Array(16)),u=await L.subtle.deriveKey({name:"PBKDF2",salt:y,iterations:a,hash:"SHA-256"},c,{name:"AES-GCM",length:256},!1,["encrypt"]);return We.set(n,{key:u,salt:y,count:ie}),[u,y]}var ae=ie*5,J=0,$e=0;async function Ye(e,t,n){if(ae--,ae<0){ae=ie;let l=(J-$e)/2;for(let[A,g]of j)g.count<l&&j.delete(A),$e=J}J++;let r=e+x(t)+n,o=j.get(r);if(o)return o.count=J,[o.key,o.salt];let a=15-e.length,i=n?(a>0?a:0)*1e3+121-a:1e5,s=new TextEncoder().encode(e),c=await L.subtle.digest({name:"SHA-256"},s),y=await L.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveKey"]),u=await L.subtle.deriveKey({name:"PBKDF2",salt:t,iterations:i,hash:"SHA-256"},y,{name:"AES-GCM",length:256},!1,["decrypt"]);return j.set(r,{key:u,salt:t,count:0}),[u,t]}function je(e){return X!=null&&!e||(X=L.getRandomValues(new Uint8Array(12))),X}function Ot(){return oe[0]++,oe[0]>1e4&&je(!0),oe}async function se(e,t,n){let[r,o]=await Gt(t,n),a=je(),i=Ot(),s=new Uint8Array([...a,...new Uint8Array(i.buffer)]),c=E(e),y=await L.subtle.encrypt({name:"AES-GCM",iv:s},r,c),u=""+await m(new Uint8Array(y));return`%${x(s)}${x(o)}${u}`}async function Ft(e,t,n){try{let r=e.substring(1,33),o=e.substring(33,65),a=e.substring(65),[i]=await Ye(t,P(o),n),s=P(r),c=te(a),y=await L.subtle.decrypt({name:"AES-GCM",iv:s},i,c);return b(new Uint8Array(y))}catch(r){throw T("Couldn\'t decode! You should wrong the passphrases (V2)",16),T(r,16),r}}async function ce(e,t,n){try{if(e[0]=="%")return e[1]==="~"?ne(e,t):Ft(e,t,n);if(!e.startsWith("[")||!e.endsWith("]"))throw new Error("Encrypted data corrupted!");let r=e.substring(1,e.length-1).split(",").map(f=>f[0]==\'"\'?f.substring(1,f.length-1):f),[o,a,i]=r,[s]=await Ye(t,P(i),n),c=P(a),y=atob(o),u=y.length,l=new Uint8Array(u);for(let f=u;f>=0;--f)l[f]=y.charCodeAt(f);let A=await L.subtle.decrypt({name:"AES-GCM",iv:c},s,l),g=b(new Uint8Array(A));return JSON.parse(g)}catch(r){throw T("Couldn\'t decode! You should wrong the passphrases",16),T(r,16),r}}var Dn=new Uint8Array([83,97,108,116,101,100,95,95]);var ye=globalThis.crypto||window.crypto;var Xe=new Uint8Array([1,0,1]);var Je=new Uint8Array([10,244,193]),ze=new Uint8Array([10,244,194]);var et=globalThis.crypto;async function lr(e,t){let n=E(e),r=await et.subtle.importKey("raw",n,{name:"HKDF"},!1,["deriveKey"]);return await et.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:t,info:new Uint8Array([])},r,{name:"HMAC",hash:"SHA-256",length:256},!1,["sign"])}var co=W(10,lr,([e,t])=>`${E(e)}-${x(t)}`);async function fe(e){let t=e.key,{type:n,input:r,passphrase:o}=e;try{if(n=="encrypt"){let a=e.autoCalculateIterations,i=await se(r,o,a);self.postMessage({key:t,result:i})}else if(n=="decrypt"){let a=e.autoCalculateIterations,i=await ce(r,o,a);self.postMessage({key:t,result:i})}else if(n=="encryptHKDF"){let a=e.pbkdf2Salt,i=await Ve(r,o,a);self.postMessage({key:t,result:i})}else if(n=="decryptHKDF"){let a=e.pbkdf2Salt,i=await Re(r,o,a);self.postMessage({key:t,result:i})}}catch(a){self.postMessage({key:t,error:a})}}self.onmessage=e=>{let t=e.data.data;if(t.type==="split")return ke(t);if(t.type==="encrypt"||t.type==="decrypt")return fe(t);if(t.type==="encryptHKDF"||t.type==="decryptHKDF")return fe(t);self.postMessage({key:t.key,error:new Error("Invalid type")})};\n/*! Bundled license information:\n\noctagonal-wheels/dist/encryption/asymmetric/common.js:\n  (* istanbul ignore next -- @preserve *)\n*/\n');
}
var init_bg_worker = __esm({
  "src/sync/core/worker/bg.worker.ts?worker"() {
    "use strict";
    init_inline_worker();
  }
});

// src/sync/core/PlatformAPIs/base/APIBase.ts
var EVENT_PLATFORM_UNLOADED;
var init_APIBase = __esm({
  "src/sync/core/PlatformAPIs/base/APIBase.ts"() {
    "use strict";
    EVENT_PLATFORM_UNLOADED = "platform-unloaded";
  }
});

// src/sync/core/worker/universalTypes.ts
var init_universalTypes = __esm({
  "src/sync/core/worker/universalTypes.ts"() {
    "use strict";
  }
});

// src/sync/core/worker/bgWorker.encryption.ts
function encryptionOnWorker(data) {
  const process2 = startWorker(data);
  return (async () => {
    const ret = await process2.task.promise;
    process2.finalize();
    return ret;
  })();
}
function encryptionHKDFOnWorker(data) {
  const process2 = startWorker(data);
  return (async () => {
    const ret = await process2.task.promise;
    process2.finalize();
    return ret;
  })();
}
function handleTaskEncrypt(process2, data) {
  const key4 = data.key;
  const task = process2.task;
  if ("result" in data) {
    task.resolve(data.result);
  } else {
    if (data.error) {
      task.reject(data.error);
    } else {
      task.reject(new Error("Unknown error in background encryption"));
    }
  }
  tasks.delete(key4);
}
var init_bgWorker_encryption = __esm({
  "src/sync/core/worker/bgWorker.encryption.ts"() {
    "use strict";
    init_bgWorker();
    init_universalTypes();
    init_universalTypes();
    init_universalTypes();
    init_universalTypes();
  }
});

// src/sync/core/worker/bgWorker.splitting.ts
function _splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, splitVersion, useSegmenter) {
  const process2 = startWorker({
    type: "split",
    dataSrc,
    pieceSize,
    plainSplit,
    minimumChunkSize,
    filename,
    useSegmenter,
    splitVersion
  });
  const _key = process2.key;
  const stream = new TransformStream({
    transform: (chunk, controller) => {
      if (chunk === null) {
        controller.terminate();
        return;
      }
      controller.enqueue(chunk);
    },
    flush: () => {
    }
  });
  workerStreams.set(_key, stream);
  const readable2 = stream.readable;
  const reader = readable2.getReader();
  const writer = stream.writable.getWriter();
  writers.set(_key, writer);
  return async function* () {
    try {
      let done = false;
      do {
        const results = await reader.read();
        done = results.done;
        if (done) {
          break;
        }
        yield results.value;
      } while (!done);
    } catch (ex) {
      Logger(`Error in worker stream for key ${_key}`);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    } finally {
      process2.finalize();
      workerStreams.delete(_key);
      writers.delete(_key);
    }
  };
}
function handleTaskSplit(process2, data) {
  const key4 = data.key;
  if (!("result" in data)) {
    responseBuf.delete(key4);
    const reportError = data.error || new Error("Unknown error in background splitting");
    writerPromise = writerPromise.then(async () => {
      const writer = writers.get(key4);
      if (writer) {
        await writer.abort(reportError);
      }
    });
  }
  let thisBuf = responseBuf.get(key4);
  if (!thisBuf) {
    thisBuf = /* @__PURE__ */ new Map();
    responseBuf.set(key4, thisBuf);
  }
  const seq = data.seq;
  thisBuf.set(seq, data.result === null ? SYMBOL_END_OF_DATA : data.result);
  responseBuf.set(key4, thisBuf);
  const keys2 = Array.from(thisBuf.keys()).sort((a, b) => a - b);
  const max3 = keys2[keys2.length - 1];
  for (let i = 0; i <= max3; i++) {
    const result = thisBuf.get(i);
    if (result === void 0) {
      break;
    }
    if (result === SYMBOL_USED) {
      continue;
    }
    thisBuf.set(i, SYMBOL_USED);
    responseBuf.set(key4, thisBuf);
    writerPromise = writerPromise.then(async () => {
      const writer = writers.get(key4);
      if (!writer) {
        throw new Error(`Invalid writer for key ${key4} in background splitting`);
      }
      await writer.write(result === SYMBOL_END_OF_DATA ? null : result);
    });
  }
}
var SYMBOL_USED, SYMBOL_END_OF_DATA, workerStreams, writers, responseBuf, writerPromise;
var init_bgWorker_splitting = __esm({
  "src/sync/core/worker/bgWorker.splitting.ts"() {
    "use strict";
    init_logger2();
    init_bgWorker();
    init_universalTypes();
    SYMBOL_USED = Symbol("used");
    SYMBOL_END_OF_DATA = Symbol("endOfData");
    workerStreams = /* @__PURE__ */ new Map();
    writers = /* @__PURE__ */ new Map();
    responseBuf = /* @__PURE__ */ new Map();
    writerPromise = Promise.resolve();
  }
});

// src/sync/core/worker/bgWorker.ts
function splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, useSegmenter) {
  return _splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, 1, useSegmenter != null ? useSegmenter : false);
}
function splitPieces2WorkerV2(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, useSegmenter) {
  return _splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, 2, useSegmenter != null ? useSegmenter : false);
}
function splitPieces2WorkerRabinKarp(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, useSegmenter) {
  return _splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, 3, useSegmenter != null ? useSegmenter : false);
}
function encryptWorker(input, passphrase, autoCalculateIterations) {
  return encryptionOnWorker({ type: "encrypt", input, passphrase, autoCalculateIterations });
}
function decryptWorker(input, passphrase, autoCalculateIterations) {
  return encryptionOnWorker({ type: "decrypt", input, passphrase, autoCalculateIterations });
}
function encryptHKDFWorker(input, passphrase, pbkdf2Salt) {
  return encryptionHKDFOnWorker({ type: "encryptHKDF", input, passphrase, pbkdf2Salt });
}
function decryptHKDFWorker(input, passphrase, pbkdf2Salt) {
  return encryptionHKDFOnWorker({ type: "decryptHKDF", input, passphrase, pbkdf2Salt });
}
function initialiseWorkers() {
  const maxConcurrency = ~~((navigator.hardwareConcurrency || 8) / 2);
  return Array.from(
    { length: maxConcurrency },
    () => ({
      // @ts-ignore
      worker: Worker2(),
      processing: 0
    })
  );
}
function nextWorker() {
  if (workers === void 0 || workers.length === 0) {
    throw new Error("No available workers");
  }
  const inst = workers[roundRobinIdx];
  roundRobinIdx = (roundRobinIdx + 1) % workers.length;
  return inst;
}
function startWorker(data) {
  const _key = key2++;
  const inst = nextWorker();
  const promise = promiseWithResolver();
  const item = {
    key: _key,
    task: promise,
    type: data.type,
    finalize: () => {
      inst.processing--;
    }
  };
  tasks.set(_key, item);
  inst.processing++;
  inst.worker.postMessage({
    data: { ...data, key: _key }
  });
  return item;
}
function terminateWorker() {
  for (const inst of workers) {
    inst.worker.terminate();
  }
}
var tasks, workers, key2, roundRobinIdx;
var init_bgWorker = __esm({
  "src/sync/core/worker/bgWorker.ts"() {
    "use strict";
    init_promises();
    init_hub();
    init_bg_worker();
    init_APIBase();
    init_logger();
    init_bgWorker_encryption();
    init_bgWorker_splitting();
    tasks = /* @__PURE__ */ new Map();
    workers = initialiseWorkers();
    key2 = 0;
    roundRobinIdx = 0;
    initialiseWorkers();
    for (const inst of workers) {
      inst.worker.onmessage = ({ data }) => {
        const key4 = data.key;
        const process2 = tasks.get(key4);
        if (!process2) {
          info(`Invalid key ${key4} of background processing`, LOG_KIND_ERROR);
          return;
        }
        if (process2.type === "split") {
          handleTaskSplit(process2, data);
        } else if (process2.type === "encrypt" || process2.type === "decrypt") {
          handleTaskEncrypt(process2, data);
        } else if (process2.type === "encryptHKDF" || process2.type === "decryptHKDF") {
          handleTaskEncrypt(process2, data);
        } else {
          info("Invalid response type" + process2);
        }
      };
      inst.worker.onerror = () => {
        inst.worker.terminate();
        workers.splice(workers.indexOf(inst), 1);
      };
    }
    eventHub.on(EVENT_PLATFORM_UNLOADED, () => {
      terminateWorker();
    });
  }
});

// src/sync/core/pouchdb/encryption.ts
function reportDecryptionError(message, context2) {
  _decryptionErrorCount++;
  const fullMessage = context2 ? `${message} ${context2}` : message;
  Logger(fullMessage, LOG_LEVEL_VERBOSE);
  if (_decryptionErrorCount === DECRYPTION_ERROR_THRESHOLD && !_decryptionErrorReported) {
    _decryptionErrorReported = true;
    Logger(
      $msg("fridaySync.decryptionErrors.aggregated", { count: _decryptionErrorCount.toString() }),
      LOG_LEVEL_NOTICE
    );
  }
}
function getEncryptionVersion(data) {
  if ("e_" in data && data.e_ === true) {
    if (data.data.startsWith(Encrypt_HKDF_Header)) {
      return EncryptionVersions.HKDF;
    } else if (data.data.startsWith(Encrypt_OLD_Header)) {
      return EncryptionVersions.ENCRYPTED;
    }
    return EncryptionVersions.UNKNOWN;
  }
  return EncryptionVersions.UNENCRYPTED;
}
async function tryDecryptV1AsFallback(encryptedData, passphrase, useDynamicIterationCount) {
  try {
    return await decrypt(encryptedData, passphrase, useDynamicIterationCount);
  } catch (ex) {
    try {
      Logger(
        "Failed to decrypt with V1 method. Fallback to disable useDynamicIterationCount.",
        LOG_LEVEL_VERBOSE
      );
      Logger(ex, LOG_LEVEL_VERBOSE);
      return await decrypt(encryptedData, passphrase, false);
    } catch (ex2) {
      Logger("Completely failed to decrypt with V1 method.", LOG_LEVEL_VERBOSE);
      Logger(ex2, LOG_LEVEL_VERBOSE);
      return false;
    }
  }
}
function isEncryptedMeta(doc) {
  return "path" in doc && doc.path.startsWith(ENCRYPTED_META_PREFIX);
}
async function encryptMetaWithHKDF(doc, passphrase, pbkdf2Salt) {
  if (isEncryptedMeta(doc)) {
    return doc.path;
  }
  const props = {
    path: getPath(doc),
    mtime: doc.mtime,
    ctime: doc.ctime,
    size: doc.size,
    children: isMetaEntry(doc) ? doc.children : void 0
  };
  const propStr = JSON.stringify(props);
  const encryptedMeta = await encryptHKDFWorker(propStr, passphrase, pbkdf2Salt);
  return ENCRYPTED_META_PREFIX + encryptedMeta;
}
async function decryptMetaWithHKDF(meta, passphrase, pbkdf2Salt) {
  if (!meta.startsWith(ENCRYPTED_META_PREFIX)) {
    throw new Error("Meta is not encrypted with HKDF.");
  }
  const encryptedMeta = meta.slice(ENCRYPTED_META_PREFIX.length);
  const props = await decryptHKDF(encryptedMeta, passphrase, pbkdf2Salt);
  const parsedProps = JSON.parse(props);
  return parsedProps;
}
async function incomingEncryptHKDF(doc, passphrase, useDynamicIterationCount, getPBKDF2Salt) {
  const saveDoc = {
    ...doc
  };
  if (isEncryptedChunkEntry(saveDoc) || isSyncInfoEntry(saveDoc)) {
    try {
      const encryptionVersion = getEncryptionVersion(saveDoc);
      if (encryptionVersion === EncryptionVersions.ENCRYPTED) {
        const decrypted = await tryDecryptV1AsFallback(saveDoc.data, passphrase, useDynamicIterationCount);
        if (decrypted === false) {
          Logger(MESSAGE_FALLBACK_DECRYPT_FAILED, LOG_LEVEL_NOTICE);
          throw new Error(MESSAGE_FALLBACK_DECRYPT_FAILED);
        }
        const pbkdf2salt = await getPBKDF2Salt();
        saveDoc.data = await encryptHKDF(saveDoc.data, passphrase, pbkdf2salt);
        saveDoc.e_ = true;
      }
      if (encryptionVersion === EncryptionVersions.HKDF) {
      } else if (encryptionVersion === EncryptionVersions.UNENCRYPTED) {
        const pbkdf2salt = await getPBKDF2Salt();
        saveDoc.data = await encryptHKDF(saveDoc.data, passphrase, pbkdf2salt);
        saveDoc.e_ = true;
      }
    } catch (ex) {
      Logger(ENCRYPTION_HKDF_FAILED, LOG_LEVEL_NOTICE);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (shouldEncryptEdenHKDF(saveDoc)) {
    const pbkdf2salt = await getPBKDF2Salt();
    try {
      saveDoc.eden = {
        [EDEN_ENCRYPTED_KEY_HKDF]: {
          data: await encryptHKDF(JSON.stringify(saveDoc.eden), passphrase, pbkdf2salt),
          epoch: 999999
        }
      };
    } catch (ex) {
      Logger(`${ENCRYPTION_HKDF_FAILED} on Eden`, LOG_LEVEL_NOTICE);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (isObfuscatedEntry(saveDoc)) {
    const pbkdf2salt = await getPBKDF2Salt();
    if (!isEncryptedMeta(saveDoc)) {
      try {
        saveDoc.path = await encryptMetaWithHKDF(
          saveDoc,
          passphrase,
          pbkdf2salt
        );
        saveDoc.mtime = 0;
        saveDoc.ctime = 0;
        saveDoc.size = 0;
        if ("children" in saveDoc) saveDoc.children = [];
      } catch (ex) {
        Logger(`${ENCRYPTION_HKDF_FAILED} on Metadata`, LOG_LEVEL_NOTICE);
        Logger(ex, LOG_LEVEL_VERBOSE);
        throw ex;
      }
    }
  }
  return saveDoc;
}
async function outgoingDecryptHKDF(doc, migrationDecrypt, decrypted, passphrase, useDynamicIterationCount, getPBKDF2Salt) {
  const loadDoc = {
    ...doc
  };
  if (isEncryptedChunkEntry(loadDoc) || isSyncInfoEntry(loadDoc)) {
    try {
      const encryptionVersion = getEncryptionVersion(loadDoc);
      if (encryptionVersion === EncryptionVersions.HKDF) {
        const pbkdf2salt = await getPBKDF2Salt();
        loadDoc.data = await decryptHKDF(loadDoc.data, passphrase, pbkdf2salt);
        delete loadDoc.e_;
      } else if (encryptionVersion === EncryptionVersions.ENCRYPTED) {
        const decryptedData = await tryDecryptV1AsFallback(loadDoc.data, passphrase, useDynamicIterationCount);
        if (decryptedData === false) {
          reportDecryptionError(MESSAGE_FALLBACK_DECRYPT_FAILED);
          throw new Error(MESSAGE_FALLBACK_DECRYPT_FAILED);
        }
        loadDoc.data = decryptedData;
        delete loadDoc.e_;
      } else if (encryptionVersion === EncryptionVersions.UNENCRYPTED) {
      } else {
        reportDecryptionError("Unknown encryption version. Cannot decrypt.");
        throw new Error("Unknown encryption version. Cannot decrypt.");
      }
    } catch (ex) {
      reportDecryptionError(DECRYPTION_HKDF_FAILED);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (isObfuscatedEntry(loadDoc)) {
    const path8 = getPath(loadDoc);
    if (isEncryptedMeta(loadDoc)) {
      const pbkdf2salt = await getPBKDF2Salt();
      try {
        const metadata = await decryptMetaWithHKDF(path8, passphrase, pbkdf2salt);
        for (const key4 of Object.keys(metadata)) {
          loadDoc[key4] = metadata[key4];
        }
      } catch (ex) {
        reportDecryptionError(DECRYPTION_HKDF_FAILED, "on Path");
        Logger(ex, LOG_LEVEL_VERBOSE);
        throw ex;
      }
    } else if (isPathProbablyObfuscated(path8)) {
      const decryptedPath = await tryDecryptV1AsFallback(path8, passphrase, useDynamicIterationCount);
      if (decryptedPath === false) {
        reportDecryptionError(MESSAGE_FALLBACK_DECRYPT_FAILED, "on Path");
        throw new Error(MESSAGE_FALLBACK_DECRYPT_FAILED);
      }
      loadDoc.path = decryptedPath;
    }
  }
  let readEden = {};
  let edenDecrypted = false;
  if (shouldDecryptEden(loadDoc)) {
    try {
      const decryptedEden = await tryDecryptV1AsFallback(
        loadDoc.eden[EDEN_ENCRYPTED_KEY].data,
        passphrase,
        useDynamicIterationCount
      );
      if (decryptedEden === false) throw new Error(MESSAGE_FALLBACK_DECRYPT_FAILED);
      readEden = {
        ...readEden,
        ...JSON.parse(decryptedEden)
      };
      edenDecrypted = true;
    } catch (ex) {
      reportDecryptionError(DECRYPTION_FALLBACK_FAILED, "on Eden");
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (shouldDecryptEdenHKDF(loadDoc)) {
    const pbkdf2salt = await getPBKDF2Salt();
    try {
      const decryptedEdenData = await decryptHKDF(
        loadDoc.eden[EDEN_ENCRYPTED_KEY_HKDF].data,
        passphrase,
        pbkdf2salt
      );
      readEden = {
        ...readEden,
        ...JSON.parse(decryptedEdenData)
      };
      edenDecrypted = true;
    } catch (ex) {
      reportDecryptionError(DECRYPTION_HKDF_FAILED, "on Eden");
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (edenDecrypted) {
    loadDoc.eden = readEden;
  } else {
  }
  return loadDoc;
}
async function incomingEncryptV1(doc, passphrase, useDynamicIterationCount) {
  const saveDoc = {
    ...doc
  };
  if (isEncryptedChunkEntry(saveDoc) || isSyncInfoEntry(saveDoc)) {
    try {
      if (!("e_" in saveDoc)) {
        saveDoc.data = await encrypt(saveDoc.data, passphrase, useDynamicIterationCount);
        saveDoc.e_ = true;
      }
    } catch (ex) {
      Logger("Encryption failed.", LOG_LEVEL_NOTICE);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  if (shouldEncryptEden(saveDoc)) {
    saveDoc.eden = {
      [EDEN_ENCRYPTED_KEY]: {
        data: await encrypt(JSON.stringify(saveDoc.eden), passphrase, useDynamicIterationCount),
        epoch: 999999
      }
    };
  }
  if (isObfuscatedEntry(saveDoc)) {
    try {
      const path8 = getPath(saveDoc);
      if (!isPathProbablyObfuscated(path8)) {
        saveDoc.path = await obfuscatePath(
          path8,
          passphrase,
          useDynamicIterationCount
        );
      }
    } catch (ex) {
      Logger("Encryption failed.", LOG_LEVEL_NOTICE);
      Logger(ex, LOG_LEVEL_VERBOSE);
      throw ex;
    }
  }
  return saveDoc;
}
async function outgoingDecryptV1(doc, migrationDecrypt, decrypted, passphrase, useDynamicIterationCount) {
  var _a6, _b4;
  const loadDoc = {
    ...doc
  };
  const _isChunkOrSyncInfo = isEncryptedChunkEntry(loadDoc) || isSyncInfoEntry(loadDoc);
  const _isObfuscatedEntry = isObfuscatedEntry(loadDoc);
  const _shouldDecryptEden = shouldDecryptEden(loadDoc);
  if (_isChunkOrSyncInfo || _isObfuscatedEntry || _shouldDecryptEden) {
    if (migrationDecrypt && decrypted.has(loadDoc._id)) {
      return loadDoc;
    }
    try {
      if (_isChunkOrSyncInfo) {
        loadDoc.data = await decrypt(loadDoc.data, passphrase, useDynamicIterationCount);
        delete loadDoc.e_;
      } else if ("e_" in loadDoc) {
        loadDoc.data = await decrypt(loadDoc.data, passphrase, useDynamicIterationCount);
        delete loadDoc.e_;
      }
      if (_isObfuscatedEntry) {
        const path8 = getPath(loadDoc);
        if (isPathProbablyObfuscated(path8)) {
          loadDoc.path = await decrypt(
            path8,
            passphrase,
            useDynamicIterationCount
          );
        }
      }
      if (_shouldDecryptEden) {
        loadDoc.eden = JSON.parse(
          await decrypt(loadDoc.eden[EDEN_ENCRYPTED_KEY].data, passphrase, useDynamicIterationCount)
        );
      }
      if (migrationDecrypt) {
        decrypted.set(loadDoc._id, true);
      }
    } catch (ex) {
      if (useDynamicIterationCount) {
        try {
          if (_isChunkOrSyncInfo) {
            loadDoc.data = await decrypt(loadDoc.data, passphrase, false);
          }
          if (_isObfuscatedEntry) {
            const path8 = getPath(loadDoc);
            if (isPathProbablyObfuscated(path8)) {
              loadDoc.path = await decrypt(path8, passphrase, false);
            }
          }
          if (_shouldDecryptEden) {
            loadDoc.eden = JSON.parse(
              await decrypt(loadDoc.eden[EDEN_ENCRYPTED_KEY].data, passphrase, false)
            );
          }
          if (migrationDecrypt) {
            decrypted.set(loadDoc._id, true);
          }
        } catch (ex2) {
          if (migrationDecrypt && ex2.name == "SyntaxError") {
            return loadDoc;
          }
          reportDecryptionError("Decryption failed.");
          Logger(ex2, LOG_LEVEL_VERBOSE);
          Logger(`id:${loadDoc._id}-${(_a6 = loadDoc._rev) == null ? void 0 : _a6.substring(0, 10)}`, LOG_LEVEL_VERBOSE);
          throw ex2;
        }
      } else {
        reportDecryptionError("Decryption failed.");
        Logger(ex, LOG_LEVEL_VERBOSE);
        Logger(`id:${loadDoc._id}-${(_b4 = loadDoc._rev) == null ? void 0 : _b4.substring(0, 10)}`, LOG_LEVEL_VERBOSE);
        throw ex;
      }
    }
  }
  return loadDoc;
}
function disableEncryption() {
  preprocessOutgoing = async (doc) => {
    return await Promise.resolve(doc);
  };
  preprocessIncoming = async (doc) => {
    return await Promise.resolve(doc);
  };
}
function shouldEncryptEden(doc) {
  if ("eden" in doc && !(EDEN_ENCRYPTED_KEY in doc.eden)) {
    return true;
  }
  return false;
}
function shouldEncryptEdenHKDF(doc) {
  if ("eden" in doc && !(EDEN_ENCRYPTED_KEY_HKDF in doc.eden)) {
    if (Object.keys(doc.eden).length === 0) {
      return false;
    }
    return true;
  }
  return false;
}
function shouldDecryptEden(doc) {
  if ("eden" in doc && EDEN_ENCRYPTED_KEY in doc.eden) {
    return true;
  }
  return false;
}
function shouldDecryptEdenHKDF(doc) {
  if ("eden" in doc && EDEN_ENCRYPTED_KEY_HKDF in doc.eden) {
    return true;
  }
  return false;
}
var encrypt, decrypt, encryptHKDF, decryptHKDF, DECRYPTION_ERROR_THRESHOLD, _decryptionErrorCount, _decryptionErrorReported, Encrypt_HKDF_Header, Encrypt_OLD_Header, EncryptionVersions, ENCRYPTED_META_PREFIX, MESSAGE_FALLBACK_DECRYPT_FAILED, ENCRYPTION_HKDF_FAILED, DECRYPTION_HKDF_FAILED, DECRYPTION_FALLBACK_FAILED, preprocessOutgoing, preprocessIncoming, enableEncryption, EDEN_ENCRYPTED_KEY, EDEN_ENCRYPTED_KEY_HKDF;
var init_encryption2 = __esm({
  "src/sync/core/pouchdb/encryption.ts"() {
    "use strict";
    init_logger2();
    init_types();
    init_utils2();
    init_encryption();
    init_path();
    init_bgWorker();
    init_i18n();
    encrypt = encryptWorker;
    decrypt = decryptWorker;
    encryptHKDF = encryptHKDFWorker;
    decryptHKDF = decryptHKDFWorker;
    DECRYPTION_ERROR_THRESHOLD = 5;
    _decryptionErrorCount = 0;
    _decryptionErrorReported = false;
    Encrypt_HKDF_Header = "%=";
    Encrypt_OLD_Header = "%";
    EncryptionVersions = {
      UNENCRYPTED: 0,
      ENCRYPTED: 1,
      HKDF: 2,
      UNKNOWN: 99
    };
    ENCRYPTED_META_PREFIX = "/\\:";
    MESSAGE_FALLBACK_DECRYPT_FAILED = "Failed to decrypt the data with V1 method. Cannot encrypt with HKDF.";
    ENCRYPTION_HKDF_FAILED = "Encryption with HKDF failed.";
    DECRYPTION_HKDF_FAILED = "Decryption with HKDF failed.";
    DECRYPTION_FALLBACK_FAILED = "Decryption with fallback failed.";
    preprocessOutgoing = async (doc) => {
      return await Promise.resolve(doc);
    };
    preprocessIncoming = async (doc) => {
      return await Promise.resolve(doc);
    };
    enableEncryption = (db, passphrase, useDynamicIterationCount, migrationDecrypt, getPBKDF2Salt, algorithm) => {
      const decrypted = /* @__PURE__ */ new Map();
      const incoming = (doc) => {
        return algorithm === E2EEAlgorithms.V2 ? incomingEncryptHKDF(doc, passphrase, useDynamicIterationCount, getPBKDF2Salt) : incomingEncryptV1(doc, passphrase, useDynamicIterationCount);
      };
      const outgoing = (doc) => {
        return algorithm !== E2EEAlgorithms.ForceV1 ? outgoingDecryptHKDF(doc, migrationDecrypt, decrypted, passphrase, useDynamicIterationCount, getPBKDF2Salt) : outgoingDecryptV1(doc, migrationDecrypt, decrypted, passphrase, useDynamicIterationCount);
      };
      preprocessOutgoing = incoming;
      preprocessIncoming = outgoing;
      db.transform({
        incoming,
        outgoing
      });
    };
    EDEN_ENCRYPTED_KEY = "h:++encrypted";
    EDEN_ENCRYPTED_KEY_HKDF = "h:++encrypted-hkdf";
  }
});

// src/sync/core/pouchdb/LiveSyncDBFunctions.ts
async function ensureRemoteIsCompatible(infoSrc, setting, deviceNodeID, currentVersionRange2, nodeDeviceInfo, updateCallback) {
  var _a6, _b4, _c2, _d;
  const now = Date.now();
  const baseMilestone = {
    _id: MILESTONE_DOCID,
    type: "milestoneinfo",
    created: /* @__PURE__ */ new Date() / 1,
    locked: false,
    accepted_nodes: [deviceNodeID],
    node_chunk_info: { [deviceNodeID]: currentVersionRange2 },
    node_info: {
      [deviceNodeID]: {
        ...nodeDeviceInfo,
        last_connected: 0,
        progress: ""
      }
    },
    tweak_values: {}
  };
  let remoteMilestone = infoSrc;
  if (!remoteMilestone) remoteMilestone = baseMilestone;
  const currentTweakValues = extractObject(TweakValuesTemplate, setting);
  remoteMilestone.node_chunk_info = { ...baseMilestone.node_chunk_info, ...remoteMilestone.node_chunk_info };
  let writeMilestone = remoteMilestone.node_chunk_info[deviceNodeID].min != currentVersionRange2.min || remoteMilestone.node_chunk_info[deviceNodeID].max != currentVersionRange2.max || isObjectDifferent((_a6 = remoteMilestone.tweak_values) == null ? void 0 : _a6[deviceNodeID], currentTweakValues) || typeof remoteMilestone._rev == "undefined" || !(DEVICE_ID_PREFERRED in remoteMilestone.tweak_values);
  if (!remoteMilestone.node_info) {
    remoteMilestone.node_info = {};
  }
  if (!(deviceNodeID in remoteMilestone.node_info)) {
    remoteMilestone.node_info[deviceNodeID] = {
      ...nodeDeviceInfo,
      last_connected: 0,
      progress: ""
    };
    writeMilestone = true;
  }
  const info3 = remoteMilestone.node_info[deviceNodeID];
  const keys2 = ["device_name", "app_version", "plugin_version", "vault_name", "progress"];
  for (const key4 of keys2) {
    if (info3[key4] != nodeDeviceInfo[key4]) {
      remoteMilestone.node_info[deviceNodeID][key4] = nodeDeviceInfo[key4];
      writeMilestone = true;
    }
  }
  const diffLastConnected = now - (remoteMilestone.node_info[deviceNodeID].last_connected || 0);
  if (diffLastConnected > 6e4) {
    remoteMilestone.node_info[deviceNodeID].last_connected = now;
    writeMilestone = true;
  }
  if (writeMilestone) {
    remoteMilestone.node_chunk_info[deviceNodeID].min = currentVersionRange2.min;
    remoteMilestone.node_chunk_info[deviceNodeID].max = currentVersionRange2.max;
    remoteMilestone.tweak_values = { ...(_b4 = remoteMilestone.tweak_values) != null ? _b4 : {}, [deviceNodeID]: currentTweakValues };
    if (!(DEVICE_ID_PREFERRED in remoteMilestone.tweak_values)) {
      remoteMilestone.tweak_values[DEVICE_ID_PREFERRED] = currentTweakValues;
    }
    await updateCallback(remoteMilestone);
  }
  let globalMin = currentVersionRange2.min;
  let globalMax = currentVersionRange2.max;
  for (const nodeId of remoteMilestone.accepted_nodes) {
    if (nodeId == deviceNodeID) continue;
    if (nodeId in remoteMilestone.node_chunk_info) {
      const nodeInfo = remoteMilestone.node_chunk_info[nodeId];
      globalMin = Math.max(nodeInfo.min, globalMin);
      globalMax = Math.min(nodeInfo.max, globalMax);
    } else {
      globalMin = 0;
      globalMax = 0;
    }
  }
  if (globalMax < globalMin) {
    if (!setting.ignoreVersionCheck) {
      return "INCOMPATIBLE";
    }
  }
  if (!setting.disableCheckingConfigMismatch) {
    const preferred_tweak = (_d = (_c2 = remoteMilestone.tweak_values) == null ? void 0 : _c2[DEVICE_ID_PREFERRED]) != null ? _d : currentTweakValues;
    const current_tweak = currentTweakValues;
    const preferred_should_matched = extractObject(TweakValuesShouldMatchedTemplate, {
      ...TweakValuesDefault,
      ...preferred_tweak
    });
    const current_should_matched = extractObject(TweakValuesShouldMatchedTemplate, {
      ...TweakValuesDefault,
      ...current_tweak
    });
    if (isObjectDifferent(preferred_should_matched, current_should_matched, true)) {
      return ["MISMATCHED", preferred_tweak];
    }
  }
  if (remoteMilestone.locked) {
    if (remoteMilestone.accepted_nodes.indexOf(deviceNodeID) == -1) {
      if (remoteMilestone.cleaned) {
        return "NODE_CLEANED";
      }
      return "NODE_LOCKED";
    }
    return "LOCKED";
  }
  return "OK";
}
async function ensureDatabaseIsCompatible(db, setting, deviceNodeID, currentVersionRange2, nodeDeviceInfo) {
  const remoteMilestone = await resolveWithIgnoreKnownError(
    db.get(MILESTONE_DOCID),
    false
  );
  const ret = await ensureRemoteIsCompatible(
    remoteMilestone,
    setting,
    deviceNodeID,
    currentVersionRange2,
    nodeDeviceInfo,
    async (info3) => {
      await db.put(info3);
    }
  );
  return ret;
}
var init_LiveSyncDBFunctions = __esm({
  "src/sync/core/pouchdb/LiveSyncDBFunctions.ts"() {
    "use strict";
    init_types();
    init_utils2();
  }
});

// src/sync/core/replication/LiveSyncAbstractReplicator.ts
var LiveSyncAbstractReplicator;
var init_LiveSyncAbstractReplicator = __esm({
  "src/sync/core/replication/LiveSyncAbstractReplicator.ts"() {
    "use strict";
    init_types();
    init_logger2();
    init_utils2();
    init_convert();
    init_i18n();
    LiveSyncAbstractReplicator = class {
      constructor(env) {
        this.syncStatus = "NOT_CONNECTED";
        this.docArrived = 0;
        this.docSent = 0;
        this.lastSyncPullSeq = 0;
        this.maxPullSeq = 0;
        this.lastSyncPushSeq = 0;
        this.maxPushSeq = 0;
        this.nodeid = "";
        this.remoteLocked = false;
        this.remoteCleaned = false;
        this.remoteLockedAndDeviceNotAccepted = false;
        this.tweakSettingsMismatched = false;
        this.updateInfo = () => {
          this.env.replicationStat.value = {
            sent: this.docSent,
            arrived: this.docArrived,
            maxPullSeq: this.maxPullSeq,
            maxPushSeq: this.maxPushSeq,
            lastSyncPullSeq: this.lastSyncPullSeq,
            lastSyncPushSeq: this.lastSyncPushSeq,
            syncStatus: this.syncStatus
          };
        };
        this.env = env;
      }
      async ensurePBKDF2Salt(setting, showMessage = false, useCache = true) {
        var _a6, _b4, _c2;
        try {
          const hash2 = await this.getReplicationPBKDF2Salt(setting, !useCache);
          if (hash2.length == 0) {
            throw new Error("PBKDF2 salt (Security Seed) is empty");
          }
          Logger(`PBKDF2 salt (Security Seed) verified`, LOG_LEVEL_VERBOSE);
          return true;
        } catch (ex) {
          const serverReachable = (_c2 = (_b4 = (_a6 = this.env).isServerReachable) == null ? void 0 : _b4.call(_a6)) != null ? _c2 : true;
          if (!serverReachable) {
            Logger("PBKDF2 salt fetch skipped - server unreachable", LOG_LEVEL_VERBOSE);
            return false;
          }
          const level = showMessage ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO;
          Logger(`Failed to obtain PBKDF2 salt (Security Seed) for replication`, level);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Get the storage key for the known salt of a specific database.
       * @param dbName The name of the database.
       * @returns The storage key.
       */
      _getKnownSaltKey(dbName) {
        return `known_salt_${dbName}`;
      }
      /**
       * Check if the remote database's PBKDF2 salt has changed since last sync.
       * This is used to detect remote database resets.
       * @param setting The remote database settings.
       * @returns The result of the salt check.
       */
      async checkSaltConsistency(setting) {
        const saltKey = this._getKnownSaltKey(setting.couchDB_DBNAME);
        const saltStore = this.env.services.database.openSimpleStore("friday-sync-salt");
        try {
          const remoteSalt = await this.getReplicationPBKDF2Salt(setting, true);
          const remoteSaltBase64 = await arrayBufferToBase64Single(remoteSalt);
          const storedSalt = await saltStore.get(saltKey);
          if (!storedSalt) {
            Logger(`First sync detected, storing initial salt`, LOG_LEVEL_VERBOSE);
            await saltStore.set(saltKey, remoteSaltBase64);
            return { ok: true, needsFetch: false };
          }
          if (storedSalt !== remoteSaltBase64) {
            Logger(`Salt mismatch detected! Stored: ${storedSalt.substring(0, 16)}..., Remote: ${remoteSaltBase64.substring(0, 16)}...`, LOG_LEVEL_INFO);
            this.remoteLockedAndDeviceNotAccepted = true;
            this.remoteLocked = true;
            this.remoteCleaned = true;
            return {
              ok: false,
              message: $msg("fridaySync.saltChanged.message"),
              needsFetch: true
            };
          }
          Logger(`Salt consistency check passed`, LOG_LEVEL_VERBOSE);
          return { ok: true, needsFetch: false };
        } catch (ex) {
          Logger($msg("fridaySync.saltCheck.failed"), LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return { ok: true, needsFetch: false };
        }
      }
      /**
       * Update the stored salt after a successful sync or fetch operation.
       * @param setting The remote database settings.
       */
      async updateStoredSalt(setting) {
        try {
          const saltKey = this._getKnownSaltKey(setting.couchDB_DBNAME);
          const saltStore = this.env.services.database.openSimpleStore("friday-sync-salt");
          const remoteSalt = await this.getReplicationPBKDF2Salt(setting, true);
          const remoteSaltBase64 = await arrayBufferToBase64Single(remoteSalt);
          await saltStore.set(saltKey, remoteSaltBase64);
          Logger(`Stored salt updated successfully`, LOG_LEVEL_VERBOSE);
        } catch (ex) {
          Logger(`Failed to update stored salt`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Clear the stored salt. Call this after "Fetch from Server" to accept new salt.
       * @param setting The remote database settings.
       */
      async clearStoredSalt(setting) {
        try {
          const saltKey = this._getKnownSaltKey(setting.couchDB_DBNAME);
          const saltStore = this.env.services.database.openSimpleStore("friday-sync-salt");
          await saltStore.delete(saltKey);
          Logger(`Stored salt cleared`, LOG_LEVEL_VERBOSE);
        } catch (ex) {
          Logger(`Failed to clear stored salt`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
      async initializeDatabaseForReplication() {
        const db = this.env.getDatabase();
        try {
          const nodeinfo = await resolveWithIgnoreKnownError(db.get(NODEINFO_DOCID), {
            _id: NODEINFO_DOCID,
            type: "nodeinfo",
            nodeid: "",
            v20220607: true
          });
          if (nodeinfo.nodeid == "") {
            nodeinfo.nodeid = Math.random().toString(36).slice(-10);
            await db.put(nodeinfo);
          }
          this.nodeid = nodeinfo.nodeid;
          return true;
        } catch (ex) {
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
        return false;
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/concurrency/lock_v2.js
function serialized(key4, proc) {
  var _a6;
  const prev = serializedMap.get(key4);
  const p = promiseWithResolvers();
  queueCount.set(key4, ((_a6 = queueCount.get(key4)) != null ? _a6 : 0) + 1);
  const nextTask = async () => {
    try {
      p.resolve(await proc());
    } catch (ex) {
      p.reject(ex);
    } finally {
      const count = queueCount.get(key4) - 1;
      if (count === 0) {
        serializedMap.delete(key4);
        queueCount.delete(key4);
      } else {
        queueCount.set(key4, count);
      }
    }
  };
  if (prev) {
    const newP = prev.then(() => nextTask());
    serializedMap.set(key4, newP);
  } else {
    serializedMap.set(key4, nextTask());
  }
  return p.promise;
}
function shareRunningResult(key4, proc) {
  const prev = shareSerializedMap.get(key4);
  if (prev)
    return prev;
  const p = promiseWithResolvers();
  shareSerializedMap.set(key4, p.promise);
  const task = async () => {
    try {
      p.resolve(await proc());
    } catch (ex) {
      p.reject(ex);
    } finally {
      shareSerializedMap.delete(key4);
    }
  };
  fireAndForget(() => task());
  return p.promise;
}
function skipIfDuplicated(key4, proc) {
  const prev = skipDuplicatedMap.get(key4);
  if (prev)
    return Promise.resolve(null);
  const p = promiseWithResolvers();
  skipDuplicatedMap.set(key4, p.promise);
  const task = async () => {
    try {
      p.resolve(await proc());
    } catch (ex) {
      p.reject(ex);
    } finally {
      skipDuplicatedMap.delete(key4);
    }
  };
  fireAndForget(() => task());
  return p.promise;
}
var serializedMap, queueCount, shareSerializedMap, skipDuplicatedMap, SYMBOL_SKIPPED, SCHEDULE_SKIPPED;
var init_lock_v2 = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/lock_v2.js"() {
    init_promises();
    serializedMap = /* @__PURE__ */ new Map();
    queueCount = /* @__PURE__ */ new Map();
    shareSerializedMap = /* @__PURE__ */ new Map();
    skipDuplicatedMap = /* @__PURE__ */ new Map();
    SYMBOL_SKIPPED = Symbol("SKIPPED");
    SCHEDULE_SKIPPED = Symbol("skipped");
  }
});

// node_modules/octagonal-wheels/dist/concurrency/lock.js
var init_lock = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/lock.js"() {
    init_lock_v2();
  }
});

// node_modules/octagonal-wheels/dist/memory/memutil.js
function generateId(prefix) {
  idx++;
  if (idx > 1e4) {
    series = `${Date.now()}`;
    idx = 0;
  }
  const paddedIdx = idx + 1e7;
  return `${PREFIX_TRENCH}-${prefix}-${series}-${paddedIdx}`;
}
function createRange(prefix, series2) {
  return [`${PREFIX_TRENCH}-${prefix}-${series2}-`, `${PREFIX_TRENCH}-${prefix}-${series2}.`];
}
function createId(prefix, series2, idx2) {
  const paddedIdx = idx2 + 1e7;
  return `${PREFIX_TRENCH}-${prefix}-${series2}-${paddedIdx}`;
}
var PREFIX_TRENCH, PREFIX_EPHEMERAL, PREFIX_PERMANENT, idx, series, indexes, inProgress, failed, Trench;
var init_memutil = __esm({
  "node_modules/octagonal-wheels/dist/memory/memutil.js"() {
    PREFIX_TRENCH = "trench";
    PREFIX_EPHEMERAL = "ephemeral";
    PREFIX_PERMANENT = "permanent";
    idx = 0;
    series = `${Date.now()}`;
    indexes = /* @__PURE__ */ new Map();
    inProgress = /* @__PURE__ */ new Set();
    failed = /* @__PURE__ */ new Map();
    Trench = class {
      /**
       * Constructs a new instance of the Trench class.
       * @param db The SimpleStore instance used for storing data.
       * @param flushExistItems Determines whether to flush existing items from the database.
       */
      constructor(db, flushExistItems = true) {
        Object.defineProperty(this, "_db", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_flushTask", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "concealing", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        this._db = db;
        if (flushExistItems) {
          this._flushTask = (async () => {
            const keys2 = await db.keys(`${PREFIX_TRENCH}-${PREFIX_EPHEMERAL}`, `${PREFIX_TRENCH}-${PREFIX_EPHEMERAL}.`);
            for (const key4 of keys2) {
              await db.delete(key4);
            }
          })();
        }
      }
      /**
       * Deletes all ephemeral keys from the SimpleStore.
       * @returns {Promise<void>} A promise that resolves when all ephemeral keys are deleted.
       */
      async eraseAllEphemerals() {
        const keys2 = await this._db.keys(`${PREFIX_TRENCH}-${PREFIX_EPHEMERAL}`, `${PREFIX_TRENCH}-${PREFIX_EPHEMERAL}.`);
        for (const key4 of keys2) {
          await this._db.delete(key4);
        }
      }
      /**
       * Deletes all permanences from the SimpleStore.
       * @returns {Promise<void>} A promise that resolves when all permanences are deleted.
       */
      async eraseAllPermanences() {
        const keys2 = await this._db.keys(`${PREFIX_TRENCH}-${PREFIX_PERMANENT}`, `${PREFIX_TRENCH}-${PREFIX_PERMANENT}.`);
        for (const key4 of keys2) {
          await this._db.delete(key4);
        }
      }
      /**
       * Conceals an object by generating a unique key and storing the object in SimpleStore.
       * The object can later be retrieved using the generated key.
       * @param obj - The object to be concealed.
       * @returns The generated key used to retrieve the concealed object.
       */
      conceal(obj) {
        const key4 = generateId(PREFIX_EPHEMERAL);
        this.concealing.set(key4, obj);
        void this._db.set(key4, obj).then(async (e2) => {
          if (this.concealing.has(key4)) {
            this.concealing.delete(key4);
          } else {
            await this._db.delete(key4);
          }
        });
        return key4;
      }
      /**
       * Dispose concealed object.
       * @param key - The key to bury.
       */
      async bury(key4) {
        if (this.concealing.has(key4)) {
          this.concealing.delete(key4);
        }
        await this._db.delete(key4);
      }
      /**
       * Exposes a concealed object by its key.
       * The object is removed from the database after being exposed.
       * @param key - The key of the concealed object.
       * @returns The exposed object.
       */
      async expose(key4) {
        if (this.concealing.has(key4)) {
          const value2 = this.concealing.get(key4);
          this.concealing.delete(key4);
          return value2;
        }
        const obj = await this._db.get(key4);
        await this._db.delete(key4);
        return obj;
      }
      _evacuate(storeTask, key4) {
        return async () => {
          if (this._flushTask) {
            await this._flushTask;
            this._flushTask = void 0;
          }
          await storeTask;
          const item = await this._db.get(key4);
          await this._db.delete(key4);
          return item;
        };
      }
      /**
       * Evacuates a promise by storing its resolved value in the database and returning an `Evacuated` object.
       * @param task The promise to be evacuated.
       * @returns An `Evacuated` object representing the evacuated promise.
       */
      evacuatePromise(task) {
        const key4 = generateId(PREFIX_EPHEMERAL);
        const storeTask = (async () => {
          const data = await task;
          await this._db.set(key4, data);
        })();
        return this._evacuate(storeTask, key4);
      }
      /**
       * Evacuates an object by storing it in the database and returning an `Evacuated` object.
       * If the object is a Promise, it is first evacuated using the `evacuatePromise` method.
       * @param obj - The object to be evacuated.
       * @returns An `Evacuated` object representing the evacuated object.
       */
      evacuate(obj) {
        if (obj instanceof Promise)
          return this.evacuatePromise(obj);
        const key4 = generateId(PREFIX_EPHEMERAL);
        const storeTask = this._db.set(key4, obj);
        return this._evacuate(storeTask, key4);
      }
      async _queue(type, key4, obj, index6) {
        var _a6;
        if (index6 === void 0) {
          index6 = (_a6 = indexes.get(key4)) != null ? _a6 : 0;
          indexes.set(key4, index6 + 1);
        }
        const storeKey = createId(type, key4, index6);
        await this._db.set(storeKey, obj);
      }
      async _dequeue(type, key4) {
        const range2 = createRange(type, key4);
        const keys2 = (await this._db.keys(range2[0], range2[1])).filter((e2) => !inProgress.has(e2));
        if (keys2.length === 0)
          return void 0;
        return await this.expose(keys2[0]);
      }
      async _dequeueWithCommit(type, key4) {
        const range2 = createRange(type, key4);
        const keysAll = await this._db.keys(range2[0], range2[1]);
        const keys2 = keysAll.filter((e2) => !inProgress.has(e2));
        if (keys2.length === 0)
          return void 0;
        const storeKey = keys2[0];
        inProgress.add(storeKey);
        const previousFailed = failed.get(storeKey) || 0;
        const value2 = await this._db.get(storeKey);
        return {
          key: storeKey,
          value: value2,
          cancelCount: previousFailed,
          pendingItems: keysAll.length - 1,
          commit: async () => {
            await this._db.delete(storeKey);
            failed.delete(storeKey);
            inProgress.delete(storeKey);
          },
          cancel: () => {
            failed.set(storeKey, (failed.get(storeKey) || 0) + 1);
            inProgress.delete(storeKey);
          }
        };
      }
      /**
       * Queues an object with the specified key and optional index.
       *
       * @template T - The type of the object being queued.
       * @param {string} key - The key to associate with the object.
       * @param {T} obj - The object to be queued.
       * @param {number} [index] - The optional index at which to insert the object in the queue.
       * @returns {Promise<void>} A promise that resolves when the object is queued.
       */
      queue(key4, obj, index6) {
        return this._queue(PREFIX_EPHEMERAL, key4, obj, index6);
      }
      /**
       * Removes and returns the first element from the queue associated with the specified key.
       *
       * @template T - The type of elements in the queue.
       * @param key - The key associated with the queue.
       * @returns The first element from the queue, or undefined if the queue is empty.
       */
      dequeue(key4) {
        return this._dequeue(PREFIX_EPHEMERAL, key4);
      }
      /**
       * Dequeues an item. you can commit or cancel the dequeue operation.
       *
       * @template T - The type of the item being dequeued.
       * @param key - The key of the item to dequeue.
       * @returns The dequeued item.
       */
      dequeueWithCommit(key4) {
        return this._dequeueWithCommit(PREFIX_EPHEMERAL, key4);
      }
      /**
       * Queues an object permanently in the SimpleStore.
       *
       * @template T - The type of the object being queued.
       * @param key - The key to associate with the object.
       * @param obj - The object to be queued.
       * @param index - Optional. The index at which to insert the object in the queue.
       * @returns The updated queue.
       */
      queuePermanent(key4, obj, index6) {
        return this._queue(PREFIX_PERMANENT, key4, obj, index6);
      }
      /**
       * Dequeues an permanent item from the SimpleStore with the specified key.
       *
       * @template T - The type of the item to dequeue.
       * @param key - The key of the item to dequeue.
       * @returns The dequeued item.
       */
      dequeuePermanent(key4) {
        return this._dequeue(PREFIX_PERMANENT, key4);
      }
      /**
       * Dequeues an permanent item from the SimpleStore. we can commit or cancel the dequeue operation.
       *
       * @template T - The type of the item being dequeued.
       * @param key - The key of the item to dequeue.
       * @returns The dequeued item.
       */
      dequeuePermanentWithCommit(key4) {
        return this._dequeueWithCommit(PREFIX_PERMANENT, key4);
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/bureau/Inbox.js
var NOT_AVAILABLE, READY_PICK_SIGNAL, READY_POST_SIGNAL, DISPOSE_ERROR, SyncInbox, Inbox;
var init_Inbox = __esm({
  "node_modules/octagonal-wheels/dist/bureau/Inbox.js"() {
    init_promises();
    NOT_AVAILABLE = Symbol("NotAvailable");
    READY_PICK_SIGNAL = Symbol("lockReady");
    READY_POST_SIGNAL = Symbol("lockFull");
    DISPOSE_ERROR = "Inbox has been disposed";
    SyncInbox = class {
      constructor(capacity) {
        Object.defineProperty(this, "_capacity", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_buffer", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_writeIdx", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_readIdx", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_wrapAroundCount", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_isDisposed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "_disposedPromise", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: promiseWithResolvers()
        });
        if (capacity <= 0) {
          throw new Error("Capacity must be greater than 0");
        }
        this._capacity = ~~capacity;
        let i = 256;
        while (i < capacity + 1) {
          i *= 2;
        }
        i--;
        this._wrapAroundCount = i;
        this._buffer = new Array(i);
        this._writeIdx = 0;
        this._readIdx = 0;
      }
      /**
       * The number of items in the buffer.
       */
      get size() {
        return this._writeIdx - this._readIdx;
      }
      /**
       * The number of free slots in the buffer.
       */
      get free() {
        return this._capacity - this.size;
      }
      /**
       * Whether the buffer is running out.
       */
      get isRunningOut() {
        return this._writeIdx == this._readIdx;
      }
      /**
       * Whether the buffer is full.
       */
      get isFull() {
        return this.free == 0;
      }
      /**
       * Whether the buffer is ready to be picked.
       */
      get isReady() {
        return this.free > 0;
      }
      get isDisposed() {
        return this._isDisposed;
      }
      get onDisposed() {
        return this._disposedPromise.promise;
      }
      __fixIdx() {
        if (this._readIdx > this._wrapAroundCount) {
          this._readIdx = this._readIdx & this._wrapAroundCount;
          this._writeIdx = this._writeIdx & this._wrapAroundCount;
        }
      }
      get state() {
        return {
          processed: this._writeIdx,
          size: this.size,
          free: this.free,
          isFull: this.isFull,
          isRunningOut: this.isRunningOut,
          isReady: this.isReady
        };
      }
      dispose() {
        this._readIdx = 0;
        this._writeIdx = 0;
        this._capacity = 0;
        this._buffer.length = 1;
        this._buffer[0] = void 0;
        this._wrapAroundCount = 1;
        this._isDisposed = true;
        this._disposedPromise.resolve();
      }
      __onPosted() {
        this.__onProgress();
      }
      __onPicked() {
        this.__onProgress();
      }
      __onProgress() {
        this.__fixIdx();
      }
      /**
       * Tries to post an item to the buffer.
       * @param item The item to post.
       * @returns whether the item is posted. `false` if the buffer is full.
       */
      tryPost(item) {
        if (this.isFull) {
          return false;
        }
        this._writeIdx++;
        this._buffer[this._writeIdx & this._wrapAroundCount] = item;
        this.__onPosted();
        return true;
      }
      /**
       * Tries to cancel the last posted item.
       * @returns The item picked, or `NOT_AVAILABLE` if no item is available.
       */
      tryCancelPost() {
        if (this.size == 0) {
          return NOT_AVAILABLE;
        }
        const pointingIdx = this._writeIdx & this._wrapAroundCount;
        const item = this._buffer[pointingIdx];
        this._buffer[pointingIdx] = void 0;
        this._writeIdx--;
        this.__fixIdx();
        return item;
      }
      /**
       * Tries to pick an item from the buffer.
       * @returns The item picked, or `NOT_AVAILABLE` if no item is available.
       */
      tryPick() {
        if (this.isRunningOut) {
          return NOT_AVAILABLE;
        }
        this._readIdx++;
        const pointingIdx = this._readIdx & this._wrapAroundCount;
        const item = this._buffer[pointingIdx];
        this._buffer[pointingIdx] = void 0;
        this.__onPicked();
        return item;
      }
    };
    Inbox = class extends SyncInbox {
      /**
       * Creates a new PostBox.
       * @param capacity The capacity of the buffer.
       */
      constructor(capacity) {
        super(capacity);
        Object.defineProperty(this, "_lockFull", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_lockReady", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
      }
      async _waitForFree() {
        while (this.free == 0) {
          if (!this._lockFull) {
            this._lockFull = promiseWithResolvers();
          }
          return await this._lockFull.promise;
        }
        return READY_POST_SIGNAL;
      }
      _notifyFree() {
        var _a6;
        (_a6 = this._lockFull) == null ? void 0 : _a6.resolve(READY_POST_SIGNAL);
        this._lockFull = void 0;
      }
      async _waitForReady() {
        while (this.isRunningOut) {
          if (!this._lockReady) {
            this._lockReady = promiseWithResolvers();
          }
          return await this._lockReady.promise;
        }
        return READY_PICK_SIGNAL;
      }
      _notifyReady() {
        var _a6;
        (_a6 = this._lockReady) == null ? void 0 : _a6.resolve(READY_PICK_SIGNAL);
        this._lockReady = void 0;
      }
      __onPosted() {
        super.__onPosted();
        this._notifyReady();
      }
      __onPicked() {
        super.__onPicked();
        this._notifyFree();
      }
      dispose() {
        super.dispose();
        if (this._lockFull) {
          this._lockFull.reject(new Error(DISPOSE_ERROR));
          this._lockFull = void 0;
        }
        if (this._lockReady) {
          this._lockReady.reject(new Error(DISPOSE_ERROR));
          this._lockReady = void 0;
        }
      }
      /**
       * Posts an item to the buffer.
       * Waits until a slot is available.
       * @param item The item to post.
       * @param timeout The timeout in milliseconds.
       * @param cancellation The promise that cancels the operation.
       * @returns whether the item is posted.
       */
      async post(item, timeout, cancellation) {
        if (this._isDisposed) {
          throw new Error(DISPOSE_ERROR);
        }
        do {
          if (cancellation && cancellation.length > 0 && await isSomeResolved(cancellation)) {
            return false;
          }
          const result = this.tryPost(item);
          if (result) {
            return true;
          }
          let p;
          const tasks3 = [
            this._waitForFree(),
            ...timeout ? [(p = cancelableDelay(timeout)).promise] : [],
            ...cancellation ? cancellation : []
          ];
          const r = await Promise.race(tasks3);
          p == null ? void 0 : p.cancel();
          if (r === READY_POST_SIGNAL) {
            continue;
          }
          return false;
        } while (!this._isDisposed);
        return false;
      }
      /**
       * Picks an item from the buffer.
       * Waits until an item is available.
       * @param timeout The timeout in milliseconds.
       * @param cancellation The promise that cancels the operation.
       * @returns The item picked.
       */
      async pick(timeout, cancellation) {
        if (this._isDisposed) {
          throw new Error(DISPOSE_ERROR);
        }
        do {
          if (cancellation && cancellation.length > 0 && await isSomeResolved(cancellation)) {
            return NOT_AVAILABLE;
          }
          const item = this.tryPick();
          if (item !== NOT_AVAILABLE) {
            return item;
          }
          let p;
          const tasks3 = [
            this._waitForReady(),
            ...timeout ? [(p = cancelableDelay(timeout)).promise] : [],
            ...cancellation ? cancellation : []
          ];
          const r = await Promise.race(tasks3);
          p == null ? void 0 : p.cancel();
          if (r === READY_PICK_SIGNAL) {
            continue;
          }
          return NOT_AVAILABLE;
        } while (!this.isDisposed);
        return NOT_AVAILABLE;
      }
    };
  }
});

// src/sync/core/replication/SyncParamsHandler.ts
function createSyncParamsHanderForServer(key4, options) {
  if (_handlers.has(key4)) {
    return _handlers.get(key4);
  }
  const handler = createSyncParamsHandler(options);
  _handlers.set(key4, handler);
  return handler;
}
function clearHandlers() {
  _handlers.clear();
}
function createSyncParamsHandler({ put, get: get4, create }) {
  let taskFetchParameters = void 0;
  const _fetchSyncParameters = async () => {
    let syncParams = void 0;
    try {
      let shouldRetry = false;
      do {
        shouldRetry = false;
        try {
          syncParams = await get4();
          Logger(`Fetched synchronisation parameters`, LOG_LEVEL_INFO);
        } catch (ex) {
          if (LiveSyncError.isCausedBy(ex, SyncParamsNotFoundError)) {
            Logger(`Synchronisation parameters not found, creating new ones`, LOG_LEVEL_INFO);
            const newSyncParams = await create();
            const putResult = await put(newSyncParams);
            if (!putResult) {
              Logger(`Failed to store initial synchronisation parameters`, LOG_LEVEL_INFO);
              throw new SyncParamsUpdateError(`Failed to store initial synchronisation parameters`);
            }
            Logger(
              `Initial synchronisation parameters stored successfully, retrying fetch`,
              LOG_LEVEL_INFO
            );
            shouldRetry = true;
          } else {
            throw ex;
          }
        }
      } while (shouldRetry);
      if (!syncParams) {
        throw new SyncParamsFetchError(`Unexpected empty synchronisation parameters`);
      }
      if (!syncParams.pbkdf2salt) {
        Logger(`Synchronisation parameters do not have PBKDF2 salt, generating a new salt`, LOG_LEVEL_INFO);
        const salt = await arrayBufferToBase64Single(createPBKDF2Salt());
        if (!salt) {
          Logger(`Failed to generate PBKDF2 salt`, LOG_LEVEL_INFO);
          throw new SyncParamsFetchError(`Failed to generate PBKDF2 salt`);
        }
        syncParams.pbkdf2salt = salt;
        const putResult = await put(syncParams);
        if (!putResult) {
          Logger(`Failed to store synchronisation parameters with new PBKDF2 salt`, LOG_LEVEL_INFO);
          throw new SyncParamsUpdateError(`Failed to store synchronisation parameters with new PBKDF2 salt`);
        }
        syncParams = await get4();
      }
      if (!syncParams) {
        throw new Error(`Failed to prepare synchronisation key in synchronisation parameters`);
      }
      Logger(`Synchronisation parameters fetched successfully`, LOG_LEVEL_INFO);
      if (!syncParams.pbkdf2saltDecoded) {
        const decodedSalt = new Uint8Array(base64ToArrayBufferInternalBrowser(syncParams.pbkdf2salt));
        if (!decodedSalt) {
          throw new SyncParamsFetchError(`Failed to decode PBKDF2 salt`);
        }
        syncParams.pbkdf2saltDecoded = decodedSalt;
      }
      return syncParams;
    } catch (ex) {
      Logger(`Failed to fetch synchronisation parameters`, LOG_LEVEL_INFO);
      Logger(ex, LOG_LEVEL_VERBOSE);
      taskFetchParameters = void 0;
      return false;
    }
  };
  const fetchSyncParameters = (refresh = false) => {
    if (taskFetchParameters && !refresh) {
      return taskFetchParameters;
    }
    taskFetchParameters = _fetchSyncParameters();
    return taskFetchParameters;
  };
  return {
    fetch: fetchSyncParameters,
    getPBKDF2Salt: async (refresh = false) => {
      const syncParams = await fetchSyncParameters(refresh);
      if (!syncParams) {
        Logger(`Failed to fetch synchronisation parameters`, LOG_LEVEL_INFO);
        throw new SyncParamsFetchError(`Failed to fetch synchronisation parameters`);
      }
      return syncParams.pbkdf2saltDecoded;
    }
  };
}
var _handlers, SyncParamsHandlerError, SyncParamsFetchError, SyncParamsNotFoundError, SyncParamsUpdateError;
var init_SyncParamsHandler = __esm({
  "src/sync/core/replication/SyncParamsHandler.ts"() {
    "use strict";
    init_hkdf();
    init_logger2();
    init_convert();
    init_LSError();
    _handlers = /* @__PURE__ */ new Map();
    SyncParamsHandlerError = class extends LiveSyncError {
    };
    SyncParamsFetchError = class extends SyncParamsHandlerError {
    };
    SyncParamsNotFoundError = class extends SyncParamsHandlerError {
    };
    SyncParamsUpdateError = class extends SyncParamsHandlerError {
    };
  }
});

// src/sync/core/replication/couchdb/LiveSyncReplicator.ts
async function* genReplication(s, signal) {
  const inbox = new Inbox(1e4);
  const push2 = function(e2) {
    void serialized("replicationResult", async () => {
      if (signal.aborted) {
        return;
      }
      if (!inbox.isDisposed) {
        await inbox.post(e2);
      } else {
        Logger("Inbox is disposed", LOG_LEVEL_VERBOSE);
      }
    });
  };
  void s.on("complete", (result) => push2(["complete", result]));
  void s.on("change", (result) => push2(["change", result]));
  void s.on("active", () => push2(["active"]));
  void s.on("denied", (err2) => push2(["denied", err2]));
  void s.on("error", (err2) => push2(["error", err2]));
  void s.on("paused", (err2) => push2(["paused", err2]));
  void s.then(() => push2(["finally"])).catch(() => push2(["finally"]));
  const abortSymbol = Symbol("abort");
  const abortPromise = promiseWithResolver();
  signal.addEventListener("abort", () => {
    abortPromise.resolve(abortSymbol);
  });
  try {
    while (!inbox.isDisposed && !signal.aborted) {
      const r = await inbox.pick(void 0, [abortPromise.promise]);
      if (r === NOT_AVAILABLE) {
        break;
      }
      yield r;
    }
  } catch (ex) {
    if (ex instanceof Error && ex.name == "AbortError") {
      Logger(`Replication aborted`, LOG_LEVEL_VERBOSE);
    } else {
      throw ex;
    }
  } finally {
    s.cancel();
    inbox.dispose();
  }
}
var currentVersionRange, selectorOnDemandPull, LiveSyncCouchDBReplicator;
var init_LiveSyncReplicator = __esm({
  "src/sync/core/replication/couchdb/LiveSyncReplicator.ts"() {
    "use strict";
    init_types();
    init_utils2();
    init_logger2();
    init_negotiation();
    init_encryption2();
    init_LiveSyncDBFunctions();
    init_LiveSyncAbstractReplicator();
    init_lock();
    init_semaphore();
    init_memutil();
    init_promises();
    init_Inbox();
    init_i18n();
    init_SyncParamsHandler();
    init_convert();
    currentVersionRange = {
      min: 0,
      max: 2400,
      current: 2
    };
    selectorOnDemandPull = { selector: { type: { $ne: "leaf" } } };
    LiveSyncCouchDBReplicator = class extends LiveSyncAbstractReplicator {
      constructor(env) {
        super(env);
        this.syncStatus = "NOT_CONNECTED";
        this.docArrived = 0;
        this.docSent = 0;
        // ✨ 追踪实际文件数（不包括 chunks）
        this.filesUploaded = 0;
        this.lastSyncPullSeq = 0;
        this.maxPullSeq = 0;
        this.lastSyncPushSeq = 0;
        this.maxPushSeq = 0;
        this.nodeid = "";
        this.remoteLocked = false;
        this.remoteCleaned = false;
        this.remoteLockedAndDeviceNotAccepted = false;
        // Instance-level salt cache (session lifetime)
        this._saltCache = null;
        this.updateInfo = () => {
          this.env.replicationStat.value = {
            sent: this.docSent,
            arrived: this.docArrived,
            maxPullSeq: this.maxPullSeq,
            maxPushSeq: this.maxPushSeq,
            lastSyncPullSeq: this.lastSyncPullSeq,
            lastSyncPushSeq: this.lastSyncPushSeq,
            syncStatus: this.syncStatus
          };
        };
        this.env = env;
        void this.initializeDatabaseForReplication();
        this.env.getDatabase().on("close", () => {
          this.closeReplication();
        });
      }
      isMobile() {
        return this.env.services.API.isMobile();
      }
      getInitialSyncParameters(setting) {
        return Promise.resolve({
          ...DEFAULT_SYNC_PARAMETERS,
          protocolVersion: ProtocolVersions.ADVANCED_E2EE
        });
      }
      async getSyncParameters(setting) {
        try {
          const downloadedSyncParams = await this.fetchRemoteDocument(setting, DOCID_SYNC_PARAMETERS);
          if (!downloadedSyncParams) {
            throw new SyncParamsNotFoundError(`Sync parameters not found on remote server`);
          }
          return downloadedSyncParams;
        } catch (ex) {
          Logger(`Could not retrieve remote sync parameters`, LOG_LEVEL_INFO);
          throw SyncParamsFetchError.fromError(ex);
        }
      }
      async putSyncParameters(setting, params) {
        try {
          const ret = await this.putRemoteDocument(setting, params);
          if (ret.ok) {
            return true;
          } else {
            throw new SyncParamsUpdateError(`Could not store remote sync parameters: ${JSON.stringify(ret)}`);
          }
        } catch (ex) {
          Logger(`Could not store remote sync parameters`, LOG_LEVEL_INFO);
          throw SyncParamsUpdateError.fromError(ex);
        }
      }
      async getReplicationPBKDF2Salt(setting, refresh = false) {
        var _a6, _b4, _c2;
        if (this._saltCache && !refresh) {
          Logger("Using session salt cache", LOG_LEVEL_VERBOSE);
          return this._saltCache;
        }
        const serverReachable = (_c2 = (_b4 = (_a6 = this.env).isServerReachable) == null ? void 0 : _b4.call(_a6)) != null ? _c2 : true;
        if (!serverReachable) {
          Logger("Server unreachable, trying local salt cache", LOG_LEVEL_VERBOSE);
          const cachedSalt = await this.getLocalCachedSalt(setting.couchDB_DBNAME);
          if (cachedSalt) {
            Logger("Using local salt cache (offline mode)", LOG_LEVEL_INFO);
            this._saltCache = cachedSalt;
            return cachedSalt;
          }
          Logger("No salt cache available for offline mode", LOG_LEVEL_INFO);
          throw new Error(
            $msg("fridaySync.error.noCacheOffline") || "First-time setup requires server connection"
          );
        }
        try {
          const server = `${setting.couchDB_URI}/${setting.couchDB_DBNAME}`;
          const manager = createSyncParamsHanderForServer(server, {
            put: (params) => this.putSyncParameters(setting, params),
            get: () => this.getSyncParameters(setting),
            create: () => this.getInitialSyncParameters(setting)
          });
          const salt = await manager.getPBKDF2Salt(refresh);
          this._saltCache = salt;
          await this.saveLocalSaltCache(setting.couchDB_DBNAME, salt);
          Logger("Salt fetched from server and cached", LOG_LEVEL_VERBOSE);
          return salt;
        } catch (ex) {
          Logger(`Failed to fetch salt from server: ${ex}`, LOG_LEVEL_VERBOSE);
          const cachedSalt = await this.getLocalCachedSalt(setting.couchDB_DBNAME);
          if (cachedSalt) {
            Logger("Falling back to local salt cache", LOG_LEVEL_INFO);
            this._saltCache = cachedSalt;
            return cachedSalt;
          }
          Logger("No salt available (server failed and no cache)", LOG_LEVEL_INFO);
          throw ex;
        }
      }
      /**
       * Save salt to local persistent cache (reuses existing "friday-sync-salt" store)
       */
      async saveLocalSaltCache(dbName, salt) {
        try {
          const saltKey = this._getKnownSaltKey(dbName);
          const saltStore = this.env.services.database.openSimpleStore("friday-sync-salt");
          const saltBase64 = await arrayBufferToBase64Single(salt);
          await saltStore.set(saltKey, saltBase64);
          Logger("Salt saved to local cache", LOG_LEVEL_VERBOSE);
        } catch (ex) {
          Logger(`Failed to save salt cache: ${ex}`, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Get salt from local persistent cache (reuses existing "friday-sync-salt" store)
       */
      async getLocalCachedSalt(dbName) {
        try {
          const saltKey = this._getKnownSaltKey(dbName);
          const saltStore = this.env.services.database.openSimpleStore("friday-sync-salt");
          const saltBase64 = await saltStore.get(saltKey);
          if (saltBase64) {
            const salt = new Uint8Array(base64ToArrayBufferInternalBrowser(saltBase64));
            Logger("Local salt cache found", LOG_LEVEL_VERBOSE);
            return salt;
          }
          Logger("No local salt cache found", LOG_LEVEL_VERBOSE);
          return null;
        } catch (ex) {
          Logger(`Failed to read salt cache: ${ex}`, LOG_LEVEL_VERBOSE);
          return null;
        }
      }
      // eslint-disable-next-line require-await
      async migrate(from, to) {
        Logger(`Database updated from ${from} to ${to}`, LOG_LEVEL_INFO);
        return Promise.resolve(true);
      }
      terminateSync() {
        if (!this.controller) {
          return;
        }
        this.controller.abort();
        this.controller = void 0;
      }
      async openReplication(setting, keepAlive, showResult, ignoreCleanLock) {
        if (!ignoreCleanLock && this.remoteLockedAndDeviceNotAccepted) {
          Logger(
            $msg("fridaySync.saltChanged.syncBlocked") || "Synchronization is blocked because the remote database has been reset. Please use 'Fetch from Server'.",
            LOG_LEVEL_NOTICE
          );
          this.syncStatus = "ERRORED";
          this.updateInfo();
          return false;
        }
        await this.initializeDatabaseForReplication();
        if (keepAlive) {
          void this.openContinuousReplication(setting, showResult, false);
        } else {
          return this.openOneShotReplication(setting, showResult, false, "sync", ignoreCleanLock);
        }
      }
      replicationActivated(showResult) {
        this.syncStatus = "CONNECTED";
        this.updateInfo();
        Logger("Replication activated", showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE, "sync");
      }
      async replicationChangeDetected(e2, showResult, docSentOnStart, docArrivedOnStart) {
        try {
          if (e2.direction == "pull") {
            this.docArrived += e2.change.docs.length;
            this.updateInfo();
            await this.env.services.replication.parseSynchroniseResult(e2.change.docs);
          } else {
            this.docSent += e2.change.docs.length;
            this.updateInfo();
            if (this.env.onFileProgress) {
              const actualFiles = e2.change.docs.filter(
                (doc) => doc.type === "notes" || doc.type === "newnote" || doc.type === "plain"
              );
              if (actualFiles.length > 0) {
                this.filesUploaded += actualFiles.length;
                this.env.onFileProgress({
                  type: "upload_progress",
                  uploadedFiles: this.filesUploaded,
                  totalFiles: 0
                  // Total will be set by FridaySyncCore
                });
              }
            }
          }
          if (showResult) {
            const maxPullSeq = this.maxPullSeq;
            const maxPushSeq = this.maxPushSeq;
            const lastSyncPullSeq = this.lastSyncPullSeq;
            const lastSyncPushSeq = this.lastSyncPushSeq;
            const pushLast = lastSyncPushSeq == 0 ? "" : lastSyncPushSeq >= maxPushSeq ? " (LIVE)" : ` (${maxPushSeq - lastSyncPushSeq})`;
            const pullLast = lastSyncPullSeq == 0 ? "" : lastSyncPullSeq >= maxPullSeq ? " (LIVE)" : ` (${maxPullSeq - lastSyncPullSeq})`;
            Logger(
              `\u2191${this.docSent - docSentOnStart}${pushLast} \u2193${this.docArrived - docArrivedOnStart}${pullLast}`,
              LOG_LEVEL_VERBOSE,
              "sync"
            );
          }
          this.updateInfo();
        } catch (ex) {
          Logger("Replication callback error", LOG_LEVEL_VERBOSE, "sync");
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
      replicationCompleted(showResult) {
        this.syncStatus = "COMPLETED";
        this.updateInfo();
        Logger("Replication completed", showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE, showResult ? "sync" : "");
        this.terminateSync();
      }
      replicationDenied(e2) {
        this.syncStatus = "ERRORED";
        this.updateInfo();
        this.terminateSync();
        Logger($msg("liveSyncReplicator.replicationDenied") || "Sync access denied. Please check your credentials.", LOG_LEVEL_NOTICE, "sync");
        Logger(e2, LOG_LEVEL_VERBOSE);
      }
      replicationErrored(e2) {
        this.syncStatus = "ERRORED";
        this.terminateSync();
        this.updateInfo();
        Logger($msg("liveSyncReplicator.replicationErrored") || "Sync error occurred", LOG_LEVEL_NOTICE, "sync");
        Logger(e2, LOG_LEVEL_VERBOSE);
      }
      replicationPaused() {
        this.syncStatus = "PAUSED";
        this.updateInfo();
        Logger("Replication paused", LOG_LEVEL_VERBOSE, "sync");
      }
      async processSync(syncHandler, showResult, docSentOnStart, docArrivedOnStart, syncMode, retrying, reportCancelledAsDone = true) {
        const controller = new AbortController();
        if (this.controller) {
          this.controller.abort();
        }
        this.controller = controller;
        const gen = genReplication(syncHandler, controller.signal);
        try {
          for await (const [type, e2] of gen) {
            const releaser = await globalConcurrencyController.tryAcquire(1, REPLICATION_BUSY_TIMEOUT);
            if (releaser === false) {
              Logger("Sync paused temporarily.", showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE, "sync");
              return "FAILED";
            }
            releaser();
            switch (type) {
              case "change":
                if ("direction" in e2) {
                  if (e2.direction == "pull") {
                    this.lastSyncPullSeq = Number(`${e2.change.last_seq}`.split("-")[0]);
                  } else {
                    this.lastSyncPushSeq = Number(`${e2.change.last_seq}`.split("-")[0]);
                  }
                  await this.replicationChangeDetected(e2, showResult, docSentOnStart, docArrivedOnStart);
                } else {
                  if (syncMode == "pullOnly") {
                    this.lastSyncPullSeq = Number(`${e2.last_seq}`.split("-")[0]);
                    await this.replicationChangeDetected(
                      { direction: "pull", change: e2 },
                      showResult,
                      docSentOnStart,
                      docArrivedOnStart
                    );
                  } else if (syncMode == "pushOnly") {
                    this.lastSyncPushSeq = Number(`${e2.last_seq}`.split("-")[0]);
                    this.updateInfo();
                    await this.replicationChangeDetected(
                      { direction: "push", change: e2 },
                      showResult,
                      docSentOnStart,
                      docArrivedOnStart
                    );
                  }
                }
                if (retrying) {
                  if (this.docSent - docSentOnStart + (this.docArrived - docArrivedOnStart) > this.originalSetting.batch_size * 2) {
                    return "NEED_RESURRECT";
                  }
                }
                break;
              case "complete":
                this.replicationCompleted(showResult);
                return "DONE";
              case "active":
                this.replicationActivated(showResult);
                break;
              case "denied":
                this.replicationDenied(e2);
                return "FAILED";
              case "error":
                this.replicationErrored(e2);
                Logger("Replication stopped.", showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE, "sync");
                if (this.env.services.API.isLastPostFailedDueToPayloadSize()) {
                  if (e2 && (e2 == null ? void 0 : e2.status) == 413) {
                    Logger(
                      $msg("liveSyncReplicator.syncFileSizeError") || `Sync failed due to file size. Please check the log for details.`,
                      LOG_LEVEL_NOTICE
                    );
                    return "FAILED";
                  }
                  return "NEED_RETRY";
                } else {
                  Logger("Replication error", LOG_LEVEL_VERBOSE, "sync");
                  Logger(e2, LOG_LEVEL_VERBOSE);
                }
                return "FAILED";
              case "paused":
                this.replicationPaused();
                break;
              case "finally":
                break;
              default:
                Logger(`Unexpected synchronization status:${JSON.stringify(e2)}`);
            }
          }
          if (reportCancelledAsDone) {
            return "DONE";
          }
          return "CANCELLED";
        } catch (ex) {
          Logger(`Unexpected synchronization exception`);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return "FAILED";
        } finally {
          this.terminateSync();
          this.controller = void 0;
        }
      }
      getEmptyMaxEntry(remoteID) {
        return {
          _id: `_local/max_seq_on_chunk-${remoteID}`,
          maxSeq: 0,
          remoteID,
          seqStatusMap: {},
          _rev: void 0
        };
      }
      async getLastTransferredSeqOfChunks(localDB, remoteID) {
        const prevMax = {
          _id: `_local/max_seq_on_chunk-${remoteID}`,
          maxSeq: 0,
          remoteID,
          seqStatusMap: {},
          _rev: void 0
        };
        const previous_max_seq_on_chunk = await wrapException(() => localDB.get(prevMax._id));
        if (previous_max_seq_on_chunk instanceof Error) {
          return prevMax;
        }
        return previous_max_seq_on_chunk;
      }
      async updateMaxTransferredSeqOnChunks(localDB, remoteID, seqStatusMap) {
        const newMax = {
          _id: "_local/max_seq_on_chunk",
          maxSeq: 0,
          remoteID,
          seqStatusMap,
          _rev: void 0
        };
        const seqs = Object.keys(seqStatusMap).map((e2) => Number(e2));
        let maxSeq = 0;
        for (const seq of seqs) {
          if (!seqStatusMap[seq]) {
            break;
          }
          maxSeq = seq;
        }
        Logger(`Updating max seq on chunk to ${maxSeq}`, LOG_LEVEL_VERBOSE);
        newMax.maxSeq = maxSeq;
        const previous_max_seq_on_chunk = await wrapException(() => localDB.get(newMax._id));
        if (previous_max_seq_on_chunk instanceof Error) {
          delete newMax._rev;
        } else {
          newMax._rev = previous_max_seq_on_chunk._rev;
          newMax.seqStatusMap = { ...previous_max_seq_on_chunk.seqStatusMap, ...seqStatusMap };
        }
        await wrapException(() => localDB.put(newMax));
        return newMax;
      }
      // No longer used. Kept only for troubleshooting.
      async sendChunks(setting, remoteDB, showResult, fromSeq) {
        const trench = new Trench(
          this.env.services.database.openSimpleStore("sc-"),
          false
        );
        await trench.eraseAllEphemerals();
        if (!remoteDB) {
          const d = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
          if (typeof d === "string") {
            Logger(
              $msg("liveSyncReplicator.couldNotConnectToRemoteDb", { d }),
              showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
              "fetch"
            );
            return false;
          }
          remoteDB = d.db;
        }
        await this.checkReplicationConnectivity(setting, false, false, false, false);
        Logger(`Uploading files to server...`, showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO, "fetch");
        const remoteMilestone = await remoteDB.get(MILESTONE_DOCID);
        const remoteID = remoteMilestone == null ? void 0 : remoteMilestone.created;
        const localDB = this.env.getDatabase();
        const te3 = new TextEncoder();
        Logger(
          $msg("liveSyncReplicator.checkingLastSyncPoint"),
          showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
          "fetch"
        );
        this.syncStatus = "CONNECTED";
        const limitOneBatch = 250;
        const prev = await this.getLastTransferredSeqOfChunks(localDB, remoteID);
        const seq = fromSeq != null ? fromSeq : prev.maxSeq;
        const localScannedDocs = [];
        const sentMap = {};
        const diffChunks = localDB.changes({
          since: seq,
          live: false,
          include_docs: true,
          return_docs: false,
          selector: { type: "leaf" }
          // limit: limitOneBatch,
        }).on("change", (e2) => {
          const numSeq = Number(e2.seq);
          if (prev.seqStatusMap[numSeq]) {
            return;
          }
          localScannedDocs.push({ id: e2.id, seq: Number(e2.seq) });
        });
        await diffChunks;
        localScannedDocs.sort((a, b) => a.seq - b.seq);
        const idSeqMap = Object.fromEntries(localScannedDocs.map((e2) => [e2.id, e2.seq]));
        for (const checkDocs of arrayToChunkedArray(localScannedDocs, limitOneBatch)) {
          const remoteDocs = await remoteDB.allDocs({ keys: checkDocs.map((e2) => e2.id), include_docs: false });
          const remoteDocMap = Object.fromEntries(
            remoteDocs.rows.map((e2) => [e2.key, "error" in e2 ? e2.error : e2.value])
          );
          const sendDocs = checkDocs.filter((e2) => remoteDocMap[e2.id] == "not_found");
          const sentDocs = checkDocs.filter((e2) => remoteDocMap[e2.id] != "not_found");
          sendDocs.forEach((e2) => sentMap[e2.seq] = false);
          sentDocs.forEach((e2) => sentMap[e2.seq] = true);
          const sendDocsMap = Object.fromEntries(sendDocs.map((e2) => [e2.id, e2.seq]));
          if (sendDocs.length > 0) {
            const localDocs = await localDB.allDocs({ keys: sendDocs.map((e2) => e2.id), include_docs: true });
            await trench.queue(
              "send-chunks",
              localDocs.rows.filter((e2) => "id" in e2).map((e2) => ({ seq: sendDocsMap[e2.id], doc: e2.doc, id: e2.id }))
            );
          }
        }
        let bulkDocs2 = [];
        let bulkDocsSizeBytes = 0;
        let bulkDocsSizeCount = 0;
        let maxSeq = 0;
        const maxBatchSizeBytes = setting.sendChunksBulkMaxSize * 1024 * 1024;
        const maxBatchSizeCount = 200;
        const semaphore = Semaphore(4);
        let sendingDocs = 0;
        let sentDocsCount = 0;
        const sendChunks = async (bulkDocs3, bulkDocsSize, seq2) => {
          Logger(
            `Sending ${bulkDocs3.length} (${bulkDocsSize} => ${sizeToHumanReadable(bulkDocsSize)} in plain) chunks to remote database...`,
            LOG_LEVEL_VERBOSE
          );
          const releaser = await semaphore.acquire(1);
          sendingDocs += bulkDocs3.length;
          Logger(
            $msg("fridaySync.rebuildRemote.uploadingProgress", {
              sending: sendingDocs.toString(),
              done: sentDocsCount.toString()
            }) || `\u2191 Uploading files: ${sendingDocs} (${sentDocsCount} completed)`,
            showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
            "send"
          );
          try {
            const uploadBulkDocTasks = bulkDocs3.map((e2) => preprocessOutgoing(e2));
            const uploadBulkDocs = await Promise.all(uploadBulkDocTasks);
            await remoteDB.bulkDocs(uploadBulkDocs, { new_edits: false });
            uploadBulkDocs.forEach((e2) => sentMap[idSeqMap[e2._id]] = true);
            await this.updateMaxTransferredSeqOnChunks(localDB, remoteID, sentMap);
            sentDocsCount += bulkDocs3.length;
            Logger(
              `\u2191 Uploading files: ${sendingDocs} (${sentDocsCount} completed)`,
              showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
              "send"
            );
          } catch (ex) {
            Logger("Upload failed.", showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO, "send");
            Logger(ex, LOG_LEVEL_VERBOSE);
            return false;
          } finally {
            releaser();
          }
          return true;
        };
        const tasks3 = [];
        do {
          const nowSendChunks = await trench.dequeue("send-chunks");
          if (!nowSendChunks || nowSendChunks.length == 0) {
            break;
          }
          for (const chunk of nowSendChunks) {
            const jsonLength = te3.encode(JSON.stringify(chunk.doc)).byteLength + 32;
            if ((bulkDocsSizeBytes + jsonLength > maxBatchSizeBytes || bulkDocsSizeCount + 1 > maxBatchSizeCount) && bulkDocs2.length > 0) {
              tasks3.push(sendChunks([...bulkDocs2], bulkDocsSizeBytes, maxSeq));
              bulkDocs2 = [];
              bulkDocsSizeBytes = 0;
              bulkDocsSizeCount = 0;
            }
            bulkDocs2.push(chunk.doc);
            maxSeq = chunk.seq;
            bulkDocsSizeBytes += jsonLength;
            bulkDocsSizeCount += 1;
          }
          if (bulkDocs2.length > 0) {
            tasks3.push(sendChunks([...bulkDocs2], bulkDocsSizeBytes, maxSeq));
          }
          const results = await Promise.all(
            tasks3.map(async (e2) => {
              try {
                await e2;
              } catch (ex) {
                Logger("Upload failed.", showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO, "send");
                Logger(ex, LOG_LEVEL_VERBOSE);
                return false;
              }
            })
          );
          if (results.some((e2) => e2 === false)) {
            return false;
          }
        } while (true);
        return true;
      }
      async openOneShotReplication(setting, showResult, retrying, syncMode, ignoreCleanLock = false) {
        var _a6, _b4, _c2;
        if (await this.ensurePBKDF2Salt(setting, showResult, !retrying) === false) {
          const serverReachable = (_c2 = (_b4 = (_a6 = this.env).isServerReachable) == null ? void 0 : _b4.call(_a6)) != null ? _c2 : true;
          if (serverReachable) {
            this.syncStatus = "ERRORED";
            this.updateInfo();
          }
          return false;
        }
        if (!retrying) {
          const saltCheck = await this.checkSaltConsistency(setting);
          if (!saltCheck.ok) {
            Logger(saltCheck.message, LOG_LEVEL_NOTICE);
            this.syncStatus = "ERRORED";
            this.updateInfo();
            return false;
          }
        }
        const next2 = await shareRunningResult("oneShotReplication", async () => {
          if (this.controller) {
            Logger(
              $msg("liveSyncReplicator.replicationInProgress"),
              showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE,
              "sync"
            );
            return false;
          }
          const localDB = this.env.getDatabase();
          Logger($msg("liveSyncReplicator.oneShotSyncBegin", { syncMode }));
          const ret = await this.checkReplicationConnectivity(setting, false, retrying, showResult, ignoreCleanLock);
          if (ret === false) {
            Logger(
              $msg("liveSyncReplicator.couldNotConnectToServer"),
              showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
              "sync"
            );
            this.syncStatus = "ERRORED";
            this.updateInfo();
            return false;
          }
          this.maxPullSeq = Number(`${ret.info.update_seq}`.split("-")[0]);
          this.maxPushSeq = Number(`${(await localDB.info()).update_seq}`.split("-")[0]);
          if (showResult) {
            Logger($msg("liveSyncReplicator.checkingLastSyncPoint"), LOG_LEVEL_INFO, "sync");
          }
          const { db, syncOptionBase } = ret;
          this.syncStatus = "STARTED";
          this.updateInfo();
          const docArrivedOnStart = this.docArrived;
          const docSentOnStart = this.docSent;
          if (syncMode === "pushOnly") {
            this.filesUploaded = 0;
          }
          if (!retrying) {
            this.originalSetting = setting;
          }
          this.terminateSync();
          const syncHandler = syncMode == "sync" ? localDB.sync(db, { ...syncOptionBase }) : syncMode == "pullOnly" ? localDB.replicate.from(db, {
            ...syncOptionBase,
            ...setting.readChunksOnline ? selectorOnDemandPull : {}
          }) : syncMode == "pushOnly" ? localDB.replicate.to(db, { ...syncOptionBase }) : void 0;
          const syncResult = await this.processSync(
            syncHandler,
            showResult,
            docSentOnStart,
            docArrivedOnStart,
            syncMode,
            retrying,
            false
          );
          if (syncResult == "DONE") {
            return true;
          }
          if (syncResult == "CANCELLED") {
            return false;
          }
          if (syncResult == "FAILED") {
            return false;
          }
          if (syncResult == "NEED_RESURRECT") {
            this.terminateSync();
            return async () => await this.openOneShotReplication(
              this.originalSetting,
              showResult,
              false,
              syncMode,
              ignoreCleanLock
            );
          }
          if (syncResult == "NEED_RETRY") {
            const tempSetting = JSON.parse(JSON.stringify(setting));
            tempSetting.batch_size = Math.ceil(tempSetting.batch_size / 2) + 2;
            tempSetting.batches_limit = Math.ceil(tempSetting.batches_limit / 2) + 2;
            if (tempSetting.batch_size <= 5 && tempSetting.batches_limit <= 5) {
              Logger(
                $msg("liveSyncReplicator.cantReplicateLowerValue"),
                showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE
              );
              return false;
            } else {
              Logger(
                $msg("liveSyncReplicator.retryLowerBatchSize", {
                  batch_size: tempSetting.batch_size.toString(),
                  batches_limit: tempSetting.batches_limit.toString()
                }),
                showResult ? LOG_LEVEL_INFO : LOG_LEVEL_VERBOSE
              );
              return async () => await this.openOneShotReplication(tempSetting, showResult, true, syncMode, ignoreCleanLock);
            }
          }
          return false;
        });
        if (typeof next2 === "boolean") {
          return next2;
        }
        return await next2();
      }
      replicateAllToServer(setting, showingNotice) {
        return this.openOneShotReplication(setting, showingNotice != null ? showingNotice : false, false, "pushOnly");
      }
      async replicateAllFromServer(setting, showingNotice) {
        await this.clearStoredSalt(setting);
        const result = await this.openOneShotReplication(setting, showingNotice != null ? showingNotice : false, false, "pullOnly");
        if (result) {
          await this.updateStoredSalt(setting);
        }
        return result;
      }
      async checkReplicationConnectivity(setting, keepAlive, skipCheck, showResult, ignoreCleanLock = false) {
        if (setting.versionUpFlash != "") {
          Logger($msg("Replicator.Message.VersionUpFlash"), LOG_LEVEL_NOTICE);
          return false;
        }
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        if (this.controller) {
          Logger("Another replication running.");
          return false;
        }
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger(
            $msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }),
            showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
          );
          return false;
        }
        if (!skipCheck) {
          if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
            Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
            return false;
          }
          this.remoteCleaned = false;
          this.remoteLocked = false;
          this.remoteLockedAndDeviceNotAccepted = false;
          this.tweakSettingsMismatched = false;
          this.preferredTweakValue = void 0;
          const progress = `${dbRet.info.update_seq}`;
          const info3 = {
            app_version: this.env.services.API.getAppVersion(),
            plugin_version: this.env.services.API.getPluginVersion(),
            vault_name: this.env.services.vault.vaultName(),
            device_name: this.env.services.vault.getVaultName(),
            progress
          };
          const ensure = await ensureDatabaseIsCompatible(dbRet.db, setting, this.nodeid, currentVersionRange, info3);
          if (ensure == "INCOMPATIBLE") {
            Logger(
              "The remote database has no compatibility with the running version. Please upgrade the plugin.",
              LOG_LEVEL_NOTICE
            );
            return false;
          } else if (ensure == "NODE_LOCKED") {
            Logger(
              "The remote database has been rebuilt or corrupted since we have synchronized last time. Fetch rebuilt DB, explicit unlocking or chunk clean-up is required.",
              LOG_LEVEL_NOTICE
            );
            this.remoteLockedAndDeviceNotAccepted = true;
            this.remoteLocked = true;
            return false;
          } else if (ensure == "LOCKED") {
            this.remoteLocked = true;
          } else if (ensure == "NODE_CLEANED") {
            if (ignoreCleanLock) {
              this.remoteLocked = true;
            } else {
              Logger(
                "The remote database has been cleaned up. Fetch rebuilt DB, explicit unlocking or chunk clean-up is required.",
                LOG_LEVEL_NOTICE
              );
              this.remoteLockedAndDeviceNotAccepted = true;
              this.remoteLocked = true;
              this.remoteCleaned = true;
              return false;
            }
          } else if (ensure == "OK") {
          } else if (ensure[0] == "MISMATCHED") {
            Logger(
              `Configuration mismatching between the clients has been detected. This can be harmful or extra capacity consumption. We have to make these value unified.`,
              LOG_LEVEL_NOTICE
            );
            this.tweakSettingsMismatched = true;
            this.preferredTweakValue = ensure[1];
            return false;
          }
        }
        const syncOptionBase = {
          batches_limit: setting.batches_limit,
          batch_size: setting.batch_size
        };
        syncOptionBase.push = {};
        if (setting.readChunksOnline) {
          syncOptionBase.pull = { ...selectorOnDemandPull };
        }
        const syncOption = keepAlive ? { live: true, retry: true, heartbeat: setting.useTimeouts ? false : 3e4, ...syncOptionBase } : { ...syncOptionBase };
        return { db: dbRet.db, info: dbRet.info, syncOptionBase, syncOption };
      }
      async openContinuousReplication(setting, showResult, retrying) {
        const next2 = await shareRunningResult("continuousReplication", async () => {
          if (this.controller) {
            Logger(
              $msg("liveSyncReplicator.replicationInProgress"),
              showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
            );
            return false;
          }
          const localDB = this.env.getDatabase();
          Logger($msg("liveSyncReplicator.beforeLiveSync"));
          if (await this.openOneShotReplication(setting, showResult, false, "pullOnly")) {
            Logger($msg("liveSyncReplicator.liveSyncBegin"));
            const ret = await this.checkReplicationConnectivity(setting, true, true, showResult);
            if (ret === false) {
              Logger(
                $msg("liveSyncReplicator.couldNotConnectToServer"),
                showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
              );
              this.syncStatus = "ERRORED";
              this.updateInfo();
              return false;
            }
            if (showResult) {
              Logger($msg("liveSyncReplicator.checkingLastSyncPoint"), LOG_LEVEL_NOTICE, "sync");
            }
            const { db, syncOption } = ret;
            this.syncStatus = "STARTED";
            this.maxPullSeq = Number(`${ret.info.update_seq}`.split("-")[0]);
            this.maxPushSeq = Number(`${(await localDB.info()).update_seq}`.split("-")[0]);
            this.updateInfo();
            const docArrivedOnStart = this.docArrived;
            const docSentOnStart = this.docSent;
            if (!retrying) {
              this.originalSetting = setting;
            }
            this.terminateSync();
            const syncHandler = localDB.sync(db, {
              ...syncOption
            });
            const syncMode = "sync";
            const syncResult = await this.processSync(
              syncHandler,
              showResult,
              docSentOnStart,
              docArrivedOnStart,
              syncMode,
              retrying
            );
            if (syncResult == "DONE") {
              return true;
            }
            if (syncResult == "FAILED") {
              return false;
            }
            if (syncResult == "NEED_RESURRECT") {
              this.terminateSync();
              return async () => await this.openContinuousReplication(this.originalSetting, showResult, false);
            }
            if (syncResult == "NEED_RETRY") {
              const tempSetting = JSON.parse(JSON.stringify(setting));
              tempSetting.batch_size = Math.ceil(tempSetting.batch_size / 2) + 2;
              tempSetting.batches_limit = Math.ceil(tempSetting.batches_limit / 2) + 2;
              if (tempSetting.batch_size <= 5 && tempSetting.batches_limit <= 5) {
                Logger(
                  $msg("liveSyncReplicator.cantReplicateLowerValue"),
                  showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
                );
                return false;
              } else {
                Logger(
                  $msg("liveSyncReplicator.retryLowerBatchSize", {
                    batch_size: tempSetting.batch_size.toString(),
                    batches_limit: tempSetting.batches_limit.toString()
                  }),
                  showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
                );
                return async () => await this.openContinuousReplication(tempSetting, showResult, true);
              }
            }
          }
          if (this.syncStatus === "STARTED") {
            this.syncStatus = "ERRORED";
            this.updateInfo();
          }
          return false;
        });
        if (typeof next2 === "boolean") {
          return next2;
        }
        return await next2();
      }
      closeReplication() {
        if (!this.controller) {
          return;
        }
        this.controller.abort();
        this.controller = void 0;
        this.syncStatus = "CLOSED";
        Logger($msg("liveSyncReplicator.replicationClosed"));
        this.updateInfo();
      }
      async tryResetRemoteDatabase(setting) {
        this.closeReplication();
        const con = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof con == "string") return;
        clearHandlers();
        await this.ensurePBKDF2Salt(setting, true, false);
        await this.updateStoredSalt(setting);
      }
      async tryCreateRemoteDatabase(setting) {
        this.closeReplication();
        const con2 = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof con2 === "string") return;
        clearHandlers();
        await this.ensurePBKDF2Salt(setting, true, false);
        Logger($msg("liveSyncReplicator.remoteDbCreatedOrConnected"), LOG_LEVEL_VERBOSE);
      }
      async markRemoteLocked(setting, locked, lockByClean) {
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return;
        }
        if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
          Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
          return;
        }
        const defInitPoint = {
          _id: MILESTONE_DOCID,
          type: "milestoneinfo",
          created: /* @__PURE__ */ new Date() / 1,
          locked,
          cleaned: lockByClean,
          accepted_nodes: [this.nodeid],
          node_chunk_info: { [this.nodeid]: currentVersionRange },
          node_info: {},
          tweak_values: {}
        };
        const remoteMilestone = {
          ...defInitPoint,
          ...await resolveWithIgnoreKnownError(dbRet.db.get(MILESTONE_DOCID), defInitPoint)
        };
        remoteMilestone.node_chunk_info = { ...defInitPoint.node_chunk_info, ...remoteMilestone.node_chunk_info };
        remoteMilestone.accepted_nodes = [this.nodeid];
        remoteMilestone.locked = locked;
        remoteMilestone.cleaned = remoteMilestone.cleaned || lockByClean;
        if (locked) {
          Logger($msg("liveSyncReplicator.lockRemoteDb"), LOG_LEVEL_VERBOSE);
        } else {
          Logger($msg("liveSyncReplicator.unlockRemoteDb"), LOG_LEVEL_VERBOSE);
        }
        await dbRet.db.put(remoteMilestone);
      }
      async markRemoteResolved(setting) {
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return;
        }
        if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
          Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
          return;
        }
        const defInitPoint = {
          _id: MILESTONE_DOCID,
          type: "milestoneinfo",
          created: /* @__PURE__ */ new Date() / 1,
          locked: false,
          accepted_nodes: [this.nodeid],
          node_info: {},
          node_chunk_info: { [this.nodeid]: currentVersionRange },
          tweak_values: {}
        };
        const remoteMilestone = {
          ...defInitPoint,
          ...await resolveWithIgnoreKnownError(dbRet.db.get(MILESTONE_DOCID), defInitPoint)
        };
        remoteMilestone.node_chunk_info = { ...defInitPoint.node_chunk_info, ...remoteMilestone.node_chunk_info };
        remoteMilestone.accepted_nodes = Array.from(/* @__PURE__ */ new Set([...remoteMilestone.accepted_nodes, this.nodeid]));
        Logger($msg("liveSyncReplicator.markDeviceResolved"), LOG_LEVEL_VERBOSE);
        const result = await dbRet.db.put(remoteMilestone);
        if (result.ok) {
          this.remoteLockedAndDeviceNotAccepted = false;
          this.remoteLocked = false;
          this.remoteCleaned = false;
          Logger($msg("liveSyncReplicator.remoteDbMarkedResolved"), LOG_LEVEL_VERBOSE);
          Logger("Device acceptance flags cleared", LOG_LEVEL_INFO);
        } else {
          Logger($msg("liveSyncReplicator.couldNotMarkResolveRemoteDb"), LOG_LEVEL_NOTICE);
        }
      }
      connectRemoteCouchDBWithSetting(settings, isMobile, performSetup = false, skipInfo = false) {
        if (settings.encrypt && settings.passphrase == "" && !settings.permitEmptyPassphrase) {
          return "Empty passphrases cannot be used without explicit permission";
        }
        const customHeaders = parseHeaderValues(settings.couchDB_CustomHeaders);
        const auth = settings.useJWT ? {
          jwtAlgorithm: settings.jwtAlgorithm,
          jwtKey: settings.jwtKey,
          jwtExpDuration: settings.jwtExpDuration,
          jwtKid: settings.jwtKid,
          jwtSub: settings.jwtSub,
          type: "jwt"
        } : {
          username: settings.couchDB_USER,
          password: settings.couchDB_PASSWORD,
          type: "basic"
        };
        return this.env.services.remote.connect(
          settings.couchDB_URI + (settings.couchDB_DBNAME == "" ? "" : "/" + settings.couchDB_DBNAME),
          auth,
          settings.disableRequestURI || isMobile,
          settings.encrypt ? settings.passphrase : settings.encrypt,
          settings.useDynamicIterationCount,
          performSetup,
          skipInfo,
          settings.enableCompression,
          customHeaders,
          settings.useRequestAPI,
          async () => await this.getReplicationPBKDF2Salt(settings)
        );
      }
      async _ensureConnection(settings) {
        const ret = await this.connectRemoteCouchDBWithSetting(settings, this.isMobile(), false, true);
        if (typeof ret === "string") {
          throw new Error(`${$msg("liveSyncReplicator.couldNotConnectToServer")}:${ret}`);
        }
        return ret.db;
      }
      /**
       * Fetch a document from the remote database directly.
       * @param settings RemoteDBSettings for the connection.
       * @param id Document ID to fetch.
       * @param db Optional PouchDB instance to use. If provided, it will use this instance instead of creating a new connection (then settings will be ignored).
       * @returns The fetched document or false if the document does not exist.
       * @throws {Error} Other errors that may occur during the fetch operation.
       */
      async fetchRemoteDocument(settings, id, db) {
        try {
          const connDB = db != null ? db : await this._ensureConnection(settings);
          return await connDB.get(id);
        } catch (ex) {
          if ("status" in ex && ex.status == 404) {
            return false;
          }
          throw ex;
        }
      }
      /**
       * Puts a document to the remote database directly
       * @param settings RemoteDBSettings for the connection.
       * @param doc Document to put.
       * @param db Optional PouchDB instance to use. If provided, it will use this instance instead of creating a new connection (then settings will be ignored).
       * @returns Response from the remote database or false if an error occurred.
       * @throws {Error} If the document could not be put.
       */
      async putRemoteDocument(settings, doc, db) {
        const connDB = db != null ? db : await this._ensureConnection(settings);
        return await connDB.put(doc);
      }
      async fetchRemoteChunks(missingChunks, showResult) {
        const ret = await this.connectRemoteCouchDBWithSetting(this.env.getSettings(), this.isMobile(), false, true);
        if (typeof ret === "string") {
          Logger(
            `${$msg("liveSyncReplicator.couldNotConnectToServer")} ${ret} `,
            showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
            "fetch"
          );
          return false;
        }
        const remoteChunks = await ret.db.allDocs({ keys: missingChunks, include_docs: true });
        if (remoteChunks.rows.some((e2) => "error" in e2)) {
          Logger(
            `Some chunks are not exists both on remote and local database.`,
            showResult ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO,
            "fetch"
          );
          Logger(`Missing chunks: ${missingChunks.join(",")}`, LOG_LEVEL_VERBOSE);
          Logger(
            `Error chunks: ${remoteChunks.rows.filter((e2) => "error" in e2).map((e2) => e2.key).join(",")}`,
            LOG_LEVEL_VERBOSE
          );
          return false;
        }
        const remoteChunkItems = remoteChunks.rows.map((e2) => e2.doc);
        const successfulChunks = remoteChunkItems.filter((c) => c && c._id);
        if (successfulChunks.length > 0) {
          this.docArrived += successfulChunks.length;
          this.updateInfo();
        }
        return remoteChunkItems;
      }
      async tryConnectRemote(setting, showResult = true) {
        const db = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof db === "string") {
          Logger(
            $msg("liveSyncReplicator.couldNotConnectTo", {
              uri: setting.couchDB_URI,
              name: setting.couchDB_DBNAME,
              db
            }),
            LOG_LEVEL_NOTICE
          );
          return false;
        }
        Logger(
          $msg("liveSyncReplicator.connectedSuccessfully", {
            dbName: db.info.db_name
          }) || `Connected to ${db.info.db_name} successfully`,
          LOG_LEVEL_NOTICE
        );
        return true;
      }
      async resetRemoteTweakSettings(setting) {
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return;
        }
        if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
          Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
          return;
        }
        try {
          const remoteMilestone = await dbRet.db.get(MILESTONE_DOCID);
          remoteMilestone.tweak_values = {};
          await dbRet.db.put(remoteMilestone);
          Logger(`tweak values on the remote database have been cleared`, LOG_LEVEL_VERBOSE);
        } catch (ex) {
          Logger(
            $msg("liveSyncReplicator.couldNotRetrieveMilestone") || `Could not retrieve remote milestone`,
            LOG_LEVEL_NOTICE
          );
          throw ex;
        }
      }
      async setPreferredRemoteTweakSettings(setting) {
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return;
        }
        if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
          Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
          return;
        }
        try {
          const remoteMilestone = await dbRet.db.get(MILESTONE_DOCID);
          remoteMilestone.tweak_values[DEVICE_ID_PREFERRED] = extractObject(TweakValuesTemplate, { ...setting });
          await dbRet.db.put(remoteMilestone);
          Logger(`Preferred tweak values has been registered`, LOG_LEVEL_VERBOSE);
        } catch (ex) {
          Logger(
            $msg("liveSyncReplicator.couldNotRetrieveMilestone") || `Could not retrieve remote milestone`,
            LOG_LEVEL_NOTICE
          );
          throw ex;
        }
      }
      async getRemotePreferredTweakValues(setting) {
        var _a6;
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return false;
        }
        if (!await checkRemoteVersion(dbRet.db, this.migrate.bind(this), VER)) {
          Logger($msg("liveSyncReplicator.remoteDbCorrupted"), LOG_LEVEL_NOTICE);
          return false;
        }
        try {
          const remoteMilestone = await dbRet.db.get(MILESTONE_DOCID);
          if (!remoteMilestone) throw new Error("Remote milestone not found");
          return ((_a6 = remoteMilestone == null ? void 0 : remoteMilestone.tweak_values) == null ? void 0 : _a6[DEVICE_ID_PREFERRED]) || false;
        } catch (ex) {
          Logger(
            $msg("liveSyncReplicator.couldNotRetrieveMilestone") || `Could not retrieve remote milestone`,
            LOG_LEVEL_NOTICE
          );
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      async compactRemote(setting) {
        const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return false;
        }
        const ret = await dbRet.db.compact({ interval: 1e3 });
        return ret.ok;
      }
      async getRemoteStatus(setting) {
        var _a6;
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return false;
        }
        const info3 = await dbRet.db.info();
        return {
          ...info3,
          estimatedSize: ((_a6 = info3 == null ? void 0 : info3.sizes) == null ? void 0 : _a6.file) || 0
        };
      }
      async countCompromisedChunks(setting = this.env.getSettings()) {
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return false;
        }
        const compromised = await countCompromisedChunks(dbRet.db);
        return compromised;
      }
      async getConnectedDeviceList(setting = this.env.getSettings()) {
        const dbRet = await this.connectRemoteCouchDBWithSetting(setting, this.isMobile(), true);
        if (typeof dbRet === "string") {
          const uri = setting.couchDB_URI + (setting.couchDB_DBNAME == "" ? "" : "/" + setting.couchDB_DBNAME);
          Logger($msg("liveSyncReplicator.couldNotConnectToURI", { uri, dbRet }), LOG_LEVEL_NOTICE);
          return false;
        }
        const milestoneDoc = await dbRet.db.get(MILESTONE_DOCID);
        if (!milestoneDoc) {
          Logger(
            $msg("liveSyncReplicator.couldNotRetrieveMilestone") || "Could not retrieve remote milestone",
            LOG_LEVEL_NOTICE
          );
          return false;
        }
        const nodeInfo = milestoneDoc.node_info;
        const acceptedNodes = milestoneDoc.accepted_nodes || [];
        return { node_info: nodeInfo, accepted_nodes: acceptedNodes };
      }
    };
  }
});

// src/sync/core/ContentSplitter/ContentSplitter.ts
var MAX_CHUNKS_SIZE_ON_UI;
var init_ContentSplitter = __esm({
  "src/sync/core/ContentSplitter/ContentSplitter.ts"() {
    "use strict";
    init_types();
    MAX_CHUNKS_SIZE_ON_UI = 1024;
  }
});

// src/sync/core/ContentSplitter/ContentSplitterBase.ts
var ContentSplitterCore, ContentSplitterBase;
var init_ContentSplitterBase = __esm({
  "src/sync/core/ContentSplitter/ContentSplitterBase.ts"() {
    "use strict";
    init_types();
    init_utils2();
    init_path();
    init_ContentSplitter();
    ContentSplitterCore = class {
      /**
       * Constructor for the content splitter core.
       * @param params Content splitter options
       */
      constructor(params) {
        this.options = params;
        this.initialised = this.initialise(params);
      }
    };
    ContentSplitterBase = class extends ContentSplitterCore {
      initialise(_options2) {
        return Promise.resolve(true);
      }
      /**
       * Check whether the content splitter is available for the given settings.
       * @param setting Content splitter options
       * @returns True if the content splitter is available; false otherwise
       */
      static isAvailableFor(setting) {
        return false;
      }
      getParamsFor(entry) {
        const maxChunkSize = Math.floor(MAX_DOC_SIZE_BIN * ((this.options.settings.customChunkSize || 0) * 1 + 1));
        const pieceSize = maxChunkSize;
        const minimumChunkSize = this.options.settings.minimumChunkSize;
        const path8 = entry.path;
        const plainSplit = shouldSplitAsPlainText(path8);
        const maxSize = MAX_CHUNKS_SIZE_ON_UI;
        const blob = entry.data instanceof Blob ? entry.data : createTextBlob(entry.data);
        let useWorker = true;
        if (this.options.settings.disableWorkerForGeneratingChunks) {
          useWorker = false;
        }
        if (useWorker && this.options.settings.processSmallFilesInUIThread) {
          if (blob.size <= maxSize) {
            useWorker = false;
          }
        }
        const useSegmenter = this.options.settings.chunkSplitterVersion === ChunkAlgorithms.V2Segmenter;
        return {
          blob,
          path: path8,
          pieceSize,
          plainSplit,
          minimumChunkSize,
          useWorker,
          useSegmenter
        };
      }
      /**
       * Split the content of the loaded entry into chunks.
       * This method waits for the initialisation task to complete before proceeding.
       * @param entry The loaded entry to be split into chunks
       * @returns A generator that yields the split chunks
       */
      async splitContent(entry) {
        await this.initialised;
        const options = this.getParamsFor(entry);
        const generator = await this.processSplit(options);
        return generator;
      }
    };
  }
});

// src/sync/core/string_and_binary/chunks.ts
function isTextBlob2(blob) {
  return blob.type === "text/plain";
}
function* pickPiece(leftData, minimumChunkSize) {
  let buffer = "";
  L1: do {
    const curLine = leftData.shift();
    if (typeof curLine === "undefined") {
      yield buffer;
      break L1;
    }
    if (curLine.startsWith("```") || curLine.startsWith(" ```") || curLine.startsWith("  ```") || curLine.startsWith("   ```")) {
      yield buffer;
      buffer = curLine + (leftData.length != 0 ? "\n" : "");
      L2: do {
        const curPx = leftData.shift();
        if (typeof curPx === "undefined") {
          break L2;
        }
        buffer += curPx + (leftData.length != 0 ? "\n" : "");
      } while (leftData.length > 0 && !(leftData[0].startsWith("```") || leftData[0].startsWith(" ```") || leftData[0].startsWith("  ```") || leftData[0].startsWith("   ```")));
      const isLooksLikeBASE64 = buffer.endsWith("=");
      const maybeUneditable = buffer.length > 2048;
      const endOfCodeBlock = leftData.shift();
      if (typeof endOfCodeBlock !== "undefined") {
        buffer += endOfCodeBlock;
        buffer += leftData.length != 0 ? "\n" : "";
      }
      if (!isLooksLikeBASE64 && !maybeUneditable) {
        const splitExpr = /(.*?[;,:<])/g;
        const sx = buffer.split(splitExpr).filter((e2) => e2 != "");
        for (const v of sx) {
          yield v;
        }
      } else {
        yield buffer;
      }
      buffer = "";
    } else {
      buffer += curLine + (leftData.length != 0 ? "\n" : "");
      if (buffer.length >= minimumChunkSize || leftData.length == 0 || leftData[0] == "#" || buffer[0] == "#") {
        yield buffer;
        buffer = "";
      }
    }
  } while (leftData.length > 0);
}
function* splitStringWithinLength(text3, pieceSize) {
  let leftData = text3;
  do {
    const splitSize = pieceSize;
    const piece = leftData.substring(0, splitSize);
    leftData = leftData.substring(splitSize);
    yield piece;
  } while (leftData != "");
}
function* splitTextInSegment(text3, pieceSize, minimumChunkSize) {
  const segments = segmenter.segment(text3);
  let prev = "";
  let buf = "";
  for (const seg of segments) {
    const buffer = seg.segment;
    if (prev == buffer || buf.length < minimumChunkSize) {
      buf += buffer;
      prev = buffer;
    } else {
      prev = buffer;
      if (buf.length > 0) {
        yield* splitStringWithinLength(buf, pieceSize);
      }
      buf = buffer;
    }
  }
  if (buf.length > 0) {
    yield* splitStringWithinLength(buf, pieceSize);
  }
}
function* splitInNewLine(texts) {
  for (const text3 of texts) {
    let start = -1;
    let end = -1;
    do {
      end = text3.indexOf("\n", start);
      if (end == -1) {
        yield text3.substring(start);
        break;
      }
      while (text3[end] == "\n") {
        end++;
      }
      yield text3.substring(start, end);
      start = end;
    } while (end != -1);
  }
  return;
}
function splitPiecesTextV2(dataSrc, pieceSize, minimumChunkSize) {
  const dataListAllArray = typeof dataSrc == "string" ? [dataSrc] : dataSrc;
  const dataListAll = splitInNewLine(dataListAllArray);
  let inCodeBlock = 0;
  let flush = false;
  let flushBefore = false;
  return function* () {
    const buf = [];
    for (const line of dataListAll) {
      if (line.startsWith("````")) {
        if (inCodeBlock == 0) {
          inCodeBlock = 4;
          flushBefore = true;
        } else if (inCodeBlock == 4) {
          inCodeBlock = 0;
          flush = true;
        }
      } else if (line.startsWith("```")) {
        if (inCodeBlock == 0) {
          inCodeBlock = 3;
          flushBefore = true;
        } else if (inCodeBlock == 3) {
          inCodeBlock = 0;
          flush = true;
        }
      }
      if (flushBefore) {
        if (buf.length > 0) {
          yield* splitTextInSegment(buf.join(""), pieceSize, minimumChunkSize);
          buf.length = 0;
        }
        flushBefore = false;
      }
      buf.push(line);
      if (flush) {
        if (buf.length > 0) {
          yield* splitStringWithinLength(buf.join(""), pieceSize);
          buf.length = 0;
        }
        flush = false;
      }
    }
    if (buf.length > 0) {
      if (inCodeBlock == 0) {
        yield* splitTextInSegment(buf.join(""), pieceSize, minimumChunkSize);
      } else {
        yield* splitStringWithinLength(buf.join(""), pieceSize);
      }
    }
  };
}
function binaryTextSplit(data, pieceSize, minimumChunkSize) {
  return function* pieces() {
    yield* splitStringWithinLength(data, pieceSize);
  };
}
function splitPiecesText(dataSrc, pieceSize, plainSplit, minimumChunkSize, useSegmenter) {
  if (!useSegmenter || !segmenter) {
    return splitPiecesTextV1(dataSrc, pieceSize, plainSplit, minimumChunkSize);
  }
  if (!plainSplit) {
    return binaryTextSplit(dataSrc, pieceSize, minimumChunkSize);
  }
  return splitPiecesTextV2(dataSrc, pieceSize, minimumChunkSize);
}
function splitPiecesTextV1(dataSrc, pieceSize, plainSplit, minimumChunkSize) {
  const dataList = typeof dataSrc == "string" ? [dataSrc] : dataSrc;
  return function* pieces() {
    for (const data of dataList) {
      if (plainSplit) {
        const leftData = data.split("\n");
        const f3 = pickPiece(leftData, minimumChunkSize);
        for (const piece of f3) {
          let buffer = piece;
          do {
            let ps = pieceSize;
            if (buffer.charCodeAt(ps - 1) != buffer.codePointAt(ps - 1)) {
              ps++;
            }
            yield buffer.substring(0, ps);
            buffer = buffer.substring(ps);
          } while (buffer != "");
        }
      } else {
        let leftData = data;
        do {
          const splitSize = pieceSize;
          const piece = leftData.substring(0, splitSize);
          leftData = leftData.substring(splitSize);
          yield piece;
        } while (leftData != "");
      }
    }
  };
}
function* splitByDelimiterWithMinLength(sources, delimiter2, minimumChunkLength = 25, splitThreshold) {
  let buf = "";
  let last = false;
  const dl = delimiter2.length;
  for (const source2 of sources) {
    const max3 = source2.length;
    if (splitThreshold && max3 > splitThreshold) {
      yield buf + source2;
      last = false;
      buf = "";
      continue;
    }
    let i = -1;
    let prev = 0;
    L1: do {
      i = source2.indexOf(delimiter2, prev);
      if (i == -1) break L1;
      buf += source2.slice(prev, i) + delimiter2;
      if (buf.length > minimumChunkLength) {
        yield buf;
        buf = "";
        last = false;
      } else {
        last = true;
      }
      prev = i + dl;
    } while (i < max3);
    if (prev != i || prev == -1 && i == -1) {
      buf += source2.slice(prev);
      last = true;
    }
  }
  if (last) {
    yield buf;
  }
}
function* chunkStringGenerator(source2, maxLength) {
  const strLen = source2.length;
  if (strLen > maxLength) {
    let from = 0;
    do {
      let end = from + maxLength;
      if (end > strLen) {
        yield source2.substring(from);
        break;
      }
      while (source2.charCodeAt(end - 1) != source2.codePointAt(end - 1)) {
        end++;
      }
      yield source2.substring(from, end);
      from = end;
    } while (from < strLen);
  } else {
    yield source2;
  }
}
function* chunkStringGeneratorFromGenerator(sources, maxLength) {
  for (const source2 of sources) {
    yield* chunkStringGenerator(source2, maxLength);
  }
}
function* stringGenerator(sources) {
  for (const str of sources) {
    yield str;
  }
}
async function splitPieces2V2(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, useSegmenter) {
  if (dataSrc.size == 0) {
    return function* noItems() {
      return;
    };
  }
  if (isTextBlob2(dataSrc)) {
    const text3 = await dataSrc.text();
    if (!plainSplit) {
      const gen2 = chunkStringGenerator(text3, pieceSize);
      return function* pieces() {
        yield* gen2;
      };
    }
    const textLen = text3.length;
    let xMinimumChunkSize = minimumChunkSize;
    while (textLen / xMinimumChunkSize > MAX_ITEMS) {
      xMinimumChunkSize += minimumChunkSize;
    }
    const org = stringGenerator([text3]);
    const gen1 = splitByDelimiterWithMinLength(org, "\n", xMinimumChunkSize);
    const gen = chunkStringGeneratorFromGenerator(gen1, pieceSize);
    return function* pieces() {
      yield* gen;
    };
  }
  let canBeSmall = false;
  let delimiter2 = 0;
  if (filename && filename.endsWith(".pdf")) {
    delimiter2 = "/".charCodeAt(0);
  } else if (filename && filename.endsWith(".json")) {
    canBeSmall = true;
    delimiter2 = ",".charCodeAt(0);
  }
  const clampMin = canBeSmall ? 100 : 1e5;
  const clampMax = 1e8;
  const clampedSize = Math.max(clampMin, Math.min(clampMax, dataSrc.size));
  let step = 1;
  let w2 = clampedSize;
  while (w2 > 10) {
    w2 /= 12.5;
    step++;
  }
  minimumChunkSize = Math.floor(10 ** (step - 1));
  return async function* piecesBlob() {
    const size = dataSrc.size;
    let i = 0;
    const buf = new Uint8Array(await dataSrc.arrayBuffer());
    do {
      const findStart = i + minimumChunkSize;
      const defaultSplitEnd = i + pieceSize;
      let splitEnd;
      let i1 = buf.indexOf(delimiter2, findStart);
      if (i1 == -1) {
        i1 = buf.indexOf(charNewLine, findStart);
      }
      if (i1 == -1) {
        splitEnd = defaultSplitEnd;
      } else {
        splitEnd = i1 < defaultSplitEnd ? i1 : defaultSplitEnd;
      }
      yield await arrayBufferToBase64Single(buf.slice(i, splitEnd));
      i = splitEnd;
    } while (i < size);
  };
}
async function splitPieces2(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, useSegmenter) {
  if (isTextBlob2(dataSrc)) {
    return splitPiecesText(await dataSrc.text(), pieceSize, plainSplit, minimumChunkSize, useSegmenter != null ? useSegmenter : false);
  }
  let delimiter2 = 0;
  let canBeSmall = false;
  if (filename && filename.endsWith(".pdf")) {
    delimiter2 = "/".charCodeAt(0);
  } else if (filename && filename.endsWith(".json")) {
    canBeSmall = true;
    delimiter2 = ",".charCodeAt(0);
  }
  const clampMin = canBeSmall ? 100 : 1e5;
  const clampMax = 1e8;
  const clampedSize = Math.max(clampMin, Math.min(clampMax, dataSrc.size));
  let step = 1;
  let w2 = clampedSize;
  while (w2 > 10) {
    w2 /= 12.5;
    step++;
  }
  minimumChunkSize = Math.floor(10 ** (step - 1));
  return async function* piecesBlob() {
    const size = dataSrc.size;
    let i = 0;
    do {
      let splitSize = pieceSize;
      const currentData = new Uint8Array(await dataSrc.slice(i, i + pieceSize).arrayBuffer());
      let nextIdx = currentData.indexOf(delimiter2, minimumChunkSize);
      splitSize = nextIdx == -1 ? pieceSize : Math.min(pieceSize, nextIdx);
      if (nextIdx == -1) nextIdx = currentData.indexOf(charNewLine, minimumChunkSize);
      const piece = currentData.slice(0, splitSize);
      i += piece.length;
      const b64 = await arrayBufferToBase64Single(piece);
      yield b64;
    } while (i < size);
  };
}
async function splitPiecesRabinKarp(dataSrc, absoluteMaxPieceSize, doPlainSplit, minimumChunkSize, _filename, _useSegmenter) {
  const plainSplit = doPlainSplit || isTextBlob2(dataSrc);
  const minPieceSize = plainSplit ? 128 : 1024 * 4;
  const splitPieceCount = plainSplit ? 20 : 12;
  const avgChunkSize = Math.max(minPieceSize, Math.floor(dataSrc.size / splitPieceCount));
  const maxChunkSize = Math.min(absoluteMaxPieceSize, avgChunkSize * 5);
  const minChunkSize = Math.min(Math.max(Math.floor(avgChunkSize / 4), minimumChunkSize), maxChunkSize);
  const windowSize = 48;
  const hashModulus = avgChunkSize;
  const boundaryPattern = 1;
  const PRIME = 31;
  let P_pow_w = 1;
  for (let i = 0; i < windowSize - 1; i++) {
    P_pow_w = Math.imul(P_pow_w, PRIME);
  }
  const buffer = new Uint8Array(await dataSrc.arrayBuffer());
  let pos2 = 0;
  let hash2 = 0;
  let start = 0;
  const isText = isTextBlob2(dataSrc);
  const length = buffer.length;
  return async function* piecesBlob() {
    while (pos2 < length) {
      const byte = buffer[pos2];
      if (pos2 >= start + windowSize) {
        const oldByte = buffer[pos2 - windowSize];
        const oldByteTerm = Math.imul(oldByte, P_pow_w);
        hash2 = hash2 - oldByteTerm | 0;
        hash2 = Math.imul(hash2, PRIME);
        hash2 = hash2 + byte | 0;
      } else {
        hash2 = Math.imul(hash2, PRIME);
        hash2 = hash2 + byte | 0;
      }
      const currentChunkSize = pos2 - start + 1;
      let isBoundaryCandidate = false;
      if (currentChunkSize >= minChunkSize) {
        if ((hash2 >>> 0) % hashModulus === boundaryPattern) {
          isBoundaryCandidate = true;
        }
      }
      if (currentChunkSize >= maxChunkSize) {
        isBoundaryCandidate = true;
      }
      if (isBoundaryCandidate) {
        let isSafeBoundary = true;
        if (isText) {
          if (pos2 + 1 < length && (buffer[pos2 + 1] & 192) === 128) {
            isSafeBoundary = false;
          }
        }
        if (isSafeBoundary) {
          if (isText) {
            yield Promise.resolve(readString(buffer.subarray(start, pos2 + 1)));
          } else {
            yield await arrayBufferToBase64Single(buffer.subarray(start, pos2 + 1));
          }
          start = pos2 + 1;
        }
      }
      pos2++;
    }
    if (start < length) {
      if (isText) {
        yield Promise.resolve(readString(buffer.subarray(start, length)));
      } else {
        yield await arrayBufferToBase64Single(buffer.subarray(start, length));
      }
    }
  };
}
var charNewLine, segmenter, MAX_ITEMS;
var init_chunks = __esm({
  "src/sync/core/string_and_binary/chunks.ts"() {
    "use strict";
    init_convert();
    charNewLine = "\n".charCodeAt(0);
    segmenter = "Segmenter" in Intl ? new Intl.Segmenter(navigator.language, { granularity: "sentence" }) : void 0;
    MAX_ITEMS = 100;
  }
});

// src/sync/core/ContentSplitter/ContentSplitterRabinKarp.ts
var ContentSplitterRabinKarp;
var init_ContentSplitterRabinKarp = __esm({
  "src/sync/core/ContentSplitter/ContentSplitterRabinKarp.ts"() {
    "use strict";
    init_types();
    init_chunks();
    init_bgWorker();
    init_ContentSplitterBase();
    ContentSplitterRabinKarp = class extends ContentSplitterBase {
      static isAvailableFor(setting) {
        return setting.settings.chunkSplitterVersion === ChunkAlgorithms.RabinKarp;
      }
      async processSplit(options) {
        if (options.useWorker) {
          return splitPieces2WorkerRabinKarp(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path
          )();
        } else {
          return (await splitPiecesRabinKarp(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path
          ))();
        }
      }
    };
  }
});

// src/sync/core/ContentSplitter/ContentSplitterV1.ts
var ContentSplitterV1;
var init_ContentSplitterV1 = __esm({
  "src/sync/core/ContentSplitter/ContentSplitterV1.ts"() {
    "use strict";
    init_types();
    init_chunks();
    init_bgWorker();
    init_ContentSplitterBase();
    ContentSplitterV1 = class extends ContentSplitterBase {
      static isAvailableFor(setting) {
        return setting.settings.chunkSplitterVersion === ChunkAlgorithms.V1 || setting.settings.chunkSplitterVersion === "";
      }
      async processSplit(options) {
        if (options.useWorker) {
          return splitPieces2Worker(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path,
            options.useSegmenter
          )();
        } else {
          return (await splitPieces2(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path,
            options.useSegmenter
          ))();
        }
      }
    };
  }
});

// src/sync/core/ContentSplitter/ContentSplitterV2.ts
var ContentSplitterV2;
var init_ContentSplitterV2 = __esm({
  "src/sync/core/ContentSplitter/ContentSplitterV2.ts"() {
    "use strict";
    init_types();
    init_chunks();
    init_bgWorker();
    init_ContentSplitterBase();
    ContentSplitterV2 = class extends ContentSplitterBase {
      static isAvailableFor(setting) {
        return setting.settings.chunkSplitterVersion === ChunkAlgorithms.V2 || setting.settings.chunkSplitterVersion === ChunkAlgorithms.V2Segmenter;
      }
      async processSplit(options) {
        if (options.useWorker) {
          return splitPieces2WorkerV2(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path,
            options.useSegmenter
          )();
        } else {
          return (await splitPieces2V2(
            options.blob,
            options.pieceSize,
            options.plainSplit,
            options.minimumChunkSize,
            options.path,
            options.useSegmenter
          ))();
        }
      }
    };
  }
});

// src/sync/core/ContentSplitter/ContentSplitters.ts
var ContentSplitters, ContentSplitter;
var init_ContentSplitters = __esm({
  "src/sync/core/ContentSplitter/ContentSplitters.ts"() {
    "use strict";
    init_ContentSplitterBase();
    init_ContentSplitterRabinKarp();
    init_ContentSplitterV1();
    init_ContentSplitterV2();
    ContentSplitters = [ContentSplitterV1, ContentSplitterV2, ContentSplitterRabinKarp];
    ContentSplitter = class extends ContentSplitterCore {
      constructor(options) {
        super(options);
      }
      initialise(options) {
        for (const Splitter of ContentSplitters) {
          if (Splitter.isAvailableFor(options)) {
            this._activeSplitter = new Splitter(options);
            break;
          }
        }
        if (!this._activeSplitter) {
          throw new Error(`ContentSplitter: No available splitter for settings!!`);
        }
        return this._activeSplitter.initialise(options);
      }
      async splitContent(entry) {
        await this.initialised;
        return this._activeSplitter.splitContent(entry);
      }
    };
  }
});

// src/sync/core/managers/ChangeManager.ts
var ChangeManager;
var init_ChangeManager = __esm({
  "src/sync/core/managers/ChangeManager.ts"() {
    "use strict";
    init_logger2();
    init_polyfill();
    ChangeManager = class {
      /**
       * Creates a new instance of the ChangeManager.
       *
       * @param options - Configuration options for the ChangeManager.
       */
      constructor(options) {
        /**
         * A list of registered callbacks wrapped in WeakRefs to avoid memory leaks.
         */
        this._callbacks = [];
        this._database = options.database;
        this.setupListener();
      }
      /**
       * Registers a new callback to be invoked when a change occurs.
       *
       * @param callback - The callback function to register.
       */
      addCallback(callback) {
        const callbackHandler = new FallbackWeakRef(callback);
        this._callbacks.push(callbackHandler);
        return () => {
          this._callbacks = this._callbacks.filter((cb) => cb !== callbackHandler);
        };
      }
      removeCallback(callback) {
        this._callbacks = this._callbacks.filter((cb) => cb.deref() !== callback);
      }
      /**
       * Handles a change event from the PouchDB changes feed.
       *
       * @param changeResponse - The change response object from the PouchDB changes feed.
       */
      _onChange(changeResponse) {
        if (!this._callbacks.length) {
          return;
        }
        this._callbacks = this._callbacks.filter((callback) => callback.deref() !== void 0);
        for (const callback of this._callbacks) {
          const cb = callback.deref();
          if (!cb) {
            continue;
          }
          void cb(changeResponse);
        }
      }
      /**
       * Sets up the PouchDB changes feed listener to monitor for database changes.
       */
      setupListener() {
        var _a6, _b4;
        if (this._changes) {
          void ((_a6 = this._changes) == null ? void 0 : _a6.removeAllListeners());
          (_b4 = this._changes) == null ? void 0 : _b4.cancel();
          this._changes = void 0;
        }
        const changes3 = this._database.changes({
          since: "now",
          live: true,
          include_docs: true
        });
        void changes3.on("change", (change) => {
          void this._onChange(change);
        });
        void changes3.on("error", (err2) => {
          Logger("ChangeManager Error watching changes");
          Logger(err2, LOG_LEVEL_VERBOSE);
        });
        this._changes = changes3;
      }
      /**
       * Tears down the PouchDB changes feed listener and cleans up resources.
       */
      teardown() {
        var _a6, _b4;
        void ((_a6 = this._changes) == null ? void 0 : _a6.removeAllListeners());
        (_b4 = this._changes) == null ? void 0 : _b4.cancel();
        this._changes = void 0;
      }
      /**
       * Restarts the PouchDB changes feed listener.
       */
      restartWatch() {
        void this.teardown();
        void this.setupListener();
      }
    };
  }
});

// node_modules/diff-match-patch/index.js
var require_diff_match_patch = __commonJS({
  "node_modules/diff-match-patch/index.js"(exports2, module2) {
    var diff_match_patch2 = function() {
      this.Diff_Timeout = 1;
      this.Diff_EditCost = 4;
      this.Match_Threshold = 0.5;
      this.Match_Distance = 1e3;
      this.Patch_DeleteThreshold = 0.5;
      this.Patch_Margin = 4;
      this.Match_MaxBits = 32;
    };
    var DIFF_DELETE2 = -1;
    var DIFF_INSERT2 = 1;
    var DIFF_EQUAL2 = 0;
    diff_match_patch2.Diff = function(op, text3) {
      return [op, text3];
    };
    diff_match_patch2.prototype.diff_main = function(text1, text22, opt_checklines, opt_deadline) {
      if (typeof opt_deadline == "undefined") {
        if (this.Diff_Timeout <= 0) {
          opt_deadline = Number.MAX_VALUE;
        } else {
          opt_deadline = (/* @__PURE__ */ new Date()).getTime() + this.Diff_Timeout * 1e3;
        }
      }
      var deadline = opt_deadline;
      if (text1 == null || text22 == null) {
        throw new Error("Null input. (diff_main)");
      }
      if (text1 == text22) {
        if (text1) {
          return [new diff_match_patch2.Diff(DIFF_EQUAL2, text1)];
        }
        return [];
      }
      if (typeof opt_checklines == "undefined") {
        opt_checklines = true;
      }
      var checklines = opt_checklines;
      var commonlength = this.diff_commonPrefix(text1, text22);
      var commonprefix = text1.substring(0, commonlength);
      text1 = text1.substring(commonlength);
      text22 = text22.substring(commonlength);
      commonlength = this.diff_commonSuffix(text1, text22);
      var commonsuffix = text1.substring(text1.length - commonlength);
      text1 = text1.substring(0, text1.length - commonlength);
      text22 = text22.substring(0, text22.length - commonlength);
      var diffs = this.diff_compute_(text1, text22, checklines, deadline);
      if (commonprefix) {
        diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL2, commonprefix));
      }
      if (commonsuffix) {
        diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, commonsuffix));
      }
      this.diff_cleanupMerge(diffs);
      return diffs;
    };
    diff_match_patch2.prototype.diff_compute_ = function(text1, text22, checklines, deadline) {
      var diffs;
      if (!text1) {
        return [new diff_match_patch2.Diff(DIFF_INSERT2, text22)];
      }
      if (!text22) {
        return [new diff_match_patch2.Diff(DIFF_DELETE2, text1)];
      }
      var longtext = text1.length > text22.length ? text1 : text22;
      var shorttext = text1.length > text22.length ? text22 : text1;
      var i = longtext.indexOf(shorttext);
      if (i != -1) {
        diffs = [
          new diff_match_patch2.Diff(DIFF_INSERT2, longtext.substring(0, i)),
          new diff_match_patch2.Diff(DIFF_EQUAL2, shorttext),
          new diff_match_patch2.Diff(
            DIFF_INSERT2,
            longtext.substring(i + shorttext.length)
          )
        ];
        if (text1.length > text22.length) {
          diffs[0][0] = diffs[2][0] = DIFF_DELETE2;
        }
        return diffs;
      }
      if (shorttext.length == 1) {
        return [
          new diff_match_patch2.Diff(DIFF_DELETE2, text1),
          new diff_match_patch2.Diff(DIFF_INSERT2, text22)
        ];
      }
      var hm = this.diff_halfMatch_(text1, text22);
      if (hm) {
        var text1_a = hm[0];
        var text1_b = hm[1];
        var text2_a = hm[2];
        var text2_b = hm[3];
        var mid_common = hm[4];
        var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
        var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
        return diffs_a.concat(
          [new diff_match_patch2.Diff(DIFF_EQUAL2, mid_common)],
          diffs_b
        );
      }
      if (checklines && text1.length > 100 && text22.length > 100) {
        return this.diff_lineMode_(text1, text22, deadline);
      }
      return this.diff_bisect_(text1, text22, deadline);
    };
    diff_match_patch2.prototype.diff_lineMode_ = function(text1, text22, deadline) {
      var a = this.diff_linesToChars_(text1, text22);
      text1 = a.chars1;
      text22 = a.chars2;
      var linearray = a.lineArray;
      var diffs = this.diff_main(text1, text22, false, deadline);
      this.diff_charsToLines_(diffs, linearray);
      this.diff_cleanupSemantic(diffs);
      diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, ""));
      var pointer = 0;
      var count_delete = 0;
      var count_insert = 0;
      var text_delete = "";
      var text_insert = "";
      while (pointer < diffs.length) {
        switch (diffs[pointer][0]) {
          case DIFF_INSERT2:
            count_insert++;
            text_insert += diffs[pointer][1];
            break;
          case DIFF_DELETE2:
            count_delete++;
            text_delete += diffs[pointer][1];
            break;
          case DIFF_EQUAL2:
            if (count_delete >= 1 && count_insert >= 1) {
              diffs.splice(
                pointer - count_delete - count_insert,
                count_delete + count_insert
              );
              pointer = pointer - count_delete - count_insert;
              var subDiff = this.diff_main(text_delete, text_insert, false, deadline);
              for (var j = subDiff.length - 1; j >= 0; j--) {
                diffs.splice(pointer, 0, subDiff[j]);
              }
              pointer = pointer + subDiff.length;
            }
            count_insert = 0;
            count_delete = 0;
            text_delete = "";
            text_insert = "";
            break;
        }
        pointer++;
      }
      diffs.pop();
      return diffs;
    };
    diff_match_patch2.prototype.diff_bisect_ = function(text1, text22, deadline) {
      var text1_length = text1.length;
      var text2_length = text22.length;
      var max_d = Math.ceil((text1_length + text2_length) / 2);
      var v_offset = max_d;
      var v_length = 2 * max_d;
      var v1 = new Array(v_length);
      var v2 = new Array(v_length);
      for (var x = 0; x < v_length; x++) {
        v1[x] = -1;
        v2[x] = -1;
      }
      v1[v_offset + 1] = 0;
      v2[v_offset + 1] = 0;
      var delta = text1_length - text2_length;
      var front = delta % 2 != 0;
      var k1start = 0;
      var k1end = 0;
      var k2start = 0;
      var k2end = 0;
      for (var d = 0; d < max_d; d++) {
        if ((/* @__PURE__ */ new Date()).getTime() > deadline) {
          break;
        }
        for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
          var k1_offset = v_offset + k1;
          var x1;
          if (k1 == -d || k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1]) {
            x1 = v1[k1_offset + 1];
          } else {
            x1 = v1[k1_offset - 1] + 1;
          }
          var y1 = x1 - k1;
          while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text22.charAt(y1)) {
            x1++;
            y1++;
          }
          v1[k1_offset] = x1;
          if (x1 > text1_length) {
            k1end += 2;
          } else if (y1 > text2_length) {
            k1start += 2;
          } else if (front) {
            var k2_offset = v_offset + delta - k1;
            if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
              var x2 = text1_length - v2[k2_offset];
              if (x1 >= x2) {
                return this.diff_bisectSplit_(text1, text22, x1, y1, deadline);
              }
            }
          }
        }
        for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
          var k2_offset = v_offset + k2;
          var x2;
          if (k2 == -d || k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1]) {
            x2 = v2[k2_offset + 1];
          } else {
            x2 = v2[k2_offset - 1] + 1;
          }
          var y2 = x2 - k2;
          while (x2 < text1_length && y2 < text2_length && text1.charAt(text1_length - x2 - 1) == text22.charAt(text2_length - y2 - 1)) {
            x2++;
            y2++;
          }
          v2[k2_offset] = x2;
          if (x2 > text1_length) {
            k2end += 2;
          } else if (y2 > text2_length) {
            k2start += 2;
          } else if (!front) {
            var k1_offset = v_offset + delta - k2;
            if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
              var x1 = v1[k1_offset];
              var y1 = v_offset + x1 - k1_offset;
              x2 = text1_length - x2;
              if (x1 >= x2) {
                return this.diff_bisectSplit_(text1, text22, x1, y1, deadline);
              }
            }
          }
        }
      }
      return [
        new diff_match_patch2.Diff(DIFF_DELETE2, text1),
        new diff_match_patch2.Diff(DIFF_INSERT2, text22)
      ];
    };
    diff_match_patch2.prototype.diff_bisectSplit_ = function(text1, text22, x, y, deadline) {
      var text1a = text1.substring(0, x);
      var text2a = text22.substring(0, y);
      var text1b = text1.substring(x);
      var text2b = text22.substring(y);
      var diffs = this.diff_main(text1a, text2a, false, deadline);
      var diffsb = this.diff_main(text1b, text2b, false, deadline);
      return diffs.concat(diffsb);
    };
    diff_match_patch2.prototype.diff_linesToChars_ = function(text1, text22) {
      var lineArray = [];
      var lineHash = {};
      lineArray[0] = "";
      function diff_linesToCharsMunge_(text3) {
        var chars = "";
        var lineStart = 0;
        var lineEnd = -1;
        var lineArrayLength = lineArray.length;
        while (lineEnd < text3.length - 1) {
          lineEnd = text3.indexOf("\n", lineStart);
          if (lineEnd == -1) {
            lineEnd = text3.length - 1;
          }
          var line = text3.substring(lineStart, lineEnd + 1);
          if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== void 0) {
            chars += String.fromCharCode(lineHash[line]);
          } else {
            if (lineArrayLength == maxLines) {
              line = text3.substring(lineStart);
              lineEnd = text3.length;
            }
            chars += String.fromCharCode(lineArrayLength);
            lineHash[line] = lineArrayLength;
            lineArray[lineArrayLength++] = line;
          }
          lineStart = lineEnd + 1;
        }
        return chars;
      }
      var maxLines = 4e4;
      var chars1 = diff_linesToCharsMunge_(text1);
      maxLines = 65535;
      var chars2 = diff_linesToCharsMunge_(text22);
      return { chars1, chars2, lineArray };
    };
    diff_match_patch2.prototype.diff_charsToLines_ = function(diffs, lineArray) {
      for (var i = 0; i < diffs.length; i++) {
        var chars = diffs[i][1];
        var text3 = [];
        for (var j = 0; j < chars.length; j++) {
          text3[j] = lineArray[chars.charCodeAt(j)];
        }
        diffs[i][1] = text3.join("");
      }
    };
    diff_match_patch2.prototype.diff_commonPrefix = function(text1, text22) {
      if (!text1 || !text22 || text1.charAt(0) != text22.charAt(0)) {
        return 0;
      }
      var pointermin = 0;
      var pointermax = Math.min(text1.length, text22.length);
      var pointermid = pointermax;
      var pointerstart = 0;
      while (pointermin < pointermid) {
        if (text1.substring(pointerstart, pointermid) == text22.substring(pointerstart, pointermid)) {
          pointermin = pointermid;
          pointerstart = pointermin;
        } else {
          pointermax = pointermid;
        }
        pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
      }
      return pointermid;
    };
    diff_match_patch2.prototype.diff_commonSuffix = function(text1, text22) {
      if (!text1 || !text22 || text1.charAt(text1.length - 1) != text22.charAt(text22.length - 1)) {
        return 0;
      }
      var pointermin = 0;
      var pointermax = Math.min(text1.length, text22.length);
      var pointermid = pointermax;
      var pointerend = 0;
      while (pointermin < pointermid) {
        if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text22.substring(text22.length - pointermid, text22.length - pointerend)) {
          pointermin = pointermid;
          pointerend = pointermin;
        } else {
          pointermax = pointermid;
        }
        pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
      }
      return pointermid;
    };
    diff_match_patch2.prototype.diff_commonOverlap_ = function(text1, text22) {
      var text1_length = text1.length;
      var text2_length = text22.length;
      if (text1_length == 0 || text2_length == 0) {
        return 0;
      }
      if (text1_length > text2_length) {
        text1 = text1.substring(text1_length - text2_length);
      } else if (text1_length < text2_length) {
        text22 = text22.substring(0, text1_length);
      }
      var text_length = Math.min(text1_length, text2_length);
      if (text1 == text22) {
        return text_length;
      }
      var best = 0;
      var length = 1;
      while (true) {
        var pattern = text1.substring(text_length - length);
        var found = text22.indexOf(pattern);
        if (found == -1) {
          return best;
        }
        length += found;
        if (found == 0 || text1.substring(text_length - length) == text22.substring(0, length)) {
          best = length;
          length++;
        }
      }
    };
    diff_match_patch2.prototype.diff_halfMatch_ = function(text1, text22) {
      if (this.Diff_Timeout <= 0) {
        return null;
      }
      var longtext = text1.length > text22.length ? text1 : text22;
      var shorttext = text1.length > text22.length ? text22 : text1;
      if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
        return null;
      }
      var dmp = this;
      function diff_halfMatchI_(longtext2, shorttext2, i) {
        var seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
        var j = -1;
        var best_common = "";
        var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
        while ((j = shorttext2.indexOf(seed, j + 1)) != -1) {
          var prefixLength = dmp.diff_commonPrefix(
            longtext2.substring(i),
            shorttext2.substring(j)
          );
          var suffixLength = dmp.diff_commonSuffix(
            longtext2.substring(0, i),
            shorttext2.substring(0, j)
          );
          if (best_common.length < suffixLength + prefixLength) {
            best_common = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
            best_longtext_a = longtext2.substring(0, i - suffixLength);
            best_longtext_b = longtext2.substring(i + prefixLength);
            best_shorttext_a = shorttext2.substring(0, j - suffixLength);
            best_shorttext_b = shorttext2.substring(j + prefixLength);
          }
        }
        if (best_common.length * 2 >= longtext2.length) {
          return [
            best_longtext_a,
            best_longtext_b,
            best_shorttext_a,
            best_shorttext_b,
            best_common
          ];
        } else {
          return null;
        }
      }
      var hm1 = diff_halfMatchI_(
        longtext,
        shorttext,
        Math.ceil(longtext.length / 4)
      );
      var hm2 = diff_halfMatchI_(
        longtext,
        shorttext,
        Math.ceil(longtext.length / 2)
      );
      var hm;
      if (!hm1 && !hm2) {
        return null;
      } else if (!hm2) {
        hm = hm1;
      } else if (!hm1) {
        hm = hm2;
      } else {
        hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
      }
      var text1_a, text1_b, text2_a, text2_b;
      if (text1.length > text22.length) {
        text1_a = hm[0];
        text1_b = hm[1];
        text2_a = hm[2];
        text2_b = hm[3];
      } else {
        text2_a = hm[0];
        text2_b = hm[1];
        text1_a = hm[2];
        text1_b = hm[3];
      }
      var mid_common = hm[4];
      return [text1_a, text1_b, text2_a, text2_b, mid_common];
    };
    diff_match_patch2.prototype.diff_cleanupSemantic = function(diffs) {
      var changes3 = false;
      var equalities = [];
      var equalitiesLength = 0;
      var lastEquality = null;
      var pointer = 0;
      var length_insertions1 = 0;
      var length_deletions1 = 0;
      var length_insertions2 = 0;
      var length_deletions2 = 0;
      while (pointer < diffs.length) {
        if (diffs[pointer][0] == DIFF_EQUAL2) {
          equalities[equalitiesLength++] = pointer;
          length_insertions1 = length_insertions2;
          length_deletions1 = length_deletions2;
          length_insertions2 = 0;
          length_deletions2 = 0;
          lastEquality = diffs[pointer][1];
        } else {
          if (diffs[pointer][0] == DIFF_INSERT2) {
            length_insertions2 += diffs[pointer][1].length;
          } else {
            length_deletions2 += diffs[pointer][1].length;
          }
          if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(
            length_insertions2,
            length_deletions2
          )) {
            diffs.splice(
              equalities[equalitiesLength - 1],
              0,
              new diff_match_patch2.Diff(DIFF_DELETE2, lastEquality)
            );
            diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT2;
            equalitiesLength--;
            equalitiesLength--;
            pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
            length_insertions1 = 0;
            length_deletions1 = 0;
            length_insertions2 = 0;
            length_deletions2 = 0;
            lastEquality = null;
            changes3 = true;
          }
        }
        pointer++;
      }
      if (changes3) {
        this.diff_cleanupMerge(diffs);
      }
      this.diff_cleanupSemanticLossless(diffs);
      pointer = 1;
      while (pointer < diffs.length) {
        if (diffs[pointer - 1][0] == DIFF_DELETE2 && diffs[pointer][0] == DIFF_INSERT2) {
          var deletion = diffs[pointer - 1][1];
          var insertion = diffs[pointer][1];
          var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
          var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
          if (overlap_length1 >= overlap_length2) {
            if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
              diffs.splice(pointer, 0, new diff_match_patch2.Diff(
                DIFF_EQUAL2,
                insertion.substring(0, overlap_length1)
              ));
              diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
              diffs[pointer + 1][1] = insertion.substring(overlap_length1);
              pointer++;
            }
          } else {
            if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
              diffs.splice(pointer, 0, new diff_match_patch2.Diff(
                DIFF_EQUAL2,
                deletion.substring(0, overlap_length2)
              ));
              diffs[pointer - 1][0] = DIFF_INSERT2;
              diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
              diffs[pointer + 1][0] = DIFF_DELETE2;
              diffs[pointer + 1][1] = deletion.substring(overlap_length2);
              pointer++;
            }
          }
          pointer++;
        }
        pointer++;
      }
    };
    diff_match_patch2.prototype.diff_cleanupSemanticLossless = function(diffs) {
      function diff_cleanupSemanticScore_(one, two) {
        if (!one || !two) {
          return 6;
        }
        var char1 = one.charAt(one.length - 1);
        var char2 = two.charAt(0);
        var nonAlphaNumeric1 = char1.match(diff_match_patch2.nonAlphaNumericRegex_);
        var nonAlphaNumeric2 = char2.match(diff_match_patch2.nonAlphaNumericRegex_);
        var whitespace1 = nonAlphaNumeric1 && char1.match(diff_match_patch2.whitespaceRegex_);
        var whitespace2 = nonAlphaNumeric2 && char2.match(diff_match_patch2.whitespaceRegex_);
        var lineBreak1 = whitespace1 && char1.match(diff_match_patch2.linebreakRegex_);
        var lineBreak2 = whitespace2 && char2.match(diff_match_patch2.linebreakRegex_);
        var blankLine1 = lineBreak1 && one.match(diff_match_patch2.blanklineEndRegex_);
        var blankLine2 = lineBreak2 && two.match(diff_match_patch2.blanklineStartRegex_);
        if (blankLine1 || blankLine2) {
          return 5;
        } else if (lineBreak1 || lineBreak2) {
          return 4;
        } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
          return 3;
        } else if (whitespace1 || whitespace2) {
          return 2;
        } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
          return 1;
        }
        return 0;
      }
      var pointer = 1;
      while (pointer < diffs.length - 1) {
        if (diffs[pointer - 1][0] == DIFF_EQUAL2 && diffs[pointer + 1][0] == DIFF_EQUAL2) {
          var equality1 = diffs[pointer - 1][1];
          var edit = diffs[pointer][1];
          var equality2 = diffs[pointer + 1][1];
          var commonOffset = this.diff_commonSuffix(equality1, edit);
          if (commonOffset) {
            var commonString = edit.substring(edit.length - commonOffset);
            equality1 = equality1.substring(0, equality1.length - commonOffset);
            edit = commonString + edit.substring(0, edit.length - commonOffset);
            equality2 = commonString + equality2;
          }
          var bestEquality1 = equality1;
          var bestEdit = edit;
          var bestEquality2 = equality2;
          var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
          while (edit.charAt(0) === equality2.charAt(0)) {
            equality1 += edit.charAt(0);
            edit = edit.substring(1) + equality2.charAt(0);
            equality2 = equality2.substring(1);
            var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
            if (score >= bestScore) {
              bestScore = score;
              bestEquality1 = equality1;
              bestEdit = edit;
              bestEquality2 = equality2;
            }
          }
          if (diffs[pointer - 1][1] != bestEquality1) {
            if (bestEquality1) {
              diffs[pointer - 1][1] = bestEquality1;
            } else {
              diffs.splice(pointer - 1, 1);
              pointer--;
            }
            diffs[pointer][1] = bestEdit;
            if (bestEquality2) {
              diffs[pointer + 1][1] = bestEquality2;
            } else {
              diffs.splice(pointer + 1, 1);
              pointer--;
            }
          }
        }
        pointer++;
      }
    };
    diff_match_patch2.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
    diff_match_patch2.whitespaceRegex_ = /\s/;
    diff_match_patch2.linebreakRegex_ = /[\r\n]/;
    diff_match_patch2.blanklineEndRegex_ = /\n\r?\n$/;
    diff_match_patch2.blanklineStartRegex_ = /^\r?\n\r?\n/;
    diff_match_patch2.prototype.diff_cleanupEfficiency = function(diffs) {
      var changes3 = false;
      var equalities = [];
      var equalitiesLength = 0;
      var lastEquality = null;
      var pointer = 0;
      var pre_ins = false;
      var pre_del = false;
      var post_ins = false;
      var post_del = false;
      while (pointer < diffs.length) {
        if (diffs[pointer][0] == DIFF_EQUAL2) {
          if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) {
            equalities[equalitiesLength++] = pointer;
            pre_ins = post_ins;
            pre_del = post_del;
            lastEquality = diffs[pointer][1];
          } else {
            equalitiesLength = 0;
            lastEquality = null;
          }
          post_ins = post_del = false;
        } else {
          if (diffs[pointer][0] == DIFF_DELETE2) {
            post_del = true;
          } else {
            post_ins = true;
          }
          if (lastEquality && (pre_ins && pre_del && post_ins && post_del || lastEquality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) {
            diffs.splice(
              equalities[equalitiesLength - 1],
              0,
              new diff_match_patch2.Diff(DIFF_DELETE2, lastEquality)
            );
            diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT2;
            equalitiesLength--;
            lastEquality = null;
            if (pre_ins && pre_del) {
              post_ins = post_del = true;
              equalitiesLength = 0;
            } else {
              equalitiesLength--;
              pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
              post_ins = post_del = false;
            }
            changes3 = true;
          }
        }
        pointer++;
      }
      if (changes3) {
        this.diff_cleanupMerge(diffs);
      }
    };
    diff_match_patch2.prototype.diff_cleanupMerge = function(diffs) {
      diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, ""));
      var pointer = 0;
      var count_delete = 0;
      var count_insert = 0;
      var text_delete = "";
      var text_insert = "";
      var commonlength;
      while (pointer < diffs.length) {
        switch (diffs[pointer][0]) {
          case DIFF_INSERT2:
            count_insert++;
            text_insert += diffs[pointer][1];
            pointer++;
            break;
          case DIFF_DELETE2:
            count_delete++;
            text_delete += diffs[pointer][1];
            pointer++;
            break;
          case DIFF_EQUAL2:
            if (count_delete + count_insert > 1) {
              if (count_delete !== 0 && count_insert !== 0) {
                commonlength = this.diff_commonPrefix(text_insert, text_delete);
                if (commonlength !== 0) {
                  if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL2) {
                    diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
                  } else {
                    diffs.splice(0, 0, new diff_match_patch2.Diff(
                      DIFF_EQUAL2,
                      text_insert.substring(0, commonlength)
                    ));
                    pointer++;
                  }
                  text_insert = text_insert.substring(commonlength);
                  text_delete = text_delete.substring(commonlength);
                }
                commonlength = this.diff_commonSuffix(text_insert, text_delete);
                if (commonlength !== 0) {
                  diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
                  text_insert = text_insert.substring(0, text_insert.length - commonlength);
                  text_delete = text_delete.substring(0, text_delete.length - commonlength);
                }
              }
              pointer -= count_delete + count_insert;
              diffs.splice(pointer, count_delete + count_insert);
              if (text_delete.length) {
                diffs.splice(
                  pointer,
                  0,
                  new diff_match_patch2.Diff(DIFF_DELETE2, text_delete)
                );
                pointer++;
              }
              if (text_insert.length) {
                diffs.splice(
                  pointer,
                  0,
                  new diff_match_patch2.Diff(DIFF_INSERT2, text_insert)
                );
                pointer++;
              }
              pointer++;
            } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL2) {
              diffs[pointer - 1][1] += diffs[pointer][1];
              diffs.splice(pointer, 1);
            } else {
              pointer++;
            }
            count_insert = 0;
            count_delete = 0;
            text_delete = "";
            text_insert = "";
            break;
        }
      }
      if (diffs[diffs.length - 1][1] === "") {
        diffs.pop();
      }
      var changes3 = false;
      pointer = 1;
      while (pointer < diffs.length - 1) {
        if (diffs[pointer - 1][0] == DIFF_EQUAL2 && diffs[pointer + 1][0] == DIFF_EQUAL2) {
          if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
            diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
            diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
            diffs.splice(pointer - 1, 1);
            changes3 = true;
          } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
            diffs[pointer - 1][1] += diffs[pointer + 1][1];
            diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
            diffs.splice(pointer + 1, 1);
            changes3 = true;
          }
        }
        pointer++;
      }
      if (changes3) {
        this.diff_cleanupMerge(diffs);
      }
    };
    diff_match_patch2.prototype.diff_xIndex = function(diffs, loc) {
      var chars1 = 0;
      var chars2 = 0;
      var last_chars1 = 0;
      var last_chars2 = 0;
      var x;
      for (x = 0; x < diffs.length; x++) {
        if (diffs[x][0] !== DIFF_INSERT2) {
          chars1 += diffs[x][1].length;
        }
        if (diffs[x][0] !== DIFF_DELETE2) {
          chars2 += diffs[x][1].length;
        }
        if (chars1 > loc) {
          break;
        }
        last_chars1 = chars1;
        last_chars2 = chars2;
      }
      if (diffs.length != x && diffs[x][0] === DIFF_DELETE2) {
        return last_chars2;
      }
      return last_chars2 + (loc - last_chars1);
    };
    diff_match_patch2.prototype.diff_prettyHtml = function(diffs) {
      var html2 = [];
      var pattern_amp = /&/g;
      var pattern_lt = /</g;
      var pattern_gt = />/g;
      var pattern_para = /\n/g;
      for (var x = 0; x < diffs.length; x++) {
        var op = diffs[x][0];
        var data = diffs[x][1];
        var text3 = data.replace(pattern_amp, "&amp;").replace(pattern_lt, "&lt;").replace(pattern_gt, "&gt;").replace(pattern_para, "&para;<br>");
        switch (op) {
          case DIFF_INSERT2:
            html2[x] = '<ins style="background:#e6ffe6;">' + text3 + "</ins>";
            break;
          case DIFF_DELETE2:
            html2[x] = '<del style="background:#ffe6e6;">' + text3 + "</del>";
            break;
          case DIFF_EQUAL2:
            html2[x] = "<span>" + text3 + "</span>";
            break;
        }
      }
      return html2.join("");
    };
    diff_match_patch2.prototype.diff_text1 = function(diffs) {
      var text3 = [];
      for (var x = 0; x < diffs.length; x++) {
        if (diffs[x][0] !== DIFF_INSERT2) {
          text3[x] = diffs[x][1];
        }
      }
      return text3.join("");
    };
    diff_match_patch2.prototype.diff_text2 = function(diffs) {
      var text3 = [];
      for (var x = 0; x < diffs.length; x++) {
        if (diffs[x][0] !== DIFF_DELETE2) {
          text3[x] = diffs[x][1];
        }
      }
      return text3.join("");
    };
    diff_match_patch2.prototype.diff_levenshtein = function(diffs) {
      var levenshtein = 0;
      var insertions = 0;
      var deletions = 0;
      for (var x = 0; x < diffs.length; x++) {
        var op = diffs[x][0];
        var data = diffs[x][1];
        switch (op) {
          case DIFF_INSERT2:
            insertions += data.length;
            break;
          case DIFF_DELETE2:
            deletions += data.length;
            break;
          case DIFF_EQUAL2:
            levenshtein += Math.max(insertions, deletions);
            insertions = 0;
            deletions = 0;
            break;
        }
      }
      levenshtein += Math.max(insertions, deletions);
      return levenshtein;
    };
    diff_match_patch2.prototype.diff_toDelta = function(diffs) {
      var text3 = [];
      for (var x = 0; x < diffs.length; x++) {
        switch (diffs[x][0]) {
          case DIFF_INSERT2:
            text3[x] = "+" + encodeURI(diffs[x][1]);
            break;
          case DIFF_DELETE2:
            text3[x] = "-" + diffs[x][1].length;
            break;
          case DIFF_EQUAL2:
            text3[x] = "=" + diffs[x][1].length;
            break;
        }
      }
      return text3.join("	").replace(/%20/g, " ");
    };
    diff_match_patch2.prototype.diff_fromDelta = function(text1, delta) {
      var diffs = [];
      var diffsLength = 0;
      var pointer = 0;
      var tokens = delta.split(/\t/g);
      for (var x = 0; x < tokens.length; x++) {
        var param = tokens[x].substring(1);
        switch (tokens[x].charAt(0)) {
          case "+":
            try {
              diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_INSERT2, decodeURI(param));
            } catch (ex) {
              throw new Error("Illegal escape in diff_fromDelta: " + param);
            }
            break;
          case "-":
          // Fall through.
          case "=":
            var n3 = parseInt(param, 10);
            if (isNaN(n3) || n3 < 0) {
              throw new Error("Invalid number in diff_fromDelta: " + param);
            }
            var text3 = text1.substring(pointer, pointer += n3);
            if (tokens[x].charAt(0) == "=") {
              diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_EQUAL2, text3);
            } else {
              diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_DELETE2, text3);
            }
            break;
          default:
            if (tokens[x]) {
              throw new Error("Invalid diff operation in diff_fromDelta: " + tokens[x]);
            }
        }
      }
      if (pointer != text1.length) {
        throw new Error("Delta length (" + pointer + ") does not equal source text length (" + text1.length + ").");
      }
      return diffs;
    };
    diff_match_patch2.prototype.match_main = function(text3, pattern, loc) {
      if (text3 == null || pattern == null || loc == null) {
        throw new Error("Null input. (match_main)");
      }
      loc = Math.max(0, Math.min(loc, text3.length));
      if (text3 == pattern) {
        return 0;
      } else if (!text3.length) {
        return -1;
      } else if (text3.substring(loc, loc + pattern.length) == pattern) {
        return loc;
      } else {
        return this.match_bitap_(text3, pattern, loc);
      }
    };
    diff_match_patch2.prototype.match_bitap_ = function(text3, pattern, loc) {
      if (pattern.length > this.Match_MaxBits) {
        throw new Error("Pattern too long for this browser.");
      }
      var s = this.match_alphabet_(pattern);
      var dmp = this;
      function match_bitapScore_(e2, x) {
        var accuracy = e2 / pattern.length;
        var proximity = Math.abs(loc - x);
        if (!dmp.Match_Distance) {
          return proximity ? 1 : accuracy;
        }
        return accuracy + proximity / dmp.Match_Distance;
      }
      var score_threshold = this.Match_Threshold;
      var best_loc = text3.indexOf(pattern, loc);
      if (best_loc != -1) {
        score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
        best_loc = text3.lastIndexOf(pattern, loc + pattern.length);
        if (best_loc != -1) {
          score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
        }
      }
      var matchmask = 1 << pattern.length - 1;
      best_loc = -1;
      var bin_min, bin_mid;
      var bin_max = pattern.length + text3.length;
      var last_rd;
      for (var d = 0; d < pattern.length; d++) {
        bin_min = 0;
        bin_mid = bin_max;
        while (bin_min < bin_mid) {
          if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {
            bin_min = bin_mid;
          } else {
            bin_max = bin_mid;
          }
          bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
        }
        bin_max = bin_mid;
        var start = Math.max(1, loc - bin_mid + 1);
        var finish = Math.min(loc + bin_mid, text3.length) + pattern.length;
        var rd = Array(finish + 2);
        rd[finish + 1] = (1 << d) - 1;
        for (var j = finish; j >= start; j--) {
          var charMatch = s[text3.charAt(j - 1)];
          if (d === 0) {
            rd[j] = (rd[j + 1] << 1 | 1) & charMatch;
          } else {
            rd[j] = (rd[j + 1] << 1 | 1) & charMatch | ((last_rd[j + 1] | last_rd[j]) << 1 | 1) | last_rd[j + 1];
          }
          if (rd[j] & matchmask) {
            var score = match_bitapScore_(d, j - 1);
            if (score <= score_threshold) {
              score_threshold = score;
              best_loc = j - 1;
              if (best_loc > loc) {
                start = Math.max(1, 2 * loc - best_loc);
              } else {
                break;
              }
            }
          }
        }
        if (match_bitapScore_(d + 1, loc) > score_threshold) {
          break;
        }
        last_rd = rd;
      }
      return best_loc;
    };
    diff_match_patch2.prototype.match_alphabet_ = function(pattern) {
      var s = {};
      for (var i = 0; i < pattern.length; i++) {
        s[pattern.charAt(i)] = 0;
      }
      for (var i = 0; i < pattern.length; i++) {
        s[pattern.charAt(i)] |= 1 << pattern.length - i - 1;
      }
      return s;
    };
    diff_match_patch2.prototype.patch_addContext_ = function(patch, text3) {
      if (text3.length == 0) {
        return;
      }
      if (patch.start2 === null) {
        throw Error("patch not initialized");
      }
      var pattern = text3.substring(patch.start2, patch.start2 + patch.length1);
      var padding = 0;
      while (text3.indexOf(pattern) != text3.lastIndexOf(pattern) && pattern.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
        padding += this.Patch_Margin;
        pattern = text3.substring(
          patch.start2 - padding,
          patch.start2 + patch.length1 + padding
        );
      }
      padding += this.Patch_Margin;
      var prefix = text3.substring(patch.start2 - padding, patch.start2);
      if (prefix) {
        patch.diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL2, prefix));
      }
      var suffix = text3.substring(
        patch.start2 + patch.length1,
        patch.start2 + patch.length1 + padding
      );
      if (suffix) {
        patch.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, suffix));
      }
      patch.start1 -= prefix.length;
      patch.start2 -= prefix.length;
      patch.length1 += prefix.length + suffix.length;
      patch.length2 += prefix.length + suffix.length;
    };
    diff_match_patch2.prototype.patch_make = function(a, opt_b, opt_c) {
      var text1, diffs;
      if (typeof a == "string" && typeof opt_b == "string" && typeof opt_c == "undefined") {
        text1 = /** @type {string} */
        a;
        diffs = this.diff_main(
          text1,
          /** @type {string} */
          opt_b,
          true
        );
        if (diffs.length > 2) {
          this.diff_cleanupSemantic(diffs);
          this.diff_cleanupEfficiency(diffs);
        }
      } else if (a && typeof a == "object" && typeof opt_b == "undefined" && typeof opt_c == "undefined") {
        diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
        a;
        text1 = this.diff_text1(diffs);
      } else if (typeof a == "string" && opt_b && typeof opt_b == "object" && typeof opt_c == "undefined") {
        text1 = /** @type {string} */
        a;
        diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
        opt_b;
      } else if (typeof a == "string" && typeof opt_b == "string" && opt_c && typeof opt_c == "object") {
        text1 = /** @type {string} */
        a;
        diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
        opt_c;
      } else {
        throw new Error("Unknown call format to patch_make.");
      }
      if (diffs.length === 0) {
        return [];
      }
      var patches = [];
      var patch = new diff_match_patch2.patch_obj();
      var patchDiffLength = 0;
      var char_count1 = 0;
      var char_count2 = 0;
      var prepatch_text = text1;
      var postpatch_text = text1;
      for (var x = 0; x < diffs.length; x++) {
        var diff_type = diffs[x][0];
        var diff_text = diffs[x][1];
        if (!patchDiffLength && diff_type !== DIFF_EQUAL2) {
          patch.start1 = char_count1;
          patch.start2 = char_count2;
        }
        switch (diff_type) {
          case DIFF_INSERT2:
            patch.diffs[patchDiffLength++] = diffs[x];
            patch.length2 += diff_text.length;
            postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2);
            break;
          case DIFF_DELETE2:
            patch.length1 += diff_text.length;
            patch.diffs[patchDiffLength++] = diffs[x];
            postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length);
            break;
          case DIFF_EQUAL2:
            if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x + 1) {
              patch.diffs[patchDiffLength++] = diffs[x];
              patch.length1 += diff_text.length;
              patch.length2 += diff_text.length;
            } else if (diff_text.length >= 2 * this.Patch_Margin) {
              if (patchDiffLength) {
                this.patch_addContext_(patch, prepatch_text);
                patches.push(patch);
                patch = new diff_match_patch2.patch_obj();
                patchDiffLength = 0;
                prepatch_text = postpatch_text;
                char_count1 = char_count2;
              }
            }
            break;
        }
        if (diff_type !== DIFF_INSERT2) {
          char_count1 += diff_text.length;
        }
        if (diff_type !== DIFF_DELETE2) {
          char_count2 += diff_text.length;
        }
      }
      if (patchDiffLength) {
        this.patch_addContext_(patch, prepatch_text);
        patches.push(patch);
      }
      return patches;
    };
    diff_match_patch2.prototype.patch_deepCopy = function(patches) {
      var patchesCopy = [];
      for (var x = 0; x < patches.length; x++) {
        var patch = patches[x];
        var patchCopy = new diff_match_patch2.patch_obj();
        patchCopy.diffs = [];
        for (var y = 0; y < patch.diffs.length; y++) {
          patchCopy.diffs[y] = new diff_match_patch2.Diff(patch.diffs[y][0], patch.diffs[y][1]);
        }
        patchCopy.start1 = patch.start1;
        patchCopy.start2 = patch.start2;
        patchCopy.length1 = patch.length1;
        patchCopy.length2 = patch.length2;
        patchesCopy[x] = patchCopy;
      }
      return patchesCopy;
    };
    diff_match_patch2.prototype.patch_apply = function(patches, text3) {
      if (patches.length == 0) {
        return [text3, []];
      }
      patches = this.patch_deepCopy(patches);
      var nullPadding = this.patch_addPadding(patches);
      text3 = nullPadding + text3 + nullPadding;
      this.patch_splitMax(patches);
      var delta = 0;
      var results = [];
      for (var x = 0; x < patches.length; x++) {
        var expected_loc = patches[x].start2 + delta;
        var text1 = this.diff_text1(patches[x].diffs);
        var start_loc;
        var end_loc = -1;
        if (text1.length > this.Match_MaxBits) {
          start_loc = this.match_main(
            text3,
            text1.substring(0, this.Match_MaxBits),
            expected_loc
          );
          if (start_loc != -1) {
            end_loc = this.match_main(
              text3,
              text1.substring(text1.length - this.Match_MaxBits),
              expected_loc + text1.length - this.Match_MaxBits
            );
            if (end_loc == -1 || start_loc >= end_loc) {
              start_loc = -1;
            }
          }
        } else {
          start_loc = this.match_main(text3, text1, expected_loc);
        }
        if (start_loc == -1) {
          results[x] = false;
          delta -= patches[x].length2 - patches[x].length1;
        } else {
          results[x] = true;
          delta = start_loc - expected_loc;
          var text22;
          if (end_loc == -1) {
            text22 = text3.substring(start_loc, start_loc + text1.length);
          } else {
            text22 = text3.substring(start_loc, end_loc + this.Match_MaxBits);
          }
          if (text1 == text22) {
            text3 = text3.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text3.substring(start_loc + text1.length);
          } else {
            var diffs = this.diff_main(text1, text22, false);
            if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
              results[x] = false;
            } else {
              this.diff_cleanupSemanticLossless(diffs);
              var index1 = 0;
              var index22;
              for (var y = 0; y < patches[x].diffs.length; y++) {
                var mod = patches[x].diffs[y];
                if (mod[0] !== DIFF_EQUAL2) {
                  index22 = this.diff_xIndex(diffs, index1);
                }
                if (mod[0] === DIFF_INSERT2) {
                  text3 = text3.substring(0, start_loc + index22) + mod[1] + text3.substring(start_loc + index22);
                } else if (mod[0] === DIFF_DELETE2) {
                  text3 = text3.substring(0, start_loc + index22) + text3.substring(start_loc + this.diff_xIndex(
                    diffs,
                    index1 + mod[1].length
                  ));
                }
                if (mod[0] !== DIFF_DELETE2) {
                  index1 += mod[1].length;
                }
              }
            }
          }
        }
      }
      text3 = text3.substring(nullPadding.length, text3.length - nullPadding.length);
      return [text3, results];
    };
    diff_match_patch2.prototype.patch_addPadding = function(patches) {
      var paddingLength = this.Patch_Margin;
      var nullPadding = "";
      for (var x = 1; x <= paddingLength; x++) {
        nullPadding += String.fromCharCode(x);
      }
      for (var x = 0; x < patches.length; x++) {
        patches[x].start1 += paddingLength;
        patches[x].start2 += paddingLength;
      }
      var patch = patches[0];
      var diffs = patch.diffs;
      if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL2) {
        diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL2, nullPadding));
        patch.start1 -= paddingLength;
        patch.start2 -= paddingLength;
        patch.length1 += paddingLength;
        patch.length2 += paddingLength;
      } else if (paddingLength > diffs[0][1].length) {
        var extraLength = paddingLength - diffs[0][1].length;
        diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
        patch.start1 -= extraLength;
        patch.start2 -= extraLength;
        patch.length1 += extraLength;
        patch.length2 += extraLength;
      }
      patch = patches[patches.length - 1];
      diffs = patch.diffs;
      if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL2) {
        diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, nullPadding));
        patch.length1 += paddingLength;
        patch.length2 += paddingLength;
      } else if (paddingLength > diffs[diffs.length - 1][1].length) {
        var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
        diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
        patch.length1 += extraLength;
        patch.length2 += extraLength;
      }
      return nullPadding;
    };
    diff_match_patch2.prototype.patch_splitMax = function(patches) {
      var patch_size = this.Match_MaxBits;
      for (var x = 0; x < patches.length; x++) {
        if (patches[x].length1 <= patch_size) {
          continue;
        }
        var bigpatch = patches[x];
        patches.splice(x--, 1);
        var start1 = bigpatch.start1;
        var start2 = bigpatch.start2;
        var precontext = "";
        while (bigpatch.diffs.length !== 0) {
          var patch = new diff_match_patch2.patch_obj();
          var empty = true;
          patch.start1 = start1 - precontext.length;
          patch.start2 = start2 - precontext.length;
          if (precontext !== "") {
            patch.length1 = patch.length2 = precontext.length;
            patch.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, precontext));
          }
          while (bigpatch.diffs.length !== 0 && patch.length1 < patch_size - this.Patch_Margin) {
            var diff_type = bigpatch.diffs[0][0];
            var diff_text = bigpatch.diffs[0][1];
            if (diff_type === DIFF_INSERT2) {
              patch.length2 += diff_text.length;
              start2 += diff_text.length;
              patch.diffs.push(bigpatch.diffs.shift());
              empty = false;
            } else if (diff_type === DIFF_DELETE2 && patch.diffs.length == 1 && patch.diffs[0][0] == DIFF_EQUAL2 && diff_text.length > 2 * patch_size) {
              patch.length1 += diff_text.length;
              start1 += diff_text.length;
              empty = false;
              patch.diffs.push(new diff_match_patch2.Diff(diff_type, diff_text));
              bigpatch.diffs.shift();
            } else {
              diff_text = diff_text.substring(
                0,
                patch_size - patch.length1 - this.Patch_Margin
              );
              patch.length1 += diff_text.length;
              start1 += diff_text.length;
              if (diff_type === DIFF_EQUAL2) {
                patch.length2 += diff_text.length;
                start2 += diff_text.length;
              } else {
                empty = false;
              }
              patch.diffs.push(new diff_match_patch2.Diff(diff_type, diff_text));
              if (diff_text == bigpatch.diffs[0][1]) {
                bigpatch.diffs.shift();
              } else {
                bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length);
              }
            }
          }
          precontext = this.diff_text2(patch.diffs);
          precontext = precontext.substring(precontext.length - this.Patch_Margin);
          var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin);
          if (postcontext !== "") {
            patch.length1 += postcontext.length;
            patch.length2 += postcontext.length;
            if (patch.diffs.length !== 0 && patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL2) {
              patch.diffs[patch.diffs.length - 1][1] += postcontext;
            } else {
              patch.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, postcontext));
            }
          }
          if (!empty) {
            patches.splice(++x, 0, patch);
          }
        }
      }
    };
    diff_match_patch2.prototype.patch_toText = function(patches) {
      var text3 = [];
      for (var x = 0; x < patches.length; x++) {
        text3[x] = patches[x];
      }
      return text3.join("");
    };
    diff_match_patch2.prototype.patch_fromText = function(textline) {
      var patches = [];
      if (!textline) {
        return patches;
      }
      var text3 = textline.split("\n");
      var textPointer = 0;
      var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
      while (textPointer < text3.length) {
        var m2 = text3[textPointer].match(patchHeader);
        if (!m2) {
          throw new Error("Invalid patch string: " + text3[textPointer]);
        }
        var patch = new diff_match_patch2.patch_obj();
        patches.push(patch);
        patch.start1 = parseInt(m2[1], 10);
        if (m2[2] === "") {
          patch.start1--;
          patch.length1 = 1;
        } else if (m2[2] == "0") {
          patch.length1 = 0;
        } else {
          patch.start1--;
          patch.length1 = parseInt(m2[2], 10);
        }
        patch.start2 = parseInt(m2[3], 10);
        if (m2[4] === "") {
          patch.start2--;
          patch.length2 = 1;
        } else if (m2[4] == "0") {
          patch.length2 = 0;
        } else {
          patch.start2--;
          patch.length2 = parseInt(m2[4], 10);
        }
        textPointer++;
        while (textPointer < text3.length) {
          var sign = text3[textPointer].charAt(0);
          try {
            var line = decodeURI(text3[textPointer].substring(1));
          } catch (ex) {
            throw new Error("Illegal escape in patch_fromText: " + line);
          }
          if (sign == "-") {
            patch.diffs.push(new diff_match_patch2.Diff(DIFF_DELETE2, line));
          } else if (sign == "+") {
            patch.diffs.push(new diff_match_patch2.Diff(DIFF_INSERT2, line));
          } else if (sign == " ") {
            patch.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL2, line));
          } else if (sign == "@") {
            break;
          } else if (sign === "") {
          } else {
            throw new Error('Invalid patch mode "' + sign + '" in: ' + line);
          }
          textPointer++;
        }
      }
      return patches;
    };
    diff_match_patch2.patch_obj = function() {
      this.diffs = [];
      this.start1 = null;
      this.start2 = null;
      this.length1 = 0;
      this.length2 = 0;
    };
    diff_match_patch2.patch_obj.prototype.toString = function() {
      var coords1, coords2;
      if (this.length1 === 0) {
        coords1 = this.start1 + ",0";
      } else if (this.length1 == 1) {
        coords1 = this.start1 + 1;
      } else {
        coords1 = this.start1 + 1 + "," + this.length1;
      }
      if (this.length2 === 0) {
        coords2 = this.start2 + ",0";
      } else if (this.length2 == 1) {
        coords2 = this.start2 + 1;
      } else {
        coords2 = this.start2 + 1 + "," + this.length2;
      }
      var text3 = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
      var op;
      for (var x = 0; x < this.diffs.length; x++) {
        switch (this.diffs[x][0]) {
          case DIFF_INSERT2:
            op = "+";
            break;
          case DIFF_DELETE2:
            op = "-";
            break;
          case DIFF_EQUAL2:
            op = " ";
            break;
        }
        text3[x + 1] = op + encodeURI(this.diffs[x][1]) + "\n";
      }
      return text3.join("").replace(/%20/g, " ");
    };
    module2.exports = diff_match_patch2;
    module2.exports["diff_match_patch"] = diff_match_patch2;
    module2.exports["DIFF_DELETE"] = DIFF_DELETE2;
    module2.exports["DIFF_INSERT"] = DIFF_INSERT2;
    module2.exports["DIFF_EQUAL"] = DIFF_EQUAL2;
  }
});

// src/sync/core/managers/ConflictManager.ts
var import_diff_match_patch, ConflictManager;
var init_ConflictManager = __esm({
  "src/sync/core/managers/ConflictManager.ts"() {
    "use strict";
    import_diff_match_patch = __toESM2(require_diff_match_patch(), 1);
    init_binary();
    init_logger();
    init_types();
    init_utils2();
    init_utils_couchdb();
    ConflictManager = class {
      constructor(options) {
        this.options = options;
      }
      get database() {
        return this.options.database;
      }
      async getConflictedDoc(path8, rev3) {
        try {
          const doc = await this.options.entryManager.getDBEntry(path8, { rev: rev3 }, false, true, true);
          if (doc === false) return false;
          let data = getDocData(doc.data);
          if (doc.datatype == "newnote") {
            data = readString(new Uint8Array(decodeBinary(doc.data)));
          } else if (doc.datatype == "plain") {
          }
          return {
            deleted: doc.deleted || doc._deleted,
            ctime: doc.ctime,
            mtime: doc.mtime,
            rev: rev3,
            data
          };
        } catch (ex) {
          if (isErrorOfMissingDoc(ex)) {
            return false;
          }
        }
        return false;
      }
      async mergeSensibly(path8, baseRev, currentRev, conflictedRev) {
        var _a6, _b4, _c2, _d;
        const baseLeaf = await this.getConflictedDoc(path8, baseRev);
        const leftLeaf = await this.getConflictedDoc(path8, currentRev);
        const rightLeaf = await this.getConflictedDoc(path8, conflictedRev);
        let autoMerge = false;
        if (baseLeaf == false || leftLeaf == false || rightLeaf == false) {
          return false;
        }
        if (leftLeaf.deleted && rightLeaf.deleted) {
          return false;
        }
        const dmp = new import_diff_match_patch.diff_match_patch();
        const mapLeft = dmp.diff_linesToChars_(baseLeaf.data, leftLeaf.data);
        const diffLeftSrc = dmp.diff_main(mapLeft.chars1, mapLeft.chars2, false);
        dmp.diff_charsToLines_(diffLeftSrc, mapLeft.lineArray);
        const mapRight = dmp.diff_linesToChars_(baseLeaf.data, rightLeaf.data);
        const diffRightSrc = dmp.diff_main(mapRight.chars1, mapRight.chars2, false);
        dmp.diff_charsToLines_(diffRightSrc, mapRight.lineArray);
        function splitDiffPiece(src) {
          const ret = [];
          do {
            const d = src.shift();
            if (d === void 0) {
              return ret;
            }
            const pieces = d[1].split(/([^\n]*\n)/).filter((f3) => f3 != "");
            if (typeof d == "undefined") {
              break;
            }
            if (d[0] != import_diff_match_patch.DIFF_DELETE) {
              ret.push(...pieces.map((e2) => [d[0], e2]));
            }
            if (d[0] == import_diff_match_patch.DIFF_DELETE) {
              const nd = src.shift();
              if (typeof nd != "undefined") {
                const piecesPair = nd[1].split(/([^\n]*\n)/).filter((f3) => f3 != "");
                if (nd[0] == import_diff_match_patch.DIFF_INSERT) {
                  for (const pt of pieces) {
                    ret.push([d[0], pt]);
                    const pairP = piecesPair.shift();
                    if (typeof pairP != "undefined") ret.push([import_diff_match_patch.DIFF_INSERT, pairP]);
                  }
                  ret.push(...piecesPair.map((e2) => [nd[0], e2]));
                } else {
                  ret.push(...pieces.map((e2) => [d[0], e2]));
                  ret.push(...piecesPair.map((e2) => [nd[0], e2]));
                }
              } else {
                ret.push(...pieces.map((e2) => [0, e2]));
              }
            }
          } while (src.length > 0);
          return ret;
        }
        const diffLeft = splitDiffPiece(diffLeftSrc);
        const diffRight = splitDiffPiece(diffRightSrc);
        let rightIdx = 0;
        let leftIdx = 0;
        const merged = [];
        autoMerge = true;
        LOOP_MERGE: do {
          if (leftIdx >= diffLeft.length && rightIdx >= diffRight.length) {
            break LOOP_MERGE;
          }
          const leftItem = (_a6 = diffLeft[leftIdx]) != null ? _a6 : [0, ""];
          const rightItem = (_b4 = diffRight[rightIdx]) != null ? _b4 : [0, ""];
          leftIdx++;
          rightIdx++;
          if (leftItem[0] == import_diff_match_patch.DIFF_EQUAL && rightItem[0] == import_diff_match_patch.DIFF_EQUAL && leftItem[1] == rightItem[1]) {
            merged.push(leftItem);
            continue;
          }
          if (leftItem[0] == import_diff_match_patch.DIFF_DELETE && rightItem[0] == import_diff_match_patch.DIFF_DELETE && leftItem[1] == rightItem[1]) {
            const nextLeftIdx = leftIdx;
            const nextRightIdx = rightIdx;
            const [nextLeftItem, nextRightItem] = [
              (_c2 = diffLeft[nextLeftIdx]) != null ? _c2 : [0, ""],
              (_d = diffRight[nextRightIdx]) != null ? _d : [0, ""]
            ];
            if (nextLeftItem[0] == import_diff_match_patch.DIFF_INSERT && nextRightItem[0] == import_diff_match_patch.DIFF_INSERT && nextLeftItem[1] != nextRightItem[1]) {
              autoMerge = false;
              break;
            } else {
              merged.push(leftItem);
              continue;
            }
          }
          if (leftItem[0] == import_diff_match_patch.DIFF_INSERT && rightItem[0] == import_diff_match_patch.DIFF_INSERT) {
            if (leftItem[1] == rightItem[1]) {
              merged.push(leftItem);
              continue;
            } else {
              if (leftLeaf.mtime <= rightLeaf.mtime) {
                merged.push(leftItem);
                merged.push(rightItem);
                continue;
              } else {
                merged.push(rightItem);
                merged.push(leftItem);
                continue;
              }
            }
          }
          if (leftItem[0] == import_diff_match_patch.DIFF_INSERT) {
            rightIdx--;
            merged.push(leftItem);
            continue;
          }
          if (rightItem[0] == import_diff_match_patch.DIFF_INSERT) {
            leftIdx--;
            merged.push(rightItem);
            continue;
          }
          if (rightItem[1] != leftItem[1]) {
            Logger(
              `MERGING PANIC:${leftItem[0]},${leftItem[1]} == ${rightItem[0]},${rightItem[1]}`,
              LOG_LEVEL_VERBOSE
            );
            autoMerge = false;
            break LOOP_MERGE;
          }
          if (leftItem[0] == import_diff_match_patch.DIFF_DELETE) {
            if (rightItem[0] == import_diff_match_patch.DIFF_EQUAL) {
              merged.push(leftItem);
              continue;
            } else {
              autoMerge = false;
              break LOOP_MERGE;
            }
          }
          if (rightItem[0] == import_diff_match_patch.DIFF_DELETE) {
            if (leftItem[0] == import_diff_match_patch.DIFF_EQUAL) {
              merged.push(rightItem);
              continue;
            } else {
              autoMerge = false;
              break LOOP_MERGE;
            }
          }
          Logger(
            `Weird condition:${leftItem[0]},${leftItem[1]} == ${rightItem[0]},${rightItem[1]}`,
            LOG_LEVEL_VERBOSE
          );
          break LOOP_MERGE;
        } while (leftIdx < diffLeft.length || rightIdx < diffRight.length);
        if (autoMerge) {
          Logger(`Sensibly merge available`, LOG_LEVEL_VERBOSE);
          return merged;
        } else {
          return false;
        }
      }
      async mergeObject(path8, baseRev, currentRev, conflictedRev) {
        try {
          const baseLeaf = await this.getConflictedDoc(path8, baseRev);
          const leftLeaf = await this.getConflictedDoc(path8, currentRev);
          const rightLeaf = await this.getConflictedDoc(path8, conflictedRev);
          if (baseLeaf == false || leftLeaf == false || rightLeaf == false) {
            Logger(`Could not load leafs for merge`, LOG_LEVEL_VERBOSE);
            Logger(
              `${baseLeaf ? "base" : "missing base"}, ${leftLeaf ? "left" : "missing left"}, ${rightLeaf ? "right" : "missing right"} }`,
              LOG_LEVEL_VERBOSE
            );
            return false;
          }
          if (leftLeaf.deleted && rightLeaf.deleted) {
            Logger(`Both are deleted`, LOG_LEVEL_VERBOSE);
            return false;
          }
          const baseObj = { data: tryParseJSON(baseLeaf.data, {}) };
          const leftObj = { data: tryParseJSON(leftLeaf.data, {}) };
          const rightObj = { data: tryParseJSON(rightLeaf.data, {}) };
          const diffLeft = generatePatchObj(baseObj, leftObj);
          const diffRight = generatePatchObj(baseObj, rightObj);
          const diffSetLeft = new Map(flattenObject(diffLeft));
          const diffSetRight = new Map(flattenObject(diffRight));
          for (const [key4, value2] of diffSetLeft) {
            if (diffSetRight.has(key4)) {
              if (diffSetRight.get(key4) == value2) {
                diffSetRight.delete(key4);
              }
            }
          }
          for (const [key4, value2] of diffSetRight) {
            if (diffSetLeft.has(key4) && diffSetLeft.get(key4) != value2) {
              Logger(`Conflicted key:${key4}`, LOG_LEVEL_VERBOSE);
              return false;
            }
          }
          const patches = [
            { mtime: leftLeaf.mtime, patch: diffLeft },
            { mtime: rightLeaf.mtime, patch: diffRight }
          ].sort((a, b) => a.mtime - b.mtime);
          let newObj = { ...baseObj };
          for (const patch of patches) {
            newObj = applyPatch(newObj, patch.patch);
          }
          Logger(`Object merge is applicable!`, LOG_LEVEL_VERBOSE);
          return JSON.stringify(newObj.data);
        } catch (ex) {
          Logger("Could not merge object");
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      async tryAutoMergeSensibly(path8, test, conflicts) {
        var _a6, _b4, _c2;
        const conflictedRev = conflicts[0];
        const conflictedRevNo = Number(conflictedRev.split("-")[0]);
        const revFrom = await this.database.get(await this.options.entryManager.path2id(path8), {
          revs_info: true
        });
        const commonBase = (_c2 = (_b4 = (_a6 = (revFrom._revs_info || []).filter(
          (e2) => e2.status == "available" && Number(e2.rev.split("-")[0]) < conflictedRevNo
        )) == null ? void 0 : _a6[0]) == null ? void 0 : _b4.rev) != null ? _c2 : "";
        let p = void 0;
        if (commonBase) {
          if (isSensibleMargeApplicable(path8)) {
            const result = await this.mergeSensibly(path8, commonBase, test._rev, conflictedRev);
            if (result) {
              p = result.filter((e2) => e2[0] != import_diff_match_patch.DIFF_DELETE).map((e2) => e2[1]).join("");
              Logger(`Sensible merge:${path8}`, LOG_LEVEL_INFO);
            } else {
              Logger(`Sensible merge is not applicable.`, LOG_LEVEL_VERBOSE);
            }
          } else if (isObjectMargeApplicable(path8)) {
            const result = await this.mergeObject(path8, commonBase, test._rev, conflictedRev);
            if (result) {
              Logger(`Object merge:${path8}`, LOG_LEVEL_INFO);
              p = result;
            } else {
              Logger(`Object merge is not applicable..`, LOG_LEVEL_VERBOSE);
            }
          }
          if (p !== void 0) {
            return { result: p, conflictedRev };
          }
        }
        return false;
      }
      async tryAutoMerge(path8, enableMarkdownAutoMerge) {
        const test = await this.options.entryManager.getDBEntry(
          path8,
          { conflicts: true, revs_info: true },
          false,
          false,
          true
        );
        if (test === false) return { ok: MISSING_OR_ERROR };
        if (test == null) return { ok: MISSING_OR_ERROR };
        if (!test._conflicts) return { ok: NOT_CONFLICTED };
        if (test._conflicts.length == 0) return { ok: NOT_CONFLICTED };
        const conflicts = test._conflicts.sort((a, b) => Number(a.split("-")[0]) - Number(b.split("-")[0]));
        if ((isSensibleMargeApplicable(path8) || isObjectMargeApplicable(path8)) && enableMarkdownAutoMerge) {
          const autoMergeResult = await this.tryAutoMergeSensibly(path8, test, conflicts);
          if (autoMergeResult !== false) {
            return autoMergeResult;
          }
        }
        const leftLeaf = await this.getConflictedDoc(path8, test._rev);
        const rightLeaf = await this.getConflictedDoc(path8, conflicts[0]);
        return { leftRev: test._rev, rightRev: conflicts[0], leftLeaf, rightLeaf };
      }
    };
  }
});

// src/sync/core/managers/EntryManager/EntryManager.ts
var EntryManager;
var init_EntryManager = __esm({
  "src/sync/core/managers/EntryManager/EntryManager.ts"() {
    "use strict";
    init_logger();
    init_lock_v2();
    init_types();
    init_utils2();
    init_utils_couchdb();
    init_path();
    EntryManager = class {
      constructor(options) {
        this.options = options;
      }
      get localDatabase() {
        return this.options.database;
      }
      get hashManager() {
        return this.options.hashManager;
      }
      get chunkManager() {
        return this.options.chunkManager;
      }
      get chunkFetcher() {
        return this.options.chunkFetcher;
      }
      get splitter() {
        return this.options.splitter;
      }
      get settings() {
        return this.options.settings;
      }
      id2path(id, entry, stripPrefix) {
        return this.options.$$id2path(id, entry, stripPrefix);
      }
      async path2id(filename, prefix) {
        return await this.options.$$path2id(filename, prefix);
      }
      get isOnDemandChunkEnabled() {
        if (this.settings.remoteType !== REMOTE_COUCHDB) {
          return false;
        }
        if (this.settings.useOnlyLocalChunk) {
          return false;
        }
        return true;
      }
      isTargetFile(filenameSrc) {
        const file = filenameSrc.startsWith("i:") ? filenameSrc.substring(2) : filenameSrc;
        if (file.startsWith("ix:")) return true;
        if (file.startsWith("ps:")) return true;
        if (file.includes(":")) {
          return false;
        }
        if (this.settings.syncOnlyRegEx) {
          const syncOnly = getFileRegExp(this.settings, "syncOnlyRegEx");
          if (syncOnly.length > 0 && !syncOnly.some((e2) => e2.test(file))) return false;
        }
        if (this.settings.syncIgnoreRegEx) {
          const syncIgnore = getFileRegExp(this.settings, "syncIgnoreRegEx");
          if (syncIgnore.some((e2) => e2.test(file))) return false;
        }
        return true;
      }
      async prepareChunk(piece) {
        const cachedChunkId = this.chunkManager.getChunkIDFromCache(piece);
        if (cachedChunkId !== false) {
          return { isNew: false, id: cachedChunkId, piece };
        }
        const chunkId = await this.hashManager.computeHash(piece);
        return { isNew: true, id: `${IDPrefixes.Chunk}${chunkId}`, piece };
      }
      async getDBEntryMeta(path8, opt, includeDeleted = false) {
        var _a6, _b4;
        if (!this.isTargetFile(path8)) {
          return false;
        }
        const id = await this.path2id(path8);
        try {
          let obj = null;
          if (opt) {
            obj = await this.localDatabase.get(id, opt);
          } else {
            obj = await this.localDatabase.get(id);
          }
          const deleted = (_b4 = (_a6 = obj == null ? void 0 : obj.deleted) != null ? _a6 : obj._deleted) != null ? _b4 : void 0;
          if (!includeDeleted && deleted) return false;
          if (obj.type && obj.type == "leaf") {
            return false;
          }
          if (!obj.type || obj.type && obj.type == "notes" || obj.type == "newnote" || obj.type == "plain") {
            const note = obj;
            let children = [];
            let type = "plain";
            if (obj.type == "newnote" || obj.type == "plain") {
              children = obj.children;
              type = obj.type;
            }
            const doc = {
              data: "",
              _id: note._id,
              path: path8,
              ctime: note.ctime,
              mtime: note.mtime,
              size: note.size,
              // _deleted: obj._deleted,
              _rev: obj._rev,
              _conflicts: obj._conflicts,
              children,
              datatype: type,
              deleted,
              type,
              eden: "eden" in obj ? obj.eden : {}
            };
            return doc;
          }
        } catch (ex) {
          if (isErrorOfMissingDoc(ex)) {
            return false;
          }
          throw ex;
        }
        return false;
      }
      async getDBEntry(path8, opt, dump = false, waitForReady = true, includeDeleted = false) {
        const meta = await this.getDBEntryMeta(path8, opt, includeDeleted);
        if (meta) {
          return await this.getDBEntryFromMeta(meta, dump, waitForReady);
        } else {
          return false;
        }
      }
      async getDBEntryFromMeta(meta, dump = false, waitForReady = true) {
        var _a6, _b4, _c2, _d, _e;
        const filename = this.id2path(meta._id, meta);
        if (!this.isTargetFile(filename)) {
          return false;
        }
        const dispFilename = stripAllPrefixes(filename);
        const deleted = (_b4 = (_a6 = meta.deleted) != null ? _a6 : meta._deleted) != null ? _b4 : void 0;
        if (!meta.type || meta.type && meta.type == "notes") {
          const note = meta;
          const doc = {
            data: note.data,
            path: note.path,
            _id: note._id,
            ctime: note.ctime,
            mtime: note.mtime,
            size: note.size,
            // _deleted: obj._deleted,
            _rev: meta._rev,
            _conflicts: meta._conflicts,
            children: [],
            datatype: "newnote",
            deleted,
            type: "newnote",
            eden: "eden" in meta ? meta.eden : {}
          };
          if (dump) {
            Logger(`--Old fashioned document--`);
            Logger(doc);
          }
          return doc;
        }
        if (meta.type == "newnote" || meta.type == "plain") {
          if (dump) {
            const conflicts = await this.localDatabase.get(meta._id, {
              rev: meta._rev,
              conflicts: true,
              revs_info: true
            });
            Logger("-- Conflicts --");
            Logger((_c2 = conflicts._conflicts) != null ? _c2 : "No conflicts");
            Logger("-- Revs info -- ");
            Logger(conflicts._revs_info);
          }
          try {
            if (dump) {
              Logger(`--Bare document--`);
              Logger(meta);
            }
            let edenChunks = {};
            if (meta.eden && Object.keys(meta.eden).length > 0) {
              const chunks2 = Object.entries(meta.eden).map(([id, data]) => ({
                _id: id,
                data: data.data,
                type: "leaf"
              }));
              edenChunks = Object.fromEntries(chunks2.map((e2) => [e2._id, e2]));
            }
            const isChunksCorrectedIncrementally = this.settings.remoteType !== RemoteTypes.REMOTE_MINIO;
            const isNetworkEnabled = this.isOnDemandChunkEnabled && this.settings.remoteType !== RemoteTypes.REMOTE_MINIO;
            const childrenKeys = [...meta.children];
            const timeout = waitForReady ? isChunksCorrectedIncrementally ? calculateChunkTimeout(childrenKeys.length) : LEAF_WAIT_TIMEOUT_SEQUENTIAL_REPLICATOR : isNetworkEnabled ? LEAF_WAIT_ONLY_REMOTE : 0;
            const chunks = await this.chunkManager.read(
              childrenKeys,
              {
                skipCache: false,
                timeout,
                preventRemoteRequest: !isNetworkEnabled
              },
              edenChunks
            );
            if (chunks.some((e2) => e2 === false)) {
              const failedIndices = chunks.map((e2, i) => e2 === false ? i : -1).filter((i) => i >= 0);
              const failedChunkIds = failedIndices.map((i) => childrenKeys[i]);
              console.error(`[Friday Sync] Failed to load chunks for ${dispFilename}:`, {
                failedChunkIds,
                totalChunks: childrenKeys.length,
                failedCount: failedIndices.length,
                docId: meta._id,
                docPath: meta.path
              });
              throw new Error(`Load failed: ${failedIndices.length}/${childrenKeys.length} chunks missing`);
            }
            const doc = {
              data: chunks.map((e2) => e2.data),
              path: meta.path,
              _id: meta._id,
              ctime: meta.ctime,
              mtime: meta.mtime,
              size: meta.size,
              _rev: meta._rev,
              children: meta.children,
              datatype: meta.type,
              _conflicts: meta._conflicts,
              eden: meta.eden,
              deleted,
              type: meta.type
            };
            if (dump) {
              Logger(`--Loaded Document--`);
              Logger(doc);
            }
            return doc;
          } catch (ex) {
            if (isErrorOfMissingDoc(ex)) {
              console.error(`[Friday Sync] Missing document content for ${dispFilename}:`, {
                docId: meta._id,
                docPath: meta.path,
                childrenCount: (_e = (_d = meta.children) == null ? void 0 : _d.length) != null ? _e : 0
              });
              Logger(
                `Missing document content for ${dispFilename}`,
                LOG_LEVEL_VERBOSE
              );
              return false;
            }
            console.error(`[Friday Sync] Error reading ${dispFilename} from database:`, {
              error: ex,
              errorMessage: ex instanceof Error ? ex.message : String(ex),
              docId: meta._id,
              docPath: meta.path
            });
            Logger(
              `Something went wrong on reading ${dispFilename} from database`,
              LOG_LEVEL_VERBOSE
            );
            Logger(ex, LOG_LEVEL_VERBOSE);
          }
        }
        return false;
      }
      async deleteDBEntry(path8, opt) {
        var _a6;
        if (!this.isTargetFile(path8)) {
          return false;
        }
        const id = await this.path2id(path8);
        try {
          return (_a6 = await serialized("file:" + path8, async () => {
            let obj = null;
            if (opt) {
              obj = await this.localDatabase.get(id, opt);
            } else {
              obj = await this.localDatabase.get(id);
            }
            const revDeletion = opt && ("rev" in opt ? opt.rev : "") != "";
            if (obj.type && obj.type == "leaf") {
              return false;
            }
            if (!obj.type || obj.type && obj.type == "notes") {
              obj._deleted = true;
              const r = await this.localDatabase.put(obj, { force: !revDeletion });
              Logger(`Entry removed:${path8} (${obj._id.substring(0, 8)}-${r.rev})`);
              return true;
            }
            if (obj.type == "newnote" || obj.type == "plain") {
              if (revDeletion) {
                obj._deleted = true;
              } else {
                obj.deleted = true;
                obj.mtime = Date.now();
                if (this.settings.deleteMetadataOfDeletedFiles) {
                  obj._deleted = true;
                }
              }
              const r = await this.localDatabase.put(obj, { force: !revDeletion });
              Logger(`Entry removed:${path8} (${obj._id.substring(0, 8)}-${r.rev})`);
              return true;
            } else {
              return false;
            }
          })) != null ? _a6 : false;
        } catch (ex) {
          if (isErrorOfMissingDoc(ex)) {
            return false;
          }
          throw ex;
        }
      }
      async putDBEntry(note, onlyChunks) {
        const filename = this.id2path(note._id, note);
        const dispFilename = stripAllPrefixes(filename);
        if (!note.eden) note.eden = {};
        if (!this.isTargetFile(filename)) {
          Logger(`File skipped:${dispFilename}`, LOG_LEVEL_VERBOSE);
          return false;
        }
        const data = note.data instanceof Blob ? note.data : createTextBlob(note.data);
        note.data = data;
        note.type = isTextBlob(data) ? "plain" : "newnote";
        note.datatype = note.type;
        await this.splitter.initialised;
        const result = await this.chunkManager.transaction(async () => {
          var _a6;
          let bufferedChunk = [];
          let bufferedSize = 0;
          let writeCount = 0;
          let newCount = 0;
          let cachedCount = 0;
          let resultCachedCount = 0;
          let duplicatedCount = 0;
          let totalWritingCount = 0;
          let createChunkCount = 0;
          const MAX_WRITE_SIZE = 1e3 * 1024 * 2;
          const chunks = [];
          let writeChars = 0;
          const flushBufferedChunks = async () => {
            if (bufferedChunk.length === 0) {
              Logger(`No chunks to flush for ${dispFilename}`, LOG_LEVEL_VERBOSE);
              return true;
            }
            const writeBuf = [...bufferedChunk];
            bufferedSize = 0;
            bufferedChunk = [];
            const result2 = await this.chunkManager.write(
              writeBuf,
              {
                skipCache: false,
                timeout: 0
              },
              note._id
            );
            if (result2.result === false) {
              Logger(`Failed to write data for ${dispFilename}`, LOG_LEVEL_VERBOSE);
              return false;
            }
            totalWritingCount++;
            writeCount += result2.processed.written;
            resultCachedCount += result2.processed.cached;
            duplicatedCount += result2.processed.duplicated;
            writeChars += writeBuf.map((e2) => e2.data.length).reduce((a, b) => a + b, 0);
            Logger(`Flushed ${writeBuf.length} (${writeChars}) chunks for ${dispFilename}`, LOG_LEVEL_VERBOSE);
            return true;
          };
          const flushIfNeeded = async () => {
            if (bufferedSize > MAX_WRITE_SIZE) {
              if (!await flushBufferedChunks()) {
                Logger(`Failed to flush data for ${dispFilename}`, LOG_LEVEL_VERBOSE);
                return false;
              }
            }
            return true;
          };
          const addBuffer = async (id, data2) => {
            const chunk = {
              _id: id,
              data: data2,
              type: "leaf"
            };
            bufferedChunk.push(chunk);
            chunks.push(chunk._id);
            bufferedSize += chunk.data.length;
            return await flushIfNeeded();
          };
          const pieces = await this.splitter.splitContent(note);
          let totalChunkCount = 0;
          try {
            for await (const piece of pieces) {
              totalChunkCount++;
              if (piece.length === 0) {
                continue;
              }
              createChunkCount++;
              const chunk = await this.prepareChunk(piece);
              cachedCount += chunk.isNew ? 0 : 1;
              newCount += chunk.isNew ? 1 : 0;
              if (!await addBuffer(chunk.id, chunk.piece)) {
                return false;
              }
            }
          } catch (ex) {
            Logger(`Error processing pieces for ${dispFilename}`);
            Logger(ex, LOG_LEVEL_VERBOSE);
            return false;
          }
          if (!await flushBufferedChunks()) {
            return false;
          }
          const dataSize = note.data.size;
          const stats = `(\u2728: ${newCount}, \u{1F5C3}\uFE0F: ${cachedCount} (${resultCachedCount}) / \u{1F5C4}\uFE0F: ${writeCount}, \u267B:${duplicatedCount})`;
          Logger(
            `Chunks processed for ${dispFilename} (${dataSize}): \u{1F4DA}:${totalChunkCount} (${createChunkCount}) , \u{1F4E5}:${totalWritingCount} ${stats}`,
            LOG_LEVEL_VERBOSE
          );
          if (dataSize > 0 && totalWritingCount === 0) {
            Logger(
              `Warning: Document ${dispFilename} appears to be corrupted. Please report this issue.`,
              LOG_LEVEL_NOTICE
            );
          }
          if (onlyChunks) {
            return {
              id: note._id,
              ok: true,
              rev: "dummy"
            };
          }
          const newDoc = {
            children: chunks,
            _id: note._id,
            path: note.path,
            ctime: note.ctime,
            mtime: note.mtime,
            size: note.size,
            type: note.datatype,
            eden: {}
          };
          return (_a6 = await serialized("file:" + filename, async () => {
            try {
              const old = await this.localDatabase.get(newDoc._id);
              newDoc._rev = old._rev;
            } catch (ex) {
              if (isErrorOfMissingDoc(ex)) {
              } else {
                throw ex;
              }
            }
            const r = await this.localDatabase.put(newDoc, { force: true });
            if (r.ok) {
              return r;
            } else {
              return false;
            }
          })) != null ? _a6 : false;
        });
        if (result === false) {
          Logger(`Failed to save ${dispFilename}`, LOG_LEVEL_VERBOSE);
          return false;
        }
        Logger(`Document saved: ${dispFilename} (${result.id.substring(0, 8)}-${result.rev})`, LOG_LEVEL_VERBOSE);
        return result;
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/hash/purejs.js
function mixedHash(str, seed, fnv1aHash_ = epochFNV1a) {
  let h1 = seed;
  let fnv1aHash = fnv1aHash_;
  const len = str.length;
  for (let i = 0; i < len; i++) {
    let k1 = str.charCodeAt(i);
    fnv1aHash ^= k1;
    fnv1aHash = Math.imul(fnv1aHash, 16777619) >>> 0;
    k1 *= c1;
    k1 = k1 << r1 | k1 >>> 32 - r1;
    k1 *= c2;
    h1 ^= k1;
    h1 = h1 << r2 | h1 >>> 32 - r2;
    h1 = h1 * m + n2;
  }
  h1 ^= len;
  h1 ^= h1 >>> 16;
  h1 = Math.imul(h1, 2246822507);
  h1 ^= h1 >>> 13;
  h1 = Math.imul(h1, 3266489909);
  h1 ^= h1 >>> 16;
  return [h1 >>> 0, fnv1aHash];
}
function fallbackMixedHashEach(src) {
  let m2 = 1;
  let f3 = epochFNV1a;
  [m2, f3] = mixedHash(`${src.length}${src}`, m2, f3);
  return `${m2.toString(36)}${f3.toString(36)}`;
}
async function sha1(src) {
  const bytes = writeString(src);
  const digest = await globalThis.crypto.subtle.digest({ name: "SHA-1" }, bytes);
  return await arrayBufferToBase64Single(digest);
}
var epochFNV1a, c1, c2, r1, r2, m, n2, te2;
var init_purejs = __esm({
  "node_modules/octagonal-wheels/dist/hash/purejs.js"() {
    init_base64();
    init_encodedUTF16();
    init_hex();
    epochFNV1a = 2166136261 >>> 0;
    c1 = 3432918353;
    c2 = 461845907;
    r1 = 15;
    r2 = 13;
    m = 5;
    n2 = 3864292196;
    te2 = new TextEncoder();
  }
});

// src/sync/core/managers/HashManager/HashManagerCore.ts
var HashEncryptedPrefix, HashManagerCore;
var init_HashManagerCore = __esm({
  "src/sync/core/managers/HashManager/HashManagerCore.ts"() {
    "use strict";
    init_purejs();
    init_types();
    HashEncryptedPrefix = "+";
    HashManagerCore = class {
      /**
       * Constructs a new {@link HashManagerCore} instance.
       *
       * @param options - Configuration options for hash management.
       */
      constructor(options) {
        /**
         * Indicates whether encryption is enabled for hash computation.
         */
        this.useEncryption = false;
        /**
         * Hashed passphrase as a string, used for hash operations.
         */
        this.hashedPassphrase = "";
        /**
         * Hashed passphrase as a 32-bit number, used for hash operations.
         */
        this.hashedPassphrase32 = 0;
        this.options = options;
        this.settings = options.settings;
        this.applyOptions(options);
      }
      /**
       * Applies the given options to the hash manager.
       *
       * Updates encryption settings and computes passphrase hashes.
       *
       * @param options - Optional configuration to apply.
       */
      applyOptions(options) {
        var _a6;
        if (options) {
          this.options = options;
        }
        this.settings = this.options.settings;
        this.useEncryption = (_a6 = this.settings.encrypt) != null ? _a6 : false;
        const passphrase = this.settings.passphrase || "";
        const usingLetters = ~~(passphrase.length / 4 * 3);
        const passphraseForHash = SALT_OF_ID + passphrase.substring(0, usingLetters);
        this.hashedPassphrase = fallbackMixedHashEach(passphraseForHash);
        this.hashedPassphrase32 = mixedHash(passphraseForHash, SEED_MURMURHASH)[0];
      }
      /**
       * Ensures the hash manager is initialised.
       *
       * Returns a promise that resolves when initialisation is complete.
       *
       * @returns Promise resolving to true if initialisation succeeds.
       */
      initialise() {
        if (this.initialiseTask) {
          return this.initialiseTask;
        }
        this.initialiseTask = this.processInitialise();
        return this.initialiseTask;
      }
      /**
       * Computes a hash for the given string.
       *
       * If encryption is enabled, the hash is computed with encryption and prefixed.
       * Otherwise, a plain hash is computed.
       *
       * @param piece - The input string to hash.
       * @returns Promise resolving to the computed hash string.
       */
      async computeHash(piece) {
        await this.initialiseTask;
        if (this.useEncryption) {
          return HashEncryptedPrefix + await this.computeHashWithEncryption(piece);
        }
        return await this.computeHashWithoutEncryption(piece);
      }
      /**
       * Determines whether the hash manager is available for the specified algorithm.
       *
       * Subclasses should override this method to indicate supported algorithms.
       *
       * @param hashAlg - The hash algorithm to check.
       * @returns True if available, false otherwise.
       */
      static isAvailableFor(hashAlg) {
        return false;
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/patched_xxhash_wasm/xxhash-wasm.js
async function e() {
  const { instance: { exports: { mem: e2, xxh32: n3, xxh64: r, init32: i, update32: o, digest32: h2, init64: s, update64: u, digest64: g } } } = await WebAssembly.instantiate(t);
  let a = new Uint8Array(e2.buffer);
  function c(t2, n4) {
    if (e2.buffer.byteLength < t2 + n4) {
      const r3 = Math.ceil((t2 + n4 - e2.buffer.byteLength) / 65536);
      e2.grow(r3), a = new Uint8Array(e2.buffer);
    }
  }
  function l(t2, e3, n4, r3, i2, o2) {
    c(t2);
    const h3 = new Uint8Array(t2);
    return a.set(h3), n4(0, e3), h3.set(a.slice(0, t2)), { update(e4) {
      let n5;
      return a.set(h3), "string" == typeof e4 ? (c(3 * e4.length, t2), n5 = b.encodeInto(e4, a.subarray(t2)).written) : (c(e4.byteLength, t2), a.set(e4, t2), n5 = e4.byteLength), r3(0, t2, n5), h3.set(a.slice(0, t2)), this;
    }, digest: () => (a.set(h3), o2(i2(0))) };
  }
  function d(t2) {
    return t2 >>> 0;
  }
  const f3 = BigInt(2) ** BigInt(64) - BigInt(1);
  function y(t2) {
    return t2 & f3;
  }
  const b = new TextEncoder(), w2 = BigInt(0);
  function p(t2) {
    let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
    return c(3 * t2.length, 0), d(n3(0, b.encodeInto(t2, a).written, e3));
  }
  function v(t2) {
    let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : w2;
    return c(3 * t2.length, 0), y(r(0, b.encodeInto(t2, a).written, e3));
  }
  return { h32: p, h32ToString(t2) {
    return p(t2, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0).toString(16).padStart(8, "0");
  }, h32Raw(t2) {
    let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
    return c(t2.byteLength, 0), a.set(t2), d(n3(0, t2.byteLength, e3));
  }, create32() {
    return l(48, arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, i, o, h2, d);
  }, h64: v, h64ToString(t2) {
    return v(t2, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : w2).toString(16).padStart(16, "0");
  }, h64Raw(t2) {
    let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : w2;
    return c(t2.byteLength, 0), a.set(t2), y(r(0, t2.byteLength, e3));
  }, create64() {
    return l(88, arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : w2, s, u, g, y);
  } };
}
var t;
var init_xxhash_wasm = __esm({
  "node_modules/octagonal-wheels/dist/patched_xxhash_wasm/xxhash-wasm.js"() {
    t = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 48, 8, 96, 3, 127, 127, 127, 0, 96, 3, 127, 127, 127, 1, 127, 96, 2, 127, 127, 0, 96, 2, 127, 126, 0, 96, 1, 127, 1, 127, 96, 1, 127, 1, 126, 96, 3, 127, 127, 126, 1, 126, 96, 3, 126, 127, 127, 1, 126, 3, 11, 10, 1, 1, 2, 0, 4, 6, 7, 3, 0, 5, 5, 3, 1, 0, 1, 7, 85, 9, 3, 109, 101, 109, 2, 0, 5, 120, 120, 104, 51, 50, 0, 0, 6, 105, 110, 105, 116, 51, 50, 0, 2, 8, 117, 112, 100, 97, 116, 101, 51, 50, 0, 3, 8, 100, 105, 103, 101, 115, 116, 51, 50, 0, 4, 5, 120, 120, 104, 54, 52, 0, 5, 6, 105, 110, 105, 116, 54, 52, 0, 7, 8, 117, 112, 100, 97, 116, 101, 54, 52, 0, 8, 8, 100, 105, 103, 101, 115, 116, 54, 52, 0, 9, 10, 211, 23, 10, 242, 1, 1, 4, 127, 32, 0, 32, 1, 106, 33, 3, 32, 1, 65, 16, 79, 4, 127, 32, 3, 65, 16, 107, 33, 6, 32, 2, 65, 168, 136, 141, 161, 2, 106, 33, 3, 32, 2, 65, 247, 148, 175, 175, 120, 106, 33, 4, 32, 2, 65, 177, 243, 221, 241, 121, 107, 33, 5, 3, 64, 32, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 3, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 3, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 4, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 2, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 2, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 5, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 5, 32, 0, 65, 4, 106, 34, 0, 32, 6, 77, 13, 0, 11, 32, 2, 65, 12, 119, 32, 5, 65, 18, 119, 106, 32, 4, 65, 7, 119, 106, 32, 3, 65, 1, 119, 106, 5, 32, 2, 65, 177, 207, 217, 178, 1, 106, 11, 32, 1, 106, 32, 0, 32, 1, 65, 15, 113, 16, 1, 11, 146, 1, 0, 32, 1, 32, 2, 106, 33, 2, 3, 64, 32, 1, 65, 4, 106, 32, 2, 75, 69, 4, 64, 32, 1, 40, 2, 0, 65, 189, 220, 202, 149, 124, 108, 32, 0, 106, 65, 17, 119, 65, 175, 214, 211, 190, 2, 108, 33, 0, 32, 1, 65, 4, 106, 33, 1, 12, 1, 11, 11, 3, 64, 32, 1, 32, 2, 79, 69, 4, 64, 32, 1, 45, 0, 0, 65, 177, 207, 217, 178, 1, 108, 32, 0, 106, 65, 11, 119, 65, 177, 243, 221, 241, 121, 108, 33, 0, 32, 1, 65, 1, 106, 33, 1, 12, 1, 11, 11, 32, 0, 65, 15, 118, 32, 0, 115, 65, 247, 148, 175, 175, 120, 108, 34, 0, 32, 0, 65, 13, 118, 115, 65, 189, 220, 202, 149, 124, 108, 34, 0, 32, 0, 65, 16, 118, 115, 11, 63, 0, 32, 0, 65, 8, 106, 32, 1, 65, 168, 136, 141, 161, 2, 106, 54, 2, 0, 32, 0, 65, 12, 106, 32, 1, 65, 247, 148, 175, 175, 120, 106, 54, 2, 0, 32, 0, 65, 16, 106, 32, 1, 54, 2, 0, 32, 0, 65, 20, 106, 32, 1, 65, 177, 243, 221, 241, 121, 107, 54, 2, 0, 11, 211, 4, 1, 6, 127, 32, 1, 32, 2, 106, 33, 6, 32, 0, 65, 24, 106, 33, 5, 32, 0, 65, 40, 106, 40, 2, 0, 33, 3, 32, 0, 32, 0, 40, 2, 0, 32, 2, 106, 54, 2, 0, 32, 0, 65, 4, 106, 34, 4, 32, 4, 40, 2, 0, 32, 2, 65, 16, 79, 32, 0, 40, 2, 0, 65, 16, 79, 114, 114, 54, 2, 0, 32, 2, 32, 3, 106, 65, 16, 73, 4, 64, 32, 3, 32, 5, 106, 32, 1, 32, 2, 252, 10, 0, 0, 32, 0, 65, 40, 106, 32, 2, 32, 3, 106, 54, 2, 0, 15, 11, 32, 3, 4, 64, 32, 3, 32, 5, 106, 32, 1, 65, 16, 32, 3, 107, 34, 2, 252, 10, 0, 0, 32, 0, 65, 8, 106, 34, 3, 40, 2, 0, 32, 5, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 3, 32, 4, 54, 2, 0, 32, 0, 65, 12, 106, 34, 3, 40, 2, 0, 32, 5, 65, 4, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 3, 32, 4, 54, 2, 0, 32, 0, 65, 16, 106, 34, 3, 40, 2, 0, 32, 5, 65, 8, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 3, 32, 4, 54, 2, 0, 32, 0, 65, 20, 106, 34, 3, 40, 2, 0, 32, 5, 65, 12, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 3, 32, 4, 54, 2, 0, 32, 0, 65, 40, 106, 65, 0, 54, 2, 0, 32, 1, 32, 2, 106, 33, 1, 11, 32, 1, 32, 6, 65, 16, 107, 77, 4, 64, 32, 6, 65, 16, 107, 33, 8, 32, 0, 65, 8, 106, 40, 2, 0, 33, 2, 32, 0, 65, 12, 106, 40, 2, 0, 33, 3, 32, 0, 65, 16, 106, 40, 2, 0, 33, 4, 32, 0, 65, 20, 106, 40, 2, 0, 33, 7, 3, 64, 32, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 2, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 2, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 3, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 3, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 4, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 32, 7, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 7, 32, 1, 65, 4, 106, 34, 1, 32, 8, 77, 13, 0, 11, 32, 0, 65, 8, 106, 32, 2, 54, 2, 0, 32, 0, 65, 12, 106, 32, 3, 54, 2, 0, 32, 0, 65, 16, 106, 32, 4, 54, 2, 0, 32, 0, 65, 20, 106, 32, 7, 54, 2, 0, 11, 32, 1, 32, 6, 73, 4, 64, 32, 5, 32, 1, 32, 6, 32, 1, 107, 34, 1, 252, 10, 0, 0, 32, 0, 65, 40, 106, 32, 1, 54, 2, 0, 11, 11, 97, 1, 1, 127, 32, 0, 65, 16, 106, 40, 2, 0, 33, 1, 32, 0, 65, 4, 106, 40, 2, 0, 4, 127, 32, 1, 65, 12, 119, 32, 0, 65, 20, 106, 40, 2, 0, 65, 18, 119, 106, 32, 0, 65, 12, 106, 40, 2, 0, 65, 7, 119, 106, 32, 0, 65, 8, 106, 40, 2, 0, 65, 1, 119, 106, 5, 32, 1, 65, 177, 207, 217, 178, 1, 106, 11, 32, 0, 40, 2, 0, 106, 32, 0, 65, 24, 106, 32, 0, 65, 40, 106, 40, 2, 0, 16, 1, 11, 157, 4, 2, 1, 127, 3, 126, 32, 0, 32, 1, 106, 33, 3, 32, 1, 65, 32, 79, 4, 126, 32, 3, 65, 32, 107, 33, 3, 32, 2, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 124, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 124, 33, 4, 32, 2, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 124, 33, 5, 32, 2, 66, 0, 124, 33, 6, 32, 2, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 125, 33, 2, 3, 64, 32, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 4, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 4, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 5, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 5, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 6, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 2, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 2, 32, 0, 65, 8, 106, 34, 0, 32, 3, 77, 13, 0, 11, 32, 6, 66, 12, 137, 32, 2, 66, 18, 137, 124, 32, 5, 66, 7, 137, 124, 32, 4, 66, 1, 137, 124, 32, 4, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 5, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 6, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 2, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 5, 32, 2, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 124, 11, 32, 1, 173, 124, 32, 0, 32, 1, 65, 31, 113, 16, 6, 11, 137, 2, 0, 32, 1, 32, 2, 106, 33, 2, 3, 64, 32, 1, 65, 8, 106, 32, 2, 77, 4, 64, 32, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 32, 0, 133, 66, 27, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 33, 0, 32, 1, 65, 8, 106, 33, 1, 12, 1, 11, 11, 32, 1, 65, 4, 106, 32, 2, 77, 4, 64, 32, 1, 53, 2, 0, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 32, 0, 133, 66, 23, 137, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 249, 243, 221, 241, 153, 246, 153, 171, 22, 124, 33, 0, 32, 1, 65, 4, 106, 33, 1, 11, 3, 64, 32, 1, 32, 2, 73, 4, 64, 32, 1, 49, 0, 0, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 126, 32, 0, 133, 66, 11, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 0, 32, 1, 65, 1, 106, 33, 1, 12, 1, 11, 11, 32, 0, 66, 33, 136, 32, 0, 133, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 34, 0, 32, 0, 66, 29, 136, 133, 66, 249, 243, 221, 241, 153, 246, 153, 171, 22, 126, 34, 0, 32, 0, 66, 32, 136, 133, 11, 88, 0, 32, 0, 65, 8, 106, 32, 1, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 124, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 124, 55, 3, 0, 32, 0, 65, 16, 106, 32, 1, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 124, 55, 3, 0, 32, 0, 65, 24, 106, 32, 1, 55, 3, 0, 32, 0, 65, 32, 106, 32, 1, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 125, 55, 3, 0, 11, 132, 5, 2, 3, 127, 4, 126, 32, 1, 32, 2, 106, 33, 5, 32, 0, 65, 40, 106, 33, 4, 32, 0, 65, 200, 0, 106, 40, 2, 0, 33, 3, 32, 0, 32, 0, 41, 3, 0, 32, 2, 173, 124, 55, 3, 0, 32, 2, 32, 3, 106, 65, 32, 73, 4, 64, 32, 3, 32, 4, 106, 32, 1, 32, 2, 252, 10, 0, 0, 32, 0, 65, 200, 0, 106, 32, 2, 32, 3, 106, 54, 2, 0, 15, 11, 32, 3, 4, 64, 32, 3, 32, 4, 106, 32, 1, 65, 32, 32, 3, 107, 34, 2, 252, 10, 0, 0, 32, 0, 65, 8, 106, 34, 3, 41, 3, 0, 32, 4, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 3, 32, 6, 55, 3, 0, 32, 0, 65, 16, 106, 34, 3, 41, 3, 0, 32, 4, 65, 8, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 3, 32, 6, 55, 3, 0, 32, 0, 65, 24, 106, 34, 3, 41, 3, 0, 32, 4, 65, 16, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 3, 32, 6, 55, 3, 0, 32, 0, 65, 32, 106, 34, 3, 41, 3, 0, 32, 4, 65, 24, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 3, 32, 6, 55, 3, 0, 32, 0, 65, 200, 0, 106, 65, 0, 54, 2, 0, 32, 1, 32, 2, 106, 33, 1, 11, 32, 1, 65, 32, 106, 32, 5, 77, 4, 64, 32, 5, 65, 32, 107, 33, 2, 32, 0, 65, 8, 106, 41, 3, 0, 33, 6, 32, 0, 65, 16, 106, 41, 3, 0, 33, 7, 32, 0, 65, 24, 106, 41, 3, 0, 33, 8, 32, 0, 65, 32, 106, 41, 3, 0, 33, 9, 3, 64, 32, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 6, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 7, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 7, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 8, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 8, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 32, 9, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 9, 32, 1, 65, 8, 106, 34, 1, 32, 2, 77, 13, 0, 11, 32, 0, 65, 8, 106, 32, 6, 55, 3, 0, 32, 0, 65, 16, 106, 32, 7, 55, 3, 0, 32, 0, 65, 24, 106, 32, 8, 55, 3, 0, 32, 0, 65, 32, 106, 32, 9, 55, 3, 0, 11, 32, 1, 32, 5, 73, 4, 64, 32, 4, 32, 1, 32, 5, 32, 1, 107, 34, 1, 252, 10, 0, 0, 32, 0, 65, 200, 0, 106, 32, 1, 54, 2, 0, 11, 11, 200, 2, 1, 5, 126, 32, 0, 65, 24, 106, 41, 3, 0, 33, 1, 32, 0, 41, 3, 0, 34, 2, 66, 32, 90, 4, 126, 32, 0, 65, 8, 106, 41, 3, 0, 34, 3, 66, 1, 137, 32, 0, 65, 16, 106, 41, 3, 0, 34, 4, 66, 7, 137, 124, 32, 1, 66, 12, 137, 32, 0, 65, 32, 106, 41, 3, 0, 34, 5, 66, 18, 137, 124, 124, 32, 3, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 4, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 1, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 32, 5, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 0, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 227, 220, 202, 149, 252, 206, 242, 245, 133, 127, 124, 5, 32, 1, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 124, 11, 32, 2, 124, 32, 0, 65, 40, 106, 32, 2, 66, 31, 131, 167, 16, 6, 11]);
  }
});

// node_modules/octagonal-wheels/dist/hash/xxhash.js
async function initHashFunc() {
  try {
    const { h32ToString } = await e();
    hashFunc = h32ToString;
    Logger(`xxhash for plugin initialised`, LOG_LEVEL_VERBOSE);
  } catch (ex) {
    Logger(`Could not initialise xxhash. fallback...`, LOG_LEVEL_VERBOSE);
    Logger(ex);
    hashFunc = (str) => fallbackMixedHashEach(str);
  }
  return hashFunc;
}
var hashFunc;
var init_xxhash = __esm({
  "node_modules/octagonal-wheels/dist/hash/xxhash.js"() {
    init_xxhash_wasm();
    init_logger();
    init_purejs();
    hashFunc = (str) => fallbackMixedHashEach(str);
    void initHashFunc();
  }
});

// src/sync/core/string_and_binary/hash.ts
var init_hash = __esm({
  "src/sync/core/string_and_binary/hash.ts"() {
    "use strict";
    init_xxhash();
  }
});

// src/sync/core/managers/HashManager/XXHashHashManager.ts
var XXHashHashManager, XXHash32RawHashManager, XXHash64HashManager, FallbackWasmHashManager;
var init_XXHashHashManager = __esm({
  "src/sync/core/managers/HashManager/XXHashHashManager.ts"() {
    "use strict";
    init_HashManagerCore();
    init_hash();
    init_types();
    XXHashHashManager = class extends HashManagerCore {
      /**
       * Constructs a new XXHashHashManager.
       * @param options - Options for the hash manager core.
       */
      constructor(options) {
        super(options);
      }
      /**
       * Initialises the XXHash API instance.
       * @returns A promise resolving to true when initialisation is complete.
       */
      async processInitialise() {
        this.xxhash = await e();
        return true;
      }
    };
    XXHash32RawHashManager = class extends XXHashHashManager {
      /**
       * Determines whether this manager is available for the specified algorithm.
       * @param hashAlg - The hash algorithm to check.
       * @returns True if available, false otherwise.
       */
      static isAvailableFor(hashAlg) {
        return hashAlg === HashAlgorithms.LEGACY;
      }
      /**
       * Computes a hash for the given piece using encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithEncryption(piece) {
        return Promise.resolve(
          (this.xxhash.h32Raw(new TextEncoder().encode(piece)) ^ this.hashedPassphrase32 ^ piece.length).toString(36)
        );
      }
      /**
       * Computes a hash for the given piece without encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithoutEncryption(piece) {
        return Promise.resolve((this.xxhash.h32Raw(new TextEncoder().encode(piece)) ^ piece.length).toString(36));
      }
    };
    XXHash64HashManager = class extends XXHashHashManager {
      /**
       * Determines whether this manager is available for the specified algorithm.
       * @param hashAlg - The hash algorithm to check.
       * @returns True if available, false otherwise.
       */
      static isAvailableFor(hashAlg) {
        return hashAlg === HashAlgorithms.XXHASH64;
      }
      /**
       * Computes a hash for the given piece using encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithEncryption(piece) {
        return Promise.resolve(this.xxhash.h64(`${piece}-${this.hashedPassphrase}-${piece.length}`).toString(36));
      }
      /**
       * Computes a hash for the given piece without encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithoutEncryption(piece) {
        return Promise.resolve(this.xxhash.h64(`${piece}-${piece.length}`).toString(36));
      }
    };
    FallbackWasmHashManager = class extends XXHashHashManager {
      /**
       * Determines whether this manager is available for the specified algorithm.
       * Always returns true as a fallback.
       * @param hashAlg - The hash algorithm to check.
       * @returns True.
       */
      static isAvailableFor(hashAlg) {
        return true;
      }
      /**
       * Computes a hash for the given piece using encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithEncryption(piece) {
        return Promise.resolve(this.xxhash.h32(`${piece}-${this.hashedPassphrase}-${piece.length}`).toString(36));
      }
      /**
       * Computes a hash for the given piece without encryption.
       * @param piece - The input string to hash.
       * @returns A promise resolving to the hash string.
       */
      computeHashWithoutEncryption(piece) {
        return Promise.resolve(this.xxhash.h32(`${piece}-${piece.length}`).toString(36));
      }
    };
  }
});

// src/sync/core/managers/HashManager/PureJSHashManager.ts
var PureJSHashManager, SHA1HashManager, FallbackPureJSHashManager;
var init_PureJSHashManager = __esm({
  "src/sync/core/managers/HashManager/PureJSHashManager.ts"() {
    "use strict";
    init_types();
    init_HashManagerCore();
    init_purejs();
    PureJSHashManager = class extends HashManagerCore {
      /**
       * Determines whether this manager is available for the specified algorithm.
       * @param hashAlg The hash algorithm to check.
       * @returns True if the algorithm is "mixed-purejs".
       */
      static isAvailableFor(hashAlg) {
        return hashAlg === HashAlgorithms.MIXED_PUREJS;
      }
      /**
       * Initialises the hash manager.
       * @returns Always resolves to true.
       */
      processInitialise() {
        return Promise.resolve(true);
      }
      /**
       * Computes a hash for the given input, including encryption.
       * @param input The input string to hash.
       * @returns The computed hash as a promise.
       */
      computeHashWithEncryption(input) {
        return Promise.resolve(fallbackMixedHashEach(`${input}${this.hashedPassphrase}${input.length}`));
      }
      /**
       * Computes a hash for the given input, without encryption.
       * @param input The input string to hash.
       * @returns The computed hash as a promise.
       */
      computeHashWithoutEncryption(input) {
        return Promise.resolve(fallbackMixedHashEach(`${input}-${input.length}`));
      }
    };
    SHA1HashManager = class extends HashManagerCore {
      /**
       * Determines whether this manager is available for the specified algorithm.
       * @param hashAlg The hash algorithm to check.
       * @returns True if the algorithm is "sha1".
       */
      static isAvailableFor(hashAlg) {
        return hashAlg === HashAlgorithms.SHA1;
      }
      /**
       * Initialises the hash manager.
       * @returns Always resolves to true.
       */
      processInitialise() {
        return Promise.resolve(true);
      }
      /**
       * Computes a SHA-1 hash for the given input, including encryption.
       * @param input The input string to hash.
       * @returns The computed SHA-1 hash as a promise.
       */
      computeHashWithEncryption(input) {
        return sha1(`${input}-${this.hashedPassphrase}-${input.length}`);
      }
      /**
       * Computes a SHA-1 hash for the given input, without encryption.
       * @param input The input string to hash.
       * @returns The computed SHA-1 hash as a promise.
       */
      computeHashWithoutEncryption(input) {
        return sha1(`${input}-${input.length}`);
      }
    };
    FallbackPureJSHashManager = class extends PureJSHashManager {
      /**
       * Always returns true, indicating this manager is available for any algorithm.
       * @param _hashAlg The hash algorithm (ignored).
       * @returns True.
       */
      static isAvailableFor(_hashAlg) {
        return true;
      }
    };
  }
});

// src/sync/core/managers/HashManager/HashManager.ts
var HashManagers, HashManager;
var init_HashManager = __esm({
  "src/sync/core/managers/HashManager/HashManager.ts"() {
    "use strict";
    init_types();
    init_XXHashHashManager();
    init_PureJSHashManager();
    init_HashManagerCore();
    init_logger2();
    HashManagers = [
      XXHash64HashManager,
      XXHash32RawHashManager,
      SHA1HashManager,
      PureJSHashManager,
      // Please retain these fallback managers, as they are essential for compatibility.
      FallbackWasmHashManager,
      FallbackPureJSHashManager
    ];
    HashManager = class extends HashManagerCore {
      /**
       * Constructs a new HashManager.
       *
       * @param options Initialisation options
       */
      constructor(options) {
        super(options);
        /**
         * Instance of the hash manager currently in use.
         */
        this.manager = void 0;
      }
      /**
       * Checks whether the specified hash algorithm is available.
       *
       * @param hashAlg The hash algorithm to check
       * @returns True if available
       */
      static isAvailableFor(hashAlg) {
        return HashManagers.some((manager) => manager.isAvailableFor(hashAlg));
      }
      /**
       * Selects and initialises an available hash manager.
       *
       * @returns True if initialisation is successful
       * @throws Throws an error if no available manager exists
       */
      async setManager() {
        for (const Manager of HashManagers) {
          if (Manager.isAvailableFor(this.settings.hashAlg)) {
            this.manager = new Manager(this.options);
            return await this.manager.initialise();
          }
        }
        throw new Error(`HashManager for ${this.settings.hashAlg} is not available`);
      }
      /**
       * Initialises the hash manager.
       *
       * @returns True if initialisation is successful
       * @throws Throws an error if initialisation fails
       */
      async processInitialise() {
        if (await this.setManager()) {
          Logger(`HashManager for ${this.settings.hashAlg} has been initialised`, LOG_LEVEL_VERBOSE);
          return true;
        }
        Logger(`HashManager for ${this.settings.hashAlg} failed to initialise`);
        throw new Error(`HashManager for ${this.settings.hashAlg} failed to initialise`);
      }
      /**
       * Computes the hash value for the specified string.
       *
       * @param piece The string to be hashed
       * @returns The hash value (returned as a Promise)
       */
      computeHash(piece) {
        return this.manager.computeHash(piece);
      }
      /**
       * Computes the hash value without encryption.
       *
       * @param piece The string to be hashed
       * @returns The hash value (returned as a Promise)
       */
      computeHashWithoutEncryption(piece) {
        return this.manager.computeHashWithoutEncryption(piece);
      }
      /**
       * Computes the hash value with encryption.
       *
       * @param piece The string to be hashed
       * @returns The hash value (returned as a Promise)
       */
      computeHashWithEncryption(piece) {
        return this.manager.computeHashWithEncryption(piece);
      }
    };
  }
});

// src/sync/core/managers/NetworkManager.ts
var NetworkManager, NetworkManagerBrowser;
var init_NetworkManager = __esm({
  "src/sync/core/managers/NetworkManager.ts"() {
    "use strict";
    NetworkManager = class {
    };
    NetworkManagerBrowser = class extends NetworkManager {
      constructor() {
        super(...arguments);
        this._statusCallbacks = [];
        this._lastKnownStatus = true;
        this._consecutiveFailures = 0;
        this._serverReachable = null;
      }
      get isOnline() {
        return navigator.onLine;
      }
      /**
       * Get the number of consecutive connection failures
       * Used for exponential backoff calculation
       */
      get consecutiveFailures() {
        return this._consecutiveFailures;
      }
      /**
       * Get server reachability status
       * null = unknown, true = reachable, false = unreachable
       */
      get serverReachable() {
        return this._serverReachable;
      }
      /**
       * Check if we can actually reach the sync server
       * This detects firewall blocking that navigator.onLine misses
       */
      async checkActualConnectivity() {
        var _a6;
        if (!navigator.onLine) {
          this._serverReachable = false;
          return false;
        }
        return (_a6 = this._serverReachable) != null ? _a6 : true;
      }
      /**
       * Set server reachability status
       * Called by replicator after connection attempts
       */
      setServerReachable(reachable) {
        const wasReachable = this._serverReachable;
        this._serverReachable = reachable;
        if (reachable) {
          this._consecutiveFailures = 0;
        } else {
          this._consecutiveFailures++;
        }
        if (wasReachable !== reachable) {
          this._notifyStatusChange(reachable);
        }
      }
      /**
       * Register a callback for status changes
       */
      onStatusChange(callback) {
        this._statusCallbacks.push(callback);
      }
      /**
       * Remove a status change callback
       */
      removeStatusChangeCallback(callback) {
        const index6 = this._statusCallbacks.indexOf(callback);
        if (index6 > -1) {
          this._statusCallbacks.splice(index6, 1);
        }
      }
      /**
       * Notify all registered callbacks about status change
       */
      _notifyStatusChange(online) {
        for (const cb of this._statusCallbacks) {
          try {
            cb(online);
          } catch (e2) {
            console.error("[NetworkManager] Error in status callback:", e2);
          }
        }
      }
      /**
       * Reset failure count (e.g., after manual reconnect)
       */
      resetFailureCount() {
        this._consecutiveFailures = 0;
      }
    };
  }
});

// src/sync/core/managers/LiveSyncManagers.ts
var LiveSyncManagers;
var init_LiveSyncManagers = __esm({
  "src/sync/core/managers/LiveSyncManagers.ts"() {
    "use strict";
    init_LSError();
    init_ContentSplitters();
    init_ChangeManager();
    init_ChunkFetcher();
    init_ChunkManager();
    init_ConflictManager();
    init_EntryManager();
    init_HashManager();
    init_NetworkManager();
    LiveSyncManagers = class {
      constructor(options) {
        this.options = options;
        if (options.networkManager) {
          this.networkManager = options.networkManager;
        } else {
          if ("navigator" in globalThis) {
            this.networkManager = new NetworkManagerBrowser();
          } else {
            throw new LiveSyncError("No NetworkManager available");
          }
        }
      }
      get settings() {
        return this.options.settings;
      }
      async teardownManagers() {
        if (this.changeManager) {
          this.changeManager.teardown();
          this.changeManager = void 0;
        }
        if (this.chunkFetcher) {
          this.chunkFetcher.destroy();
          this.chunkFetcher = void 0;
        }
        if (this.chunkManager) {
          this.chunkManager.destroy();
          this.chunkManager = void 0;
        }
        return await Promise.resolve();
      }
      getProxy() {
        const getDB = () => this.options.database;
        const getChangeManager = () => this.changeManager;
        const getChunkManager = () => this.chunkManager;
        const getReplicator = () => this.options.getActiveReplicator();
        const getSettings = () => this.options.settings;
        const getEntryManager = () => this.entryManager;
        const getHashManager = () => this.hashManager;
        const getChunkFetcher = () => this.chunkFetcher;
        const getSplitter = () => this.splitter;
        const proxy2 = {
          get database() {
            return getDB();
          },
          get changeManager() {
            return getChangeManager();
          },
          get chunkManager() {
            return getChunkManager();
          },
          getActiveReplicator() {
            return getReplicator();
          },
          get settings() {
            return getSettings();
          },
          get entryManager() {
            return getEntryManager();
          },
          get hashManager() {
            return getHashManager();
          },
          $$path2id: (filename, prefix) => {
            return this.options.path2id(filename, prefix);
          },
          $$id2path: (id, entry, stripPrefix) => {
            return this.options.id2path(id, entry, stripPrefix);
          },
          get chunkFetcher() {
            return getChunkFetcher();
          },
          get splitter() {
            return getSplitter();
          }
        };
        return proxy2;
      }
      async initManagers() {
        await this.teardownManagers();
        const proxy2 = this.getProxy();
        this.hashManager = new HashManager({
          ...proxy2
        });
        this.splitter = new ContentSplitter({
          ...proxy2
        });
        await this.splitter.initialise(proxy2);
        await this.hashManager.initialise();
        this.changeManager = new ChangeManager(proxy2);
        this.chunkManager = new ChunkManager({
          ...proxy2,
          maxCacheSize: this.settings.hashCacheMaxCount * 10
        });
        this.chunkFetcher = new ChunkFetcher(proxy2);
        this.entryManager = new EntryManager({
          ...proxy2
        });
        this.conflictManager = new ConflictManager({
          ...proxy2
        });
      }
      clearCaches() {
        var _a6;
        (_a6 = this.chunkManager) == null ? void 0 : _a6.clearCaches();
      }
      async prepareHashFunction() {
        const proxy2 = this.getProxy();
        this.hashManager = new HashManager(proxy2);
        await this.hashManager.initialise();
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/databases/SimpleStoreBase.js
var init_SimpleStoreBase = __esm({
  "node_modules/octagonal-wheels/dist/databases/SimpleStoreBase.js"() {
  }
});

// src/sync/core/services/ServiceHub.ts
var ServiceHub;
var init_ServiceHub = __esm({
  "src/sync/core/services/ServiceHub.ts"() {
    "use strict";
    ServiceHub = class {
      constructor(services = {}) {
        this._injected = {};
        for (const service of Object.values(services)) {
          service.setServices(this);
        }
        this._injected = services;
      }
      get API() {
        return this._injected.API || this._api;
      }
      get path() {
        return this._injected.path || this._path;
      }
      get database() {
        return this._injected.database || this._database;
      }
      get databaseEvents() {
        return this._injected.databaseEvents || this._databaseEvents;
      }
      get replicator() {
        return this._injected.replicator || this._replicator;
      }
      get fileProcessing() {
        return this._injected.fileProcessing || this._fileProcessing;
      }
      get replication() {
        return this._injected.replication || this._replication;
      }
      get remote() {
        return this._injected.remote || this._remote;
      }
      get conflict() {
        return this._injected.conflict || this._conflict;
      }
      get appLifecycle() {
        return this._injected.appLifecycle || this._appLifecycle;
      }
      get setting() {
        return this._injected.setting || this._setting;
      }
      get tweakValue() {
        return this._injected.tweakValue || this._tweakValue;
      }
      get vault() {
        return this._injected.vault || this._vault;
      }
      get test() {
        return this._injected.test || this._test;
      }
      get UI() {
        return this._injected.ui || this._ui;
      }
    };
  }
});

// src/sync/core/services/Services.ts
var HubService, ServiceBase;
var init_Services = __esm({
  "src/sync/core/services/Services.ts"() {
    "use strict";
    init_logger();
    HubService = class {
      get services() {
        return this._services;
      }
      setServices(services) {
        this._services = services;
      }
    };
    ServiceBase = class extends HubService {
      /**
       * Register a handler that returns all results from the listeners.
       * Means ex-`all`
       * @param key The event key to listen to.
       */
      _all(key4) {
        return this._backend.all(key4);
      }
      /**
       * Register a handler that returns the first success (true) from the listeners.
       * Means ex-`any`
       * @param key The event key to listen to.
       * @returns
       */
      _first(key4) {
        return this._backend.first(key4);
      }
      /**
       * Register a handler that returns the first success (true) from the listeners.
       * Means ex-`any` of some sort.
       * @param key The event key to listen to.
       * @returns
       */
      _firstOrUndefined(key4) {
        return this._backend.firstOrUndefined(key4);
      }
      /**
       * Register a handler that returns the first failure (false) from the listeners.
       * Means ex-`every`
       * @param key The event key to listen to.
       * @returns
       */
      _firstFailure(key4) {
        return this._backend.firstFailure(key4);
      }
      /**
       *  Register a handler that broadcasts to all listeners without caring about the result.
       *  Means ex-`all` of some sort.
       * @param key The event key to listen to.
       * @returns
       */
      _broadcast(key4) {
        return this._backend.broadcast(key4);
      }
      /**
       * Register a collector that collects results from all listeners.
       * @param key The event key to listen to.
       * @returns A collector for the specified event key.
       */
      _collect(key4) {
        return this._backend.collect(key4);
      }
      /**
       * Register a batch collector that collects results from all listeners in batches.
       * @param key The event key to listen to.
       * @returns A batch collector for the specified event key.
       */
      _collectBatch(key4) {
        return this._backend.collectBatch(key4);
      }
      constructor(hub) {
        super();
        this._backend = hub;
      }
    };
  }
});

// src/sync/core/services/ServiceBackend.ts
var ChannelBase, Pipeline, Switch, AN_ERROR_OCCURRED, Survey, Broadcaster, ServiceBackend;
var init_ServiceBackend = __esm({
  "src/sync/core/services/ServiceBackend.ts"() {
    "use strict";
    init_logger();
    ChannelBase = class {
      constructor(name) {
        this.name = name;
        this.handlers = [];
        this.handlerNames = /* @__PURE__ */ new Map();
      }
      isAlreadyRegistered(handler) {
        const result = this.handlers.indexOf(handler);
        if (result === -1) {
          return false;
        }
        console.error("Handler already registered at index", result);
        return true;
      }
      getHandlerName(handler) {
        return this.handlerNames.get(handler);
      }
      register(handler, name) {
        if (this.isAlreadyRegistered(handler)) {
          Logger("Handler already registered for " + this.name, LOG_LEVEL_VERBOSE);
          return;
        }
        this.handlers.push(handler);
        this.handlerNames.set(handler, name);
      }
      isSomeHandlerRegistered() {
        const result = this.handlers.length > 0;
        if (!result) {
          console.warn("No handler registered");
        }
        return result;
      }
    };
    Pipeline = class extends ChannelBase {
      constructor(name) {
        super(name);
      }
      register(handler, name) {
        super.register(handler, name);
      }
      async invoke(...args) {
        if (!this.isSomeHandlerRegistered()) {
          Logger("No handler registered for Pipeline " + this.name, LOG_LEVEL_VERBOSE);
          return true;
        }
        for (const handler of this.handlers) {
          const name = this.getHandlerName(handler);
          try {
            const result = await handler(...args);
            if (result === false) {
              Logger(`Handler ${name != null ? name : "unknown"} for Pipeline ${this.name} returned false`, LOG_LEVEL_VERBOSE);
              const err2 = new Error();
              console.error(err2.stack);
              return false;
            }
          } catch (e2) {
            Logger(`Handler ${name != null ? name : "unknown"} Error in Pipeline handler for ${this.name}`);
            Logger(e2, LOG_LEVEL_VERBOSE);
            return false;
          }
        }
        return true;
      }
    };
    Switch = class extends ChannelBase {
      constructor(name) {
        super(name);
      }
      register(handler, name) {
        super.register(handler, name);
      }
      async invoke(...args) {
        if (!this.isSomeHandlerRegistered()) {
          Logger("No handler registered for Switch " + this.name, LOG_LEVEL_VERBOSE);
          return void 0;
        }
        for (const handler of this.handlers) {
          try {
            const result = await handler(...args);
            if (result !== false) {
              return result;
            }
          } catch (e2) {
            Logger("Error in Switch handler for " + this.name);
            Logger(e2, LOG_LEVEL_VERBOSE);
          }
        }
        return void 0;
      }
    };
    AN_ERROR_OCCURRED = Symbol("AN_ERROR_OCCURRED");
    Survey = class extends ChannelBase {
      constructor(name) {
        super(name);
      }
      register(handler, name) {
        super.register(handler, name);
      }
      invoke(...args) {
        if (!this.isSomeHandlerRegistered()) {
          return [];
        }
        return this.handlers.map(async (handler) => {
          try {
            return await handler(...args);
          } catch (e2) {
            Logger("Error in Survey handler for " + this.name);
            Logger(e2, LOG_LEVEL_VERBOSE);
            return AN_ERROR_OCCURRED;
          }
        }).filter((result) => result !== AN_ERROR_OCCURRED);
      }
    };
    Broadcaster = class extends ChannelBase {
      constructor(name) {
        super(name);
      }
      register(handler, name) {
        super.register(handler, name);
      }
      async invoke(...args) {
        if (!this.isSomeHandlerRegistered()) {
          return;
        }
        await Promise.all(
          this.handlers.map(async (handler) => {
            try {
              await handler(...args);
            } catch (e2) {
              Logger("Error in Broadcaster handler for " + this.name);
              Logger(e2, LOG_LEVEL_VERBOSE);
            }
          })
        );
      }
    };
    ServiceBackend = class {
      constructor() {
        this.pipelines = /* @__PURE__ */ new Map();
        this.switches = /* @__PURE__ */ new Map();
        this.surveys = /* @__PURE__ */ new Map();
        this.broadcasters = /* @__PURE__ */ new Map();
      }
      getPipeline(name) {
        if (this.pipelines.has(name)) {
          return this.pipelines.get(name);
        }
        const pipeline = new Pipeline(name);
        this.pipelines.set(name, pipeline);
        return pipeline;
      }
      getSwitch(name) {
        if (this.switches.has(name)) {
          return this.switches.get(name);
        }
        const switchChannel = new Switch(name);
        this.switches.set(name, switchChannel);
        return switchChannel;
      }
      getSurvey(name) {
        if (this.surveys.has(name)) {
          return this.surveys.get(name);
        }
        const survey = new Survey(name);
        this.surveys.set(name, survey);
        return survey;
      }
      getBroadcaster(name) {
        if (this.broadcasters.has(name)) {
          return this.broadcasters.get(name);
        }
        const broadcaster = new Broadcaster(name);
        this.broadcasters.set(name, broadcaster);
        return broadcaster;
      }
      all(name) {
        const pipeline = this.getPipeline(name);
        return [
          (...args) => pipeline.invoke(...args),
          (func) => pipeline.register(func, `${name} for ${func.name}`)
        ];
      }
      first(name) {
        const switchChannel = this.getSwitch(name);
        return [
          (...args) => switchChannel.invoke(...args),
          (func) => switchChannel.register(func, `${name} for ${func.name}`)
        ];
      }
      firstOrUndefined(name) {
        const switchChannel = this.getSwitch(name);
        const invoke = async (...args) => {
          const result = await switchChannel.invoke(...args);
          if (!result) {
            return void 0;
          }
          return result;
        };
        const registerFunc = (handler) => {
          const wrapped = async (...args) => {
            try {
              const result = await handler(...args);
              if (result !== void 0 && result !== false) {
                return result;
              }
            } catch (e2) {
              Logger("Error in firstOrUndefined handler for " + name);
              Logger(e2, LOG_LEVEL_VERBOSE);
            }
            return false;
          };
          switchChannel.register(wrapped, `${name} for ${handler.name}`);
        };
        return [invoke, registerFunc];
      }
      firstFailure(name) {
        const survey = this.getSurvey(name);
        const invoke = async (...args) => {
          const resultTasks = survey.invoke(...args);
          try {
            const results = await Promise.all(resultTasks);
            const someFailed = results.some((r) => r === false);
            if (someFailed) {
            }
            return !someFailed;
          } catch (e2) {
            Logger("Error in firstFailure handler for survey " + name);
            Logger(e2, LOG_LEVEL_VERBOSE);
            return false;
          }
        };
        const registerFunc = (handler) => {
          const wrapped = async (...args) => {
            try {
              const result = await handler(...args);
              if (result !== void 0 && !result) {
                return false;
              }
            } catch (e2) {
              Logger("Error in firstFailure handler for survey " + name);
              Logger(e2, LOG_LEVEL_VERBOSE);
            }
            return true;
          };
          survey.register(wrapped, `${name} for ${handler.name}`);
        };
        return [invoke, registerFunc];
      }
      broadcast(name) {
        const broadcaster = this.getBroadcaster(name);
        return [
          (...args) => broadcaster.invoke(...args),
          (func) => broadcaster.register(func, `${name} for ${func.name}`)
        ];
      }
      collect(name) {
        const survey = this.getSurvey(name);
        return [
          (...args) => survey.invoke(...args),
          (func) => survey.register(func, `${name} for ${func.name}`)
        ];
      }
      collectBatch(name) {
        const survey = this.getSurvey(name);
        return [
          (...args) => {
            const tasks3 = survey.invoke(...args);
            return Promise.all(tasks3);
          },
          (func) => survey.register(func, `${name} for ${func.name}`)
        ];
      }
    };
  }
});

// node_modules/fflate/esm/browser.js
function deflate(data, opts, cb) {
  if (!cb)
    cb = opts, opts = {};
  if (typeof cb != "function")
    err(7);
  return cbify(data, opts, [
    bDflt
  ], function(ev) {
    return pbf(deflateSync(ev.data[0], ev.data[1]));
  }, 0, cb);
}
function deflateSync(data, opts) {
  return dopt(data, opts || {}, 0, 0);
}
function inflate(data, opts, cb) {
  if (!cb)
    cb = opts, opts = {};
  if (typeof cb != "function")
    err(7);
  return cbify(data, opts, [
    bInflt
  ], function(ev) {
    return pbf(inflateSync(ev.data[0], gopt(ev.data[1])));
  }, 1, cb);
}
function inflateSync(data, opts) {
  return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
}
var ch2, wk, u8, u16, i32, fleb, fdeb, clim, freb, _a3, fl, revfl, _b, fd, revfd, rev, x, i, hMap, flt, i, i, i, i, fdt, i, flm, flrm, fdm, fdrm, max, bits, bits16, shft, slc, ec, err, inflt, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, deo, et, dflt, dopt, mrg, wcln, ch, cbfs, wrkr, bInflt, bDflt, pbf, gopt, cbify, td2, tds;
var init_browser = __esm({
  "node_modules/fflate/esm/browser.js"() {
    ch2 = {};
    wk = function(c, id, msg, transfer, cb) {
      var w2 = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([
        c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'
      ], { type: "text/javascript" }))));
      w2.onmessage = function(e2) {
        var d = e2.data, ed = d.$e$;
        if (ed) {
          var err2 = new Error(ed[0]);
          err2["code"] = ed[1];
          err2.stack = ed[2];
          cb(err2, null);
        } else
          cb(null, d);
      };
      w2.postMessage(msg, transfer);
      return w2;
    };
    u8 = Uint8Array;
    u16 = Uint16Array;
    i32 = Int32Array;
    fleb = new u8([
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      1,
      1,
      1,
      1,
      2,
      2,
      2,
      2,
      3,
      3,
      3,
      3,
      4,
      4,
      4,
      4,
      5,
      5,
      5,
      5,
      0,
      /* unused */
      0,
      0,
      /* impossible */
      0
    ]);
    fdeb = new u8([
      0,
      0,
      0,
      0,
      1,
      1,
      2,
      2,
      3,
      3,
      4,
      4,
      5,
      5,
      6,
      6,
      7,
      7,
      8,
      8,
      9,
      9,
      10,
      10,
      11,
      11,
      12,
      12,
      13,
      13,
      /* unused */
      0,
      0
    ]);
    clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
    freb = function(eb, start) {
      var b = new u16(31);
      for (var i = 0; i < 31; ++i) {
        b[i] = start += 1 << eb[i - 1];
      }
      var r = new i32(b[30]);
      for (var i = 1; i < 30; ++i) {
        for (var j = b[i]; j < b[i + 1]; ++j) {
          r[j] = j - b[i] << 5 | i;
        }
      }
      return { b, r };
    };
    _a3 = freb(fleb, 2);
    fl = _a3.b;
    revfl = _a3.r;
    fl[28] = 258, revfl[258] = 28;
    _b = freb(fdeb, 0);
    fd = _b.b;
    revfd = _b.r;
    rev = new u16(32768);
    for (i = 0; i < 32768; ++i) {
      x = (i & 43690) >> 1 | (i & 21845) << 1;
      x = (x & 52428) >> 2 | (x & 13107) << 2;
      x = (x & 61680) >> 4 | (x & 3855) << 4;
      rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
    }
    hMap = function(cd, mb, r) {
      var s = cd.length;
      var i = 0;
      var l = new u16(mb);
      for (; i < s; ++i) {
        if (cd[i])
          ++l[cd[i] - 1];
      }
      var le = new u16(mb);
      for (i = 1; i < mb; ++i) {
        le[i] = le[i - 1] + l[i - 1] << 1;
      }
      var co;
      if (r) {
        co = new u16(1 << mb);
        var rvb = 15 - mb;
        for (i = 0; i < s; ++i) {
          if (cd[i]) {
            var sv = i << 4 | cd[i];
            var r_1 = mb - cd[i];
            var v = le[cd[i] - 1]++ << r_1;
            for (var m2 = v | (1 << r_1) - 1; v <= m2; ++v) {
              co[rev[v] >> rvb] = sv;
            }
          }
        }
      } else {
        co = new u16(s);
        for (i = 0; i < s; ++i) {
          if (cd[i]) {
            co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
          }
        }
      }
      return co;
    };
    flt = new u8(288);
    for (i = 0; i < 144; ++i)
      flt[i] = 8;
    for (i = 144; i < 256; ++i)
      flt[i] = 9;
    for (i = 256; i < 280; ++i)
      flt[i] = 7;
    for (i = 280; i < 288; ++i)
      flt[i] = 8;
    fdt = new u8(32);
    for (i = 0; i < 32; ++i)
      fdt[i] = 5;
    flm = /* @__PURE__ */ hMap(flt, 9, 0);
    flrm = /* @__PURE__ */ hMap(flt, 9, 1);
    fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
    fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
    max = function(a) {
      var m2 = a[0];
      for (var i = 1; i < a.length; ++i) {
        if (a[i] > m2)
          m2 = a[i];
      }
      return m2;
    };
    bits = function(d, p, m2) {
      var o = p / 8 | 0;
      return (d[o] | d[o + 1] << 8) >> (p & 7) & m2;
    };
    bits16 = function(d, p) {
      var o = p / 8 | 0;
      return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
    };
    shft = function(p) {
      return (p + 7) / 8 | 0;
    };
    slc = function(v, s, e2) {
      if (s == null || s < 0)
        s = 0;
      if (e2 == null || e2 > v.length)
        e2 = v.length;
      return new u8(v.subarray(s, e2));
    };
    ec = [
      "unexpected EOF",
      "invalid block type",
      "invalid length/literal",
      "invalid distance",
      "stream finished",
      "no stream handler",
      ,
      "no callback",
      "invalid UTF-8 data",
      "extra field too long",
      "date not in range 1980-2099",
      "filename too long",
      "stream finishing",
      "invalid zip data"
      // determined by unknown compression method
    ];
    err = function(ind, msg, nt) {
      var e2 = new Error(msg || ec[ind]);
      e2.code = ind;
      if (Error.captureStackTrace)
        Error.captureStackTrace(e2, err);
      if (!nt)
        throw e2;
      return e2;
    };
    inflt = function(dat, st, buf, dict) {
      var sl = dat.length, dl = dict ? dict.length : 0;
      if (!sl || st.f && !st.l)
        return buf || new u8(0);
      var noBuf = !buf;
      var resize = noBuf || st.i != 2;
      var noSt = st.i;
      if (noBuf)
        buf = new u8(sl * 3);
      var cbuf = function(l2) {
        var bl = buf.length;
        if (l2 > bl) {
          var nbuf = new u8(Math.max(bl * 2, l2));
          nbuf.set(buf);
          buf = nbuf;
        }
      };
      var final = st.f || 0, pos2 = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
      var tbts = sl * 8;
      do {
        if (!lm) {
          final = bits(dat, pos2, 1);
          var type = bits(dat, pos2 + 1, 3);
          pos2 += 3;
          if (!type) {
            var s = shft(pos2) + 4, l = dat[s - 4] | dat[s - 3] << 8, t2 = s + l;
            if (t2 > sl) {
              if (noSt)
                err(0);
              break;
            }
            if (resize)
              cbuf(bt + l);
            buf.set(dat.subarray(s, t2), bt);
            st.b = bt += l, st.p = pos2 = t2 * 8, st.f = final;
            continue;
          } else if (type == 1)
            lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
          else if (type == 2) {
            var hLit = bits(dat, pos2, 31) + 257, hcLen = bits(dat, pos2 + 10, 15) + 4;
            var tl = hLit + bits(dat, pos2 + 5, 31) + 1;
            pos2 += 14;
            var ldt = new u8(tl);
            var clt = new u8(19);
            for (var i = 0; i < hcLen; ++i) {
              clt[clim[i]] = bits(dat, pos2 + i * 3, 7);
            }
            pos2 += hcLen * 3;
            var clb = max(clt), clbmsk = (1 << clb) - 1;
            var clm = hMap(clt, clb, 1);
            for (var i = 0; i < tl; ) {
              var r = clm[bits(dat, pos2, clbmsk)];
              pos2 += r & 15;
              var s = r >> 4;
              if (s < 16) {
                ldt[i++] = s;
              } else {
                var c = 0, n3 = 0;
                if (s == 16)
                  n3 = 3 + bits(dat, pos2, 3), pos2 += 2, c = ldt[i - 1];
                else if (s == 17)
                  n3 = 3 + bits(dat, pos2, 7), pos2 += 3;
                else if (s == 18)
                  n3 = 11 + bits(dat, pos2, 127), pos2 += 7;
                while (n3--)
                  ldt[i++] = c;
              }
            }
            var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
            lbt = max(lt);
            dbt = max(dt);
            lm = hMap(lt, lbt, 1);
            dm = hMap(dt, dbt, 1);
          } else
            err(1);
          if (pos2 > tbts) {
            if (noSt)
              err(0);
            break;
          }
        }
        if (resize)
          cbuf(bt + 131072);
        var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
        var lpos = pos2;
        for (; ; lpos = pos2) {
          var c = lm[bits16(dat, pos2) & lms], sym = c >> 4;
          pos2 += c & 15;
          if (pos2 > tbts) {
            if (noSt)
              err(0);
            break;
          }
          if (!c)
            err(2);
          if (sym < 256)
            buf[bt++] = sym;
          else if (sym == 256) {
            lpos = pos2, lm = null;
            break;
          } else {
            var add = sym - 254;
            if (sym > 264) {
              var i = sym - 257, b = fleb[i];
              add = bits(dat, pos2, (1 << b) - 1) + fl[i];
              pos2 += b;
            }
            var d = dm[bits16(dat, pos2) & dms], dsym = d >> 4;
            if (!d)
              err(3);
            pos2 += d & 15;
            var dt = fd[dsym];
            if (dsym > 3) {
              var b = fdeb[dsym];
              dt += bits16(dat, pos2) & (1 << b) - 1, pos2 += b;
            }
            if (pos2 > tbts) {
              if (noSt)
                err(0);
              break;
            }
            if (resize)
              cbuf(bt + 131072);
            var end = bt + add;
            if (bt < dt) {
              var shift = dl - dt, dend = Math.min(dt, end);
              if (shift + bt < 0)
                err(3);
              for (; bt < dend; ++bt)
                buf[bt] = dict[shift + bt];
            }
            for (; bt < end; ++bt)
              buf[bt] = buf[bt - dt];
          }
        }
        st.l = lm, st.p = lpos, st.b = bt, st.f = final;
        if (lm)
          final = 1, st.m = lbt, st.d = dm, st.n = dbt;
      } while (!final);
      return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
    };
    wbits = function(d, p, v) {
      v <<= p & 7;
      var o = p / 8 | 0;
      d[o] |= v;
      d[o + 1] |= v >> 8;
    };
    wbits16 = function(d, p, v) {
      v <<= p & 7;
      var o = p / 8 | 0;
      d[o] |= v;
      d[o + 1] |= v >> 8;
      d[o + 2] |= v >> 16;
    };
    hTree = function(d, mb) {
      var t2 = [];
      for (var i = 0; i < d.length; ++i) {
        if (d[i])
          t2.push({ s: i, f: d[i] });
      }
      var s = t2.length;
      var t22 = t2.slice();
      if (!s)
        return { t: et, l: 0 };
      if (s == 1) {
        var v = new u8(t2[0].s + 1);
        v[t2[0].s] = 1;
        return { t: v, l: 1 };
      }
      t2.sort(function(a, b) {
        return a.f - b.f;
      });
      t2.push({ s: -1, f: 25001 });
      var l = t2[0], r = t2[1], i0 = 0, i1 = 1, i2 = 2;
      t2[0] = { s: -1, f: l.f + r.f, l, r };
      while (i1 != s - 1) {
        l = t2[t2[i0].f < t2[i2].f ? i0++ : i2++];
        r = t2[i0 != i1 && t2[i0].f < t2[i2].f ? i0++ : i2++];
        t2[i1++] = { s: -1, f: l.f + r.f, l, r };
      }
      var maxSym = t22[0].s;
      for (var i = 1; i < s; ++i) {
        if (t22[i].s > maxSym)
          maxSym = t22[i].s;
      }
      var tr = new u16(maxSym + 1);
      var mbt = ln(t2[i1 - 1], tr, 0);
      if (mbt > mb) {
        var i = 0, dt = 0;
        var lft = mbt - mb, cst = 1 << lft;
        t22.sort(function(a, b) {
          return tr[b.s] - tr[a.s] || a.f - b.f;
        });
        for (; i < s; ++i) {
          var i2_1 = t22[i].s;
          if (tr[i2_1] > mb) {
            dt += cst - (1 << mbt - tr[i2_1]);
            tr[i2_1] = mb;
          } else
            break;
        }
        dt >>= lft;
        while (dt > 0) {
          var i2_2 = t22[i].s;
          if (tr[i2_2] < mb)
            dt -= 1 << mb - tr[i2_2]++ - 1;
          else
            ++i;
        }
        for (; i >= 0 && dt; --i) {
          var i2_3 = t22[i].s;
          if (tr[i2_3] == mb) {
            --tr[i2_3];
            ++dt;
          }
        }
        mbt = mb;
      }
      return { t: new u8(tr), l: mbt };
    };
    ln = function(n3, l, d) {
      return n3.s == -1 ? Math.max(ln(n3.l, l, d + 1), ln(n3.r, l, d + 1)) : l[n3.s] = d;
    };
    lc = function(c) {
      var s = c.length;
      while (s && !c[--s])
        ;
      var cl = new u16(++s);
      var cli = 0, cln = c[0], cls = 1;
      var w2 = function(v) {
        cl[cli++] = v;
      };
      for (var i = 1; i <= s; ++i) {
        if (c[i] == cln && i != s)
          ++cls;
        else {
          if (!cln && cls > 2) {
            for (; cls > 138; cls -= 138)
              w2(32754);
            if (cls > 2) {
              w2(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
              cls = 0;
            }
          } else if (cls > 3) {
            w2(cln), --cls;
            for (; cls > 6; cls -= 6)
              w2(8304);
            if (cls > 2)
              w2(cls - 3 << 5 | 8208), cls = 0;
          }
          while (cls--)
            w2(cln);
          cls = 1;
          cln = c[i];
        }
      }
      return { c: cl.subarray(0, cli), n: s };
    };
    clen = function(cf, cl) {
      var l = 0;
      for (var i = 0; i < cl.length; ++i)
        l += cf[i] * cl[i];
      return l;
    };
    wfblk = function(out, pos2, dat) {
      var s = dat.length;
      var o = shft(pos2 + 2);
      out[o] = s & 255;
      out[o + 1] = s >> 8;
      out[o + 2] = out[o] ^ 255;
      out[o + 3] = out[o + 1] ^ 255;
      for (var i = 0; i < s; ++i)
        out[o + i + 4] = dat[i];
      return (o + 4 + s) * 8;
    };
    wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
      wbits(out, p++, final);
      ++lf[256];
      var _a6 = hTree(lf, 15), dlt = _a6.t, mlb = _a6.l;
      var _b4 = hTree(df, 15), ddt = _b4.t, mdb = _b4.l;
      var _c2 = lc(dlt), lclt = _c2.c, nlc = _c2.n;
      var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
      var lcfreq = new u16(19);
      for (var i = 0; i < lclt.length; ++i)
        ++lcfreq[lclt[i] & 31];
      for (var i = 0; i < lcdt.length; ++i)
        ++lcfreq[lcdt[i] & 31];
      var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
      var nlcc = 19;
      for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
        ;
      var flen = bl + 5 << 3;
      var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
      var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
      if (bs >= 0 && flen <= ftlen && flen <= dtlen)
        return wfblk(out, p, dat.subarray(bs, bs + bl));
      var lm, ll, dm, dl;
      wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
      if (dtlen < ftlen) {
        lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
        var llm = hMap(lct, mlcb, 0);
        wbits(out, p, nlc - 257);
        wbits(out, p + 5, ndc - 1);
        wbits(out, p + 10, nlcc - 4);
        p += 14;
        for (var i = 0; i < nlcc; ++i)
          wbits(out, p + 3 * i, lct[clim[i]]);
        p += 3 * nlcc;
        var lcts = [lclt, lcdt];
        for (var it = 0; it < 2; ++it) {
          var clct = lcts[it];
          for (var i = 0; i < clct.length; ++i) {
            var len = clct[i] & 31;
            wbits(out, p, llm[len]), p += lct[len];
            if (len > 15)
              wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
          }
        }
      } else {
        lm = flm, ll = flt, dm = fdm, dl = fdt;
      }
      for (var i = 0; i < li; ++i) {
        var sym = syms[i];
        if (sym > 255) {
          var len = sym >> 18 & 31;
          wbits16(out, p, lm[len + 257]), p += ll[len + 257];
          if (len > 7)
            wbits(out, p, sym >> 23 & 31), p += fleb[len];
          var dst = sym & 31;
          wbits16(out, p, dm[dst]), p += dl[dst];
          if (dst > 3)
            wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
        } else {
          wbits16(out, p, lm[sym]), p += ll[sym];
        }
      }
      wbits16(out, p, lm[256]);
      return p + ll[256];
    };
    deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
    et = /* @__PURE__ */ new u8(0);
    dflt = function(dat, lvl, plvl, pre, post, st) {
      var s = st.z || dat.length;
      var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
      var w2 = o.subarray(pre, o.length - post);
      var lst = st.l;
      var pos2 = (st.r || 0) & 7;
      if (lvl) {
        if (pos2)
          w2[0] = st.r >> 3;
        var opt = deo[lvl - 1];
        var n3 = opt >> 13, c = opt & 8191;
        var msk_1 = (1 << plvl) - 1;
        var prev = st.p || new u16(32768), head2 = st.h || new u16(msk_1 + 1);
        var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
        var hsh = function(i2) {
          return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1;
        };
        var syms = new i32(25e3);
        var lf = new u16(288), df = new u16(32);
        var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
        for (; i + 2 < s; ++i) {
          var hv = hsh(i);
          var imod = i & 32767, pimod = head2[hv];
          prev[imod] = pimod;
          head2[hv] = imod;
          if (wi <= i) {
            var rem = s - i;
            if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
              pos2 = wblk(dat, w2, 0, syms, lf, df, eb, li, bs, i - bs, pos2);
              li = lc_1 = eb = 0, bs = i;
              for (var j = 0; j < 286; ++j)
                lf[j] = 0;
              for (var j = 0; j < 30; ++j)
                df[j] = 0;
            }
            var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
            if (rem > 2 && hv == hsh(i - dif)) {
              var maxn = Math.min(n3, rem) - 1;
              var maxd = Math.min(32767, i);
              var ml = Math.min(258, rem);
              while (dif <= maxd && --ch_1 && imod != pimod) {
                if (dat[i + l] == dat[i + l - dif]) {
                  var nl = 0;
                  for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)
                    ;
                  if (nl > l) {
                    l = nl, d = dif;
                    if (nl > maxn)
                      break;
                    var mmd = Math.min(dif, nl - 2);
                    var md = 0;
                    for (var j = 0; j < mmd; ++j) {
                      var ti = i - dif + j & 32767;
                      var pti = prev[ti];
                      var cd = ti - pti & 32767;
                      if (cd > md)
                        md = cd, pimod = ti;
                    }
                  }
                }
                imod = pimod, pimod = prev[imod];
                dif += imod - pimod & 32767;
              }
            }
            if (d) {
              syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
              var lin = revfl[l] & 31, din = revfd[d] & 31;
              eb += fleb[lin] + fdeb[din];
              ++lf[257 + lin];
              ++df[din];
              wi = i + l;
              ++lc_1;
            } else {
              syms[li++] = dat[i];
              ++lf[dat[i]];
            }
          }
        }
        for (i = Math.max(i, wi); i < s; ++i) {
          syms[li++] = dat[i];
          ++lf[dat[i]];
        }
        pos2 = wblk(dat, w2, lst, syms, lf, df, eb, li, bs, i - bs, pos2);
        if (!lst) {
          st.r = pos2 & 7 | w2[pos2 / 8 | 0] << 3;
          pos2 -= 7;
          st.h = head2, st.p = prev, st.i = i, st.w = wi;
        }
      } else {
        for (var i = st.w || 0; i < s + lst; i += 65535) {
          var e2 = i + 65535;
          if (e2 >= s) {
            w2[pos2 / 8 | 0] = lst;
            e2 = s;
          }
          pos2 = wfblk(w2, pos2 + 1, dat.subarray(i, e2));
        }
        st.i = s;
      }
      return slc(o, 0, pre + shft(pos2) + post);
    };
    dopt = function(dat, opt, pre, post, st) {
      if (!st) {
        st = { l: 1 };
        if (opt.dictionary) {
          var dict = opt.dictionary.subarray(-32768);
          var newDat = new u8(dict.length + dat.length);
          newDat.set(dict);
          newDat.set(dat, dict.length);
          dat = newDat;
          st.w = dict.length;
        }
      }
      return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
    };
    mrg = function(a, b) {
      var o = {};
      for (var k in a)
        o[k] = a[k];
      for (var k in b)
        o[k] = b[k];
      return o;
    };
    wcln = function(fn, fnStr, td3) {
      var dt = fn();
      var st = fn.toString();
      var ks = st.slice(st.indexOf("[") + 1, st.lastIndexOf("]")).replace(/\s+/g, "").split(",");
      for (var i = 0; i < dt.length; ++i) {
        var v = dt[i], k = ks[i];
        if (typeof v == "function") {
          fnStr += ";" + k + "=";
          var st_1 = v.toString();
          if (v.prototype) {
            if (st_1.indexOf("[native code]") != -1) {
              var spInd = st_1.indexOf(" ", 8) + 1;
              fnStr += st_1.slice(spInd, st_1.indexOf("(", spInd));
            } else {
              fnStr += st_1;
              for (var t2 in v.prototype)
                fnStr += ";" + k + ".prototype." + t2 + "=" + v.prototype[t2].toString();
            }
          } else
            fnStr += st_1;
        } else
          td3[k] = v;
      }
      return fnStr;
    };
    ch = [];
    cbfs = function(v) {
      var tl = [];
      for (var k in v) {
        if (v[k].buffer) {
          tl.push((v[k] = new v[k].constructor(v[k])).buffer);
        }
      }
      return tl;
    };
    wrkr = function(fns, init3, id, cb) {
      if (!ch[id]) {
        var fnStr = "", td_1 = {}, m2 = fns.length - 1;
        for (var i = 0; i < m2; ++i)
          fnStr = wcln(fns[i], fnStr, td_1);
        ch[id] = { c: wcln(fns[m2], fnStr, td_1), e: td_1 };
      }
      var td3 = mrg({}, ch[id].e);
      return wk(ch[id].c + ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + init3.toString() + "}", id, td3, cbfs(td3), cb);
    };
    bInflt = function() {
      return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt];
    };
    bDflt = function() {
      return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf];
    };
    pbf = function(msg) {
      return postMessage(msg, [msg.buffer]);
    };
    gopt = function(o) {
      return o && {
        out: o.size && new u8(o.size),
        dictionary: o.dictionary
      };
    };
    cbify = function(dat, opts, fns, init3, id, cb) {
      var w2 = wrkr(fns, init3, id, function(err2, dat2) {
        w2.terminate();
        cb(err2, dat2);
      });
      w2.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);
      return function() {
        w2.terminate();
      };
    };
    td2 = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
    tds = 0;
    try {
      td2.decode(et, { stream: true });
      tds = 1;
    } catch (e2) {
    }
  }
});

// src/sync/core/pouchdb/compress.ts
async function _compressText(text3) {
  const converted = tryConvertBase64ToArrayBuffer(text3);
  const data = new Uint8Array(
    converted || await new Blob([text3], { type: "application/octet-stream" }).arrayBuffer()
  );
  if (data.buffer.byteLength == 0) {
    return "";
  }
  const df = await wrappedDeflate(new Uint8Array(data), { consume: true, level: 8 });
  const deflateResult = (converted ? "~" : "") + await arrayBufferToBase64Single(df);
  return deflateResult;
}
async function _decompressText(compressed, _useUTF16 = false) {
  if (compressed.length == 0) {
    return "";
  }
  const converted = compressed[0] == "~";
  const src = compressed.substring(converted ? 1 : 0);
  if (src.length == 0) {
    return "";
  }
  const ab = new Uint8Array(base64ToArrayBuffer(src));
  if (ab.length == 0) {
    return "";
  }
  const ret = await wrappedInflate(new Uint8Array(ab), { consume: true });
  if (converted) {
    return await arrayBufferToBase64Single(ret);
  }
  const response = new Blob([ret]);
  const text3 = await response.text();
  return text3;
}
async function compressDoc(doc) {
  if (!("data" in doc)) {
    return doc;
  }
  if (typeof doc.data !== "string") return doc;
  if (doc.data.startsWith(MARK_SHIFT_COMPRESSED)) return doc;
  const oldData = doc.data;
  const compressed = await _compressText(oldData);
  const newData = MARK_SHIFT_COMPRESSED + compressed;
  if (doc.data.length > newData.length) doc.data = newData;
  return doc;
}
async function decompressDoc(doc) {
  if (!("data" in doc)) {
    return doc;
  }
  if (typeof doc.data !== "string") return doc;
  if (doc.data.startsWith(MARK_SHIFT_COMPRESSED)) {
    doc.data = await _decompressText(doc.data.substring(MARK_SHIFT_COMPRESSED.length));
  }
  return doc;
}
function wrapFflateFunc(func) {
  return (data, opts) => {
    return new Promise((res2, rej) => {
      func(data, opts, (err2, result) => {
        if (err2) rej(err2);
        else res2(new Uint8Array(result));
      });
    });
  };
}
var wrappedInflate, wrappedDeflate, replicationFilter, MARK_SHIFT, MARK_SHIFT_COMPRESSED;
var init_compress = __esm({
  "src/sync/core/pouchdb/compress.ts"() {
    "use strict";
    init_browser();
    init_convert();
    wrappedInflate = wrapFflateFunc(inflate);
    wrappedDeflate = wrapFflateFunc(deflate);
    replicationFilter = (db, compress) => {
      db.transform({
        //@ts-ignore
        async incoming(doc) {
          if (!compress) return doc;
          return await compressDoc(doc);
        },
        //@ts-ignore
        async outgoing(doc) {
          return await decompressDoc(doc);
        }
      });
    };
    MARK_SHIFT = `L`;
    MARK_SHIFT_COMPRESSED = `${MARK_SHIFT}Z`;
  }
});

// src/sync/core/encryption/stringEncryption.ts
var init_stringEncryption = __esm({
  "src/sync/core/encryption/stringEncryption.ts"() {
    "use strict";
    init_encryption();
    init_hkdf();
    init_logger2();
  }
});

// src/sync/types.ts
var ICHeader, ICHeaderEnd, ICHeaderLength, DEFAULT_INTERNAL_IGNORE_PATTERNS;
var init_types2 = __esm({
  "src/sync/types.ts"() {
    "use strict";
    init_types();
    init_LiveSyncReplicator();
    init_LiveSyncLocalDB();
    init_stringEncryption();
    init_i18n();
    init_logger2();
    init_utils_couchdb();
    ICHeader = "i:";
    ICHeaderEnd = "i;";
    ICHeaderLength = ICHeader.length;
    DEFAULT_INTERNAL_IGNORE_PATTERNS = [
      "\\.obsidian\\/workspace",
      // Workspace layout (device-specific)
      "\\.obsidian\\/workspace\\.json",
      // Workspace JSON
      "\\.obsidian\\/workspace-mobile\\.json",
      // Mobile workspace
      "\\.obsidian\\/cache",
      // Cache directory
      "\\/node_modules\\/",
      // Node modules
      "\\/\\.git\\/",
      // Git directories
      "plugins\\/mdfriday\\/preview",
      // MDFriday preview files (generated)
      "plugins\\/mdfriday\\/themes",
      // MDFriday themes (generated)
      "plugins\\/mdfriday\\/data\\.json"
      // MDFriday plugin settings (device-specific)
    ].join(",");
  }
});

// src/sync/utils/hiddenFileUtils.ts
function isInternalMetadata(id) {
  return id.startsWith(ICHeader);
}
function stripInternalMetadataPrefix(id) {
  if (id.startsWith(ICHeader)) {
    return id.substring(ICHeaderLength);
  }
  return id;
}
function compareMTime(baseMTime, targetMTime) {
  const tolerance = 2e3;
  const diff = targetMTime - baseMTime;
  if (diff > tolerance) {
    return TARGET_IS_NEW;
  } else if (diff < -tolerance) {
    return BASE_IS_NEW;
  }
  return EVEN;
}
function markChangesAreSame(path8, mtime1, mtime2) {
  sameChangePairs.set(path8, [mtime1, mtime2]);
}
function unmarkChanges(path8) {
  sameChangePairs.delete(path8);
}
function getComparingMTime(doc, includeDeleted = false) {
  var _a6, _b4;
  if (doc === null || doc === false || doc === void 0) return 0;
  if (!includeDeleted) {
    if ("deleted" in doc && doc.deleted) return 0;
    if ("_deleted" in doc && doc._deleted) return 0;
  }
  if ("stat" in doc && doc.stat) return (_a6 = doc.stat.mtime) != null ? _a6 : 0;
  if ("mtime" in doc) return (_b4 = doc.mtime) != null ? _b4 : 0;
  return 0;
}
function onlyInNTimes(n3, fn) {
  let count = 0;
  return () => {
    count++;
    if (count % n3 === 0) {
      fn(count);
    }
  };
}
function statToKey(stat) {
  var _a6, _b4;
  return `${(_a6 = stat == null ? void 0 : stat.mtime) != null ? _a6 : 0}-${(_b4 = stat == null ? void 0 : stat.size) != null ? _b4 : 0}`;
}
function docToKey(doc) {
  const deleted = doc._deleted || doc.deleted || false;
  return `${doc.mtime || 0}-${doc.size || 0}-${doc._rev || ""}-${deleted ? "0" : "1"}`;
}
function parsePatterns(patterns) {
  if (!patterns || patterns.trim() === "") {
    return [];
  }
  return patterns.split(",").map((p) => p.trim()).filter((p) => p.length > 0).map((p) => {
    try {
      return new RegExp(p);
    } catch (e2) {
      console.warn(`Invalid regex pattern: ${p}`);
      return null;
    }
  }).filter((r) => r !== null);
}
function matchesAnyPattern(path8, patterns) {
  return patterns.some((pattern) => pattern.test(path8));
}
function getPath2(entry) {
  if (entry.path) {
    return stripInternalMetadataPrefix(entry.path);
  }
  if (entry._id) {
    return stripInternalMetadataPrefix(entry._id);
  }
  return "";
}
var TARGET_IS_NEW, BASE_IS_NEW, EVEN, sameChangePairs;
var init_hiddenFileUtils = __esm({
  "src/sync/utils/hiddenFileUtils.ts"() {
    "use strict";
    init_types2();
    TARGET_IS_NEW = 1;
    BASE_IS_NEW = -1;
    EVEN = 0;
    sameChangePairs = /* @__PURE__ */ new Map();
  }
});

// node_modules/octagonal-wheels/dist/concurrency/task.js
function unwrapTaskResult(result) {
  if ("ok" in result)
    return result.ok;
  if ("err" in result)
    return result.err;
  throw new Error("Argument Exception: Could not unwrap");
}
function isTaskWaiting(task) {
  if (task instanceof Promise) {
    return false;
  }
  if (task instanceof Function) {
    return true;
  }
  throw new Error("Invalid state");
}
async function wrapEachProcess(key4, task) {
  try {
    const r = await task;
    return { key: key4, ok: r };
  } catch (ex) {
    return { key: key4, err: ex instanceof Error ? ex : new Error(`${ex}`) };
  }
}
async function* processAllTasksWithConcurrencyLimit(limit, tasks3) {
  const nowProcessing = /* @__PURE__ */ new Map();
  let idx2 = 0;
  const pendingTasks = tasks3.reverse();
  while (pendingTasks.length > 0 || nowProcessing.size > 0) {
    L2: while (nowProcessing.size < limit && pendingTasks.length > 0) {
      const task = pendingTasks.pop();
      if (task === void 0) {
        break L2;
      }
      idx2++;
      const newProcess = isTaskWaiting(task) ? task() : task;
      const wrappedPromise = wrapEachProcess(idx2, newProcess);
      nowProcessing.set(idx2, wrappedPromise);
    }
    const done = await Promise.race(nowProcessing.values());
    nowProcessing.delete(done.key);
    yield done;
  }
}
async function mapAllTasksWithConcurrencyLimit(limit, tasks3) {
  const results = /* @__PURE__ */ new Map();
  for await (const v of processAllTasksWithConcurrencyLimit(limit, tasks3)) {
    results.set(v.key, v);
  }
  const ret = [...results.entries()].sort((a, b) => a[0] - b[0]).map((e2) => e2[1]);
  return ret;
}
function scheduleTask(key4, timeout, proc, skipIfTaskExist) {
  if (tasks2.has(key4)) {
    if (skipIfTaskExist)
      return;
    cancelTask(key4);
  }
  const newTask = setTimeout(() => {
    tasks2.delete(key4);
    void proc();
  }, timeout);
  tasks2.set(key4, newTask);
}
function cancelTask(key4) {
  const old = tasks2.get(key4);
  if (old) {
    clearTimeout(old);
    tasks2.delete(key4);
  }
}
var tasks2;
var init_task = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/task.js"() {
    init_promises();
    init_lock_v2();
    init_SlipBoard();
    tasks2 = /* @__PURE__ */ new Map();
  }
});

// node_modules/octagonal-wheels/dist/dataobject/PersistentMap.js
var YieldOperationNumbers, PersistentMap;
var init_PersistentMap = __esm({
  "node_modules/octagonal-wheels/dist/dataobject/PersistentMap.js"() {
    init_task();
    YieldOperationNumbers = 100;
    PersistentMap = class {
      flush() {
        this._save();
      }
      _save() {
        localStorage.setItem(this._key, JSON.stringify([...this._map.entries()]));
      }
      _load(suppliedEntries = []) {
        var _a6;
        try {
          const savedSource = (_a6 = localStorage.getItem(this._key)) != null ? _a6 : "";
          const sourceToParse = savedSource === "" ? "[]" : savedSource;
          const obj = JSON.parse(sourceToParse);
          this._map = new Map([...obj, ...suppliedEntries]);
        } catch (ex) {
          console.log(`Map read error : ${this._key}`);
          console.dir(ex);
          this._map = new Map([...suppliedEntries]);
        }
        return Promise.resolve();
      }
      _queueSave() {
        this._setCount--;
        if (this._setCount < 0) {
          this._setCount = YieldOperationNumbers;
          scheduleTask(`save-map-${this._key}`, 0, () => this._save());
        }
        scheduleTask(`save-map-${this._key}`, 150, () => this._save());
      }
      delete(key4) {
        const ret = this._map.delete(key4);
        this._queueSave();
        return ret;
      }
      has(key4) {
        return this._map.has(key4);
      }
      set(key4, value2) {
        this._map.set(key4, value2);
        this._queueSave();
        return this;
      }
      clear() {
        this._map = /* @__PURE__ */ new Map();
        this._save();
      }
      get(key4, defValue) {
        const v = this._map.get(key4);
        if (v === void 0)
          return defValue;
        return v;
      }
      constructor(key4, entries) {
        Object.defineProperty(this, "_setCount", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: YieldOperationNumbers
        });
        Object.defineProperty(this, "_map", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_key", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._key = key4;
        this._map = new Map(entries != null ? entries : []);
        void this._load(entries);
      }
    };
  }
});

// src/sync/utils/sameChangePairs.ts
function initializeSameChangePairs(vaultName) {
  sameChangePairs2 = new PersistentMap(`friday-persist-same-changes-${vaultName}`);
  Logger(`sameChangePairs initialized for vault: ${vaultName}`, LOG_LEVEL_VERBOSE);
}
function getSameChangePairs() {
  if (!sameChangePairs2) {
    throw new Error("sameChangePairs not initialized. Call initializeSameChangePairs() first.");
  }
  return sameChangePairs2;
}
function getKey(file) {
  if (typeof file === "string") {
    return stripAllPrefixes2(file);
  }
  return stripAllPrefixes2(file.path);
}
function stripAllPrefixes2(path8) {
  return path8.replace(/^[hi]:/g, "");
}
function markChangesAreSame2(file, mtime1, mtime2) {
  if (mtime1 === mtime2) return;
  try {
    const store = getSameChangePairs();
    const key4 = getKey(file);
    const pairs = store.get(key4, []) || [];
    if (pairs.some((e2) => e2 === mtime1 || e2 === mtime2)) {
      store.set(key4, [.../* @__PURE__ */ new Set([...pairs, mtime1, mtime2])]);
    } else {
      store.set(key4, [mtime1, mtime2]);
    }
    Logger(
      `Marked same changes: ${key4} [${mtime1}, ${mtime2}]`,
      LOG_LEVEL_VERBOSE
    );
  } catch (error2) {
    Logger(`Failed to mark same changes: ${error2}`, LOG_LEVEL_VERBOSE);
  }
}
function unmarkChanges2(file) {
  try {
    const store = getSameChangePairs();
    const key4 = getKey(file);
    store.delete(key4);
    Logger(`Unmarked changes for: ${key4}`, LOG_LEVEL_VERBOSE);
  } catch (error2) {
    Logger(`Failed to unmark changes: ${error2}`, LOG_LEVEL_VERBOSE);
  }
}
function isMarkedAsSameChanges(file, mtimes) {
  try {
    const store = getSameChangePairs();
    const key4 = getKey(file);
    const pairs = store.get(key4, []) || [];
    if (mtimes.every((e2) => pairs.indexOf(e2) !== -1)) {
      return EVEN2;
    }
  } catch (error2) {
    Logger(`Failed to check marked changes: ${error2}`, LOG_LEVEL_VERBOSE);
  }
  return void 0;
}
var sameChangePairs2, BASE_IS_NEW2, TARGET_IS_NEW2, EVEN2;
var init_sameChangePairs = __esm({
  "src/sync/utils/sameChangePairs.ts"() {
    "use strict";
    init_PersistentMap();
    init_logger2();
    sameChangePairs2 = null;
    BASE_IS_NEW2 = Symbol("base");
    TARGET_IS_NEW2 = Symbol("target");
    EVEN2 = Symbol("even");
  }
});

// src/sync/FridayStorageEventManager.ts
function compareMtime(baseMTime, targetMTime) {
  const truncatedBaseMTime = Math.floor(baseMTime / MTIME_RESOLUTION) * MTIME_RESOLUTION;
  const truncatedTargetMTime = Math.floor(targetMTime / MTIME_RESOLUTION) * MTIME_RESOLUTION;
  if (truncatedBaseMTime === truncatedTargetMTime) return "EVEN";
  if (truncatedBaseMTime > truncatedTargetMTime) return "BASE_IS_NEW";
  return "TARGET_IS_NEW";
}
function compareFileFreshness(baseFile, targetFile) {
  if (baseFile === void 0 && targetFile === void 0) return "EVEN";
  if (baseFile === void 0) return "TARGET_IS_NEW";
  if (targetFile === void 0) return "BASE_IS_NEW";
  const baseMtime = baseFile.mtime;
  const targetMtime = targetFile.mtime;
  if (baseMtime && targetMtime && isMarkedAsSameChanges(baseFile.path, [baseMtime, targetMtime]) === EVEN2) {
    Logger(
      `File mtimes marked as same: ${baseFile.path} [${baseMtime}, ${targetMtime}]`,
      LOG_LEVEL_VERBOSE
    );
    return "EVEN";
  }
  return compareMtime(baseMtime, targetMtime);
}
var import_obsidian2, MTIME_RESOLUTION, FridayStorageEventManager;
var init_FridayStorageEventManager = __esm({
  "src/sync/FridayStorageEventManager.ts"() {
    "use strict";
    import_obsidian2 = require("obsidian");
    init_logger2();
    init_types();
    init_path();
    init_utils2();
    init_sameChangePairs();
    MTIME_RESOLUTION = 2e3;
    FridayStorageEventManager = class {
      // 500ms debounce for file changes
      constructor(plugin2, core) {
        this._isWatching = false;
        this._isSuspended = false;
        // Track files being processed to avoid loops (livesync's processingFiles)
        this.processingFiles = /* @__PURE__ */ new Set();
        // ==================== Livesync's recentlyTouched mechanism ====================
        // Tracks files we've recently written to prevent self-triggered events
        // Key format: `${path}-${mtime}-${size}`
        this.touchedFiles = [];
        this.MAX_TOUCHED_FILES = 100;
        // ==================== Livesync's mtime cache mechanism ====================
        // Tracks last processed mtime for each file to avoid reprocessing
        this.lastProcessedMtime = /* @__PURE__ */ new Map();
        // Queue for file events to process
        this.eventQueue = [];
        this.isProcessingQueue = false;
        // Debounce map for file changes
        this.debounceTimers = /* @__PURE__ */ new Map();
        this.DEBOUNCE_DELAY = 500;
        this.plugin = plugin2;
        this.core = core;
      }
      // LiveSync's suspendFileWatching mechanism
      /**
       * Whether file watcher is currently active
       */
      get isWatching() {
        return this._isWatching;
      }
      /**
       * Whether file watching is suspended (matching LiveSync's suspendFileWatching)
       */
      get isSuspended() {
        return this._isSuspended;
      }
      // ==================== Livesync's touched mechanism ====================
      /**
       * Mark a file as recently touched by us (livesync pattern)
       * This prevents our own writes from triggering sync events
       */
      touch(path8, mtime, size) {
        const key4 = `${path8}-${mtime}-${size}`;
        this.touchedFiles = this.touchedFiles.filter((k) => k !== key4);
        this.touchedFiles.unshift(key4);
        if (this.touchedFiles.length > this.MAX_TOUCHED_FILES) {
          this.touchedFiles = this.touchedFiles.slice(0, this.MAX_TOUCHED_FILES);
        }
        Logger(`Touched: ${path8} (mtime=${mtime}, size=${size})`, LOG_LEVEL_DEBUG);
      }
      /**
       * Check if a file was recently touched by us (livesync pattern)
       */
      recentlyTouched(file) {
        const key4 = `${file.path}-${file.stat.mtime}-${file.stat.size}`;
        const isTouched = this.touchedFiles.includes(key4);
        if (isTouched) {
          Logger(`Recently touched, skipping: ${file.path}`, LOG_LEVEL_DEBUG);
        }
        return isTouched;
      }
      /**
       * Clear all touched files
       */
      clearTouched() {
        this.touchedFiles = [];
      }
      // ==================== File Processing Status ====================
      /**
       * Mark a file as being processed (to prevent feedback loops)
       */
      markFileProcessing(path8) {
        this.processingFiles.add(path8);
        setTimeout(() => {
          this.processingFiles.delete(path8);
        }, 5e3);
      }
      /**
       * Check if a file is currently being processed
       */
      isFileProcessing(path8) {
        return this.processingFiles.has(path8);
      }
      /**
       * Unmark a file as being processed
       */
      unmarkFileProcessing(path8) {
        this.processingFiles.delete(path8);
      }
      // ==================== Watch Control ====================
      /**
       * Start watching vault for file changes
       * Note: Following livesync, we don't immediately start - allow time for Obsidian to settle
       */
      beginWatch() {
        if (this._isWatching) {
          Logger("Storage event manager already watching", LOG_LEVEL_VERBOSE);
          return;
        }
        this.watchVaultCreate = this.watchVaultCreate.bind(this);
        this.watchVaultChange = this.watchVaultChange.bind(this);
        this.watchVaultDelete = this.watchVaultDelete.bind(this);
        this.watchVaultRename = this.watchVaultRename.bind(this);
        this.plugin.registerEvent(
          this.plugin.app.vault.on("create", this.watchVaultCreate)
        );
        this.plugin.registerEvent(
          this.plugin.app.vault.on("modify", this.watchVaultChange)
        );
        this.plugin.registerEvent(
          this.plugin.app.vault.on("delete", this.watchVaultDelete)
        );
        this.plugin.registerEvent(
          this.plugin.app.vault.on("rename", this.watchVaultRename)
        );
        this.plugin.registerEvent(
          this.plugin.app.vault.on("raw", this.watchVaultRawEvents.bind(this))
        );
        this._isWatching = true;
        Logger("Storage event manager started watching vault", LOG_LEVEL_INFO);
      }
      /**
       * Handle vault raw events for hidden files (.obsidian)
       * Delegates to HiddenFileSync module if enabled
       */
      watchVaultRawEvents(path8) {
        const hiddenFileSync = this.core.hiddenFileSync;
        if (hiddenFileSync && hiddenFileSync.isThisModuleEnabled()) {
          fireAndForget(() => hiddenFileSync.watchVaultRawEvents(path8));
        }
      }
      /**
       * Stop watching vault
       */
      stopWatch() {
        this._isWatching = false;
        for (const timer of this.debounceTimers.values()) {
          clearTimeout(timer);
        }
        this.debounceTimers.clear();
        Logger("Storage event manager stopped", LOG_LEVEL_VERBOSE);
      }
      /**
       * Start watching vault
       */
      startWatch() {
        this._isWatching = true;
        Logger("Storage event manager started", LOG_LEVEL_VERBOSE);
      }
      /**
       * Suspend file watching (LiveSync's suspendFileWatching pattern)
       * Used when processing remote updates to prevent feedback loops
       */
      suspend() {
        this._isSuspended = true;
        Logger("\u{1F4DB} File watching suspended (processing remote updates)", LOG_LEVEL_VERBOSE);
      }
      /**
       * Resume file watching after processing remote updates
       */
      resume() {
        this._isSuspended = false;
        Logger("\u2705 File watching resumed", LOG_LEVEL_VERBOSE);
      }
      /**
       * Check if we should process vault events
       * Implements LiveSync's suspendFileWatching safety valve
       */
      shouldProcessEvent() {
        if (!this._isWatching) {
          return false;
        }
        return !this._isSuspended;
      }
      // ==================== Event Handlers ====================
      watchVaultCreate(file) {
        if (!this.shouldProcessEvent()) {
          Logger(`File create skipped (watching suspended): ${file.path}`, LOG_LEVEL_DEBUG);
          return;
        }
        if (file instanceof import_obsidian2.TFolder) return;
        if (this.isFileProcessing(file.path)) {
          Logger(`File create skipped (being processed): ${file.path}`, LOG_LEVEL_VERBOSE);
          return;
        }
        this.enqueueEvent({
          type: "CREATE",
          path: file.path,
          file,
          mtime: file.stat.mtime,
          size: file.stat.size
        });
      }
      watchVaultChange(file) {
        if (!this.shouldProcessEvent()) {
          Logger(`File change skipped (watching suspended): ${file.path}`, LOG_LEVEL_DEBUG);
          return;
        }
        if (file instanceof import_obsidian2.TFolder) return;
        if (this.isFileProcessing(file.path)) {
          Logger(`File change skipped (being processed): ${file.path}`, LOG_LEVEL_VERBOSE);
          return;
        }
        this.debouncedEnqueue({
          type: "CHANGED",
          path: file.path,
          file,
          mtime: file.stat.mtime,
          size: file.stat.size
        });
      }
      watchVaultDelete(file) {
        if (!this.shouldProcessEvent()) {
          Logger(`File delete skipped (watching suspended): ${file.path}`, LOG_LEVEL_DEBUG);
          return;
        }
        if (file instanceof import_obsidian2.TFolder) return;
        if (this.isFileProcessing(file.path)) {
          Logger(`File delete skipped (being processed): ${file.path}`, LOG_LEVEL_VERBOSE);
          return;
        }
        const existingTimer = this.debounceTimers.get(file.path);
        if (existingTimer) {
          clearTimeout(existingTimer);
          this.debounceTimers.delete(file.path);
        }
        this.enqueueEvent({
          type: "DELETE",
          path: file.path
        });
      }
      watchVaultRename(file, oldPath) {
        if (!this.shouldProcessEvent()) {
          Logger(`File rename skipped (watching suspended): ${oldPath} -> ${file.path}`, LOG_LEVEL_DEBUG);
          return;
        }
        if (file instanceof import_obsidian2.TFolder) return;
        this.enqueueEvent({
          type: "DELETE",
          path: oldPath
        });
        this.enqueueEvent({
          type: "CREATE",
          path: file.path,
          file,
          mtime: file.stat.mtime,
          size: file.stat.size
        });
      }
      // ==================== Event Queue Processing ====================
      debouncedEnqueue(event2) {
        const path8 = event2.path;
        const existingTimer = this.debounceTimers.get(path8);
        if (existingTimer) {
          clearTimeout(existingTimer);
        }
        const timer = setTimeout(() => {
          this.debounceTimers.delete(path8);
          this.enqueueEvent(event2);
        }, this.DEBOUNCE_DELAY);
        this.debounceTimers.set(path8, timer);
      }
      enqueueEvent(event2) {
        if (shouldBeIgnored(event2.path)) {
          Logger(`File ignored: ${event2.path}`, LOG_LEVEL_VERBOSE);
          return;
        }
        if (!this.core.localDatabase) {
          Logger(`Database not ready, skipping event for: ${event2.path}`, LOG_LEVEL_VERBOSE);
          return;
        }
        this.eventQueue.push(event2);
        fireAndForget(() => this.processQueue());
      }
      async processQueue() {
        if (this.isProcessingQueue) return;
        this.isProcessingQueue = true;
        try {
          while (this.eventQueue.length > 0) {
            const event2 = this.eventQueue.shift();
            await this.processEvent(event2);
          }
        } finally {
          this.isProcessingQueue = false;
        }
      }
      async processEvent(event2) {
        try {
          if (event2.type === "CREATE" || event2.type === "CHANGED") {
            if (event2.file) {
              await new Promise((resolve) => setTimeout(resolve, 10));
              if (this.recentlyTouched(event2.file)) {
                Logger(`File recently touched by us, skipping: ${event2.path}`, LOG_LEVEL_VERBOSE);
                return true;
              }
            }
          }
          if (!await this.core.isTargetFile(event2.path)) {
            Logger(`File ignored by ignore patterns: ${event2.path}`, LOG_LEVEL_VERBOSE);
            return true;
          }
          if (event2.type !== "DELETE" && event2.mtime !== void 0) {
            const cacheKey = `${event2.type}-${event2.path}`;
            const lastMtime = this.lastProcessedMtime.get(cacheKey);
            if (lastMtime !== void 0 && lastMtime === event2.mtime) {
              Logger(`File already processed at this mtime, skip: ${event2.path}`, LOG_LEVEL_VERBOSE);
              return true;
            }
          }
          switch (event2.type) {
            case "CREATE":
            case "CHANGED":
              return await this.storeFileToDB(event2);
            case "DELETE":
              return await this.deleteFileFromDB(event2);
            default:
              Logger(`Unknown event type: ${event2.type}`, LOG_LEVEL_VERBOSE);
              return false;
          }
        } catch (error2) {
          Logger(`Error processing event ${event2.type} for ${event2.path}: ${error2}`, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
      * Process a file event directly, bypassing queue and debounce
      *
      * Used by rebuildRemote() to scan and store all vault files at once.
      * This is a public method that allows direct file processing.
      *
      * @param event
      * @param force - If true, skip content comparison and force write
      */
      async processFileEventDirect(event2, force = false) {
        if (this.isFileProcessing(event2.path)) {
          return true;
        }
        if (shouldBeIgnored(event2.path)) {
          return true;
        }
        if (!await this.core.isTargetFile(event2.path)) {
          Logger(`File ignored by ignore patterns: ${event2.path}`, LOG_LEVEL_VERBOSE);
          return true;
        }
        return await this.storeFileToDB(event2, force);
      }
      // ==================== Database Operations ====================
      /**
       * Store a file to the local database
       * This follows livesync's pattern: file -> SavingEntry -> localDatabase.putDBEntry
       * 
       * Key features from livesync:
       * 1. Check if file exists in DB first
       * 2. Compare mtime (with resolution) 
       * 3. Compare content if mtime suggests change
       * 4. Only write if content actually changed
       * 
       * @param event - The file event to process
       * @param force - If true, skip comparison and force write
       */
      async storeFileToDB(event2, force = false) {
        const path8 = event2.path;
        const file = event2.file || this.plugin.app.vault.getAbstractFileByPath(path8);
        if (!file || !(file instanceof import_obsidian2.TFile)) {
          Logger(`File not found for storage: ${path8}`, LOG_LEVEL_VERBOSE);
          return false;
        }
        const localDB = this.core.localDatabase;
        if (!localDB) {
          Logger(`Local database not available`, LOG_LEVEL_VERBOSE);
          return false;
        }
        try {
          const id = await this.core.path2id(path8);
          const isText = this.isTextFile(file);
          let contentBlob;
          if (isText) {
            const textContent = await this.plugin.app.vault.read(file);
            contentBlob = createTextBlob(textContent);
          } else {
            const binaryContent = await this.plugin.app.vault.readBinary(file);
            contentBlob = createBinaryBlob(binaryContent);
          }
          if (!force) {
            try {
              const existingEntry = await localDB.getDBEntry(path8, void 0, false, true, false);
              if (existingEntry && !existingEntry.deleted && !existingEntry._deleted) {
                let shouldUpdate = false;
                const freshnessResult = compareFileFreshness(
                  { path: path8, mtime: file.stat.mtime },
                  { path: path8, mtime: existingEntry.mtime }
                );
                switch (freshnessResult) {
                  case "EVEN":
                    Logger(`File mtimes are equivalent (marked or same), skip: ${path8}`, LOG_LEVEL_VERBOSE);
                    const cacheKey = `${event2.type}-${path8}`;
                    this.lastProcessedMtime.set(cacheKey, file.stat.mtime);
                    return true;
                  case "BASE_IS_NEW":
                  case "TARGET_IS_NEW":
                    shouldUpdate = true;
                    break;
                }
                if (shouldUpdate) {
                  const existingData = getDocDataAsArray(existingEntry.data);
                  const isSame = await isDocContentSame(existingData, contentBlob);
                  if (isSame) {
                    markChangesAreSame2(path8, file.stat.mtime, existingEntry.mtime);
                    Logger(`File content unchanged (mtime different), marked as same: ${path8}`, LOG_LEVEL_VERBOSE);
                    const cacheKey = `${event2.type}-${path8}`;
                    this.lastProcessedMtime.set(cacheKey, file.stat.mtime);
                    return true;
                  } else {
                    unmarkChanges2(path8);
                  }
                }
              }
              Logger(`File changed, updating: ${path8}`, LOG_LEVEL_VERBOSE);
            } catch (e2) {
              Logger(`Entry not found or error, creating: ${path8}`, LOG_LEVEL_VERBOSE);
            }
          }
          const datatype = determineTypeFromBlob(contentBlob);
          const savingEntry = {
            _id: id,
            path: path8,
            data: contentBlob,
            // Must be Blob!
            ctime: file.stat.ctime,
            mtime: file.stat.mtime,
            size: file.stat.size,
            children: [],
            datatype,
            type: datatype,
            eden: {}
          };
          const result = await localDB.putDBEntry(savingEntry);
          if (result !== false) {
            const cacheKey = `${event2.type}-${path8}`;
            this.lastProcessedMtime.set(cacheKey, file.stat.mtime);
            Logger(`STORAGE -> DB (${datatype}) ${path8}`);
            return true;
          } else {
            Logger(`Failed to store: ${path8}`, LOG_LEVEL_INFO);
            return false;
          }
        } catch (error2) {
          Logger(`Error storing file ${path8}: ${error2}`, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Delete a file from the local database
       */
      async deleteFileFromDB(event2) {
        const path8 = event2.path;
        const localDB = this.core.localDatabase;
        if (!localDB) {
          Logger(`Local database not available`, LOG_LEVEL_VERBOSE);
          return false;
        }
        try {
          const result = await localDB.deleteDBEntry(path8);
          if (result) {
            this.lastProcessedMtime.delete(`CREATE-${path8}`);
            this.lastProcessedMtime.delete(`CHANGED-${path8}`);
            Logger(`STORAGE -> DB (delete): ${path8}`, LOG_LEVEL_VERBOSE);
            return true;
          } else {
            Logger(`Failed to delete from DB: ${path8}`, LOG_LEVEL_VERBOSE);
            return false;
          }
        } catch (error2) {
          Logger(`Error deleting file ${path8} from DB: ${error2}`, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Check if a file is a text file based on extension
       */
      isTextFile(file) {
        const textExtensions = [
          "md",
          "txt",
          "json",
          "js",
          "ts",
          "css",
          "html",
          "xml",
          "yaml",
          "yml",
          "toml",
          "csv",
          "svg",
          "canvas"
        ];
        return textExtensions.includes(file.extension.toLowerCase());
      }
      /**
       * Wait until the event queue is empty
       */
      async waitForIdle() {
        while (this.eventQueue.length > 0 || this.isProcessingQueue) {
          await new Promise((resolve) => setTimeout(resolve, 100));
        }
      }
      /**
       * Get queue status for debugging
       */
      getStatus() {
        return {
          queueLength: this.eventQueue.length,
          isProcessing: this.isProcessingQueue,
          touchedCount: this.touchedFiles.length
        };
      }
    };
  }
});

// node_modules/pouchdb-errors/lib/index.es.js
function createError(error2, reason) {
  function CustomPouchError(reason2) {
    var names = Object.getOwnPropertyNames(error2);
    for (var i = 0, len = names.length; i < len; i++) {
      if (typeof error2[names[i]] !== "function") {
        this[names[i]] = error2[names[i]];
      }
    }
    if (this.stack === void 0) {
      this.stack = new Error().stack;
    }
    if (reason2 !== void 0) {
      this.reason = reason2;
    }
  }
  CustomPouchError.prototype = PouchError.prototype;
  return new CustomPouchError(reason);
}
function generateErrorFromResponse(err2) {
  if (typeof err2 !== "object") {
    var data = err2;
    err2 = UNKNOWN_ERROR;
    err2.data = data;
  }
  if ("error" in err2 && err2.error === "conflict") {
    err2.name = "conflict";
    err2.status = 409;
  }
  if (!("name" in err2)) {
    err2.name = err2.error || "unknown";
  }
  if (!("status" in err2)) {
    err2.status = 500;
  }
  if (!("message" in err2)) {
    err2.message = err2.message || err2.reason;
  }
  if (!("stack" in err2)) {
    err2.stack = new Error().stack;
  }
  return err2;
}
var PouchError, UNAUTHORIZED, MISSING_BULK_DOCS, MISSING_DOC, REV_CONFLICT, INVALID_ID, MISSING_ID, RESERVED_ID, NOT_OPEN, UNKNOWN_ERROR, BAD_ARG, INVALID_REQUEST, QUERY_PARSE_ERROR, DOC_VALIDATION, BAD_REQUEST, NOT_AN_OBJECT, DB_MISSING, IDB_ERROR, WSQ_ERROR, LDB_ERROR, FORBIDDEN, INVALID_REV, FILE_EXISTS, MISSING_STUB, INVALID_URL;
var init_index_es = __esm({
  "node_modules/pouchdb-errors/lib/index.es.js"() {
    PouchError = class extends Error {
      constructor(status, error2, reason) {
        super();
        this.status = status;
        this.name = error2;
        this.message = reason;
        this.error = true;
      }
      toString() {
        return JSON.stringify({
          status: this.status,
          name: this.name,
          message: this.message,
          reason: this.reason
        });
      }
    };
    UNAUTHORIZED = new PouchError(401, "unauthorized", "Name or password is incorrect.");
    MISSING_BULK_DOCS = new PouchError(400, "bad_request", "Missing JSON list of 'docs'");
    MISSING_DOC = new PouchError(404, "not_found", "missing");
    REV_CONFLICT = new PouchError(409, "conflict", "Document update conflict");
    INVALID_ID = new PouchError(400, "bad_request", "_id field must contain a string");
    MISSING_ID = new PouchError(412, "missing_id", "_id is required for puts");
    RESERVED_ID = new PouchError(400, "bad_request", "Only reserved document ids may start with underscore.");
    NOT_OPEN = new PouchError(412, "precondition_failed", "Database not open");
    UNKNOWN_ERROR = new PouchError(500, "unknown_error", "Database encountered an unknown error");
    BAD_ARG = new PouchError(500, "badarg", "Some query argument is invalid");
    INVALID_REQUEST = new PouchError(400, "invalid_request", "Request was invalid");
    QUERY_PARSE_ERROR = new PouchError(400, "query_parse_error", "Some query parameter is invalid");
    DOC_VALIDATION = new PouchError(500, "doc_validation", "Bad special document member");
    BAD_REQUEST = new PouchError(400, "bad_request", "Something wrong with the request");
    NOT_AN_OBJECT = new PouchError(400, "bad_request", "Document must be a JSON object");
    DB_MISSING = new PouchError(404, "not_found", "Database not found");
    IDB_ERROR = new PouchError(500, "indexed_db_went_bad", "unknown");
    WSQ_ERROR = new PouchError(500, "web_sql_went_bad", "unknown");
    LDB_ERROR = new PouchError(500, "levelDB_went_went_bad", "unknown");
    FORBIDDEN = new PouchError(403, "forbidden", "Forbidden by design doc validate_doc_update function");
    INVALID_REV = new PouchError(400, "bad_request", "Invalid rev format");
    FILE_EXISTS = new PouchError(412, "file_exists", "The database could not be created, the file already exists.");
    MISSING_STUB = new PouchError(412, "missing_stub", "A pre-existing attachment stub wasn't found");
    INVALID_URL = new PouchError(413, "invalid_url", "Provided URL is invalid");
  }
});

// node_modules/events/events.js
var require_events = __commonJS({
  "node_modules/events/events.js"(exports2, module2) {
    "use strict";
    var R = typeof Reflect === "object" ? Reflect : null;
    var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
      return Function.prototype.apply.call(target, receiver, args);
    };
    var ReflectOwnKeys;
    if (R && typeof R.ownKeys === "function") {
      ReflectOwnKeys = R.ownKeys;
    } else if (Object.getOwnPropertySymbols) {
      ReflectOwnKeys = function ReflectOwnKeys2(target) {
        return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
      };
    } else {
      ReflectOwnKeys = function ReflectOwnKeys2(target) {
        return Object.getOwnPropertyNames(target);
      };
    }
    function ProcessEmitWarning(warning) {
      if (console && console.warn) console.warn(warning);
    }
    var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value2) {
      return value2 !== value2;
    };
    function EventEmitter2() {
      EventEmitter2.init.call(this);
    }
    module2.exports = EventEmitter2;
    module2.exports.once = once3;
    EventEmitter2.EventEmitter = EventEmitter2;
    EventEmitter2.prototype._events = void 0;
    EventEmitter2.prototype._eventsCount = 0;
    EventEmitter2.prototype._maxListeners = void 0;
    var defaultMaxListeners = 10;
    function checkListener(listener) {
      if (typeof listener !== "function") {
        throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
      }
    }
    Object.defineProperty(EventEmitter2, "defaultMaxListeners", {
      enumerable: true,
      get: function() {
        return defaultMaxListeners;
      },
      set: function(arg) {
        if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
          throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
        }
        defaultMaxListeners = arg;
      }
    });
    EventEmitter2.init = function() {
      if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
        this._events = /* @__PURE__ */ Object.create(null);
        this._eventsCount = 0;
      }
      this._maxListeners = this._maxListeners || void 0;
    };
    EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n3) {
      if (typeof n3 !== "number" || n3 < 0 || NumberIsNaN(n3)) {
        throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n3 + ".");
      }
      this._maxListeners = n3;
      return this;
    };
    function _getMaxListeners(that) {
      if (that._maxListeners === void 0)
        return EventEmitter2.defaultMaxListeners;
      return that._maxListeners;
    }
    EventEmitter2.prototype.getMaxListeners = function getMaxListeners() {
      return _getMaxListeners(this);
    };
    EventEmitter2.prototype.emit = function emit(type) {
      var args = [];
      for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
      var doError = type === "error";
      var events = this._events;
      if (events !== void 0)
        doError = doError && events.error === void 0;
      else if (!doError)
        return false;
      if (doError) {
        var er;
        if (args.length > 0)
          er = args[0];
        if (er instanceof Error) {
          throw er;
        }
        var err2 = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
        err2.context = er;
        throw err2;
      }
      var handler = events[type];
      if (handler === void 0)
        return false;
      if (typeof handler === "function") {
        ReflectApply(handler, this, args);
      } else {
        var len = handler.length;
        var listeners = arrayClone(handler, len);
        for (var i = 0; i < len; ++i)
          ReflectApply(listeners[i], this, args);
      }
      return true;
    };
    function _addListener(target, type, listener, prepend) {
      var m2;
      var events;
      var existing;
      checkListener(listener);
      events = target._events;
      if (events === void 0) {
        events = target._events = /* @__PURE__ */ Object.create(null);
        target._eventsCount = 0;
      } else {
        if (events.newListener !== void 0) {
          target.emit(
            "newListener",
            type,
            listener.listener ? listener.listener : listener
          );
          events = target._events;
        }
        existing = events[type];
      }
      if (existing === void 0) {
        existing = events[type] = listener;
        ++target._eventsCount;
      } else {
        if (typeof existing === "function") {
          existing = events[type] = prepend ? [listener, existing] : [existing, listener];
        } else if (prepend) {
          existing.unshift(listener);
        } else {
          existing.push(listener);
        }
        m2 = _getMaxListeners(target);
        if (m2 > 0 && existing.length > m2 && !existing.warned) {
          existing.warned = true;
          var w2 = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
          w2.name = "MaxListenersExceededWarning";
          w2.emitter = target;
          w2.type = type;
          w2.count = existing.length;
          ProcessEmitWarning(w2);
        }
      }
      return target;
    }
    EventEmitter2.prototype.addListener = function addListener(type, listener) {
      return _addListener(this, type, listener, false);
    };
    EventEmitter2.prototype.on = EventEmitter2.prototype.addListener;
    EventEmitter2.prototype.prependListener = function prependListener(type, listener) {
      return _addListener(this, type, listener, true);
    };
    function onceWrapper() {
      if (!this.fired) {
        this.target.removeListener(this.type, this.wrapFn);
        this.fired = true;
        if (arguments.length === 0)
          return this.listener.call(this.target);
        return this.listener.apply(this.target, arguments);
      }
    }
    function _onceWrap(target, type, listener) {
      var state2 = { fired: false, wrapFn: void 0, target, type, listener };
      var wrapped = onceWrapper.bind(state2);
      wrapped.listener = listener;
      state2.wrapFn = wrapped;
      return wrapped;
    }
    EventEmitter2.prototype.once = function once4(type, listener) {
      checkListener(listener);
      this.on(type, _onceWrap(this, type, listener));
      return this;
    };
    EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type, listener) {
      checkListener(listener);
      this.prependListener(type, _onceWrap(this, type, listener));
      return this;
    };
    EventEmitter2.prototype.removeListener = function removeListener(type, listener) {
      var list, events, position, i, originalListener;
      checkListener(listener);
      events = this._events;
      if (events === void 0)
        return this;
      list = events[type];
      if (list === void 0)
        return this;
      if (list === listener || list.listener === listener) {
        if (--this._eventsCount === 0)
          this._events = /* @__PURE__ */ Object.create(null);
        else {
          delete events[type];
          if (events.removeListener)
            this.emit("removeListener", type, list.listener || listener);
        }
      } else if (typeof list !== "function") {
        position = -1;
        for (i = list.length - 1; i >= 0; i--) {
          if (list[i] === listener || list[i].listener === listener) {
            originalListener = list[i].listener;
            position = i;
            break;
          }
        }
        if (position < 0)
          return this;
        if (position === 0)
          list.shift();
        else {
          spliceOne(list, position);
        }
        if (list.length === 1)
          events[type] = list[0];
        if (events.removeListener !== void 0)
          this.emit("removeListener", type, originalListener || listener);
      }
      return this;
    };
    EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
    EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type) {
      var listeners, events, i;
      events = this._events;
      if (events === void 0)
        return this;
      if (events.removeListener === void 0) {
        if (arguments.length === 0) {
          this._events = /* @__PURE__ */ Object.create(null);
          this._eventsCount = 0;
        } else if (events[type] !== void 0) {
          if (--this._eventsCount === 0)
            this._events = /* @__PURE__ */ Object.create(null);
          else
            delete events[type];
        }
        return this;
      }
      if (arguments.length === 0) {
        var keys2 = Object.keys(events);
        var key4;
        for (i = 0; i < keys2.length; ++i) {
          key4 = keys2[i];
          if (key4 === "removeListener") continue;
          this.removeAllListeners(key4);
        }
        this.removeAllListeners("removeListener");
        this._events = /* @__PURE__ */ Object.create(null);
        this._eventsCount = 0;
        return this;
      }
      listeners = events[type];
      if (typeof listeners === "function") {
        this.removeListener(type, listeners);
      } else if (listeners !== void 0) {
        for (i = listeners.length - 1; i >= 0; i--) {
          this.removeListener(type, listeners[i]);
        }
      }
      return this;
    };
    function _listeners(target, type, unwrap) {
      var events = target._events;
      if (events === void 0)
        return [];
      var evlistener = events[type];
      if (evlistener === void 0)
        return [];
      if (typeof evlistener === "function")
        return unwrap ? [evlistener.listener || evlistener] : [evlistener];
      return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
    }
    EventEmitter2.prototype.listeners = function listeners(type) {
      return _listeners(this, type, true);
    };
    EventEmitter2.prototype.rawListeners = function rawListeners(type) {
      return _listeners(this, type, false);
    };
    EventEmitter2.listenerCount = function(emitter, type) {
      if (typeof emitter.listenerCount === "function") {
        return emitter.listenerCount(type);
      } else {
        return listenerCount2.call(emitter, type);
      }
    };
    EventEmitter2.prototype.listenerCount = listenerCount2;
    function listenerCount2(type) {
      var events = this._events;
      if (events !== void 0) {
        var evlistener = events[type];
        if (typeof evlistener === "function") {
          return 1;
        } else if (evlistener !== void 0) {
          return evlistener.length;
        }
      }
      return 0;
    }
    EventEmitter2.prototype.eventNames = function eventNames() {
      return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
    };
    function arrayClone(arr, n3) {
      var copy = new Array(n3);
      for (var i = 0; i < n3; ++i)
        copy[i] = arr[i];
      return copy;
    }
    function spliceOne(list, index6) {
      for (; index6 + 1 < list.length; index6++)
        list[index6] = list[index6 + 1];
      list.pop();
    }
    function unwrapListeners(arr) {
      var ret = new Array(arr.length);
      for (var i = 0; i < ret.length; ++i) {
        ret[i] = arr[i].listener || arr[i];
      }
      return ret;
    }
    function once3(emitter, name) {
      return new Promise(function(resolve, reject) {
        function errorListener(err2) {
          emitter.removeListener(name, resolver);
          reject(err2);
        }
        function resolver() {
          if (typeof emitter.removeListener === "function") {
            emitter.removeListener("error", errorListener);
          }
          resolve([].slice.call(arguments));
        }
        ;
        eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
        if (name !== "error") {
          addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
        }
      });
    }
    function addErrorHandlerIfEventEmitter(emitter, handler, flags2) {
      if (typeof emitter.on === "function") {
        eventTargetAgnosticAddListener(emitter, "error", handler, flags2);
      }
    }
    function eventTargetAgnosticAddListener(emitter, name, listener, flags2) {
      if (typeof emitter.on === "function") {
        if (flags2.once) {
          emitter.once(name, listener);
        } else {
          emitter.on(name, listener);
        }
      } else if (typeof emitter.addEventListener === "function") {
        emitter.addEventListener(name, function wrapListener(arg) {
          if (flags2.once) {
            emitter.removeEventListener(name, wrapListener);
          }
          listener(arg);
        });
      } else {
        throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
      }
    }
  }
});

// node_modules/uuid/dist/esm-browser/rng.js
function rng() {
  if (!getRandomValues) {
    getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
    if (!getRandomValues) {
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    }
  }
  return getRandomValues(rnds8);
}
var getRandomValues, rnds8;
var init_rng = __esm({
  "node_modules/uuid/dist/esm-browser/rng.js"() {
    rnds8 = new Uint8Array(16);
  }
});

// node_modules/uuid/dist/esm-browser/regex.js
var regex_default;
var init_regex = __esm({
  "node_modules/uuid/dist/esm-browser/regex.js"() {
    regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
  }
});

// node_modules/uuid/dist/esm-browser/validate.js
function validate(uuid2) {
  return typeof uuid2 === "string" && regex_default.test(uuid2);
}
var validate_default;
var init_validate = __esm({
  "node_modules/uuid/dist/esm-browser/validate.js"() {
    init_regex();
    validate_default = validate;
  }
});

// node_modules/uuid/dist/esm-browser/stringify.js
function stringify(arr) {
  var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var uuid2 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
  if (!validate_default(uuid2)) {
    throw TypeError("Stringified UUID is invalid");
  }
  return uuid2;
}
var byteToHex, i, stringify_default;
var init_stringify = __esm({
  "node_modules/uuid/dist/esm-browser/stringify.js"() {
    init_validate();
    byteToHex = [];
    for (i = 0; i < 256; ++i) {
      byteToHex.push((i + 256).toString(16).substr(1));
    }
    stringify_default = stringify;
  }
});

// node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
  options = options || {};
  var rnds = options.random || (options.rng || rng)();
  rnds[6] = rnds[6] & 15 | 64;
  rnds[8] = rnds[8] & 63 | 128;
  if (buf) {
    offset = offset || 0;
    for (var i = 0; i < 16; ++i) {
      buf[offset + i] = rnds[i];
    }
    return buf;
  }
  return stringify_default(rnds);
}
var v4_default;
var init_v4 = __esm({
  "node_modules/uuid/dist/esm-browser/v4.js"() {
    init_rng();
    init_stringify();
    v4_default = v4;
  }
});

// node_modules/uuid/dist/esm-browser/index.js
var init_esm_browser = __esm({
  "node_modules/uuid/dist/esm-browser/index.js"() {
    init_v4();
  }
});

// node_modules/pouchdb-binary-utils/lib/index-browser.es.js
function createBlob2(parts, properties) {
  parts = parts || [];
  properties = properties || {};
  try {
    return new Blob(parts, properties);
  } catch (e2) {
    if (e2.name !== "TypeError") {
      throw e2;
    }
    var Builder = typeof BlobBuilder !== "undefined" ? BlobBuilder : typeof MSBlobBuilder !== "undefined" ? MSBlobBuilder : typeof MozBlobBuilder !== "undefined" ? MozBlobBuilder : WebKitBlobBuilder;
    var builder = new Builder();
    for (var i = 0; i < parts.length; i += 1) {
      builder.append(parts[i]);
    }
    return builder.getBlob(properties.type);
  }
}
function binaryStringToArrayBuffer(bin) {
  var length = bin.length;
  var buf = new ArrayBuffer(length);
  var arr = new Uint8Array(buf);
  for (var i = 0; i < length; i++) {
    arr[i] = bin.charCodeAt(i);
  }
  return buf;
}
function binStringToBluffer(binString, type) {
  return createBlob2([binaryStringToArrayBuffer(binString)], { type });
}
function b64ToBluffer(b64, type) {
  return binStringToBluffer(thisAtob(b64), type);
}
function arrayBufferToBinaryString(buffer) {
  var binary = "";
  var bytes = new Uint8Array(buffer);
  var length = bytes.byteLength;
  for (var i = 0; i < length; i++) {
    binary += String.fromCharCode(bytes[i]);
  }
  return binary;
}
function readAsBinaryString(blob, callback) {
  var reader = new FileReader();
  var hasBinaryString = typeof reader.readAsBinaryString === "function";
  reader.onloadend = function(e2) {
    var result = e2.target.result || "";
    if (hasBinaryString) {
      return callback(result);
    }
    callback(arrayBufferToBinaryString(result));
  };
  if (hasBinaryString) {
    reader.readAsBinaryString(blob);
  } else {
    reader.readAsArrayBuffer(blob);
  }
}
function blobToBinaryString(blobOrBuffer, callback) {
  readAsBinaryString(blobOrBuffer, function(bin) {
    callback(bin);
  });
}
function blobToBase64(blobOrBuffer, callback) {
  blobToBinaryString(blobOrBuffer, function(base64) {
    callback(thisBtoa(base64));
  });
}
function readAsArrayBuffer(blob, callback) {
  var reader = new FileReader();
  reader.onloadend = function(e2) {
    var result = e2.target.result || new ArrayBuffer(0);
    callback(result);
  };
  reader.readAsArrayBuffer(blob);
}
var thisAtob, thisBtoa;
var init_index_browser_es = __esm({
  "node_modules/pouchdb-binary-utils/lib/index-browser.es.js"() {
    thisAtob = function(str) {
      return atob(str);
    };
    thisBtoa = function(str) {
      return btoa(str);
    };
  }
});

// node_modules/spark-md5/spark-md5.js
var require_spark_md5 = __commonJS({
  "node_modules/spark-md5/spark-md5.js"(exports2, module2) {
    (function(factory) {
      if (typeof exports2 === "object") {
        module2.exports = factory();
      } else if (typeof define === "function" && define.amd) {
        define(factory);
      } else {
        var glob;
        try {
          glob = window;
        } catch (e2) {
          glob = self;
        }
        glob.SparkMD5 = factory();
      }
    })(function(undefined2) {
      "use strict";
      var add32 = function(a, b) {
        return a + b & 4294967295;
      }, hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
      function cmn(q, a, b, x, s, t2) {
        a = add32(add32(a, q), add32(x, t2));
        return add32(a << s | a >>> 32 - s, b);
      }
      function md5cycle(x, k) {
        var a = x[0], b = x[1], c = x[2], d = x[3];
        a += (b & c | ~b & d) + k[0] - 680876936 | 0;
        a = (a << 7 | a >>> 25) + b | 0;
        d += (a & b | ~a & c) + k[1] - 389564586 | 0;
        d = (d << 12 | d >>> 20) + a | 0;
        c += (d & a | ~d & b) + k[2] + 606105819 | 0;
        c = (c << 17 | c >>> 15) + d | 0;
        b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
        b = (b << 22 | b >>> 10) + c | 0;
        a += (b & c | ~b & d) + k[4] - 176418897 | 0;
        a = (a << 7 | a >>> 25) + b | 0;
        d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
        d = (d << 12 | d >>> 20) + a | 0;
        c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
        c = (c << 17 | c >>> 15) + d | 0;
        b += (c & d | ~c & a) + k[7] - 45705983 | 0;
        b = (b << 22 | b >>> 10) + c | 0;
        a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
        a = (a << 7 | a >>> 25) + b | 0;
        d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
        d = (d << 12 | d >>> 20) + a | 0;
        c += (d & a | ~d & b) + k[10] - 42063 | 0;
        c = (c << 17 | c >>> 15) + d | 0;
        b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
        b = (b << 22 | b >>> 10) + c | 0;
        a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
        a = (a << 7 | a >>> 25) + b | 0;
        d += (a & b | ~a & c) + k[13] - 40341101 | 0;
        d = (d << 12 | d >>> 20) + a | 0;
        c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
        c = (c << 17 | c >>> 15) + d | 0;
        b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
        b = (b << 22 | b >>> 10) + c | 0;
        a += (b & d | c & ~d) + k[1] - 165796510 | 0;
        a = (a << 5 | a >>> 27) + b | 0;
        d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
        d = (d << 9 | d >>> 23) + a | 0;
        c += (d & b | a & ~b) + k[11] + 643717713 | 0;
        c = (c << 14 | c >>> 18) + d | 0;
        b += (c & a | d & ~a) + k[0] - 373897302 | 0;
        b = (b << 20 | b >>> 12) + c | 0;
        a += (b & d | c & ~d) + k[5] - 701558691 | 0;
        a = (a << 5 | a >>> 27) + b | 0;
        d += (a & c | b & ~c) + k[10] + 38016083 | 0;
        d = (d << 9 | d >>> 23) + a | 0;
        c += (d & b | a & ~b) + k[15] - 660478335 | 0;
        c = (c << 14 | c >>> 18) + d | 0;
        b += (c & a | d & ~a) + k[4] - 405537848 | 0;
        b = (b << 20 | b >>> 12) + c | 0;
        a += (b & d | c & ~d) + k[9] + 568446438 | 0;
        a = (a << 5 | a >>> 27) + b | 0;
        d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
        d = (d << 9 | d >>> 23) + a | 0;
        c += (d & b | a & ~b) + k[3] - 187363961 | 0;
        c = (c << 14 | c >>> 18) + d | 0;
        b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
        b = (b << 20 | b >>> 12) + c | 0;
        a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
        a = (a << 5 | a >>> 27) + b | 0;
        d += (a & c | b & ~c) + k[2] - 51403784 | 0;
        d = (d << 9 | d >>> 23) + a | 0;
        c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
        c = (c << 14 | c >>> 18) + d | 0;
        b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
        b = (b << 20 | b >>> 12) + c | 0;
        a += (b ^ c ^ d) + k[5] - 378558 | 0;
        a = (a << 4 | a >>> 28) + b | 0;
        d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
        d = (d << 11 | d >>> 21) + a | 0;
        c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
        c = (c << 16 | c >>> 16) + d | 0;
        b += (c ^ d ^ a) + k[14] - 35309556 | 0;
        b = (b << 23 | b >>> 9) + c | 0;
        a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
        a = (a << 4 | a >>> 28) + b | 0;
        d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
        d = (d << 11 | d >>> 21) + a | 0;
        c += (d ^ a ^ b) + k[7] - 155497632 | 0;
        c = (c << 16 | c >>> 16) + d | 0;
        b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
        b = (b << 23 | b >>> 9) + c | 0;
        a += (b ^ c ^ d) + k[13] + 681279174 | 0;
        a = (a << 4 | a >>> 28) + b | 0;
        d += (a ^ b ^ c) + k[0] - 358537222 | 0;
        d = (d << 11 | d >>> 21) + a | 0;
        c += (d ^ a ^ b) + k[3] - 722521979 | 0;
        c = (c << 16 | c >>> 16) + d | 0;
        b += (c ^ d ^ a) + k[6] + 76029189 | 0;
        b = (b << 23 | b >>> 9) + c | 0;
        a += (b ^ c ^ d) + k[9] - 640364487 | 0;
        a = (a << 4 | a >>> 28) + b | 0;
        d += (a ^ b ^ c) + k[12] - 421815835 | 0;
        d = (d << 11 | d >>> 21) + a | 0;
        c += (d ^ a ^ b) + k[15] + 530742520 | 0;
        c = (c << 16 | c >>> 16) + d | 0;
        b += (c ^ d ^ a) + k[2] - 995338651 | 0;
        b = (b << 23 | b >>> 9) + c | 0;
        a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
        a = (a << 6 | a >>> 26) + b | 0;
        d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
        d = (d << 10 | d >>> 22) + a | 0;
        c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
        c = (c << 15 | c >>> 17) + d | 0;
        b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
        b = (b << 21 | b >>> 11) + c | 0;
        a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
        a = (a << 6 | a >>> 26) + b | 0;
        d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
        d = (d << 10 | d >>> 22) + a | 0;
        c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
        c = (c << 15 | c >>> 17) + d | 0;
        b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
        b = (b << 21 | b >>> 11) + c | 0;
        a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
        a = (a << 6 | a >>> 26) + b | 0;
        d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
        d = (d << 10 | d >>> 22) + a | 0;
        c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
        c = (c << 15 | c >>> 17) + d | 0;
        b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
        b = (b << 21 | b >>> 11) + c | 0;
        a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
        a = (a << 6 | a >>> 26) + b | 0;
        d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
        d = (d << 10 | d >>> 22) + a | 0;
        c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
        c = (c << 15 | c >>> 17) + d | 0;
        b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
        b = (b << 21 | b >>> 11) + c | 0;
        x[0] = a + x[0] | 0;
        x[1] = b + x[1] | 0;
        x[2] = c + x[2] | 0;
        x[3] = d + x[3] | 0;
      }
      function md5blk(s) {
        var md5blks = [], i;
        for (i = 0; i < 64; i += 4) {
          md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
        }
        return md5blks;
      }
      function md5blk_array(a) {
        var md5blks = [], i;
        for (i = 0; i < 64; i += 4) {
          md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
        }
        return md5blks;
      }
      function md51(s) {
        var n3 = s.length, state2 = [1732584193, -271733879, -1732584194, 271733878], i, length, tail, tmp, lo, hi;
        for (i = 64; i <= n3; i += 64) {
          md5cycle(state2, md5blk(s.substring(i - 64, i)));
        }
        s = s.substring(i - 64);
        length = s.length;
        tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (i = 0; i < length; i += 1) {
          tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
        }
        tail[i >> 2] |= 128 << (i % 4 << 3);
        if (i > 55) {
          md5cycle(state2, tail);
          for (i = 0; i < 16; i += 1) {
            tail[i] = 0;
          }
        }
        tmp = n3 * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;
        tail[14] = lo;
        tail[15] = hi;
        md5cycle(state2, tail);
        return state2;
      }
      function md51_array(a) {
        var n3 = a.length, state2 = [1732584193, -271733879, -1732584194, 271733878], i, length, tail, tmp, lo, hi;
        for (i = 64; i <= n3; i += 64) {
          md5cycle(state2, md5blk_array(a.subarray(i - 64, i)));
        }
        a = i - 64 < n3 ? a.subarray(i - 64) : new Uint8Array(0);
        length = a.length;
        tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (i = 0; i < length; i += 1) {
          tail[i >> 2] |= a[i] << (i % 4 << 3);
        }
        tail[i >> 2] |= 128 << (i % 4 << 3);
        if (i > 55) {
          md5cycle(state2, tail);
          for (i = 0; i < 16; i += 1) {
            tail[i] = 0;
          }
        }
        tmp = n3 * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;
        tail[14] = lo;
        tail[15] = hi;
        md5cycle(state2, tail);
        return state2;
      }
      function rhex(n3) {
        var s = "", j;
        for (j = 0; j < 4; j += 1) {
          s += hex_chr[n3 >> j * 8 + 4 & 15] + hex_chr[n3 >> j * 8 & 15];
        }
        return s;
      }
      function hex(x) {
        var i;
        for (i = 0; i < x.length; i += 1) {
          x[i] = rhex(x[i]);
        }
        return x.join("");
      }
      if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") {
        add32 = function(x, y) {
          var lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16);
          return msw << 16 | lsw & 65535;
        };
      }
      if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
        (function() {
          function clamp(val, length) {
            val = val | 0 || 0;
            if (val < 0) {
              return Math.max(val + length, 0);
            }
            return Math.min(val, length);
          }
          ArrayBuffer.prototype.slice = function(from, to) {
            var length = this.byteLength, begin = clamp(from, length), end = length, num, target, targetArray, sourceArray;
            if (to !== undefined2) {
              end = clamp(to, length);
            }
            if (begin > end) {
              return new ArrayBuffer(0);
            }
            num = end - begin;
            target = new ArrayBuffer(num);
            targetArray = new Uint8Array(target);
            sourceArray = new Uint8Array(this, begin, num);
            targetArray.set(sourceArray);
            return target;
          };
        })();
      }
      function toUtf8(str) {
        if (/[\u0080-\uFFFF]/.test(str)) {
          str = unescape(encodeURIComponent(str));
        }
        return str;
      }
      function utf8Str2ArrayBuffer(str, returnUInt8Array) {
        var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i;
        for (i = 0; i < length; i += 1) {
          arr[i] = str.charCodeAt(i);
        }
        return returnUInt8Array ? arr : buff;
      }
      function arrayBuffer2Utf8Str(buff) {
        return String.fromCharCode.apply(null, new Uint8Array(buff));
      }
      function concatenateArrayBuffers(first, second, returnUInt8Array) {
        var result = new Uint8Array(first.byteLength + second.byteLength);
        result.set(new Uint8Array(first));
        result.set(new Uint8Array(second), first.byteLength);
        return returnUInt8Array ? result : result.buffer;
      }
      function hexToBinaryString(hex2) {
        var bytes = [], length = hex2.length, x;
        for (x = 0; x < length - 1; x += 2) {
          bytes.push(parseInt(hex2.substr(x, 2), 16));
        }
        return String.fromCharCode.apply(String, bytes);
      }
      function SparkMD5() {
        this.reset();
      }
      SparkMD5.prototype.append = function(str) {
        this.appendBinary(toUtf8(str));
        return this;
      };
      SparkMD5.prototype.appendBinary = function(contents) {
        this._buff += contents;
        this._length += contents.length;
        var length = this._buff.length, i;
        for (i = 64; i <= length; i += 64) {
          md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
        }
        this._buff = this._buff.substring(i - 64);
        return this;
      };
      SparkMD5.prototype.end = function(raw) {
        var buff = this._buff, length = buff.length, i, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret;
        for (i = 0; i < length; i += 1) {
          tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);
        }
        this._finish(tail, length);
        ret = hex(this._hash);
        if (raw) {
          ret = hexToBinaryString(ret);
        }
        this.reset();
        return ret;
      };
      SparkMD5.prototype.reset = function() {
        this._buff = "";
        this._length = 0;
        this._hash = [1732584193, -271733879, -1732584194, 271733878];
        return this;
      };
      SparkMD5.prototype.getState = function() {
        return {
          buff: this._buff,
          length: this._length,
          hash: this._hash.slice()
        };
      };
      SparkMD5.prototype.setState = function(state2) {
        this._buff = state2.buff;
        this._length = state2.length;
        this._hash = state2.hash;
        return this;
      };
      SparkMD5.prototype.destroy = function() {
        delete this._hash;
        delete this._buff;
        delete this._length;
      };
      SparkMD5.prototype._finish = function(tail, length) {
        var i = length, tmp, lo, hi;
        tail[i >> 2] |= 128 << (i % 4 << 3);
        if (i > 55) {
          md5cycle(this._hash, tail);
          for (i = 0; i < 16; i += 1) {
            tail[i] = 0;
          }
        }
        tmp = this._length * 8;
        tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
        lo = parseInt(tmp[2], 16);
        hi = parseInt(tmp[1], 16) || 0;
        tail[14] = lo;
        tail[15] = hi;
        md5cycle(this._hash, tail);
      };
      SparkMD5.hash = function(str, raw) {
        return SparkMD5.hashBinary(toUtf8(str), raw);
      };
      SparkMD5.hashBinary = function(content, raw) {
        var hash2 = md51(content), ret = hex(hash2);
        return raw ? hexToBinaryString(ret) : ret;
      };
      SparkMD5.ArrayBuffer = function() {
        this.reset();
      };
      SparkMD5.ArrayBuffer.prototype.append = function(arr) {
        var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i;
        this._length += arr.byteLength;
        for (i = 64; i <= length; i += 64) {
          md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
        }
        this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
        return this;
      };
      SparkMD5.ArrayBuffer.prototype.end = function(raw) {
        var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i, ret;
        for (i = 0; i < length; i += 1) {
          tail[i >> 2] |= buff[i] << (i % 4 << 3);
        }
        this._finish(tail, length);
        ret = hex(this._hash);
        if (raw) {
          ret = hexToBinaryString(ret);
        }
        this.reset();
        return ret;
      };
      SparkMD5.ArrayBuffer.prototype.reset = function() {
        this._buff = new Uint8Array(0);
        this._length = 0;
        this._hash = [1732584193, -271733879, -1732584194, 271733878];
        return this;
      };
      SparkMD5.ArrayBuffer.prototype.getState = function() {
        var state2 = SparkMD5.prototype.getState.call(this);
        state2.buff = arrayBuffer2Utf8Str(state2.buff);
        return state2;
      };
      SparkMD5.ArrayBuffer.prototype.setState = function(state2) {
        state2.buff = utf8Str2ArrayBuffer(state2.buff, true);
        return SparkMD5.prototype.setState.call(this, state2);
      };
      SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
      SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
      SparkMD5.ArrayBuffer.hash = function(arr, raw) {
        var hash2 = md51_array(new Uint8Array(arr)), ret = hex(hash2);
        return raw ? hexToBinaryString(ret) : ret;
      };
      return SparkMD5;
    });
  }
});

// node_modules/pouchdb-md5/lib/index-browser.es.js
function rawToBase64(raw) {
  return thisBtoa(raw);
}
function appendBlob(buffer, blob, start, end, callback) {
  if (start > 0 || end < blob.size) {
    blob = blob.slice(start, end);
  }
  readAsArrayBuffer(blob, function(arrayBuffer) {
    buffer.append(arrayBuffer);
    callback();
  });
}
function appendString(buffer, string, start, end, callback) {
  if (start > 0 || end < string.length) {
    string = string.substring(start, end);
  }
  buffer.appendBinary(string);
  callback();
}
function binaryMd5(data, callback) {
  var inputIsString = typeof data === "string";
  var len = inputIsString ? data.length : data.size;
  var chunkSize = Math.min(MD5_CHUNK_SIZE, len);
  var chunks = Math.ceil(len / chunkSize);
  var currentChunk = 0;
  var buffer = inputIsString ? new import_spark_md5.default() : new import_spark_md5.default.ArrayBuffer();
  var append2 = inputIsString ? appendString : appendBlob;
  function next2() {
    setImmediateShim(loadNextChunk);
  }
  function done() {
    var raw = buffer.end(true);
    var base64 = rawToBase64(raw);
    callback(base64);
    buffer.destroy();
  }
  function loadNextChunk() {
    var start = currentChunk * chunkSize;
    var end = start + chunkSize;
    currentChunk++;
    if (currentChunk < chunks) {
      append2(buffer, data, start, end, next2);
    } else {
      append2(buffer, data, start, end, done);
    }
  }
  loadNextChunk();
}
function stringMd5(string) {
  return import_spark_md5.default.hash(string);
}
var import_spark_md5, setImmediateShim, MD5_CHUNK_SIZE;
var init_index_browser_es2 = __esm({
  "node_modules/pouchdb-md5/lib/index-browser.es.js"() {
    init_index_browser_es();
    import_spark_md5 = __toESM2(require_spark_md5());
    setImmediateShim = self.setImmediate || self.setTimeout;
    MD5_CHUNK_SIZE = 32768;
  }
});

// node_modules/pouchdb-utils/lib/index-browser.es.js
function isBinaryObject(object) {
  return typeof ArrayBuffer !== "undefined" && object instanceof ArrayBuffer || typeof Blob !== "undefined" && object instanceof Blob;
}
function cloneBinaryObject(object) {
  return object instanceof ArrayBuffer ? object.slice(0) : object.slice(0, object.size, object.type);
}
function isPlainObject(value2) {
  var proto = Object.getPrototypeOf(value2);
  if (proto === null) {
    return true;
  }
  var Ctor = proto.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
function clone(object) {
  var newObject;
  var i;
  var len;
  if (!object || typeof object !== "object") {
    return object;
  }
  if (Array.isArray(object)) {
    newObject = [];
    for (i = 0, len = object.length; i < len; i++) {
      newObject[i] = clone(object[i]);
    }
    return newObject;
  }
  if (object instanceof Date && isFinite(object)) {
    return object.toISOString();
  }
  if (isBinaryObject(object)) {
    return cloneBinaryObject(object);
  }
  if (!isPlainObject(object)) {
    return object;
  }
  newObject = {};
  for (i in object) {
    if (Object.prototype.hasOwnProperty.call(object, i)) {
      var value2 = clone(object[i]);
      if (typeof value2 !== "undefined") {
        newObject[i] = value2;
      }
    }
  }
  return newObject;
}
function once(fun) {
  var called = false;
  return function(...args) {
    if (called) {
      throw new Error("once called more than once");
    } else {
      called = true;
      fun.apply(this, args);
    }
  };
}
function toPromise(func) {
  return function(...args) {
    args = clone(args);
    var self3 = this;
    var usedCB = typeof args[args.length - 1] === "function" ? args.pop() : false;
    var promise = new Promise(function(fulfill, reject) {
      var resp;
      try {
        var callback = once(function(err2, mesg) {
          if (err2) {
            reject(err2);
          } else {
            fulfill(mesg);
          }
        });
        args.push(callback);
        resp = func.apply(self3, args);
        if (resp && typeof resp.then === "function") {
          fulfill(resp);
        }
      } catch (e2) {
        reject(e2);
      }
    });
    if (usedCB) {
      promise.then(function(result) {
        usedCB(null, result);
      }, usedCB);
    }
    return promise;
  };
}
function logApiCall(self3, name, args) {
  if (self3.constructor.listeners("debug").length) {
    var logArgs = ["api", self3.name, name];
    for (var i = 0; i < args.length - 1; i++) {
      logArgs.push(args[i]);
    }
    self3.constructor.emit("debug", logArgs);
    var origCallback = args[args.length - 1];
    args[args.length - 1] = function(err2, res2) {
      var responseArgs = ["api", self3.name, name];
      responseArgs = responseArgs.concat(
        err2 ? ["error", err2] : ["success", res2]
      );
      self3.constructor.emit("debug", responseArgs);
      origCallback(err2, res2);
    };
  }
}
function adapterFun(name, callback) {
  return toPromise(function(...args) {
    if (this._closed) {
      return Promise.reject(new Error("database is closed"));
    }
    if (this._destroyed) {
      return Promise.reject(new Error("database is destroyed"));
    }
    var self3 = this;
    logApiCall(self3, name, args);
    if (!this.taskqueue.isReady) {
      return new Promise(function(fulfill, reject) {
        self3.taskqueue.addTask(function(failed2) {
          if (failed2) {
            reject(failed2);
          } else {
            fulfill(self3[name].apply(self3, args));
          }
        });
      });
    }
    return callback.apply(this, args);
  });
}
function pick(obj, arr) {
  var res2 = {};
  for (var i = 0, len = arr.length; i < len; i++) {
    var prop2 = arr[i];
    if (prop2 in obj) {
      res2[prop2] = obj[prop2];
    }
  }
  return res2;
}
function identityFunction(x) {
  return x;
}
function formatResultForOpenRevsGet(result) {
  return [{
    ok: result
  }];
}
function bulkGet(db, opts, callback) {
  var requests = opts.docs;
  var requestsById = /* @__PURE__ */ new Map();
  requests.forEach(function(request) {
    if (requestsById.has(request.id)) {
      requestsById.get(request.id).push(request);
    } else {
      requestsById.set(request.id, [request]);
    }
  });
  var numDocs = requestsById.size;
  var numDone = 0;
  var perDocResults = new Array(numDocs);
  function collapseResultsAndFinish() {
    var results = [];
    perDocResults.forEach(function(res2) {
      res2.docs.forEach(function(info3) {
        results.push({
          id: res2.id,
          docs: [info3]
        });
      });
    });
    callback(null, { results });
  }
  function checkDone() {
    if (++numDone === numDocs) {
      collapseResultsAndFinish();
    }
  }
  function gotResult(docIndex, id, docs) {
    perDocResults[docIndex] = { id, docs };
    checkDone();
  }
  var allRequests = [];
  requestsById.forEach(function(value2, key4) {
    allRequests.push(key4);
  });
  var i = 0;
  function nextBatch() {
    if (i >= allRequests.length) {
      return;
    }
    var upTo = Math.min(i + MAX_NUM_CONCURRENT_REQUESTS, allRequests.length);
    var batch = allRequests.slice(i, upTo);
    processBatch(batch, i);
    i += batch.length;
  }
  function processBatch(batch, offset) {
    batch.forEach(function(docId, j) {
      var docIdx = offset + j;
      var docRequests = requestsById.get(docId);
      var docOpts = pick(docRequests[0], ["atts_since", "attachments"]);
      docOpts.open_revs = docRequests.map(function(request) {
        return request.rev;
      });
      docOpts.open_revs = docOpts.open_revs.filter(identityFunction);
      var formatResult = identityFunction;
      if (docOpts.open_revs.length === 0) {
        delete docOpts.open_revs;
        formatResult = formatResultForOpenRevsGet;
      }
      ["revs", "attachments", "binary", "ajax", "latest"].forEach(function(param) {
        if (param in opts) {
          docOpts[param] = opts[param];
        }
      });
      db.get(docId, docOpts, function(err2, res2) {
        var result;
        if (err2) {
          result = [{ error: err2 }];
        } else {
          result = formatResult(res2);
        }
        gotResult(docIdx, docId, result);
        nextBatch();
      });
    });
  }
  nextBatch();
}
function hasLocalStorage() {
  return hasLocal;
}
function guardedConsole(method) {
  if (typeof console !== "undefined" && typeof console[method] === "function") {
    var args = Array.prototype.slice.call(arguments, 1);
    console[method].apply(console, args);
  }
}
function randomNumber(min, max3) {
  var maxTimeout = 6e5;
  min = parseInt(min, 10) || 0;
  max3 = parseInt(max3, 10);
  if (max3 !== max3 || max3 <= min) {
    max3 = (min || 1) << 1;
  } else {
    max3 = max3 + 1;
  }
  if (max3 > maxTimeout) {
    min = maxTimeout >> 1;
    max3 = maxTimeout;
  }
  var ratio = Math.random();
  var range2 = max3 - min;
  return ~~(range2 * ratio + min);
}
function defaultBackOff(min) {
  var max3 = 0;
  if (!min) {
    max3 = 2e3;
  }
  return randomNumber(min, max3);
}
function explainError(status, str) {
  guardedConsole("info", "The above " + status + " is totally normal. " + str);
}
function tryFilter(filter3, doc, req) {
  try {
    return !filter3(doc, req);
  } catch (err2) {
    var msg = "Filter function threw: " + err2.toString();
    return createError(BAD_REQUEST, msg);
  }
}
function filterChange(opts) {
  var req = {};
  var hasFilter = opts.filter && typeof opts.filter === "function";
  req.query = opts.query_params;
  return function filter3(change) {
    if (!change.doc) {
      change.doc = {};
    }
    var filterReturn = hasFilter && tryFilter(opts.filter, change.doc, req);
    if (typeof filterReturn === "object") {
      return filterReturn;
    }
    if (filterReturn) {
      return false;
    }
    if (!opts.include_docs) {
      delete change.doc;
    } else if (!opts.attachments) {
      for (var att in change.doc._attachments) {
        if (Object.prototype.hasOwnProperty.call(change.doc._attachments, att)) {
          change.doc._attachments[att].stub = true;
        }
      }
    }
    return true;
  };
}
function f() {
}
function invalidIdError(id) {
  var err2;
  if (!id) {
    err2 = createError(MISSING_ID);
  } else if (typeof id !== "string") {
    err2 = createError(INVALID_ID);
  } else if (/^_/.test(id) && !/^_(design|local)/.test(id)) {
    err2 = createError(RESERVED_ID);
  }
  if (err2) {
    throw err2;
  }
}
function isRemote(db) {
  if (typeof db._remote === "boolean") {
    return db._remote;
  }
  if (typeof db.type === "function") {
    guardedConsole(
      "warn",
      "db.type() is deprecated and will be removed in a future version of PouchDB"
    );
    return db.type() === "http";
  }
  return false;
}
function listenerCount(ee, type) {
  return "listenerCount" in ee ? ee.listenerCount(type) : import_events2.default.listenerCount(ee, type);
}
function parseDesignDocFunctionName(s) {
  if (!s) {
    return null;
  }
  var parts = s.split("/");
  if (parts.length === 2) {
    return parts;
  }
  if (parts.length === 1) {
    return [s, s];
  }
  return null;
}
function normalizeDesignDocFunctionName(s) {
  var normalized = parseDesignDocFunctionName(s);
  return normalized ? normalized.join("/") : null;
}
function parseUri(str) {
  var m2 = parser.exec(str);
  var uri = {};
  var i = 14;
  while (i--) {
    var key4 = keys[i];
    var value2 = m2[i] || "";
    var encoded = ["user", "password"].indexOf(key4) !== -1;
    uri[key4] = encoded ? decodeURIComponent(value2) : value2;
  }
  uri[qName] = {};
  uri[keys[12]].replace(qParser, function($0, $1, $2) {
    if ($1) {
      uri[qName][$1] = $2;
    }
  });
  return uri;
}
function scopeEval(source2, scope) {
  var keys2 = [];
  var values = [];
  for (var key4 in scope) {
    if (Object.prototype.hasOwnProperty.call(scope, key4)) {
      keys2.push(key4);
      values.push(scope[key4]);
    }
  }
  keys2.push(source2);
  return Function.apply(null, keys2).apply(null, values);
}
function upsert(db, docId, diffFun) {
  return db.get(docId).catch(function(err2) {
    if (err2.status !== 404) {
      throw err2;
    }
    return {};
  }).then(function(doc) {
    var docRev = doc._rev;
    var newDoc = diffFun(doc);
    if (!newDoc) {
      return { updated: false, rev: docRev };
    }
    newDoc._id = docId;
    newDoc._rev = docRev;
    return tryAndPut(db, newDoc, diffFun);
  });
}
function tryAndPut(db, doc, diffFun) {
  return db.put(doc).then(function(res2) {
    return {
      updated: true,
      rev: res2.rev
    };
  }, function(err2) {
    if (err2.status !== 409) {
      throw err2;
    }
    return upsert(db, doc._id, diffFun);
  });
}
function rev2(doc, deterministic_revs) {
  if (!deterministic_revs) {
    return v4_default().replace(/-/g, "").toLowerCase();
  }
  var mutateableDoc = Object.assign({}, doc);
  delete mutateableDoc._rev_tree;
  return stringMd5(JSON.stringify(mutateableDoc));
}
var import_events2, funcToString, objectCtorString, MAX_NUM_CONCURRENT_REQUESTS, hasLocal, nextTick, Changes, hasName, res, keys, qName, qParser, parser, uuid;
var init_index_browser_es3 = __esm({
  "node_modules/pouchdb-utils/lib/index-browser.es.js"() {
    init_index_es();
    import_events2 = __toESM2(require_events());
    init_esm_browser();
    init_index_browser_es2();
    funcToString = Function.prototype.toString;
    objectCtorString = funcToString.call(Object);
    MAX_NUM_CONCURRENT_REQUESTS = 6;
    try {
      localStorage.setItem("_pouch_check_localstorage", 1);
      hasLocal = !!localStorage.getItem("_pouch_check_localstorage");
    } catch (e2) {
      hasLocal = false;
    }
    nextTick = typeof queueMicrotask === "function" ? queueMicrotask : function nextTick2(fn) {
      Promise.resolve().then(fn);
    };
    Changes = class extends import_events2.default {
      constructor() {
        super();
        this._listeners = {};
        if (hasLocalStorage()) {
          addEventListener("storage", (e2) => {
            this.emit(e2.key);
          });
        }
      }
      addListener(dbName, id, db, opts) {
        if (this._listeners[id]) {
          return;
        }
        var inprogress = false;
        var self3 = this;
        function eventFunction() {
          if (!self3._listeners[id]) {
            return;
          }
          if (inprogress) {
            inprogress = "waiting";
            return;
          }
          inprogress = true;
          var changesOpts = pick(opts, [
            "style",
            "include_docs",
            "attachments",
            "conflicts",
            "filter",
            "doc_ids",
            "view",
            "since",
            "query_params",
            "binary",
            "return_docs"
          ]);
          function onError() {
            inprogress = false;
          }
          db.changes(changesOpts).on("change", function(c) {
            if (c.seq > opts.since && !opts.cancelled) {
              opts.since = c.seq;
              opts.onChange(c);
            }
          }).on("complete", function() {
            if (inprogress === "waiting") {
              nextTick(eventFunction);
            }
            inprogress = false;
          }).on("error", onError);
        }
        this._listeners[id] = eventFunction;
        this.on(dbName, eventFunction);
      }
      removeListener(dbName, id) {
        if (!(id in this._listeners)) {
          return;
        }
        super.removeListener(dbName, this._listeners[id]);
        delete this._listeners[id];
      }
      notifyLocalWindows(dbName) {
        if (hasLocalStorage()) {
          localStorage[dbName] = localStorage[dbName] === "a" ? "b" : "a";
        }
      }
      notify(dbName) {
        this.emit(dbName);
        this.notifyLocalWindows(dbName);
      }
    };
    hasName = f.name;
    if (hasName) {
      res = function(fun) {
        return fun.name;
      };
    } else {
      res = function(fun) {
        var match3 = fun.toString().match(/^\s*function\s*(?:(\S+)\s*)?\(/);
        if (match3 && match3[1]) {
          return match3[1];
        } else {
          return "";
        }
      };
    }
    keys = [
      "source",
      "protocol",
      "authority",
      "userInfo",
      "user",
      "password",
      "host",
      "port",
      "relative",
      "path",
      "directory",
      "file",
      "query",
      "anchor"
    ];
    qName = "queryKey";
    qParser = /(?:^|&)([^&=]*)=?([^&]*)/g;
    parser = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
    uuid = v4_default;
  }
});

// node_modules/pouchdb-merge/lib/index.es.js
function winningRev(metadata) {
  var winningId;
  var winningPos;
  var winningDeleted;
  var toVisit = metadata.rev_tree.slice();
  var node;
  while (node = toVisit.pop()) {
    var tree = node.ids;
    var branches = tree[2];
    var pos2 = node.pos;
    if (branches.length) {
      for (var i = 0, len = branches.length; i < len; i++) {
        toVisit.push({ pos: pos2 + 1, ids: branches[i] });
      }
      continue;
    }
    var deleted = !!tree[1].deleted;
    var id = tree[0];
    if (!winningId || (winningDeleted !== deleted ? winningDeleted : winningPos !== pos2 ? winningPos < pos2 : winningId < id)) {
      winningId = id;
      winningPos = pos2;
      winningDeleted = deleted;
    }
  }
  return winningPos + "-" + winningId;
}
function traverseRevTree(revs, callback) {
  var toVisit = revs.slice();
  var node;
  while (node = toVisit.pop()) {
    var pos2 = node.pos;
    var tree = node.ids;
    var branches = tree[2];
    var newCtx = callback(branches.length === 0, pos2, tree[0], node.ctx, tree[1]);
    for (var i = 0, len = branches.length; i < len; i++) {
      toVisit.push({ pos: pos2 + 1, ids: branches[i], ctx: newCtx });
    }
  }
}
function sortByPos(a, b) {
  return a.pos - b.pos;
}
function collectLeaves(revs) {
  var leaves = [];
  traverseRevTree(revs, function(isLeaf, pos2, id, acc, opts) {
    if (isLeaf) {
      leaves.push({ rev: pos2 + "-" + id, pos: pos2, opts });
    }
  });
  leaves.sort(sortByPos).reverse();
  for (var i = 0, len = leaves.length; i < len; i++) {
    delete leaves[i].pos;
  }
  return leaves;
}
function collectConflicts(metadata) {
  var win = winningRev(metadata);
  var leaves = collectLeaves(metadata.rev_tree);
  var conflicts = [];
  for (var i = 0, len = leaves.length; i < len; i++) {
    var leaf = leaves[i];
    if (leaf.rev !== win && !leaf.opts.deleted) {
      conflicts.push(leaf.rev);
    }
  }
  return conflicts;
}
function compactTree(metadata) {
  var revs = [];
  traverseRevTree(metadata.rev_tree, function(isLeaf, pos2, revHash, ctx, opts) {
    if (opts.status === "available" && !isLeaf) {
      revs.push(pos2 + "-" + revHash);
      opts.status = "missing";
    }
  });
  return revs;
}
function findPathToLeaf(revs, targetRev) {
  let path8 = [];
  const toVisit = revs.slice();
  let node;
  while (node = toVisit.pop()) {
    const { pos: pos2, ids: tree } = node;
    const rev3 = `${pos2}-${tree[0]}`;
    const branches = tree[2];
    path8.push(rev3);
    if (rev3 === targetRev) {
      if (branches.length !== 0) {
        throw new Error("The requested revision is not a leaf");
      }
      return path8.reverse();
    }
    if (branches.length === 0 || branches.length > 1) {
      path8 = [];
    }
    for (let i = 0, len = branches.length; i < len; i++) {
      toVisit.push({ pos: pos2 + 1, ids: branches[i] });
    }
  }
  if (path8.length === 0) {
    throw new Error("The requested revision does not exist");
  }
  return path8.reverse();
}
function rootToLeaf(revs) {
  var paths = [];
  var toVisit = revs.slice();
  var node;
  while (node = toVisit.pop()) {
    var pos2 = node.pos;
    var tree = node.ids;
    var id = tree[0];
    var opts = tree[1];
    var branches = tree[2];
    var isLeaf = branches.length === 0;
    var history = node.history ? node.history.slice() : [];
    history.push({ id, opts });
    if (isLeaf) {
      paths.push({ pos: pos2 + 1 - history.length, ids: history });
    }
    for (var i = 0, len = branches.length; i < len; i++) {
      toVisit.push({ pos: pos2 + 1, ids: branches[i], history });
    }
  }
  return paths.reverse();
}
function sortByPos$1(a, b) {
  return a.pos - b.pos;
}
function binarySearch(arr, item, comparator) {
  var low = 0;
  var high = arr.length;
  var mid;
  while (low < high) {
    mid = low + high >>> 1;
    if (comparator(arr[mid], item) < 0) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  return low;
}
function insertSorted(arr, item, comparator) {
  var idx2 = binarySearch(arr, item, comparator);
  arr.splice(idx2, 0, item);
}
function pathToTree(path8, numStemmed) {
  var root5;
  var leaf;
  for (var i = numStemmed, len = path8.length; i < len; i++) {
    var node = path8[i];
    var currentLeaf = [node.id, node.opts, []];
    if (leaf) {
      leaf[2].push(currentLeaf);
      leaf = currentLeaf;
    } else {
      root5 = leaf = currentLeaf;
    }
  }
  return root5;
}
function compareTree(a, b) {
  return a[0] < b[0] ? -1 : 1;
}
function mergeTree(in_tree1, in_tree2) {
  var queue2 = [{ tree1: in_tree1, tree2: in_tree2 }];
  var conflicts = false;
  while (queue2.length > 0) {
    var item = queue2.pop();
    var tree1 = item.tree1;
    var tree2 = item.tree2;
    if (tree1[1].status || tree2[1].status) {
      tree1[1].status = tree1[1].status === "available" || tree2[1].status === "available" ? "available" : "missing";
    }
    for (var i = 0; i < tree2[2].length; i++) {
      if (!tree1[2][0]) {
        conflicts = "new_leaf";
        tree1[2][0] = tree2[2][i];
        continue;
      }
      var merged = false;
      for (var j = 0; j < tree1[2].length; j++) {
        if (tree1[2][j][0] === tree2[2][i][0]) {
          queue2.push({ tree1: tree1[2][j], tree2: tree2[2][i] });
          merged = true;
        }
      }
      if (!merged) {
        conflicts = "new_branch";
        insertSorted(tree1[2], tree2[2][i], compareTree);
      }
    }
  }
  return { conflicts, tree: in_tree1 };
}
function doMerge(tree, path8, dontExpand) {
  var restree = [];
  var conflicts = false;
  var merged = false;
  var res2;
  if (!tree.length) {
    return { tree: [path8], conflicts: "new_leaf" };
  }
  for (var i = 0, len = tree.length; i < len; i++) {
    var branch2 = tree[i];
    if (branch2.pos === path8.pos && branch2.ids[0] === path8.ids[0]) {
      res2 = mergeTree(branch2.ids, path8.ids);
      restree.push({ pos: branch2.pos, ids: res2.tree });
      conflicts = conflicts || res2.conflicts;
      merged = true;
    } else if (dontExpand !== true) {
      var t1 = branch2.pos < path8.pos ? branch2 : path8;
      var t2 = branch2.pos < path8.pos ? path8 : branch2;
      var diff = t2.pos - t1.pos;
      var candidateParents = [];
      var trees = [];
      trees.push({ ids: t1.ids, diff, parent: null, parentIdx: null });
      while (trees.length > 0) {
        var item = trees.pop();
        if (item.diff === 0) {
          if (item.ids[0] === t2.ids[0]) {
            candidateParents.push(item);
          }
          continue;
        }
        var elements = item.ids[2];
        for (var j = 0, elementsLen = elements.length; j < elementsLen; j++) {
          trees.push({
            ids: elements[j],
            diff: item.diff - 1,
            parent: item.ids,
            parentIdx: j
          });
        }
      }
      var el = candidateParents[0];
      if (!el) {
        restree.push(branch2);
      } else {
        res2 = mergeTree(el.ids, t2.ids);
        el.parent[2][el.parentIdx] = res2.tree;
        restree.push({ pos: t1.pos, ids: t1.ids });
        conflicts = conflicts || res2.conflicts;
        merged = true;
      }
    } else {
      restree.push(branch2);
    }
  }
  if (!merged) {
    restree.push(path8);
  }
  restree.sort(sortByPos$1);
  return {
    tree: restree,
    conflicts: conflicts || "internal_node"
  };
}
function stem(tree, depth) {
  var paths = rootToLeaf(tree);
  var stemmedRevs;
  var result;
  for (var i = 0, len = paths.length; i < len; i++) {
    var path8 = paths[i];
    var stemmed = path8.ids;
    var node;
    if (stemmed.length > depth) {
      if (!stemmedRevs) {
        stemmedRevs = {};
      }
      var numStemmed = stemmed.length - depth;
      node = {
        pos: path8.pos + numStemmed,
        ids: pathToTree(stemmed, numStemmed)
      };
      for (var s = 0; s < numStemmed; s++) {
        var rev3 = path8.pos + s + "-" + stemmed[s].id;
        stemmedRevs[rev3] = true;
      }
    } else {
      node = {
        pos: path8.pos,
        ids: pathToTree(stemmed, 0)
      };
    }
    if (result) {
      result = doMerge(result, node, true).tree;
    } else {
      result = [node];
    }
  }
  if (stemmedRevs) {
    traverseRevTree(result, function(isLeaf, pos2, revHash) {
      delete stemmedRevs[pos2 + "-" + revHash];
    });
  }
  return {
    tree: result,
    revs: stemmedRevs ? Object.keys(stemmedRevs) : []
  };
}
function merge(tree, path8, depth) {
  var newTree = doMerge(tree, path8);
  var stemmed = stem(newTree.tree, depth);
  return {
    tree: stemmed.tree,
    stemmedRevs: stemmed.revs,
    conflicts: newTree.conflicts
  };
}
function removeLeafFromRevTree(tree, leafRev) {
  return tree.flatMap((path8) => {
    path8 = removeLeafFromPath(path8, leafRev);
    return path8 ? [path8] : [];
  });
}
function removeLeafFromPath(path8, leafRev) {
  const tree = clone(path8);
  const toVisit = [tree];
  let node;
  while (node = toVisit.pop()) {
    const { pos: pos2, ids: [id, , branches], parent } = node;
    const isLeaf = branches.length === 0;
    const hash2 = `${pos2}-${id}`;
    if (isLeaf && hash2 === leafRev) {
      if (!parent) {
        return null;
      }
      parent.ids[2] = parent.ids[2].filter(function(branchNode) {
        return branchNode[0] !== id;
      });
      return tree;
    }
    for (let i = 0, len = branches.length; i < len; i++) {
      toVisit.push({ pos: pos2 + 1, ids: branches[i], parent: node });
    }
  }
  return tree;
}
function revExists(revs, rev3) {
  var toVisit = revs.slice();
  var splitRev = rev3.split("-");
  var targetPos = parseInt(splitRev[0], 10);
  var targetId = splitRev[1];
  var node;
  while (node = toVisit.pop()) {
    if (node.pos === targetPos && node.ids[0] === targetId) {
      return true;
    }
    var branches = node.ids[2];
    for (var i = 0, len = branches.length; i < len; i++) {
      toVisit.push({ pos: node.pos + 1, ids: branches[i] });
    }
  }
  return false;
}
function getTrees(node) {
  return node.ids;
}
function isDeleted(metadata, rev3) {
  if (!rev3) {
    rev3 = winningRev(metadata);
  }
  var id = rev3.substring(rev3.indexOf("-") + 1);
  var toVisit = metadata.rev_tree.map(getTrees);
  var tree;
  while (tree = toVisit.pop()) {
    if (tree[0] === id) {
      return !!tree[1].deleted;
    }
    toVisit = toVisit.concat(tree[2]);
  }
}
function isLocalId(id) {
  return typeof id === "string" && id.startsWith("_local/");
}
function latest(rev3, metadata) {
  var toVisit = metadata.rev_tree.slice();
  var node;
  while (node = toVisit.pop()) {
    var pos2 = node.pos;
    var tree = node.ids;
    var id = tree[0];
    var opts = tree[1];
    var branches = tree[2];
    var isLeaf = branches.length === 0;
    var history = node.history ? node.history.slice() : [];
    history.push({ id, pos: pos2, opts });
    if (isLeaf) {
      for (var i = 0, len = history.length; i < len; i++) {
        var historyNode = history[i];
        var historyRev = historyNode.pos + "-" + historyNode.id;
        if (historyRev === rev3) {
          return pos2 + "-" + id;
        }
      }
    }
    for (var j = 0, l = branches.length; j < l; j++) {
      toVisit.push({ pos: pos2 + 1, ids: branches[j], history });
    }
  }
  throw new Error("Unable to resolve latest revision for id " + metadata.id + ", rev " + rev3);
}
var init_index_es2 = __esm({
  "node_modules/pouchdb-merge/lib/index.es.js"() {
    init_index_browser_es3();
  }
});

// node_modules/pouchdb-fetch/lib/index-browser.es.js
var f2, h;
var init_index_browser_es4 = __esm({
  "node_modules/pouchdb-fetch/lib/index-browser.es.js"() {
    f2 = fetch;
    h = Headers;
  }
});

// node_modules/pouchdb-collate/lib/index.es.js
function pad(str, padWith, upToLength) {
  var padding = "";
  var targetLength = upToLength - str.length;
  while (padding.length < targetLength) {
    padding += padWith;
  }
  return padding;
}
function padLeft(str, padWith, upToLength) {
  var padding = pad(str, padWith, upToLength);
  return padding + str;
}
function collate(a, b) {
  if (a === b) {
    return 0;
  }
  a = normalizeKey(a);
  b = normalizeKey(b);
  var ai = collationIndex(a);
  var bi = collationIndex(b);
  if (ai - bi !== 0) {
    return ai - bi;
  }
  switch (typeof a) {
    case "number":
      return a - b;
    case "boolean":
      return a < b ? -1 : 1;
    case "string":
      return stringCollate(a, b);
  }
  return Array.isArray(a) ? arrayCollate(a, b) : objectCollate(a, b);
}
function normalizeKey(key4) {
  switch (typeof key4) {
    case "undefined":
      return null;
    case "number":
      if (key4 === Infinity || key4 === -Infinity || isNaN(key4)) {
        return null;
      }
      return key4;
    case "object":
      var origKey = key4;
      if (Array.isArray(key4)) {
        var len = key4.length;
        key4 = new Array(len);
        for (var i = 0; i < len; i++) {
          key4[i] = normalizeKey(origKey[i]);
        }
      } else if (key4 instanceof Date) {
        return key4.toJSON();
      } else if (key4 !== null) {
        key4 = {};
        for (var k in origKey) {
          if (Object.prototype.hasOwnProperty.call(origKey, k)) {
            var val = origKey[k];
            if (typeof val !== "undefined") {
              key4[k] = normalizeKey(val);
            }
          }
        }
      }
  }
  return key4;
}
function indexify(key4) {
  if (key4 !== null) {
    switch (typeof key4) {
      case "boolean":
        return key4 ? 1 : 0;
      case "number":
        return numToIndexableString(key4);
      case "string":
        return key4.replace(/\u0002/g, "").replace(/\u0001/g, "").replace(/\u0000/g, "");
      /* eslint-enable no-control-regex */
      case "object":
        var isArray2 = Array.isArray(key4);
        var arr = isArray2 ? key4 : Object.keys(key4);
        var i = -1;
        var len = arr.length;
        var result = "";
        if (isArray2) {
          while (++i < len) {
            result += toIndexableString(arr[i]);
          }
        } else {
          while (++i < len) {
            var objKey = arr[i];
            result += toIndexableString(objKey) + toIndexableString(key4[objKey]);
          }
        }
        return result;
    }
  }
  return "";
}
function toIndexableString(key4) {
  var zero = "\0";
  key4 = normalizeKey(key4);
  return collationIndex(key4) + SEP + indexify(key4) + zero;
}
function parseNumber(str, i) {
  var originalIdx = i;
  var num;
  var zero = str[i] === "1";
  if (zero) {
    num = 0;
    i++;
  } else {
    var neg = str[i] === "0";
    i++;
    var numAsString = "";
    var magAsString = str.substring(i, i + MAGNITUDE_DIGITS);
    var magnitude = parseInt(magAsString, 10) + MIN_MAGNITUDE;
    if (neg) {
      magnitude = -magnitude;
    }
    i += MAGNITUDE_DIGITS;
    while (true) {
      var ch3 = str[i];
      if (ch3 === "\0") {
        break;
      } else {
        numAsString += ch3;
      }
      i++;
    }
    numAsString = numAsString.split(".");
    if (numAsString.length === 1) {
      num = parseInt(numAsString, 10);
    } else {
      num = parseFloat(numAsString[0] + "." + numAsString[1]);
    }
    if (neg) {
      num = num - 10;
    }
    if (magnitude !== 0) {
      num = parseFloat(num + "e" + magnitude);
    }
  }
  return { num, length: i - originalIdx };
}
function pop(stack2, metaStack) {
  var obj = stack2.pop();
  if (metaStack.length) {
    var lastMetaElement = metaStack[metaStack.length - 1];
    if (obj === lastMetaElement.element) {
      metaStack.pop();
      lastMetaElement = metaStack[metaStack.length - 1];
    }
    var element2 = lastMetaElement.element;
    var lastElementIndex = lastMetaElement.index;
    if (Array.isArray(element2)) {
      element2.push(obj);
    } else if (lastElementIndex === stack2.length - 2) {
      var key4 = stack2.pop();
      element2[key4] = obj;
    } else {
      stack2.push(obj);
    }
  }
}
function parseIndexableString(str) {
  var stack2 = [];
  var metaStack = [];
  var i = 0;
  while (true) {
    var collationIndex2 = str[i++];
    if (collationIndex2 === "\0") {
      if (stack2.length === 1) {
        return stack2.pop();
      } else {
        pop(stack2, metaStack);
        continue;
      }
    }
    switch (collationIndex2) {
      case "1":
        stack2.push(null);
        break;
      case "2":
        stack2.push(str[i] === "1");
        i++;
        break;
      case "3":
        var parsedNum = parseNumber(str, i);
        stack2.push(parsedNum.num);
        i += parsedNum.length;
        break;
      case "4":
        var parsedStr = "";
        while (true) {
          var ch3 = str[i];
          if (ch3 === "\0") {
            break;
          }
          parsedStr += ch3;
          i++;
        }
        parsedStr = parsedStr.replace(/\u0001\u0001/g, "\0").replace(/\u0001\u0002/g, "").replace(/\u0002\u0002/g, "");
        stack2.push(parsedStr);
        break;
      case "5":
        var arrayElement = { element: [], index: stack2.length };
        stack2.push(arrayElement.element);
        metaStack.push(arrayElement);
        break;
      case "6":
        var objElement = { element: {}, index: stack2.length };
        stack2.push(objElement.element);
        metaStack.push(objElement);
        break;
      /* istanbul ignore next */
      default:
        throw new Error(
          "bad collationIndex or unexpectedly reached end of input: " + collationIndex2
        );
    }
  }
}
function arrayCollate(a, b) {
  var len = Math.min(a.length, b.length);
  for (var i = 0; i < len; i++) {
    var sort = collate(a[i], b[i]);
    if (sort !== 0) {
      return sort;
    }
  }
  return a.length === b.length ? 0 : a.length > b.length ? 1 : -1;
}
function stringCollate(a, b) {
  return a === b ? 0 : a > b ? 1 : -1;
}
function objectCollate(a, b) {
  var ak = Object.keys(a), bk = Object.keys(b);
  var len = Math.min(ak.length, bk.length);
  for (var i = 0; i < len; i++) {
    var sort = collate(ak[i], bk[i]);
    if (sort !== 0) {
      return sort;
    }
    sort = collate(a[ak[i]], b[bk[i]]);
    if (sort !== 0) {
      return sort;
    }
  }
  return ak.length === bk.length ? 0 : ak.length > bk.length ? 1 : -1;
}
function collationIndex(x) {
  var id = ["boolean", "number", "string", "object"];
  var idx2 = id.indexOf(typeof x);
  if (~idx2) {
    if (x === null) {
      return 1;
    }
    if (Array.isArray(x)) {
      return 5;
    }
    return idx2 < 3 ? idx2 + 2 : idx2 + 3;
  }
  if (Array.isArray(x)) {
    return 5;
  }
}
function numToIndexableString(num) {
  if (num === 0) {
    return "1";
  }
  var expFormat = num.toExponential().split(/e\+?/);
  var magnitude = parseInt(expFormat[1], 10);
  var neg = num < 0;
  var result = neg ? "0" : "2";
  var magForComparison = (neg ? -magnitude : magnitude) - MIN_MAGNITUDE;
  var magString = padLeft(magForComparison.toString(), "0", MAGNITUDE_DIGITS);
  result += SEP + magString;
  var factor = Math.abs(parseFloat(expFormat[0]));
  if (neg) {
    factor = 10 - factor;
  }
  var factorStr = factor.toFixed(20);
  factorStr = factorStr.replace(/\.?0+$/, "");
  result += SEP + factorStr;
  return result;
}
var MIN_MAGNITUDE, MAGNITUDE_DIGITS, SEP;
var init_index_es3 = __esm({
  "node_modules/pouchdb-collate/lib/index.es.js"() {
    MIN_MAGNITUDE = -324;
    MAGNITUDE_DIGITS = 3;
    SEP = "";
  }
});

// node_modules/pouchdb-selector-core/lib/index.es.js
function getFieldFromDoc(doc, parsedField) {
  var value2 = doc;
  for (var i = 0, len = parsedField.length; i < len; i++) {
    var key4 = parsedField[i];
    value2 = value2[key4];
    if (!value2) {
      break;
    }
  }
  return value2;
}
function setFieldInDoc(doc, parsedField, value2) {
  for (var i = 0, len = parsedField.length; i < len - 1; i++) {
    var elem = parsedField[i];
    doc = doc[elem] = doc[elem] || {};
  }
  doc[parsedField[len - 1]] = value2;
}
function compare(left, right) {
  return left < right ? -1 : left > right ? 1 : 0;
}
function parseField(fieldName) {
  var fields = [];
  var current = "";
  for (var i = 0, len = fieldName.length; i < len; i++) {
    var ch3 = fieldName[i];
    if (i > 0 && fieldName[i - 1] === "\\" && (ch3 === "$" || ch3 === ".")) {
      current = current.substring(0, current.length - 1) + ch3;
    } else if (ch3 === ".") {
      fields.push(current);
      current = "";
    } else {
      current += ch3;
    }
  }
  fields.push(current);
  return fields;
}
function isCombinationalField(field) {
  return combinationFields.indexOf(field) > -1;
}
function getKey2(obj) {
  return Object.keys(obj)[0];
}
function getValue(obj) {
  return obj[getKey2(obj)];
}
function mergeAndedSelectors(selectors) {
  var res2 = {};
  var first = { $or: true, $nor: true };
  selectors.forEach(function(selector) {
    Object.keys(selector).forEach(function(field) {
      var matcher = selector[field];
      if (typeof matcher !== "object") {
        matcher = { $eq: matcher };
      }
      if (isCombinationalField(field)) {
        if (matcher instanceof Array) {
          if (first[field]) {
            first[field] = false;
            res2[field] = matcher;
            return;
          }
          var entries = [];
          res2[field].forEach(function(existing) {
            Object.keys(matcher).forEach(function(key4) {
              var m2 = matcher[key4];
              var longest = Math.max(Object.keys(existing).length, Object.keys(m2).length);
              var merged = mergeAndedSelectors([existing, m2]);
              if (Object.keys(merged).length <= longest) {
                return;
              }
              entries.push(merged);
            });
          });
          res2[field] = entries;
        } else {
          res2[field] = mergeAndedSelectors([matcher]);
        }
      } else {
        var fieldMatchers = res2[field] = res2[field] || {};
        Object.keys(matcher).forEach(function(operator) {
          var value2 = matcher[operator];
          if (operator === "$gt" || operator === "$gte") {
            return mergeGtGte(operator, value2, fieldMatchers);
          } else if (operator === "$lt" || operator === "$lte") {
            return mergeLtLte(operator, value2, fieldMatchers);
          } else if (operator === "$ne") {
            return mergeNe(value2, fieldMatchers);
          } else if (operator === "$eq") {
            return mergeEq(value2, fieldMatchers);
          } else if (operator === "$regex") {
            return mergeRegex(value2, fieldMatchers);
          }
          fieldMatchers[operator] = value2;
        });
      }
    });
  });
  return res2;
}
function mergeGtGte(operator, value2, fieldMatchers) {
  if (typeof fieldMatchers.$eq !== "undefined") {
    return;
  }
  if (typeof fieldMatchers.$gte !== "undefined") {
    if (operator === "$gte") {
      if (value2 > fieldMatchers.$gte) {
        fieldMatchers.$gte = value2;
      }
    } else {
      if (value2 >= fieldMatchers.$gte) {
        delete fieldMatchers.$gte;
        fieldMatchers.$gt = value2;
      }
    }
  } else if (typeof fieldMatchers.$gt !== "undefined") {
    if (operator === "$gte") {
      if (value2 > fieldMatchers.$gt) {
        delete fieldMatchers.$gt;
        fieldMatchers.$gte = value2;
      }
    } else {
      if (value2 > fieldMatchers.$gt) {
        fieldMatchers.$gt = value2;
      }
    }
  } else {
    fieldMatchers[operator] = value2;
  }
}
function mergeLtLte(operator, value2, fieldMatchers) {
  if (typeof fieldMatchers.$eq !== "undefined") {
    return;
  }
  if (typeof fieldMatchers.$lte !== "undefined") {
    if (operator === "$lte") {
      if (value2 < fieldMatchers.$lte) {
        fieldMatchers.$lte = value2;
      }
    } else {
      if (value2 <= fieldMatchers.$lte) {
        delete fieldMatchers.$lte;
        fieldMatchers.$lt = value2;
      }
    }
  } else if (typeof fieldMatchers.$lt !== "undefined") {
    if (operator === "$lte") {
      if (value2 < fieldMatchers.$lt) {
        delete fieldMatchers.$lt;
        fieldMatchers.$lte = value2;
      }
    } else {
      if (value2 < fieldMatchers.$lt) {
        fieldMatchers.$lt = value2;
      }
    }
  } else {
    fieldMatchers[operator] = value2;
  }
}
function mergeNe(value2, fieldMatchers) {
  if ("$ne" in fieldMatchers) {
    fieldMatchers.$ne.push(value2);
  } else {
    fieldMatchers.$ne = [value2];
  }
}
function mergeEq(value2, fieldMatchers) {
  delete fieldMatchers.$gt;
  delete fieldMatchers.$gte;
  delete fieldMatchers.$lt;
  delete fieldMatchers.$lte;
  delete fieldMatchers.$ne;
  fieldMatchers.$eq = value2;
}
function mergeRegex(value2, fieldMatchers) {
  if ("$regex" in fieldMatchers) {
    fieldMatchers.$regex.push(value2);
  } else {
    fieldMatchers.$regex = [value2];
  }
}
function mergeAndedSelectorsNested(obj) {
  for (var prop2 in obj) {
    if (Array.isArray(obj)) {
      for (var i in obj) {
        if (obj[i]["$and"]) {
          obj[i] = mergeAndedSelectors(obj[i]["$and"]);
        }
      }
    }
    var value2 = obj[prop2];
    if (typeof value2 === "object") {
      mergeAndedSelectorsNested(value2);
    }
  }
  return obj;
}
function isAndInSelector(obj, isAnd) {
  for (var prop2 in obj) {
    if (prop2 === "$and") {
      isAnd = true;
    }
    var value2 = obj[prop2];
    if (typeof value2 === "object") {
      isAnd = isAndInSelector(value2, isAnd);
    }
  }
  return isAnd;
}
function massageSelector(input) {
  var result = clone(input);
  if (isAndInSelector(result, false)) {
    result = mergeAndedSelectorsNested(result);
    if ("$and" in result) {
      result = mergeAndedSelectors(result["$and"]);
    }
  }
  ["$or", "$nor"].forEach(function(orOrNor) {
    if (orOrNor in result) {
      result[orOrNor].forEach(function(subSelector) {
        var fields2 = Object.keys(subSelector);
        for (var i2 = 0; i2 < fields2.length; i2++) {
          var field2 = fields2[i2];
          var matcher2 = subSelector[field2];
          if (typeof matcher2 !== "object" || matcher2 === null) {
            subSelector[field2] = { $eq: matcher2 };
          }
        }
      });
    }
  });
  if ("$not" in result) {
    result["$not"] = mergeAndedSelectors([result["$not"]]);
  }
  var fields = Object.keys(result);
  for (var i = 0; i < fields.length; i++) {
    var field = fields[i];
    var matcher = result[field];
    if (typeof matcher !== "object" || matcher === null) {
      matcher = { $eq: matcher };
    }
    result[field] = matcher;
  }
  normalizeArrayOperators(result);
  return result;
}
function normalizeArrayOperators(selector) {
  Object.keys(selector).forEach(function(field) {
    var matcher = selector[field];
    if (Array.isArray(matcher)) {
      matcher.forEach(function(matcherItem) {
        if (matcherItem && typeof matcherItem === "object") {
          normalizeArrayOperators(matcherItem);
        }
      });
    } else if (field === "$ne") {
      selector.$ne = [matcher];
    } else if (field === "$regex") {
      selector.$regex = [matcher];
    } else if (matcher && typeof matcher === "object") {
      normalizeArrayOperators(matcher);
    }
  });
}
function createFieldSorter(sort) {
  function getFieldValuesAsArray(doc) {
    return sort.map(function(sorting) {
      var fieldName = getKey2(sorting);
      var parsedField = parseField(fieldName);
      var docFieldValue = getFieldFromDoc(doc, parsedField);
      return docFieldValue;
    });
  }
  return function(aRow, bRow) {
    var aFieldValues = getFieldValuesAsArray(aRow.doc);
    var bFieldValues = getFieldValuesAsArray(bRow.doc);
    var collation = collate(aFieldValues, bFieldValues);
    if (collation !== 0) {
      return collation;
    }
    return compare(aRow.doc._id, bRow.doc._id);
  };
}
function filterInMemoryFields(rows, requestDef, inMemoryFields) {
  rows = rows.filter(function(row) {
    return rowFilter(row.doc, requestDef.selector, inMemoryFields);
  });
  if (requestDef.sort) {
    var fieldSorter = createFieldSorter(requestDef.sort);
    rows = rows.sort(fieldSorter);
    if (typeof requestDef.sort[0] !== "string" && getValue(requestDef.sort[0]) === "desc") {
      rows = rows.reverse();
    }
  }
  if ("limit" in requestDef || "skip" in requestDef) {
    var skip = requestDef.skip || 0;
    var limit = ("limit" in requestDef ? requestDef.limit : rows.length) + skip;
    rows = rows.slice(skip, limit);
  }
  return rows;
}
function rowFilter(doc, selector, inMemoryFields) {
  return inMemoryFields.every(function(field) {
    var matcher = selector[field];
    var parsedField = parseField(field);
    var docFieldValue = getFieldFromDoc(doc, parsedField);
    if (isCombinationalField(field)) {
      return matchCominationalSelector(field, matcher, doc);
    }
    return matchSelector(matcher, doc, parsedField, docFieldValue);
  });
}
function matchSelector(matcher, doc, parsedField, docFieldValue) {
  if (!matcher) {
    return true;
  }
  if (typeof matcher === "object") {
    return Object.keys(matcher).every(function(maybeUserOperator) {
      var userValue = matcher[maybeUserOperator];
      if (maybeUserOperator.indexOf("$") === 0) {
        return match2(maybeUserOperator, doc, userValue, parsedField, docFieldValue);
      } else {
        var subParsedField = parseField(maybeUserOperator);
        if (docFieldValue === void 0 && typeof userValue !== "object" && subParsedField.length > 0) {
          return false;
        }
        var subDocFieldValue = getFieldFromDoc(docFieldValue, subParsedField);
        if (typeof userValue === "object") {
          return matchSelector(userValue, doc, parsedField, subDocFieldValue);
        }
        return match2("$eq", doc, userValue, subParsedField, subDocFieldValue);
      }
    });
  }
  return matcher === docFieldValue;
}
function matchCominationalSelector(field, matcher, doc) {
  if (field === "$or") {
    return matcher.some(function(orMatchers) {
      return rowFilter(doc, orMatchers, Object.keys(orMatchers));
    });
  }
  if (field === "$not") {
    return !rowFilter(doc, matcher, Object.keys(matcher));
  }
  return !matcher.find(function(orMatchers) {
    return rowFilter(doc, orMatchers, Object.keys(orMatchers));
  });
}
function match2(userOperator, doc, userValue, parsedField, docFieldValue) {
  if (!matchers[userOperator]) {
    throw new Error('unknown operator "' + userOperator + '" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');
  }
  return matchers[userOperator](doc, userValue, parsedField, docFieldValue);
}
function fieldExists(docFieldValue) {
  return typeof docFieldValue !== "undefined" && docFieldValue !== null;
}
function fieldIsNotUndefined(docFieldValue) {
  return typeof docFieldValue !== "undefined";
}
function modField(docFieldValue, userValue) {
  if (typeof docFieldValue !== "number" || parseInt(docFieldValue, 10) !== docFieldValue) {
    return false;
  }
  var divisor = userValue[0];
  var mod = userValue[1];
  return docFieldValue % divisor === mod;
}
function arrayContainsValue(docFieldValue, userValue) {
  return userValue.some(function(val) {
    if (docFieldValue instanceof Array) {
      return docFieldValue.some(function(docFieldValueItem) {
        return collate(val, docFieldValueItem) === 0;
      });
    }
    return collate(val, docFieldValue) === 0;
  });
}
function arrayContainsAllValues(docFieldValue, userValue) {
  return userValue.every(function(val) {
    return docFieldValue.some(function(docFieldValueItem) {
      return collate(val, docFieldValueItem) === 0;
    });
  });
}
function arraySize(docFieldValue, userValue) {
  return docFieldValue.length === userValue;
}
function regexMatch(docFieldValue, userValue) {
  var re = new RegExp(userValue);
  return re.test(docFieldValue);
}
function typeMatch(docFieldValue, userValue) {
  switch (userValue) {
    case "null":
      return docFieldValue === null;
    case "boolean":
      return typeof docFieldValue === "boolean";
    case "number":
      return typeof docFieldValue === "number";
    case "string":
      return typeof docFieldValue === "string";
    case "array":
      return docFieldValue instanceof Array;
    case "object":
      return {}.toString.call(docFieldValue) === "[object Object]";
  }
}
function matchesSelector(doc, selector) {
  if (typeof selector !== "object") {
    throw new Error("Selector error: expected a JSON object");
  }
  selector = massageSelector(selector);
  var row = {
    doc
  };
  var rowsMatched = filterInMemoryFields([row], { selector }, Object.keys(selector));
  return rowsMatched && rowsMatched.length === 1;
}
var combinationFields, matchers;
var init_index_es4 = __esm({
  "node_modules/pouchdb-selector-core/lib/index.es.js"() {
    init_index_browser_es3();
    init_index_es3();
    combinationFields = ["$or", "$nor", "$not"];
    matchers = {
      "$elemMatch": function(doc, userValue, parsedField, docFieldValue) {
        if (!Array.isArray(docFieldValue)) {
          return false;
        }
        if (docFieldValue.length === 0) {
          return false;
        }
        if (typeof docFieldValue[0] === "object" && docFieldValue[0] !== null) {
          return docFieldValue.some(function(val) {
            return rowFilter(val, userValue, Object.keys(userValue));
          });
        }
        return docFieldValue.some(function(val) {
          return matchSelector(userValue, doc, parsedField, val);
        });
      },
      "$allMatch": function(doc, userValue, parsedField, docFieldValue) {
        if (!Array.isArray(docFieldValue)) {
          return false;
        }
        if (docFieldValue.length === 0) {
          return false;
        }
        if (typeof docFieldValue[0] === "object" && docFieldValue[0] !== null) {
          return docFieldValue.every(function(val) {
            return rowFilter(val, userValue, Object.keys(userValue));
          });
        }
        return docFieldValue.every(function(val) {
          return matchSelector(userValue, doc, parsedField, val);
        });
      },
      "$eq": function(doc, userValue, parsedField, docFieldValue) {
        return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) === 0;
      },
      "$gte": function(doc, userValue, parsedField, docFieldValue) {
        return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) >= 0;
      },
      "$gt": function(doc, userValue, parsedField, docFieldValue) {
        return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) > 0;
      },
      "$lte": function(doc, userValue, parsedField, docFieldValue) {
        return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) <= 0;
      },
      "$lt": function(doc, userValue, parsedField, docFieldValue) {
        return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) < 0;
      },
      "$exists": function(doc, userValue, parsedField, docFieldValue) {
        if (userValue) {
          return fieldIsNotUndefined(docFieldValue);
        }
        return !fieldIsNotUndefined(docFieldValue);
      },
      "$mod": function(doc, userValue, parsedField, docFieldValue) {
        return fieldExists(docFieldValue) && modField(docFieldValue, userValue);
      },
      "$ne": function(doc, userValue, parsedField, docFieldValue) {
        return userValue.every(function(neValue) {
          return collate(docFieldValue, neValue) !== 0;
        });
      },
      "$in": function(doc, userValue, parsedField, docFieldValue) {
        return fieldExists(docFieldValue) && arrayContainsValue(docFieldValue, userValue);
      },
      "$nin": function(doc, userValue, parsedField, docFieldValue) {
        return fieldExists(docFieldValue) && !arrayContainsValue(docFieldValue, userValue);
      },
      "$size": function(doc, userValue, parsedField, docFieldValue) {
        return fieldExists(docFieldValue) && Array.isArray(docFieldValue) && arraySize(docFieldValue, userValue);
      },
      "$all": function(doc, userValue, parsedField, docFieldValue) {
        return Array.isArray(docFieldValue) && arrayContainsAllValues(docFieldValue, userValue);
      },
      "$regex": function(doc, userValue, parsedField, docFieldValue) {
        return fieldExists(docFieldValue) && typeof docFieldValue == "string" && userValue.every(function(regexValue) {
          return regexMatch(docFieldValue, regexValue);
        });
      },
      "$type": function(doc, userValue, parsedField, docFieldValue) {
        return typeMatch(docFieldValue, userValue);
      }
    };
  }
});

// node_modules/pouchdb-changes-filter/lib/index-browser.es.js
function evalFilter(input) {
  return scopeEval('"use strict";\nreturn ' + input + ";", {});
}
function evalView(input) {
  var code = [
    "return function(doc) {",
    '  "use strict";',
    "  var emitted = false;",
    "  var emit = function (a, b) {",
    "    emitted = true;",
    "  };",
    "  var view = " + input + ";",
    "  view(doc);",
    "  if (emitted) {",
    "    return true;",
    "  }",
    "};"
  ].join("\n");
  return scopeEval(code, {});
}
function validate2(opts, callback) {
  if (opts.selector) {
    if (opts.filter && opts.filter !== "_selector") {
      var filterName = typeof opts.filter === "string" ? opts.filter : "function";
      return callback(new Error('selector invalid for filter "' + filterName + '"'));
    }
  }
  callback();
}
function normalize(opts) {
  if (opts.view && !opts.filter) {
    opts.filter = "_view";
  }
  if (opts.selector && !opts.filter) {
    opts.filter = "_selector";
  }
  if (opts.filter && typeof opts.filter === "string") {
    if (opts.filter === "_view") {
      opts.view = normalizeDesignDocFunctionName(opts.view);
    } else {
      opts.filter = normalizeDesignDocFunctionName(opts.filter);
    }
  }
}
function shouldFilter(changesHandler, opts) {
  return opts.filter && typeof opts.filter === "string" && !opts.doc_ids && !isRemote(changesHandler.db);
}
function filter2(changesHandler, opts) {
  var callback = opts.complete;
  if (opts.filter === "_view") {
    if (!opts.view || typeof opts.view !== "string") {
      var err2 = createError(
        BAD_REQUEST,
        "`view` filter parameter not found or invalid."
      );
      return callback(err2);
    }
    var viewName = parseDesignDocFunctionName(opts.view);
    changesHandler.db.get("_design/" + viewName[0], function(err3, ddoc) {
      if (changesHandler.isCancelled) {
        return callback(null, { status: "cancelled" });
      }
      if (err3) {
        return callback(generateErrorFromResponse(err3));
      }
      var mapFun = ddoc && ddoc.views && ddoc.views[viewName[1]] && ddoc.views[viewName[1]].map;
      if (!mapFun) {
        return callback(createError(
          MISSING_DOC,
          ddoc.views ? "missing json key: " + viewName[1] : "missing json key: views"
        ));
      }
      opts.filter = evalView(mapFun);
      changesHandler.doChanges(opts);
    });
  } else if (opts.selector) {
    opts.filter = function(doc) {
      return matchesSelector(doc, opts.selector);
    };
    changesHandler.doChanges(opts);
  } else {
    var filterName = parseDesignDocFunctionName(opts.filter);
    changesHandler.db.get("_design/" + filterName[0], function(err3, ddoc) {
      if (changesHandler.isCancelled) {
        return callback(null, { status: "cancelled" });
      }
      if (err3) {
        return callback(generateErrorFromResponse(err3));
      }
      var filterFun = ddoc && ddoc.filters && ddoc.filters[filterName[1]];
      if (!filterFun) {
        return callback(createError(
          MISSING_DOC,
          ddoc && ddoc.filters ? "missing json key: " + filterName[1] : "missing json key: filters"
        ));
      }
      opts.filter = evalFilter(filterFun);
      changesHandler.doChanges(opts);
    });
  }
}
function applyChangesFilterPlugin(PouchDB3) {
  PouchDB3._changesFilterPlugin = {
    validate: validate2,
    normalize,
    shouldFilter,
    filter: filter2
  };
}
var index_browser_es_default;
var init_index_browser_es5 = __esm({
  "node_modules/pouchdb-changes-filter/lib/index-browser.es.js"() {
    init_index_es();
    init_index_es4();
    init_index_browser_es3();
    index_browser_es_default = applyChangesFilterPlugin;
  }
});

// node_modules/pouchdb-core/lib/index.es.js
function tryCatchInChangeListener(self3, change, pending2, lastSeq) {
  try {
    self3.emit("change", change, pending2, lastSeq);
  } catch (e2) {
    guardedConsole("error", 'Error in .on("change", function):', e2);
  }
}
function processChange(doc, metadata, opts) {
  var changeList = [{ rev: doc._rev }];
  if (opts.style === "all_docs") {
    changeList = collectLeaves(metadata.rev_tree).map(function(x) {
      return { rev: x.rev };
    });
  }
  var change = {
    id: metadata.id,
    changes: changeList,
    doc
  };
  if (isDeleted(metadata, doc._rev)) {
    change.deleted = true;
  }
  if (opts.conflicts) {
    change.doc._conflicts = collectConflicts(metadata);
    if (!change.doc._conflicts.length) {
      delete change.doc._conflicts;
    }
  }
  return change;
}
function yankError(callback, docId) {
  return function(err2, results) {
    if (err2 || results[0] && results[0].error) {
      err2 = err2 || results[0];
      err2.docId = docId;
      callback(err2);
    } else {
      callback(null, results.length ? results[0] : results);
    }
  };
}
function cleanDocs(docs) {
  for (var i = 0; i < docs.length; i++) {
    var doc = docs[i];
    if (doc._deleted) {
      delete doc._attachments;
    } else if (doc._attachments) {
      var atts = Object.keys(doc._attachments);
      for (var j = 0; j < atts.length; j++) {
        var att = atts[j];
        doc._attachments[att] = pick(
          doc._attachments[att],
          ["data", "digest", "content_type", "length", "revpos", "stub"]
        );
      }
    }
  }
}
function compareByIdThenRev(a, b) {
  if (a._id === b._id) {
    const aStart = a._revisions ? a._revisions.start : 0;
    const bStart = b._revisions ? b._revisions.start : 0;
    return aStart - bStart;
  }
  return a._id < b._id ? -1 : 1;
}
function computeHeight(revs) {
  var height = {};
  var edges = [];
  traverseRevTree(revs, function(isLeaf, pos2, id, prnt) {
    var rev$$1 = pos2 + "-" + id;
    if (isLeaf) {
      height[rev$$1] = 0;
    }
    if (prnt !== void 0) {
      edges.push({ from: prnt, to: rev$$1 });
    }
    return rev$$1;
  });
  edges.reverse();
  edges.forEach(function(edge) {
    if (height[edge.from] === void 0) {
      height[edge.from] = 1 + height[edge.to];
    } else {
      height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);
    }
  });
  return height;
}
function allDocsKeysParse(opts) {
  var keys2 = "limit" in opts ? opts.keys.slice(opts.skip, opts.limit + opts.skip) : opts.skip > 0 ? opts.keys.slice(opts.skip) : opts.keys;
  opts.keys = keys2;
  opts.skip = 0;
  delete opts.limit;
  if (opts.descending) {
    keys2.reverse();
    opts.descending = false;
  }
}
function doNextCompaction(self3) {
  var task = self3._compactionQueue[0];
  var opts = task.opts;
  var callback = task.callback;
  self3.get("_local/compaction").catch(function() {
    return false;
  }).then(function(doc) {
    if (doc && doc.last_seq) {
      opts.last_seq = doc.last_seq;
    }
    self3._compact(opts, function(err2, res2) {
      if (err2) {
        callback(err2);
      } else {
        callback(null, res2);
      }
      nextTick(function() {
        self3._compactionQueue.shift();
        if (self3._compactionQueue.length) {
          doNextCompaction(self3);
        }
      });
    });
  });
}
function appendPurgeSeq(db, docId, rev$$1) {
  return db.get("_local/purges").then(function(doc) {
    const purgeSeq = doc.purgeSeq + 1;
    doc.purges.push({
      docId,
      rev: rev$$1,
      purgeSeq
    });
    if (doc.purges.length > self.purged_infos_limit) {
      doc.purges.splice(0, doc.purges.length - self.purged_infos_limit);
    }
    doc.purgeSeq = purgeSeq;
    return doc;
  }).catch(function(err2) {
    if (err2.status !== 404) {
      throw err2;
    }
    return {
      _id: "_local/purges",
      purges: [{
        docId,
        rev: rev$$1,
        purgeSeq: 0
      }],
      purgeSeq: 0
    };
  }).then(function(doc) {
    return db.put(doc);
  });
}
function attachmentNameError(name) {
  if (name.charAt(0) === "_") {
    return name + " is not a valid attachment name, attachment names cannot start with '_'";
  }
  return false;
}
function isNotSingleDoc(doc) {
  return doc === null || typeof doc !== "object" || Array.isArray(doc);
}
function isValidRev(rev$$1) {
  return typeof rev$$1 === "string" && validRevRegex.test(rev$$1);
}
function parseAdapter(name, opts) {
  var match3 = name.match(/([a-z-]*):\/\/(.*)/);
  if (match3) {
    return {
      name: /https?/.test(match3[1]) ? match3[1] + "://" + match3[2] : match3[2],
      adapter: match3[1]
    };
  }
  var adapters = PouchDB.adapters;
  var preferredAdapters = PouchDB.preferredAdapters;
  var prefix = PouchDB.prefix;
  var adapterName = opts.adapter;
  if (!adapterName) {
    for (var i = 0; i < preferredAdapters.length; ++i) {
      adapterName = preferredAdapters[i];
      if (adapterName === "idb" && "websql" in adapters && hasLocalStorage() && localStorage["_pouch__websqldb_" + prefix + name]) {
        guardedConsole("log", 'PouchDB is downgrading "' + name + '" to WebSQL to avoid data loss, because it was already opened with WebSQL.');
        continue;
      }
      break;
    }
  }
  var adapter = adapters[adapterName];
  var usePrefix = adapter && "use_prefix" in adapter ? adapter.use_prefix : true;
  return {
    name: usePrefix ? prefix + name : name,
    adapter: adapterName
  };
}
function inherits(A, B) {
  A.prototype = Object.create(B.prototype, {
    constructor: { value: A }
  });
}
function createClass(parent, init3) {
  let klass = function(...args) {
    if (!(this instanceof klass)) {
      return new klass(...args);
    }
    init3.apply(this, args);
  };
  inherits(klass, parent);
  return klass;
}
function prepareForDestruction(self3) {
  function onDestroyed(from_constructor) {
    self3.removeListener("closed", onClosed);
    if (!from_constructor) {
      self3.constructor.emit("destroyed", self3.name);
    }
  }
  function onClosed() {
    self3.removeListener("destroyed", onDestroyed);
    self3.constructor.emit("unref", self3);
  }
  self3.once("destroyed", onDestroyed);
  self3.once("closed", onClosed);
  self3.constructor.emit("ref", self3);
}
function setUpEventEmitter(Pouch) {
  Object.keys(import_events3.default.prototype).forEach(function(key4) {
    if (typeof import_events3.default.prototype[key4] === "function") {
      Pouch[key4] = eventEmitter[key4].bind(eventEmitter);
    }
  });
  var destructListeners = Pouch._destructionListeners = /* @__PURE__ */ new Map();
  Pouch.on("ref", function onConstructorRef(db) {
    if (!destructListeners.has(db.name)) {
      destructListeners.set(db.name, []);
    }
    destructListeners.get(db.name).push(db);
  });
  Pouch.on("unref", function onConstructorUnref(db) {
    if (!destructListeners.has(db.name)) {
      return;
    }
    var dbList = destructListeners.get(db.name);
    var pos2 = dbList.indexOf(db);
    if (pos2 < 0) {
      return;
    }
    dbList.splice(pos2, 1);
    if (dbList.length > 1) {
      destructListeners.set(db.name, dbList);
    } else {
      destructListeners.delete(db.name);
    }
  });
  Pouch.on("destroyed", function onConstructorDestroyed(name) {
    if (!destructListeners.has(name)) {
      return;
    }
    var dbList = destructListeners.get(name);
    destructListeners.delete(name);
    dbList.forEach(function(db) {
      db.emit("destroyed", true);
    });
  });
}
var import_events3, Changes2, validRevRegex, AbstractPouchDB, TaskQueue, PouchInternal, PouchDB, ActiveTasks, eventEmitter, version, index_es_default;
var init_index_es5 = __esm({
  "node_modules/pouchdb-core/lib/index.es.js"() {
    init_index_es2();
    init_index_es();
    init_index_browser_es3();
    import_events3 = __toESM2(require_events());
    init_index_browser_es4();
    init_esm_browser();
    init_index_browser_es5();
    Changes2 = class extends import_events3.default {
      constructor(db, opts, callback) {
        super();
        this.db = db;
        opts = opts ? clone(opts) : {};
        var complete = opts.complete = once((err2, resp) => {
          if (err2) {
            if (listenerCount(this, "error") > 0) {
              this.emit("error", err2);
            }
          } else {
            this.emit("complete", resp);
          }
          this.removeAllListeners();
          db.removeListener("destroyed", onDestroy2);
        });
        if (callback) {
          this.on("complete", function(resp) {
            callback(null, resp);
          });
          this.on("error", callback);
        }
        const onDestroy2 = () => {
          this.cancel();
        };
        db.once("destroyed", onDestroy2);
        opts.onChange = (change, pending2, lastSeq) => {
          if (this.isCancelled) {
            return;
          }
          tryCatchInChangeListener(this, change, pending2, lastSeq);
        };
        var promise = new Promise(function(fulfill, reject) {
          opts.complete = function(err2, res2) {
            if (err2) {
              reject(err2);
            } else {
              fulfill(res2);
            }
          };
        });
        this.once("cancel", function() {
          db.removeListener("destroyed", onDestroy2);
          opts.complete(null, { status: "cancelled" });
        });
        this.then = promise.then.bind(promise);
        this["catch"] = promise["catch"].bind(promise);
        this.then(function(result) {
          complete(null, result);
        }, complete);
        if (!db.taskqueue.isReady) {
          db.taskqueue.addTask((failed2) => {
            if (failed2) {
              opts.complete(failed2);
            } else if (this.isCancelled) {
              this.emit("cancel");
            } else {
              this.validateChanges(opts);
            }
          });
        } else {
          this.validateChanges(opts);
        }
      }
      cancel() {
        this.isCancelled = true;
        if (this.db.taskqueue.isReady) {
          this.emit("cancel");
        }
      }
      validateChanges(opts) {
        var callback = opts.complete;
        if (PouchDB._changesFilterPlugin) {
          PouchDB._changesFilterPlugin.validate(opts, (err2) => {
            if (err2) {
              return callback(err2);
            }
            this.doChanges(opts);
          });
        } else {
          this.doChanges(opts);
        }
      }
      doChanges(opts) {
        var callback = opts.complete;
        opts = clone(opts);
        if ("live" in opts && !("continuous" in opts)) {
          opts.continuous = opts.live;
        }
        opts.processChange = processChange;
        if (opts.since === "latest") {
          opts.since = "now";
        }
        if (!opts.since) {
          opts.since = 0;
        }
        if (opts.since === "now") {
          this.db.info().then((info3) => {
            if (this.isCancelled) {
              callback(null, { status: "cancelled" });
              return;
            }
            opts.since = info3.update_seq;
            this.doChanges(opts);
          }, callback);
          return;
        }
        if (PouchDB._changesFilterPlugin) {
          PouchDB._changesFilterPlugin.normalize(opts);
          if (PouchDB._changesFilterPlugin.shouldFilter(this, opts)) {
            return PouchDB._changesFilterPlugin.filter(this, opts);
          }
        } else {
          ["doc_ids", "filter", "selector", "view"].forEach(function(key4) {
            if (key4 in opts) {
              guardedConsole(
                "warn",
                'The "' + key4 + '" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.'
              );
            }
          });
        }
        if (!("descending" in opts)) {
          opts.descending = false;
        }
        opts.limit = opts.limit === 0 ? 1 : opts.limit;
        opts.complete = callback;
        var newPromise = this.db._changes(opts);
        if (newPromise && typeof newPromise.cancel === "function") {
          const cancel = this.cancel;
          this.cancel = (...args) => {
            newPromise.cancel();
            cancel.apply(this, args);
          };
        }
      }
    };
    validRevRegex = /^\d+-[^-]*$/;
    AbstractPouchDB = class extends import_events3.default {
      _setup() {
        this.post = adapterFun("post", function(doc, opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          if (isNotSingleDoc(doc)) {
            return callback(createError(NOT_AN_OBJECT));
          }
          this.bulkDocs({ docs: [doc] }, opts, yankError(callback, doc._id));
        }).bind(this);
        this.put = adapterFun("put", function(doc, opts, cb) {
          if (typeof opts === "function") {
            cb = opts;
            opts = {};
          }
          if (isNotSingleDoc(doc)) {
            return cb(createError(NOT_AN_OBJECT));
          }
          invalidIdError(doc._id);
          if ("_rev" in doc && !isValidRev(doc._rev)) {
            return cb(createError(INVALID_REV));
          }
          if (isLocalId(doc._id) && typeof this._putLocal === "function") {
            if (doc._deleted) {
              return this._removeLocal(doc, cb);
            } else {
              return this._putLocal(doc, cb);
            }
          }
          const putDoc = (next2) => {
            if (typeof this._put === "function" && opts.new_edits !== false) {
              this._put(doc, opts, next2);
            } else {
              this.bulkDocs({ docs: [doc] }, opts, yankError(next2, doc._id));
            }
          };
          if (opts.force && doc._rev) {
            transformForceOptionToNewEditsOption();
            putDoc(function(err2) {
              var result = err2 ? null : { ok: true, id: doc._id, rev: doc._rev };
              cb(err2, result);
            });
          } else {
            putDoc(cb);
          }
          function transformForceOptionToNewEditsOption() {
            var parts = doc._rev.split("-");
            var oldRevId = parts[1];
            var oldRevNum = parseInt(parts[0], 10);
            var newRevNum = oldRevNum + 1;
            var newRevId = rev2();
            doc._revisions = {
              start: newRevNum,
              ids: [newRevId, oldRevId]
            };
            doc._rev = newRevNum + "-" + newRevId;
            opts.new_edits = false;
          }
        }).bind(this);
        this.putAttachment = adapterFun("putAttachment", function(docId, attachmentId, rev$$1, blob, type) {
          var api = this;
          if (typeof type === "function") {
            type = blob;
            blob = rev$$1;
            rev$$1 = null;
          }
          if (typeof type === "undefined") {
            type = blob;
            blob = rev$$1;
            rev$$1 = null;
          }
          if (!type) {
            guardedConsole("warn", "Attachment", attachmentId, "on document", docId, "is missing content_type");
          }
          function createAttachment(doc) {
            var prevrevpos = "_rev" in doc ? parseInt(doc._rev, 10) : 0;
            doc._attachments = doc._attachments || {};
            doc._attachments[attachmentId] = {
              content_type: type,
              data: blob,
              revpos: ++prevrevpos
            };
            return api.put(doc);
          }
          return api.get(docId).then(function(doc) {
            if (doc._rev !== rev$$1) {
              throw createError(REV_CONFLICT);
            }
            return createAttachment(doc);
          }, function(err2) {
            if (err2.reason === MISSING_DOC.message) {
              return createAttachment({ _id: docId });
            } else {
              throw err2;
            }
          });
        }).bind(this);
        this.removeAttachment = adapterFun("removeAttachment", function(docId, attachmentId, rev$$1, callback) {
          this.get(docId, (err2, obj) => {
            if (err2) {
              callback(err2);
              return;
            }
            if (obj._rev !== rev$$1) {
              callback(createError(REV_CONFLICT));
              return;
            }
            if (!obj._attachments) {
              return callback();
            }
            delete obj._attachments[attachmentId];
            if (Object.keys(obj._attachments).length === 0) {
              delete obj._attachments;
            }
            this.put(obj, callback);
          });
        }).bind(this);
        this.remove = adapterFun("remove", function(docOrId, optsOrRev, opts, callback) {
          var doc;
          if (typeof optsOrRev === "string") {
            doc = {
              _id: docOrId,
              _rev: optsOrRev
            };
            if (typeof opts === "function") {
              callback = opts;
              opts = {};
            }
          } else {
            doc = docOrId;
            if (typeof optsOrRev === "function") {
              callback = optsOrRev;
              opts = {};
            } else {
              callback = opts;
              opts = optsOrRev;
            }
          }
          opts = opts || {};
          opts.was_delete = true;
          var newDoc = { _id: doc._id, _rev: doc._rev || opts.rev };
          newDoc._deleted = true;
          if (isLocalId(newDoc._id) && typeof this._removeLocal === "function") {
            return this._removeLocal(doc, callback);
          }
          this.bulkDocs({ docs: [newDoc] }, opts, yankError(callback, newDoc._id));
        }).bind(this);
        this.revsDiff = adapterFun("revsDiff", function(req, opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          var ids = Object.keys(req);
          if (!ids.length) {
            return callback(null, {});
          }
          var count = 0;
          var missing = /* @__PURE__ */ new Map();
          function addToMissing(id, revId) {
            if (!missing.has(id)) {
              missing.set(id, { missing: [] });
            }
            missing.get(id).missing.push(revId);
          }
          function processDoc(id, rev_tree) {
            var missingForId = req[id].slice(0);
            traverseRevTree(rev_tree, function(isLeaf, pos2, revHash, ctx, opts2) {
              var rev$$1 = pos2 + "-" + revHash;
              var idx2 = missingForId.indexOf(rev$$1);
              if (idx2 === -1) {
                return;
              }
              missingForId.splice(idx2, 1);
              if (opts2.status !== "available") {
                addToMissing(id, rev$$1);
              }
            });
            missingForId.forEach(function(rev$$1) {
              addToMissing(id, rev$$1);
            });
          }
          ids.forEach(function(id) {
            this._getRevisionTree(id, function(err2, rev_tree) {
              if (err2 && err2.status === 404 && err2.message === "missing") {
                missing.set(id, { missing: req[id] });
              } else if (err2) {
                return callback(err2);
              } else {
                processDoc(id, rev_tree);
              }
              if (++count === ids.length) {
                var missingObj = {};
                missing.forEach(function(value2, key4) {
                  missingObj[key4] = value2;
                });
                return callback(null, missingObj);
              }
            });
          }, this);
        }).bind(this);
        this.bulkGet = adapterFun("bulkGet", function(opts, callback) {
          bulkGet(this, opts, callback);
        }).bind(this);
        this.compactDocument = adapterFun("compactDocument", function(docId, maxHeight, callback) {
          this._getRevisionTree(docId, (err2, revTree) => {
            if (err2) {
              return callback(err2);
            }
            var height = computeHeight(revTree);
            var candidates = [];
            var revs = [];
            Object.keys(height).forEach(function(rev$$1) {
              if (height[rev$$1] > maxHeight) {
                candidates.push(rev$$1);
              }
            });
            traverseRevTree(revTree, function(isLeaf, pos2, revHash, ctx, opts) {
              var rev$$1 = pos2 + "-" + revHash;
              if (opts.status === "available" && candidates.indexOf(rev$$1) !== -1) {
                revs.push(rev$$1);
              }
            });
            this._doCompaction(docId, revs, callback);
          });
        }).bind(this);
        this.compact = adapterFun("compact", function(opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          opts = opts || {};
          this._compactionQueue = this._compactionQueue || [];
          this._compactionQueue.push({ opts, callback });
          if (this._compactionQueue.length === 1) {
            doNextCompaction(this);
          }
        }).bind(this);
        this.get = adapterFun("get", function(id, opts, cb) {
          if (typeof opts === "function") {
            cb = opts;
            opts = {};
          }
          opts = opts || {};
          if (typeof id !== "string") {
            return cb(createError(INVALID_ID));
          }
          if (isLocalId(id) && typeof this._getLocal === "function") {
            return this._getLocal(id, cb);
          }
          var leaves = [];
          const finishOpenRevs = () => {
            var result = [];
            var count = leaves.length;
            if (!count) {
              return cb(null, result);
            }
            leaves.forEach((leaf) => {
              this.get(id, {
                rev: leaf,
                revs: opts.revs,
                latest: opts.latest,
                attachments: opts.attachments,
                binary: opts.binary
              }, function(err2, doc) {
                if (!err2) {
                  var existing;
                  for (var i2 = 0, l2 = result.length; i2 < l2; i2++) {
                    if (result[i2].ok && result[i2].ok._rev === doc._rev) {
                      existing = true;
                      break;
                    }
                  }
                  if (!existing) {
                    result.push({ ok: doc });
                  }
                } else {
                  result.push({ missing: leaf });
                }
                count--;
                if (!count) {
                  cb(null, result);
                }
              });
            });
          };
          if (opts.open_revs) {
            if (opts.open_revs === "all") {
              this._getRevisionTree(id, function(err2, rev_tree) {
                if (err2) {
                  return cb(err2);
                }
                leaves = collectLeaves(rev_tree).map(function(leaf) {
                  return leaf.rev;
                });
                finishOpenRevs();
              });
            } else {
              if (Array.isArray(opts.open_revs)) {
                leaves = opts.open_revs;
                for (var i = 0; i < leaves.length; i++) {
                  var l = leaves[i];
                  if (!isValidRev(l)) {
                    return cb(createError(INVALID_REV));
                  }
                }
                finishOpenRevs();
              } else {
                return cb(createError(UNKNOWN_ERROR, "function_clause"));
              }
            }
            return;
          }
          return this._get(id, opts, (err2, result) => {
            if (err2) {
              err2.docId = id;
              return cb(err2);
            }
            var doc = result.doc;
            var metadata = result.metadata;
            var ctx = result.ctx;
            if (opts.conflicts) {
              var conflicts = collectConflicts(metadata);
              if (conflicts.length) {
                doc._conflicts = conflicts;
              }
            }
            if (isDeleted(metadata, doc._rev)) {
              doc._deleted = true;
            }
            if (opts.revs || opts.revs_info) {
              var splittedRev = doc._rev.split("-");
              var revNo = parseInt(splittedRev[0], 10);
              var revHash = splittedRev[1];
              var paths = rootToLeaf(metadata.rev_tree);
              var path8 = null;
              for (var i2 = 0; i2 < paths.length; i2++) {
                var currentPath = paths[i2];
                const hashIndex = currentPath.ids.findIndex((x) => x.id === revHash);
                var hashFoundAtRevPos = hashIndex === revNo - 1;
                if (hashFoundAtRevPos || !path8 && hashIndex !== -1) {
                  path8 = currentPath;
                }
              }
              if (!path8) {
                err2 = new Error("invalid rev tree");
                err2.docId = id;
                return cb(err2);
              }
              const pathId = doc._rev.split("-")[1];
              const indexOfRev = path8.ids.findIndex((x) => x.id === pathId) + 1;
              var howMany = path8.ids.length - indexOfRev;
              path8.ids.splice(indexOfRev, howMany);
              path8.ids.reverse();
              if (opts.revs) {
                doc._revisions = {
                  start: path8.pos + path8.ids.length - 1,
                  ids: path8.ids.map(function(rev$$1) {
                    return rev$$1.id;
                  })
                };
              }
              if (opts.revs_info) {
                var pos2 = path8.pos + path8.ids.length;
                doc._revs_info = path8.ids.map(function(rev$$1) {
                  pos2--;
                  return {
                    rev: pos2 + "-" + rev$$1.id,
                    status: rev$$1.opts.status
                  };
                });
              }
            }
            if (opts.attachments && doc._attachments) {
              var attachments = doc._attachments;
              var count = Object.keys(attachments).length;
              if (count === 0) {
                return cb(null, doc);
              }
              Object.keys(attachments).forEach((key5) => {
                this._getAttachment(doc._id, key5, attachments[key5], {
                  binary: opts.binary,
                  metadata,
                  ctx
                }, function(err3, data) {
                  var att = doc._attachments[key5];
                  att.data = data;
                  delete att.stub;
                  delete att.length;
                  if (!--count) {
                    cb(null, doc);
                  }
                });
              });
            } else {
              if (doc._attachments) {
                for (var key4 in doc._attachments) {
                  if (Object.prototype.hasOwnProperty.call(doc._attachments, key4)) {
                    doc._attachments[key4].stub = true;
                  }
                }
              }
              cb(null, doc);
            }
          });
        }).bind(this);
        this.getAttachment = adapterFun("getAttachment", function(docId, attachmentId, opts, callback) {
          if (opts instanceof Function) {
            callback = opts;
            opts = {};
          }
          this._get(docId, opts, (err2, res2) => {
            if (err2) {
              return callback(err2);
            }
            if (res2.doc._attachments && res2.doc._attachments[attachmentId]) {
              opts.ctx = res2.ctx;
              opts.binary = true;
              opts.metadata = res2.metadata;
              this._getAttachment(
                docId,
                attachmentId,
                res2.doc._attachments[attachmentId],
                opts,
                callback
              );
            } else {
              return callback(createError(MISSING_DOC));
            }
          });
        }).bind(this);
        this.allDocs = adapterFun("allDocs", function(opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          opts.skip = typeof opts.skip !== "undefined" ? opts.skip : 0;
          if (opts.start_key) {
            opts.startkey = opts.start_key;
          }
          if (opts.end_key) {
            opts.endkey = opts.end_key;
          }
          if ("keys" in opts) {
            if (!Array.isArray(opts.keys)) {
              return callback(new TypeError("options.keys must be an array"));
            }
            var incompatibleOpt = ["startkey", "endkey", "key"].filter(function(incompatibleOpt2) {
              return incompatibleOpt2 in opts;
            })[0];
            if (incompatibleOpt) {
              callback(createError(
                QUERY_PARSE_ERROR,
                "Query parameter `" + incompatibleOpt + "` is not compatible with multi-get"
              ));
              return;
            }
            if (!isRemote(this)) {
              allDocsKeysParse(opts);
              if (opts.keys.length === 0) {
                return this._allDocs({ limit: 0 }, callback);
              }
            }
          }
          return this._allDocs(opts, callback);
        }).bind(this);
        this.close = adapterFun("close", function(callback) {
          this._closed = true;
          this.emit("closed");
          return this._close(callback);
        }).bind(this);
        this.info = adapterFun("info", function(callback) {
          this._info((err2, info3) => {
            if (err2) {
              return callback(err2);
            }
            info3.db_name = info3.db_name || this.name;
            info3.auto_compaction = !!(this.auto_compaction && !isRemote(this));
            info3.adapter = this.adapter;
            callback(null, info3);
          });
        }).bind(this);
        this.id = adapterFun("id", function(callback) {
          return this._id(callback);
        }).bind(this);
        this.bulkDocs = adapterFun("bulkDocs", function(req, opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          opts = opts || {};
          if (Array.isArray(req)) {
            req = {
              docs: req
            };
          }
          if (!req || !req.docs || !Array.isArray(req.docs)) {
            return callback(createError(MISSING_BULK_DOCS));
          }
          for (var i = 0; i < req.docs.length; ++i) {
            const doc = req.docs[i];
            if (isNotSingleDoc(doc)) {
              return callback(createError(NOT_AN_OBJECT));
            }
            if ("_rev" in doc && !isValidRev(doc._rev)) {
              return callback(createError(INVALID_REV));
            }
          }
          var attachmentError;
          req.docs.forEach(function(doc) {
            if (doc._attachments) {
              Object.keys(doc._attachments).forEach(function(name) {
                attachmentError = attachmentError || attachmentNameError(name);
                if (!doc._attachments[name].content_type) {
                  guardedConsole("warn", "Attachment", name, "on document", doc._id, "is missing content_type");
                }
              });
            }
          });
          if (attachmentError) {
            return callback(createError(BAD_REQUEST, attachmentError));
          }
          if (!("new_edits" in opts)) {
            if ("new_edits" in req) {
              opts.new_edits = req.new_edits;
            } else {
              opts.new_edits = true;
            }
          }
          var adapter = this;
          if (!opts.new_edits && !isRemote(adapter)) {
            req.docs.sort(compareByIdThenRev);
          }
          cleanDocs(req.docs);
          var ids = req.docs.map(function(doc) {
            return doc._id;
          });
          this._bulkDocs(req, opts, function(err2, res2) {
            if (err2) {
              return callback(err2);
            }
            if (!opts.new_edits) {
              res2 = res2.filter(function(x) {
                return x.error;
              });
            }
            if (!isRemote(adapter)) {
              for (var i2 = 0, l = res2.length; i2 < l; i2++) {
                res2[i2].id = res2[i2].id || ids[i2];
              }
            }
            callback(null, res2);
          });
        }).bind(this);
        this.registerDependentDatabase = adapterFun("registerDependentDatabase", function(dependentDb, callback) {
          var dbOptions = clone(this.__opts);
          if (this.__opts.view_adapter) {
            dbOptions.adapter = this.__opts.view_adapter;
          }
          var depDB = new this.constructor(dependentDb, dbOptions);
          function diffFun(doc) {
            doc.dependentDbs = doc.dependentDbs || {};
            if (doc.dependentDbs[dependentDb]) {
              return false;
            }
            doc.dependentDbs[dependentDb] = true;
            return doc;
          }
          upsert(this, "_local/_pouch_dependentDbs", diffFun).then(function() {
            callback(null, { db: depDB });
          }).catch(callback);
        }).bind(this);
        this.destroy = adapterFun("destroy", function(opts, callback) {
          if (typeof opts === "function") {
            callback = opts;
            opts = {};
          }
          var usePrefix = "use_prefix" in this ? this.use_prefix : true;
          const destroyDb = () => {
            this._destroy(opts, (err2, resp) => {
              if (err2) {
                return callback(err2);
              }
              this._destroyed = true;
              this.emit("destroyed");
              callback(null, resp || { "ok": true });
            });
          };
          if (isRemote(this)) {
            return destroyDb();
          }
          this.get("_local/_pouch_dependentDbs", (err2, localDoc) => {
            if (err2) {
              if (err2.status !== 404) {
                return callback(err2);
              } else {
                return destroyDb();
              }
            }
            var dependentDbs = localDoc.dependentDbs;
            var PouchDB3 = this.constructor;
            var deletedMap = Object.keys(dependentDbs).map((name) => {
              var trueName = usePrefix ? name.replace(new RegExp("^" + PouchDB3.prefix), "") : name;
              return new PouchDB3(trueName, this.__opts).destroy();
            });
            Promise.all(deletedMap).then(destroyDb, callback);
          });
        }).bind(this);
      }
      _compact(opts, callback) {
        var changesOpts = {
          return_docs: false,
          last_seq: opts.last_seq || 0,
          since: opts.last_seq || 0
        };
        var promises6 = [];
        var taskId;
        var compactedDocs = 0;
        const onChange = (row) => {
          this.activeTasks.update(taskId, {
            completed_items: ++compactedDocs
          });
          promises6.push(this.compactDocument(row.id, 0));
        };
        const onError = (err2) => {
          this.activeTasks.remove(taskId, err2);
          callback(err2);
        };
        const onComplete = (resp) => {
          var lastSeq = resp.last_seq;
          Promise.all(promises6).then(() => {
            return upsert(this, "_local/compaction", (doc) => {
              if (!doc.last_seq || doc.last_seq < lastSeq) {
                doc.last_seq = lastSeq;
                return doc;
              }
              return false;
            });
          }).then(() => {
            this.activeTasks.remove(taskId);
            callback(null, { ok: true });
          }).catch(onError);
        };
        this.info().then((info3) => {
          taskId = this.activeTasks.add({
            name: "database_compaction",
            total_items: info3.update_seq - changesOpts.last_seq
          });
          this.changes(changesOpts).on("change", onChange).on("complete", onComplete).on("error", onError);
        });
      }
      changes(opts, callback) {
        if (typeof opts === "function") {
          callback = opts;
          opts = {};
        }
        opts = opts || {};
        opts.return_docs = "return_docs" in opts ? opts.return_docs : !opts.live;
        return new Changes2(this, opts, callback);
      }
      type() {
        return typeof this._type === "function" ? this._type() : this.adapter;
      }
    };
    AbstractPouchDB.prototype.purge = adapterFun("_purge", function(docId, rev$$1, callback) {
      if (typeof this._purge === "undefined") {
        return callback(createError(UNKNOWN_ERROR, "Purge is not implemented in the " + this.adapter + " adapter."));
      }
      var self3 = this;
      self3._getRevisionTree(docId, (error2, revs) => {
        if (error2) {
          return callback(error2);
        }
        if (!revs) {
          return callback(createError(MISSING_DOC));
        }
        let path8;
        try {
          path8 = findPathToLeaf(revs, rev$$1);
        } catch (error3) {
          return callback(error3.message || error3);
        }
        self3._purge(docId, path8, (error3, result) => {
          if (error3) {
            return callback(error3);
          } else {
            appendPurgeSeq(self3, docId, rev$$1).then(function() {
              return callback(null, result);
            });
          }
        });
      });
    });
    TaskQueue = class {
      constructor() {
        this.isReady = false;
        this.failed = false;
        this.queue = [];
      }
      execute() {
        var fun;
        if (this.failed) {
          while (fun = this.queue.shift()) {
            fun(this.failed);
          }
        } else {
          while (fun = this.queue.shift()) {
            fun();
          }
        }
      }
      fail(err2) {
        this.failed = err2;
        this.execute();
      }
      ready(db) {
        this.isReady = true;
        this.db = db;
        this.execute();
      }
      addTask(fun) {
        this.queue.push(fun);
        if (this.failed) {
          this.execute();
        }
      }
    };
    PouchInternal = class extends AbstractPouchDB {
      constructor(name, opts) {
        super();
        this._setup(name, opts);
      }
      _setup(name, opts) {
        super._setup();
        opts = opts || {};
        if (name && typeof name === "object") {
          opts = name;
          name = opts.name;
          delete opts.name;
        }
        if (opts.deterministic_revs === void 0) {
          opts.deterministic_revs = true;
        }
        this.__opts = opts = clone(opts);
        this.auto_compaction = opts.auto_compaction;
        this.purged_infos_limit = opts.purged_infos_limit || 1e3;
        this.prefix = PouchDB.prefix;
        if (typeof name !== "string") {
          throw new Error("Missing/invalid DB name");
        }
        var prefixedName = (opts.prefix || "") + name;
        var backend = parseAdapter(prefixedName, opts);
        opts.name = backend.name;
        opts.adapter = opts.adapter || backend.adapter;
        this.name = name;
        this._adapter = opts.adapter;
        PouchDB.emit("debug", ["adapter", "Picked adapter: ", opts.adapter]);
        if (!PouchDB.adapters[opts.adapter] || !PouchDB.adapters[opts.adapter].valid()) {
          throw new Error("Invalid Adapter: " + opts.adapter);
        }
        if (opts.view_adapter) {
          if (!PouchDB.adapters[opts.view_adapter] || !PouchDB.adapters[opts.view_adapter].valid()) {
            throw new Error("Invalid View Adapter: " + opts.view_adapter);
          }
        }
        this.taskqueue = new TaskQueue();
        this.adapter = opts.adapter;
        PouchDB.adapters[opts.adapter].call(this, opts, (err2) => {
          if (err2) {
            return this.taskqueue.fail(err2);
          }
          prepareForDestruction(this);
          this.emit("created", this);
          PouchDB.emit("created", this.name);
          this.taskqueue.ready(this);
        });
      }
    };
    PouchDB = createClass(PouchInternal, function(name, opts) {
      PouchInternal.prototype._setup.call(this, name, opts);
    });
    ActiveTasks = class {
      constructor() {
        this.tasks = {};
      }
      list() {
        return Object.values(this.tasks);
      }
      add(task) {
        const id = v4_default();
        this.tasks[id] = {
          id,
          name: task.name,
          total_items: task.total_items,
          created_at: (/* @__PURE__ */ new Date()).toJSON()
        };
        return id;
      }
      get(id) {
        return this.tasks[id];
      }
      /* eslint-disable no-unused-vars */
      remove(id, reason) {
        delete this.tasks[id];
        return this.tasks;
      }
      update(id, updatedTask) {
        const task = this.tasks[id];
        if (typeof task !== "undefined") {
          const mergedTask = {
            id: task.id,
            name: task.name,
            created_at: task.created_at,
            total_items: updatedTask.total_items || task.total_items,
            completed_items: updatedTask.completed_items || task.completed_items,
            updated_at: (/* @__PURE__ */ new Date()).toJSON()
          };
          this.tasks[id] = mergedTask;
        }
        return this.tasks;
      }
    };
    PouchDB.adapters = {};
    PouchDB.preferredAdapters = [];
    PouchDB.prefix = "_pouch_";
    eventEmitter = new import_events3.default();
    setUpEventEmitter(PouchDB);
    PouchDB.adapter = function(id, obj, addToPreferredAdapters) {
      if (obj.valid()) {
        PouchDB.adapters[id] = obj;
        if (addToPreferredAdapters) {
          PouchDB.preferredAdapters.push(id);
        }
      }
    };
    PouchDB.plugin = function(obj) {
      if (typeof obj === "function") {
        obj(PouchDB);
      } else if (typeof obj !== "object" || Object.keys(obj).length === 0) {
        throw new Error('Invalid plugin: got "' + obj + '", expected an object or a function');
      } else {
        Object.keys(obj).forEach(function(id) {
          PouchDB.prototype[id] = obj[id];
        });
      }
      if (this.__defaults) {
        PouchDB.__defaults = Object.assign({}, this.__defaults);
      }
      return PouchDB;
    };
    PouchDB.defaults = function(defaultOpts) {
      let PouchWithDefaults = createClass(PouchDB, function(name, opts) {
        opts = opts || {};
        if (name && typeof name === "object") {
          opts = name;
          name = opts.name;
          delete opts.name;
        }
        opts = Object.assign({}, PouchWithDefaults.__defaults, opts);
        PouchDB.call(this, name, opts);
      });
      PouchWithDefaults.preferredAdapters = PouchDB.preferredAdapters.slice();
      Object.keys(PouchDB).forEach(function(key4) {
        if (!(key4 in PouchWithDefaults)) {
          PouchWithDefaults[key4] = PouchDB[key4];
        }
      });
      PouchWithDefaults.__defaults = Object.assign({}, this.__defaults, defaultOpts);
      return PouchWithDefaults;
    };
    PouchDB.fetch = function(url, opts) {
      return f2(url, opts);
    };
    PouchDB.prototype.activeTasks = PouchDB.activeTasks = new ActiveTasks();
    version = "9.0.0";
    PouchDB.plugin(index_browser_es_default);
    PouchDB.version = version;
    index_es_default = PouchDB;
  }
});

// node_modules/vuvuzela/index.js
var require_vuvuzela = __commonJS({
  "node_modules/vuvuzela/index.js"(exports2) {
    "use strict";
    exports2.stringify = function stringify3(input) {
      var queue2 = [];
      queue2.push({ obj: input });
      var res2 = "";
      var next2, obj, prefix, val, i, arrayPrefix, keys2, k, key4, value2, objPrefix;
      while (next2 = queue2.pop()) {
        obj = next2.obj;
        prefix = next2.prefix || "";
        val = next2.val || "";
        res2 += prefix;
        if (val) {
          res2 += val;
        } else if (typeof obj !== "object") {
          res2 += typeof obj === "undefined" ? null : JSON.stringify(obj);
        } else if (obj === null) {
          res2 += "null";
        } else if (Array.isArray(obj)) {
          queue2.push({ val: "]" });
          for (i = obj.length - 1; i >= 0; i--) {
            arrayPrefix = i === 0 ? "" : ",";
            queue2.push({ obj: obj[i], prefix: arrayPrefix });
          }
          queue2.push({ val: "[" });
        } else {
          keys2 = [];
          for (k in obj) {
            if (obj.hasOwnProperty(k)) {
              keys2.push(k);
            }
          }
          queue2.push({ val: "}" });
          for (i = keys2.length - 1; i >= 0; i--) {
            key4 = keys2[i];
            value2 = obj[key4];
            objPrefix = i > 0 ? "," : "";
            objPrefix += JSON.stringify(key4) + ":";
            queue2.push({ obj: value2, prefix: objPrefix });
          }
          queue2.push({ val: "{" });
        }
      }
      return res2;
    };
    function pop3(obj, stack2, metaStack) {
      var lastMetaElement = metaStack[metaStack.length - 1];
      if (obj === lastMetaElement.element) {
        metaStack.pop();
        lastMetaElement = metaStack[metaStack.length - 1];
      }
      var element2 = lastMetaElement.element;
      var lastElementIndex = lastMetaElement.index;
      if (Array.isArray(element2)) {
        element2.push(obj);
      } else if (lastElementIndex === stack2.length - 2) {
        var key4 = stack2.pop();
        element2[key4] = obj;
      } else {
        stack2.push(obj);
      }
    }
    exports2.parse = function(str) {
      var stack2 = [];
      var metaStack = [];
      var i = 0;
      var collationIndex2, parsedNum, numChar;
      var parsedString, lastCh, numConsecutiveSlashes, ch3;
      var arrayElement, objElement;
      while (true) {
        collationIndex2 = str[i++];
        if (collationIndex2 === "}" || collationIndex2 === "]" || typeof collationIndex2 === "undefined") {
          if (stack2.length === 1) {
            return stack2.pop();
          } else {
            pop3(stack2.pop(), stack2, metaStack);
            continue;
          }
        }
        switch (collationIndex2) {
          case " ":
          case "	":
          case "\n":
          case ":":
          case ",":
            break;
          case "n":
            i += 3;
            pop3(null, stack2, metaStack);
            break;
          case "t":
            i += 3;
            pop3(true, stack2, metaStack);
            break;
          case "f":
            i += 4;
            pop3(false, stack2, metaStack);
            break;
          case "0":
          case "1":
          case "2":
          case "3":
          case "4":
          case "5":
          case "6":
          case "7":
          case "8":
          case "9":
          case "-":
            parsedNum = "";
            i--;
            while (true) {
              numChar = str[i++];
              if (/[\d\.\-e\+]/.test(numChar)) {
                parsedNum += numChar;
              } else {
                i--;
                break;
              }
            }
            pop3(parseFloat(parsedNum), stack2, metaStack);
            break;
          case '"':
            parsedString = "";
            lastCh = void 0;
            numConsecutiveSlashes = 0;
            while (true) {
              ch3 = str[i++];
              if (ch3 !== '"' || lastCh === "\\" && numConsecutiveSlashes % 2 === 1) {
                parsedString += ch3;
                lastCh = ch3;
                if (lastCh === "\\") {
                  numConsecutiveSlashes++;
                } else {
                  numConsecutiveSlashes = 0;
                }
              } else {
                break;
              }
            }
            pop3(JSON.parse('"' + parsedString + '"'), stack2, metaStack);
            break;
          case "[":
            arrayElement = { element: [], index: stack2.length };
            stack2.push(arrayElement.element);
            metaStack.push(arrayElement);
            break;
          case "{":
            objElement = { element: {}, index: stack2.length };
            stack2.push(objElement.element);
            metaStack.push(objElement);
            break;
          default:
            throw new Error(
              "unexpectedly reached end of input: " + collationIndex2
            );
        }
      }
    };
  }
});

// node_modules/pouchdb-json/lib/index.es.js
function safeJsonParse(str) {
  try {
    return JSON.parse(str);
  } catch (e2) {
    return import_vuvuzela.default.parse(str);
  }
}
function safeJsonStringify(json) {
  try {
    return JSON.stringify(json);
  } catch (e2) {
    return import_vuvuzela.default.stringify(json);
  }
}
var import_vuvuzela;
var init_index_es6 = __esm({
  "node_modules/pouchdb-json/lib/index.es.js"() {
    import_vuvuzela = __toESM2(require_vuvuzela());
  }
});

// node_modules/pouchdb-adapter-utils/lib/index.es.js
function checkBlobSupport(txn, store, docIdOrCreateDoc) {
  return new Promise(function(resolve) {
    var blob$$1 = createBlob2([""]);
    let req;
    if (typeof docIdOrCreateDoc === "function") {
      const createDoc = docIdOrCreateDoc;
      const doc = createDoc(blob$$1);
      req = txn.objectStore(store).put(doc);
    } else {
      const docId = docIdOrCreateDoc;
      req = txn.objectStore(store).put(blob$$1, docId);
    }
    req.onsuccess = function() {
      var matchedChrome = navigator.userAgent.match(/Chrome\/(\d+)/);
      var matchedEdge = navigator.userAgent.match(/Edge\//);
      resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43);
    };
    req.onerror = txn.onabort = function(e2) {
      e2.preventDefault();
      e2.stopPropagation();
      resolve(false);
    };
  }).catch(function() {
    return false;
  });
}
function toObject(array) {
  return array.reduce(function(obj, item) {
    obj[item] = true;
    return obj;
  }, {});
}
function parseRevisionInfo(rev$$1) {
  if (!/^\d+-/.test(rev$$1)) {
    return createError(INVALID_REV);
  }
  var idx2 = rev$$1.indexOf("-");
  var left = rev$$1.substring(0, idx2);
  var right = rev$$1.substring(idx2 + 1);
  return {
    prefix: parseInt(left, 10),
    id: right
  };
}
function makeRevTreeFromRevisions(revisions, opts) {
  var pos2 = revisions.start - revisions.ids.length + 1;
  var revisionIds = revisions.ids;
  var ids = [revisionIds[0], opts, []];
  for (var i = 1, len = revisionIds.length; i < len; i++) {
    ids = [revisionIds[i], { status: "missing" }, [ids]];
  }
  return [{
    pos: pos2,
    ids
  }];
}
function parseDoc(doc, newEdits, dbOpts) {
  if (!dbOpts) {
    dbOpts = {
      deterministic_revs: true
    };
  }
  var nRevNum;
  var newRevId;
  var revInfo;
  var opts = { status: "available" };
  if (doc._deleted) {
    opts.deleted = true;
  }
  if (newEdits) {
    if (!doc._id) {
      doc._id = uuid();
    }
    newRevId = rev2(doc, dbOpts.deterministic_revs);
    if (doc._rev) {
      revInfo = parseRevisionInfo(doc._rev);
      if (revInfo.error) {
        return revInfo;
      }
      doc._rev_tree = [{
        pos: revInfo.prefix,
        ids: [revInfo.id, { status: "missing" }, [[newRevId, opts, []]]]
      }];
      nRevNum = revInfo.prefix + 1;
    } else {
      doc._rev_tree = [{
        pos: 1,
        ids: [newRevId, opts, []]
      }];
      nRevNum = 1;
    }
  } else {
    if (doc._revisions) {
      doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);
      nRevNum = doc._revisions.start;
      newRevId = doc._revisions.ids[0];
    }
    if (!doc._rev_tree) {
      revInfo = parseRevisionInfo(doc._rev);
      if (revInfo.error) {
        return revInfo;
      }
      nRevNum = revInfo.prefix;
      newRevId = revInfo.id;
      doc._rev_tree = [{
        pos: nRevNum,
        ids: [newRevId, opts, []]
      }];
    }
  }
  invalidIdError(doc._id);
  doc._rev = nRevNum + "-" + newRevId;
  var result = { metadata: {}, data: {} };
  for (var key4 in doc) {
    if (Object.prototype.hasOwnProperty.call(doc, key4)) {
      var specialKey = key4[0] === "_";
      if (specialKey && !reservedWords[key4]) {
        var error2 = createError(DOC_VALIDATION, key4);
        error2.message = DOC_VALIDATION.message + ": " + key4;
        throw error2;
      } else if (specialKey && !dataWords[key4]) {
        result.metadata[key4.slice(1)] = doc[key4];
      } else {
        result.data[key4] = doc[key4];
      }
    }
  }
  return result;
}
function parseBase64(data) {
  try {
    return thisAtob(data);
  } catch (e2) {
    var err2 = createError(
      BAD_ARG,
      "Attachment is not a valid base64 string"
    );
    return { error: err2 };
  }
}
function preprocessString(att, blobType, callback) {
  var asBinary = parseBase64(att.data);
  if (asBinary.error) {
    return callback(asBinary.error);
  }
  att.length = asBinary.length;
  if (blobType === "blob") {
    att.data = binStringToBluffer(asBinary, att.content_type);
  } else if (blobType === "base64") {
    att.data = thisBtoa(asBinary);
  } else {
    att.data = asBinary;
  }
  binaryMd5(asBinary, function(result) {
    att.digest = "md5-" + result;
    callback();
  });
}
function preprocessBlob(att, blobType, callback) {
  binaryMd5(att.data, function(md5) {
    att.digest = "md5-" + md5;
    att.length = att.data.size || att.data.length || 0;
    if (blobType === "binary") {
      blobToBinaryString(att.data, function(binString) {
        att.data = binString;
        callback();
      });
    } else if (blobType === "base64") {
      blobToBase64(att.data, function(b64) {
        att.data = b64;
        callback();
      });
    } else {
      callback();
    }
  });
}
function preprocessAttachment(att, blobType, callback) {
  if (att.stub) {
    return callback();
  }
  if (typeof att.data === "string") {
    preprocessString(att, blobType, callback);
  } else {
    preprocessBlob(att, blobType, callback);
  }
}
function preprocessAttachments(docInfos, blobType, callback) {
  if (!docInfos.length) {
    return callback();
  }
  var docv = 0;
  var overallErr;
  docInfos.forEach(function(docInfo) {
    var attachments = docInfo.data && docInfo.data._attachments ? Object.keys(docInfo.data._attachments) : [];
    var recv = 0;
    if (!attachments.length) {
      return done();
    }
    function processedAttachment(err2) {
      overallErr = err2;
      recv++;
      if (recv === attachments.length) {
        done();
      }
    }
    for (var key4 in docInfo.data._attachments) {
      if (Object.prototype.hasOwnProperty.call(docInfo.data._attachments, key4)) {
        preprocessAttachment(
          docInfo.data._attachments[key4],
          blobType,
          processedAttachment
        );
      }
    }
  });
  function done() {
    docv++;
    if (docInfos.length === docv) {
      if (overallErr) {
        callback(overallErr);
      } else {
        callback();
      }
    }
  }
}
function updateDoc(revLimit, prev, docInfo, results, i, cb, writeDoc, newEdits) {
  if (revExists(prev.rev_tree, docInfo.metadata.rev) && !newEdits) {
    results[i] = docInfo;
    return cb();
  }
  var previousWinningRev = prev.winningRev || winningRev(prev);
  var previouslyDeleted = "deleted" in prev ? prev.deleted : isDeleted(prev, previousWinningRev);
  var deleted = "deleted" in docInfo.metadata ? docInfo.metadata.deleted : isDeleted(docInfo.metadata);
  var isRoot = /^1-/.test(docInfo.metadata.rev);
  if (previouslyDeleted && !deleted && newEdits && isRoot) {
    var newDoc = docInfo.data;
    newDoc._rev = previousWinningRev;
    newDoc._id = docInfo.metadata.id;
    docInfo = parseDoc(newDoc, newEdits);
  }
  var merged = merge(prev.rev_tree, docInfo.metadata.rev_tree[0], revLimit);
  var inConflict = newEdits && (previouslyDeleted && deleted && merged.conflicts !== "new_leaf" || !previouslyDeleted && merged.conflicts !== "new_leaf" || previouslyDeleted && !deleted && merged.conflicts === "new_branch");
  if (inConflict) {
    var err2 = createError(REV_CONFLICT);
    results[i] = err2;
    return cb();
  }
  var newRev = docInfo.metadata.rev;
  docInfo.metadata.rev_tree = merged.tree;
  docInfo.stemmedRevs = merged.stemmedRevs || [];
  if (prev.rev_map) {
    docInfo.metadata.rev_map = prev.rev_map;
  }
  var winningRev$$1 = winningRev(docInfo.metadata);
  var winningRevIsDeleted = isDeleted(docInfo.metadata, winningRev$$1);
  var delta = previouslyDeleted === winningRevIsDeleted ? 0 : previouslyDeleted < winningRevIsDeleted ? -1 : 1;
  var newRevIsDeleted;
  if (newRev === winningRev$$1) {
    newRevIsDeleted = winningRevIsDeleted;
  } else {
    newRevIsDeleted = isDeleted(docInfo.metadata, newRev);
  }
  writeDoc(
    docInfo,
    winningRev$$1,
    winningRevIsDeleted,
    newRevIsDeleted,
    true,
    delta,
    i,
    cb
  );
}
function rootIsMissing(docInfo) {
  return docInfo.metadata.rev_tree[0].ids[1].status === "missing";
}
function processDocs(revLimit, docInfos, api, fetchedDocs, tx, results, writeDoc, opts, overallCallback) {
  revLimit = revLimit || 1e3;
  function insertDoc(docInfo, resultsIdx, callback) {
    var winningRev$$1 = winningRev(docInfo.metadata);
    var deleted = isDeleted(docInfo.metadata, winningRev$$1);
    if ("was_delete" in opts && deleted) {
      results[resultsIdx] = createError(MISSING_DOC, "deleted");
      return callback();
    }
    var inConflict = newEdits && rootIsMissing(docInfo);
    if (inConflict) {
      var err2 = createError(REV_CONFLICT);
      results[resultsIdx] = err2;
      return callback();
    }
    var delta = deleted ? 0 : 1;
    writeDoc(
      docInfo,
      winningRev$$1,
      deleted,
      deleted,
      false,
      delta,
      resultsIdx,
      callback
    );
  }
  var newEdits = opts.new_edits;
  var idsToDocs = /* @__PURE__ */ new Map();
  var docsDone = 0;
  var docsToDo = docInfos.length;
  function checkAllDocsDone() {
    if (++docsDone === docsToDo && overallCallback) {
      overallCallback();
    }
  }
  docInfos.forEach(function(currentDoc, resultsIdx) {
    if (currentDoc._id && isLocalId(currentDoc._id)) {
      var fun = currentDoc._deleted ? "_removeLocal" : "_putLocal";
      api[fun](currentDoc, { ctx: tx }, function(err2, res2) {
        results[resultsIdx] = err2 || res2;
        checkAllDocsDone();
      });
      return;
    }
    var id = currentDoc.metadata.id;
    if (idsToDocs.has(id)) {
      docsToDo--;
      idsToDocs.get(id).push([currentDoc, resultsIdx]);
    } else {
      idsToDocs.set(id, [[currentDoc, resultsIdx]]);
    }
  });
  idsToDocs.forEach(function(docs, id) {
    var numDone = 0;
    function docWritten() {
      if (++numDone < docs.length) {
        nextDoc();
      } else {
        checkAllDocsDone();
      }
    }
    function nextDoc() {
      var value2 = docs[numDone];
      var currentDoc = value2[0];
      var resultsIdx = value2[1];
      if (fetchedDocs.has(id)) {
        updateDoc(
          revLimit,
          fetchedDocs.get(id),
          currentDoc,
          results,
          resultsIdx,
          docWritten,
          writeDoc,
          newEdits
        );
      } else {
        var merged = merge([], currentDoc.metadata.rev_tree[0], revLimit);
        currentDoc.metadata.rev_tree = merged.tree;
        currentDoc.stemmedRevs = merged.stemmedRevs || [];
        insertDoc(currentDoc, resultsIdx, docWritten);
      }
    }
    nextDoc();
  });
}
var reservedWords, dataWords;
var init_index_es7 = __esm({
  "node_modules/pouchdb-adapter-utils/lib/index.es.js"() {
    init_index_browser_es3();
    init_index_browser_es3();
    init_index_browser_es();
    init_index_browser_es2();
    init_index_es();
    init_index_es2();
    init_index_es2();
    reservedWords = toObject([
      "_id",
      "_rev",
      "_access",
      "_attachments",
      "_deleted",
      "_revisions",
      "_revs_info",
      "_conflicts",
      "_deleted_conflicts",
      "_local_seq",
      "_rev_tree",
      // replication documents
      "_replication_id",
      "_replication_state",
      "_replication_state_time",
      "_replication_state_reason",
      "_replication_stats",
      // Specific to Couchbase Sync Gateway
      "_removed"
    ]);
    dataWords = toObject([
      "_access",
      "_attachments",
      // replication documents
      "_replication_id",
      "_replication_state",
      "_replication_state_time",
      "_replication_state_reason",
      "_replication_stats"
    ]);
  }
});

// node_modules/pouchdb-adapter-idb/lib/index.es.js
function idbError(callback) {
  return function(evt) {
    var message = "unknown_error";
    if (evt.target && evt.target.error) {
      message = evt.target.error.name || evt.target.error.message;
    }
    callback(createError(IDB_ERROR, message, evt.type));
  };
}
function encodeMetadata(metadata, winningRev$$1, deleted) {
  return {
    data: safeJsonStringify(metadata),
    winningRev: winningRev$$1,
    deletedOrLocal: deleted ? "1" : "0",
    seq: metadata.seq,
    // highest seq for this doc
    id: metadata.id
  };
}
function decodeMetadata(storedObject) {
  if (!storedObject) {
    return null;
  }
  var metadata = safeJsonParse(storedObject.data);
  metadata.winningRev = storedObject.winningRev;
  metadata.deleted = storedObject.deletedOrLocal === "1";
  metadata.seq = storedObject.seq;
  return metadata;
}
function decodeDoc(doc) {
  if (!doc) {
    return doc;
  }
  var idx2 = doc._doc_id_rev.lastIndexOf(":");
  doc._id = doc._doc_id_rev.substring(0, idx2 - 1);
  doc._rev = doc._doc_id_rev.substring(idx2 + 1);
  delete doc._doc_id_rev;
  return doc;
}
function readBlobData(body, type, asBlob, callback) {
  if (asBlob) {
    if (!body) {
      callback(createBlob2([""], { type }));
    } else if (typeof body !== "string") {
      callback(body);
    } else {
      callback(b64ToBluffer(body, type));
    }
  } else {
    if (!body) {
      callback("");
    } else if (typeof body !== "string") {
      readAsBinaryString(body, function(binary) {
        callback(thisBtoa(binary));
      });
    } else {
      callback(body);
    }
  }
}
function fetchAttachmentsIfNecessary(doc, opts, txn, cb) {
  var attachments = Object.keys(doc._attachments || {});
  if (!attachments.length) {
    return cb && cb();
  }
  var numDone = 0;
  function checkDone() {
    if (++numDone === attachments.length && cb) {
      cb();
    }
  }
  function fetchAttachment(doc2, att) {
    var attObj = doc2._attachments[att];
    var digest = attObj.digest;
    var req = txn.objectStore(ATTACH_STORE).get(digest);
    req.onsuccess = function(e2) {
      attObj.body = e2.target.result.body;
      checkDone();
    };
  }
  attachments.forEach(function(att) {
    if (opts.attachments && opts.include_docs) {
      fetchAttachment(doc, att);
    } else {
      doc._attachments[att].stub = true;
      checkDone();
    }
  });
}
function postProcessAttachments(results, asBlob) {
  return Promise.all(results.map(function(row) {
    if (row.doc && row.doc._attachments) {
      var attNames = Object.keys(row.doc._attachments);
      return Promise.all(attNames.map(function(att) {
        var attObj = row.doc._attachments[att];
        if (!("body" in attObj)) {
          return;
        }
        var body = attObj.body;
        var type = attObj.content_type;
        return new Promise(function(resolve) {
          readBlobData(body, type, asBlob, function(data) {
            row.doc._attachments[att] = Object.assign(
              pick(attObj, ["digest", "content_type"]),
              { data }
            );
            resolve();
          });
        });
      }));
    }
  }));
}
function compactRevs(revs, docId, txn) {
  var possiblyOrphanedDigests = [];
  var seqStore = txn.objectStore(BY_SEQ_STORE);
  var attStore = txn.objectStore(ATTACH_STORE);
  var attAndSeqStore = txn.objectStore(ATTACH_AND_SEQ_STORE);
  var count = revs.length;
  function checkDone() {
    count--;
    if (!count) {
      deleteOrphanedAttachments();
    }
  }
  function deleteOrphanedAttachments() {
    if (!possiblyOrphanedDigests.length) {
      return;
    }
    possiblyOrphanedDigests.forEach(function(digest) {
      var countReq = attAndSeqStore.index("digestSeq").count(
        IDBKeyRange.bound(
          digest + "::",
          digest + "::\uFFFF",
          false,
          false
        )
      );
      countReq.onsuccess = function(e2) {
        var count2 = e2.target.result;
        if (!count2) {
          attStore.delete(digest);
        }
      };
    });
  }
  revs.forEach(function(rev3) {
    var index6 = seqStore.index("_doc_id_rev");
    var key4 = docId + "::" + rev3;
    index6.getKey(key4).onsuccess = function(e2) {
      var seq = e2.target.result;
      if (typeof seq !== "number") {
        return checkDone();
      }
      seqStore.delete(seq);
      var cursor = attAndSeqStore.index("seq").openCursor(IDBKeyRange.only(seq));
      cursor.onsuccess = function(event2) {
        var cursor2 = event2.target.result;
        if (cursor2) {
          var digest = cursor2.value.digestSeq.split("::")[0];
          possiblyOrphanedDigests.push(digest);
          attAndSeqStore.delete(cursor2.primaryKey);
          cursor2.continue();
        } else {
          checkDone();
        }
      };
    };
  });
}
function openTransactionSafely(idb, stores, mode) {
  try {
    return {
      txn: idb.transaction(stores, mode)
    };
  } catch (err2) {
    return {
      error: err2
    };
  }
}
function idbBulkDocs(dbOpts, req, opts, api, idb, callback) {
  var docInfos = req.docs;
  var txn;
  var docStore;
  var bySeqStore;
  var attachStore;
  var attachAndSeqStore;
  var metaStore;
  var docInfoError;
  var metaDoc;
  for (var i = 0, len = docInfos.length; i < len; i++) {
    var doc = docInfos[i];
    if (doc._id && isLocalId(doc._id)) {
      continue;
    }
    doc = docInfos[i] = parseDoc(doc, opts.new_edits, dbOpts);
    if (doc.error && !docInfoError) {
      docInfoError = doc;
    }
  }
  if (docInfoError) {
    return callback(docInfoError);
  }
  var allDocsProcessed = false;
  var docCountDelta = 0;
  var results = new Array(docInfos.length);
  var fetchedDocs = /* @__PURE__ */ new Map();
  var preconditionErrored = false;
  var blobType = api._meta.blobSupport ? "blob" : "base64";
  preprocessAttachments(docInfos, blobType, function(err2) {
    if (err2) {
      return callback(err2);
    }
    startTransaction();
  });
  function startTransaction() {
    var stores = [
      DOC_STORE,
      BY_SEQ_STORE,
      ATTACH_STORE,
      LOCAL_STORE,
      ATTACH_AND_SEQ_STORE,
      META_STORE
    ];
    var txnResult = openTransactionSafely(idb, stores, "readwrite");
    if (txnResult.error) {
      return callback(txnResult.error);
    }
    txn = txnResult.txn;
    txn.onabort = idbError(callback);
    txn.ontimeout = idbError(callback);
    txn.oncomplete = complete;
    docStore = txn.objectStore(DOC_STORE);
    bySeqStore = txn.objectStore(BY_SEQ_STORE);
    attachStore = txn.objectStore(ATTACH_STORE);
    attachAndSeqStore = txn.objectStore(ATTACH_AND_SEQ_STORE);
    metaStore = txn.objectStore(META_STORE);
    metaStore.get(META_STORE).onsuccess = function(e2) {
      metaDoc = e2.target.result;
      updateDocCountIfReady();
    };
    verifyAttachments(function(err2) {
      if (err2) {
        preconditionErrored = true;
        return callback(err2);
      }
      fetchExistingDocs();
    });
  }
  function onAllDocsProcessed() {
    allDocsProcessed = true;
    updateDocCountIfReady();
  }
  function idbProcessDocs() {
    processDocs(
      dbOpts.revs_limit,
      docInfos,
      api,
      fetchedDocs,
      txn,
      results,
      writeDoc,
      opts,
      onAllDocsProcessed
    );
  }
  function updateDocCountIfReady() {
    if (!metaDoc || !allDocsProcessed) {
      return;
    }
    metaDoc.docCount += docCountDelta;
    metaStore.put(metaDoc);
  }
  function fetchExistingDocs() {
    if (!docInfos.length) {
      return;
    }
    var numFetched = 0;
    function checkDone() {
      if (++numFetched === docInfos.length) {
        idbProcessDocs();
      }
    }
    function readMetadata(event2) {
      var metadata = decodeMetadata(event2.target.result);
      if (metadata) {
        fetchedDocs.set(metadata.id, metadata);
      }
      checkDone();
    }
    for (var i2 = 0, len2 = docInfos.length; i2 < len2; i2++) {
      var docInfo = docInfos[i2];
      if (docInfo._id && isLocalId(docInfo._id)) {
        checkDone();
        continue;
      }
      var req2 = docStore.get(docInfo.metadata.id);
      req2.onsuccess = readMetadata;
    }
  }
  function complete() {
    if (preconditionErrored) {
      return;
    }
    changesHandler$1.notify(api._meta.name);
    callback(null, results);
  }
  function verifyAttachment(digest, callback2) {
    var req2 = attachStore.get(digest);
    req2.onsuccess = function(e2) {
      if (!e2.target.result) {
        var err2 = createError(
          MISSING_STUB,
          "unknown stub attachment with digest " + digest
        );
        err2.status = 412;
        callback2(err2);
      } else {
        callback2();
      }
    };
  }
  function verifyAttachments(finish) {
    var digests = [];
    docInfos.forEach(function(docInfo) {
      if (docInfo.data && docInfo.data._attachments) {
        Object.keys(docInfo.data._attachments).forEach(function(filename) {
          var att = docInfo.data._attachments[filename];
          if (att.stub) {
            digests.push(att.digest);
          }
        });
      }
    });
    if (!digests.length) {
      return finish();
    }
    var numDone = 0;
    var err2;
    function checkDone() {
      if (++numDone === digests.length) {
        finish(err2);
      }
    }
    digests.forEach(function(digest) {
      verifyAttachment(digest, function(attErr) {
        if (attErr && !err2) {
          err2 = attErr;
        }
        checkDone();
      });
    });
  }
  function writeDoc(docInfo, winningRev$$1, winningRevIsDeleted, newRevIsDeleted, isUpdate, delta, resultsIdx, callback2) {
    docInfo.metadata.winningRev = winningRev$$1;
    docInfo.metadata.deleted = winningRevIsDeleted;
    var doc2 = docInfo.data;
    doc2._id = docInfo.metadata.id;
    doc2._rev = docInfo.metadata.rev;
    if (newRevIsDeleted) {
      doc2._deleted = true;
    }
    var hasAttachments = doc2._attachments && Object.keys(doc2._attachments).length;
    if (hasAttachments) {
      return writeAttachments(
        docInfo,
        winningRev$$1,
        winningRevIsDeleted,
        isUpdate,
        resultsIdx,
        callback2
      );
    }
    docCountDelta += delta;
    updateDocCountIfReady();
    finishDoc(
      docInfo,
      winningRev$$1,
      winningRevIsDeleted,
      isUpdate,
      resultsIdx,
      callback2
    );
  }
  function finishDoc(docInfo, winningRev$$1, winningRevIsDeleted, isUpdate, resultsIdx, callback2) {
    var doc2 = docInfo.data;
    var metadata = docInfo.metadata;
    doc2._doc_id_rev = metadata.id + "::" + metadata.rev;
    delete doc2._id;
    delete doc2._rev;
    function afterPutDoc(e2) {
      var revsToDelete = docInfo.stemmedRevs || [];
      if (isUpdate && api.auto_compaction) {
        revsToDelete = revsToDelete.concat(compactTree(docInfo.metadata));
      }
      if (revsToDelete && revsToDelete.length) {
        compactRevs(revsToDelete, docInfo.metadata.id, txn);
      }
      metadata.seq = e2.target.result;
      var metadataToStore = encodeMetadata(
        metadata,
        winningRev$$1,
        winningRevIsDeleted
      );
      var metaDataReq = docStore.put(metadataToStore);
      metaDataReq.onsuccess = afterPutMetadata;
    }
    function afterPutDocError(e2) {
      e2.preventDefault();
      e2.stopPropagation();
      var index6 = bySeqStore.index("_doc_id_rev");
      var getKeyReq = index6.getKey(doc2._doc_id_rev);
      getKeyReq.onsuccess = function(e3) {
        var putReq2 = bySeqStore.put(doc2, e3.target.result);
        putReq2.onsuccess = afterPutDoc;
      };
    }
    function afterPutMetadata() {
      results[resultsIdx] = {
        ok: true,
        id: metadata.id,
        rev: metadata.rev
      };
      fetchedDocs.set(docInfo.metadata.id, docInfo.metadata);
      insertAttachmentMappings(docInfo, metadata.seq, callback2);
    }
    var putReq = bySeqStore.put(doc2);
    putReq.onsuccess = afterPutDoc;
    putReq.onerror = afterPutDocError;
  }
  function writeAttachments(docInfo, winningRev$$1, winningRevIsDeleted, isUpdate, resultsIdx, callback2) {
    var doc2 = docInfo.data;
    var numDone = 0;
    var attachments = Object.keys(doc2._attachments);
    function collectResults() {
      if (numDone === attachments.length) {
        finishDoc(
          docInfo,
          winningRev$$1,
          winningRevIsDeleted,
          isUpdate,
          resultsIdx,
          callback2
        );
      }
    }
    function attachmentSaved() {
      numDone++;
      collectResults();
    }
    attachments.forEach(function(key4) {
      var att = docInfo.data._attachments[key4];
      if (!att.stub) {
        var data = att.data;
        delete att.data;
        att.revpos = parseInt(winningRev$$1, 10);
        var digest = att.digest;
        saveAttachment(digest, data, attachmentSaved);
      } else {
        numDone++;
        collectResults();
      }
    });
  }
  function insertAttachmentMappings(docInfo, seq, callback2) {
    var attsAdded = 0;
    var attsToAdd = Object.keys(docInfo.data._attachments || {});
    if (!attsToAdd.length) {
      return callback2();
    }
    function checkDone() {
      if (++attsAdded === attsToAdd.length) {
        callback2();
      }
    }
    function add(att) {
      var digest = docInfo.data._attachments[att].digest;
      var req2 = attachAndSeqStore.put({
        seq,
        digestSeq: digest + "::" + seq
      });
      req2.onsuccess = checkDone;
      req2.onerror = function(e2) {
        e2.preventDefault();
        e2.stopPropagation();
        checkDone();
      };
    }
    for (var i2 = 0; i2 < attsToAdd.length; i2++) {
      add(attsToAdd[i2]);
    }
  }
  function saveAttachment(digest, data, callback2) {
    var getKeyReq = attachStore.count(digest);
    getKeyReq.onsuccess = function(e2) {
      var count = e2.target.result;
      if (count) {
        return callback2();
      }
      var newAtt = {
        digest,
        body: data
      };
      var putReq = attachStore.put(newAtt);
      putReq.onsuccess = callback2;
    };
  }
}
function runBatchedCursor(objectStore, keyRange, descending, batchSize, onBatch) {
  if (batchSize === -1) {
    batchSize = 1e3;
  }
  var useGetAll = typeof objectStore.getAll === "function" && typeof objectStore.getAllKeys === "function" && batchSize > 1 && !descending;
  var keysBatch;
  var valuesBatch;
  var pseudoCursor;
  function onGetAll(e2) {
    valuesBatch = e2.target.result;
    if (keysBatch) {
      onBatch(keysBatch, valuesBatch, pseudoCursor);
    }
  }
  function onGetAllKeys(e2) {
    keysBatch = e2.target.result;
    if (valuesBatch) {
      onBatch(keysBatch, valuesBatch, pseudoCursor);
    }
  }
  function continuePseudoCursor() {
    if (!keysBatch.length) {
      return onBatch();
    }
    var lastKey = keysBatch[keysBatch.length - 1];
    var newKeyRange;
    if (keyRange && keyRange.upper) {
      try {
        newKeyRange = IDBKeyRange.bound(
          lastKey,
          keyRange.upper,
          true,
          keyRange.upperOpen
        );
      } catch (e2) {
        if (e2.name === "DataError" && e2.code === 0) {
          return onBatch();
        }
      }
    } else {
      newKeyRange = IDBKeyRange.lowerBound(lastKey, true);
    }
    keyRange = newKeyRange;
    keysBatch = null;
    valuesBatch = null;
    objectStore.getAll(keyRange, batchSize).onsuccess = onGetAll;
    objectStore.getAllKeys(keyRange, batchSize).onsuccess = onGetAllKeys;
  }
  function onCursor(e2) {
    var cursor = e2.target.result;
    if (!cursor) {
      return onBatch();
    }
    onBatch([cursor.key], [cursor.value], cursor);
  }
  if (useGetAll) {
    pseudoCursor = { "continue": continuePseudoCursor };
    objectStore.getAll(keyRange, batchSize).onsuccess = onGetAll;
    objectStore.getAllKeys(keyRange, batchSize).onsuccess = onGetAllKeys;
  } else if (descending) {
    objectStore.openCursor(keyRange, "prev").onsuccess = onCursor;
  } else {
    objectStore.openCursor(keyRange).onsuccess = onCursor;
  }
}
function getAll(objectStore, keyRange, onSuccess) {
  if (typeof objectStore.getAll === "function") {
    objectStore.getAll(keyRange).onsuccess = onSuccess;
    return;
  }
  var values = [];
  function onCursor(e2) {
    var cursor = e2.target.result;
    if (cursor) {
      values.push(cursor.value);
      cursor.continue();
    } else {
      onSuccess({
        target: {
          result: values
        }
      });
    }
  }
  objectStore.openCursor(keyRange).onsuccess = onCursor;
}
function allDocsKeys(keys2, docStore, onBatch) {
  var valuesBatch = new Array(keys2.length);
  var count = 0;
  keys2.forEach(function(key4, index6) {
    docStore.get(key4).onsuccess = function(event2) {
      if (event2.target.result) {
        valuesBatch[index6] = event2.target.result;
      } else {
        valuesBatch[index6] = { key: key4, error: "not_found" };
      }
      count++;
      if (count === keys2.length) {
        onBatch(keys2, valuesBatch, {});
      }
    };
  });
}
function createKeyRange(start, end, inclusiveEnd, key4, descending) {
  try {
    if (start && end) {
      if (descending) {
        return IDBKeyRange.bound(end, start, !inclusiveEnd, false);
      } else {
        return IDBKeyRange.bound(start, end, false, !inclusiveEnd);
      }
    } else if (start) {
      if (descending) {
        return IDBKeyRange.upperBound(start);
      } else {
        return IDBKeyRange.lowerBound(start);
      }
    } else if (end) {
      if (descending) {
        return IDBKeyRange.lowerBound(end, !inclusiveEnd);
      } else {
        return IDBKeyRange.upperBound(end, !inclusiveEnd);
      }
    } else if (key4) {
      return IDBKeyRange.only(key4);
    }
  } catch (e2) {
    return { error: e2 };
  }
  return null;
}
function idbAllDocs(opts, idb, callback) {
  var start = "startkey" in opts ? opts.startkey : false;
  var end = "endkey" in opts ? opts.endkey : false;
  var key4 = "key" in opts ? opts.key : false;
  var keys2 = "keys" in opts ? opts.keys : false;
  var skip = opts.skip || 0;
  var limit = typeof opts.limit === "number" ? opts.limit : -1;
  var inclusiveEnd = opts.inclusive_end !== false;
  var keyRange;
  var keyRangeError;
  if (!keys2) {
    keyRange = createKeyRange(start, end, inclusiveEnd, key4, opts.descending);
    keyRangeError = keyRange && keyRange.error;
    if (keyRangeError && !(keyRangeError.name === "DataError" && keyRangeError.code === 0)) {
      return callback(createError(
        IDB_ERROR,
        keyRangeError.name,
        keyRangeError.message
      ));
    }
  }
  var stores = [DOC_STORE, BY_SEQ_STORE, META_STORE];
  if (opts.attachments) {
    stores.push(ATTACH_STORE);
  }
  var txnResult = openTransactionSafely(idb, stores, "readonly");
  if (txnResult.error) {
    return callback(txnResult.error);
  }
  var txn = txnResult.txn;
  txn.oncomplete = onTxnComplete;
  txn.onabort = idbError(callback);
  var docStore = txn.objectStore(DOC_STORE);
  var seqStore = txn.objectStore(BY_SEQ_STORE);
  var metaStore = txn.objectStore(META_STORE);
  var docIdRevIndex = seqStore.index("_doc_id_rev");
  var results = [];
  var docCount;
  var updateSeq;
  metaStore.get(META_STORE).onsuccess = function(e2) {
    docCount = e2.target.result.docCount;
  };
  if (opts.update_seq) {
    seqStore.openKeyCursor(null, "prev").onsuccess = (e2) => {
      var cursor = e2.target.result;
      if (cursor && cursor.key) {
        updateSeq = cursor.key;
      }
    };
  }
  function fetchDocAsynchronously(metadata, row, winningRev$$1) {
    var key5 = metadata.id + "::" + winningRev$$1;
    docIdRevIndex.get(key5).onsuccess = function onGetDoc(e2) {
      row.doc = decodeDoc(e2.target.result) || {};
      if (opts.conflicts) {
        var conflicts = collectConflicts(metadata);
        if (conflicts.length) {
          row.doc._conflicts = conflicts;
        }
      }
      fetchAttachmentsIfNecessary(row.doc, opts, txn);
    };
  }
  function allDocsInner(winningRev$$1, metadata) {
    var row = {
      id: metadata.id,
      key: metadata.id,
      value: {
        rev: winningRev$$1
      }
    };
    var deleted = metadata.deleted;
    if (deleted) {
      if (keys2) {
        results.push(row);
        row.value.deleted = true;
        row.doc = null;
      }
    } else if (skip-- <= 0) {
      results.push(row);
      if (opts.include_docs) {
        fetchDocAsynchronously(metadata, row, winningRev$$1);
      }
    }
  }
  function processBatch(batchValues) {
    for (var i = 0, len = batchValues.length; i < len; i++) {
      if (results.length === limit) {
        break;
      }
      var batchValue = batchValues[i];
      if (batchValue.error && keys2) {
        results.push(batchValue);
        continue;
      }
      var metadata = decodeMetadata(batchValue);
      var winningRev$$1 = metadata.winningRev;
      allDocsInner(winningRev$$1, metadata);
    }
  }
  function onBatch(batchKeys, batchValues, cursor) {
    if (!cursor) {
      return;
    }
    processBatch(batchValues);
    if (results.length < limit) {
      cursor.continue();
    }
  }
  function onGetAll(e2) {
    var values = e2.target.result;
    if (opts.descending) {
      values = values.reverse();
    }
    processBatch(values);
  }
  function onResultsReady() {
    var returnVal = {
      total_rows: docCount,
      offset: opts.skip,
      rows: results
    };
    if (opts.update_seq && updateSeq !== void 0) {
      returnVal.update_seq = updateSeq;
    }
    callback(null, returnVal);
  }
  function onTxnComplete() {
    if (opts.attachments) {
      postProcessAttachments(results, opts.binary).then(onResultsReady);
    } else {
      onResultsReady();
    }
  }
  if (keyRangeError || limit === 0) {
    return;
  }
  if (keys2) {
    return allDocsKeys(keys2, docStore, onBatch);
  }
  if (limit === -1) {
    return getAll(docStore, keyRange, onGetAll);
  }
  runBatchedCursor(docStore, keyRange, opts.descending, limit + skip, onBatch);
}
function countDocs(txn, cb) {
  var index6 = txn.objectStore(DOC_STORE).index("deletedOrLocal");
  index6.count(IDBKeyRange.only("0")).onsuccess = function(e2) {
    cb(e2.target.result);
  };
}
function tryCode(fun, err2, res2, PouchDB3) {
  try {
    fun(err2, res2);
  } catch (err3) {
    PouchDB3.emit("error", err3);
  }
}
function applyNext() {
  if (running || !queue.length) {
    return;
  }
  running = true;
  queue.shift()();
}
function enqueueTask(action2, callback, PouchDB3) {
  queue.push(function runAction() {
    action2(function runCallback(err2, res2) {
      tryCode(callback, err2, res2, PouchDB3);
      running = false;
      nextTick(function runNext() {
        applyNext(PouchDB3);
      });
    });
  });
  applyNext();
}
function changes(opts, api, dbName, idb) {
  opts = clone(opts);
  if (opts.continuous) {
    var id = dbName + ":" + uuid();
    changesHandler$1.addListener(dbName, id, api, opts);
    changesHandler$1.notify(dbName);
    return {
      cancel: function() {
        changesHandler$1.removeListener(dbName, id);
      }
    };
  }
  var docIds = opts.doc_ids && new Set(opts.doc_ids);
  opts.since = opts.since || 0;
  var lastSeq = opts.since;
  var limit = "limit" in opts ? opts.limit : -1;
  if (limit === 0) {
    limit = 1;
  }
  var results = [];
  var numResults = 0;
  var filter3 = filterChange(opts);
  var docIdsToMetadata = /* @__PURE__ */ new Map();
  var txn;
  var bySeqStore;
  var docStore;
  var docIdRevIndex;
  function onBatch(batchKeys, batchValues, cursor) {
    if (!cursor || !batchKeys.length) {
      return;
    }
    var winningDocs = new Array(batchKeys.length);
    var metadatas = new Array(batchKeys.length);
    function processMetadataAndWinningDoc(metadata, winningDoc) {
      var change = opts.processChange(winningDoc, metadata, opts);
      lastSeq = change.seq = metadata.seq;
      var filtered = filter3(change);
      if (typeof filtered === "object") {
        return Promise.reject(filtered);
      }
      if (!filtered) {
        return Promise.resolve();
      }
      numResults++;
      if (opts.return_docs) {
        results.push(change);
      }
      if (opts.attachments && opts.include_docs) {
        return new Promise(function(resolve) {
          fetchAttachmentsIfNecessary(winningDoc, opts, txn, function() {
            postProcessAttachments([change], opts.binary).then(function() {
              resolve(change);
            });
          });
        });
      } else {
        return Promise.resolve(change);
      }
    }
    function onBatchDone() {
      var promises6 = [];
      for (var i = 0, len = winningDocs.length; i < len; i++) {
        if (numResults === limit) {
          break;
        }
        var winningDoc = winningDocs[i];
        if (!winningDoc) {
          continue;
        }
        var metadata = metadatas[i];
        promises6.push(processMetadataAndWinningDoc(metadata, winningDoc));
      }
      Promise.all(promises6).then(function(changes3) {
        for (var i2 = 0, len2 = changes3.length; i2 < len2; i2++) {
          if (changes3[i2]) {
            opts.onChange(changes3[i2]);
          }
        }
      }).catch(opts.complete);
      if (numResults !== limit) {
        cursor.continue();
      }
    }
    var numDone = 0;
    batchValues.forEach(function(value2, i) {
      var doc = decodeDoc(value2);
      var seq = batchKeys[i];
      fetchWinningDocAndMetadata(doc, seq, function(metadata, winningDoc) {
        metadatas[i] = metadata;
        winningDocs[i] = winningDoc;
        if (++numDone === batchKeys.length) {
          onBatchDone();
        }
      });
    });
  }
  function onGetMetadata(doc, seq, metadata, cb) {
    if (metadata.seq !== seq) {
      return cb();
    }
    if (metadata.winningRev === doc._rev) {
      return cb(metadata, doc);
    }
    var docIdRev = doc._id + "::" + metadata.winningRev;
    var req = docIdRevIndex.get(docIdRev);
    req.onsuccess = function(e2) {
      cb(metadata, decodeDoc(e2.target.result));
    };
  }
  function fetchWinningDocAndMetadata(doc, seq, cb) {
    if (docIds && !docIds.has(doc._id)) {
      return cb();
    }
    var metadata = docIdsToMetadata.get(doc._id);
    if (metadata) {
      return onGetMetadata(doc, seq, metadata, cb);
    }
    docStore.get(doc._id).onsuccess = function(e2) {
      metadata = decodeMetadata(e2.target.result);
      docIdsToMetadata.set(doc._id, metadata);
      onGetMetadata(doc, seq, metadata, cb);
    };
  }
  function finish() {
    opts.complete(null, {
      results,
      last_seq: lastSeq
    });
  }
  function onTxnComplete() {
    if (!opts.continuous && opts.attachments) {
      postProcessAttachments(results).then(finish);
    } else {
      finish();
    }
  }
  var objectStores = [DOC_STORE, BY_SEQ_STORE];
  if (opts.attachments) {
    objectStores.push(ATTACH_STORE);
  }
  var txnResult = openTransactionSafely(idb, objectStores, "readonly");
  if (txnResult.error) {
    return opts.complete(txnResult.error);
  }
  txn = txnResult.txn;
  txn.onabort = idbError(opts.complete);
  txn.oncomplete = onTxnComplete;
  bySeqStore = txn.objectStore(BY_SEQ_STORE);
  docStore = txn.objectStore(DOC_STORE);
  docIdRevIndex = bySeqStore.index("_doc_id_rev");
  var keyRange = opts.since && !opts.descending ? IDBKeyRange.lowerBound(opts.since, true) : null;
  runBatchedCursor(bySeqStore, keyRange, opts.descending, limit, onBatch);
}
function IdbPouch(opts, callback) {
  var api = this;
  enqueueTask(function(thisCallback) {
    init(api, opts, thisCallback);
  }, callback, api.constructor);
}
function init(api, opts, callback) {
  var dbName = opts.name;
  var idb = null;
  var idbGlobalFailureError = null;
  api._meta = null;
  function enrichCallbackError(callback2) {
    return function(error2, result) {
      if (error2 && error2 instanceof Error && !error2.reason) {
        if (idbGlobalFailureError) {
          error2.reason = idbGlobalFailureError;
        }
      }
      callback2(error2, result);
    };
  }
  function createSchema(db) {
    var docStore = db.createObjectStore(DOC_STORE, { keyPath: "id" });
    db.createObjectStore(BY_SEQ_STORE, { autoIncrement: true }).createIndex("_doc_id_rev", "_doc_id_rev", { unique: true });
    db.createObjectStore(ATTACH_STORE, { keyPath: "digest" });
    db.createObjectStore(META_STORE, { keyPath: "id", autoIncrement: false });
    db.createObjectStore(DETECT_BLOB_SUPPORT_STORE);
    docStore.createIndex("deletedOrLocal", "deletedOrLocal", { unique: false });
    db.createObjectStore(LOCAL_STORE, { keyPath: "_id" });
    var attAndSeqStore = db.createObjectStore(
      ATTACH_AND_SEQ_STORE,
      { autoIncrement: true }
    );
    attAndSeqStore.createIndex("seq", "seq");
    attAndSeqStore.createIndex("digestSeq", "digestSeq", { unique: true });
  }
  function addDeletedOrLocalIndex(txn, callback2) {
    var docStore = txn.objectStore(DOC_STORE);
    docStore.createIndex("deletedOrLocal", "deletedOrLocal", { unique: false });
    docStore.openCursor().onsuccess = function(event2) {
      var cursor = event2.target.result;
      if (cursor) {
        var metadata = cursor.value;
        var deleted = isDeleted(metadata);
        metadata.deletedOrLocal = deleted ? "1" : "0";
        docStore.put(metadata);
        cursor.continue();
      } else {
        callback2();
      }
    };
  }
  function createLocalStoreSchema(db) {
    db.createObjectStore(LOCAL_STORE, { keyPath: "_id" }).createIndex("_doc_id_rev", "_doc_id_rev", { unique: true });
  }
  function migrateLocalStore(txn, cb) {
    var localStore = txn.objectStore(LOCAL_STORE);
    var docStore = txn.objectStore(DOC_STORE);
    var seqStore = txn.objectStore(BY_SEQ_STORE);
    var cursor = docStore.openCursor();
    cursor.onsuccess = function(event2) {
      var cursor2 = event2.target.result;
      if (cursor2) {
        var metadata = cursor2.value;
        var docId = metadata.id;
        var local = isLocalId(docId);
        var rev3 = winningRev(metadata);
        if (local) {
          var docIdRev = docId + "::" + rev3;
          var start = docId + "::";
          var end = docId + "::~";
          var index6 = seqStore.index("_doc_id_rev");
          var range2 = IDBKeyRange.bound(start, end, false, false);
          var seqCursor = index6.openCursor(range2);
          seqCursor.onsuccess = function(e2) {
            seqCursor = e2.target.result;
            if (!seqCursor) {
              docStore.delete(cursor2.primaryKey);
              cursor2.continue();
            } else {
              var data = seqCursor.value;
              if (data._doc_id_rev === docIdRev) {
                localStore.put(data);
              }
              seqStore.delete(seqCursor.primaryKey);
              seqCursor.continue();
            }
          };
        } else {
          cursor2.continue();
        }
      } else if (cb) {
        cb();
      }
    };
  }
  function addAttachAndSeqStore(db) {
    var attAndSeqStore = db.createObjectStore(
      ATTACH_AND_SEQ_STORE,
      { autoIncrement: true }
    );
    attAndSeqStore.createIndex("seq", "seq");
    attAndSeqStore.createIndex("digestSeq", "digestSeq", { unique: true });
  }
  function migrateAttsAndSeqs(txn, callback2) {
    var seqStore = txn.objectStore(BY_SEQ_STORE);
    var attStore = txn.objectStore(ATTACH_STORE);
    var attAndSeqStore = txn.objectStore(ATTACH_AND_SEQ_STORE);
    var req2 = attStore.count();
    req2.onsuccess = function(e2) {
      var count = e2.target.result;
      if (!count) {
        return callback2();
      }
      seqStore.openCursor().onsuccess = function(e3) {
        var cursor = e3.target.result;
        if (!cursor) {
          return callback2();
        }
        var doc = cursor.value;
        var seq = cursor.primaryKey;
        var atts = Object.keys(doc._attachments || {});
        var digestMap = {};
        for (var j = 0; j < atts.length; j++) {
          var att = doc._attachments[atts[j]];
          digestMap[att.digest] = true;
        }
        var digests = Object.keys(digestMap);
        for (j = 0; j < digests.length; j++) {
          var digest = digests[j];
          attAndSeqStore.put({
            seq,
            digestSeq: digest + "::" + seq
          });
        }
        cursor.continue();
      };
    };
  }
  function migrateMetadata(txn) {
    function decodeMetadataCompat(storedObject) {
      if (!storedObject.data) {
        storedObject.deleted = storedObject.deletedOrLocal === "1";
        return storedObject;
      }
      return decodeMetadata(storedObject);
    }
    var bySeqStore = txn.objectStore(BY_SEQ_STORE);
    var docStore = txn.objectStore(DOC_STORE);
    var cursor = docStore.openCursor();
    cursor.onsuccess = function(e2) {
      var cursor2 = e2.target.result;
      if (!cursor2) {
        return;
      }
      var metadata = decodeMetadataCompat(cursor2.value);
      metadata.winningRev = metadata.winningRev || winningRev(metadata);
      function fetchMetadataSeq() {
        var start = metadata.id + "::";
        var end = metadata.id + "::\uFFFF";
        var req2 = bySeqStore.index("_doc_id_rev").openCursor(
          IDBKeyRange.bound(start, end)
        );
        var metadataSeq = 0;
        req2.onsuccess = function(e3) {
          var cursor3 = e3.target.result;
          if (!cursor3) {
            metadata.seq = metadataSeq;
            return onGetMetadataSeq();
          }
          var seq = cursor3.primaryKey;
          if (seq > metadataSeq) {
            metadataSeq = seq;
          }
          cursor3.continue();
        };
      }
      function onGetMetadataSeq() {
        var metadataToStore = encodeMetadata(
          metadata,
          metadata.winningRev,
          metadata.deleted
        );
        var req2 = docStore.put(metadataToStore);
        req2.onsuccess = function() {
          cursor2.continue();
        };
      }
      if (metadata.seq) {
        return onGetMetadataSeq();
      }
      fetchMetadataSeq();
    };
  }
  api._remote = false;
  api.type = function() {
    return "idb";
  };
  api._id = toPromise(function(callback2) {
    callback2(null, api._meta.instanceId);
  });
  api._bulkDocs = function idb_bulkDocs(req2, reqOpts, callback2) {
    idbBulkDocs(opts, req2, reqOpts, api, idb, enrichCallbackError(callback2));
  };
  api._get = function idb_get(id, opts2, callback2) {
    var doc;
    var metadata;
    var err2;
    var txn = opts2.ctx;
    if (!txn) {
      var txnResult = openTransactionSafely(
        idb,
        [DOC_STORE, BY_SEQ_STORE, ATTACH_STORE],
        "readonly"
      );
      if (txnResult.error) {
        return callback2(txnResult.error);
      }
      txn = txnResult.txn;
    }
    function finish() {
      callback2(err2, { doc, metadata, ctx: txn });
    }
    txn.objectStore(DOC_STORE).get(id).onsuccess = function(e2) {
      metadata = decodeMetadata(e2.target.result);
      if (!metadata) {
        err2 = createError(MISSING_DOC, "missing");
        return finish();
      }
      var rev3;
      if (!opts2.rev) {
        rev3 = metadata.winningRev;
        var deleted = isDeleted(metadata);
        if (deleted) {
          err2 = createError(MISSING_DOC, "deleted");
          return finish();
        }
      } else {
        rev3 = opts2.latest ? latest(opts2.rev, metadata) : opts2.rev;
      }
      var objectStore = txn.objectStore(BY_SEQ_STORE);
      var key4 = metadata.id + "::" + rev3;
      objectStore.index("_doc_id_rev").get(key4).onsuccess = function(e3) {
        doc = e3.target.result;
        if (doc) {
          doc = decodeDoc(doc);
        }
        if (!doc) {
          err2 = createError(MISSING_DOC, "missing");
          return finish();
        }
        finish();
      };
    };
  };
  api._getAttachment = function(docId, attachId, attachment, opts2, callback2) {
    var txn;
    if (opts2.ctx) {
      txn = opts2.ctx;
    } else {
      var txnResult = openTransactionSafely(
        idb,
        [DOC_STORE, BY_SEQ_STORE, ATTACH_STORE],
        "readonly"
      );
      if (txnResult.error) {
        return callback2(txnResult.error);
      }
      txn = txnResult.txn;
    }
    var digest = attachment.digest;
    var type = attachment.content_type;
    txn.objectStore(ATTACH_STORE).get(digest).onsuccess = function(e2) {
      var body = e2.target.result.body;
      readBlobData(body, type, opts2.binary, function(blobData) {
        callback2(null, blobData);
      });
    };
  };
  api._info = function idb_info(callback2) {
    var updateSeq;
    var docCount;
    var txnResult = openTransactionSafely(idb, [META_STORE, BY_SEQ_STORE], "readonly");
    if (txnResult.error) {
      return callback2(txnResult.error);
    }
    var txn = txnResult.txn;
    txn.objectStore(META_STORE).get(META_STORE).onsuccess = function(e2) {
      docCount = e2.target.result.docCount;
    };
    txn.objectStore(BY_SEQ_STORE).openKeyCursor(null, "prev").onsuccess = function(e2) {
      var cursor = e2.target.result;
      updateSeq = cursor ? cursor.key : 0;
    };
    txn.oncomplete = function() {
      callback2(null, {
        doc_count: docCount,
        update_seq: updateSeq,
        // for debugging
        idb_attachment_format: api._meta.blobSupport ? "binary" : "base64"
      });
    };
  };
  api._allDocs = function idb_allDocs(opts2, callback2) {
    idbAllDocs(opts2, idb, enrichCallbackError(callback2));
  };
  api._changes = function idbChanges2(opts2) {
    return changes(opts2, api, dbName, idb);
  };
  api._close = function(callback2) {
    idb.close();
    cachedDBs.delete(dbName);
    callback2();
  };
  api._getRevisionTree = function(docId, callback2) {
    var txnResult = openTransactionSafely(idb, [DOC_STORE], "readonly");
    if (txnResult.error) {
      return callback2(txnResult.error);
    }
    var txn = txnResult.txn;
    var req2 = txn.objectStore(DOC_STORE).get(docId);
    req2.onsuccess = function(event2) {
      var doc = decodeMetadata(event2.target.result);
      if (!doc) {
        callback2(createError(MISSING_DOC));
      } else {
        callback2(null, doc.rev_tree);
      }
    };
  };
  api._doCompaction = function(docId, revs, callback2) {
    var stores = [
      DOC_STORE,
      BY_SEQ_STORE,
      ATTACH_STORE,
      ATTACH_AND_SEQ_STORE
    ];
    var txnResult = openTransactionSafely(idb, stores, "readwrite");
    if (txnResult.error) {
      return callback2(txnResult.error);
    }
    var txn = txnResult.txn;
    var docStore = txn.objectStore(DOC_STORE);
    docStore.get(docId).onsuccess = function(event2) {
      var metadata = decodeMetadata(event2.target.result);
      traverseRevTree(metadata.rev_tree, function(isLeaf, pos2, revHash, ctx, opts2) {
        var rev3 = pos2 + "-" + revHash;
        if (revs.indexOf(rev3) !== -1) {
          opts2.status = "missing";
        }
      });
      compactRevs(revs, docId, txn);
      var winningRev$$1 = metadata.winningRev;
      var deleted = metadata.deleted;
      txn.objectStore(DOC_STORE).put(
        encodeMetadata(metadata, winningRev$$1, deleted)
      );
    };
    txn.onabort = idbError(callback2);
    txn.oncomplete = function() {
      callback2();
    };
  };
  api._getLocal = function(id, callback2) {
    var txnResult = openTransactionSafely(idb, [LOCAL_STORE], "readonly");
    if (txnResult.error) {
      return callback2(txnResult.error);
    }
    var tx = txnResult.txn;
    var req2 = tx.objectStore(LOCAL_STORE).get(id);
    req2.onerror = idbError(callback2);
    req2.onsuccess = function(e2) {
      var doc = e2.target.result;
      if (!doc) {
        callback2(createError(MISSING_DOC));
      } else {
        delete doc["_doc_id_rev"];
        callback2(null, doc);
      }
    };
  };
  api._putLocal = function(doc, opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    delete doc._revisions;
    var oldRev = doc._rev;
    var id = doc._id;
    if (!oldRev) {
      doc._rev = "0-1";
    } else {
      doc._rev = "0-" + (parseInt(oldRev.split("-")[1], 10) + 1);
    }
    var tx = opts2.ctx;
    var ret;
    if (!tx) {
      var txnResult = openTransactionSafely(idb, [LOCAL_STORE], "readwrite");
      if (txnResult.error) {
        return callback2(txnResult.error);
      }
      tx = txnResult.txn;
      tx.onerror = idbError(callback2);
      tx.oncomplete = function() {
        if (ret) {
          callback2(null, ret);
        }
      };
    }
    var oStore = tx.objectStore(LOCAL_STORE);
    var req2;
    if (oldRev) {
      req2 = oStore.get(id);
      req2.onsuccess = function(e2) {
        var oldDoc = e2.target.result;
        if (!oldDoc || oldDoc._rev !== oldRev) {
          callback2(createError(REV_CONFLICT));
        } else {
          var req3 = oStore.put(doc);
          req3.onsuccess = function() {
            ret = { ok: true, id: doc._id, rev: doc._rev };
            if (opts2.ctx) {
              callback2(null, ret);
            }
          };
        }
      };
    } else {
      req2 = oStore.add(doc);
      req2.onerror = function(e2) {
        callback2(createError(REV_CONFLICT));
        e2.preventDefault();
        e2.stopPropagation();
      };
      req2.onsuccess = function() {
        ret = { ok: true, id: doc._id, rev: doc._rev };
        if (opts2.ctx) {
          callback2(null, ret);
        }
      };
    }
  };
  api._removeLocal = function(doc, opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    var tx = opts2.ctx;
    if (!tx) {
      var txnResult = openTransactionSafely(idb, [LOCAL_STORE], "readwrite");
      if (txnResult.error) {
        return callback2(txnResult.error);
      }
      tx = txnResult.txn;
      tx.oncomplete = function() {
        if (ret) {
          callback2(null, ret);
        }
      };
    }
    var ret;
    var id = doc._id;
    var oStore = tx.objectStore(LOCAL_STORE);
    var req2 = oStore.get(id);
    req2.onerror = idbError(callback2);
    req2.onsuccess = function(e2) {
      var oldDoc = e2.target.result;
      if (!oldDoc || oldDoc._rev !== doc._rev) {
        callback2(createError(MISSING_DOC));
      } else {
        oStore.delete(id);
        ret = { ok: true, id, rev: "0-0" };
        if (opts2.ctx) {
          callback2(null, ret);
        }
      }
    };
  };
  api._destroy = function(opts2, callback2) {
    changesHandler$1.removeAllListeners(dbName);
    var openReq = openReqList.get(dbName);
    if (openReq && openReq.result) {
      openReq.result.close();
      cachedDBs.delete(dbName);
    }
    var req2 = indexedDB.deleteDatabase(dbName);
    req2.onsuccess = function() {
      openReqList.delete(dbName);
      if (hasLocalStorage() && dbName in localStorage) {
        delete localStorage[dbName];
      }
      callback2(null, { "ok": true });
    };
    req2.onerror = idbError(callback2);
  };
  var cached = cachedDBs.get(dbName);
  if (cached) {
    idb = cached.idb;
    api._meta = cached.global;
    return nextTick(function() {
      callback(null, api);
    });
  }
  var req = indexedDB.open(dbName, ADAPTER_VERSION);
  openReqList.set(dbName, req);
  req.onupgradeneeded = function(e2) {
    var db = e2.target.result;
    if (e2.oldVersion < 1) {
      return createSchema(db);
    }
    var txn = e2.currentTarget.transaction;
    if (e2.oldVersion < 3) {
      createLocalStoreSchema(db);
    }
    if (e2.oldVersion < 4) {
      addAttachAndSeqStore(db);
    }
    var migrations = [
      addDeletedOrLocalIndex,
      // v1 -> v2
      migrateLocalStore,
      // v2 -> v3
      migrateAttsAndSeqs,
      // v3 -> v4
      migrateMetadata
      // v4 -> v5
    ];
    var i = e2.oldVersion;
    function next2() {
      var migration = migrations[i - 1];
      i++;
      if (migration) {
        migration(txn, next2);
      }
    }
    next2();
  };
  req.onsuccess = function(e2) {
    idb = e2.target.result;
    idb.onversionchange = function() {
      idb.close();
      cachedDBs.delete(dbName);
    };
    idb.onabort = function(e3) {
      guardedConsole("error", "Database has a global failure", e3.target.error);
      idbGlobalFailureError = e3.target.error;
      idb.close();
      cachedDBs.delete(dbName);
    };
    var txn = idb.transaction([
      META_STORE,
      DETECT_BLOB_SUPPORT_STORE,
      DOC_STORE
    ], "readwrite");
    var storedMetaDoc = false;
    var metaDoc;
    var docCount;
    var blobSupport;
    var instanceId;
    function completeSetup() {
      if (typeof blobSupport === "undefined" || !storedMetaDoc) {
        return;
      }
      api._meta = {
        name: dbName,
        instanceId,
        blobSupport
      };
      cachedDBs.set(dbName, {
        idb,
        global: api._meta
      });
      callback(null, api);
    }
    function storeMetaDocIfReady() {
      if (typeof docCount === "undefined" || typeof metaDoc === "undefined") {
        return;
      }
      var instanceKey = dbName + "_id";
      if (instanceKey in metaDoc) {
        instanceId = metaDoc[instanceKey];
      } else {
        metaDoc[instanceKey] = instanceId = uuid();
      }
      metaDoc.docCount = docCount;
      txn.objectStore(META_STORE).put(metaDoc);
    }
    txn.objectStore(META_STORE).get(META_STORE).onsuccess = function(e3) {
      metaDoc = e3.target.result || { id: META_STORE };
      storeMetaDocIfReady();
    };
    countDocs(txn, function(count) {
      docCount = count;
      storeMetaDocIfReady();
    });
    if (!blobSupportPromise) {
      blobSupportPromise = checkBlobSupport(txn, DETECT_BLOB_SUPPORT_STORE, "key");
    }
    blobSupportPromise.then(function(val) {
      blobSupport = val;
      completeSetup();
    });
    txn.oncomplete = function() {
      storedMetaDoc = true;
      completeSetup();
    };
    txn.onabort = idbError(callback);
  };
  req.onerror = function(e2) {
    var msg = e2.target.error && e2.target.error.message;
    if (!msg) {
      msg = "Failed to open indexedDB, are you in private browsing mode?";
    } else if (msg.indexOf("stored database is a higher version") !== -1) {
      msg = new Error('This DB was created with the newer "indexeddb" adapter, but you are trying to open it with the older "idb" adapter');
    }
    guardedConsole("error", msg);
    callback(createError(IDB_ERROR, msg));
  };
}
function index(PouchDB3) {
  PouchDB3.adapter("idb", IdbPouch, true);
}
var ADAPTER_VERSION, DOC_STORE, BY_SEQ_STORE, ATTACH_STORE, ATTACH_AND_SEQ_STORE, META_STORE, LOCAL_STORE, DETECT_BLOB_SUPPORT_STORE, changesHandler$1, running, queue, cachedDBs, blobSupportPromise, openReqList, index_es_default2;
var init_index_es8 = __esm({
  "node_modules/pouchdb-adapter-idb/lib/index.es.js"() {
    init_index_es6();
    init_index_browser_es();
    init_index_es2();
    init_index_es7();
    init_index_es();
    init_index_browser_es3();
    ADAPTER_VERSION = 5;
    DOC_STORE = "document-store";
    BY_SEQ_STORE = "by-sequence";
    ATTACH_STORE = "attach-store";
    ATTACH_AND_SEQ_STORE = "attach-seq-store";
    META_STORE = "meta-store";
    LOCAL_STORE = "local-store";
    DETECT_BLOB_SUPPORT_STORE = "detect-blob-support";
    changesHandler$1 = new Changes();
    running = false;
    queue = [];
    cachedDBs = /* @__PURE__ */ new Map();
    openReqList = /* @__PURE__ */ new Map();
    IdbPouch.valid = function() {
      try {
        return typeof indexedDB !== "undefined" && typeof IDBKeyRange !== "undefined";
      } catch (e2) {
        return false;
      }
    };
    index_es_default2 = index;
  }
});

// node_modules/pouchdb-adapter-indexeddb/lib/index.es.js
function needsSanitise(name, isPath) {
  if (isPath) {
    return TEST_PATH_INVALID.test(name);
  } else {
    return TEST_KEY_INVALID.test(name);
  }
}
function sanitise(name, isPath) {
  const correctCharacters = function(match3) {
    let good = "";
    for (let i = 0; i < match3.length; i++) {
      const code = match3.charCodeAt(i);
      if (code === IS_DOT && isPath && i === 0) {
        good += ".";
      } else if (code === SLASH && isPath) {
        continue;
      } else {
        good += "_c" + code + "_";
      }
    }
    return good;
  };
  if (isPath) {
    return name.replace(PATH_INVALID, correctCharacters);
  } else {
    return name.replace(KEY_INVALID, correctCharacters);
  }
}
function needsRewrite(data) {
  for (const key4 of Object.keys(data)) {
    if (needsSanitise(key4)) {
      return true;
    } else if (data[key4] === null || typeof data[key4] === "boolean") {
      return true;
    } else if (typeof data[key4] === "object") {
      return needsRewrite(data[key4]);
    }
  }
}
function rewrite(data) {
  if (!needsRewrite(data)) {
    return false;
  }
  const isArray2 = Array.isArray(data);
  const clone2 = isArray2 ? [] : {};
  Object.keys(data).forEach(function(key4) {
    const safeKey = isArray2 ? key4 : sanitise(key4);
    if (data[key4] === null) {
      clone2[safeKey] = IDB_NULL;
    } else if (typeof data[key4] === "boolean") {
      clone2[safeKey] = data[key4] ? IDB_TRUE : IDB_FALSE;
    } else if (typeof data[key4] === "object") {
      clone2[safeKey] = rewrite(data[key4]);
    } else {
      clone2[safeKey] = data[key4];
    }
  });
  return clone2;
}
function idbError2(callback) {
  return function(evt) {
    let message = "unknown_error";
    if (evt.target && evt.target.error) {
      message = evt.target.error.name || evt.target.error.message;
    }
    callback(createError(IDB_ERROR, message, evt.type));
  };
}
function processAttachment(name, src, doc, isBinary, attachmentFormat) {
  delete doc._attachments[name].stub;
  if (attachmentFormat === "base64") {
    if (isBinary) {
      const att = src.attachments[doc._attachments[name].digest];
      doc._attachments[name].data = b64ToBluffer(att.data, att.content_type);
    } else {
      doc._attachments[name].data = src.attachments[doc._attachments[name].digest].data;
    }
    delete doc._attachments[name].length;
    return Promise.resolve();
  }
  if (isBinary) {
    doc._attachments[name].data = src.attachments[doc._attachments[name].digest].data;
    return Promise.resolve();
  }
  return new Promise(function(resolve) {
    const data = src.attachments[doc._attachments[name].digest].data;
    readAsBinaryString(data, function(binString) {
      doc._attachments[name].data = thisBtoa(binString);
      delete doc._attachments[name].length;
      resolve();
    });
  });
}
function rawIndexFields(ddoc, viewName) {
  const fields = ddoc.views[viewName].options && ddoc.views[viewName].options.def && ddoc.views[viewName].options.def.fields || [];
  return fields.map(function(field) {
    if (typeof field === "string") {
      return field;
    } else {
      return Object.keys(field)[0];
    }
  });
}
function isPartialFilterView(ddoc, viewName) {
  return viewName in ddoc.views && ddoc.views[viewName].options && ddoc.views[viewName].options.def && ddoc.views[viewName].options.def.partial_filter_selector;
}
function naturalIndexName(fields) {
  return "_find_idx/" + fields.join("/");
}
function correctIndexFields(fields) {
  return ["deleted"].concat(
    fields.map(function(field) {
      if (["_id", "_rev", "_deleted", "_attachments"].includes(field)) {
        return field.substr(1);
      } else {
        return "data." + sanitise(field, true);
      }
    })
  );
}
function createIdbVersion() {
  return versionMultiplier * POUCHDB_IDB_VERSION + (/* @__PURE__ */ new Date()).getTime();
}
function getPouchDbVersion(version2) {
  return Math.floor(version2 / versionMultiplier);
}
function maintainNativeIndexes(openReq, reject) {
  const docStore = openReq.transaction.objectStore(DOC_STORE2);
  const ddocsReq = docStore.getAll(IDBKeyRange.bound("_design/", "_design/\uFFFF"));
  ddocsReq.onsuccess = function(e2) {
    const results = e2.target.result;
    const existingIndexNames = Array.from(docStore.indexNames);
    const expectedIndexes = results.filter(function(row) {
      return row.deleted === 0 && row.revs[row.rev].data.views;
    }).map(function(row) {
      return row.revs[row.rev].data;
    }).reduce(function(indexes2, ddoc) {
      return Object.keys(ddoc.views).reduce(function(acc, viewName) {
        const fields = rawIndexFields(ddoc, viewName);
        if (fields && fields.length > 0) {
          acc[naturalIndexName(fields)] = correctIndexFields(fields);
        }
        return acc;
      }, indexes2);
    }, {});
    const expectedIndexNames = Object.keys(expectedIndexes);
    const systemIndexNames = ["seq", "deleted,id"];
    existingIndexNames.forEach(function(index6) {
      if (systemIndexNames.indexOf(index6) === -1 && expectedIndexNames.indexOf(index6) === -1) {
        docStore.deleteIndex(index6);
      }
    });
    const newIndexNames = expectedIndexNames.filter(function(ei) {
      return existingIndexNames.indexOf(ei) === -1;
    });
    try {
      newIndexNames.forEach(function(indexName) {
        docStore.createIndex(indexName, expectedIndexes[indexName]);
      });
    } catch (err2) {
      reject(err2);
    }
  };
}
function upgradePouchDbSchema(dbName, db, tx, pouchdbVersion) {
  if (pouchdbVersion < 1) {
    const docStore = db.createObjectStore(DOC_STORE2, { keyPath: "id" });
    docStore.createIndex("seq", "seq", { unique: true });
    db.createObjectStore(META_LOCAL_STORE, { keyPath: "id" });
  }
  if (pouchdbVersion < 2) {
    const docStore = tx.objectStore(DOC_STORE2);
    docStore.createIndex("deleted,id", ["deleted", "id"], { unique: true });
    if (dbName.includes("-mrview-")) {
      docStore.deleteIndex("seq");
    }
  }
}
function openDatabase(openDatabases2, api, opts, resolve, reject) {
  const openReq = opts.versionChangedWhileOpen ? indexedDB.open(opts.name) : indexedDB.open(opts.name, createIdbVersion());
  openReq.onupgradeneeded = function(e2) {
    if (e2.oldVersion > 0 && e2.oldVersion < versionMultiplier) {
      throw new Error('Incorrect adapter: you should specify the "idb" adapter to open this DB');
    } else if (e2.oldVersion === 0 && e2.newVersion < versionMultiplier) {
      indexedDB.deleteDatabase(opts.name);
      throw new Error("Database was deleted while open");
    }
    const tx = e2.target.transaction;
    const db = e2.target.result;
    const pouchdbVersion = getPouchDbVersion(e2.oldVersion);
    upgradePouchDbSchema(opts.name, db, tx, pouchdbVersion);
    maintainNativeIndexes(openReq, reject);
    if (pouchdbVersion < 2) {
      const docStore = openReq.transaction.objectStore(DOC_STORE2);
      const metaStore = openReq.transaction.objectStore(META_LOCAL_STORE);
      const allDocsReq = docStore.openCursor();
      allDocsReq.onsuccess = (event2) => {
        const cursor = event2.target.result;
        if (!cursor) {
          return;
        }
        const doc = cursor.value;
        if (!isLocalId(doc.id)) {
          return cursor.continue();
        }
        metaStore.put(doc).onsuccess = () => {
          cursor.delete(doc).onsuccess = () => {
            cursor.continue();
          };
        };
      };
    }
  };
  openReq.onblocked = function(e2) {
    console.error("onblocked, this should never happen", e2);
  };
  openReq.onsuccess = function(e2) {
    const idb = e2.target.result;
    idb.onabort = function(e3) {
      console.error("Database has a global failure", e3.target.error);
      delete openDatabases2[opts.name];
      idb.close();
    };
    idb.onversionchange = function() {
      console.log("Database was made stale, closing handle");
      openDatabases2[opts.name].versionChangedWhileOpen = true;
      idb.close();
    };
    idb.onclose = function() {
      console.log("Database was made stale, closing handle");
      if (opts.name in openDatabases2) {
        openDatabases2[opts.name].versionChangedWhileOpen = true;
      }
    };
    let metadata = { id: META_LOCAL_STORE };
    const txn = idb.transaction([META_LOCAL_STORE], "readwrite");
    txn.oncomplete = function() {
      resolve({ idb, metadata });
    };
    const metaStore = txn.objectStore(META_LOCAL_STORE);
    metaStore.get(META_LOCAL_STORE).onsuccess = function(e3) {
      metadata = e3.target.result || metadata;
      let changed = false;
      if (!("doc_count" in metadata)) {
        changed = true;
        metadata.doc_count = 0;
      }
      if (!("seq" in metadata)) {
        changed = true;
        metadata.seq = 0;
      }
      if (!("db_uuid" in metadata)) {
        changed = true;
        metadata.db_uuid = uuid();
      }
      if (!("idb_attachment_format" in metadata)) {
        const createBlobDoc = (blob) => ({ id: "blob-support", blob });
        checkBlobSupport(txn, META_LOCAL_STORE, createBlobDoc).then((blobSupport) => {
          api.blobSupport = metadata.idb_attachment_format = blobSupport ? "binary" : "base64";
          metaStore.put(metadata);
        });
      } else if (changed) {
        api.blobSupport = metadata.idb_attachment_format;
        metaStore.put(metadata);
      }
    };
  };
  openReq.onerror = function(e2) {
    reject(e2.target.error);
  };
}
function setup(openDatabases2, api, opts) {
  if (!openDatabases2[opts.name] || openDatabases2[opts.name].versionChangedWhileOpen) {
    opts.versionChangedWhileOpen = openDatabases2[opts.name] && openDatabases2[opts.name].versionChangedWhileOpen;
    openDatabases2[opts.name] = new Promise(function(resolve, reject) {
      openDatabase(openDatabases2, api, opts, resolve, reject);
    });
  }
  return openDatabases2[opts.name];
}
function info2(metadata, callback) {
  callback(null, {
    doc_count: metadata.doc_count,
    update_seq: metadata.seq
  });
}
function get(txn, id, opts, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  txn.txn.objectStore(DOC_STORE2).get(id).onsuccess = function(e2) {
    const doc = e2.target.result;
    let rev3;
    if (!opts.rev) {
      rev3 = doc && doc.rev;
    } else {
      rev3 = opts.latest ? latest(opts.rev, doc) : opts.rev;
    }
    if (!doc || doc.deleted && !opts.rev || !(rev3 in doc.revs)) {
      callback(createError(MISSING_DOC, "missing"));
      return;
    }
    const result = doc.revs[rev3].data;
    result._id = doc.id;
    result._rev = rev3;
    callback(null, {
      doc: result,
      metadata: doc,
      ctx: txn
    });
  };
}
function getLocal(txn, id, api, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  txn.txn.objectStore(META_LOCAL_STORE).get(id).onsuccess = function(e2) {
    const doc = e2.target.result;
    if (!doc) {
      callback(createError(MISSING_DOC, "missing"));
      return;
    }
    const result = doc.revs[doc.rev].data;
    result._id = doc.id;
    result._rev = doc.rev;
    if (result._attachments) {
      const processing = [];
      for (const name in result._attachments) {
        processing.push(processAttachment(name, doc, result, BINARY_ATTACHMENTS, api.blobSupport));
      }
      Promise.all(processing).then(() => callback(null, result)).catch(callback);
    } else {
      callback(null, result);
    }
  };
}
function getAttachment(docId, attachId, attachment, opts, cb) {
  if (isLocalId(docId)) {
    cb(createError(MISSING_DOC, "missing"));
    return;
  }
  const doc = opts.metadata;
  const data = doc.attachments[attachment.digest].data;
  if (typeof data === "string") {
    if (opts.binary) {
      cb(null, b64ToBluffer(data, attachment.content_type));
    } else {
      cb(null, data);
    }
    return;
  }
  if (opts.binary) {
    return cb(null, data);
  } else {
    readAsBinaryString(data, function(binString) {
      cb(null, thisBtoa(binString));
    });
  }
}
function bulkDocs(api, req, opts, metadata, dbOpts, idbChanges2, callback) {
  let txn;
  let error2;
  const results = [];
  const docs = [];
  let lastWriteIndex;
  const revsLimit = dbOpts.revs_limit || 1e3;
  const rewriteEnabled = dbOpts.name.indexOf("-mrview-") === -1;
  const autoCompaction = dbOpts.auto_compaction;
  function docsRevsLimit(doc) {
    return isLocalId(doc.id) ? 1 : revsLimit;
  }
  function rootIsMissing2(doc) {
    return doc.rev_tree[0].ids[1].status === "missing";
  }
  function fetchExistingDocs(txn2, docs2) {
    let fetched = 0;
    const oldDocs = {};
    function readDone(e2) {
      if (e2.target.result) {
        oldDocs[e2.target.result.id] = e2.target.result;
      }
      if (++fetched === docs2.length) {
        processDocs2(txn2, docs2, oldDocs);
      }
    }
    docs2.forEach(function(doc) {
      const docStore = isLocalId(doc.id) ? META_LOCAL_STORE : DOC_STORE2;
      txn2.objectStore(docStore).get(doc.id).onsuccess = readDone;
    });
  }
  function revHasAttachment(doc, rev3, digest) {
    return doc.revs[rev3] && doc.revs[rev3].data._attachments && Object.values(doc.revs[rev3].data._attachments).find(function(att) {
      return att.digest === digest;
    });
  }
  function processDocs2(txn2, docs2, oldDocs) {
    docs2.forEach(function(doc, i) {
      let newDoc;
      if ("was_delete" in opts && !Object.prototype.hasOwnProperty.call(oldDocs, doc.id)) {
        newDoc = createError(MISSING_DOC, "deleted");
      } else if (opts.new_edits && !Object.prototype.hasOwnProperty.call(oldDocs, doc.id) && rootIsMissing2(doc)) {
        newDoc = createError(REV_CONFLICT);
      } else if (Object.prototype.hasOwnProperty.call(oldDocs, doc.id)) {
        newDoc = update2(txn2, doc, oldDocs[doc.id]);
        if (newDoc == false) {
          return;
        }
      } else {
        const merged = merge([], doc.rev_tree[0], docsRevsLimit(doc));
        doc.rev_tree = merged.tree;
        doc.stemmedRevs = merged.stemmedRevs;
        newDoc = doc;
        newDoc.isNewDoc = true;
        newDoc.wasDeleted = doc.revs[doc.rev].deleted ? 1 : 0;
      }
      if (newDoc.error) {
        results[i] = newDoc;
      } else {
        oldDocs[newDoc.id] = newDoc;
        lastWriteIndex = i;
        write(txn2, newDoc, i);
      }
    });
  }
  function convertDocFormat(doc) {
    const newDoc = {
      id: doc.metadata.id,
      rev: doc.metadata.rev,
      rev_tree: doc.metadata.rev_tree,
      revs: doc.metadata.revs || {}
    };
    newDoc.revs[newDoc.rev] = {
      data: doc.data,
      deleted: doc.metadata.deleted
    };
    return newDoc;
  }
  function update2(txn2, doc, oldDoc) {
    if (doc.rev in oldDoc.revs && !opts.new_edits) {
      return false;
    }
    const isRoot = /^1-/.test(doc.rev);
    if (oldDoc.deleted && !doc.deleted && opts.new_edits && isRoot) {
      const tmp = doc.revs[doc.rev].data;
      tmp._rev = oldDoc.rev;
      tmp._id = oldDoc.id;
      doc = convertDocFormat(parseDoc(tmp, opts.new_edits, dbOpts));
    }
    const merged = merge(oldDoc.rev_tree, doc.rev_tree[0], docsRevsLimit(doc));
    doc.stemmedRevs = merged.stemmedRevs;
    doc.rev_tree = merged.tree;
    const revs = oldDoc.revs;
    revs[doc.rev] = doc.revs[doc.rev];
    doc.revs = revs;
    doc.attachments = oldDoc.attachments;
    const inConflict = opts.new_edits && (oldDoc.deleted && doc.deleted || !oldDoc.deleted && merged.conflicts !== "new_leaf" || oldDoc.deleted && !doc.deleted && merged.conflicts === "new_branch" || oldDoc.rev === doc.rev);
    if (inConflict) {
      return createError(REV_CONFLICT);
    }
    doc.wasDeleted = oldDoc.deleted;
    return doc;
  }
  function write(txn2, doc, i) {
    const winningRev$$1 = winningRev(doc);
    const writtenRev = doc.rev;
    const isLocal = isLocalId(doc.id);
    const theDoc = doc.revs[winningRev$$1].data;
    const isNewDoc = doc.isNewDoc;
    if (rewriteEnabled) {
      const result = rewrite(theDoc);
      if (result) {
        doc.data = result;
        delete doc.data._attachments;
      } else {
        doc.data = theDoc;
      }
    } else {
      doc.data = theDoc;
    }
    doc.rev = winningRev$$1;
    doc.deleted = doc.revs[winningRev$$1].deleted ? 1 : 0;
    if (!isLocal) {
      doc.seq = ++metadata.seq;
      let delta = 0;
      if (doc.isNewDoc) {
        delta = doc.deleted ? 0 : 1;
      } else if (doc.wasDeleted !== doc.deleted) {
        delta = doc.deleted ? -1 : 1;
      }
      metadata.doc_count += delta;
    }
    delete doc.isNewDoc;
    delete doc.wasDeleted;
    let revsToDelete = doc.stemmedRevs || [];
    if (autoCompaction && !isNewDoc) {
      const result = compactTree(doc);
      if (result.length) {
        revsToDelete = revsToDelete.concat(result);
      }
    }
    if (revsToDelete.length) {
      revsToDelete.forEach(function(rev3) {
        delete doc.revs[rev3];
      });
    }
    delete doc.stemmedRevs;
    if (!("attachments" in doc)) {
      doc.attachments = {};
    }
    if (theDoc._attachments) {
      for (const k in theDoc._attachments) {
        const attachment = theDoc._attachments[k];
        if (attachment.stub) {
          if (!(attachment.digest in doc.attachments)) {
            error2 = createError(MISSING_STUB);
            txn2.abort();
            return;
          }
          if (revHasAttachment(doc, writtenRev, attachment.digest)) {
            doc.attachments[attachment.digest].revs[writtenRev] = true;
          }
        } else {
          doc.attachments[attachment.digest] = attachment;
          doc.attachments[attachment.digest].revs = {};
          doc.attachments[attachment.digest].revs[writtenRev] = true;
          theDoc._attachments[k] = {
            stub: true,
            digest: attachment.digest,
            content_type: attachment.content_type,
            length: attachment.length,
            revpos: parseInt(writtenRev, 10)
          };
        }
      }
    }
    if (isLocal && doc.deleted) {
      txn2.objectStore(META_LOCAL_STORE).delete(doc.id).onsuccess = function() {
        results[i] = {
          ok: true,
          id: doc.id,
          rev: "0-0"
        };
      };
      updateSeq(i);
      return;
    }
    const docStore = isLocal ? META_LOCAL_STORE : DOC_STORE2;
    txn2.objectStore(docStore).put(doc).onsuccess = function() {
      results[i] = {
        ok: true,
        id: doc.id,
        rev: writtenRev
      };
      updateSeq(i);
    };
  }
  function updateSeq(i) {
    if (i === lastWriteIndex) {
      txn.objectStore(META_LOCAL_STORE).put(metadata);
    }
  }
  function preProcessAttachment(attachment) {
    if (attachment.stub) {
      return Promise.resolve(attachment);
    }
    let binData;
    if (typeof attachment.data === "string") {
      try {
        binData = thisAtob(attachment.data);
      } catch (e2) {
        return Promise.reject(createError(BAD_ARG, "Attachment is not a valid base64 string"));
      }
      if (metadata.idb_attachment_format === "binary") {
        attachment.data = binStringToBluffer(binData, attachment.content_type);
      }
    } else {
      binData = attachment.data;
      if (metadata.idb_attachment_format === "base64") {
        return new Promise((resolve) => {
          blobToBase64(attachment.data, function(b64) {
            attachment.data = b64;
            binaryMd5(binData, function(result) {
              attachment.digest = "md5-" + result;
              attachment.length = binData.size || binData.length || 0;
              resolve(attachment);
            });
          });
        });
      }
    }
    return new Promise(function(resolve) {
      binaryMd5(binData, function(result) {
        attachment.digest = "md5-" + result;
        attachment.length = binData.size || binData.length || 0;
        resolve(attachment);
      });
    });
  }
  function preProcessAttachments() {
    const promises6 = docs.map(function(doc) {
      const data = doc.revs[doc.rev].data;
      if (!data._attachments) {
        return Promise.resolve(data);
      }
      const attachments = Object.keys(data._attachments).map(function(k) {
        data._attachments[k].name = k;
        return preProcessAttachment(data._attachments[k]);
      });
      return Promise.all(attachments).then(function(newAttachments) {
        const processed = {};
        newAttachments.forEach(function(attachment) {
          processed[attachment.name] = attachment;
          delete attachment.name;
        });
        data._attachments = processed;
        return data;
      });
    });
    return Promise.all(promises6);
  }
  for (let i = 0, len = req.docs.length; i < len; i++) {
    let result;
    try {
      result = parseDoc(req.docs[i], opts.new_edits, dbOpts);
    } catch (err2) {
      result = err2;
    }
    if (result.error) {
      return callback(result);
    }
    docs.push(convertDocFormat(result));
  }
  preProcessAttachments().then(function() {
    api._openTransactionSafely([DOC_STORE2, META_LOCAL_STORE], "readwrite", function(err2, _txn) {
      if (err2) {
        return callback(err2);
      }
      txn = _txn;
      txn.onabort = function() {
        callback(error2 || createError(UNKNOWN_ERROR, "transaction was aborted"));
      };
      txn.ontimeout = idbError2(callback);
      txn.oncomplete = function() {
        idbChanges2.notify(dbOpts.name);
        callback(null, results);
      };
      fetchExistingDocs(txn, docs);
    });
  }).catch(function(err2) {
    callback(err2);
  });
}
function allDocsKeys2(keys2, docStore, allDocsInner) {
  const valuesBatch = new Array(keys2.length);
  let count = 0;
  keys2.forEach(function(key4, index6) {
    docStore.get(key4).onsuccess = function(event2) {
      if (event2.target.result) {
        valuesBatch[index6] = event2.target.result;
      } else {
        valuesBatch[index6] = { key: key4, error: "not_found" };
      }
      count++;
      if (count === keys2.length) {
        valuesBatch.forEach(function(doc) {
          allDocsInner(doc);
        });
      }
    };
  });
}
function createKeyRange2(start, end, inclusiveStart, inclusiveEnd, key4, descending) {
  try {
    if (key4) {
      return IDBKeyRange.only([0, key4]);
    } else if (descending) {
      return IDBKeyRange.bound(end, start, !inclusiveEnd, !inclusiveStart);
    } else {
      return IDBKeyRange.bound(start, end, !inclusiveStart, !inclusiveEnd);
    }
  } catch (e2) {
    return { error: e2 };
  }
}
function handleKeyRangeError(opts, metadata, err2, callback) {
  if (err2.name === "DataError" && err2.code === 0) {
    const returnVal = {
      total_rows: metadata.doc_count,
      offset: opts.skip,
      rows: []
    };
    if (opts.update_seq) {
      returnVal.update_seq = metadata.seq;
    }
    return callback(null, returnVal);
  }
  callback(createError(IDB_ERROR, err2.name, err2.message));
}
function allDocs(txn, metadata, opts, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  if (opts.limit === 0) {
    const returnVal = {
      total_rows: metadata.doc_count,
      offset: opts.skip,
      rows: []
    };
    if (opts.update_seq) {
      returnVal.update_seq = metadata.seq;
    }
    return callback(null, returnVal);
  }
  const results = [];
  const processing = [];
  const key4 = "key" in opts ? opts.key : false;
  const keys2 = "keys" in opts ? opts.keys : false;
  let skip = opts.skip || 0;
  let limit = typeof opts.limit === "number" ? opts.limit : void 0;
  const inclusiveEnd = opts.inclusive_end !== false;
  const descending = "descending" in opts && opts.descending ? "prev" : null;
  const start = "startkey" in opts ? opts.startkey : descending ? "\uFFFF" : "";
  const end = "endkey" in opts ? opts.endkey : descending ? "" : "\uFFFF";
  const docStore = txn.txn.objectStore(DOC_STORE2);
  if (keys2) {
    txn.txn.oncomplete = onTxnComplete;
    const allDocsInner = (doc) => {
      if (doc.error) {
        return results.push(doc);
      }
      const row = { id: doc.id, key: doc.id, value: { rev: doc.rev } };
      if (doc.deleted) {
        row.value.deleted = true;
        row.doc = null;
      } else if (opts.include_docs) {
        include_doc(row, doc);
      }
      results.push(row);
    };
    return allDocsKeys2(keys2, docStore, allDocsInner);
  }
  let keyRange = createKeyRange2([0, start], [0, end], true, inclusiveEnd, key4, descending);
  if (keyRange.error) {
    return handleKeyRangeError(opts, metadata, keyRange.error, callback);
  }
  txn.txn.oncomplete = onTxnComplete;
  function include_doc(row, doc) {
    const docData = doc.revs[doc.rev].data;
    row.doc = docData;
    row.doc._id = doc.id;
    row.doc._rev = doc.rev;
    if (opts.conflicts) {
      const conflicts = collectConflicts(doc);
      if (conflicts.length) {
        row.doc._conflicts = conflicts;
      }
    }
    if (opts.attachments && docData._attachments) {
      for (const name in docData._attachments) {
        processing.push(processAttachment(
          name,
          doc,
          row.doc,
          opts.binary,
          metadata.idb_attachment_format
        ));
      }
    }
  }
  function onTxnComplete() {
    const returnVal = {
      total_rows: metadata.doc_count,
      offset: 0,
      rows: results
    };
    if (opts.update_seq) {
      returnVal.update_seq = metadata.seq;
    }
    if (processing.length) {
      Promise.all(processing).then(function() {
        callback(null, returnVal);
      });
    } else {
      callback(null, returnVal);
    }
  }
  const dbIndex = docStore.index("deleted,id");
  if (!skip && !limit) {
    fetchResults();
  } else {
    let firstKey;
    let limitKey = limit > 0;
    dbIndex.openKeyCursor(keyRange, descending || "next").onsuccess = (e2) => {
      const cursor = e2.target.result;
      if (skip) {
        if (!cursor) {
          return txn.txn.commit();
        }
        cursor.advance(skip);
        skip = 0;
        return;
      }
      if (firstKey === void 0) {
        firstKey = cursor && cursor.key;
        if (!firstKey) {
          return txn.txn.commit();
        }
      }
      if (limit) {
        if (limit > 1 && cursor) {
          cursor.advance(limit - 1);
          limit = void 0;
          return;
        }
        limit = void 0;
      }
      if (limitKey) {
        limitKey = cursor && cursor.key;
      }
      if (!limitKey) {
        limitKey = descending ? keyRange.lower : keyRange.upper;
      }
      keyRange = createKeyRange2(firstKey, limitKey, true, inclusiveEnd, key4, descending);
      if (keyRange.error) {
        txn.txn.abort();
        return handleKeyRangeError(opts, metadata, keyRange.error, callback);
      }
      fetchResults();
    };
  }
  async function fetchResults() {
    const batchSize = 100;
    let kr = keyRange;
    do {
      kr = await fetchNextBatch(kr);
    } while (kr);
    if (descending) {
      results.reverse();
    }
    return txn.txn.commit();
    function fetchNextBatch(kr2) {
      return new Promise((resolve) => {
        dbIndex.getAll(kr2, batchSize).onsuccess = (e2) => {
          const batch = e2.target.result;
          for (let i = 0; i < batch.length; ++i) {
            const doc = batch[i];
            const row = { id: doc.id, key: doc.id, value: { rev: doc.rev } };
            if (opts.include_docs) {
              include_doc(row, doc);
            }
            results.push(row);
          }
          if (batch.length >= batchSize) {
            const lastSeenKey = [0, batch[batch.length - 1].id];
            const startKey = descending ? kr2.upper : lastSeenKey;
            const endKey = descending ? lastSeenKey : kr2.upper;
            if (startKey[1] !== endKey[1]) {
              const incEnd = descending ? false : inclusiveEnd;
              const incStart = descending ? true : false;
              return resolve(createKeyRange2(startKey, endKey, incStart, incEnd, key4, descending));
            }
          }
          return resolve();
        };
      });
    }
  }
}
function changes2(txn, idbChanges2, api, dbOpts, opts) {
  if (txn.error) {
    return opts.complete(txn.error);
  }
  if (opts.continuous) {
    const id = dbOpts.name + ":" + uuid();
    idbChanges2.addListener(dbOpts.name, id, api, opts);
    idbChanges2.notify(dbOpts.name);
    return {
      cancel: function() {
        idbChanges2.removeListener(dbOpts.name, id);
      }
    };
  }
  let limit = "limit" in opts ? opts.limit : -1;
  if (limit === 0) {
    limit = 1;
  }
  const store = txn.txn.objectStore(DOC_STORE2).index("seq");
  const filter3 = filterChange(opts);
  let received = 0;
  let lastSeq = opts.since || 0;
  const results = [];
  const processing = [];
  function onReqSuccess(e2) {
    if (!e2.target.result) {
      return;
    }
    const cursor = e2.target.result;
    const doc = cursor.value;
    doc.data = doc.revs[doc.rev].data;
    doc.data._id = doc.id;
    doc.data._rev = doc.rev;
    if (doc.deleted) {
      doc.data._deleted = true;
    }
    if (opts.doc_ids && opts.doc_ids.indexOf(doc.id) === -1) {
      return cursor.continue();
    }
    const change = opts.processChange(doc.data, doc, opts);
    change.seq = doc.seq;
    lastSeq = doc.seq;
    const filtered = filter3(change);
    if (typeof filtered === "object") {
      return opts.complete(filtered);
    }
    if (filtered) {
      received++;
      if (opts.return_docs) {
        results.push(change);
      }
      if (opts.include_docs && opts.attachments && doc.data._attachments) {
        const promises6 = [];
        for (const name in doc.data._attachments) {
          const p = processAttachment(name, doc, change.doc, opts.binary, api.blobSupport);
          promises6.push(p);
          processing.push(p);
        }
        Promise.all(promises6).then(function() {
          opts.onChange(change);
        });
      } else {
        opts.onChange(change);
      }
    }
    if (received !== limit) {
      cursor.continue();
    }
  }
  function onTxnComplete() {
    Promise.all(processing).then(function() {
      opts.complete(null, {
        results,
        last_seq: lastSeq
      });
    });
  }
  let req;
  if (opts.descending) {
    req = store.openCursor(null, "prev");
  } else {
    req = store.openCursor(IDBKeyRange.lowerBound(opts.since, true));
  }
  txn.txn.oncomplete = onTxnComplete;
  req.onsuccess = onReqSuccess;
}
function getRevisionTree(txn, id, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  const req = txn.txn.objectStore(DOC_STORE2).get(id);
  req.onsuccess = function(e2) {
    if (!e2.target.result) {
      callback(createError(MISSING_DOC));
    } else {
      callback(null, e2.target.result.rev_tree);
    }
  };
}
function doCompaction(txn, id, revs, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  const docStore = txn.txn.objectStore(DOC_STORE2);
  docStore.get(id).onsuccess = function(e2) {
    const doc = e2.target.result;
    traverseRevTree(doc.rev_tree, function(isLeaf, pos2, revHash, ctx, opts) {
      const rev3 = pos2 + "-" + revHash;
      if (revs.indexOf(rev3) !== -1) {
        opts.status = "missing";
      }
    });
    const attachments = [];
    revs.forEach(function(rev3) {
      if (rev3 in doc.revs) {
        if (doc.revs[rev3].data._attachments) {
          for (const k in doc.revs[rev3].data._attachments) {
            attachments.push(doc.revs[rev3].data._attachments[k].digest);
          }
        }
        delete doc.revs[rev3];
      }
    });
    attachments.forEach(function(digest) {
      revs.forEach(function(rev3) {
        delete doc.attachments[digest].revs[rev3];
      });
      if (!Object.keys(doc.attachments[digest].revs).length) {
        delete doc.attachments[digest];
      }
    });
    docStore.put(doc);
  };
  txn.txn.oncomplete = function() {
    callback();
  };
}
function destroy(dbOpts, openDatabases2, idbChanges2, callback) {
  idbChanges2.removeAllListeners(dbOpts.name);
  function doDestroy() {
    const req = indexedDB.deleteDatabase(dbOpts.name);
    req.onsuccess = function() {
      delete openDatabases2[dbOpts.name];
      callback(null, { ok: true });
    };
  }
  if (dbOpts.name in openDatabases2) {
    openDatabases2[dbOpts.name].then(function(res2) {
      res2.idb.close();
      doDestroy();
    });
  } else {
    doDestroy();
  }
}
function externaliseRecord(idbDoc) {
  const doc = idbDoc.revs[idbDoc.rev].data;
  doc._id = idbDoc.id;
  doc._rev = idbDoc.rev;
  if (idbDoc.deleted) {
    doc._deleted = true;
  }
  return doc;
}
function generateKeyRange(opts) {
  function defined(obj, k) {
    return obj[k] !== void 0;
  }
  function convert(key4, exact) {
    const filterDeleted = [0].concat(key4);
    return filterDeleted.map(function(k) {
      if (k === null && exact) {
        return IDB_NULL;
      } else if (k === true) {
        return IDB_TRUE;
      } else if (k === false) {
        return IDB_FALSE;
      }
      if (!exact) {
        if (k === COUCH_COLLATE_LO) {
          return IDB_COLLATE_LO;
        } else if (Object.prototype.hasOwnProperty.call(k, COUCH_COLLATE_HI)) {
          return IDB_COLLATE_HI;
        }
      }
      return k;
    });
  }
  if (!defined(opts, "inclusive_end")) {
    opts.inclusive_end = true;
  }
  if (!defined(opts, "inclusive_start")) {
    opts.inclusive_start = true;
  }
  if (opts.descending) {
    const realEndkey = opts.startkey, realInclusiveEnd = opts.inclusive_start;
    opts.startkey = opts.endkey;
    opts.endkey = realEndkey;
    opts.inclusive_start = opts.inclusive_end;
    opts.inclusive_end = realInclusiveEnd;
  }
  try {
    if (defined(opts, "key")) {
      return IDBKeyRange.only(convert(opts.key, true));
    }
    if (defined(opts, "startkey") && !defined(opts, "endkey")) {
      return IDBKeyRange.bound(
        convert(opts.startkey),
        [1],
        !opts.inclusive_start,
        true
      );
    }
    if (!defined(opts, "startkey") && defined(opts, "endkey")) {
      return IDBKeyRange.upperBound(convert(opts.endkey), !opts.inclusive_end);
    }
    if (defined(opts, "startkey") && defined(opts, "endkey")) {
      return IDBKeyRange.bound(
        convert(opts.startkey),
        convert(opts.endkey),
        !opts.inclusive_start,
        !opts.inclusive_end
      );
    }
    return IDBKeyRange.only([0]);
  } catch (err2) {
    console.error("Could not generate keyRange", err2, opts);
    throw Error("Could not generate key range with " + JSON.stringify(opts));
  }
}
function getIndexHandle(pdb, fields, reject) {
  const indexName = naturalIndexName(fields);
  return new Promise(function(resolve) {
    pdb._openTransactionSafely([DOC_STORE2], "readonly", function(err2, txn) {
      if (err2) {
        return idbError2(reject)(err2);
      }
      txn.onabort = idbError2(reject);
      txn.ontimeout = idbError2(reject);
      const existingIndexNames = Array.from(txn.objectStore(DOC_STORE2).indexNames);
      if (existingIndexNames.indexOf(indexName) === -1) {
        pdb._freshen().then(function() {
          return getIndexHandle(pdb, fields, reject);
        }).then(resolve);
      } else {
        resolve(txn.objectStore(DOC_STORE2).index(indexName));
      }
    });
  });
}
function query(idb, signature, opts, fallback2) {
  const pdb = this;
  const parts = signature.split("/");
  return new Promise(function(resolve, reject) {
    pdb.get("_design/" + parts[0]).then(function(ddoc) {
      if (isPartialFilterView(ddoc, parts[1])) {
        return fallback2(signature, opts).then(resolve, reject);
      }
      const fields = rawIndexFields(ddoc, parts[1]);
      if (!fields) {
        throw new Error("ddoc " + ddoc._id + " with view " + parts[1] + " does not have map.options.def.fields defined.");
      }
      let skip = opts.skip;
      let limit = Number.isInteger(opts.limit) && opts.limit;
      return getIndexHandle(pdb, fields, reject).then(function(indexHandle) {
        const keyRange = generateKeyRange(opts);
        const req = indexHandle.openCursor(keyRange, opts.descending ? "prev" : "next");
        const rows = [];
        req.onerror = idbError2(reject);
        req.onsuccess = function(e2) {
          const cursor = e2.target.result;
          if (!cursor || limit === 0) {
            return resolve({
              rows
            });
          }
          if (skip) {
            cursor.advance(skip);
            skip = false;
            return;
          }
          if (limit) {
            limit = limit - 1;
          }
          rows.push({ doc: externaliseRecord(cursor.value) });
          cursor.continue();
        };
      });
    }).catch(reject);
  });
}
function viewCleanup(idb, fallback2) {
  return fallback2();
}
function purgeAttachments(doc, revs) {
  if (!doc.attachments) {
    return {};
  }
  for (let key4 in doc.attachments) {
    const attachment = doc.attachments[key4];
    for (let rev3 of revs) {
      if (attachment.revs[rev3]) {
        delete attachment.revs[rev3];
      }
    }
    if (Object.keys(attachment.revs).length === 0) {
      delete doc.attachments[key4];
    }
  }
  return doc.attachments;
}
function purge(txn, docId, revs, callback) {
  if (txn.error) {
    return callback(txn.error);
  }
  const docStore = txn.txn.objectStore(DOC_STORE2);
  const deletedRevs = [];
  let documentWasRemovedCompletely = false;
  docStore.get(docId).onsuccess = (e2) => {
    const doc = e2.target.result;
    for (const rev3 of revs) {
      doc.rev_tree = removeLeafFromRevTree(doc.rev_tree, rev3);
      delete doc.revs[rev3];
      deletedRevs.push(rev3);
    }
    if (doc.rev_tree.length === 0) {
      docStore.delete(doc.id);
      documentWasRemovedCompletely = true;
      return;
    }
    doc.rev = winningRev(doc);
    doc.data = doc.revs[doc.rev].data;
    doc.attachments = purgeAttachments(doc, revs);
    docStore.put(doc);
  };
  txn.txn.oncomplete = function() {
    callback(null, {
      ok: true,
      deletedRevs,
      documentWasRemovedCompletely
    });
  };
}
function IndexeddbPouch(dbOpts, callback) {
  if (dbOpts.view_adapter) {
    console.log("Please note that the indexeddb adapter manages _find indexes itself, therefore it is not using your specified view_adapter");
  }
  const api = this;
  let metadata = {};
  const $ = function(fun) {
    return function() {
      const args = Array.prototype.slice.call(arguments);
      setup(openDatabases, api, dbOpts).then(function(res2) {
        metadata = res2.metadata;
        args.unshift(res2.idb);
        fun.apply(api, args);
      }).catch(function(err2) {
        const last = args.pop();
        if (typeof last === "function") {
          last(err2);
        } else {
          console.error(err2);
        }
      });
    };
  };
  const $p = function(fun) {
    return function() {
      const args = Array.prototype.slice.call(arguments);
      return setup(openDatabases, api, dbOpts).then(function(res2) {
        metadata = res2.metadata;
        args.unshift(res2.idb);
        return fun.apply(api, args);
      });
    };
  };
  const $t2 = function(fun, stores, mode) {
    mode = mode || "readonly";
    return function() {
      const args = Array.prototype.slice.call(arguments);
      const txn = {};
      setup(openDatabases, api, dbOpts).then(function(res2) {
        metadata = res2.metadata;
        txn.txn = res2.idb.transaction(stores, mode);
      }).catch(function(err2) {
        console.error("Failed to establish transaction safely");
        console.error(err2);
        txn.error = err2;
      }).then(function() {
        args.unshift(txn);
        fun.apply(api, args);
      });
    };
  };
  api._openTransactionSafely = function(stores, mode, callback2) {
    $t2(function(txn, callback3) {
      callback3(txn.error, txn.txn);
    }, stores, mode)(callback2);
  };
  api._remote = false;
  api.type = function() {
    return ADAPTER_NAME;
  };
  api._id = $(function(_, cb) {
    cb(null, metadata.db_uuid);
  });
  api._info = $(function(_, cb) {
    return info2(metadata, cb);
  });
  api._get = $t2(get, [DOC_STORE2]);
  api._getLocal = $t2(function(txn, id, callback2) {
    return getLocal(txn, id, api, callback2);
  }, [META_LOCAL_STORE]);
  api._bulkDocs = $(function(_, req, opts, callback2) {
    bulkDocs(api, req, opts, metadata, dbOpts, idbChanges, callback2);
  });
  api._allDocs = $t2(function(txn, opts, cb) {
    allDocs(txn, metadata, opts, cb);
  }, [DOC_STORE2]);
  api._getAttachment = getAttachment;
  api._changes = $t2(function(txn, opts) {
    changes2(txn, idbChanges, api, dbOpts, opts);
  }, [DOC_STORE2]);
  api._getRevisionTree = $t2(getRevisionTree, [DOC_STORE2]);
  api._doCompaction = $t2(doCompaction, [DOC_STORE2], "readwrite");
  api._customFindAbstractMapper = {
    query: $p(query),
    viewCleanup: $p(viewCleanup)
  };
  api._destroy = function(opts, callback2) {
    return destroy(dbOpts, openDatabases, idbChanges, callback2);
  };
  api._close = $(function(db, cb) {
    delete openDatabases[dbOpts.name];
    db.close();
    cb();
  });
  api._freshen = function() {
    return new Promise(function(resolve) {
      api._close(function() {
        $(resolve)();
      });
    });
  };
  api._purge = $t2(purge, [DOC_STORE2], "readwrite");
  setTimeout(function() {
    callback(null, api);
  });
}
function index2(PouchDB3) {
  PouchDB3.adapter(ADAPTER_NAME, IndexeddbPouch, true);
}
var IDB_NULL, IDB_FALSE, IDB_TRUE, TEST_KEY_INVALID, TEST_PATH_INVALID, KEY_INVALID, PATH_INVALID, SLASH, IS_DOT, DOC_STORE2, META_LOCAL_STORE, POUCHDB_IDB_VERSION, versionMultiplier, BINARY_ATTACHMENTS, COUCH_COLLATE_LO, COUCH_COLLATE_HI, IDB_COLLATE_LO, IDB_COLLATE_HI, ADAPTER_NAME, idbChanges, openDatabases, index_es_default3;
var init_index_es9 = __esm({
  "node_modules/pouchdb-adapter-indexeddb/lib/index.es.js"() {
    init_index_browser_es();
    init_index_es7();
    init_index_browser_es2();
    init_index_browser_es3();
    init_index_es();
    init_index_es2();
    IDB_NULL = Number.MIN_SAFE_INTEGER;
    IDB_FALSE = Number.MIN_SAFE_INTEGER + 1;
    IDB_TRUE = Number.MIN_SAFE_INTEGER + 2;
    TEST_KEY_INVALID = /^[^a-zA-Z$]|[^a-zA-Z0-9$]+/;
    TEST_PATH_INVALID = /\\.|(^|\.)[^a-zA-Z$]|[^a-zA-Z0-9$.]+/;
    KEY_INVALID = new RegExp(TEST_KEY_INVALID.source, "g");
    PATH_INVALID = new RegExp(TEST_PATH_INVALID.source, "g");
    SLASH = "\\".charCodeAt(0);
    IS_DOT = ".".charCodeAt(0);
    DOC_STORE2 = "docs";
    META_LOCAL_STORE = "meta";
    POUCHDB_IDB_VERSION = 2;
    versionMultiplier = Math.pow(10, 13);
    BINARY_ATTACHMENTS = false;
    COUCH_COLLATE_LO = null;
    COUCH_COLLATE_HI = "\uFFFF";
    IDB_COLLATE_LO = Number.NEGATIVE_INFINITY;
    IDB_COLLATE_HI = [[[[[[[[[[[[]]]]]]]]]]]];
    ADAPTER_NAME = "indexeddb";
    idbChanges = new Changes();
    openDatabases = {};
    IndexeddbPouch.valid = function() {
      return true;
    };
    index_es_default3 = index2;
  }
});

// node_modules/pouchdb-adapter-http/lib/index.es.js
function pool(promiseFactories, limit) {
  return new Promise(function(resolve, reject) {
    var running2 = 0;
    var current = 0;
    var done = 0;
    var len = promiseFactories.length;
    var err2;
    function runNext() {
      running2++;
      promiseFactories[current++]().then(onSuccess, onError);
    }
    function doNext() {
      if (++done === len) {
        if (err2) {
          reject(err2);
        } else {
          resolve();
        }
      } else {
        runNextBatch();
      }
    }
    function onSuccess() {
      running2--;
      doNext();
    }
    function onError(thisErr) {
      running2--;
      err2 = err2 || thisErr;
      doNext();
    }
    function runNextBatch() {
      while (running2 < limit && current < len) {
        runNext();
      }
    }
    runNextBatch();
  });
}
function readAttachmentsAsBlobOrBuffer(row) {
  const doc = row.doc || row.ok;
  const atts = doc && doc._attachments;
  if (!atts) {
    return;
  }
  Object.keys(atts).forEach(function(filename) {
    const att = atts[filename];
    att.data = b64ToBluffer(att.data, att.content_type);
  });
}
function encodeDocId(id) {
  if (/^_design/.test(id)) {
    return "_design/" + encodeURIComponent(id.slice(8));
  }
  if (id.startsWith("_local/")) {
    return "_local/" + encodeURIComponent(id.slice(7));
  }
  return encodeURIComponent(id);
}
function preprocessAttachments2(doc) {
  if (!doc._attachments || !Object.keys(doc._attachments)) {
    return Promise.resolve();
  }
  return Promise.all(Object.keys(doc._attachments).map(function(key4) {
    const attachment = doc._attachments[key4];
    if (attachment.data && typeof attachment.data !== "string") {
      return new Promise(function(resolve) {
        blobToBase64(attachment.data, resolve);
      }).then(function(b64) {
        attachment.data = b64;
      });
    }
  }));
}
function hasUrlPrefix(opts) {
  if (!opts.prefix) {
    return false;
  }
  const protocol = parseUri(opts.prefix).protocol;
  return protocol === "http" || protocol === "https";
}
function getHost(name, opts) {
  if (hasUrlPrefix(opts)) {
    const dbName = opts.name.substr(opts.prefix.length);
    const prefix = opts.prefix.replace(/\/?$/, "/");
    name = prefix + encodeURIComponent(dbName);
  }
  const uri = parseUri(name);
  if (uri.user || uri.password) {
    uri.auth = { username: uri.user, password: uri.password };
  }
  const parts = uri.path.replace(/(^\/|\/$)/g, "").split("/");
  uri.db = parts.pop();
  if (uri.db.indexOf("%") === -1) {
    uri.db = encodeURIComponent(uri.db);
  }
  uri.path = parts.join("/");
  return uri;
}
function genDBUrl(opts, path8) {
  return genUrl(opts, opts.db + "/" + path8);
}
function genUrl(opts, path8) {
  const pathDel = !opts.path ? "" : "/";
  return opts.protocol + "://" + opts.host + (opts.port ? ":" + opts.port : "") + "/" + opts.path + pathDel + path8;
}
function paramsToStr(params) {
  const paramKeys = Object.keys(params);
  if (paramKeys.length === 0) {
    return "";
  }
  return "?" + paramKeys.map((key4) => key4 + "=" + encodeURIComponent(params[key4])).join("&");
}
function shouldCacheBust(opts) {
  const ua = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent.toLowerCase() : "";
  const isIE = ua.indexOf("msie") !== -1;
  const isTrident = ua.indexOf("trident") !== -1;
  const isEdge = ua.indexOf("edge") !== -1;
  const isGET = !("method" in opts) || opts.method === "GET";
  return (isIE || isTrident || isEdge) && isGET;
}
function HttpPouch(opts, callback) {
  const api = this;
  const host = getHost(opts.name, opts);
  const dbUrl = genDBUrl(host, "");
  opts = clone(opts);
  const ourFetch = async function(url, options) {
    options = options || {};
    options.headers = options.headers || new h();
    options.credentials = "include";
    if (opts.auth || host.auth) {
      const nAuth = opts.auth || host.auth;
      const str = nAuth.username + ":" + nAuth.password;
      const token = thisBtoa(unescape(encodeURIComponent(str)));
      options.headers.set("Authorization", "Basic " + token);
    }
    const headers = opts.headers || {};
    Object.keys(headers).forEach(function(key4) {
      options.headers.append(key4, headers[key4]);
    });
    if (shouldCacheBust(options)) {
      url += (url.indexOf("?") === -1 ? "?" : "&") + "_nonce=" + Date.now();
    }
    const fetchFun = opts.fetch || f2;
    return await fetchFun(url, options);
  };
  function adapterFun$$1(name, fun) {
    return adapterFun(name, function(...args) {
      setup2().then(function() {
        return fun.apply(this, args);
      }).catch(function(e2) {
        const callback2 = args.pop();
        callback2(e2);
      });
    }).bind(api);
  }
  async function fetchJSON(url, options) {
    const result = {};
    options = options || {};
    options.headers = options.headers || new h();
    if (!options.headers.get("Content-Type")) {
      options.headers.set("Content-Type", "application/json");
    }
    if (!options.headers.get("Accept")) {
      options.headers.set("Accept", "application/json");
    }
    const response = await ourFetch(url, options);
    result.ok = response.ok;
    result.status = response.status;
    const json = await response.json();
    result.data = json;
    if (!result.ok) {
      result.data.status = result.status;
      const err2 = generateErrorFromResponse(result.data);
      throw err2;
    }
    if (Array.isArray(result.data)) {
      result.data = result.data.map(function(v) {
        if (v.error || v.missing) {
          return generateErrorFromResponse(v);
        } else {
          return v;
        }
      });
    }
    return result;
  }
  let setupPromise;
  async function setup2() {
    if (opts.skip_setup) {
      return Promise.resolve();
    }
    if (setupPromise) {
      return setupPromise;
    }
    setupPromise = fetchJSON(dbUrl).catch(function(err2) {
      if (err2 && err2.status && err2.status === 404) {
        explainError(404, "PouchDB is just detecting if the remote exists.");
        return fetchJSON(dbUrl, { method: "PUT" });
      } else {
        return Promise.reject(err2);
      }
    }).catch(function(err2) {
      if (err2 && err2.status && err2.status === 412) {
        return true;
      }
      return Promise.reject(err2);
    });
    setupPromise.catch(function() {
      setupPromise = null;
    });
    return setupPromise;
  }
  nextTick(function() {
    callback(null, api);
  });
  api._remote = true;
  api.type = function() {
    return "http";
  };
  api.id = adapterFun$$1("id", async function(callback2) {
    let result;
    try {
      const response = await ourFetch(genUrl(host, ""));
      result = await response.json();
    } catch (err2) {
      result = {};
    }
    const uuid2 = result && result.uuid ? result.uuid + host.db : genDBUrl(host, "");
    callback2(null, uuid2);
  });
  api.compact = adapterFun$$1("compact", async function(opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    opts2 = clone(opts2);
    await fetchJSON(genDBUrl(host, "_compact"), { method: "POST" });
    function ping() {
      api.info(function(err2, res2) {
        if (res2 && !res2.compact_running) {
          callback2(null, { ok: true });
        } else {
          setTimeout(ping, opts2.interval || 200);
        }
      });
    }
    ping();
  });
  api.bulkGet = adapterFun("bulkGet", function(opts2, callback2) {
    const self3 = this;
    async function doBulkGet(cb) {
      const params = {};
      if (opts2.revs) {
        params.revs = true;
      }
      if (opts2.attachments) {
        params.attachments = true;
      }
      if (opts2.latest) {
        params.latest = true;
      }
      try {
        const result = await fetchJSON(genDBUrl(host, "_bulk_get" + paramsToStr(params)), {
          method: "POST",
          body: JSON.stringify({ docs: opts2.docs })
        });
        if (opts2.attachments && opts2.binary) {
          result.data.results.forEach(function(res2) {
            res2.docs.forEach(readAttachmentsAsBlobOrBuffer);
          });
        }
        cb(null, result.data);
      } catch (error2) {
        cb(error2);
      }
    }
    function doBulkGetShim() {
      const batchSize = MAX_SIMULTANEOUS_REVS;
      const numBatches = Math.ceil(opts2.docs.length / batchSize);
      let numDone = 0;
      const results = new Array(numBatches);
      function onResult(batchNum) {
        return function(err2, res2) {
          results[batchNum] = res2.results;
          if (++numDone === numBatches) {
            callback2(null, { results: results.flat() });
          }
        };
      }
      for (let i = 0; i < numBatches; i++) {
        const subOpts = pick(opts2, ["revs", "attachments", "binary", "latest"]);
        subOpts.docs = opts2.docs.slice(
          i * batchSize,
          Math.min(opts2.docs.length, (i + 1) * batchSize)
        );
        bulkGet(self3, subOpts, onResult(i));
      }
    }
    const dbUrl2 = genUrl(host, "");
    const supportsBulkGet = supportsBulkGetMap[dbUrl2];
    if (typeof supportsBulkGet !== "boolean") {
      doBulkGet(function(err2, res2) {
        if (err2) {
          supportsBulkGetMap[dbUrl2] = false;
          explainError(
            err2.status,
            "PouchDB is just detecting if the remote supports the _bulk_get API."
          );
          doBulkGetShim();
        } else {
          supportsBulkGetMap[dbUrl2] = true;
          callback2(null, res2);
        }
      });
    } else if (supportsBulkGet) {
      doBulkGet(callback2);
    } else {
      doBulkGetShim();
    }
  });
  api._info = async function(callback2) {
    try {
      await setup2();
      const response = await ourFetch(genDBUrl(host, ""));
      const info3 = await response.json();
      info3.host = genDBUrl(host, "");
      callback2(null, info3);
    } catch (err2) {
      callback2(err2);
    }
  };
  api.fetch = async function(path8, options) {
    await setup2();
    const url = path8.substring(0, 1) === "/" ? genUrl(host, path8.substring(1)) : genDBUrl(host, path8);
    return ourFetch(url, options);
  };
  api.get = adapterFun$$1("get", async function(id, opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    opts2 = clone(opts2);
    const params = {};
    if (opts2.revs) {
      params.revs = true;
    }
    if (opts2.revs_info) {
      params.revs_info = true;
    }
    if (opts2.latest) {
      params.latest = true;
    }
    if (opts2.open_revs) {
      if (opts2.open_revs !== "all") {
        opts2.open_revs = JSON.stringify(opts2.open_revs);
      }
      params.open_revs = opts2.open_revs;
    }
    if (opts2.rev) {
      params.rev = opts2.rev;
    }
    if (opts2.conflicts) {
      params.conflicts = opts2.conflicts;
    }
    if (opts2.update_seq) {
      params.update_seq = opts2.update_seq;
    }
    id = encodeDocId(id);
    function fetchAttachments(doc) {
      const atts = doc._attachments;
      const filenames = atts && Object.keys(atts);
      if (!atts || !filenames.length) {
        return;
      }
      async function fetchData(filename) {
        const att = atts[filename];
        const path8 = encodeDocId(doc._id) + "/" + encodeAttachmentId(filename) + "?rev=" + doc._rev;
        const response = await ourFetch(genDBUrl(host, path8));
        let blob;
        if ("buffer" in response) {
          blob = await response.buffer();
        } else {
          blob = await response.blob();
        }
        let data;
        if (opts2.binary) {
          const typeFieldDescriptor = Object.getOwnPropertyDescriptor(blob.__proto__, "type");
          if (!typeFieldDescriptor || typeFieldDescriptor.set) {
            blob.type = att.content_type;
          }
          data = blob;
        } else {
          data = await new Promise(function(resolve) {
            blobToBase64(blob, resolve);
          });
        }
        delete att.stub;
        delete att.length;
        att.data = data;
      }
      const promiseFactories = filenames.map(function(filename) {
        return function() {
          return fetchData(filename);
        };
      });
      return pool(promiseFactories, 5);
    }
    function fetchAllAttachments(docOrDocs) {
      if (Array.isArray(docOrDocs)) {
        return Promise.all(docOrDocs.map(function(doc) {
          if (doc.ok) {
            return fetchAttachments(doc.ok);
          }
        }));
      }
      return fetchAttachments(docOrDocs);
    }
    const url = genDBUrl(host, id + paramsToStr(params));
    try {
      const res2 = await fetchJSON(url);
      if (opts2.attachments) {
        await fetchAllAttachments(res2.data);
      }
      callback2(null, res2.data);
    } catch (error2) {
      error2.docId = id;
      callback2(error2);
    }
  });
  api.remove = adapterFun$$1("remove", async function(docOrId, optsOrRev, opts2, cb) {
    let doc;
    if (typeof optsOrRev === "string") {
      doc = {
        _id: docOrId,
        _rev: optsOrRev
      };
      if (typeof opts2 === "function") {
        cb = opts2;
        opts2 = {};
      }
    } else {
      doc = docOrId;
      if (typeof optsOrRev === "function") {
        cb = optsOrRev;
        opts2 = {};
      } else {
        cb = opts2;
        opts2 = optsOrRev;
      }
    }
    const rev3 = doc._rev || opts2.rev;
    const url = genDBUrl(host, encodeDocId(doc._id)) + "?rev=" + rev3;
    try {
      const result = await fetchJSON(url, { method: "DELETE" });
      cb(null, result.data);
    } catch (error2) {
      cb(error2);
    }
  });
  function encodeAttachmentId(attachmentId) {
    return attachmentId.split("/").map(encodeURIComponent).join("/");
  }
  api.getAttachment = adapterFun$$1("getAttachment", async function(docId, attachmentId, opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    const params = opts2.rev ? "?rev=" + opts2.rev : "";
    const url = genDBUrl(host, encodeDocId(docId)) + "/" + encodeAttachmentId(attachmentId) + params;
    let contentType;
    try {
      const response = await ourFetch(url, { method: "GET" });
      if (!response.ok) {
        throw response;
      }
      contentType = response.headers.get("content-type");
      let blob;
      if (typeof process !== "undefined" && !process.browser && typeof response.buffer === "function") {
        blob = await response.buffer();
      } else {
        blob = await response.blob();
      }
      if (typeof process !== "undefined" && !process.browser) {
        const typeFieldDescriptor = Object.getOwnPropertyDescriptor(blob.__proto__, "type");
        if (!typeFieldDescriptor || typeFieldDescriptor.set) {
          blob.type = contentType;
        }
      }
      callback2(null, blob);
    } catch (err2) {
      callback2(err2);
    }
  });
  api.removeAttachment = adapterFun$$1("removeAttachment", async function(docId, attachmentId, rev3, callback2) {
    const url = genDBUrl(host, encodeDocId(docId) + "/" + encodeAttachmentId(attachmentId)) + "?rev=" + rev3;
    try {
      const result = await fetchJSON(url, { method: "DELETE" });
      callback2(null, result.data);
    } catch (error2) {
      callback2(error2);
    }
  });
  api.putAttachment = adapterFun$$1("putAttachment", async function(docId, attachmentId, rev3, blob, type, callback2) {
    if (typeof type === "function") {
      callback2 = type;
      type = blob;
      blob = rev3;
      rev3 = null;
    }
    const id = encodeDocId(docId) + "/" + encodeAttachmentId(attachmentId);
    let url = genDBUrl(host, id);
    if (rev3) {
      url += "?rev=" + rev3;
    }
    if (typeof blob === "string") {
      let binary;
      try {
        binary = thisAtob(blob);
      } catch (err2) {
        return callback2(createError(
          BAD_ARG,
          "Attachment is not a valid base64 string"
        ));
      }
      blob = binary ? binStringToBluffer(binary, type) : "";
    }
    try {
      const result = await fetchJSON(url, {
        headers: new h({ "Content-Type": type }),
        method: "PUT",
        body: blob
      });
      callback2(null, result.data);
    } catch (error2) {
      callback2(error2);
    }
  });
  api._bulkDocs = async function(req, opts2, callback2) {
    req.new_edits = opts2.new_edits;
    try {
      await setup2();
      await Promise.all(req.docs.map(preprocessAttachments2));
      const result = await fetchJSON(genDBUrl(host, "_bulk_docs"), {
        method: "POST",
        body: JSON.stringify(req)
      });
      callback2(null, result.data);
    } catch (error2) {
      callback2(error2);
    }
  };
  api._put = async function(doc, opts2, callback2) {
    try {
      await setup2();
      await preprocessAttachments2(doc);
      const result = await fetchJSON(genDBUrl(host, encodeDocId(doc._id)), {
        method: "PUT",
        body: JSON.stringify(doc)
      });
      callback2(null, result.data);
    } catch (error2) {
      error2.docId = doc && doc._id;
      callback2(error2);
    }
  };
  api.allDocs = adapterFun$$1("allDocs", async function(opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    opts2 = clone(opts2);
    const params = {};
    let body;
    let method = "GET";
    if (opts2.conflicts) {
      params.conflicts = true;
    }
    if (opts2.update_seq) {
      params.update_seq = true;
    }
    if (opts2.descending) {
      params.descending = true;
    }
    if (opts2.include_docs) {
      params.include_docs = true;
    }
    if (opts2.attachments) {
      params.attachments = true;
    }
    if (opts2.key) {
      params.key = JSON.stringify(opts2.key);
    }
    if (opts2.start_key) {
      opts2.startkey = opts2.start_key;
    }
    if (opts2.startkey) {
      params.startkey = JSON.stringify(opts2.startkey);
    }
    if (opts2.end_key) {
      opts2.endkey = opts2.end_key;
    }
    if (opts2.endkey) {
      params.endkey = JSON.stringify(opts2.endkey);
    }
    if (typeof opts2.inclusive_end !== "undefined") {
      params.inclusive_end = !!opts2.inclusive_end;
    }
    if (typeof opts2.limit !== "undefined") {
      params.limit = opts2.limit;
    }
    if (typeof opts2.skip !== "undefined") {
      params.skip = opts2.skip;
    }
    const paramStr = paramsToStr(params);
    if (typeof opts2.keys !== "undefined") {
      method = "POST";
      body = { keys: opts2.keys };
    }
    try {
      const result = await fetchJSON(genDBUrl(host, "_all_docs" + paramStr), {
        method,
        body: JSON.stringify(body)
      });
      if (opts2.include_docs && opts2.attachments && opts2.binary) {
        result.data.rows.forEach(readAttachmentsAsBlobOrBuffer);
      }
      callback2(null, result.data);
    } catch (error2) {
      callback2(error2);
    }
  });
  api._changes = function(opts2) {
    const batchSize = "batch_size" in opts2 ? opts2.batch_size : CHANGES_BATCH_SIZE;
    opts2 = clone(opts2);
    if (opts2.continuous && !("heartbeat" in opts2)) {
      opts2.heartbeat = DEFAULT_HEARTBEAT;
    }
    let requestTimeout = "timeout" in opts2 ? opts2.timeout : 30 * 1e3;
    if ("timeout" in opts2 && opts2.timeout && requestTimeout - opts2.timeout < CHANGES_TIMEOUT_BUFFER) {
      requestTimeout = opts2.timeout + CHANGES_TIMEOUT_BUFFER;
    }
    if ("heartbeat" in opts2 && opts2.heartbeat && requestTimeout - opts2.heartbeat < CHANGES_TIMEOUT_BUFFER) {
      requestTimeout = opts2.heartbeat + CHANGES_TIMEOUT_BUFFER;
    }
    const params = {};
    if ("timeout" in opts2 && opts2.timeout) {
      params.timeout = opts2.timeout;
    }
    const limit = typeof opts2.limit !== "undefined" ? opts2.limit : false;
    let leftToFetch = limit;
    if (opts2.style) {
      params.style = opts2.style;
    }
    if (opts2.include_docs || opts2.filter && typeof opts2.filter === "function") {
      params.include_docs = true;
    }
    if (opts2.attachments) {
      params.attachments = true;
    }
    if (opts2.continuous) {
      params.feed = "longpoll";
    }
    if (opts2.seq_interval) {
      params.seq_interval = opts2.seq_interval;
    }
    if (opts2.conflicts) {
      params.conflicts = true;
    }
    if (opts2.descending) {
      params.descending = true;
    }
    if (opts2.update_seq) {
      params.update_seq = true;
    }
    if ("heartbeat" in opts2) {
      if (opts2.heartbeat) {
        params.heartbeat = opts2.heartbeat;
      }
    }
    if (opts2.filter && typeof opts2.filter === "string") {
      params.filter = opts2.filter;
    }
    if (opts2.view && typeof opts2.view === "string") {
      params.filter = "_view";
      params.view = opts2.view;
    }
    if (opts2.query_params && typeof opts2.query_params === "object") {
      for (const param_name in opts2.query_params) {
        if (Object.prototype.hasOwnProperty.call(opts2.query_params, param_name)) {
          params[param_name] = opts2.query_params[param_name];
        }
      }
    }
    let method = "GET";
    let body;
    if (opts2.doc_ids) {
      params.filter = "_doc_ids";
      method = "POST";
      body = { doc_ids: opts2.doc_ids };
    } else if (opts2.selector) {
      params.filter = "_selector";
      method = "POST";
      body = { selector: opts2.selector };
    }
    const controller = new AbortController();
    let lastFetchedSeq;
    const fetchData = async function(since, callback2) {
      if (opts2.aborted) {
        return;
      }
      params.since = since;
      if (typeof params.since === "object") {
        params.since = JSON.stringify(params.since);
      }
      if (opts2.descending) {
        if (limit) {
          params.limit = leftToFetch;
        }
      } else {
        params.limit = !limit || leftToFetch > batchSize ? batchSize : leftToFetch;
      }
      const url = genDBUrl(host, "_changes" + paramsToStr(params));
      const fetchOpts = {
        signal: controller.signal,
        method,
        body: JSON.stringify(body)
      };
      lastFetchedSeq = since;
      if (opts2.aborted) {
        return;
      }
      try {
        await setup2();
        const result = await fetchJSON(url, fetchOpts);
        callback2(null, result.data);
      } catch (error2) {
        callback2(error2);
      }
    };
    const results = { results: [] };
    const fetched = function(err2, res2) {
      if (opts2.aborted) {
        return;
      }
      let raw_results_length = 0;
      if (res2 && res2.results) {
        raw_results_length = res2.results.length;
        results.last_seq = res2.last_seq;
        let pending2 = null;
        let lastSeq = null;
        if (typeof res2.pending === "number") {
          pending2 = res2.pending;
        }
        if (typeof results.last_seq === "string" || typeof results.last_seq === "number") {
          lastSeq = results.last_seq;
        }
        const req = {};
        req.query = opts2.query_params;
        res2.results = res2.results.filter(function(c) {
          leftToFetch--;
          const ret = filterChange(opts2)(c);
          if (ret) {
            if (opts2.include_docs && opts2.attachments && opts2.binary) {
              readAttachmentsAsBlobOrBuffer(c);
            }
            if (opts2.return_docs) {
              results.results.push(c);
            }
            opts2.onChange(c, pending2, lastSeq);
          }
          return ret;
        });
      } else if (err2) {
        opts2.aborted = true;
        opts2.complete(err2);
        return;
      }
      if (res2 && res2.last_seq) {
        lastFetchedSeq = res2.last_seq;
      }
      const finished = limit && leftToFetch <= 0 || res2 && raw_results_length < batchSize || opts2.descending;
      if (opts2.continuous && !(limit && leftToFetch <= 0) || !finished) {
        nextTick(function() {
          fetchData(lastFetchedSeq, fetched);
        });
      } else {
        opts2.complete(null, results);
      }
    };
    fetchData(opts2.since || 0, fetched);
    return {
      cancel: function() {
        opts2.aborted = true;
        controller.abort();
      }
    };
  };
  api.revsDiff = adapterFun$$1("revsDiff", async function(req, opts2, callback2) {
    if (typeof opts2 === "function") {
      callback2 = opts2;
      opts2 = {};
    }
    try {
      const result = await fetchJSON(genDBUrl(host, "_revs_diff"), {
        method: "POST",
        body: JSON.stringify(req)
      });
      callback2(null, result.data);
    } catch (error2) {
      callback2(error2);
    }
  });
  api._close = function(callback2) {
    callback2();
  };
  api._destroy = async function(options, callback2) {
    try {
      const json = await fetchJSON(genDBUrl(host, ""), { method: "DELETE" });
      callback2(null, json);
    } catch (error2) {
      if (error2.status === 404) {
        callback2(null, { ok: true });
      } else {
        callback2(error2);
      }
    }
  };
}
function index3(PouchDB3) {
  PouchDB3.adapter("http", HttpPouch, false);
  PouchDB3.adapter("https", HttpPouch, false);
}
var CHANGES_BATCH_SIZE, MAX_SIMULTANEOUS_REVS, CHANGES_TIMEOUT_BUFFER, DEFAULT_HEARTBEAT, supportsBulkGetMap, index_es_default4;
var init_index_es10 = __esm({
  "node_modules/pouchdb-adapter-http/lib/index.es.js"() {
    init_index_browser_es4();
    init_index_es();
    init_index_browser_es3();
    init_index_browser_es();
    CHANGES_BATCH_SIZE = 25;
    MAX_SIMULTANEOUS_REVS = 50;
    CHANGES_TIMEOUT_BUFFER = 5e3;
    DEFAULT_HEARTBEAT = 1e4;
    supportsBulkGetMap = {};
    HttpPouch.valid = function() {
      return true;
    };
    index_es_default4 = index3;
  }
});

// node_modules/pouchdb-mapreduce-utils/lib/index.es.js
function promisedCallback(promise, callback) {
  if (callback) {
    promise.then(function(res2) {
      nextTick(function() {
        callback(null, res2);
      });
    }, function(reason) {
      nextTick(function() {
        callback(reason);
      });
    });
  }
  return promise;
}
function callbackify(fun) {
  return function(...args) {
    var cb = args.pop();
    var promise = fun.apply(this, args);
    if (typeof cb === "function") {
      promisedCallback(promise, cb);
    }
    return promise;
  };
}
function fin(promise, finalPromiseFactory) {
  return promise.then(function(res2) {
    return finalPromiseFactory().then(function() {
      return res2;
    });
  }, function(reason) {
    return finalPromiseFactory().then(function() {
      throw reason;
    });
  });
}
function sequentialize(queue2, promiseFactory) {
  return function() {
    var args = arguments;
    var that = this;
    return queue2.add(function() {
      return promiseFactory.apply(that, args);
    });
  };
}
function uniq(arr) {
  var theSet = new Set(arr);
  var result = new Array(theSet.size);
  var index6 = -1;
  theSet.forEach(function(value2) {
    result[++index6] = value2;
  });
  return result;
}
function mapToKeysArray(map2) {
  var result = new Array(map2.size);
  var index6 = -1;
  map2.forEach(function(value2, key4) {
    result[++index6] = key4;
  });
  return result;
}
var QueryParseError, NotFoundError, BuiltInError;
var init_index_es11 = __esm({
  "node_modules/pouchdb-mapreduce-utils/lib/index.es.js"() {
    init_index_browser_es3();
    QueryParseError = class _QueryParseError extends Error {
      constructor(message) {
        super();
        this.status = 400;
        this.name = "query_parse_error";
        this.message = message;
        this.error = true;
        try {
          Error.captureStackTrace(this, _QueryParseError);
        } catch (e2) {
        }
      }
    };
    NotFoundError = class _NotFoundError extends Error {
      constructor(message) {
        super();
        this.status = 404;
        this.name = "not_found";
        this.message = message;
        this.error = true;
        try {
          Error.captureStackTrace(this, _NotFoundError);
        } catch (e2) {
        }
      }
    };
    BuiltInError = class _BuiltInError extends Error {
      constructor(message) {
        super();
        this.status = 500;
        this.name = "invalid_value";
        this.message = message;
        this.error = true;
        try {
          Error.captureStackTrace(this, _BuiltInError);
        } catch (e2) {
        }
      }
    };
  }
});

// node_modules/pouchdb-abstract-mapreduce/lib/index.es.js
function stringify2(input) {
  if (!input) {
    return "undefined";
  }
  switch (typeof input) {
    case "function":
      return input.toString();
    case "string":
      return input.toString();
    default:
      return JSON.stringify(input);
  }
}
function createViewSignature(mapFun, reduceFun) {
  return stringify2(mapFun) + stringify2(reduceFun) + "undefined";
}
async function createView(sourceDB, viewName, mapFun, reduceFun, temporary, localDocName2) {
  const viewSignature = createViewSignature(mapFun, reduceFun);
  let cachedViews;
  if (!temporary) {
    cachedViews = sourceDB._cachedViews = sourceDB._cachedViews || {};
    if (cachedViews[viewSignature]) {
      return cachedViews[viewSignature];
    }
  }
  const promiseForView = sourceDB.info().then(async function(info3) {
    const depDbName = info3.db_name + "-mrview-" + (temporary ? "temp" : stringMd5(viewSignature));
    function diffFunction(doc) {
      doc.views = doc.views || {};
      let fullViewName = viewName;
      if (fullViewName.indexOf("/") === -1) {
        fullViewName = viewName + "/" + viewName;
      }
      const depDbs = doc.views[fullViewName] = doc.views[fullViewName] || {};
      if (depDbs[depDbName]) {
        return;
      }
      depDbs[depDbName] = true;
      return doc;
    }
    await upsert(sourceDB, "_local/" + localDocName2, diffFunction);
    const res2 = await sourceDB.registerDependentDatabase(depDbName);
    const db = res2.db;
    db.auto_compaction = true;
    const view = {
      name: depDbName,
      db,
      sourceDB,
      adapter: sourceDB.adapter,
      mapFun,
      reduceFun
    };
    let lastSeqDoc;
    try {
      lastSeqDoc = await view.db.get("_local/lastSeq");
    } catch (err2) {
      if (err2.status !== 404) {
        throw err2;
      }
    }
    view.seq = lastSeqDoc ? lastSeqDoc.seq : 0;
    if (cachedViews) {
      view.db.once("destroyed", function() {
        delete cachedViews[viewSignature];
      });
    }
    return view;
  });
  if (cachedViews) {
    cachedViews[viewSignature] = promiseForView;
  }
  return promiseForView;
}
function parseViewName(name) {
  return name.indexOf("/") === -1 ? [name, name] : name.split("/");
}
function isGenOne(changes3) {
  return changes3.length === 1 && /^1-/.test(changes3[0].rev);
}
function emitError(db, e2, data) {
  try {
    db.emit("error", e2);
  } catch (err2) {
    guardedConsole(
      "error",
      "The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."
    );
    guardedConsole("error", e2, data);
  }
}
function createAbstractMapReduce(localDocName2, mapper3, reducer3, ddocValidator3) {
  function tryMap(db, fun, doc) {
    try {
      fun(doc);
    } catch (e2) {
      emitError(db, e2, { fun, doc });
    }
  }
  function tryReduce(db, fun, keys2, values, rereduce) {
    try {
      return { output: fun(keys2, values, rereduce) };
    } catch (e2) {
      emitError(db, e2, { fun, keys: keys2, values, rereduce });
      return { error: e2 };
    }
  }
  function sortByKeyThenValue(x, y) {
    const keyCompare = collate(x.key, y.key);
    return keyCompare !== 0 ? keyCompare : collate(x.value, y.value);
  }
  function sliceResults(results, limit, skip) {
    skip = skip || 0;
    if (typeof limit === "number") {
      return results.slice(skip, limit + skip);
    } else if (skip > 0) {
      return results.slice(skip);
    }
    return results;
  }
  function rowToDocId(row) {
    const val = row.value;
    const docId = val && typeof val === "object" && val._id || row.id;
    return docId;
  }
  function readAttachmentsAsBlobOrBuffer2(res2) {
    for (const row of res2.rows) {
      const atts = row.doc && row.doc._attachments;
      if (!atts) {
        continue;
      }
      for (const filename of Object.keys(atts)) {
        const att = atts[filename];
        atts[filename].data = b64ToBluffer(att.data, att.content_type);
      }
    }
  }
  function postprocessAttachments(opts) {
    return function(res2) {
      if (opts.include_docs && opts.attachments && opts.binary) {
        readAttachmentsAsBlobOrBuffer2(res2);
      }
      return res2;
    };
  }
  function addHttpParam(paramName, opts, params, asJson) {
    let val = opts[paramName];
    if (typeof val !== "undefined") {
      if (asJson) {
        val = encodeURIComponent(JSON.stringify(val));
      }
      params.push(paramName + "=" + val);
    }
  }
  function coerceInteger(integerCandidate) {
    if (typeof integerCandidate !== "undefined") {
      const asNumber = Number(integerCandidate);
      if (!isNaN(asNumber) && asNumber === parseInt(integerCandidate, 10)) {
        return asNumber;
      } else {
        return integerCandidate;
      }
    }
  }
  function coerceOptions(opts) {
    opts.group_level = coerceInteger(opts.group_level);
    opts.limit = coerceInteger(opts.limit);
    opts.skip = coerceInteger(opts.skip);
    return opts;
  }
  function checkPositiveInteger(number) {
    if (number) {
      if (typeof number !== "number") {
        return new QueryParseError(`Invalid value for integer: "${number}"`);
      }
      if (number < 0) {
        return new QueryParseError(`Invalid value for positive integer: "${number}"`);
      }
    }
  }
  function checkQueryParseError(options, fun) {
    const startkeyName = options.descending ? "endkey" : "startkey";
    const endkeyName = options.descending ? "startkey" : "endkey";
    if (typeof options[startkeyName] !== "undefined" && typeof options[endkeyName] !== "undefined" && collate(options[startkeyName], options[endkeyName]) > 0) {
      throw new QueryParseError("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");
    } else if (fun.reduce && options.reduce !== false) {
      if (options.include_docs) {
        throw new QueryParseError("{include_docs:true} is invalid for reduce");
      } else if (options.keys && options.keys.length > 1 && !options.group && !options.group_level) {
        throw new QueryParseError("Multi-key fetches for reduce views must use {group: true}");
      }
    }
    for (const optionName of ["group_level", "limit", "skip"]) {
      const error2 = checkPositiveInteger(options[optionName]);
      if (error2) {
        throw error2;
      }
    }
  }
  async function httpQuery(db, fun, opts) {
    let params = [];
    let body;
    let method = "GET";
    let ok;
    addHttpParam("reduce", opts, params);
    addHttpParam("include_docs", opts, params);
    addHttpParam("attachments", opts, params);
    addHttpParam("limit", opts, params);
    addHttpParam("descending", opts, params);
    addHttpParam("group", opts, params);
    addHttpParam("group_level", opts, params);
    addHttpParam("skip", opts, params);
    addHttpParam("stale", opts, params);
    addHttpParam("conflicts", opts, params);
    addHttpParam("startkey", opts, params, true);
    addHttpParam("start_key", opts, params, true);
    addHttpParam("endkey", opts, params, true);
    addHttpParam("end_key", opts, params, true);
    addHttpParam("inclusive_end", opts, params);
    addHttpParam("key", opts, params, true);
    addHttpParam("update_seq", opts, params);
    params = params.join("&");
    params = params === "" ? "" : "?" + params;
    if (typeof opts.keys !== "undefined") {
      const MAX_URL_LENGTH = 2e3;
      const keysAsString = `keys=${encodeURIComponent(JSON.stringify(opts.keys))}`;
      if (keysAsString.length + params.length + 1 <= MAX_URL_LENGTH) {
        params += (params[0] === "?" ? "&" : "?") + keysAsString;
      } else {
        method = "POST";
        if (typeof fun === "string") {
          body = { keys: opts.keys };
        } else {
          fun.keys = opts.keys;
        }
      }
    }
    if (typeof fun === "string") {
      const parts = parseViewName(fun);
      const response2 = await db.fetch("_design/" + parts[0] + "/_view/" + parts[1] + params, {
        headers: new h({ "Content-Type": "application/json" }),
        method,
        body: JSON.stringify(body)
      });
      ok = response2.ok;
      const result2 = await response2.json();
      if (!ok) {
        result2.status = response2.status;
        throw generateErrorFromResponse(result2);
      }
      for (const row of result2.rows) {
        if (row.value && row.value.error && row.value.error === "builtin_reduce_error") {
          throw new Error(row.reason);
        }
      }
      return new Promise(function(resolve) {
        resolve(result2);
      }).then(postprocessAttachments(opts));
    }
    body = body || {};
    for (const key4 of Object.keys(fun)) {
      if (Array.isArray(fun[key4])) {
        body[key4] = fun[key4];
      } else {
        body[key4] = fun[key4].toString();
      }
    }
    const response = await db.fetch("_temp_view" + params, {
      headers: new h({ "Content-Type": "application/json" }),
      method: "POST",
      body: JSON.stringify(body)
    });
    ok = response.ok;
    const result = await response.json();
    if (!ok) {
      result.status = response.status;
      throw generateErrorFromResponse(result);
    }
    return new Promise(function(resolve) {
      resolve(result);
    }).then(postprocessAttachments(opts));
  }
  function customQuery(db, fun, opts) {
    return new Promise(function(resolve, reject) {
      db._query(fun, opts, function(err2, res2) {
        if (err2) {
          return reject(err2);
        }
        resolve(res2);
      });
    });
  }
  function customViewCleanup(db) {
    return new Promise(function(resolve, reject) {
      db._viewCleanup(function(err2, res2) {
        if (err2) {
          return reject(err2);
        }
        resolve(res2);
      });
    });
  }
  function defaultsTo(value2) {
    return function(reason) {
      if (reason.status === 404) {
        return value2;
      } else {
        throw reason;
      }
    };
  }
  async function getDocsToPersist(docId, view, docIdsToChangesAndEmits) {
    const metaDocId = "_local/doc_" + docId;
    const defaultMetaDoc = { _id: metaDocId, keys: [] };
    const docData = docIdsToChangesAndEmits.get(docId);
    const indexableKeysToKeyValues = docData[0];
    const changes3 = docData[1];
    function getMetaDoc() {
      if (isGenOne(changes3)) {
        return Promise.resolve(defaultMetaDoc);
      }
      return view.db.get(metaDocId).catch(defaultsTo(defaultMetaDoc));
    }
    function getKeyValueDocs(metaDoc2) {
      if (!metaDoc2.keys.length) {
        return Promise.resolve({ rows: [] });
      }
      return view.db.allDocs({
        keys: metaDoc2.keys,
        include_docs: true
      });
    }
    function processKeyValueDocs(metaDoc2, kvDocsRes) {
      const kvDocs = [];
      const oldKeys = /* @__PURE__ */ new Set();
      for (const row of kvDocsRes.rows) {
        const doc = row.doc;
        if (!doc) {
          continue;
        }
        kvDocs.push(doc);
        oldKeys.add(doc._id);
        doc._deleted = !indexableKeysToKeyValues.has(doc._id);
        if (!doc._deleted) {
          const keyValue = indexableKeysToKeyValues.get(doc._id);
          if ("value" in keyValue) {
            doc.value = keyValue.value;
          }
        }
      }
      const newKeys = mapToKeysArray(indexableKeysToKeyValues);
      for (const key4 of newKeys) {
        if (!oldKeys.has(key4)) {
          const kvDoc = {
            _id: key4
          };
          const keyValue = indexableKeysToKeyValues.get(key4);
          if ("value" in keyValue) {
            kvDoc.value = keyValue.value;
          }
          kvDocs.push(kvDoc);
        }
      }
      metaDoc2.keys = uniq(newKeys.concat(metaDoc2.keys));
      kvDocs.push(metaDoc2);
      return kvDocs;
    }
    const metaDoc = await getMetaDoc();
    const keyValueDocs = await getKeyValueDocs(metaDoc);
    return processKeyValueDocs(metaDoc, keyValueDocs);
  }
  function updatePurgeSeq(view) {
    return view.sourceDB.get("_local/purges").then(function(res2) {
      const purgeSeq = res2.purgeSeq;
      return view.db.get("_local/purgeSeq").then(function(res3) {
        return res3._rev;
      }).catch(defaultsTo(void 0)).then(function(rev3) {
        return view.db.put({
          _id: "_local/purgeSeq",
          _rev: rev3,
          purgeSeq
        });
      });
    }).catch(function(err2) {
      if (err2.status !== 404) {
        throw err2;
      }
    });
  }
  function saveKeyValues(view, docIdsToChangesAndEmits, seq) {
    var seqDocId = "_local/lastSeq";
    return view.db.get(seqDocId).catch(defaultsTo({ _id: seqDocId, seq: 0 })).then(function(lastSeqDoc) {
      var docIds = mapToKeysArray(docIdsToChangesAndEmits);
      return Promise.all(docIds.map(function(docId) {
        return getDocsToPersist(docId, view, docIdsToChangesAndEmits);
      })).then(function(listOfDocsToPersist) {
        var docsToPersist = listOfDocsToPersist.flat();
        lastSeqDoc.seq = seq;
        docsToPersist.push(lastSeqDoc);
        return view.db.bulkDocs({ docs: docsToPersist });
      }).then(() => updatePurgeSeq(view));
    });
  }
  function getQueue(view) {
    const viewName = typeof view === "string" ? view : view.name;
    let queue2 = persistentQueues[viewName];
    if (!queue2) {
      queue2 = persistentQueues[viewName] = new TaskQueue2();
    }
    return queue2;
  }
  async function updateView(view, opts) {
    return sequentialize(getQueue(view), function() {
      return updateViewInQueue(view, opts);
    })();
  }
  async function updateViewInQueue(view, opts) {
    let mapResults;
    let doc;
    let taskId;
    function emit(key4, value2) {
      const output = { id: doc._id, key: normalizeKey(key4) };
      if (typeof value2 !== "undefined" && value2 !== null) {
        output.value = normalizeKey(value2);
      }
      mapResults.push(output);
    }
    const mapFun = mapper3(view.mapFun, emit);
    let currentSeq = view.seq || 0;
    function createTask() {
      return view.sourceDB.info().then(function(info3) {
        taskId = view.sourceDB.activeTasks.add({
          name: "view_indexing",
          total_items: info3.update_seq - currentSeq
        });
      });
    }
    function processChange2(docIdsToChangesAndEmits, seq) {
      return function() {
        return saveKeyValues(view, docIdsToChangesAndEmits, seq);
      };
    }
    let indexed_docs = 0;
    const progress = {
      view: view.name,
      indexed_docs
    };
    view.sourceDB.emit("indexing", progress);
    const queue2 = new TaskQueue2();
    async function processNextBatch() {
      const response = await view.sourceDB.changes({
        return_docs: true,
        conflicts: true,
        include_docs: true,
        style: "all_docs",
        since: currentSeq,
        limit: opts.changes_batch_size
      });
      const purges = await getRecentPurges();
      return processBatch(response, purges);
    }
    function getRecentPurges() {
      return view.db.get("_local/purgeSeq").then(function(res2) {
        return res2.purgeSeq;
      }).catch(defaultsTo(-1)).then(function(purgeSeq) {
        return view.sourceDB.get("_local/purges").then(function(res2) {
          const recentPurges = res2.purges.filter(function(purge2, index6) {
            return index6 > purgeSeq;
          }).map((purge2) => purge2.docId);
          const uniquePurges = recentPurges.filter(function(docId, index6) {
            return recentPurges.indexOf(docId) === index6;
          });
          return Promise.all(uniquePurges.map(function(docId) {
            return view.sourceDB.get(docId).then(function(doc2) {
              return { docId, doc: doc2 };
            }).catch(defaultsTo({ docId }));
          }));
        }).catch(defaultsTo([]));
      });
    }
    function processBatch(response, purges) {
      const results = response.results;
      if (!results.length && !purges.length) {
        return;
      }
      for (const purge2 of purges) {
        const index6 = results.findIndex(function(change) {
          return change.id === purge2.docId;
        });
        if (index6 < 0) {
          const entry = {
            _id: purge2.docId,
            doc: {
              _id: purge2.docId,
              _deleted: 1
            },
            changes: []
          };
          if (purge2.doc) {
            entry.doc = purge2.doc;
            entry.changes.push({ rev: purge2.doc._rev });
          }
          results.push(entry);
        }
      }
      const docIdsToChangesAndEmits = createDocIdsToChangesAndEmits(results);
      queue2.add(processChange2(docIdsToChangesAndEmits, currentSeq));
      indexed_docs = indexed_docs + results.length;
      const progress2 = {
        view: view.name,
        last_seq: response.last_seq,
        results_count: results.length,
        indexed_docs
      };
      view.sourceDB.emit("indexing", progress2);
      view.sourceDB.activeTasks.update(taskId, { completed_items: indexed_docs });
      if (results.length < opts.changes_batch_size) {
        return;
      }
      return processNextBatch();
    }
    function createDocIdsToChangesAndEmits(results) {
      const docIdsToChangesAndEmits = /* @__PURE__ */ new Map();
      for (const change of results) {
        if (change.doc._id[0] !== "_") {
          mapResults = [];
          doc = change.doc;
          if (!doc._deleted) {
            tryMap(view.sourceDB, mapFun, doc);
          }
          mapResults.sort(sortByKeyThenValue);
          const indexableKeysToKeyValues = createIndexableKeysToKeyValues(mapResults);
          docIdsToChangesAndEmits.set(change.doc._id, [
            indexableKeysToKeyValues,
            change.changes
          ]);
        }
        currentSeq = change.seq;
      }
      return docIdsToChangesAndEmits;
    }
    function createIndexableKeysToKeyValues(mapResults2) {
      const indexableKeysToKeyValues = /* @__PURE__ */ new Map();
      let lastKey;
      for (let i = 0, len = mapResults2.length; i < len; i++) {
        const emittedKeyValue = mapResults2[i];
        const complexKey = [emittedKeyValue.key, emittedKeyValue.id];
        if (i > 0 && collate(emittedKeyValue.key, lastKey) === 0) {
          complexKey.push(i);
        }
        indexableKeysToKeyValues.set(toIndexableString(complexKey), emittedKeyValue);
        lastKey = emittedKeyValue.key;
      }
      return indexableKeysToKeyValues;
    }
    try {
      await createTask();
      await processNextBatch();
      await queue2.finish();
      view.seq = currentSeq;
      view.sourceDB.activeTasks.remove(taskId);
    } catch (error2) {
      view.sourceDB.activeTasks.remove(taskId, error2);
    }
  }
  function reduceView(view, results, options) {
    if (options.group_level === 0) {
      delete options.group_level;
    }
    const shouldGroup = options.group || options.group_level;
    const reduceFun = reducer3(view.reduceFun);
    const groups = [];
    const lvl = isNaN(options.group_level) ? Number.POSITIVE_INFINITY : options.group_level;
    for (const result of results) {
      const last = groups[groups.length - 1];
      let groupKey = shouldGroup ? result.key : null;
      if (shouldGroup && Array.isArray(groupKey)) {
        groupKey = groupKey.slice(0, lvl);
      }
      if (last && collate(last.groupKey, groupKey) === 0) {
        last.keys.push([result.key, result.id]);
        last.values.push(result.value);
        continue;
      }
      groups.push({
        keys: [[result.key, result.id]],
        values: [result.value],
        groupKey
      });
    }
    results = [];
    for (const group of groups) {
      const reduceTry = tryReduce(view.sourceDB, reduceFun, group.keys, group.values, false);
      if (reduceTry.error && reduceTry.error instanceof BuiltInError) {
        throw reduceTry.error;
      }
      results.push({
        // CouchDB just sets the value to null if a non-built-in errors out
        value: reduceTry.error ? null : reduceTry.output,
        key: group.groupKey
      });
    }
    return { rows: sliceResults(results, options.limit, options.skip) };
  }
  function queryView(view, opts) {
    return sequentialize(getQueue(view), function() {
      return queryViewInQueue(view, opts);
    })();
  }
  async function queryViewInQueue(view, opts) {
    let totalRows;
    const shouldReduce = view.reduceFun && opts.reduce !== false;
    const skip = opts.skip || 0;
    if (typeof opts.keys !== "undefined" && !opts.keys.length) {
      opts.limit = 0;
      delete opts.keys;
    }
    async function fetchFromView(viewOpts) {
      viewOpts.include_docs = true;
      const res2 = await view.db.allDocs(viewOpts);
      totalRows = res2.total_rows;
      return res2.rows.map(function(result) {
        if ("value" in result.doc && typeof result.doc.value === "object" && result.doc.value !== null) {
          const keys2 = Object.keys(result.doc.value).sort();
          const expectedKeys = ["id", "key", "value"];
          if (!(keys2 < expectedKeys || keys2 > expectedKeys)) {
            return result.doc.value;
          }
        }
        const parsedKeyAndDocId = parseIndexableString(result.doc._id);
        return {
          key: parsedKeyAndDocId[0],
          id: parsedKeyAndDocId[1],
          value: "value" in result.doc ? result.doc.value : null
        };
      });
    }
    async function onMapResultsReady(rows) {
      let finalResults;
      if (shouldReduce) {
        finalResults = reduceView(view, rows, opts);
      } else if (typeof opts.keys === "undefined") {
        finalResults = {
          total_rows: totalRows,
          offset: skip,
          rows
        };
      } else {
        finalResults = {
          total_rows: totalRows,
          offset: skip,
          rows: sliceResults(rows, opts.limit, opts.skip)
        };
      }
      if (opts.update_seq) {
        finalResults.update_seq = view.seq;
      }
      if (opts.include_docs) {
        const docIds = uniq(rows.map(rowToDocId));
        const allDocsRes = await view.sourceDB.allDocs({
          keys: docIds,
          include_docs: true,
          conflicts: opts.conflicts,
          attachments: opts.attachments,
          binary: opts.binary
        });
        const docIdsToDocs = /* @__PURE__ */ new Map();
        for (const row of allDocsRes.rows) {
          docIdsToDocs.set(row.id, row.doc);
        }
        for (const row of rows) {
          const docId = rowToDocId(row);
          const doc = docIdsToDocs.get(docId);
          if (doc) {
            row.doc = doc;
          }
        }
      }
      return finalResults;
    }
    if (typeof opts.keys !== "undefined") {
      const keys2 = opts.keys;
      const fetchPromises = keys2.map(function(key4) {
        const viewOpts = {
          startkey: toIndexableString([key4]),
          endkey: toIndexableString([key4, {}])
        };
        if (opts.update_seq) {
          viewOpts.update_seq = true;
        }
        return fetchFromView(viewOpts);
      });
      const result = await Promise.all(fetchPromises);
      const flattenedResult = result.flat();
      return onMapResultsReady(flattenedResult);
    } else {
      const viewOpts = {
        descending: opts.descending
      };
      if (opts.update_seq) {
        viewOpts.update_seq = true;
      }
      let startkey;
      let endkey;
      if ("start_key" in opts) {
        startkey = opts.start_key;
      }
      if ("startkey" in opts) {
        startkey = opts.startkey;
      }
      if ("end_key" in opts) {
        endkey = opts.end_key;
      }
      if ("endkey" in opts) {
        endkey = opts.endkey;
      }
      if (typeof startkey !== "undefined") {
        viewOpts.startkey = opts.descending ? toIndexableString([startkey, {}]) : toIndexableString([startkey]);
      }
      if (typeof endkey !== "undefined") {
        let inclusiveEnd = opts.inclusive_end !== false;
        if (opts.descending) {
          inclusiveEnd = !inclusiveEnd;
        }
        viewOpts.endkey = toIndexableString(
          inclusiveEnd ? [endkey, {}] : [endkey]
        );
      }
      if (typeof opts.key !== "undefined") {
        const keyStart = toIndexableString([opts.key]);
        const keyEnd = toIndexableString([opts.key, {}]);
        if (viewOpts.descending) {
          viewOpts.endkey = keyStart;
          viewOpts.startkey = keyEnd;
        } else {
          viewOpts.startkey = keyStart;
          viewOpts.endkey = keyEnd;
        }
      }
      if (!shouldReduce) {
        if (typeof opts.limit === "number") {
          viewOpts.limit = opts.limit;
        }
        viewOpts.skip = skip;
      }
      const result = await fetchFromView(viewOpts);
      return onMapResultsReady(result);
    }
  }
  async function httpViewCleanup(db) {
    const response = await db.fetch("_view_cleanup", {
      headers: new h({ "Content-Type": "application/json" }),
      method: "POST"
    });
    return response.json();
  }
  async function localViewCleanup(db) {
    try {
      const metaDoc = await db.get("_local/" + localDocName2);
      const docsToViews = /* @__PURE__ */ new Map();
      for (const fullViewName of Object.keys(metaDoc.views)) {
        const parts = parseViewName(fullViewName);
        const designDocName = "_design/" + parts[0];
        const viewName = parts[1];
        let views = docsToViews.get(designDocName);
        if (!views) {
          views = /* @__PURE__ */ new Set();
          docsToViews.set(designDocName, views);
        }
        views.add(viewName);
      }
      const opts = {
        keys: mapToKeysArray(docsToViews),
        include_docs: true
      };
      const res2 = await db.allDocs(opts);
      const viewsToStatus = {};
      for (const row of res2.rows) {
        const ddocName = row.key.substring(8);
        for (const viewName of docsToViews.get(row.key)) {
          let fullViewName = ddocName + "/" + viewName;
          if (!metaDoc.views[fullViewName]) {
            fullViewName = viewName;
          }
          const viewDBNames = Object.keys(metaDoc.views[fullViewName]);
          const statusIsGood = row.doc && row.doc.views && row.doc.views[viewName];
          for (const viewDBName of viewDBNames) {
            viewsToStatus[viewDBName] = viewsToStatus[viewDBName] || statusIsGood;
          }
        }
      }
      const dbsToDelete = Object.keys(viewsToStatus).filter(function(viewDBName) {
        return !viewsToStatus[viewDBName];
      });
      const destroyPromises = dbsToDelete.map(function(viewDBName) {
        return sequentialize(getQueue(viewDBName), function() {
          return new db.constructor(viewDBName, db.__opts).destroy();
        })();
      });
      return Promise.all(destroyPromises).then(function() {
        return { ok: true };
      });
    } catch (err2) {
      if (err2.status === 404) {
        return { ok: true };
      } else {
        throw err2;
      }
    }
  }
  async function queryPromised(db, fun, opts) {
    if (typeof db._query === "function") {
      return customQuery(db, fun, opts);
    }
    if (isRemote(db)) {
      return httpQuery(db, fun, opts);
    }
    const updateViewOpts = {
      changes_batch_size: db.__opts.view_update_changes_batch_size || CHANGES_BATCH_SIZE2
    };
    if (typeof fun !== "string") {
      checkQueryParseError(opts, fun);
      tempViewQueue.add(async function() {
        const view = await createView(
          /* sourceDB */
          db,
          /* viewName */
          "temp_view/temp_view",
          /* mapFun */
          fun.map,
          /* reduceFun */
          fun.reduce,
          /* temporary */
          true,
          /* localDocName */
          localDocName2
        );
        return fin(
          updateView(view, updateViewOpts).then(
            function() {
              return queryView(view, opts);
            }
          ),
          function() {
            return view.db.destroy();
          }
        );
      });
      return tempViewQueue.finish();
    } else {
      const fullViewName = fun;
      const parts = parseViewName(fullViewName);
      const designDocName = parts[0];
      const viewName = parts[1];
      const doc = await db.get("_design/" + designDocName);
      fun = doc.views && doc.views[viewName];
      if (!fun) {
        throw new NotFoundError(`ddoc ${doc._id} has no view named ${viewName}`);
      }
      ddocValidator3(doc, viewName);
      checkQueryParseError(opts, fun);
      const view = await createView(
        /* sourceDB */
        db,
        /* viewName */
        fullViewName,
        /* mapFun */
        fun.map,
        /* reduceFun */
        fun.reduce,
        /* temporary */
        false,
        /* localDocName */
        localDocName2
      );
      if (opts.stale === "ok" || opts.stale === "update_after") {
        if (opts.stale === "update_after") {
          nextTick(function() {
            updateView(view, updateViewOpts);
          });
        }
        return queryView(view, opts);
      } else {
        await updateView(view, updateViewOpts);
        return queryView(view, opts);
      }
    }
  }
  function abstractQuery(fun, opts, callback) {
    const db = this;
    if (typeof opts === "function") {
      callback = opts;
      opts = {};
    }
    opts = opts ? coerceOptions(opts) : {};
    if (typeof fun === "function") {
      fun = { map: fun };
    }
    const promise = Promise.resolve().then(function() {
      return queryPromised(db, fun, opts);
    });
    promisedCallback(promise, callback);
    return promise;
  }
  const abstractViewCleanup = callbackify(function() {
    const db = this;
    if (typeof db._viewCleanup === "function") {
      return customViewCleanup(db);
    }
    if (isRemote(db)) {
      return httpViewCleanup(db);
    }
    return localViewCleanup(db);
  });
  return {
    query: abstractQuery,
    viewCleanup: abstractViewCleanup
  };
}
var TaskQueue2, persistentQueues, tempViewQueue, CHANGES_BATCH_SIZE2, index_es_default5;
var init_index_es12 = __esm({
  "node_modules/pouchdb-abstract-mapreduce/lib/index.es.js"() {
    init_index_browser_es();
    init_index_es3();
    init_index_es();
    init_index_browser_es4();
    init_index_browser_es3();
    init_index_browser_es2();
    init_index_es11();
    TaskQueue2 = class {
      constructor() {
        this.promise = Promise.resolve();
      }
      add(promiseFactory) {
        this.promise = this.promise.catch(() => {
        }).then(() => promiseFactory());
        return this.promise;
      }
      finish() {
        return this.promise;
      }
    };
    persistentQueues = {};
    tempViewQueue = new TaskQueue2();
    CHANGES_BATCH_SIZE2 = 50;
    index_es_default5 = createAbstractMapReduce;
  }
});

// node_modules/pouchdb-mapreduce/lib/index-browser.es.js
function createBuiltInError(name) {
  var message = "builtin " + name + " function requires map values to be numbers or number arrays";
  return new BuiltInError(message);
}
function sum(values) {
  var result = 0;
  for (var i = 0, len = values.length; i < len; i++) {
    var num = values[i];
    if (typeof num !== "number") {
      if (Array.isArray(num)) {
        result = typeof result === "number" ? [result] : result;
        for (var j = 0, jLen = num.length; j < jLen; j++) {
          var jNum = num[j];
          if (typeof jNum !== "number") {
            throw createBuiltInError("_sum");
          } else if (typeof result[j] === "undefined") {
            result.push(jNum);
          } else {
            result[j] += jNum;
          }
        }
      } else {
        throw createBuiltInError("_sum");
      }
    } else if (typeof result === "number") {
      result += num;
    } else {
      result[0] += num;
    }
  }
  return result;
}
function evalFunctionWithEval(func, emit) {
  return scopeEval(
    "return (" + func.replace(/;\s*$/, "") + ");",
    {
      emit,
      sum,
      log,
      isArray,
      toJSON
    }
  );
}
function getBuiltIn(reduceFunString) {
  if (/^_sum/.test(reduceFunString)) {
    return builtInReduce._sum;
  } else if (/^_count/.test(reduceFunString)) {
    return builtInReduce._count;
  } else if (/^_stats/.test(reduceFunString)) {
    return builtInReduce._stats;
  } else if (/^_/.test(reduceFunString)) {
    throw new Error(reduceFunString + " is not a supported reduce function.");
  }
}
function mapper(mapFun, emit) {
  if (typeof mapFun === "function" && mapFun.length === 2) {
    var origMap = mapFun;
    return function(doc) {
      return origMap(doc, emit);
    };
  } else {
    return evalFunctionWithEval(mapFun.toString(), emit);
  }
}
function reducer(reduceFun) {
  var reduceFunString = reduceFun.toString();
  var builtIn = getBuiltIn(reduceFunString);
  if (builtIn) {
    return builtIn;
  } else {
    return evalFunctionWithEval(reduceFunString);
  }
}
function ddocValidator(ddoc, viewName) {
  var fun = ddoc.views && ddoc.views[viewName];
  if (typeof fun.map !== "string") {
    throw new NotFoundError("ddoc " + ddoc._id + " has no string view named " + viewName + ", instead found object of type: " + typeof fun.map);
  }
}
function query2(fun, opts, callback) {
  return abstract.query.call(this, fun, opts, callback);
}
function viewCleanup2(callback) {
  return abstract.viewCleanup.call(this, callback);
}
var log, isArray, toJSON, builtInReduce, localDocName, abstract, index4, index_browser_es_default2;
var init_index_browser_es6 = __esm({
  "node_modules/pouchdb-mapreduce/lib/index-browser.es.js"() {
    init_index_browser_es3();
    init_index_es11();
    init_index_es12();
    log = guardedConsole.bind(null, "log");
    isArray = Array.isArray;
    toJSON = JSON.parse;
    builtInReduce = {
      _sum: function(keys2, values) {
        return sum(values);
      },
      _count: function(keys2, values) {
        return values.length;
      },
      _stats: function(keys2, values) {
        function sumsqr(values2) {
          var _sumsqr = 0;
          for (var i = 0, len = values2.length; i < len; i++) {
            var num = values2[i];
            _sumsqr += num * num;
          }
          return _sumsqr;
        }
        return {
          sum: sum(values),
          min: Math.min.apply(null, values),
          max: Math.max.apply(null, values),
          count: values.length,
          sumsqr: sumsqr(values)
        };
      }
    };
    localDocName = "mrviews";
    abstract = index_es_default5(localDocName, mapper, reducer, ddocValidator);
    index4 = {
      query: query2,
      viewCleanup: viewCleanup2
    };
    index_browser_es_default2 = index4;
  }
});

// node_modules/pouchdb-checkpointer/lib/index.es.js
function updateCheckpoint(db, id, checkpoint, session, returnValue) {
  return db.get(id).catch(function(err2) {
    if (err2.status === 404) {
      if (db.adapter === "http" || db.adapter === "https") {
        explainError(
          404,
          "PouchDB is just checking if a remote checkpoint exists."
        );
      }
      return {
        session_id: session,
        _id: id,
        history: [],
        replicator: REPLICATOR,
        version: CHECKPOINT_VERSION
      };
    }
    throw err2;
  }).then(function(doc) {
    if (returnValue.cancelled) {
      return;
    }
    if (doc.last_seq === checkpoint) {
      return;
    }
    doc.history = (doc.history || []).filter(function(item) {
      return item.session_id !== session;
    });
    doc.history.unshift({
      last_seq: checkpoint,
      session_id: session
    });
    doc.history = doc.history.slice(0, CHECKPOINT_HISTORY_SIZE);
    doc.version = CHECKPOINT_VERSION;
    doc.replicator = REPLICATOR;
    doc.session_id = session;
    doc.last_seq = checkpoint;
    return db.put(doc).catch(function(err2) {
      if (err2.status === 409) {
        return updateCheckpoint(db, id, checkpoint, session, returnValue);
      }
      throw err2;
    });
  });
}
function compareReplicationLogs(srcDoc, tgtDoc) {
  if (srcDoc.session_id === tgtDoc.session_id) {
    return {
      last_seq: srcDoc.last_seq,
      history: srcDoc.history
    };
  }
  return compareReplicationHistory(srcDoc.history, tgtDoc.history);
}
function compareReplicationHistory(sourceHistory, targetHistory) {
  var S = sourceHistory[0];
  var sourceRest = sourceHistory.slice(1);
  var T = targetHistory[0];
  var targetRest = targetHistory.slice(1);
  if (!S || targetHistory.length === 0) {
    return {
      last_seq: LOWEST_SEQ,
      history: []
    };
  }
  var sourceId = S.session_id;
  if (hasSessionId(sourceId, targetHistory)) {
    return {
      last_seq: S.last_seq,
      history: sourceHistory
    };
  }
  var targetId = T.session_id;
  if (hasSessionId(targetId, sourceRest)) {
    return {
      last_seq: T.last_seq,
      history: targetRest
    };
  }
  return compareReplicationHistory(sourceRest, targetRest);
}
function hasSessionId(sessionId, history) {
  var props = history[0];
  var rest = history.slice(1);
  if (!sessionId || history.length === 0) {
    return false;
  }
  if (sessionId === props.session_id) {
    return true;
  }
  return hasSessionId(sessionId, rest);
}
function isForbiddenError(err2) {
  return typeof err2.status === "number" && Math.floor(err2.status / 100) === 4;
}
function Checkpointer(src, target, id, returnValue, opts) {
  if (!(this instanceof CheckpointerInternal)) {
    return new CheckpointerInternal(src, target, id, returnValue, opts);
  }
  return Checkpointer;
}
var CHECKPOINT_VERSION, REPLICATOR, CHECKPOINT_HISTORY_SIZE, LOWEST_SEQ, CheckpointerInternal, comparisons, index_es_default6;
var init_index_es13 = __esm({
  "node_modules/pouchdb-checkpointer/lib/index.es.js"() {
    init_index_browser_es3();
    init_index_es3();
    CHECKPOINT_VERSION = 1;
    REPLICATOR = "pouchdb";
    CHECKPOINT_HISTORY_SIZE = 5;
    LOWEST_SEQ = 0;
    CheckpointerInternal = class {
      constructor(src, target, id, returnValue, opts = {
        writeSourceCheckpoint: true,
        writeTargetCheckpoint: true
      }) {
        this.src = src;
        this.target = target;
        this.id = id;
        this.returnValue = returnValue;
        this.opts = opts;
        if (typeof opts.writeSourceCheckpoint === "undefined") {
          opts.writeSourceCheckpoint = true;
        }
        if (typeof opts.writeTargetCheckpoint === "undefined") {
          opts.writeTargetCheckpoint = true;
        }
      }
      writeCheckpoint(checkpoint, session) {
        var self3 = this;
        return this.updateTarget(checkpoint, session).then(function() {
          return self3.updateSource(checkpoint, session);
        });
      }
      updateTarget(checkpoint, session) {
        if (this.opts.writeTargetCheckpoint) {
          return updateCheckpoint(
            this.target,
            this.id,
            checkpoint,
            session,
            this.returnValue
          );
        } else {
          return Promise.resolve(true);
        }
      }
      updateSource(checkpoint, session) {
        if (this.opts.writeSourceCheckpoint) {
          var self3 = this;
          return updateCheckpoint(
            this.src,
            this.id,
            checkpoint,
            session,
            this.returnValue
          ).catch(function(err2) {
            if (isForbiddenError(err2)) {
              self3.opts.writeSourceCheckpoint = false;
              return true;
            }
            throw err2;
          });
        } else {
          return Promise.resolve(true);
        }
      }
      getCheckpoint() {
        var self3 = this;
        if (!self3.opts.writeSourceCheckpoint && !self3.opts.writeTargetCheckpoint) {
          return Promise.resolve(LOWEST_SEQ);
        }
        if (self3.opts && self3.opts.writeSourceCheckpoint && !self3.opts.writeTargetCheckpoint) {
          return self3.src.get(self3.id).then(function(sourceDoc) {
            return sourceDoc.last_seq || LOWEST_SEQ;
          }).catch(function(err2) {
            if (err2.status !== 404) {
              throw err2;
            }
            return LOWEST_SEQ;
          });
        }
        return self3.target.get(self3.id).then(function(targetDoc) {
          if (self3.opts && self3.opts.writeTargetCheckpoint && !self3.opts.writeSourceCheckpoint) {
            return targetDoc.last_seq || LOWEST_SEQ;
          }
          return self3.src.get(self3.id).then(function(sourceDoc) {
            if (targetDoc.version !== sourceDoc.version) {
              return LOWEST_SEQ;
            }
            var version2;
            if (targetDoc.version) {
              version2 = targetDoc.version.toString();
            } else {
              version2 = "undefined";
            }
            if (version2 in comparisons) {
              return comparisons[version2](targetDoc, sourceDoc);
            }
            return LOWEST_SEQ;
          }, function(err2) {
            if (err2.status === 404 && targetDoc.last_seq) {
              return self3.src.put({
                _id: self3.id,
                last_seq: LOWEST_SEQ
              }).then(function() {
                return LOWEST_SEQ;
              }, function(err3) {
                if (isForbiddenError(err3)) {
                  self3.opts.writeSourceCheckpoint = false;
                  return targetDoc.last_seq;
                }
                return LOWEST_SEQ;
              });
            }
            throw err2;
          });
        }).catch(function(err2) {
          if (err2.status !== 404) {
            throw err2;
          }
          return LOWEST_SEQ;
        });
      }
    };
    comparisons = {
      "undefined": function(targetDoc, sourceDoc) {
        if (collate(targetDoc.last_seq, sourceDoc.last_seq) === 0) {
          return sourceDoc.last_seq;
        }
        return 0;
      },
      "1": function(targetDoc, sourceDoc) {
        return compareReplicationLogs(sourceDoc, targetDoc).last_seq;
      }
    };
    index_es_default6 = Checkpointer;
  }
});

// node_modules/pouchdb-generate-replication-id/lib/index.es.js
function sortObjectPropertiesByKey(queryParams) {
  return Object.keys(queryParams).sort(collate).reduce(function(result, key4) {
    result[key4] = queryParams[key4];
    return result;
  }, {});
}
function generateReplicationId(src, target, opts) {
  var docIds = opts.doc_ids ? opts.doc_ids.sort(collate) : "";
  var filterFun = opts.filter ? opts.filter.toString() : "";
  var queryParams = "";
  var filterViewName = "";
  var selector = "";
  if (opts.selector) {
    selector = JSON.stringify(opts.selector);
  }
  if (opts.filter && opts.query_params) {
    queryParams = JSON.stringify(sortObjectPropertiesByKey(opts.query_params));
  }
  if (opts.filter && opts.filter === "_view") {
    filterViewName = opts.view.toString();
  }
  return Promise.all([src.id(), target.id()]).then(function(res2) {
    var queryData = res2[0] + res2[1] + filterFun + filterViewName + queryParams + docIds + selector;
    return new Promise(function(resolve) {
      binaryMd5(queryData, resolve);
    });
  }).then(function(md5sum) {
    md5sum = md5sum.replace(/\//g, ".").replace(/\+/g, "_");
    return "_local/" + md5sum;
  });
}
var index_es_default7;
var init_index_es14 = __esm({
  "node_modules/pouchdb-generate-replication-id/lib/index.es.js"() {
    init_index_browser_es2();
    init_index_es3();
    index_es_default7 = generateReplicationId;
  }
});

// node_modules/pouchdb-replication/lib/index.es.js
function fileHasChanged(localDoc, remoteDoc, filename) {
  return !localDoc._attachments || !localDoc._attachments[filename] || localDoc._attachments[filename].digest !== remoteDoc._attachments[filename].digest;
}
function getDocAttachments(db, doc) {
  var filenames = Object.keys(doc._attachments);
  return Promise.all(filenames.map(function(filename) {
    return db.getAttachment(doc._id, filename, { rev: doc._rev });
  }));
}
function getDocAttachmentsFromTargetOrSource(target, src, doc) {
  var doCheckForLocalAttachments = isRemote(src) && !isRemote(target);
  var filenames = Object.keys(doc._attachments);
  if (!doCheckForLocalAttachments) {
    return getDocAttachments(src, doc);
  }
  return target.get(doc._id).then(function(localDoc) {
    return Promise.all(filenames.map(function(filename) {
      if (fileHasChanged(localDoc, doc, filename)) {
        return src.getAttachment(doc._id, filename);
      }
      return target.getAttachment(localDoc._id, filename);
    }));
  }).catch(function(error2) {
    if (error2.status !== 404) {
      throw error2;
    }
    return getDocAttachments(src, doc);
  });
}
function createBulkGetOpts(diffs) {
  var requests = [];
  Object.keys(diffs).forEach(function(id) {
    var missingRevs = diffs[id].missing;
    missingRevs.forEach(function(missingRev) {
      requests.push({
        id,
        rev: missingRev
      });
    });
  });
  return {
    docs: requests,
    revs: true,
    latest: true
  };
}
function getDocs(src, target, diffs, state2) {
  diffs = clone(diffs);
  var resultDocs = [], ok = true;
  function getAllDocs() {
    var bulkGetOpts = createBulkGetOpts(diffs);
    if (!bulkGetOpts.docs.length) {
      return;
    }
    return src.bulkGet(bulkGetOpts).then(function(bulkGetResponse) {
      if (state2.cancelled) {
        throw new Error("cancelled");
      }
      return Promise.all(bulkGetResponse.results.map(function(bulkGetInfo) {
        return Promise.all(bulkGetInfo.docs.map(function(doc) {
          var remoteDoc = doc.ok;
          if (doc.error) {
            ok = false;
          }
          if (!remoteDoc || !remoteDoc._attachments) {
            return remoteDoc;
          }
          return getDocAttachmentsFromTargetOrSource(target, src, remoteDoc).then((attachments) => {
            var filenames = Object.keys(remoteDoc._attachments);
            attachments.forEach(function(attachment, i) {
              var att = remoteDoc._attachments[filenames[i]];
              delete att.stub;
              delete att.length;
              att.data = attachment;
            });
            return remoteDoc;
          });
        }));
      })).then(function(results) {
        resultDocs = resultDocs.concat(results.flat().filter(Boolean));
      });
    });
  }
  function returnResult() {
    return { ok, docs: resultDocs };
  }
  return Promise.resolve().then(getAllDocs).then(returnResult);
}
function backOff(opts, returnValue, error2, callback) {
  if (opts.retry === false) {
    returnValue.emit("error", error2);
    returnValue.removeAllListeners();
    return;
  }
  if (typeof opts.back_off_function !== "function") {
    opts.back_off_function = defaultBackOff;
  }
  returnValue.emit("requestError", error2);
  if (returnValue.state === "active" || returnValue.state === "pending") {
    returnValue.emit("paused", error2);
    returnValue.state = "stopped";
    var backOffSet = function backoffTimeSet() {
      opts.current_back_off = STARTING_BACK_OFF;
    };
    var removeBackOffSetter = function removeBackOffTimeSet() {
      returnValue.removeListener("active", backOffSet);
    };
    returnValue.once("paused", removeBackOffSetter);
    returnValue.once("active", backOffSet);
  }
  opts.current_back_off = opts.current_back_off || STARTING_BACK_OFF;
  opts.current_back_off = opts.back_off_function(opts.current_back_off);
  setTimeout(callback, opts.current_back_off);
}
function replicate(src, target, opts, returnValue, result) {
  var batches2 = [];
  var currentBatch;
  var pendingBatch = {
    seq: 0,
    changes: [],
    docs: []
  };
  var writingCheckpoint = false;
  var changesCompleted = false;
  var replicationCompleted = false;
  var initial_last_seq = 0;
  var last_seq = 0;
  var continuous = opts.continuous || opts.live || false;
  var batch_size = opts.batch_size || 100;
  var batches_limit = opts.batches_limit || 10;
  var style = opts.style || "all_docs";
  var changesPending = false;
  var doc_ids = opts.doc_ids;
  var selector = opts.selector;
  var repId;
  var checkpointer;
  var changedDocs = [];
  var session = uuid();
  var taskId;
  result = result || {
    ok: true,
    start_time: (/* @__PURE__ */ new Date()).toISOString(),
    docs_read: 0,
    docs_written: 0,
    doc_write_failures: 0,
    errors: []
  };
  var changesOpts = {};
  returnValue.ready(src, target);
  function initCheckpointer() {
    if (checkpointer) {
      return Promise.resolve();
    }
    return index_es_default7(src, target, opts).then(function(res2) {
      repId = res2;
      var checkpointOpts = {};
      if (opts.checkpoint === false) {
        checkpointOpts = { writeSourceCheckpoint: false, writeTargetCheckpoint: false };
      } else if (opts.checkpoint === "source") {
        checkpointOpts = { writeSourceCheckpoint: true, writeTargetCheckpoint: false };
      } else if (opts.checkpoint === "target") {
        checkpointOpts = { writeSourceCheckpoint: false, writeTargetCheckpoint: true };
      } else {
        checkpointOpts = { writeSourceCheckpoint: true, writeTargetCheckpoint: true };
      }
      checkpointer = new index_es_default6(src, target, repId, returnValue, checkpointOpts);
    });
  }
  function writeDocs() {
    changedDocs = [];
    if (currentBatch.docs.length === 0) {
      return;
    }
    var docs = currentBatch.docs;
    var bulkOpts = { timeout: opts.timeout };
    return target.bulkDocs({ docs, new_edits: false }, bulkOpts).then(function(res2) {
      if (returnValue.cancelled) {
        completeReplication();
        throw new Error("cancelled");
      }
      var errorsById = /* @__PURE__ */ Object.create(null);
      res2.forEach(function(res3) {
        if (res3.error) {
          errorsById[res3.id] = res3;
        }
      });
      var errorsNo = Object.keys(errorsById).length;
      result.doc_write_failures += errorsNo;
      result.docs_written += docs.length - errorsNo;
      docs.forEach(function(doc) {
        var error2 = errorsById[doc._id];
        if (error2) {
          result.errors.push(error2);
          var errorName = (error2.name || "").toLowerCase();
          if (errorName === "unauthorized" || errorName === "forbidden") {
            returnValue.emit("denied", clone(error2));
          } else {
            throw error2;
          }
        } else {
          changedDocs.push(doc);
        }
      });
    }, function(err2) {
      result.doc_write_failures += docs.length;
      throw err2;
    });
  }
  function finishBatch() {
    if (currentBatch.error) {
      throw new Error("There was a problem getting docs.");
    }
    result.last_seq = last_seq = currentBatch.seq;
    var outResult = clone(result);
    if (changedDocs.length) {
      outResult.docs = changedDocs;
      if (typeof currentBatch.pending === "number") {
        outResult.pending = currentBatch.pending;
        delete currentBatch.pending;
      }
      returnValue.emit("change", outResult);
    }
    writingCheckpoint = true;
    src.info().then(function(info3) {
      var task = src.activeTasks.get(taskId);
      if (!currentBatch || !task) {
        return;
      }
      var completed = task.completed_items || 0;
      var total_items = parseInt(info3.update_seq, 10) - parseInt(initial_last_seq, 10);
      src.activeTasks.update(taskId, {
        completed_items: completed + currentBatch.changes.length,
        total_items
      });
    });
    return checkpointer.writeCheckpoint(
      currentBatch.seq,
      session
    ).then(function() {
      returnValue.emit("checkpoint", { "checkpoint": currentBatch.seq });
      writingCheckpoint = false;
      if (returnValue.cancelled) {
        completeReplication();
        throw new Error("cancelled");
      }
      currentBatch = void 0;
      getChanges();
    }).catch(function(err2) {
      onCheckpointError(err2);
      throw err2;
    });
  }
  function getDiffs() {
    var diff = {};
    currentBatch.changes.forEach(function(change) {
      returnValue.emit("checkpoint", { "revs_diff": change });
      if (change.id === "_user/") {
        return;
      }
      diff[change.id] = change.changes.map(function(x) {
        return x.rev;
      });
    });
    return target.revsDiff(diff).then(function(diffs) {
      if (returnValue.cancelled) {
        completeReplication();
        throw new Error("cancelled");
      }
      currentBatch.diffs = diffs;
    });
  }
  function getBatchDocs() {
    return getDocs(src, target, currentBatch.diffs, returnValue).then(function(got) {
      currentBatch.error = !got.ok;
      got.docs.forEach(function(doc) {
        delete currentBatch.diffs[doc._id];
        result.docs_read++;
        currentBatch.docs.push(doc);
      });
    });
  }
  function startNextBatch() {
    if (returnValue.cancelled || currentBatch) {
      return;
    }
    if (batches2.length === 0) {
      processPendingBatch(true);
      return;
    }
    currentBatch = batches2.shift();
    returnValue.emit("checkpoint", { "start_next_batch": currentBatch.seq });
    getDiffs().then(getBatchDocs).then(writeDocs).then(finishBatch).then(startNextBatch).catch(function(err2) {
      abortReplication("batch processing terminated with error", err2);
    });
  }
  function processPendingBatch(immediate) {
    if (pendingBatch.changes.length === 0) {
      if (batches2.length === 0 && !currentBatch) {
        if (continuous && changesOpts.live || changesCompleted) {
          returnValue.state = "pending";
          returnValue.emit("paused");
        }
        if (changesCompleted) {
          completeReplication();
        }
      }
      return;
    }
    if (immediate || changesCompleted || pendingBatch.changes.length >= batch_size) {
      batches2.push(pendingBatch);
      pendingBatch = {
        seq: 0,
        changes: [],
        docs: []
      };
      if (returnValue.state === "pending" || returnValue.state === "stopped") {
        returnValue.state = "active";
        returnValue.emit("active");
      }
      startNextBatch();
    }
  }
  function abortReplication(reason, err2) {
    if (replicationCompleted) {
      return;
    }
    if (!err2.message) {
      err2.message = reason;
    }
    result.ok = false;
    result.status = "aborting";
    batches2 = [];
    pendingBatch = {
      seq: 0,
      changes: [],
      docs: []
    };
    completeReplication(err2);
  }
  function completeReplication(fatalError) {
    if (replicationCompleted) {
      return;
    }
    if (returnValue.cancelled) {
      result.status = "cancelled";
      if (writingCheckpoint) {
        return;
      }
    }
    result.status = result.status || "complete";
    result.end_time = (/* @__PURE__ */ new Date()).toISOString();
    result.last_seq = last_seq;
    replicationCompleted = true;
    src.activeTasks.remove(taskId, fatalError);
    if (fatalError) {
      fatalError = createError(fatalError);
      fatalError.result = result;
      var errorName = (fatalError.name || "").toLowerCase();
      if (errorName === "unauthorized" || errorName === "forbidden") {
        returnValue.emit("error", fatalError);
        returnValue.removeAllListeners();
      } else {
        backOff(opts, returnValue, fatalError, function() {
          replicate(src, target, opts, returnValue);
        });
      }
    } else {
      returnValue.emit("complete", result);
      returnValue.removeAllListeners();
    }
  }
  function onChange(change, pending2, lastSeq) {
    if (returnValue.cancelled) {
      return completeReplication();
    }
    if (typeof pending2 === "number") {
      pendingBatch.pending = pending2;
    }
    var filter3 = filterChange(opts)(change);
    if (!filter3) {
      var task = src.activeTasks.get(taskId);
      if (task) {
        var completed = task.completed_items || 0;
        src.activeTasks.update(taskId, { completed_items: ++completed });
      }
      return;
    }
    pendingBatch.seq = change.seq || lastSeq;
    pendingBatch.changes.push(change);
    returnValue.emit("checkpoint", { "pending_batch": pendingBatch.seq });
    nextTick(function() {
      processPendingBatch(batches2.length === 0 && changesOpts.live);
    });
  }
  function onChangesComplete(changes3) {
    changesPending = false;
    if (returnValue.cancelled) {
      return completeReplication();
    }
    if (changes3.results.length > 0) {
      changesOpts.since = changes3.results[changes3.results.length - 1].seq;
      getChanges();
      processPendingBatch(true);
    } else {
      var complete = function() {
        if (continuous) {
          changesOpts.live = true;
          getChanges();
        } else {
          changesCompleted = true;
        }
        processPendingBatch(true);
      };
      if (!currentBatch && changes3.results.length === 0) {
        writingCheckpoint = true;
        checkpointer.writeCheckpoint(
          changes3.last_seq,
          session
        ).then(function() {
          writingCheckpoint = false;
          result.last_seq = last_seq = changes3.last_seq;
          if (returnValue.cancelled) {
            completeReplication();
            throw new Error("cancelled");
          } else {
            complete();
          }
        }).catch(onCheckpointError);
      } else {
        complete();
      }
    }
  }
  function onChangesError(err2) {
    changesPending = false;
    if (returnValue.cancelled) {
      return completeReplication();
    }
    abortReplication("changes rejected", err2);
  }
  function getChanges() {
    if (!(!changesPending && !changesCompleted && batches2.length < batches_limit)) {
      return;
    }
    changesPending = true;
    function abortChanges() {
      changes3.cancel();
    }
    function removeListener() {
      returnValue.removeListener("cancel", abortChanges);
    }
    if (returnValue._changes) {
      returnValue.removeListener("cancel", returnValue._abortChanges);
      returnValue._changes.cancel();
    }
    returnValue.once("cancel", abortChanges);
    var changes3 = src.changes(changesOpts).on("change", onChange);
    changes3.then(removeListener, removeListener);
    changes3.then(onChangesComplete).catch(onChangesError);
    if (opts.retry) {
      returnValue._changes = changes3;
      returnValue._abortChanges = abortChanges;
    }
  }
  function createTask(checkpoint) {
    return src.info().then(function(info3) {
      var total_items = typeof opts.since === "undefined" ? parseInt(info3.update_seq, 10) - parseInt(checkpoint, 10) : parseInt(info3.update_seq, 10);
      taskId = src.activeTasks.add({
        name: `${continuous ? "continuous " : ""}replication from ${info3.db_name}`,
        total_items
      });
      return checkpoint;
    });
  }
  function startChanges() {
    initCheckpointer().then(function() {
      if (returnValue.cancelled) {
        completeReplication();
        return;
      }
      return checkpointer.getCheckpoint().then(createTask).then(function(checkpoint) {
        last_seq = checkpoint;
        initial_last_seq = checkpoint;
        changesOpts = {
          since: last_seq,
          limit: batch_size,
          batch_size,
          style,
          doc_ids,
          selector,
          return_docs: true
          // required so we know when we're done
        };
        if (opts.filter) {
          if (typeof opts.filter !== "string") {
            changesOpts.include_docs = true;
          } else {
            changesOpts.filter = opts.filter;
          }
        }
        if ("heartbeat" in opts) {
          changesOpts.heartbeat = opts.heartbeat;
        }
        if ("timeout" in opts) {
          changesOpts.timeout = opts.timeout;
        }
        if (opts.query_params) {
          changesOpts.query_params = opts.query_params;
        }
        if (opts.view) {
          changesOpts.view = opts.view;
        }
        getChanges();
      });
    }).catch(function(err2) {
      abortReplication("getCheckpoint rejected with ", err2);
    });
  }
  function onCheckpointError(err2) {
    writingCheckpoint = false;
    abortReplication("writeCheckpoint completed with error", err2);
  }
  if (returnValue.cancelled) {
    completeReplication();
    return;
  }
  if (!returnValue._addedListeners) {
    returnValue.once("cancel", completeReplication);
    if (typeof opts.complete === "function") {
      returnValue.once("error", opts.complete);
      returnValue.once("complete", function(result2) {
        opts.complete(null, result2);
      });
    }
    returnValue._addedListeners = true;
  }
  if (typeof opts.since === "undefined") {
    startChanges();
  } else {
    initCheckpointer().then(function() {
      writingCheckpoint = true;
      return checkpointer.writeCheckpoint(opts.since, session);
    }).then(function() {
      writingCheckpoint = false;
      if (returnValue.cancelled) {
        completeReplication();
        return;
      }
      last_seq = opts.since;
      startChanges();
    }).catch(onCheckpointError);
  }
}
function toPouch(db, opts) {
  var PouchConstructor = opts.PouchConstructor;
  if (typeof db === "string") {
    return new PouchConstructor(db, opts);
  } else {
    return db;
  }
}
function replicateWrapper(src, target, opts, callback) {
  if (typeof opts === "function") {
    callback = opts;
    opts = {};
  }
  if (typeof opts === "undefined") {
    opts = {};
  }
  if (opts.doc_ids && !Array.isArray(opts.doc_ids)) {
    throw createError(
      BAD_REQUEST,
      "`doc_ids` filter parameter is not a list."
    );
  }
  opts.complete = callback;
  opts = clone(opts);
  opts.continuous = opts.continuous || opts.live;
  opts.retry = "retry" in opts ? opts.retry : false;
  opts.PouchConstructor = opts.PouchConstructor || this;
  var replicateRet = new Replication(opts);
  var srcPouch = toPouch(src, opts);
  var targetPouch = toPouch(target, opts);
  replicate(srcPouch, targetPouch, opts, replicateRet);
  return replicateRet;
}
function sync(src, target, opts, callback) {
  if (typeof opts === "function") {
    callback = opts;
    opts = {};
  }
  if (typeof opts === "undefined") {
    opts = {};
  }
  opts = clone(opts);
  opts.PouchConstructor = opts.PouchConstructor || this;
  src = toPouch(src, opts);
  target = toPouch(target, opts);
  return new Sync(src, target, opts, callback);
}
function replication(PouchDB3) {
  PouchDB3.replicate = replicateWrapper;
  PouchDB3.sync = sync;
  Object.defineProperty(PouchDB3.prototype, "replicate", {
    get: function() {
      var self3 = this;
      if (typeof this.replicateMethods === "undefined") {
        this.replicateMethods = {
          from: function(other, opts, callback) {
            return self3.constructor.replicate(other, self3, opts, callback);
          },
          to: function(other, opts, callback) {
            return self3.constructor.replicate(self3, other, opts, callback);
          }
        };
      }
      return this.replicateMethods;
    }
  });
  PouchDB3.prototype.sync = function(dbName, opts, callback) {
    return this.constructor.sync(this, dbName, opts, callback);
  };
}
var import_events4, STARTING_BACK_OFF, Replication, Sync, index_es_default8;
var init_index_es15 = __esm({
  "node_modules/pouchdb-replication/lib/index.es.js"() {
    init_index_es13();
    init_index_es14();
    init_index_es();
    import_events4 = __toESM2(require_events());
    init_index_browser_es3();
    STARTING_BACK_OFF = 0;
    Replication = class extends import_events4.default {
      constructor() {
        super();
        this.cancelled = false;
        this.state = "pending";
        const promise = new Promise((fulfill, reject) => {
          this.once("complete", fulfill);
          this.once("error", reject);
        });
        this.then = function(resolve, reject) {
          return promise.then(resolve, reject);
        };
        this.catch = function(reject) {
          return promise.catch(reject);
        };
        this.catch(function() {
        });
      }
      cancel() {
        this.cancelled = true;
        this.state = "cancelled";
        this.emit("cancel");
      }
      ready(src, target) {
        if (this._readyCalled) {
          return;
        }
        this._readyCalled = true;
        const onDestroy2 = () => {
          this.cancel();
        };
        src.once("destroyed", onDestroy2);
        target.once("destroyed", onDestroy2);
        function cleanup() {
          src.removeListener("destroyed", onDestroy2);
          target.removeListener("destroyed", onDestroy2);
        }
        this.once("complete", cleanup);
        this.once("error", cleanup);
      }
    };
    Sync = class extends import_events4.default {
      constructor(src, target, opts, callback) {
        super();
        this.canceled = false;
        const optsPush = opts.push ? Object.assign({}, opts, opts.push) : opts;
        const optsPull = opts.pull ? Object.assign({}, opts, opts.pull) : opts;
        this.push = replicateWrapper(src, target, optsPush);
        this.pull = replicateWrapper(target, src, optsPull);
        this.pushPaused = true;
        this.pullPaused = true;
        const pullChange = (change) => {
          this.emit("change", {
            direction: "pull",
            change
          });
        };
        const pushChange = (change) => {
          this.emit("change", {
            direction: "push",
            change
          });
        };
        const pushDenied = (doc) => {
          this.emit("denied", {
            direction: "push",
            doc
          });
        };
        const pullDenied = (doc) => {
          this.emit("denied", {
            direction: "pull",
            doc
          });
        };
        const pushPaused = () => {
          this.pushPaused = true;
          if (this.pullPaused) {
            this.emit("paused");
          }
        };
        const pullPaused = () => {
          this.pullPaused = true;
          if (this.pushPaused) {
            this.emit("paused");
          }
        };
        const pushActive = () => {
          this.pushPaused = false;
          if (this.pullPaused) {
            this.emit("active", {
              direction: "push"
            });
          }
        };
        const pullActive = () => {
          this.pullPaused = false;
          if (this.pushPaused) {
            this.emit("active", {
              direction: "pull"
            });
          }
        };
        let removed = {};
        const removeAll = (type) => {
          return (event2, func) => {
            const isChange = event2 === "change" && (func === pullChange || func === pushChange);
            const isDenied = event2 === "denied" && (func === pullDenied || func === pushDenied);
            const isPaused = event2 === "paused" && (func === pullPaused || func === pushPaused);
            const isActive = event2 === "active" && (func === pullActive || func === pushActive);
            if (isChange || isDenied || isPaused || isActive) {
              if (!(event2 in removed)) {
                removed[event2] = {};
              }
              removed[event2][type] = true;
              if (Object.keys(removed[event2]).length === 2) {
                this.removeAllListeners(event2);
              }
            }
          };
        };
        if (opts.live) {
          this.push.on("complete", this.pull.cancel.bind(this.pull));
          this.pull.on("complete", this.push.cancel.bind(this.push));
        }
        function addOneListener(ee, event2, listener) {
          if (ee.listeners(event2).indexOf(listener) == -1) {
            ee.on(event2, listener);
          }
        }
        this.on("newListener", function(event2) {
          if (event2 === "change") {
            addOneListener(this.pull, "change", pullChange);
            addOneListener(this.push, "change", pushChange);
          } else if (event2 === "denied") {
            addOneListener(this.pull, "denied", pullDenied);
            addOneListener(this.push, "denied", pushDenied);
          } else if (event2 === "active") {
            addOneListener(this.pull, "active", pullActive);
            addOneListener(this.push, "active", pushActive);
          } else if (event2 === "paused") {
            addOneListener(this.pull, "paused", pullPaused);
            addOneListener(this.push, "paused", pushPaused);
          }
        });
        this.on("removeListener", function(event2) {
          if (event2 === "change") {
            this.pull.removeListener("change", pullChange);
            this.push.removeListener("change", pushChange);
          } else if (event2 === "denied") {
            this.pull.removeListener("denied", pullDenied);
            this.push.removeListener("denied", pushDenied);
          } else if (event2 === "active") {
            this.pull.removeListener("active", pullActive);
            this.push.removeListener("active", pushActive);
          } else if (event2 === "paused") {
            this.pull.removeListener("paused", pullPaused);
            this.push.removeListener("paused", pushPaused);
          }
        });
        this.pull.on("removeListener", removeAll("pull"));
        this.push.on("removeListener", removeAll("push"));
        const promise = Promise.all([
          this.push,
          this.pull
        ]).then((resp) => {
          const out = {
            push: resp[0],
            pull: resp[1]
          };
          this.emit("complete", out);
          if (callback) {
            callback(null, out);
          }
          this.removeAllListeners();
          return out;
        }, (err2) => {
          this.cancel();
          if (callback) {
            callback(err2);
          } else {
            this.emit("error", err2);
          }
          this.removeAllListeners();
          if (callback) {
            throw err2;
          }
        });
        this.then = function(success, err2) {
          return promise.then(success, err2);
        };
        this.catch = function(err2) {
          return promise.catch(err2);
        };
      }
      cancel() {
        if (!this.canceled) {
          this.canceled = true;
          this.push.cancel();
          this.pull.cancel();
        }
      }
    };
    index_es_default8 = replication;
  }
});

// node_modules/pouchdb-find/lib/index-browser.es.js
function mergeObjects(arr) {
  const res2 = {};
  for (const element2 of arr) {
    Object.assign(res2, element2);
  }
  return res2;
}
function pick2(obj, arr) {
  const res2 = {};
  for (const field of arr) {
    const parsedField = parseField(field);
    const value2 = getFieldFromDoc(obj, parsedField);
    if (typeof value2 !== "undefined") {
      setFieldInDoc(res2, parsedField, value2);
    }
  }
  return res2;
}
function oneArrayIsSubArrayOfOther(left, right) {
  for (let i = 0, len = Math.min(left.length, right.length); i < len; i++) {
    if (left[i] !== right[i]) {
      return false;
    }
  }
  return true;
}
function oneArrayIsStrictSubArrayOfOther(left, right) {
  if (left.length > right.length) {
    return false;
  }
  return oneArrayIsSubArrayOfOther(left, right);
}
function oneSetIsSubArrayOfOther(left, right) {
  left = left.slice();
  for (const field of right) {
    if (!left.length) {
      break;
    }
    const leftIdx = left.indexOf(field);
    if (leftIdx === -1) {
      return false;
    } else {
      left.splice(leftIdx, 1);
    }
  }
  return true;
}
function arrayToObject(arr) {
  const res2 = {};
  for (const field of arr) {
    res2[field] = true;
  }
  return res2;
}
function max2(arr, fun) {
  let max3 = null;
  let maxScore = -1;
  for (const element2 of arr) {
    const score = fun(element2);
    if (score > maxScore) {
      maxScore = score;
      max3 = element2;
    }
  }
  return max3;
}
function arrayEquals(arr1, arr2) {
  if (arr1.length !== arr2.length) {
    return false;
  }
  for (let i = 0, len = arr1.length; i < len; i++) {
    if (arr1[i] !== arr2[i]) {
      return false;
    }
  }
  return true;
}
function uniq2(arr) {
  return Array.from(new Set(arr));
}
function resolveToCallback(fun) {
  return function(...args) {
    const maybeCallback = args[args.length - 1];
    if (typeof maybeCallback === "function") {
      const fulfilled = maybeCallback.bind(null, null);
      const rejected = maybeCallback.bind(null);
      fun.apply(this, args.slice(0, -1)).then(fulfilled, rejected);
    } else {
      return fun.apply(this, args);
    }
  };
}
function massageCreateIndexRequest(requestDef) {
  requestDef = clone(requestDef);
  if (!requestDef.index) {
    requestDef.index = {};
  }
  for (const key4 of ["type", "name", "ddoc"]) {
    if (requestDef.index[key4]) {
      requestDef[key4] = requestDef.index[key4];
      delete requestDef.index[key4];
    }
  }
  if (requestDef.fields) {
    requestDef.index.fields = requestDef.fields;
    delete requestDef.fields;
  }
  if (!requestDef.type) {
    requestDef.type = "json";
  }
  return requestDef;
}
function isNonNullObject(value2) {
  return typeof value2 === "object" && value2 !== null;
}
function checkFieldValueType(name, value2, isHttp) {
  let message = "";
  let received = value2;
  let addReceived = true;
  if (["$in", "$nin", "$or", "$and", "$mod", "$nor", "$all"].indexOf(name) !== -1) {
    if (!Array.isArray(value2)) {
      message = "Query operator " + name + " must be an array.";
    }
  }
  if (["$not", "$elemMatch", "$allMatch"].indexOf(name) !== -1) {
    if (!(!Array.isArray(value2) && isNonNullObject(value2))) {
      message = "Query operator " + name + " must be an object.";
    }
  }
  if (name === "$mod" && Array.isArray(value2)) {
    if (value2.length !== 2) {
      message = "Query operator $mod must be in the format [divisor, remainder], where divisor and remainder are both integers.";
    } else {
      const divisor = value2[0];
      const mod = value2[1];
      if (divisor === 0) {
        message = "Query operator $mod's divisor cannot be 0, cannot divide by zero.";
        addReceived = false;
      }
      if (typeof divisor !== "number" || parseInt(divisor, 10) !== divisor) {
        message = "Query operator $mod's divisor is not an integer.";
        received = divisor;
      }
      if (parseInt(mod, 10) !== mod) {
        message = "Query operator $mod's remainder is not an integer.";
        received = mod;
      }
    }
  }
  if (name === "$exists") {
    if (typeof value2 !== "boolean") {
      message = "Query operator $exists must be a boolean.";
    }
  }
  if (name === "$type") {
    const allowed = ["null", "boolean", "number", "string", "array", "object"];
    const allowedStr = '"' + allowed.slice(0, allowed.length - 1).join('", "') + '", or "' + allowed[allowed.length - 1] + '"';
    if (typeof value2 !== "string") {
      message = "Query operator $type must be a string. Supported values: " + allowedStr + ".";
    } else if (allowed.indexOf(value2) == -1) {
      message = "Query operator $type must be a string. Supported values: " + allowedStr + ".";
    }
  }
  if (name === "$size") {
    if (parseInt(value2, 10) !== value2) {
      message = "Query operator $size must be a integer.";
    }
  }
  if (name === "$regex") {
    if (typeof value2 !== "string") {
      if (isHttp) {
        message = "Query operator $regex must be a string.";
      } else if (!(value2 instanceof RegExp)) {
        message = "Query operator $regex must be a string or an instance of a javascript regular expression.";
      }
    }
  }
  if (message) {
    if (addReceived) {
      const type = received === null ? " " : Array.isArray(received) ? " array" : " " + typeof received;
      const receivedStr = isNonNullObject(received) ? JSON.stringify(received, null, "	") : received;
      message += " Received" + type + ": " + receivedStr;
    }
    throw new Error(message);
  }
}
function validateSelector(input, isHttp) {
  if (Array.isArray(input)) {
    for (const entry of input) {
      if (isNonNullObject(entry)) {
        validateSelector(entry, isHttp);
      }
    }
  } else {
    for (const [key4, value2] of Object.entries(input)) {
      if (requireValidation.indexOf(key4) !== -1) {
        checkFieldValueType(key4, value2, isHttp);
      }
      if (equalityOperators.indexOf(key4) !== -1) {
        continue;
      }
      if (arrayTypeComparisonOperators.indexOf(key4) !== -1) {
        continue;
      }
      if (isNonNullObject(value2)) {
        validateSelector(value2, isHttp);
      }
    }
  }
}
async function dbFetch(db, path8, opts) {
  if (opts.body) {
    opts.body = JSON.stringify(opts.body);
    opts.headers = new h({ "Content-type": "application/json" });
  }
  const response = await db.fetch(path8, opts);
  const json = await response.json();
  if (!response.ok) {
    json.status = response.status;
    const pouchError = createError(json);
    throw generateErrorFromResponse(pouchError);
  }
  return json;
}
async function createIndex(db, requestDef) {
  return await dbFetch(db, "_index", {
    method: "POST",
    body: massageCreateIndexRequest(requestDef)
  });
}
async function find(db, requestDef) {
  validateSelector(requestDef.selector, true);
  return await dbFetch(db, "_find", {
    method: "POST",
    body: requestDef
  });
}
async function explain(db, requestDef) {
  return await dbFetch(db, "_explain", {
    method: "POST",
    body: requestDef
  });
}
async function getIndexes(db) {
  return await dbFetch(db, "_index", {
    method: "GET"
  });
}
async function deleteIndex(db, indexDef) {
  const ddoc = indexDef.ddoc;
  const type = indexDef.type || "json";
  const name = indexDef.name;
  if (!ddoc) {
    throw new Error("you must provide an index's ddoc");
  }
  if (!name) {
    throw new Error("you must provide an index's name");
  }
  const url = "_index/" + [ddoc, type, name].map(encodeURIComponent).join("/");
  return await dbFetch(db, url, { method: "DELETE" });
}
function getDeepValue(value2, path8) {
  for (const key4 of path8) {
    value2 = value2[key4];
    if (value2 === void 0) {
      return void 0;
    }
  }
  return value2;
}
function createDeepMultiMapper(fields, emit, selector) {
  return function(doc) {
    if (selector && !matchesSelector(doc, selector)) {
      return;
    }
    const toEmit = [];
    for (const field of fields) {
      const value2 = getDeepValue(doc, parseField(field));
      if (value2 === void 0) {
        return;
      }
      toEmit.push(value2);
    }
    emit(toEmit);
  };
}
function createDeepSingleMapper(field, emit, selector) {
  const parsedField = parseField(field);
  return function(doc) {
    if (selector && !matchesSelector(doc, selector)) {
      return;
    }
    const value2 = getDeepValue(doc, parsedField);
    if (value2 !== void 0) {
      emit(value2);
    }
  };
}
function createShallowSingleMapper(field, emit, selector) {
  return function(doc) {
    if (selector && !matchesSelector(doc, selector)) {
      return;
    }
    emit(doc[field]);
  };
}
function createShallowMultiMapper(fields, emit, selector) {
  return function(doc) {
    if (selector && !matchesSelector(doc, selector)) {
      return;
    }
    const toEmit = fields.map((field) => doc[field]);
    emit(toEmit);
  };
}
function checkShallow(fields) {
  return fields.every((field) => field.indexOf(".") === -1);
}
function createMapper(fields, emit, selector) {
  const isShallow = checkShallow(fields);
  const isSingle = fields.length === 1;
  if (isShallow) {
    if (isSingle) {
      return createShallowSingleMapper(fields[0], emit, selector);
    } else {
      return createShallowMultiMapper(fields, emit, selector);
    }
  } else {
    if (isSingle) {
      return createDeepSingleMapper(fields[0], emit, selector);
    } else {
      return createDeepMultiMapper(fields, emit, selector);
    }
  }
}
function mapper2(mapFunDef, emit) {
  const fields = Object.keys(mapFunDef.fields);
  const partialSelector = mapFunDef.partial_filter_selector;
  return createMapper(fields, emit, partialSelector);
}
function reducer2() {
  throw new Error("reduce not supported");
}
function ddocValidator2(ddoc, viewName) {
  const view = ddoc.views[viewName];
  if (!view.map || !view.map.fields) {
    throw new Error("ddoc " + ddoc._id + " with view " + viewName + " doesn't have map.fields defined. maybe it wasn't created by this plugin?");
  }
}
function abstractMapper$1(db) {
  if (db._customFindAbstractMapper) {
    return {
      // Calls the _customFindAbstractMapper, but with a third argument:
      // the standard findAbstractMapper query/viewCleanup.
      // This allows the indexeddb adapter to support partial_filter_selector.
      query: function addQueryFallback(signature, opts) {
        const fallback2 = abstractMapper.query.bind(this);
        return db._customFindAbstractMapper.query.call(this, signature, opts, fallback2);
      },
      viewCleanup: function addViewCleanupFallback() {
        const fallback2 = abstractMapper.viewCleanup.bind(this);
        return db._customFindAbstractMapper.viewCleanup.call(this, fallback2);
      }
    };
  }
  return abstractMapper;
}
function massageSort(sort) {
  if (!Array.isArray(sort)) {
    throw new Error("invalid sort json - should be an array");
  }
  return sort.map(function(sorting) {
    if (typeof sorting === "string") {
      const obj = {};
      obj[sorting] = "asc";
      return obj;
    } else {
      return sorting;
    }
  });
}
function massageUseIndex(useIndex) {
  let cleanedUseIndex = [];
  if (typeof useIndex === "string") {
    cleanedUseIndex.push(useIndex);
  } else {
    cleanedUseIndex = useIndex;
  }
  return cleanedUseIndex.map(function(name) {
    return name.replace(ddocIdPrefix, "");
  });
}
function massageIndexDef(indexDef) {
  indexDef.fields = indexDef.fields.map(function(field) {
    if (typeof field === "string") {
      const obj = {};
      obj[field] = "asc";
      return obj;
    }
    return field;
  });
  if (indexDef.partial_filter_selector) {
    indexDef.partial_filter_selector = massageSelector(
      indexDef.partial_filter_selector
    );
  }
  return indexDef;
}
function getKeyFromDoc(doc, index6) {
  return index6.def.fields.map((obj) => {
    const field = getKey2(obj);
    return getFieldFromDoc(doc, parseField(field));
  });
}
function filterInclusiveStart(rows, targetValue, index6) {
  const indexFields = index6.def.fields;
  let startAt = 0;
  for (const row of rows) {
    let docKey = getKeyFromDoc(row.doc, index6);
    if (indexFields.length === 1) {
      docKey = docKey[0];
    } else {
      while (docKey.length > targetValue.length) {
        docKey.pop();
      }
    }
    if (Math.abs(collate(docKey, targetValue)) > 0) {
      break;
    }
    ++startAt;
  }
  return startAt > 0 ? rows.slice(startAt) : rows;
}
function reverseOptions(opts) {
  const newOpts = clone(opts);
  delete newOpts.startkey;
  delete newOpts.endkey;
  delete newOpts.inclusive_start;
  delete newOpts.inclusive_end;
  if ("endkey" in opts) {
    newOpts.startkey = opts.endkey;
  }
  if ("startkey" in opts) {
    newOpts.endkey = opts.startkey;
  }
  if ("inclusive_start" in opts) {
    newOpts.inclusive_end = opts.inclusive_start;
  }
  if ("inclusive_end" in opts) {
    newOpts.inclusive_start = opts.inclusive_end;
  }
  return newOpts;
}
function validateIndex(index6) {
  const ascFields = index6.fields.filter(function(field) {
    return getValue(field) === "asc";
  });
  if (ascFields.length !== 0 && ascFields.length !== index6.fields.length) {
    throw new Error("unsupported mixed sorting");
  }
}
function validateSort(requestDef, index6) {
  if (index6.defaultUsed && requestDef.sort) {
    const noneIdSorts = requestDef.sort.filter(function(sortItem) {
      return Object.keys(sortItem)[0] !== "_id";
    }).map(function(sortItem) {
      return Object.keys(sortItem)[0];
    });
    if (noneIdSorts.length > 0) {
      throw new Error('Cannot sort on field(s) "' + noneIdSorts.join(",") + '" when using the default index');
    }
  }
  if (index6.defaultUsed) {
    return;
  }
}
function validateFindRequest(requestDef) {
  if (typeof requestDef.selector !== "object") {
    throw new Error("you must provide a selector when you find()");
  }
}
function getUserFields(selector, sort) {
  const selectorFields = Object.keys(selector);
  const sortFields = sort ? sort.map(getKey2) : [];
  let userFields;
  if (selectorFields.length >= sortFields.length) {
    userFields = selectorFields;
  } else {
    userFields = sortFields;
  }
  if (sortFields.length === 0) {
    return {
      fields: userFields
    };
  }
  userFields = userFields.sort(function(left, right) {
    let leftIdx = sortFields.indexOf(left);
    if (leftIdx === -1) {
      leftIdx = Number.MAX_VALUE;
    }
    let rightIdx = sortFields.indexOf(right);
    if (rightIdx === -1) {
      rightIdx = Number.MAX_VALUE;
    }
    return leftIdx < rightIdx ? -1 : leftIdx > rightIdx ? 1 : 0;
  });
  return {
    fields: userFields,
    sortOrder: sort.map(getKey2)
  };
}
async function createIndex$1(db, requestDef) {
  requestDef = massageCreateIndexRequest(requestDef);
  const originalIndexDef = clone(requestDef.index);
  requestDef.index = massageIndexDef(requestDef.index);
  validateIndex(requestDef.index);
  let md5;
  function getMd5() {
    return md5 || (md5 = stringMd5(JSON.stringify(requestDef)));
  }
  const viewName = requestDef.name || "idx-" + getMd5();
  const ddocName = requestDef.ddoc || "idx-" + getMd5();
  const ddocId = "_design/" + ddocName;
  let hasInvalidLanguage = false;
  let viewExists = false;
  function updateDdoc(doc) {
    if (doc._rev && doc.language !== "query") {
      hasInvalidLanguage = true;
    }
    doc.language = "query";
    doc.views = doc.views || {};
    viewExists = !!doc.views[viewName];
    if (viewExists) {
      return false;
    }
    doc.views[viewName] = {
      map: {
        fields: mergeObjects(requestDef.index.fields),
        partial_filter_selector: requestDef.index.partial_filter_selector
      },
      reduce: "_count",
      options: {
        def: originalIndexDef
      }
    };
    return doc;
  }
  db.constructor.emit("debug", ["find", "creating index", ddocId]);
  await upsert(db, ddocId, updateDdoc);
  if (hasInvalidLanguage) {
    throw new Error('invalid language for ddoc with id "' + ddocId + '" (should be "query")');
  }
  const signature = ddocName + "/" + viewName;
  await abstractMapper$1(db).query.call(db, signature, {
    limit: 0,
    reduce: false
  });
  return {
    id: ddocId,
    name: viewName,
    result: viewExists ? "exists" : "created"
  };
}
async function getIndexes$1(db) {
  const allDocsRes = await db.allDocs({
    startkey: "_design/",
    endkey: "_design/\uFFFF",
    include_docs: true
  });
  const res2 = {
    indexes: [{
      ddoc: null,
      name: "_all_docs",
      type: "special",
      def: {
        fields: [{ _id: "asc" }]
      }
    }]
  };
  res2.indexes = flatten(res2.indexes, allDocsRes.rows.filter(function(row) {
    return row.doc.language === "query";
  }).map(function(row) {
    const viewNames = row.doc.views !== void 0 ? Object.keys(row.doc.views) : [];
    return viewNames.map(function(viewName) {
      const view = row.doc.views[viewName];
      return {
        ddoc: row.id,
        name: viewName,
        type: "json",
        def: massageIndexDef(view.options.def)
      };
    });
  }));
  res2.indexes.sort(function(left, right) {
    return compare(left.name, right.name);
  });
  res2.total_rows = res2.indexes.length;
  return res2;
}
function checkFieldInIndex(index6, field) {
  return index6.def.fields.some((key4) => getKey2(key4) === field);
}
function userOperatorLosesPrecision(selector, field) {
  const matcher = selector[field];
  const userOperator = getKey2(matcher);
  return userOperator !== "$eq";
}
function sortFieldsByIndex(userFields, index6) {
  const indexFields = index6.def.fields.map(getKey2);
  return userFields.slice().sort(function(a, b) {
    let aIdx = indexFields.indexOf(a);
    let bIdx = indexFields.indexOf(b);
    if (aIdx === -1) {
      aIdx = Number.MAX_VALUE;
    }
    if (bIdx === -1) {
      bIdx = Number.MAX_VALUE;
    }
    return compare(aIdx, bIdx);
  });
}
function getBasicInMemoryFields(index6, selector, userFields) {
  userFields = sortFieldsByIndex(userFields, index6);
  let needToFilterInMemory = false;
  for (let i = 0, len = userFields.length; i < len; i++) {
    const field = userFields[i];
    if (needToFilterInMemory || !checkFieldInIndex(index6, field)) {
      return userFields.slice(i);
    }
    if (i < len - 1 && userOperatorLosesPrecision(selector, field)) {
      needToFilterInMemory = true;
    }
  }
  return [];
}
function getInMemoryFieldsFromNe(selector) {
  const fields = [];
  for (const [field, matcher] of Object.entries(selector)) {
    for (const operator of Object.keys(matcher)) {
      if (operator === "$ne") {
        fields.push(field);
      }
    }
  }
  return fields;
}
function getInMemoryFields(coreInMemoryFields, index6, selector, userFields) {
  const result = flatten(
    // in-memory fields reported as necessary by the query planner
    coreInMemoryFields,
    // combine with another pass that checks for any we may have missed
    getBasicInMemoryFields(index6, selector, userFields),
    // combine with another pass that checks for $ne's
    getInMemoryFieldsFromNe(selector)
  );
  return sortFieldsByIndex(uniq2(result), index6);
}
function checkIndexFieldsMatch(indexFields, sortOrder, fields) {
  if (sortOrder) {
    const sortMatches = oneArrayIsStrictSubArrayOfOther(sortOrder, indexFields);
    const selectorMatches = oneArrayIsSubArrayOfOther(fields, indexFields);
    return sortMatches && selectorMatches;
  }
  return oneSetIsSubArrayOfOther(fields, indexFields);
}
function isNonLogicalMatcher(matcher) {
  return logicalMatchers.indexOf(matcher) === -1;
}
function checkFieldsLogicallySound(indexFields, selector) {
  const firstField = indexFields[0];
  const matcher = selector[firstField];
  if (typeof matcher === "undefined") {
    return true;
  }
  const isInvalidNe = Object.keys(matcher).length === 1 && getKey2(matcher) === "$ne";
  return !isInvalidNe;
}
function checkIndexMatches(index6, sortOrder, fields, selector) {
  const indexFields = index6.def.fields.map(getKey2);
  const fieldsMatch = checkIndexFieldsMatch(indexFields, sortOrder, fields);
  if (!fieldsMatch) {
    return false;
  }
  return checkFieldsLogicallySound(indexFields, selector);
}
function findMatchingIndexes(selector, userFields, sortOrder, indexes2) {
  return indexes2.filter(function(index6) {
    return checkIndexMatches(index6, sortOrder, userFields, selector);
  });
}
function findBestMatchingIndex(selector, userFields, sortOrder, indexes2, useIndex) {
  const matchingIndexes = findMatchingIndexes(selector, userFields, sortOrder, indexes2);
  if (matchingIndexes.length === 0) {
    if (useIndex) {
      throw {
        error: "no_usable_index",
        message: "There is no index available for this selector."
      };
    }
    const defaultIndex = indexes2[0];
    defaultIndex.defaultUsed = true;
    return defaultIndex;
  }
  if (matchingIndexes.length === 1 && !useIndex) {
    return matchingIndexes[0];
  }
  const userFieldsMap = arrayToObject(userFields);
  function scoreIndex(index6) {
    const indexFields = index6.def.fields.map(getKey2);
    let score = 0;
    for (const indexField of indexFields) {
      if (userFieldsMap[indexField]) {
        score++;
      }
    }
    return score;
  }
  if (useIndex) {
    const useIndexDdoc = "_design/" + useIndex[0];
    const useIndexName = useIndex.length === 2 ? useIndex[1] : false;
    const index6 = matchingIndexes.find(function(index7) {
      if (useIndexName && index7.ddoc === useIndexDdoc && useIndexName === index7.name) {
        return true;
      }
      if (index7.ddoc === useIndexDdoc) {
        return true;
      }
      return false;
    });
    if (!index6) {
      throw {
        error: "unknown_error",
        message: "Could not find that index or could not use that index for the query"
      };
    }
    return index6;
  }
  return max2(matchingIndexes, scoreIndex);
}
function getSingleFieldQueryOptsFor(userOperator, userValue) {
  switch (userOperator) {
    case "$eq":
      return { key: userValue };
    case "$lte":
      return { endkey: userValue };
    case "$gte":
      return { startkey: userValue };
    case "$lt":
      return {
        endkey: userValue,
        inclusive_end: false
      };
    case "$gt":
      return {
        startkey: userValue,
        inclusive_start: false
      };
  }
  return {
    startkey: COLLATE_LO
  };
}
function getSingleFieldCoreQueryPlan(selector, index6) {
  const field = getKey2(index6.def.fields[0]);
  const matcher = selector[field] || {};
  const inMemoryFields = [];
  const userOperators = Object.keys(matcher);
  let combinedOpts;
  for (const userOperator of userOperators) {
    if (isNonLogicalMatcher(userOperator)) {
      inMemoryFields.push(field);
    }
    const userValue = matcher[userOperator];
    const newQueryOpts = getSingleFieldQueryOptsFor(userOperator, userValue);
    if (combinedOpts) {
      combinedOpts = mergeObjects([combinedOpts, newQueryOpts]);
    } else {
      combinedOpts = newQueryOpts;
    }
  }
  return {
    queryOpts: combinedOpts,
    inMemoryFields
  };
}
function getMultiFieldCoreQueryPlan(userOperator, userValue) {
  switch (userOperator) {
    case "$eq":
      return {
        startkey: userValue,
        endkey: userValue
      };
    case "$lte":
      return {
        endkey: userValue
      };
    case "$gte":
      return {
        startkey: userValue
      };
    case "$lt":
      return {
        endkey: userValue,
        inclusive_end: false
      };
    case "$gt":
      return {
        startkey: userValue,
        inclusive_start: false
      };
  }
}
function getMultiFieldQueryOpts(selector, index6) {
  const indexFields = index6.def.fields.map(getKey2);
  let inMemoryFields = [];
  const startkey = [];
  const endkey = [];
  let inclusiveStart;
  let inclusiveEnd;
  function finish(i) {
    if (inclusiveStart !== false) {
      startkey.push(COLLATE_LO);
    }
    if (inclusiveEnd !== false) {
      endkey.push(COLLATE_HI);
    }
    inMemoryFields = indexFields.slice(i);
  }
  for (let i = 0, len = indexFields.length; i < len; i++) {
    const indexField = indexFields[i];
    const matcher = selector[indexField];
    if (!matcher || !Object.keys(matcher).length) {
      finish(i);
      break;
    } else if (Object.keys(matcher).some(isNonLogicalMatcher)) {
      finish(i);
      break;
    } else if (i > 0) {
      const usingGtlt = "$gt" in matcher || "$gte" in matcher || "$lt" in matcher || "$lte" in matcher;
      const previousKeys = Object.keys(selector[indexFields[i - 1]]);
      const previousWasEq = arrayEquals(previousKeys, ["$eq"]);
      const previousWasSame = arrayEquals(previousKeys, Object.keys(matcher));
      const gtltLostSpecificity = usingGtlt && !previousWasEq && !previousWasSame;
      if (gtltLostSpecificity) {
        finish(i);
        break;
      }
    }
    const userOperators = Object.keys(matcher);
    let combinedOpts = null;
    for (const userOperator of userOperators) {
      const userValue = matcher[userOperator];
      const newOpts = getMultiFieldCoreQueryPlan(userOperator, userValue);
      if (combinedOpts) {
        combinedOpts = mergeObjects([combinedOpts, newOpts]);
      } else {
        combinedOpts = newOpts;
      }
    }
    startkey.push("startkey" in combinedOpts ? combinedOpts.startkey : COLLATE_LO);
    endkey.push("endkey" in combinedOpts ? combinedOpts.endkey : COLLATE_HI);
    if ("inclusive_start" in combinedOpts) {
      inclusiveStart = combinedOpts.inclusive_start;
    }
    if ("inclusive_end" in combinedOpts) {
      inclusiveEnd = combinedOpts.inclusive_end;
    }
  }
  const res2 = {
    startkey,
    endkey
  };
  if (typeof inclusiveStart !== "undefined") {
    res2.inclusive_start = inclusiveStart;
  }
  if (typeof inclusiveEnd !== "undefined") {
    res2.inclusive_end = inclusiveEnd;
  }
  return {
    queryOpts: res2,
    inMemoryFields
  };
}
function shouldShortCircuit(selector) {
  const values = Object.keys(selector).map(function(key4) {
    return selector[key4];
  });
  return values.some(function(val) {
    return typeof val === "object" && Object.keys(val).length === 0;
  });
}
function getDefaultQueryPlan(selector) {
  return {
    queryOpts: { startkey: null },
    inMemoryFields: [Object.keys(selector)]
  };
}
function getCoreQueryPlan(selector, index6) {
  if (index6.defaultUsed) {
    return getDefaultQueryPlan(selector, index6);
  }
  if (index6.def.fields.length === 1) {
    return getSingleFieldCoreQueryPlan(selector, index6);
  }
  return getMultiFieldQueryOpts(selector, index6);
}
function planQuery(request, indexes2) {
  const selector = request.selector;
  const sort = request.sort;
  if (shouldShortCircuit(selector)) {
    return Object.assign({}, SHORT_CIRCUIT_QUERY, { index: indexes2[0] });
  }
  const userFieldsRes = getUserFields(selector, sort);
  const userFields = userFieldsRes.fields;
  const sortOrder = userFieldsRes.sortOrder;
  const index6 = findBestMatchingIndex(selector, userFields, sortOrder, indexes2, request.use_index);
  const coreQueryPlan = getCoreQueryPlan(selector, index6);
  const queryOpts = coreQueryPlan.queryOpts;
  const coreInMemoryFields = coreQueryPlan.inMemoryFields;
  const inMemoryFields = getInMemoryFields(coreInMemoryFields, index6, selector, userFields);
  return {
    queryOpts,
    index: index6,
    inMemoryFields
  };
}
function indexToSignature(index6) {
  return index6.ddoc.substring(8) + "/" + index6.name;
}
async function doAllDocs(db, originalOpts) {
  const opts = clone(originalOpts);
  if (opts.descending) {
    if ("endkey" in opts && typeof opts.endkey !== "string") {
      opts.endkey = "";
    }
    if ("startkey" in opts && typeof opts.startkey !== "string") {
      opts.limit = 0;
    }
  } else {
    if ("startkey" in opts && typeof opts.startkey !== "string") {
      opts.startkey = "";
    }
    if ("endkey" in opts && typeof opts.endkey !== "string") {
      opts.limit = 0;
    }
  }
  if ("key" in opts && typeof opts.key !== "string") {
    opts.limit = 0;
  }
  if (opts.limit > 0 && opts.indexes_count) {
    opts.original_limit = opts.limit;
    opts.limit += opts.indexes_count;
  }
  const res2 = await db.allDocs(opts);
  res2.rows = res2.rows.filter(function(row) {
    return !/^_design\//.test(row.id);
  });
  if (opts.original_limit) {
    opts.limit = opts.original_limit;
  }
  res2.rows = res2.rows.slice(0, opts.limit);
  return res2;
}
async function queryAllOrIndex(db, opts, indexToUse) {
  if (indexToUse.name === "_all_docs") {
    return doAllDocs(db, opts);
  }
  return abstractMapper$1(db).query.call(db, indexToSignature(indexToUse), opts);
}
async function find$1(db, requestDef, explain2) {
  if (requestDef.selector) {
    validateSelector(requestDef.selector, false);
    requestDef.selector = massageSelector(requestDef.selector);
  }
  if (requestDef.sort) {
    requestDef.sort = massageSort(requestDef.sort);
  }
  if (requestDef.use_index) {
    requestDef.use_index = massageUseIndex(requestDef.use_index);
  }
  if (!("limit" in requestDef)) {
    requestDef.limit = 25;
  }
  validateFindRequest(requestDef);
  const getIndexesRes = await getIndexes$1(db);
  db.constructor.emit("debug", ["find", "planning query", requestDef]);
  const queryPlan = planQuery(requestDef, getIndexesRes.indexes);
  db.constructor.emit("debug", ["find", "query plan", queryPlan]);
  const indexToUse = queryPlan.index;
  validateSort(requestDef, indexToUse);
  let opts = Object.assign({
    include_docs: true,
    reduce: false,
    // Add amount of index for doAllDocs to use (related to issue #7810)
    indexes_count: getIndexesRes.total_rows
  }, queryPlan.queryOpts);
  if ("startkey" in opts && "endkey" in opts && collate(opts.startkey, opts.endkey) > 0) {
    return { docs: [] };
  }
  const isDescending = requestDef.sort && typeof requestDef.sort[0] !== "string" && getValue(requestDef.sort[0]) === "desc";
  if (isDescending) {
    opts.descending = true;
    opts = reverseOptions(opts);
  }
  if (!queryPlan.inMemoryFields.length) {
    opts.limit = requestDef.limit;
    if ("skip" in requestDef) {
      opts.skip = requestDef.skip;
    }
  }
  if (explain2) {
    return Promise.resolve(queryPlan, opts);
  }
  const res2 = await queryAllOrIndex(db, opts, indexToUse);
  if (opts.inclusive_start === false) {
    res2.rows = filterInclusiveStart(res2.rows, opts.startkey, indexToUse);
  }
  if (queryPlan.inMemoryFields.length) {
    res2.rows = filterInMemoryFields(res2.rows, requestDef, queryPlan.inMemoryFields);
  }
  const resp = {
    docs: res2.rows.map(function(row) {
      const doc = row.doc;
      if (requestDef.fields) {
        return pick2(doc, requestDef.fields);
      }
      return doc;
    })
  };
  if (indexToUse.defaultUsed) {
    resp.warning = "No matching index found, create an index to optimize query time.";
  }
  return resp;
}
async function explain$1(db, requestDef) {
  const queryPlan = await find$1(db, requestDef, true);
  return {
    dbname: db.name,
    index: queryPlan.index,
    selector: requestDef.selector,
    range: {
      start_key: queryPlan.queryOpts.startkey,
      end_key: queryPlan.queryOpts.endkey
    },
    opts: {
      use_index: requestDef.use_index || [],
      bookmark: "nil",
      //hardcoded to match CouchDB since its not supported,
      limit: requestDef.limit,
      skip: requestDef.skip,
      sort: requestDef.sort || {},
      fields: requestDef.fields,
      conflicts: false,
      //hardcoded to match CouchDB since its not supported,
      r: [49]
      // hardcoded to match CouchDB since its not support
    },
    limit: requestDef.limit,
    skip: requestDef.skip || 0,
    fields: requestDef.fields
  };
}
async function deleteIndex$1(db, index6) {
  if (!index6.ddoc) {
    throw new Error("you must supply an index.ddoc when deleting");
  }
  if (!index6.name) {
    throw new Error("you must supply an index.name when deleting");
  }
  const docId = index6.ddoc;
  const viewName = index6.name;
  function deltaFun(doc) {
    if (Object.keys(doc.views).length === 1 && doc.views[viewName]) {
      return { _id: docId, _deleted: true };
    }
    delete doc.views[viewName];
    return doc;
  }
  await upsert(db, docId, deltaFun);
  await abstractMapper$1(db).viewCleanup.apply(db);
  return { ok: true };
}
var nativeFlat, polyFlat, flatten, requireValidation, arrayTypeComparisonOperators, equalityOperators, abstractMapper, ddocIdPrefix, COLLATE_LO, COLLATE_HI, SHORT_CIRCUIT_QUERY, logicalMatchers, plugin, index_browser_es_default3;
var init_index_browser_es7 = __esm({
  "node_modules/pouchdb-find/lib/index-browser.es.js"() {
    init_index_es();
    init_index_browser_es4();
    init_index_es12();
    init_index_browser_es2();
    init_index_es3();
    init_index_es4();
    init_index_browser_es3();
    nativeFlat = (...args) => args.flat(Infinity);
    polyFlat = (...args) => {
      let res2 = [];
      for (const subArr of args) {
        if (Array.isArray(subArr)) {
          res2 = res2.concat(polyFlat(...subArr));
        } else {
          res2.push(subArr);
        }
      }
      return res2;
    };
    flatten = typeof Array.prototype.flat === "function" ? nativeFlat : polyFlat;
    requireValidation = ["$all", "$allMatch", "$and", "$elemMatch", "$exists", "$in", "$mod", "$nin", "$nor", "$not", "$or", "$regex", "$size", "$type"];
    arrayTypeComparisonOperators = ["$in", "$nin", "$mod", "$all"];
    equalityOperators = ["$eq", "$gt", "$gte", "$lt", "$lte"];
    abstractMapper = index_es_default5(
      /* localDocName */
      "indexes",
      mapper2,
      reducer2,
      ddocValidator2
    );
    ddocIdPrefix = /^_design\//;
    COLLATE_LO = null;
    COLLATE_HI = { "\uFFFF": {} };
    SHORT_CIRCUIT_QUERY = {
      queryOpts: { limit: 0, startkey: COLLATE_HI, endkey: COLLATE_LO },
      inMemoryFields: []
    };
    logicalMatchers = ["$eq", "$gt", "$gte", "$lt", "$lte"];
    plugin = {};
    plugin.createIndex = resolveToCallback(async function(requestDef) {
      if (typeof requestDef !== "object") {
        throw new Error("you must provide an index to create");
      }
      const createIndex$$1 = isRemote(this) ? createIndex : createIndex$1;
      return createIndex$$1(this, requestDef);
    });
    plugin.find = resolveToCallback(async function(requestDef) {
      if (typeof requestDef !== "object") {
        throw new Error("you must provide search parameters to find()");
      }
      const find$$1 = isRemote(this) ? find : find$1;
      return find$$1(this, requestDef);
    });
    plugin.explain = resolveToCallback(async function(requestDef) {
      if (typeof requestDef !== "object") {
        throw new Error("you must provide search parameters to explain()");
      }
      const find$$1 = isRemote(this) ? explain : explain$1;
      return find$$1(this, requestDef);
    });
    plugin.getIndexes = resolveToCallback(async function() {
      const getIndexes$$1 = isRemote(this) ? getIndexes : getIndexes$1;
      return getIndexes$$1(this);
    });
    plugin.deleteIndex = resolveToCallback(async function(indexDef) {
      if (typeof indexDef !== "object") {
        throw new Error("you must provide an index to delete");
      }
      const deleteIndex$$1 = isRemote(this) ? deleteIndex : deleteIndex$1;
      return deleteIndex$$1(this, indexDef);
    });
    index_browser_es_default3 = plugin;
  }
});

// node_modules/pouchdb-wrappers/index.js
var require_pouchdb_wrappers = __commonJS({
  "node_modules/pouchdb-wrappers/index.js"(exports2, module2) {
    "use strict";
    function nodify(promise, callback) {
      promise.then((...args) => {
        callback(null, ...args);
      }).catch((err2) => {
        callback(err2);
      });
    }
    function installWrappers(base2, handlers = {}) {
      if (!base2._originals || !base2._handlers) {
        base2._originals = {};
        base2._handlers = {};
      }
      for (const [method, handler] of Object.entries(handlers)) {
        if (!(method in base2)) {
          throw new Error(`Method '${method}' does not exist on given base, so it cannot be wrapped.`);
        }
        if (!(method in base2._originals)) {
          base2._originals[method] = base2[method];
        }
        if (method in base2._handlers) {
          base2._handlers[method].unshift(handler);
        } else {
          base2._handlers[method] = [handler];
          base2[method] = replacementMethod(base2, method);
        }
      }
    }
    function replacementMethod(base2, method) {
      return function(...args) {
        function doMethod() {
          let callback = null;
          const minArgs = method === "query" ? 1 : 0;
          if (args.length > minArgs && typeof args[args.length - 1] === "function") {
            callback = args.pop();
          }
          let prev = base2._originals[method].bind(base2);
          for (const handler of base2._handlers[method]) {
            prev = handler.bind(base2, prev);
          }
          const result = prev(...args);
          if (result.then && callback) {
            nodify(result, callback);
          }
          return result;
        }
        if (method !== "changes" && base2.taskqueue && !base2.taskqueue.isReady) {
          const dbReady = new Promise((resolve, reject) => {
            base2.taskqueue.addTask((error2) => {
              if (error2) {
                reject(error2);
              } else {
                resolve();
              }
            });
          });
          return dbReady.then(doMethod);
        } else {
          return doMethod();
        }
      };
    }
    function uninstallWrappers(base2, handlers) {
      if (!base2._originals || !base2._handlers) {
        throw new Error("No wrapper methods installed, so no methods can be uninstalled.");
      }
      for (const [method, handler] of Object.entries(handlers)) {
        const errorMessage = `Wrapper method for '${method}' not installed: ${handler.toString()}`;
        if (!(method in base2._handlers)) {
          throw new Error(errorMessage);
        }
        const i = base2._handlers[method].indexOf(handler);
        if (i === -1) {
          throw new Error(errorMessage);
        } else {
          base2._handlers[method].splice(i, 1);
        }
      }
    }
    var toExport = {
      install: installWrappers,
      uninstall: uninstallWrappers
    };
    try {
      module2.exports = toExport;
    } catch (e2) {
    }
    try {
      window.PouchDBWrappers = toExport;
    } catch (e2) {
    }
  }
});

// node_modules/transform-pouch/index.js
var require_transform_pouch = __commonJS({
  "node_modules/transform-pouch/index.js"(exports2, module2) {
    "use strict";
    var wrappers = require_pouchdb_wrappers();
    function isntInternalKey(key4) {
      return key4[0] !== "_";
    }
    function isUntransformable(doc) {
      if (typeof doc._id === "string" && /^_local/.test(doc._id)) {
        return true;
      }
      if (doc._deleted) {
        return Object.keys(doc).filter(isntInternalKey).length === 0;
      }
      return false;
    }
    module2.exports = {
      transform: transform2,
      // api.filter provided for backwards compat with the old "filter-pouch"
      filter: transform2
    };
    function transform2(config) {
      const db = this;
      const incoming = function(doc) {
        if (!isUntransformable(doc) && config.incoming) {
          return config.incoming(doc);
        }
        return doc;
      };
      const outgoing = function(doc) {
        if (!isUntransformable(doc) && config.outgoing) {
          return config.outgoing(doc);
        }
        return doc;
      };
      const handlers = {
        async get(orig, ...args) {
          const response = await orig(...args);
          if (Array.isArray(response)) {
            await Promise.all(response.map(async (row) => {
              if (row.ok) {
                row.ok = await outgoing(row.ok);
              }
            }));
            return response;
          } else {
            return outgoing(response);
          }
        },
        async bulkDocs(orig, docs, ...args) {
          if (docs.docs) {
            docs.docs = await Promise.all(docs.docs.map(incoming));
          } else {
            docs = await Promise.all(docs.map(incoming));
          }
          return orig(docs, ...args);
        },
        async allDocs(orig, ...args) {
          const response = await orig(...args);
          await Promise.all(response.rows.map(async (row) => {
            if (row.doc) {
              row.doc = await outgoing(row.doc);
            }
          }));
          return response;
        },
        async bulkGet(orig, ...args) {
          const mapDoc = async (doc) => {
            if (doc.ok) {
              return { ok: await outgoing(doc.ok) };
            } else {
              return doc;
            }
          };
          const mapResult = async (result) => {
            const { id, docs } = result;
            if (id && docs && Array.isArray(docs)) {
              return { id, docs: await Promise.all(docs.map(mapDoc)) };
            } else {
              return result;
            }
          };
          let { results, ...res2 } = await orig(...args);
          results = await Promise.all(results.map(mapResult));
          return { results, ...res2 };
        },
        changes(orig, ...args) {
          async function modifyChange(change) {
            if (change.doc) {
              change.doc = await outgoing(change.doc);
              return change;
            }
            return change;
          }
          async function modifyChanges(res2) {
            if (res2.results) {
              res2.results = await Promise.all(res2.results.map(modifyChange));
              return res2;
            }
            return res2;
          }
          const changes3 = orig(...args);
          const { on: origOn, then: origThen } = changes3;
          return Object.assign(changes3, {
            // wrap all listeners, but specifically those for 'change' and 'complete'
            on(event2, listener) {
              const origListener = listener;
              if (event2 === "change") {
                listener = async (change) => {
                  origListener(await modifyChange(change));
                };
              } else if (event2 === "complete") {
                listener = async (res2) => {
                  origListener(await modifyChanges(res2));
                };
              }
              return origOn.call(changes3, event2, listener);
            },
            // `.changes` can be awaited. it then returns all relevant changes
            // which we pass to our handler for possible transformation
            then(resolve, reject) {
              return origThen.call(changes3, modifyChanges).then(resolve, reject);
            }
          });
        }
      };
      if (db.type() === "http") {
        handlers.put = async function(orig, doc, ...args) {
          doc = await incoming(doc);
          return orig(doc, ...args);
        };
        handlers.query = async function(orig, ...args) {
          const response = await orig(...args);
          await Promise.all(response.rows.map(async (row) => {
            if (row.doc) {
              row.doc = await outgoing(row.doc);
            }
          }));
          return response;
        };
      }
      wrappers.install(db, handlers);
    }
    if (typeof window !== "undefined" && window.PouchDB) {
      window.PouchDB.plugin(exports2);
    }
  }
});

// src/sync/core/pouchdb/pouchdb-browser.ts
function appendPurgeSeqs(db, docs) {
  return db.get("_local/purges").then(function(doc) {
    for (const [docId, rev$$1] of docs) {
      const purgeSeq = doc.purgeSeq + 1;
      doc.purges.push({
        docId,
        rev: rev$$1,
        purgeSeq
      });
      if (doc.purges.length > db.purged_infos_limit) {
        doc.purges.splice(0, doc.purges.length - db.purged_infos_limit);
      }
      doc.purgeSeq = purgeSeq;
    }
    return doc;
  }).catch(function(err2) {
    if (err2.status !== 404) {
      throw err2;
    }
    return {
      _id: "_local/purges",
      purges: docs.map(([docId, rev$$1], idx2) => ({
        docId,
        rev: rev$$1,
        purgeSeq: idx2
      })),
      purgeSeq: docs.length
    };
  }).then(function(doc) {
    return db.put(doc);
  });
}
var import_transform_pouch;
var init_pouchdb_browser = __esm({
  "src/sync/core/pouchdb/pouchdb-browser.ts"() {
    "use strict";
    init_index_es5();
    init_index_es8();
    init_index_es9();
    init_index_es10();
    init_index_browser_es6();
    init_index_es15();
    init_index_browser_es7();
    import_transform_pouch = __toESM2(require_transform_pouch(), 1);
    init_index_es2();
    init_index_browser_es3();
    init_index_es();
    init_task();
    index_es_default.plugin(index_es_default2).plugin(index_es_default3).plugin(index_es_default4).plugin(index_browser_es_default2).plugin(index_es_default8).plugin(index_browser_es_default3).plugin(import_transform_pouch.default);
    index_es_default.prototype.purgeMulti = adapterFun(
      "_purgeMulti",
      function(docs, callback) {
        if (typeof this._purge === "undefined") {
          return callback(
            //@ts-ignore: this ts-ignore might be hiding a `this` bug where we don't have "this" conext.
            createError(UNKNOWN_ERROR, "Purge is not implemented in the " + this.adapter + " adapter.")
          );
        }
        const self3 = this;
        const tasks3 = docs.map(
          (param) => () => new Promise((res2, rej) => {
            const [docId, rev$$1] = param;
            self3._getRevisionTree(docId, (error2, revs) => {
              if (error2) {
                return res2([param, error2]);
              }
              if (!revs) {
                return res2([param, createError(MISSING_DOC)]);
              }
              let path8;
              try {
                path8 = findPathToLeaf(revs, rev$$1);
              } catch (error3) {
                return res2([param, error3.message || error3]);
              }
              self3._purge(docId, path8, (error3, result) => {
                if (error3) {
                  return res2([param, error3]);
                } else {
                  return res2([param, result]);
                }
              });
            });
          })
        );
        (async () => {
          const ret = await mapAllTasksWithConcurrencyLimit(1, tasks3);
          const retAll = ret.map((e2) => unwrapTaskResult(e2));
          await appendPurgeSeqs(
            self3,
            retAll.filter((e2) => "ok" in e2[1]).map((e2) => e2[0])
          );
          const result = Object.fromEntries(retAll.map((e2) => [e2[0][0], e2[1]]));
          return result;
        })().then((result) => callback(void 0, result)).catch((error2) => callback(error2));
      }
    );
  }
});

// src/sync/FridayServiceHub.ts
var import_obsidian3, FridayAPIService, FridayPathService, FridayDatabaseService, FridayDatabaseEventService, FridayReplicatorService, FridayReplicationService, FridayAppLifecycleService, FridayServiceHub, FridayFileProcessingService, FridayRemoteService, FridayConflictService, FridaySettingService, FridayTweakValueService, FridayVaultService, FridayTestService, FridayUIService;
var init_FridayServiceHub = __esm({
  "src/sync/FridayServiceHub.ts"() {
    "use strict";
    import_obsidian3 = require("obsidian");
    init_ServiceHub();
    init_Services();
    init_ServiceBackend();
    init_logger();
    init_utils2();
    init_encryption2();
    init_compress();
    init_types();
    init_hiddenFileUtils();
    init_FridayStorageEventManager();
    init_sameChangePairs();
    init_pouchdb_browser();
    FridayAPIService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
      }
      getCustomFetchHandler() {
        return {
          handle: async (request) => {
            const response = await fetch(request.url, {
              method: request.method,
              headers: request.headers,
              body: request.body
            });
            return { response };
          }
        };
      }
      addLog(message, level, key4) {
        Logger(`[${key4}] ${message}`, level);
      }
      isMobile() {
        return import_obsidian3.Platform.isMobile;
      }
      async showWindow(type) {
      }
      getAppID() {
        return "friday-sync";
      }
      isLastPostFailedDueToPayloadSize() {
        return false;
      }
      getPlatform() {
        return import_obsidian3.Platform.isDesktop ? "desktop" : "mobile";
      }
      getAppVersion() {
        return "1.0.0";
      }
      getPluginVersion() {
        return "0.1.0";
      }
    };
    FridayPathService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
      }
      id2path(id, entry, stripPrefix) {
        return this.core.id2path(id, entry, stripPrefix);
      }
      async path2id(filename, prefix) {
        return this.core.path2id(filename, prefix);
      }
    };
    FridayDatabaseService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this._isDatabaseReady = false;
        this.core = core;
      }
      createPouchDBInstance(name, options) {
        return new index_es_default(name, {
          adapter: "idb",
          ...options
        });
      }
      openSimpleStore(kind) {
        return {
          get: async (key4) => {
            const value2 = localStorage.getItem(`friday-${kind}-${key4}`);
            return value2 ? JSON.parse(value2) : void 0;
          },
          set: async (key4, value2) => {
            localStorage.setItem(`friday-${kind}-${key4}`, JSON.stringify(value2));
          },
          delete: async (key4) => {
            localStorage.removeItem(`friday-${kind}-${key4}`);
          },
          keys: async () => {
            const prefix = `friday-${kind}-`;
            const keys2 = [];
            for (let i = 0; i < localStorage.length; i++) {
              const key4 = localStorage.key(i);
              if (key4 == null ? void 0 : key4.startsWith(prefix)) {
                keys2.push(key4.substring(prefix.length));
              }
            }
            return keys2;
          },
          close: () => {
          }
        };
      }
      async openDatabase() {
        this._isDatabaseReady = true;
        return true;
      }
      async resetDatabase() {
        this._isDatabaseReady = false;
        return true;
      }
      isDatabaseReady() {
        return this._isDatabaseReady;
      }
    };
    FridayDatabaseEventService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
        [this.onUnloadDatabase, this.handleOnUnloadDatabase] = this._all("dbUnload");
        [this.onCloseDatabase, this.handleOnCloseDatabase] = this._all("dbClose");
        [this.onDatabaseInitialisation, this.handleOnDatabaseInitialisation] = this._firstFailure("databaseInitialisation");
        [this.onDatabaseInitialised, this.handleDatabaseInitialised] = this._firstFailure("databaseInitialised");
        [this.onResetDatabase, this.handleOnResetDatabase] = this._firstFailure("resetDatabase");
      }
      async initialiseDatabase(showingNotice, reopenDatabase, ignoreSuspending) {
        return true;
      }
    };
    FridayReplicatorService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
        [this.getNewReplicator, this.handleGetNewReplicator] = this._firstOrUndefined("getNewReplicator");
        [this.onCloseActiveReplication, this.handleOnCloseActiveReplication] = this._first("closeActiveReplication");
      }
      getActiveReplicator() {
        return this.core.replicator || void 0;
      }
    };
    FridayReplicationService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.processingQueue = [];
        this.isProcessing = false;
        // 实时同步活动统计
        this.syncActivityStarted = false;
        this.totalProcessed = 0;
        if (!core) {
          console.error("[Friday Sync] CRITICAL: FridayReplicationService created with undefined core!");
          throw new Error("FridayReplicationService requires a valid core instance");
        }
        this.core = core;
        [this.processOptionalSynchroniseResult, this.handleProcessOptionalSynchroniseResult] = this._first("processOptionalSynchroniseResult");
        [this.processSynchroniseResult, this.handleProcessSynchroniseResult] = this._first("processSynchroniseResult");
        [this.processVirtualDocument, this.handleProcessVirtualDocuments] = this._first("processVirtualDocuments");
        [this.onBeforeReplicate, this.handleBeforeReplicate] = this._firstFailure("beforeReplicate");
        [this.checkConnectionFailure, this.handleCheckConnectionFailure] = this._first("connectionHasFailure");
        this.handleProcessSynchroniseResult(this.defaultProcessSynchroniseResult.bind(this));
      }
      // ==================== Document Processing (Aligned with LiveSync) ====================
      // Note: Following LiveSync's approach - no custom conflict resolution
      // Conflict handling is done by LiveSync's core ConflictChecker module
      /**
       * Default handler for processing synchronized documents
       * Writes the document content to the vault
       * 
       * This follows the same pattern as livesync's ModuleFileHandler.dbToStorage
       * Completely aligned with livesync's approach - no custom conflict resolution
       */
      async defaultProcessSynchroniseResult(doc) {
        var _a6, _b4, _c2, _d;
        try {
          if (!this.core) {
            console.error("[Friday Sync] Critical error: this.core is undefined in defaultProcessSynchroniseResult");
            return false;
          }
          if (!this.core.settings) {
            console.error("[Friday Sync] Critical error: this.core.settings is undefined");
            return false;
          }
          if (this.core.settings.suspendParseReplicationResult) {
            return true;
          }
          const isInternalFile = isInternalMetadata(doc._id) || doc.path && isInternalMetadata(doc.path);
          if (isInternalFile) {
            const hiddenFileSync = this.core.hiddenFileSync;
            if (hiddenFileSync && hiddenFileSync.isThisModuleEnabled()) {
              return await hiddenFileSync.processReplicationResult(doc);
            }
            return true;
          }
          const path8 = doc.path;
          if (!path8) {
            return false;
          }
          const storageEventManager = this.core.storageEventManager;
          const isDeleted2 = doc._deleted === true || "deleted" in doc && doc.deleted === true;
          if (storageEventManager) {
            storageEventManager.markFileProcessing(path8);
          }
          try {
            if (isDeleted2) {
              const vault2 = this.core.app.vault;
              const existingFile2 = vault2.getAbstractFileByPath(path8);
              if (existingFile2 && (existingFile2 instanceof import_obsidian3.TFile || existingFile2 instanceof import_obsidian3.TFolder)) {
                await this.deleteVaultItem(existingFile2);
              }
              return true;
            }
            const localDB = this.core.localDatabase;
            if (!localDB) {
              console.error("[Friday Sync] Local database not available");
              return false;
            }
            const fullEntry = await localDB.getDBEntryFromMeta(doc, false, true);
            if (!fullEntry) {
              console.error(`[Friday Sync] Could not get full entry for:`, {
                docId: doc._id,
                docPath: doc.path,
                docType: doc.type,
                docSize: doc.size,
                docChildren: (_b4 = (_a6 = doc.children) == null ? void 0 : _a6.length) != null ? _b4 : 0
              });
              return false;
            }
            const content = readContent(fullEntry);
            const isText = isTextDocument(fullEntry);
            const vault = this.core.app.vault;
            const existingFile = vault.getAbstractFileByPath(path8);
            if (existingFile && existingFile instanceof import_obsidian3.TFile) {
              let shouldWrite = false;
              const storageFilePath = path8.startsWith("h:") || path8.startsWith("i:") ? path8.substring(2) : path8;
              const localMtime = existingFile.stat.mtime;
              const remoteMtime = fullEntry.mtime || 0;
              const freshnessResult = compareFileFreshness(
                { path: storageFilePath, mtime: localMtime },
                { path: storageFilePath, mtime: remoteMtime }
              );
              switch (freshnessResult) {
                case "EVEN":
                  Logger(`File mtimes are equivalent (marked or same), skip write: ${path8}`, LOG_LEVEL_VERBOSE);
                  return true;
                case "BASE_IS_NEW":
                case "TARGET_IS_NEW":
                  shouldWrite = true;
                  break;
              }
              if (shouldWrite) {
                try {
                  let localContent;
                  if (isText) {
                    localContent = await vault.read(existingFile);
                  } else {
                    localContent = await vault.readBinary(existingFile);
                  }
                  const isSame = await isDocContentSame(content, localContent);
                  if (isSame) {
                    markChangesAreSame2(storageFilePath, localMtime, remoteMtime);
                    Logger(`Content same, marked and skip write: ${path8}`, LOG_LEVEL_VERBOSE);
                    return true;
                  } else {
                    unmarkChanges2(storageFilePath);
                  }
                } catch (error2) {
                  Logger(`Content comparison failed for ${path8}, will write: ${error2}`, LOG_LEVEL_VERBOSE);
                  shouldWrite = true;
                }
              }
              if (!shouldWrite) {
                Logger(`Skipped write for ${path8} (no changes)`, LOG_LEVEL_VERBOSE);
                return true;
              }
            }
            const dirPath = path8.substring(0, path8.lastIndexOf("/"));
            if (dirPath) {
              const existingDir = vault.getAbstractFileByPath(dirPath);
              if (!existingDir) {
                await vault.createFolder(dirPath).catch(() => {
                });
              }
            }
            if (existingFile) {
              if (isText) {
                await vault.modify(existingFile, content);
              } else {
                await vault.modifyBinary(existingFile, content);
              }
            } else {
              if (isText) {
                await vault.create(path8, content);
              } else {
                await vault.createBinary(path8, content);
              }
            }
            const writtenFile = vault.getAbstractFileByPath(path8);
            if (writtenFile && storageEventManager && "stat" in writtenFile) {
              const stat = writtenFile.stat;
              storageEventManager.touch(path8, stat.mtime, stat.size);
            }
            const shortId = ((_c2 = doc._id) == null ? void 0 : _c2.substring(0, 8)) || "unknown";
            const shortRev = ((_d = doc._rev) == null ? void 0 : _d.substring(0, 5)) || "new";
            Logger(`Processing ${path8} (${shortId} :${shortRev}) : Done`, LOG_LEVEL_INFO);
            return true;
          } finally {
            if (storageEventManager) {
              setTimeout(() => {
                storageEventManager.unmarkFileProcessing(path8);
              }, 1e3);
            }
          }
        } catch (error2) {
          console.error(`[Friday Sync] Error processing document:`, {
            error: error2,
            docId: doc._id,
            docPath: doc.path,
            docType: doc.type,
            docRev: doc._rev,
            docSize: doc.size,
            errorMessage: error2 instanceof Error ? error2.message : String(error2),
            errorStack: error2 instanceof Error ? error2.stack : void 0
          });
          return false;
        }
      }
      /**
       * Delete a vault item (file or folder) recursively
       * Copied from LiveSync's ModuleFileAccessObsidian.__deleteVaultItem
       * 
       * This implementation:
       * 1. Deletes the file/folder (using trash or permanent delete based on settings)
       * 2. After deletion, checks if parent folder is empty (dir.children.length === 0)
       * 3. If empty and doNotDeleteFolder is false, recursively deletes the parent folder
       */
      async deleteVaultItem(file) {
        const settings = this.core.settings;
        const vault = this.core.app.vault;
        const dir = file.parent;
        if (settings.trashInsteadDelete) {
          await vault.trash(file, false);
        } else {
          await vault.delete(file);
        }
        Logger(`xxx <- STORAGE (deleted) ${file.path}`, LOG_LEVEL_VERBOSE);
        if (dir) {
          Logger(`files: ${dir.children.length}`, LOG_LEVEL_VERBOSE);
          if (dir.children.length === 0) {
            if (!settings.doNotDeleteFolder) {
              Logger(
                `All files under the parent directory (${dir.path}) have been deleted, so delete this one.`,
                LOG_LEVEL_VERBOSE
              );
              await this.deleteVaultItem(dir);
            }
          }
        }
      }
      parseSynchroniseResult(docs) {
        if (this.core.settings.suspendParseReplicationResult) {
          return;
        }
        let queuedCount = 0;
        for (const doc of docs) {
          if (doc._id.startsWith("h:")) continue;
          if (doc._id === "_design") continue;
          if (doc.type === "versioninfo") continue;
          if (doc.type === "milestoneinfo") continue;
          if (doc.type === "nodeinfo") continue;
          if (doc._id.startsWith("_")) continue;
          if (doc.type === "notes" || doc.type === "newnote" || doc.type === "plain") {
            this.processingQueue.push(doc);
            queuedCount++;
          }
        }
        if (queuedCount > 0 && this.core.onFileProgress) {
          if (this.completeTimer) {
            clearTimeout(this.completeTimer);
            this.completeTimer = void 0;
          }
          if (!this.syncActivityStarted) {
            this.syncActivityStarted = true;
            this.totalProcessed = 0;
            this.core.onFileProgress({
              type: "sync_activity_start"
            });
          }
        }
        if (!this.isProcessing) {
          this.processQueue();
        }
      }
      async processQueue() {
        if (this.isProcessing) return;
        this.isProcessing = true;
        try {
          while (this.processingQueue.length > 0) {
            const doc = this.processingQueue.shift();
            if (!doc) continue;
            try {
              const result = await this.processSynchroniseResult(doc);
              if (result) {
                this.totalProcessed++;
                if (this.core.onFileProgress) {
                  this.core.onFileProgress({
                    type: "sync_activity_progress",
                    processedFiles: this.totalProcessed
                  });
                }
              }
            } catch (error2) {
              console.error(`[Friday Sync] Error processing doc ${doc._id}:`, {
                error: error2,
                docPath: doc.path,
                docType: doc.type,
                errorMessage: error2 instanceof Error ? error2.message : String(error2),
                errorStack: error2 instanceof Error ? error2.stack : void 0
              });
            }
          }
          this.scheduleComplete();
        } finally {
          this.isProcessing = false;
        }
      }
      /**
       * 延迟发送同步完成事件
       * 使用 debounce 机制：只有当队列空闲 2 秒后，才认为同步真正完成
       */
      scheduleComplete() {
        if (this.completeTimer) {
          clearTimeout(this.completeTimer);
        }
        this.completeTimer = setTimeout(() => {
          if (this.processingQueue.length === 0 && this.syncActivityStarted && this.core.onFileProgress) {
            this.core.onFileProgress({
              type: "sync_activity_complete",
              totalProcessed: this.totalProcessed
            });
            this.syncActivityStarted = false;
            this.totalProcessed = 0;
            this.completeTimer = void 0;
          }
        }, 2e3);
      }
      async isReplicationReady(showMessage) {
        return this.core.localDatabase !== null && this.core.replicator !== null;
      }
      /**
       * Trigger a replication (one-shot sync).
       * In LiveSync mode, this will run alongside the continuous replication.
       * This is typically called when the user wants to manually trigger a sync.
       */
      async replicate(showMessage) {
        const replicator = this.core.replicator;
        if (replicator) {
          const status = this.core.replicationStat.value.syncStatus;
          if (status === "CONNECTED" || status === "STARTED") {
            return true;
          }
          return this.core.startSync(false);
        }
        return false;
      }
      /**
       * Trigger replication by event (e.g., file saved).
       * In LiveSync mode, changes are automatically synced, so this may be a no-op.
       */
      async replicateByEvent(showMessage) {
        return this.replicate(showMessage);
      }
    };
    FridayAppLifecycleService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
        this._isReady = false;
        this._isSuspended = false;
        this._hasUnloaded = false;
        [this.onLayoutReady, this.handleLayoutReady] = this._firstFailure("layoutReady");
        [this.onFirstInitialise, this.handleFirstInitialise] = this._firstFailure("firstInitialise");
        [this.onReady, this.handleOnReady] = this._firstFailure("appReady");
        [this.onWireUpEvents, this.handleOnWireUpEvents] = this._firstFailure("wireUpEvents");
        [this.onLoad, this.handleOnLoad] = this._firstFailure("appLoad");
        [this.onAppUnload, this.handleOnAppUnload] = this._broadcast("appUnload");
        [this.onScanningStartupIssues, this.handleOnScanningStartupIssues] = this._all("scanStartupIssues");
        [this.onInitialise, this.handleOnInitialise] = this._firstFailure("appInitialise");
        [this.onLoaded, this.handleOnLoaded] = this._firstFailure("appLoaded");
        [this.onSettingLoaded, this.handleOnSettingLoaded] = this._firstFailure("applyStartupLoaded");
        [this.onBeforeUnload, this.handleOnBeforeUnload] = this._all("beforeUnload");
        [this.onUnload, this.handleOnUnload] = this._all("unload");
        [this.onSuspending, this.handleOnSuspending] = this._firstFailure("beforeSuspendProcess");
        [this.onResuming, this.handleOnResuming] = this._firstFailure("onResumeProcess");
        [this.onResumed, this.handleOnResumed] = this._firstFailure("afterResumeProcess");
        [this.getUnresolvedMessages, this.reportUnresolvedMessages] = this._collectBatch("unresolvedMessages");
      }
      performRestart() {
      }
      askRestart(message) {
      }
      scheduleRestart() {
      }
      isSuspended() {
        return this._isSuspended;
      }
      setSuspended(suspend) {
        this._isSuspended = suspend;
      }
      isReady() {
        return this._isReady;
      }
      markIsReady() {
        this._isReady = true;
      }
      resetIsReady() {
        this._isReady = false;
      }
      hasUnloaded() {
        return this._hasUnloaded;
      }
      isReloadingScheduled() {
        return false;
      }
    };
    FridayServiceHub = class extends ServiceHub {
      constructor(core) {
        const backend = new ServiceBackend();
        super();
        this.backend = backend;
        this.core = core;
        this._api = new FridayAPIService(backend, core);
        this._path = new FridayPathService(backend, core);
        this._database = new FridayDatabaseService(backend, core);
        this._databaseEvents = new FridayDatabaseEventService(backend);
        this._replicator = new FridayReplicatorService(backend, core);
        this._fileProcessing = new FridayFileProcessingService(backend);
        this._replication = new FridayReplicationService(backend, core);
        this._remote = new FridayRemoteService(backend, core);
        this._conflict = new FridayConflictService(backend);
        this._appLifecycle = new FridayAppLifecycleService(backend);
        this._setting = new FridaySettingService(backend, core);
        this._tweakValue = new FridayTweakValueService(backend);
        this._vault = new FridayVaultService(backend, core);
        this._test = new FridayTestService(backend);
        this._ui = new FridayUIService();
        [
          this._api,
          this._path,
          this._database,
          this._databaseEvents,
          this._replicator,
          this._fileProcessing,
          this._replication,
          this._remote,
          this._conflict,
          this._appLifecycle,
          this._setting,
          this._tweakValue,
          this._vault,
          this._test,
          this._ui
        ].forEach((service) => service.setServices(this));
      }
    };
    FridayFileProcessingService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
        [this.processFileEvent, this.handleProcessFileEvent] = this._first("processFileEvent");
        [this.processOptionalFileEvent, this.handleOptionalFileEvent] = this._first("processOptionalFileEvent");
        [this.commitPendingFileEvents, this.handleCommitPendingFileEvents] = this._firstFailure("commitPendingFileEvents");
      }
    };
    FridayRemoteService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
      }
      async connect(uri, auth, disableRequestURI, passphrase, useDynamicIterationCount, performSetup, skipInfo, compression, customHeaders, useRequestAPI, getPBKDF2Salt) {
        try {
          if (!uri || uri.trim() === "") {
            return "Remote URI is empty";
          }
          const conf = {
            adapter: "http",
            skip_setup: !performSetup,
            fetch: async (url, opts) => {
              const headers = new Headers(opts == null ? void 0 : opts.headers);
              if (customHeaders) {
                for (const [key4, value2] of Object.entries(customHeaders)) {
                  if (key4 && value2) {
                    headers.append(key4, value2);
                  }
                }
              }
              if ("username" in auth && auth.username && auth.password) {
                const credentials = btoa(`${auth.username}:${auth.password}`);
                headers.append("Authorization", `Basic ${credentials}`);
              }
              const DEFAULT_HTTP_TIMEOUT = 3e4;
              const controller = new AbortController();
              const timeoutId = setTimeout(() => controller.abort(), DEFAULT_HTTP_TIMEOUT);
              try {
                const response = await fetch(url, {
                  ...opts,
                  headers,
                  signal: controller.signal
                });
                clearTimeout(timeoutId);
                return response;
              } catch (ex) {
                clearTimeout(timeoutId);
                if (ex.name === "AbortError") {
                  console.error("[Friday Sync] Request timeout after", DEFAULT_HTTP_TIMEOUT, "ms:", url);
                  throw new Error(`Request timeout after ${DEFAULT_HTTP_TIMEOUT}ms`);
                }
                console.error("[Friday Sync] Fetch error:", ex);
                throw ex;
              }
            }
          };
          const db = new index_es_default(uri, conf);
          replicationFilter(db, compression);
          disableEncryption();
          if (passphrase !== false && typeof passphrase === "string" && passphrase !== "") {
            const settings = this.core.getSettings();
            const e2eeAlgorithm = settings.E2EEAlgorithm || E2EEAlgorithms.V2;
            enableEncryption(
              db,
              passphrase,
              useDynamicIterationCount,
              false,
              // migrationDecrypt
              getPBKDF2Salt,
              e2eeAlgorithm
            );
          }
          if (skipInfo) {
            return { db, info: { db_name: "", doc_count: 0, update_seq: "" } };
          }
          try {
            const info3 = await db.info();
            return { db, info: info3 };
          } catch (ex) {
            const msg = `${ex == null ? void 0 : ex.name}:${ex == null ? void 0 : ex.message}`;
            console.error("[Friday Sync] Failed to get database info:", msg);
            return msg;
          }
        } catch (ex) {
          const msg = `Connection error: ${(ex == null ? void 0 : ex.message) || ex}`;
          console.error("[Friday Sync]", msg);
          return msg;
        }
      }
      async replicateAllToRemote(showingNotice) {
        return this.core.pushToServer();
      }
      async replicateAllFromRemote(showingNotice) {
        return this.core.pullFromServer();
      }
      async markLocked(lockByClean) {
      }
      async markUnlocked() {
      }
      async markResolved() {
      }
      async tryResetDatabase() {
      }
      async tryCreateDatabase() {
      }
    };
    FridayConflictService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
        [this.resolveByUserInteraction, this.handleResolveByUserInteraction] = this._first("resolveByUserInteraction");
        [this.getOptionalConflictCheckMethod, this.handleGetOptionalConflictCheckMethod] = this._first("getOptionalConflictCheckMethod");
      }
      async queueCheckForIfOpen(path8) {
      }
      async queueCheckFor(path8) {
      }
      async ensureAllProcessed() {
        return true;
      }
      async resolveByDeletingRevision(path8, deleteRevision, title) {
        return "MISSING_OR_ERROR";
      }
      async resolve(filename) {
      }
      async resolveByNewest(filename) {
        return true;
      }
    };
    FridaySettingService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
        [this.onBeforeRealiseSetting, this.handleBeforeRealiseSetting] = this._firstFailure("beforeRealiseSetting");
        [this.onSettingRealised, this.handleSettingRealised] = this._firstFailure("afterRealiseSetting");
        [this.onRealiseSetting, this.handleOnRealiseSetting] = this._firstFailure("realiseSetting");
        [this.suspendAllSync, this.handleSuspendAllSync] = this._all("suspendAllSync");
        [this.suspendExtraSync, this.handleSuspendExtraSync] = this._all("suspendExtraSync");
        [this.suggestOptionalFeatures, this.handleSuggestOptionalFeatures] = this._all("suggestOptionalFeatures");
        [this.enableOptionalFeature, this.handleEnableOptionalFeature] = this._all("enableOptionalFeature");
      }
      clearUsedPassphrase() {
      }
      async realiseSetting() {
      }
      async decryptSettings(settings) {
        return settings;
      }
      async adjustSettings(settings) {
        return settings;
      }
      async loadSettings() {
      }
      getDeviceAndVaultName() {
        return "friday-device";
      }
      setDeviceAndVaultName(name) {
      }
      saveDeviceAndVaultName() {
      }
      async saveSettingData() {
      }
      currentSettings() {
        return this.core.getSettings();
      }
      shouldCheckCaseInsensitively() {
        return false;
      }
      async importSettings(imported) {
        return true;
      }
    };
    FridayTweakValueService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
      }
      async fetchRemotePreferred(trialSetting) {
        return false;
      }
      async checkAndAskResolvingMismatched(preferred) {
        return [false, false];
      }
      async askResolvingMismatched(preferredSource) {
        return "OK";
      }
      async checkAndAskUseRemoteConfiguration(settings) {
        return { result: false, requireFetch: false };
      }
      async askUseRemoteConfiguration(trialSetting, preferred) {
        return { result: false, requireFetch: false };
      }
    };
    FridayVaultService = class extends ServiceBase {
      constructor(backend, core) {
        super(backend);
        this.core = core;
      }
      vaultName() {
        return "friday-vault";
      }
      getVaultName() {
        return "friday-vault";
      }
      async scanVault(showingNotice, ignoreSuspending) {
        return true;
      }
      /**
       * Check if file is ignored by ignore patterns
       */
      async isIgnoredByIgnoreFile(file) {
        const filepath = typeof file === "string" ? file : file.path;
        return await this.core.isIgnoredByIgnoreFile(filepath);
      }
      markFileListPossiblyChanged() {
      }
      /**
       * Check if file is a valid sync target (livesync compatible)
       */
      async isTargetFile(file, keepFileCheckList) {
        const filepath = typeof file === "string" ? file : file.path;
        return await this.core.isTargetFile(filepath);
      }
      isFileSizeTooLarge(size) {
        return size > 100 * 1024 * 1024;
      }
      getActiveFilePath() {
        return void 0;
      }
      isStorageInsensitive() {
        return false;
      }
    };
    FridayTestService = class extends ServiceBase {
      constructor(backend) {
        super(backend);
        [this.test, this.handleTest] = this._firstFailure("test");
        [this.testMultiDevice, this.handleTestMultiDevice] = this._firstFailure("testMultiDevice");
      }
      addTestResult(name, key4, result, summary, message) {
      }
    };
    FridayUIService = class extends HubService {
      get dialogManager() {
        throw new Error("Dialog manager not implemented");
      }
      async promptCopyToClipboard(title, value2) {
        return false;
      }
      async showMarkdownDialog(title, contentMD, buttons) {
        return false;
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/bureau/PaceMaker.js
var PaceMaker;
var init_PaceMaker = __esm({
  "node_modules/octagonal-wheels/dist/bureau/PaceMaker.js"() {
    PaceMaker = class {
      constructor(interval) {
        Object.defineProperty(this, "_interval", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_minimumNext", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._interval = interval;
      }
      /**
       * Change the interval of the pacing.
       * This will reset the minimum next pacing time.
       * @param interval
       */
      changeInterval(interval) {
        if (interval !== this._interval) {
          this._interval = interval;
          this._minimumNext = void 0;
        }
      }
      /**
       * Mark the current time as the basis for the next pacing.
       * @param now
       */
      mark(now = Date.now()) {
        if (this._minimumNext === void 0) {
          this._minimumNext = now + this._interval;
        } else {
          this._minimumNext = Math.max(this._minimumNext + this._interval, now + this._interval);
        }
      }
      _getPaced(doMark) {
        const now = Date.now();
        const prevMinimum = this._minimumNext;
        if (doMark)
          this.mark(now);
        if (prevMinimum !== void 0) {
          const shouldWait = prevMinimum - now;
          if (shouldWait > 0) {
            return new Promise((resolve) => setTimeout(() => {
              resolve();
            }, shouldWait));
          }
        }
        return Promise.resolve();
      }
      /**
       * The promise for waiting paced
       */
      get paced() {
        return this._getPaced(true);
      }
      /**
       * The promise for waiting paced since the last mark
       */
      get pacedSinceMark() {
        return this._getPaced(false);
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/bureau/Clerk.js
var ClerkState, SENTINEL_FINISHED, SENTINEL_FLUSH, ClerkBase, Clerk, ClerkGroup;
var init_Clerk = __esm({
  "node_modules/octagonal-wheels/dist/bureau/Clerk.js"() {
    init_logger();
    init_promises();
    init_Inbox();
    (function(ClerkState2) {
      ClerkState2["IDLE"] = "idle";
      ClerkState2["DISPOSED"] = "disposed";
      ClerkState2["WORKING"] = "working";
      ClerkState2["STALLED"] = "not-started";
    })(ClerkState || (ClerkState = {}));
    SENTINEL_FINISHED = Symbol("finished");
    SENTINEL_FLUSH = Symbol("flush");
    ClerkBase = class {
      get state() {
        return this._state;
      }
      constructor(params) {
        Object.defineProperty(this, "_inbox", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_state", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: ClerkState.STALLED
        });
        Object.defineProperty(this, "_totalProcessed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_totalSuccess", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_totalFailed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_totalFetched", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_disposed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "_disposePromise", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: promiseWithResolvers()
        });
        Object.defineProperty(this, "_onProgress", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        const { name, assigned } = params;
        this._inbox = assigned;
        this._name = name != null ? name : this.constructor.name;
        void yieldMicrotask().then(() => this._mainLoop());
        void this._inbox.onDisposed.then(() => this.dispose());
      }
      get stateDetail() {
        const hasStarted = this._totalFetched != 0;
        const hasAnyUnprocessed = this._totalFetched != this._totalProcessed;
        const inboxDetail = this._inbox.state;
        const hasAnyInInbox = inboxDetail.size != 0;
        const isBusy = hasAnyInInbox || hasAnyUnprocessed;
        return {
          totalFetched: this._totalFetched,
          inboxDetail: this._inbox.state,
          totalProcessed: this._totalProcessed,
          state: this._state,
          hasStarted,
          isBusy
        };
      }
      onProgress() {
        var _a6;
        try {
          (_a6 = this._onProgress) == null ? void 0 : _a6.call(this, this.stateDetail);
        } catch (e2) {
        }
      }
      setOnProgress(callback) {
        this._onProgress = callback;
      }
      async _mainLoop() {
        var _a6;
        this._state = ClerkState.STALLED;
        this.onProgress();
        await yieldMicrotask();
        do {
          this._state = ClerkState.IDLE;
          this.onProgress();
          try {
            const item = await this._inbox.pick(void 0, [this._disposePromise.promise]);
            if (item === SENTINEL_FLUSH || item === SENTINEL_FINISHED) {
              await ((_a6 = this._onSentinel) == null ? void 0 : _a6.call(this, item));
              continue;
            }
            if (item === NOT_AVAILABLE) {
              if (this._inbox.isDisposed) {
                this._state = ClerkState.DISPOSED;
                break;
              }
              continue;
            }
            this._totalFetched++;
            this._state = ClerkState.WORKING;
            this.onProgress();
            try {
              await this._onPick(item);
              this._totalSuccess++;
            } catch (ex) {
              this._totalFailed++;
              Logger("Error on processing job on clerk");
              Logger(ex, LOG_LEVEL_VERBOSE);
            }
            this._totalProcessed++;
            this.onProgress();
          } catch (ex) {
            if (ex instanceof Error && ex.message !== DISPOSE_ERROR) {
              Logger("Error on picking item on clerk");
              Logger(ex, LOG_LEVEL_VERBOSE);
            }
          }
        } while (!this._inbox.isDisposed && !this._disposed);
        this._state = ClerkState.IDLE;
        if (!this._disposed) {
          this.dispose();
        } else {
          this._state = ClerkState.DISPOSED;
        }
        this.onProgress();
      }
      dispose() {
        this._disposePromise.resolve();
        this._disposed = true;
        this._state = ClerkState.DISPOSED;
      }
      get onDisposed() {
        return this._disposePromise.promise;
      }
    };
    Clerk = class extends ClerkBase {
      async _onPick(item) {
        return await this._job(item);
      }
      constructor(params) {
        super(params);
        Object.defineProperty(this, "_job", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._job = params.job;
      }
    };
    ClerkGroup = class {
      constructor(params) {
        var _a6;
        Object.defineProperty(this, "_clerks", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_nameBase", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_assigned", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_hiredCount", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_job", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_instantiate", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        const { assigned, job, instantiate, initialMemberCount } = params;
        this._assigned = assigned;
        this._instantiate = instantiate;
        this._job = job;
        this._nameBase = (_a6 = params.name) != null ? _a6 : this.constructor.name;
        this._clerks = [];
        for (let i = 0; i < initialMemberCount; i++) {
          this.hireMember({ assigned, job });
        }
      }
      hireMember(params) {
        const name = `${this._nameBase}-${this._hiredCount++}`;
        const clerk = this._instantiate({
          name,
          assigned: params.assigned,
          job: params.job
        });
        this._clerks.push(clerk);
      }
      fireMember() {
        const clerk = this._clerks.pop();
        clerk == null ? void 0 : clerk.dispose();
      }
      adjustMemberCount(count) {
        const diff = count - this._clerks.length;
        if (diff > 0) {
          for (let i = 0; i < diff; i++) {
            this.hireMember({ assigned: this._assigned, job: this._job });
          }
        } else if (diff < 0) {
          for (let i = 0; i < -diff; i++) {
            this.fireMember();
          }
        }
      }
      get stateDetail() {
        const states = this._clerks.map((clerk) => clerk.stateDetail);
        const totalFetched = states.reduce((acc, state2) => acc + state2.totalFetched, 0);
        const totalProcessed = states.reduce((acc, state2) => acc + state2.totalProcessed, 0);
        const isBusy = states.some((state2) => state2.isBusy);
        const hasStarted = states.some((state2) => state2.hasStarted);
        const inboxDetail = this._assigned.state;
        return {
          totalFetched,
          totalProcessed,
          inboxDetail,
          isBusy,
          hasStarted,
          state: ClerkState.IDLE
        };
      }
      get freeMembers() {
        return this._clerks.filter((clerk) => clerk.state === ClerkState.IDLE).length;
      }
      dispose() {
        this._clerks.forEach((clerk) => clerk.dispose());
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/concurrency/processor_v2.js
var allRunningProcessors, QueueProcessor;
var init_processor_v2 = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/processor_v2.js"() {
    init_logger();
    init_const();
    init_promises();
    init_EventHub();
    init_PaceMaker();
    init_Clerk();
    init_Inbox();
    allRunningProcessors = /* @__PURE__ */ new Set([]);
    QueueProcessor = class {
      get nowProcessing() {
        return this.processingEntities;
      }
      get totalNowProcessing() {
        var _a6;
        return this.nowProcessing + (((_a6 = this._pipeTo) == null ? void 0 : _a6.totalNowProcessing) || 0);
      }
      get remaining() {
        return this._queue.length + this.processingEntities + this.waitingEntries;
      }
      get totalRemaining() {
        var _a6;
        return this.remaining + (((_a6 = this._pipeTo) == null ? void 0 : _a6.totalRemaining) || 0);
      }
      updateStatus(setFunc) {
        setFunc();
        this._updateReactiveSource();
      }
      suspend() {
        this._isSuspended = true;
        this._hub.emitEvent("tickSuspended");
        return this;
      }
      resume() {
        this._isSuspended = false;
        this._hub.emitEvent("tickResumed");
        return this;
      }
      resumePipeLine() {
        var _a6;
        (_a6 = this._pipeTo) == null ? void 0 : _a6.resumePipeLine();
        this.resume();
        return this;
      }
      startPipeline() {
        this.root.resumePipeLine();
        return this;
      }
      get root() {
        if (this._root === void 0) {
          return this;
        }
        return this._root;
      }
      _initEventHub() {
        this._hub.onEvent("tickResumed", () => this._run());
      }
      async _waitFor(keys2, timeout) {
        const items = keys2.map((key4) => {
          const p = promiseWithResolvers();
          const releaser = this._hub.onEvent(key4, () => {
            p.resolve(key4);
          });
          p.promise = p.promise.finally(() => {
            releaser();
          });
          return p;
        });
        const timer = timeout ? cancelableDelay(timeout) : void 0;
        const tasks3 = [...items.map((i) => i.promise), ...timer ? [timer.promise] : []];
        const ret = await Promise.race(tasks3);
        items.forEach((i) => i.resolve(void 0));
        return ret;
      }
      _triggerTickDelay() {
        if (!this._delayTimer) {
          this._delayTimer = setTimeout(() => {
            this._hub.emitEvent("tickDelayTimeout");
            this._delayTimer = void 0;
          });
        }
      }
      _clearTickDelay() {
        if (this._delayTimer) {
          clearTimeout(this._delayTimer);
          this._delayTimer = void 0;
        }
      }
      _notifyIfIdle() {
        return this.root.__notifyIfIdle();
      }
      __notifyIfIdle() {
        if (this._processCount == 0 && !this._canCollectBatch()) {
          this._hub.emitEvent("idle");
        }
        if (this._pipeTo) {
          this._pipeTo.__notifyIfIdle();
        }
      }
      _onTick() {
        if (!this._canCollectBatch()) {
          this._notifyIfIdle();
          this._clearTickDelay();
          this._hub.emitEvent("tickEmpty");
          return;
        }
        if (this._nextProcessNeedsImmediate) {
          this._clearTickDelay();
          this._nextProcessNeedsImmediate = false;
          this._hub.emitEvent("tickImmediate");
          return;
        }
        if (this._queue.length > this.yieldThreshold) {
          this._clearTickDelay();
          this._hub.emitEvent("yielded");
        } else {
          if (!this.delay) {
            this._clearTickDelay();
            this._hub.emitEvent("tickDelayTimeout");
            return;
          }
          if (this._delayTimer) ;
          else {
            this._triggerTickDelay();
          }
        }
      }
      constructor(processor, params, items, enqueueProcessor) {
        var _a6, _b4, _c2, _d, _e, _f, _g;
        Object.defineProperty(this, "_queue", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "_processor", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_enqueueProcessor", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (queue2, entity) => (queue2.push(entity), queue2)
        });
        Object.defineProperty(this, "_isSuspended", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: true
        });
        Object.defineProperty(this, "_nextProcessNeedsImmediate", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "_pipeTo", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_root", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_remainingReactiveSource", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_totalRemainingReactiveSource", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_processingEntitiesReactiveSource", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_keepResultUntilDownstreamConnected", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "_keptResult", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "_runOnUpdateBatch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: () => {
          }
        });
        Object.defineProperty(this, "concurrentLimit", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 1
        });
        Object.defineProperty(this, "batchSize", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 1
        });
        Object.defineProperty(this, "yieldThreshold", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 1
        });
        Object.defineProperty(this, "delay", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "maintainDelay", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "interval", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "processingEntities", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "waitingEntries", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        Object.defineProperty(this, "_hub", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new EventHub()
        });
        Object.defineProperty(this, "_delayTimer", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_intervalPaceMaker", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_processingBatches", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Set()
        });
        Object.defineProperty(this, "addProcessingBatch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (value2) => {
            const r = this._processingBatches.add(value2);
            this._updateBatchProcessStatus();
            return r;
          }
        });
        Object.defineProperty(this, "deleteProcessingBatch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (value2) => {
            const r = this._processingBatches.delete(value2);
            this._updateBatchProcessStatus();
            return r;
          }
        });
        Object.defineProperty(this, "_processing", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "_collected", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_clerks", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_processCount", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: 0
        });
        this._root = this;
        this._processor = processor;
        this.batchSize = (_a6 = params == null ? void 0 : params.batchSize) != null ? _a6 : 1;
        this.yieldThreshold = (_c2 = (_b4 = params == null ? void 0 : params.yieldThreshold) != null ? _b4 : params == null ? void 0 : params.batchSize) != null ? _c2 : 0;
        this.concurrentLimit = (_d = params == null ? void 0 : params.concurrentLimit) != null ? _d : 1;
        this.delay = (_e = params == null ? void 0 : params.delay) != null ? _e : 0;
        this.maintainDelay = (_f = params == null ? void 0 : params.maintainDelay) != null ? _f : false;
        this.interval = (_g = params == null ? void 0 : params.interval) != null ? _g : 0;
        if (params == null ? void 0 : params.keepResultUntilDownstreamConnected)
          this._keepResultUntilDownstreamConnected = params.keepResultUntilDownstreamConnected;
        if (params == null ? void 0 : params.remainingReactiveSource)
          this._remainingReactiveSource = params == null ? void 0 : params.remainingReactiveSource;
        if (params == null ? void 0 : params.totalRemainingReactiveSource)
          this._totalRemainingReactiveSource = params == null ? void 0 : params.totalRemainingReactiveSource;
        if (params == null ? void 0 : params.processingEntitiesReactiveSource)
          this._processingEntitiesReactiveSource = params == null ? void 0 : params.processingEntitiesReactiveSource;
        if ((params == null ? void 0 : params.suspended) !== void 0)
          this._isSuspended = params == null ? void 0 : params.suspended;
        if (enqueueProcessor)
          this.replaceEnqueueProcessor(enqueueProcessor);
        if ((params == null ? void 0 : params.pipeTo) !== void 0) {
          this.pipeTo(params.pipeTo);
        }
        this._intervalPaceMaker = new PaceMaker(this.interval);
        if (items)
          this.enqueueAll(items);
        allRunningProcessors.add(this);
        this._initClerks();
        this._initEventHub();
        this.resume();
      }
      /**
       * replace enqueue logic.
       * @param processor enqueue logic. this should return new queue.
       * @returns
       */
      replaceEnqueueProcessor(processor) {
        this._enqueueProcessor = processor;
        return this;
      }
      /**
       * Modify the queue by force.
       * @param processor
       * @remarks I know that you have known this is very dangerous.
       */
      modifyQueue(processor) {
        this._queue = processor(this._queue);
        this._onTick();
      }
      /**
       * Clear the queue
       * @remarks I know that you have known this is very dangerous.
       */
      clearQueue() {
        this._queue = [];
        this._onTick();
      }
      /**
       * Set the handler for when the queue has been modified
       * @param proc
       * @returns
       */
      onUpdateProgress(proc) {
        this._runOnUpdateBatch = proc;
        return this;
      }
      /**
       * Join another processor
       * @param pipeTo
       * @returns
       */
      pipeTo(pipeTo) {
        this._pipeTo = pipeTo;
        this._pipeTo._root = this.root;
        if (this._keptResult.length > 0) {
          const temp = [...this._keptResult];
          this._keptResult = [];
          this._pipeTo.enqueueAll(temp);
        }
        return pipeTo;
      }
      isIdle() {
        return this._isIdle() && (!this._pipeTo ? true : this._pipeTo.isIdle());
      }
      _isIdle() {
        return this.totalRemaining == 0;
      }
      async _waitForIdle() {
        if (this._isSuspended)
          return Promise.resolve();
        if (this._isIdle())
          return Promise.resolve();
        do {
          const r = await this._waitFor(["tickEmpty", "tick", "tickSuspended", "suspended", "idle"]);
          if (r === "tickSuspended")
            break;
          if (r == "suspended")
            break;
          if (r == "tickEmpty")
            break;
          if (r == "idle")
            break;
        } while (!this._isIdle());
        return Promise.resolve();
      }
      idleDetectors() {
        const thisPromise = this._waitForIdle();
        if (this._pipeTo) {
          return [thisPromise, ...this._pipeTo.idleDetectors()];
        }
        return [thisPromise];
      }
      get isSuspended() {
        var _a6;
        return this._isSuspended || ((_a6 = this._pipeTo) == null ? void 0 : _a6.isSuspended) || false;
      }
      _updateReactiveSource() {
        this.root.updateReactiveSource();
      }
      updateReactiveSource() {
        if (this._pipeTo) {
          this._pipeTo.updateReactiveSource();
        }
        if (this._remainingReactiveSource)
          this._remainingReactiveSource.value = this.remaining;
        if (this._totalRemainingReactiveSource)
          this._totalRemainingReactiveSource.value = this.totalRemaining;
        if (this._processingEntitiesReactiveSource)
          this._processingEntitiesReactiveSource.value = this.nowProcessing;
      }
      _updateBatchProcessStatus() {
        this._updateReactiveSource();
        this._runOnUpdateBatch();
      }
      _collectBatch() {
        return this._queue.splice(0, this.batchSize);
      }
      _canCollectBatch() {
        return this._queue.length !== 0;
      }
      enqueue(entity) {
        this._queue = this._enqueueProcessor(this._queue, entity);
        this._updateBatchProcessStatus();
        this._onTick();
        return this;
      }
      enqueueAll(entities) {
        let queue2 = this._queue;
        for (const v of entities) {
          queue2 = this._enqueueProcessor(queue2, v);
        }
        this._queue = queue2;
        this._updateBatchProcessStatus();
        this._onTick();
        return this;
      }
      requestNextFlush() {
        this._nextProcessNeedsImmediate = true;
        this._onTick();
      }
      async _waitForSuspended() {
      }
      flush() {
        if (this._isSuspended)
          return Promise.resolve(false);
        this.requestNextFlush();
        return this.waitForAllDownstream();
      }
      async waitForAllDownstream(timeout) {
        const baseTasks = [];
        if (timeout) {
          baseTasks.push(delay(timeout, RESULT_TIMED_OUT));
        }
        do {
          const idleTasks = this.idleDetectors();
          const tasks3 = [...baseTasks, Promise.all(idleTasks)];
          const ret = await Promise.race(tasks3);
          if (ret === RESULT_TIMED_OUT)
            return false;
        } while (!this.isIdle());
        return true;
      }
      waitForAllProcessed(timeout) {
        this.root.startPipeline();
        return this.root.waitForAllDownstream(timeout);
      }
      async waitForAllDoneAndTerminate(timeout) {
        this.root.startPipeline();
        const r = await this.root.waitForAllDownstream(timeout);
        this.terminateAll();
        return r;
      }
      async _runProcessor(items) {
        const ret = await this._processor(items);
        if (!ret)
          return;
        if (this._pipeTo) {
          this._pipeTo.enqueueAll(ret);
        } else if (this._keepResultUntilDownstreamConnected) {
          this._keptResult.push(...ret);
        }
      }
      async *pump() {
        do {
          const ticked = await this._waitFor([
            "tickImmediate",
            "yielded",
            "tickSuspended",
            "tickDelayTimeout",
            "tickSuspended"
          ]);
          L2: do {
            const items = this._collectBatch();
            if (items.length == 0)
              break L2;
            yield items;
          } while (this._canCollectBatch());
          if (ticked == "tickSuspended")
            break;
        } while (!this._isSuspended);
      }
      _initClerks() {
        this._collected = new Inbox(this.concurrentLimit * 2);
        this._clerks = new ClerkGroup({
          assigned: this._collected,
          job: async (items) => {
            const batchLength = items.length;
            this.updateStatus(() => {
              this.processingEntities += batchLength;
              this.waitingEntries -= batchLength;
            });
            await this._intervalPaceMaker.paced;
            this._processCount++;
            try {
              await this._runProcessor(items);
            } catch (ex) {
              Logger(`Processor error!`);
              Logger(ex, LOG_LEVEL_VERBOSE);
            }
            this.updateStatus(() => {
              this.processingEntities -= batchLength;
            });
            this._processCount--;
            if (this._processCount == 0) {
              this._notifyIfIdle();
            }
          },
          initialMemberCount: this.concurrentLimit,
          instantiate: (params) => new Clerk(params)
        });
      }
      async _process() {
        if (this._processing || this._isSuspended)
          return;
        try {
          this._processing = true;
          do {
            const batchPump = this.pump();
            for await (const batch of batchPump) {
              if (!batch || batch.length === 0) {
                this._hub.emitEvent("tickEmpty");
                continue;
              }
              const batchLength = batch.length;
              this.updateStatus(() => {
                this.waitingEntries += batchLength;
              });
              await this._collected.post(batch);
            }
          } while (!this._isSuspended);
          this._hub.emitEvent("suspended");
        } finally {
          this._processing = false;
        }
      }
      _run() {
        if (this._isSuspended)
          return;
        if (this._processing)
          return;
        fireAndForget(() => this._process());
      }
      terminateAll() {
        this.root.terminate();
      }
      terminate() {
        if (this._pipeTo) {
          this._pipeTo.terminate();
          this._pipeTo = void 0;
        }
        this._isSuspended = true;
        this._enqueueProcessor = () => [];
        this._processor = () => Promise.resolve([]);
        this.clearQueue();
        this._hub.emitEvent("tickSuspended");
        this._hub.emitEvent("tickSuspended");
        this._hub.emitEvent("tickSuspended");
        this._collected.dispose();
        this._clerks.dispose();
        this._queue.length = 0;
        allRunningProcessors.delete(this);
      }
    };
  }
});

// node_modules/octagonal-wheels/dist/concurrency/processor.js
var init_processor = __esm({
  "node_modules/octagonal-wheels/dist/concurrency/processor.js"() {
    init_processor_v2();
  }
});

// src/sync/features/HiddenFileSync/index.ts
var import_obsidian4, FridayHiddenFileSync;
var init_HiddenFileSync = __esm({
  "src/sync/features/HiddenFileSync/index.ts"() {
    "use strict";
    import_obsidian4 = require("obsidian");
    init_lock();
    init_semaphore();
    init_processor();
    init_sync();
    init_i18n();
    init_logger2();
    init_utils2();
    init_path();
    init_hiddenFileUtils();
    FridayHiddenFileSync = class {
      constructor(plugin2, core) {
        // Cache management for tracking processed files
        this._fileInfoLastProcessed = /* @__PURE__ */ new Map();
        this._fileInfoLastKnown = /* @__PURE__ */ new Map();
        this._databaseInfoLastProcessed = /* @__PURE__ */ new Map();
        // RegExp cache for pattern matching
        this.cacheFileRegExps = /* @__PURE__ */ new Map();
        // Semaphore for limiting concurrent operations
        this.semaphore = Semaphore(10);
        // Periodic scan timer
        this.periodicScanTimer = null;
        // Module enabled state
        this._enabled = true;
        this.plugin = plugin2;
        this.core = core;
        this.initConflictResolutionProcessor();
      }
      // ==================== Module State ====================
      /**
       * Check if hidden file sync module is enabled
       */
      isThisModuleEnabled() {
        var _a6;
        const settings = this.core.getSettings();
        return this._enabled && ((_a6 = settings.syncInternalFiles) != null ? _a6 : true);
      }
      /**
       * Get the vault adapter for file operations
       */
      get adapter() {
        return this.plugin.app.vault.adapter;
      }
      /**
       * Get the config directory (usually .obsidian)
       */
      get configDir() {
        return this.plugin.app.vault.configDir;
      }
      /**
       * Get settings with defaults
       */
      get settings() {
        var _a6, _b4, _c2, _d, _e;
        const s = this.core.getSettings();
        return {
          syncInternalFiles: (_a6 = s.syncInternalFiles) != null ? _a6 : true,
          syncInternalFilesIgnorePatterns: s.syncInternalFilesIgnorePatterns ? `${DEFAULT_INTERNAL_IGNORE_PATTERNS},${s.syncInternalFilesIgnorePatterns}` : DEFAULT_INTERNAL_IGNORE_PATTERNS,
          syncInternalFilesTargetPatterns: (_b4 = s.syncInternalFilesTargetPatterns) != null ? _b4 : "",
          syncInternalFileOverwritePatterns: (_c2 = s.syncInternalFileOverwritePatterns) != null ? _c2 : "",
          watchInternalFileChanges: (_d = s.watchInternalFileChanges) != null ? _d : true,
          syncInternalFilesInterval: (_e = s.syncInternalFilesInterval) != null ? _e : 60
        };
      }
      // ==================== Lifecycle ====================
      /**
       * Initialize the module
       */
      async onload() {
        Logger("[HiddenFileSync] Module loaded", LOG_LEVEL_INFO);
        this._fileInfoLastProcessed.clear();
        this._fileInfoLastKnown.clear();
        this._databaseInfoLastProcessed.clear();
        this.cacheFileRegExps.clear();
        await this.resolveConflictOnInternalFiles();
        this.startPeriodicScan();
      }
      /**
       * Cleanup the module
       */
      onunload() {
        this.stopPeriodicScan();
        Logger("[HiddenFileSync] Module unloaded", LOG_LEVEL_INFO);
      }
      /**
       * Clear regex cache (call when patterns change for real-time update)
       */
      clearRegexCache() {
        this.cacheFileRegExps.clear();
        Logger("[HiddenFileSync] Regex cache cleared", LOG_LEVEL_VERBOSE);
      }
      /**
       * Start periodic scanning for hidden file changes
       */
      startPeriodicScan() {
        this.stopPeriodicScan();
        const interval = this.settings.syncInternalFilesInterval;
        if (interval > 0 && this.isThisModuleEnabled()) {
          this.periodicScanTimer = window.setInterval(async () => {
            if (this.isThisModuleEnabled()) {
              await this.scanAllStorageChanges(false);
            }
          }, interval * 1e3);
        }
      }
      /**
       * Stop periodic scanning
       */
      stopPeriodicScan() {
        if (this.periodicScanTimer !== null) {
          window.clearInterval(this.periodicScanTimer);
          this.periodicScanTimer = null;
        }
      }
      // ==================== Target File Detection ====================
      /**
       * Check if path is a hidden file that should be handled
       */
      isHiddenFileSyncHandlingPath(path8) {
        return path8.startsWith(".") && !path8.startsWith(".trash");
      }
      /**
       * Parse RegExp settings with caching
       */
      parseRegExpSettings() {
        const key4 = `${this.settings.syncInternalFilesTargetPatterns}||${this.settings.syncInternalFilesIgnorePatterns}`;
        if (this.cacheFileRegExps.has(key4)) {
          const cached = this.cacheFileRegExps.get(key4);
          return { targetFilter: cached[0], ignoreFilter: cached[1] };
        }
        const ignoreFilter = parsePatterns(this.settings.syncInternalFilesIgnorePatterns);
        const targetFilter = parsePatterns(this.settings.syncInternalFilesTargetPatterns);
        this.cacheFileRegExps.clear();
        this.cacheFileRegExps.set(key4, [targetFilter, ignoreFilter]);
        return { ignoreFilter, targetFilter };
      }
      /**
       * Check if path matches target patterns and not ignored
       */
      isTargetFileInPatterns(path8) {
        const { ignoreFilter, targetFilter } = this.parseRegExpSettings();
        if (ignoreFilter.length > 0 && matchesAnyPattern(path8, ignoreFilter)) {
          return false;
        }
        if (targetFilter.length > 0) {
          return matchesAnyPattern(path8, targetFilter);
        }
        return true;
      }
      /**
       * Check if file is a valid sync target
       */
      async isTargetFile(path8) {
        if (!this.isHiddenFileSyncHandlingPath(path8)) {
          return false;
        }
        if (!this.isTargetFileInPatterns(path8)) {
          return false;
        }
        if (this.core.isIgnoredByIgnoreFile) {
          const ignored = await this.core.isIgnoredByIgnoreFile(path8);
          if (ignored) return false;
        }
        return true;
      }
      // ==================== Storage Operations ====================
      /**
       * Load file content and stat
       * CRITICAL: Use text reading for plain text files (.js, .css, .json, etc.)
       * to match livesync's adapterReadAuto behavior.
       * This ensures storage type matches retrieval logic in readContent().
       */
      async loadFileWithInfo(path8) {
        var _a6, _b4, _c2;
        try {
          const stat = await this.adapter.stat(path8);
          if (!stat) {
            return {
              name: (_a6 = path8.split("/").pop()) != null ? _a6 : "",
              path: path8,
              stat: { size: 0, mtime: 0, ctime: 0, type: "file" },
              isInternal: true,
              deleted: true,
              body: createBlob(new Uint8Array(0))
            };
          }
          let content;
          if (isPlainText(path8)) {
            content = await this.adapter.read(path8);
          } else {
            content = await this.adapter.readBinary(path8);
          }
          return {
            name: (_b4 = path8.split("/").pop()) != null ? _b4 : "",
            path: path8,
            stat: { size: stat.size, mtime: stat.mtime, ctime: stat.ctime, type: "file" },
            isInternal: true,
            deleted: false,
            body: createBlob(content)
          };
        } catch (e2) {
          return {
            name: (_c2 = path8.split("/").pop()) != null ? _c2 : "",
            path: path8,
            stat: { size: 0, mtime: 0, ctime: 0, type: "file" },
            isInternal: true,
            deleted: true,
            body: createBlob(new Uint8Array(0))
          };
        }
      }
      /**
       * Ensure directory exists
       */
      async ensureDir(path8) {
        const dir = path8.substring(0, path8.lastIndexOf("/"));
        if (dir && !await this.adapter.exists(dir)) {
          try {
            await this.plugin.app.vault.createFolder(dir);
          } catch (e2) {
          }
        }
      }
      /**
       * Write file to storage
       */
      async writeFile(path8, data, opt) {
        var _a6, _b4;
        try {
          await this.ensureDir(path8);
          if (typeof data === "string") {
            await this.adapter.write(path8, data);
          } else {
            await this.adapter.writeBinary(path8, data);
          }
          if (opt == null ? void 0 : opt.mtime) {
            try {
              await ((_b4 = (_a6 = this.adapter).setMtime) == null ? void 0 : _b4.call(_a6, path8, opt.mtime));
            } catch (e2) {
            }
          }
          const stat = await this.adapter.stat(path8);
          return stat ? { size: stat.size, mtime: stat.mtime, ctime: stat.ctime, type: "file" } : null;
        } catch (ex) {
          Logger(`[HiddenFileSync] Failed to write file: ${path8}`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return null;
        }
      }
      /**
       * Remove file from storage
       */
      async removeFile(path8) {
        try {
          if (!await this.adapter.exists(path8)) {
            return "ALREADY";
          }
          await this.adapter.remove(path8);
          return "OK";
        } catch (ex) {
          Logger(`[HiddenFileSync] Failed to remove file: ${path8}`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      // ==================== Cache Management ====================
      /**
       * Update last processed file cache
       */
      updateLastProcessedFile(file, keySrc) {
        const key4 = typeof keySrc === "string" ? keySrc : statToKey(keySrc);
        const mtime = parseInt(key4.split("-")[0]);
        if (mtime !== 0) {
          this._fileInfoLastKnown.set(file, mtime);
        }
        this._fileInfoLastProcessed.set(file, key4);
      }
      /**
       * Get last processed file key
       */
      getLastProcessedFileKey(file) {
        return this._fileInfoLastProcessed.get(file);
      }
      /**
       * Get last known file mtime
       */
      getLastProcessedFileMTime(file) {
        var _a6;
        return (_a6 = this._fileInfoLastKnown.get(file)) != null ? _a6 : 0;
      }
      /**
       * Update last processed database cache
       */
      updateLastProcessedDatabase(file, keySrc) {
        const key4 = typeof keySrc === "string" ? keySrc : docToKey(keySrc);
        this._databaseInfoLastProcessed.set(file, key4);
      }
      /**
       * Get last processed database key
       */
      getLastProcessedDatabaseKey(file) {
        return this._databaseInfoLastProcessed.get(file);
      }
      /**
       * Update both file and database processed caches
       */
      updateLastProcessed(path8, db, stat) {
        this.updateLastProcessedDatabase(path8, db);
        this.updateLastProcessedFile(path8, statToKey(stat));
        const dbMTime = getComparingMTime(db);
        const storageMTime = getComparingMTime({ stat });
        if (dbMTime === 0 || storageMTime === 0) {
          unmarkChanges(path8);
        } else {
          markChangesAreSame(path8, dbMTime, storageMTime);
        }
      }
      /**
       * Update processed cache for deletion
       */
      updateLastProcessedDeletion(path8, db) {
        unmarkChanges(path8);
        if (db) this.updateLastProcessedDatabase(path8, db);
        this.updateLastProcessedFile(path8, statToKey(null));
      }
      /**
       * Reset file processed cache
       */
      resetLastProcessedFile(targetFiles) {
        if (targetFiles) {
          for (const key4 of targetFiles) {
            this._fileInfoLastProcessed.delete(key4);
          }
        } else {
          this._fileInfoLastProcessed.clear();
        }
      }
      /**
       * Reset database processed cache
       */
      resetLastProcessedDatabase(targetFiles) {
        if (targetFiles) {
          for (const key4 of targetFiles) {
            this._databaseInfoLastProcessed.delete(key4);
          }
        } else {
          this._databaseInfoLastProcessed.clear();
        }
      }
      // ==================== Database Operations ====================
      /**
       * Load base save data for a file
       */
      async loadBaseSaveData(file, includeContent = true) {
        const localDB = this.core.localDatabase;
        if (!localDB) return false;
        const prefixedFileName = addPrefix(file, ICHeader);
        const id = await this.core.path2id(prefixedFileName);
        try {
          const old = includeContent ? await localDB.getDBEntry(prefixedFileName, void 0, false, true) : await localDB.getDBEntryMeta(prefixedFileName, { conflicts: true }, true);
          if (old === false) {
            const baseSaveData = {
              _id: id,
              data: [],
              path: prefixedFileName,
              mtime: 0,
              ctime: 0,
              datatype: "newnote",
              children: [],
              size: 0,
              deleted: false,
              type: "newnote",
              eden: {}
            };
            return baseSaveData;
          }
          return old;
        } catch (ex) {
          Logger(`[HiddenFileSync] Failed to load base data: ${file}`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Store internal file to database
       */
      async storeInternalFileToDatabase(file, forceWrite = false) {
        const localDB = this.core.localDatabase;
        if (!localDB) return false;
        const storeFilePath = stripAllPrefixes(file.path);
        const prefixedFileName = addPrefix(storeFilePath, ICHeader);
        if (this.core.isIgnoredByIgnoreFile && await this.core.isIgnoredByIgnoreFile(storeFilePath)) {
          return void 0;
        }
        return await serialized("file-" + prefixedFileName, async () => {
          try {
            const fileInfo = "body" in file && "stat" in file ? file : await this.loadFileWithInfo(storeFilePath);
            if (fileInfo.deleted) {
              throw new Error(`Hidden file ${storeFilePath} is deleted`);
            }
            const baseData = await this.loadBaseSaveData(storeFilePath, true);
            if (baseData === false) throw new Error("Failed to load base data");
            if (baseData._rev && !forceWrite) {
              const isSame = await isDocContentSame(readAsBlob(baseData), fileInfo.body);
              if (isSame) {
                this.updateLastProcessed(storeFilePath, baseData, fileInfo.stat);
                return void 0;
              }
            }
            const saveData = {
              ...baseData,
              data: fileInfo.body,
              mtime: fileInfo.stat.mtime,
              ctime: fileInfo.stat.ctime,
              size: fileInfo.stat.size,
              children: [],
              deleted: false,
              type: baseData.datatype
            };
            const ret = await localDB.putDBEntry(saveData);
            if (ret && ret.ok) {
              saveData._rev = ret.rev;
              this.updateLastProcessed(storeFilePath, saveData, fileInfo.stat);
            }
            const success = ret && ret.ok;
            Logger(`STORAGE --> DB:${storeFilePath}: (hidden) ${success ? "Done" : "Failed"}`, LOG_LEVEL_INFO);
            return success;
          } catch (ex) {
            Logger(`STORAGE --> DB:${storeFilePath}: (hidden) Failed`, LOG_LEVEL_INFO);
            Logger(ex, LOG_LEVEL_VERBOSE);
            return false;
          }
        });
      }
      /**
       * Delete internal file from database
       */
      async deleteInternalFileOnDatabase(filenameSrc, forceWrite = false) {
        const localDB = this.core.localDatabase;
        if (!localDB) return false;
        const storeFilePath = filenameSrc;
        const prefixedFileName = addPrefix(storeFilePath, ICHeader);
        const mtime = Date.now();
        if (this.core.isIgnoredByIgnoreFile && await this.core.isIgnoredByIgnoreFile(storeFilePath)) {
          return void 0;
        }
        return await serialized("file-" + prefixedFileName, async () => {
          try {
            const baseData = await this.loadBaseSaveData(storeFilePath, false);
            if (baseData === false) throw new Error("Failed to load base data during deleting");
            if (baseData._conflicts !== void 0) {
              for (const conflictRev of baseData._conflicts) {
                await localDB.removeRevision(baseData._id, conflictRev);
              }
            }
            if (baseData.deleted) {
              this.updateLastProcessedDeletion(storeFilePath, baseData);
              return true;
            }
            const saveData = {
              ...baseData,
              mtime,
              size: 0,
              children: [],
              deleted: true,
              type: baseData.datatype
            };
            const ret = await localDB.putRaw(saveData);
            if (ret && ret.ok) {
              Logger(`STORAGE -x> DB:${storeFilePath}: (hidden) Done`, LOG_LEVEL_INFO);
              saveData._rev = ret.rev;
              this.updateLastProcessedDeletion(storeFilePath, saveData);
              return true;
            }
            Logger(`STORAGE -x> DB:${storeFilePath}: (hidden) Failed`, LOG_LEVEL_INFO);
            return false;
          } catch (ex) {
            Logger(`STORAGE -x> DB:${storeFilePath}: (hidden) Failed`, LOG_LEVEL_INFO);
            Logger(ex, LOG_LEVEL_VERBOSE);
            return false;
          }
        });
      }
      /**
       * Extract internal file from database to storage
       */
      async extractInternalFileFromDatabase(storageFilePath, force = false, metaEntry, preventDoubleProcess = true, onlyNew = false, includeDeletion = true) {
        const localDB = this.core.localDatabase;
        if (!localDB) return false;
        const prefixedFileName = addPrefix(storageFilePath, ICHeader);
        if (this.core.isIgnoredByIgnoreFile && await this.core.isIgnoredByIgnoreFile(storageFilePath)) {
          return void 0;
        }
        return await serialized("file-" + prefixedFileName, async () => {
          var _a6, _b4;
          try {
            const metaOnDB = metaEntry || await localDB.getDBEntryMeta(prefixedFileName, { conflicts: true }, true);
            if (metaOnDB === false) throw new Error(`File not found on database: ${storageFilePath}`);
            if ((_a6 = metaOnDB._conflicts) == null ? void 0 : _a6.length) {
              Logger(`[HiddenFileSync] ${storageFilePath} has conflicts, queuing resolution`, LOG_LEVEL_INFO);
              const prefixedPath = addPrefix(storageFilePath, ICHeader);
              this.queueConflictCheck(prefixedPath);
              return false;
            }
            if (preventDoubleProcess) {
              const key4 = docToKey(metaOnDB);
              if (this.getLastProcessedDatabaseKey(storageFilePath) === key4 && !force) {
                return void 0;
              }
            }
            if (onlyNew) {
              const dbMTime = getComparingMTime(metaOnDB, includeDeletion);
              const storageStat = await this.adapter.stat(storageFilePath);
              const storageMTimeActual = (_b4 = storageStat == null ? void 0 : storageStat.mtime) != null ? _b4 : 0;
              const storageMTime = storageMTimeActual === 0 ? this.getLastProcessedFileMTime(storageFilePath) : storageMTimeActual;
              const diff = compareMTime(storageMTime, dbMTime);
              if (diff !== TARGET_IS_NEW) {
                this.updateLastProcessedDatabase(storageFilePath, metaOnDB);
                if (storageStat) this.updateLastProcessedFile(storageFilePath, {
                  mtime: storageStat.mtime,
                  size: storageStat.size,
                  ctime: storageStat.ctime,
                  type: "file"
                });
                return void 0;
              }
            }
            const deleted = metaOnDB.deleted || metaOnDB._deleted || false;
            if (deleted) {
              const result = await this.removeFile(storageFilePath);
              if (result === "OK" || result === "ALREADY") {
                this.updateLastProcessedDeletion(storageFilePath, metaOnDB);
                Logger(`STORAGE <x- DB:${storageFilePath}: deleted (hidden)`, LOG_LEVEL_INFO);
                return true;
              }
              return false;
            }
            const fileOnDB = await localDB.getDBEntryFromMeta(metaOnDB, false, true);
            if (fileOnDB === false) {
              throw new Error(`Failed to read file from database: ${storageFilePath}`);
            }
            const writeContent = readContent(fileOnDB);
            const resultStat = await this.writeFile(storageFilePath, writeContent, {
              mtime: fileOnDB.mtime,
              ctime: fileOnDB.ctime
            });
            if (resultStat) {
              this.updateLastProcessed(storageFilePath, metaOnDB, resultStat);
              Logger(`STORAGE <-- DB:${storageFilePath}: written (hidden)`, LOG_LEVEL_INFO);
              return true;
            }
            return false;
          } catch (ex) {
            console.error(`[HiddenFileSync] extractInternalFileFromDatabase failed:`, {
              path: storageFilePath,
              error: ex,
              errorMessage: ex instanceof Error ? ex.message : String(ex),
              errorStack: ex instanceof Error ? ex.stack : void 0
            });
            Logger(`STORAGE <-- DB:${storageFilePath}: (hidden) Failed`, LOG_LEVEL_INFO);
            Logger(ex, LOG_LEVEL_VERBOSE);
            return false;
          }
        });
      }
      // ==================== Scan Operations ====================
      /**
       * Scan all internal file names in vault
       */
      async scanInternalFileNames() {
        const root5 = this.plugin.app.vault.getRoot();
        return await this.getFiles(root5.path, (path8) => this.isTargetFile(path8));
      }
      /**
       * Recursively get files matching filter
       */
      async getFiles(path8, checkFunction) {
        let w2;
        try {
          w2 = await this.adapter.list(path8);
        } catch (e2) {
          return [];
        }
        let files = [];
        for (const file of w2.files) {
          if (await checkFunction(file)) {
            files.push(file);
          }
        }
        for (const folder of w2.folders) {
          if (await checkFunction(folder)) {
            files = files.concat(await this.getFiles(folder, checkFunction));
          }
        }
        return files;
      }
      /**
       * Get all database files
       */
      async getAllDatabaseFiles() {
        const localDB = this.core.localDatabase;
        if (!localDB) return [];
        const allFiles = (await localDB.allDocsRaw({ startkey: ICHeader, endkey: ICHeaderEnd, include_docs: true })).rows.filter((e2) => isInternalMetadata(e2.id)).map((e2) => e2.doc);
        const files = [];
        for (const file of allFiles) {
          const path8 = stripAllPrefixes(getPath2(file));
          if (await this.isTargetFile(path8)) {
            files.push(file);
          }
        }
        return files;
      }
      /**
       * Scan all storage changes and sync to database
       */
      async scanAllStorageChanges(showNotice = false) {
        await skipIfDuplicated("scanAllStorageChanges", async () => {
          Logger($msg("fridaySync.hiddenFileSync.scanningStorage"), showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_VERBOSE);
          const knownNames = [...this._fileInfoLastProcessed.keys()];
          const existNames = await this.scanInternalFileNames();
          const allFiles = /* @__PURE__ */ new Set([...knownNames, ...existNames]);
          const fileStats = await Promise.all(
            [...allFiles].map(async (path8) => ({
              path: path8,
              stat: await this.adapter.stat(path8)
            }))
          );
          const processFiles = fileStats.filter(({ path: path8, stat }) => {
            const key4 = this.getLastProcessedFileKey(path8);
            const newKey = statToKey(stat ? { mtime: stat.mtime, size: stat.size, ctime: stat.ctime, type: "file" } : null);
            return key4 !== newKey;
          }).map(({ path: path8 }) => path8);
          Logger(`[HiddenFileSync] Found ${processFiles.length} changed files`, LOG_LEVEL_VERBOSE);
          const notifyProgress = onlyInNTimes(
            25,
            (progress) => Logger(`[HiddenFileSync] Processing ${progress}/${processFiles.length}...`, LOG_LEVEL_VERBOSE)
          );
          await Promise.all(
            processFiles.map(async (file) => {
              await this.trackStorageFileModification(file);
              notifyProgress();
            })
          );
          Logger($msg("fridaySync.hiddenFileSync.storageScanComplete"), showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_VERBOSE);
        });
      }
      /**
       * Scan all database changes and sync to storage
       */
      async scanAllDatabaseChanges(showNotice = false) {
        await skipIfDuplicated("scanAllDatabaseChanges", async () => {
          Logger($msg("fridaySync.hiddenFileSync.scanningDatabase"), showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_VERBOSE);
          const databaseFiles = await this.getAllDatabaseFiles();
          const processFiles = databaseFiles.filter((doc) => {
            const key4 = docToKey(doc);
            const path8 = stripAllPrefixes(getPath2(doc));
            const lastKey = this.getLastProcessedDatabaseKey(path8);
            return lastKey !== key4;
          });
          Logger(`[HiddenFileSync] Found ${processFiles.length} changed database entries`, LOG_LEVEL_VERBOSE);
          const notifyProgress = onlyInNTimes(
            25,
            (progress) => Logger(`[HiddenFileSync] Processing ${progress}/${processFiles.length}...`, LOG_LEVEL_VERBOSE)
          );
          await Promise.all(
            processFiles.map(async (doc) => {
              const path8 = stripAllPrefixes(getPath2(doc));
              await this.trackDatabaseFileModification(path8, doc);
              notifyProgress();
            })
          );
          Logger($msg("fridaySync.hiddenFileSync.databaseScanComplete"), showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_VERBOSE);
        });
      }
      /**
       * Track storage file modification
       */
      async trackStorageFileModification(path8, onlyNew = false, forceWrite = false) {
        if (!await this.isTargetFile(path8)) {
          return false;
        }
        const rel = await this.semaphore.acquire();
        try {
          return await serialized(`hidden-file-event:${path8}`, async () => {
            const stat = await this.adapter.stat(path8);
            if (stat && stat.type !== "file") return false;
            const key4 = statToKey(stat ? { mtime: stat.mtime, size: stat.size, ctime: stat.ctime, type: "file" } : null);
            const lastKey = this.getLastProcessedFileKey(path8);
            if (lastKey === key4 && !forceWrite) {
              return true;
            }
            const cache = await this.loadFileWithInfo(path8);
            this.updateLastProcessedFile(path8, cache.stat);
            const lastIsNotFound = !lastKey || lastKey.endsWith("-0-0");
            const nowIsNotFound = cache.deleted;
            const type = lastIsNotFound && nowIsNotFound ? "invalid" : nowIsNotFound ? "delete" : "modified";
            if (type === "invalid") return false;
            if (type === "delete") {
              return await this.deleteInternalFileOnDatabase(path8, forceWrite);
            } else {
              return await this.storeInternalFileToDatabase(cache, forceWrite);
            }
          });
        } finally {
          rel();
        }
      }
      /**
       * Track database file modification
       * This is the main entry point for processing replicated hidden files.
       * Key change: Check for conflicts BEFORE extracting file to storage.
       * Source: livesync CmdHiddenFileSync.ts lines 1114-1158
       */
      async trackDatabaseFileModification(path8, meta) {
        const rel = await this.semaphore.acquire();
        try {
          return await serialized(`hidden-file-event:${path8}`, async () => {
            const localDB = this.core.localDatabase;
            if (!localDB) return false;
            try {
              const prefixedPath = addPrefix(path8, ICHeader);
              const docMeta = await localDB.getDBEntryMeta(prefixedPath, { conflicts: true }, true);
              if (docMeta === false) return false;
              if (docMeta._conflicts && docMeta._conflicts.length > 0) {
                const prefixedPathWithType = addPrefix(path8, ICHeader);
                this.queueConflictCheck(prefixedPathWithType);
                return true;
              }
              await this.extractInternalFileFromDatabase(
                path8,
                false,
                docMeta,
                true,
                // preventDoubleProcess
                false,
                // onlyNew
                true
                // includeDeletion
              );
              return true;
            } catch (ex) {
              console.error(`[HiddenFileSync] trackDatabaseFileModification failed:`, {
                path: path8,
                error: ex,
                errorMessage: ex instanceof Error ? ex.message : String(ex),
                errorStack: ex instanceof Error ? ex.stack : void 0
              });
              Logger(`[HiddenFileSync] trackDatabaseFileModification failed: ${path8}`, LOG_LEVEL_VERBOSE);
              Logger(ex, LOG_LEVEL_VERBOSE);
              return false;
            }
          });
        } finally {
          rel();
        }
      }
      // ==================== Event Processing ====================
      /**
       * Process replication result for internal files
       */
      async processReplicationResult(doc) {
        const path8 = stripAllPrefixes(getPath2(doc));
        if (!await this.isTargetFile(path8)) {
          return false;
        }
        return await this.trackDatabaseFileModification(path8);
      }
      /**
       * Handle vault raw events for hidden files
       * Called from FridayStorageEventManager
       */
      async watchVaultRawEvents(path8) {
        if (!this.isThisModuleEnabled()) return;
        if (!this.settings.watchInternalFileChanges) return;
        if (!path8.startsWith(this.configDir)) return;
        if (path8.endsWith("/")) return;
        if (!await this.isTargetFile(path8)) return;
        await this.trackStorageFileModification(path8);
      }
      // ==================== Initialization ====================
      /**
       * Initialize hidden file sync (for first-time setup)
       * @param direction - "push" | "pull" | "safe"
       */
      async initialiseInternalFileSync(direction, showNotice = true) {
        Logger(`[HiddenFileSync] Initializing with direction: ${direction}`, showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO);
        if (direction === "push") {
          this.resetLastProcessedFile(false);
          await this.scanAllStorageChanges(showNotice);
        } else if (direction === "pull") {
          this.resetLastProcessedDatabase(false);
          await this.scanAllDatabaseChanges(showNotice);
        } else {
          this.resetLastProcessedFile(false);
          this.resetLastProcessedDatabase(false);
          await this.scanAllStorageChanges(showNotice);
          await this.scanAllDatabaseChanges(showNotice);
        }
        Logger($msg("fridaySync.hiddenFileSync.initComplete"), showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO);
      }
      // ==================== Conflict Resolution ====================
      /**
       * Initialize the conflict resolution queue processor
       * Source: livesync CmdHiddenFileSync.ts lines 679-770
       */
      initConflictResolutionProcessor() {
        this.conflictResolutionProcessor = new QueueProcessor(
          async (paths) => {
            var _a6;
            const path8 = paths[0];
            const localDB = this.core.localDatabase;
            if (!localDB) return [];
            try {
              const prefixedPath = path8.startsWith(ICHeader) ? path8 : addPrefix(path8, ICHeader);
              const id = await this.core.path2id(prefixedPath);
              const doc = await localDB.getRaw(id, { conflicts: true });
              if (!((_a6 = doc._conflicts) == null ? void 0 : _a6.length)) return [];
              Logger(`[HiddenFileSync] Resolving ${doc._conflicts.length} conflict(s) for: ${path8}`, LOG_LEVEL_INFO);
              const conflicts = doc._conflicts.sort(
                (a, b) => Number(a.split("-")[0]) - Number(b.split("-")[0])
              );
              const revA = doc._rev;
              const revB = conflicts[0];
              if (path8.endsWith(".json")) {
                const merged = await this.tryMergeJSON(id, path8, doc, revA, revB);
                if (merged) return [];
                const overwritePatterns = parsePatterns(
                  this.settings.syncInternalFileOverwritePatterns || ""
                );
                if (matchesAnyPattern(stripAllPrefixes(path8), overwritePatterns)) {
                  await this.resolveByNewerEntry(id, path8, doc, revA, revB);
                  return [];
                }
                await this.resolveByNewerEntry(id, path8, doc, revA, revB);
                return [];
              }
              await this.resolveByNewerEntry(id, path8, doc, revA, revB);
              return [];
            } catch (ex) {
              Logger(`[HiddenFileSync] Conflict resolution failed: ${path8}`, LOG_LEVEL_VERBOSE);
              Logger(ex, LOG_LEVEL_VERBOSE);
              return [];
            }
          },
          {
            suspended: false,
            batchSize: 1,
            concurrentLimit: 1,
            // Process one at a time
            delay: 10,
            keepResultUntilDownstreamConnected: false,
            yieldThreshold: 10
          }
        );
      }
      /**
       * Queue a path for conflict resolution
       */
      queueConflictCheck(path8) {
        this.conflictResolutionProcessor.enqueue(path8);
      }
      /**
       * Resolve conflict by selecting the revision with newer mtime
       * This is used for non-JSON files like main.js, styles.css
       * Source: livesync CmdHiddenFileSync.ts lines 653-678
       */
      async resolveByNewerEntry(id, path8, currentDoc, currentRev, conflictedRev) {
        var _a6, _b4;
        const localDB = this.core.localDatabase;
        if (!localDB) return;
        try {
          const conflictedDoc = await localDB.getRaw(id, { rev: conflictedRev });
          const mtimeCurrent = getComparingMTime(currentDoc, true);
          const mtimeConflicted = getComparingMTime(conflictedDoc, true);
          const deleteRev = mtimeCurrent < mtimeConflicted ? currentRev : conflictedRev;
          await localDB.removeRevision(id, deleteRev);
          Logger(`[HiddenFileSync] Conflict resolved, older revision deleted: ${path8}`, LOG_LEVEL_INFO);
          const updated = await localDB.getRaw(id, { conflicts: true });
          const remainingConflicts = (_b4 = (_a6 = updated._conflicts) == null ? void 0 : _a6.length) != null ? _b4 : 0;
          if (remainingConflicts === 0) {
            const storageFilePath = stripAllPrefixes(path8);
            await this.extractInternalFileFromDatabase(storageFilePath);
          } else {
            this.queueConflictCheck(path8);
          }
        } catch (ex) {
          Logger(`[HiddenFileSync] resolveByNewerEntry failed: ${path8}`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Try to merge JSON files using object-level merge
       * Returns true if merge was successful
       * Source: livesync CmdHiddenFileSync.ts lines 694-724
       */
      async tryMergeJSON(id, path8, doc, currentRev, conflictedRev) {
        var _a6, _b4, _c2, _d, _e;
        const localDB = this.core.localDatabase;
        if (!localDB) return false;
        try {
          const revInfo = await localDB.getRaw(id, { revs_info: true });
          const conflictedRevNo = Number(conflictedRev.split("-")[0]);
          const commonBase = (_d = (_c2 = (_b4 = (_a6 = revInfo._revs_info) == null ? void 0 : _a6.filter((e2) => e2.status === "available" && Number(e2.rev.split("-")[0]) < conflictedRevNo)) == null ? void 0 : _b4[0]) == null ? void 0 : _c2.rev) != null ? _d : "";
          if (!commonBase) return false;
          const conflictManager = (_e = this.core.managers) == null ? void 0 : _e.conflictManager;
          if (!conflictManager || !conflictManager.mergeObject) return false;
          const result = await conflictManager.mergeObject(
            doc.path,
            commonBase,
            currentRev,
            conflictedRev
          );
          if (!result) return false;
          const filename = stripAllPrefixes(path8);
          await this.ensureDir(filename);
          const stat = await this.writeFile(filename, result);
          if (!stat) {
            throw new Error(`Failed to write merged file: ${filename}`);
          }
          await this.storeInternalFileToDatabase({ path: filename, ...stat });
          await localDB.removeRevision(id, conflictedRev);
          this.queueConflictCheck(path8);
          Logger(`[HiddenFileSync] JSON merge successful: ${path8}`, LOG_LEVEL_INFO);
          return true;
        } catch (ex) {
          Logger(`[HiddenFileSync] JSON merge failed: ${path8}`, LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Scan all internal files for conflicts and queue resolution
       * Called during initialization
       * Source: livesync CmdHiddenFileSync.ts lines 635-651
       */
      async resolveConflictOnInternalFiles() {
        var _a6;
        const localDB = this.core.localDatabase;
        if (!localDB) return;
        Logger("[HiddenFileSync] Scanning for conflicted files...", LOG_LEVEL_INFO);
        try {
          const conflicted = localDB.findEntries(ICHeader, ICHeaderEnd, { conflicts: true });
          let conflictCount = 0;
          for await (const doc of conflicted) {
            if (!("_conflicts" in doc)) continue;
            if (!((_a6 = doc._conflicts) == null ? void 0 : _a6.length)) continue;
            if (isInternalMetadata(doc._id)) {
              const path8 = doc.path || doc._id;
              this.queueConflictCheck(path8);
              conflictCount++;
            }
          }
          if (conflictCount > 0) {
            Logger(`[HiddenFileSync] Found ${conflictCount} conflicted file(s), resolving...`, LOG_LEVEL_INFO);
            await this.conflictResolutionProcessor.startPipeline().waitForAllProcessed();
            Logger("[HiddenFileSync] Conflict resolution complete", LOG_LEVEL_INFO);
          }
        } catch (ex) {
          Logger("[HiddenFileSync] Error scanning for conflicts", LOG_LEVEL_VERBOSE);
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
    };
  }
});

// src/sync/features/NetworkEvents/index.ts
var import_obsidian5, FridayNetworkEvents;
var init_NetworkEvents = __esm({
  "src/sync/features/NetworkEvents/index.ts"() {
    "use strict";
    import_obsidian5 = require("obsidian");
    init_logger2();
    init_types();
    init_task();
    init_promises();
    FridayNetworkEvents = class {
      constructor(plugin2, core) {
        this.hasFocus = true;
        this.isLastHidden = false;
        this.boundHandlers = null;
        this.plugin = plugin2;
        this.core = core;
      }
      /**
       * Register all network-related event listeners
       * Matching livesync's ModuleObsidianEvents.registerWatchEvents()
       */
      registerEvents() {
        this.boundHandlers = {
          online: this.watchOnline.bind(this),
          offline: this.watchOnline.bind(this),
          visibilityChange: this.watchWindowVisibility.bind(this),
          focus: () => this.setHasFocus(true),
          blur: () => this.setHasFocus(false)
        };
        this.plugin.registerDomEvent(window, "online", this.boundHandlers.online);
        this.plugin.registerDomEvent(window, "offline", this.boundHandlers.offline);
        this.plugin.registerDomEvent(document, "visibilitychange", this.boundHandlers.visibilityChange);
        this.plugin.registerDomEvent(window, "focus", this.boundHandlers.focus);
        this.plugin.registerDomEvent(window, "blur", this.boundHandlers.blur);
        Logger("Network event listeners registered", LOG_LEVEL_VERBOSE);
      }
      setHasFocus(hasFocus) {
        this.hasFocus = hasFocus;
        this.watchWindowVisibility();
      }
      /**
       * Handle online/offline events
       * Source: livesync ModuleObsidianEvents.watchOnline()
       */
      watchOnline() {
        scheduleTask("watch-online", 500, () => fireAndForget(() => this.watchOnlineAsync()));
      }
      async watchOnlineAsync() {
        var _a6;
        const isOnline = navigator.onLine;
        Logger(`Network status changed: ${isOnline ? "online" : "offline"}`, LOG_LEVEL_INFO);
        if (isOnline) {
          const currentStatus = this.core.replicationStat.value.syncStatus;
          if (currentStatus === "LIVE") {
            Logger("Network online but sync already active", LOG_LEVEL_VERBOSE);
            return;
          }
          Logger("Network recovered, attempting reconnection", LOG_LEVEL_INFO);
          await this.core.handleNetworkRecovery();
        } else {
          if ((_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) {
            this.core.managers.networkManager.setServerReachable(false);
          }
          if (this.core.offlineTracker) {
            this.core.offlineTracker.setOffline(true);
          }
        }
      }
      /**
       * Handle visibility changes (tab switching, minimize)
       * Source: livesync ModuleObsidianEvents.watchWindowVisibility()
       */
      watchWindowVisibility() {
        scheduleTask(
          "watch-window-visibility",
          100,
          () => fireAndForget(() => this.watchWindowVisibilityAsync())
        );
      }
      async watchWindowVisibilityAsync() {
        var _a6;
        const settings = this.core.getSettings();
        if (settings.suspendFileWatching) return;
        if (!settings.isConfigured) return;
        if (this.isLastHidden && !this.hasFocus) {
          return;
        }
        const isHidden = document.hidden;
        if (this.isLastHidden === isHidden) {
          return;
        }
        this.isLastHidden = isHidden;
        if (isHidden) {
          Logger("Window hidden, sync continues in background", LOG_LEVEL_VERBOSE);
        } else {
          if (!this.hasFocus) return;
          const currentStatus = this.core.replicationStat.value.syncStatus;
          if (currentStatus === "LIVE") {
            Logger("Window visible, sync already active", LOG_LEVEL_VERBOSE);
            return;
          }
          if (currentStatus === "NOT_CONNECTED" || currentStatus === "ERRORED") {
            Logger("Window visible, checking for sync recovery", LOG_LEVEL_VERBOSE);
            if ((_a6 = this.core.connectionMonitor) == null ? void 0 : _a6.isReconnectScheduled()) {
              Logger("Reconnect already scheduled, skipping duplicate attempt", LOG_LEVEL_VERBOSE);
              return;
            }
            await this.core.handleNetworkRecovery();
          } else {
            Logger(`Window visible, current status: ${currentStatus}`, LOG_LEVEL_VERBOSE);
          }
        }
      }
      /**
       * Unload and cleanup event listeners
       * Note: Events registered via registerDomEvent are auto-cleaned by Obsidian
       */
      unload() {
        this.boundHandlers = null;
        Logger("Network event listeners unloaded", LOG_LEVEL_VERBOSE);
      }
    };
  }
});

// src/sync/features/ConnectionMonitor/index.ts
var FridayConnectionMonitor;
var init_ConnectionMonitor = __esm({
  "src/sync/features/ConnectionMonitor/index.ts"() {
    "use strict";
    init_logger2();
    init_types();
    FridayConnectionMonitor = class {
      constructor(core) {
        this.reconnectTimer = null;
        this.healthCheckTimer = null;
        this.isMonitoring = false;
        this.healthCheckInterval = 6e4;
        // 1 minute
        this._pausedForManualOperation = false;
        this.core = core;
      }
      /**
       * Start monitoring connection health
       */
      startMonitoring() {
        if (this.isMonitoring) return;
        this.isMonitoring = true;
        this.healthCheckTimer = setInterval(() => {
          this.performHealthCheck();
        }, this.healthCheckInterval);
        Logger("Connection monitoring started", LOG_LEVEL_VERBOSE);
      }
      /**
       * Stop monitoring
       */
      stopMonitoring() {
        this.isMonitoring = false;
        this.cancelReconnect();
        if (this.healthCheckTimer) {
          clearInterval(this.healthCheckTimer);
          this.healthCheckTimer = null;
        }
        Logger("Connection monitoring stopped", LOG_LEVEL_VERBOSE);
      }
      /**
       * Perform a health check on the connection
       */
      async performHealthCheck() {
        if (!this.core.replicator) return;
        const status = this.core.replicationStat.value.syncStatus;
        if (status === "ERRORED" || status === "CLOSED") {
          const networkOnline = navigator.onLine;
          if (networkOnline) {
            Logger("Connection appears unhealthy, scheduling reconnect", LOG_LEVEL_VERBOSE);
            this.scheduleReconnect(5e3);
          }
        }
      }
      /**
       * Schedule a reconnection attempt
       */
      scheduleReconnect(delay2) {
        this.cancelReconnect();
        Logger(`Scheduling reconnect in ${delay2}ms`, LOG_LEVEL_VERBOSE);
        this.reconnectTimer = setTimeout(async () => {
          this.reconnectTimer = null;
          await this.attemptReconnect();
        }, delay2);
      }
      /**
       * Cancel any pending reconnection
       */
      cancelReconnect() {
        if (this.reconnectTimer) {
          clearTimeout(this.reconnectTimer);
          this.reconnectTimer = null;
        }
      }
      /**
       * Pause auto-reconnect during manual operations (RESET/Push/Fetch)
       * This prevents ConnectionMonitor from interfering with user-initiated operations
       */
      pauseDuringManualOperation() {
        if (this._pausedForManualOperation) return;
        this._pausedForManualOperation = true;
        this.cancelReconnect();
        Logger("Manual operation started - pausing auto-reconnect", LOG_LEVEL_VERBOSE);
      }
      /**
       * Resume auto-reconnect after manual operation completes
       */
      resumeAfterManualOperation() {
        if (!this._pausedForManualOperation) return;
        this._pausedForManualOperation = false;
        Logger("Manual operation finished - resuming auto-reconnect", LOG_LEVEL_VERBOSE);
      }
      /**
       * Attempt to reconnect
       */
      async attemptReconnect() {
        var _a6, _b4, _c2;
        if (this._pausedForManualOperation) {
          Logger("Skipping reconnect - manual operation in progress", LOG_LEVEL_VERBOSE);
          return;
        }
        if (!navigator.onLine) {
          Logger("Network offline, skipping reconnect attempt", LOG_LEVEL_VERBOSE);
          return;
        }
        Logger("Attempting to reconnect...", LOG_LEVEL_INFO);
        try {
          const testResult = await this.core.testConnection();
          if (testResult.success) {
            if ((_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) {
              this.core.managers.networkManager.setServerReachable(true);
            }
            const settings = this.core.getSettings();
            if (settings.liveSync) {
              await this.core.startSync(true, {
                reason: "AUTO_RECONNECT",
                forceCheck: false
              });
              Logger("Reconnected and sync restarted", LOG_LEVEL_NOTICE);
            }
          } else {
            if ((_b4 = this.core.managers) == null ? void 0 : _b4.networkManager) {
              this.core.managers.networkManager.setServerReachable(false);
            }
            const delay2 = this.calculateBackoffDelay();
            Logger(`Reconnect failed, will retry in ${delay2 / 1e3}s`, LOG_LEVEL_INFO);
            this.scheduleReconnect(delay2);
          }
        } catch (error2) {
          if ((_c2 = this.core.managers) == null ? void 0 : _c2.networkManager) {
            this.core.managers.networkManager.setServerReachable(false);
          }
          Logger(`Reconnect error: ${error2}`, LOG_LEVEL_VERBOSE);
          const delay2 = this.calculateBackoffDelay();
          this.scheduleReconnect(delay2);
        }
      }
      /**
       * Calculate backoff delay based on consecutive failures
       */
      calculateBackoffDelay() {
        var _a6, _b4, _c2;
        const failures = (_c2 = (_b4 = (_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) == null ? void 0 : _b4.consecutiveFailures) != null ? _c2 : 1;
        const baseDelay = 1e4;
        const maxDelay = 3e5;
        return Math.min(baseDelay * Math.pow(1.5, failures), maxDelay);
      }
      /**
       * Force an immediate reconnect attempt
       */
      async forceReconnect() {
        var _a6, _b4;
        this.cancelReconnect();
        Logger("Forcing reconnection attempt...", LOG_LEVEL_INFO);
        try {
          const testResult = await this.core.testConnection();
          if (testResult.success) {
            if ((_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) {
              this.core.managers.networkManager.setServerReachable(true);
            }
            return true;
          }
        } catch (error2) {
          Logger(`Force reconnect failed: ${error2}`, LOG_LEVEL_VERBOSE);
        }
        if ((_b4 = this.core.managers) == null ? void 0 : _b4.networkManager) {
          this.core.managers.networkManager.setServerReachable(false);
        }
        return false;
      }
      /**
       * Check if a reconnect is currently scheduled
       */
      isReconnectScheduled() {
        return this.reconnectTimer !== null;
      }
      /**
       * Get time until next reconnect attempt (ms)
       */
      getTimeUntilReconnect() {
        return this.reconnectTimer ? -1 : null;
      }
    };
  }
});

// src/sync/features/ConnectionFailure/index.ts
var FridayConnectionFailureHandler;
var init_ConnectionFailure = __esm({
  "src/sync/features/ConnectionFailure/index.ts"() {
    "use strict";
    init_logger2();
    init_types();
    init_i18n();
    FridayConnectionFailureHandler = class {
      // 30 seconds
      constructor(core) {
        this._lastFailureNotified = 0;
        this._failureNotificationCooldown = 3e4;
        this.core = core;
      }
      /**
       * Check connection failure and determine action
       * 
       * NOTE: Unlike livesync which uses MILESTONE document for database reset detection,
       * Friday uses Salt consistency check. This is more suitable for our backend-controlled
       * database reset scenario where:
       * - Backend rebuilds database with same config but new salt
       * - Salt change is the only indicator of reset
       * - No MILESTONE document management needed
       */
      async checkConnectionFailure() {
        return false;
      }
      /**
       * Notify user about database reset (Notice only, no dialog)
       * User should go to Settings → "Fetch from Server" to recover
       */
      notifyDatabaseReset() {
        const now = Date.now();
        if (now - this._lastFailureNotified < this._failureNotificationCooldown) {
          return;
        }
        this._lastFailureNotified = now;
        Logger(
          $msg("fridaySync.saltChanged.message") || "Remote database has been reset. Please use 'Fetch from Server' in Settings to re-sync.",
          LOG_LEVEL_NOTICE
        );
      }
      /**
       * Handle replication error with retry logic
       * @returns Action to take: 'retry', 'abort', or 'ignore'
       */
      async handleReplicationError(error2, showNotice) {
        var _a6;
        const errorMessage = (error2 == null ? void 0 : error2.message) || String(error2);
        if (this.isNetworkError(error2)) {
          if ((_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) {
            this.core.managers.networkManager.setServerReachable(false);
          }
          if (showNotice && this.shouldShowNotification()) {
            Logger(
              $msg("fridaySync.error.networkUnavailable") || "Cannot connect to sync server. Will retry when network is available.",
              LOG_LEVEL_NOTICE
            );
          }
          return "retry";
        }
        if (this.isAuthError(error2)) {
          Logger(
            $msg("fridaySync.error.authFailed") || "Authentication failed. Please check your credentials in Settings.",
            LOG_LEVEL_NOTICE
          );
          return "abort";
        }
        if (this.isTimeoutError(error2)) {
          Logger("Connection timeout, will retry...", LOG_LEVEL_INFO);
          return "retry";
        }
        Logger(`Sync error: ${errorMessage}`, LOG_LEVEL_VERBOSE);
        return "ignore";
      }
      /**
       * Check if error is network-related
       */
      isNetworkError(error2) {
        var _a6;
        if (!error2) return false;
        const message = ((_a6 = error2 == null ? void 0 : error2.message) == null ? void 0 : _a6.toLowerCase()) || "";
        return error2.name === "TypeError" && message.includes("fetch") || message.includes("network") || message.includes("econnrefused") || message.includes("enotfound") || message.includes("etimedout") || message.includes("failed to fetch") || error2.status === 0;
      }
      /**
       * Check if error is authentication-related
       */
      isAuthError(error2) {
        return (error2 == null ? void 0 : error2.status) === 401 || (error2 == null ? void 0 : error2.status) === 403;
      }
      /**
       * Check if error is timeout-related
       */
      isTimeoutError(error2) {
        var _a6;
        if (!error2) return false;
        const message = ((_a6 = error2 == null ? void 0 : error2.message) == null ? void 0 : _a6.toLowerCase()) || "";
        return message.includes("timeout") || error2.name === "TimeoutError" || error2.status === 408;
      }
      /**
       * Check if we should show a notification (avoid spam)
       */
      shouldShowNotification() {
        const now = Date.now();
        if (now - this._lastFailureNotified < this._failureNotificationCooldown) {
          return false;
        }
        this._lastFailureNotified = now;
        return true;
      }
      /**
       * Calculate retry delay with exponential backoff
       */
      getRetryDelay() {
        var _a6, _b4, _c2;
        const failures = (_c2 = (_b4 = (_a6 = this.core.managers) == null ? void 0 : _a6.networkManager) == null ? void 0 : _b4.consecutiveFailures) != null ? _c2 : 1;
        const baseDelay = 5e3;
        const maxDelay = 3e5;
        const delay2 = Math.min(baseDelay * Math.pow(2, failures - 1), maxDelay);
        return delay2;
      }
      /**
       * Reset notification cooldown (e.g., after successful connection)
       */
      resetNotificationCooldown() {
        this._lastFailureNotified = 0;
      }
    };
  }
});

// src/sync/features/OfflineTracker/index.ts
var OFFLINE_CHANGES_KEY, FridayOfflineTracker;
var init_OfflineTracker = __esm({
  "src/sync/features/OfflineTracker/index.ts"() {
    "use strict";
    init_logger2();
    init_types();
    OFFLINE_CHANGES_KEY = "friday-offline-changes";
    FridayOfflineTracker = class {
      constructor(core) {
        this.pendingChanges = /* @__PURE__ */ new Map();
        this._isOffline = false;
        this.core = core;
        this.kvDB = core.kvDB;
      }
      /**
       * Initialize tracker and load persisted changes
       */
      async initialize() {
        await this.loadPersistedChanges();
      }
      /**
       * Get current offline status
       */
      get isOffline() {
        return this._isOffline;
      }
      /**
       * Set offline status
       */
      setOffline(offline) {
        const wasOffline = this._isOffline;
        this._isOffline = offline;
        if (wasOffline && !offline) {
          this.persistChanges();
          Logger(`Came online with ${this.pendingChanges.size} pending changes`, LOG_LEVEL_INFO);
        }
        if (!wasOffline && offline) {
          Logger("Now tracking changes for offline sync", LOG_LEVEL_INFO);
        }
      }
      /**
       * Track a file change that occurred while offline
       */
      trackChange(path8, type) {
        if (!this._isOffline) return;
        const change = {
          path: path8,
          type,
          timestamp: Date.now()
        };
        this.pendingChanges.set(path8, change);
        Logger(`Tracked offline change: ${type} ${path8}`, LOG_LEVEL_VERBOSE);
        this.persistChanges();
      }
      /**
       * Get all pending offline changes
       */
      getPendingChanges() {
        return Array.from(this.pendingChanges.values());
      }
      /**
       * Get count of pending changes
       */
      get pendingCount() {
        return this.pendingChanges.size;
      }
      /**
       * Clear all pending changes (after successful sync)
       */
      async clearPendingChanges() {
        this.pendingChanges.clear();
        await this.kvDB.delete(OFFLINE_CHANGES_KEY);
        Logger("Offline changes cleared", LOG_LEVEL_VERBOSE);
      }
      /**
       * Apply offline changes after reconnection
       * Source: livesync CmdHiddenFileSync.applyOfflineChanges()
       */
      async applyOfflineChanges(showNotice = true) {
        const changes3 = this.getPendingChanges();
        if (changes3.length === 0) {
          if (showNotice) {
            Logger("No offline changes to apply", LOG_LEVEL_INFO);
          }
          return;
        }
        Logger(
          `Applying ${changes3.length} offline changes...`,
          showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
        );
        let applied = 0;
        let errors2 = 0;
        for (const change of changes3) {
          try {
            await this.applyChange(change);
            applied++;
          } catch (error2) {
            errors2++;
            Logger(`Failed to apply offline change for ${change.path}: ${error2}`, LOG_LEVEL_VERBOSE);
          }
        }
        await this.clearPendingChanges();
        Logger(
          `Applied ${applied} offline changes (${errors2} errors)`,
          showNotice ? LOG_LEVEL_NOTICE : LOG_LEVEL_INFO
        );
      }
      /**
       * Apply a single offline change
       */
      async applyChange(change) {
        const storageManager = this.core.storageEventManager;
        if (!storageManager) return;
        switch (change.type) {
          case "create":
          case "modify":
            await storageManager.processFileEventDirect({
              type: "CHANGED",
              path: change.path
            });
            break;
          case "delete":
            await storageManager.processFileEventDirect({
              type: "DELETE",
              path: change.path
            });
            break;
        }
      }
      /**
       * Persist changes to kvDB for crash recovery
       */
      async persistChanges() {
        try {
          const changes3 = Array.from(this.pendingChanges.entries());
          await this.kvDB.set(OFFLINE_CHANGES_KEY, changes3);
        } catch (error2) {
          Logger(`Failed to persist offline changes: ${error2}`, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Load persisted changes from kvDB
       */
      async loadPersistedChanges() {
        try {
          const stored = await this.kvDB.get(OFFLINE_CHANGES_KEY);
          if (stored && Array.isArray(stored)) {
            this.pendingChanges = new Map(stored);
            if (this.pendingChanges.size > 0) {
              Logger(`Loaded ${this.pendingChanges.size} persisted offline changes`, LOG_LEVEL_INFO);
            }
          }
        } catch (error2) {
          Logger(`Failed to load persisted offline changes: ${error2}`, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Check if there are pending changes
       */
      hasPendingChanges() {
        return this.pendingChanges.size > 0;
      }
      /**
       * Get a summary of pending changes
       */
      getPendingChangesSummary() {
        let creates = 0, modifies = 0, deletes = 0;
        for (const change of this.pendingChanges.values()) {
          switch (change.type) {
            case "create":
              creates++;
              break;
            case "modify":
              modifies++;
              break;
            case "delete":
              deletes++;
              break;
          }
        }
        return { creates, modifies, deletes };
      }
    };
  }
});

// src/sync/features/ServerConnectivity/index.ts
var ServerConnectivityChecker;
var init_ServerConnectivity = __esm({
  "src/sync/features/ServerConnectivity/index.ts"() {
    "use strict";
    init_logger2();
    ServerConnectivityChecker = class {
      constructor() {
        this._lastCheckTime = 0;
        this._lastStatus = "UNKNOWN";
        this._checkCooldown = 5e3;
        // 5 seconds
        this._lastError = void 0;
      }
      /**
       * Current server status based on last check
       */
      get currentStatus() {
        return this._lastStatus;
      }
      /**
       * Whether server is reachable
       */
      get isServerReachable() {
        return this._lastStatus === "REACHABLE";
      }
      /**
       * Last error message (if any)
       */
      get lastError() {
        return this._lastError;
      }
      /**
       * Check server connectivity
       * This is a lightweight check that only verifies server reachability
       * 
       * @param setting - Remote database settings
       * @param forceCheck - If true, bypass cooldown and force a fresh check
       * @returns Connectivity check result
       */
      async checkConnectivity(setting, forceCheck = false) {
        const now = Date.now();
        if (!forceCheck && now - this._lastCheckTime < this._checkCooldown) {
          return {
            status: this._lastStatus,
            error: this._lastError
          };
        }
        if (!navigator.onLine) {
          this._lastStatus = "UNREACHABLE";
          this._lastCheckTime = now;
          this._lastError = "Browser is offline";
          Logger("Server connectivity check: Browser is offline", LOG_LEVEL_INFO);
          return { status: "UNREACHABLE", error: "Browser is offline" };
        }
        const startTime = Date.now();
        try {
          const result = await this.pingServer(setting);
          if (result.ok) {
            this._lastStatus = "REACHABLE";
            this._lastCheckTime = now;
            this._lastError = void 0;
            const latency = Date.now() - startTime;
            Logger(`Server connectivity check passed (${latency}ms)`, LOG_LEVEL_VERBOSE);
            return { status: "REACHABLE", latency };
          } else {
            this._lastStatus = "UNREACHABLE";
            this._lastCheckTime = now;
            this._lastError = result.error;
            Logger(`Server connectivity check failed: ${result.error}`, LOG_LEVEL_INFO);
            return { status: "UNREACHABLE", error: result.error };
          }
        } catch (ex) {
          this._lastStatus = "UNREACHABLE";
          this._lastCheckTime = now;
          const error2 = (ex == null ? void 0 : ex.message) || String(ex);
          this._lastError = error2;
          Logger(`Server connectivity check error: ${error2}`, LOG_LEVEL_VERBOSE);
          return { status: "UNREACHABLE", error: error2 };
        }
      }
      /**
       * Lightweight ping to server
       * Only checks if server responds - doesn't verify database or auth
       * Note: Even 401/403 responses mean server is reachable
       */
      async pingServer(setting) {
        try {
          const uri = setting.couchDB_URI;
          if (!uri) {
            return { ok: false, error: "No server URI configured" };
          }
          const controller = new AbortController();
          const timeoutId = setTimeout(() => controller.abort(), 1e4);
          const response = await fetch(uri, {
            method: "GET",
            signal: controller.signal,
            headers: this.getAuthHeaders(setting)
          });
          clearTimeout(timeoutId);
          if (response.ok || response.status === 401 || response.status === 403) {
            return { ok: true };
          } else if (response.status === 404) {
            return { ok: true };
          } else {
            return { ok: false, error: `HTTP ${response.status}` };
          }
        } catch (ex) {
          if (ex.name === "AbortError") {
            return { ok: false, error: "Connection timeout (10s)" };
          }
          const message = ex.message || "Connection failed";
          if (message.includes("Failed to fetch") || message.includes("NetworkError")) {
            return { ok: false, error: "Cannot reach server" };
          }
          return { ok: false, error: message };
        }
      }
      /**
       * Get authentication headers for the request
       */
      getAuthHeaders(setting) {
        const headers = {};
        if (setting.couchDB_USER && setting.couchDB_PASSWORD) {
          const auth = btoa(`${setting.couchDB_USER}:${setting.couchDB_PASSWORD}`);
          headers["Authorization"] = `Basic ${auth}`;
        }
        return headers;
      }
      /**
       * Reset status to unknown
       * Call this when settings change or on explicit user action
       */
      reset() {
        this._lastStatus = "UNKNOWN";
        this._lastCheckTime = 0;
        this._lastError = void 0;
        Logger("Server connectivity checker reset", LOG_LEVEL_VERBOSE);
      }
      /**
       * Force status update (for when we know server state from other operations)
       */
      setStatus(status, error2) {
        this._lastStatus = status;
        this._lastCheckTime = Date.now();
        this._lastError = error2;
      }
    };
  }
});

// src/sync/FridaySyncCore.ts
var import_obsidian6, SimpleKeyValueDB, FridaySimpleStore, _FridaySyncCore, FridaySyncCore;
var init_FridaySyncCore = __esm({
  "src/sync/FridaySyncCore.ts"() {
    "use strict";
    import_obsidian6 = require("obsidian");
    init_reactive();
    init_types();
    init_LiveSyncLocalDB();
    init_LiveSyncReplicator();
    init_LiveSyncAbstractReplicator();
    init_LiveSyncManagers();
    init_SimpleStoreBase();
    init_logger2();
    init_utils2();
    init_i18n();
    init_FridayServiceHub();
    init_FridayStorageEventManager();
    init_sameChangePairs();
    init_HiddenFileSync();
    init_types2();
    init_NetworkEvents();
    init_ConnectionMonitor();
    init_ConnectionFailure();
    init_OfflineTracker();
    init_ServerConnectivity();
    init_hiddenFileUtils();
    init_pouchdb_browser();
    init_encryption2();
    init_compress();
    init_path();
    SimpleKeyValueDB = class {
      constructor(prefix) {
        this.prefix = prefix;
      }
      getKey(key4) {
        return `${this.prefix}-${key4}`;
      }
      async get(key4) {
        const value2 = localStorage.getItem(this.getKey(key4));
        if (value2 === null) return void 0;
        try {
          return JSON.parse(value2);
        } catch (e2) {
          return void 0;
        }
      }
      async set(key4, value2) {
        localStorage.setItem(this.getKey(key4), JSON.stringify(value2));
      }
      async delete(key4) {
        localStorage.removeItem(this.getKey(key4));
      }
      async keys() {
        const result = [];
        for (let i = 0; i < localStorage.length; i++) {
          const key4 = localStorage.key(i);
          if (key4 == null ? void 0 : key4.startsWith(this.prefix)) {
            result.push(key4.substring(this.prefix.length + 1));
          }
        }
        return result;
      }
      destroy() {
        const keysToRemove = [];
        for (let i = 0; i < localStorage.length; i++) {
          const key4 = localStorage.key(i);
          if (key4 == null ? void 0 : key4.startsWith(this.prefix)) {
            keysToRemove.push(key4);
          }
        }
        keysToRemove.forEach((key4) => localStorage.removeItem(key4));
      }
    };
    FridaySimpleStore = class {
      constructor(name) {
        this.db = new SimpleKeyValueDB(`friday-store-${name}`);
      }
      async get(key4) {
        return this.db.get(key4);
      }
      async set(key4, value2) {
        return this.db.set(key4, value2);
      }
      async delete(key4) {
        return this.db.delete(key4);
      }
      async keys(from, to) {
        const allKeys = await this.db.keys();
        if (!from && !to) return allKeys;
        return allKeys.filter((k) => {
          if (from && k < from) return false;
          if (to && k >= to) return false;
          return true;
        });
      }
      close() {
      }
    };
    _FridaySyncCore = class _FridaySyncCore {
      constructor(plugin2) {
        this._localDatabase = null;
        this._replicator = null;
        this._managers = null;
        // Status tracking
        this.statusCallback = null;
        this._status = "NOT_CONNECTED";
        // Reactive counters for status display (same as livesync)
        this.replicationStat = reactiveSource({
          sent: 0,
          arrived: 0,
          maxPullSeq: 0,
          maxPushSeq: 0,
          lastSyncPullSeq: 0,
          lastSyncPushSeq: 0,
          syncStatus: "NOT_CONNECTED"
        });
        // Additional reactive counters for status display
        this.requestCount = reactiveSource(0);
        this.responseCount = reactiveSource(0);
        this.totalQueued = reactiveSource(0);
        this.batched = reactiveSource(0);
        this.processing = reactiveSource(0);
        this.databaseQueueCount = reactiveSource(0);
        this.storageApplyingCount = reactiveSource(0);
        this.replicationResultCount = reactiveSource(0);
        this.conflictProcessQueueCount = reactiveSource(0);
        this.pendingFileEventCount = reactiveSource(0);
        this.processingFileEventCount = reactiveSource(0);
        this._totalProcessingCount = reactiveSource(0);
        // Status display for progress tracking and UI updates
        this._statusDisplay = null;
        // Storage event manager for watching file changes
        this._storageEventManager = null;
        // Hidden file sync module for .obsidian synchronization
        this._hiddenFileSync = null;
        // Network error handling modules
        this._networkEvents = null;
        this._connectionMonitor = null;
        this._connectionFailureHandler = null;
        this._offlineTracker = null;
        // Server connectivity checker for pre-sync validation
        this._serverChecker = null;
        // Track if file watcher has been started (to avoid duplicate starts)
        this._fileWatcherStarted = false;
        // Track if network monitoring has been started (to avoid duplicate starts)
        this._networkMonitoringStarted = false;
        // Track manual operations (RESET/Push/Fetch) to pause auto-reconnect
        this._manualOperationType = null;
        // Ignore patterns configuration (directly from settings, no file needed)
        this._ignorePatterns = [];
        // Selective sync settings (for file type filtering)
        this._selectiveSync = {
          syncImages: true,
          syncAudio: false,
          syncVideo: false,
          syncPdf: false
        };
        /**
         * Set up monitoring for replication status changes
         * Note: Uses VERBOSE level to avoid cluttering user-visible logs
         * These messages are for debugging/console only
         */
        this._lastLoggedStatus = "";
        this.plugin = plugin2;
        this._settings = { ...DEFAULT_SETTINGS };
        this._services = new FridayServiceHub(this);
        this._kvDB = new SimpleKeyValueDB("friday-kv");
        this._simpleStore = new FridaySimpleStore("checkpoint");
        this.onFileProgress = (event2) => {
          var _a6;
          const tracker = (_a6 = this._statusDisplay) == null ? void 0 : _a6.getFileProgressTracker();
          if (tracker) {
            tracker.handleEvent(event2);
          }
        };
        setGlobalLogFunction((message, level, key4) => {
          const msgStr = String(message);
          const logLevel = level != null ? level : LOG_LEVEL_INFO;
          if (this._logCallback) {
            this._logCallback(msgStr, logLevel, key4);
          }
        });
      }
      /**
       * Set log callback for status display integration
       * This allows SyncStatusDisplay to receive log messages
       * @param callback - Function that receives (message, level, key)
       */
      setLogCallback(callback) {
        this._logCallback = callback;
      }
      /**
       * Set status display for progress tracking
       * This allows FridaySyncCore to update progress bars
       * @param statusDisplay - SyncStatusDisplay instance
       */
      setStatusDisplay(statusDisplay) {
        this._statusDisplay = statusDisplay;
      }
      // ==================== LiveSyncLocalDBEnv Implementation ====================
      getSettings() {
        return this._settings;
      }
      // Getter for direct property access (used by Services)
      get settings() {
        return this._settings;
      }
      get managers() {
        if (!this._managers) {
          throw new Error("Managers not initialized");
        }
        return this._managers;
      }
      get services() {
        return this._services;
      }
      get app() {
        return this.plugin.app;
      }
      // ==================== LiveSyncReplicatorEnv Implementation ====================
      getDatabase() {
        var _a6;
        if (!((_a6 = this._localDatabase) == null ? void 0 : _a6.localDatabase)) {
          throw new Error("Local database not initialized");
        }
        return this._localDatabase.localDatabase;
      }
      get kvDB() {
        return this._kvDB;
      }
      get simpleStore() {
        return this._simpleStore;
      }
      // ==================== Public API ====================
      get status() {
        return this._status;
      }
      get localDatabase() {
        return this._localDatabase;
      }
      get replicator() {
        return this._replicator;
      }
      get hiddenFileSync() {
        return this._hiddenFileSync;
      }
      /**
       * Current server connectivity status
       */
      get serverStatus() {
        var _a6, _b4;
        return (_b4 = (_a6 = this._serverChecker) == null ? void 0 : _a6.currentStatus) != null ? _b4 : "UNKNOWN";
      }
      /**
       * Whether server is currently reachable
       * Used by replicator for error attribution
       */
      isServerReachable() {
        var _a6, _b4;
        return (_b4 = (_a6 = this._serverChecker) == null ? void 0 : _a6.isServerReachable) != null ? _b4 : false;
      }
      get offlineTracker() {
        return this._offlineTracker;
      }
      get connectionMonitor() {
        return this._connectionMonitor;
      }
      get connectionFailureHandler() {
        return this._connectionFailureHandler;
      }
      /**
       * Check if a manual operation (RESET/Push/Fetch) is in progress
       */
      get isManualOperation() {
        return this._manualOperationType !== null;
      }
      /**
       * Get the type of manual operation currently in progress
       */
      get manualOperationType() {
        return this._manualOperationType;
      }
      /**
       * Start network monitoring (event listeners and connection monitoring)
       * 
       * This should be called:
       * - After first-time upload completes (rebuildRemote)
       * - After first-time download completes (fetchFromServer)
       * - Automatically during normal sync startup (if not first-time)
       */
      startNetworkMonitoring() {
        if (this._networkMonitoringStarted) {
          Logger("Network monitoring already started", LOG_LEVEL_VERBOSE);
          return;
        }
        if (this._networkEvents) {
          this._networkEvents.registerEvents();
        }
        if (this._connectionMonitor) {
          this._connectionMonitor.startMonitoring();
        }
        this._networkMonitoringStarted = true;
        Logger("Network monitoring started (auto-reconnect enabled)", LOG_LEVEL_INFO);
      }
      /**
       * Stop network monitoring
       */
      stopNetworkMonitoring() {
        if (!this._networkMonitoringStarted) {
          return;
        }
        if (this._connectionMonitor) {
          this._connectionMonitor.stopMonitoring();
        }
        if (this._networkEvents) {
          this._networkEvents.unload();
        }
        this._networkMonitoringStarted = false;
        Logger("Network monitoring stopped", LOG_LEVEL_VERBOSE);
      }
      onStatusChange(callback) {
        this.statusCallback = callback;
      }
      setStatus(status, message) {
        this._status = status;
        this.replicationStat.value = {
          ...this.replicationStat.value,
          syncStatus: status
        };
        if (this.statusCallback) {
          this.statusCallback(status, message);
        }
      }
      setupStatusMonitoring() {
        setInterval(() => {
          const currentStatus = this.replicationStat.value.syncStatus;
          if (currentStatus !== this._lastLoggedStatus) {
            Logger(`[Status Change] ${this._lastLoggedStatus || "initial"} -> ${currentStatus}`, LOG_LEVEL_VERBOSE);
            this._lastLoggedStatus = currentStatus;
            const stat = this.replicationStat.value;
            Logger(`  Docs: sent=${stat.sent}, arrived=${stat.arrived}`, LOG_LEVEL_VERBOSE);
            Logger(`  Seq: pull=${stat.lastSyncPullSeq}/${stat.maxPullSeq}, push=${stat.lastSyncPushSeq}/${stat.maxPushSeq}`, LOG_LEVEL_VERBOSE);
          }
        }, 2e3);
      }
      /**
       * Initialize the sync core with configuration
       */
      async initialize(config) {
        var _a6, _b4, _c2, _d, _e, _f, _g, _h, _i;
        try {
          this._ignorePatterns = config.ignorePatterns || [];
          if (config.selectiveSync) {
            this._selectiveSync = {
              syncImages: (_a6 = config.selectiveSync.syncImages) != null ? _a6 : false,
              syncAudio: (_b4 = config.selectiveSync.syncAudio) != null ? _b4 : false,
              syncVideo: (_c2 = config.selectiveSync.syncVideo) != null ? _c2 : false,
              syncPdf: (_d = config.selectiveSync.syncPdf) != null ? _d : false
            };
          }
          this._settings = {
            ...DEFAULT_SETTINGS,
            couchDB_URI: config.couchDB_URI,
            couchDB_USER: config.couchDB_USER,
            couchDB_PASSWORD: config.couchDB_PASSWORD,
            couchDB_DBNAME: config.couchDB_DBNAME,
            encrypt: config.encrypt,
            passphrase: config.passphrase,
            usePathObfuscation: config.usePathObfuscation,
            liveSync: config.liveSync,
            syncOnStart: config.syncOnStart,
            syncOnSave: config.syncOnSave,
            remoteType: REMOTE_COUCHDB,
            isConfigured: true,
            // Livesync ignore file settings (disabled - we use in-memory patterns)
            useIgnoreFiles: false,
            ignoreFiles: "",
            // Hidden file sync settings (default: enabled with best practices)
            syncInternalFiles: (_e = config.syncInternalFiles) != null ? _e : true,
            syncInternalFilesBeforeReplication: (_f = config.syncInternalFilesBeforeReplication) != null ? _f : true,
            syncInternalFilesInterval: (_g = config.syncInternalFilesInterval) != null ? _g : 60,
            syncInternalFilesIgnorePatterns: config.syncInternalFilesIgnorePatterns ? `${DEFAULT_INTERNAL_IGNORE_PATTERNS},${config.syncInternalFilesIgnorePatterns}` : DEFAULT_INTERNAL_IGNORE_PATTERNS,
            syncInternalFilesTargetPatterns: (_h = config.syncInternalFilesTargetPatterns) != null ? _h : "",
            watchInternalFileChanges: (_i = config.watchInternalFileChanges) != null ? _i : true
          };
          const getDB = () => this._localDatabase.localDatabase;
          const getSettings = () => this._settings;
          this._managers = new LiveSyncManagers({
            get database() {
              return getDB();
            },
            getActiveReplicator: () => this._replicator,
            id2path: this.id2path.bind(this),
            path2id: this.path2id.bind(this),
            get settings() {
              return getSettings();
            }
          });
          this._services.databaseEvents.handleOnDatabaseInitialisation(async (db) => {
            replicationFilter(db.localDatabase, false);
            disableEncryption();
            if (this._settings.passphrase && this._settings.encrypt) {
              const e2eeAlgorithm = this._settings.E2EEAlgorithm || E2EEAlgorithms.V2;
              enableEncryption(
                db.localDatabase,
                this._settings.passphrase,
                false,
                // useDynamicIterationCount
                false,
                // migrationDecrypt
                async () => {
                  if (!this._replicator) {
                    const tempReplicator = new LiveSyncCouchDBReplicator(this);
                    return await tempReplicator.getReplicationPBKDF2Salt(this._settings);
                  }
                  return await this._replicator.getReplicationPBKDF2Salt(this._settings);
                },
                e2eeAlgorithm
              );
            } else {
              console.warn("[Friday Sync] No passphrase configured or encryption disabled - skipping encryption");
            }
            return true;
          });
          const vaultName = this.getVaultName();
          this._localDatabase = new LiveSyncLocalDB(vaultName, this);
          const dbInitialized = await this._localDatabase.initializeDatabase();
          if (!dbInitialized) {
            this.setStatus("ERRORED", "Failed to initialize local database");
            return false;
          }
          initializeSameChangePairs(vaultName);
          Logger("sameChangePairs storage initialized", LOG_LEVEL_INFO);
          this._replicator = new LiveSyncCouchDBReplicator(this);
          this._storageEventManager = new FridayStorageEventManager(this.plugin, this);
          if (this._settings.syncInternalFiles !== false) {
            this._hiddenFileSync = new FridayHiddenFileSync(this.plugin, this);
            await this._hiddenFileSync.onload();
            Logger("Hidden file sync module initialized", LOG_LEVEL_INFO);
          }
          this._networkEvents = new FridayNetworkEvents(this.plugin, this);
          this._connectionMonitor = new FridayConnectionMonitor(this);
          this._connectionFailureHandler = new FridayConnectionFailureHandler(this);
          this._offlineTracker = new FridayOfflineTracker(this);
          this._serverChecker = new ServerConnectivityChecker();
          await this._offlineTracker.initialize();
          Logger("Network error handling modules initialized (monitoring not started yet)", LOG_LEVEL_INFO);
          this.setupStatusMonitoring();
          this.setStatus("NOT_CONNECTED", "Sync initialized");
          Logger("Sync core initialized", LOG_LEVEL_INFO);
          return true;
        } catch (error2) {
          console.error("Sync initialization failed:", error2);
          this.setStatus("ERRORED", `Initialization failed: ${error2}`);
          return false;
        }
      }
      /**
       * Check if the remote database has been reset/rebuilt
       * 
       * This happens when:
       * - The main vault resets the remote database
       * - The remote database was corrupted and rebuilt
       * - Chunk cleanup was performed on the remote
       * 
       * When detected, the user should use "Fetch from Server" to re-sync.
       * 
       * @returns true if database reset was detected
       */
      isRemoteDatabaseReset() {
        if (!this._replicator) return false;
        return this._replicator.remoteLockedAndDeviceNotAccepted;
      }
      /**
       * Check if there are any sync issues that need user attention
       * 
       * @returns object with status flags and message
       */
      getSyncIssues() {
        if (!this._replicator) {
          return { hasIssues: false, message: "", needsFetch: false };
        }
        if (this._replicator.remoteLockedAndDeviceNotAccepted) {
          return {
            hasIssues: true,
            needsFetch: true,
            message: "Remote database has been reset. Use 'Fetch from Server' to re-sync."
          };
        }
        if (this._replicator.tweakSettingsMismatched) {
          return {
            hasIssues: true,
            needsFetch: false,
            message: "Configuration mismatch detected between devices."
          };
        }
        return { hasIssues: false, message: "", needsFetch: false };
      }
      /**
       * Handle network recovery - called when network comes back online
       * Source: Network event handlers trigger this when online event fires
       */
      async handleNetworkRecovery() {
        var _a6;
        Logger("Network recovery detected", LOG_LEVEL_INFO);
        const currentStatus = this.replicationStat.value.syncStatus;
        if (currentStatus === "LIVE") {
          Logger("Sync already in LIVE state, skipping recovery", LOG_LEVEL_VERBOSE);
          return;
        }
        (_a6 = this._managers) == null ? void 0 : _a6.networkManager.setServerReachable(true);
        if (this._offlineTracker) {
          this._offlineTracker.setOffline(false);
        }
        if (this._offlineTracker && this._offlineTracker.pendingCount > 0) {
          await this._offlineTracker.applyOfflineChanges(true);
        }
        if (this._settings.liveSync && this._replicator) {
          if (currentStatus !== "LIVE") {
            Logger(`Restarting sync after network recovery (current status: ${currentStatus})`, LOG_LEVEL_INFO);
            await this.startSync(true, {
              reason: "NETWORK_RECOVERY",
              forceCheck: true
            });
          }
        }
      }
      /**
       * Start synchronization
       * 
       * @param continuous - If true (default), starts LiveSync mode (continuous replication)
       *                     If false, performs a one-shot sync
       * @param options - Optional configuration:
       *                  - reason: Why sync is being started (for logging and behavior)
       *                  - forceCheck: Force server connectivity check (bypass cooldown)
       * 
       * Note: Following livesync's pattern, continuous sync uses showResult=false
       * to avoid spamming users with Notice popups. Status is shown in the 
       * top-right corner display instead.
       * 
       * IMPORTANT: File watcher is started AFTER a delay to avoid capturing
       * Obsidian's startup events as file changes.
       */
      async startSync(continuous = true, options) {
        var _a6, _b4, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
        if (!this._replicator) {
          this.setStatus("ERRORED", "Replicator not initialized");
          return false;
        }
        const reason = (_a6 = options == null ? void 0 : options.reason) != null ? _a6 : "PLUGIN_STARTUP";
        const forceCheck = (_b4 = options == null ? void 0 : options.forceCheck) != null ? _b4 : reason === "PLUGIN_STARTUP";
        Logger(`Starting sync (reason: ${reason}, forceCheck: ${forceCheck})`, LOG_LEVEL_VERBOSE);
        if (this._replicator.remoteLockedAndDeviceNotAccepted) {
          Logger(
            $msg("fridaySync.saltChanged.actionRequired") || "Remote database has been reset. Please go to Settings \u2192 'Fetch from Server' to re-sync your vault.",
            LOG_LEVEL_NOTICE
          );
          this.setStatus("ERRORED", "Device not accepted - Fetch required");
          return false;
        }
        try {
          this.setStatus("STARTED", "Checking server connectivity...");
          const connectivityResult = await ((_c2 = this._serverChecker) == null ? void 0 : _c2.checkConnectivity(
            this._settings,
            forceCheck
          ));
          if ((connectivityResult == null ? void 0 : connectivityResult.status) !== "REACHABLE") {
            return this.handleOfflineMode(connectivityResult == null ? void 0 : connectivityResult.error);
          }
          Logger("Server connectivity confirmed", LOG_LEVEL_VERBOSE);
          (_d = this._managers) == null ? void 0 : _d.networkManager.setServerReachable(true);
          (_e = this._serverChecker) == null ? void 0 : _e.setStatus("REACHABLE");
          if (this._offlineTracker) {
            this._offlineTracker.setOffline(false);
          }
          this.startFileWatcherIfNeeded();
          if (continuous) {
            Logger("Starting LiveSync mode...", LOG_LEVEL_INFO);
            await this._replicator.openReplication(
              this._settings,
              true,
              // keepAlive = true for LiveSync
              false,
              // showResult: false for LiveSync
              false
              // ignoreCleanLock
            );
            this.setupConnectionTimeout();
          } else {
            const result = await this._replicator.openReplication(
              this._settings,
              false,
              // keepAlive = false for OneShot
              false,
              // showResult
              false
              // ignoreCleanLock
            );
            if (!result) {
              (_f = this._managers) == null ? void 0 : _f.networkManager.setServerReachable(false);
              (_g = this._serverChecker) == null ? void 0 : _g.setStatus("UNREACHABLE", "Sync operation failed");
              const issues2 = this.getSyncIssues();
              if (issues2.needsFetch) {
                Logger(issues2.message, LOG_LEVEL_NOTICE);
                this.setStatus("ERRORED", "Database reset detected");
              } else {
                this.setStatus("NOT_CONNECTED", "Connection failed, will retry");
                (_h = this._connectionMonitor) == null ? void 0 : _h.scheduleReconnect(5e3);
              }
              return false;
            }
          }
          (_i = this._connectionFailureHandler) == null ? void 0 : _i.resetNotificationCooldown();
          const issues = this.getSyncIssues();
          if (issues.needsFetch) {
            Logger(issues.message, LOG_LEVEL_NOTICE);
            this.setStatus("ERRORED", "Database reset detected");
            return false;
          }
          this.startNetworkMonitoring();
          return true;
        } catch (error2) {
          console.error("Sync failed:", error2);
          (_j = this._managers) == null ? void 0 : _j.networkManager.setServerReachable(false);
          (_k = this._serverChecker) == null ? void 0 : _k.setStatus("UNREACHABLE", String(error2));
          const action2 = await ((_l = this._connectionFailureHandler) == null ? void 0 : _l.handleReplicationError(error2, true));
          if (action2 === "retry") {
            const delay2 = ((_m = this._connectionFailureHandler) == null ? void 0 : _m.getRetryDelay()) || 1e4;
            (_n = this._connectionMonitor) == null ? void 0 : _n.scheduleReconnect(delay2);
            this.setStatus("NOT_CONNECTED", "Connection failed, will retry");
          } else {
            this.setStatus("ERRORED", "Sync failed");
          }
          return false;
        }
      }
      /**
       * Handle offline mode when server is unreachable
       * This ensures local changes are still saved and reconnection is scheduled
       */
      handleOfflineMode(errorMessage) {
        var _a6, _b4, _c2;
        Logger(`Server unreachable: ${errorMessage || "unknown reason"}`, LOG_LEVEL_INFO);
        (_a6 = this._managers) == null ? void 0 : _a6.networkManager.setServerReachable(false);
        (_b4 = this._serverChecker) == null ? void 0 : _b4.setStatus("UNREACHABLE", errorMessage);
        this.setStatus("NOT_CONNECTED", "Server unreachable, offline mode");
        this.startFileWatcherIfNeeded();
        if (this._offlineTracker) {
          this._offlineTracker.setOffline(true);
        }
        (_c2 = this._connectionMonitor) == null ? void 0 : _c2.scheduleReconnect(1e4);
        Logger(
          $msg("fridaySync.error.cannotConnectServer") || "Cannot connect to server. Changes will be saved locally.",
          LOG_LEVEL_NOTICE
        );
        return false;
      }
      /**
       * Start file watcher if not already started
       * This ensures local changes are always saved to PouchDB, even in offline mode
       */
      startFileWatcherIfNeeded() {
        if (this._storageEventManager && !this._fileWatcherStarted) {
          this._fileWatcherStarted = true;
          const WATCH_DELAY_MS = 1500;
          Logger(`File watcher will start in ${WATCH_DELAY_MS}ms...`, LOG_LEVEL_VERBOSE);
          setTimeout(() => {
            if (this._storageEventManager) {
              this._storageEventManager.beginWatch();
              Logger("File watcher started - local changes will be saved", LOG_LEVEL_INFO);
            }
          }, WATCH_DELAY_MS);
        }
      }
      /**
       * Setup connection timeout safety net
       * If status remains STARTED after timeout, transition to error state
       */
      setupConnectionTimeout() {
        const CONNECTION_TIMEOUT_MS = 3e4;
        setTimeout(() => {
          var _a6, _b4, _c2;
          const status = this.replicationStat.value.syncStatus;
          if (status === "STARTED") {
            Logger("Connection timeout - status stuck at STARTED", LOG_LEVEL_INFO);
            this.setStatus("NOT_CONNECTED", "Connection timeout");
            (_a6 = this._managers) == null ? void 0 : _a6.networkManager.setServerReachable(false);
            (_b4 = this._serverChecker) == null ? void 0 : _b4.setStatus("UNREACHABLE", "Connection timeout");
            (_c2 = this._connectionMonitor) == null ? void 0 : _c2.scheduleReconnect(1e4);
          }
        }, CONNECTION_TIMEOUT_MS);
      }
      /**
       * Execute a manual operation with auto-reconnect paused
       * This prevents ConnectionMonitor from interfering during user-initiated operations
       * 
       * @param type - Type of manual operation
       * @param operation - The async operation to execute
       * @returns Result of the operation
       */
      async _executeManualOperation(type, operation) {
        var _a6, _b4;
        this._manualOperationType = type;
        try {
          (_a6 = this._connectionMonitor) == null ? void 0 : _a6.pauseDuringManualOperation();
          Logger(`Starting manual operation: ${type}`, LOG_LEVEL_INFO);
          const result = await operation();
          Logger(`Manual operation completed: ${type}`, LOG_LEVEL_INFO);
          return result;
        } catch (error2) {
          Logger(`Manual operation failed: ${type}`, LOG_LEVEL_INFO);
          Logger(error2, LOG_LEVEL_VERBOSE);
          throw error2;
        } finally {
          this._manualOperationType = null;
          (_b4 = this._connectionMonitor) == null ? void 0 : _b4.resumeAfterManualOperation();
        }
      }
      /**
       * Pull all documents from server (one-shot)
       */
      async pullFromServer() {
        if (!this._replicator) {
          this.setStatus("ERRORED", "Replicator not initialized");
          return false;
        }
        try {
          this.setStatus("STARTED", "Pulling from server...");
          Logger($msg("fridaySync.pull.pulling"), LOG_LEVEL_NOTICE);
          const result = await this._replicator.replicateAllFromServer(this._settings, true);
          if (result) {
            this.setStatus("COMPLETED", "Pull completed");
            Logger($msg("fridaySync.pull.completed"), LOG_LEVEL_NOTICE);
          } else {
            this.setStatus("ERRORED", "Pull failed");
            Logger($msg("fridaySync.pull.failed"), LOG_LEVEL_NOTICE);
          }
          return result;
        } catch (error2) {
          console.error("Pull failed:", error2);
          this.setStatus("ERRORED", "Pull failed");
          Logger($msg("fridaySync.pull.failedConnection"), LOG_LEVEL_NOTICE);
          Logger(error2, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Push all documents to server (one-shot)
       */
      async pushToServer() {
        if (!this._replicator) {
          this.setStatus("ERRORED", "Replicator not initialized");
          return false;
        }
        return this._executeManualOperation("PUSH", async () => {
          try {
            this.setStatus("STARTED", "Pushing to server...");
            Logger($msg("fridaySync.push.pushing"), LOG_LEVEL_NOTICE);
            const result = await this._replicator.replicateAllToServer(this._settings, true);
            if (result) {
              this.setStatus("COMPLETED", "Push completed");
              Logger($msg("fridaySync.push.completed"), LOG_LEVEL_NOTICE);
            } else {
              this.setStatus("ERRORED", "Push failed");
              Logger($msg("fridaySync.push.failed"), LOG_LEVEL_NOTICE);
            }
            return result;
          } catch (error2) {
            console.error("Push failed:", error2);
            this.setStatus("ERRORED", "Push failed");
            Logger($msg("fridaySync.push.failedConnection"), LOG_LEVEL_NOTICE);
            Logger(error2, LOG_LEVEL_VERBOSE);
            return false;
          }
        });
      }
      /**
       * Fetch from server for first-time sync
       * 
       * This method is used when connecting a new device to an existing database.
       * It marks the device as resolved (accepted) and then pulls all data from server.
       */
      async fetchFromServer() {
        if (!this._replicator) {
          this.setStatus("ERRORED", "Replicator not initialized");
          return false;
        }
        return this._executeManualOperation("FETCH", async () => {
          try {
            this.setStatus("STARTED", "Fetching from server (first-time sync)...");
            Logger($msg("fridaySync.fetch.fetching"), LOG_LEVEL_NOTICE);
            Logger("Marking remote as resolved...", LOG_LEVEL_INFO);
            await this._replicator.markRemoteResolved(this._settings);
            Logger("Rebuilding local database from remote...", LOG_LEVEL_INFO);
            const result = await this.rebuildLocalFromRemote();
            if (result) {
              this.setStatus("COMPLETED", "Fetch completed");
              Logger($msg("fridaySync.fetch.completed"), LOG_LEVEL_NOTICE);
            } else {
              this.setStatus("ERRORED", "Fetch failed");
              Logger($msg("fridaySync.fetch.failed"), LOG_LEVEL_NOTICE);
            }
            return result;
          } catch (error2) {
            console.error("Fetch failed:", error2);
            this.setStatus("ERRORED", "Fetch failed");
            Logger($msg("fridaySync.fetch.failedConnection"), LOG_LEVEL_NOTICE);
            Logger(error2, LOG_LEVEL_VERBOSE);
            return false;
          }
        });
      }
      /**
       * Rebuild remote database from local files
       * 
       * This method is used for first-time sync from a device that has local files.
       * It will:
       * 1. Scan all local vault files and store them in local PouchDB
       * 2. Reset the remote database
       * 3. Push all local data to the remote server
       * 
       * WARNING: This will overwrite the remote database!
       * Other devices will need to fetch from server after this operation.
       * 
       * Based on livesync's ModuleRebuilder.rebuildRemote()
       */
      async rebuildRemote() {
        if (!this._replicator || !this._localDatabase) {
          this.setStatus("ERRORED", "Sync not initialized");
          return false;
        }
        return this._executeManualOperation("RESET", async () => {
          var _a6, _b4;
          try {
            this.setStatus("STARTED", "Uploading your files...");
            Logger($msg("fridaySync.rebuildRemote.rebuilding"), LOG_LEVEL_NOTICE);
            const vault = this.plugin.app.vault;
            const files = vault.getFiles();
            const totalFiles = files.length;
            (_a6 = this.onFileProgress) == null ? void 0 : _a6.call(this, {
              type: "upload_start",
              totalFiles
            });
            Logger("Step 1: Scanning local vault and storing to database...", LOG_LEVEL_INFO);
            const scanResult = await this.scanAndStoreVaultToDB();
            if (!scanResult) {
              Logger($msg("fridaySync.rebuildRemote.scanFailed"), LOG_LEVEL_NOTICE);
              this.setStatus("ERRORED", "Failed to scan vault files");
              return false;
            }
            Logger("Step 2: Marking remote database as locked...", LOG_LEVEL_INFO);
            await this._replicator.markRemoteLocked(this._settings, true, true);
            Logger("Step 3: Resetting remote database...", LOG_LEVEL_INFO);
            try {
              await this._replicator.tryResetRemoteDatabase(this._settings);
            } catch (error2) {
              console.error("[RebuildRemote] Step 3: Reset remote database error (may be expected if DB doesn't exist):", error2);
            }
            Logger("Step 4: Marking remote database as locked again...", LOG_LEVEL_INFO);
            await this._replicator.markRemoteLocked(this._settings, true, true);
            Logger("Step 5: Creating remote database...", LOG_LEVEL_INFO);
            try {
              await this._replicator.tryCreateRemoteDatabase(this._settings);
            } catch (error2) {
              console.error("[RebuildRemote] Step 5: Create remote database error:", error2);
            }
            await new Promise((resolve) => setTimeout(resolve, 500));
            Logger("Step 6: Pushing all data to remote server...", LOG_LEVEL_INFO);
            Logger($msg("fridaySync.rebuildRemote.pushingData"), LOG_LEVEL_INFO);
            let result = await this._replicator.replicateAllToServer(this._settings, true);
            if (!result) {
              console.error("[RebuildRemote] \u274C First push attempt failed, retrying...");
              Logger("First push attempt failed, retrying...", LOG_LEVEL_INFO);
            }
            await new Promise((resolve) => setTimeout(resolve, 1e3));
            Logger("Step 7: Final push to ensure all data is synced...", LOG_LEVEL_INFO);
            result = await this._replicator.replicateAllToServer(this._settings, true);
            if (result) {
              this.setStatus("COMPLETED", "Remote database rebuilt successfully");
              (_b4 = this.onFileProgress) == null ? void 0 : _b4.call(this, {
                type: "upload_complete",
                totalFiles,
                successCount: totalFiles,
                errorCount: 0
              });
              Logger($msg("fridaySync.rebuildRemote.success"), LOG_LEVEL_NOTICE);
              Logger("Other devices should now use 'Fetch from Server' to sync", LOG_LEVEL_INFO);
              this.startNetworkMonitoring();
            } else {
              this.setStatus("ERRORED", "Rebuild remote failed");
              Logger($msg("fridaySync.rebuildRemote.failed"), LOG_LEVEL_NOTICE);
            }
            return result;
          } catch (error2) {
            this.setStatus("ERRORED", `Rebuild remote error: ${error2}`);
            Logger(`Rebuild remote error: ${error2}`, LOG_LEVEL_NOTICE);
            console.error("[RebuildRemote] Error:", error2);
            return false;
          }
        });
      }
      /**
       * Scan all vault files and store them to local PouchDB database
       * 
       * This prepares local database for pushing to remote.
       */
      async scanAndStoreVaultToDB() {
        if (!this._localDatabase || !this._storageEventManager) {
          return false;
        }
        try {
          const vault = this.plugin.app.vault;
          const files = vault.getFiles();
          Logger(`Found ${files.length} files in vault`, LOG_LEVEL_INFO);
          let stored = 0;
          let skipped = 0;
          let ignored = 0;
          let errors2 = 0;
          for (const file of files) {
            try {
              if (file.path.startsWith(".")) {
                skipped++;
                continue;
              }
              if (!await this.isTargetFile(file.path)) {
                ignored++;
                Logger(`File ignored by ignore patterns: ${file.path}`, LOG_LEVEL_VERBOSE);
                continue;
              }
              const result = await this._storageEventManager.processFileEventDirect({
                type: "CHANGED",
                path: file.path,
                file
              });
              if (result) {
                stored++;
                if (stored % 50 === 0) {
                  Logger(`Stored ${stored}/${files.length} files...`, LOG_LEVEL_INFO);
                }
              } else {
                errors2++;
              }
            } catch (error2) {
              console.error(`Error storing file ${file.path}:`, error2);
              errors2++;
            }
          }
          Logger(`Vault scan complete: ${stored} stored, ${skipped} skipped (hidden), ${ignored} ignored (patterns), ${errors2} errors`, LOG_LEVEL_INFO);
          Logger(
            $msg("fridaySync.rebuildRemote.filesPrepared", { count: stored.toString() }) || `Prepared ${stored} files for upload`,
            LOG_LEVEL_VERBOSE
          );
          return errors2 === 0 || stored > 0;
        } catch (error2) {
          console.error("Vault scan failed:", error2);
          return false;
        }
      }
      /**
       * Rebuild vault from local PouchDB database
       * 
       * ⚠️ IMPORTANT: This method assumes chunks are already present in local database!
       * 
       * This reads all documents from the local database and writes them to the vault.
       * It's typically called AFTER data has been replicated from remote (via rebuildLocalFromRemote).
       * 
       * Flow:
       * 1. Scan local database for all documents
       * 2. For each document, read its content (chunks must exist)
       * 3. Write to vault (files and folders)
       * 
       * If you need to download data from server first, use rebuildLocalFromRemote() instead.
       */
      async rebuildVaultFromDB() {
        var _a6, _b4, _c2, _d, _e, _f;
        if (!this._localDatabase) {
          Logger($msg("fridaySync.rebuild.localDbNotInitialized"), LOG_LEVEL_NOTICE);
          return false;
        }
        try {
          const vault = this.plugin.app.vault;
          const localDB = this._localDatabase.localDatabase;
          Logger("Scanning local database for files...", LOG_LEVEL_INFO);
          const allDocs2 = await localDB.allDocs({
            include_docs: true,
            attachments: false
          });
          let totalFilesToWrite = 0;
          for (const row of allDocs2.rows) {
            const doc = row.doc;
            if (!doc) continue;
            if (doc._id.startsWith("h:")) continue;
            if (doc._id.startsWith("_")) continue;
            if (doc.type === "versioninfo") continue;
            if (doc.type === "milestoneinfo") continue;
            if (doc.type === "nodeinfo") continue;
            if (doc.type === "leaf") continue;
            const docPath = doc.path;
            const isInternalFile = isInternalMetadata(doc._id) || docPath && isInternalMetadata(docPath);
            if (isInternalFile) {
              totalFilesToWrite++;
              continue;
            }
            const docType = doc.type;
            if (docType === "notes" || docType === "newnote" || docType === "plain") {
              const isDeleted2 = doc._deleted === true || doc.deleted === true;
              if (!isDeleted2 && docPath) {
                totalFilesToWrite++;
              }
            }
          }
          (_a6 = this.onFileProgress) == null ? void 0 : _a6.call(this, {
            type: "file_write_start",
            totalFiles: totalFilesToWrite
          });
          let processed = 0;
          let created = 0;
          let updated = 0;
          let errors2 = 0;
          let internalFilesProcessed = 0;
          let internalFilesErrors = 0;
          let missingChunksErrors = 0;
          const missingChunksFiles = [];
          for (const row of allDocs2.rows) {
            const doc = row.doc;
            if (!doc) continue;
            if (doc._id.startsWith("h:")) continue;
            if (doc._id.startsWith("_")) continue;
            if (doc.type === "versioninfo") continue;
            if (doc.type === "milestoneinfo") continue;
            if (doc.type === "nodeinfo") continue;
            if (doc.type === "leaf") continue;
            const docPath = doc.path;
            const isInternalFile = isInternalMetadata(doc._id) || docPath && isInternalMetadata(docPath);
            if (isInternalFile) {
              if (this._hiddenFileSync && this._hiddenFileSync.isThisModuleEnabled()) {
                try {
                  const result = await this._hiddenFileSync.processReplicationResult(doc);
                  if (result) {
                    internalFilesProcessed++;
                    (_b4 = this.onFileProgress) == null ? void 0 : _b4.call(this, {
                      type: "file_write_progress",
                      writtenFiles: internalFilesProcessed + created + updated,
                      totalFiles: totalFilesToWrite,
                      currentFilePath: docPath || doc._id
                    });
                  } else {
                    internalFilesErrors++;
                  }
                } catch (ex) {
                  internalFilesErrors++;
                  console.error(`[Friday Sync] Error processing internal file:`, {
                    docId: doc._id,
                    path: docPath,
                    error: ex instanceof Error ? ex.message : String(ex)
                  });
                }
              }
              continue;
            }
            const docType = doc.type;
            if (docType !== "notes" && docType !== "newnote" && docType !== "plain") continue;
            const path8 = docPath;
            if (!path8) continue;
            const isDeleted2 = doc._deleted === true || doc.deleted === true;
            if (isDeleted2) continue;
            processed++;
            try {
              const fullEntry = await this._localDatabase.getDBEntryFromMeta(doc, false, true);
              if (!fullEntry) {
                missingChunksErrors++;
                if (missingChunksFiles.length < 10) {
                  missingChunksFiles.push(path8);
                }
                console.error(`[Friday Sync] Could not get full entry for:`, {
                  docId: doc._id,
                  path: path8,
                  docType: doc.type,
                  docSize: doc.size,
                  docChildren: (_d = (_c2 = doc.children) == null ? void 0 : _c2.length) != null ? _d : 0
                });
                continue;
              }
              const content = readContent(fullEntry);
              const dirPath = path8.substring(0, path8.lastIndexOf("/"));
              if (dirPath) {
                const existingDir = vault.getAbstractFileByPath(dirPath);
                if (!existingDir) {
                  try {
                    await vault.createFolder(dirPath);
                  } catch (e2) {
                  }
                }
              }
              const isText = isTextDocument(fullEntry);
              const existingFile = vault.getAbstractFileByPath(path8);
              if (existingFile) {
                if (isText) {
                  await vault.modify(existingFile, content);
                } else {
                  await vault.modifyBinary(existingFile, content);
                }
                updated++;
              } else {
                if (isText) {
                  await vault.create(path8, content);
                } else {
                  await vault.createBinary(path8, content);
                }
                created++;
              }
              const writtenFile = vault.getAbstractFileByPath(path8);
              if (writtenFile && this._storageEventManager && "stat" in writtenFile) {
                const stat = writtenFile.stat;
                this._storageEventManager.touch(path8, stat.mtime, stat.size);
              }
              (_e = this.onFileProgress) == null ? void 0 : _e.call(this, {
                type: "file_write_progress",
                writtenFiles: internalFilesProcessed + created + updated,
                totalFiles: totalFilesToWrite,
                currentFilePath: path8
              });
              if (processed % 50 === 0) {
                Logger(`Progress: ${processed} files processed (${created} created, ${updated} updated)`, LOG_LEVEL_INFO);
              }
            } catch (error2) {
              errors2++;
              console.error(`[Friday Sync] Error writing file ${path8}:`, {
                error: error2,
                docId: doc._id,
                docType: doc.type,
                docSize: doc.size,
                errorMessage: error2 instanceof Error ? error2.message : String(error2),
                errorStack: error2 instanceof Error ? error2.stack : void 0
              });
              Logger(`Error writing file ${path8}: ${error2}`, LOG_LEVEL_VERBOSE);
            }
          }
          const successCount = created + updated + internalFilesProcessed;
          (_f = this.onFileProgress) == null ? void 0 : _f.call(this, {
            type: "file_write_complete",
            totalFiles: totalFilesToWrite,
            successCount,
            errorCount: errors2 + internalFilesErrors
          });
          const totalErrors = errors2 + internalFilesErrors + missingChunksErrors;
          if (missingChunksErrors > 0) {
            const sampleFiles = missingChunksFiles.slice(0, 3).join(", ");
            const moreText = missingChunksErrors > 3 ? ` and ${missingChunksErrors - 3} more` : "";
            Logger(
              $msg("fridaySync.rebuild.missingChunks", {
                count: missingChunksErrors.toString(),
                examples: sampleFiles,
                more: moreText
              }) || `${missingChunksErrors} files could not be read (missing data). This usually happens after a database reset. Consider using "Fetch from Server" to re-sync. Examples: ${sampleFiles}${moreText}`,
              LOG_LEVEL_NOTICE
            );
            console.error(`[Friday Sync] Missing chunks for ${missingChunksErrors} files:`, missingChunksFiles);
          }
          if (errors2 > 0) {
            console.error(`[Friday Sync] Rebuild completed with ${errors2} write errors. Check console for details.`);
          }
          if (internalFilesErrors > 0) {
            console.error(`[Friday Sync] ${internalFilesErrors} internal files had errors. Check console for details.`);
          }
          if (successCount > 0 || totalErrors === 0) {
            Logger(
              $msg("fridaySync.rebuild.complete", {
                count: successCount.toString(),
                created: created.toString(),
                updated: updated.toString()
              }) || `Rebuild complete: ${successCount} files written (${created} new, ${updated} updated)`,
              LOG_LEVEL_NOTICE
            );
          }
          return true;
        } catch (error2) {
          Logger($msg("fridaySync.rebuild.failed"), LOG_LEVEL_NOTICE);
          Logger(error2, LOG_LEVEL_VERBOSE);
          return false;
        }
      }
      /**
       * Fetch all data from remote database (Rebuild local from remote)
       * This is the equivalent of livesync's "Fetch from Remote" feature
       * 
       * This method follows livesync's fetchLocal() flow exactly:
       * 1. Suspend database and file watching events
       * 2. Reset local database (clear all data)
       * 3. Reopen database connection
       * 4. Mark device as resolved with remote
       * 5. Replicate ALL data from remote (metadata + chunks together)
       * 6. Second replication pass for completeness
       * 7. Resume event processing - ReplicateResultProcessor handles writing files
       * 
       * Key difference from old approach:
       * - OLD: Replicate metadata → Fetch chunks separately → Read from DB
       * - NEW: Replicate everything together → Process replication results
       * 
       * This ensures chunks and metadata arrive together, preventing "missing chunks" errors.
       */
      async rebuildLocalFromRemote() {
        var _a6, _b4, _c2, _d, _e;
        const originalSuspendParseState = this._settings.suspendParseReplicationResult;
        const originalSuspendFileWatchingState = this._settings.suspendFileWatching;
        try {
          Logger($msg("fridaySync.fetch.starting") || "Starting fetch from server...", LOG_LEVEL_INFO);
          Logger("[Fetch] Phase 1: Suspending database and storage reflection", LOG_LEVEL_INFO);
          const estimatedDocs = 0;
          (_a6 = this.onFileProgress) == null ? void 0 : _a6.call(this, {
            type: "download_start",
            totalDocs: estimatedDocs
          });
          this._settings.suspendParseReplicationResult = true;
          this._settings.suspendFileWatching = true;
          Logger("[Fetch] Suspended: database\u2192vault and vault\u2192database", LOG_LEVEL_INFO);
          if (this._storageEventManager) {
            this._storageEventManager.stopWatch();
          }
          Logger("[Fetch] Phase 2: Resetting local database", LOG_LEVEL_INFO);
          if (this._localDatabase) {
            await this._localDatabase.resetDatabase();
            Logger("[Fetch] Local database reset and reopened", LOG_LEVEL_INFO);
          } else {
            throw new Error("LocalDatabase not initialized");
          }
          await this.delay(1e3);
          Logger("[Fetch] Phase 3: Verifying database is ready", LOG_LEVEL_INFO);
          if (!this._localDatabase || !this._localDatabase.isReady) {
            throw new Error("Database not ready after reset");
          }
          Logger("[Fetch] Database verified ready", LOG_LEVEL_INFO);
          Logger("[Fetch] Phase 4: Marking device as resolved with remote", LOG_LEVEL_INFO);
          if (this._replicator) {
            this._replicator.remoteLockedAndDeviceNotAccepted = false;
            this._replicator.remoteLocked = false;
            this._replicator.remoteCleaned = false;
            try {
              await this._replicator.markRemoteLocked(this._settings, false, false);
            } catch (ex) {
              console.error(`[Fetch] Phase 4.1: \u274C Failed to unlock remote:`, ex);
              Logger("[Fetch] \u274C Failed to unlock remote database", LOG_LEVEL_VERBOSE);
              Logger(ex, LOG_LEVEL_VERBOSE);
              throw new Error("Failed to unlock remote database");
            }
            try {
              await this._replicator.markRemoteResolved(this._settings);
            } catch (ex) {
              console.error(`[Fetch] Phase 4.2: \u274C Failed to mark remote resolved:`, ex);
              Logger("[Fetch] \u274C Failed to mark remote resolved", LOG_LEVEL_VERBOSE);
              Logger(ex, LOG_LEVEL_VERBOSE);
              throw new Error("Failed to mark device as accepted - device will remain locked out");
            }
            try {
              await this._replicator.updateStoredSalt(this._settings);
              Logger("[Fetch] Stored salt updated successfully", LOG_LEVEL_VERBOSE);
            } catch (ex) {
              console.error(`[Fetch] Phase 4.3: \u274C Failed to update stored salt:`, ex);
              Logger("[Fetch] \u274C Failed to update stored salt", LOG_LEVEL_VERBOSE);
              Logger(ex, LOG_LEVEL_VERBOSE);
              throw new Error("Failed to update stored salt - device will remain out of sync");
            }
            Logger("[Fetch] Device accepted by remote", LOG_LEVEL_INFO);
          } else {
            throw new Error("Replicator not initialized");
          }
          await this.delay(500);
          Logger($msg("fridaySync.fetch.downloading") || "Downloading all data from server...", LOG_LEVEL_INFO);
          Logger("[Fetch] Phase 5: First replication pass (metadata + chunks)", LOG_LEVEL_INFO);
          const result1 = await ((_b4 = this._replicator) == null ? void 0 : _b4.replicateAllFromServer(
            this._settings,
            true
          ));
          if (!result1) {
            throw new Error("First replication pass failed");
          }
          await this.delay(1e3);
          Logger("[Fetch] Phase 6: Second replication pass (ensure completeness)", LOG_LEVEL_INFO);
          const result2 = await ((_c2 = this._replicator) == null ? void 0 : _c2.replicateAllFromServer(
            this._settings,
            true
          ));
          if (!result2) {
            Logger("[Fetch] Second pass failed, but continuing (first pass succeeded)", LOG_LEVEL_INFO);
          }
          await this.delay(500);
          (_d = this.onFileProgress) == null ? void 0 : _d.call(this, {
            type: "download_complete",
            totalDocs: estimatedDocs
          });
          try {
            if (this._settings.readChunksOnline && !this._settings.useOnlyLocalChunk && this._settings.remoteType === REMOTE_COUCHDB) {
              Logger(
                $msg("fridaySync.fetch.fetchingChunks") || "Fetching file data from server...",
                LOG_LEVEL_INFO
              );
              await this.fetchAllMissingChunksFromRemote();
            } else {
              if (this._localDatabase) {
                try {
                  const allDocs2 = await this._localDatabase.localDatabase.allDocs({
                    startkey: "h:",
                    endkey: "h:\uFFF0",
                    limit: 1
                  });
                  const hasChunks = allDocs2.rows.length > 0;
                  if (!hasChunks && !this._settings.readChunksOnline) {
                    console.warn("[Fetch] \u26A0\uFE0F WARNING: No chunks found but readChunksOnline=false, chunks should have been downloaded during replication!");
                    Logger("[Fetch] \u26A0\uFE0F WARNING: No chunks found but readChunksOnline=false, chunks should have been downloaded during replication!", LOG_LEVEL_VERBOSE);
                  }
                } catch (ex) {
                  console.error(`[Fetch] - Could not check for chunks:`, ex);
                }
              }
            }
          } catch (error2) {
            Logger(`[Fetch] \u274C ERROR in Phase 6.5: ${error2}`, LOG_LEVEL_VERBOSE);
            Logger(error2, LOG_LEVEL_VERBOSE);
          }
          Logger("[Fetch] Phase 7: Resuming database and storage reflection", LOG_LEVEL_INFO);
          Logger($msg("fridaySync.fetch.writingFiles") || "Writing files to vault...", LOG_LEVEL_INFO);
          this._settings.suspendParseReplicationResult = false;
          this._settings.suspendFileWatching = false;
          Logger("[Fetch] Resumed: database\u2192vault and vault\u2192database", LOG_LEVEL_INFO);
          if (this._storageEventManager) {
            this._storageEventManager.startWatch();
          }
          await this.delay(500);
          Logger("[Fetch] Processing downloaded documents...", LOG_LEVEL_INFO);
          const rebuildResult = await this.rebuildVaultFromDB();
          if (!rebuildResult) {
            Logger("[Fetch] Warning: Some files may not have been written", LOG_LEVEL_INFO);
          }
          Logger($msg("fridaySync.fetch.downloadComplete") || "Fetch from server complete!", LOG_LEVEL_INFO);
          this.startNetworkMonitoring();
          if (this._settings.liveSync) {
            await this.startSync(true);
            if ((_e = this._replicator) == null ? void 0 : _e.remoteLockedAndDeviceNotAccepted) {
              console.error(`[Fetch] Phase 8: \u274C ERROR: remoteLockedAndDeviceNotAccepted is still TRUE!`);
            }
          } else {
            console.error(`[Fetch] Phase 8: Sync not restarted (liveSync=false)`);
          }
          return true;
        } catch (error2) {
          Logger($msg("fridaySync.fetch.downloadFailed") || "Fetch from server failed", LOG_LEVEL_VERBOSE);
          Logger(error2, LOG_LEVEL_VERBOSE);
          console.error("[Friday Sync] Fetch error:", error2);
          this._settings.suspendParseReplicationResult = originalSuspendParseState;
          this._settings.suspendFileWatching = originalSuspendFileWatchingState;
          if (this._storageEventManager) {
            this._storageEventManager.startWatch();
          }
          return false;
        }
      }
      /**
       * Fetch all missing chunks from remote database
       * This ensures chunks are present before rebuildVaultFromDB
       * 
       * Similar to livesync's fetchAllUsedChunks() but simplified for our use case
       * 
       * Why this is needed:
       * - ChunkFetcher is passive (responds to MISSING_CHUNKS events)
       * - It only triggers when getDBEntryFromMeta is called
       * - rebuildVaultFromDB would fail if chunks aren't present yet
       * - This method ACTIVELY fetches all referenced chunks upfront
       * 
       * Note: This uses the same batch size as ChunkFetcher (100 chunks per request)
       * to maintain consistency with the rest of the system.
       */
      async fetchAllMissingChunksFromRemote() {
        if (!this._replicator || !this._localDatabase) {
          console.error("[fetchAllMissingChunks] \u274C Cannot fetch chunks: Replicator or LocalDatabase not initialized");
          return;
        }
        try {
          const localDB = this._localDatabase.localDatabase;
          const referencedChunkIds = /* @__PURE__ */ new Set();
          const allDocs2 = await localDB.allDocs({
            include_docs: true,
            attachments: false
          });
          for (const row of allDocs2.rows) {
            const doc = row.doc;
            if (doc && doc.children && Array.isArray(doc.children)) {
              doc.children.forEach((chunkId) => {
                referencedChunkIds.add(chunkId);
              });
            }
          }
          if (referencedChunkIds.size === 0) {
            Logger("No chunk references found", LOG_LEVEL_VERBOSE);
            return;
          }
          const chunkIds = Array.from(referencedChunkIds);
          const localChunksResult = await localDB.allDocs({
            keys: chunkIds
          });
          const missingChunkIds = localChunksResult.rows.filter((row) => "error" in row && row.error === "not_found").map((row) => row.key);
          if (missingChunkIds.length === 0) {
            Logger("All chunks are already present locally", LOG_LEVEL_VERBOSE);
            return;
          }
          Logger(
            $msg("fridaySync.fetch.fetchingMissingChunks", {
              count: missingChunkIds.length.toString()
            }) || `Fetching ${missingChunkIds.length} missing chunks from remote...`,
            LOG_LEVEL_INFO
          );
          const BATCH_SIZE2 = 100;
          const totalBatches = Math.ceil(missingChunkIds.length / BATCH_SIZE2);
          let fetchedTotal = 0;
          for (let i = 0; i < missingChunkIds.length; i += BATCH_SIZE2) {
            const batch = missingChunkIds.slice(i, i + BATCH_SIZE2);
            const batchNum = Math.floor(i / BATCH_SIZE2) + 1;
            Logger(
              `Fetching batch ${batchNum}/${totalBatches} (${batch.length} chunks)...`,
              LOG_LEVEL_VERBOSE
            );
            const chunks = await this._replicator.fetchRemoteChunks(batch, false);
            if (chunks === false) {
              Logger(
                `Failed to fetch batch ${batchNum}/${totalBatches}`,
                LOG_LEVEL_VERBOSE
              );
              continue;
            }
            try {
              await localDB.bulkDocs(chunks, { new_edits: false });
              fetchedTotal += chunks.length;
              Logger(
                `Progress: ${fetchedTotal}/${missingChunkIds.length} chunks fetched`,
                LOG_LEVEL_VERBOSE
              );
            } catch (ex) {
              Logger(
                `Error writing batch ${batchNum} to database: ${ex}`,
                LOG_LEVEL_VERBOSE
              );
            }
          }
          Logger(
            $msg("fridaySync.fetch.chunkFetchComplete", {
              count: fetchedTotal.toString()
            }) || `Chunk fetching complete: ${fetchedTotal}/${missingChunkIds.length} chunks fetched`,
            LOG_LEVEL_INFO
          );
          if (fetchedTotal < missingChunkIds.length) {
            Logger(
              `Warning: Only ${fetchedTotal}/${missingChunkIds.length} chunks were fetched`,
              LOG_LEVEL_NOTICE
            );
          }
        } catch (ex) {
          Logger(
            `Error in fetchAllMissingChunksFromRemote: ${ex}`,
            LOG_LEVEL_NOTICE
          );
          Logger(ex, LOG_LEVEL_VERBOSE);
        }
      }
      /**
       * Helper function for delays
       */
      delay(ms) {
        return new Promise((resolve) => setTimeout(resolve, ms));
      }
      /**
       * Stop synchronization
       */
      async stopSync() {
        if (this._storageEventManager) {
          this._storageEventManager.stopWatch();
        }
        if (this._replicator) {
          this._replicator.closeReplication();
        }
        this.setStatus("CLOSED", "Sync stopped");
      }
      /**
       * Close and clean up
       */
      async close() {
        this.stopNetworkMonitoring();
        await this.stopSync();
        if (this._localDatabase) {
          await this._localDatabase.close();
        }
      }
      /**
       * Get the storage event manager (for external access if needed)
       */
      get storageEventManager() {
        return this._storageEventManager;
      }
      // ==================== Helper Methods ====================
      getVaultName() {
        return this.plugin.app.vault.getName() || "friday-vault";
      }
      /**
       * Convert document ID to file path
       */
      /**
       * Convert document ID to file path
       * This uses id2path_base from livesync's path utilities to ensure consistency
       */
      id2path(id, entry, stripPrefix) {
        return id2path_base(id, entry);
      }
      /**
       * Convert file path to document ID
       * This uses path2id_base from livesync's path utilities to ensure consistency
       * 
       * CRITICAL: The document ID format must match livesync's format exactly:
       * - If usePathObfuscation is false: ID = file path (e.g., "未命名.md")
       * - If usePathObfuscation is true: ID = "f:" + hash (e.g., "f:abc123...")
       */
      async path2id(filename, prefix) {
        const obfuscatePassphrase = this._settings.usePathObfuscation ? this._settings.passphrase : false;
        const caseInsensitive = false;
        const baseId = await path2id_base(filename, obfuscatePassphrase, caseInsensitive);
        if (prefix) {
          return `${prefix}${baseId}`;
        }
        return baseId;
      }
      /**
       * Test connection to CouchDB
       */
      async testConnection() {
        try {
          const uri = this._settings.couchDB_URI.replace(/\/$/, "");
          const dbUrl = `${uri}/${this._settings.couchDB_DBNAME}`;
          const credentials = btoa(`${this._settings.couchDB_USER}:${this._settings.couchDB_PASSWORD}`);
          const response = await fetch(dbUrl, {
            method: "GET",
            headers: {
              "Authorization": `Basic ${credentials}`,
              "Content-Type": "application/json"
            }
          });
          if (response.ok) {
            const data = await response.json();
            return {
              success: true,
              message: `Connected to ${data.db_name}, docs: ${data.doc_count}`
            };
          } else if (response.status === 404) {
            return { success: false, message: "Database not found. Please create it first." };
          } else {
            return { success: false, message: `Connection failed: ${response.statusText}` };
          }
        } catch (error2) {
          return { success: false, message: `Connection error: ${error2}` };
        }
      }
      // ==================== Ignore Patterns & Selective Sync Management ====================
      /**
       * Update ignore patterns (for real-time settings update)
       * Patterns are stored in memory and used directly without file I/O
       */
      updateIgnorePatterns(patterns) {
        this._ignorePatterns = patterns;
        Logger(`Updated ignore patterns: ${patterns.length} patterns`, LOG_LEVEL_INFO);
      }
      /**
       * Update selective sync settings (for real-time settings update)
       * Controls which file types are synced (images, audio, video, pdf)
       */
      updateSelectiveSync(settings) {
        if (settings.syncImages !== void 0) this._selectiveSync.syncImages = settings.syncImages;
        if (settings.syncAudio !== void 0) this._selectiveSync.syncAudio = settings.syncAudio;
        if (settings.syncVideo !== void 0) this._selectiveSync.syncVideo = settings.syncVideo;
        if (settings.syncPdf !== void 0) this._selectiveSync.syncPdf = settings.syncPdf;
        Logger(`Updated selective sync: images=${this._selectiveSync.syncImages}, audio=${this._selectiveSync.syncAudio}, video=${this._selectiveSync.syncVideo}, pdf=${this._selectiveSync.syncPdf}`, LOG_LEVEL_INFO);
      }
      /**
       * Update internal files ignore patterns (for .obsidian folder sync)
       * This updates _settings directly for real-time effect
       */
      updateInternalFilesIgnorePatterns(patterns) {
        this._settings.syncInternalFilesIgnorePatterns = patterns;
        if (this._hiddenFileSync) {
          this._hiddenFileSync.clearRegexCache();
        }
        Logger(`Updated internal files ignore patterns`, LOG_LEVEL_INFO);
      }
      /**
       * Check if a file is ignored by user-defined ignore patterns
       * Uses gitignore-style pattern matching directly from memory
       */
      async isIgnoredByIgnoreFile(filepath) {
        if (this._ignorePatterns.length === 0) {
          return false;
        }
        const result = isAccepted(filepath, this._ignorePatterns);
        return result === false;
      }
      /**
       * Check if a file is ignored by selective sync settings (file type filtering)
       * This checks the file extension against the selectiveSync settings
       */
      isIgnoredBySelectiveSync(filepath) {
        var _a6;
        const ext2 = (_a6 = filepath.split(".").pop()) == null ? void 0 : _a6.toLowerCase();
        if (!ext2) return false;
        if (_FridaySyncCore.IMAGE_EXTENSIONS.includes(ext2)) {
          return !this._selectiveSync.syncImages;
        }
        if (_FridaySyncCore.AUDIO_EXTENSIONS.includes(ext2)) {
          return !this._selectiveSync.syncAudio;
        }
        if (_FridaySyncCore.VIDEO_EXTENSIONS.includes(ext2)) {
          return !this._selectiveSync.syncVideo;
        }
        if (_FridaySyncCore.PDF_EXTENSIONS.includes(ext2)) {
          return !this._selectiveSync.syncPdf;
        }
        return false;
      }
      /**
       * Check if a file is a valid sync target
       */
      async isTargetFile(filepath) {
        if (this.isIgnoredBySelectiveSync(filepath)) {
          return false;
        }
        if (await this.isIgnoredByIgnoreFile(filepath)) {
          return false;
        }
        if (this._localDatabase && !this._localDatabase.isTargetFile(filepath)) {
          return false;
        }
        return true;
      }
    };
    // File extension mappings for selective sync
    _FridaySyncCore.IMAGE_EXTENSIONS = ["bmp", "png", "jpg", "jpeg", "gif", "svg", "webp", "avif"];
    _FridaySyncCore.AUDIO_EXTENSIONS = ["mp3", "wav", "m4a", "3gp", "flac", "ogg", "oga", "opus"];
    _FridaySyncCore.VIDEO_EXTENSIONS = ["mp4", "webm", "ogv", "mov", "mkv"];
    _FridaySyncCore.PDF_EXTENSIONS = ["pdf"];
    FridaySyncCore = _FridaySyncCore;
  }
});

// src/sync/SyncService.ts
var import_obsidian7, SyncService;
var init_SyncService = __esm({
  "src/sync/SyncService.ts"() {
    "use strict";
    import_obsidian7 = require("obsidian");
    init_FridaySyncCore();
    SyncService = class {
      constructor(plugin2) {
        this.config = null;
        this.core = null;
        this.statusCallback = null;
        this._isInitialized = false;
        this.plugin = plugin2;
      }
      /**
       * Get current sync status
       */
      get status() {
        var _a6, _b4;
        return (_b4 = (_a6 = this.core) == null ? void 0 : _a6.status) != null ? _b4 : "NOT_CONNECTED";
      }
      /**
       * Check if sync is initialized
       */
      get isInitialized() {
        return this._isInitialized;
      }
      /**
       * Get the underlying sync core (for advanced usage)
       */
      get syncCore() {
        return this.core;
      }
      /**
       * Set status callback
       */
      onStatusChange(callback) {
        this.statusCallback = callback;
        if (this.core) {
          this.core.onStatusChange(callback);
        }
      }
      /**
       * Initialize sync with configuration
       */
      async initialize(config) {
        this.config = config;
        try {
          if (!config.couchDB_URI || !config.couchDB_DBNAME) {
            new import_obsidian7.Notice("Sync: CouchDB URI and database name are required");
            return false;
          }
          this.core = new FridaySyncCore(this.plugin);
          if (this.statusCallback) {
            this.core.onStatusChange(this.statusCallback);
          }
          const result = await this.core.initialize(config);
          this._isInitialized = result;
          return result;
        } catch (error2) {
          console.error("Sync initialization failed:", error2);
          new import_obsidian7.Notice("Sync initialization failed. Please check your settings.");
          return false;
        }
      }
      /**
       * Test connection to CouchDB
       */
      async testConnection() {
        if (!this.core) {
          const tempCore = new FridaySyncCore(this.plugin);
          if (this.config) {
            await tempCore.initialize(this.config);
          }
          const result = await tempCore.testConnection();
          await tempCore.close();
          return result;
        }
        return await this.core.testConnection();
      }
      /**
       * Start synchronization
       * 
       * @param continuous - If true (default), starts LiveSync mode (continuous replication)
       *                     that monitors remote database for changes in real-time.
       *                     If false, performs a one-shot sync.
       */
      async startSync(continuous = true) {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.startSync(continuous);
      }
      /**
       * Pull all documents from server (one-shot sync)
       * 
       * This downloads all documents from the remote CouchDB to local.
       */
      async pullFromServer() {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.pullFromServer();
      }
      /**
       * Push all documents to server (one-shot sync)
       * 
       * This uploads all local documents to the remote CouchDB.
       */
      async pushToServer() {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.pushToServer();
      }
      /**
       * Fetch from server for first-time sync
       * 
       * Use this when connecting a new device to an existing database.
       * It marks the device as accepted and pulls all data from the server.
       * 
       * This is required when you see "The remote database has been rebuilt or corrupted" message.
       */
      async fetchFromServer() {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.fetchFromServer();
      }
      /**
       * Rebuild vault from local database
       * 
       * Use this when the database is synced but files haven't been written to disk.
       * This reads all documents from the local PouchDB and writes them to the vault.
       */
      async rebuildVaultFromDB() {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.rebuildVaultFromDB();
      }
      /**
       * Rebuild remote database from local files
       * 
       * Use this for first-time sync when you want to upload all local files to an empty server.
       * WARNING: This will reset the remote database and upload all local files.
       * Other devices will need to use "Fetch from Server" after this operation.
       */
      async rebuildRemote() {
        if (!this.core) {
          new import_obsidian7.Notice("Sync: Not initialized. Please initialize first.");
          return false;
        }
        return await this.core.rebuildRemote();
      }
      /**
       * Stop synchronization
       */
      async stopSync() {
        if (this.core) {
          await this.core.stopSync();
        }
      }
      /**
       * Update ignore patterns
       * 
       * This updates the ignore patterns in memory.
       * Changes take effect immediately for new sync operations.
       * 
       * @param patterns - Array of gitignore-style patterns
       */
      updateIgnorePatterns(patterns) {
        if (this.config) {
          this.config.ignorePatterns = patterns;
        }
        if (this.core) {
          this.core.updateIgnorePatterns(patterns);
        }
      }
      /**
       * Update internal files ignore patterns (for .obsidian folder sync)
       * 
       * This updates the ignore patterns for themes, plugins, etc.
       * Changes take effect immediately.
       * 
       * @param patterns - Comma-separated regex patterns
       */
      updateInternalFilesIgnorePatterns(patterns) {
        if (this.core) {
          this.core.updateInternalFilesIgnorePatterns(patterns);
        }
      }
      /**
       * Update selective sync settings (for file type filtering)
       * 
       * This updates which file types are synced (images, audio, video, pdf).
       * Changes take effect immediately.
       * 
       * @param settings - Partial selective sync settings
       */
      updateSelectiveSync(settings) {
        if (this.core) {
          this.core.updateSelectiveSync(settings);
        }
      }
      /**
       * Check if there are any sync issues that need user attention
       * 
       * This is useful for detecting:
       * - Remote database reset (requires "Fetch from Server")
       * - Configuration mismatches between devices
       * 
       * @returns object with status flags and message
       */
      getSyncIssues() {
        if (!this.core) {
          return { hasIssues: false, message: "", needsFetch: false };
        }
        return this.core.getSyncIssues();
      }
      /**
       * Check if the remote database has been reset/rebuilt
       * 
       * When this returns true, the user should use "Fetch from Server" to re-sync.
       * This typically happens when another device rebuilds the remote database.
       * 
       * @returns true if database reset was detected
       */
      isRemoteDatabaseReset() {
        var _a6, _b4;
        return (_b4 = (_a6 = this.core) == null ? void 0 : _a6.isRemoteDatabaseReset()) != null ? _b4 : false;
      }
      /**
       * Close and clean up resources
       */
      async close() {
        if (this.core) {
          await this.core.close();
          this.core = null;
        }
        this._isInitialized = false;
      }
      /**
       * Get default sync configuration
       */
      static getDefaultConfig() {
        return {
          couchDB_URI: "",
          couchDB_USER: "",
          couchDB_PASSWORD: "",
          couchDB_DBNAME: "friday-sync",
          encrypt: false,
          passphrase: "",
          usePathObfuscation: false,
          liveSync: true,
          // Default to LiveSync mode for real-time synchronization
          syncOnStart: true,
          syncOnSave: true,
          ignorePatterns: []
          // No patterns ignored by default
        };
      }
    };
  }
});

// src/sync/utils/FileProgressTracker.ts
var FileProgressTracker;
var init_FileProgressTracker = __esm({
  "src/sync/utils/FileProgressTracker.ts"() {
    "use strict";
    init_i18n();
    FileProgressTracker = class {
      constructor() {
        this.state = {
          totalFilesToUpload: 0,
          uploadedFiles: 0,
          totalFilesToDownload: 0,
          downloadedFiles: 0,
          totalFilesToWrite: 0,
          writtenFiles: 0,
          syncActivityProcessed: 0,
          syncActivityCompleted: false,
          currentOperation: "idle"
        };
        this.onChange = null;
      }
      /**
       * 处理来自 core 的文件进度事件
       */
      handleEvent(event2) {
        switch (event2.type) {
          // === 上传事件 ===
          case "upload_start":
            this.state.currentOperation = "upload";
            this.state.totalFilesToUpload = event2.totalFiles;
            this.state.uploadedFiles = 0;
            break;
          case "upload_progress":
            this.state.uploadedFiles = event2.uploadedFiles;
            break;
          case "upload_complete":
            this.state.uploadedFiles = event2.successCount;
            setTimeout(() => this.reset(), 2e3);
            break;
          // === 下载事件 ===
          case "download_start":
            this.state.currentOperation = "download";
            this.state.totalFilesToDownload = event2.totalDocs;
            this.state.downloadedFiles = 0;
            break;
          case "download_progress":
            this.state.downloadedFiles = event2.downloadedDocs;
            break;
          case "download_complete":
            this.state.downloadedFiles = event2.totalDocs;
            break;
          // === 文件写入事件 ===
          case "file_write_start":
            this.state.currentOperation = "write";
            this.state.totalFilesToWrite = event2.totalFiles;
            this.state.writtenFiles = 0;
            break;
          case "file_write_progress":
            this.state.writtenFiles = event2.writtenFiles;
            break;
          case "file_write_complete":
            this.state.writtenFiles = event2.successCount;
            setTimeout(() => this.reset(), 2e3);
            break;
          // === 实时同步活动事件 ===
          case "sync_activity_start":
            this.state.currentOperation = "sync_activity";
            this.state.syncActivityProcessed = 0;
            this.state.syncActivityCompleted = false;
            break;
          case "sync_activity_progress":
            this.state.syncActivityProcessed = event2.processedFiles;
            break;
          case "sync_activity_complete":
            this.state.currentOperation = "sync_completed";
            this.state.syncActivityProcessed = event2.totalProcessed;
            this.state.syncActivityCompleted = true;
            setTimeout(() => this.reset(), 3e3);
            break;
        }
        this.notifyChange();
      }
      /**
       * 重置状态
       */
      reset() {
        this.state = {
          totalFilesToUpload: 0,
          uploadedFiles: 0,
          totalFilesToDownload: 0,
          downloadedFiles: 0,
          totalFilesToWrite: 0,
          writtenFiles: 0,
          syncActivityProcessed: 0,
          syncActivityCompleted: false,
          currentOperation: "idle"
        };
        this.notifyChange();
      }
      /**
       * 获取当前状态
       */
      getState() {
        return { ...this.state };
      }
      /**
       * 计算总体进度（0-100）
       * @returns -1 表示不确定进度（显示滚动动画），0-100 表示确定进度
       */
      getOverallProgress() {
        const { currentOperation } = this.state;
        if (currentOperation === "upload") {
          const { uploadedFiles, totalFilesToUpload } = this.state;
          return totalFilesToUpload > 0 ? uploadedFiles / totalFilesToUpload * 100 : 0;
        }
        if (currentOperation === "download") {
          const { downloadedFiles, totalFilesToDownload } = this.state;
          return totalFilesToDownload > 0 ? downloadedFiles / totalFilesToDownload * 100 : 0;
        }
        if (currentOperation === "write") {
          const { writtenFiles, totalFilesToWrite } = this.state;
          return totalFilesToWrite > 0 ? writtenFiles / totalFilesToWrite * 100 : 0;
        }
        if (currentOperation === "sync_activity") {
          return -1;
        }
        if (currentOperation === "sync_completed") {
          return 100;
        }
        return 0;
      }
      /**
       * 获取显示文本
       */
      getDisplayText() {
        const { currentOperation } = this.state;
        if (currentOperation === "upload") {
          return $msg("fridaySync.progress.uploadingFiles", {
            current: this.state.uploadedFiles.toString(),
            total: this.state.totalFilesToUpload.toString()
          }) || `\u4E0A\u4F20\u6587\u4EF6\uFF1A${this.state.uploadedFiles}/${this.state.totalFilesToUpload}`;
        }
        if (currentOperation === "download") {
          return $msg("fridaySync.progress.downloadingFiles", {
            current: this.state.downloadedFiles.toString(),
            total: this.state.totalFilesToDownload.toString()
          }) || `\u4E0B\u8F7D\u6587\u4EF6\uFF1A${this.state.downloadedFiles}/${this.state.totalFilesToDownload}`;
        }
        if (currentOperation === "write") {
          return $msg("fridaySync.progress.writingFiles", {
            current: this.state.writtenFiles.toString(),
            total: this.state.totalFilesToWrite.toString()
          }) || `\u5199\u5165\u6587\u4EF6\uFF1A${this.state.writtenFiles}/${this.state.totalFilesToWrite}`;
        }
        if (currentOperation === "sync_activity") {
          return $msg("fridaySync.progress.syncing") || "\u6B63\u5728\u540C\u6B65...";
        }
        if (currentOperation === "sync_completed") {
          return $msg("fridaySync.progress.syncCompleted") || "\u540C\u6B65\u5B8C\u6210 \u2713";
        }
        return "";
      }
      /**
       * 监听状态变化
       */
      onStateChange(callback) {
        this.onChange = callback;
      }
      /**
       * 通知状态变化
       */
      notifyChange() {
        if (this.onChange) {
          this.onChange(this.state);
        }
      }
    };
  }
});

// src/sync/SyncStatusDisplay.ts
function truncateMiddleForMobile(text3, maxLength = 60) {
  if (!import_obsidian8.Platform.isMobile || text3.length <= maxLength) {
    return text3;
  }
  const headLength = Math.floor(maxLength * 0.4);
  const tailLength = Math.floor(maxLength * 0.4);
  const head2 = text3.substring(0, headLength);
  const tail = text3.substring(text3.length - tailLength);
  return `${head2}...${tail}`;
}
var import_obsidian8, MARK_DONE, SyncStatusDisplay;
var init_SyncStatusDisplay = __esm({
  "src/sync/SyncStatusDisplay.ts"() {
    "use strict";
    import_obsidian8 = require("obsidian");
    init_reactive();
    init_FileProgressTracker();
    MARK_DONE = "\u2009\u2009";
    SyncStatusDisplay = class {
      constructor(plugin2) {
        this.core = null;
        this.statusLog = reactiveSource("");
        // Current log message to display below status line
        // Notification handling
        this.notifies = {};
        // Animation frame handling
        this.nextFrameQueue = void 0;
        this.plugin = plugin2;
        this.fileProgressTracker = new FileProgressTracker();
        this.fileProgressTracker.onStateChange((state2) => {
          this.updateProgressBar(state2);
        });
      }
      /**
       * Get whether editor status should be shown from plugin settings
       * Mobile: Always show (no status bar on mobile)
       * Desktop: Respect user settings
       */
      get shouldShowEditorStatus() {
        var _a6, _b4;
        if (import_obsidian8.Platform.isMobile) {
          return true;
        }
        return (_b4 = (_a6 = this.plugin.settings) == null ? void 0 : _a6.showEditorStatusDisplay) != null ? _b4 : false;
      }
      /**
       * Get file progress tracker (for FridaySyncCore to use)
       */
      getFileProgressTracker() {
        return this.fileProgressTracker;
      }
      /**
       * Set the sync core reference
       */
      setCore(core) {
        this.core = core;
      }
      /**
       * Initialize the status display
       * Note: Call setCore() before initialize() if you want reactive status updates
       * 
       * DOM structure (exactly matching livesync):
       * <div class="livesync-status">
       *   <div class="livesync-status-statusline">Sync: 💤 ↑ 41 ↓ 0</div>
       *   <div class="livesync-status-messagearea"></div>
       *   <div class="livesync-status-logmessage"></div>
       *   <div class="livesync-status-loghistory"></div>
       * </div>
       */
      initialize() {
        var _a6;
        (_a6 = document.querySelectorAll(".livesync-status")) == null ? void 0 : _a6.forEach((e2) => e2.remove());
        this.statusDiv = this.plugin.app.workspace.containerEl.createDiv({ cls: "livesync-status" });
        this.statusLine = this.statusDiv.createDiv({ cls: "livesync-status-statusline" });
        this.messageArea = this.statusDiv.createDiv({ cls: "livesync-status-messagearea" });
        this.logMessage = this.statusDiv.createDiv({ cls: "livesync-status-logmessage" });
        this.logHistory = this.statusDiv.createDiv({ cls: "livesync-status-loghistory" });
        this.progressBarContainer = this.statusDiv.createDiv({
          cls: "livesync-status-progressbar"
        });
        this.progressBarTrack = this.progressBarContainer.createDiv({
          cls: "livesync-progressbar-track"
        });
        this.progressBarFill = this.progressBarTrack.createDiv({
          cls: "livesync-progressbar-fill"
        });
        this.progressBarLabel = this.progressBarContainer.createDiv({
          cls: "livesync-progressbar-label"
        });
        this.statusBar = this.plugin.addStatusBarItem();
        this.statusBar.addClass("syncstatusbar");
        this.statusBar.addClass("clickable-statusbar");
        this.statusBar.addEventListener("click", (e2) => {
          this.showStatusBarMenu(e2);
        });
        this.observeForLogs();
        this.plugin.app.workspace.onLayoutReady(() => {
          this.adjustStatusDivPosition();
        });
        this.plugin.registerEvent(
          this.plugin.app.workspace.on("layout-change", () => {
            this.adjustStatusDivPosition();
          })
        );
        this.plugin.registerEvent(
          this.plugin.app.workspace.on("active-leaf-change", () => {
            this.adjustStatusDivPosition();
          })
        );
        this.applyEditorStatusVisibility();
      }
      /**
       * Set up reactive observers for log display (from livesync's ModuleLog)
       */
      observeForLogs() {
        var _a6, _b4, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
        const padSpaces = `\u2007`.repeat(10);
        function padLeftSpComputed(numI, mark) {
          const formatted = reactiveSource("");
          let timer = void 0;
          let maxLen = 1;
          numI.onChanged((numX) => {
            const num = numX.value;
            const numLen = `${Math.abs(num)}`.length + 1;
            maxLen = maxLen < numLen ? numLen : maxLen;
            if (timer) clearTimeout(timer);
            if (num == 0) {
              timer = setTimeout(() => {
                formatted.value = "";
                maxLen = 1;
              }, 3e3);
            }
            formatted.value = ` ${mark}${`${padSpaces}${num}`.slice(-maxLen)}`;
          });
          return computed(() => formatted.value);
        }
        const replicationResultCount = (_b4 = (_a6 = this.core) == null ? void 0 : _a6.replicationResultCount) != null ? _b4 : reactiveSource(0);
        const databaseQueueCount = (_d = (_c2 = this.core) == null ? void 0 : _c2.databaseQueueCount) != null ? _d : reactiveSource(0);
        const storageApplyingCount = (_f = (_e = this.core) == null ? void 0 : _e.storageApplyingCount) != null ? _f : reactiveSource(0);
        const processing = (_h = (_g = this.core) == null ? void 0 : _g.processing) != null ? _h : reactiveSource(0);
        const totalQueued = (_j = (_i = this.core) == null ? void 0 : _i.totalQueued) != null ? _j : reactiveSource(0);
        const batched = (_l = (_k = this.core) == null ? void 0 : _k.batched) != null ? _l : reactiveSource(0);
        const requestCount = (_n = (_m = this.core) == null ? void 0 : _m.requestCount) != null ? _n : reactiveSource(0);
        const responseCount = (_p = (_o = this.core) == null ? void 0 : _o.responseCount) != null ? _p : reactiveSource(0);
        const labelReplication = padLeftSpComputed(replicationResultCount, `\u{1F4E5}`);
        const labelDBCount = padLeftSpComputed(databaseQueueCount, `\u{1F4C4}`);
        const labelStorageCount = padLeftSpComputed(storageApplyingCount, `\u{1F4BE}`);
        const queueCountLabelX = reactive(() => {
          return `${labelReplication()}${labelDBCount()}${labelStorageCount()}`;
        });
        const queueCountLabel = () => queueCountLabelX.value;
        const requestingStatLabel = computed(() => {
          const diff = requestCount.value - responseCount.value;
          return diff != 0 ? "\u{1F4F2} " : "";
        });
        const replicationStat = (_r = (_q = this.core) == null ? void 0 : _q.replicationStat) != null ? _r : reactiveSource({
          sent: 0,
          arrived: 0,
          maxPullSeq: 0,
          maxPushSeq: 0,
          lastSyncPullSeq: 0,
          lastSyncPushSeq: 0,
          syncStatus: "NOT_CONNECTED"
        });
        const replicationStatLabel = computed(() => {
          const e2 = replicationStat.value;
          const sent = e2.sent;
          const arrived = e2.arrived;
          const maxPullSeq = e2.maxPullSeq;
          const maxPushSeq = e2.maxPushSeq;
          const lastSyncPullSeq = e2.lastSyncPullSeq;
          const lastSyncPushSeq = e2.lastSyncPushSeq;
          let pushLast = "";
          let pullLast = "";
          let w2 = "";
          const labels = {
            CONNECTED: "\u26A1",
            JOURNAL_SEND: "\u{1F4E6}\u2191",
            JOURNAL_RECEIVE: "\u{1F4E6}\u2193"
          };
          switch (e2.syncStatus) {
            case "CLOSED":
            case "COMPLETED":
            case "NOT_CONNECTED":
              w2 = "\u23F9";
              break;
            case "STARTED":
              w2 = "\u{1F300}";
              break;
            case "PAUSED":
              w2 = "\u{1F4A4}";
              break;
            case "CONNECTED":
            case "JOURNAL_SEND":
            case "JOURNAL_RECEIVE":
              w2 = labels[e2.syncStatus] || "\u26A1";
              pushLast = lastSyncPushSeq == 0 ? "" : lastSyncPushSeq >= maxPushSeq ? " (LIVE)" : ` (${maxPushSeq - lastSyncPushSeq})`;
              pullLast = lastSyncPullSeq == 0 ? "" : lastSyncPullSeq >= maxPullSeq ? " (LIVE)" : ` (${maxPullSeq - lastSyncPullSeq})`;
              break;
            case "ERRORED":
              w2 = "\u26A0";
              break;
            default:
              w2 = "?";
          }
          return { w: w2, sent, pushLast, arrived, pullLast };
        });
        const labelProc = padLeftSpComputed(processing, `\u23F3`);
        const labelPend = padLeftSpComputed(totalQueued, `\u{1F6EB}`);
        const labelInBatchDelay = padLeftSpComputed(batched, `\u{1F4EC}`);
        const waitingLabel = computed(() => {
          return `${labelProc()}${labelPend()}${labelInBatchDelay()}`;
        });
        const statusLineLabel = computed(() => {
          const { w: w2, sent, pushLast, arrived, pullLast } = replicationStatLabel();
          const queued = queueCountLabel();
          const waiting = waitingLabel();
          const networkActivity = requestingStatLabel();
          return {
            message: `${networkActivity}Sync: ${w2} \u2191 ${sent}${pushLast} \u2193 ${arrived}${pullLast}${waiting}${queued}`
          };
        });
        const statusBarLabels = reactive(() => {
          const { message } = statusLineLabel();
          return {
            message: `${message}`,
            status: ""
            // Not used anymore
          };
        });
        this.statusBarLabels = statusBarLabels;
        let updateTimer;
        const applyToDisplay = (label) => {
          if (updateTimer) return;
          updateTimer = setTimeout(() => {
            updateTimer = void 0;
            this.applyStatusBarText();
          }, 20);
        };
        statusBarLabels.onChanged((label) => applyToDisplay(label.value));
      }
      /**
       * Adjust status div position to active leaf (from livesync's ModuleLog)
       * Positions the status display in the top-right corner of the active editor pane
       * The actual positioning is done via CSS (position: absolute, top: var(--header-height), text-align: right)
       */
      adjustStatusDivPosition() {
        const mdv = this.plugin.app.workspace.getMostRecentLeaf();
        if (mdv && this.statusDiv) {
          this.statusDiv.remove();
          const container = mdv.view.containerEl;
          container.insertBefore(this.statusDiv, container.lastChild);
          this.applyEditorStatusVisibility();
        }
      }
      /**
       * Apply status text to UI elements (matching livesync's behavior)
       * Shows:
       * - statusLine: "Sync: ⚡ ↑ 0 (LIVE) ↓ 3 (LIVE)"
       * - logMessage: Current log message (e.g., "Replication activated")
       * 
       * Mobile: Truncates long messages to prevent UI overlap
       */
      applyStatusBarText() {
        if (this.nextFrameQueue) {
          return;
        }
        this.nextFrameQueue = requestAnimationFrame(() => {
          var _a6;
          this.nextFrameQueue = void 0;
          const { message } = this.statusBarLabels.value;
          const newMsg = message;
          const newLog = this.statusLog.value;
          (_a6 = this.statusBar) == null ? void 0 : _a6.setText(newMsg.split("\n")[0]);
          if (this.statusLine) {
            this.statusLine.innerText = newMsg;
          }
          if (this.logMessage) {
            this.logMessage.innerText = truncateMiddleForMobile(newLog);
          }
        });
      }
      /**
       * Add a log message (matching livesync's __addLog behavior)
       * 
       * Log levels (from livesync):
       * - LOG_LEVEL_DEBUG = 1    -> Skip (not shown in UI)
       * - LOG_LEVEL_VERBOSE = 2  -> Skip (not shown in UI)
       * - LOG_LEVEL_INFO = 32    -> Show in logMessage area (below status line)
       * - LOG_LEVEL_NOTICE = 64  -> Show in logMessage area + Notice popup
       * - LOG_LEVEL_URGENT = 128 -> Show in logMessage area + Notice popup
       * 
       * @param message - The log message
       * @param level - Log level
       * @param key - Optional key for Notice grouping
       */
      addLog(message, level = 32, key4) {
        if (level < 32) {
          return;
        }
        this.statusLog.value = message;
        this.applyStatusBarText();
        if (this.logHideTimer) {
          clearTimeout(this.logHideTimer);
        }
        this.logHideTimer = setTimeout(() => {
          this.statusLog.value = "";
          this.applyStatusBarText();
        }, 3e3);
        if (level >= 64) {
          this.showNotice(message, key4);
        }
      }
      /**
       * Show a notice
       */
      showNotice(message, key4, timeout = 5e3) {
        var _a6;
        if (!key4) key4 = message;
        if (key4 in this.notifies) {
          const isShown = (_a6 = this.notifies[key4].notice.noticeEl) == null ? void 0 : _a6.isShown();
          if (!isShown) {
            this.notifies[key4].notice = new import_obsidian8.Notice(message, 0);
          }
          if (key4 === message) {
            this.notifies[key4].count++;
            this.notifies[key4].notice.setMessage(`(${this.notifies[key4].count}): ${message}`);
          } else {
            this.notifies[key4].notice.setMessage(message);
          }
        } else {
          const notice = new import_obsidian8.Notice(message, 0);
          this.notifies[key4] = {
            count: 0,
            notice
          };
        }
        if (!key4.startsWith("keepalive-") || message.indexOf(MARK_DONE) !== -1) {
          setTimeout(() => {
            if (this.notifies[key4]) {
              const notice = this.notifies[key4].notice;
              delete this.notifies[key4];
              try {
                notice.hide();
              } catch (e2) {
              }
            }
          }, timeout);
        }
      }
      /**
       * Apply editor status visibility based on settings
       */
      applyEditorStatusVisibility() {
        if (this.statusDiv) {
          if (this.shouldShowEditorStatus) {
            this.statusDiv.style.display = "";
          } else {
            this.statusDiv.style.display = "none";
          }
        }
      }
      /**
       * Toggle editor status display visibility
       */
      async toggleEditorStatusDisplay() {
        const plugin2 = this.plugin;
        plugin2.settings.showEditorStatusDisplay = !plugin2.settings.showEditorStatusDisplay;
        await plugin2.saveSettings();
        this.applyEditorStatusVisibility();
      }
      /**
       * Show context menu when clicking on status bar
       * Mobile: Simplified menu (no toggle option, always shows editor status)
       */
      showStatusBarMenu(event2) {
        var _a6, _b4, _c2;
        const { Menu } = require("obsidian");
        const menu = new Menu();
        if (import_obsidian8.Platform.isDesktop) {
          menu.addItem((item) => {
            item.setTitle(
              this.shouldShowEditorStatus ? "\u9690\u85CF\u7F16\u8F91\u5668\u5185\u72B6\u6001" : "\u663E\u793A\u7F16\u8F91\u5668\u5185\u72B6\u6001"
            ).setIcon(this.shouldShowEditorStatus ? "eye-off" : "eye").onClick(async () => {
              await this.toggleEditorStatusDisplay();
            });
          });
          menu.addSeparator();
        }
        const syncStatus = (_c2 = (_b4 = (_a6 = this.core) == null ? void 0 : _a6.replicationStat) == null ? void 0 : _b4.value) == null ? void 0 : _c2.syncStatus;
        if (syncStatus === "NOT_CONNECTED" || syncStatus === "ERRORED") {
          menu.addItem((item) => {
            item.setTitle("\u91CD\u65B0\u8FDE\u63A5\u540C\u6B65").setIcon("refresh-cw").onClick(async () => {
              if (this.core) {
                await this.core.startSync();
              }
            });
          });
        }
        menu.addItem((item) => {
          item.setTitle("\u540C\u6B65\u8BBE\u7F6E").setIcon("settings").onClick(() => {
            this.plugin.app.setting.open();
            this.plugin.app.setting.openTabById("mdfriday");
          });
        });
        menu.showAtMouseEvent(event2);
      }
      /**
       * Clean up
       */
      onunload() {
        var _a6, _b4, _c2;
        if (this.statusBar) {
          this.statusBar.remove();
          this.statusBar = void 0;
        }
        if (this.statusDiv) {
          this.statusDiv.remove();
          this.statusDiv = void 0;
        }
        (_a6 = document.querySelectorAll(".livesync-status")) == null ? void 0 : _a6.forEach((e2) => e2.remove());
        (_b4 = document.querySelectorAll(".syncstatusbar")) == null ? void 0 : _b4.forEach((e2) => e2.remove());
        for (const key4 in this.notifies) {
          try {
            this.notifies[key4].notice.hide();
          } catch (e2) {
          }
        }
        this.notifies = {};
        (_c2 = this.fileProgressTracker) == null ? void 0 : _c2.reset();
        this.core = null;
      }
      /**
       * Update progress bar display
       */
      updateProgressBar(state2) {
        if (!this.progressBarContainer || !this.progressBarFill || !this.progressBarLabel) {
          return;
        }
        const progress = this.fileProgressTracker.getOverallProgress();
        const displayText = this.fileProgressTracker.getDisplayText();
        if (state2.currentOperation === "idle") {
          if (this.progressBarContainer.hasClass("active")) {
            this.progressBarContainer.addClass("fadeout");
            setTimeout(() => {
              var _a6;
              (_a6 = this.progressBarContainer) == null ? void 0 : _a6.removeClass("active", "fadeout");
            }, 1e3);
          } else {
            this.progressBarContainer.removeClass("active", "fadeout");
          }
          return;
        }
        this.progressBarContainer.addClass("active");
        this.progressBarContainer.removeClass("fadeout");
        if (progress === -1) {
          this.progressBarFill.addClass("indeterminate");
          this.progressBarFill.style.width = "";
          this.progressBarLabel.innerText = displayText;
        } else {
          this.progressBarFill.removeClass("indeterminate");
          this.progressBarFill.style.width = `${progress}%`;
          this.progressBarLabel.innerText = displayText;
        }
        if (progress >= 100) {
          this.progressBarFill.addClass("completed");
        } else {
          this.progressBarFill.removeClass("completed");
        }
      }
    };
  }
});

// src/sync/index.ts
var init_sync = __esm({
  "src/sync/index.ts"() {
    "use strict";
    init_SyncService();
    init_FridaySyncCore();
    init_SyncStatusDisplay();
    init_FridayStorageEventManager();
    init_HiddenFileSync();
    init_hiddenFileUtils();
    init_SyncParamsHandler();
    init_path();
    init_types2();
  }
});

// src/license.ts
var license_exports = {};
__export2(license_exports, {
  formatExpirationDate: () => formatExpirationDate,
  formatPlanName: () => formatPlanName,
  generateEncryptionPassphrase: () => generateEncryptionPassphrase,
  getDaysUntilExpiration: () => getDaysUntilExpiration,
  getDeviceId: () => getDeviceId,
  getDeviceName: () => getDeviceName,
  getDeviceType: () => getDeviceType,
  isLicenseExpired: () => isLicenseExpired,
  isValidLicenseKeyFormat: () => isValidLicenseKeyFormat,
  licenseKeyToEmail: () => licenseKeyToEmail,
  licenseKeyToPassword: () => licenseKeyToPassword,
  maskLicenseKey: () => maskLicenseKey
});
function licenseKeyToEmail(licenseKey) {
  const key4 = licenseKey.replace(/^MDF-/i, "").toLowerCase();
  return `${key4}@mdfriday.com`;
}
function licenseKeyToPassword(licenseKey) {
  const key4 = licenseKey.replace(/^MDF-/i, "").toLowerCase();
  return btoa(key4);
}
function isValidLicenseKeyFormat(licenseKey) {
  const pattern = /^MDF-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/i;
  return pattern.test(licenseKey);
}
function maskLicenseKey(licenseKey) {
  if (!licenseKey || licenseKey.length < 4) return licenseKey;
  const parts = licenseKey.split("-");
  if (parts.length === 4) {
    return `MDF-\u2022\u2022\u2022\u2022-\u2022\u2022\u2022\u2022-${parts[3]}`;
  }
  return licenseKey.slice(0, -4).replace(/./g, "\u2022") + licenseKey.slice(-4);
}
function formatExpirationDate(timestamp) {
  const date = new Date(timestamp);
  return date.toLocaleDateString("en-US", {
    year: "numeric",
    month: "short",
    day: "numeric"
  });
}
function isLicenseExpired(expiresAt) {
  return Date.now() > expiresAt;
}
function getDaysUntilExpiration(expiresAt) {
  const diff = expiresAt - Date.now();
  return Math.max(0, Math.ceil(diff / (1e3 * 60 * 60 * 24)));
}
async function generateDeviceFingerprint() {
  const components = [];
  if (typeof screen !== "undefined") {
    components.push(`${screen.width}x${screen.height}`);
    components.push(`${screen.colorDepth}`);
    components.push(`${screen.pixelDepth || 0}`);
  }
  if (typeof navigator !== "undefined") {
    components.push(navigator.language || "");
    components.push(navigator.platform || "");
    components.push(String(navigator.hardwareConcurrency || 0));
    components.push(String(navigator.maxTouchPoints || 0));
  }
  try {
    components.push(Intl.DateTimeFormat().resolvedOptions().timeZone || "");
  } catch (e2) {
    components.push("");
  }
  const ua = (navigator == null ? void 0 : navigator.userAgent) || "";
  const uaHash = ua.split(" ").slice(0, 3).join(" ");
  components.push(uaHash);
  const fingerprint = components.join("|");
  const encoder = new TextEncoder();
  const data = encoder.encode(fingerprint);
  if (typeof crypto !== "undefined" && crypto.subtle) {
    const hashBuffer = await crypto.subtle.digest("SHA-256", data);
    const hashArray = Array.from(new Uint8Array(hashBuffer));
    return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
  }
  let hash2 = 0;
  for (let i = 0; i < fingerprint.length; i++) {
    const char2 = fingerprint.charCodeAt(i);
    hash2 = (hash2 << 5) - hash2 + char2;
    hash2 = hash2 & hash2;
  }
  return Math.abs(hash2).toString(16).padStart(8, "0");
}
function openDeviceDB() {
  return new Promise((resolve, reject) => {
    const request = indexedDB.open(DEVICE_DB_NAME, 1);
    request.onerror = () => reject(request.error);
    request.onsuccess = () => resolve(request.result);
    request.onupgradeneeded = (event2) => {
      const db = event2.target.result;
      if (!db.objectStoreNames.contains(DEVICE_STORE_NAME)) {
        db.createObjectStore(DEVICE_STORE_NAME);
      }
    };
  });
}
async function getStoredDeviceId() {
  try {
    const db = await openDeviceDB();
    return new Promise((resolve, reject) => {
      const transaction = db.transaction(DEVICE_STORE_NAME, "readonly");
      const store = transaction.objectStore(DEVICE_STORE_NAME);
      const request = store.get(DEVICE_ID_KEY);
      request.onerror = () => {
        db.close();
        reject(request.error);
      };
      request.onsuccess = () => {
        db.close();
        resolve(request.result || null);
      };
    });
  } catch (e2) {
    return null;
  }
}
async function storeDeviceId(deviceId) {
  try {
    const db = await openDeviceDB();
    return new Promise((resolve, reject) => {
      const transaction = db.transaction(DEVICE_STORE_NAME, "readwrite");
      const store = transaction.objectStore(DEVICE_STORE_NAME);
      const request = store.put(deviceId, DEVICE_ID_KEY);
      request.onerror = () => {
        db.close();
        reject(request.error);
      };
      request.onsuccess = () => {
        db.close();
        resolve();
      };
    });
  } catch (error2) {
    console.warn("Failed to store device ID:", error2);
  }
}
async function getDeviceId() {
  let deviceId = await getStoredDeviceId();
  if (!deviceId) {
    deviceId = await generateDeviceFingerprint();
    await storeDeviceId(deviceId);
  }
  return deviceId;
}
function getDeviceName() {
  const platform = (navigator == null ? void 0 : navigator.platform) || "Unknown";
  const ua = (navigator == null ? void 0 : navigator.userAgent) || "";
  let osName = "Unknown OS";
  if (ua.includes("Mac")) osName = "macOS";
  else if (ua.includes("Windows")) osName = "Windows";
  else if (ua.includes("Linux")) osName = "Linux";
  else if (ua.includes("iPhone") || ua.includes("iPad")) osName = "iOS";
  else if (ua.includes("Android")) osName = "Android";
  return `Obsidian on ${osName}`;
}
function getDeviceType() {
  const ua = (navigator == null ? void 0 : navigator.userAgent) || "";
  if (ua.includes("Mobile") || ua.includes("Android") || ua.includes("iPhone")) {
    return "mobile";
  }
  if (ua.includes("Tablet") || ua.includes("iPad")) {
    return "tablet";
  }
  return "desktop";
}
function generateEncryptionPassphrase() {
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  const array = new Uint8Array(24);
  crypto.getRandomValues(array);
  return Array.from(array, (byte) => chars[byte % chars.length]).join("");
}
function formatPlanName(plan) {
  if (!plan) return "Unknown";
  return plan.charAt(0).toUpperCase() + plan.slice(1).toLowerCase();
}
var import_obsidian9, DEVICE_DB_NAME, DEVICE_STORE_NAME, DEVICE_ID_KEY;
var init_license = __esm({
  "src/license.ts"() {
    "use strict";
    import_obsidian9 = require("obsidian");
    DEVICE_DB_NAME = "friday-device-store";
    DEVICE_STORE_NAME = "device";
    DEVICE_ID_KEY = "device_id";
  }
});

// src/domain.ts
function validateSubdomainFormat(subdomain) {
  if (subdomain.length < 4) {
    return {
      valid: false,
      error: "Subdomain must be at least 4 characters long"
    };
  }
  if (subdomain.length > 32) {
    return {
      valid: false,
      error: "Subdomain must be at most 32 characters long"
    };
  }
  const pattern = /^[a-z0-9][a-z0-9-]{2,30}[a-z0-9]$/;
  if (!pattern.test(subdomain)) {
    return {
      valid: false,
      error: "Subdomain can only contain lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen"
    };
  }
  return { valid: true };
}
function isReservedSubdomain(subdomain) {
  return RESERVED_SUBDOMAINS.has(subdomain);
}
var RESERVED_SUBDOMAINS;
var init_domain = __esm({
  "src/domain.ts"() {
    "use strict";
    RESERVED_SUBDOMAINS = /* @__PURE__ */ new Set([
      "www",
      "api",
      "admin",
      "cdb",
      "mail",
      "ftp",
      "smtp",
      "pop",
      "imap",
      "ns1",
      "ns2",
      "ns3",
      "mx",
      "mx1",
      "mx2",
      "webmail",
      "cpanel",
      "whm",
      "autodiscover",
      "autoconfig",
      "test",
      "dev",
      "staging",
      "prod",
      "beta",
      "alpha",
      "demo",
      "preview",
      "support",
      "help",
      "docs",
      "blog",
      "shop",
      "store",
      "app",
      "apps",
      "mobile",
      "status",
      "cdn",
      "static",
      "assets",
      "img",
      "images",
      "video",
      "videos",
      "media",
      "download",
      "downloads",
      "upload",
      "uploads",
      "file",
      "files",
      "secure",
      "ssl",
      "vpn",
      "proxy",
      "git",
      "svn",
      "repo",
      "jenkins",
      "ci",
      "build",
      "deploy",
      "monitor",
      "log",
      "logs",
      "analytics",
      "stats",
      "db",
      "database",
      "mysql",
      "postgres",
      "redis",
      "mongo",
      "elastic",
      "kafka",
      "rabbit",
      "mdfriday"
    ]);
  }
});

// src/hugoverse.ts
var hugoverse_exports = {};
__export2(hugoverse_exports, {
  Hugoverse: () => Hugoverse
});
var import_obsidian10, NEW_ID, COUNTER_REQUEST_ID_KEY, Hugoverse;
var init_hugoverse = __esm({
  "src/hugoverse.ts"() {
    "use strict";
    import_obsidian10 = require("obsidian");
    NEW_ID = "-1";
    COUNTER_REQUEST_ID_KEY = "friday_counter_request_id";
    Hugoverse = class {
      constructor(plugin2) {
        this.plugin = plugin2;
        this.app = this.plugin.app;
        this.apiUrl = this.plugin.apiUrl;
        this.user = this.plugin.user;
        const adapter = this.app.vault.adapter;
        if (import_obsidian10.Platform.isDesktop && adapter instanceof import_obsidian10.FileSystemAdapter) {
          this.basePath = adapter.getBasePath();
        } else {
          this.basePath = "";
        }
      }
      generateDownloadUrl(filename) {
        return `${this.apiUrl}/api/uploads/themes/${filename}`;
      }
      /**
       * Wrapper method to handle 401 errors and auto-retry with refreshed token
       * 
       * @param requestFn - Function that makes the API request, receives token as parameter
       * @param requireAuth - Whether this request requires authentication (default: true)
       * @returns The result from requestFn
       */
      async requestWithTokenRefresh(requestFn, requireAuth = true) {
        var _a6;
        if (!requireAuth) {
          return requestFn(this.user.token);
        }
        try {
          return await requestFn(this.user.token);
        } catch (error2) {
          const errorMessage = (error2 == null ? void 0 : error2.message) || ((_a6 = error2 == null ? void 0 : error2.toString) == null ? void 0 : _a6.call(error2)) || String(error2);
          const is401 = errorMessage.includes("401") || (error2 == null ? void 0 : error2.status) && error2.status === 401;
          if (is401) {
            await this.user.login();
            if (!this.user.token) {
              throw new Error("Failed to refresh token - login unsuccessful");
            }
            return await requestFn(this.user.token);
          }
          throw error2;
        }
      }
      /**
       * 生成简单的 UUID（不使用第三方库）
       */
      generateUUID() {
        return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
          const r = Math.random() * 16 | 0;
          const v = c == "x" ? r : r & 3 | 8;
          return v.toString(16);
        });
      }
      /**
       * 从浏览器缓存获取或生成 request_id
       */
      getOrCreateRequestId() {
        let requestId = localStorage.getItem(COUNTER_REQUEST_ID_KEY);
        if (!requestId) {
          requestId = this.generateUUID();
          localStorage.setItem(COUNTER_REQUEST_ID_KEY, requestId);
        }
        return requestId;
      }
      projectDirPath(filepath) {
        const lastSlash = filepath.lastIndexOf("/");
        if (lastSlash === -1) {
          const lastBackslash = filepath.lastIndexOf("\\");
          if (lastBackslash === -1) return ".";
          return filepath.substring(0, lastBackslash);
        }
        return filepath.substring(0, lastSlash);
      }
      /*
      * curl -X POST "http://127.0.0.1:1314/api/mdf/preview/deploy?type=MDFPreview&id=1" \
      * -H "Authorization: Bearer <token>" \
      * -F "type=MDFPreview" \
      * -F "host_name=MDFriday Share"
      */
      async deployMDFridayPreview(id, licenseKey = "") {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const createPostUrl = `${this.apiUrl}/api/mdf/preview/deploy?type=MDFPreview&id=${id}`;
            let body = new FormData();
            body.append("type", "MDFPreview");
            body.append("id", id);
            body.append("host_name", "MDFriday Preview");
            body.append("license_key", licenseKey);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url: createPostUrl,
              method: "POST",
              headers: {
                "Content-Type": `multipart/form-data; boundary=${boundary2}`,
                "Authorization": `Bearer ${freshToken}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              throw new Error(`Post creation failed: ${response.text}`);
            }
            return response.json.data[0];
          } catch (error2) {
            console.error("Failed to create post:", error2.toString());
            new import_obsidian10.Notice(this.plugin.i18n.t("messages.failed_to_create_post"), 5e3);
            throw error2;
          }
        });
      }
      /*
      * curl -X POST "http://127.0.0.1:1314/api/mdf/preview?type=MDFPreview" \
      * -F "type=MDFPreview" \
      * -F "id=-1" \
      * -F "name=abc" \
      * -F "size=12345" \
      * -F "asset=@/Users/weisun/Downloads/site.zip"
      */
      async createMDFPreview(name, content, type = "share", path8 = "") {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const createResourceUrl = `${this.apiUrl}/api/mdf/preview?type=MDFPreview`;
            let body = new FormData();
            body.append("type", type);
            body.append("path", path8);
            body.append("id", NEW_ID);
            body.append("name", name);
            body.append("size", content.byteLength.toString());
            const mimeType = "application/zip";
            const blob = new Blob([new Uint8Array(content)], { type: mimeType });
            body.append(`asset`, blob, `${name}.zip`);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url: createResourceUrl,
              method: "POST",
              headers: {
                "Content-Type": `multipart/form-data; boundary=${boundary2}`,
                "Authorization": `Bearer ${freshToken}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              throw new Error(`Resource creation failed: ${response.text}`);
            }
            return response.json.data[0].id;
          } catch (error2) {
            console.error("Failed to create resource:", error2.toString());
            new import_obsidian10.Notice(this.plugin.i18n.t("messages.failed_to_create_resource"), 5e3);
            throw error2;
          }
        });
      }
      async formDataToArrayBuffer(formData, boundary2) {
        let bodyParts = [];
        const formDataEntries = [];
        formData.forEach((value2, key4) => {
          formDataEntries.push({ value: value2, key: key4 });
        });
        for (const { value: value2, key: key4 } of formDataEntries) {
          bodyParts.push(`--${boundary2}\r
`);
          if (typeof value2 === "string") {
            bodyParts.push(`Content-Disposition: form-data; name="${key4}"\r
\r
${value2}\r
`);
          } else if (value2 instanceof Blob) {
            bodyParts.push(
              `Content-Disposition: form-data; name="${key4}"; filename="${value2.name}"\r
`
            );
            bodyParts.push(`Content-Type: ${value2.type || "application/octet-stream"}\r
\r
`);
            const arrayBuffer = await value2.arrayBuffer();
            bodyParts.push(new Uint8Array(arrayBuffer));
            bodyParts.push(`\r
`);
          }
        }
        bodyParts.push(`--${boundary2}--\r
`);
        const encoder = new TextEncoder();
        const encodedParts = bodyParts.map((part) => typeof part === "string" ? encoder.encode(part) : part);
        const totalLength = encodedParts.reduce((acc, curr) => acc + curr.length, 0);
        const combinedArray = new Uint8Array(totalLength);
        let offset = 0;
        for (const part of encodedParts) {
          combinedArray.set(part, offset);
          offset += part.length;
        }
        return combinedArray.buffer;
      }
      async sendCounter(kind = "preview") {
        try {
          const requestId = this.getOrCreateRequestId();
          const counterUrl = `${this.apiUrl}/api/counter?type=Counter`;
          let body = new FormData();
          body.append("id", NEW_ID);
          body.append("kind", kind);
          body.append("request_id", requestId);
          const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
          const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
          const response = await (0, import_obsidian10.requestUrl)({
            url: counterUrl,
            method: "POST",
            headers: {
              "Content-Type": `multipart/form-data; boundary=${boundary2}`
            },
            body: arrayBufferBody
          });
          if (response.status !== 200) {
            console.warn(`Counter request failed: ${response.text}`);
            return false;
          }
          return true;
        } catch (error2) {
          console.warn("Failed to send counter:", error2.toString());
          return false;
        }
      }
      /**
       * Request a trial license key
       * 
       * POST /api/license/trial
       * No Authorization required (public endpoint)
       * 
       * FormData:
       * - email
       * 
       * Returns:
       * - email: Generated trial email
       * - license_key: Trial license key
       * - password: Password for the trial account
       * - message: Success message
       * - success: true/false
       * - validity_days: Trial validity period (days)
       */
      async requestTrialLicense(email) {
        try {
          const trialUrl = `${this.apiUrl}/api/license/trial`;
          const body = new FormData();
          body.append("email", email);
          const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
          const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
          const response = await (0, import_obsidian10.requestUrl)({
            url: trialUrl,
            method: "POST",
            headers: {
              "Content-Type": `multipart/form-data; boundary=${boundary2}`
            },
            body: arrayBufferBody
          });
          if (response.status !== 200 && response.status !== 201) {
            console.error(`Trial license request failed: ${response.text}`);
            throw new Error(`Trial request failed: ${response.status}`);
          }
          const data = response.json;
          if (data && data.data && data.data.length > 0) {
            return data.data[0];
          }
          throw new Error("Invalid trial response format");
        } catch (error2) {
          console.error("Failed to request trial license:", error2);
          throw error2;
        }
      }
      /**
       * Activate a license key
       * 
       * POST /api/license/activate
       * Authorization: Bearer <token>
       * 
       * FormData:
       * - license_key
       * - device_id
       * - device_name
       * - device_type
       */
      async activateLicense(token, licenseKey, deviceId, deviceName, deviceType) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const activateUrl = `${this.apiUrl}/api/license/activate`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("device_id", deviceId);
            body.append("device_name", deviceName);
            body.append("device_type", deviceType);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url: activateUrl,
              method: "POST",
              headers: {
                "Content-Type": `multipart/form-data; boundary=${boundary2}`,
                "Authorization": `Bearer ${freshToken}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200 && response.status !== 201) {
              console.error(`License activation failed: ${response.text}`);
              throw new Error(`License activation failed: ${response.status}`);
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            throw new Error("Invalid activation response format");
          } catch (error2) {
            console.error("Failed to activate license:", error2);
            throw error2;
          }
        });
      }
      /**
       * Get license usage information
       * 
       * GET /api/license/usage?key=<license_key>&_t=<timestamp>
       * Authorization: Bearer <token>
       * 
       * Note: Adds timestamp parameter to prevent HTTP caching
       */
      async getLicenseUsage(token, licenseKey) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const timestamp = Date.now();
            const usageUrl = `${this.apiUrl}/api/license/usage?key=${licenseKey}&_t=${timestamp}`;
            const response = await (0, import_obsidian10.requestUrl)({
              url: usageUrl,
              method: "GET",
              headers: {
                "Authorization": `Bearer ${freshToken}`,
                "Cache-Control": "no-cache",
                "Pragma": "no-cache"
              }
            });
            if (response.status !== 200) {
              console.error(`License usage fetch failed: ${response.text}`);
              throw new Error(`License usage fetch failed: ${response.status}`);
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            throw new Error("Invalid usage response format");
          } catch (error2) {
            console.error("Failed to get license usage:", error2);
            throw error2;
          }
        });
      }
      /**
       * Get license information (plan, expiration, features)
       * 
       * GET /api/license/info?key=<license_key>&_t=<timestamp>
       * Authorization: Bearer <token>
       * 
       * Returns up-to-date license information including:
       * - expires_at: expiration timestamp
       * - plan: license plan type
       * - features.max_storage: maximum storage quota
       */
      async getLicenseInfo(token, licenseKey) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const timestamp = Date.now();
            const infoUrl = `${this.apiUrl}/api/license/info?key=${licenseKey}&_t=${timestamp}`;
            const response = await (0, import_obsidian10.requestUrl)({
              url: infoUrl,
              method: "GET",
              headers: {
                "Authorization": `Bearer ${freshToken}`,
                "Cache-Control": "no-cache",
                "Pragma": "no-cache"
              }
            });
            if (response.status !== 200) {
              console.error(`License info fetch failed: ${response.text}`);
              throw new Error(`License info fetch failed: ${response.status}`);
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            throw new Error("Invalid license info response format");
          } catch (error2) {
            console.error("Failed to get license info:", error2);
            throw error2;
          }
        });
      }
      /**
       * Reset license usage (clear sync database and publish data)
       * 
       * POST /api/license/usage/reset?key=<license_key>
       * Authorization: Bearer <token>
       * 
       * This will:
       * 1. Delete and recreate the CouchDB database (clear sync data)
       * 2. Delete the publish directory (clear publish data)
       */
      async resetUsage(token, licenseKey) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const resetUrl = `${this.apiUrl}/api/license/usage/reset?key=${licenseKey}`;
            const response = await (0, import_obsidian10.requestUrl)({
              url: resetUrl,
              method: "POST",
              headers: {
                "Authorization": `Bearer ${freshToken}`
              }
            });
            if (response.status !== 200 && response.status !== 201) {
              console.error(`License usage reset failed: ${response.text}`);
              throw new Error(`Reset failed: ${response.status}`);
            }
            return { success: true };
          } catch (error2) {
            console.error("Failed to reset license usage:", error2);
            throw error2;
          }
        });
      }
      /**
       * Get current subdomain for license
       * 
       * GET /api/license/subdomain?key={license_key}
       * Authorization: Bearer <token>
       */
      async getDomains(token, licenseKey) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/domains?key=${licenseKey}`;
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "GET",
              headers: {
                "Authorization": `Bearer ${freshToken}`
              }
            });
            if (response.status !== 200) {
              console.error(`Get subdomain failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to get subdomain:", error2);
            return null;
          }
        });
      }
      /**
       * Check if subdomain is available
       * 
       * POST /api/license/subdomain/check
       * Authorization: Bearer <token>
       * FormData: license_key, subdomain
       */
      async checkSubdomainAvailability(token, licenseKey, subdomain) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/subdomain/check`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("subdomain", subdomain);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "POST",
              headers: {
                "Content-Type": `multipart/form-data; boundary=${boundary2}`,
                "Authorization": `Bearer ${freshToken}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              console.error(`Check subdomain failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to check subdomain:", error2);
            return null;
          }
        });
      }
      /**
       * Update subdomain
       * 
       * POST /api/license/subdomain/update
       * Authorization: Bearer <token>
       * FormData: license_key, new_subdomain
       */
      async updateSubdomain(token, licenseKey, newSubdomain) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/subdomain/update`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("new_subdomain", newSubdomain);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "POST",
              headers: {
                "Content-Type": `multipart/form-data; boundary=${boundary2}`,
                "Authorization": `Bearer ${freshToken}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              console.error(`Update subdomain failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to update subdomain:", error2);
            return null;
          }
        });
      }
      /**
       * Check custom domain DNS configuration
       * 
       * POST /api/license/domain/check
       * Authorization: Bearer <token>
       * FormData: license_key, domain
       */
      async checkCustomDomain(token, licenseKey, domain) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/domain/check`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("domain", domain);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "POST",
              headers: {
                "Authorization": `Bearer ${freshToken}`,
                "Content-Type": `multipart/form-data; boundary=${boundary2}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              console.error(`Check custom domain failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to check custom domain:", error2);
            throw error2;
          }
        });
      }
      /**
       * Add custom domain to license
       * 
       * POST /api/license/domain/add
       * Authorization: Bearer <token>
       * FormData: license_key, domain
       */
      async addCustomDomain(token, licenseKey, domain) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/domain/add`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("domain", domain);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "POST",
              headers: {
                "Authorization": `Bearer ${freshToken}`,
                "Content-Type": `multipart/form-data; boundary=${boundary2}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200 && response.status !== 201) {
              console.error(`Add custom domain failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to add custom domain:", error2);
            throw error2;
          }
        });
      }
      /**
       * Check HTTPS certificate status for custom domain
       * 
       * POST /api/license/domain/https-status
       * Authorization: Bearer <token>
       * FormData: license_key, domain
       */
      async checkCustomDomainHttpsStatus(token, licenseKey, domain) {
        return this.requestWithTokenRefresh(async (freshToken) => {
          try {
            const url = `${this.apiUrl}/api/license/domain/https-status`;
            const body = new FormData();
            body.append("license_key", licenseKey);
            body.append("domain", domain);
            const boundary2 = "----WebKitFormBoundary" + Math.random().toString(36).substring(2, 9);
            const arrayBufferBody = await this.formDataToArrayBuffer(body, boundary2);
            const response = await (0, import_obsidian10.requestUrl)({
              url,
              method: "POST",
              headers: {
                "Authorization": `Bearer ${freshToken}`,
                "Content-Type": `multipart/form-data; boundary=${boundary2}`
              },
              body: arrayBufferBody
            });
            if (response.status !== 200) {
              console.error(`Check HTTPS status failed: ${response.text}`);
              return null;
            }
            const data = response.json;
            if (data && data.data && data.data.length > 0) {
              return data.data[0];
            }
            return null;
          } catch (error2) {
            console.error("Failed to check HTTPS status:", error2);
            throw error2;
          }
        });
      }
    };
  }
});

// node_modules/svelte/src/internal/client/constants.js
var DERIVED, EFFECT, RENDER_EFFECT, BLOCK_EFFECT, BRANCH_EFFECT, ROOT_EFFECT, BOUNDARY_EFFECT, UNOWNED, DISCONNECTED, CLEAN, DIRTY, MAYBE_DIRTY, INERT, DESTROYED, EFFECT_RAN, EFFECT_TRANSPARENT, INSPECT_EFFECT, HEAD_EFFECT, EFFECT_PRESERVED, USER_EFFECT, REACTION_IS_UPDATING, ASYNC, ERROR_VALUE, STATE_SYMBOL, LEGACY_PROPS, LOADING_ATTR_SYMBOL, PROXY_PATH_SYMBOL, STALE_REACTION, TEXT_NODE, COMMENT_NODE;
var init_constants = __esm({
  "node_modules/svelte/src/internal/client/constants.js"() {
    DERIVED = 1 << 1;
    EFFECT = 1 << 2;
    RENDER_EFFECT = 1 << 3;
    BLOCK_EFFECT = 1 << 4;
    BRANCH_EFFECT = 1 << 5;
    ROOT_EFFECT = 1 << 6;
    BOUNDARY_EFFECT = 1 << 7;
    UNOWNED = 1 << 8;
    DISCONNECTED = 1 << 9;
    CLEAN = 1 << 10;
    DIRTY = 1 << 11;
    MAYBE_DIRTY = 1 << 12;
    INERT = 1 << 13;
    DESTROYED = 1 << 14;
    EFFECT_RAN = 1 << 15;
    EFFECT_TRANSPARENT = 1 << 16;
    INSPECT_EFFECT = 1 << 17;
    HEAD_EFFECT = 1 << 18;
    EFFECT_PRESERVED = 1 << 19;
    USER_EFFECT = 1 << 20;
    REACTION_IS_UPDATING = 1 << 21;
    ASYNC = 1 << 22;
    ERROR_VALUE = 1 << 23;
    STATE_SYMBOL = Symbol("$state");
    LEGACY_PROPS = Symbol("legacy props");
    LOADING_ATTR_SYMBOL = Symbol("");
    PROXY_PATH_SYMBOL = Symbol("proxy path");
    STALE_REACTION = new class StaleReactionError extends Error {
      constructor() {
        super(...arguments);
        __publicField(this, "name", "StaleReactionError");
        __publicField(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
      }
    }();
    TEXT_NODE = 3;
    COMMENT_NODE = 8;
  }
});

// node_modules/esm-env/true.js
var init_true = __esm({
  "node_modules/esm-env/true.js"() {
  }
});

// node_modules/esm-env/dev-fallback.js
var _a4, _b2, node_env, dev_fallback_default;
var init_dev_fallback = __esm({
  "node_modules/esm-env/dev-fallback.js"() {
    node_env = (_b2 = (_a4 = globalThis.process) == null ? void 0 : _a4.env) == null ? void 0 : _b2.NODE_ENV;
    dev_fallback_default = node_env && !node_env.toLowerCase().startsWith("prod");
  }
});

// node_modules/esm-env/false.js
var init_false = __esm({
  "node_modules/esm-env/false.js"() {
  }
});

// node_modules/esm-env/index.js
var init_esm_env = __esm({
  "node_modules/esm-env/index.js"() {
    init_true();
    init_dev_fallback();
    init_false();
  }
});

// node_modules/svelte/src/internal/shared/utils.js
function run(fn) {
  return fn();
}
function run_all(arr) {
  for (var i = 0; i < arr.length; i++) {
    arr[i]();
  }
}
function deferred() {
  var resolve;
  var reject;
  var promise = new Promise((res2, rej) => {
    resolve = res2;
    reject = rej;
  });
  return { promise, resolve, reject };
}
var is_array, index_of, array_from, object_keys, define_property, get_descriptor, get_descriptors, object_prototype, array_prototype, get_prototype_of, is_extensible, noop2;
var init_utils3 = __esm({
  "node_modules/svelte/src/internal/shared/utils.js"() {
    is_array = Array.isArray;
    index_of = Array.prototype.indexOf;
    array_from = Array.from;
    object_keys = Object.keys;
    define_property = Object.defineProperty;
    get_descriptor = Object.getOwnPropertyDescriptor;
    get_descriptors = Object.getOwnPropertyDescriptors;
    object_prototype = Object.prototype;
    array_prototype = Array.prototype;
    get_prototype_of = Object.getPrototypeOf;
    is_extensible = Object.isExtensible;
    noop2 = () => {
    };
  }
});

// node_modules/svelte/src/internal/client/reactivity/equality.js
function equals(value2) {
  return value2 === this.v;
}
function safe_not_equal(a, b) {
  return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
}
function safe_equals(value2) {
  return !safe_not_equal(value2, this.v);
}
var init_equality = __esm({
  "node_modules/svelte/src/internal/client/reactivity/equality.js"() {
  }
});

// node_modules/svelte/src/internal/shared/errors.js
function lifecycle_outside_component(name) {
  if (dev_fallback_default) {
    const error2 = new Error(`lifecycle_outside_component
\`${name}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
  }
}
var init_errors = __esm({
  "node_modules/svelte/src/internal/shared/errors.js"() {
    init_esm_env();
  }
});

// node_modules/svelte/src/internal/client/errors.js
function async_derived_orphan() {
  if (dev_fallback_default) {
    const error2 = new Error(`async_derived_orphan
Cannot create a \`$derived(...)\` with an \`await\` expression outside of an effect tree
https://svelte.dev/e/async_derived_orphan`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/async_derived_orphan`);
  }
}
function bind_invalid_checkbox_value() {
  if (dev_fallback_default) {
    const error2 = new Error(`bind_invalid_checkbox_value
Using \`bind:value\` together with a checkbox input is not allowed. Use \`bind:checked\` instead
https://svelte.dev/e/bind_invalid_checkbox_value`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);
  }
}
function derived_references_self() {
  if (dev_fallback_default) {
    const error2 = new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/derived_references_self`);
  }
}
function effect_in_teardown(rune2) {
  if (dev_fallback_default) {
    const error2 = new Error(`effect_in_teardown
\`${rune2}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/effect_in_teardown`);
  }
}
function effect_in_unowned_derived() {
  if (dev_fallback_default) {
    const error2 = new Error(`effect_in_unowned_derived
Effect cannot be created inside a \`$derived\` value that was not itself created inside an effect
https://svelte.dev/e/effect_in_unowned_derived`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
  }
}
function effect_orphan(rune2) {
  if (dev_fallback_default) {
    const error2 = new Error(`effect_orphan
\`${rune2}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/effect_orphan`);
  }
}
function effect_update_depth_exceeded() {
  if (dev_fallback_default) {
    const error2 = new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
https://svelte.dev/e/effect_update_depth_exceeded`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
  }
}
function flush_sync_in_effect() {
  if (dev_fallback_default) {
    const error2 = new Error(`flush_sync_in_effect
Cannot use \`flushSync\` inside an effect
https://svelte.dev/e/flush_sync_in_effect`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/flush_sync_in_effect`);
  }
}
function hydration_failed() {
  if (dev_fallback_default) {
    const error2 = new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/hydration_failed`);
  }
}
function props_invalid_value(key4) {
  if (dev_fallback_default) {
    const error2 = new Error(`props_invalid_value
Cannot do \`bind:${key4}={undefined}\` when \`${key4}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/props_invalid_value`);
  }
}
function rune_outside_svelte(rune2) {
  if (dev_fallback_default) {
    const error2 = new Error(`rune_outside_svelte
The \`${rune2}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/rune_outside_svelte`);
  }
}
function state_descriptors_fixed() {
  if (dev_fallback_default) {
    const error2 = new Error(`state_descriptors_fixed
Property descriptors defined on \`$state\` objects must contain \`value\` and always be \`enumerable\`, \`configurable\` and \`writable\`.
https://svelte.dev/e/state_descriptors_fixed`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
  }
}
function state_prototype_fixed() {
  if (dev_fallback_default) {
    const error2 = new Error(`state_prototype_fixed
Cannot set prototype of \`$state\` object
https://svelte.dev/e/state_prototype_fixed`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
  }
}
function state_unsafe_mutation() {
  if (dev_fallback_default) {
    const error2 = new Error(`state_unsafe_mutation
Updating state inside \`$derived(...)\`, \`$inspect(...)\` or a template expression is forbidden. If the value should not be reactive, declare it without \`$state\`
https://svelte.dev/e/state_unsafe_mutation`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
  }
}
function svelte_boundary_reset_onerror() {
  if (dev_fallback_default) {
    const error2 = new Error(`svelte_boundary_reset_onerror
A \`<svelte:boundary>\` \`reset\` function cannot be called while an error is still being handled
https://svelte.dev/e/svelte_boundary_reset_onerror`);
    error2.name = "Svelte error";
    throw error2;
  } else {
    throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
  }
}
var init_errors2 = __esm({
  "node_modules/svelte/src/internal/client/errors.js"() {
    init_esm_env();
    init_errors();
  }
});

// node_modules/svelte/src/internal/flags/index.js
function enable_legacy_mode_flag() {
  legacy_mode_flag = true;
}
var async_mode_flag, legacy_mode_flag, tracing_mode_flag;
var init_flags = __esm({
  "node_modules/svelte/src/internal/flags/index.js"() {
    async_mode_flag = false;
    legacy_mode_flag = false;
    tracing_mode_flag = false;
  }
});

// node_modules/svelte/src/constants.js
var EACH_ITEM_REACTIVE, EACH_INDEX_REACTIVE, EACH_IS_CONTROLLED, EACH_IS_ANIMATED, EACH_ITEM_IMMUTABLE, PROPS_IS_IMMUTABLE, PROPS_IS_RUNES, PROPS_IS_UPDATED, PROPS_IS_BINDABLE, PROPS_IS_LAZY_INITIAL, TRANSITION_OUT, TRANSITION_GLOBAL, TEMPLATE_FRAGMENT, TEMPLATE_USE_IMPORT_NODE, TEMPLATE_USE_SVG, TEMPLATE_USE_MATHML, HYDRATION_START, HYDRATION_START_ELSE, HYDRATION_END, HYDRATION_ERROR, ELEMENT_PRESERVE_ATTRIBUTE_CASE, ELEMENT_IS_INPUT, UNINITIALIZED, FILENAME, HMR, NAMESPACE_HTML;
var init_constants2 = __esm({
  "node_modules/svelte/src/constants.js"() {
    EACH_ITEM_REACTIVE = 1;
    EACH_INDEX_REACTIVE = 1 << 1;
    EACH_IS_CONTROLLED = 1 << 2;
    EACH_IS_ANIMATED = 1 << 3;
    EACH_ITEM_IMMUTABLE = 1 << 4;
    PROPS_IS_IMMUTABLE = 1;
    PROPS_IS_RUNES = 1 << 1;
    PROPS_IS_UPDATED = 1 << 2;
    PROPS_IS_BINDABLE = 1 << 3;
    PROPS_IS_LAZY_INITIAL = 1 << 4;
    TRANSITION_OUT = 1 << 1;
    TRANSITION_GLOBAL = 1 << 2;
    TEMPLATE_FRAGMENT = 1;
    TEMPLATE_USE_IMPORT_NODE = 1 << 1;
    TEMPLATE_USE_SVG = 1 << 2;
    TEMPLATE_USE_MATHML = 1 << 3;
    HYDRATION_START = "[";
    HYDRATION_START_ELSE = "[!";
    HYDRATION_END = "]";
    HYDRATION_ERROR = {};
    ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
    ELEMENT_IS_INPUT = 1 << 2;
    UNINITIALIZED = Symbol();
    FILENAME = Symbol("filename");
    HMR = Symbol("hmr");
    NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
  }
});

// node_modules/svelte/src/internal/shared/warnings.js
var init_warnings = __esm({
  "node_modules/svelte/src/internal/shared/warnings.js"() {
    init_esm_env();
  }
});

// node_modules/svelte/src/internal/shared/clone.js
var init_clone = __esm({
  "node_modules/svelte/src/internal/shared/clone.js"() {
    init_esm_env();
    init_warnings();
    init_utils3();
  }
});

// node_modules/svelte/src/internal/client/dev/tracing.js
function get_stack(label) {
  let error2 = Error();
  const stack2 = error2.stack;
  if (!stack2) return null;
  const lines = stack2.split("\n");
  const new_lines = ["\n"];
  for (let i = 0; i < lines.length; i++) {
    const line = lines[i];
    if (line === "Error") {
      continue;
    }
    if (line.includes("validate_each_keys")) {
      return null;
    }
    if (line.includes("svelte/src/internal")) {
      continue;
    }
    new_lines.push(line);
  }
  if (new_lines.length === 1) {
    return null;
  }
  define_property(error2, "stack", {
    value: new_lines.join("\n")
  });
  define_property(error2, "name", {
    // 'Error' suffix is required for stack traces to be rendered properly
    value: `${label}Error`
  });
  return (
    /** @type {Error & { stack: string }} */
    error2
  );
}
function tag(source2, label) {
  source2.label = label;
  tag_proxy(source2.v, label);
  return source2;
}
function tag_proxy(value2, label) {
  var _a6;
  (_a6 = value2 == null ? void 0 : value2[PROXY_PATH_SYMBOL]) == null ? void 0 : _a6.call(value2, label);
  return value2;
}
var tracing_expressions;
var init_tracing = __esm({
  "node_modules/svelte/src/internal/client/dev/tracing.js"() {
    init_constants2();
    init_clone();
    init_utils3();
    init_constants();
    init_effects();
    init_runtime();
    tracing_expressions = null;
  }
});

// node_modules/svelte/src/internal/client/context.js
function set_component_context(context2) {
  component_context = context2;
}
function set_dev_stack(stack2) {
  dev_stack = stack2;
}
function set_dev_current_component_function(fn) {
  dev_current_component_function = fn;
}
function push(props, runes = false, fn) {
  component_context = {
    p: component_context,
    c: null,
    e: null,
    s: props,
    x: null,
    l: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null
  };
  if (dev_fallback_default) {
    component_context.function = fn;
    dev_current_component_function = fn;
  }
}
function pop2(component2) {
  var _a6;
  var context2 = (
    /** @type {ComponentContext} */
    component_context
  );
  var effects = context2.e;
  if (effects !== null) {
    context2.e = null;
    for (var fn of effects) {
      create_user_effect(fn);
    }
  }
  if (component2 !== void 0) {
    context2.x = component2;
  }
  component_context = context2.p;
  if (dev_fallback_default) {
    dev_current_component_function = (_a6 = component_context == null ? void 0 : component_context.function) != null ? _a6 : null;
  }
  return component2 != null ? component2 : (
    /** @type {T} */
    {}
  );
}
function is_runes() {
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
}
var component_context, dev_stack, dev_current_component_function;
var init_context = __esm({
  "node_modules/svelte/src/internal/client/context.js"() {
    init_esm_env();
    init_errors2();
    init_runtime();
    init_effects();
    init_flags();
    init_constants2();
    init_constants();
    component_context = null;
    dev_stack = null;
    dev_current_component_function = null;
  }
});

// node_modules/svelte/src/internal/client/dom/task.js
function run_micro_tasks() {
  var tasks3 = micro_tasks;
  micro_tasks = [];
  run_all(tasks3);
}
function queue_micro_task(fn) {
  if (micro_tasks.length === 0 && !is_flushing_sync) {
    var tasks3 = micro_tasks;
    queueMicrotask(() => {
      if (tasks3 === micro_tasks) run_micro_tasks();
    });
  }
  micro_tasks.push(fn);
}
function flush_tasks() {
  while (micro_tasks.length > 0) {
    run_micro_tasks();
  }
}
var micro_tasks;
var init_task2 = __esm({
  "node_modules/svelte/src/internal/client/dom/task.js"() {
    init_utils3();
    init_batch();
    micro_tasks = [];
  }
});

// node_modules/svelte/src/internal/client/warnings.js
function await_reactivity_loss(name) {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${name}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/await_reactivity_loss`);
  }
}
function await_waterfall(name, location) {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${name}\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
https://svelte.dev/e/await_waterfall`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/await_waterfall`);
  }
}
function hydration_attribute_changed(attribute, html2, value2) {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${attribute}\` attribute on \`${html2}\` changed its value between server and client renders. The client value, \`${value2}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/hydration_attribute_changed`);
  }
}
function hydration_mismatch(location) {
  if (dev_fallback_default) {
    console.warn(
      `%c[svelte] hydration_mismatch
%c${location ? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}` : "Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,
      bold,
      normal
    );
  } else {
    console.warn(`https://svelte.dev/e/hydration_mismatch`);
  }
}
function lifecycle_double_unmount() {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/lifecycle_double_unmount`);
  }
}
function select_multiple_invalid_value() {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] select_multiple_invalid_value
%cThe \`value\` property of a \`<select multiple>\` element should be an array, but it received a non-array value. The selection will be kept as is.
https://svelte.dev/e/select_multiple_invalid_value`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/select_multiple_invalid_value`);
  }
}
function state_proxy_equality_mismatch(operator) {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${operator}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);
  }
}
function state_proxy_unmount() {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] state_proxy_unmount
%cTried to unmount a state proxy, rather than a component
https://svelte.dev/e/state_proxy_unmount`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/state_proxy_unmount`);
  }
}
function svelte_boundary_reset_noop() {
  if (dev_fallback_default) {
    console.warn(`%c[svelte] svelte_boundary_reset_noop
%cA \`<svelte:boundary>\` \`reset\` function only resets the boundary the first time it is called
https://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);
  } else {
    console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
  }
}
var bold, normal;
var init_warnings2 = __esm({
  "node_modules/svelte/src/internal/client/warnings.js"() {
    init_esm_env();
    bold = "font-weight: bold";
    normal = "font-weight: normal";
  }
});

// node_modules/svelte/src/internal/client/dom/hydration.js
function set_hydrating(value2) {
  hydrating = value2;
}
function set_hydrate_node(node) {
  if (node === null) {
    hydration_mismatch();
    throw HYDRATION_ERROR;
  }
  return hydrate_node = node;
}
function hydrate_next() {
  return set_hydrate_node(
    /** @type {TemplateNode} */
    get_next_sibling(hydrate_node)
  );
}
function reset(node) {
  if (!hydrating) return;
  if (get_next_sibling(hydrate_node) !== null) {
    hydration_mismatch();
    throw HYDRATION_ERROR;
  }
  hydrate_node = node;
}
function next(count = 1) {
  if (hydrating) {
    var i = count;
    var node = hydrate_node;
    while (i--) {
      node = /** @type {TemplateNode} */
      get_next_sibling(node);
    }
    hydrate_node = node;
  }
}
function skip_nodes(remove = true) {
  var depth = 0;
  var node = hydrate_node;
  while (true) {
    if (node.nodeType === COMMENT_NODE) {
      var data = (
        /** @type {Comment} */
        node.data
      );
      if (data === HYDRATION_END) {
        if (depth === 0) return node;
        depth -= 1;
      } else if (data === HYDRATION_START || data === HYDRATION_START_ELSE) {
        depth += 1;
      }
    }
    var next2 = (
      /** @type {TemplateNode} */
      get_next_sibling(node)
    );
    if (remove) node.remove();
    node = next2;
  }
}
function read_hydration_instruction(node) {
  if (!node || node.nodeType !== COMMENT_NODE) {
    hydration_mismatch();
    throw HYDRATION_ERROR;
  }
  return (
    /** @type {Comment} */
    node.data
  );
}
var hydrating, hydrate_node;
var init_hydration = __esm({
  "node_modules/svelte/src/internal/client/dom/hydration.js"() {
    init_constants();
    init_constants2();
    init_warnings2();
    init_operations();
    hydrating = false;
  }
});

// node_modules/svelte/src/internal/client/proxy.js
function proxy(value2) {
  if (typeof value2 !== "object" || value2 === null || STATE_SYMBOL in value2) {
    return value2;
  }
  const prototype = get_prototype_of(value2);
  if (prototype !== object_prototype && prototype !== array_prototype) {
    return value2;
  }
  var sources = /* @__PURE__ */ new Map();
  var is_proxied_array = is_array(value2);
  var version2 = state(0);
  var stack2 = dev_fallback_default && tracing_mode_flag ? get_stack("CreatedAt") : null;
  var parent_version = update_version;
  var with_parent = (fn) => {
    if (update_version === parent_version) {
      return fn();
    }
    var reaction = active_reaction;
    var version3 = update_version;
    set_active_reaction(null);
    set_update_version(parent_version);
    var result = fn();
    set_active_reaction(reaction);
    set_update_version(version3);
    return result;
  };
  if (is_proxied_array) {
    sources.set("length", state(
      /** @type {any[]} */
      value2.length,
      stack2
    ));
    if (dev_fallback_default) {
      value2 = /** @type {any} */
      inspectable_array(
        /** @type {any[]} */
        value2
      );
    }
  }
  var path8 = "";
  let updating = false;
  function update_path(new_path) {
    if (updating) return;
    updating = true;
    path8 = new_path;
    tag(version2, `${path8} version`);
    for (const [prop2, source2] of sources) {
      tag(source2, get_label(path8, prop2));
    }
    updating = false;
  }
  return new Proxy(
    /** @type {any} */
    value2,
    {
      defineProperty(_, prop2, descriptor) {
        if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
          state_descriptors_fixed();
        }
        var s = sources.get(prop2);
        if (s === void 0) {
          s = with_parent(() => {
            var s2 = state(descriptor.value, stack2);
            sources.set(prop2, s2);
            if (dev_fallback_default && typeof prop2 === "string") {
              tag(s2, get_label(path8, prop2));
            }
            return s2;
          });
        } else {
          set(s, descriptor.value, true);
        }
        return true;
      },
      deleteProperty(target, prop2) {
        var s = sources.get(prop2);
        if (s === void 0) {
          if (prop2 in target) {
            const s2 = with_parent(() => state(UNINITIALIZED, stack2));
            sources.set(prop2, s2);
            increment(version2);
            if (dev_fallback_default) {
              tag(s2, get_label(path8, prop2));
            }
          }
        } else {
          set(s, UNINITIALIZED);
          increment(version2);
        }
        return true;
      },
      get(target, prop2, receiver) {
        var _a6;
        if (prop2 === STATE_SYMBOL) {
          return value2;
        }
        if (dev_fallback_default && prop2 === PROXY_PATH_SYMBOL) {
          return update_path;
        }
        var s = sources.get(prop2);
        var exists = prop2 in target;
        if (s === void 0 && (!exists || ((_a6 = get_descriptor(target, prop2)) == null ? void 0 : _a6.writable))) {
          s = with_parent(() => {
            var p = proxy(exists ? target[prop2] : UNINITIALIZED);
            var s2 = state(p, stack2);
            if (dev_fallback_default) {
              tag(s2, get_label(path8, prop2));
            }
            return s2;
          });
          sources.set(prop2, s);
        }
        if (s !== void 0) {
          var v = get2(s);
          return v === UNINITIALIZED ? void 0 : v;
        }
        return Reflect.get(target, prop2, receiver);
      },
      getOwnPropertyDescriptor(target, prop2) {
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2);
        if (descriptor && "value" in descriptor) {
          var s = sources.get(prop2);
          if (s) descriptor.value = get2(s);
        } else if (descriptor === void 0) {
          var source2 = sources.get(prop2);
          var value3 = source2 == null ? void 0 : source2.v;
          if (source2 !== void 0 && value3 !== UNINITIALIZED) {
            return {
              enumerable: true,
              configurable: true,
              value: value3,
              writable: true
            };
          }
        }
        return descriptor;
      },
      has(target, prop2) {
        var _a6;
        if (prop2 === STATE_SYMBOL) {
          return true;
        }
        var s = sources.get(prop2);
        var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop2);
        if (s !== void 0 || active_effect !== null && (!has || ((_a6 = get_descriptor(target, prop2)) == null ? void 0 : _a6.writable))) {
          if (s === void 0) {
            s = with_parent(() => {
              var p = has ? proxy(target[prop2]) : UNINITIALIZED;
              var s2 = state(p, stack2);
              if (dev_fallback_default) {
                tag(s2, get_label(path8, prop2));
              }
              return s2;
            });
            sources.set(prop2, s);
          }
          var value3 = get2(s);
          if (value3 === UNINITIALIZED) {
            return false;
          }
        }
        return has;
      },
      set(target, prop2, value3, receiver) {
        var _a6;
        var s = sources.get(prop2);
        var has = prop2 in target;
        if (is_proxied_array && prop2 === "length") {
          for (var i = value3; i < /** @type {Source<number>} */
          s.v; i += 1) {
            var other_s = sources.get(i + "");
            if (other_s !== void 0) {
              set(other_s, UNINITIALIZED);
            } else if (i in target) {
              other_s = with_parent(() => state(UNINITIALIZED, stack2));
              sources.set(i + "", other_s);
              if (dev_fallback_default) {
                tag(other_s, get_label(path8, i));
              }
            }
          }
        }
        if (s === void 0) {
          if (!has || ((_a6 = get_descriptor(target, prop2)) == null ? void 0 : _a6.writable)) {
            s = with_parent(() => state(void 0, stack2));
            if (dev_fallback_default) {
              tag(s, get_label(path8, prop2));
            }
            set(s, proxy(value3));
            sources.set(prop2, s);
          }
        } else {
          has = s.v !== UNINITIALIZED;
          var p = with_parent(() => proxy(value3));
          set(s, p);
        }
        var descriptor = Reflect.getOwnPropertyDescriptor(target, prop2);
        if (descriptor == null ? void 0 : descriptor.set) {
          descriptor.set.call(receiver, value3);
        }
        if (!has) {
          if (is_proxied_array && typeof prop2 === "string") {
            var ls = (
              /** @type {Source<number>} */
              sources.get("length")
            );
            var n3 = Number(prop2);
            if (Number.isInteger(n3) && n3 >= ls.v) {
              set(ls, n3 + 1);
            }
          }
          increment(version2);
        }
        return true;
      },
      ownKeys(target) {
        get2(version2);
        var own_keys = Reflect.ownKeys(target).filter((key5) => {
          var source3 = sources.get(key5);
          return source3 === void 0 || source3.v !== UNINITIALIZED;
        });
        for (var [key4, source2] of sources) {
          if (source2.v !== UNINITIALIZED && !(key4 in target)) {
            own_keys.push(key4);
          }
        }
        return own_keys;
      },
      setPrototypeOf() {
        state_prototype_fixed();
      }
    }
  );
}
function get_label(path8, prop2) {
  var _a6;
  if (typeof prop2 === "symbol") return `${path8}[Symbol(${(_a6 = prop2.description) != null ? _a6 : ""})]`;
  if (regex_is_valid_identifier.test(prop2)) return `${path8}.${prop2}`;
  return /^\d+$/.test(prop2) ? `${path8}[${prop2}]` : `${path8}['${prop2}']`;
}
function get_proxied_value(value2) {
  try {
    if (value2 !== null && typeof value2 === "object" && STATE_SYMBOL in value2) {
      return value2[STATE_SYMBOL];
    }
  } catch (e2) {
  }
  return value2;
}
function is(a, b) {
  return Object.is(get_proxied_value(a), get_proxied_value(b));
}
function inspectable_array(array) {
  return new Proxy(array, {
    get(target, prop2, receiver) {
      var value2 = Reflect.get(target, prop2, receiver);
      if (!ARRAY_MUTATING_METHODS.has(
        /** @type {string} */
        prop2
      )) {
        return value2;
      }
      return function(...args) {
        set_inspect_effects_deferred();
        var result = value2.apply(this, args);
        flush_inspect_effects();
        return result;
      };
    }
  });
}
var regex_is_valid_identifier, ARRAY_MUTATING_METHODS;
var init_proxy = __esm({
  "node_modules/svelte/src/internal/client/proxy.js"() {
    init_esm_env();
    init_runtime();
    init_utils3();
    init_sources();
    init_constants();
    init_constants2();
    init_errors2();
    init_tracing();
    init_flags();
    regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
    ARRAY_MUTATING_METHODS = /* @__PURE__ */ new Set([
      "copyWithin",
      "fill",
      "pop",
      "push",
      "reverse",
      "shift",
      "sort",
      "splice",
      "unshift"
    ]);
  }
});

// node_modules/svelte/src/internal/client/dev/equality.js
function init_array_prototype_warnings() {
  const array_prototype2 = Array.prototype;
  const cleanup = Array.__svelte_cleanup;
  if (cleanup) {
    cleanup();
  }
  const { indexOf, lastIndexOf, includes } = array_prototype2;
  array_prototype2.indexOf = function(item, from_index) {
    const index6 = indexOf.call(this, item, from_index);
    if (index6 === -1) {
      for (let i = from_index != null ? from_index : 0; i < this.length; i += 1) {
        if (get_proxied_value(this[i]) === item) {
          state_proxy_equality_mismatch("array.indexOf(...)");
          break;
        }
      }
    }
    return index6;
  };
  array_prototype2.lastIndexOf = function(item, from_index) {
    const index6 = lastIndexOf.call(this, item, from_index != null ? from_index : this.length - 1);
    if (index6 === -1) {
      for (let i = 0; i <= (from_index != null ? from_index : this.length - 1); i += 1) {
        if (get_proxied_value(this[i]) === item) {
          state_proxy_equality_mismatch("array.lastIndexOf(...)");
          break;
        }
      }
    }
    return index6;
  };
  array_prototype2.includes = function(item, from_index) {
    const has = includes.call(this, item, from_index);
    if (!has) {
      for (let i = 0; i < this.length; i += 1) {
        if (get_proxied_value(this[i]) === item) {
          state_proxy_equality_mismatch("array.includes(...)");
          break;
        }
      }
    }
    return has;
  };
  Array.__svelte_cleanup = () => {
    array_prototype2.indexOf = indexOf;
    array_prototype2.lastIndexOf = lastIndexOf;
    array_prototype2.includes = includes;
  };
}
var init_equality2 = __esm({
  "node_modules/svelte/src/internal/client/dev/equality.js"() {
    init_warnings2();
    init_proxy();
  }
});

// node_modules/svelte/src/internal/client/dom/operations.js
function init_operations2() {
  if ($window !== void 0) {
    return;
  }
  $window = window;
  $document = document;
  is_firefox = /Firefox/.test(navigator.userAgent);
  var element_prototype = Element.prototype;
  var node_prototype = Node.prototype;
  var text_prototype = Text.prototype;
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
  if (is_extensible(element_prototype)) {
    element_prototype.__click = void 0;
    element_prototype.__className = void 0;
    element_prototype.__attributes = null;
    element_prototype.__style = void 0;
    element_prototype.__e = void 0;
  }
  if (is_extensible(text_prototype)) {
    text_prototype.__t = void 0;
  }
  if (dev_fallback_default) {
    element_prototype.__svelte_meta = null;
    init_array_prototype_warnings();
  }
}
function create_text(value2 = "") {
  return document.createTextNode(value2);
}
// @__NO_SIDE_EFFECTS__
function get_first_child(node) {
  return first_child_getter.call(node);
}
// @__NO_SIDE_EFFECTS__
function get_next_sibling(node) {
  return next_sibling_getter.call(node);
}
function child(node, is_text) {
  if (!hydrating) {
    return /* @__PURE__ */ get_first_child(node);
  }
  var child2 = (
    /** @type {TemplateNode} */
    /* @__PURE__ */ get_first_child(hydrate_node)
  );
  if (child2 === null) {
    child2 = hydrate_node.appendChild(create_text());
  } else if (is_text && child2.nodeType !== TEXT_NODE) {
    var text3 = create_text();
    child2 == null ? void 0 : child2.before(text3);
    set_hydrate_node(text3);
    return text3;
  }
  set_hydrate_node(child2);
  return child2;
}
function first_child(fragment, is_text = false) {
  var _a6, _b4;
  if (!hydrating) {
    var first = (
      /** @type {DocumentFragment} */
      /* @__PURE__ */ get_first_child(
        /** @type {Node} */
        fragment
      )
    );
    if (first instanceof Comment && first.data === "") return /* @__PURE__ */ get_next_sibling(first);
    return first;
  }
  if (is_text && ((_a6 = hydrate_node) == null ? void 0 : _a6.nodeType) !== TEXT_NODE) {
    var text3 = create_text();
    (_b4 = hydrate_node) == null ? void 0 : _b4.before(text3);
    set_hydrate_node(text3);
    return text3;
  }
  return hydrate_node;
}
function sibling(node, count = 1, is_text = false) {
  let next_sibling = hydrating ? hydrate_node : node;
  var last_sibling;
  while (count--) {
    last_sibling = next_sibling;
    next_sibling = /** @type {TemplateNode} */
    /* @__PURE__ */ get_next_sibling(next_sibling);
  }
  if (!hydrating) {
    return next_sibling;
  }
  if (is_text && (next_sibling == null ? void 0 : next_sibling.nodeType) !== TEXT_NODE) {
    var text3 = create_text();
    if (next_sibling === null) {
      last_sibling == null ? void 0 : last_sibling.after(text3);
    } else {
      next_sibling.before(text3);
    }
    set_hydrate_node(text3);
    return text3;
  }
  set_hydrate_node(next_sibling);
  return (
    /** @type {TemplateNode} */
    next_sibling
  );
}
function clear_text_content(node) {
  node.textContent = "";
}
function should_defer_append() {
  if (!async_mode_flag) return false;
  if (eager_block_effects !== null) return false;
  var flags2 = (
    /** @type {Effect} */
    active_effect.f
  );
  return (flags2 & EFFECT_RAN) !== 0;
}
var $window, $document, is_firefox, first_child_getter, next_sibling_getter;
var init_operations = __esm({
  "node_modules/svelte/src/internal/client/dom/operations.js"() {
    init_hydration();
    init_esm_env();
    init_equality2();
    init_utils3();
    init_runtime();
    init_flags();
    init_constants();
    init_batch();
  }
});

// node_modules/svelte/src/internal/client/error-handling.js
function handle_error(error2) {
  var effect2 = active_effect;
  if (effect2 === null) {
    active_reaction.f |= ERROR_VALUE;
    return error2;
  }
  if (dev_fallback_default && error2 instanceof Error && !adjustments.has(error2)) {
    adjustments.set(error2, get_adjustments(error2, effect2));
  }
  if ((effect2.f & EFFECT_RAN) === 0) {
    if ((effect2.f & BOUNDARY_EFFECT) === 0) {
      if (!effect2.parent && error2 instanceof Error) {
        apply_adjustments(error2);
      }
      throw error2;
    }
    effect2.b.error(error2);
  } else {
    invoke_error_boundary(error2, effect2);
  }
}
function invoke_error_boundary(error2, effect2) {
  while (effect2 !== null) {
    if ((effect2.f & BOUNDARY_EFFECT) !== 0) {
      try {
        effect2.b.error(error2);
        return;
      } catch (e2) {
        error2 = e2;
      }
    }
    effect2 = effect2.parent;
  }
  if (error2 instanceof Error) {
    apply_adjustments(error2);
  }
  throw error2;
}
function get_adjustments(error2, effect2) {
  var _a6, _b4, _c2;
  const message_descriptor = get_descriptor(error2, "message");
  if (message_descriptor && !message_descriptor.configurable) return;
  var indent = is_firefox ? "  " : "	";
  var component_stack = `
${indent}in ${((_a6 = effect2.fn) == null ? void 0 : _a6.name) || "<unknown>"}`;
  var context2 = effect2.ctx;
  while (context2 !== null) {
    component_stack += `
${indent}in ${(_b4 = context2.function) == null ? void 0 : _b4[FILENAME].split("/").pop()}`;
    context2 = context2.p;
  }
  return {
    message: error2.message + `
${component_stack}
`,
    stack: (_c2 = error2.stack) == null ? void 0 : _c2.split("\n").filter((line) => !line.includes("svelte/src/internal")).join("\n")
  };
}
function apply_adjustments(error2) {
  const adjusted = adjustments.get(error2);
  if (adjusted) {
    define_property(error2, "message", {
      value: adjusted.message
    });
    define_property(error2, "stack", {
      value: adjusted.stack
    });
  }
}
var adjustments;
var init_error_handling = __esm({
  "node_modules/svelte/src/internal/client/error-handling.js"() {
    init_esm_env();
    init_constants2();
    init_operations();
    init_constants();
    init_utils3();
    init_runtime();
    adjustments = /* @__PURE__ */ new WeakMap();
  }
});

// node_modules/svelte/src/internal/client/reactivity/batch.js
function flushSync(fn) {
  if (async_mode_flag && active_effect !== null) {
    flush_sync_in_effect();
  }
  var was_flushing_sync = is_flushing_sync;
  is_flushing_sync = true;
  try {
    var result;
    if (fn) {
      if (current_batch !== null) {
        flush_effects();
      }
      result = fn();
    }
    while (true) {
      flush_tasks();
      if (queued_root_effects.length === 0) {
        current_batch == null ? void 0 : current_batch.flush();
        if (queued_root_effects.length === 0) {
          last_scheduled_effect = null;
          return (
            /** @type {T} */
            result
          );
        }
      }
      flush_effects();
    }
  } finally {
    is_flushing_sync = was_flushing_sync;
  }
}
function flush_effects() {
  var _a6;
  var was_updating_effect = is_updating_effect;
  is_flushing = true;
  try {
    var flush_count = 0;
    set_is_updating_effect(true);
    while (queued_root_effects.length > 0) {
      var batch = Batch.ensure();
      if (flush_count++ > 1e3) {
        if (dev_fallback_default) {
          var updates = /* @__PURE__ */ new Map();
          for (const source2 of batch.current.keys()) {
            for (const [stack2, update2] of (_a6 = source2.updated) != null ? _a6 : []) {
              var entry = updates.get(stack2);
              if (!entry) {
                entry = { error: update2.error, count: 0 };
                updates.set(stack2, entry);
              }
              entry.count += update2.count;
            }
          }
          for (const update2 of updates.values()) {
            console.error(update2.error);
          }
        }
        infinite_loop_guard();
      }
      batch.process(queued_root_effects);
      old_values.clear();
    }
  } finally {
    is_flushing = false;
    set_is_updating_effect(was_updating_effect);
    last_scheduled_effect = null;
  }
}
function infinite_loop_guard() {
  try {
    effect_update_depth_exceeded();
  } catch (error2) {
    if (dev_fallback_default) {
      define_property(error2, "stack", { value: "" });
    }
    invoke_error_boundary(error2, last_scheduled_effect);
  }
}
function flush_queued_effects(effects) {
  var length = effects.length;
  if (length === 0) return;
  var i = 0;
  while (i < length) {
    var effect2 = effects[i++];
    if ((effect2.f & (DESTROYED | INERT)) === 0 && is_dirty(effect2)) {
      eager_block_effects = [];
      update_effect(effect2);
      if (effect2.deps === null && effect2.first === null && effect2.nodes_start === null) {
        if (effect2.teardown === null && effect2.ac === null) {
          unlink_effect(effect2);
        } else {
          effect2.fn = null;
        }
      }
      if ((eager_block_effects == null ? void 0 : eager_block_effects.length) > 0) {
        old_values.clear();
        for (const e2 of eager_block_effects) {
          update_effect(e2);
        }
        eager_block_effects = [];
      }
    }
  }
  eager_block_effects = null;
}
function mark_effects(value2, sources) {
  if (value2.reactions !== null) {
    for (const reaction of value2.reactions) {
      const flags2 = reaction.f;
      if ((flags2 & DERIVED) !== 0) {
        mark_effects(
          /** @type {Derived} */
          reaction,
          sources
        );
      } else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && depends_on(reaction, sources)) {
        set_signal_status(reaction, DIRTY);
        schedule_effect(
          /** @type {Effect} */
          reaction
        );
      }
    }
  }
}
function depends_on(reaction, sources) {
  if (reaction.deps !== null) {
    for (const dep of reaction.deps) {
      if (sources.includes(dep)) {
        return true;
      }
      if ((dep.f & DERIVED) !== 0 && depends_on(
        /** @type {Derived} */
        dep,
        sources
      )) {
        return true;
      }
    }
  }
  return false;
}
function schedule_effect(signal) {
  var effect2 = last_scheduled_effect = signal;
  while (effect2.parent !== null) {
    effect2 = effect2.parent;
    var flags2 = effect2.f;
    if (is_flushing && effect2 === active_effect && (flags2 & BLOCK_EFFECT) !== 0) {
      return;
    }
    if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
      if ((flags2 & CLEAN) === 0) return;
      effect2.f ^= CLEAN;
    }
  }
  queued_root_effects.push(effect2);
}
var batches, current_batch, previous_batch, batch_values, effect_pending_updates, queued_root_effects, last_scheduled_effect, is_flushing, is_flushing_sync, _previous, _callbacks, _pending, _deferred, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _Batch, Batch, eager_block_effects;
var init_batch = __esm({
  "node_modules/svelte/src/internal/client/reactivity/batch.js"() {
    init_constants();
    init_flags();
    init_utils3();
    init_runtime();
    init_errors2();
    init_task2();
    init_esm_env();
    init_error_handling();
    init_sources();
    init_effects();
    batches = /* @__PURE__ */ new Set();
    current_batch = null;
    previous_batch = null;
    batch_values = null;
    effect_pending_updates = /* @__PURE__ */ new Set();
    queued_root_effects = [];
    last_scheduled_effect = null;
    is_flushing = false;
    is_flushing_sync = false;
    _Batch = class _Batch {
      constructor() {
        __privateAdd(this, _Batch_instances);
        /**
         * The current values of any sources that are updated in this batch
         * They keys of this map are identical to `this.#previous`
         * @type {Map<Source, any>}
         */
        __publicField(this, "current", /* @__PURE__ */ new Map());
        /**
         * The values of any sources that are updated in this batch _before_ those updates took place.
         * They keys of this map are identical to `this.#current`
         * @type {Map<Source, any>}
         */
        __privateAdd(this, _previous, /* @__PURE__ */ new Map());
        /**
         * When the batch is committed (and the DOM is updated), we need to remove old branches
         * and append new ones by calling the functions added inside (if/each/key/etc) blocks
         * @type {Set<() => void>}
         */
        __privateAdd(this, _callbacks, /* @__PURE__ */ new Set());
        /**
         * The number of async effects that are currently in flight
         */
        __privateAdd(this, _pending, 0);
        /**
         * A deferred that resolves when the batch is committed, used with `settled()`
         * TODO replace with Promise.withResolvers once supported widely enough
         * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
         */
        __privateAdd(this, _deferred, null);
        /**
         * Template effects and `$effect.pre` effects, which run when
         * a batch is committed
         * @type {Effect[]}
         */
        __privateAdd(this, _render_effects, []);
        /**
         * The same as `#render_effects`, but for `$effect` (which runs after)
         * @type {Effect[]}
         */
        __privateAdd(this, _effects, []);
        /**
         * Block effects, which may need to re-run on subsequent flushes
         * in order to update internal sources (e.g. each block items)
         * @type {Effect[]}
         */
        __privateAdd(this, _block_effects, []);
        /**
         * Deferred effects (which run after async work has completed) that are DIRTY
         * @type {Effect[]}
         */
        __privateAdd(this, _dirty_effects, []);
        /**
         * Deferred effects that are MAYBE_DIRTY
         * @type {Effect[]}
         */
        __privateAdd(this, _maybe_dirty_effects, []);
        /**
         * A set of branches that still exist, but will be destroyed when this batch
         * is committed — we skip over these during `process`
         * @type {Set<Effect>}
         */
        __publicField(this, "skipped_effects", /* @__PURE__ */ new Set());
      }
      /**
       *
       * @param {Effect[]} root_effects
       */
      process(root_effects) {
        var _a6;
        queued_root_effects = [];
        previous_batch = null;
        this.apply();
        for (const root5 of root_effects) {
          __privateMethod(this, _Batch_instances, traverse_effect_tree_fn).call(this, root5);
        }
        if (__privateGet(this, _pending) === 0) {
          var previous_batch_sources = batch_values;
          __privateMethod(this, _Batch_instances, commit_fn).call(this);
          var render_effects = __privateGet(this, _render_effects);
          var effects = __privateGet(this, _effects);
          __privateSet(this, _render_effects, []);
          __privateSet(this, _effects, []);
          __privateSet(this, _block_effects, []);
          previous_batch = this;
          current_batch = null;
          batch_values = previous_batch_sources;
          flush_queued_effects(render_effects);
          flush_queued_effects(effects);
          previous_batch = null;
          (_a6 = __privateGet(this, _deferred)) == null ? void 0 : _a6.resolve();
        } else {
          __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, __privateGet(this, _render_effects));
          __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, __privateGet(this, _effects));
          __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, __privateGet(this, _block_effects));
        }
        batch_values = null;
      }
      /**
       * Associate a change to a given source with the current
       * batch, noting its previous and current values
       * @param {Source} source
       * @param {any} value
       */
      capture(source2, value2) {
        if (!__privateGet(this, _previous).has(source2)) {
          __privateGet(this, _previous).set(source2, value2);
        }
        this.current.set(source2, source2.v);
        batch_values == null ? void 0 : batch_values.set(source2, source2.v);
      }
      activate() {
        current_batch = this;
      }
      deactivate() {
        current_batch = null;
        batch_values = null;
      }
      flush() {
        if (queued_root_effects.length > 0) {
          this.activate();
          flush_effects();
          if (current_batch !== null && current_batch !== this) {
            return;
          }
        } else if (__privateGet(this, _pending) === 0) {
          __privateMethod(this, _Batch_instances, commit_fn).call(this);
        }
        this.deactivate();
        for (const update2 of effect_pending_updates) {
          effect_pending_updates.delete(update2);
          update2();
          if (current_batch !== null) {
            break;
          }
        }
      }
      increment() {
        __privateSet(this, _pending, __privateGet(this, _pending) + 1);
      }
      decrement() {
        __privateSet(this, _pending, __privateGet(this, _pending) - 1);
        for (const e2 of __privateGet(this, _dirty_effects)) {
          set_signal_status(e2, DIRTY);
          schedule_effect(e2);
        }
        for (const e2 of __privateGet(this, _maybe_dirty_effects)) {
          set_signal_status(e2, MAYBE_DIRTY);
          schedule_effect(e2);
        }
        this.flush();
      }
      /** @param {() => void} fn */
      add_callback(fn) {
        __privateGet(this, _callbacks).add(fn);
      }
      settled() {
        var _a6;
        return ((_a6 = __privateGet(this, _deferred)) != null ? _a6 : __privateSet(this, _deferred, deferred())).promise;
      }
      static ensure() {
        if (current_batch === null) {
          const batch = current_batch = new _Batch();
          batches.add(current_batch);
          if (!is_flushing_sync) {
            _Batch.enqueue(() => {
              if (current_batch !== batch) {
                return;
              }
              batch.flush();
            });
          }
        }
        return current_batch;
      }
      /** @param {() => void} task */
      static enqueue(task) {
        queue_micro_task(task);
      }
      apply() {
        if (!async_mode_flag || batches.size === 1) return;
        batch_values = new Map(this.current);
        for (const batch of batches) {
          if (batch === this) continue;
          for (const [source2, previous] of __privateGet(batch, _previous)) {
            if (!batch_values.has(source2)) {
              batch_values.set(source2, previous);
            }
          }
        }
      }
    };
    _previous = new WeakMap();
    _callbacks = new WeakMap();
    _pending = new WeakMap();
    _deferred = new WeakMap();
    _render_effects = new WeakMap();
    _effects = new WeakMap();
    _block_effects = new WeakMap();
    _dirty_effects = new WeakMap();
    _maybe_dirty_effects = new WeakMap();
    _Batch_instances = new WeakSet();
    /**
     * Traverse the effect tree, executing effects or stashing
     * them for later execution as appropriate
     * @param {Effect} root
     */
    traverse_effect_tree_fn = function(root5) {
      root5.f ^= CLEAN;
      var effect2 = root5.first;
      while (effect2 !== null) {
        var flags2 = effect2.f;
        var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
        var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
        var skip = is_skippable_branch || (flags2 & INERT) !== 0 || this.skipped_effects.has(effect2);
        if (!skip && effect2.fn !== null) {
          if (is_branch) {
            effect2.f ^= CLEAN;
          } else if ((flags2 & EFFECT) !== 0) {
            __privateGet(this, _effects).push(effect2);
          } else if (async_mode_flag && (flags2 & RENDER_EFFECT) !== 0) {
            __privateGet(this, _render_effects).push(effect2);
          } else if (is_dirty(effect2)) {
            if ((effect2.f & BLOCK_EFFECT) !== 0) __privateGet(this, _block_effects).push(effect2);
            update_effect(effect2);
          }
          var child2 = effect2.first;
          if (child2 !== null) {
            effect2 = child2;
            continue;
          }
        }
        var parent = effect2.parent;
        effect2 = effect2.next;
        while (effect2 === null && parent !== null) {
          effect2 = parent.next;
          parent = parent.parent;
        }
      }
    };
    /**
     * @param {Effect[]} effects
     */
    defer_effects_fn = function(effects) {
      for (const e2 of effects) {
        const target = (e2.f & DIRTY) !== 0 ? __privateGet(this, _dirty_effects) : __privateGet(this, _maybe_dirty_effects);
        target.push(e2);
        set_signal_status(e2, CLEAN);
      }
      effects.length = 0;
    };
    /**
     * Append and remove branches to/from the DOM
     */
    commit_fn = function() {
      var _a6;
      for (const fn of __privateGet(this, _callbacks)) {
        fn();
      }
      __privateGet(this, _callbacks).clear();
      if (batches.size > 1) {
        __privateGet(this, _previous).clear();
        let is_earlier = true;
        for (const batch of batches) {
          if (batch === this) {
            is_earlier = false;
            continue;
          }
          const sources = [];
          for (const [source2, value2] of this.current) {
            if (batch.current.has(source2)) {
              if (is_earlier && value2 !== batch.current.get(source2)) {
                batch.current.set(source2, value2);
              } else {
                continue;
              }
            }
            sources.push(source2);
          }
          if (sources.length === 0) {
            continue;
          }
          const others = [...batch.current.keys()].filter((s) => !this.current.has(s));
          if (others.length > 0) {
            for (const source2 of sources) {
              mark_effects(source2, others);
            }
            if (queued_root_effects.length > 0) {
              current_batch = batch;
              batch.apply();
              for (const root5 of queued_root_effects) {
                __privateMethod(_a6 = batch, _Batch_instances, traverse_effect_tree_fn).call(_a6, root5);
              }
              queued_root_effects = [];
              batch.deactivate();
            }
          }
        }
        current_batch = null;
      }
      batches.delete(this);
    };
    Batch = _Batch;
    eager_block_effects = null;
  }
});

// node_modules/svelte/src/reactivity/create-subscriber.js
function createSubscriber(start) {
  let subscribers = 0;
  let version2 = source(0);
  let stop;
  if (dev_fallback_default) {
    tag(version2, "createSubscriber version");
  }
  return () => {
    if (effect_tracking()) {
      get2(version2);
      render_effect(() => {
        if (subscribers === 0) {
          stop = untrack(() => start(() => increment(version2)));
        }
        subscribers += 1;
        return () => {
          queue_micro_task(() => {
            subscribers -= 1;
            if (subscribers === 0) {
              stop == null ? void 0 : stop();
              stop = void 0;
              increment(version2);
            }
          });
        };
      });
    }
  };
}
var init_create_subscriber = __esm({
  "node_modules/svelte/src/reactivity/create-subscriber.js"() {
    init_runtime();
    init_effects();
    init_sources();
    init_tracing();
    init_esm_env();
    init_task2();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/boundary.js
function boundary(node, props, children) {
  new Boundary(node, props, children);
}
var flags, _pending2, _anchor, _hydrate_open, _props, _children, _effect, _main_effect, _pending_effect, _failed_effect, _offscreen_fragment, _local_pending_count, _pending_count, _is_creating_fallback, _effect_pending, _effect_pending_update, _effect_pending_subscriber, _Boundary_instances, hydrate_resolved_content_fn, hydrate_pending_content_fn, run_fn, show_pending_snippet_fn, update_pending_count_fn, Boundary;
var init_boundary = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/boundary.js"() {
    init_constants();
    init_constants2();
    init_context();
    init_error_handling();
    init_effects();
    init_runtime();
    init_hydration();
    init_operations();
    init_task2();
    init_errors2();
    init_warnings2();
    init_esm_env();
    init_batch();
    init_sources();
    init_tracing();
    init_create_subscriber();
    flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED | BOUNDARY_EFFECT;
    Boundary = class {
      /**
       * @param {TemplateNode} node
       * @param {BoundaryProps} props
       * @param {((anchor: Node) => void)} children
       */
      constructor(node, props, children) {
        __privateAdd(this, _Boundary_instances);
        /** @type {Boundary | null} */
        __publicField(this, "parent");
        __privateAdd(this, _pending2, false);
        /** @type {TemplateNode} */
        __privateAdd(this, _anchor);
        /** @type {TemplateNode | null} */
        __privateAdd(this, _hydrate_open, hydrating ? hydrate_node : null);
        /** @type {BoundaryProps} */
        __privateAdd(this, _props);
        /** @type {((anchor: Node) => void)} */
        __privateAdd(this, _children);
        /** @type {Effect} */
        __privateAdd(this, _effect);
        /** @type {Effect | null} */
        __privateAdd(this, _main_effect, null);
        /** @type {Effect | null} */
        __privateAdd(this, _pending_effect, null);
        /** @type {Effect | null} */
        __privateAdd(this, _failed_effect, null);
        /** @type {DocumentFragment | null} */
        __privateAdd(this, _offscreen_fragment, null);
        __privateAdd(this, _local_pending_count, 0);
        __privateAdd(this, _pending_count, 0);
        __privateAdd(this, _is_creating_fallback, false);
        /**
         * A source containing the number of pending async deriveds/expressions.
         * Only created if `$effect.pending()` is used inside the boundary,
         * otherwise updating the source results in needless `Batch.ensure()`
         * calls followed by no-op flushes
         * @type {Source<number> | null}
         */
        __privateAdd(this, _effect_pending, null);
        __privateAdd(this, _effect_pending_update, () => {
          if (__privateGet(this, _effect_pending)) {
            internal_set(__privateGet(this, _effect_pending), __privateGet(this, _local_pending_count));
          }
        });
        __privateAdd(this, _effect_pending_subscriber, createSubscriber(() => {
          __privateSet(this, _effect_pending, source(__privateGet(this, _local_pending_count)));
          if (dev_fallback_default) {
            tag(__privateGet(this, _effect_pending), "$effect.pending()");
          }
          return () => {
            __privateSet(this, _effect_pending, null);
          };
        }));
        __privateSet(this, _anchor, node);
        __privateSet(this, _props, props);
        __privateSet(this, _children, children);
        this.parent = /** @type {Effect} */
        active_effect.b;
        __privateSet(this, _pending2, !!__privateGet(this, _props).pending);
        __privateSet(this, _effect, block(() => {
          active_effect.b = this;
          if (hydrating) {
            const comment2 = __privateGet(this, _hydrate_open);
            hydrate_next();
            const server_rendered_pending = (
              /** @type {Comment} */
              comment2.nodeType === COMMENT_NODE && /** @type {Comment} */
              comment2.data === HYDRATION_START_ELSE
            );
            if (server_rendered_pending) {
              __privateMethod(this, _Boundary_instances, hydrate_pending_content_fn).call(this);
            } else {
              __privateMethod(this, _Boundary_instances, hydrate_resolved_content_fn).call(this);
            }
          } else {
            try {
              __privateSet(this, _main_effect, branch(() => children(__privateGet(this, _anchor))));
            } catch (error2) {
              this.error(error2);
            }
            if (__privateGet(this, _pending_count) > 0) {
              __privateMethod(this, _Boundary_instances, show_pending_snippet_fn).call(this);
            } else {
              __privateSet(this, _pending2, false);
            }
          }
        }, flags));
        if (hydrating) {
          __privateSet(this, _anchor, hydrate_node);
        }
      }
      /**
       * Returns `true` if the effect exists inside a boundary whose pending snippet is shown
       * @returns {boolean}
       */
      is_pending() {
        return __privateGet(this, _pending2) || !!this.parent && this.parent.is_pending();
      }
      has_pending_snippet() {
        return !!__privateGet(this, _props).pending;
      }
      /**
       * Update the source that powers `$effect.pending()` inside this boundary,
       * and controls when the current `pending` snippet (if any) is removed.
       * Do not call from inside the class
       * @param {1 | -1} d
       */
      update_pending_count(d) {
        __privateMethod(this, _Boundary_instances, update_pending_count_fn).call(this, d);
        __privateSet(this, _local_pending_count, __privateGet(this, _local_pending_count) + d);
        effect_pending_updates.add(__privateGet(this, _effect_pending_update));
      }
      get_effect_pending() {
        __privateGet(this, _effect_pending_subscriber).call(this);
        return get2(
          /** @type {Source<number>} */
          __privateGet(this, _effect_pending)
        );
      }
      /** @param {unknown} error */
      error(error2) {
        var onerror = __privateGet(this, _props).onerror;
        let failed2 = __privateGet(this, _props).failed;
        if (__privateGet(this, _is_creating_fallback) || !onerror && !failed2) {
          throw error2;
        }
        if (__privateGet(this, _main_effect)) {
          destroy_effect(__privateGet(this, _main_effect));
          __privateSet(this, _main_effect, null);
        }
        if (__privateGet(this, _pending_effect)) {
          destroy_effect(__privateGet(this, _pending_effect));
          __privateSet(this, _pending_effect, null);
        }
        if (__privateGet(this, _failed_effect)) {
          destroy_effect(__privateGet(this, _failed_effect));
          __privateSet(this, _failed_effect, null);
        }
        if (hydrating) {
          set_hydrate_node(
            /** @type {TemplateNode} */
            __privateGet(this, _hydrate_open)
          );
          next();
          set_hydrate_node(skip_nodes());
        }
        var did_reset = false;
        var calling_on_error = false;
        const reset2 = () => {
          if (did_reset) {
            svelte_boundary_reset_noop();
            return;
          }
          did_reset = true;
          if (calling_on_error) {
            svelte_boundary_reset_onerror();
          }
          Batch.ensure();
          __privateSet(this, _local_pending_count, 0);
          if (__privateGet(this, _failed_effect) !== null) {
            pause_effect(__privateGet(this, _failed_effect), () => {
              __privateSet(this, _failed_effect, null);
            });
          }
          __privateSet(this, _pending2, this.has_pending_snippet());
          __privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
            __privateSet(this, _is_creating_fallback, false);
            return branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor)));
          }));
          if (__privateGet(this, _pending_count) > 0) {
            __privateMethod(this, _Boundary_instances, show_pending_snippet_fn).call(this);
          } else {
            __privateSet(this, _pending2, false);
          }
        };
        var previous_reaction = active_reaction;
        try {
          set_active_reaction(null);
          calling_on_error = true;
          onerror == null ? void 0 : onerror(error2, reset2);
          calling_on_error = false;
        } catch (error3) {
          invoke_error_boundary(error3, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
        } finally {
          set_active_reaction(previous_reaction);
        }
        if (failed2) {
          queue_micro_task(() => {
            __privateSet(this, _failed_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
              __privateSet(this, _is_creating_fallback, true);
              try {
                return branch(() => {
                  failed2(
                    __privateGet(this, _anchor),
                    () => error2,
                    () => reset2
                  );
                });
              } catch (error3) {
                invoke_error_boundary(
                  error3,
                  /** @type {Effect} */
                  __privateGet(this, _effect).parent
                );
                return null;
              } finally {
                __privateSet(this, _is_creating_fallback, false);
              }
            }));
          });
        }
      }
    };
    _pending2 = new WeakMap();
    _anchor = new WeakMap();
    _hydrate_open = new WeakMap();
    _props = new WeakMap();
    _children = new WeakMap();
    _effect = new WeakMap();
    _main_effect = new WeakMap();
    _pending_effect = new WeakMap();
    _failed_effect = new WeakMap();
    _offscreen_fragment = new WeakMap();
    _local_pending_count = new WeakMap();
    _pending_count = new WeakMap();
    _is_creating_fallback = new WeakMap();
    _effect_pending = new WeakMap();
    _effect_pending_update = new WeakMap();
    _effect_pending_subscriber = new WeakMap();
    _Boundary_instances = new WeakSet();
    hydrate_resolved_content_fn = function() {
      try {
        __privateSet(this, _main_effect, branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor))));
      } catch (error2) {
        this.error(error2);
      }
      __privateSet(this, _pending2, false);
    };
    hydrate_pending_content_fn = function() {
      const pending2 = __privateGet(this, _props).pending;
      if (!pending2) {
        return;
      }
      __privateSet(this, _pending_effect, branch(() => pending2(__privateGet(this, _anchor))));
      Batch.enqueue(() => {
        __privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
          Batch.ensure();
          return branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor)));
        }));
        if (__privateGet(this, _pending_count) > 0) {
          __privateMethod(this, _Boundary_instances, show_pending_snippet_fn).call(this);
        } else {
          pause_effect(
            /** @type {Effect} */
            __privateGet(this, _pending_effect),
            () => {
              __privateSet(this, _pending_effect, null);
            }
          );
          __privateSet(this, _pending2, false);
        }
      });
    };
    /**
     * @param {() => Effect | null} fn
     */
    run_fn = function(fn) {
      var previous_effect = active_effect;
      var previous_reaction = active_reaction;
      var previous_ctx = component_context;
      set_active_effect(__privateGet(this, _effect));
      set_active_reaction(__privateGet(this, _effect));
      set_component_context(__privateGet(this, _effect).ctx);
      try {
        return fn();
      } catch (e2) {
        handle_error(e2);
        return null;
      } finally {
        set_active_effect(previous_effect);
        set_active_reaction(previous_reaction);
        set_component_context(previous_ctx);
      }
    };
    show_pending_snippet_fn = function() {
      const pending2 = (
        /** @type {(anchor: Node) => void} */
        __privateGet(this, _props).pending
      );
      if (__privateGet(this, _main_effect) !== null) {
        __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
        move_effect(__privateGet(this, _main_effect), __privateGet(this, _offscreen_fragment));
      }
      if (__privateGet(this, _pending_effect) === null) {
        __privateSet(this, _pending_effect, branch(() => pending2(__privateGet(this, _anchor))));
      }
    };
    /**
     * Updates the pending count associated with the currently visible pending snippet,
     * if any, such that we can replace the snippet with content once work is done
     * @param {1 | -1} d
     */
    update_pending_count_fn = function(d) {
      var _a6;
      if (!this.has_pending_snippet()) {
        if (this.parent) {
          __privateMethod(_a6 = this.parent, _Boundary_instances, update_pending_count_fn).call(_a6, d);
        }
        return;
      }
      __privateSet(this, _pending_count, __privateGet(this, _pending_count) + d);
      if (__privateGet(this, _pending_count) === 0) {
        __privateSet(this, _pending2, false);
        if (__privateGet(this, _pending_effect)) {
          pause_effect(__privateGet(this, _pending_effect), () => {
            __privateSet(this, _pending_effect, null);
          });
        }
        if (__privateGet(this, _offscreen_fragment)) {
          __privateGet(this, _anchor).before(__privateGet(this, _offscreen_fragment));
          __privateSet(this, _offscreen_fragment, null);
        }
        queue_micro_task(() => {
          Batch.ensure().flush();
        });
      }
    };
  }
});

// node_modules/svelte/src/internal/client/reactivity/async.js
function flatten2(sync2, async2, fn) {
  const d = is_runes() ? derived : derived_safe_equal;
  if (async2.length === 0) {
    fn(sync2.map(d));
    return;
  }
  var batch = current_batch;
  var parent = (
    /** @type {Effect} */
    active_effect
  );
  var restore = capture();
  var was_hydrating = hydrating;
  Promise.all(async2.map((expression) => async_derived(expression))).then((result) => {
    restore();
    try {
      fn([...sync2.map(d), ...result]);
    } catch (error2) {
      if ((parent.f & DESTROYED) === 0) {
        invoke_error_boundary(error2, parent);
      }
    }
    if (was_hydrating) {
      set_hydrating(false);
    }
    batch == null ? void 0 : batch.deactivate();
    unset_context();
  }).catch((error2) => {
    invoke_error_boundary(error2, parent);
  });
}
function capture() {
  var previous_effect = active_effect;
  var previous_reaction = active_reaction;
  var previous_component_context = component_context;
  var previous_batch2 = current_batch;
  var was_hydrating = hydrating;
  if (was_hydrating) {
    var previous_hydrate_node = hydrate_node;
  }
  if (dev_fallback_default) {
    var previous_dev_stack = dev_stack;
  }
  return function restore() {
    set_active_effect(previous_effect);
    set_active_reaction(previous_reaction);
    set_component_context(previous_component_context);
    previous_batch2 == null ? void 0 : previous_batch2.activate();
    if (was_hydrating) {
      set_hydrating(true);
      set_hydrate_node(previous_hydrate_node);
    }
    if (dev_fallback_default) {
      set_from_async_derived(null);
      set_dev_stack(previous_dev_stack);
    }
  };
}
function unset_context() {
  set_active_effect(null);
  set_active_reaction(null);
  set_component_context(null);
  if (dev_fallback_default) {
    set_from_async_derived(null);
    set_dev_stack(null);
  }
}
var init_async = __esm({
  "node_modules/svelte/src/internal/client/reactivity/async.js"() {
    init_constants();
    init_esm_env();
    init_context();
    init_boundary();
    init_error_handling();
    init_runtime();
    init_batch();
    init_deriveds();
    init_effects();
    init_hydration();
    init_operations();
  }
});

// node_modules/svelte/src/internal/client/reactivity/deriveds.js
function set_from_async_derived(v) {
  current_async_effect = v;
}
// @__NO_SIDE_EFFECTS__
function derived(fn) {
  var flags2 = DERIVED | DIRTY;
  var parent_derived = active_reaction !== null && (active_reaction.f & DERIVED) !== 0 ? (
    /** @type {Derived} */
    active_reaction
  ) : null;
  if (active_effect === null || parent_derived !== null && (parent_derived.f & UNOWNED) !== 0) {
    flags2 |= UNOWNED;
  } else {
    active_effect.f |= EFFECT_PRESERVED;
  }
  const signal = {
    ctx: component_context,
    deps: null,
    effects: null,
    equals,
    f: flags2,
    fn,
    reactions: null,
    rv: 0,
    v: (
      /** @type {V} */
      UNINITIALIZED
    ),
    wv: 0,
    parent: parent_derived != null ? parent_derived : active_effect,
    ac: null
  };
  if (dev_fallback_default && tracing_mode_flag) {
    signal.created = get_stack("CreatedAt");
  }
  return signal;
}
// @__NO_SIDE_EFFECTS__
function async_derived(fn, location) {
  let parent = (
    /** @type {Effect | null} */
    active_effect
  );
  if (parent === null) {
    async_derived_orphan();
  }
  var boundary2 = (
    /** @type {Boundary} */
    parent.b
  );
  var promise = (
    /** @type {Promise<V>} */
    /** @type {unknown} */
    void 0
  );
  var signal = source(
    /** @type {V} */
    UNINITIALIZED
  );
  var should_suspend = !active_reaction;
  var deferreds = /* @__PURE__ */ new Map();
  async_effect(() => {
    var _a6;
    if (dev_fallback_default) current_async_effect = active_effect;
    var d = deferred();
    promise = d.promise;
    try {
      Promise.resolve(fn()).then(d.resolve, d.reject).then(unset_context);
    } catch (error2) {
      d.reject(error2);
      unset_context();
    }
    if (dev_fallback_default) current_async_effect = null;
    var batch = (
      /** @type {Batch} */
      current_batch
    );
    var pending2 = boundary2.is_pending();
    if (should_suspend) {
      boundary2.update_pending_count(1);
      if (!pending2) {
        batch.increment();
        (_a6 = deferreds.get(batch)) == null ? void 0 : _a6.reject(STALE_REACTION);
        deferreds.delete(batch);
        deferreds.set(batch, d);
      }
    }
    const handler = (value2, error2 = void 0) => {
      current_async_effect = null;
      if (!pending2) batch.activate();
      if (error2) {
        if (error2 !== STALE_REACTION) {
          signal.f |= ERROR_VALUE;
          internal_set(signal, error2);
        }
      } else {
        if ((signal.f & ERROR_VALUE) !== 0) {
          signal.f ^= ERROR_VALUE;
        }
        internal_set(signal, value2);
        for (const [b, d2] of deferreds) {
          deferreds.delete(b);
          if (b === batch) break;
          d2.reject(STALE_REACTION);
        }
        if (dev_fallback_default && location !== void 0) {
          recent_async_deriveds.add(signal);
          setTimeout(() => {
            if (recent_async_deriveds.has(signal)) {
              await_waterfall(
                /** @type {string} */
                signal.label,
                location
              );
              recent_async_deriveds.delete(signal);
            }
          });
        }
      }
      if (should_suspend) {
        boundary2.update_pending_count(-1);
        if (!pending2) batch.decrement();
      }
    };
    d.promise.then(handler, (e2) => handler(null, e2 || "unknown"));
  });
  teardown(() => {
    for (const d of deferreds.values()) {
      d.reject(STALE_REACTION);
    }
  });
  if (dev_fallback_default) {
    signal.f |= ASYNC;
  }
  return new Promise((fulfil) => {
    function next2(p) {
      function go() {
        if (p === promise) {
          fulfil(signal);
        } else {
          next2(promise);
        }
      }
      p.then(go, go);
    }
    next2(promise);
  });
}
// @__NO_SIDE_EFFECTS__
function derived_safe_equal(fn) {
  const signal = /* @__PURE__ */ derived(fn);
  signal.equals = safe_equals;
  return signal;
}
function destroy_derived_effects(derived3) {
  var effects = derived3.effects;
  if (effects !== null) {
    derived3.effects = null;
    for (var i = 0; i < effects.length; i += 1) {
      destroy_effect(
        /** @type {Effect} */
        effects[i]
      );
    }
  }
}
function get_derived_parent_effect(derived3) {
  var parent = derived3.parent;
  while (parent !== null) {
    if ((parent.f & DERIVED) === 0) {
      return (
        /** @type {Effect} */
        parent
      );
    }
    parent = parent.parent;
  }
  return null;
}
function execute_derived(derived3) {
  var value2;
  var prev_active_effect = active_effect;
  set_active_effect(get_derived_parent_effect(derived3));
  if (dev_fallback_default) {
    let prev_inspect_effects = inspect_effects;
    set_inspect_effects(/* @__PURE__ */ new Set());
    try {
      if (stack.includes(derived3)) {
        derived_references_self();
      }
      stack.push(derived3);
      destroy_derived_effects(derived3);
      value2 = update_reaction(derived3);
    } finally {
      set_active_effect(prev_active_effect);
      set_inspect_effects(prev_inspect_effects);
      stack.pop();
    }
  } else {
    try {
      destroy_derived_effects(derived3);
      value2 = update_reaction(derived3);
    } finally {
      set_active_effect(prev_active_effect);
    }
  }
  return value2;
}
function update_derived(derived3) {
  var value2 = execute_derived(derived3);
  if (!derived3.equals(value2)) {
    derived3.v = value2;
    derived3.wv = increment_write_version();
  }
  if (is_destroying_effect) {
    return;
  }
  if (batch_values !== null) {
    batch_values.set(derived3, derived3.v);
  } else {
    var status = (skip_reaction || (derived3.f & UNOWNED) !== 0) && derived3.deps !== null ? MAYBE_DIRTY : CLEAN;
    set_signal_status(derived3, status);
  }
}
var current_async_effect, recent_async_deriveds, stack;
var init_deriveds = __esm({
  "node_modules/svelte/src/internal/client/reactivity/deriveds.js"() {
    init_esm_env();
    init_constants();
    init_runtime();
    init_equality();
    init_errors2();
    init_warnings2();
    init_effects();
    init_sources();
    init_tracing();
    init_flags();
    init_boundary();
    init_context();
    init_constants2();
    init_batch();
    init_async();
    init_utils3();
    current_async_effect = null;
    recent_async_deriveds = /* @__PURE__ */ new Set();
    stack = [];
  }
});

// node_modules/svelte/src/internal/client/reactivity/sources.js
function set_inspect_effects(v) {
  inspect_effects = v;
}
function set_inspect_effects_deferred() {
  inspect_effects_deferred = true;
}
function source(v, stack2) {
  var signal = {
    f: 0,
    // TODO ideally we could skip this altogether, but it causes type errors
    v,
    reactions: null,
    equals,
    rv: 0,
    wv: 0
  };
  if (dev_fallback_default && tracing_mode_flag) {
    signal.created = stack2 != null ? stack2 : get_stack("CreatedAt");
    signal.updated = null;
    signal.set_during_effect = false;
    signal.trace = null;
  }
  return signal;
}
// @__NO_SIDE_EFFECTS__
function state(v, stack2) {
  const s = source(v, stack2);
  push_reaction_value(s);
  return s;
}
// @__NO_SIDE_EFFECTS__
function mutable_source(initial_value, immutable = false, trackable = true) {
  var _a6, _b4;
  const s = source(initial_value);
  if (!immutable) {
    s.equals = safe_equals;
  }
  if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
    ((_b4 = (_a6 = component_context.l).s) != null ? _b4 : _a6.s = []).push(s);
  }
  return s;
}
function set(source2, value2, should_proxy = false) {
  var _a6;
  if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
  // to ensure we error if state is set inside an inspect effect
  (!untracking || (active_reaction.f & INSPECT_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | INSPECT_EFFECT)) !== 0 && !((_a6 = current_sources) == null ? void 0 : _a6.includes(source2))) {
    state_unsafe_mutation();
  }
  let new_value = should_proxy ? proxy(value2) : value2;
  if (dev_fallback_default) {
    tag_proxy(
      new_value,
      /** @type {string} */
      source2.label
    );
  }
  return internal_set(source2, new_value);
}
function internal_set(source2, value2) {
  var _a6;
  if (!source2.equals(value2)) {
    var old_value = source2.v;
    if (is_destroying_effect) {
      old_values.set(source2, value2);
    } else {
      old_values.set(source2, old_value);
    }
    source2.v = value2;
    var batch = Batch.ensure();
    batch.capture(source2, old_value);
    if (dev_fallback_default) {
      if (tracing_mode_flag || active_effect !== null) {
        const error2 = get_stack("UpdatedAt");
        if (error2 !== null) {
          (_a6 = source2.updated) != null ? _a6 : source2.updated = /* @__PURE__ */ new Map();
          let entry = source2.updated.get(error2.stack);
          if (!entry) {
            entry = { error: error2, count: 0 };
            source2.updated.set(error2.stack, entry);
          }
          entry.count++;
        }
      }
      if (active_effect !== null) {
        source2.set_during_effect = true;
      }
    }
    if ((source2.f & DERIVED) !== 0) {
      if ((source2.f & DIRTY) !== 0) {
        execute_derived(
          /** @type {Derived} */
          source2
        );
      }
      set_signal_status(source2, (source2.f & UNOWNED) === 0 ? CLEAN : MAYBE_DIRTY);
    }
    source2.wv = increment_write_version();
    mark_reactions(source2, DIRTY);
    if (is_runes() && active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
      if (untracked_writes === null) {
        set_untracked_writes([source2]);
      } else {
        untracked_writes.push(source2);
      }
    }
    if (dev_fallback_default && inspect_effects.size > 0 && !inspect_effects_deferred) {
      flush_inspect_effects();
    }
  }
  return value2;
}
function flush_inspect_effects() {
  inspect_effects_deferred = false;
  const inspects = Array.from(inspect_effects);
  for (const effect2 of inspects) {
    if ((effect2.f & CLEAN) !== 0) {
      set_signal_status(effect2, MAYBE_DIRTY);
    }
    if (is_dirty(effect2)) {
      update_effect(effect2);
    }
  }
  inspect_effects.clear();
}
function increment(source2) {
  set(source2, source2.v + 1);
}
function mark_reactions(signal, status) {
  var reactions = signal.reactions;
  if (reactions === null) return;
  var runes = is_runes();
  var length = reactions.length;
  for (var i = 0; i < length; i++) {
    var reaction = reactions[i];
    var flags2 = reaction.f;
    if (!runes && reaction === active_effect) continue;
    if (dev_fallback_default && (flags2 & INSPECT_EFFECT) !== 0) {
      inspect_effects.add(reaction);
      continue;
    }
    var not_dirty = (flags2 & DIRTY) === 0;
    if (not_dirty) {
      set_signal_status(reaction, status);
    }
    if ((flags2 & DERIVED) !== 0) {
      mark_reactions(
        /** @type {Derived} */
        reaction,
        MAYBE_DIRTY
      );
    } else if (not_dirty) {
      if ((flags2 & BLOCK_EFFECT) !== 0) {
        if (eager_block_effects !== null) {
          eager_block_effects.push(
            /** @type {Effect} */
            reaction
          );
        }
      }
      schedule_effect(
        /** @type {Effect} */
        reaction
      );
    }
  }
}
var inspect_effects, old_values, inspect_effects_deferred;
var init_sources = __esm({
  "node_modules/svelte/src/internal/client/reactivity/sources.js"() {
    init_esm_env();
    init_runtime();
    init_equality();
    init_constants();
    init_errors2();
    init_flags();
    init_tracing();
    init_context();
    init_batch();
    init_proxy();
    init_deriveds();
    inspect_effects = /* @__PURE__ */ new Set();
    old_values = /* @__PURE__ */ new Map();
    inspect_effects_deferred = false;
  }
});

// node_modules/svelte/src/internal/client/legacy.js
function capture_signals(fn) {
  var previous_captured_signals = captured_signals;
  try {
    captured_signals = /* @__PURE__ */ new Set();
    untrack(fn);
    if (previous_captured_signals !== null) {
      for (var signal of captured_signals) {
        previous_captured_signals.add(signal);
      }
    }
    return captured_signals;
  } finally {
    captured_signals = previous_captured_signals;
  }
}
function invalidate_inner_signals(fn) {
  for (var signal of capture_signals(fn)) {
    internal_set(signal, signal.v);
  }
}
var captured_signals;
var init_legacy = __esm({
  "node_modules/svelte/src/internal/client/legacy.js"() {
    init_sources();
    init_runtime();
    captured_signals = null;
  }
});

// node_modules/svelte/src/internal/client/dom/elements/misc.js
function add_form_reset_listener() {
  if (!listening_to_form_reset) {
    listening_to_form_reset = true;
    document.addEventListener(
      "reset",
      (evt) => {
        Promise.resolve().then(() => {
          var _a6;
          if (!evt.defaultPrevented) {
            for (
              const e2 of
              /**@type {HTMLFormElement} */
              evt.target.elements
            ) {
              (_a6 = e2.__on_r) == null ? void 0 : _a6.call(e2);
            }
          }
        });
      },
      // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
      { capture: true }
    );
  }
}
var listening_to_form_reset;
var init_misc = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/misc.js"() {
    init_hydration();
    init_operations();
    init_task2();
    listening_to_form_reset = false;
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
function without_reactive_context(fn) {
  var previous_reaction = active_reaction;
  var previous_effect = active_effect;
  set_active_reaction(null);
  set_active_effect(null);
  try {
    return fn();
  } finally {
    set_active_reaction(previous_reaction);
    set_active_effect(previous_effect);
  }
}
function listen_to_event_and_reset_event(element2, event2, handler, on_reset = handler) {
  element2.addEventListener(event2, () => without_reactive_context(handler));
  const prev = element2.__on_r;
  if (prev) {
    element2.__on_r = () => {
      prev();
      on_reset(true);
    };
  } else {
    element2.__on_r = () => on_reset(true);
  }
  add_form_reset_listener();
}
var init_shared = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js"() {
    init_effects();
    init_runtime();
    init_misc();
  }
});

// node_modules/svelte/src/internal/client/runtime.js
function set_is_updating_effect(value2) {
  is_updating_effect = value2;
}
function set_is_destroying_effect(value2) {
  is_destroying_effect = value2;
}
function set_active_reaction(reaction) {
  active_reaction = reaction;
}
function set_active_effect(effect2) {
  active_effect = effect2;
}
function push_reaction_value(value2) {
  if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {
    if (current_sources === null) {
      current_sources = [value2];
    } else {
      current_sources.push(value2);
    }
  }
}
function set_untracked_writes(value2) {
  untracked_writes = value2;
}
function set_update_version(value2) {
  update_version = value2;
}
function increment_write_version() {
  return ++write_version;
}
function is_dirty(reaction) {
  var _a6, _b4;
  var flags2 = reaction.f;
  if ((flags2 & DIRTY) !== 0) {
    return true;
  }
  if ((flags2 & MAYBE_DIRTY) !== 0) {
    var dependencies = reaction.deps;
    var is_unowned = (flags2 & UNOWNED) !== 0;
    if (dependencies !== null) {
      var i;
      var dependency;
      var is_disconnected = (flags2 & DISCONNECTED) !== 0;
      var is_unowned_connected = is_unowned && active_effect !== null && !skip_reaction;
      var length = dependencies.length;
      if ((is_disconnected || is_unowned_connected) && (active_effect === null || (active_effect.f & DESTROYED) === 0)) {
        var derived3 = (
          /** @type {Derived} */
          reaction
        );
        var parent = derived3.parent;
        for (i = 0; i < length; i++) {
          dependency = dependencies[i];
          if (is_disconnected || !((_a6 = dependency == null ? void 0 : dependency.reactions) == null ? void 0 : _a6.includes(derived3))) {
            ((_b4 = dependency.reactions) != null ? _b4 : dependency.reactions = []).push(derived3);
          }
        }
        if (is_disconnected) {
          derived3.f ^= DISCONNECTED;
        }
        if (is_unowned_connected && parent !== null && (parent.f & UNOWNED) === 0) {
          derived3.f ^= UNOWNED;
        }
      }
      for (i = 0; i < length; i++) {
        dependency = dependencies[i];
        if (is_dirty(
          /** @type {Derived} */
          dependency
        )) {
          update_derived(
            /** @type {Derived} */
            dependency
          );
        }
        if (dependency.wv > reaction.wv) {
          return true;
        }
      }
    }
    if (!is_unowned || active_effect !== null && !skip_reaction) {
      set_signal_status(reaction, CLEAN);
    }
  }
  return false;
}
function schedule_possible_effect_self_invalidation(signal, effect2, root5 = true) {
  var reactions = signal.reactions;
  if (reactions === null) return;
  if (!async_mode_flag && (current_sources == null ? void 0 : current_sources.includes(signal))) {
    return;
  }
  for (var i = 0; i < reactions.length; i++) {
    var reaction = reactions[i];
    if ((reaction.f & DERIVED) !== 0) {
      schedule_possible_effect_self_invalidation(
        /** @type {Derived} */
        reaction,
        effect2,
        false
      );
    } else if (effect2 === reaction) {
      if (root5) {
        set_signal_status(reaction, DIRTY);
      } else if ((reaction.f & CLEAN) !== 0) {
        set_signal_status(reaction, MAYBE_DIRTY);
      }
      schedule_effect(
        /** @type {Effect} */
        reaction
      );
    }
  }
}
function update_reaction(reaction) {
  var _a6, _b4;
  var previous_deps = new_deps;
  var previous_skipped_deps = skipped_deps;
  var previous_untracked_writes = untracked_writes;
  var previous_reaction = active_reaction;
  var previous_skip_reaction = skip_reaction;
  var previous_sources = current_sources;
  var previous_component_context = component_context;
  var previous_untracking = untracking;
  var previous_update_version = update_version;
  var flags2 = reaction.f;
  new_deps = /** @type {null | Value[]} */
  null;
  skipped_deps = 0;
  untracked_writes = null;
  skip_reaction = (flags2 & UNOWNED) !== 0 && (untracking || !is_updating_effect || active_reaction === null);
  active_reaction = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
  current_sources = null;
  set_component_context(reaction.ctx);
  untracking = false;
  update_version = ++read_version;
  if (reaction.ac !== null) {
    without_reactive_context(() => {
      reaction.ac.abort(STALE_REACTION);
    });
    reaction.ac = null;
  }
  try {
    reaction.f |= REACTION_IS_UPDATING;
    var fn = (
      /** @type {Function} */
      reaction.fn
    );
    var result = fn();
    var deps = reaction.deps;
    if (new_deps !== null) {
      var i;
      remove_reactions(reaction, skipped_deps);
      if (deps !== null && skipped_deps > 0) {
        deps.length = skipped_deps + new_deps.length;
        for (i = 0; i < new_deps.length; i++) {
          deps[skipped_deps + i] = new_deps[i];
        }
      } else {
        reaction.deps = deps = new_deps;
      }
      if (!skip_reaction || // Deriveds that already have reactions can cleanup, so we still add them as reactions
      (flags2 & DERIVED) !== 0 && /** @type {import('#client').Derived} */
      reaction.reactions !== null) {
        for (i = skipped_deps; i < deps.length; i++) {
          ((_b4 = (_a6 = deps[i]).reactions) != null ? _b4 : _a6.reactions = []).push(reaction);
        }
      }
    } else if (deps !== null && skipped_deps < deps.length) {
      remove_reactions(reaction, skipped_deps);
      deps.length = skipped_deps;
    }
    if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
      for (i = 0; i < /** @type {Source[]} */
      untracked_writes.length; i++) {
        schedule_possible_effect_self_invalidation(
          untracked_writes[i],
          /** @type {Effect} */
          reaction
        );
      }
    }
    if (previous_reaction !== null && previous_reaction !== reaction) {
      read_version++;
      if (untracked_writes !== null) {
        if (previous_untracked_writes === null) {
          previous_untracked_writes = untracked_writes;
        } else {
          previous_untracked_writes.push(.../** @type {Source[]} */
          untracked_writes);
        }
      }
    }
    if ((reaction.f & ERROR_VALUE) !== 0) {
      reaction.f ^= ERROR_VALUE;
    }
    return result;
  } catch (error2) {
    return handle_error(error2);
  } finally {
    reaction.f ^= REACTION_IS_UPDATING;
    new_deps = previous_deps;
    skipped_deps = previous_skipped_deps;
    untracked_writes = previous_untracked_writes;
    active_reaction = previous_reaction;
    skip_reaction = previous_skip_reaction;
    current_sources = previous_sources;
    set_component_context(previous_component_context);
    untracking = previous_untracking;
    update_version = previous_update_version;
  }
}
function remove_reaction(signal, dependency) {
  let reactions = dependency.reactions;
  if (reactions !== null) {
    var index6 = index_of.call(reactions, signal);
    if (index6 !== -1) {
      var new_length = reactions.length - 1;
      if (new_length === 0) {
        reactions = dependency.reactions = null;
      } else {
        reactions[index6] = reactions[new_length];
        reactions.pop();
      }
    }
  }
  if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
  (new_deps === null || !new_deps.includes(dependency))) {
    set_signal_status(dependency, MAYBE_DIRTY);
    if ((dependency.f & (UNOWNED | DISCONNECTED)) === 0) {
      dependency.f ^= DISCONNECTED;
    }
    destroy_derived_effects(
      /** @type {Derived} **/
      dependency
    );
    remove_reactions(
      /** @type {Derived} **/
      dependency,
      0
    );
  }
}
function remove_reactions(signal, start_index) {
  var dependencies = signal.deps;
  if (dependencies === null) return;
  for (var i = start_index; i < dependencies.length; i++) {
    remove_reaction(signal, dependencies[i]);
  }
}
function update_effect(effect2) {
  var _a6;
  var flags2 = effect2.f;
  if ((flags2 & DESTROYED) !== 0) {
    return;
  }
  set_signal_status(effect2, CLEAN);
  var previous_effect = active_effect;
  var was_updating_effect = is_updating_effect;
  active_effect = effect2;
  is_updating_effect = true;
  if (dev_fallback_default) {
    var previous_component_fn = dev_current_component_function;
    set_dev_current_component_function(effect2.component_function);
    var previous_stack = (
      /** @type {any} */
      dev_stack
    );
    set_dev_stack((_a6 = effect2.dev_stack) != null ? _a6 : dev_stack);
  }
  try {
    if ((flags2 & BLOCK_EFFECT) !== 0) {
      destroy_block_effect_children(effect2);
    } else {
      destroy_effect_children(effect2);
    }
    execute_effect_teardown(effect2);
    var teardown2 = update_reaction(effect2);
    effect2.teardown = typeof teardown2 === "function" ? teardown2 : null;
    effect2.wv = write_version;
    if (dev_fallback_default && tracing_mode_flag && (effect2.f & DIRTY) !== 0 && effect2.deps !== null) {
      for (var dep of effect2.deps) {
        if (dep.set_during_effect) {
          dep.wv = increment_write_version();
          dep.set_during_effect = false;
        }
      }
    }
  } finally {
    is_updating_effect = was_updating_effect;
    active_effect = previous_effect;
    if (dev_fallback_default) {
      set_dev_current_component_function(previous_component_fn);
      set_dev_stack(previous_stack);
    }
  }
}
async function tick() {
  if (async_mode_flag) {
    return new Promise((f3) => {
      requestAnimationFrame(() => f3());
      setTimeout(() => f3());
    });
  }
  await Promise.resolve();
  flushSync();
}
function get2(signal) {
  var _a6, _b4, _c2, _d, _e;
  var flags2 = signal.f;
  var is_derived = (flags2 & DERIVED) !== 0;
  (_a6 = captured_signals) == null ? void 0 : _a6.add(signal);
  if (active_reaction !== null && !untracking) {
    var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
    if (!destroyed && !(current_sources == null ? void 0 : current_sources.includes(signal))) {
      var deps = active_reaction.deps;
      if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
        if (signal.rv < read_version) {
          signal.rv = read_version;
          if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
            skipped_deps++;
          } else if (new_deps === null) {
            new_deps = [signal];
          } else if (!skip_reaction || !new_deps.includes(signal)) {
            new_deps.push(signal);
          }
        }
      } else {
        ((_b4 = active_reaction.deps) != null ? _b4 : active_reaction.deps = []).push(signal);
        var reactions = signal.reactions;
        if (reactions === null) {
          signal.reactions = [active_reaction];
        } else if (!reactions.includes(active_reaction)) {
          reactions.push(active_reaction);
        }
      }
    }
  } else if (is_derived && /** @type {Derived} */
  signal.deps === null && /** @type {Derived} */
  signal.effects === null) {
    var derived3 = (
      /** @type {Derived} */
      signal
    );
    var parent = derived3.parent;
    if (parent !== null && (parent.f & UNOWNED) === 0) {
      derived3.f ^= UNOWNED;
    }
  }
  if (dev_fallback_default) {
    if (current_async_effect) {
      var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
      var was_read = (_c2 = current_async_effect.deps) == null ? void 0 : _c2.includes(signal);
      if (!tracking && !untracking && !was_read) {
        await_reactivity_loss(
          /** @type {string} */
          signal.label
        );
        var trace2 = get_stack("TracedAt");
        if (trace2) console.warn(trace2);
      }
    }
    recent_async_deriveds.delete(signal);
    if (tracing_mode_flag && !untracking && tracing_expressions !== null && active_reaction !== null && tracing_expressions.reaction === active_reaction) {
      if (signal.trace) {
        signal.trace();
      } else {
        trace2 = get_stack("TracedAt");
        if (trace2) {
          var entry = tracing_expressions.entries.get(signal);
          if (entry === void 0) {
            entry = { traces: [] };
            tracing_expressions.entries.set(signal, entry);
          }
          var last = entry.traces[entry.traces.length - 1];
          if (trace2.stack !== (last == null ? void 0 : last.stack)) {
            entry.traces.push(trace2);
          }
        }
      }
    }
  }
  if (is_destroying_effect) {
    if (old_values.has(signal)) {
      return old_values.get(signal);
    }
    if (is_derived) {
      derived3 = /** @type {Derived} */
      signal;
      var value2 = derived3.v;
      if ((derived3.f & CLEAN) === 0 && derived3.reactions !== null || depends_on_old_values(derived3)) {
        value2 = execute_derived(derived3);
      }
      old_values.set(derived3, value2);
      return value2;
    }
  } else if (is_derived) {
    derived3 = /** @type {Derived} */
    signal;
    if ((_d = batch_values) == null ? void 0 : _d.has(derived3)) {
      return batch_values.get(derived3);
    }
    if (is_dirty(derived3)) {
      update_derived(derived3);
    }
  }
  if ((_e = batch_values) == null ? void 0 : _e.has(signal)) {
    return batch_values.get(signal);
  }
  if ((signal.f & ERROR_VALUE) !== 0) {
    throw signal.v;
  }
  return signal.v;
}
function depends_on_old_values(derived3) {
  if (derived3.v === UNINITIALIZED) return true;
  if (derived3.deps === null) return false;
  for (const dep of derived3.deps) {
    if (old_values.has(dep)) {
      return true;
    }
    if ((dep.f & DERIVED) !== 0 && depends_on_old_values(
      /** @type {Derived} */
      dep
    )) {
      return true;
    }
  }
  return false;
}
function safe_get(signal) {
  return signal && get2(signal);
}
function untrack(fn) {
  var previous_untracking = untracking;
  try {
    untracking = true;
    return fn();
  } finally {
    untracking = previous_untracking;
  }
}
function set_signal_status(signal, status) {
  signal.f = signal.f & STATUS_MASK | status;
}
function deep_read_state(value2) {
  if (typeof value2 !== "object" || !value2 || value2 instanceof EventTarget) {
    return;
  }
  if (STATE_SYMBOL in value2) {
    deep_read(value2);
  } else if (!Array.isArray(value2)) {
    for (let key4 in value2) {
      const prop2 = value2[key4];
      if (typeof prop2 === "object" && prop2 && STATE_SYMBOL in prop2) {
        deep_read(prop2);
      }
    }
  }
}
function deep_read(value2, visited = /* @__PURE__ */ new Set()) {
  if (typeof value2 === "object" && value2 !== null && // We don't want to traverse DOM elements
  !(value2 instanceof EventTarget) && !visited.has(value2)) {
    visited.add(value2);
    if (value2 instanceof Date) {
      value2.getTime();
    }
    for (let key4 in value2) {
      try {
        deep_read(value2[key4], visited);
      } catch (e2) {
      }
    }
    const proto = get_prototype_of(value2);
    if (proto !== Object.prototype && proto !== Array.prototype && proto !== Map.prototype && proto !== Set.prototype && proto !== Date.prototype) {
      const descriptors = get_descriptors(proto);
      for (let key4 in descriptors) {
        const get4 = descriptors[key4].get;
        if (get4) {
          try {
            get4.call(value2);
          } catch (e2) {
          }
        }
      }
    }
  }
}
var is_updating_effect, is_destroying_effect, active_reaction, untracking, active_effect, current_sources, new_deps, skipped_deps, untracked_writes, write_version, read_version, update_version, skip_reaction, STATUS_MASK;
var init_runtime = __esm({
  "node_modules/svelte/src/internal/client/runtime.js"() {
    init_esm_env();
    init_utils3();
    init_effects();
    init_constants();
    init_sources();
    init_deriveds();
    init_flags();
    init_tracing();
    init_context();
    init_warnings2();
    init_batch();
    init_error_handling();
    init_constants2();
    init_legacy();
    init_shared();
    is_updating_effect = false;
    is_destroying_effect = false;
    active_reaction = null;
    untracking = false;
    active_effect = null;
    current_sources = null;
    new_deps = null;
    skipped_deps = 0;
    untracked_writes = null;
    write_version = 1;
    read_version = 0;
    update_version = read_version;
    skip_reaction = false;
    STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
  }
});

// node_modules/svelte/src/internal/client/reactivity/effects.js
function validate_effect(rune2) {
  if (active_effect === null && active_reaction === null) {
    effect_orphan(rune2);
  }
  if (active_reaction !== null && (active_reaction.f & UNOWNED) !== 0 && active_effect === null) {
    effect_in_unowned_derived();
  }
  if (is_destroying_effect) {
    effect_in_teardown(rune2);
  }
}
function push_effect(effect2, parent_effect) {
  var parent_last = parent_effect.last;
  if (parent_last === null) {
    parent_effect.last = parent_effect.first = effect2;
  } else {
    parent_last.next = effect2;
    effect2.prev = parent_last;
    parent_effect.last = effect2;
  }
}
function create_effect(type, fn, sync2, push2 = true) {
  var _a6;
  var parent = active_effect;
  if (dev_fallback_default) {
    while (parent !== null && (parent.f & INSPECT_EFFECT) !== 0) {
      parent = parent.parent;
    }
  }
  if (parent !== null && (parent.f & INERT) !== 0) {
    type |= INERT;
  }
  var effect2 = {
    ctx: component_context,
    deps: null,
    nodes_start: null,
    nodes_end: null,
    f: type | DIRTY,
    first: null,
    fn,
    last: null,
    next: null,
    parent,
    b: parent && parent.b,
    prev: null,
    teardown: null,
    transitions: null,
    wv: 0,
    ac: null
  };
  if (dev_fallback_default) {
    effect2.component_function = dev_current_component_function;
  }
  if (sync2) {
    try {
      update_effect(effect2);
      effect2.f |= EFFECT_RAN;
    } catch (e3) {
      destroy_effect(effect2);
      throw e3;
    }
  } else if (fn !== null) {
    schedule_effect(effect2);
  }
  if (push2) {
    var e2 = effect2;
    if (sync2 && e2.deps === null && e2.teardown === null && e2.nodes_start === null && e2.first === e2.last && // either `null`, or a singular child
    (e2.f & EFFECT_PRESERVED) === 0) {
      e2 = e2.first;
    }
    if (e2 !== null) {
      e2.parent = parent;
      if (parent !== null) {
        push_effect(e2, parent);
      }
      if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
        var derived3 = (
          /** @type {Derived} */
          active_reaction
        );
        ((_a6 = derived3.effects) != null ? _a6 : derived3.effects = []).push(e2);
      }
    }
  }
  return effect2;
}
function effect_tracking() {
  return active_reaction !== null && !untracking;
}
function teardown(fn) {
  const effect2 = create_effect(RENDER_EFFECT, null, false);
  set_signal_status(effect2, CLEAN);
  effect2.teardown = fn;
  return effect2;
}
function user_effect(fn) {
  var _a6;
  validate_effect("$effect");
  if (dev_fallback_default) {
    define_property(fn, "name", {
      value: "$effect"
    });
  }
  var flags2 = (
    /** @type {Effect} */
    active_effect.f
  );
  var defer = !active_reaction && (flags2 & BRANCH_EFFECT) !== 0 && (flags2 & EFFECT_RAN) === 0;
  if (defer) {
    var context2 = (
      /** @type {ComponentContext} */
      component_context
    );
    ((_a6 = context2.e) != null ? _a6 : context2.e = []).push(fn);
  } else {
    return create_user_effect(fn);
  }
}
function create_user_effect(fn) {
  return create_effect(EFFECT | USER_EFFECT, fn, false);
}
function user_pre_effect(fn) {
  validate_effect("$effect.pre");
  if (dev_fallback_default) {
    define_property(fn, "name", {
      value: "$effect.pre"
    });
  }
  return create_effect(RENDER_EFFECT | USER_EFFECT, fn, true);
}
function effect_root(fn) {
  Batch.ensure();
  const effect2 = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
  return () => {
    destroy_effect(effect2);
  };
}
function component_root(fn) {
  Batch.ensure();
  const effect2 = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
  return (options = {}) => {
    return new Promise((fulfil) => {
      if (options.outro) {
        pause_effect(effect2, () => {
          destroy_effect(effect2);
          fulfil(void 0);
        });
      } else {
        destroy_effect(effect2);
        fulfil(void 0);
      }
    });
  };
}
function effect(fn) {
  return create_effect(EFFECT, fn, false);
}
function legacy_pre_effect(deps, fn) {
  var context2 = (
    /** @type {ComponentContextLegacy} */
    component_context
  );
  var token = { effect: null, ran: false, deps };
  context2.l.$.push(token);
  token.effect = render_effect(() => {
    deps();
    if (token.ran) return;
    token.ran = true;
    untrack(fn);
  });
}
function legacy_pre_effect_reset() {
  var context2 = (
    /** @type {ComponentContextLegacy} */
    component_context
  );
  render_effect(() => {
    for (var token of context2.l.$) {
      token.deps();
      var effect2 = token.effect;
      if ((effect2.f & CLEAN) !== 0) {
        set_signal_status(effect2, MAYBE_DIRTY);
      }
      if (is_dirty(effect2)) {
        update_effect(effect2);
      }
      token.ran = false;
    }
  });
}
function async_effect(fn) {
  return create_effect(ASYNC | EFFECT_PRESERVED, fn, true);
}
function render_effect(fn, flags2 = 0) {
  return create_effect(RENDER_EFFECT | flags2, fn, true);
}
function template_effect(fn, sync2 = [], async2 = []) {
  flatten2(sync2, async2, (values) => {
    create_effect(RENDER_EFFECT, () => fn(...values.map(get2)), true);
  });
}
function block(fn, flags2 = 0) {
  var effect2 = create_effect(BLOCK_EFFECT | flags2, fn, true);
  if (dev_fallback_default) {
    effect2.dev_stack = dev_stack;
  }
  return effect2;
}
function branch(fn, push2 = true) {
  return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true, push2);
}
function execute_effect_teardown(effect2) {
  var teardown2 = effect2.teardown;
  if (teardown2 !== null) {
    const previously_destroying_effect = is_destroying_effect;
    const previous_reaction = active_reaction;
    set_is_destroying_effect(true);
    set_active_reaction(null);
    try {
      teardown2.call(null);
    } finally {
      set_is_destroying_effect(previously_destroying_effect);
      set_active_reaction(previous_reaction);
    }
  }
}
function destroy_effect_children(signal, remove_dom = false) {
  var effect2 = signal.first;
  signal.first = signal.last = null;
  while (effect2 !== null) {
    const controller = effect2.ac;
    if (controller !== null) {
      without_reactive_context(() => {
        controller.abort(STALE_REACTION);
      });
    }
    var next2 = effect2.next;
    if ((effect2.f & ROOT_EFFECT) !== 0) {
      effect2.parent = null;
    } else {
      destroy_effect(effect2, remove_dom);
    }
    effect2 = next2;
  }
}
function destroy_block_effect_children(signal) {
  var effect2 = signal.first;
  while (effect2 !== null) {
    var next2 = effect2.next;
    if ((effect2.f & BRANCH_EFFECT) === 0) {
      destroy_effect(effect2);
    }
    effect2 = next2;
  }
}
function destroy_effect(effect2, remove_dom = true) {
  var removed = false;
  if ((remove_dom || (effect2.f & HEAD_EFFECT) !== 0) && effect2.nodes_start !== null && effect2.nodes_end !== null) {
    remove_effect_dom(
      effect2.nodes_start,
      /** @type {TemplateNode} */
      effect2.nodes_end
    );
    removed = true;
  }
  destroy_effect_children(effect2, remove_dom && !removed);
  remove_reactions(effect2, 0);
  set_signal_status(effect2, DESTROYED);
  var transitions = effect2.transitions;
  if (transitions !== null) {
    for (const transition2 of transitions) {
      transition2.stop();
    }
  }
  execute_effect_teardown(effect2);
  var parent = effect2.parent;
  if (parent !== null && parent.first !== null) {
    unlink_effect(effect2);
  }
  if (dev_fallback_default) {
    effect2.component_function = null;
  }
  effect2.next = effect2.prev = effect2.teardown = effect2.ctx = effect2.deps = effect2.fn = effect2.nodes_start = effect2.nodes_end = effect2.ac = null;
}
function remove_effect_dom(node, end) {
  while (node !== null) {
    var next2 = node === end ? null : (
      /** @type {TemplateNode} */
      get_next_sibling(node)
    );
    node.remove();
    node = next2;
  }
}
function unlink_effect(effect2) {
  var parent = effect2.parent;
  var prev = effect2.prev;
  var next2 = effect2.next;
  if (prev !== null) prev.next = next2;
  if (next2 !== null) next2.prev = prev;
  if (parent !== null) {
    if (parent.first === effect2) parent.first = next2;
    if (parent.last === effect2) parent.last = prev;
  }
}
function pause_effect(effect2, callback, destroy2 = true) {
  var transitions = [];
  pause_children(effect2, transitions, true);
  run_out_transitions(transitions, () => {
    if (destroy2) destroy_effect(effect2);
    if (callback) callback();
  });
}
function run_out_transitions(transitions, fn) {
  var remaining = transitions.length;
  if (remaining > 0) {
    var check = () => --remaining || fn();
    for (var transition2 of transitions) {
      transition2.out(check);
    }
  } else {
    fn();
  }
}
function pause_children(effect2, transitions, local) {
  if ((effect2.f & INERT) !== 0) return;
  effect2.f ^= INERT;
  if (effect2.transitions !== null) {
    for (const transition2 of effect2.transitions) {
      if (transition2.is_global || local) {
        transitions.push(transition2);
      }
    }
  }
  var child2 = effect2.first;
  while (child2 !== null) {
    var sibling2 = child2.next;
    var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0;
    pause_children(child2, transitions, transparent ? local : false);
    child2 = sibling2;
  }
}
function resume_effect(effect2) {
  resume_children(effect2, true);
}
function resume_children(effect2, local) {
  if ((effect2.f & INERT) === 0) return;
  effect2.f ^= INERT;
  if ((effect2.f & CLEAN) === 0) {
    set_signal_status(effect2, DIRTY);
    schedule_effect(effect2);
  }
  var child2 = effect2.first;
  while (child2 !== null) {
    var sibling2 = child2.next;
    var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || (child2.f & BRANCH_EFFECT) !== 0;
    resume_children(child2, transparent ? local : false);
    child2 = sibling2;
  }
  if (effect2.transitions !== null) {
    for (const transition2 of effect2.transitions) {
      if (transition2.is_global || local) {
        transition2.in();
      }
    }
  }
}
function move_effect(effect2, fragment) {
  var node = effect2.nodes_start;
  var end = effect2.nodes_end;
  while (node !== null) {
    var next2 = node === end ? null : (
      /** @type {TemplateNode} */
      get_next_sibling(node)
    );
    fragment.append(node);
    node = next2;
  }
}
var init_effects = __esm({
  "node_modules/svelte/src/internal/client/reactivity/effects.js"() {
    init_runtime();
    init_constants();
    init_errors2();
    init_esm_env();
    init_utils3();
    init_operations();
    init_context();
    init_batch();
    init_async();
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/events.js
function create_event(event_name, dom, handler, options = {}) {
  function target_handler(event2) {
    if (!options.capture) {
      handle_event_propagation.call(dom, event2);
    }
    if (!event2.cancelBubble) {
      return without_reactive_context(() => {
        return handler == null ? void 0 : handler.call(this, event2);
      });
    }
  }
  if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") {
    queue_micro_task(() => {
      dom.addEventListener(event_name, target_handler, options);
    });
  } else {
    dom.addEventListener(event_name, target_handler, options);
  }
  return target_handler;
}
function event(event_name, dom, handler, capture2, passive2) {
  var options = { capture: capture2, passive: passive2 };
  var target_handler = create_event(event_name, dom, handler, options);
  if (dom === document.body || // @ts-ignore
  dom === window || // @ts-ignore
  dom === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
  dom instanceof HTMLMediaElement) {
    teardown(() => {
      dom.removeEventListener(event_name, target_handler, options);
    });
  }
}
function handle_event_propagation(event2) {
  var _a6;
  var handler_element = this;
  var owner_document = (
    /** @type {Node} */
    handler_element.ownerDocument
  );
  var event_name = event2.type;
  var path8 = ((_a6 = event2.composedPath) == null ? void 0 : _a6.call(event2)) || [];
  var current_target = (
    /** @type {null | Element} */
    path8[0] || event2.target
  );
  last_propagated_event = event2;
  var path_idx = 0;
  var handled_at = last_propagated_event === event2 && event2.__root;
  if (handled_at) {
    var at_idx = path8.indexOf(handled_at);
    if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
    window)) {
      event2.__root = handler_element;
      return;
    }
    var handler_idx = path8.indexOf(handler_element);
    if (handler_idx === -1) {
      return;
    }
    if (at_idx <= handler_idx) {
      path_idx = at_idx;
    }
  }
  current_target = /** @type {Element} */
  path8[path_idx] || event2.target;
  if (current_target === handler_element) return;
  define_property(event2, "currentTarget", {
    configurable: true,
    get() {
      return current_target || owner_document;
    }
  });
  var previous_reaction = active_reaction;
  var previous_effect = active_effect;
  set_active_reaction(null);
  set_active_effect(null);
  try {
    var throw_error;
    var other_errors = [];
    while (current_target !== null) {
      var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
      current_target.host || null;
      try {
        var delegated = current_target["__" + event_name];
        if (delegated != null && (!/** @type {any} */
        current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
        // -> the target could not have been disabled because it emits the event in the first place
        event2.target === current_target)) {
          if (is_array(delegated)) {
            var [fn, ...data] = delegated;
            fn.apply(current_target, [event2, ...data]);
          } else {
            delegated.call(current_target, event2);
          }
        }
      } catch (error2) {
        if (throw_error) {
          other_errors.push(error2);
        } else {
          throw_error = error2;
        }
      }
      if (event2.cancelBubble || parent_element === handler_element || parent_element === null) {
        break;
      }
      current_target = parent_element;
    }
    if (throw_error) {
      for (let error2 of other_errors) {
        queueMicrotask(() => {
          throw error2;
        });
      }
      throw throw_error;
    }
  } finally {
    event2.__root = handler_element;
    delete event2.currentTarget;
    set_active_reaction(previous_reaction);
    set_active_effect(previous_effect);
  }
}
var all_registered_events, root_event_handles, last_propagated_event;
var init_events2 = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/events.js"() {
    init_effects();
    init_utils3();
    init_hydration();
    init_task2();
    init_constants2();
    init_warnings2();
    init_runtime();
    init_shared();
    all_registered_events = /* @__PURE__ */ new Set();
    root_event_handles = /* @__PURE__ */ new Set();
    last_propagated_event = null;
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js
function reset_head_anchor() {
  head_anchor = void 0;
}
var head_anchor;
var init_svelte_head = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js"() {
    init_hydration();
    init_operations();
    init_effects();
    init_constants();
    init_constants2();
  }
});

// node_modules/svelte/src/internal/client/dom/reconciler.js
function create_fragment_from_html(html2) {
  var elem = document.createElement("template");
  elem.innerHTML = html2.replaceAll("<!>", "<!---->");
  return elem.content;
}
var init_reconciler = __esm({
  "node_modules/svelte/src/internal/client/dom/reconciler.js"() {
  }
});

// node_modules/svelte/src/internal/client/dom/template.js
function assign_nodes(start, end) {
  var effect2 = (
    /** @type {Effect} */
    active_effect
  );
  if (effect2.nodes_start === null) {
    effect2.nodes_start = start;
    effect2.nodes_end = end;
  }
}
// @__NO_SIDE_EFFECTS__
function from_html(content, flags2) {
  var is_fragment = (flags2 & TEMPLATE_FRAGMENT) !== 0;
  var use_import_node = (flags2 & TEMPLATE_USE_IMPORT_NODE) !== 0;
  var node;
  var has_start = !content.startsWith("<!>");
  return () => {
    if (hydrating) {
      assign_nodes(hydrate_node, null);
      return hydrate_node;
    }
    if (node === void 0) {
      node = create_fragment_from_html(has_start ? content : "<!>" + content);
      if (!is_fragment) node = /** @type {Node} */
      get_first_child(node);
    }
    var clone2 = (
      /** @type {TemplateNode} */
      use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)
    );
    if (is_fragment) {
      var start = (
        /** @type {TemplateNode} */
        get_first_child(clone2)
      );
      var end = (
        /** @type {TemplateNode} */
        clone2.lastChild
      );
      assign_nodes(start, end);
    } else {
      assign_nodes(clone2, clone2);
    }
    return clone2;
  };
}
function text2(value2 = "") {
  if (!hydrating) {
    var t2 = create_text(value2 + "");
    assign_nodes(t2, t2);
    return t2;
  }
  var node = hydrate_node;
  if (node.nodeType !== TEXT_NODE) {
    node.before(node = create_text());
    set_hydrate_node(node);
  }
  assign_nodes(node, node);
  return node;
}
function comment() {
  if (hydrating) {
    assign_nodes(hydrate_node, null);
    return hydrate_node;
  }
  var frag = document.createDocumentFragment();
  var start = document.createComment("");
  var anchor = create_text();
  frag.append(start, anchor);
  assign_nodes(start, anchor);
  return frag;
}
function append(anchor, dom) {
  if (hydrating) {
    active_effect.nodes_end = hydrate_node;
    hydrate_next();
    return;
  }
  if (anchor === null) {
    return;
  }
  anchor.before(
    /** @type {Node} */
    dom
  );
}
var init_template = __esm({
  "node_modules/svelte/src/internal/client/dom/template.js"() {
    init_hydration();
    init_operations();
    init_reconciler();
    init_runtime();
    init_constants2();
    init_constants();
  }
});

// node_modules/svelte/src/utils.js
function is_passive_event(name) {
  return PASSIVE_EVENTS.includes(name);
}
var DOM_BOOLEAN_ATTRIBUTES, DOM_PROPERTIES, PASSIVE_EVENTS, STATE_CREATION_RUNES, RUNES;
var init_utils4 = __esm({
  "node_modules/svelte/src/utils.js"() {
    DOM_BOOLEAN_ATTRIBUTES = [
      "allowfullscreen",
      "async",
      "autofocus",
      "autoplay",
      "checked",
      "controls",
      "default",
      "disabled",
      "formnovalidate",
      "indeterminate",
      "inert",
      "ismap",
      "loop",
      "multiple",
      "muted",
      "nomodule",
      "novalidate",
      "open",
      "playsinline",
      "readonly",
      "required",
      "reversed",
      "seamless",
      "selected",
      "webkitdirectory",
      "defer",
      "disablepictureinpicture",
      "disableremoteplayback"
    ];
    DOM_PROPERTIES = [
      ...DOM_BOOLEAN_ATTRIBUTES,
      "formNoValidate",
      "isMap",
      "noModule",
      "playsInline",
      "readOnly",
      "value",
      "volume",
      "defaultValue",
      "defaultChecked",
      "srcObject",
      "noValidate",
      "allowFullscreen",
      "disablePictureInPicture",
      "disableRemotePlayback"
    ];
    PASSIVE_EVENTS = ["touchstart", "touchmove"];
    STATE_CREATION_RUNES = /** @type {const} */
    [
      "$state",
      "$state.raw",
      "$derived",
      "$derived.by"
    ];
    RUNES = /** @type {const} */
    [
      ...STATE_CREATION_RUNES,
      "$state.eager",
      "$state.snapshot",
      "$props",
      "$props.id",
      "$bindable",
      "$effect",
      "$effect.pre",
      "$effect.tracking",
      "$effect.root",
      "$effect.pending",
      "$inspect",
      "$inspect().with",
      "$inspect.trace",
      "$host"
    ];
  }
});

// node_modules/svelte/src/internal/client/render.js
function set_text(text3, value2) {
  var _a6;
  var str = value2 == null ? "" : typeof value2 === "object" ? value2 + "" : value2;
  if (str !== ((_a6 = text3.__t) != null ? _a6 : text3.__t = text3.nodeValue)) {
    text3.__t = str;
    text3.nodeValue = str + "";
  }
}
function mount(component2, options) {
  return _mount(component2, options);
}
function hydrate(component2, options) {
  var _a6;
  init_operations2();
  options.intro = (_a6 = options.intro) != null ? _a6 : false;
  const target = options.target;
  const was_hydrating = hydrating;
  const previous_hydrate_node = hydrate_node;
  try {
    var anchor = (
      /** @type {TemplateNode} */
      get_first_child(target)
    );
    while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
    anchor.data !== HYDRATION_START)) {
      anchor = /** @type {TemplateNode} */
      get_next_sibling(anchor);
    }
    if (!anchor) {
      throw HYDRATION_ERROR;
    }
    set_hydrating(true);
    set_hydrate_node(
      /** @type {Comment} */
      anchor
    );
    const instance = _mount(component2, { ...options, anchor });
    set_hydrating(false);
    return (
      /**  @type {Exports} */
      instance
    );
  } catch (error2) {
    if (error2 instanceof Error && error2.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
      throw error2;
    }
    if (error2 !== HYDRATION_ERROR) {
      console.warn("Failed to hydrate: ", error2);
    }
    if (options.recover === false) {
      hydration_failed();
    }
    init_operations2();
    clear_text_content(target);
    set_hydrating(false);
    return mount(component2, options);
  } finally {
    set_hydrating(was_hydrating);
    set_hydrate_node(previous_hydrate_node);
    reset_head_anchor();
  }
}
function _mount(Component, { target, anchor, props = {}, events, context: context2, intro = true }) {
  init_operations2();
  var registered_events = /* @__PURE__ */ new Set();
  var event_handle = (events2) => {
    for (var i = 0; i < events2.length; i++) {
      var event_name = events2[i];
      if (registered_events.has(event_name)) continue;
      registered_events.add(event_name);
      var passive2 = is_passive_event(event_name);
      target.addEventListener(event_name, handle_event_propagation, { passive: passive2 });
      var n3 = document_listeners.get(event_name);
      if (n3 === void 0) {
        document.addEventListener(event_name, handle_event_propagation, { passive: passive2 });
        document_listeners.set(event_name, 1);
      } else {
        document_listeners.set(event_name, n3 + 1);
      }
    }
  };
  event_handle(array_from(all_registered_events));
  root_event_handles.add(event_handle);
  var component2 = void 0;
  var unmount2 = component_root(() => {
    var anchor_node = anchor != null ? anchor : target.appendChild(create_text());
    boundary(
      /** @type {TemplateNode} */
      anchor_node,
      {
        pending: () => {
        }
      },
      (anchor_node2) => {
        if (context2) {
          push({});
          var ctx = (
            /** @type {ComponentContext} */
            component_context
          );
          ctx.c = context2;
        }
        if (events) {
          props.$$events = events;
        }
        if (hydrating) {
          assign_nodes(
            /** @type {TemplateNode} */
            anchor_node2,
            null
          );
        }
        should_intro = intro;
        component2 = Component(anchor_node2, props) || {};
        should_intro = true;
        if (hydrating) {
          active_effect.nodes_end = hydrate_node;
          if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
          hydrate_node.data !== HYDRATION_END) {
            hydration_mismatch();
            throw HYDRATION_ERROR;
          }
        }
        if (context2) {
          pop2();
        }
      }
    );
    return () => {
      var _a6;
      for (var event_name of registered_events) {
        target.removeEventListener(event_name, handle_event_propagation);
        var n3 = (
          /** @type {number} */
          document_listeners.get(event_name)
        );
        if (--n3 === 0) {
          document.removeEventListener(event_name, handle_event_propagation);
          document_listeners.delete(event_name);
        } else {
          document_listeners.set(event_name, n3);
        }
      }
      root_event_handles.delete(event_handle);
      if (anchor_node !== anchor) {
        (_a6 = anchor_node.parentNode) == null ? void 0 : _a6.removeChild(anchor_node);
      }
    };
  });
  mounted_components.set(component2, unmount2);
  return component2;
}
function unmount(component2, options) {
  const fn = mounted_components.get(component2);
  if (fn) {
    mounted_components.delete(component2);
    return fn(options);
  }
  if (dev_fallback_default) {
    if (STATE_SYMBOL in component2) {
      state_proxy_unmount();
    } else {
      lifecycle_double_unmount();
    }
  }
  return Promise.resolve();
}
var should_intro, document_listeners, mounted_components;
var init_render = __esm({
  "node_modules/svelte/src/internal/client/render.js"() {
    init_esm_env();
    init_operations();
    init_constants2();
    init_runtime();
    init_context();
    init_effects();
    init_hydration();
    init_utils3();
    init_events2();
    init_svelte_head();
    init_warnings2();
    init_errors2();
    init_template();
    init_utils4();
    init_constants();
    init_boundary();
    should_intro = true;
    document_listeners = /* @__PURE__ */ new Map();
    mounted_components = /* @__PURE__ */ new WeakMap();
  }
});

// node_modules/svelte/src/internal/client/dom/legacy/event-modifiers.js
var init_event_modifiers = __esm({
  "node_modules/svelte/src/internal/client/dom/legacy/event-modifiers.js"() {
    init_utils3();
    init_effects();
    init_events2();
  }
});

// node_modules/svelte/src/legacy/legacy-client.js
function createClassComponent(options) {
  return new Svelte4Component(options);
}
var _events, _instance, Svelte4Component;
var init_legacy_client = __esm({
  "node_modules/svelte/src/legacy/legacy-client.js"() {
    init_constants();
    init_effects();
    init_sources();
    init_render();
    init_runtime();
    init_batch();
    init_utils3();
    init_errors2();
    init_warnings2();
    init_esm_env();
    init_constants2();
    init_context();
    init_flags();
    init_event_modifiers();
    Svelte4Component = class {
      /**
       * @param {ComponentConstructorOptions & {
       *  component: any;
       * }} options
       */
      constructor(options) {
        /** @type {any} */
        __privateAdd(this, _events);
        /** @type {Record<string, any>} */
        __privateAdd(this, _instance);
        var _a6, _b4;
        var sources = /* @__PURE__ */ new Map();
        var add_source = (key4, value2) => {
          var s = mutable_source(value2, false, false);
          sources.set(key4, s);
          return s;
        };
        const props = new Proxy(
          { ...options.props || {}, $$events: {} },
          {
            get(target, prop2) {
              var _a7;
              return get2((_a7 = sources.get(prop2)) != null ? _a7 : add_source(prop2, Reflect.get(target, prop2)));
            },
            has(target, prop2) {
              var _a7;
              if (prop2 === LEGACY_PROPS) return true;
              get2((_a7 = sources.get(prop2)) != null ? _a7 : add_source(prop2, Reflect.get(target, prop2)));
              return Reflect.has(target, prop2);
            },
            set(target, prop2, value2) {
              var _a7;
              set((_a7 = sources.get(prop2)) != null ? _a7 : add_source(prop2, value2), value2);
              return Reflect.set(target, prop2, value2);
            }
          }
        );
        __privateSet(this, _instance, (options.hydrate ? hydrate : mount)(options.component, {
          target: options.target,
          anchor: options.anchor,
          props,
          context: options.context,
          intro: (_a6 = options.intro) != null ? _a6 : false,
          recover: options.recover
        }));
        if (!async_mode_flag && (!((_b4 = options == null ? void 0 : options.props) == null ? void 0 : _b4.$$host) || options.sync === false)) {
          flushSync();
        }
        __privateSet(this, _events, props.$$events);
        for (const key4 of Object.keys(__privateGet(this, _instance))) {
          if (key4 === "$set" || key4 === "$destroy" || key4 === "$on") continue;
          define_property(this, key4, {
            get() {
              return __privateGet(this, _instance)[key4];
            },
            /** @param {any} value */
            set(value2) {
              __privateGet(this, _instance)[key4] = value2;
            },
            enumerable: true
          });
        }
        __privateGet(this, _instance).$set = /** @param {Record<string, any>} next */
        (next2) => {
          Object.assign(props, next2);
        };
        __privateGet(this, _instance).$destroy = () => {
          unmount(__privateGet(this, _instance));
        };
      }
      /** @param {Record<string, any>} props */
      $set(props) {
        __privateGet(this, _instance).$set(props);
      }
      /**
       * @param {string} event
       * @param {(...args: any[]) => any} callback
       * @returns {any}
       */
      $on(event2, callback) {
        __privateGet(this, _events)[event2] = __privateGet(this, _events)[event2] || [];
        const cb = (...args) => callback.call(this, ...args);
        __privateGet(this, _events)[event2].push(cb);
        return () => {
          __privateGet(this, _events)[event2] = __privateGet(this, _events)[event2].filter(
            /** @param {any} fn */
            (fn) => fn !== cb
          );
        };
      }
      $destroy() {
        __privateGet(this, _instance).$destroy();
      }
    };
    _events = new WeakMap();
    _instance = new WeakMap();
  }
});

// node_modules/svelte/src/version.js
var PUBLIC_VERSION;
var init_version = __esm({
  "node_modules/svelte/src/version.js"() {
    PUBLIC_VERSION = "5";
  }
});

// node_modules/svelte/src/internal/disclose-version.js
var _a5, _b3, _c;
var init_disclose_version = __esm({
  "node_modules/svelte/src/internal/disclose-version.js"() {
    init_version();
    if (typeof window !== "undefined") {
      ((_c = (_b3 = (_a5 = window.__svelte) != null ? _a5 : window.__svelte = {}).v) != null ? _c : _b3.v = /* @__PURE__ */ new Set()).add(PUBLIC_VERSION);
    }
  }
});

// node_modules/svelte/src/internal/flags/legacy.js
var init_legacy2 = __esm({
  "node_modules/svelte/src/internal/flags/legacy.js"() {
    init_flags();
    enable_legacy_mode_flag();
  }
});

// node_modules/svelte/src/internal/shared/validate.js
var init_validate2 = __esm({
  "node_modules/svelte/src/internal/shared/validate.js"() {
    init_utils4();
    init_warnings();
    init_errors();
    init_errors();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/branches.js
var _batches, _onscreen, _offscreen, _transition, _commit, BranchManager;
var init_branches = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/branches.js"() {
    init_context();
    init_batch();
    init_effects();
    init_render();
    init_hydration();
    init_operations();
    BranchManager = class {
      /**
       * @param {TemplateNode} anchor
       * @param {boolean} transition
       */
      constructor(anchor, transition2 = true) {
        /** @type {TemplateNode} */
        __publicField(this, "anchor");
        /** @type {Map<Batch, Key>} */
        __privateAdd(this, _batches, /* @__PURE__ */ new Map());
        /** @type {Map<Key, Effect>} */
        __privateAdd(this, _onscreen, /* @__PURE__ */ new Map());
        /** @type {Map<Key, Branch>} */
        __privateAdd(this, _offscreen, /* @__PURE__ */ new Map());
        /**
         * Whether to pause (i.e. outro) on change, or destroy immediately.
         * This is necessary for `<svelte:element>`
         */
        __privateAdd(this, _transition, true);
        __privateAdd(this, _commit, () => {
          var batch = (
            /** @type {Batch} */
            current_batch
          );
          if (!__privateGet(this, _batches).has(batch)) return;
          var key4 = (
            /** @type {Key} */
            __privateGet(this, _batches).get(batch)
          );
          var onscreen = __privateGet(this, _onscreen).get(key4);
          if (onscreen) {
            resume_effect(onscreen);
          } else {
            var offscreen = __privateGet(this, _offscreen).get(key4);
            if (offscreen) {
              __privateGet(this, _onscreen).set(key4, offscreen.effect);
              __privateGet(this, _offscreen).delete(key4);
              offscreen.fragment.lastChild.remove();
              this.anchor.before(offscreen.fragment);
              onscreen = offscreen.effect;
            }
          }
          for (const [b, k] of __privateGet(this, _batches)) {
            __privateGet(this, _batches).delete(b);
            if (b === batch) {
              break;
            }
            const offscreen2 = __privateGet(this, _offscreen).get(k);
            if (offscreen2) {
              destroy_effect(offscreen2.effect);
              __privateGet(this, _offscreen).delete(k);
            }
          }
          for (const [k, effect2] of __privateGet(this, _onscreen)) {
            if (k === key4) continue;
            const on_destroy = () => {
              const keys2 = Array.from(__privateGet(this, _batches).values());
              if (keys2.includes(k)) {
                var fragment = document.createDocumentFragment();
                move_effect(effect2, fragment);
                fragment.append(create_text());
                __privateGet(this, _offscreen).set(k, { effect: effect2, fragment });
              } else {
                destroy_effect(effect2);
              }
              __privateGet(this, _onscreen).delete(k);
            };
            if (__privateGet(this, _transition) || !onscreen) {
              pause_effect(effect2, on_destroy, false);
            } else {
              on_destroy();
            }
          }
        });
        this.anchor = anchor;
        __privateSet(this, _transition, transition2);
      }
      /**
       *
       * @param {any} key
       * @param {null | ((target: TemplateNode) => void)} fn
       */
      ensure(key4, fn) {
        var batch = (
          /** @type {Batch} */
          current_batch
        );
        var defer = should_defer_append();
        if (fn && !__privateGet(this, _onscreen).has(key4) && !__privateGet(this, _offscreen).has(key4)) {
          if (defer) {
            var fragment = document.createDocumentFragment();
            var target = create_text();
            fragment.append(target);
            __privateGet(this, _offscreen).set(key4, {
              effect: branch(() => fn(target)),
              fragment
            });
          } else {
            __privateGet(this, _onscreen).set(
              key4,
              branch(() => fn(this.anchor))
            );
          }
        }
        __privateGet(this, _batches).set(batch, key4);
        if (defer) {
          for (const [k, effect2] of __privateGet(this, _onscreen)) {
            if (k === key4) {
              batch.skipped_effects.delete(effect2);
            } else {
              batch.skipped_effects.add(effect2);
            }
          }
          for (const [k, branch2] of __privateGet(this, _offscreen)) {
            if (k === key4) {
              batch.skipped_effects.delete(branch2.effect);
            } else {
              batch.skipped_effects.add(branch2.effect);
            }
          }
          batch.add_callback(__privateGet(this, _commit));
        } else {
          if (hydrating) {
            this.anchor = hydrate_node;
          }
          __privateGet(this, _commit).call(this);
        }
      }
    };
    _batches = new WeakMap();
    _onscreen = new WeakMap();
    _offscreen = new WeakMap();
    _transition = new WeakMap();
    _commit = new WeakMap();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/snippet.js
var init_snippet = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/snippet.js"() {
    init_constants();
    init_effects();
    init_context();
    init_hydration();
    init_reconciler();
    init_template();
    init_warnings2();
    init_errors2();
    init_esm_env();
    init_operations();
    init_validate2();
    init_branches();
  }
});

// node_modules/svelte/src/index-client.js
function onMount(fn) {
  if (component_context === null) {
    lifecycle_outside_component("onMount");
  }
  if (legacy_mode_flag && component_context.l !== null) {
    init_update_callbacks(component_context).m.push(fn);
  } else {
    user_effect(() => {
      const cleanup = untrack(fn);
      if (typeof cleanup === "function") return (
        /** @type {() => void} */
        cleanup
      );
    });
  }
}
function onDestroy(fn) {
  if (component_context === null) {
    lifecycle_outside_component("onDestroy");
  }
  onMount(() => () => untrack(fn));
}
function init_update_callbacks(context2) {
  var _a6;
  var l = (
    /** @type {ComponentContextLegacy} */
    context2.l
  );
  return (_a6 = l.u) != null ? _a6 : l.u = { a: [], b: [], m: [] };
}
var init_index_client = __esm({
  "node_modules/svelte/src/index-client.js"() {
    init_runtime();
    init_utils3();
    init_client();
    init_errors2();
    init_flags();
    init_context();
    init_esm_env();
    init_batch();
    init_context();
    init_render();
    init_runtime();
    init_snippet();
    if (dev_fallback_default) {
      let throw_rune_error = function(rune2) {
        if (!(rune2 in globalThis)) {
          let value2;
          Object.defineProperty(globalThis, rune2, {
            configurable: true,
            // eslint-disable-next-line getter-return
            get: () => {
              if (value2 !== void 0) {
                return value2;
              }
              rune_outside_svelte(rune2);
            },
            set: (v) => {
              value2 = v;
            }
          });
        }
      };
      throw_rune_error("$state");
      throw_rune_error("$effect");
      throw_rune_error("$derived");
      throw_rune_error("$inspect");
      throw_rune_error("$props");
      throw_rune_error("$bindable");
    }
  }
});

// node_modules/svelte/src/attachments/index.js
var init_attachments = __esm({
  "node_modules/svelte/src/attachments/index.js"() {
    init_client();
    init_constants2();
    init_index_client();
    init_effects();
  }
});

// node_modules/svelte/src/internal/client/dev/assign.js
var init_assign = __esm({
  "node_modules/svelte/src/internal/client/dev/assign.js"() {
    init_utils4();
    init_runtime();
    init_warnings2();
  }
});

// node_modules/svelte/src/internal/client/dev/css.js
function register_style(hash2, style) {
  var styles = all_styles.get(hash2);
  if (!styles) {
    styles = /* @__PURE__ */ new Set();
    all_styles.set(hash2, styles);
  }
  styles.add(style);
}
var all_styles;
var init_css = __esm({
  "node_modules/svelte/src/internal/client/dev/css.js"() {
    all_styles = /* @__PURE__ */ new Map();
  }
});

// node_modules/svelte/src/internal/client/dev/elements.js
var init_elements = __esm({
  "node_modules/svelte/src/internal/client/dev/elements.js"() {
    init_constants();
    init_constants2();
    init_hydration();
    init_context();
  }
});

// node_modules/svelte/src/internal/client/dev/hmr.js
var init_hmr = __esm({
  "node_modules/svelte/src/internal/client/dev/hmr.js"() {
    init_constants2();
    init_constants();
    init_hydration();
    init_effects();
    init_sources();
    init_render();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/dev/ownership.js
var init_ownership = __esm({
  "node_modules/svelte/src/internal/client/dev/ownership.js"() {
    init_utils3();
    init_constants();
    init_constants2();
    init_context();
    init_warnings2();
    init_utils4();
  }
});

// node_modules/svelte/src/internal/client/dev/legacy.js
var init_legacy3 = __esm({
  "node_modules/svelte/src/internal/client/dev/legacy.js"() {
    init_errors2();
    init_context();
    init_constants2();
  }
});

// node_modules/svelte/src/internal/client/dev/inspect.js
var init_inspect = __esm({
  "node_modules/svelte/src/internal/client/dev/inspect.js"() {
    init_constants2();
    init_clone();
    init_effects();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/async.js
var init_async2 = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/async.js"() {
    init_async();
    init_runtime();
    init_hydration();
    init_boundary();
  }
});

// node_modules/svelte/src/internal/client/dev/validation.js
var init_validation = __esm({
  "node_modules/svelte/src/internal/client/dev/validation.js"() {
    init_errors2();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/await.js
var init_await = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/await.js"() {
    init_utils3();
    init_effects();
    init_sources();
    init_hydration();
    init_task2();
    init_constants2();
    init_context();
    init_batch();
    init_branches();
    init_async();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/if.js
function if_block(node, fn, elseif = false) {
  if (hydrating) {
    hydrate_next();
  }
  var branches = new BranchManager(node);
  var flags2 = elseif ? EFFECT_TRANSPARENT : 0;
  function update_branch(condition, fn2) {
    if (hydrating) {
      const is_else = read_hydration_instruction(node) === HYDRATION_START_ELSE;
      if (condition === is_else) {
        var anchor = skip_nodes();
        set_hydrate_node(anchor);
        branches.anchor = anchor;
        set_hydrating(false);
        branches.ensure(condition, fn2);
        set_hydrating(true);
        return;
      }
    }
    branches.ensure(condition, fn2);
  }
  block(() => {
    var has_branch = false;
    fn((fn2, flag = true) => {
      has_branch = true;
      update_branch(flag, fn2);
    });
    if (!has_branch) {
      update_branch(false, null);
    }
  }, flags2);
}
var init_if = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/if.js"() {
    init_constants();
    init_hydration();
    init_effects();
    init_constants2();
    init_branches();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/key.js
var init_key = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/key.js"() {
    init_context();
    init_effects();
    init_hydration();
    init_branches();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/css-props.js
var init_css_props = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/css-props.js"() {
    init_effects();
    init_hydration();
    init_operations();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/each.js
function index5(_, i) {
  return i;
}
function pause_effects(state2, items, controlled_anchor) {
  var items_map = state2.items;
  var transitions = [];
  var length = items.length;
  for (var i = 0; i < length; i++) {
    pause_children(items[i].e, transitions, true);
  }
  var is_controlled = length > 0 && transitions.length === 0 && controlled_anchor !== null;
  if (is_controlled) {
    var parent_node = (
      /** @type {Element} */
      /** @type {Element} */
      controlled_anchor.parentNode
    );
    clear_text_content(parent_node);
    parent_node.append(
      /** @type {Element} */
      controlled_anchor
    );
    items_map.clear();
    link(state2, items[0].prev, items[length - 1].next);
  }
  run_out_transitions(transitions, () => {
    for (var i2 = 0; i2 < length; i2++) {
      var item = items[i2];
      if (!is_controlled) {
        items_map.delete(item.k);
        link(state2, item.prev, item.next);
      }
      destroy_effect(item.e, !is_controlled);
    }
  });
}
function each(node, flags2, get_collection, get_key, render_fn, fallback_fn = null) {
  var anchor = node;
  var state2 = { flags: flags2, items: /* @__PURE__ */ new Map(), first: null };
  var is_controlled = (flags2 & EACH_IS_CONTROLLED) !== 0;
  if (is_controlled) {
    var parent_node = (
      /** @type {Element} */
      node
    );
    anchor = hydrating ? set_hydrate_node(
      /** @type {Comment | Text} */
      get_first_child(parent_node)
    ) : parent_node.appendChild(create_text());
  }
  if (hydrating) {
    hydrate_next();
  }
  var fallback2 = null;
  var was_empty = false;
  var offscreen_items = /* @__PURE__ */ new Map();
  var each_array = derived_safe_equal(() => {
    var collection = get_collection();
    return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
  });
  var array;
  var each_effect;
  function commit() {
    reconcile(
      each_effect,
      array,
      state2,
      offscreen_items,
      anchor,
      render_fn,
      flags2,
      get_key,
      get_collection
    );
    if (fallback_fn !== null) {
      if (array.length === 0) {
        if (fallback2) {
          resume_effect(fallback2);
        } else {
          fallback2 = branch(() => fallback_fn(anchor));
        }
      } else if (fallback2 !== null) {
        pause_effect(fallback2, () => {
          fallback2 = null;
        });
      }
    }
  }
  block(() => {
    var _a6;
    each_effect != null ? each_effect : each_effect = /** @type {Effect} */
    active_effect;
    array = /** @type {V[]} */
    get2(each_array);
    var length = array.length;
    if (was_empty && length === 0) {
      return;
    }
    was_empty = length === 0;
    let mismatch = false;
    if (hydrating) {
      var is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;
      if (is_else !== (length === 0)) {
        anchor = skip_nodes();
        set_hydrate_node(anchor);
        set_hydrating(false);
        mismatch = true;
      }
    }
    if (hydrating) {
      var prev = null;
      var item;
      for (var i = 0; i < length; i++) {
        if (hydrate_node.nodeType === COMMENT_NODE && /** @type {Comment} */
        hydrate_node.data === HYDRATION_END) {
          anchor = /** @type {Comment} */
          hydrate_node;
          mismatch = true;
          set_hydrating(false);
          break;
        }
        var value2 = array[i];
        var key4 = get_key(value2, i);
        item = create_item(
          hydrate_node,
          state2,
          prev,
          null,
          value2,
          key4,
          i,
          render_fn,
          flags2,
          get_collection
        );
        state2.items.set(key4, item);
        prev = item;
      }
      if (length > 0) {
        set_hydrate_node(skip_nodes());
      }
    }
    if (hydrating) {
      if (length === 0 && fallback_fn) {
        fallback2 = branch(() => fallback_fn(anchor));
      }
    } else {
      if (should_defer_append()) {
        var keys2 = /* @__PURE__ */ new Set();
        var batch = (
          /** @type {Batch} */
          current_batch
        );
        for (i = 0; i < length; i += 1) {
          value2 = array[i];
          key4 = get_key(value2, i);
          var existing = (_a6 = state2.items.get(key4)) != null ? _a6 : offscreen_items.get(key4);
          if (existing) {
            if ((flags2 & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0) {
              update_item(existing, value2, i, flags2);
            }
          } else {
            item = create_item(
              null,
              state2,
              null,
              null,
              value2,
              key4,
              i,
              render_fn,
              flags2,
              get_collection,
              true
            );
            offscreen_items.set(key4, item);
          }
          keys2.add(key4);
        }
        for (const [key5, item2] of state2.items) {
          if (!keys2.has(key5)) {
            batch.skipped_effects.add(item2.e);
          }
        }
        batch.add_callback(commit);
      } else {
        commit();
      }
    }
    if (mismatch) {
      set_hydrating(true);
    }
    get2(each_array);
  });
  if (hydrating) {
    anchor = hydrate_node;
  }
}
function reconcile(each_effect, array, state2, offscreen_items, anchor, render_fn, flags2, get_key, get_collection) {
  var _a6, _b4, _c2, _d;
  var is_animated = (flags2 & EACH_IS_ANIMATED) !== 0;
  var should_update = (flags2 & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0;
  var length = array.length;
  var items = state2.items;
  var first = state2.first;
  var current = first;
  var seen;
  var prev = null;
  var to_animate;
  var matched = [];
  var stashed = [];
  var value2;
  var key4;
  var item;
  var i;
  if (is_animated) {
    for (i = 0; i < length; i += 1) {
      value2 = array[i];
      key4 = get_key(value2, i);
      item = items.get(key4);
      if (item !== void 0) {
        (_a6 = item.a) == null ? void 0 : _a6.measure();
        (to_animate != null ? to_animate : to_animate = /* @__PURE__ */ new Set()).add(item);
      }
    }
  }
  for (i = 0; i < length; i += 1) {
    value2 = array[i];
    key4 = get_key(value2, i);
    item = items.get(key4);
    if (item === void 0) {
      var pending2 = offscreen_items.get(key4);
      if (pending2 !== void 0) {
        offscreen_items.delete(key4);
        items.set(key4, pending2);
        var next2 = prev ? prev.next : current;
        link(state2, prev, pending2);
        link(state2, pending2, next2);
        move(pending2, next2, anchor);
        prev = pending2;
      } else {
        var child_anchor = current ? (
          /** @type {TemplateNode} */
          current.e.nodes_start
        ) : anchor;
        prev = create_item(
          child_anchor,
          state2,
          prev,
          prev === null ? state2.first : prev.next,
          value2,
          key4,
          i,
          render_fn,
          flags2,
          get_collection
        );
      }
      items.set(key4, prev);
      matched = [];
      stashed = [];
      current = prev.next;
      continue;
    }
    if (should_update) {
      update_item(item, value2, i, flags2);
    }
    if ((item.e.f & INERT) !== 0) {
      resume_effect(item.e);
      if (is_animated) {
        (_b4 = item.a) == null ? void 0 : _b4.unfix();
        (to_animate != null ? to_animate : to_animate = /* @__PURE__ */ new Set()).delete(item);
      }
    }
    if (item !== current) {
      if (seen !== void 0 && seen.has(item)) {
        if (matched.length < stashed.length) {
          var start = stashed[0];
          var j;
          prev = start.prev;
          var a = matched[0];
          var b = matched[matched.length - 1];
          for (j = 0; j < matched.length; j += 1) {
            move(matched[j], start, anchor);
          }
          for (j = 0; j < stashed.length; j += 1) {
            seen.delete(stashed[j]);
          }
          link(state2, a.prev, b.next);
          link(state2, prev, a);
          link(state2, b, start);
          current = start;
          prev = b;
          i -= 1;
          matched = [];
          stashed = [];
        } else {
          seen.delete(item);
          move(item, current, anchor);
          link(state2, item.prev, item.next);
          link(state2, item, prev === null ? state2.first : prev.next);
          link(state2, prev, item);
          prev = item;
        }
        continue;
      }
      matched = [];
      stashed = [];
      while (current !== null && current.k !== key4) {
        if ((current.e.f & INERT) === 0) {
          (seen != null ? seen : seen = /* @__PURE__ */ new Set()).add(current);
        }
        stashed.push(current);
        current = current.next;
      }
      if (current === null) {
        continue;
      }
      item = current;
    }
    matched.push(item);
    prev = item;
    current = item.next;
  }
  if (current !== null || seen !== void 0) {
    var to_destroy = seen === void 0 ? [] : array_from(seen);
    while (current !== null) {
      if ((current.e.f & INERT) === 0) {
        to_destroy.push(current);
      }
      current = current.next;
    }
    var destroy_length = to_destroy.length;
    if (destroy_length > 0) {
      var controlled_anchor = (flags2 & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
      if (is_animated) {
        for (i = 0; i < destroy_length; i += 1) {
          (_c2 = to_destroy[i].a) == null ? void 0 : _c2.measure();
        }
        for (i = 0; i < destroy_length; i += 1) {
          (_d = to_destroy[i].a) == null ? void 0 : _d.fix();
        }
      }
      pause_effects(state2, to_destroy, controlled_anchor);
    }
  }
  if (is_animated) {
    queue_micro_task(() => {
      var _a7;
      if (to_animate === void 0) return;
      for (item of to_animate) {
        (_a7 = item.a) == null ? void 0 : _a7.apply();
      }
    });
  }
  each_effect.first = state2.first && state2.first.e;
  each_effect.last = prev && prev.e;
  for (var unused of offscreen_items.values()) {
    destroy_effect(unused.e);
  }
  offscreen_items.clear();
}
function update_item(item, value2, index6, type) {
  if ((type & EACH_ITEM_REACTIVE) !== 0) {
    internal_set(item.v, value2);
  }
  if ((type & EACH_INDEX_REACTIVE) !== 0) {
    internal_set(
      /** @type {Value<number>} */
      item.i,
      index6
    );
  } else {
    item.i = index6;
  }
}
function create_item(anchor, state2, prev, next2, value2, key4, index6, render_fn, flags2, get_collection, deferred2) {
  var previous_each_item = current_each_item;
  var reactive2 = (flags2 & EACH_ITEM_REACTIVE) !== 0;
  var mutable = (flags2 & EACH_ITEM_IMMUTABLE) === 0;
  var v = reactive2 ? mutable ? mutable_source(value2, false, false) : source(value2) : value2;
  var i = (flags2 & EACH_INDEX_REACTIVE) === 0 ? index6 : source(index6);
  if (dev_fallback_default && reactive2) {
    v.trace = () => {
      var collection_index = typeof i === "number" ? index6 : i.v;
      get_collection()[collection_index];
    };
  }
  var item = {
    i,
    v,
    k: key4,
    a: null,
    // @ts-expect-error
    e: null,
    prev,
    next: next2
  };
  current_each_item = item;
  try {
    if (anchor === null) {
      var fragment = document.createDocumentFragment();
      fragment.append(anchor = create_text());
    }
    item.e = branch(() => render_fn(
      /** @type {Node} */
      anchor,
      v,
      i,
      get_collection
    ), hydrating);
    item.e.prev = prev && prev.e;
    item.e.next = next2 && next2.e;
    if (prev === null) {
      if (!deferred2) {
        state2.first = item;
      }
    } else {
      prev.next = item;
      prev.e.next = item.e;
    }
    if (next2 !== null) {
      next2.prev = item;
      next2.e.prev = item.e;
    }
    return item;
  } finally {
    current_each_item = previous_each_item;
  }
}
function move(item, next2, anchor) {
  var end = item.next ? (
    /** @type {TemplateNode} */
    item.next.e.nodes_start
  ) : anchor;
  var dest = next2 ? (
    /** @type {TemplateNode} */
    next2.e.nodes_start
  ) : anchor;
  var node = (
    /** @type {TemplateNode} */
    item.e.nodes_start
  );
  while (node !== null && node !== end) {
    var next_node = (
      /** @type {TemplateNode} */
      get_next_sibling(node)
    );
    dest.before(node);
    node = next_node;
  }
}
function link(state2, prev, next2) {
  if (prev === null) {
    state2.first = next2;
  } else {
    prev.next = next2;
    prev.e.next = next2 && next2.e;
  }
  if (next2 !== null) {
    next2.prev = prev;
    next2.e.prev = prev && prev.e;
  }
}
var current_each_item;
var init_each = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/each.js"() {
    init_constants2();
    init_hydration();
    init_operations();
    init_effects();
    init_sources();
    init_utils3();
    init_constants();
    init_task2();
    init_runtime();
    init_esm_env();
    init_deriveds();
    init_batch();
    current_each_item = null;
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/html.js
var init_html = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/html.js"() {
    init_constants2();
    init_effects();
    init_hydration();
    init_reconciler();
    init_template();
    init_warnings2();
    init_utils4();
    init_esm_env();
    init_context();
    init_operations();
    init_runtime();
    init_constants();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/slot.js
var init_slot = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/slot.js"() {
    init_hydration();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js
var init_svelte_component = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js"() {
    init_constants();
    init_effects();
    init_hydration();
    init_branches();
  }
});

// node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js
var init_svelte_element = __esm({
  "node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js"() {
    init_constants2();
    init_hydration();
    init_operations();
    init_effects();
    init_render();
    init_each();
    init_runtime();
    init_context();
    init_esm_env();
    init_constants();
    init_template();
    init_utils4();
    init_branches();
  }
});

// node_modules/svelte/src/internal/client/dom/css.js
function append_styles(anchor, css) {
  effect(() => {
    var _a6;
    var root5 = anchor.getRootNode();
    var target = (
      /** @type {ShadowRoot} */
      root5.host ? (
        /** @type {ShadowRoot} */
        root5
      ) : (
        /** @type {Document} */
        (_a6 = root5.head) != null ? _a6 : (
          /** @type {Document} */
          root5.ownerDocument.head
        )
      )
    );
    if (!target.querySelector("#" + css.hash)) {
      const style = document.createElement("style");
      style.id = css.hash;
      style.textContent = css.code;
      target.appendChild(style);
      if (dev_fallback_default) {
        register_style(css.hash, style);
      }
    }
  });
}
var init_css2 = __esm({
  "node_modules/svelte/src/internal/client/dom/css.js"() {
    init_esm_env();
    init_css();
    init_effects();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/actions.js
var init_actions = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/actions.js"() {
    init_effects();
    init_equality();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/attachments.js
var init_attachments2 = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/attachments.js"() {
    init_effects();
  }
});

// node_modules/svelte/src/escaping.js
var init_escaping = __esm({
  "node_modules/svelte/src/escaping.js"() {
  }
});

// node_modules/clsx/dist/clsx.mjs
var init_clsx = __esm({
  "node_modules/clsx/dist/clsx.mjs"() {
  }
});

// node_modules/svelte/src/internal/shared/attributes.js
function to_class(value2, hash2, directives) {
  var classname = value2 == null ? "" : "" + value2;
  if (hash2) {
    classname = classname ? classname + " " + hash2 : hash2;
  }
  if (directives) {
    for (var key4 in directives) {
      if (directives[key4]) {
        classname = classname ? classname + " " + key4 : key4;
      } else if (classname.length) {
        var len = key4.length;
        var a = 0;
        while ((a = classname.indexOf(key4, a)) >= 0) {
          var b = a + len;
          if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
            classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
          } else {
            a = b;
          }
        }
      }
    }
  }
  return classname === "" ? null : classname;
}
function append_styles2(styles, important = false) {
  var separator = important ? " !important;" : ";";
  var css = "";
  for (var key4 in styles) {
    var value2 = styles[key4];
    if (value2 != null && value2 !== "") {
      css += " " + key4 + ": " + value2 + separator;
    }
  }
  return css;
}
function to_css_name(name) {
  if (name[0] !== "-" || name[1] !== "-") {
    return name.toLowerCase();
  }
  return name;
}
function to_style(value2, styles) {
  if (styles) {
    var new_style = "";
    var normal_styles;
    var important_styles;
    if (Array.isArray(styles)) {
      normal_styles = styles[0];
      important_styles = styles[1];
    } else {
      normal_styles = styles;
    }
    if (value2) {
      value2 = String(value2).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
      var in_str = false;
      var in_apo = 0;
      var in_comment = false;
      var reserved_names = [];
      if (normal_styles) {
        reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
      }
      if (important_styles) {
        reserved_names.push(...Object.keys(important_styles).map(to_css_name));
      }
      var start_index = 0;
      var name_index = -1;
      const len = value2.length;
      for (var i = 0; i < len; i++) {
        var c = value2[i];
        if (in_comment) {
          if (c === "/" && value2[i - 1] === "*") {
            in_comment = false;
          }
        } else if (in_str) {
          if (in_str === c) {
            in_str = false;
          }
        } else if (c === "/" && value2[i + 1] === "*") {
          in_comment = true;
        } else if (c === '"' || c === "'") {
          in_str = c;
        } else if (c === "(") {
          in_apo++;
        } else if (c === ")") {
          in_apo--;
        }
        if (!in_comment && in_str === false && in_apo === 0) {
          if (c === ":" && name_index === -1) {
            name_index = i;
          } else if (c === ";" || i === len - 1) {
            if (name_index !== -1) {
              var name = to_css_name(value2.substring(start_index, name_index).trim());
              if (!reserved_names.includes(name)) {
                if (c !== ";") {
                  i++;
                }
                var property = value2.substring(start_index, i).trim();
                new_style += " " + property + ";";
              }
            }
            start_index = i + 1;
            name_index = -1;
          }
        }
      }
    }
    if (normal_styles) {
      new_style += append_styles2(normal_styles);
    }
    if (important_styles) {
      new_style += append_styles2(important_styles, true);
    }
    new_style = new_style.trim();
    return new_style === "" ? null : new_style;
  }
  return value2 == null ? null : String(value2);
}
var whitespace;
var init_attributes = __esm({
  "node_modules/svelte/src/internal/shared/attributes.js"() {
    init_escaping();
    init_clsx();
    whitespace = [..." 	\n\r\f\xA0\v\uFEFF"];
  }
});

// node_modules/svelte/src/internal/client/dom/elements/class.js
function set_class(dom, is_html, value2, hash2, prev_classes, next_classes) {
  var prev = dom.__className;
  if (hydrating || prev !== value2 || prev === void 0) {
    var next_class_name = to_class(value2, hash2, next_classes);
    if (!hydrating || next_class_name !== dom.getAttribute("class")) {
      if (next_class_name == null) {
        dom.removeAttribute("class");
      } else if (is_html) {
        dom.className = next_class_name;
      } else {
        dom.setAttribute("class", next_class_name);
      }
    }
    dom.__className = value2;
  } else if (next_classes && prev_classes !== next_classes) {
    for (var key4 in next_classes) {
      var is_present = !!next_classes[key4];
      if (prev_classes == null || is_present !== !!prev_classes[key4]) {
        dom.classList.toggle(key4, is_present);
      }
    }
  }
  return next_classes;
}
var init_class = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/class.js"() {
    init_attributes();
    init_hydration();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/style.js
function update_styles(dom, prev = {}, next2, priority) {
  for (var key4 in next2) {
    var value2 = next2[key4];
    if (prev[key4] !== value2) {
      if (next2[key4] == null) {
        dom.style.removeProperty(key4);
      } else {
        dom.style.setProperty(key4, value2, priority);
      }
    }
  }
}
function set_style(dom, value2, prev_styles, next_styles) {
  var prev = dom.__style;
  if (hydrating || prev !== value2) {
    var next_style_attr = to_style(value2, next_styles);
    if (!hydrating || next_style_attr !== dom.getAttribute("style")) {
      if (next_style_attr == null) {
        dom.removeAttribute("style");
      } else {
        dom.style.cssText = next_style_attr;
      }
    }
    dom.__style = value2;
  } else if (next_styles) {
    if (Array.isArray(next_styles)) {
      update_styles(dom, prev_styles == null ? void 0 : prev_styles[0], next_styles[0]);
      update_styles(dom, prev_styles == null ? void 0 : prev_styles[1], next_styles[1], "important");
    } else {
      update_styles(dom, prev_styles, next_styles);
    }
  }
  return next_styles;
}
var init_style = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/style.js"() {
    init_attributes();
    init_hydration();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/select.js
function select_option(select, value2, mounting = false) {
  if (select.multiple) {
    if (value2 == void 0) {
      return;
    }
    if (!is_array(value2)) {
      return select_multiple_invalid_value();
    }
    for (var option of select.options) {
      option.selected = value2.includes(get_option_value(option));
    }
    return;
  }
  for (option of select.options) {
    var option_value = get_option_value(option);
    if (is(option_value, value2)) {
      option.selected = true;
      return;
    }
  }
  if (!mounting || value2 !== void 0) {
    select.selectedIndex = -1;
  }
}
function init_select2(select) {
  var observer = new MutationObserver(() => {
    select_option(select, select.__value);
  });
  observer.observe(select, {
    // Listen to option element changes
    childList: true,
    subtree: true,
    // because of <optgroup>
    // Listen to option element value attribute changes
    // (doesn't get notified of select value changes,
    // because that property is not reflected as an attribute)
    attributes: true,
    attributeFilter: ["value"]
  });
  teardown(() => {
    observer.disconnect();
  });
}
function bind_select_value(select, get4, set2 = get4) {
  var batches2 = /* @__PURE__ */ new WeakSet();
  var mounting = true;
  listen_to_event_and_reset_event(select, "change", (is_reset) => {
    var _a6;
    var query3 = is_reset ? "[selected]" : ":checked";
    var value2;
    if (select.multiple) {
      value2 = [].map.call(select.querySelectorAll(query3), get_option_value);
    } else {
      var selected_option = (_a6 = select.querySelector(query3)) != null ? _a6 : (
        // will fall back to first non-disabled option if no option is selected
        select.querySelector("option:not([disabled])")
      );
      value2 = selected_option && get_option_value(selected_option);
    }
    set2(value2);
    if (current_batch !== null) {
      batches2.add(current_batch);
    }
  });
  effect(() => {
    var _a6;
    var value2 = get4();
    if (select === document.activeElement) {
      var batch = (
        /** @type {Batch} */
        (_a6 = previous_batch) != null ? _a6 : current_batch
      );
      if (batches2.has(batch)) {
        return;
      }
    }
    select_option(select, value2, mounting);
    if (mounting && value2 === void 0) {
      var selected_option = select.querySelector(":checked");
      if (selected_option !== null) {
        value2 = get_option_value(selected_option);
        set2(value2);
      }
    }
    select.__value = value2;
    mounting = false;
  });
  init_select2(select);
}
function get_option_value(option) {
  if ("__value" in option) {
    return option.__value;
  } else {
    return option.value;
  }
}
var init_select = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/select.js"() {
    init_effects();
    init_shared();
    init_proxy();
    init_utils3();
    init_warnings2();
    init_batch();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/attributes.js
function remove_input_defaults(input) {
  if (!hydrating) return;
  var already_removed = false;
  var remove_defaults = () => {
    if (already_removed) return;
    already_removed = true;
    if (input.hasAttribute("value")) {
      var value2 = input.value;
      set_attribute2(input, "value", null);
      input.value = value2;
    }
    if (input.hasAttribute("checked")) {
      var checked = input.checked;
      set_attribute2(input, "checked", null);
      input.checked = checked;
    }
  };
  input.__on_r = remove_defaults;
  queue_micro_task(remove_defaults);
  add_form_reset_listener();
}
function set_attribute2(element2, attribute, value2, skip_warning) {
  var attributes = get_attributes(element2);
  if (hydrating) {
    attributes[attribute] = element2.getAttribute(attribute);
    if (attribute === "src" || attribute === "srcset" || attribute === "href" && element2.nodeName === "LINK") {
      if (!skip_warning) {
        check_src_in_dev_hydration(element2, attribute, value2 != null ? value2 : "");
      }
      return;
    }
  }
  if (attributes[attribute] === (attributes[attribute] = value2)) return;
  if (attribute === "loading") {
    element2[LOADING_ATTR_SYMBOL] = value2;
  }
  if (value2 == null) {
    element2.removeAttribute(attribute);
  } else if (typeof value2 !== "string" && get_setters(element2).includes(attribute)) {
    element2[attribute] = value2;
  } else {
    element2.setAttribute(attribute, value2);
  }
}
function get_attributes(element2) {
  var _a6;
  return (
    /** @type {Record<string | symbol, unknown>} **/
    // @ts-expect-error
    (_a6 = element2.__attributes) != null ? _a6 : element2.__attributes = {
      [IS_CUSTOM_ELEMENT]: element2.nodeName.includes("-"),
      [IS_HTML]: element2.namespaceURI === NAMESPACE_HTML
    }
  );
}
function get_setters(element2) {
  var cache_key = element2.getAttribute("is") || element2.nodeName;
  var setters = setters_cache.get(cache_key);
  if (setters) return setters;
  setters_cache.set(cache_key, setters = []);
  var descriptors;
  var proto = element2;
  var element_proto = Element.prototype;
  while (element_proto !== proto) {
    descriptors = get_descriptors(proto);
    for (var key4 in descriptors) {
      if (descriptors[key4].set) {
        setters.push(key4);
      }
    }
    proto = get_prototype_of(proto);
  }
  return setters;
}
function check_src_in_dev_hydration(element2, attribute, value2) {
  var _a6;
  if (!dev_fallback_default) return;
  if (attribute === "srcset" && srcset_url_equal(element2, value2)) return;
  if (src_url_equal((_a6 = element2.getAttribute(attribute)) != null ? _a6 : "", value2)) return;
  hydration_attribute_changed(
    attribute,
    element2.outerHTML.replace(element2.innerHTML, element2.innerHTML && "..."),
    String(value2)
  );
}
function src_url_equal(element_src, url) {
  if (element_src === url) return true;
  return new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;
}
function split_srcset(srcset) {
  return srcset.split(",").map((src) => src.trim().split(" ").filter(Boolean));
}
function srcset_url_equal(element2, srcset) {
  var element_urls = split_srcset(element2.srcset);
  var urls = split_srcset(srcset);
  return urls.length === element_urls.length && urls.every(
    ([url, width], i) => width === element_urls[i][1] && // We need to test both ways because Vite will create an a full URL with
    // `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the
    // relative URLs inside srcset are not automatically resolved to absolute URLs by
    // browsers (in contrast to img.src). This means both SSR and DOM code could
    // contain relative or absolute URLs.
    (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))
  );
}
var CLASS, STYLE, IS_CUSTOM_ELEMENT, IS_HTML, setters_cache;
var init_attributes2 = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/attributes.js"() {
    init_esm_env();
    init_hydration();
    init_utils3();
    init_events2();
    init_misc();
    init_warnings2();
    init_constants();
    init_task2();
    init_utils4();
    init_runtime();
    init_attachments2();
    init_attributes();
    init_class();
    init_style();
    init_constants2();
    init_effects();
    init_select();
    init_async();
    CLASS = Symbol("class");
    STYLE = Symbol("style");
    IS_CUSTOM_ELEMENT = Symbol("is custom element");
    IS_HTML = Symbol("is html");
    setters_cache = /* @__PURE__ */ new Map();
  }
});

// node_modules/svelte/src/internal/client/timing.js
var init_timing = __esm({
  "node_modules/svelte/src/internal/client/timing.js"() {
    init_utils3();
    init_esm_env();
  }
});

// node_modules/svelte/src/internal/client/loop.js
var init_loop = __esm({
  "node_modules/svelte/src/internal/client/loop.js"() {
    init_timing();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/transitions.js
var init_transitions = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/transitions.js"() {
    init_utils3();
    init_effects();
    init_runtime();
    init_loop();
    init_render();
    init_each();
    init_constants2();
    init_constants();
    init_task2();
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/document.js
var init_document = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/document.js"() {
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
function bind_value(input, get4, set2 = get4) {
  var batches2 = /* @__PURE__ */ new WeakSet();
  listen_to_event_and_reset_event(input, "input", async (is_reset) => {
    if (dev_fallback_default && input.type === "checkbox") {
      bind_invalid_checkbox_value();
    }
    var value2 = is_reset ? input.defaultValue : input.value;
    value2 = is_numberlike_input(input) ? to_number(value2) : value2;
    set2(value2);
    if (current_batch !== null) {
      batches2.add(current_batch);
    }
    await tick();
    if (value2 !== (value2 = get4())) {
      var start = input.selectionStart;
      var end = input.selectionEnd;
      var length = input.value.length;
      input.value = value2 != null ? value2 : "";
      if (end !== null) {
        var new_length = input.value.length;
        if (start === end && end === length && new_length > length) {
          input.selectionStart = new_length;
          input.selectionEnd = new_length;
        } else {
          input.selectionStart = start;
          input.selectionEnd = Math.min(end, new_length);
        }
      }
    }
  });
  if (
    // If we are hydrating and the value has since changed,
    // then use the updated value from the input instead.
    hydrating && input.defaultValue !== input.value || // If defaultValue is set, then value == defaultValue
    // TODO Svelte 6: remove input.value check and set to empty string?
    untrack(get4) == null && input.value
  ) {
    set2(is_numberlike_input(input) ? to_number(input.value) : input.value);
    if (current_batch !== null) {
      batches2.add(current_batch);
    }
  }
  render_effect(() => {
    var _a6;
    if (dev_fallback_default && input.type === "checkbox") {
      bind_invalid_checkbox_value();
    }
    var value2 = get4();
    if (input === document.activeElement) {
      var batch = (
        /** @type {Batch} */
        (_a6 = previous_batch) != null ? _a6 : current_batch
      );
      if (batches2.has(batch)) {
        return;
      }
    }
    if (is_numberlike_input(input) && value2 === to_number(input.value)) {
      return;
    }
    if (input.type === "date" && !value2 && !input.value) {
      return;
    }
    if (value2 !== input.value) {
      input.value = value2 != null ? value2 : "";
    }
  });
}
function bind_checked(input, get4, set2 = get4) {
  listen_to_event_and_reset_event(input, "change", (is_reset) => {
    var value2 = is_reset ? input.defaultChecked : input.checked;
    set2(value2);
  });
  if (
    // If we are hydrating and the value has since changed,
    // then use the update value from the input instead.
    hydrating && input.defaultChecked !== input.checked || // If defaultChecked is set, then checked == defaultChecked
    untrack(get4) == null
  ) {
    set2(input.checked);
  }
  render_effect(() => {
    var value2 = get4();
    input.checked = Boolean(value2);
  });
}
function is_numberlike_input(input) {
  var type = input.type;
  return type === "number" || type === "range";
}
function to_number(value2) {
  return value2 === "" ? null : +value2;
}
var init_input = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/input.js"() {
    init_esm_env();
    init_effects();
    init_shared();
    init_errors2();
    init_proxy();
    init_task2();
    init_hydration();
    init_runtime();
    init_context();
    init_batch();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/media.js
var init_media = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/media.js"() {
    init_effects();
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/navigator.js
var init_navigator = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/navigator.js"() {
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/props.js
var init_props = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/props.js"() {
    init_effects();
    init_utils3();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
var init_size = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/size.js"() {
    init_effects();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
var init_this = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/this.js"() {
    init_constants();
    init_effects();
    init_runtime();
    init_task2();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/universal.js
var init_universal = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/universal.js"() {
    init_effects();
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/bindings/window.js
var init_window = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/bindings/window.js"() {
    init_effects();
    init_shared();
  }
});

// node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js
function init2(immutable = false) {
  const context2 = (
    /** @type {ComponentContextLegacy} */
    component_context
  );
  const callbacks = context2.l.u;
  if (!callbacks) return;
  let props = () => deep_read_state(context2.s);
  if (immutable) {
    let version2 = 0;
    let prev = (
      /** @type {Record<string, any>} */
      {}
    );
    const d = derived(() => {
      let changed = false;
      const props2 = context2.s;
      for (const key4 in props2) {
        if (props2[key4] !== prev[key4]) {
          prev[key4] = props2[key4];
          changed = true;
        }
      }
      if (changed) version2++;
      return version2;
    });
    props = () => get2(d);
  }
  if (callbacks.b.length) {
    user_pre_effect(() => {
      observe_all(context2, props);
      run_all(callbacks.b);
    });
  }
  user_effect(() => {
    const fns = untrack(() => callbacks.m.map(run));
    return () => {
      for (const fn of fns) {
        if (typeof fn === "function") {
          fn();
        }
      }
    };
  });
  if (callbacks.a.length) {
    user_effect(() => {
      observe_all(context2, props);
      run_all(callbacks.a);
    });
  }
}
function observe_all(context2, props) {
  if (context2.l.s) {
    for (const signal of context2.l.s) get2(signal);
  }
  props();
}
var init_lifecycle = __esm({
  "node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js"() {
    init_utils3();
    init_context();
    init_deriveds();
    init_effects();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/dom/legacy/misc.js
function add_legacy_event_listener($$props, event_name, event_callback) {
  var _a6;
  $$props.$$events || ($$props.$$events = {});
  (_a6 = $$props.$$events)[event_name] || (_a6[event_name] = []);
  $$props.$$events[event_name].push(event_callback);
}
function update_legacy_props($$new_props) {
  for (var key4 in $$new_props) {
    if (key4 in this) {
      this[key4] = $$new_props[key4];
    }
  }
}
var init_misc2 = __esm({
  "node_modules/svelte/src/internal/client/dom/legacy/misc.js"() {
    init_sources();
    init_runtime();
    init_utils3();
  }
});

// node_modules/svelte/src/store/utils.js
function subscribe_to_store(store, run2, invalidate) {
  if (store == null) {
    run2(void 0);
    if (invalidate) invalidate(void 0);
    return noop2;
  }
  const unsub = untrack(
    () => store.subscribe(
      run2,
      // @ts-expect-error
      invalidate
    )
  );
  return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
var init_utils5 = __esm({
  "node_modules/svelte/src/store/utils.js"() {
    init_index_client();
    init_utils3();
  }
});

// node_modules/svelte/src/store/shared/index.js
function writable(value2, start = noop2) {
  let stop = null;
  const subscribers = /* @__PURE__ */ new Set();
  function set2(new_value) {
    if (safe_not_equal(value2, new_value)) {
      value2 = new_value;
      if (stop) {
        const run_queue = !subscriber_queue.length;
        for (const subscriber of subscribers) {
          subscriber[1]();
          subscriber_queue.push(subscriber, value2);
        }
        if (run_queue) {
          for (let i = 0; i < subscriber_queue.length; i += 2) {
            subscriber_queue[i][0](subscriber_queue[i + 1]);
          }
          subscriber_queue.length = 0;
        }
      }
    }
  }
  function update2(fn) {
    set2(fn(
      /** @type {T} */
      value2
    ));
  }
  function subscribe(run2, invalidate = noop2) {
    const subscriber = [run2, invalidate];
    subscribers.add(subscriber);
    if (subscribers.size === 1) {
      stop = start(set2, update2) || noop2;
    }
    run2(
      /** @type {T} */
      value2
    );
    return () => {
      subscribers.delete(subscriber);
      if (subscribers.size === 0 && stop) {
        stop();
        stop = null;
      }
    };
  }
  return { set: set2, update: update2, subscribe };
}
function get3(store) {
  let value2;
  subscribe_to_store(store, (_) => value2 = _)();
  return value2;
}
var subscriber_queue;
var init_shared2 = __esm({
  "node_modules/svelte/src/store/shared/index.js"() {
    init_utils3();
    init_equality();
    init_utils5();
    subscriber_queue = [];
  }
});

// node_modules/svelte/src/internal/client/reactivity/store.js
function store_get(store, store_name, stores) {
  var _a6;
  const entry = (_a6 = stores[store_name]) != null ? _a6 : stores[store_name] = {
    store: null,
    source: mutable_source(void 0),
    unsubscribe: noop2
  };
  if (dev_fallback_default) {
    entry.source.label = store_name;
  }
  if (entry.store !== store && !(IS_UNMOUNTED in stores)) {
    entry.unsubscribe();
    entry.store = store != null ? store : null;
    if (store == null) {
      entry.source.v = void 0;
      entry.unsubscribe = noop2;
    } else {
      var is_synchronous_callback = true;
      entry.unsubscribe = subscribe_to_store(store, (v) => {
        if (is_synchronous_callback) {
          entry.source.v = v;
        } else {
          set(entry.source, v);
        }
      });
      is_synchronous_callback = false;
    }
  }
  if (store && IS_UNMOUNTED in stores) {
    return get3(store);
  }
  return get2(entry.source);
}
function store_unsub(store, store_name, stores) {
  let entry = stores[store_name];
  if (entry && entry.store !== store) {
    entry.unsubscribe();
    entry.unsubscribe = noop2;
  }
  return store;
}
function setup_stores() {
  const stores = {};
  function cleanup() {
    teardown(() => {
      for (var store_name in stores) {
        const ref = stores[store_name];
        ref.unsubscribe();
      }
      define_property(stores, IS_UNMOUNTED, {
        enumerable: false,
        value: true
      });
    });
  }
  return [stores, cleanup];
}
function capture_store_binding(fn) {
  var previous_is_store_binding = is_store_binding;
  try {
    is_store_binding = false;
    return [fn(), is_store_binding];
  } finally {
    is_store_binding = previous_is_store_binding;
  }
}
var is_store_binding, IS_UNMOUNTED;
var init_store = __esm({
  "node_modules/svelte/src/internal/client/reactivity/store.js"() {
    init_utils5();
    init_shared2();
    init_utils3();
    init_runtime();
    init_effects();
    init_sources();
    init_esm_env();
    is_store_binding = false;
    IS_UNMOUNTED = Symbol();
  }
});

// node_modules/svelte/src/internal/client/reactivity/props.js
function prop(props, key4, flags2, fallback2) {
  var _a6, _b4;
  var runes = !legacy_mode_flag || (flags2 & PROPS_IS_RUNES) !== 0;
  var bindable = (flags2 & PROPS_IS_BINDABLE) !== 0;
  var lazy = (flags2 & PROPS_IS_LAZY_INITIAL) !== 0;
  var fallback_value = (
    /** @type {V} */
    fallback2
  );
  var fallback_dirty = true;
  var get_fallback = () => {
    if (fallback_dirty) {
      fallback_dirty = false;
      fallback_value = lazy ? untrack(
        /** @type {() => V} */
        fallback2
      ) : (
        /** @type {V} */
        fallback2
      );
    }
    return fallback_value;
  };
  var setter;
  if (bindable) {
    var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
    setter = (_b4 = (_a6 = get_descriptor(props, key4)) == null ? void 0 : _a6.set) != null ? _b4 : is_entry_props && key4 in props ? (v) => props[key4] = v : void 0;
  }
  var initial_value;
  var is_store_sub = false;
  if (bindable) {
    [initial_value, is_store_sub] = capture_store_binding(() => (
      /** @type {V} */
      props[key4]
    ));
  } else {
    initial_value = /** @type {V} */
    props[key4];
  }
  if (initial_value === void 0 && fallback2 !== void 0) {
    initial_value = get_fallback();
    if (setter) {
      if (runes) props_invalid_value(key4);
      setter(initial_value);
    }
  }
  var getter;
  if (runes) {
    getter = () => {
      var value2 = (
        /** @type {V} */
        props[key4]
      );
      if (value2 === void 0) return get_fallback();
      fallback_dirty = true;
      return value2;
    };
  } else {
    getter = () => {
      var value2 = (
        /** @type {V} */
        props[key4]
      );
      if (value2 !== void 0) {
        fallback_value = /** @type {V} */
        void 0;
      }
      return value2 === void 0 ? fallback_value : value2;
    };
  }
  if (runes && (flags2 & PROPS_IS_UPDATED) === 0) {
    return getter;
  }
  if (setter) {
    var legacy_parent = props.$$legacy;
    return (
      /** @type {() => V} */
      function(value2, mutation) {
        if (arguments.length > 0) {
          if (!runes || !mutation || legacy_parent || is_store_sub) {
            setter(mutation ? getter() : value2);
          }
          return value2;
        }
        return getter();
      }
    );
  }
  var overridden = false;
  var d = ((flags2 & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {
    overridden = false;
    return getter();
  });
  if (dev_fallback_default) {
    d.label = key4;
  }
  if (bindable) get2(d);
  var parent_effect = (
    /** @type {Effect} */
    active_effect
  );
  return (
    /** @type {() => V} */
    function(value2, mutation) {
      if (arguments.length > 0) {
        const new_value = mutation ? get2(d) : runes && bindable ? proxy(value2) : value2;
        set(d, new_value);
        overridden = true;
        if (fallback_value !== void 0) {
          fallback_value = new_value;
        }
        return value2;
      }
      if (is_destroying_effect && overridden || (parent_effect.f & DESTROYED) !== 0) {
        return d.v;
      }
      return get2(d);
    }
  );
}
var init_props2 = __esm({
  "node_modules/svelte/src/internal/client/reactivity/props.js"() {
    init_esm_env();
    init_constants2();
    init_utils3();
    init_sources();
    init_deriveds();
    init_runtime();
    init_errors2();
    init_constants();
    init_proxy();
    init_store();
    init_flags();
  }
});

// node_modules/svelte/src/internal/client/validate.js
var init_validate3 = __esm({
  "node_modules/svelte/src/internal/client/validate.js"() {
    init_context();
    init_utils3();
    init_errors2();
    init_constants2();
    init_effects();
    init_warnings2();
    init_store();
  }
});

// node_modules/svelte/src/internal/client/dom/elements/custom-element.js
function get_custom_element_value(prop2, value2, props_definition, transform2) {
  var _a6;
  const type = (_a6 = props_definition[prop2]) == null ? void 0 : _a6.type;
  value2 = type === "Boolean" && typeof value2 !== "boolean" ? value2 != null : value2;
  if (!transform2 || !props_definition[prop2]) {
    return value2;
  } else if (transform2 === "toAttribute") {
    switch (type) {
      case "Object":
      case "Array":
        return value2 == null ? null : JSON.stringify(value2);
      case "Boolean":
        return value2 ? "" : null;
      case "Number":
        return value2 == null ? null : value2;
      default:
        return value2;
    }
  } else {
    switch (type) {
      case "Object":
      case "Array":
        return value2 && JSON.parse(value2);
      case "Boolean":
        return value2;
      // conversion already handled above
      case "Number":
        return value2 != null ? +value2 : value2;
      default:
        return value2;
    }
  }
}
function get_custom_elements_slots(element2) {
  const result = {};
  element2.childNodes.forEach((node) => {
    result[
      /** @type {Element} node */
      node.slot || "default"
    ] = true;
  });
  return result;
}
var SvelteElement;
var init_custom_element = __esm({
  "node_modules/svelte/src/internal/client/dom/elements/custom-element.js"() {
    init_legacy_client();
    init_effects();
    init_template();
    init_utils3();
    if (typeof HTMLElement === "function") {
      SvelteElement = class extends HTMLElement {
        /**
         * @param {*} $$componentCtor
         * @param {*} $$slots
         * @param {*} use_shadow_dom
         */
        constructor($$componentCtor, $$slots, use_shadow_dom) {
          super();
          /** The Svelte component constructor */
          __publicField(this, "$$ctor");
          /** Slots */
          __publicField(this, "$$s");
          /** @type {any} The Svelte component instance */
          __publicField(this, "$$c");
          /** Whether or not the custom element is connected */
          __publicField(this, "$$cn", false);
          /** @type {Record<string, any>} Component props data */
          __publicField(this, "$$d", {});
          /** `true` if currently in the process of reflecting component props back to attributes */
          __publicField(this, "$$r", false);
          /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
          __publicField(this, "$$p_d", {});
          /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
          __publicField(this, "$$l", {});
          /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
          __publicField(this, "$$l_u", /* @__PURE__ */ new Map());
          /** @type {any} The managed render effect for reflecting attributes */
          __publicField(this, "$$me");
          this.$$ctor = $$componentCtor;
          this.$$s = $$slots;
          if (use_shadow_dom) {
            this.attachShadow({ mode: "open" });
          }
        }
        /**
         * @param {string} type
         * @param {EventListenerOrEventListenerObject} listener
         * @param {boolean | AddEventListenerOptions} [options]
         */
        addEventListener(type, listener, options) {
          this.$$l[type] = this.$$l[type] || [];
          this.$$l[type].push(listener);
          if (this.$$c) {
            const unsub = this.$$c.$on(type, listener);
            this.$$l_u.set(listener, unsub);
          }
          super.addEventListener(type, listener, options);
        }
        /**
         * @param {string} type
         * @param {EventListenerOrEventListenerObject} listener
         * @param {boolean | AddEventListenerOptions} [options]
         */
        removeEventListener(type, listener, options) {
          super.removeEventListener(type, listener, options);
          if (this.$$c) {
            const unsub = this.$$l_u.get(listener);
            if (unsub) {
              unsub();
              this.$$l_u.delete(listener);
            }
          }
        }
        async connectedCallback() {
          this.$$cn = true;
          if (!this.$$c) {
            let create_slot = function(name) {
              return (anchor) => {
                const slot2 = document.createElement("slot");
                if (name !== "default") slot2.name = name;
                append(anchor, slot2);
              };
            };
            await Promise.resolve();
            if (!this.$$cn || this.$$c) {
              return;
            }
            const $$slots = {};
            const existing_slots = get_custom_elements_slots(this);
            for (const name of this.$$s) {
              if (name in existing_slots) {
                if (name === "default" && !this.$$d.children) {
                  this.$$d.children = create_slot(name);
                  $$slots.default = true;
                } else {
                  $$slots[name] = create_slot(name);
                }
              }
            }
            for (const attribute of this.attributes) {
              const name = this.$$g_p(attribute.name);
              if (!(name in this.$$d)) {
                this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
              }
            }
            for (const key4 in this.$$p_d) {
              if (!(key4 in this.$$d) && this[key4] !== void 0) {
                this.$$d[key4] = this[key4];
                delete this[key4];
              }
            }
            this.$$c = createClassComponent({
              component: this.$$ctor,
              target: this.shadowRoot || this,
              props: {
                ...this.$$d,
                $$slots,
                $$host: this
              }
            });
            this.$$me = effect_root(() => {
              render_effect(() => {
                var _a6;
                this.$$r = true;
                for (const key4 of object_keys(this.$$c)) {
                  if (!((_a6 = this.$$p_d[key4]) == null ? void 0 : _a6.reflect)) continue;
                  this.$$d[key4] = this.$$c[key4];
                  const attribute_value = get_custom_element_value(
                    key4,
                    this.$$d[key4],
                    this.$$p_d,
                    "toAttribute"
                  );
                  if (attribute_value == null) {
                    this.removeAttribute(this.$$p_d[key4].attribute || key4);
                  } else {
                    this.setAttribute(this.$$p_d[key4].attribute || key4, attribute_value);
                  }
                }
                this.$$r = false;
              });
            });
            for (const type in this.$$l) {
              for (const listener of this.$$l[type]) {
                const unsub = this.$$c.$on(type, listener);
                this.$$l_u.set(listener, unsub);
              }
            }
            this.$$l = {};
          }
        }
        // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
        // and setting attributes through setAttribute etc, this is helpful
        /**
         * @param {string} attr
         * @param {string} _oldValue
         * @param {string} newValue
         */
        attributeChangedCallback(attr2, _oldValue, newValue) {
          var _a6;
          if (this.$$r) return;
          attr2 = this.$$g_p(attr2);
          this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp");
          (_a6 = this.$$c) == null ? void 0 : _a6.$set({ [attr2]: this.$$d[attr2] });
        }
        disconnectedCallback() {
          this.$$cn = false;
          Promise.resolve().then(() => {
            if (!this.$$cn && this.$$c) {
              this.$$c.$destroy();
              this.$$me();
              this.$$c = void 0;
            }
          });
        }
        /**
         * @param {string} attribute_name
         */
        $$g_p(attribute_name) {
          return object_keys(this.$$p_d).find(
            (key4) => this.$$p_d[key4].attribute === attribute_name || !this.$$p_d[key4].attribute && key4.toLowerCase() === attribute_name
          ) || attribute_name;
        }
      };
    }
  }
});

// node_modules/svelte/src/internal/client/dev/console-log.js
var init_console_log = __esm({
  "node_modules/svelte/src/internal/client/dev/console-log.js"() {
    init_constants();
    init_clone();
    init_warnings2();
    init_runtime();
  }
});

// node_modules/svelte/src/internal/client/index.js
var init_client = __esm({
  "node_modules/svelte/src/internal/client/index.js"() {
    init_attachments();
    init_constants2();
    init_context();
    init_assign();
    init_css();
    init_elements();
    init_hmr();
    init_ownership();
    init_legacy3();
    init_tracing();
    init_inspect();
    init_async2();
    init_validation();
    init_await();
    init_if();
    init_key();
    init_css_props();
    init_each();
    init_html();
    init_slot();
    init_snippet();
    init_svelte_component();
    init_svelte_element();
    init_svelte_head();
    init_css2();
    init_actions();
    init_attachments2();
    init_attributes2();
    init_class();
    init_events2();
    init_misc();
    init_style();
    init_transitions();
    init_document();
    init_input();
    init_media();
    init_navigator();
    init_props();
    init_select();
    init_size();
    init_this();
    init_universal();
    init_window();
    init_hydration();
    init_event_modifiers();
    init_lifecycle();
    init_misc2();
    init_template();
    init_async();
    init_batch();
    init_deriveds();
    init_effects();
    init_sources();
    init_props2();
    init_store();
    init_boundary();
    init_legacy();
    init_render();
    init_runtime();
    init_validate3();
    init_timing();
    init_proxy();
    init_custom_element();
    init_operations();
    init_attributes();
    init_clone();
    init_utils3();
    init_validate2();
    init_equality2();
    init_console_log();
    init_error_handling();
  }
});

// src/svelte/Info.svelte
function Info($$anchor, $$props) {
  if (new.target) return createClassComponent({ component: Info, ...$$anchor });
  push($$props, false);
  append_styles($$anchor, $$css);
  const t2 = mutable_source();
  var _a6 = mutable_source();
  let plugin2 = prop($$props, "plugin", 12);
  legacy_pre_effect(() => (safe_get(_a6), deep_read_state(plugin2())), () => {
    set(t2, (set(_a6, plugin2() === null || plugin2() === void 0 ? void 0 : plugin2().i18n) === null || safe_get(_a6) === void 0 ? void 0 : safe_get(_a6).t) || ((key4) => key4));
  });
  legacy_pre_effect_reset();
  var $$exports = {
    get plugin() {
      return plugin2();
    },
    set plugin($$value) {
      plugin2($$value);
      flushSync();
    },
    $set: update_legacy_props,
    $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb)
  };
  init2();
  var div = root();
  var text3 = child(div);
  next(5);
  reset(div);
  template_effect(($0) => set_text(text3, `${$0 != null ? $0 : ""} `), [
    () => (get2(t2), untrack(() => get2(t2)("info.service_description")))
  ]);
  append($$anchor, div);
  return pop2($$exports);
}
var root, $$css;
var init_Info = __esm({
  "src/svelte/Info.svelte"() {
    "use strict";
    init_legacy_client();
    init_disclose_version();
    init_legacy2();
    init_client();
    init_main();
    root = from_html(`<div class="mdf-info svelte-m7tqwz"> <br/> <br/> <a href="https://mdfriday.com" target="_blank"><img src="https://gohugo.net/mdfriday.svg" alt="MDFriday" width="20" height="20"/></a></div>`);
    $$css = {
      hash: "svelte-m7tqwz",
      code: ".mdf-info.svelte-m7tqwz {font-size:0.9em;text-align:center;}"
    };
  }
});

// src/svelte/ProgressBar.svelte
function ProgressBar($$anchor, $$props) {
  if (new.target) return createClassComponent({ component: ProgressBar, ...$$anchor });
  push($$props, false);
  append_styles($$anchor, $$css2);
  let progress = prop($$props, "progress", 12, 0);
  var $$exports = {
    get progress() {
      return progress();
    },
    set progress($$value) {
      progress($$value);
      flushSync();
    },
    $set: update_legacy_props,
    $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb)
  };
  var div = root2();
  var div_1 = child(div);
  reset(div);
  template_effect(() => {
    var _a6;
    return set_style(div_1, `width: ${(_a6 = progress()) != null ? _a6 : ""}%`);
  });
  append($$anchor, div);
  return pop2($$exports);
}
var root2, $$css2;
var init_ProgressBar = __esm({
  "src/svelte/ProgressBar.svelte"() {
    "use strict";
    init_legacy_client();
    init_disclose_version();
    init_legacy2();
    init_client();
    root2 = from_html(`<div class="progress-container svelte-1gahl8f"><div class="progress-bar svelte-1gahl8f"></div></div>`);
    $$css2 = {
      hash: "svelte-1gahl8f",
      code: ".progress-container.svelte-1gahl8f {width:100%;              /* \u8FDB\u5EA6\u6761\u5360\u636E\u7236\u5143\u7D20\u7684\u5BBD\u5EA6 */background-color:#e0e0e0; /* \u5916\u90E8\u80CC\u666F\uFF0C\u6D45\u7070\u8272 */border-radius:8px;        /* \u5706\u89D2\u8FB9\u6846 */height:10px;              /* \u9AD8\u5EA6\u8BBE\u7F6E\u4E3A 20px */margin-top:10px;          /* \u4E0E\u4E0A\u65B9\u5185\u5BB9\u7559\u51FA\u95F4\u8DDD */overflow:hidden;          /* \u5706\u89D2\u65F6\u907F\u514D\u5185\u90E8\u5185\u5BB9\u6EA2\u51FA */position:relative;}.progress-bar.svelte-1gahl8f {height:10px;background-color:rgb(124 58 237);transition:width 0.4s ease; /* \u5E73\u6ED1\u8FC7\u6E21\u52A8\u753B\uFF0C\u8868\u793A\u8FDB\u5EA6 */position:absolute;         /* \u8BBE\u7F6E\u4E3A\u7EDD\u5BF9\u5B9A\u4F4D */top:0;                     /* \u786E\u4FDD\u4ECE\u5BB9\u5668\u9876\u90E8\u5F00\u59CB */left:0;                    /* \u786E\u4FDD\u4ECE\u5BB9\u5668\u5DE6\u4FA7\u5F00\u59CB */}"
    };
  }
});

// node_modules/jszip/dist/jszip.min.js
var require_jszip_min = __commonJS({
  "node_modules/jszip/dist/jszip.min.js"(exports2, module2) {
    !function(e2) {
      if ("object" == typeof exports2 && "undefined" != typeof module2) module2.exports = e2();
      else if ("function" == typeof define && define.amd) define([], e2);
      else {
        ("undefined" != typeof window ? window : "undefined" != typeof window ? window : "undefined" != typeof self ? self : this).JSZip = e2();
      }
    }(function() {
      return function s(a, o, h2) {
        function u(r, e3) {
          if (!o[r]) {
            if (!a[r]) {
              var t2 = "function" == typeof require && require;
              if (!e3 && t2) return t2(r, true);
              if (l) return l(r, true);
              var n3 = new Error("Cannot find module '" + r + "'");
              throw n3.code = "MODULE_NOT_FOUND", n3;
            }
            var i = o[r] = { exports: {} };
            a[r][0].call(i.exports, function(e4) {
              var t3 = a[r][1][e4];
              return u(t3 || e4);
            }, i, i.exports, s, a, o, h2);
          }
          return o[r].exports;
        }
        for (var l = "function" == typeof require && require, e2 = 0; e2 < h2.length; e2++) u(h2[e2]);
        return u;
      }({ 1: [function(e2, t2, r) {
        "use strict";
        var d = e2("./utils"), c = e2("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        r.encode = function(e3) {
          for (var t3, r3, n3, i, s, a, o, h2 = [], u = 0, l = e3.length, f3 = l, c3 = "string" !== d.getTypeOf(e3); u < e3.length; ) f3 = l - u, n3 = c3 ? (t3 = e3[u++], r3 = u < l ? e3[u++] : 0, u < l ? e3[u++] : 0) : (t3 = e3.charCodeAt(u++), r3 = u < l ? e3.charCodeAt(u++) : 0, u < l ? e3.charCodeAt(u++) : 0), i = t3 >> 2, s = (3 & t3) << 4 | r3 >> 4, a = 1 < f3 ? (15 & r3) << 2 | n3 >> 6 : 64, o = 2 < f3 ? 63 & n3 : 64, h2.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o));
          return h2.join("");
        }, r.decode = function(e3) {
          var t3, r3, n3, i, s, a, o = 0, h2 = 0, u = "data:";
          if (e3.substr(0, u.length) === u) throw new Error("Invalid base64 input, it looks like a data url.");
          var l, f3 = 3 * (e3 = e3.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
          if (e3.charAt(e3.length - 1) === p.charAt(64) && f3--, e3.charAt(e3.length - 2) === p.charAt(64) && f3--, f3 % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
          for (l = c.uint8array ? new Uint8Array(0 | f3) : new Array(0 | f3); o < e3.length; ) t3 = p.indexOf(e3.charAt(o++)) << 2 | (i = p.indexOf(e3.charAt(o++))) >> 4, r3 = (15 & i) << 4 | (s = p.indexOf(e3.charAt(o++))) >> 2, n3 = (3 & s) << 6 | (a = p.indexOf(e3.charAt(o++))), l[h2++] = t3, 64 !== s && (l[h2++] = r3), 64 !== a && (l[h2++] = n3);
          return l;
        };
      }, { "./support": 30, "./utils": 32 }], 2: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./external"), i = e2("./stream/DataWorker"), s = e2("./stream/Crc32Probe"), a = e2("./stream/DataLengthProbe");
        function o(e3, t3, r3, n4, i2) {
          this.compressedSize = e3, this.uncompressedSize = t3, this.crc32 = r3, this.compression = n4, this.compressedContent = i2;
        }
        o.prototype = { getContentWorker: function() {
          var e3 = new i(n3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t3 = this;
          return e3.on("end", function() {
            if (this.streamInfo.data_length !== t3.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
          }), e3;
        }, getCompressedWorker: function() {
          return new i(n3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
        } }, o.createWorkerFrom = function(e3, t3, r3) {
          return e3.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t3.compressWorker(r3)).pipe(new a("compressedSize")).withStreamInfo("compression", t3);
        }, t2.exports = o;
      }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./stream/GenericWorker");
        r.STORE = { magic: "\0\0", compressWorker: function() {
          return new n3("STORE compression");
        }, uncompressWorker: function() {
          return new n3("STORE decompression");
        } }, r.DEFLATE = e2("./flate");
      }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./utils");
        var o = function() {
          for (var e3, t3 = [], r3 = 0; r3 < 256; r3++) {
            e3 = r3;
            for (var n4 = 0; n4 < 8; n4++) e3 = 1 & e3 ? 3988292384 ^ e3 >>> 1 : e3 >>> 1;
            t3[r3] = e3;
          }
          return t3;
        }();
        t2.exports = function(e3, t3) {
          return void 0 !== e3 && e3.length ? "string" !== n3.getTypeOf(e3) ? function(e4, t4, r3, n4) {
            var i = o, s = n4 + r3;
            e4 ^= -1;
            for (var a = n4; a < s; a++) e4 = e4 >>> 8 ^ i[255 & (e4 ^ t4[a])];
            return -1 ^ e4;
          }(0 | t3, e3, e3.length, 0) : function(e4, t4, r3, n4) {
            var i = o, s = n4 + r3;
            e4 ^= -1;
            for (var a = n4; a < s; a++) e4 = e4 >>> 8 ^ i[255 & (e4 ^ t4.charCodeAt(a))];
            return -1 ^ e4;
          }(0 | t3, e3, e3.length, 0) : 0;
        };
      }, { "./utils": 32 }], 5: [function(e2, t2, r) {
        "use strict";
        r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null;
      }, {}], 6: [function(e2, t2, r) {
        "use strict";
        var n3 = null;
        n3 = "undefined" != typeof Promise ? Promise : e2("lie"), t2.exports = { Promise: n3 };
      }, { lie: 37 }], 7: [function(e2, t2, r) {
        "use strict";
        var n3 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e2("pako"), s = e2("./utils"), a = e2("./stream/GenericWorker"), o = n3 ? "uint8array" : "array";
        function h2(e3, t3) {
          a.call(this, "FlateWorker/" + e3), this._pako = null, this._pakoAction = e3, this._pakoOptions = t3, this.meta = {};
        }
        r.magic = "\b\0", s.inherits(h2, a), h2.prototype.processChunk = function(e3) {
          this.meta = e3.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e3.data), false);
        }, h2.prototype.flush = function() {
          a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
        }, h2.prototype.cleanUp = function() {
          a.prototype.cleanUp.call(this), this._pako = null;
        }, h2.prototype._createPako = function() {
          this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
          var t3 = this;
          this._pako.onData = function(e3) {
            t3.push({ data: e3, meta: t3.meta });
          };
        }, r.compressWorker = function(e3) {
          return new h2("Deflate", e3);
        }, r.uncompressWorker = function() {
          return new h2("Inflate", {});
        };
      }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e2, t2, r) {
        "use strict";
        function A(e3, t3) {
          var r3, n4 = "";
          for (r3 = 0; r3 < t3; r3++) n4 += String.fromCharCode(255 & e3), e3 >>>= 8;
          return n4;
        }
        function n3(e3, t3, r3, n4, i2, s2) {
          var a, o, h2 = e3.file, u = e3.compression, l = s2 !== O.utf8encode, f3 = I.transformTo("string", s2(h2.name)), c = I.transformTo("string", O.utf8encode(h2.name)), d = h2.comment, p = I.transformTo("string", s2(d)), m2 = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h2.name.length, g = m2.length !== d.length, b = "", v = "", y = "", w2 = h2.dir, k = h2.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
          t3 && !r3 || (x.crc32 = e3.crc32, x.compressedSize = e3.compressedSize, x.uncompressedSize = e3.uncompressedSize);
          var S = 0;
          t3 && (S |= 8), l || !_ && !g || (S |= 2048);
          var z = 0, C = 0;
          w2 && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e4, t4) {
            var r4 = e4;
            return e4 || (r4 = t4 ? 16893 : 33204), (65535 & r4) << 16;
          }(h2.unixPermissions, w2)) : (C = 20, z |= function(e4) {
            return 63 & (e4 || 0);
          }(h2.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f3), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m2, b += "uc" + A(y.length, 2) + y);
          var E = "";
          return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f3.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f3 + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n4, 4) + f3 + b + p };
        }
        var I = e2("../utils"), i = e2("../stream/GenericWorker"), O = e2("../utf8"), B = e2("../crc32"), R = e2("../signature");
        function s(e3, t3, r3, n4) {
          i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t3, this.zipPlatform = r3, this.encodeFileName = n4, this.streamFiles = e3, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
        }
        I.inherits(s, i), s.prototype.push = function(e3) {
          var t3 = e3.meta.percent || 0, r3 = this.entriesCount, n4 = this._sources.length;
          this.accumulate ? this.contentBuffer.push(e3) : (this.bytesWritten += e3.data.length, i.prototype.push.call(this, { data: e3.data, meta: { currentFile: this.currentFile, percent: r3 ? (t3 + 100 * (r3 - n4 - 1)) / r3 : 100 } }));
        }, s.prototype.openedSource = function(e3) {
          this.currentSourceOffset = this.bytesWritten, this.currentFile = e3.file.name;
          var t3 = this.streamFiles && !e3.file.dir;
          if (t3) {
            var r3 = n3(e3, t3, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
            this.push({ data: r3.fileRecord, meta: { percent: 0 } });
          } else this.accumulate = true;
        }, s.prototype.closedSource = function(e3) {
          this.accumulate = false;
          var t3 = this.streamFiles && !e3.file.dir, r3 = n3(e3, t3, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
          if (this.dirRecords.push(r3.dirRecord), t3) this.push({ data: function(e4) {
            return R.DATA_DESCRIPTOR + A(e4.crc32, 4) + A(e4.compressedSize, 4) + A(e4.uncompressedSize, 4);
          }(e3), meta: { percent: 100 } });
          else for (this.push({ data: r3.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
          this.currentFile = null;
        }, s.prototype.flush = function() {
          for (var e3 = this.bytesWritten, t3 = 0; t3 < this.dirRecords.length; t3++) this.push({ data: this.dirRecords[t3], meta: { percent: 100 } });
          var r3 = this.bytesWritten - e3, n4 = function(e4, t4, r4, n5, i2) {
            var s2 = I.transformTo("string", i2(n5));
            return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e4, 2) + A(e4, 2) + A(t4, 4) + A(r4, 4) + A(s2.length, 2) + s2;
          }(this.dirRecords.length, r3, e3, this.zipComment, this.encodeFileName);
          this.push({ data: n4, meta: { percent: 100 } });
        }, s.prototype.prepareNextSource = function() {
          this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
        }, s.prototype.registerPrevious = function(e3) {
          this._sources.push(e3);
          var t3 = this;
          return e3.on("data", function(e4) {
            t3.processChunk(e4);
          }), e3.on("end", function() {
            t3.closedSource(t3.previous.streamInfo), t3._sources.length ? t3.prepareNextSource() : t3.end();
          }), e3.on("error", function(e4) {
            t3.error(e4);
          }), this;
        }, s.prototype.resume = function() {
          return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true));
        }, s.prototype.error = function(e3) {
          var t3 = this._sources;
          if (!i.prototype.error.call(this, e3)) return false;
          for (var r3 = 0; r3 < t3.length; r3++) try {
            t3[r3].error(e3);
          } catch (e4) {
          }
          return true;
        }, s.prototype.lock = function() {
          i.prototype.lock.call(this);
          for (var e3 = this._sources, t3 = 0; t3 < e3.length; t3++) e3[t3].lock();
        }, t2.exports = s;
      }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e2, t2, r) {
        "use strict";
        var u = e2("../compressions"), n3 = e2("./ZipFileWorker");
        r.generateWorker = function(e3, a, t3) {
          var o = new n3(a.streamFiles, t3, a.platform, a.encodeFileName), h2 = 0;
          try {
            e3.forEach(function(e4, t4) {
              h2++;
              var r3 = function(e5, t5) {
                var r4 = e5 || t5, n5 = u[r4];
                if (!n5) throw new Error(r4 + " is not a valid compression method !");
                return n5;
              }(t4.options.compression, a.compression), n4 = t4.options.compressionOptions || a.compressionOptions || {}, i = t4.dir, s = t4.date;
              t4._compressWorker(r3, n4).withStreamInfo("file", { name: e4, dir: i, date: s, comment: t4.comment || "", unixPermissions: t4.unixPermissions, dosPermissions: t4.dosPermissions }).pipe(o);
            }), o.entriesCount = h2;
          } catch (e4) {
            o.error(e4);
          }
          return o;
        };
      }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e2, t2, r) {
        "use strict";
        function n3() {
          if (!(this instanceof n3)) return new n3();
          if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
          this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
            var e3 = new n3();
            for (var t3 in this) "function" != typeof this[t3] && (e3[t3] = this[t3]);
            return e3;
          };
        }
        (n3.prototype = e2("./object")).loadAsync = e2("./load"), n3.support = e2("./support"), n3.defaults = e2("./defaults"), n3.version = "3.10.1", n3.loadAsync = function(e3, t3) {
          return new n3().loadAsync(e3, t3);
        }, n3.external = e2("./external"), t2.exports = n3;
      }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e2, t2, r) {
        "use strict";
        var u = e2("./utils"), i = e2("./external"), n3 = e2("./utf8"), s = e2("./zipEntries"), a = e2("./stream/Crc32Probe"), l = e2("./nodejsUtils");
        function f3(n4) {
          return new i.Promise(function(e3, t3) {
            var r3 = n4.decompressed.getContentWorker().pipe(new a());
            r3.on("error", function(e4) {
              t3(e4);
            }).on("end", function() {
              r3.streamInfo.crc32 !== n4.decompressed.crc32 ? t3(new Error("Corrupted zip : CRC32 mismatch")) : e3();
            }).resume();
          });
        }
        t2.exports = function(e3, o) {
          var h2 = this;
          return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n3.utf8decode }), l.isNode && l.isStream(e3) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e3, true, o.optimizedBinaryString, o.base64).then(function(e4) {
            var t3 = new s(o);
            return t3.load(e4), t3;
          }).then(function(e4) {
            var t3 = [i.Promise.resolve(e4)], r3 = e4.files;
            if (o.checkCRC32) for (var n4 = 0; n4 < r3.length; n4++) t3.push(f3(r3[n4]));
            return i.Promise.all(t3);
          }).then(function(e4) {
            for (var t3 = e4.shift(), r3 = t3.files, n4 = 0; n4 < r3.length; n4++) {
              var i2 = r3[n4], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr);
              h2.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h2.file(a2).unsafeOriginalName = s2);
            }
            return t3.zipComment.length && (h2.comment = t3.zipComment), h2;
          });
        };
      }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("../utils"), i = e2("../stream/GenericWorker");
        function s(e3, t3) {
          i.call(this, "Nodejs stream input adapter for " + e3), this._upstreamEnded = false, this._bindStream(t3);
        }
        n3.inherits(s, i), s.prototype._bindStream = function(e3) {
          var t3 = this;
          (this._stream = e3).pause(), e3.on("data", function(e4) {
            t3.push({ data: e4, meta: { percent: 0 } });
          }).on("error", function(e4) {
            t3.isPaused ? this.generatedError = e4 : t3.error(e4);
          }).on("end", function() {
            t3.isPaused ? t3._upstreamEnded = true : t3.end();
          });
        }, s.prototype.pause = function() {
          return !!i.prototype.pause.call(this) && (this._stream.pause(), true);
        }, s.prototype.resume = function() {
          return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
        }, t2.exports = s;
      }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e2, t2, r) {
        "use strict";
        var i = e2("readable-stream").Readable;
        function n3(e3, t3, r3) {
          i.call(this, t3), this._helper = e3;
          var n4 = this;
          e3.on("data", function(e4, t4) {
            n4.push(e4) || n4._helper.pause(), r3 && r3(t4);
          }).on("error", function(e4) {
            n4.emit("error", e4);
          }).on("end", function() {
            n4.push(null);
          });
        }
        e2("../utils").inherits(n3, i), n3.prototype._read = function() {
          this._helper.resume();
        }, t2.exports = n3;
      }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e2, t2, r) {
        "use strict";
        t2.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e3, t3) {
          if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(e3, t3);
          if ("number" == typeof e3) throw new Error('The "data" argument must not be a number');
          return new Buffer(e3, t3);
        }, allocBuffer: function(e3) {
          if (Buffer.alloc) return Buffer.alloc(e3);
          var t3 = new Buffer(e3);
          return t3.fill(0), t3;
        }, isBuffer: function(e3) {
          return Buffer.isBuffer(e3);
        }, isStream: function(e3) {
          return e3 && "function" == typeof e3.on && "function" == typeof e3.pause && "function" == typeof e3.resume;
        } };
      }, {}], 15: [function(e2, t2, r) {
        "use strict";
        function s(e3, t3, r3) {
          var n4, i2 = u.getTypeOf(t3), s2 = u.extend(r3 || {}, f3);
          s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e3 = g(e3)), s2.createFolders && (n4 = _(e3)) && b.call(this, n4, true);
          var a2 = "string" === i2 && false === s2.binary && false === s2.base64;
          r3 && void 0 !== r3.binary || (s2.binary = !a2), (t3 instanceof c && 0 === t3.uncompressedSize || s2.dir || !t3 || 0 === t3.length) && (s2.base64 = false, s2.binary = true, t3 = "", s2.compression = "STORE", i2 = "string");
          var o2 = null;
          o2 = t3 instanceof c || t3 instanceof l ? t3 : p.isNode && p.isStream(t3) ? new m2(e3, t3) : u.prepareContent(e3, t3, s2.binary, s2.optimizedBinaryString, s2.base64);
          var h3 = new d(e3, o2, s2);
          this.files[e3] = h3;
        }
        var i = e2("./utf8"), u = e2("./utils"), l = e2("./stream/GenericWorker"), a = e2("./stream/StreamHelper"), f3 = e2("./defaults"), c = e2("./compressedObject"), d = e2("./zipObject"), o = e2("./generate"), p = e2("./nodejsUtils"), m2 = e2("./nodejs/NodejsStreamInputAdapter"), _ = function(e3) {
          "/" === e3.slice(-1) && (e3 = e3.substring(0, e3.length - 1));
          var t3 = e3.lastIndexOf("/");
          return 0 < t3 ? e3.substring(0, t3) : "";
        }, g = function(e3) {
          return "/" !== e3.slice(-1) && (e3 += "/"), e3;
        }, b = function(e3, t3) {
          return t3 = void 0 !== t3 ? t3 : f3.createFolders, e3 = g(e3), this.files[e3] || s.call(this, e3, null, { dir: true, createFolders: t3 }), this.files[e3];
        };
        function h2(e3) {
          return "[object RegExp]" === Object.prototype.toString.call(e3);
        }
        var n3 = { load: function() {
          throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
        }, forEach: function(e3) {
          var t3, r3, n4;
          for (t3 in this.files) n4 = this.files[t3], (r3 = t3.slice(this.root.length, t3.length)) && t3.slice(0, this.root.length) === this.root && e3(r3, n4);
        }, filter: function(r3) {
          var n4 = [];
          return this.forEach(function(e3, t3) {
            r3(e3, t3) && n4.push(t3);
          }), n4;
        }, file: function(e3, t3, r3) {
          if (1 !== arguments.length) return e3 = this.root + e3, s.call(this, e3, t3, r3), this;
          if (h2(e3)) {
            var n4 = e3;
            return this.filter(function(e4, t4) {
              return !t4.dir && n4.test(e4);
            });
          }
          var i2 = this.files[this.root + e3];
          return i2 && !i2.dir ? i2 : null;
        }, folder: function(r3) {
          if (!r3) return this;
          if (h2(r3)) return this.filter(function(e4, t4) {
            return t4.dir && r3.test(e4);
          });
          var e3 = this.root + r3, t3 = b.call(this, e3), n4 = this.clone();
          return n4.root = t3.name, n4;
        }, remove: function(r3) {
          r3 = this.root + r3;
          var e3 = this.files[r3];
          if (e3 || ("/" !== r3.slice(-1) && (r3 += "/"), e3 = this.files[r3]), e3 && !e3.dir) delete this.files[r3];
          else for (var t3 = this.filter(function(e4, t4) {
            return t4.name.slice(0, r3.length) === r3;
          }), n4 = 0; n4 < t3.length; n4++) delete this.files[t3[n4].name];
          return this;
        }, generate: function() {
          throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
        }, generateInternalStream: function(e3) {
          var t3, r3 = {};
          try {
            if ((r3 = u.extend(e3 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r3.type.toLowerCase(), r3.compression = r3.compression.toUpperCase(), "binarystring" === r3.type && (r3.type = "string"), !r3.type) throw new Error("No output type specified.");
            u.checkSupport(r3.type), "darwin" !== r3.platform && "freebsd" !== r3.platform && "linux" !== r3.platform && "sunos" !== r3.platform || (r3.platform = "UNIX"), "win32" === r3.platform && (r3.platform = "DOS");
            var n4 = r3.comment || this.comment || "";
            t3 = o.generateWorker(this, r3, n4);
          } catch (e4) {
            (t3 = new l("error")).error(e4);
          }
          return new a(t3, r3.type || "string", r3.mimeType);
        }, generateAsync: function(e3, t3) {
          return this.generateInternalStream(e3).accumulate(t3);
        }, generateNodeStream: function(e3, t3) {
          return (e3 = e3 || {}).type || (e3.type = "nodebuffer"), this.generateInternalStream(e3).toNodejsStream(t3);
        } };
        t2.exports = n3;
      }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e2, t2, r) {
        "use strict";
        t2.exports = e2("stream");
      }, { stream: void 0 }], 17: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./DataReader");
        function i(e3) {
          n3.call(this, e3);
          for (var t3 = 0; t3 < this.data.length; t3++) e3[t3] = 255 & e3[t3];
        }
        e2("../utils").inherits(i, n3), i.prototype.byteAt = function(e3) {
          return this.data[this.zero + e3];
        }, i.prototype.lastIndexOfSignature = function(e3) {
          for (var t3 = e3.charCodeAt(0), r3 = e3.charCodeAt(1), n4 = e3.charCodeAt(2), i2 = e3.charCodeAt(3), s = this.length - 4; 0 <= s; --s) if (this.data[s] === t3 && this.data[s + 1] === r3 && this.data[s + 2] === n4 && this.data[s + 3] === i2) return s - this.zero;
          return -1;
        }, i.prototype.readAndCheckSignature = function(e3) {
          var t3 = e3.charCodeAt(0), r3 = e3.charCodeAt(1), n4 = e3.charCodeAt(2), i2 = e3.charCodeAt(3), s = this.readData(4);
          return t3 === s[0] && r3 === s[1] && n4 === s[2] && i2 === s[3];
        }, i.prototype.readData = function(e3) {
          if (this.checkOffset(e3), 0 === e3) return [];
          var t3 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
          return this.index += e3, t3;
        }, t2.exports = i;
      }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("../utils");
        function i(e3) {
          this.data = e3, this.length = e3.length, this.index = 0, this.zero = 0;
        }
        i.prototype = { checkOffset: function(e3) {
          this.checkIndex(this.index + e3);
        }, checkIndex: function(e3) {
          if (this.length < this.zero + e3 || e3 < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e3 + "). Corrupted zip ?");
        }, setIndex: function(e3) {
          this.checkIndex(e3), this.index = e3;
        }, skip: function(e3) {
          this.setIndex(this.index + e3);
        }, byteAt: function() {
        }, readInt: function(e3) {
          var t3, r3 = 0;
          for (this.checkOffset(e3), t3 = this.index + e3 - 1; t3 >= this.index; t3--) r3 = (r3 << 8) + this.byteAt(t3);
          return this.index += e3, r3;
        }, readString: function(e3) {
          return n3.transformTo("string", this.readData(e3));
        }, readData: function() {
        }, lastIndexOfSignature: function() {
        }, readAndCheckSignature: function() {
        }, readDate: function() {
          var e3 = this.readInt(4);
          return new Date(Date.UTC(1980 + (e3 >> 25 & 127), (e3 >> 21 & 15) - 1, e3 >> 16 & 31, e3 >> 11 & 31, e3 >> 5 & 63, (31 & e3) << 1));
        } }, t2.exports = i;
      }, { "../utils": 32 }], 19: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./Uint8ArrayReader");
        function i(e3) {
          n3.call(this, e3);
        }
        e2("../utils").inherits(i, n3), i.prototype.readData = function(e3) {
          this.checkOffset(e3);
          var t3 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
          return this.index += e3, t3;
        }, t2.exports = i;
      }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./DataReader");
        function i(e3) {
          n3.call(this, e3);
        }
        e2("../utils").inherits(i, n3), i.prototype.byteAt = function(e3) {
          return this.data.charCodeAt(this.zero + e3);
        }, i.prototype.lastIndexOfSignature = function(e3) {
          return this.data.lastIndexOf(e3) - this.zero;
        }, i.prototype.readAndCheckSignature = function(e3) {
          return e3 === this.readData(4);
        }, i.prototype.readData = function(e3) {
          this.checkOffset(e3);
          var t3 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
          return this.index += e3, t3;
        }, t2.exports = i;
      }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./ArrayReader");
        function i(e3) {
          n3.call(this, e3);
        }
        e2("../utils").inherits(i, n3), i.prototype.readData = function(e3) {
          if (this.checkOffset(e3), 0 === e3) return new Uint8Array(0);
          var t3 = this.data.subarray(this.zero + this.index, this.zero + this.index + e3);
          return this.index += e3, t3;
        }, t2.exports = i;
      }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("../utils"), i = e2("../support"), s = e2("./ArrayReader"), a = e2("./StringReader"), o = e2("./NodeBufferReader"), h2 = e2("./Uint8ArrayReader");
        t2.exports = function(e3) {
          var t3 = n3.getTypeOf(e3);
          return n3.checkSupport(t3), "string" !== t3 || i.uint8array ? "nodebuffer" === t3 ? new o(e3) : i.uint8array ? new h2(n3.transformTo("uint8array", e3)) : new s(n3.transformTo("array", e3)) : new a(e3);
        };
      }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e2, t2, r) {
        "use strict";
        r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b";
      }, {}], 24: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./GenericWorker"), i = e2("../utils");
        function s(e3) {
          n3.call(this, "ConvertWorker to " + e3), this.destType = e3;
        }
        i.inherits(s, n3), s.prototype.processChunk = function(e3) {
          this.push({ data: i.transformTo(this.destType, e3.data), meta: e3.meta });
        }, t2.exports = s;
      }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./GenericWorker"), i = e2("../crc32");
        function s() {
          n3.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
        }
        e2("../utils").inherits(s, n3), s.prototype.processChunk = function(e3) {
          this.streamInfo.crc32 = i(e3.data, this.streamInfo.crc32 || 0), this.push(e3);
        }, t2.exports = s;
      }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("../utils"), i = e2("./GenericWorker");
        function s(e3) {
          i.call(this, "DataLengthProbe for " + e3), this.propName = e3, this.withStreamInfo(e3, 0);
        }
        n3.inherits(s, i), s.prototype.processChunk = function(e3) {
          if (e3) {
            var t3 = this.streamInfo[this.propName] || 0;
            this.streamInfo[this.propName] = t3 + e3.data.length;
          }
          i.prototype.processChunk.call(this, e3);
        }, t2.exports = s;
      }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("../utils"), i = e2("./GenericWorker");
        function s(e3) {
          i.call(this, "DataWorker");
          var t3 = this;
          this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e3.then(function(e4) {
            t3.dataIsReady = true, t3.data = e4, t3.max = e4 && e4.length || 0, t3.type = n3.getTypeOf(e4), t3.isPaused || t3._tickAndRepeat();
          }, function(e4) {
            t3.error(e4);
          });
        }
        n3.inherits(s, i), s.prototype.cleanUp = function() {
          i.prototype.cleanUp.call(this), this.data = null;
        }, s.prototype.resume = function() {
          return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n3.delay(this._tickAndRepeat, [], this)), true);
        }, s.prototype._tickAndRepeat = function() {
          this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n3.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
        }, s.prototype._tick = function() {
          if (this.isPaused || this.isFinished) return false;
          var e3 = null, t3 = Math.min(this.max, this.index + 16384);
          if (this.index >= this.max) return this.end();
          switch (this.type) {
            case "string":
              e3 = this.data.substring(this.index, t3);
              break;
            case "uint8array":
              e3 = this.data.subarray(this.index, t3);
              break;
            case "array":
            case "nodebuffer":
              e3 = this.data.slice(this.index, t3);
          }
          return this.index = t3, this.push({ data: e3, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
        }, t2.exports = s;
      }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e2, t2, r) {
        "use strict";
        function n3(e3) {
          this.name = e3 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
        }
        n3.prototype = { push: function(e3) {
          this.emit("data", e3);
        }, end: function() {
          if (this.isFinished) return false;
          this.flush();
          try {
            this.emit("end"), this.cleanUp(), this.isFinished = true;
          } catch (e3) {
            this.emit("error", e3);
          }
          return true;
        }, error: function(e3) {
          return !this.isFinished && (this.isPaused ? this.generatedError = e3 : (this.isFinished = true, this.emit("error", e3), this.previous && this.previous.error(e3), this.cleanUp()), true);
        }, on: function(e3, t3) {
          return this._listeners[e3].push(t3), this;
        }, cleanUp: function() {
          this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
        }, emit: function(e3, t3) {
          if (this._listeners[e3]) for (var r3 = 0; r3 < this._listeners[e3].length; r3++) this._listeners[e3][r3].call(this, t3);
        }, pipe: function(e3) {
          return e3.registerPrevious(this);
        }, registerPrevious: function(e3) {
          if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
          this.streamInfo = e3.streamInfo, this.mergeStreamInfo(), this.previous = e3;
          var t3 = this;
          return e3.on("data", function(e4) {
            t3.processChunk(e4);
          }), e3.on("end", function() {
            t3.end();
          }), e3.on("error", function(e4) {
            t3.error(e4);
          }), this;
        }, pause: function() {
          return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);
        }, resume: function() {
          if (!this.isPaused || this.isFinished) return false;
          var e3 = this.isPaused = false;
          return this.generatedError && (this.error(this.generatedError), e3 = true), this.previous && this.previous.resume(), !e3;
        }, flush: function() {
        }, processChunk: function(e3) {
          this.push(e3);
        }, withStreamInfo: function(e3, t3) {
          return this.extraStreamInfo[e3] = t3, this.mergeStreamInfo(), this;
        }, mergeStreamInfo: function() {
          for (var e3 in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e3) && (this.streamInfo[e3] = this.extraStreamInfo[e3]);
        }, lock: function() {
          if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
          this.isLocked = true, this.previous && this.previous.lock();
        }, toString: function() {
          var e3 = "Worker " + this.name;
          return this.previous ? this.previous + " -> " + e3 : e3;
        } }, t2.exports = n3;
      }, {}], 29: [function(e2, t2, r) {
        "use strict";
        var h2 = e2("../utils"), i = e2("./ConvertWorker"), s = e2("./GenericWorker"), u = e2("../base64"), n3 = e2("../support"), a = e2("../external"), o = null;
        if (n3.nodestream) try {
          o = e2("../nodejs/NodejsStreamOutputAdapter");
        } catch (e3) {
        }
        function l(e3, o2) {
          return new a.Promise(function(t3, r3) {
            var n4 = [], i2 = e3._internalType, s2 = e3._outputType, a2 = e3._mimeType;
            e3.on("data", function(e4, t4) {
              n4.push(e4), o2 && o2(t4);
            }).on("error", function(e4) {
              n4 = [], r3(e4);
            }).on("end", function() {
              try {
                var e4 = function(e5, t4, r4) {
                  switch (e5) {
                    case "blob":
                      return h2.newBlob(h2.transformTo("arraybuffer", t4), r4);
                    case "base64":
                      return u.encode(t4);
                    default:
                      return h2.transformTo(e5, t4);
                  }
                }(s2, function(e5, t4) {
                  var r4, n5 = 0, i3 = null, s3 = 0;
                  for (r4 = 0; r4 < t4.length; r4++) s3 += t4[r4].length;
                  switch (e5) {
                    case "string":
                      return t4.join("");
                    case "array":
                      return Array.prototype.concat.apply([], t4);
                    case "uint8array":
                      for (i3 = new Uint8Array(s3), r4 = 0; r4 < t4.length; r4++) i3.set(t4[r4], n5), n5 += t4[r4].length;
                      return i3;
                    case "nodebuffer":
                      return Buffer.concat(t4);
                    default:
                      throw new Error("concat : unsupported type '" + e5 + "'");
                  }
                }(i2, n4), a2);
                t3(e4);
              } catch (e5) {
                r3(e5);
              }
              n4 = [];
            }).resume();
          });
        }
        function f3(e3, t3, r3) {
          var n4 = t3;
          switch (t3) {
            case "blob":
            case "arraybuffer":
              n4 = "uint8array";
              break;
            case "base64":
              n4 = "string";
          }
          try {
            this._internalType = n4, this._outputType = t3, this._mimeType = r3, h2.checkSupport(n4), this._worker = e3.pipe(new i(n4)), e3.lock();
          } catch (e4) {
            this._worker = new s("error"), this._worker.error(e4);
          }
        }
        f3.prototype = { accumulate: function(e3) {
          return l(this, e3);
        }, on: function(e3, t3) {
          var r3 = this;
          return "data" === e3 ? this._worker.on(e3, function(e4) {
            t3.call(r3, e4.data, e4.meta);
          }) : this._worker.on(e3, function() {
            h2.delay(t3, arguments, r3);
          }), this;
        }, resume: function() {
          return h2.delay(this._worker.resume, [], this._worker), this;
        }, pause: function() {
          return this._worker.pause(), this;
        }, toNodejsStream: function(e3) {
          if (h2.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method");
          return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e3);
        } }, t2.exports = f3;
      }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e2, t2, r) {
        "use strict";
        if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) r.blob = false;
        else {
          var n3 = new ArrayBuffer(0);
          try {
            r.blob = 0 === new Blob([n3], { type: "application/zip" }).size;
          } catch (e3) {
            try {
              var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
              i.append(n3), r.blob = 0 === i.getBlob("application/zip").size;
            } catch (e4) {
              r.blob = false;
            }
          }
        }
        try {
          r.nodestream = !!e2("readable-stream").Readable;
        } catch (e3) {
          r.nodestream = false;
        }
      }, { "readable-stream": 16 }], 31: [function(e2, t2, s) {
        "use strict";
        for (var o = e2("./utils"), h2 = e2("./support"), r = e2("./nodejsUtils"), n3 = e2("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1;
        u[254] = u[254] = 1;
        function a() {
          n3.call(this, "utf-8 decode"), this.leftOver = null;
        }
        function l() {
          n3.call(this, "utf-8 encode");
        }
        s.utf8encode = function(e3) {
          return h2.nodebuffer ? r.newBufferFrom(e3, "utf-8") : function(e4) {
            var t3, r3, n4, i2, s2, a2 = e4.length, o2 = 0;
            for (i2 = 0; i2 < a2; i2++) 55296 == (64512 & (r3 = e4.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n4 = e4.charCodeAt(i2 + 1))) && (r3 = 65536 + (r3 - 55296 << 10) + (n4 - 56320), i2++), o2 += r3 < 128 ? 1 : r3 < 2048 ? 2 : r3 < 65536 ? 3 : 4;
            for (t3 = h2.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) 55296 == (64512 & (r3 = e4.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n4 = e4.charCodeAt(i2 + 1))) && (r3 = 65536 + (r3 - 55296 << 10) + (n4 - 56320), i2++), r3 < 128 ? t3[s2++] = r3 : (r3 < 2048 ? t3[s2++] = 192 | r3 >>> 6 : (r3 < 65536 ? t3[s2++] = 224 | r3 >>> 12 : (t3[s2++] = 240 | r3 >>> 18, t3[s2++] = 128 | r3 >>> 12 & 63), t3[s2++] = 128 | r3 >>> 6 & 63), t3[s2++] = 128 | 63 & r3);
            return t3;
          }(e3);
        }, s.utf8decode = function(e3) {
          return h2.nodebuffer ? o.transformTo("nodebuffer", e3).toString("utf-8") : function(e4) {
            var t3, r3, n4, i2, s2 = e4.length, a2 = new Array(2 * s2);
            for (t3 = r3 = 0; t3 < s2; ) if ((n4 = e4[t3++]) < 128) a2[r3++] = n4;
            else if (4 < (i2 = u[n4])) a2[r3++] = 65533, t3 += i2 - 1;
            else {
              for (n4 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t3 < s2; ) n4 = n4 << 6 | 63 & e4[t3++], i2--;
              1 < i2 ? a2[r3++] = 65533 : n4 < 65536 ? a2[r3++] = n4 : (n4 -= 65536, a2[r3++] = 55296 | n4 >> 10 & 1023, a2[r3++] = 56320 | 1023 & n4);
            }
            return a2.length !== r3 && (a2.subarray ? a2 = a2.subarray(0, r3) : a2.length = r3), o.applyFromCharCode(a2);
          }(e3 = o.transformTo(h2.uint8array ? "uint8array" : "array", e3));
        }, o.inherits(a, n3), a.prototype.processChunk = function(e3) {
          var t3 = o.transformTo(h2.uint8array ? "uint8array" : "array", e3.data);
          if (this.leftOver && this.leftOver.length) {
            if (h2.uint8array) {
              var r3 = t3;
              (t3 = new Uint8Array(r3.length + this.leftOver.length)).set(this.leftOver, 0), t3.set(r3, this.leftOver.length);
            } else t3 = this.leftOver.concat(t3);
            this.leftOver = null;
          }
          var n4 = function(e4, t4) {
            var r4;
            for ((t4 = t4 || e4.length) > e4.length && (t4 = e4.length), r4 = t4 - 1; 0 <= r4 && 128 == (192 & e4[r4]); ) r4--;
            return r4 < 0 ? t4 : 0 === r4 ? t4 : r4 + u[e4[r4]] > t4 ? r4 : t4;
          }(t3), i2 = t3;
          n4 !== t3.length && (h2.uint8array ? (i2 = t3.subarray(0, n4), this.leftOver = t3.subarray(n4, t3.length)) : (i2 = t3.slice(0, n4), this.leftOver = t3.slice(n4, t3.length))), this.push({ data: s.utf8decode(i2), meta: e3.meta });
        }, a.prototype.flush = function() {
          this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
        }, s.Utf8DecodeWorker = a, o.inherits(l, n3), l.prototype.processChunk = function(e3) {
          this.push({ data: s.utf8encode(e3.data), meta: e3.meta });
        }, s.Utf8EncodeWorker = l;
      }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e2, t2, a) {
        "use strict";
        var o = e2("./support"), h2 = e2("./base64"), r = e2("./nodejsUtils"), u = e2("./external");
        function n3(e3) {
          return e3;
        }
        function l(e3, t3) {
          for (var r3 = 0; r3 < e3.length; ++r3) t3[r3] = 255 & e3.charCodeAt(r3);
          return t3;
        }
        e2("setimmediate"), a.newBlob = function(t3, r3) {
          a.checkSupport("blob");
          try {
            return new Blob([t3], { type: r3 });
          } catch (e3) {
            try {
              var n4 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
              return n4.append(t3), n4.getBlob(r3);
            } catch (e4) {
              throw new Error("Bug : can't construct the Blob.");
            }
          }
        };
        var i = { stringifyByChunk: function(e3, t3, r3) {
          var n4 = [], i2 = 0, s2 = e3.length;
          if (s2 <= r3) return String.fromCharCode.apply(null, e3);
          for (; i2 < s2; ) "array" === t3 || "nodebuffer" === t3 ? n4.push(String.fromCharCode.apply(null, e3.slice(i2, Math.min(i2 + r3, s2)))) : n4.push(String.fromCharCode.apply(null, e3.subarray(i2, Math.min(i2 + r3, s2)))), i2 += r3;
          return n4.join("");
        }, stringifyByChar: function(e3) {
          for (var t3 = "", r3 = 0; r3 < e3.length; r3++) t3 += String.fromCharCode(e3[r3]);
          return t3;
        }, applyCanBeUsed: { uint8array: function() {
          try {
            return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
          } catch (e3) {
            return false;
          }
        }(), nodebuffer: function() {
          try {
            return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
          } catch (e3) {
            return false;
          }
        }() } };
        function s(e3) {
          var t3 = 65536, r3 = a.getTypeOf(e3), n4 = true;
          if ("uint8array" === r3 ? n4 = i.applyCanBeUsed.uint8array : "nodebuffer" === r3 && (n4 = i.applyCanBeUsed.nodebuffer), n4) for (; 1 < t3; ) try {
            return i.stringifyByChunk(e3, r3, t3);
          } catch (e4) {
            t3 = Math.floor(t3 / 2);
          }
          return i.stringifyByChar(e3);
        }
        function f3(e3, t3) {
          for (var r3 = 0; r3 < e3.length; r3++) t3[r3] = e3[r3];
          return t3;
        }
        a.applyFromCharCode = s;
        var c = {};
        c.string = { string: n3, array: function(e3) {
          return l(e3, new Array(e3.length));
        }, arraybuffer: function(e3) {
          return c.string.uint8array(e3).buffer;
        }, uint8array: function(e3) {
          return l(e3, new Uint8Array(e3.length));
        }, nodebuffer: function(e3) {
          return l(e3, r.allocBuffer(e3.length));
        } }, c.array = { string: s, array: n3, arraybuffer: function(e3) {
          return new Uint8Array(e3).buffer;
        }, uint8array: function(e3) {
          return new Uint8Array(e3);
        }, nodebuffer: function(e3) {
          return r.newBufferFrom(e3);
        } }, c.arraybuffer = { string: function(e3) {
          return s(new Uint8Array(e3));
        }, array: function(e3) {
          return f3(new Uint8Array(e3), new Array(e3.byteLength));
        }, arraybuffer: n3, uint8array: function(e3) {
          return new Uint8Array(e3);
        }, nodebuffer: function(e3) {
          return r.newBufferFrom(new Uint8Array(e3));
        } }, c.uint8array = { string: s, array: function(e3) {
          return f3(e3, new Array(e3.length));
        }, arraybuffer: function(e3) {
          return e3.buffer;
        }, uint8array: n3, nodebuffer: function(e3) {
          return r.newBufferFrom(e3);
        } }, c.nodebuffer = { string: s, array: function(e3) {
          return f3(e3, new Array(e3.length));
        }, arraybuffer: function(e3) {
          return c.nodebuffer.uint8array(e3).buffer;
        }, uint8array: function(e3) {
          return f3(e3, new Uint8Array(e3.length));
        }, nodebuffer: n3 }, a.transformTo = function(e3, t3) {
          if (t3 = t3 || "", !e3) return t3;
          a.checkSupport(e3);
          var r3 = a.getTypeOf(t3);
          return c[r3][e3](t3);
        }, a.resolve = function(e3) {
          for (var t3 = e3.split("/"), r3 = [], n4 = 0; n4 < t3.length; n4++) {
            var i2 = t3[n4];
            "." === i2 || "" === i2 && 0 !== n4 && n4 !== t3.length - 1 || (".." === i2 ? r3.pop() : r3.push(i2));
          }
          return r3.join("/");
        }, a.getTypeOf = function(e3) {
          return "string" == typeof e3 ? "string" : "[object Array]" === Object.prototype.toString.call(e3) ? "array" : o.nodebuffer && r.isBuffer(e3) ? "nodebuffer" : o.uint8array && e3 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e3 instanceof ArrayBuffer ? "arraybuffer" : void 0;
        }, a.checkSupport = function(e3) {
          if (!o[e3.toLowerCase()]) throw new Error(e3 + " is not supported by this platform");
        }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e3) {
          var t3, r3, n4 = "";
          for (r3 = 0; r3 < (e3 || "").length; r3++) n4 += "\\x" + ((t3 = e3.charCodeAt(r3)) < 16 ? "0" : "") + t3.toString(16).toUpperCase();
          return n4;
        }, a.delay = function(e3, t3, r3) {
          setImmediate(function() {
            e3.apply(r3 || null, t3 || []);
          });
        }, a.inherits = function(e3, t3) {
          function r3() {
          }
          r3.prototype = t3.prototype, e3.prototype = new r3();
        }, a.extend = function() {
          var e3, t3, r3 = {};
          for (e3 = 0; e3 < arguments.length; e3++) for (t3 in arguments[e3]) Object.prototype.hasOwnProperty.call(arguments[e3], t3) && void 0 === r3[t3] && (r3[t3] = arguments[e3][t3]);
          return r3;
        }, a.prepareContent = function(r3, e3, n4, i2, s2) {
          return u.Promise.resolve(e3).then(function(n5) {
            return o.blob && (n5 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n5))) && "undefined" != typeof FileReader ? new u.Promise(function(t3, r4) {
              var e4 = new FileReader();
              e4.onload = function(e5) {
                t3(e5.target.result);
              }, e4.onerror = function(e5) {
                r4(e5.target.error);
              }, e4.readAsArrayBuffer(n5);
            }) : n5;
          }).then(function(e4) {
            var t3 = a.getTypeOf(e4);
            return t3 ? ("arraybuffer" === t3 ? e4 = a.transformTo("uint8array", e4) : "string" === t3 && (s2 ? e4 = h2.decode(e4) : n4 && true !== i2 && (e4 = function(e5) {
              return l(e5, o.uint8array ? new Uint8Array(e5.length) : new Array(e5.length));
            }(e4))), e4) : u.Promise.reject(new Error("Can't read the data of '" + r3 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
          });
        };
      }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./reader/readerFor"), i = e2("./utils"), s = e2("./signature"), a = e2("./zipEntry"), o = e2("./support");
        function h2(e3) {
          this.files = [], this.loadOptions = e3;
        }
        h2.prototype = { checkSignature: function(e3) {
          if (!this.reader.readAndCheckSignature(e3)) {
            this.reader.index -= 4;
            var t3 = this.reader.readString(4);
            throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t3) + ", expected " + i.pretty(e3) + ")");
          }
        }, isSignature: function(e3, t3) {
          var r3 = this.reader.index;
          this.reader.setIndex(e3);
          var n4 = this.reader.readString(4) === t3;
          return this.reader.setIndex(r3), n4;
        }, readBlockEndOfCentral: function() {
          this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
          var e3 = this.reader.readData(this.zipCommentLength), t3 = o.uint8array ? "uint8array" : "array", r3 = i.transformTo(t3, e3);
          this.zipComment = this.loadOptions.decodeFileName(r3);
        }, readBlockZip64EndOfCentral: function() {
          this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
          for (var e3, t3, r3, n4 = this.zip64EndOfCentralSize - 44; 0 < n4; ) e3 = this.reader.readInt(2), t3 = this.reader.readInt(4), r3 = this.reader.readData(t3), this.zip64ExtensibleData[e3] = { id: e3, length: t3, value: r3 };
        }, readBlockZip64EndOfCentralLocator: function() {
          if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
        }, readLocalFiles: function() {
          var e3, t3;
          for (e3 = 0; e3 < this.files.length; e3++) t3 = this.files[e3], this.reader.setIndex(t3.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t3.readLocalPart(this.reader), t3.handleUTF8(), t3.processAttributes();
        }, readCentralDir: function() {
          var e3;
          for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) (e3 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e3);
          if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
        }, readEndOfCentral: function() {
          var e3 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);
          if (e3 < 0) throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory");
          this.reader.setIndex(e3);
          var t3 = e3;
          if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) {
            if (this.zip64 = true, (e3 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
            if (this.reader.setIndex(e3), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
            this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
          }
          var r3 = this.centralDirOffset + this.centralDirSize;
          this.zip64 && (r3 += 20, r3 += 12 + this.zip64EndOfCentralSize);
          var n4 = t3 - r3;
          if (0 < n4) this.isSignature(t3, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n4);
          else if (n4 < 0) throw new Error("Corrupted zip: missing " + Math.abs(n4) + " bytes.");
        }, prepareReader: function(e3) {
          this.reader = n3(e3);
        }, load: function(e3) {
          this.prepareReader(e3), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
        } }, t2.exports = h2;
      }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e2, t2, r) {
        "use strict";
        var n3 = e2("./reader/readerFor"), s = e2("./utils"), i = e2("./compressedObject"), a = e2("./crc32"), o = e2("./utf8"), h2 = e2("./compressions"), u = e2("./support");
        function l(e3, t3) {
          this.options = e3, this.loadOptions = t3;
        }
        l.prototype = { isEncrypted: function() {
          return 1 == (1 & this.bitFlag);
        }, useUTF8: function() {
          return 2048 == (2048 & this.bitFlag);
        }, readLocalPart: function(e3) {
          var t3, r3;
          if (e3.skip(22), this.fileNameLength = e3.readInt(2), r3 = e3.readInt(2), this.fileName = e3.readData(this.fileNameLength), e3.skip(r3), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
          if (null === (t3 = function(e4) {
            for (var t4 in h2) if (Object.prototype.hasOwnProperty.call(h2, t4) && h2[t4].magic === e4) return h2[t4];
            return null;
          }(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
          this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t3, e3.readData(this.compressedSize));
        }, readCentralPart: function(e3) {
          this.versionMadeBy = e3.readInt(2), e3.skip(2), this.bitFlag = e3.readInt(2), this.compressionMethod = e3.readString(2), this.date = e3.readDate(), this.crc32 = e3.readInt(4), this.compressedSize = e3.readInt(4), this.uncompressedSize = e3.readInt(4);
          var t3 = e3.readInt(2);
          if (this.extraFieldsLength = e3.readInt(2), this.fileCommentLength = e3.readInt(2), this.diskNumberStart = e3.readInt(2), this.internalFileAttributes = e3.readInt(2), this.externalFileAttributes = e3.readInt(4), this.localHeaderOffset = e3.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
          e3.skip(t3), this.readExtraFields(e3), this.parseZIP64ExtraField(e3), this.fileComment = e3.readData(this.fileCommentLength);
        }, processAttributes: function() {
          this.unixPermissions = null, this.dosPermissions = null;
          var e3 = this.versionMadeBy >> 8;
          this.dir = !!(16 & this.externalFileAttributes), 0 == e3 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e3 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true);
        }, parseZIP64ExtraField: function() {
          if (this.extraFields[1]) {
            var e3 = n3(this.extraFields[1].value);
            this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e3.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e3.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e3.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e3.readInt(4));
          }
        }, readExtraFields: function(e3) {
          var t3, r3, n4, i2 = e3.index + this.extraFieldsLength;
          for (this.extraFields || (this.extraFields = {}); e3.index + 4 < i2; ) t3 = e3.readInt(2), r3 = e3.readInt(2), n4 = e3.readData(r3), this.extraFields[t3] = { id: t3, length: r3, value: n4 };
          e3.setIndex(i2);
        }, handleUTF8: function() {
          var e3 = u.uint8array ? "uint8array" : "array";
          if (this.useUTF8()) this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment);
          else {
            var t3 = this.findExtraFieldUnicodePath();
            if (null !== t3) this.fileNameStr = t3;
            else {
              var r3 = s.transformTo(e3, this.fileName);
              this.fileNameStr = this.loadOptions.decodeFileName(r3);
            }
            var n4 = this.findExtraFieldUnicodeComment();
            if (null !== n4) this.fileCommentStr = n4;
            else {
              var i2 = s.transformTo(e3, this.fileComment);
              this.fileCommentStr = this.loadOptions.decodeFileName(i2);
            }
          }
        }, findExtraFieldUnicodePath: function() {
          var e3 = this.extraFields[28789];
          if (e3) {
            var t3 = n3(e3.value);
            return 1 !== t3.readInt(1) ? null : a(this.fileName) !== t3.readInt(4) ? null : o.utf8decode(t3.readData(e3.length - 5));
          }
          return null;
        }, findExtraFieldUnicodeComment: function() {
          var e3 = this.extraFields[25461];
          if (e3) {
            var t3 = n3(e3.value);
            return 1 !== t3.readInt(1) ? null : a(this.fileComment) !== t3.readInt(4) ? null : o.utf8decode(t3.readData(e3.length - 5));
          }
          return null;
        } }, t2.exports = l;
      }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e2, t2, r) {
        "use strict";
        function n3(e3, t3, r3) {
          this.name = e3, this.dir = r3.dir, this.date = r3.date, this.comment = r3.comment, this.unixPermissions = r3.unixPermissions, this.dosPermissions = r3.dosPermissions, this._data = t3, this._dataBinary = r3.binary, this.options = { compression: r3.compression, compressionOptions: r3.compressionOptions };
        }
        var s = e2("./stream/StreamHelper"), i = e2("./stream/DataWorker"), a = e2("./utf8"), o = e2("./compressedObject"), h2 = e2("./stream/GenericWorker");
        n3.prototype = { internalStream: function(e3) {
          var t3 = null, r3 = "string";
          try {
            if (!e3) throw new Error("No output type specified.");
            var n4 = "string" === (r3 = e3.toLowerCase()) || "text" === r3;
            "binarystring" !== r3 && "text" !== r3 || (r3 = "string"), t3 = this._decompressWorker();
            var i2 = !this._dataBinary;
            i2 && !n4 && (t3 = t3.pipe(new a.Utf8EncodeWorker())), !i2 && n4 && (t3 = t3.pipe(new a.Utf8DecodeWorker()));
          } catch (e4) {
            (t3 = new h2("error")).error(e4);
          }
          return new s(t3, r3, "");
        }, async: function(e3, t3) {
          return this.internalStream(e3).accumulate(t3);
        }, nodeStream: function(e3, t3) {
          return this.internalStream(e3 || "nodebuffer").toNodejsStream(t3);
        }, _compressWorker: function(e3, t3) {
          if (this._data instanceof o && this._data.compression.magic === e3.magic) return this._data.getCompressedWorker();
          var r3 = this._decompressWorker();
          return this._dataBinary || (r3 = r3.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r3, e3, t3);
        }, _decompressWorker: function() {
          return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h2 ? this._data : new i(this._data);
        } };
        for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() {
          throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
        }, f3 = 0; f3 < u.length; f3++) n3.prototype[u[f3]] = l;
        t2.exports = n3;
      }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e2, l, t2) {
        (function(t3) {
          "use strict";
          var r, n3, e3 = t3.MutationObserver || t3.WebKitMutationObserver;
          if (e3) {
            var i = 0, s = new e3(u), a = t3.document.createTextNode("");
            s.observe(a, { characterData: true }), r = function() {
              a.data = i = ++i % 2;
            };
          } else if (t3.setImmediate || void 0 === t3.MessageChannel) r = "document" in t3 && "onreadystatechange" in t3.document.createElement("script") ? function() {
            var e4 = t3.document.createElement("script");
            e4.onreadystatechange = function() {
              u(), e4.onreadystatechange = null, e4.parentNode.removeChild(e4), e4 = null;
            }, t3.document.documentElement.appendChild(e4);
          } : function() {
            setTimeout(u, 0);
          };
          else {
            var o = new t3.MessageChannel();
            o.port1.onmessage = u, r = function() {
              o.port2.postMessage(0);
            };
          }
          var h2 = [];
          function u() {
            var e4, t4;
            n3 = true;
            for (var r3 = h2.length; r3; ) {
              for (t4 = h2, h2 = [], e4 = -1; ++e4 < r3; ) t4[e4]();
              r3 = h2.length;
            }
            n3 = false;
          }
          l.exports = function(e4) {
            1 !== h2.push(e4) || n3 || r();
          };
        }).call(this, "undefined" != typeof window ? window : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
      }, {}], 37: [function(e2, t2, r) {
        "use strict";
        var i = e2("immediate");
        function u() {
        }
        var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n3 = ["PENDING"];
        function o(e3) {
          if ("function" != typeof e3) throw new TypeError("resolver must be a function");
          this.state = n3, this.queue = [], this.outcome = void 0, e3 !== u && d(this, e3);
        }
        function h2(e3, t3, r3) {
          this.promise = e3, "function" == typeof t3 && (this.onFulfilled = t3, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r3 && (this.onRejected = r3, this.callRejected = this.otherCallRejected);
        }
        function f3(t3, r3, n4) {
          i(function() {
            var e3;
            try {
              e3 = r3(n4);
            } catch (e4) {
              return l.reject(t3, e4);
            }
            e3 === t3 ? l.reject(t3, new TypeError("Cannot resolve promise with itself")) : l.resolve(t3, e3);
          });
        }
        function c(e3) {
          var t3 = e3 && e3.then;
          if (e3 && ("object" == typeof e3 || "function" == typeof e3) && "function" == typeof t3) return function() {
            t3.apply(e3, arguments);
          };
        }
        function d(t3, e3) {
          var r3 = false;
          function n4(e4) {
            r3 || (r3 = true, l.reject(t3, e4));
          }
          function i2(e4) {
            r3 || (r3 = true, l.resolve(t3, e4));
          }
          var s2 = p(function() {
            e3(i2, n4);
          });
          "error" === s2.status && n4(s2.value);
        }
        function p(e3, t3) {
          var r3 = {};
          try {
            r3.value = e3(t3), r3.status = "success";
          } catch (e4) {
            r3.status = "error", r3.value = e4;
          }
          return r3;
        }
        (t2.exports = o).prototype.finally = function(t3) {
          if ("function" != typeof t3) return this;
          var r3 = this.constructor;
          return this.then(function(e3) {
            return r3.resolve(t3()).then(function() {
              return e3;
            });
          }, function(e3) {
            return r3.resolve(t3()).then(function() {
              throw e3;
            });
          });
        }, o.prototype.catch = function(e3) {
          return this.then(null, e3);
        }, o.prototype.then = function(e3, t3) {
          if ("function" != typeof e3 && this.state === a || "function" != typeof t3 && this.state === s) return this;
          var r3 = new this.constructor(u);
          this.state !== n3 ? f3(r3, this.state === a ? e3 : t3, this.outcome) : this.queue.push(new h2(r3, e3, t3));
          return r3;
        }, h2.prototype.callFulfilled = function(e3) {
          l.resolve(this.promise, e3);
        }, h2.prototype.otherCallFulfilled = function(e3) {
          f3(this.promise, this.onFulfilled, e3);
        }, h2.prototype.callRejected = function(e3) {
          l.reject(this.promise, e3);
        }, h2.prototype.otherCallRejected = function(e3) {
          f3(this.promise, this.onRejected, e3);
        }, l.resolve = function(e3, t3) {
          var r3 = p(c, t3);
          if ("error" === r3.status) return l.reject(e3, r3.value);
          var n4 = r3.value;
          if (n4) d(e3, n4);
          else {
            e3.state = a, e3.outcome = t3;
            for (var i2 = -1, s2 = e3.queue.length; ++i2 < s2; ) e3.queue[i2].callFulfilled(t3);
          }
          return e3;
        }, l.reject = function(e3, t3) {
          e3.state = s, e3.outcome = t3;
          for (var r3 = -1, n4 = e3.queue.length; ++r3 < n4; ) e3.queue[r3].callRejected(t3);
          return e3;
        }, o.resolve = function(e3) {
          if (e3 instanceof this) return e3;
          return l.resolve(new this(u), e3);
        }, o.reject = function(e3) {
          var t3 = new this(u);
          return l.reject(t3, e3);
        }, o.all = function(e3) {
          var r3 = this;
          if ("[object Array]" !== Object.prototype.toString.call(e3)) return this.reject(new TypeError("must be an array"));
          var n4 = e3.length, i2 = false;
          if (!n4) return this.resolve([]);
          var s2 = new Array(n4), a2 = 0, t3 = -1, o2 = new this(u);
          for (; ++t3 < n4; ) h3(e3[t3], t3);
          return o2;
          function h3(e4, t4) {
            r3.resolve(e4).then(function(e5) {
              s2[t4] = e5, ++a2 !== n4 || i2 || (i2 = true, l.resolve(o2, s2));
            }, function(e5) {
              i2 || (i2 = true, l.reject(o2, e5));
            });
          }
        }, o.race = function(e3) {
          var t3 = this;
          if ("[object Array]" !== Object.prototype.toString.call(e3)) return this.reject(new TypeError("must be an array"));
          var r3 = e3.length, n4 = false;
          if (!r3) return this.resolve([]);
          var i2 = -1, s2 = new this(u);
          for (; ++i2 < r3; ) a2 = e3[i2], t3.resolve(a2).then(function(e4) {
            n4 || (n4 = true, l.resolve(s2, e4));
          }, function(e4) {
            n4 || (n4 = true, l.reject(s2, e4));
          });
          var a2;
          return s2;
        };
      }, { immediate: 36 }], 38: [function(e2, t2, r) {
        "use strict";
        var n3 = {};
        (0, e2("./lib/utils/common").assign)(n3, e2("./lib/deflate"), e2("./lib/inflate"), e2("./lib/zlib/constants")), t2.exports = n3;
      }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e2, t2, r) {
        "use strict";
        var a = e2("./zlib/deflate"), o = e2("./utils/common"), h2 = e2("./utils/strings"), i = e2("./zlib/messages"), s = e2("./zlib/zstream"), u = Object.prototype.toString, l = 0, f3 = -1, c = 0, d = 8;
        function p(e3) {
          if (!(this instanceof p)) return new p(e3);
          this.options = o.assign({ level: f3, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e3 || {});
          var t3 = this.options;
          t3.raw && 0 < t3.windowBits ? t3.windowBits = -t3.windowBits : t3.gzip && 0 < t3.windowBits && t3.windowBits < 16 && (t3.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0;
          var r3 = a.deflateInit2(this.strm, t3.level, t3.method, t3.windowBits, t3.memLevel, t3.strategy);
          if (r3 !== l) throw new Error(i[r3]);
          if (t3.header && a.deflateSetHeader(this.strm, t3.header), t3.dictionary) {
            var n4;
            if (n4 = "string" == typeof t3.dictionary ? h2.string2buf(t3.dictionary) : "[object ArrayBuffer]" === u.call(t3.dictionary) ? new Uint8Array(t3.dictionary) : t3.dictionary, (r3 = a.deflateSetDictionary(this.strm, n4)) !== l) throw new Error(i[r3]);
            this._dict_set = true;
          }
        }
        function n3(e3, t3) {
          var r3 = new p(t3);
          if (r3.push(e3, true), r3.err) throw r3.msg || i[r3.err];
          return r3.result;
        }
        p.prototype.push = function(e3, t3) {
          var r3, n4, i2 = this.strm, s2 = this.options.chunkSize;
          if (this.ended) return false;
          n4 = t3 === ~~t3 ? t3 : true === t3 ? 4 : 0, "string" == typeof e3 ? i2.input = h2.string2buf(e3) : "[object ArrayBuffer]" === u.call(e3) ? i2.input = new Uint8Array(e3) : i2.input = e3, i2.next_in = 0, i2.avail_in = i2.input.length;
          do {
            if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r3 = a.deflate(i2, n4)) && r3 !== l) return this.onEnd(r3), !(this.ended = true);
            0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n4 && 2 !== n4) || ("string" === this.options.to ? this.onData(h2.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out)));
          } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r3);
          return 4 === n4 ? (r3 = a.deflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === l) : 2 !== n4 || (this.onEnd(l), !(i2.avail_out = 0));
        }, p.prototype.onData = function(e3) {
          this.chunks.push(e3);
        }, p.prototype.onEnd = function(e3) {
          e3 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e3, this.msg = this.strm.msg;
        }, r.Deflate = p, r.deflate = n3, r.deflateRaw = function(e3, t3) {
          return (t3 = t3 || {}).raw = true, n3(e3, t3);
        }, r.gzip = function(e3, t3) {
          return (t3 = t3 || {}).gzip = true, n3(e3, t3);
        };
      }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e2, t2, r) {
        "use strict";
        var c = e2("./zlib/inflate"), d = e2("./utils/common"), p = e2("./utils/strings"), m2 = e2("./zlib/constants"), n3 = e2("./zlib/messages"), i = e2("./zlib/zstream"), s = e2("./zlib/gzheader"), _ = Object.prototype.toString;
        function a(e3) {
          if (!(this instanceof a)) return new a(e3);
          this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e3 || {});
          var t3 = this.options;
          t3.raw && 0 <= t3.windowBits && t3.windowBits < 16 && (t3.windowBits = -t3.windowBits, 0 === t3.windowBits && (t3.windowBits = -15)), !(0 <= t3.windowBits && t3.windowBits < 16) || e3 && e3.windowBits || (t3.windowBits += 32), 15 < t3.windowBits && t3.windowBits < 48 && 0 == (15 & t3.windowBits) && (t3.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0;
          var r3 = c.inflateInit2(this.strm, t3.windowBits);
          if (r3 !== m2.Z_OK) throw new Error(n3[r3]);
          this.header = new s(), c.inflateGetHeader(this.strm, this.header);
        }
        function o(e3, t3) {
          var r3 = new a(t3);
          if (r3.push(e3, true), r3.err) throw r3.msg || n3[r3.err];
          return r3.result;
        }
        a.prototype.push = function(e3, t3) {
          var r3, n4, i2, s2, a2, o2, h2 = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f3 = false;
          if (this.ended) return false;
          n4 = t3 === ~~t3 ? t3 : true === t3 ? m2.Z_FINISH : m2.Z_NO_FLUSH, "string" == typeof e3 ? h2.input = p.binstring2buf(e3) : "[object ArrayBuffer]" === _.call(e3) ? h2.input = new Uint8Array(e3) : h2.input = e3, h2.next_in = 0, h2.avail_in = h2.input.length;
          do {
            if (0 === h2.avail_out && (h2.output = new d.Buf8(u), h2.next_out = 0, h2.avail_out = u), (r3 = c.inflate(h2, m2.Z_NO_FLUSH)) === m2.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r3 = c.inflateSetDictionary(this.strm, o2)), r3 === m2.Z_BUF_ERROR && true === f3 && (r3 = m2.Z_OK, f3 = false), r3 !== m2.Z_STREAM_END && r3 !== m2.Z_OK) return this.onEnd(r3), !(this.ended = true);
            h2.next_out && (0 !== h2.avail_out && r3 !== m2.Z_STREAM_END && (0 !== h2.avail_in || n4 !== m2.Z_FINISH && n4 !== m2.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h2.output, h2.next_out), s2 = h2.next_out - i2, a2 = p.buf2string(h2.output, i2), h2.next_out = s2, h2.avail_out = u - s2, s2 && d.arraySet(h2.output, h2.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h2.output, h2.next_out)))), 0 === h2.avail_in && 0 === h2.avail_out && (f3 = true);
          } while ((0 < h2.avail_in || 0 === h2.avail_out) && r3 !== m2.Z_STREAM_END);
          return r3 === m2.Z_STREAM_END && (n4 = m2.Z_FINISH), n4 === m2.Z_FINISH ? (r3 = c.inflateEnd(this.strm), this.onEnd(r3), this.ended = true, r3 === m2.Z_OK) : n4 !== m2.Z_SYNC_FLUSH || (this.onEnd(m2.Z_OK), !(h2.avail_out = 0));
        }, a.prototype.onData = function(e3) {
          this.chunks.push(e3);
        }, a.prototype.onEnd = function(e3) {
          e3 === m2.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e3, this.msg = this.strm.msg;
        }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e3, t3) {
          return (t3 = t3 || {}).raw = true, o(e3, t3);
        }, r.ungzip = o;
      }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e2, t2, r) {
        "use strict";
        var n3 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
        r.assign = function(e3) {
          for (var t3 = Array.prototype.slice.call(arguments, 1); t3.length; ) {
            var r3 = t3.shift();
            if (r3) {
              if ("object" != typeof r3) throw new TypeError(r3 + "must be non-object");
              for (var n4 in r3) r3.hasOwnProperty(n4) && (e3[n4] = r3[n4]);
            }
          }
          return e3;
        }, r.shrinkBuf = function(e3, t3) {
          return e3.length === t3 ? e3 : e3.subarray ? e3.subarray(0, t3) : (e3.length = t3, e3);
        };
        var i = { arraySet: function(e3, t3, r3, n4, i2) {
          if (t3.subarray && e3.subarray) e3.set(t3.subarray(r3, r3 + n4), i2);
          else for (var s2 = 0; s2 < n4; s2++) e3[i2 + s2] = t3[r3 + s2];
        }, flattenChunks: function(e3) {
          var t3, r3, n4, i2, s2, a;
          for (t3 = n4 = 0, r3 = e3.length; t3 < r3; t3++) n4 += e3[t3].length;
          for (a = new Uint8Array(n4), t3 = i2 = 0, r3 = e3.length; t3 < r3; t3++) s2 = e3[t3], a.set(s2, i2), i2 += s2.length;
          return a;
        } }, s = { arraySet: function(e3, t3, r3, n4, i2) {
          for (var s2 = 0; s2 < n4; s2++) e3[i2 + s2] = t3[r3 + s2];
        }, flattenChunks: function(e3) {
          return [].concat.apply([], e3);
        } };
        r.setTyped = function(e3) {
          e3 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s));
        }, r.setTyped(n3);
      }, {}], 42: [function(e2, t2, r) {
        "use strict";
        var h2 = e2("./common"), i = true, s = true;
        try {
          String.fromCharCode.apply(null, [0]);
        } catch (e3) {
          i = false;
        }
        try {
          String.fromCharCode.apply(null, new Uint8Array(1));
        } catch (e3) {
          s = false;
        }
        for (var u = new h2.Buf8(256), n3 = 0; n3 < 256; n3++) u[n3] = 252 <= n3 ? 6 : 248 <= n3 ? 5 : 240 <= n3 ? 4 : 224 <= n3 ? 3 : 192 <= n3 ? 2 : 1;
        function l(e3, t3) {
          if (t3 < 65537 && (e3.subarray && s || !e3.subarray && i)) return String.fromCharCode.apply(null, h2.shrinkBuf(e3, t3));
          for (var r3 = "", n4 = 0; n4 < t3; n4++) r3 += String.fromCharCode(e3[n4]);
          return r3;
        }
        u[254] = u[254] = 1, r.string2buf = function(e3) {
          var t3, r3, n4, i2, s2, a = e3.length, o = 0;
          for (i2 = 0; i2 < a; i2++) 55296 == (64512 & (r3 = e3.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n4 = e3.charCodeAt(i2 + 1))) && (r3 = 65536 + (r3 - 55296 << 10) + (n4 - 56320), i2++), o += r3 < 128 ? 1 : r3 < 2048 ? 2 : r3 < 65536 ? 3 : 4;
          for (t3 = new h2.Buf8(o), i2 = s2 = 0; s2 < o; i2++) 55296 == (64512 & (r3 = e3.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n4 = e3.charCodeAt(i2 + 1))) && (r3 = 65536 + (r3 - 55296 << 10) + (n4 - 56320), i2++), r3 < 128 ? t3[s2++] = r3 : (r3 < 2048 ? t3[s2++] = 192 | r3 >>> 6 : (r3 < 65536 ? t3[s2++] = 224 | r3 >>> 12 : (t3[s2++] = 240 | r3 >>> 18, t3[s2++] = 128 | r3 >>> 12 & 63), t3[s2++] = 128 | r3 >>> 6 & 63), t3[s2++] = 128 | 63 & r3);
          return t3;
        }, r.buf2binstring = function(e3) {
          return l(e3, e3.length);
        }, r.binstring2buf = function(e3) {
          for (var t3 = new h2.Buf8(e3.length), r3 = 0, n4 = t3.length; r3 < n4; r3++) t3[r3] = e3.charCodeAt(r3);
          return t3;
        }, r.buf2string = function(e3, t3) {
          var r3, n4, i2, s2, a = t3 || e3.length, o = new Array(2 * a);
          for (r3 = n4 = 0; r3 < a; ) if ((i2 = e3[r3++]) < 128) o[n4++] = i2;
          else if (4 < (s2 = u[i2])) o[n4++] = 65533, r3 += s2 - 1;
          else {
            for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r3 < a; ) i2 = i2 << 6 | 63 & e3[r3++], s2--;
            1 < s2 ? o[n4++] = 65533 : i2 < 65536 ? o[n4++] = i2 : (i2 -= 65536, o[n4++] = 55296 | i2 >> 10 & 1023, o[n4++] = 56320 | 1023 & i2);
          }
          return l(o, n4);
        }, r.utf8border = function(e3, t3) {
          var r3;
          for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) r3--;
          return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
        };
      }, { "./common": 41 }], 43: [function(e2, t2, r) {
        "use strict";
        t2.exports = function(e3, t3, r3, n3) {
          for (var i = 65535 & e3 | 0, s = e3 >>> 16 & 65535 | 0, a = 0; 0 !== r3; ) {
            for (r3 -= a = 2e3 < r3 ? 2e3 : r3; s = s + (i = i + t3[n3++] | 0) | 0, --a; ) ;
            i %= 65521, s %= 65521;
          }
          return i | s << 16 | 0;
        };
      }, {}], 44: [function(e2, t2, r) {
        "use strict";
        t2.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
      }, {}], 45: [function(e2, t2, r) {
        "use strict";
        var o = function() {
          for (var e3, t3 = [], r3 = 0; r3 < 256; r3++) {
            e3 = r3;
            for (var n3 = 0; n3 < 8; n3++) e3 = 1 & e3 ? 3988292384 ^ e3 >>> 1 : e3 >>> 1;
            t3[r3] = e3;
          }
          return t3;
        }();
        t2.exports = function(e3, t3, r3, n3) {
          var i = o, s = n3 + r3;
          e3 ^= -1;
          for (var a = n3; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
          return -1 ^ e3;
        };
      }, {}], 46: [function(e2, t2, r) {
        "use strict";
        var h2, c = e2("../utils/common"), u = e2("./trees"), d = e2("./adler32"), p = e2("./crc32"), n3 = e2("./messages"), l = 0, f3 = 4, m2 = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w2 = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4;
        function R(e3, t3) {
          return e3.msg = n3[t3], t3;
        }
        function T(e3) {
          return (e3 << 1) - (4 < e3 ? 9 : 0);
        }
        function D(e3) {
          for (var t3 = e3.length; 0 <= --t3; ) e3[t3] = 0;
        }
        function F(e3) {
          var t3 = e3.state, r3 = t3.pending;
          r3 > e3.avail_out && (r3 = e3.avail_out), 0 !== r3 && (c.arraySet(e3.output, t3.pending_buf, t3.pending_out, r3, e3.next_out), e3.next_out += r3, t3.pending_out += r3, e3.total_out += r3, e3.avail_out -= r3, t3.pending -= r3, 0 === t3.pending && (t3.pending_out = 0));
        }
        function N(e3, t3) {
          u._tr_flush_block(e3, 0 <= e3.block_start ? e3.block_start : -1, e3.strstart - e3.block_start, t3), e3.block_start = e3.strstart, F(e3.strm);
        }
        function U(e3, t3) {
          e3.pending_buf[e3.pending++] = t3;
        }
        function P(e3, t3) {
          e3.pending_buf[e3.pending++] = t3 >>> 8 & 255, e3.pending_buf[e3.pending++] = 255 & t3;
        }
        function L(e3, t3) {
          var r3, n4, i2 = e3.max_chain_length, s2 = e3.strstart, a2 = e3.prev_length, o2 = e3.nice_match, h3 = e3.strstart > e3.w_size - z ? e3.strstart - (e3.w_size - z) : 0, u2 = e3.window, l2 = e3.w_mask, f4 = e3.prev, c3 = e3.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
          e3.prev_length >= e3.good_match && (i2 >>= 2), o2 > e3.lookahead && (o2 = e3.lookahead);
          do {
            if (u2[(r3 = t3) + a2] === p2 && u2[r3 + a2 - 1] === d2 && u2[r3] === u2[s2] && u2[++r3] === u2[s2 + 1]) {
              s2 += 2, r3++;
              do {
              } while (u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && u2[++s2] === u2[++r3] && s2 < c3);
              if (n4 = S - (c3 - s2), s2 = c3 - S, a2 < n4) {
                if (e3.match_start = t3, o2 <= (a2 = n4)) break;
                d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
              }
            }
          } while ((t3 = f4[t3 & l2]) > h3 && 0 != --i2);
          return a2 <= e3.lookahead ? a2 : e3.lookahead;
        }
        function j(e3) {
          var t3, r3, n4, i2, s2, a2, o2, h3, u2, l2, f4 = e3.w_size;
          do {
            if (i2 = e3.window_size - e3.lookahead - e3.strstart, e3.strstart >= f4 + (f4 - z)) {
              for (c.arraySet(e3.window, e3.window, f4, f4, 0), e3.match_start -= f4, e3.strstart -= f4, e3.block_start -= f4, t3 = r3 = e3.hash_size; n4 = e3.head[--t3], e3.head[t3] = f4 <= n4 ? n4 - f4 : 0, --r3; ) ;
              for (t3 = r3 = f4; n4 = e3.prev[--t3], e3.prev[t3] = f4 <= n4 ? n4 - f4 : 0, --r3; ) ;
              i2 += f4;
            }
            if (0 === e3.strm.avail_in) break;
            if (a2 = e3.strm, o2 = e3.window, h3 = e3.strstart + e3.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r3 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h3), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h3) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h3)), a2.next_in += l2, a2.total_in += l2, l2), e3.lookahead += r3, e3.lookahead + e3.insert >= x) for (s2 = e3.strstart - e3.insert, e3.ins_h = e3.window[s2], e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[s2 + 1]) & e3.hash_mask; e3.insert && (e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[s2 + x - 1]) & e3.hash_mask, e3.prev[s2 & e3.w_mask] = e3.head[e3.ins_h], e3.head[e3.ins_h] = s2, s2++, e3.insert--, !(e3.lookahead + e3.insert < x)); ) ;
          } while (e3.lookahead < z && 0 !== e3.strm.avail_in);
        }
        function Z(e3, t3) {
          for (var r3, n4; ; ) {
            if (e3.lookahead < z) {
              if (j(e3), e3.lookahead < z && t3 === l) return A;
              if (0 === e3.lookahead) break;
            }
            if (r3 = 0, e3.lookahead >= x && (e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[e3.strstart + x - 1]) & e3.hash_mask, r3 = e3.prev[e3.strstart & e3.w_mask] = e3.head[e3.ins_h], e3.head[e3.ins_h] = e3.strstart), 0 !== r3 && e3.strstart - r3 <= e3.w_size - z && (e3.match_length = L(e3, r3)), e3.match_length >= x) if (n4 = u._tr_tally(e3, e3.strstart - e3.match_start, e3.match_length - x), e3.lookahead -= e3.match_length, e3.match_length <= e3.max_lazy_match && e3.lookahead >= x) {
              for (e3.match_length--; e3.strstart++, e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[e3.strstart + x - 1]) & e3.hash_mask, r3 = e3.prev[e3.strstart & e3.w_mask] = e3.head[e3.ins_h], e3.head[e3.ins_h] = e3.strstart, 0 != --e3.match_length; ) ;
              e3.strstart++;
            } else e3.strstart += e3.match_length, e3.match_length = 0, e3.ins_h = e3.window[e3.strstart], e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[e3.strstart + 1]) & e3.hash_mask;
            else n4 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++;
            if (n4 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
          }
          return e3.insert = e3.strstart < x - 1 ? e3.strstart : x - 1, t3 === f3 ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
        }
        function W(e3, t3) {
          for (var r3, n4, i2; ; ) {
            if (e3.lookahead < z) {
              if (j(e3), e3.lookahead < z && t3 === l) return A;
              if (0 === e3.lookahead) break;
            }
            if (r3 = 0, e3.lookahead >= x && (e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[e3.strstart + x - 1]) & e3.hash_mask, r3 = e3.prev[e3.strstart & e3.w_mask] = e3.head[e3.ins_h], e3.head[e3.ins_h] = e3.strstart), e3.prev_length = e3.match_length, e3.prev_match = e3.match_start, e3.match_length = x - 1, 0 !== r3 && e3.prev_length < e3.max_lazy_match && e3.strstart - r3 <= e3.w_size - z && (e3.match_length = L(e3, r3), e3.match_length <= 5 && (1 === e3.strategy || e3.match_length === x && 4096 < e3.strstart - e3.match_start) && (e3.match_length = x - 1)), e3.prev_length >= x && e3.match_length <= e3.prev_length) {
              for (i2 = e3.strstart + e3.lookahead - x, n4 = u._tr_tally(e3, e3.strstart - 1 - e3.prev_match, e3.prev_length - x), e3.lookahead -= e3.prev_length - 1, e3.prev_length -= 2; ++e3.strstart <= i2 && (e3.ins_h = (e3.ins_h << e3.hash_shift ^ e3.window[e3.strstart + x - 1]) & e3.hash_mask, r3 = e3.prev[e3.strstart & e3.w_mask] = e3.head[e3.ins_h], e3.head[e3.ins_h] = e3.strstart), 0 != --e3.prev_length; ) ;
              if (e3.match_available = 0, e3.match_length = x - 1, e3.strstart++, n4 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
            } else if (e3.match_available) {
              if ((n4 = u._tr_tally(e3, 0, e3.window[e3.strstart - 1])) && N(e3, false), e3.strstart++, e3.lookahead--, 0 === e3.strm.avail_out) return A;
            } else e3.match_available = 1, e3.strstart++, e3.lookahead--;
          }
          return e3.match_available && (n4 = u._tr_tally(e3, 0, e3.window[e3.strstart - 1]), e3.match_available = 0), e3.insert = e3.strstart < x - 1 ? e3.strstart : x - 1, t3 === f3 ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
        }
        function M(e3, t3, r3, n4, i2) {
          this.good_length = e3, this.max_lazy = t3, this.nice_length = r3, this.max_chain = n4, this.func = i2;
        }
        function H() {
          this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w2), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
        }
        function G(e3) {
          var t3;
          return e3 && e3.state ? (e3.total_in = e3.total_out = 0, e3.data_type = i, (t3 = e3.state).pending = 0, t3.pending_out = 0, t3.wrap < 0 && (t3.wrap = -t3.wrap), t3.status = t3.wrap ? C : E, e3.adler = 2 === t3.wrap ? 0 : 1, t3.last_flush = l, u._tr_init(t3), m2) : R(e3, _);
        }
        function K(e3) {
          var t3 = G(e3);
          return t3 === m2 && function(e4) {
            e4.window_size = 2 * e4.w_size, D(e4.head), e4.max_lazy_match = h2[e4.level].max_lazy, e4.good_match = h2[e4.level].good_length, e4.nice_match = h2[e4.level].nice_length, e4.max_chain_length = h2[e4.level].max_chain, e4.strstart = 0, e4.block_start = 0, e4.lookahead = 0, e4.insert = 0, e4.match_length = e4.prev_length = x - 1, e4.match_available = 0, e4.ins_h = 0;
          }(e3.state), t3;
        }
        function Y(e3, t3, r3, n4, i2, s2) {
          if (!e3) return _;
          var a2 = 1;
          if (t3 === g && (t3 = 6), n4 < 0 ? (a2 = 0, n4 = -n4) : 15 < n4 && (a2 = 2, n4 -= 16), i2 < 1 || y < i2 || r3 !== v || n4 < 8 || 15 < n4 || t3 < 0 || 9 < t3 || s2 < 0 || b < s2) return R(e3, _);
          8 === n4 && (n4 = 9);
          var o2 = new H();
          return (e3.state = o2).strm = e3, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n4, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t3, o2.strategy = s2, o2.method = r3, K(e3);
        }
        h2 = [new M(0, 0, 0, 0, function(e3, t3) {
          var r3 = 65535;
          for (r3 > e3.pending_buf_size - 5 && (r3 = e3.pending_buf_size - 5); ; ) {
            if (e3.lookahead <= 1) {
              if (j(e3), 0 === e3.lookahead && t3 === l) return A;
              if (0 === e3.lookahead) break;
            }
            e3.strstart += e3.lookahead, e3.lookahead = 0;
            var n4 = e3.block_start + r3;
            if ((0 === e3.strstart || e3.strstart >= n4) && (e3.lookahead = e3.strstart - n4, e3.strstart = n4, N(e3, false), 0 === e3.strm.avail_out)) return A;
            if (e3.strstart - e3.block_start >= e3.w_size - z && (N(e3, false), 0 === e3.strm.avail_out)) return A;
          }
          return e3.insert = 0, t3 === f3 ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : (e3.strstart > e3.block_start && (N(e3, false), e3.strm.avail_out), A);
        }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e3, t3) {
          return Y(e3, t3, v, 15, 8, 0);
        }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e3, t3) {
          return e3 && e3.state ? 2 !== e3.state.wrap ? _ : (e3.state.gzhead = t3, m2) : _;
        }, r.deflate = function(e3, t3) {
          var r3, n4, i2, s2;
          if (!e3 || !e3.state || 5 < t3 || t3 < 0) return e3 ? R(e3, _) : _;
          if (n4 = e3.state, !e3.output || !e3.input && 0 !== e3.avail_in || 666 === n4.status && t3 !== f3) return R(e3, 0 === e3.avail_out ? -5 : _);
          if (n4.strm = e3, r3 = n4.last_flush, n4.last_flush = t3, n4.status === C) if (2 === n4.wrap) e3.adler = 0, U(n4, 31), U(n4, 139), U(n4, 8), n4.gzhead ? (U(n4, (n4.gzhead.text ? 1 : 0) + (n4.gzhead.hcrc ? 2 : 0) + (n4.gzhead.extra ? 4 : 0) + (n4.gzhead.name ? 8 : 0) + (n4.gzhead.comment ? 16 : 0)), U(n4, 255 & n4.gzhead.time), U(n4, n4.gzhead.time >> 8 & 255), U(n4, n4.gzhead.time >> 16 & 255), U(n4, n4.gzhead.time >> 24 & 255), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 255 & n4.gzhead.os), n4.gzhead.extra && n4.gzhead.extra.length && (U(n4, 255 & n4.gzhead.extra.length), U(n4, n4.gzhead.extra.length >> 8 & 255)), n4.gzhead.hcrc && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending, 0)), n4.gzindex = 0, n4.status = 69) : (U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 3), n4.status = E);
          else {
            var a2 = v + (n4.w_bits - 8 << 4) << 8;
            a2 |= (2 <= n4.strategy || n4.level < 2 ? 0 : n4.level < 6 ? 1 : 6 === n4.level ? 2 : 3) << 6, 0 !== n4.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n4.status = E, P(n4, a2), 0 !== n4.strstart && (P(n4, e3.adler >>> 16), P(n4, 65535 & e3.adler)), e3.adler = 1;
          }
          if (69 === n4.status) if (n4.gzhead.extra) {
            for (i2 = n4.pending; n4.gzindex < (65535 & n4.gzhead.extra.length) && (n4.pending !== n4.pending_buf_size || (n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), F(e3), i2 = n4.pending, n4.pending !== n4.pending_buf_size)); ) U(n4, 255 & n4.gzhead.extra[n4.gzindex]), n4.gzindex++;
            n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), n4.gzindex === n4.gzhead.extra.length && (n4.gzindex = 0, n4.status = 73);
          } else n4.status = 73;
          if (73 === n4.status) if (n4.gzhead.name) {
            i2 = n4.pending;
            do {
              if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), F(e3), i2 = n4.pending, n4.pending === n4.pending_buf_size)) {
                s2 = 1;
                break;
              }
              s2 = n4.gzindex < n4.gzhead.name.length ? 255 & n4.gzhead.name.charCodeAt(n4.gzindex++) : 0, U(n4, s2);
            } while (0 !== s2);
            n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), 0 === s2 && (n4.gzindex = 0, n4.status = 91);
          } else n4.status = 91;
          if (91 === n4.status) if (n4.gzhead.comment) {
            i2 = n4.pending;
            do {
              if (n4.pending === n4.pending_buf_size && (n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), F(e3), i2 = n4.pending, n4.pending === n4.pending_buf_size)) {
                s2 = 1;
                break;
              }
              s2 = n4.gzindex < n4.gzhead.comment.length ? 255 & n4.gzhead.comment.charCodeAt(n4.gzindex++) : 0, U(n4, s2);
            } while (0 !== s2);
            n4.gzhead.hcrc && n4.pending > i2 && (e3.adler = p(e3.adler, n4.pending_buf, n4.pending - i2, i2)), 0 === s2 && (n4.status = 103);
          } else n4.status = 103;
          if (103 === n4.status && (n4.gzhead.hcrc ? (n4.pending + 2 > n4.pending_buf_size && F(e3), n4.pending + 2 <= n4.pending_buf_size && (U(n4, 255 & e3.adler), U(n4, e3.adler >> 8 & 255), e3.adler = 0, n4.status = E)) : n4.status = E), 0 !== n4.pending) {
            if (F(e3), 0 === e3.avail_out) return n4.last_flush = -1, m2;
          } else if (0 === e3.avail_in && T(t3) <= T(r3) && t3 !== f3) return R(e3, -5);
          if (666 === n4.status && 0 !== e3.avail_in) return R(e3, -5);
          if (0 !== e3.avail_in || 0 !== n4.lookahead || t3 !== l && 666 !== n4.status) {
            var o2 = 2 === n4.strategy ? function(e4, t4) {
              for (var r4; ; ) {
                if (0 === e4.lookahead && (j(e4), 0 === e4.lookahead)) {
                  if (t4 === l) return A;
                  break;
                }
                if (e4.match_length = 0, r4 = u._tr_tally(e4, 0, e4.window[e4.strstart]), e4.lookahead--, e4.strstart++, r4 && (N(e4, false), 0 === e4.strm.avail_out)) return A;
              }
              return e4.insert = 0, t4 === f3 ? (N(e4, true), 0 === e4.strm.avail_out ? O : B) : e4.last_lit && (N(e4, false), 0 === e4.strm.avail_out) ? A : I;
            }(n4, t3) : 3 === n4.strategy ? function(e4, t4) {
              for (var r4, n5, i3, s3, a3 = e4.window; ; ) {
                if (e4.lookahead <= S) {
                  if (j(e4), e4.lookahead <= S && t4 === l) return A;
                  if (0 === e4.lookahead) break;
                }
                if (e4.match_length = 0, e4.lookahead >= x && 0 < e4.strstart && (n5 = a3[i3 = e4.strstart - 1]) === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3]) {
                  s3 = e4.strstart + S;
                  do {
                  } while (n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && n5 === a3[++i3] && i3 < s3);
                  e4.match_length = S - (s3 - i3), e4.match_length > e4.lookahead && (e4.match_length = e4.lookahead);
                }
                if (e4.match_length >= x ? (r4 = u._tr_tally(e4, 1, e4.match_length - x), e4.lookahead -= e4.match_length, e4.strstart += e4.match_length, e4.match_length = 0) : (r4 = u._tr_tally(e4, 0, e4.window[e4.strstart]), e4.lookahead--, e4.strstart++), r4 && (N(e4, false), 0 === e4.strm.avail_out)) return A;
              }
              return e4.insert = 0, t4 === f3 ? (N(e4, true), 0 === e4.strm.avail_out ? O : B) : e4.last_lit && (N(e4, false), 0 === e4.strm.avail_out) ? A : I;
            }(n4, t3) : h2[n4.level].func(n4, t3);
            if (o2 !== O && o2 !== B || (n4.status = 666), o2 === A || o2 === O) return 0 === e3.avail_out && (n4.last_flush = -1), m2;
            if (o2 === I && (1 === t3 ? u._tr_align(n4) : 5 !== t3 && (u._tr_stored_block(n4, 0, 0, false), 3 === t3 && (D(n4.head), 0 === n4.lookahead && (n4.strstart = 0, n4.block_start = 0, n4.insert = 0))), F(e3), 0 === e3.avail_out)) return n4.last_flush = -1, m2;
          }
          return t3 !== f3 ? m2 : n4.wrap <= 0 ? 1 : (2 === n4.wrap ? (U(n4, 255 & e3.adler), U(n4, e3.adler >> 8 & 255), U(n4, e3.adler >> 16 & 255), U(n4, e3.adler >> 24 & 255), U(n4, 255 & e3.total_in), U(n4, e3.total_in >> 8 & 255), U(n4, e3.total_in >> 16 & 255), U(n4, e3.total_in >> 24 & 255)) : (P(n4, e3.adler >>> 16), P(n4, 65535 & e3.adler)), F(e3), 0 < n4.wrap && (n4.wrap = -n4.wrap), 0 !== n4.pending ? m2 : 1);
        }, r.deflateEnd = function(e3) {
          var t3;
          return e3 && e3.state ? (t3 = e3.state.status) !== C && 69 !== t3 && 73 !== t3 && 91 !== t3 && 103 !== t3 && t3 !== E && 666 !== t3 ? R(e3, _) : (e3.state = null, t3 === E ? R(e3, -3) : m2) : _;
        }, r.deflateSetDictionary = function(e3, t3) {
          var r3, n4, i2, s2, a2, o2, h3, u2, l2 = t3.length;
          if (!e3 || !e3.state) return _;
          if (2 === (s2 = (r3 = e3.state).wrap) || 1 === s2 && r3.status !== C || r3.lookahead) return _;
          for (1 === s2 && (e3.adler = d(e3.adler, t3, l2, 0)), r3.wrap = 0, l2 >= r3.w_size && (0 === s2 && (D(r3.head), r3.strstart = 0, r3.block_start = 0, r3.insert = 0), u2 = new c.Buf8(r3.w_size), c.arraySet(u2, t3, l2 - r3.w_size, r3.w_size, 0), t3 = u2, l2 = r3.w_size), a2 = e3.avail_in, o2 = e3.next_in, h3 = e3.input, e3.avail_in = l2, e3.next_in = 0, e3.input = t3, j(r3); r3.lookahead >= x; ) {
            for (n4 = r3.strstart, i2 = r3.lookahead - (x - 1); r3.ins_h = (r3.ins_h << r3.hash_shift ^ r3.window[n4 + x - 1]) & r3.hash_mask, r3.prev[n4 & r3.w_mask] = r3.head[r3.ins_h], r3.head[r3.ins_h] = n4, n4++, --i2; ) ;
            r3.strstart = n4, r3.lookahead = x - 1, j(r3);
          }
          return r3.strstart += r3.lookahead, r3.block_start = r3.strstart, r3.insert = r3.lookahead, r3.lookahead = 0, r3.match_length = r3.prev_length = x - 1, r3.match_available = 0, e3.next_in = o2, e3.input = h3, e3.avail_in = a2, r3.wrap = s2, m2;
        }, r.deflateInfo = "pako deflate (from Nodeca project)";
      }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e2, t2, r) {
        "use strict";
        t2.exports = function() {
          this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false;
        };
      }, {}], 48: [function(e2, t2, r) {
        "use strict";
        t2.exports = function(e3, t3) {
          var r3, n3, i, s, a, o, h2, u, l, f3, c, d, p, m2, _, g, b, v, y, w2, k, x, S, z, C;
          r3 = e3.state, n3 = e3.next_in, z = e3.input, i = n3 + (e3.avail_in - 5), s = e3.next_out, C = e3.output, a = s - (t3 - e3.avail_out), o = s + (e3.avail_out - 257), h2 = r3.dmax, u = r3.wsize, l = r3.whave, f3 = r3.wnext, c = r3.window, d = r3.hold, p = r3.bits, m2 = r3.lencode, _ = r3.distcode, g = (1 << r3.lenbits) - 1, b = (1 << r3.distbits) - 1;
          e: do {
            p < 15 && (d += z[n3++] << p, p += 8, d += z[n3++] << p, p += 8), v = m2[d & g];
            t: for (; ; ) {
              if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) C[s++] = 65535 & v;
              else {
                if (!(16 & y)) {
                  if (0 == (64 & y)) {
                    v = m2[(65535 & v) + (d & (1 << y) - 1)];
                    continue t;
                  }
                  if (32 & y) {
                    r3.mode = 12;
                    break e;
                  }
                  e3.msg = "invalid literal/length code", r3.mode = 30;
                  break e;
                }
                w2 = 65535 & v, (y &= 15) && (p < y && (d += z[n3++] << p, p += 8), w2 += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n3++] << p, p += 8, d += z[n3++] << p, p += 8), v = _[d & b];
                r: for (; ; ) {
                  if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) {
                    if (0 == (64 & y)) {
                      v = _[(65535 & v) + (d & (1 << y) - 1)];
                      continue r;
                    }
                    e3.msg = "invalid distance code", r3.mode = 30;
                    break e;
                  }
                  if (k = 65535 & v, p < (y &= 15) && (d += z[n3++] << p, (p += 8) < y && (d += z[n3++] << p, p += 8)), h2 < (k += d & (1 << y) - 1)) {
                    e3.msg = "invalid distance too far back", r3.mode = 30;
                    break e;
                  }
                  if (d >>>= y, p -= y, (y = s - a) < k) {
                    if (l < (y = k - y) && r3.sane) {
                      e3.msg = "invalid distance too far back", r3.mode = 30;
                      break e;
                    }
                    if (S = c, (x = 0) === f3) {
                      if (x += u - y, y < w2) {
                        for (w2 -= y; C[s++] = c[x++], --y; ) ;
                        x = s - k, S = C;
                      }
                    } else if (f3 < y) {
                      if (x += u + f3 - y, (y -= f3) < w2) {
                        for (w2 -= y; C[s++] = c[x++], --y; ) ;
                        if (x = 0, f3 < w2) {
                          for (w2 -= y = f3; C[s++] = c[x++], --y; ) ;
                          x = s - k, S = C;
                        }
                      }
                    } else if (x += f3 - y, y < w2) {
                      for (w2 -= y; C[s++] = c[x++], --y; ) ;
                      x = s - k, S = C;
                    }
                    for (; 2 < w2; ) C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w2 -= 3;
                    w2 && (C[s++] = S[x++], 1 < w2 && (C[s++] = S[x++]));
                  } else {
                    for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w2 -= 3); ) ;
                    w2 && (C[s++] = C[x++], 1 < w2 && (C[s++] = C[x++]));
                  }
                  break;
                }
              }
              break;
            }
          } while (n3 < i && s < o);
          n3 -= w2 = p >> 3, d &= (1 << (p -= w2 << 3)) - 1, e3.next_in = n3, e3.next_out = s, e3.avail_in = n3 < i ? i - n3 + 5 : 5 - (n3 - i), e3.avail_out = s < o ? o - s + 257 : 257 - (s - o), r3.hold = d, r3.bits = p;
        };
      }, {}], 49: [function(e2, t2, r) {
        "use strict";
        var I = e2("../utils/common"), O = e2("./adler32"), B = e2("./crc32"), R = e2("./inffast"), T = e2("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n3 = 852, i = 592;
        function L(e3) {
          return (e3 >>> 24 & 255) + (e3 >>> 8 & 65280) + ((65280 & e3) << 8) + ((255 & e3) << 24);
        }
        function s() {
          this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
        }
        function a(e3) {
          var t3;
          return e3 && e3.state ? (t3 = e3.state, e3.total_in = e3.total_out = t3.total = 0, e3.msg = "", t3.wrap && (e3.adler = 1 & t3.wrap), t3.mode = P, t3.last = 0, t3.havedict = 0, t3.dmax = 32768, t3.head = null, t3.hold = 0, t3.bits = 0, t3.lencode = t3.lendyn = new I.Buf32(n3), t3.distcode = t3.distdyn = new I.Buf32(i), t3.sane = 1, t3.back = -1, N) : U;
        }
        function o(e3) {
          var t3;
          return e3 && e3.state ? ((t3 = e3.state).wsize = 0, t3.whave = 0, t3.wnext = 0, a(e3)) : U;
        }
        function h2(e3, t3) {
          var r3, n4;
          return e3 && e3.state ? (n4 = e3.state, t3 < 0 ? (r3 = 0, t3 = -t3) : (r3 = 1 + (t3 >> 4), t3 < 48 && (t3 &= 15)), t3 && (t3 < 8 || 15 < t3) ? U : (null !== n4.window && n4.wbits !== t3 && (n4.window = null), n4.wrap = r3, n4.wbits = t3, o(e3))) : U;
        }
        function u(e3, t3) {
          var r3, n4;
          return e3 ? (n4 = new s(), (e3.state = n4).window = null, (r3 = h2(e3, t3)) !== N && (e3.state = null), r3) : U;
        }
        var l, f3, c = true;
        function j(e3) {
          if (c) {
            var t3;
            for (l = new I.Buf32(512), f3 = new I.Buf32(32), t3 = 0; t3 < 144; ) e3.lens[t3++] = 8;
            for (; t3 < 256; ) e3.lens[t3++] = 9;
            for (; t3 < 280; ) e3.lens[t3++] = 7;
            for (; t3 < 288; ) e3.lens[t3++] = 8;
            for (T(D, e3.lens, 0, 288, l, 0, e3.work, { bits: 9 }), t3 = 0; t3 < 32; ) e3.lens[t3++] = 5;
            T(F, e3.lens, 0, 32, f3, 0, e3.work, { bits: 5 }), c = false;
          }
          e3.lencode = l, e3.lenbits = 9, e3.distcode = f3, e3.distbits = 5;
        }
        function Z(e3, t3, r3, n4) {
          var i2, s2 = e3.state;
          return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n4 >= s2.wsize ? (I.arraySet(s2.window, t3, r3 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n4 < (i2 = s2.wsize - s2.wnext) && (i2 = n4), I.arraySet(s2.window, t3, r3 - n4, i2, s2.wnext), (n4 -= i2) ? (I.arraySet(s2.window, t3, r3 - n4, n4, 0), s2.wnext = n4, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0;
        }
        r.inflateReset = o, r.inflateReset2 = h2, r.inflateResetKeep = a, r.inflateInit = function(e3) {
          return u(e3, 15);
        }, r.inflateInit2 = u, r.inflate = function(e3, t3) {
          var r3, n4, i2, s2, a2, o2, h3, u2, l2, f4, c3, d, p, m2, _, g, b, v, y, w2, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
          if (!e3 || !e3.state || !e3.output || !e3.input && 0 !== e3.avail_in) return U;
          12 === (r3 = e3.state).mode && (r3.mode = 13), a2 = e3.next_out, i2 = e3.output, h3 = e3.avail_out, s2 = e3.next_in, n4 = e3.input, o2 = e3.avail_in, u2 = r3.hold, l2 = r3.bits, f4 = o2, c3 = h3, x = N;
          e: for (; ; ) switch (r3.mode) {
            case P:
              if (0 === r3.wrap) {
                r3.mode = 13;
                break;
              }
              for (; l2 < 16; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if (2 & r3.wrap && 35615 === u2) {
                E[r3.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r3.check = B(r3.check, E, 2, 0), l2 = u2 = 0, r3.mode = 2;
                break;
              }
              if (r3.flags = 0, r3.head && (r3.head.done = false), !(1 & r3.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) {
                e3.msg = "incorrect header check", r3.mode = 30;
                break;
              }
              if (8 != (15 & u2)) {
                e3.msg = "unknown compression method", r3.mode = 30;
                break;
              }
              if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r3.wbits) r3.wbits = k;
              else if (k > r3.wbits) {
                e3.msg = "invalid window size", r3.mode = 30;
                break;
              }
              r3.dmax = 1 << k, e3.adler = r3.check = 1, r3.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0;
              break;
            case 2:
              for (; l2 < 16; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if (r3.flags = u2, 8 != (255 & r3.flags)) {
                e3.msg = "unknown compression method", r3.mode = 30;
                break;
              }
              if (57344 & r3.flags) {
                e3.msg = "unknown header flags set", r3.mode = 30;
                break;
              }
              r3.head && (r3.head.text = u2 >> 8 & 1), 512 & r3.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r3.check = B(r3.check, E, 2, 0)), l2 = u2 = 0, r3.mode = 3;
            case 3:
              for (; l2 < 32; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              r3.head && (r3.head.time = u2), 512 & r3.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r3.check = B(r3.check, E, 4, 0)), l2 = u2 = 0, r3.mode = 4;
            case 4:
              for (; l2 < 16; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              r3.head && (r3.head.xflags = 255 & u2, r3.head.os = u2 >> 8), 512 & r3.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r3.check = B(r3.check, E, 2, 0)), l2 = u2 = 0, r3.mode = 5;
            case 5:
              if (1024 & r3.flags) {
                for (; l2 < 16; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                r3.length = u2, r3.head && (r3.head.extra_len = u2), 512 & r3.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r3.check = B(r3.check, E, 2, 0)), l2 = u2 = 0;
              } else r3.head && (r3.head.extra = null);
              r3.mode = 6;
            case 6:
              if (1024 & r3.flags && (o2 < (d = r3.length) && (d = o2), d && (r3.head && (k = r3.head.extra_len - r3.length, r3.head.extra || (r3.head.extra = new Array(r3.head.extra_len)), I.arraySet(r3.head.extra, n4, s2, d, k)), 512 & r3.flags && (r3.check = B(r3.check, n4, d, s2)), o2 -= d, s2 += d, r3.length -= d), r3.length)) break e;
              r3.length = 0, r3.mode = 7;
            case 7:
              if (2048 & r3.flags) {
                if (0 === o2) break e;
                for (d = 0; k = n4[s2 + d++], r3.head && k && r3.length < 65536 && (r3.head.name += String.fromCharCode(k)), k && d < o2; ) ;
                if (512 & r3.flags && (r3.check = B(r3.check, n4, d, s2)), o2 -= d, s2 += d, k) break e;
              } else r3.head && (r3.head.name = null);
              r3.length = 0, r3.mode = 8;
            case 8:
              if (4096 & r3.flags) {
                if (0 === o2) break e;
                for (d = 0; k = n4[s2 + d++], r3.head && k && r3.length < 65536 && (r3.head.comment += String.fromCharCode(k)), k && d < o2; ) ;
                if (512 & r3.flags && (r3.check = B(r3.check, n4, d, s2)), o2 -= d, s2 += d, k) break e;
              } else r3.head && (r3.head.comment = null);
              r3.mode = 9;
            case 9:
              if (512 & r3.flags) {
                for (; l2 < 16; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                if (u2 !== (65535 & r3.check)) {
                  e3.msg = "header crc mismatch", r3.mode = 30;
                  break;
                }
                l2 = u2 = 0;
              }
              r3.head && (r3.head.hcrc = r3.flags >> 9 & 1, r3.head.done = true), e3.adler = r3.check = 0, r3.mode = 12;
              break;
            case 10:
              for (; l2 < 32; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              e3.adler = r3.check = L(u2), l2 = u2 = 0, r3.mode = 11;
            case 11:
              if (0 === r3.havedict) return e3.next_out = a2, e3.avail_out = h3, e3.next_in = s2, e3.avail_in = o2, r3.hold = u2, r3.bits = l2, 2;
              e3.adler = r3.check = 1, r3.mode = 12;
            case 12:
              if (5 === t3 || 6 === t3) break e;
            case 13:
              if (r3.last) {
                u2 >>>= 7 & l2, l2 -= 7 & l2, r3.mode = 27;
                break;
              }
              for (; l2 < 3; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              switch (r3.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) {
                case 0:
                  r3.mode = 14;
                  break;
                case 1:
                  if (j(r3), r3.mode = 20, 6 !== t3) break;
                  u2 >>>= 2, l2 -= 2;
                  break e;
                case 2:
                  r3.mode = 17;
                  break;
                case 3:
                  e3.msg = "invalid block type", r3.mode = 30;
              }
              u2 >>>= 2, l2 -= 2;
              break;
            case 14:
              for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if ((65535 & u2) != (u2 >>> 16 ^ 65535)) {
                e3.msg = "invalid stored block lengths", r3.mode = 30;
                break;
              }
              if (r3.length = 65535 & u2, l2 = u2 = 0, r3.mode = 15, 6 === t3) break e;
            case 15:
              r3.mode = 16;
            case 16:
              if (d = r3.length) {
                if (o2 < d && (d = o2), h3 < d && (d = h3), 0 === d) break e;
                I.arraySet(i2, n4, s2, d, a2), o2 -= d, s2 += d, h3 -= d, a2 += d, r3.length -= d;
                break;
              }
              r3.mode = 12;
              break;
            case 17:
              for (; l2 < 14; ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if (r3.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r3.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r3.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r3.nlen || 30 < r3.ndist) {
                e3.msg = "too many length or distance symbols", r3.mode = 30;
                break;
              }
              r3.have = 0, r3.mode = 18;
            case 18:
              for (; r3.have < r3.ncode; ) {
                for (; l2 < 3; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                r3.lens[A[r3.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3;
              }
              for (; r3.have < 19; ) r3.lens[A[r3.have++]] = 0;
              if (r3.lencode = r3.lendyn, r3.lenbits = 7, S = { bits: r3.lenbits }, x = T(0, r3.lens, 0, 19, r3.lencode, 0, r3.work, S), r3.lenbits = S.bits, x) {
                e3.msg = "invalid code lengths set", r3.mode = 30;
                break;
              }
              r3.have = 0, r3.mode = 19;
            case 19:
              for (; r3.have < r3.nlen + r3.ndist; ) {
                for (; g = (C = r3.lencode[u2 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                if (b < 16) u2 >>>= _, l2 -= _, r3.lens[r3.have++] = b;
                else {
                  if (16 === b) {
                    for (z = _ + 2; l2 < z; ) {
                      if (0 === o2) break e;
                      o2--, u2 += n4[s2++] << l2, l2 += 8;
                    }
                    if (u2 >>>= _, l2 -= _, 0 === r3.have) {
                      e3.msg = "invalid bit length repeat", r3.mode = 30;
                      break;
                    }
                    k = r3.lens[r3.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2;
                  } else if (17 === b) {
                    for (z = _ + 3; l2 < z; ) {
                      if (0 === o2) break e;
                      o2--, u2 += n4[s2++] << l2, l2 += 8;
                    }
                    l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3;
                  } else {
                    for (z = _ + 7; l2 < z; ) {
                      if (0 === o2) break e;
                      o2--, u2 += n4[s2++] << l2, l2 += 8;
                    }
                    l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7;
                  }
                  if (r3.have + d > r3.nlen + r3.ndist) {
                    e3.msg = "invalid bit length repeat", r3.mode = 30;
                    break;
                  }
                  for (; d--; ) r3.lens[r3.have++] = k;
                }
              }
              if (30 === r3.mode) break;
              if (0 === r3.lens[256]) {
                e3.msg = "invalid code -- missing end-of-block", r3.mode = 30;
                break;
              }
              if (r3.lenbits = 9, S = { bits: r3.lenbits }, x = T(D, r3.lens, 0, r3.nlen, r3.lencode, 0, r3.work, S), r3.lenbits = S.bits, x) {
                e3.msg = "invalid literal/lengths set", r3.mode = 30;
                break;
              }
              if (r3.distbits = 6, r3.distcode = r3.distdyn, S = { bits: r3.distbits }, x = T(F, r3.lens, r3.nlen, r3.ndist, r3.distcode, 0, r3.work, S), r3.distbits = S.bits, x) {
                e3.msg = "invalid distances set", r3.mode = 30;
                break;
              }
              if (r3.mode = 20, 6 === t3) break e;
            case 20:
              r3.mode = 21;
            case 21:
              if (6 <= o2 && 258 <= h3) {
                e3.next_out = a2, e3.avail_out = h3, e3.next_in = s2, e3.avail_in = o2, r3.hold = u2, r3.bits = l2, R(e3, c3), a2 = e3.next_out, i2 = e3.output, h3 = e3.avail_out, s2 = e3.next_in, n4 = e3.input, o2 = e3.avail_in, u2 = r3.hold, l2 = r3.bits, 12 === r3.mode && (r3.back = -1);
                break;
              }
              for (r3.back = 0; g = (C = r3.lencode[u2 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if (g && 0 == (240 & g)) {
                for (v = _, y = g, w2 = b; g = (C = r3.lencode[w2 + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                u2 >>>= v, l2 -= v, r3.back += v;
              }
              if (u2 >>>= _, l2 -= _, r3.back += _, r3.length = b, 0 === g) {
                r3.mode = 26;
                break;
              }
              if (32 & g) {
                r3.back = -1, r3.mode = 12;
                break;
              }
              if (64 & g) {
                e3.msg = "invalid literal/length code", r3.mode = 30;
                break;
              }
              r3.extra = 15 & g, r3.mode = 22;
            case 22:
              if (r3.extra) {
                for (z = r3.extra; l2 < z; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                r3.length += u2 & (1 << r3.extra) - 1, u2 >>>= r3.extra, l2 -= r3.extra, r3.back += r3.extra;
              }
              r3.was = r3.length, r3.mode = 23;
            case 23:
              for (; g = (C = r3.distcode[u2 & (1 << r3.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
                if (0 === o2) break e;
                o2--, u2 += n4[s2++] << l2, l2 += 8;
              }
              if (0 == (240 & g)) {
                for (v = _, y = g, w2 = b; g = (C = r3.distcode[w2 + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                u2 >>>= v, l2 -= v, r3.back += v;
              }
              if (u2 >>>= _, l2 -= _, r3.back += _, 64 & g) {
                e3.msg = "invalid distance code", r3.mode = 30;
                break;
              }
              r3.offset = b, r3.extra = 15 & g, r3.mode = 24;
            case 24:
              if (r3.extra) {
                for (z = r3.extra; l2 < z; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                r3.offset += u2 & (1 << r3.extra) - 1, u2 >>>= r3.extra, l2 -= r3.extra, r3.back += r3.extra;
              }
              if (r3.offset > r3.dmax) {
                e3.msg = "invalid distance too far back", r3.mode = 30;
                break;
              }
              r3.mode = 25;
            case 25:
              if (0 === h3) break e;
              if (d = c3 - h3, r3.offset > d) {
                if ((d = r3.offset - d) > r3.whave && r3.sane) {
                  e3.msg = "invalid distance too far back", r3.mode = 30;
                  break;
                }
                p = d > r3.wnext ? (d -= r3.wnext, r3.wsize - d) : r3.wnext - d, d > r3.length && (d = r3.length), m2 = r3.window;
              } else m2 = i2, p = a2 - r3.offset, d = r3.length;
              for (h3 < d && (d = h3), h3 -= d, r3.length -= d; i2[a2++] = m2[p++], --d; ) ;
              0 === r3.length && (r3.mode = 21);
              break;
            case 26:
              if (0 === h3) break e;
              i2[a2++] = r3.length, h3--, r3.mode = 21;
              break;
            case 27:
              if (r3.wrap) {
                for (; l2 < 32; ) {
                  if (0 === o2) break e;
                  o2--, u2 |= n4[s2++] << l2, l2 += 8;
                }
                if (c3 -= h3, e3.total_out += c3, r3.total += c3, c3 && (e3.adler = r3.check = r3.flags ? B(r3.check, i2, c3, a2 - c3) : O(r3.check, i2, c3, a2 - c3)), c3 = h3, (r3.flags ? u2 : L(u2)) !== r3.check) {
                  e3.msg = "incorrect data check", r3.mode = 30;
                  break;
                }
                l2 = u2 = 0;
              }
              r3.mode = 28;
            case 28:
              if (r3.wrap && r3.flags) {
                for (; l2 < 32; ) {
                  if (0 === o2) break e;
                  o2--, u2 += n4[s2++] << l2, l2 += 8;
                }
                if (u2 !== (4294967295 & r3.total)) {
                  e3.msg = "incorrect length check", r3.mode = 30;
                  break;
                }
                l2 = u2 = 0;
              }
              r3.mode = 29;
            case 29:
              x = 1;
              break e;
            case 30:
              x = -3;
              break e;
            case 31:
              return -4;
            case 32:
            default:
              return U;
          }
          return e3.next_out = a2, e3.avail_out = h3, e3.next_in = s2, e3.avail_in = o2, r3.hold = u2, r3.bits = l2, (r3.wsize || c3 !== e3.avail_out && r3.mode < 30 && (r3.mode < 27 || 4 !== t3)) && Z(e3, e3.output, e3.next_out, c3 - e3.avail_out) ? (r3.mode = 31, -4) : (f4 -= e3.avail_in, c3 -= e3.avail_out, e3.total_in += f4, e3.total_out += c3, r3.total += c3, r3.wrap && c3 && (e3.adler = r3.check = r3.flags ? B(r3.check, i2, c3, e3.next_out - c3) : O(r3.check, i2, c3, e3.next_out - c3)), e3.data_type = r3.bits + (r3.last ? 64 : 0) + (12 === r3.mode ? 128 : 0) + (20 === r3.mode || 15 === r3.mode ? 256 : 0), (0 == f4 && 0 === c3 || 4 === t3) && x === N && (x = -5), x);
        }, r.inflateEnd = function(e3) {
          if (!e3 || !e3.state) return U;
          var t3 = e3.state;
          return t3.window && (t3.window = null), e3.state = null, N;
        }, r.inflateGetHeader = function(e3, t3) {
          var r3;
          return e3 && e3.state ? 0 == (2 & (r3 = e3.state).wrap) ? U : ((r3.head = t3).done = false, N) : U;
        }, r.inflateSetDictionary = function(e3, t3) {
          var r3, n4 = t3.length;
          return e3 && e3.state ? 0 !== (r3 = e3.state).wrap && 11 !== r3.mode ? U : 11 === r3.mode && O(1, t3, n4, 0) !== r3.check ? -3 : Z(e3, t3, n4, n4) ? (r3.mode = 31, -4) : (r3.havedict = 1, N) : U;
        }, r.inflateInfo = "pako inflate (from Nodeca project)";
      }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e2, t2, r) {
        "use strict";
        var D = e2("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
        t2.exports = function(e3, t3, r3, n3, i, s, a, o) {
          var h2, u, l, f3, c, d, p, m2, _, g = o.bits, b = 0, v = 0, y = 0, w2 = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0;
          for (b = 0; b <= 15; b++) O[b] = 0;
          for (v = 0; v < n3; v++) O[t3[r3 + v]]++;
          for (k = g, w2 = 15; 1 <= w2 && 0 === O[w2]; w2--) ;
          if (w2 < k && (k = w2), 0 === w2) return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0;
          for (y = 1; y < w2 && 0 === O[y]; y++) ;
          for (k < y && (k = y), b = z = 1; b <= 15; b++) if (z <<= 1, (z -= O[b]) < 0) return -1;
          if (0 < z && (0 === e3 || 1 !== w2)) return -1;
          for (B[1] = 0, b = 1; b < 15; b++) B[b + 1] = B[b] + O[b];
          for (v = 0; v < n3; v++) 0 !== t3[r3 + v] && (a[B[t3[r3 + v]]++] = v);
          if (d = 0 === e3 ? (A = R = a, 19) : 1 === e3 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f3 = (C = 1 << (x = k)) - 1, 1 === e3 && 852 < C || 2 === e3 && 592 < C) return 1;
          for (; ; ) {
            for (p = b - S, _ = a[v] < d ? (m2 = 0, a[v]) : a[v] > d ? (m2 = R[T + a[v]], A[I + a[v]]) : (m2 = 96, 0), h2 = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h2)] = p << 24 | m2 << 16 | _ | 0, 0 !== u; ) ;
            for (h2 = 1 << b - 1; E & h2; ) h2 >>= 1;
            if (0 !== h2 ? (E &= h2 - 1, E += h2) : E = 0, v++, 0 == --O[b]) {
              if (b === w2) break;
              b = t3[r3 + a[v]];
            }
            if (k < b && (E & f3) !== l) {
              for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w2 && !((z -= O[x + S]) <= 0); ) x++, z <<= 1;
              if (C += 1 << x, 1 === e3 && 852 < C || 2 === e3 && 592 < C) return 1;
              i[l = E & f3] = k << 24 | x << 16 | c - s | 0;
            }
          }
          return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0;
        };
      }, { "../utils/common": 41 }], 51: [function(e2, t2, r) {
        "use strict";
        t2.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
      }, {}], 52: [function(e2, t2, r) {
        "use strict";
        var i = e2("../utils/common"), o = 0, h2 = 1;
        function n3(e3) {
          for (var t3 = e3.length; 0 <= --t3; ) e3[t3] = 0;
        }
        var s = 0, a = 29, u = 256, l = u + 1 + a, f3 = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m2 = 256, b = 16, v = 17, y = 18, w2 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2));
        n3(z);
        var C = new Array(2 * f3);
        n3(C);
        var E = new Array(512);
        n3(E);
        var A = new Array(256);
        n3(A);
        var I = new Array(a);
        n3(I);
        var O, B, R, T = new Array(f3);
        function D(e3, t3, r3, n4, i2) {
          this.static_tree = e3, this.extra_bits = t3, this.extra_base = r3, this.elems = n4, this.max_length = i2, this.has_stree = e3 && e3.length;
        }
        function F(e3, t3) {
          this.dyn_tree = e3, this.max_code = 0, this.stat_desc = t3;
        }
        function N(e3) {
          return e3 < 256 ? E[e3] : E[256 + (e3 >>> 7)];
        }
        function U(e3, t3) {
          e3.pending_buf[e3.pending++] = 255 & t3, e3.pending_buf[e3.pending++] = t3 >>> 8 & 255;
        }
        function P(e3, t3, r3) {
          e3.bi_valid > d - r3 ? (e3.bi_buf |= t3 << e3.bi_valid & 65535, U(e3, e3.bi_buf), e3.bi_buf = t3 >> d - e3.bi_valid, e3.bi_valid += r3 - d) : (e3.bi_buf |= t3 << e3.bi_valid & 65535, e3.bi_valid += r3);
        }
        function L(e3, t3, r3) {
          P(e3, r3[2 * t3], r3[2 * t3 + 1]);
        }
        function j(e3, t3) {
          for (var r3 = 0; r3 |= 1 & e3, e3 >>>= 1, r3 <<= 1, 0 < --t3; ) ;
          return r3 >>> 1;
        }
        function Z(e3, t3, r3) {
          var n4, i2, s2 = new Array(g + 1), a2 = 0;
          for (n4 = 1; n4 <= g; n4++) s2[n4] = a2 = a2 + r3[n4 - 1] << 1;
          for (i2 = 0; i2 <= t3; i2++) {
            var o2 = e3[2 * i2 + 1];
            0 !== o2 && (e3[2 * i2] = j(s2[o2]++, o2));
          }
        }
        function W(e3) {
          var t3;
          for (t3 = 0; t3 < l; t3++) e3.dyn_ltree[2 * t3] = 0;
          for (t3 = 0; t3 < f3; t3++) e3.dyn_dtree[2 * t3] = 0;
          for (t3 = 0; t3 < c; t3++) e3.bl_tree[2 * t3] = 0;
          e3.dyn_ltree[2 * m2] = 1, e3.opt_len = e3.static_len = 0, e3.last_lit = e3.matches = 0;
        }
        function M(e3) {
          8 < e3.bi_valid ? U(e3, e3.bi_buf) : 0 < e3.bi_valid && (e3.pending_buf[e3.pending++] = e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0;
        }
        function H(e3, t3, r3, n4) {
          var i2 = 2 * t3, s2 = 2 * r3;
          return e3[i2] < e3[s2] || e3[i2] === e3[s2] && n4[t3] <= n4[r3];
        }
        function G(e3, t3, r3) {
          for (var n4 = e3.heap[r3], i2 = r3 << 1; i2 <= e3.heap_len && (i2 < e3.heap_len && H(t3, e3.heap[i2 + 1], e3.heap[i2], e3.depth) && i2++, !H(t3, n4, e3.heap[i2], e3.depth)); ) e3.heap[r3] = e3.heap[i2], r3 = i2, i2 <<= 1;
          e3.heap[r3] = n4;
        }
        function K(e3, t3, r3) {
          var n4, i2, s2, a2, o2 = 0;
          if (0 !== e3.last_lit) for (; n4 = e3.pending_buf[e3.d_buf + 2 * o2] << 8 | e3.pending_buf[e3.d_buf + 2 * o2 + 1], i2 = e3.pending_buf[e3.l_buf + o2], o2++, 0 === n4 ? L(e3, i2, t3) : (L(e3, (s2 = A[i2]) + u + 1, t3), 0 !== (a2 = w2[s2]) && P(e3, i2 -= I[s2], a2), L(e3, s2 = N(--n4), r3), 0 !== (a2 = k[s2]) && P(e3, n4 -= T[s2], a2)), o2 < e3.last_lit; ) ;
          L(e3, m2, t3);
        }
        function Y(e3, t3) {
          var r3, n4, i2, s2 = t3.dyn_tree, a2 = t3.stat_desc.static_tree, o2 = t3.stat_desc.has_stree, h3 = t3.stat_desc.elems, u2 = -1;
          for (e3.heap_len = 0, e3.heap_max = _, r3 = 0; r3 < h3; r3++) 0 !== s2[2 * r3] ? (e3.heap[++e3.heap_len] = u2 = r3, e3.depth[r3] = 0) : s2[2 * r3 + 1] = 0;
          for (; e3.heap_len < 2; ) s2[2 * (i2 = e3.heap[++e3.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e3.depth[i2] = 0, e3.opt_len--, o2 && (e3.static_len -= a2[2 * i2 + 1]);
          for (t3.max_code = u2, r3 = e3.heap_len >> 1; 1 <= r3; r3--) G(e3, s2, r3);
          for (i2 = h3; r3 = e3.heap[1], e3.heap[1] = e3.heap[e3.heap_len--], G(e3, s2, 1), n4 = e3.heap[1], e3.heap[--e3.heap_max] = r3, e3.heap[--e3.heap_max] = n4, s2[2 * i2] = s2[2 * r3] + s2[2 * n4], e3.depth[i2] = (e3.depth[r3] >= e3.depth[n4] ? e3.depth[r3] : e3.depth[n4]) + 1, s2[2 * r3 + 1] = s2[2 * n4 + 1] = i2, e3.heap[1] = i2++, G(e3, s2, 1), 2 <= e3.heap_len; ) ;
          e3.heap[--e3.heap_max] = e3.heap[1], function(e4, t4) {
            var r4, n5, i3, s3, a3, o3, h4 = t4.dyn_tree, u3 = t4.max_code, l2 = t4.stat_desc.static_tree, f4 = t4.stat_desc.has_stree, c3 = t4.stat_desc.extra_bits, d2 = t4.stat_desc.extra_base, p2 = t4.stat_desc.max_length, m3 = 0;
            for (s3 = 0; s3 <= g; s3++) e4.bl_count[s3] = 0;
            for (h4[2 * e4.heap[e4.heap_max] + 1] = 0, r4 = e4.heap_max + 1; r4 < _; r4++) p2 < (s3 = h4[2 * h4[2 * (n5 = e4.heap[r4]) + 1] + 1] + 1) && (s3 = p2, m3++), h4[2 * n5 + 1] = s3, u3 < n5 || (e4.bl_count[s3]++, a3 = 0, d2 <= n5 && (a3 = c3[n5 - d2]), o3 = h4[2 * n5], e4.opt_len += o3 * (s3 + a3), f4 && (e4.static_len += o3 * (l2[2 * n5 + 1] + a3)));
            if (0 !== m3) {
              do {
                for (s3 = p2 - 1; 0 === e4.bl_count[s3]; ) s3--;
                e4.bl_count[s3]--, e4.bl_count[s3 + 1] += 2, e4.bl_count[p2]--, m3 -= 2;
              } while (0 < m3);
              for (s3 = p2; 0 !== s3; s3--) for (n5 = e4.bl_count[s3]; 0 !== n5; ) u3 < (i3 = e4.heap[--r4]) || (h4[2 * i3 + 1] !== s3 && (e4.opt_len += (s3 - h4[2 * i3 + 1]) * h4[2 * i3], h4[2 * i3 + 1] = s3), n5--);
            }
          }(e3, t3), Z(s2, u2, e3.bl_count);
        }
        function X(e3, t3, r3) {
          var n4, i2, s2 = -1, a2 = t3[1], o2 = 0, h3 = 7, u2 = 4;
          for (0 === a2 && (h3 = 138, u2 = 3), t3[2 * (r3 + 1) + 1] = 65535, n4 = 0; n4 <= r3; n4++) i2 = a2, a2 = t3[2 * (n4 + 1) + 1], ++o2 < h3 && i2 === a2 || (o2 < u2 ? e3.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e3.bl_tree[2 * i2]++, e3.bl_tree[2 * b]++) : o2 <= 10 ? e3.bl_tree[2 * v]++ : e3.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h3 = 138, 3) : i2 === a2 ? (h3 = 6, 3) : (h3 = 7, 4));
        }
        function V(e3, t3, r3) {
          var n4, i2, s2 = -1, a2 = t3[1], o2 = 0, h3 = 7, u2 = 4;
          for (0 === a2 && (h3 = 138, u2 = 3), n4 = 0; n4 <= r3; n4++) if (i2 = a2, a2 = t3[2 * (n4 + 1) + 1], !(++o2 < h3 && i2 === a2)) {
            if (o2 < u2) for (; L(e3, i2, e3.bl_tree), 0 != --o2; ) ;
            else 0 !== i2 ? (i2 !== s2 && (L(e3, i2, e3.bl_tree), o2--), L(e3, b, e3.bl_tree), P(e3, o2 - 3, 2)) : o2 <= 10 ? (L(e3, v, e3.bl_tree), P(e3, o2 - 3, 3)) : (L(e3, y, e3.bl_tree), P(e3, o2 - 11, 7));
            s2 = i2, u2 = (o2 = 0) === a2 ? (h3 = 138, 3) : i2 === a2 ? (h3 = 6, 3) : (h3 = 7, 4);
          }
        }
        n3(T);
        var q = false;
        function J(e3, t3, r3, n4) {
          P(e3, (s << 1) + (n4 ? 1 : 0), 3), function(e4, t4, r4, n5) {
            M(e4), n5 && (U(e4, r4), U(e4, ~r4)), i.arraySet(e4.pending_buf, e4.window, t4, r4, e4.pending), e4.pending += r4;
          }(e3, t3, r3, true);
        }
        r._tr_init = function(e3) {
          q || (function() {
            var e4, t3, r3, n4, i2, s2 = new Array(g + 1);
            for (n4 = r3 = 0; n4 < a - 1; n4++) for (I[n4] = r3, e4 = 0; e4 < 1 << w2[n4]; e4++) A[r3++] = n4;
            for (A[r3 - 1] = n4, n4 = i2 = 0; n4 < 16; n4++) for (T[n4] = i2, e4 = 0; e4 < 1 << k[n4]; e4++) E[i2++] = n4;
            for (i2 >>= 7; n4 < f3; n4++) for (T[n4] = i2 << 7, e4 = 0; e4 < 1 << k[n4] - 7; e4++) E[256 + i2++] = n4;
            for (t3 = 0; t3 <= g; t3++) s2[t3] = 0;
            for (e4 = 0; e4 <= 143; ) z[2 * e4 + 1] = 8, e4++, s2[8]++;
            for (; e4 <= 255; ) z[2 * e4 + 1] = 9, e4++, s2[9]++;
            for (; e4 <= 279; ) z[2 * e4 + 1] = 7, e4++, s2[7]++;
            for (; e4 <= 287; ) z[2 * e4 + 1] = 8, e4++, s2[8]++;
            for (Z(z, l + 1, s2), e4 = 0; e4 < f3; e4++) C[2 * e4 + 1] = 5, C[2 * e4] = j(e4, 5);
            O = new D(z, w2, u + 1, l, g), B = new D(C, k, 0, f3, g), R = new D(new Array(0), x, 0, c, p);
          }(), q = true), e3.l_desc = new F(e3.dyn_ltree, O), e3.d_desc = new F(e3.dyn_dtree, B), e3.bl_desc = new F(e3.bl_tree, R), e3.bi_buf = 0, e3.bi_valid = 0, W(e3);
        }, r._tr_stored_block = J, r._tr_flush_block = function(e3, t3, r3, n4) {
          var i2, s2, a2 = 0;
          0 < e3.level ? (2 === e3.strm.data_type && (e3.strm.data_type = function(e4) {
            var t4, r4 = 4093624447;
            for (t4 = 0; t4 <= 31; t4++, r4 >>>= 1) if (1 & r4 && 0 !== e4.dyn_ltree[2 * t4]) return o;
            if (0 !== e4.dyn_ltree[18] || 0 !== e4.dyn_ltree[20] || 0 !== e4.dyn_ltree[26]) return h2;
            for (t4 = 32; t4 < u; t4++) if (0 !== e4.dyn_ltree[2 * t4]) return h2;
            return o;
          }(e3)), Y(e3, e3.l_desc), Y(e3, e3.d_desc), a2 = function(e4) {
            var t4;
            for (X(e4, e4.dyn_ltree, e4.l_desc.max_code), X(e4, e4.dyn_dtree, e4.d_desc.max_code), Y(e4, e4.bl_desc), t4 = c - 1; 3 <= t4 && 0 === e4.bl_tree[2 * S[t4] + 1]; t4--) ;
            return e4.opt_len += 3 * (t4 + 1) + 5 + 5 + 4, t4;
          }(e3), i2 = e3.opt_len + 3 + 7 >>> 3, (s2 = e3.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r3 + 5, r3 + 4 <= i2 && -1 !== t3 ? J(e3, t3, r3, n4) : 4 === e3.strategy || s2 === i2 ? (P(e3, 2 + (n4 ? 1 : 0), 3), K(e3, z, C)) : (P(e3, 4 + (n4 ? 1 : 0), 3), function(e4, t4, r4, n5) {
            var i3;
            for (P(e4, t4 - 257, 5), P(e4, r4 - 1, 5), P(e4, n5 - 4, 4), i3 = 0; i3 < n5; i3++) P(e4, e4.bl_tree[2 * S[i3] + 1], 3);
            V(e4, e4.dyn_ltree, t4 - 1), V(e4, e4.dyn_dtree, r4 - 1);
          }(e3, e3.l_desc.max_code + 1, e3.d_desc.max_code + 1, a2 + 1), K(e3, e3.dyn_ltree, e3.dyn_dtree)), W(e3), n4 && M(e3);
        }, r._tr_tally = function(e3, t3, r3) {
          return e3.pending_buf[e3.d_buf + 2 * e3.last_lit] = t3 >>> 8 & 255, e3.pending_buf[e3.d_buf + 2 * e3.last_lit + 1] = 255 & t3, e3.pending_buf[e3.l_buf + e3.last_lit] = 255 & r3, e3.last_lit++, 0 === t3 ? e3.dyn_ltree[2 * r3]++ : (e3.matches++, t3--, e3.dyn_ltree[2 * (A[r3] + u + 1)]++, e3.dyn_dtree[2 * N(t3)]++), e3.last_lit === e3.lit_bufsize - 1;
        }, r._tr_align = function(e3) {
          P(e3, 2, 3), L(e3, m2, z), function(e4) {
            16 === e4.bi_valid ? (U(e4, e4.bi_buf), e4.bi_buf = 0, e4.bi_valid = 0) : 8 <= e4.bi_valid && (e4.pending_buf[e4.pending++] = 255 & e4.bi_buf, e4.bi_buf >>= 8, e4.bi_valid -= 8);
          }(e3);
        };
      }, { "../utils/common": 41 }], 53: [function(e2, t2, r) {
        "use strict";
        t2.exports = function() {
          this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
        };
      }, {}], 54: [function(e2, t2, r) {
        (function(e3) {
          !function(r3, n3) {
            "use strict";
            if (!r3.setImmediate) {
              var i, s, t3, a, o = 1, h2 = {}, u = false, l = r3.document, e4 = Object.getPrototypeOf && Object.getPrototypeOf(r3);
              e4 = e4 && e4.setTimeout ? e4 : r3, i = "[object process]" === {}.toString.call(r3.process) ? function(e5) {
                process.nextTick(function() {
                  c(e5);
                });
              } : function() {
                if (r3.postMessage && !r3.importScripts) {
                  var e5 = true, t4 = r3.onmessage;
                  return r3.onmessage = function() {
                    e5 = false;
                  }, r3.postMessage("", "*"), r3.onmessage = t4, e5;
                }
              }() ? (a = "setImmediate$" + Math.random() + "$", r3.addEventListener ? r3.addEventListener("message", d, false) : r3.attachEvent("onmessage", d), function(e5) {
                r3.postMessage(a + e5, "*");
              }) : r3.MessageChannel ? ((t3 = new MessageChannel()).port1.onmessage = function(e5) {
                c(e5.data);
              }, function(e5) {
                t3.port2.postMessage(e5);
              }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e5) {
                var t4 = l.createElement("script");
                t4.onreadystatechange = function() {
                  c(e5), t4.onreadystatechange = null, s.removeChild(t4), t4 = null;
                }, s.appendChild(t4);
              }) : function(e5) {
                setTimeout(c, 0, e5);
              }, e4.setImmediate = function(e5) {
                "function" != typeof e5 && (e5 = new Function("" + e5));
                for (var t4 = new Array(arguments.length - 1), r4 = 0; r4 < t4.length; r4++) t4[r4] = arguments[r4 + 1];
                var n4 = { callback: e5, args: t4 };
                return h2[o] = n4, i(o), o++;
              }, e4.clearImmediate = f3;
            }
            function f3(e5) {
              delete h2[e5];
            }
            function c(e5) {
              if (u) setTimeout(c, 0, e5);
              else {
                var t4 = h2[e5];
                if (t4) {
                  u = true;
                  try {
                    !function(e6) {
                      var t5 = e6.callback, r4 = e6.args;
                      switch (r4.length) {
                        case 0:
                          t5();
                          break;
                        case 1:
                          t5(r4[0]);
                          break;
                        case 2:
                          t5(r4[0], r4[1]);
                          break;
                        case 3:
                          t5(r4[0], r4[1], r4[2]);
                          break;
                        default:
                          t5.apply(n3, r4);
                      }
                    }(t4);
                  } finally {
                    f3(e5), u = false;
                  }
                }
              }
            }
            function d(e5) {
              e5.source === r3 && "string" == typeof e5.data && 0 === e5.data.indexOf(a) && c(+e5.data.slice(a.length));
            }
          }("undefined" == typeof self ? void 0 === e3 ? this : e3 : self);
        }).call(this, "undefined" != typeof window ? window : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
      }, {}] }, {}, [10])(10);
    });
  }
});

// node_modules/smol-toml/dist/index.cjs
var require_dist = __commonJS({
  "node_modules/smol-toml/dist/index.cjs"(exports2, module2) {
    "use strict";
    var __defProp3 = Object.defineProperty;
    var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
    var __getOwnPropNames3 = Object.getOwnPropertyNames;
    var __hasOwnProp3 = Object.prototype.hasOwnProperty;
    var __export3 = (target, all) => {
      for (var name in all)
        __defProp3(target, name, { get: all[name], enumerable: true });
    };
    var __copyProps3 = (to, from, except, desc) => {
      if (from && typeof from === "object" || typeof from === "function") {
        for (let key4 of __getOwnPropNames3(from))
          if (!__hasOwnProp3.call(to, key4) && key4 !== except)
            __defProp3(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc3(from, key4)) || desc.enumerable });
      }
      return to;
    };
    var __toCommonJS3 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
    var index_exports = {};
    __export3(index_exports, {
      TomlDate: () => TomlDate,
      TomlError: () => TomlError,
      default: () => index_default,
      parse: () => parse2,
      stringify: () => stringify3
    });
    module2.exports = __toCommonJS3(index_exports);
    function getLineColFromPtr(string, ptr) {
      let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
      return [lines.length, lines.pop().length + 1];
    }
    function makeCodeBlock(string, line, column) {
      let lines = string.split(/\r\n|\n|\r/g);
      let codeblock = "";
      let numberLen = (Math.log10(line + 1) | 0) + 1;
      for (let i = line - 1; i <= line + 1; i++) {
        let l = lines[i - 1];
        if (!l)
          continue;
        codeblock += i.toString().padEnd(numberLen, " ");
        codeblock += ":  ";
        codeblock += l;
        codeblock += "\n";
        if (i === line) {
          codeblock += " ".repeat(numberLen + column + 2);
          codeblock += "^\n";
        }
      }
      return codeblock;
    }
    var TomlError = class extends Error {
      constructor(message, options) {
        const [line, column] = getLineColFromPtr(options.toml, options.ptr);
        const codeblock = makeCodeBlock(options.toml, line, column);
        super(`Invalid TOML document: ${message}

${codeblock}`, options);
        __publicField(this, "line");
        __publicField(this, "column");
        __publicField(this, "codeblock");
        this.line = line;
        this.column = column;
        this.codeblock = codeblock;
      }
    };
    function isEscaped(str, ptr) {
      let i = 0;
      while (str[ptr - ++i] === "\\")
        ;
      return --i && i % 2;
    }
    function indexOfNewline(str, start = 0, end = str.length) {
      let idx2 = str.indexOf("\n", start);
      if (str[idx2 - 1] === "\r")
        idx2--;
      return idx2 <= end ? idx2 : -1;
    }
    function skipComment(str, ptr) {
      for (let i = ptr; i < str.length; i++) {
        let c = str[i];
        if (c === "\n")
          return i;
        if (c === "\r" && str[i + 1] === "\n")
          return i + 1;
        if (c < " " && c !== "	" || c === "\x7F") {
          throw new TomlError("control characters are not allowed in comments", {
            toml: str,
            ptr
          });
        }
      }
      return str.length;
    }
    function skipVoid(str, ptr, banNewLines, banComments) {
      let c;
      while ((c = str[ptr]) === " " || c === "	" || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
        ptr++;
      return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
    }
    function skipUntil(str, ptr, sep4, end, banNewLines = false) {
      if (!end) {
        ptr = indexOfNewline(str, ptr);
        return ptr < 0 ? str.length : ptr;
      }
      for (let i = ptr; i < str.length; i++) {
        let c = str[i];
        if (c === "#") {
          i = indexOfNewline(str, i);
        } else if (c === sep4) {
          return i + 1;
        } else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
          return i;
        }
      }
      throw new TomlError("cannot find end of structure", {
        toml: str,
        ptr
      });
    }
    function getStringEnd(str, seek) {
      let first = str[seek];
      let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
      seek += target.length - 1;
      do
        seek = str.indexOf(target, ++seek);
      while (seek > -1 && first !== "'" && isEscaped(str, seek));
      if (seek > -1) {
        seek += target.length;
        if (target.length > 1) {
          if (str[seek] === first)
            seek++;
          if (str[seek] === first)
            seek++;
        }
      }
      return seek;
    }
    var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
    var _hasDate, _hasTime, _offset, _a6;
    var TomlDate = (_a6 = class extends Date {
      constructor(date) {
        let hasDate = true;
        let hasTime = true;
        let offset = "Z";
        if (typeof date === "string") {
          let match3 = date.match(DATE_TIME_RE);
          if (match3) {
            if (!match3[1]) {
              hasDate = false;
              date = `0000-01-01T${date}`;
            }
            hasTime = !!match3[2];
            hasTime && date[10] === " " && (date = date.replace(" ", "T"));
            if (match3[2] && +match3[2] > 23) {
              date = "";
            } else {
              offset = match3[3] || null;
              date = date.toUpperCase();
              if (!offset && hasTime)
                date += "Z";
            }
          } else {
            date = "";
          }
        }
        super(date);
        __privateAdd(this, _hasDate, false);
        __privateAdd(this, _hasTime, false);
        __privateAdd(this, _offset, null);
        if (!isNaN(this.getTime())) {
          __privateSet(this, _hasDate, hasDate);
          __privateSet(this, _hasTime, hasTime);
          __privateSet(this, _offset, offset);
        }
      }
      isDateTime() {
        return __privateGet(this, _hasDate) && __privateGet(this, _hasTime);
      }
      isLocal() {
        return !__privateGet(this, _hasDate) || !__privateGet(this, _hasTime) || !__privateGet(this, _offset);
      }
      isDate() {
        return __privateGet(this, _hasDate) && !__privateGet(this, _hasTime);
      }
      isTime() {
        return __privateGet(this, _hasTime) && !__privateGet(this, _hasDate);
      }
      isValid() {
        return __privateGet(this, _hasDate) || __privateGet(this, _hasTime);
      }
      toISOString() {
        let iso = super.toISOString();
        if (this.isDate())
          return iso.slice(0, 10);
        if (this.isTime())
          return iso.slice(11, 23);
        if (__privateGet(this, _offset) === null)
          return iso.slice(0, -1);
        if (__privateGet(this, _offset) === "Z")
          return iso;
        let offset = +__privateGet(this, _offset).slice(1, 3) * 60 + +__privateGet(this, _offset).slice(4, 6);
        offset = __privateGet(this, _offset)[0] === "-" ? offset : -offset;
        let offsetDate = new Date(this.getTime() - offset * 6e4);
        return offsetDate.toISOString().slice(0, -1) + __privateGet(this, _offset);
      }
      static wrapAsOffsetDateTime(jsDate, offset = "Z") {
        let date = new _a6(jsDate);
        __privateSet(date, _offset, offset);
        return date;
      }
      static wrapAsLocalDateTime(jsDate) {
        let date = new _a6(jsDate);
        __privateSet(date, _offset, null);
        return date;
      }
      static wrapAsLocalDate(jsDate) {
        let date = new _a6(jsDate);
        __privateSet(date, _hasTime, false);
        __privateSet(date, _offset, null);
        return date;
      }
      static wrapAsLocalTime(jsDate) {
        let date = new _a6(jsDate);
        __privateSet(date, _hasDate, false);
        __privateSet(date, _offset, null);
        return date;
      }
    }, _hasDate = new WeakMap(), _hasTime = new WeakMap(), _offset = new WeakMap(), _a6);
    var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
    var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
    var LEADING_ZERO = /^[+-]?0[0-9_]/;
    var ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
    var ESC_MAP = {
      b: "\b",
      t: "	",
      n: "\n",
      f: "\f",
      r: "\r",
      e: "\x1B",
      '"': '"',
      "\\": "\\"
    };
    function parseString(str, ptr = 0, endPtr = str.length) {
      let isLiteral = str[ptr] === "'";
      let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
      if (isMultiline) {
        endPtr -= 2;
        if (str[ptr += 2] === "\r")
          ptr++;
        if (str[ptr] === "\n")
          ptr++;
      }
      let tmp = 0;
      let isEscape;
      let parsed = "";
      let sliceStart = ptr;
      while (ptr < endPtr - 1) {
        let c = str[ptr++];
        if (c === "\n" || c === "\r" && str[ptr] === "\n") {
          if (!isMultiline) {
            throw new TomlError("newlines are not allowed in strings", {
              toml: str,
              ptr: ptr - 1
            });
          }
        } else if (c < " " && c !== "	" || c === "\x7F") {
          throw new TomlError("control characters are not allowed in strings", {
            toml: str,
            ptr: ptr - 1
          });
        }
        if (isEscape) {
          isEscape = false;
          if (c === "x" || c === "u" || c === "U") {
            let code = str.slice(ptr, ptr += c === "x" ? 2 : c === "u" ? 4 : 8);
            if (!ESCAPE_REGEX.test(code)) {
              throw new TomlError("invalid unicode escape", {
                toml: str,
                ptr: tmp
              });
            }
            try {
              parsed += String.fromCodePoint(parseInt(code, 16));
            } catch (e2) {
              throw new TomlError("invalid unicode escape", {
                toml: str,
                ptr: tmp
              });
            }
          } else if (isMultiline && (c === "\n" || c === " " || c === "	" || c === "\r")) {
            ptr = skipVoid(str, ptr - 1, true);
            if (str[ptr] !== "\n" && str[ptr] !== "\r") {
              throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
                toml: str,
                ptr: tmp
              });
            }
            ptr = skipVoid(str, ptr);
          } else if (c in ESC_MAP) {
            parsed += ESC_MAP[c];
          } else {
            throw new TomlError("unrecognized escape sequence", {
              toml: str,
              ptr: tmp
            });
          }
          sliceStart = ptr;
        } else if (!isLiteral && c === "\\") {
          tmp = ptr - 1;
          isEscape = true;
          parsed += str.slice(sliceStart, tmp);
        }
      }
      return parsed + str.slice(sliceStart, endPtr - 1);
    }
    function parseValue(value2, toml, ptr, integersAsBigInt) {
      if (value2 === "true")
        return true;
      if (value2 === "false")
        return false;
      if (value2 === "-inf")
        return -Infinity;
      if (value2 === "inf" || value2 === "+inf")
        return Infinity;
      if (value2 === "nan" || value2 === "+nan" || value2 === "-nan")
        return NaN;
      if (value2 === "-0")
        return integersAsBigInt ? /* @__PURE__ */ BigInt("0") : 0;
      let isInt2 = INT_REGEX.test(value2);
      if (isInt2 || FLOAT_REGEX.test(value2)) {
        if (LEADING_ZERO.test(value2)) {
          throw new TomlError("leading zeroes are not allowed", {
            toml,
            ptr
          });
        }
        value2 = value2.replace(/_/g, "");
        let numeric = +value2;
        if (isNaN(numeric)) {
          throw new TomlError("invalid number", {
            toml,
            ptr
          });
        }
        if (isInt2) {
          if ((isInt2 = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
            throw new TomlError("integer value cannot be represented losslessly", {
              toml,
              ptr
            });
          }
          if (isInt2 || integersAsBigInt === true)
            numeric = BigInt(value2);
        }
        return numeric;
      }
      const date = new TomlDate(value2);
      if (!date.isValid()) {
        throw new TomlError("invalid value", {
          toml,
          ptr
        });
      }
      return date;
    }
    function sliceAndTrimEndOf(str, startPtr, endPtr) {
      let value2 = str.slice(startPtr, endPtr);
      let commentIdx = value2.indexOf("#");
      if (commentIdx > -1) {
        skipComment(str, commentIdx);
        value2 = value2.slice(0, commentIdx);
      }
      return [value2.trimEnd(), commentIdx];
    }
    function extractValue(str, ptr, end, depth, integersAsBigInt) {
      if (depth === 0) {
        throw new TomlError("document contains excessively nested structures. aborting.", {
          toml: str,
          ptr
        });
      }
      let c = str[ptr];
      if (c === "[" || c === "{") {
        let [value2, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
        if (end) {
          endPtr2 = skipVoid(str, endPtr2);
          if (str[endPtr2] === ",")
            endPtr2++;
          else if (str[endPtr2] !== end) {
            throw new TomlError("expected comma or end of structure", {
              toml: str,
              ptr: endPtr2
            });
          }
        }
        return [value2, endPtr2];
      }
      let endPtr;
      if (c === '"' || c === "'") {
        endPtr = getStringEnd(str, ptr);
        let parsed = parseString(str, ptr, endPtr);
        if (end) {
          endPtr = skipVoid(str, endPtr);
          if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
            throw new TomlError("unexpected character encountered", {
              toml: str,
              ptr: endPtr
            });
          }
          endPtr += +(str[endPtr] === ",");
        }
        return [parsed, endPtr];
      }
      endPtr = skipUntil(str, ptr, ",", end);
      let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","));
      if (!slice[0]) {
        throw new TomlError("incomplete key-value declaration: no value specified", {
          toml: str,
          ptr
        });
      }
      if (end && slice[1] > -1) {
        endPtr = skipVoid(str, ptr + slice[1]);
        endPtr += +(str[endPtr] === ",");
      }
      return [
        parseValue(slice[0], str, ptr, integersAsBigInt),
        endPtr
      ];
    }
    var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
    function parseKey(str, ptr, end = "=") {
      let dot = ptr - 1;
      let parsed = [];
      let endPtr = str.indexOf(end, ptr);
      if (endPtr < 0) {
        throw new TomlError("incomplete key-value: cannot find end of key", {
          toml: str,
          ptr
        });
      }
      do {
        let c = str[ptr = ++dot];
        if (c !== " " && c !== "	") {
          if (c === '"' || c === "'") {
            if (c === str[ptr + 1] && c === str[ptr + 2]) {
              throw new TomlError("multiline strings are not allowed in keys", {
                toml: str,
                ptr
              });
            }
            let eos = getStringEnd(str, ptr);
            if (eos < 0) {
              throw new TomlError("unfinished string encountered", {
                toml: str,
                ptr
              });
            }
            dot = str.indexOf(".", eos);
            let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
            let newLine = indexOfNewline(strEnd);
            if (newLine > -1) {
              throw new TomlError("newlines are not allowed in keys", {
                toml: str,
                ptr: ptr + dot + newLine
              });
            }
            if (strEnd.trimStart()) {
              throw new TomlError("found extra tokens after the string part", {
                toml: str,
                ptr: eos
              });
            }
            if (endPtr < eos) {
              endPtr = str.indexOf(end, eos);
              if (endPtr < 0) {
                throw new TomlError("incomplete key-value: cannot find end of key", {
                  toml: str,
                  ptr
                });
              }
            }
            parsed.push(parseString(str, ptr, eos));
          } else {
            dot = str.indexOf(".", ptr);
            let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
            if (!KEY_PART_RE.test(part)) {
              throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
                toml: str,
                ptr
              });
            }
            parsed.push(part.trimEnd());
          }
        }
      } while (dot + 1 && dot < endPtr);
      return [parsed, skipVoid(str, endPtr + 1, true, true)];
    }
    function parseInlineTable(str, ptr, depth, integersAsBigInt) {
      let res2 = {};
      let seen = /* @__PURE__ */ new Set();
      let c;
      ptr++;
      while ((c = str[ptr++]) !== "}" && c) {
        if (c === ",") {
          throw new TomlError("expected value, found comma", {
            toml: str,
            ptr: ptr - 1
          });
        } else if (c === "#")
          ptr = skipComment(str, ptr);
        else if (c !== " " && c !== "	" && c !== "\n" && c !== "\r") {
          let k;
          let t2 = res2;
          let hasOwn = false;
          let [key4, keyEndPtr] = parseKey(str, ptr - 1);
          for (let i = 0; i < key4.length; i++) {
            if (i)
              t2 = hasOwn ? t2[k] : t2[k] = {};
            k = key4[i];
            if ((hasOwn = Object.hasOwn(t2, k)) && (typeof t2[k] !== "object" || seen.has(t2[k]))) {
              throw new TomlError("trying to redefine an already defined value", {
                toml: str,
                ptr
              });
            }
            if (!hasOwn && k === "__proto__") {
              Object.defineProperty(t2, k, { enumerable: true, configurable: true, writable: true });
            }
          }
          if (hasOwn) {
            throw new TomlError("trying to redefine an already defined value", {
              toml: str,
              ptr
            });
          }
          let [value2, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
          seen.add(value2);
          t2[k] = value2;
          ptr = valueEndPtr;
        }
      }
      if (!c) {
        throw new TomlError("unfinished table encountered", {
          toml: str,
          ptr
        });
      }
      return [res2, ptr];
    }
    function parseArray(str, ptr, depth, integersAsBigInt) {
      let res2 = [];
      let c;
      ptr++;
      while ((c = str[ptr++]) !== "]" && c) {
        if (c === ",") {
          throw new TomlError("expected value, found comma", {
            toml: str,
            ptr: ptr - 1
          });
        } else if (c === "#")
          ptr = skipComment(str, ptr);
        else if (c !== " " && c !== "	" && c !== "\n" && c !== "\r") {
          let e2 = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
          res2.push(e2[0]);
          ptr = e2[1];
        }
      }
      if (!c) {
        throw new TomlError("unfinished array encountered", {
          toml: str,
          ptr
        });
      }
      return [res2, ptr];
    }
    function peekTable(key4, table2, meta, type) {
      var _a7, _b4;
      let t2 = table2;
      let m2 = meta;
      let k;
      let hasOwn = false;
      let state2;
      for (let i = 0; i < key4.length; i++) {
        if (i) {
          t2 = hasOwn ? t2[k] : t2[k] = {};
          m2 = (state2 = m2[k]).c;
          if (type === 0 && (state2.t === 1 || state2.t === 2)) {
            return null;
          }
          if (state2.t === 2) {
            let l = t2.length - 1;
            t2 = t2[l];
            m2 = m2[l].c;
          }
        }
        k = key4[i];
        if ((hasOwn = Object.hasOwn(t2, k)) && ((_a7 = m2[k]) == null ? void 0 : _a7.t) === 0 && ((_b4 = m2[k]) == null ? void 0 : _b4.d)) {
          return null;
        }
        if (!hasOwn) {
          if (k === "__proto__") {
            Object.defineProperty(t2, k, { enumerable: true, configurable: true, writable: true });
            Object.defineProperty(m2, k, { enumerable: true, configurable: true, writable: true });
          }
          m2[k] = {
            t: i < key4.length - 1 && type === 2 ? 3 : type,
            d: false,
            i: 0,
            c: {}
          };
        }
      }
      state2 = m2[k];
      if (state2.t !== type && !(type === 1 && state2.t === 3)) {
        return null;
      }
      if (type === 2) {
        if (!state2.d) {
          state2.d = true;
          t2[k] = [];
        }
        t2[k].push(t2 = {});
        state2.c[state2.i++] = state2 = { t: 1, d: false, i: 0, c: {} };
      }
      if (state2.d) {
        return null;
      }
      state2.d = true;
      if (type === 1) {
        t2 = hasOwn ? t2[k] : t2[k] = {};
      } else if (type === 0 && hasOwn) {
        return null;
      }
      return [k, t2, state2.c];
    }
    function parse2(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
      let res2 = {};
      let meta = {};
      let tbl = res2;
      let m2 = meta;
      for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
        if (toml[ptr] === "[") {
          let isTableArray = toml[++ptr] === "[";
          let k = parseKey(toml, ptr += +isTableArray, "]");
          if (isTableArray) {
            if (toml[k[1] - 1] !== "]") {
              throw new TomlError("expected end of table declaration", {
                toml,
                ptr: k[1] - 1
              });
            }
            k[1]++;
          }
          let p = peekTable(
            k[0],
            res2,
            meta,
            isTableArray ? 2 : 1
            /* Type.EXPLICIT */
          );
          if (!p) {
            throw new TomlError("trying to redefine an already defined table or value", {
              toml,
              ptr
            });
          }
          m2 = p[2];
          tbl = p[1];
          ptr = k[1];
        } else {
          let k = parseKey(toml, ptr);
          let p = peekTable(
            k[0],
            tbl,
            m2,
            0
            /* Type.DOTTED */
          );
          if (!p) {
            throw new TomlError("trying to redefine an already defined table or value", {
              toml,
              ptr
            });
          }
          let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
          p[1][p[0]] = v[0];
          ptr = v[1];
        }
        ptr = skipVoid(toml, ptr, true);
        if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
          throw new TomlError("each key-value declaration must be followed by an end-of-line", {
            toml,
            ptr
          });
        }
        ptr = skipVoid(toml, ptr);
      }
      return res2;
    }
    var BARE_KEY = /^[a-z0-9-_]+$/i;
    function extendedTypeOf(obj) {
      let type = typeof obj;
      if (type === "object") {
        if (Array.isArray(obj))
          return "array";
        if (obj instanceof Date)
          return "date";
      }
      return type;
    }
    function isArrayOfTables(obj) {
      for (let i = 0; i < obj.length; i++) {
        if (extendedTypeOf(obj[i]) !== "object")
          return false;
      }
      return obj.length != 0;
    }
    function formatString(s) {
      return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
    }
    function stringifyValue(val, type, depth, numberAsFloat) {
      if (depth === 0) {
        throw new Error("Could not stringify the object: maximum object depth exceeded");
      }
      if (type === "number") {
        if (isNaN(val))
          return "nan";
        if (val === Infinity)
          return "inf";
        if (val === -Infinity)
          return "-inf";
        if (numberAsFloat && Number.isInteger(val))
          return val.toFixed(1);
        return val.toString();
      }
      if (type === "bigint" || type === "boolean") {
        return val.toString();
      }
      if (type === "string") {
        return formatString(val);
      }
      if (type === "date") {
        if (isNaN(val.getTime())) {
          throw new TypeError("cannot serialize invalid date");
        }
        return val.toISOString();
      }
      if (type === "object") {
        return stringifyInlineTable(val, depth, numberAsFloat);
      }
      if (type === "array") {
        return stringifyArray(val, depth, numberAsFloat);
      }
    }
    function stringifyInlineTable(obj, depth, numberAsFloat) {
      let keys2 = Object.keys(obj);
      if (keys2.length === 0)
        return "{}";
      let res2 = "{ ";
      for (let i = 0; i < keys2.length; i++) {
        let k = keys2[i];
        if (i)
          res2 += ", ";
        res2 += BARE_KEY.test(k) ? k : formatString(k);
        res2 += " = ";
        res2 += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
      }
      return res2 + " }";
    }
    function stringifyArray(array, depth, numberAsFloat) {
      if (array.length === 0)
        return "[]";
      let res2 = "[ ";
      for (let i = 0; i < array.length; i++) {
        if (i)
          res2 += ", ";
        if (array[i] === null || array[i] === void 0) {
          throw new TypeError("arrays cannot contain null or undefined values");
        }
        res2 += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
      }
      return res2 + " ]";
    }
    function stringifyArrayTable(array, key4, depth, numberAsFloat) {
      if (depth === 0) {
        throw new Error("Could not stringify the object: maximum object depth exceeded");
      }
      let res2 = "";
      for (let i = 0; i < array.length; i++) {
        res2 += `${res2 && "\n"}[[${key4}]]
`;
        res2 += stringifyTable(0, array[i], key4, depth, numberAsFloat);
      }
      return res2;
    }
    function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
      if (depth === 0) {
        throw new Error("Could not stringify the object: maximum object depth exceeded");
      }
      let preamble = "";
      let tables = "";
      let keys2 = Object.keys(obj);
      for (let i = 0; i < keys2.length; i++) {
        let k = keys2[i];
        if (obj[k] !== null && obj[k] !== void 0) {
          let type = extendedTypeOf(obj[k]);
          if (type === "symbol" || type === "function") {
            throw new TypeError(`cannot serialize values of type '${type}'`);
          }
          let key4 = BARE_KEY.test(k) ? k : formatString(k);
          if (type === "array" && isArrayOfTables(obj[k])) {
            tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key4}` : key4, depth - 1, numberAsFloat);
          } else if (type === "object") {
            let tblKey = prefix ? `${prefix}.${key4}` : key4;
            tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
          } else {
            preamble += key4;
            preamble += " = ";
            preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
            preamble += "\n";
          }
        }
      }
      if (tableKey && (preamble || !tables))
        preamble = preamble ? `[${tableKey}]
${preamble}` : `[${tableKey}]`;
      return preamble && tables ? `${preamble}
${tables}` : preamble || tables;
    }
    function stringify3(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
      if (extendedTypeOf(obj) !== "object") {
        throw new TypeError("stringify can only be called with an object");
      }
      let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
      if (str[str.length - 1] !== "\n")
        return str + "\n";
      return str;
    }
    var index_default = { parse: parse2, stringify: stringify3, TomlDate, TomlError };
  }
});

// node_modules/js-yaml/lib/common.js
var require_common = __commonJS({
  "node_modules/js-yaml/lib/common.js"(exports2, module2) {
    "use strict";
    function isNothing(subject) {
      return typeof subject === "undefined" || subject === null;
    }
    function isObject(subject) {
      return typeof subject === "object" && subject !== null;
    }
    function toArray(sequence) {
      if (Array.isArray(sequence)) return sequence;
      else if (isNothing(sequence)) return [];
      return [sequence];
    }
    function extend(target, source2) {
      var index6, length, key4, sourceKeys;
      if (source2) {
        sourceKeys = Object.keys(source2);
        for (index6 = 0, length = sourceKeys.length; index6 < length; index6 += 1) {
          key4 = sourceKeys[index6];
          target[key4] = source2[key4];
        }
      }
      return target;
    }
    function repeat(string, count) {
      var result = "", cycle;
      for (cycle = 0; cycle < count; cycle += 1) {
        result += string;
      }
      return result;
    }
    function isNegativeZero(number) {
      return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
    }
    module2.exports.isNothing = isNothing;
    module2.exports.isObject = isObject;
    module2.exports.toArray = toArray;
    module2.exports.repeat = repeat;
    module2.exports.isNegativeZero = isNegativeZero;
    module2.exports.extend = extend;
  }
});

// node_modules/js-yaml/lib/exception.js
var require_exception = __commonJS({
  "node_modules/js-yaml/lib/exception.js"(exports2, module2) {
    "use strict";
    function formatError(exception, compact) {
      var where = "", message = exception.reason || "(unknown reason)";
      if (!exception.mark) return message;
      if (exception.mark.name) {
        where += 'in "' + exception.mark.name + '" ';
      }
      where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
      if (!compact && exception.mark.snippet) {
        where += "\n\n" + exception.mark.snippet;
      }
      return message + " " + where;
    }
    function YAMLException(reason, mark) {
      Error.call(this);
      this.name = "YAMLException";
      this.reason = reason;
      this.mark = mark;
      this.message = formatError(this, false);
      if (Error.captureStackTrace) {
        Error.captureStackTrace(this, this.constructor);
      } else {
        this.stack = new Error().stack || "";
      }
    }
    YAMLException.prototype = Object.create(Error.prototype);
    YAMLException.prototype.constructor = YAMLException;
    YAMLException.prototype.toString = function toString(compact) {
      return this.name + ": " + formatError(this, compact);
    };
    module2.exports = YAMLException;
  }
});

// node_modules/js-yaml/lib/snippet.js
var require_snippet = __commonJS({
  "node_modules/js-yaml/lib/snippet.js"(exports2, module2) {
    "use strict";
    var common2 = require_common();
    function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
      var head2 = "";
      var tail = "";
      var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
      if (position - lineStart > maxHalfLength) {
        head2 = " ... ";
        lineStart = position - maxHalfLength + head2.length;
      }
      if (lineEnd - position > maxHalfLength) {
        tail = " ...";
        lineEnd = position + maxHalfLength - tail.length;
      }
      return {
        str: head2 + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
        pos: position - lineStart + head2.length
        // relative position
      };
    }
    function padStart(string, max3) {
      return common2.repeat(" ", max3 - string.length) + string;
    }
    function makeSnippet(mark, options) {
      options = Object.create(options || null);
      if (!mark.buffer) return null;
      if (!options.maxLength) options.maxLength = 79;
      if (typeof options.indent !== "number") options.indent = 1;
      if (typeof options.linesBefore !== "number") options.linesBefore = 3;
      if (typeof options.linesAfter !== "number") options.linesAfter = 2;
      var re = /\r?\n|\r|\0/g;
      var lineStarts = [0];
      var lineEnds = [];
      var match3;
      var foundLineNo = -1;
      while (match3 = re.exec(mark.buffer)) {
        lineEnds.push(match3.index);
        lineStarts.push(match3.index + match3[0].length);
        if (mark.position <= match3.index && foundLineNo < 0) {
          foundLineNo = lineStarts.length - 2;
        }
      }
      if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
      var result = "", i, line;
      var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
      var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
      for (i = 1; i <= options.linesBefore; i++) {
        if (foundLineNo - i < 0) break;
        line = getLine(
          mark.buffer,
          lineStarts[foundLineNo - i],
          lineEnds[foundLineNo - i],
          mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
          maxLineLength
        );
        result = common2.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
      }
      line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
      result += common2.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
      result += common2.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
      for (i = 1; i <= options.linesAfter; i++) {
        if (foundLineNo + i >= lineEnds.length) break;
        line = getLine(
          mark.buffer,
          lineStarts[foundLineNo + i],
          lineEnds[foundLineNo + i],
          mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
          maxLineLength
        );
        result += common2.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
      }
      return result.replace(/\n$/, "");
    }
    module2.exports = makeSnippet;
  }
});

// node_modules/js-yaml/lib/type.js
var require_type = __commonJS({
  "node_modules/js-yaml/lib/type.js"(exports2, module2) {
    "use strict";
    var YAMLException = require_exception();
    var TYPE_CONSTRUCTOR_OPTIONS = [
      "kind",
      "multi",
      "resolve",
      "construct",
      "instanceOf",
      "predicate",
      "represent",
      "representName",
      "defaultStyle",
      "styleAliases"
    ];
    var YAML_NODE_KINDS = [
      "scalar",
      "sequence",
      "mapping"
    ];
    function compileStyleAliases(map2) {
      var result = {};
      if (map2 !== null) {
        Object.keys(map2).forEach(function(style) {
          map2[style].forEach(function(alias) {
            result[String(alias)] = style;
          });
        });
      }
      return result;
    }
    function Type(tag2, options) {
      options = options || {};
      Object.keys(options).forEach(function(name) {
        if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
          throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag2 + '" YAML type.');
        }
      });
      this.options = options;
      this.tag = tag2;
      this.kind = options["kind"] || null;
      this.resolve = options["resolve"] || function() {
        return true;
      };
      this.construct = options["construct"] || function(data) {
        return data;
      };
      this.instanceOf = options["instanceOf"] || null;
      this.predicate = options["predicate"] || null;
      this.represent = options["represent"] || null;
      this.representName = options["representName"] || null;
      this.defaultStyle = options["defaultStyle"] || null;
      this.multi = options["multi"] || false;
      this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
      if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
        throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag2 + '" YAML type.');
      }
    }
    module2.exports = Type;
  }
});

// node_modules/js-yaml/lib/schema.js
var require_schema = __commonJS({
  "node_modules/js-yaml/lib/schema.js"(exports2, module2) {
    "use strict";
    var YAMLException = require_exception();
    var Type = require_type();
    function compileList(schema, name) {
      var result = [];
      schema[name].forEach(function(currentType) {
        var newIndex = result.length;
        result.forEach(function(previousType, previousIndex) {
          if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
            newIndex = previousIndex;
          }
        });
        result[newIndex] = currentType;
      });
      return result;
    }
    function compileMap() {
      var result = {
        scalar: {},
        sequence: {},
        mapping: {},
        fallback: {},
        multi: {
          scalar: [],
          sequence: [],
          mapping: [],
          fallback: []
        }
      }, index6, length;
      function collectType(type) {
        if (type.multi) {
          result.multi[type.kind].push(type);
          result.multi["fallback"].push(type);
        } else {
          result[type.kind][type.tag] = result["fallback"][type.tag] = type;
        }
      }
      for (index6 = 0, length = arguments.length; index6 < length; index6 += 1) {
        arguments[index6].forEach(collectType);
      }
      return result;
    }
    function Schema(definition) {
      return this.extend(definition);
    }
    Schema.prototype.extend = function extend(definition) {
      var implicit = [];
      var explicit = [];
      if (definition instanceof Type) {
        explicit.push(definition);
      } else if (Array.isArray(definition)) {
        explicit = explicit.concat(definition);
      } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
        if (definition.implicit) implicit = implicit.concat(definition.implicit);
        if (definition.explicit) explicit = explicit.concat(definition.explicit);
      } else {
        throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
      }
      implicit.forEach(function(type) {
        if (!(type instanceof Type)) {
          throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
        }
        if (type.loadKind && type.loadKind !== "scalar") {
          throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
        }
        if (type.multi) {
          throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
        }
      });
      explicit.forEach(function(type) {
        if (!(type instanceof Type)) {
          throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
        }
      });
      var result = Object.create(Schema.prototype);
      result.implicit = (this.implicit || []).concat(implicit);
      result.explicit = (this.explicit || []).concat(explicit);
      result.compiledImplicit = compileList(result, "implicit");
      result.compiledExplicit = compileList(result, "explicit");
      result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
      return result;
    };
    module2.exports = Schema;
  }
});

// node_modules/js-yaml/lib/type/str.js
var require_str = __commonJS({
  "node_modules/js-yaml/lib/type/str.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    module2.exports = new Type("tag:yaml.org,2002:str", {
      kind: "scalar",
      construct: function(data) {
        return data !== null ? data : "";
      }
    });
  }
});

// node_modules/js-yaml/lib/type/seq.js
var require_seq = __commonJS({
  "node_modules/js-yaml/lib/type/seq.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    module2.exports = new Type("tag:yaml.org,2002:seq", {
      kind: "sequence",
      construct: function(data) {
        return data !== null ? data : [];
      }
    });
  }
});

// node_modules/js-yaml/lib/type/map.js
var require_map = __commonJS({
  "node_modules/js-yaml/lib/type/map.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    module2.exports = new Type("tag:yaml.org,2002:map", {
      kind: "mapping",
      construct: function(data) {
        return data !== null ? data : {};
      }
    });
  }
});

// node_modules/js-yaml/lib/schema/failsafe.js
var require_failsafe = __commonJS({
  "node_modules/js-yaml/lib/schema/failsafe.js"(exports2, module2) {
    "use strict";
    var Schema = require_schema();
    module2.exports = new Schema({
      explicit: [
        require_str(),
        require_seq(),
        require_map()
      ]
    });
  }
});

// node_modules/js-yaml/lib/type/null.js
var require_null = __commonJS({
  "node_modules/js-yaml/lib/type/null.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    function resolveYamlNull(data) {
      if (data === null) return true;
      var max3 = data.length;
      return max3 === 1 && data === "~" || max3 === 4 && (data === "null" || data === "Null" || data === "NULL");
    }
    function constructYamlNull() {
      return null;
    }
    function isNull(object) {
      return object === null;
    }
    module2.exports = new Type("tag:yaml.org,2002:null", {
      kind: "scalar",
      resolve: resolveYamlNull,
      construct: constructYamlNull,
      predicate: isNull,
      represent: {
        canonical: function() {
          return "~";
        },
        lowercase: function() {
          return "null";
        },
        uppercase: function() {
          return "NULL";
        },
        camelcase: function() {
          return "Null";
        },
        empty: function() {
          return "";
        }
      },
      defaultStyle: "lowercase"
    });
  }
});

// node_modules/js-yaml/lib/type/bool.js
var require_bool = __commonJS({
  "node_modules/js-yaml/lib/type/bool.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    function resolveYamlBoolean(data) {
      if (data === null) return false;
      var max3 = data.length;
      return max3 === 4 && (data === "true" || data === "True" || data === "TRUE") || max3 === 5 && (data === "false" || data === "False" || data === "FALSE");
    }
    function constructYamlBoolean(data) {
      return data === "true" || data === "True" || data === "TRUE";
    }
    function isBoolean(object) {
      return Object.prototype.toString.call(object) === "[object Boolean]";
    }
    module2.exports = new Type("tag:yaml.org,2002:bool", {
      kind: "scalar",
      resolve: resolveYamlBoolean,
      construct: constructYamlBoolean,
      predicate: isBoolean,
      represent: {
        lowercase: function(object) {
          return object ? "true" : "false";
        },
        uppercase: function(object) {
          return object ? "TRUE" : "FALSE";
        },
        camelcase: function(object) {
          return object ? "True" : "False";
        }
      },
      defaultStyle: "lowercase"
    });
  }
});

// node_modules/js-yaml/lib/type/int.js
var require_int = __commonJS({
  "node_modules/js-yaml/lib/type/int.js"(exports2, module2) {
    "use strict";
    var common2 = require_common();
    var Type = require_type();
    function isHexCode(c) {
      return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
    }
    function isOctCode(c) {
      return 48 <= c && c <= 55;
    }
    function isDecCode(c) {
      return 48 <= c && c <= 57;
    }
    function resolveYamlInteger(data) {
      if (data === null) return false;
      var max3 = data.length, index6 = 0, hasDigits = false, ch3;
      if (!max3) return false;
      ch3 = data[index6];
      if (ch3 === "-" || ch3 === "+") {
        ch3 = data[++index6];
      }
      if (ch3 === "0") {
        if (index6 + 1 === max3) return true;
        ch3 = data[++index6];
        if (ch3 === "b") {
          index6++;
          for (; index6 < max3; index6++) {
            ch3 = data[index6];
            if (ch3 === "_") continue;
            if (ch3 !== "0" && ch3 !== "1") return false;
            hasDigits = true;
          }
          return hasDigits && ch3 !== "_";
        }
        if (ch3 === "x") {
          index6++;
          for (; index6 < max3; index6++) {
            ch3 = data[index6];
            if (ch3 === "_") continue;
            if (!isHexCode(data.charCodeAt(index6))) return false;
            hasDigits = true;
          }
          return hasDigits && ch3 !== "_";
        }
        if (ch3 === "o") {
          index6++;
          for (; index6 < max3; index6++) {
            ch3 = data[index6];
            if (ch3 === "_") continue;
            if (!isOctCode(data.charCodeAt(index6))) return false;
            hasDigits = true;
          }
          return hasDigits && ch3 !== "_";
        }
      }
      if (ch3 === "_") return false;
      for (; index6 < max3; index6++) {
        ch3 = data[index6];
        if (ch3 === "_") continue;
        if (!isDecCode(data.charCodeAt(index6))) {
          return false;
        }
        hasDigits = true;
      }
      if (!hasDigits || ch3 === "_") return false;
      return true;
    }
    function constructYamlInteger(data) {
      var value2 = data, sign = 1, ch3;
      if (value2.indexOf("_") !== -1) {
        value2 = value2.replace(/_/g, "");
      }
      ch3 = value2[0];
      if (ch3 === "-" || ch3 === "+") {
        if (ch3 === "-") sign = -1;
        value2 = value2.slice(1);
        ch3 = value2[0];
      }
      if (value2 === "0") return 0;
      if (ch3 === "0") {
        if (value2[1] === "b") return sign * parseInt(value2.slice(2), 2);
        if (value2[1] === "x") return sign * parseInt(value2.slice(2), 16);
        if (value2[1] === "o") return sign * parseInt(value2.slice(2), 8);
      }
      return sign * parseInt(value2, 10);
    }
    function isInteger(object) {
      return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common2.isNegativeZero(object));
    }
    module2.exports = new Type("tag:yaml.org,2002:int", {
      kind: "scalar",
      resolve: resolveYamlInteger,
      construct: constructYamlInteger,
      predicate: isInteger,
      represent: {
        binary: function(obj) {
          return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
        },
        octal: function(obj) {
          return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
        },
        decimal: function(obj) {
          return obj.toString(10);
        },
        /* eslint-disable max-len */
        hexadecimal: function(obj) {
          return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
        }
      },
      defaultStyle: "decimal",
      styleAliases: {
        binary: [2, "bin"],
        octal: [8, "oct"],
        decimal: [10, "dec"],
        hexadecimal: [16, "hex"]
      }
    });
  }
});

// node_modules/js-yaml/lib/type/float.js
var require_float = __commonJS({
  "node_modules/js-yaml/lib/type/float.js"(exports2, module2) {
    "use strict";
    var common2 = require_common();
    var Type = require_type();
    var YAML_FLOAT_PATTERN = new RegExp(
      // 2.5e4, 2.5 and integers
      "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
    );
    function resolveYamlFloat(data) {
      if (data === null) return false;
      if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
      // Probably should update regexp & check speed
      data[data.length - 1] === "_") {
        return false;
      }
      return true;
    }
    function constructYamlFloat(data) {
      var value2, sign;
      value2 = data.replace(/_/g, "").toLowerCase();
      sign = value2[0] === "-" ? -1 : 1;
      if ("+-".indexOf(value2[0]) >= 0) {
        value2 = value2.slice(1);
      }
      if (value2 === ".inf") {
        return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
      } else if (value2 === ".nan") {
        return NaN;
      }
      return sign * parseFloat(value2, 10);
    }
    var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
    function representYamlFloat(object, style) {
      var res2;
      if (isNaN(object)) {
        switch (style) {
          case "lowercase":
            return ".nan";
          case "uppercase":
            return ".NAN";
          case "camelcase":
            return ".NaN";
        }
      } else if (Number.POSITIVE_INFINITY === object) {
        switch (style) {
          case "lowercase":
            return ".inf";
          case "uppercase":
            return ".INF";
          case "camelcase":
            return ".Inf";
        }
      } else if (Number.NEGATIVE_INFINITY === object) {
        switch (style) {
          case "lowercase":
            return "-.inf";
          case "uppercase":
            return "-.INF";
          case "camelcase":
            return "-.Inf";
        }
      } else if (common2.isNegativeZero(object)) {
        return "-0.0";
      }
      res2 = object.toString(10);
      return SCIENTIFIC_WITHOUT_DOT.test(res2) ? res2.replace("e", ".e") : res2;
    }
    function isFloat(object) {
      return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
    }
    module2.exports = new Type("tag:yaml.org,2002:float", {
      kind: "scalar",
      resolve: resolveYamlFloat,
      construct: constructYamlFloat,
      predicate: isFloat,
      represent: representYamlFloat,
      defaultStyle: "lowercase"
    });
  }
});

// node_modules/js-yaml/lib/schema/json.js
var require_json = __commonJS({
  "node_modules/js-yaml/lib/schema/json.js"(exports2, module2) {
    "use strict";
    module2.exports = require_failsafe().extend({
      implicit: [
        require_null(),
        require_bool(),
        require_int(),
        require_float()
      ]
    });
  }
});

// node_modules/js-yaml/lib/schema/core.js
var require_core = __commonJS({
  "node_modules/js-yaml/lib/schema/core.js"(exports2, module2) {
    "use strict";
    module2.exports = require_json();
  }
});

// node_modules/js-yaml/lib/type/timestamp.js
var require_timestamp = __commonJS({
  "node_modules/js-yaml/lib/type/timestamp.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    var YAML_DATE_REGEXP = new RegExp(
      "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
    );
    var YAML_TIMESTAMP_REGEXP = new RegExp(
      "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
    );
    function resolveYamlTimestamp(data) {
      if (data === null) return false;
      if (YAML_DATE_REGEXP.exec(data) !== null) return true;
      if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
      return false;
    }
    function constructYamlTimestamp(data) {
      var match3, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
      match3 = YAML_DATE_REGEXP.exec(data);
      if (match3 === null) match3 = YAML_TIMESTAMP_REGEXP.exec(data);
      if (match3 === null) throw new Error("Date resolve error");
      year = +match3[1];
      month = +match3[2] - 1;
      day = +match3[3];
      if (!match3[4]) {
        return new Date(Date.UTC(year, month, day));
      }
      hour = +match3[4];
      minute = +match3[5];
      second = +match3[6];
      if (match3[7]) {
        fraction = match3[7].slice(0, 3);
        while (fraction.length < 3) {
          fraction += "0";
        }
        fraction = +fraction;
      }
      if (match3[9]) {
        tz_hour = +match3[10];
        tz_minute = +(match3[11] || 0);
        delta = (tz_hour * 60 + tz_minute) * 6e4;
        if (match3[9] === "-") delta = -delta;
      }
      date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
      if (delta) date.setTime(date.getTime() - delta);
      return date;
    }
    function representYamlTimestamp(object) {
      return object.toISOString();
    }
    module2.exports = new Type("tag:yaml.org,2002:timestamp", {
      kind: "scalar",
      resolve: resolveYamlTimestamp,
      construct: constructYamlTimestamp,
      instanceOf: Date,
      represent: representYamlTimestamp
    });
  }
});

// node_modules/js-yaml/lib/type/merge.js
var require_merge = __commonJS({
  "node_modules/js-yaml/lib/type/merge.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    function resolveYamlMerge(data) {
      return data === "<<" || data === null;
    }
    module2.exports = new Type("tag:yaml.org,2002:merge", {
      kind: "scalar",
      resolve: resolveYamlMerge
    });
  }
});

// node_modules/js-yaml/lib/type/binary.js
var require_binary = __commonJS({
  "node_modules/js-yaml/lib/type/binary.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
    function resolveYamlBinary(data) {
      if (data === null) return false;
      var code, idx2, bitlen = 0, max3 = data.length, map2 = BASE64_MAP;
      for (idx2 = 0; idx2 < max3; idx2++) {
        code = map2.indexOf(data.charAt(idx2));
        if (code > 64) continue;
        if (code < 0) return false;
        bitlen += 6;
      }
      return bitlen % 8 === 0;
    }
    function constructYamlBinary(data) {
      var idx2, tailbits, input = data.replace(/[\r\n=]/g, ""), max3 = input.length, map2 = BASE64_MAP, bits2 = 0, result = [];
      for (idx2 = 0; idx2 < max3; idx2++) {
        if (idx2 % 4 === 0 && idx2) {
          result.push(bits2 >> 16 & 255);
          result.push(bits2 >> 8 & 255);
          result.push(bits2 & 255);
        }
        bits2 = bits2 << 6 | map2.indexOf(input.charAt(idx2));
      }
      tailbits = max3 % 4 * 6;
      if (tailbits === 0) {
        result.push(bits2 >> 16 & 255);
        result.push(bits2 >> 8 & 255);
        result.push(bits2 & 255);
      } else if (tailbits === 18) {
        result.push(bits2 >> 10 & 255);
        result.push(bits2 >> 2 & 255);
      } else if (tailbits === 12) {
        result.push(bits2 >> 4 & 255);
      }
      return new Uint8Array(result);
    }
    function representYamlBinary(object) {
      var result = "", bits2 = 0, idx2, tail, max3 = object.length, map2 = BASE64_MAP;
      for (idx2 = 0; idx2 < max3; idx2++) {
        if (idx2 % 3 === 0 && idx2) {
          result += map2[bits2 >> 18 & 63];
          result += map2[bits2 >> 12 & 63];
          result += map2[bits2 >> 6 & 63];
          result += map2[bits2 & 63];
        }
        bits2 = (bits2 << 8) + object[idx2];
      }
      tail = max3 % 3;
      if (tail === 0) {
        result += map2[bits2 >> 18 & 63];
        result += map2[bits2 >> 12 & 63];
        result += map2[bits2 >> 6 & 63];
        result += map2[bits2 & 63];
      } else if (tail === 2) {
        result += map2[bits2 >> 10 & 63];
        result += map2[bits2 >> 4 & 63];
        result += map2[bits2 << 2 & 63];
        result += map2[64];
      } else if (tail === 1) {
        result += map2[bits2 >> 2 & 63];
        result += map2[bits2 << 4 & 63];
        result += map2[64];
        result += map2[64];
      }
      return result;
    }
    function isBinary(obj) {
      return Object.prototype.toString.call(obj) === "[object Uint8Array]";
    }
    module2.exports = new Type("tag:yaml.org,2002:binary", {
      kind: "scalar",
      resolve: resolveYamlBinary,
      construct: constructYamlBinary,
      predicate: isBinary,
      represent: representYamlBinary
    });
  }
});

// node_modules/js-yaml/lib/type/omap.js
var require_omap = __commonJS({
  "node_modules/js-yaml/lib/type/omap.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var _toString2 = Object.prototype.toString;
    function resolveYamlOmap(data) {
      if (data === null) return true;
      var objectKeys = [], index6, length, pair, pairKey, pairHasKey, object = data;
      for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
        pair = object[index6];
        pairHasKey = false;
        if (_toString2.call(pair) !== "[object Object]") return false;
        for (pairKey in pair) {
          if (_hasOwnProperty.call(pair, pairKey)) {
            if (!pairHasKey) pairHasKey = true;
            else return false;
          }
        }
        if (!pairHasKey) return false;
        if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
        else return false;
      }
      return true;
    }
    function constructYamlOmap(data) {
      return data !== null ? data : [];
    }
    module2.exports = new Type("tag:yaml.org,2002:omap", {
      kind: "sequence",
      resolve: resolveYamlOmap,
      construct: constructYamlOmap
    });
  }
});

// node_modules/js-yaml/lib/type/pairs.js
var require_pairs = __commonJS({
  "node_modules/js-yaml/lib/type/pairs.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    var _toString2 = Object.prototype.toString;
    function resolveYamlPairs(data) {
      if (data === null) return true;
      var index6, length, pair, keys2, result, object = data;
      result = new Array(object.length);
      for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
        pair = object[index6];
        if (_toString2.call(pair) !== "[object Object]") return false;
        keys2 = Object.keys(pair);
        if (keys2.length !== 1) return false;
        result[index6] = [keys2[0], pair[keys2[0]]];
      }
      return true;
    }
    function constructYamlPairs(data) {
      if (data === null) return [];
      var index6, length, pair, keys2, result, object = data;
      result = new Array(object.length);
      for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
        pair = object[index6];
        keys2 = Object.keys(pair);
        result[index6] = [keys2[0], pair[keys2[0]]];
      }
      return result;
    }
    module2.exports = new Type("tag:yaml.org,2002:pairs", {
      kind: "sequence",
      resolve: resolveYamlPairs,
      construct: constructYamlPairs
    });
  }
});

// node_modules/js-yaml/lib/type/set.js
var require_set = __commonJS({
  "node_modules/js-yaml/lib/type/set.js"(exports2, module2) {
    "use strict";
    var Type = require_type();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    function resolveYamlSet(data) {
      if (data === null) return true;
      var key4, object = data;
      for (key4 in object) {
        if (_hasOwnProperty.call(object, key4)) {
          if (object[key4] !== null) return false;
        }
      }
      return true;
    }
    function constructYamlSet(data) {
      return data !== null ? data : {};
    }
    module2.exports = new Type("tag:yaml.org,2002:set", {
      kind: "mapping",
      resolve: resolveYamlSet,
      construct: constructYamlSet
    });
  }
});

// node_modules/js-yaml/lib/schema/default.js
var require_default = __commonJS({
  "node_modules/js-yaml/lib/schema/default.js"(exports2, module2) {
    "use strict";
    module2.exports = require_core().extend({
      implicit: [
        require_timestamp(),
        require_merge()
      ],
      explicit: [
        require_binary(),
        require_omap(),
        require_pairs(),
        require_set()
      ]
    });
  }
});

// node_modules/js-yaml/lib/loader.js
var require_loader = __commonJS({
  "node_modules/js-yaml/lib/loader.js"(exports2, module2) {
    "use strict";
    var common2 = require_common();
    var YAMLException = require_exception();
    var makeSnippet = require_snippet();
    var DEFAULT_SCHEMA = require_default();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var CONTEXT_FLOW_IN = 1;
    var CONTEXT_FLOW_OUT = 2;
    var CONTEXT_BLOCK_IN = 3;
    var CONTEXT_BLOCK_OUT = 4;
    var CHOMPING_CLIP = 1;
    var CHOMPING_STRIP = 2;
    var CHOMPING_KEEP = 3;
    var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
    var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
    var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
    var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
    var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function is_EOL(c) {
      return c === 10 || c === 13;
    }
    function is_WHITE_SPACE(c) {
      return c === 9 || c === 32;
    }
    function is_WS_OR_EOL(c) {
      return c === 9 || c === 32 || c === 10 || c === 13;
    }
    function is_FLOW_INDICATOR(c) {
      return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
    }
    function fromHexCode(c) {
      var lc2;
      if (48 <= c && c <= 57) {
        return c - 48;
      }
      lc2 = c | 32;
      if (97 <= lc2 && lc2 <= 102) {
        return lc2 - 97 + 10;
      }
      return -1;
    }
    function escapedHexLen(c) {
      if (c === 120) {
        return 2;
      }
      if (c === 117) {
        return 4;
      }
      if (c === 85) {
        return 8;
      }
      return 0;
    }
    function fromDecimalCode(c) {
      if (48 <= c && c <= 57) {
        return c - 48;
      }
      return -1;
    }
    function simpleEscapeSequence(c) {
      return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "	" : c === 9 ? "	" : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
    }
    function charFromCodepoint(c) {
      if (c <= 65535) {
        return String.fromCharCode(c);
      }
      return String.fromCharCode(
        (c - 65536 >> 10) + 55296,
        (c - 65536 & 1023) + 56320
      );
    }
    function setProperty(object, key4, value2) {
      if (key4 === "__proto__") {
        Object.defineProperty(object, key4, {
          configurable: true,
          enumerable: true,
          writable: true,
          value: value2
        });
      } else {
        object[key4] = value2;
      }
    }
    var simpleEscapeCheck = new Array(256);
    var simpleEscapeMap = new Array(256);
    for (i = 0; i < 256; i++) {
      simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
      simpleEscapeMap[i] = simpleEscapeSequence(i);
    }
    var i;
    function State(input, options) {
      this.input = input;
      this.filename = options["filename"] || null;
      this.schema = options["schema"] || DEFAULT_SCHEMA;
      this.onWarning = options["onWarning"] || null;
      this.legacy = options["legacy"] || false;
      this.json = options["json"] || false;
      this.listener = options["listener"] || null;
      this.implicitTypes = this.schema.compiledImplicit;
      this.typeMap = this.schema.compiledTypeMap;
      this.length = input.length;
      this.position = 0;
      this.line = 0;
      this.lineStart = 0;
      this.lineIndent = 0;
      this.firstTabInLine = -1;
      this.documents = [];
    }
    function generateError(state2, message) {
      var mark = {
        name: state2.filename,
        buffer: state2.input.slice(0, -1),
        // omit trailing \0
        position: state2.position,
        line: state2.line,
        column: state2.position - state2.lineStart
      };
      mark.snippet = makeSnippet(mark);
      return new YAMLException(message, mark);
    }
    function throwError(state2, message) {
      throw generateError(state2, message);
    }
    function throwWarning(state2, message) {
      if (state2.onWarning) {
        state2.onWarning.call(null, generateError(state2, message));
      }
    }
    var directiveHandlers = {
      YAML: function handleYamlDirective(state2, name, args) {
        var match3, major, minor;
        if (state2.version !== null) {
          throwError(state2, "duplication of %YAML directive");
        }
        if (args.length !== 1) {
          throwError(state2, "YAML directive accepts exactly one argument");
        }
        match3 = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
        if (match3 === null) {
          throwError(state2, "ill-formed argument of the YAML directive");
        }
        major = parseInt(match3[1], 10);
        minor = parseInt(match3[2], 10);
        if (major !== 1) {
          throwError(state2, "unacceptable YAML version of the document");
        }
        state2.version = args[0];
        state2.checkLineBreaks = minor < 2;
        if (minor !== 1 && minor !== 2) {
          throwWarning(state2, "unsupported YAML version of the document");
        }
      },
      TAG: function handleTagDirective(state2, name, args) {
        var handle, prefix;
        if (args.length !== 2) {
          throwError(state2, "TAG directive accepts exactly two arguments");
        }
        handle = args[0];
        prefix = args[1];
        if (!PATTERN_TAG_HANDLE.test(handle)) {
          throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
        }
        if (_hasOwnProperty.call(state2.tagMap, handle)) {
          throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
        }
        if (!PATTERN_TAG_URI.test(prefix)) {
          throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
        }
        try {
          prefix = decodeURIComponent(prefix);
        } catch (err2) {
          throwError(state2, "tag prefix is malformed: " + prefix);
        }
        state2.tagMap[handle] = prefix;
      }
    };
    function captureSegment(state2, start, end, checkJson) {
      var _position, _length, _character, _result;
      if (start < end) {
        _result = state2.input.slice(start, end);
        if (checkJson) {
          for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
            _character = _result.charCodeAt(_position);
            if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
              throwError(state2, "expected valid JSON character");
            }
          }
        } else if (PATTERN_NON_PRINTABLE.test(_result)) {
          throwError(state2, "the stream contains non-printable characters");
        }
        state2.result += _result;
      }
    }
    function mergeMappings(state2, destination, source2, overridableKeys) {
      var sourceKeys, key4, index6, quantity;
      if (!common2.isObject(source2)) {
        throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
      }
      sourceKeys = Object.keys(source2);
      for (index6 = 0, quantity = sourceKeys.length; index6 < quantity; index6 += 1) {
        key4 = sourceKeys[index6];
        if (!_hasOwnProperty.call(destination, key4)) {
          setProperty(destination, key4, source2[key4]);
          overridableKeys[key4] = true;
        }
      }
    }
    function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
      var index6, quantity;
      if (Array.isArray(keyNode)) {
        keyNode = Array.prototype.slice.call(keyNode);
        for (index6 = 0, quantity = keyNode.length; index6 < quantity; index6 += 1) {
          if (Array.isArray(keyNode[index6])) {
            throwError(state2, "nested arrays are not supported inside keys");
          }
          if (typeof keyNode === "object" && _class(keyNode[index6]) === "[object Object]") {
            keyNode[index6] = "[object Object]";
          }
        }
      }
      if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
        keyNode = "[object Object]";
      }
      keyNode = String(keyNode);
      if (_result === null) {
        _result = {};
      }
      if (keyTag === "tag:yaml.org,2002:merge") {
        if (Array.isArray(valueNode)) {
          for (index6 = 0, quantity = valueNode.length; index6 < quantity; index6 += 1) {
            mergeMappings(state2, _result, valueNode[index6], overridableKeys);
          }
        } else {
          mergeMappings(state2, _result, valueNode, overridableKeys);
        }
      } else {
        if (!state2.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
          state2.line = startLine || state2.line;
          state2.lineStart = startLineStart || state2.lineStart;
          state2.position = startPos || state2.position;
          throwError(state2, "duplicated mapping key");
        }
        setProperty(_result, keyNode, valueNode);
        delete overridableKeys[keyNode];
      }
      return _result;
    }
    function readLineBreak(state2) {
      var ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 === 10) {
        state2.position++;
      } else if (ch3 === 13) {
        state2.position++;
        if (state2.input.charCodeAt(state2.position) === 10) {
          state2.position++;
        }
      } else {
        throwError(state2, "a line break is expected");
      }
      state2.line += 1;
      state2.lineStart = state2.position;
      state2.firstTabInLine = -1;
    }
    function skipSeparationSpace(state2, allowComments, checkIndent) {
      var lineBreaks = 0, ch3 = state2.input.charCodeAt(state2.position);
      while (ch3 !== 0) {
        while (is_WHITE_SPACE(ch3)) {
          if (ch3 === 9 && state2.firstTabInLine === -1) {
            state2.firstTabInLine = state2.position;
          }
          ch3 = state2.input.charCodeAt(++state2.position);
        }
        if (allowComments && ch3 === 35) {
          do {
            ch3 = state2.input.charCodeAt(++state2.position);
          } while (ch3 !== 10 && ch3 !== 13 && ch3 !== 0);
        }
        if (is_EOL(ch3)) {
          readLineBreak(state2);
          ch3 = state2.input.charCodeAt(state2.position);
          lineBreaks++;
          state2.lineIndent = 0;
          while (ch3 === 32) {
            state2.lineIndent++;
            ch3 = state2.input.charCodeAt(++state2.position);
          }
        } else {
          break;
        }
      }
      if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
        throwWarning(state2, "deficient indentation");
      }
      return lineBreaks;
    }
    function testDocumentSeparator(state2) {
      var _position = state2.position, ch3;
      ch3 = state2.input.charCodeAt(_position);
      if ((ch3 === 45 || ch3 === 46) && ch3 === state2.input.charCodeAt(_position + 1) && ch3 === state2.input.charCodeAt(_position + 2)) {
        _position += 3;
        ch3 = state2.input.charCodeAt(_position);
        if (ch3 === 0 || is_WS_OR_EOL(ch3)) {
          return true;
        }
      }
      return false;
    }
    function writeFoldedLines(state2, count) {
      if (count === 1) {
        state2.result += " ";
      } else if (count > 1) {
        state2.result += common2.repeat("\n", count - 1);
      }
    }
    function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
      var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (is_WS_OR_EOL(ch3) || is_FLOW_INDICATOR(ch3) || ch3 === 35 || ch3 === 38 || ch3 === 42 || ch3 === 33 || ch3 === 124 || ch3 === 62 || ch3 === 39 || ch3 === 34 || ch3 === 37 || ch3 === 64 || ch3 === 96) {
        return false;
      }
      if (ch3 === 63 || ch3 === 45) {
        following = state2.input.charCodeAt(state2.position + 1);
        if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
          return false;
        }
      }
      state2.kind = "scalar";
      state2.result = "";
      captureStart = captureEnd = state2.position;
      hasPendingContent = false;
      while (ch3 !== 0) {
        if (ch3 === 58) {
          following = state2.input.charCodeAt(state2.position + 1);
          if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
            break;
          }
        } else if (ch3 === 35) {
          preceding = state2.input.charCodeAt(state2.position - 1);
          if (is_WS_OR_EOL(preceding)) {
            break;
          }
        } else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch3)) {
          break;
        } else if (is_EOL(ch3)) {
          _line = state2.line;
          _lineStart = state2.lineStart;
          _lineIndent = state2.lineIndent;
          skipSeparationSpace(state2, false, -1);
          if (state2.lineIndent >= nodeIndent) {
            hasPendingContent = true;
            ch3 = state2.input.charCodeAt(state2.position);
            continue;
          } else {
            state2.position = captureEnd;
            state2.line = _line;
            state2.lineStart = _lineStart;
            state2.lineIndent = _lineIndent;
            break;
          }
        }
        if (hasPendingContent) {
          captureSegment(state2, captureStart, captureEnd, false);
          writeFoldedLines(state2, state2.line - _line);
          captureStart = captureEnd = state2.position;
          hasPendingContent = false;
        }
        if (!is_WHITE_SPACE(ch3)) {
          captureEnd = state2.position + 1;
        }
        ch3 = state2.input.charCodeAt(++state2.position);
      }
      captureSegment(state2, captureStart, captureEnd, false);
      if (state2.result) {
        return true;
      }
      state2.kind = _kind;
      state2.result = _result;
      return false;
    }
    function readSingleQuotedScalar(state2, nodeIndent) {
      var ch3, captureStart, captureEnd;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 !== 39) {
        return false;
      }
      state2.kind = "scalar";
      state2.result = "";
      state2.position++;
      captureStart = captureEnd = state2.position;
      while ((ch3 = state2.input.charCodeAt(state2.position)) !== 0) {
        if (ch3 === 39) {
          captureSegment(state2, captureStart, state2.position, true);
          ch3 = state2.input.charCodeAt(++state2.position);
          if (ch3 === 39) {
            captureStart = state2.position;
            state2.position++;
            captureEnd = state2.position;
          } else {
            return true;
          }
        } else if (is_EOL(ch3)) {
          captureSegment(state2, captureStart, captureEnd, true);
          writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
          captureStart = captureEnd = state2.position;
        } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
          throwError(state2, "unexpected end of the document within a single quoted scalar");
        } else {
          state2.position++;
          captureEnd = state2.position;
        }
      }
      throwError(state2, "unexpected end of the stream within a single quoted scalar");
    }
    function readDoubleQuotedScalar(state2, nodeIndent) {
      var captureStart, captureEnd, hexLength, hexResult, tmp, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 !== 34) {
        return false;
      }
      state2.kind = "scalar";
      state2.result = "";
      state2.position++;
      captureStart = captureEnd = state2.position;
      while ((ch3 = state2.input.charCodeAt(state2.position)) !== 0) {
        if (ch3 === 34) {
          captureSegment(state2, captureStart, state2.position, true);
          state2.position++;
          return true;
        } else if (ch3 === 92) {
          captureSegment(state2, captureStart, state2.position, true);
          ch3 = state2.input.charCodeAt(++state2.position);
          if (is_EOL(ch3)) {
            skipSeparationSpace(state2, false, nodeIndent);
          } else if (ch3 < 256 && simpleEscapeCheck[ch3]) {
            state2.result += simpleEscapeMap[ch3];
            state2.position++;
          } else if ((tmp = escapedHexLen(ch3)) > 0) {
            hexLength = tmp;
            hexResult = 0;
            for (; hexLength > 0; hexLength--) {
              ch3 = state2.input.charCodeAt(++state2.position);
              if ((tmp = fromHexCode(ch3)) >= 0) {
                hexResult = (hexResult << 4) + tmp;
              } else {
                throwError(state2, "expected hexadecimal character");
              }
            }
            state2.result += charFromCodepoint(hexResult);
            state2.position++;
          } else {
            throwError(state2, "unknown escape sequence");
          }
          captureStart = captureEnd = state2.position;
        } else if (is_EOL(ch3)) {
          captureSegment(state2, captureStart, captureEnd, true);
          writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
          captureStart = captureEnd = state2.position;
        } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
          throwError(state2, "unexpected end of the document within a double quoted scalar");
        } else {
          state2.position++;
          captureEnd = state2.position;
        }
      }
      throwError(state2, "unexpected end of the stream within a double quoted scalar");
    }
    function readFlowCollection(state2, nodeIndent) {
      var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor2 = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 === 91) {
        terminator = 93;
        isMapping = false;
        _result = [];
      } else if (ch3 === 123) {
        terminator = 125;
        isMapping = true;
        _result = {};
      } else {
        return false;
      }
      if (state2.anchor !== null) {
        state2.anchorMap[state2.anchor] = _result;
      }
      ch3 = state2.input.charCodeAt(++state2.position);
      while (ch3 !== 0) {
        skipSeparationSpace(state2, true, nodeIndent);
        ch3 = state2.input.charCodeAt(state2.position);
        if (ch3 === terminator) {
          state2.position++;
          state2.tag = _tag;
          state2.anchor = _anchor2;
          state2.kind = isMapping ? "mapping" : "sequence";
          state2.result = _result;
          return true;
        } else if (!readNext) {
          throwError(state2, "missed comma between flow collection entries");
        } else if (ch3 === 44) {
          throwError(state2, "expected the node content, but found ','");
        }
        keyTag = keyNode = valueNode = null;
        isPair = isExplicitPair = false;
        if (ch3 === 63) {
          following = state2.input.charCodeAt(state2.position + 1);
          if (is_WS_OR_EOL(following)) {
            isPair = isExplicitPair = true;
            state2.position++;
            skipSeparationSpace(state2, true, nodeIndent);
          }
        }
        _line = state2.line;
        _lineStart = state2.lineStart;
        _pos = state2.position;
        composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
        keyTag = state2.tag;
        keyNode = state2.result;
        skipSeparationSpace(state2, true, nodeIndent);
        ch3 = state2.input.charCodeAt(state2.position);
        if ((isExplicitPair || state2.line === _line) && ch3 === 58) {
          isPair = true;
          ch3 = state2.input.charCodeAt(++state2.position);
          skipSeparationSpace(state2, true, nodeIndent);
          composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
          valueNode = state2.result;
        }
        if (isMapping) {
          storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
        } else if (isPair) {
          _result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
        } else {
          _result.push(keyNode);
        }
        skipSeparationSpace(state2, true, nodeIndent);
        ch3 = state2.input.charCodeAt(state2.position);
        if (ch3 === 44) {
          readNext = true;
          ch3 = state2.input.charCodeAt(++state2.position);
        } else {
          readNext = false;
        }
      }
      throwError(state2, "unexpected end of the stream within a flow collection");
    }
    function readBlockScalar(state2, nodeIndent) {
      var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 === 124) {
        folding = false;
      } else if (ch3 === 62) {
        folding = true;
      } else {
        return false;
      }
      state2.kind = "scalar";
      state2.result = "";
      while (ch3 !== 0) {
        ch3 = state2.input.charCodeAt(++state2.position);
        if (ch3 === 43 || ch3 === 45) {
          if (CHOMPING_CLIP === chomping) {
            chomping = ch3 === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
          } else {
            throwError(state2, "repeat of a chomping mode identifier");
          }
        } else if ((tmp = fromDecimalCode(ch3)) >= 0) {
          if (tmp === 0) {
            throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
          } else if (!detectedIndent) {
            textIndent = nodeIndent + tmp - 1;
            detectedIndent = true;
          } else {
            throwError(state2, "repeat of an indentation width identifier");
          }
        } else {
          break;
        }
      }
      if (is_WHITE_SPACE(ch3)) {
        do {
          ch3 = state2.input.charCodeAt(++state2.position);
        } while (is_WHITE_SPACE(ch3));
        if (ch3 === 35) {
          do {
            ch3 = state2.input.charCodeAt(++state2.position);
          } while (!is_EOL(ch3) && ch3 !== 0);
        }
      }
      while (ch3 !== 0) {
        readLineBreak(state2);
        state2.lineIndent = 0;
        ch3 = state2.input.charCodeAt(state2.position);
        while ((!detectedIndent || state2.lineIndent < textIndent) && ch3 === 32) {
          state2.lineIndent++;
          ch3 = state2.input.charCodeAt(++state2.position);
        }
        if (!detectedIndent && state2.lineIndent > textIndent) {
          textIndent = state2.lineIndent;
        }
        if (is_EOL(ch3)) {
          emptyLines++;
          continue;
        }
        if (state2.lineIndent < textIndent) {
          if (chomping === CHOMPING_KEEP) {
            state2.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
          } else if (chomping === CHOMPING_CLIP) {
            if (didReadContent) {
              state2.result += "\n";
            }
          }
          break;
        }
        if (folding) {
          if (is_WHITE_SPACE(ch3)) {
            atMoreIndented = true;
            state2.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
          } else if (atMoreIndented) {
            atMoreIndented = false;
            state2.result += common2.repeat("\n", emptyLines + 1);
          } else if (emptyLines === 0) {
            if (didReadContent) {
              state2.result += " ";
            }
          } else {
            state2.result += common2.repeat("\n", emptyLines);
          }
        } else {
          state2.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
        }
        didReadContent = true;
        detectedIndent = true;
        emptyLines = 0;
        captureStart = state2.position;
        while (!is_EOL(ch3) && ch3 !== 0) {
          ch3 = state2.input.charCodeAt(++state2.position);
        }
        captureSegment(state2, captureStart, state2.position, false);
      }
      return true;
    }
    function readBlockSequence(state2, nodeIndent) {
      var _line, _tag = state2.tag, _anchor2 = state2.anchor, _result = [], following, detected = false, ch3;
      if (state2.firstTabInLine !== -1) return false;
      if (state2.anchor !== null) {
        state2.anchorMap[state2.anchor] = _result;
      }
      ch3 = state2.input.charCodeAt(state2.position);
      while (ch3 !== 0) {
        if (state2.firstTabInLine !== -1) {
          state2.position = state2.firstTabInLine;
          throwError(state2, "tab characters must not be used in indentation");
        }
        if (ch3 !== 45) {
          break;
        }
        following = state2.input.charCodeAt(state2.position + 1);
        if (!is_WS_OR_EOL(following)) {
          break;
        }
        detected = true;
        state2.position++;
        if (skipSeparationSpace(state2, true, -1)) {
          if (state2.lineIndent <= nodeIndent) {
            _result.push(null);
            ch3 = state2.input.charCodeAt(state2.position);
            continue;
          }
        }
        _line = state2.line;
        composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
        _result.push(state2.result);
        skipSeparationSpace(state2, true, -1);
        ch3 = state2.input.charCodeAt(state2.position);
        if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch3 !== 0) {
          throwError(state2, "bad indentation of a sequence entry");
        } else if (state2.lineIndent < nodeIndent) {
          break;
        }
      }
      if (detected) {
        state2.tag = _tag;
        state2.anchor = _anchor2;
        state2.kind = "sequence";
        state2.result = _result;
        return true;
      }
      return false;
    }
    function readBlockMapping(state2, nodeIndent, flowIndent) {
      var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor2 = state2.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch3;
      if (state2.firstTabInLine !== -1) return false;
      if (state2.anchor !== null) {
        state2.anchorMap[state2.anchor] = _result;
      }
      ch3 = state2.input.charCodeAt(state2.position);
      while (ch3 !== 0) {
        if (!atExplicitKey && state2.firstTabInLine !== -1) {
          state2.position = state2.firstTabInLine;
          throwError(state2, "tab characters must not be used in indentation");
        }
        following = state2.input.charCodeAt(state2.position + 1);
        _line = state2.line;
        if ((ch3 === 63 || ch3 === 58) && is_WS_OR_EOL(following)) {
          if (ch3 === 63) {
            if (atExplicitKey) {
              storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
              keyTag = keyNode = valueNode = null;
            }
            detected = true;
            atExplicitKey = true;
            allowCompact = true;
          } else if (atExplicitKey) {
            atExplicitKey = false;
            allowCompact = true;
          } else {
            throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
          }
          state2.position += 1;
          ch3 = following;
        } else {
          _keyLine = state2.line;
          _keyLineStart = state2.lineStart;
          _keyPos = state2.position;
          if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
            break;
          }
          if (state2.line === _line) {
            ch3 = state2.input.charCodeAt(state2.position);
            while (is_WHITE_SPACE(ch3)) {
              ch3 = state2.input.charCodeAt(++state2.position);
            }
            if (ch3 === 58) {
              ch3 = state2.input.charCodeAt(++state2.position);
              if (!is_WS_OR_EOL(ch3)) {
                throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
              }
              if (atExplicitKey) {
                storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
                keyTag = keyNode = valueNode = null;
              }
              detected = true;
              atExplicitKey = false;
              allowCompact = false;
              keyTag = state2.tag;
              keyNode = state2.result;
            } else if (detected) {
              throwError(state2, "can not read an implicit mapping pair; a colon is missed");
            } else {
              state2.tag = _tag;
              state2.anchor = _anchor2;
              return true;
            }
          } else if (detected) {
            throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
          } else {
            state2.tag = _tag;
            state2.anchor = _anchor2;
            return true;
          }
        }
        if (state2.line === _line || state2.lineIndent > nodeIndent) {
          if (atExplicitKey) {
            _keyLine = state2.line;
            _keyLineStart = state2.lineStart;
            _keyPos = state2.position;
          }
          if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
            if (atExplicitKey) {
              keyNode = state2.result;
            } else {
              valueNode = state2.result;
            }
          }
          if (!atExplicitKey) {
            storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
            keyTag = keyNode = valueNode = null;
          }
          skipSeparationSpace(state2, true, -1);
          ch3 = state2.input.charCodeAt(state2.position);
        }
        if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch3 !== 0) {
          throwError(state2, "bad indentation of a mapping entry");
        } else if (state2.lineIndent < nodeIndent) {
          break;
        }
      }
      if (atExplicitKey) {
        storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
      }
      if (detected) {
        state2.tag = _tag;
        state2.anchor = _anchor2;
        state2.kind = "mapping";
        state2.result = _result;
      }
      return detected;
    }
    function readTagProperty(state2) {
      var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 !== 33) return false;
      if (state2.tag !== null) {
        throwError(state2, "duplication of a tag property");
      }
      ch3 = state2.input.charCodeAt(++state2.position);
      if (ch3 === 60) {
        isVerbatim = true;
        ch3 = state2.input.charCodeAt(++state2.position);
      } else if (ch3 === 33) {
        isNamed = true;
        tagHandle = "!!";
        ch3 = state2.input.charCodeAt(++state2.position);
      } else {
        tagHandle = "!";
      }
      _position = state2.position;
      if (isVerbatim) {
        do {
          ch3 = state2.input.charCodeAt(++state2.position);
        } while (ch3 !== 0 && ch3 !== 62);
        if (state2.position < state2.length) {
          tagName = state2.input.slice(_position, state2.position);
          ch3 = state2.input.charCodeAt(++state2.position);
        } else {
          throwError(state2, "unexpected end of the stream within a verbatim tag");
        }
      } else {
        while (ch3 !== 0 && !is_WS_OR_EOL(ch3)) {
          if (ch3 === 33) {
            if (!isNamed) {
              tagHandle = state2.input.slice(_position - 1, state2.position + 1);
              if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
                throwError(state2, "named tag handle cannot contain such characters");
              }
              isNamed = true;
              _position = state2.position + 1;
            } else {
              throwError(state2, "tag suffix cannot contain exclamation marks");
            }
          }
          ch3 = state2.input.charCodeAt(++state2.position);
        }
        tagName = state2.input.slice(_position, state2.position);
        if (PATTERN_FLOW_INDICATORS.test(tagName)) {
          throwError(state2, "tag suffix cannot contain flow indicator characters");
        }
      }
      if (tagName && !PATTERN_TAG_URI.test(tagName)) {
        throwError(state2, "tag name cannot contain such characters: " + tagName);
      }
      try {
        tagName = decodeURIComponent(tagName);
      } catch (err2) {
        throwError(state2, "tag name is malformed: " + tagName);
      }
      if (isVerbatim) {
        state2.tag = tagName;
      } else if (_hasOwnProperty.call(state2.tagMap, tagHandle)) {
        state2.tag = state2.tagMap[tagHandle] + tagName;
      } else if (tagHandle === "!") {
        state2.tag = "!" + tagName;
      } else if (tagHandle === "!!") {
        state2.tag = "tag:yaml.org,2002:" + tagName;
      } else {
        throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
      }
      return true;
    }
    function readAnchorProperty(state2) {
      var _position, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 !== 38) return false;
      if (state2.anchor !== null) {
        throwError(state2, "duplication of an anchor property");
      }
      ch3 = state2.input.charCodeAt(++state2.position);
      _position = state2.position;
      while (ch3 !== 0 && !is_WS_OR_EOL(ch3) && !is_FLOW_INDICATOR(ch3)) {
        ch3 = state2.input.charCodeAt(++state2.position);
      }
      if (state2.position === _position) {
        throwError(state2, "name of an anchor node must contain at least one character");
      }
      state2.anchor = state2.input.slice(_position, state2.position);
      return true;
    }
    function readAlias(state2) {
      var _position, alias, ch3;
      ch3 = state2.input.charCodeAt(state2.position);
      if (ch3 !== 42) return false;
      ch3 = state2.input.charCodeAt(++state2.position);
      _position = state2.position;
      while (ch3 !== 0 && !is_WS_OR_EOL(ch3) && !is_FLOW_INDICATOR(ch3)) {
        ch3 = state2.input.charCodeAt(++state2.position);
      }
      if (state2.position === _position) {
        throwError(state2, "name of an alias node must contain at least one character");
      }
      alias = state2.input.slice(_position, state2.position);
      if (!_hasOwnProperty.call(state2.anchorMap, alias)) {
        throwError(state2, 'unidentified alias "' + alias + '"');
      }
      state2.result = state2.anchorMap[alias];
      skipSeparationSpace(state2, true, -1);
      return true;
    }
    function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
      var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
      if (state2.listener !== null) {
        state2.listener("open", state2);
      }
      state2.tag = null;
      state2.anchor = null;
      state2.kind = null;
      state2.result = null;
      allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
      if (allowToSeek) {
        if (skipSeparationSpace(state2, true, -1)) {
          atNewLine = true;
          if (state2.lineIndent > parentIndent) {
            indentStatus = 1;
          } else if (state2.lineIndent === parentIndent) {
            indentStatus = 0;
          } else if (state2.lineIndent < parentIndent) {
            indentStatus = -1;
          }
        }
      }
      if (indentStatus === 1) {
        while (readTagProperty(state2) || readAnchorProperty(state2)) {
          if (skipSeparationSpace(state2, true, -1)) {
            atNewLine = true;
            allowBlockCollections = allowBlockStyles;
            if (state2.lineIndent > parentIndent) {
              indentStatus = 1;
            } else if (state2.lineIndent === parentIndent) {
              indentStatus = 0;
            } else if (state2.lineIndent < parentIndent) {
              indentStatus = -1;
            }
          } else {
            allowBlockCollections = false;
          }
        }
      }
      if (allowBlockCollections) {
        allowBlockCollections = atNewLine || allowCompact;
      }
      if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
        if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
          flowIndent = parentIndent;
        } else {
          flowIndent = parentIndent + 1;
        }
        blockIndent = state2.position - state2.lineStart;
        if (indentStatus === 1) {
          if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
            hasContent = true;
          } else {
            if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
              hasContent = true;
            } else if (readAlias(state2)) {
              hasContent = true;
              if (state2.tag !== null || state2.anchor !== null) {
                throwError(state2, "alias node should not have any properties");
              }
            } else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
              hasContent = true;
              if (state2.tag === null) {
                state2.tag = "?";
              }
            }
            if (state2.anchor !== null) {
              state2.anchorMap[state2.anchor] = state2.result;
            }
          }
        } else if (indentStatus === 0) {
          hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
        }
      }
      if (state2.tag === null) {
        if (state2.anchor !== null) {
          state2.anchorMap[state2.anchor] = state2.result;
        }
      } else if (state2.tag === "?") {
        if (state2.result !== null && state2.kind !== "scalar") {
          throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
        }
        for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
          type = state2.implicitTypes[typeIndex];
          if (type.resolve(state2.result)) {
            state2.result = type.construct(state2.result);
            state2.tag = type.tag;
            if (state2.anchor !== null) {
              state2.anchorMap[state2.anchor] = state2.result;
            }
            break;
          }
        }
      } else if (state2.tag !== "!") {
        if (_hasOwnProperty.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
          type = state2.typeMap[state2.kind || "fallback"][state2.tag];
        } else {
          type = null;
          typeList = state2.typeMap.multi[state2.kind || "fallback"];
          for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
            if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
              type = typeList[typeIndex];
              break;
            }
          }
        }
        if (!type) {
          throwError(state2, "unknown tag !<" + state2.tag + ">");
        }
        if (state2.result !== null && type.kind !== state2.kind) {
          throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type.kind + '", not "' + state2.kind + '"');
        }
        if (!type.resolve(state2.result, state2.tag)) {
          throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
        } else {
          state2.result = type.construct(state2.result, state2.tag);
          if (state2.anchor !== null) {
            state2.anchorMap[state2.anchor] = state2.result;
          }
        }
      }
      if (state2.listener !== null) {
        state2.listener("close", state2);
      }
      return state2.tag !== null || state2.anchor !== null || hasContent;
    }
    function readDocument(state2) {
      var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch3;
      state2.version = null;
      state2.checkLineBreaks = state2.legacy;
      state2.tagMap = /* @__PURE__ */ Object.create(null);
      state2.anchorMap = /* @__PURE__ */ Object.create(null);
      while ((ch3 = state2.input.charCodeAt(state2.position)) !== 0) {
        skipSeparationSpace(state2, true, -1);
        ch3 = state2.input.charCodeAt(state2.position);
        if (state2.lineIndent > 0 || ch3 !== 37) {
          break;
        }
        hasDirectives = true;
        ch3 = state2.input.charCodeAt(++state2.position);
        _position = state2.position;
        while (ch3 !== 0 && !is_WS_OR_EOL(ch3)) {
          ch3 = state2.input.charCodeAt(++state2.position);
        }
        directiveName = state2.input.slice(_position, state2.position);
        directiveArgs = [];
        if (directiveName.length < 1) {
          throwError(state2, "directive name must not be less than one character in length");
        }
        while (ch3 !== 0) {
          while (is_WHITE_SPACE(ch3)) {
            ch3 = state2.input.charCodeAt(++state2.position);
          }
          if (ch3 === 35) {
            do {
              ch3 = state2.input.charCodeAt(++state2.position);
            } while (ch3 !== 0 && !is_EOL(ch3));
            break;
          }
          if (is_EOL(ch3)) break;
          _position = state2.position;
          while (ch3 !== 0 && !is_WS_OR_EOL(ch3)) {
            ch3 = state2.input.charCodeAt(++state2.position);
          }
          directiveArgs.push(state2.input.slice(_position, state2.position));
        }
        if (ch3 !== 0) readLineBreak(state2);
        if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
          directiveHandlers[directiveName](state2, directiveName, directiveArgs);
        } else {
          throwWarning(state2, 'unknown document directive "' + directiveName + '"');
        }
      }
      skipSeparationSpace(state2, true, -1);
      if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
        state2.position += 3;
        skipSeparationSpace(state2, true, -1);
      } else if (hasDirectives) {
        throwError(state2, "directives end mark is expected");
      }
      composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
      skipSeparationSpace(state2, true, -1);
      if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
        throwWarning(state2, "non-ASCII line breaks are interpreted as content");
      }
      state2.documents.push(state2.result);
      if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
        if (state2.input.charCodeAt(state2.position) === 46) {
          state2.position += 3;
          skipSeparationSpace(state2, true, -1);
        }
        return;
      }
      if (state2.position < state2.length - 1) {
        throwError(state2, "end of the stream or a document separator is expected");
      } else {
        return;
      }
    }
    function loadDocuments(input, options) {
      input = String(input);
      options = options || {};
      if (input.length !== 0) {
        if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
          input += "\n";
        }
        if (input.charCodeAt(0) === 65279) {
          input = input.slice(1);
        }
      }
      var state2 = new State(input, options);
      var nullpos = input.indexOf("\0");
      if (nullpos !== -1) {
        state2.position = nullpos;
        throwError(state2, "null byte is not allowed in input");
      }
      state2.input += "\0";
      while (state2.input.charCodeAt(state2.position) === 32) {
        state2.lineIndent += 1;
        state2.position += 1;
      }
      while (state2.position < state2.length - 1) {
        readDocument(state2);
      }
      return state2.documents;
    }
    function loadAll(input, iterator, options) {
      if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
        options = iterator;
        iterator = null;
      }
      var documents = loadDocuments(input, options);
      if (typeof iterator !== "function") {
        return documents;
      }
      for (var index6 = 0, length = documents.length; index6 < length; index6 += 1) {
        iterator(documents[index6]);
      }
    }
    function load(input, options) {
      var documents = loadDocuments(input, options);
      if (documents.length === 0) {
        return void 0;
      } else if (documents.length === 1) {
        return documents[0];
      }
      throw new YAMLException("expected a single document in the stream, but found more");
    }
    module2.exports.loadAll = loadAll;
    module2.exports.load = load;
  }
});

// node_modules/js-yaml/lib/dumper.js
var require_dumper = __commonJS({
  "node_modules/js-yaml/lib/dumper.js"(exports2, module2) {
    "use strict";
    var common2 = require_common();
    var YAMLException = require_exception();
    var DEFAULT_SCHEMA = require_default();
    var _toString2 = Object.prototype.toString;
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var CHAR_BOM = 65279;
    var CHAR_TAB = 9;
    var CHAR_LINE_FEED = 10;
    var CHAR_CARRIAGE_RETURN = 13;
    var CHAR_SPACE = 32;
    var CHAR_EXCLAMATION = 33;
    var CHAR_DOUBLE_QUOTE = 34;
    var CHAR_SHARP = 35;
    var CHAR_PERCENT = 37;
    var CHAR_AMPERSAND = 38;
    var CHAR_SINGLE_QUOTE = 39;
    var CHAR_ASTERISK = 42;
    var CHAR_COMMA = 44;
    var CHAR_MINUS = 45;
    var CHAR_COLON = 58;
    var CHAR_EQUALS = 61;
    var CHAR_GREATER_THAN = 62;
    var CHAR_QUESTION = 63;
    var CHAR_COMMERCIAL_AT = 64;
    var CHAR_LEFT_SQUARE_BRACKET = 91;
    var CHAR_RIGHT_SQUARE_BRACKET = 93;
    var CHAR_GRAVE_ACCENT = 96;
    var CHAR_LEFT_CURLY_BRACKET = 123;
    var CHAR_VERTICAL_LINE = 124;
    var CHAR_RIGHT_CURLY_BRACKET = 125;
    var ESCAPE_SEQUENCES = {};
    ESCAPE_SEQUENCES[0] = "\\0";
    ESCAPE_SEQUENCES[7] = "\\a";
    ESCAPE_SEQUENCES[8] = "\\b";
    ESCAPE_SEQUENCES[9] = "\\t";
    ESCAPE_SEQUENCES[10] = "\\n";
    ESCAPE_SEQUENCES[11] = "\\v";
    ESCAPE_SEQUENCES[12] = "\\f";
    ESCAPE_SEQUENCES[13] = "\\r";
    ESCAPE_SEQUENCES[27] = "\\e";
    ESCAPE_SEQUENCES[34] = '\\"';
    ESCAPE_SEQUENCES[92] = "\\\\";
    ESCAPE_SEQUENCES[133] = "\\N";
    ESCAPE_SEQUENCES[160] = "\\_";
    ESCAPE_SEQUENCES[8232] = "\\L";
    ESCAPE_SEQUENCES[8233] = "\\P";
    var DEPRECATED_BOOLEANS_SYNTAX = [
      "y",
      "Y",
      "yes",
      "Yes",
      "YES",
      "on",
      "On",
      "ON",
      "n",
      "N",
      "no",
      "No",
      "NO",
      "off",
      "Off",
      "OFF"
    ];
    var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
    function compileStyleMap(schema, map2) {
      var result, keys2, index6, length, tag2, style, type;
      if (map2 === null) return {};
      result = {};
      keys2 = Object.keys(map2);
      for (index6 = 0, length = keys2.length; index6 < length; index6 += 1) {
        tag2 = keys2[index6];
        style = String(map2[tag2]);
        if (tag2.slice(0, 2) === "!!") {
          tag2 = "tag:yaml.org,2002:" + tag2.slice(2);
        }
        type = schema.compiledTypeMap["fallback"][tag2];
        if (type && _hasOwnProperty.call(type.styleAliases, style)) {
          style = type.styleAliases[style];
        }
        result[tag2] = style;
      }
      return result;
    }
    function encodeHex(character) {
      var string, handle, length;
      string = character.toString(16).toUpperCase();
      if (character <= 255) {
        handle = "x";
        length = 2;
      } else if (character <= 65535) {
        handle = "u";
        length = 4;
      } else if (character <= 4294967295) {
        handle = "U";
        length = 8;
      } else {
        throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
      }
      return "\\" + handle + common2.repeat("0", length - string.length) + string;
    }
    var QUOTING_TYPE_SINGLE = 1;
    var QUOTING_TYPE_DOUBLE = 2;
    function State(options) {
      this.schema = options["schema"] || DEFAULT_SCHEMA;
      this.indent = Math.max(1, options["indent"] || 2);
      this.noArrayIndent = options["noArrayIndent"] || false;
      this.skipInvalid = options["skipInvalid"] || false;
      this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
      this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
      this.sortKeys = options["sortKeys"] || false;
      this.lineWidth = options["lineWidth"] || 80;
      this.noRefs = options["noRefs"] || false;
      this.noCompatMode = options["noCompatMode"] || false;
      this.condenseFlow = options["condenseFlow"] || false;
      this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
      this.forceQuotes = options["forceQuotes"] || false;
      this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
      this.implicitTypes = this.schema.compiledImplicit;
      this.explicitTypes = this.schema.compiledExplicit;
      this.tag = null;
      this.result = "";
      this.duplicates = [];
      this.usedDuplicates = null;
    }
    function indentString(string, spaces) {
      var ind = common2.repeat(" ", spaces), position = 0, next2 = -1, result = "", line, length = string.length;
      while (position < length) {
        next2 = string.indexOf("\n", position);
        if (next2 === -1) {
          line = string.slice(position);
          position = length;
        } else {
          line = string.slice(position, next2 + 1);
          position = next2 + 1;
        }
        if (line.length && line !== "\n") result += ind;
        result += line;
      }
      return result;
    }
    function generateNextLine(state2, level) {
      return "\n" + common2.repeat(" ", state2.indent * level);
    }
    function testImplicitResolving(state2, str) {
      var index6, length, type;
      for (index6 = 0, length = state2.implicitTypes.length; index6 < length; index6 += 1) {
        type = state2.implicitTypes[index6];
        if (type.resolve(str)) {
          return true;
        }
      }
      return false;
    }
    function isWhitespace(c) {
      return c === CHAR_SPACE || c === CHAR_TAB;
    }
    function isPrintable(c) {
      return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
    }
    function isNsCharOrWhitespace(c) {
      return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
    }
    function isPlainSafe(c, prev, inblock) {
      var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
      var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
      return (
        // ns-plain-safe
        (inblock ? (
          // c = flow-in
          cIsNsCharOrWhitespace
        ) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
      );
    }
    function isPlainSafeFirst(c) {
      return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
    }
    function isPlainSafeLast(c) {
      return !isWhitespace(c) && c !== CHAR_COLON;
    }
    function codePointAt(string, pos2) {
      var first = string.charCodeAt(pos2), second;
      if (first >= 55296 && first <= 56319 && pos2 + 1 < string.length) {
        second = string.charCodeAt(pos2 + 1);
        if (second >= 56320 && second <= 57343) {
          return (first - 55296) * 1024 + second - 56320 + 65536;
        }
      }
      return first;
    }
    function needIndentIndicator(string) {
      var leadingSpaceRe = /^\n* /;
      return leadingSpaceRe.test(string);
    }
    var STYLE_PLAIN = 1;
    var STYLE_SINGLE = 2;
    var STYLE_LITERAL = 3;
    var STYLE_FOLDED = 4;
    var STYLE_DOUBLE = 5;
    function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
      var i;
      var char2 = 0;
      var prevChar = null;
      var hasLineBreak = false;
      var hasFoldableLine = false;
      var shouldTrackWidth = lineWidth !== -1;
      var previousLineBreak = -1;
      var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
      if (singleLineOnly || forceQuotes) {
        for (i = 0; i < string.length; char2 >= 65536 ? i += 2 : i++) {
          char2 = codePointAt(string, i);
          if (!isPrintable(char2)) {
            return STYLE_DOUBLE;
          }
          plain = plain && isPlainSafe(char2, prevChar, inblock);
          prevChar = char2;
        }
      } else {
        for (i = 0; i < string.length; char2 >= 65536 ? i += 2 : i++) {
          char2 = codePointAt(string, i);
          if (char2 === CHAR_LINE_FEED) {
            hasLineBreak = true;
            if (shouldTrackWidth) {
              hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
              i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
              previousLineBreak = i;
            }
          } else if (!isPrintable(char2)) {
            return STYLE_DOUBLE;
          }
          plain = plain && isPlainSafe(char2, prevChar, inblock);
          prevChar = char2;
        }
        hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
      }
      if (!hasLineBreak && !hasFoldableLine) {
        if (plain && !forceQuotes && !testAmbiguousType(string)) {
          return STYLE_PLAIN;
        }
        return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
      }
      if (indentPerLevel > 9 && needIndentIndicator(string)) {
        return STYLE_DOUBLE;
      }
      if (!forceQuotes) {
        return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
      }
      return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
    }
    function writeScalar(state2, string, level, iskey, inblock) {
      state2.dump = function() {
        if (string.length === 0) {
          return state2.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
        }
        if (!state2.noCompatMode) {
          if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
            return state2.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
          }
        }
        var indent = state2.indent * Math.max(1, level);
        var lineWidth = state2.lineWidth === -1 ? -1 : Math.max(Math.min(state2.lineWidth, 40), state2.lineWidth - indent);
        var singleLineOnly = iskey || state2.flowLevel > -1 && level >= state2.flowLevel;
        function testAmbiguity(string2) {
          return testImplicitResolving(state2, string2);
        }
        switch (chooseScalarStyle(
          string,
          singleLineOnly,
          state2.indent,
          lineWidth,
          testAmbiguity,
          state2.quotingType,
          state2.forceQuotes && !iskey,
          inblock
        )) {
          case STYLE_PLAIN:
            return string;
          case STYLE_SINGLE:
            return "'" + string.replace(/'/g, "''") + "'";
          case STYLE_LITERAL:
            return "|" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(string, indent));
          case STYLE_FOLDED:
            return ">" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
          case STYLE_DOUBLE:
            return '"' + escapeString(string, lineWidth) + '"';
          default:
            throw new YAMLException("impossible error: invalid scalar style");
        }
      }();
    }
    function blockHeader(string, indentPerLevel) {
      var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
      var clip = string[string.length - 1] === "\n";
      var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
      var chomp = keep ? "+" : clip ? "" : "-";
      return indentIndicator + chomp + "\n";
    }
    function dropEndingNewline(string) {
      return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
    }
    function foldString(string, width) {
      var lineRe = /(\n+)([^\n]*)/g;
      var result = function() {
        var nextLF = string.indexOf("\n");
        nextLF = nextLF !== -1 ? nextLF : string.length;
        lineRe.lastIndex = nextLF;
        return foldLine(string.slice(0, nextLF), width);
      }();
      var prevMoreIndented = string[0] === "\n" || string[0] === " ";
      var moreIndented;
      var match3;
      while (match3 = lineRe.exec(string)) {
        var prefix = match3[1], line = match3[2];
        moreIndented = line[0] === " ";
        result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
        prevMoreIndented = moreIndented;
      }
      return result;
    }
    function foldLine(line, width) {
      if (line === "" || line[0] === " ") return line;
      var breakRe = / [^ ]/g;
      var match3;
      var start = 0, end, curr = 0, next2 = 0;
      var result = "";
      while (match3 = breakRe.exec(line)) {
        next2 = match3.index;
        if (next2 - start > width) {
          end = curr > start ? curr : next2;
          result += "\n" + line.slice(start, end);
          start = end + 1;
        }
        curr = next2;
      }
      result += "\n";
      if (line.length - start > width && curr > start) {
        result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
      } else {
        result += line.slice(start);
      }
      return result.slice(1);
    }
    function escapeString(string) {
      var result = "";
      var char2 = 0;
      var escapeSeq;
      for (var i = 0; i < string.length; char2 >= 65536 ? i += 2 : i++) {
        char2 = codePointAt(string, i);
        escapeSeq = ESCAPE_SEQUENCES[char2];
        if (!escapeSeq && isPrintable(char2)) {
          result += string[i];
          if (char2 >= 65536) result += string[i + 1];
        } else {
          result += escapeSeq || encodeHex(char2);
        }
      }
      return result;
    }
    function writeFlowSequence(state2, level, object) {
      var _result = "", _tag = state2.tag, index6, length, value2;
      for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
        value2 = object[index6];
        if (state2.replacer) {
          value2 = state2.replacer.call(object, String(index6), value2);
        }
        if (writeNode(state2, level, value2, false, false) || typeof value2 === "undefined" && writeNode(state2, level, null, false, false)) {
          if (_result !== "") _result += "," + (!state2.condenseFlow ? " " : "");
          _result += state2.dump;
        }
      }
      state2.tag = _tag;
      state2.dump = "[" + _result + "]";
    }
    function writeBlockSequence(state2, level, object, compact) {
      var _result = "", _tag = state2.tag, index6, length, value2;
      for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
        value2 = object[index6];
        if (state2.replacer) {
          value2 = state2.replacer.call(object, String(index6), value2);
        }
        if (writeNode(state2, level + 1, value2, true, true, false, true) || typeof value2 === "undefined" && writeNode(state2, level + 1, null, true, true, false, true)) {
          if (!compact || _result !== "") {
            _result += generateNextLine(state2, level);
          }
          if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
            _result += "-";
          } else {
            _result += "- ";
          }
          _result += state2.dump;
        }
      }
      state2.tag = _tag;
      state2.dump = _result || "[]";
    }
    function writeFlowMapping(state2, level, object) {
      var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index6, length, objectKey, objectValue, pairBuffer;
      for (index6 = 0, length = objectKeyList.length; index6 < length; index6 += 1) {
        pairBuffer = "";
        if (_result !== "") pairBuffer += ", ";
        if (state2.condenseFlow) pairBuffer += '"';
        objectKey = objectKeyList[index6];
        objectValue = object[objectKey];
        if (state2.replacer) {
          objectValue = state2.replacer.call(object, objectKey, objectValue);
        }
        if (!writeNode(state2, level, objectKey, false, false)) {
          continue;
        }
        if (state2.dump.length > 1024) pairBuffer += "? ";
        pairBuffer += state2.dump + (state2.condenseFlow ? '"' : "") + ":" + (state2.condenseFlow ? "" : " ");
        if (!writeNode(state2, level, objectValue, false, false)) {
          continue;
        }
        pairBuffer += state2.dump;
        _result += pairBuffer;
      }
      state2.tag = _tag;
      state2.dump = "{" + _result + "}";
    }
    function writeBlockMapping(state2, level, object, compact) {
      var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index6, length, objectKey, objectValue, explicitPair, pairBuffer;
      if (state2.sortKeys === true) {
        objectKeyList.sort();
      } else if (typeof state2.sortKeys === "function") {
        objectKeyList.sort(state2.sortKeys);
      } else if (state2.sortKeys) {
        throw new YAMLException("sortKeys must be a boolean or a function");
      }
      for (index6 = 0, length = objectKeyList.length; index6 < length; index6 += 1) {
        pairBuffer = "";
        if (!compact || _result !== "") {
          pairBuffer += generateNextLine(state2, level);
        }
        objectKey = objectKeyList[index6];
        objectValue = object[objectKey];
        if (state2.replacer) {
          objectValue = state2.replacer.call(object, objectKey, objectValue);
        }
        if (!writeNode(state2, level + 1, objectKey, true, true, true)) {
          continue;
        }
        explicitPair = state2.tag !== null && state2.tag !== "?" || state2.dump && state2.dump.length > 1024;
        if (explicitPair) {
          if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
            pairBuffer += "?";
          } else {
            pairBuffer += "? ";
          }
        }
        pairBuffer += state2.dump;
        if (explicitPair) {
          pairBuffer += generateNextLine(state2, level);
        }
        if (!writeNode(state2, level + 1, objectValue, true, explicitPair)) {
          continue;
        }
        if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
          pairBuffer += ":";
        } else {
          pairBuffer += ": ";
        }
        pairBuffer += state2.dump;
        _result += pairBuffer;
      }
      state2.tag = _tag;
      state2.dump = _result || "{}";
    }
    function detectType(state2, object, explicit) {
      var _result, typeList, index6, length, type, style;
      typeList = explicit ? state2.explicitTypes : state2.implicitTypes;
      for (index6 = 0, length = typeList.length; index6 < length; index6 += 1) {
        type = typeList[index6];
        if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
          if (explicit) {
            if (type.multi && type.representName) {
              state2.tag = type.representName(object);
            } else {
              state2.tag = type.tag;
            }
          } else {
            state2.tag = "?";
          }
          if (type.represent) {
            style = state2.styleMap[type.tag] || type.defaultStyle;
            if (_toString2.call(type.represent) === "[object Function]") {
              _result = type.represent(object, style);
            } else if (_hasOwnProperty.call(type.represent, style)) {
              _result = type.represent[style](object, style);
            } else {
              throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
            }
            state2.dump = _result;
          }
          return true;
        }
      }
      return false;
    }
    function writeNode(state2, level, object, block2, compact, iskey, isblockseq) {
      state2.tag = null;
      state2.dump = object;
      if (!detectType(state2, object, false)) {
        detectType(state2, object, true);
      }
      var type = _toString2.call(state2.dump);
      var inblock = block2;
      var tagStr;
      if (block2) {
        block2 = state2.flowLevel < 0 || state2.flowLevel > level;
      }
      var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
      if (objectOrArray) {
        duplicateIndex = state2.duplicates.indexOf(object);
        duplicate = duplicateIndex !== -1;
      }
      if (state2.tag !== null && state2.tag !== "?" || duplicate || state2.indent !== 2 && level > 0) {
        compact = false;
      }
      if (duplicate && state2.usedDuplicates[duplicateIndex]) {
        state2.dump = "*ref_" + duplicateIndex;
      } else {
        if (objectOrArray && duplicate && !state2.usedDuplicates[duplicateIndex]) {
          state2.usedDuplicates[duplicateIndex] = true;
        }
        if (type === "[object Object]") {
          if (block2 && Object.keys(state2.dump).length !== 0) {
            writeBlockMapping(state2, level, state2.dump, compact);
            if (duplicate) {
              state2.dump = "&ref_" + duplicateIndex + state2.dump;
            }
          } else {
            writeFlowMapping(state2, level, state2.dump);
            if (duplicate) {
              state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
            }
          }
        } else if (type === "[object Array]") {
          if (block2 && state2.dump.length !== 0) {
            if (state2.noArrayIndent && !isblockseq && level > 0) {
              writeBlockSequence(state2, level - 1, state2.dump, compact);
            } else {
              writeBlockSequence(state2, level, state2.dump, compact);
            }
            if (duplicate) {
              state2.dump = "&ref_" + duplicateIndex + state2.dump;
            }
          } else {
            writeFlowSequence(state2, level, state2.dump);
            if (duplicate) {
              state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
            }
          }
        } else if (type === "[object String]") {
          if (state2.tag !== "?") {
            writeScalar(state2, state2.dump, level, iskey, inblock);
          }
        } else if (type === "[object Undefined]") {
          return false;
        } else {
          if (state2.skipInvalid) return false;
          throw new YAMLException("unacceptable kind of an object to dump " + type);
        }
        if (state2.tag !== null && state2.tag !== "?") {
          tagStr = encodeURI(
            state2.tag[0] === "!" ? state2.tag.slice(1) : state2.tag
          ).replace(/!/g, "%21");
          if (state2.tag[0] === "!") {
            tagStr = "!" + tagStr;
          } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
            tagStr = "!!" + tagStr.slice(18);
          } else {
            tagStr = "!<" + tagStr + ">";
          }
          state2.dump = tagStr + " " + state2.dump;
        }
      }
      return true;
    }
    function getDuplicateReferences(object, state2) {
      var objects = [], duplicatesIndexes = [], index6, length;
      inspectNode(object, objects, duplicatesIndexes);
      for (index6 = 0, length = duplicatesIndexes.length; index6 < length; index6 += 1) {
        state2.duplicates.push(objects[duplicatesIndexes[index6]]);
      }
      state2.usedDuplicates = new Array(length);
    }
    function inspectNode(object, objects, duplicatesIndexes) {
      var objectKeyList, index6, length;
      if (object !== null && typeof object === "object") {
        index6 = objects.indexOf(object);
        if (index6 !== -1) {
          if (duplicatesIndexes.indexOf(index6) === -1) {
            duplicatesIndexes.push(index6);
          }
        } else {
          objects.push(object);
          if (Array.isArray(object)) {
            for (index6 = 0, length = object.length; index6 < length; index6 += 1) {
              inspectNode(object[index6], objects, duplicatesIndexes);
            }
          } else {
            objectKeyList = Object.keys(object);
            for (index6 = 0, length = objectKeyList.length; index6 < length; index6 += 1) {
              inspectNode(object[objectKeyList[index6]], objects, duplicatesIndexes);
            }
          }
        }
      }
    }
    function dump(input, options) {
      options = options || {};
      var state2 = new State(options);
      if (!state2.noRefs) getDuplicateReferences(input, state2);
      var value2 = input;
      if (state2.replacer) {
        value2 = state2.replacer.call({ "": value2 }, "", value2);
      }
      if (writeNode(state2, 0, value2, true, true)) return state2.dump + "\n";
      return "";
    }
    module2.exports.dump = dump;
  }
});

// node_modules/js-yaml/index.js
var require_js_yaml = __commonJS({
  "node_modules/js-yaml/index.js"(exports2, module2) {
    "use strict";
    var loader = require_loader();
    var dumper = require_dumper();
    function renamed(from, to) {
      return function() {
        throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
      };
    }
    module2.exports.Type = require_type();
    module2.exports.Schema = require_schema();
    module2.exports.FAILSAFE_SCHEMA = require_failsafe();
    module2.exports.JSON_SCHEMA = require_json();
    module2.exports.CORE_SCHEMA = require_core();
    module2.exports.DEFAULT_SCHEMA = require_default();
    module2.exports.load = loader.load;
    module2.exports.loadAll = loader.loadAll;
    module2.exports.dump = dumper.dump;
    module2.exports.YAMLException = require_exception();
    module2.exports.types = {
      binary: require_binary(),
      float: require_float(),
      map: require_map(),
      null: require_null(),
      pairs: require_pairs(),
      set: require_set(),
      timestamp: require_timestamp(),
      bool: require_bool(),
      int: require_int(),
      merge: require_merge(),
      omap: require_omap(),
      seq: require_seq(),
      str: require_str()
    };
    module2.exports.safeLoad = renamed("safeLoad", "load");
    module2.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
    module2.exports.safeDump = renamed("safeDump", "dump");
  }
});

// node_modules/markdown-it/lib/token.mjs
var token_exports = {};
__export2(token_exports, {
  default: () => token_default
});
function Token(type, tag2, nesting) {
  this.type = type;
  this.tag = tag2;
  this.attrs = null;
  this.map = null;
  this.nesting = nesting;
  this.level = 0;
  this.children = null;
  this.content = "";
  this.markup = "";
  this.info = "";
  this.meta = null;
  this.block = false;
  this.hidden = false;
}
var token_default;
var init_token = __esm({
  "node_modules/markdown-it/lib/token.mjs"() {
    Token.prototype.attrIndex = function attrIndex(name) {
      if (!this.attrs) {
        return -1;
      }
      const attrs = this.attrs;
      for (let i = 0, len = attrs.length; i < len; i++) {
        if (attrs[i][0] === name) {
          return i;
        }
      }
      return -1;
    };
    Token.prototype.attrPush = function attrPush(attrData) {
      if (this.attrs) {
        this.attrs.push(attrData);
      } else {
        this.attrs = [attrData];
      }
    };
    Token.prototype.attrSet = function attrSet(name, value2) {
      const idx2 = this.attrIndex(name);
      const attrData = [name, value2];
      if (idx2 < 0) {
        this.attrPush(attrData);
      } else {
        this.attrs[idx2] = attrData;
      }
    };
    Token.prototype.attrGet = function attrGet(name) {
      const idx2 = this.attrIndex(name);
      let value2 = null;
      if (idx2 >= 0) {
        value2 = this.attrs[idx2][1];
      }
      return value2;
    };
    Token.prototype.attrJoin = function attrJoin(name, value2) {
      const idx2 = this.attrIndex(name);
      if (idx2 < 0) {
        this.attrPush([name, value2]);
      } else {
        this.attrs[idx2][1] = this.attrs[idx2][1] + " " + value2;
      }
    };
    token_default = Token;
  }
});

// node_modules/mdurl/build/index.cjs.js
var require_index_cjs = __commonJS({
  "node_modules/mdurl/build/index.cjs.js"(exports2) {
    "use strict";
    var decodeCache = {};
    function getDecodeCache(exclude) {
      let cache = decodeCache[exclude];
      if (cache) {
        return cache;
      }
      cache = decodeCache[exclude] = [];
      for (let i = 0; i < 128; i++) {
        const ch3 = String.fromCharCode(i);
        cache.push(ch3);
      }
      for (let i = 0; i < exclude.length; i++) {
        const ch3 = exclude.charCodeAt(i);
        cache[ch3] = "%" + ("0" + ch3.toString(16).toUpperCase()).slice(-2);
      }
      return cache;
    }
    function decode2(string, exclude) {
      if (typeof exclude !== "string") {
        exclude = decode2.defaultChars;
      }
      const cache = getDecodeCache(exclude);
      return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
        let result = "";
        for (let i = 0, l = seq.length; i < l; i += 3) {
          const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
          if (b1 < 128) {
            result += cache[b1];
            continue;
          }
          if ((b1 & 224) === 192 && i + 3 < l) {
            const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
            if ((b2 & 192) === 128) {
              const chr = b1 << 6 & 1984 | b2 & 63;
              if (chr < 128) {
                result += "\uFFFD\uFFFD";
              } else {
                result += String.fromCharCode(chr);
              }
              i += 3;
              continue;
            }
          }
          if ((b1 & 240) === 224 && i + 6 < l) {
            const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
            const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
            if ((b2 & 192) === 128 && (b3 & 192) === 128) {
              const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
              if (chr < 2048 || chr >= 55296 && chr <= 57343) {
                result += "\uFFFD\uFFFD\uFFFD";
              } else {
                result += String.fromCharCode(chr);
              }
              i += 6;
              continue;
            }
          }
          if ((b1 & 248) === 240 && i + 9 < l) {
            const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
            const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
            const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
            if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
              let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
              if (chr < 65536 || chr > 1114111) {
                result += "\uFFFD\uFFFD\uFFFD\uFFFD";
              } else {
                chr -= 65536;
                result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
              }
              i += 9;
              continue;
            }
          }
          result += "\uFFFD";
        }
        return result;
      });
    }
    decode2.defaultChars = ";/?:@&=+$,#";
    decode2.componentChars = "";
    var encodeCache = {};
    function getEncodeCache(exclude) {
      let cache = encodeCache[exclude];
      if (cache) {
        return cache;
      }
      cache = encodeCache[exclude] = [];
      for (let i = 0; i < 128; i++) {
        const ch3 = String.fromCharCode(i);
        if (/^[0-9a-z]$/i.test(ch3)) {
          cache.push(ch3);
        } else {
          cache.push("%" + ("0" + i.toString(16).toUpperCase()).slice(-2));
        }
      }
      for (let i = 0; i < exclude.length; i++) {
        cache[exclude.charCodeAt(i)] = exclude[i];
      }
      return cache;
    }
    function encode2(string, exclude, keepEscaped) {
      if (typeof exclude !== "string") {
        keepEscaped = exclude;
        exclude = encode2.defaultChars;
      }
      if (typeof keepEscaped === "undefined") {
        keepEscaped = true;
      }
      const cache = getEncodeCache(exclude);
      let result = "";
      for (let i = 0, l = string.length; i < l; i++) {
        const code = string.charCodeAt(i);
        if (keepEscaped && code === 37 && i + 2 < l) {
          if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
            result += string.slice(i, i + 3);
            i += 2;
            continue;
          }
        }
        if (code < 128) {
          result += cache[code];
          continue;
        }
        if (code >= 55296 && code <= 57343) {
          if (code >= 55296 && code <= 56319 && i + 1 < l) {
            const nextCode = string.charCodeAt(i + 1);
            if (nextCode >= 56320 && nextCode <= 57343) {
              result += encodeURIComponent(string[i] + string[i + 1]);
              i++;
              continue;
            }
          }
          result += "%EF%BF%BD";
          continue;
        }
        result += encodeURIComponent(string[i]);
      }
      return result;
    }
    encode2.defaultChars = ";/?:@&=+$,-_.!~*'()#";
    encode2.componentChars = "-_.!~*'()";
    function format(url) {
      let result = "";
      result += url.protocol || "";
      result += url.slashes ? "//" : "";
      result += url.auth ? url.auth + "@" : "";
      if (url.hostname && url.hostname.indexOf(":") !== -1) {
        result += "[" + url.hostname + "]";
      } else {
        result += url.hostname || "";
      }
      result += url.port ? ":" + url.port : "";
      result += url.pathname || "";
      result += url.search || "";
      result += url.hash || "";
      return result;
    }
    function Url() {
      this.protocol = null;
      this.slashes = null;
      this.auth = null;
      this.port = null;
      this.hostname = null;
      this.hash = null;
      this.search = null;
      this.pathname = null;
    }
    var protocolPattern = /^([a-z0-9.+-]+:)/i;
    var portPattern = /:[0-9]*$/;
    var simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
    var delims = ["<", ">", '"', "`", " ", "\r", "\n", "	"];
    var unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims);
    var autoEscape = ["'"].concat(unwise);
    var nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape);
    var hostEndingChars = ["/", "?", "#"];
    var hostnameMaxLen = 255;
    var hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
    var hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
    var hostlessProtocol = {
      javascript: true,
      "javascript:": true
    };
    var slashedProtocol = {
      http: true,
      https: true,
      ftp: true,
      gopher: true,
      file: true,
      "http:": true,
      "https:": true,
      "ftp:": true,
      "gopher:": true,
      "file:": true
    };
    function urlParse(url, slashesDenoteHost) {
      if (url && url instanceof Url) return url;
      const u = new Url();
      u.parse(url, slashesDenoteHost);
      return u;
    }
    Url.prototype.parse = function(url, slashesDenoteHost) {
      let lowerProto, hec, slashes;
      let rest = url;
      rest = rest.trim();
      if (!slashesDenoteHost && url.split("#").length === 1) {
        const simplePath = simplePathPattern.exec(rest);
        if (simplePath) {
          this.pathname = simplePath[1];
          if (simplePath[2]) {
            this.search = simplePath[2];
          }
          return this;
        }
      }
      let proto = protocolPattern.exec(rest);
      if (proto) {
        proto = proto[0];
        lowerProto = proto.toLowerCase();
        this.protocol = proto;
        rest = rest.substr(proto.length);
      }
      if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
        slashes = rest.substr(0, 2) === "//";
        if (slashes && !(proto && hostlessProtocol[proto])) {
          rest = rest.substr(2);
          this.slashes = true;
        }
      }
      if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
        let hostEnd = -1;
        for (let i = 0; i < hostEndingChars.length; i++) {
          hec = rest.indexOf(hostEndingChars[i]);
          if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
            hostEnd = hec;
          }
        }
        let auth, atSign;
        if (hostEnd === -1) {
          atSign = rest.lastIndexOf("@");
        } else {
          atSign = rest.lastIndexOf("@", hostEnd);
        }
        if (atSign !== -1) {
          auth = rest.slice(0, atSign);
          rest = rest.slice(atSign + 1);
          this.auth = auth;
        }
        hostEnd = -1;
        for (let i = 0; i < nonHostChars.length; i++) {
          hec = rest.indexOf(nonHostChars[i]);
          if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
            hostEnd = hec;
          }
        }
        if (hostEnd === -1) {
          hostEnd = rest.length;
        }
        if (rest[hostEnd - 1] === ":") {
          hostEnd--;
        }
        const host = rest.slice(0, hostEnd);
        rest = rest.slice(hostEnd);
        this.parseHost(host);
        this.hostname = this.hostname || "";
        const ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
        if (!ipv6Hostname) {
          const hostparts = this.hostname.split(/\./);
          for (let i = 0, l = hostparts.length; i < l; i++) {
            const part = hostparts[i];
            if (!part) {
              continue;
            }
            if (!part.match(hostnamePartPattern)) {
              let newpart = "";
              for (let j = 0, k = part.length; j < k; j++) {
                if (part.charCodeAt(j) > 127) {
                  newpart += "x";
                } else {
                  newpart += part[j];
                }
              }
              if (!newpart.match(hostnamePartPattern)) {
                const validParts = hostparts.slice(0, i);
                const notHost = hostparts.slice(i + 1);
                const bit = part.match(hostnamePartStart);
                if (bit) {
                  validParts.push(bit[1]);
                  notHost.unshift(bit[2]);
                }
                if (notHost.length) {
                  rest = notHost.join(".") + rest;
                }
                this.hostname = validParts.join(".");
                break;
              }
            }
          }
        }
        if (this.hostname.length > hostnameMaxLen) {
          this.hostname = "";
        }
        if (ipv6Hostname) {
          this.hostname = this.hostname.substr(1, this.hostname.length - 2);
        }
      }
      const hash2 = rest.indexOf("#");
      if (hash2 !== -1) {
        this.hash = rest.substr(hash2);
        rest = rest.slice(0, hash2);
      }
      const qm = rest.indexOf("?");
      if (qm !== -1) {
        this.search = rest.substr(qm);
        rest = rest.slice(0, qm);
      }
      if (rest) {
        this.pathname = rest;
      }
      if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
        this.pathname = "";
      }
      return this;
    };
    Url.prototype.parseHost = function(host) {
      let port = portPattern.exec(host);
      if (port) {
        port = port[0];
        if (port !== ":") {
          this.port = port.substr(1);
        }
        host = host.substr(0, host.length - port.length);
      }
      if (host) {
        this.hostname = host;
      }
    };
    exports2.decode = decode2;
    exports2.encode = encode2;
    exports2.format = format;
    exports2.parse = urlParse;
  }
});

// node_modules/uc.micro/build/index.cjs.js
var require_index_cjs2 = __commonJS({
  "node_modules/uc.micro/build/index.cjs.js"(exports2) {
    "use strict";
    var regex$5 = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
    var regex$4 = /[\0-\x1F\x7F-\x9F]/;
    var regex$3 = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;
    var regex$2 = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
    var regex$1 = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
    var regex2 = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
    exports2.Any = regex$5;
    exports2.Cc = regex$4;
    exports2.Cf = regex$3;
    exports2.P = regex$2;
    exports2.S = regex$1;
    exports2.Z = regex2;
  }
});

// node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js
var require_decode_data_html = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.default = new Uint16Array(
      // prettier-ignore
      '\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(function(c) {
        return c.charCodeAt(0);
      })
    );
  }
});

// node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js
var require_decode_data_xml = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.default = new Uint16Array(
      // prettier-ignore
      "\u0200aglq	\x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(function(c) {
        return c.charCodeAt(0);
      })
    );
  }
});

// node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js
var require_decode_codepoint = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js"(exports2) {
    "use strict";
    var _a6;
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.replaceCodePoint = exports2.fromCodePoint = void 0;
    var decodeMap = /* @__PURE__ */ new Map([
      [0, 65533],
      // C1 Unicode control character reference replacements
      [128, 8364],
      [130, 8218],
      [131, 402],
      [132, 8222],
      [133, 8230],
      [134, 8224],
      [135, 8225],
      [136, 710],
      [137, 8240],
      [138, 352],
      [139, 8249],
      [140, 338],
      [142, 381],
      [145, 8216],
      [146, 8217],
      [147, 8220],
      [148, 8221],
      [149, 8226],
      [150, 8211],
      [151, 8212],
      [152, 732],
      [153, 8482],
      [154, 353],
      [155, 8250],
      [156, 339],
      [158, 382],
      [159, 376]
    ]);
    exports2.fromCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
    (_a6 = String.fromCodePoint) !== null && _a6 !== void 0 ? _a6 : function(codePoint) {
      var output = "";
      if (codePoint > 65535) {
        codePoint -= 65536;
        output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296);
        codePoint = 56320 | codePoint & 1023;
      }
      output += String.fromCharCode(codePoint);
      return output;
    };
    function replaceCodePoint(codePoint) {
      var _a7;
      if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) {
        return 65533;
      }
      return (_a7 = decodeMap.get(codePoint)) !== null && _a7 !== void 0 ? _a7 : codePoint;
    }
    exports2.replaceCodePoint = replaceCodePoint;
    function decodeCodePoint(codePoint) {
      return (0, exports2.fromCodePoint)(replaceCodePoint(codePoint));
    }
    exports2.default = decodeCodePoint;
  }
});

// node_modules/markdown-it/node_modules/entities/lib/decode.js
var require_decode = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/decode.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m2, k);
      if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m2[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    } : function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m2[k];
    });
    var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      }
      __setModuleDefault(result, mod);
      return result;
    };
    var __importDefault = exports2 && exports2.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.decodeXML = exports2.decodeHTMLStrict = exports2.decodeHTMLAttribute = exports2.decodeHTML = exports2.determineBranch = exports2.EntityDecoder = exports2.DecodingMode = exports2.BinTrieFlags = exports2.fromCodePoint = exports2.replaceCodePoint = exports2.decodeCodePoint = exports2.xmlDecodeTree = exports2.htmlDecodeTree = void 0;
    var decode_data_html_js_1 = __importDefault(require_decode_data_html());
    exports2.htmlDecodeTree = decode_data_html_js_1.default;
    var decode_data_xml_js_1 = __importDefault(require_decode_data_xml());
    exports2.xmlDecodeTree = decode_data_xml_js_1.default;
    var decode_codepoint_js_1 = __importStar(require_decode_codepoint());
    exports2.decodeCodePoint = decode_codepoint_js_1.default;
    var decode_codepoint_js_2 = require_decode_codepoint();
    Object.defineProperty(exports2, "replaceCodePoint", { enumerable: true, get: function() {
      return decode_codepoint_js_2.replaceCodePoint;
    } });
    Object.defineProperty(exports2, "fromCodePoint", { enumerable: true, get: function() {
      return decode_codepoint_js_2.fromCodePoint;
    } });
    var CharCodes;
    (function(CharCodes2) {
      CharCodes2[CharCodes2["NUM"] = 35] = "NUM";
      CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI";
      CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS";
      CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO";
      CharCodes2[CharCodes2["NINE"] = 57] = "NINE";
      CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A";
      CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F";
      CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X";
      CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z";
      CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A";
      CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F";
      CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z";
    })(CharCodes || (CharCodes = {}));
    var TO_LOWER_BIT = 32;
    var BinTrieFlags;
    (function(BinTrieFlags2) {
      BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
      BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
      BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
    })(BinTrieFlags = exports2.BinTrieFlags || (exports2.BinTrieFlags = {}));
    function isNumber(code) {
      return code >= CharCodes.ZERO && code <= CharCodes.NINE;
    }
    function isHexadecimalCharacter(code) {
      return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F;
    }
    function isAsciiAlphaNumeric(code) {
      return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code);
    }
    function isEntityInAttributeInvalidEnd(code) {
      return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
    }
    var EntityDecoderState;
    (function(EntityDecoderState2) {
      EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart";
      EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart";
      EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal";
      EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex";
      EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity";
    })(EntityDecoderState || (EntityDecoderState = {}));
    var DecodingMode;
    (function(DecodingMode2) {
      DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy";
      DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict";
      DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute";
    })(DecodingMode = exports2.DecodingMode || (exports2.DecodingMode = {}));
    var EntityDecoder = (
      /** @class */
      function() {
        function EntityDecoder2(decodeTree, emitCodePoint, errors2) {
          this.decodeTree = decodeTree;
          this.emitCodePoint = emitCodePoint;
          this.errors = errors2;
          this.state = EntityDecoderState.EntityStart;
          this.consumed = 1;
          this.result = 0;
          this.treeIndex = 0;
          this.excess = 1;
          this.decodeMode = DecodingMode.Strict;
        }
        EntityDecoder2.prototype.startEntity = function(decodeMode) {
          this.decodeMode = decodeMode;
          this.state = EntityDecoderState.EntityStart;
          this.result = 0;
          this.treeIndex = 0;
          this.excess = 1;
          this.consumed = 1;
        };
        EntityDecoder2.prototype.write = function(str, offset) {
          switch (this.state) {
            case EntityDecoderState.EntityStart: {
              if (str.charCodeAt(offset) === CharCodes.NUM) {
                this.state = EntityDecoderState.NumericStart;
                this.consumed += 1;
                return this.stateNumericStart(str, offset + 1);
              }
              this.state = EntityDecoderState.NamedEntity;
              return this.stateNamedEntity(str, offset);
            }
            case EntityDecoderState.NumericStart: {
              return this.stateNumericStart(str, offset);
            }
            case EntityDecoderState.NumericDecimal: {
              return this.stateNumericDecimal(str, offset);
            }
            case EntityDecoderState.NumericHex: {
              return this.stateNumericHex(str, offset);
            }
            case EntityDecoderState.NamedEntity: {
              return this.stateNamedEntity(str, offset);
            }
          }
        };
        EntityDecoder2.prototype.stateNumericStart = function(str, offset) {
          if (offset >= str.length) {
            return -1;
          }
          if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
            this.state = EntityDecoderState.NumericHex;
            this.consumed += 1;
            return this.stateNumericHex(str, offset + 1);
          }
          this.state = EntityDecoderState.NumericDecimal;
          return this.stateNumericDecimal(str, offset);
        };
        EntityDecoder2.prototype.addToNumericResult = function(str, start, end, base2) {
          if (start !== end) {
            var digitCount = end - start;
            this.result = this.result * Math.pow(base2, digitCount) + parseInt(str.substr(start, digitCount), base2);
            this.consumed += digitCount;
          }
        };
        EntityDecoder2.prototype.stateNumericHex = function(str, offset) {
          var startIdx = offset;
          while (offset < str.length) {
            var char2 = str.charCodeAt(offset);
            if (isNumber(char2) || isHexadecimalCharacter(char2)) {
              offset += 1;
            } else {
              this.addToNumericResult(str, startIdx, offset, 16);
              return this.emitNumericEntity(char2, 3);
            }
          }
          this.addToNumericResult(str, startIdx, offset, 16);
          return -1;
        };
        EntityDecoder2.prototype.stateNumericDecimal = function(str, offset) {
          var startIdx = offset;
          while (offset < str.length) {
            var char2 = str.charCodeAt(offset);
            if (isNumber(char2)) {
              offset += 1;
            } else {
              this.addToNumericResult(str, startIdx, offset, 10);
              return this.emitNumericEntity(char2, 2);
            }
          }
          this.addToNumericResult(str, startIdx, offset, 10);
          return -1;
        };
        EntityDecoder2.prototype.emitNumericEntity = function(lastCp, expectedLength) {
          var _a6;
          if (this.consumed <= expectedLength) {
            (_a6 = this.errors) === null || _a6 === void 0 ? void 0 : _a6.absenceOfDigitsInNumericCharacterReference(this.consumed);
            return 0;
          }
          if (lastCp === CharCodes.SEMI) {
            this.consumed += 1;
          } else if (this.decodeMode === DecodingMode.Strict) {
            return 0;
          }
          this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed);
          if (this.errors) {
            if (lastCp !== CharCodes.SEMI) {
              this.errors.missingSemicolonAfterCharacterReference();
            }
            this.errors.validateNumericCharacterReference(this.result);
          }
          return this.consumed;
        };
        EntityDecoder2.prototype.stateNamedEntity = function(str, offset) {
          var decodeTree = this.decodeTree;
          var current = decodeTree[this.treeIndex];
          var valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
          for (; offset < str.length; offset++, this.excess++) {
            var char2 = str.charCodeAt(offset);
            this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char2);
            if (this.treeIndex < 0) {
              return this.result === 0 || // If we are parsing an attribute
              this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity,
              (valueLength === 0 || // And there should be no invalid characters.
              isEntityInAttributeInvalidEnd(char2)) ? 0 : this.emitNotTerminatedNamedEntity();
            }
            current = decodeTree[this.treeIndex];
            valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
            if (valueLength !== 0) {
              if (char2 === CharCodes.SEMI) {
                return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
              }
              if (this.decodeMode !== DecodingMode.Strict) {
                this.result = this.treeIndex;
                this.consumed += this.excess;
                this.excess = 0;
              }
            }
          }
          return -1;
        };
        EntityDecoder2.prototype.emitNotTerminatedNamedEntity = function() {
          var _a6;
          var _b4 = this, result = _b4.result, decodeTree = _b4.decodeTree;
          var valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
          this.emitNamedEntityData(result, valueLength, this.consumed);
          (_a6 = this.errors) === null || _a6 === void 0 ? void 0 : _a6.missingSemicolonAfterCharacterReference();
          return this.consumed;
        };
        EntityDecoder2.prototype.emitNamedEntityData = function(result, valueLength, consumed) {
          var decodeTree = this.decodeTree;
          this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH : decodeTree[result + 1], consumed);
          if (valueLength === 3) {
            this.emitCodePoint(decodeTree[result + 2], consumed);
          }
          return consumed;
        };
        EntityDecoder2.prototype.end = function() {
          var _a6;
          switch (this.state) {
            case EntityDecoderState.NamedEntity: {
              return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
            }
            // Otherwise, emit a numeric entity if we have one.
            case EntityDecoderState.NumericDecimal: {
              return this.emitNumericEntity(0, 2);
            }
            case EntityDecoderState.NumericHex: {
              return this.emitNumericEntity(0, 3);
            }
            case EntityDecoderState.NumericStart: {
              (_a6 = this.errors) === null || _a6 === void 0 ? void 0 : _a6.absenceOfDigitsInNumericCharacterReference(this.consumed);
              return 0;
            }
            case EntityDecoderState.EntityStart: {
              return 0;
            }
          }
        };
        return EntityDecoder2;
      }()
    );
    exports2.EntityDecoder = EntityDecoder;
    function getDecoder(decodeTree) {
      var ret = "";
      var decoder = new EntityDecoder(decodeTree, function(str) {
        return ret += (0, decode_codepoint_js_1.fromCodePoint)(str);
      });
      return function decodeWithTrie(str, decodeMode) {
        var lastIndex = 0;
        var offset = 0;
        while ((offset = str.indexOf("&", offset)) >= 0) {
          ret += str.slice(lastIndex, offset);
          decoder.startEntity(decodeMode);
          var len = decoder.write(
            str,
            // Skip the "&"
            offset + 1
          );
          if (len < 0) {
            lastIndex = offset + decoder.end();
            break;
          }
          lastIndex = offset + len;
          offset = len === 0 ? lastIndex + 1 : lastIndex;
        }
        var result = ret + str.slice(lastIndex);
        ret = "";
        return result;
      };
    }
    function determineBranch(decodeTree, current, nodeIdx, char2) {
      var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
      var jumpOffset = current & BinTrieFlags.JUMP_TABLE;
      if (branchCount === 0) {
        return jumpOffset !== 0 && char2 === jumpOffset ? nodeIdx : -1;
      }
      if (jumpOffset) {
        var value2 = char2 - jumpOffset;
        return value2 < 0 || value2 >= branchCount ? -1 : decodeTree[nodeIdx + value2] - 1;
      }
      var lo = nodeIdx;
      var hi = lo + branchCount - 1;
      while (lo <= hi) {
        var mid = lo + hi >>> 1;
        var midVal = decodeTree[mid];
        if (midVal < char2) {
          lo = mid + 1;
        } else if (midVal > char2) {
          hi = mid - 1;
        } else {
          return decodeTree[mid + branchCount];
        }
      }
      return -1;
    }
    exports2.determineBranch = determineBranch;
    var htmlDecoder = getDecoder(decode_data_html_js_1.default);
    var xmlDecoder = getDecoder(decode_data_xml_js_1.default);
    function decodeHTML(str, mode) {
      if (mode === void 0) {
        mode = DecodingMode.Legacy;
      }
      return htmlDecoder(str, mode);
    }
    exports2.decodeHTML = decodeHTML;
    function decodeHTMLAttribute(str) {
      return htmlDecoder(str, DecodingMode.Attribute);
    }
    exports2.decodeHTMLAttribute = decodeHTMLAttribute;
    function decodeHTMLStrict(str) {
      return htmlDecoder(str, DecodingMode.Strict);
    }
    exports2.decodeHTMLStrict = decodeHTMLStrict;
    function decodeXML(str) {
      return xmlDecoder(str, DecodingMode.Strict);
    }
    exports2.decodeXML = decodeXML;
  }
});

// node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js
var require_encode_html = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    function restoreDiff(arr) {
      for (var i = 1; i < arr.length; i++) {
        arr[i][0] += arr[i - 1][0] + 1;
      }
      return arr;
    }
    exports2.default = new Map(/* @__PURE__ */ restoreDiff([[9, "&Tab;"], [0, "&NewLine;"], [22, "&excl;"], [0, "&quot;"], [0, "&num;"], [0, "&dollar;"], [0, "&percnt;"], [0, "&amp;"], [0, "&apos;"], [0, "&lpar;"], [0, "&rpar;"], [0, "&ast;"], [0, "&plus;"], [0, "&comma;"], [1, "&period;"], [0, "&sol;"], [10, "&colon;"], [0, "&semi;"], [0, { v: "&lt;", n: 8402, o: "&nvlt;" }], [0, { v: "&equals;", n: 8421, o: "&bne;" }], [0, { v: "&gt;", n: 8402, o: "&nvgt;" }], [0, "&quest;"], [0, "&commat;"], [26, "&lbrack;"], [0, "&bsol;"], [0, "&rbrack;"], [0, "&Hat;"], [0, "&lowbar;"], [0, "&DiacriticalGrave;"], [5, { n: 106, o: "&fjlig;" }], [20, "&lbrace;"], [0, "&verbar;"], [0, "&rbrace;"], [34, "&nbsp;"], [0, "&iexcl;"], [0, "&cent;"], [0, "&pound;"], [0, "&curren;"], [0, "&yen;"], [0, "&brvbar;"], [0, "&sect;"], [0, "&die;"], [0, "&copy;"], [0, "&ordf;"], [0, "&laquo;"], [0, "&not;"], [0, "&shy;"], [0, "&circledR;"], [0, "&macr;"], [0, "&deg;"], [0, "&PlusMinus;"], [0, "&sup2;"], [0, "&sup3;"], [0, "&acute;"], [0, "&micro;"], [0, "&para;"], [0, "&centerdot;"], [0, "&cedil;"], [0, "&sup1;"], [0, "&ordm;"], [0, "&raquo;"], [0, "&frac14;"], [0, "&frac12;"], [0, "&frac34;"], [0, "&iquest;"], [0, "&Agrave;"], [0, "&Aacute;"], [0, "&Acirc;"], [0, "&Atilde;"], [0, "&Auml;"], [0, "&angst;"], [0, "&AElig;"], [0, "&Ccedil;"], [0, "&Egrave;"], [0, "&Eacute;"], [0, "&Ecirc;"], [0, "&Euml;"], [0, "&Igrave;"], [0, "&Iacute;"], [0, "&Icirc;"], [0, "&Iuml;"], [0, "&ETH;"], [0, "&Ntilde;"], [0, "&Ograve;"], [0, "&Oacute;"], [0, "&Ocirc;"], [0, "&Otilde;"], [0, "&Ouml;"], [0, "&times;"], [0, "&Oslash;"], [0, "&Ugrave;"], [0, "&Uacute;"], [0, "&Ucirc;"], [0, "&Uuml;"], [0, "&Yacute;"], [0, "&THORN;"], [0, "&szlig;"], [0, "&agrave;"], [0, "&aacute;"], [0, "&acirc;"], [0, "&atilde;"], [0, "&auml;"], [0, "&aring;"], [0, "&aelig;"], [0, "&ccedil;"], [0, "&egrave;"], [0, "&eacute;"], [0, "&ecirc;"], [0, "&euml;"], [0, "&igrave;"], [0, "&iacute;"], [0, "&icirc;"], [0, "&iuml;"], [0, "&eth;"], [0, "&ntilde;"], [0, "&ograve;"], [0, "&oacute;"], [0, "&ocirc;"], [0, "&otilde;"], [0, "&ouml;"], [0, "&div;"], [0, "&oslash;"], [0, "&ugrave;"], [0, "&uacute;"], [0, "&ucirc;"], [0, "&uuml;"], [0, "&yacute;"], [0, "&thorn;"], [0, "&yuml;"], [0, "&Amacr;"], [0, "&amacr;"], [0, "&Abreve;"], [0, "&abreve;"], [0, "&Aogon;"], [0, "&aogon;"], [0, "&Cacute;"], [0, "&cacute;"], [0, "&Ccirc;"], [0, "&ccirc;"], [0, "&Cdot;"], [0, "&cdot;"], [0, "&Ccaron;"], [0, "&ccaron;"], [0, "&Dcaron;"], [0, "&dcaron;"], [0, "&Dstrok;"], [0, "&dstrok;"], [0, "&Emacr;"], [0, "&emacr;"], [2, "&Edot;"], [0, "&edot;"], [0, "&Eogon;"], [0, "&eogon;"], [0, "&Ecaron;"], [0, "&ecaron;"], [0, "&Gcirc;"], [0, "&gcirc;"], [0, "&Gbreve;"], [0, "&gbreve;"], [0, "&Gdot;"], [0, "&gdot;"], [0, "&Gcedil;"], [1, "&Hcirc;"], [0, "&hcirc;"], [0, "&Hstrok;"], [0, "&hstrok;"], [0, "&Itilde;"], [0, "&itilde;"], [0, "&Imacr;"], [0, "&imacr;"], [2, "&Iogon;"], [0, "&iogon;"], [0, "&Idot;"], [0, "&imath;"], [0, "&IJlig;"], [0, "&ijlig;"], [0, "&Jcirc;"], [0, "&jcirc;"], [0, "&Kcedil;"], [0, "&kcedil;"], [0, "&kgreen;"], [0, "&Lacute;"], [0, "&lacute;"], [0, "&Lcedil;"], [0, "&lcedil;"], [0, "&Lcaron;"], [0, "&lcaron;"], [0, "&Lmidot;"], [0, "&lmidot;"], [0, "&Lstrok;"], [0, "&lstrok;"], [0, "&Nacute;"], [0, "&nacute;"], [0, "&Ncedil;"], [0, "&ncedil;"], [0, "&Ncaron;"], [0, "&ncaron;"], [0, "&napos;"], [0, "&ENG;"], [0, "&eng;"], [0, "&Omacr;"], [0, "&omacr;"], [2, "&Odblac;"], [0, "&odblac;"], [0, "&OElig;"], [0, "&oelig;"], [0, "&Racute;"], [0, "&racute;"], [0, "&Rcedil;"], [0, "&rcedil;"], [0, "&Rcaron;"], [0, "&rcaron;"], [0, "&Sacute;"], [0, "&sacute;"], [0, "&Scirc;"], [0, "&scirc;"], [0, "&Scedil;"], [0, "&scedil;"], [0, "&Scaron;"], [0, "&scaron;"], [0, "&Tcedil;"], [0, "&tcedil;"], [0, "&Tcaron;"], [0, "&tcaron;"], [0, "&Tstrok;"], [0, "&tstrok;"], [0, "&Utilde;"], [0, "&utilde;"], [0, "&Umacr;"], [0, "&umacr;"], [0, "&Ubreve;"], [0, "&ubreve;"], [0, "&Uring;"], [0, "&uring;"], [0, "&Udblac;"], [0, "&udblac;"], [0, "&Uogon;"], [0, "&uogon;"], [0, "&Wcirc;"], [0, "&wcirc;"], [0, "&Ycirc;"], [0, "&ycirc;"], [0, "&Yuml;"], [0, "&Zacute;"], [0, "&zacute;"], [0, "&Zdot;"], [0, "&zdot;"], [0, "&Zcaron;"], [0, "&zcaron;"], [19, "&fnof;"], [34, "&imped;"], [63, "&gacute;"], [65, "&jmath;"], [142, "&circ;"], [0, "&caron;"], [16, "&breve;"], [0, "&DiacriticalDot;"], [0, "&ring;"], [0, "&ogon;"], [0, "&DiacriticalTilde;"], [0, "&dblac;"], [51, "&DownBreve;"], [127, "&Alpha;"], [0, "&Beta;"], [0, "&Gamma;"], [0, "&Delta;"], [0, "&Epsilon;"], [0, "&Zeta;"], [0, "&Eta;"], [0, "&Theta;"], [0, "&Iota;"], [0, "&Kappa;"], [0, "&Lambda;"], [0, "&Mu;"], [0, "&Nu;"], [0, "&Xi;"], [0, "&Omicron;"], [0, "&Pi;"], [0, "&Rho;"], [1, "&Sigma;"], [0, "&Tau;"], [0, "&Upsilon;"], [0, "&Phi;"], [0, "&Chi;"], [0, "&Psi;"], [0, "&ohm;"], [7, "&alpha;"], [0, "&beta;"], [0, "&gamma;"], [0, "&delta;"], [0, "&epsi;"], [0, "&zeta;"], [0, "&eta;"], [0, "&theta;"], [0, "&iota;"], [0, "&kappa;"], [0, "&lambda;"], [0, "&mu;"], [0, "&nu;"], [0, "&xi;"], [0, "&omicron;"], [0, "&pi;"], [0, "&rho;"], [0, "&sigmaf;"], [0, "&sigma;"], [0, "&tau;"], [0, "&upsi;"], [0, "&phi;"], [0, "&chi;"], [0, "&psi;"], [0, "&omega;"], [7, "&thetasym;"], [0, "&Upsi;"], [2, "&phiv;"], [0, "&piv;"], [5, "&Gammad;"], [0, "&digamma;"], [18, "&kappav;"], [0, "&rhov;"], [3, "&epsiv;"], [0, "&backepsilon;"], [10, "&IOcy;"], [0, "&DJcy;"], [0, "&GJcy;"], [0, "&Jukcy;"], [0, "&DScy;"], [0, "&Iukcy;"], [0, "&YIcy;"], [0, "&Jsercy;"], [0, "&LJcy;"], [0, "&NJcy;"], [0, "&TSHcy;"], [0, "&KJcy;"], [1, "&Ubrcy;"], [0, "&DZcy;"], [0, "&Acy;"], [0, "&Bcy;"], [0, "&Vcy;"], [0, "&Gcy;"], [0, "&Dcy;"], [0, "&IEcy;"], [0, "&ZHcy;"], [0, "&Zcy;"], [0, "&Icy;"], [0, "&Jcy;"], [0, "&Kcy;"], [0, "&Lcy;"], [0, "&Mcy;"], [0, "&Ncy;"], [0, "&Ocy;"], [0, "&Pcy;"], [0, "&Rcy;"], [0, "&Scy;"], [0, "&Tcy;"], [0, "&Ucy;"], [0, "&Fcy;"], [0, "&KHcy;"], [0, "&TScy;"], [0, "&CHcy;"], [0, "&SHcy;"], [0, "&SHCHcy;"], [0, "&HARDcy;"], [0, "&Ycy;"], [0, "&SOFTcy;"], [0, "&Ecy;"], [0, "&YUcy;"], [0, "&YAcy;"], [0, "&acy;"], [0, "&bcy;"], [0, "&vcy;"], [0, "&gcy;"], [0, "&dcy;"], [0, "&iecy;"], [0, "&zhcy;"], [0, "&zcy;"], [0, "&icy;"], [0, "&jcy;"], [0, "&kcy;"], [0, "&lcy;"], [0, "&mcy;"], [0, "&ncy;"], [0, "&ocy;"], [0, "&pcy;"], [0, "&rcy;"], [0, "&scy;"], [0, "&tcy;"], [0, "&ucy;"], [0, "&fcy;"], [0, "&khcy;"], [0, "&tscy;"], [0, "&chcy;"], [0, "&shcy;"], [0, "&shchcy;"], [0, "&hardcy;"], [0, "&ycy;"], [0, "&softcy;"], [0, "&ecy;"], [0, "&yucy;"], [0, "&yacy;"], [1, "&iocy;"], [0, "&djcy;"], [0, "&gjcy;"], [0, "&jukcy;"], [0, "&dscy;"], [0, "&iukcy;"], [0, "&yicy;"], [0, "&jsercy;"], [0, "&ljcy;"], [0, "&njcy;"], [0, "&tshcy;"], [0, "&kjcy;"], [1, "&ubrcy;"], [0, "&dzcy;"], [7074, "&ensp;"], [0, "&emsp;"], [0, "&emsp13;"], [0, "&emsp14;"], [1, "&numsp;"], [0, "&puncsp;"], [0, "&ThinSpace;"], [0, "&hairsp;"], [0, "&NegativeMediumSpace;"], [0, "&zwnj;"], [0, "&zwj;"], [0, "&lrm;"], [0, "&rlm;"], [0, "&dash;"], [2, "&ndash;"], [0, "&mdash;"], [0, "&horbar;"], [0, "&Verbar;"], [1, "&lsquo;"], [0, "&CloseCurlyQuote;"], [0, "&lsquor;"], [1, "&ldquo;"], [0, "&CloseCurlyDoubleQuote;"], [0, "&bdquo;"], [1, "&dagger;"], [0, "&Dagger;"], [0, "&bull;"], [2, "&nldr;"], [0, "&hellip;"], [9, "&permil;"], [0, "&pertenk;"], [0, "&prime;"], [0, "&Prime;"], [0, "&tprime;"], [0, "&backprime;"], [3, "&lsaquo;"], [0, "&rsaquo;"], [3, "&oline;"], [2, "&caret;"], [1, "&hybull;"], [0, "&frasl;"], [10, "&bsemi;"], [7, "&qprime;"], [7, { v: "&MediumSpace;", n: 8202, o: "&ThickSpace;" }], [0, "&NoBreak;"], [0, "&af;"], [0, "&InvisibleTimes;"], [0, "&ic;"], [72, "&euro;"], [46, "&tdot;"], [0, "&DotDot;"], [37, "&complexes;"], [2, "&incare;"], [4, "&gscr;"], [0, "&hamilt;"], [0, "&Hfr;"], [0, "&Hopf;"], [0, "&planckh;"], [0, "&hbar;"], [0, "&imagline;"], [0, "&Ifr;"], [0, "&lagran;"], [0, "&ell;"], [1, "&naturals;"], [0, "&numero;"], [0, "&copysr;"], [0, "&weierp;"], [0, "&Popf;"], [0, "&Qopf;"], [0, "&realine;"], [0, "&real;"], [0, "&reals;"], [0, "&rx;"], [3, "&trade;"], [1, "&integers;"], [2, "&mho;"], [0, "&zeetrf;"], [0, "&iiota;"], [2, "&bernou;"], [0, "&Cayleys;"], [1, "&escr;"], [0, "&Escr;"], [0, "&Fouriertrf;"], [1, "&Mellintrf;"], [0, "&order;"], [0, "&alefsym;"], [0, "&beth;"], [0, "&gimel;"], [0, "&daleth;"], [12, "&CapitalDifferentialD;"], [0, "&dd;"], [0, "&ee;"], [0, "&ii;"], [10, "&frac13;"], [0, "&frac23;"], [0, "&frac15;"], [0, "&frac25;"], [0, "&frac35;"], [0, "&frac45;"], [0, "&frac16;"], [0, "&frac56;"], [0, "&frac18;"], [0, "&frac38;"], [0, "&frac58;"], [0, "&frac78;"], [49, "&larr;"], [0, "&ShortUpArrow;"], [0, "&rarr;"], [0, "&darr;"], [0, "&harr;"], [0, "&updownarrow;"], [0, "&nwarr;"], [0, "&nearr;"], [0, "&LowerRightArrow;"], [0, "&LowerLeftArrow;"], [0, "&nlarr;"], [0, "&nrarr;"], [1, { v: "&rarrw;", n: 824, o: "&nrarrw;" }], [0, "&Larr;"], [0, "&Uarr;"], [0, "&Rarr;"], [0, "&Darr;"], [0, "&larrtl;"], [0, "&rarrtl;"], [0, "&LeftTeeArrow;"], [0, "&mapstoup;"], [0, "&map;"], [0, "&DownTeeArrow;"], [1, "&hookleftarrow;"], [0, "&hookrightarrow;"], [0, "&larrlp;"], [0, "&looparrowright;"], [0, "&harrw;"], [0, "&nharr;"], [1, "&lsh;"], [0, "&rsh;"], [0, "&ldsh;"], [0, "&rdsh;"], [1, "&crarr;"], [0, "&cularr;"], [0, "&curarr;"], [2, "&circlearrowleft;"], [0, "&circlearrowright;"], [0, "&leftharpoonup;"], [0, "&DownLeftVector;"], [0, "&RightUpVector;"], [0, "&LeftUpVector;"], [0, "&rharu;"], [0, "&DownRightVector;"], [0, "&dharr;"], [0, "&dharl;"], [0, "&RightArrowLeftArrow;"], [0, "&udarr;"], [0, "&LeftArrowRightArrow;"], [0, "&leftleftarrows;"], [0, "&upuparrows;"], [0, "&rightrightarrows;"], [0, "&ddarr;"], [0, "&leftrightharpoons;"], [0, "&Equilibrium;"], [0, "&nlArr;"], [0, "&nhArr;"], [0, "&nrArr;"], [0, "&DoubleLeftArrow;"], [0, "&DoubleUpArrow;"], [0, "&DoubleRightArrow;"], [0, "&dArr;"], [0, "&DoubleLeftRightArrow;"], [0, "&DoubleUpDownArrow;"], [0, "&nwArr;"], [0, "&neArr;"], [0, "&seArr;"], [0, "&swArr;"], [0, "&lAarr;"], [0, "&rAarr;"], [1, "&zigrarr;"], [6, "&larrb;"], [0, "&rarrb;"], [15, "&DownArrowUpArrow;"], [7, "&loarr;"], [0, "&roarr;"], [0, "&hoarr;"], [0, "&forall;"], [0, "&comp;"], [0, { v: "&part;", n: 824, o: "&npart;" }], [0, "&exist;"], [0, "&nexist;"], [0, "&empty;"], [1, "&Del;"], [0, "&Element;"], [0, "&NotElement;"], [1, "&ni;"], [0, "&notni;"], [2, "&prod;"], [0, "&coprod;"], [0, "&sum;"], [0, "&minus;"], [0, "&MinusPlus;"], [0, "&dotplus;"], [1, "&Backslash;"], [0, "&lowast;"], [0, "&compfn;"], [1, "&radic;"], [2, "&prop;"], [0, "&infin;"], [0, "&angrt;"], [0, { v: "&ang;", n: 8402, o: "&nang;" }], [0, "&angmsd;"], [0, "&angsph;"], [0, "&mid;"], [0, "&nmid;"], [0, "&DoubleVerticalBar;"], [0, "&NotDoubleVerticalBar;"], [0, "&and;"], [0, "&or;"], [0, { v: "&cap;", n: 65024, o: "&caps;" }], [0, { v: "&cup;", n: 65024, o: "&cups;" }], [0, "&int;"], [0, "&Int;"], [0, "&iiint;"], [0, "&conint;"], [0, "&Conint;"], [0, "&Cconint;"], [0, "&cwint;"], [0, "&ClockwiseContourIntegral;"], [0, "&awconint;"], [0, "&there4;"], [0, "&becaus;"], [0, "&ratio;"], [0, "&Colon;"], [0, "&dotminus;"], [1, "&mDDot;"], [0, "&homtht;"], [0, { v: "&sim;", n: 8402, o: "&nvsim;" }], [0, { v: "&backsim;", n: 817, o: "&race;" }], [0, { v: "&ac;", n: 819, o: "&acE;" }], [0, "&acd;"], [0, "&VerticalTilde;"], [0, "&NotTilde;"], [0, { v: "&eqsim;", n: 824, o: "&nesim;" }], [0, "&sime;"], [0, "&NotTildeEqual;"], [0, "&cong;"], [0, "&simne;"], [0, "&ncong;"], [0, "&ap;"], [0, "&nap;"], [0, "&ape;"], [0, { v: "&apid;", n: 824, o: "&napid;" }], [0, "&backcong;"], [0, { v: "&asympeq;", n: 8402, o: "&nvap;" }], [0, { v: "&bump;", n: 824, o: "&nbump;" }], [0, { v: "&bumpe;", n: 824, o: "&nbumpe;" }], [0, { v: "&doteq;", n: 824, o: "&nedot;" }], [0, "&doteqdot;"], [0, "&efDot;"], [0, "&erDot;"], [0, "&Assign;"], [0, "&ecolon;"], [0, "&ecir;"], [0, "&circeq;"], [1, "&wedgeq;"], [0, "&veeeq;"], [1, "&triangleq;"], [2, "&equest;"], [0, "&ne;"], [0, { v: "&Congruent;", n: 8421, o: "&bnequiv;" }], [0, "&nequiv;"], [1, { v: "&le;", n: 8402, o: "&nvle;" }], [0, { v: "&ge;", n: 8402, o: "&nvge;" }], [0, { v: "&lE;", n: 824, o: "&nlE;" }], [0, { v: "&gE;", n: 824, o: "&ngE;" }], [0, { v: "&lnE;", n: 65024, o: "&lvertneqq;" }], [0, { v: "&gnE;", n: 65024, o: "&gvertneqq;" }], [0, { v: "&ll;", n: new Map(/* @__PURE__ */ restoreDiff([[824, "&nLtv;"], [7577, "&nLt;"]])) }], [0, { v: "&gg;", n: new Map(/* @__PURE__ */ restoreDiff([[824, "&nGtv;"], [7577, "&nGt;"]])) }], [0, "&between;"], [0, "&NotCupCap;"], [0, "&nless;"], [0, "&ngt;"], [0, "&nle;"], [0, "&nge;"], [0, "&lesssim;"], [0, "&GreaterTilde;"], [0, "&nlsim;"], [0, "&ngsim;"], [0, "&LessGreater;"], [0, "&gl;"], [0, "&NotLessGreater;"], [0, "&NotGreaterLess;"], [0, "&pr;"], [0, "&sc;"], [0, "&prcue;"], [0, "&sccue;"], [0, "&PrecedesTilde;"], [0, { v: "&scsim;", n: 824, o: "&NotSucceedsTilde;" }], [0, "&NotPrecedes;"], [0, "&NotSucceeds;"], [0, { v: "&sub;", n: 8402, o: "&NotSubset;" }], [0, { v: "&sup;", n: 8402, o: "&NotSuperset;" }], [0, "&nsub;"], [0, "&nsup;"], [0, "&sube;"], [0, "&supe;"], [0, "&NotSubsetEqual;"], [0, "&NotSupersetEqual;"], [0, { v: "&subne;", n: 65024, o: "&varsubsetneq;" }], [0, { v: "&supne;", n: 65024, o: "&varsupsetneq;" }], [1, "&cupdot;"], [0, "&UnionPlus;"], [0, { v: "&sqsub;", n: 824, o: "&NotSquareSubset;" }], [0, { v: "&sqsup;", n: 824, o: "&NotSquareSuperset;" }], [0, "&sqsube;"], [0, "&sqsupe;"], [0, { v: "&sqcap;", n: 65024, o: "&sqcaps;" }], [0, { v: "&sqcup;", n: 65024, o: "&sqcups;" }], [0, "&CirclePlus;"], [0, "&CircleMinus;"], [0, "&CircleTimes;"], [0, "&osol;"], [0, "&CircleDot;"], [0, "&circledcirc;"], [0, "&circledast;"], [1, "&circleddash;"], [0, "&boxplus;"], [0, "&boxminus;"], [0, "&boxtimes;"], [0, "&dotsquare;"], [0, "&RightTee;"], [0, "&dashv;"], [0, "&DownTee;"], [0, "&bot;"], [1, "&models;"], [0, "&DoubleRightTee;"], [0, "&Vdash;"], [0, "&Vvdash;"], [0, "&VDash;"], [0, "&nvdash;"], [0, "&nvDash;"], [0, "&nVdash;"], [0, "&nVDash;"], [0, "&prurel;"], [1, "&LeftTriangle;"], [0, "&RightTriangle;"], [0, { v: "&LeftTriangleEqual;", n: 8402, o: "&nvltrie;" }], [0, { v: "&RightTriangleEqual;", n: 8402, o: "&nvrtrie;" }], [0, "&origof;"], [0, "&imof;"], [0, "&multimap;"], [0, "&hercon;"], [0, "&intcal;"], [0, "&veebar;"], [1, "&barvee;"], [0, "&angrtvb;"], [0, "&lrtri;"], [0, "&bigwedge;"], [0, "&bigvee;"], [0, "&bigcap;"], [0, "&bigcup;"], [0, "&diam;"], [0, "&sdot;"], [0, "&sstarf;"], [0, "&divideontimes;"], [0, "&bowtie;"], [0, "&ltimes;"], [0, "&rtimes;"], [0, "&leftthreetimes;"], [0, "&rightthreetimes;"], [0, "&backsimeq;"], [0, "&curlyvee;"], [0, "&curlywedge;"], [0, "&Sub;"], [0, "&Sup;"], [0, "&Cap;"], [0, "&Cup;"], [0, "&fork;"], [0, "&epar;"], [0, "&lessdot;"], [0, "&gtdot;"], [0, { v: "&Ll;", n: 824, o: "&nLl;" }], [0, { v: "&Gg;", n: 824, o: "&nGg;" }], [0, { v: "&leg;", n: 65024, o: "&lesg;" }], [0, { v: "&gel;", n: 65024, o: "&gesl;" }], [2, "&cuepr;"], [0, "&cuesc;"], [0, "&NotPrecedesSlantEqual;"], [0, "&NotSucceedsSlantEqual;"], [0, "&NotSquareSubsetEqual;"], [0, "&NotSquareSupersetEqual;"], [2, "&lnsim;"], [0, "&gnsim;"], [0, "&precnsim;"], [0, "&scnsim;"], [0, "&nltri;"], [0, "&NotRightTriangle;"], [0, "&nltrie;"], [0, "&NotRightTriangleEqual;"], [0, "&vellip;"], [0, "&ctdot;"], [0, "&utdot;"], [0, "&dtdot;"], [0, "&disin;"], [0, "&isinsv;"], [0, "&isins;"], [0, { v: "&isindot;", n: 824, o: "&notindot;" }], [0, "&notinvc;"], [0, "&notinvb;"], [1, { v: "&isinE;", n: 824, o: "&notinE;" }], [0, "&nisd;"], [0, "&xnis;"], [0, "&nis;"], [0, "&notnivc;"], [0, "&notnivb;"], [6, "&barwed;"], [0, "&Barwed;"], [1, "&lceil;"], [0, "&rceil;"], [0, "&LeftFloor;"], [0, "&rfloor;"], [0, "&drcrop;"], [0, "&dlcrop;"], [0, "&urcrop;"], [0, "&ulcrop;"], [0, "&bnot;"], [1, "&profline;"], [0, "&profsurf;"], [1, "&telrec;"], [0, "&target;"], [5, "&ulcorn;"], [0, "&urcorn;"], [0, "&dlcorn;"], [0, "&drcorn;"], [2, "&frown;"], [0, "&smile;"], [9, "&cylcty;"], [0, "&profalar;"], [7, "&topbot;"], [6, "&ovbar;"], [1, "&solbar;"], [60, "&angzarr;"], [51, "&lmoustache;"], [0, "&rmoustache;"], [2, "&OverBracket;"], [0, "&bbrk;"], [0, "&bbrktbrk;"], [37, "&OverParenthesis;"], [0, "&UnderParenthesis;"], [0, "&OverBrace;"], [0, "&UnderBrace;"], [2, "&trpezium;"], [4, "&elinters;"], [59, "&blank;"], [164, "&circledS;"], [55, "&boxh;"], [1, "&boxv;"], [9, "&boxdr;"], [3, "&boxdl;"], [3, "&boxur;"], [3, "&boxul;"], [3, "&boxvr;"], [7, "&boxvl;"], [7, "&boxhd;"], [7, "&boxhu;"], [7, "&boxvh;"], [19, "&boxH;"], [0, "&boxV;"], [0, "&boxdR;"], [0, "&boxDr;"], [0, "&boxDR;"], [0, "&boxdL;"], [0, "&boxDl;"], [0, "&boxDL;"], [0, "&boxuR;"], [0, "&boxUr;"], [0, "&boxUR;"], [0, "&boxuL;"], [0, "&boxUl;"], [0, "&boxUL;"], [0, "&boxvR;"], [0, "&boxVr;"], [0, "&boxVR;"], [0, "&boxvL;"], [0, "&boxVl;"], [0, "&boxVL;"], [0, "&boxHd;"], [0, "&boxhD;"], [0, "&boxHD;"], [0, "&boxHu;"], [0, "&boxhU;"], [0, "&boxHU;"], [0, "&boxvH;"], [0, "&boxVh;"], [0, "&boxVH;"], [19, "&uhblk;"], [3, "&lhblk;"], [3, "&block;"], [8, "&blk14;"], [0, "&blk12;"], [0, "&blk34;"], [13, "&square;"], [8, "&blacksquare;"], [0, "&EmptyVerySmallSquare;"], [1, "&rect;"], [0, "&marker;"], [2, "&fltns;"], [1, "&bigtriangleup;"], [0, "&blacktriangle;"], [0, "&triangle;"], [2, "&blacktriangleright;"], [0, "&rtri;"], [3, "&bigtriangledown;"], [0, "&blacktriangledown;"], [0, "&dtri;"], [2, "&blacktriangleleft;"], [0, "&ltri;"], [6, "&loz;"], [0, "&cir;"], [32, "&tridot;"], [2, "&bigcirc;"], [8, "&ultri;"], [0, "&urtri;"], [0, "&lltri;"], [0, "&EmptySmallSquare;"], [0, "&FilledSmallSquare;"], [8, "&bigstar;"], [0, "&star;"], [7, "&phone;"], [49, "&female;"], [1, "&male;"], [29, "&spades;"], [2, "&clubs;"], [1, "&hearts;"], [0, "&diamondsuit;"], [3, "&sung;"], [2, "&flat;"], [0, "&natural;"], [0, "&sharp;"], [163, "&check;"], [3, "&cross;"], [8, "&malt;"], [21, "&sext;"], [33, "&VerticalSeparator;"], [25, "&lbbrk;"], [0, "&rbbrk;"], [84, "&bsolhsub;"], [0, "&suphsol;"], [28, "&LeftDoubleBracket;"], [0, "&RightDoubleBracket;"], [0, "&lang;"], [0, "&rang;"], [0, "&Lang;"], [0, "&Rang;"], [0, "&loang;"], [0, "&roang;"], [7, "&longleftarrow;"], [0, "&longrightarrow;"], [0, "&longleftrightarrow;"], [0, "&DoubleLongLeftArrow;"], [0, "&DoubleLongRightArrow;"], [0, "&DoubleLongLeftRightArrow;"], [1, "&longmapsto;"], [2, "&dzigrarr;"], [258, "&nvlArr;"], [0, "&nvrArr;"], [0, "&nvHarr;"], [0, "&Map;"], [6, "&lbarr;"], [0, "&bkarow;"], [0, "&lBarr;"], [0, "&dbkarow;"], [0, "&drbkarow;"], [0, "&DDotrahd;"], [0, "&UpArrowBar;"], [0, "&DownArrowBar;"], [2, "&Rarrtl;"], [2, "&latail;"], [0, "&ratail;"], [0, "&lAtail;"], [0, "&rAtail;"], [0, "&larrfs;"], [0, "&rarrfs;"], [0, "&larrbfs;"], [0, "&rarrbfs;"], [2, "&nwarhk;"], [0, "&nearhk;"], [0, "&hksearow;"], [0, "&hkswarow;"], [0, "&nwnear;"], [0, "&nesear;"], [0, "&seswar;"], [0, "&swnwar;"], [8, { v: "&rarrc;", n: 824, o: "&nrarrc;" }], [1, "&cudarrr;"], [0, "&ldca;"], [0, "&rdca;"], [0, "&cudarrl;"], [0, "&larrpl;"], [2, "&curarrm;"], [0, "&cularrp;"], [7, "&rarrpl;"], [2, "&harrcir;"], [0, "&Uarrocir;"], [0, "&lurdshar;"], [0, "&ldrushar;"], [2, "&LeftRightVector;"], [0, "&RightUpDownVector;"], [0, "&DownLeftRightVector;"], [0, "&LeftUpDownVector;"], [0, "&LeftVectorBar;"], [0, "&RightVectorBar;"], [0, "&RightUpVectorBar;"], [0, "&RightDownVectorBar;"], [0, "&DownLeftVectorBar;"], [0, "&DownRightVectorBar;"], [0, "&LeftUpVectorBar;"], [0, "&LeftDownVectorBar;"], [0, "&LeftTeeVector;"], [0, "&RightTeeVector;"], [0, "&RightUpTeeVector;"], [0, "&RightDownTeeVector;"], [0, "&DownLeftTeeVector;"], [0, "&DownRightTeeVector;"], [0, "&LeftUpTeeVector;"], [0, "&LeftDownTeeVector;"], [0, "&lHar;"], [0, "&uHar;"], [0, "&rHar;"], [0, "&dHar;"], [0, "&luruhar;"], [0, "&ldrdhar;"], [0, "&ruluhar;"], [0, "&rdldhar;"], [0, "&lharul;"], [0, "&llhard;"], [0, "&rharul;"], [0, "&lrhard;"], [0, "&udhar;"], [0, "&duhar;"], [0, "&RoundImplies;"], [0, "&erarr;"], [0, "&simrarr;"], [0, "&larrsim;"], [0, "&rarrsim;"], [0, "&rarrap;"], [0, "&ltlarr;"], [1, "&gtrarr;"], [0, "&subrarr;"], [1, "&suplarr;"], [0, "&lfisht;"], [0, "&rfisht;"], [0, "&ufisht;"], [0, "&dfisht;"], [5, "&lopar;"], [0, "&ropar;"], [4, "&lbrke;"], [0, "&rbrke;"], [0, "&lbrkslu;"], [0, "&rbrksld;"], [0, "&lbrksld;"], [0, "&rbrkslu;"], [0, "&langd;"], [0, "&rangd;"], [0, "&lparlt;"], [0, "&rpargt;"], [0, "&gtlPar;"], [0, "&ltrPar;"], [3, "&vzigzag;"], [1, "&vangrt;"], [0, "&angrtvbd;"], [6, "&ange;"], [0, "&range;"], [0, "&dwangle;"], [0, "&uwangle;"], [0, "&angmsdaa;"], [0, "&angmsdab;"], [0, "&angmsdac;"], [0, "&angmsdad;"], [0, "&angmsdae;"], [0, "&angmsdaf;"], [0, "&angmsdag;"], [0, "&angmsdah;"], [0, "&bemptyv;"], [0, "&demptyv;"], [0, "&cemptyv;"], [0, "&raemptyv;"], [0, "&laemptyv;"], [0, "&ohbar;"], [0, "&omid;"], [0, "&opar;"], [1, "&operp;"], [1, "&olcross;"], [0, "&odsold;"], [1, "&olcir;"], [0, "&ofcir;"], [0, "&olt;"], [0, "&ogt;"], [0, "&cirscir;"], [0, "&cirE;"], [0, "&solb;"], [0, "&bsolb;"], [3, "&boxbox;"], [3, "&trisb;"], [0, "&rtriltri;"], [0, { v: "&LeftTriangleBar;", n: 824, o: "&NotLeftTriangleBar;" }], [0, { v: "&RightTriangleBar;", n: 824, o: "&NotRightTriangleBar;" }], [11, "&iinfin;"], [0, "&infintie;"], [0, "&nvinfin;"], [4, "&eparsl;"], [0, "&smeparsl;"], [0, "&eqvparsl;"], [5, "&blacklozenge;"], [8, "&RuleDelayed;"], [1, "&dsol;"], [9, "&bigodot;"], [0, "&bigoplus;"], [0, "&bigotimes;"], [1, "&biguplus;"], [1, "&bigsqcup;"], [5, "&iiiint;"], [0, "&fpartint;"], [2, "&cirfnint;"], [0, "&awint;"], [0, "&rppolint;"], [0, "&scpolint;"], [0, "&npolint;"], [0, "&pointint;"], [0, "&quatint;"], [0, "&intlarhk;"], [10, "&pluscir;"], [0, "&plusacir;"], [0, "&simplus;"], [0, "&plusdu;"], [0, "&plussim;"], [0, "&plustwo;"], [1, "&mcomma;"], [0, "&minusdu;"], [2, "&loplus;"], [0, "&roplus;"], [0, "&Cross;"], [0, "&timesd;"], [0, "&timesbar;"], [1, "&smashp;"], [0, "&lotimes;"], [0, "&rotimes;"], [0, "&otimesas;"], [0, "&Otimes;"], [0, "&odiv;"], [0, "&triplus;"], [0, "&triminus;"], [0, "&tritime;"], [0, "&intprod;"], [2, "&amalg;"], [0, "&capdot;"], [1, "&ncup;"], [0, "&ncap;"], [0, "&capand;"], [0, "&cupor;"], [0, "&cupcap;"], [0, "&capcup;"], [0, "&cupbrcap;"], [0, "&capbrcup;"], [0, "&cupcup;"], [0, "&capcap;"], [0, "&ccups;"], [0, "&ccaps;"], [2, "&ccupssm;"], [2, "&And;"], [0, "&Or;"], [0, "&andand;"], [0, "&oror;"], [0, "&orslope;"], [0, "&andslope;"], [1, "&andv;"], [0, "&orv;"], [0, "&andd;"], [0, "&ord;"], [1, "&wedbar;"], [6, "&sdote;"], [3, "&simdot;"], [2, { v: "&congdot;", n: 824, o: "&ncongdot;" }], [0, "&easter;"], [0, "&apacir;"], [0, { v: "&apE;", n: 824, o: "&napE;" }], [0, "&eplus;"], [0, "&pluse;"], [0, "&Esim;"], [0, "&Colone;"], [0, "&Equal;"], [1, "&ddotseq;"], [0, "&equivDD;"], [0, "&ltcir;"], [0, "&gtcir;"], [0, "&ltquest;"], [0, "&gtquest;"], [0, { v: "&leqslant;", n: 824, o: "&nleqslant;" }], [0, { v: "&geqslant;", n: 824, o: "&ngeqslant;" }], [0, "&lesdot;"], [0, "&gesdot;"], [0, "&lesdoto;"], [0, "&gesdoto;"], [0, "&lesdotor;"], [0, "&gesdotol;"], [0, "&lap;"], [0, "&gap;"], [0, "&lne;"], [0, "&gne;"], [0, "&lnap;"], [0, "&gnap;"], [0, "&lEg;"], [0, "&gEl;"], [0, "&lsime;"], [0, "&gsime;"], [0, "&lsimg;"], [0, "&gsiml;"], [0, "&lgE;"], [0, "&glE;"], [0, "&lesges;"], [0, "&gesles;"], [0, "&els;"], [0, "&egs;"], [0, "&elsdot;"], [0, "&egsdot;"], [0, "&el;"], [0, "&eg;"], [2, "&siml;"], [0, "&simg;"], [0, "&simlE;"], [0, "&simgE;"], [0, { v: "&LessLess;", n: 824, o: "&NotNestedLessLess;" }], [0, { v: "&GreaterGreater;", n: 824, o: "&NotNestedGreaterGreater;" }], [1, "&glj;"], [0, "&gla;"], [0, "&ltcc;"], [0, "&gtcc;"], [0, "&lescc;"], [0, "&gescc;"], [0, "&smt;"], [0, "&lat;"], [0, { v: "&smte;", n: 65024, o: "&smtes;" }], [0, { v: "&late;", n: 65024, o: "&lates;" }], [0, "&bumpE;"], [0, { v: "&PrecedesEqual;", n: 824, o: "&NotPrecedesEqual;" }], [0, { v: "&sce;", n: 824, o: "&NotSucceedsEqual;" }], [2, "&prE;"], [0, "&scE;"], [0, "&precneqq;"], [0, "&scnE;"], [0, "&prap;"], [0, "&scap;"], [0, "&precnapprox;"], [0, "&scnap;"], [0, "&Pr;"], [0, "&Sc;"], [0, "&subdot;"], [0, "&supdot;"], [0, "&subplus;"], [0, "&supplus;"], [0, "&submult;"], [0, "&supmult;"], [0, "&subedot;"], [0, "&supedot;"], [0, { v: "&subE;", n: 824, o: "&nsubE;" }], [0, { v: "&supE;", n: 824, o: "&nsupE;" }], [0, "&subsim;"], [0, "&supsim;"], [2, { v: "&subnE;", n: 65024, o: "&varsubsetneqq;" }], [0, { v: "&supnE;", n: 65024, o: "&varsupsetneqq;" }], [2, "&csub;"], [0, "&csup;"], [0, "&csube;"], [0, "&csupe;"], [0, "&subsup;"], [0, "&supsub;"], [0, "&subsub;"], [0, "&supsup;"], [0, "&suphsub;"], [0, "&supdsub;"], [0, "&forkv;"], [0, "&topfork;"], [0, "&mlcp;"], [8, "&Dashv;"], [1, "&Vdashl;"], [0, "&Barv;"], [0, "&vBar;"], [0, "&vBarv;"], [1, "&Vbar;"], [0, "&Not;"], [0, "&bNot;"], [0, "&rnmid;"], [0, "&cirmid;"], [0, "&midcir;"], [0, "&topcir;"], [0, "&nhpar;"], [0, "&parsim;"], [9, { v: "&parsl;", n: 8421, o: "&nparsl;" }], [44343, { n: new Map(/* @__PURE__ */ restoreDiff([[56476, "&Ascr;"], [1, "&Cscr;"], [0, "&Dscr;"], [2, "&Gscr;"], [2, "&Jscr;"], [0, "&Kscr;"], [2, "&Nscr;"], [0, "&Oscr;"], [0, "&Pscr;"], [0, "&Qscr;"], [1, "&Sscr;"], [0, "&Tscr;"], [0, "&Uscr;"], [0, "&Vscr;"], [0, "&Wscr;"], [0, "&Xscr;"], [0, "&Yscr;"], [0, "&Zscr;"], [0, "&ascr;"], [0, "&bscr;"], [0, "&cscr;"], [0, "&dscr;"], [1, "&fscr;"], [1, "&hscr;"], [0, "&iscr;"], [0, "&jscr;"], [0, "&kscr;"], [0, "&lscr;"], [0, "&mscr;"], [0, "&nscr;"], [1, "&pscr;"], [0, "&qscr;"], [0, "&rscr;"], [0, "&sscr;"], [0, "&tscr;"], [0, "&uscr;"], [0, "&vscr;"], [0, "&wscr;"], [0, "&xscr;"], [0, "&yscr;"], [0, "&zscr;"], [52, "&Afr;"], [0, "&Bfr;"], [1, "&Dfr;"], [0, "&Efr;"], [0, "&Ffr;"], [0, "&Gfr;"], [2, "&Jfr;"], [0, "&Kfr;"], [0, "&Lfr;"], [0, "&Mfr;"], [0, "&Nfr;"], [0, "&Ofr;"], [0, "&Pfr;"], [0, "&Qfr;"], [1, "&Sfr;"], [0, "&Tfr;"], [0, "&Ufr;"], [0, "&Vfr;"], [0, "&Wfr;"], [0, "&Xfr;"], [0, "&Yfr;"], [1, "&afr;"], [0, "&bfr;"], [0, "&cfr;"], [0, "&dfr;"], [0, "&efr;"], [0, "&ffr;"], [0, "&gfr;"], [0, "&hfr;"], [0, "&ifr;"], [0, "&jfr;"], [0, "&kfr;"], [0, "&lfr;"], [0, "&mfr;"], [0, "&nfr;"], [0, "&ofr;"], [0, "&pfr;"], [0, "&qfr;"], [0, "&rfr;"], [0, "&sfr;"], [0, "&tfr;"], [0, "&ufr;"], [0, "&vfr;"], [0, "&wfr;"], [0, "&xfr;"], [0, "&yfr;"], [0, "&zfr;"], [0, "&Aopf;"], [0, "&Bopf;"], [1, "&Dopf;"], [0, "&Eopf;"], [0, "&Fopf;"], [0, "&Gopf;"], [1, "&Iopf;"], [0, "&Jopf;"], [0, "&Kopf;"], [0, "&Lopf;"], [0, "&Mopf;"], [1, "&Oopf;"], [3, "&Sopf;"], [0, "&Topf;"], [0, "&Uopf;"], [0, "&Vopf;"], [0, "&Wopf;"], [0, "&Xopf;"], [0, "&Yopf;"], [1, "&aopf;"], [0, "&bopf;"], [0, "&copf;"], [0, "&dopf;"], [0, "&eopf;"], [0, "&fopf;"], [0, "&gopf;"], [0, "&hopf;"], [0, "&iopf;"], [0, "&jopf;"], [0, "&kopf;"], [0, "&lopf;"], [0, "&mopf;"], [0, "&nopf;"], [0, "&oopf;"], [0, "&popf;"], [0, "&qopf;"], [0, "&ropf;"], [0, "&sopf;"], [0, "&topf;"], [0, "&uopf;"], [0, "&vopf;"], [0, "&wopf;"], [0, "&xopf;"], [0, "&yopf;"], [0, "&zopf;"]])) }], [8906, "&fflig;"], [0, "&filig;"], [0, "&fllig;"], [0, "&ffilig;"], [0, "&ffllig;"]]));
  }
});

// node_modules/markdown-it/node_modules/entities/lib/escape.js
var require_escape = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/escape.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.escapeText = exports2.escapeAttribute = exports2.escapeUTF8 = exports2.escape = exports2.encodeXML = exports2.getCodePoint = exports2.xmlReplacer = void 0;
    exports2.xmlReplacer = /["&'<>$\x80-\uFFFF]/g;
    var xmlCodeMap = /* @__PURE__ */ new Map([
      [34, "&quot;"],
      [38, "&amp;"],
      [39, "&apos;"],
      [60, "&lt;"],
      [62, "&gt;"]
    ]);
    exports2.getCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
    String.prototype.codePointAt != null ? function(str, index6) {
      return str.codePointAt(index6);
    } : (
      // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
      function(c, index6) {
        return (c.charCodeAt(index6) & 64512) === 55296 ? (c.charCodeAt(index6) - 55296) * 1024 + c.charCodeAt(index6 + 1) - 56320 + 65536 : c.charCodeAt(index6);
      }
    );
    function encodeXML(str) {
      var ret = "";
      var lastIdx = 0;
      var match3;
      while ((match3 = exports2.xmlReplacer.exec(str)) !== null) {
        var i = match3.index;
        var char2 = str.charCodeAt(i);
        var next2 = xmlCodeMap.get(char2);
        if (next2 !== void 0) {
          ret += str.substring(lastIdx, i) + next2;
          lastIdx = i + 1;
        } else {
          ret += "".concat(str.substring(lastIdx, i), "&#x").concat((0, exports2.getCodePoint)(str, i).toString(16), ";");
          lastIdx = exports2.xmlReplacer.lastIndex += Number((char2 & 64512) === 55296);
        }
      }
      return ret + str.substr(lastIdx);
    }
    exports2.encodeXML = encodeXML;
    exports2.escape = encodeXML;
    function getEscaper(regex2, map2) {
      return function escape3(data) {
        var match3;
        var lastIdx = 0;
        var result = "";
        while (match3 = regex2.exec(data)) {
          if (lastIdx !== match3.index) {
            result += data.substring(lastIdx, match3.index);
          }
          result += map2.get(match3[0].charCodeAt(0));
          lastIdx = match3.index + 1;
        }
        return result + data.substring(lastIdx);
      };
    }
    exports2.escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap);
    exports2.escapeAttribute = getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([
      [34, "&quot;"],
      [38, "&amp;"],
      [160, "&nbsp;"]
    ]));
    exports2.escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([
      [38, "&amp;"],
      [60, "&lt;"],
      [62, "&gt;"],
      [160, "&nbsp;"]
    ]));
  }
});

// node_modules/markdown-it/node_modules/entities/lib/encode.js
var require_encode = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/encode.js"(exports2) {
    "use strict";
    var __importDefault = exports2 && exports2.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.encodeNonAsciiHTML = exports2.encodeHTML = void 0;
    var encode_html_js_1 = __importDefault(require_encode_html());
    var escape_js_1 = require_escape();
    var htmlReplacer = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g;
    function encodeHTML(data) {
      return encodeHTMLTrieRe(htmlReplacer, data);
    }
    exports2.encodeHTML = encodeHTML;
    function encodeNonAsciiHTML(data) {
      return encodeHTMLTrieRe(escape_js_1.xmlReplacer, data);
    }
    exports2.encodeNonAsciiHTML = encodeNonAsciiHTML;
    function encodeHTMLTrieRe(regExp, str) {
      var ret = "";
      var lastIdx = 0;
      var match3;
      while ((match3 = regExp.exec(str)) !== null) {
        var i = match3.index;
        ret += str.substring(lastIdx, i);
        var char2 = str.charCodeAt(i);
        var next2 = encode_html_js_1.default.get(char2);
        if (typeof next2 === "object") {
          if (i + 1 < str.length) {
            var nextChar = str.charCodeAt(i + 1);
            var value2 = typeof next2.n === "number" ? next2.n === nextChar ? next2.o : void 0 : next2.n.get(nextChar);
            if (value2 !== void 0) {
              ret += value2;
              lastIdx = regExp.lastIndex += 1;
              continue;
            }
          }
          next2 = next2.v;
        }
        if (next2 !== void 0) {
          ret += next2;
          lastIdx = i + 1;
        } else {
          var cp = (0, escape_js_1.getCodePoint)(str, i);
          ret += "&#x".concat(cp.toString(16), ";");
          lastIdx = regExp.lastIndex += Number(cp !== char2);
        }
      }
      return ret + str.substr(lastIdx);
    }
  }
});

// node_modules/markdown-it/node_modules/entities/lib/index.js
var require_lib = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/index.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.decodeXMLStrict = exports2.decodeHTML5Strict = exports2.decodeHTML4Strict = exports2.decodeHTML5 = exports2.decodeHTML4 = exports2.decodeHTMLAttribute = exports2.decodeHTMLStrict = exports2.decodeHTML = exports2.decodeXML = exports2.DecodingMode = exports2.EntityDecoder = exports2.encodeHTML5 = exports2.encodeHTML4 = exports2.encodeNonAsciiHTML = exports2.encodeHTML = exports2.escapeText = exports2.escapeAttribute = exports2.escapeUTF8 = exports2.escape = exports2.encodeXML = exports2.encode = exports2.decodeStrict = exports2.decode = exports2.EncodingMode = exports2.EntityLevel = void 0;
    var decode_js_1 = require_decode();
    var encode_js_1 = require_encode();
    var escape_js_1 = require_escape();
    var EntityLevel;
    (function(EntityLevel2) {
      EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
      EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
    })(EntityLevel = exports2.EntityLevel || (exports2.EntityLevel = {}));
    var EncodingMode;
    (function(EncodingMode2) {
      EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
      EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
      EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
      EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
      EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
    })(EncodingMode = exports2.EncodingMode || (exports2.EncodingMode = {}));
    function decode2(data, options) {
      if (options === void 0) {
        options = EntityLevel.XML;
      }
      var level = typeof options === "number" ? options : options.level;
      if (level === EntityLevel.HTML) {
        var mode = typeof options === "object" ? options.mode : void 0;
        return (0, decode_js_1.decodeHTML)(data, mode);
      }
      return (0, decode_js_1.decodeXML)(data);
    }
    exports2.decode = decode2;
    function decodeStrict(data, options) {
      var _a6;
      if (options === void 0) {
        options = EntityLevel.XML;
      }
      var opts = typeof options === "number" ? { level: options } : options;
      (_a6 = opts.mode) !== null && _a6 !== void 0 ? _a6 : opts.mode = decode_js_1.DecodingMode.Strict;
      return decode2(data, opts);
    }
    exports2.decodeStrict = decodeStrict;
    function encode2(data, options) {
      if (options === void 0) {
        options = EntityLevel.XML;
      }
      var opts = typeof options === "number" ? { level: options } : options;
      if (opts.mode === EncodingMode.UTF8)
        return (0, escape_js_1.escapeUTF8)(data);
      if (opts.mode === EncodingMode.Attribute)
        return (0, escape_js_1.escapeAttribute)(data);
      if (opts.mode === EncodingMode.Text)
        return (0, escape_js_1.escapeText)(data);
      if (opts.level === EntityLevel.HTML) {
        if (opts.mode === EncodingMode.ASCII) {
          return (0, encode_js_1.encodeNonAsciiHTML)(data);
        }
        return (0, encode_js_1.encodeHTML)(data);
      }
      return (0, escape_js_1.encodeXML)(data);
    }
    exports2.encode = encode2;
    var escape_js_2 = require_escape();
    Object.defineProperty(exports2, "encodeXML", { enumerable: true, get: function() {
      return escape_js_2.encodeXML;
    } });
    Object.defineProperty(exports2, "escape", { enumerable: true, get: function() {
      return escape_js_2.escape;
    } });
    Object.defineProperty(exports2, "escapeUTF8", { enumerable: true, get: function() {
      return escape_js_2.escapeUTF8;
    } });
    Object.defineProperty(exports2, "escapeAttribute", { enumerable: true, get: function() {
      return escape_js_2.escapeAttribute;
    } });
    Object.defineProperty(exports2, "escapeText", { enumerable: true, get: function() {
      return escape_js_2.escapeText;
    } });
    var encode_js_2 = require_encode();
    Object.defineProperty(exports2, "encodeHTML", { enumerable: true, get: function() {
      return encode_js_2.encodeHTML;
    } });
    Object.defineProperty(exports2, "encodeNonAsciiHTML", { enumerable: true, get: function() {
      return encode_js_2.encodeNonAsciiHTML;
    } });
    Object.defineProperty(exports2, "encodeHTML4", { enumerable: true, get: function() {
      return encode_js_2.encodeHTML;
    } });
    Object.defineProperty(exports2, "encodeHTML5", { enumerable: true, get: function() {
      return encode_js_2.encodeHTML;
    } });
    var decode_js_2 = require_decode();
    Object.defineProperty(exports2, "EntityDecoder", { enumerable: true, get: function() {
      return decode_js_2.EntityDecoder;
    } });
    Object.defineProperty(exports2, "DecodingMode", { enumerable: true, get: function() {
      return decode_js_2.DecodingMode;
    } });
    Object.defineProperty(exports2, "decodeXML", { enumerable: true, get: function() {
      return decode_js_2.decodeXML;
    } });
    Object.defineProperty(exports2, "decodeHTML", { enumerable: true, get: function() {
      return decode_js_2.decodeHTML;
    } });
    Object.defineProperty(exports2, "decodeHTMLStrict", { enumerable: true, get: function() {
      return decode_js_2.decodeHTMLStrict;
    } });
    Object.defineProperty(exports2, "decodeHTMLAttribute", { enumerable: true, get: function() {
      return decode_js_2.decodeHTMLAttribute;
    } });
    Object.defineProperty(exports2, "decodeHTML4", { enumerable: true, get: function() {
      return decode_js_2.decodeHTML;
    } });
    Object.defineProperty(exports2, "decodeHTML5", { enumerable: true, get: function() {
      return decode_js_2.decodeHTML;
    } });
    Object.defineProperty(exports2, "decodeHTML4Strict", { enumerable: true, get: function() {
      return decode_js_2.decodeHTMLStrict;
    } });
    Object.defineProperty(exports2, "decodeHTML5Strict", { enumerable: true, get: function() {
      return decode_js_2.decodeHTMLStrict;
    } });
    Object.defineProperty(exports2, "decodeXMLStrict", { enumerable: true, get: function() {
      return decode_js_2.decodeXML;
    } });
  }
});

// node_modules/linkify-it/build/index.cjs.js
var require_index_cjs3 = __commonJS({
  "node_modules/linkify-it/build/index.cjs.js"(exports2, module2) {
    "use strict";
    var uc_micro = require_index_cjs2();
    function reFactory(opts) {
      const re = {};
      opts = opts || {};
      re.src_Any = uc_micro.Any.source;
      re.src_Cc = uc_micro.Cc.source;
      re.src_Z = uc_micro.Z.source;
      re.src_P = uc_micro.P.source;
      re.src_ZPCc = [re.src_Z, re.src_P, re.src_Cc].join("|");
      re.src_ZCc = [re.src_Z, re.src_Cc].join("|");
      const text_separators = "[><\uFF5C]";
      re.src_pseudo_letter = "(?:(?!" + text_separators + "|" + re.src_ZPCc + ")" + re.src_Any + ")";
      re.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
      re.src_auth = "(?:(?:(?!" + re.src_ZCc + "|[@/\\[\\]()]).)+@)?";
      re.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
      re.src_host_terminator = "(?=$|" + text_separators + "|" + re.src_ZPCc + ")(?!" + (opts["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + re.src_ZPCc + "))";
      re.src_path = "(?:[/?#](?:(?!" + re.src_ZCc + "|" + text_separators + `|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!` + re.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + re.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + re.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + re.src_ZCc + `|["]).)+\\"|\\'(?:(?!` + re.src_ZCc + "|[']).)+\\'|\\'(?=" + re.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + re.src_ZCc + "|[.]|$)|" + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + // allow `,,,` in paths
      ",(?!" + re.src_ZCc + "|$)|;(?!" + re.src_ZCc + "|$)|\\!+(?!" + re.src_ZCc + "|[!]|$)|\\?(?!" + re.src_ZCc + "|[?]|$))+|\\/)?";
      re.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';
      re.src_xn = "xn--[a-z0-9\\-]{1,59}";
      re.src_domain_root = // Allow letters & digits (http://test1)
      "(?:" + re.src_xn + "|" + re.src_pseudo_letter + "{1,63})";
      re.src_domain = "(?:" + re.src_xn + "|(?:" + re.src_pseudo_letter + ")|(?:" + re.src_pseudo_letter + "(?:-|" + re.src_pseudo_letter + "){0,61}" + re.src_pseudo_letter + "))";
      re.src_host = "(?:(?:(?:(?:" + re.src_domain + ")\\.)*" + re.src_domain + "))";
      re.tpl_host_fuzzy = "(?:" + re.src_ip4 + "|(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%)))";
      re.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%))";
      re.src_host_strict = re.src_host + re.src_host_terminator;
      re.tpl_host_fuzzy_strict = re.tpl_host_fuzzy + re.src_host_terminator;
      re.src_host_port_strict = re.src_host + re.src_port + re.src_host_terminator;
      re.tpl_host_port_fuzzy_strict = re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
      re.tpl_host_port_no_ip_fuzzy_strict = re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
      re.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + re.src_ZPCc + "|>|$))";
      re.tpl_email_fuzzy = "(^|" + text_separators + '|"|\\(|' + re.src_ZCc + ")(" + re.src_email_name + "@" + re.tpl_host_fuzzy_strict + ")";
      re.tpl_link_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
      // but can start with > (markdown blockquote)
      "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|" + re.src_ZPCc + "))((?![$+<=>^`|\uFF5C])" + re.tpl_host_port_fuzzy_strict + re.src_path + ")";
      re.tpl_link_no_ip_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
      // but can start with > (markdown blockquote)
      "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|" + re.src_ZPCc + "))((?![$+<=>^`|\uFF5C])" + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ")";
      return re;
    }
    function assign2(obj) {
      const sources = Array.prototype.slice.call(arguments, 1);
      sources.forEach(function(source2) {
        if (!source2) {
          return;
        }
        Object.keys(source2).forEach(function(key4) {
          obj[key4] = source2[key4];
        });
      });
      return obj;
    }
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function isString(obj) {
      return _class(obj) === "[object String]";
    }
    function isObject(obj) {
      return _class(obj) === "[object Object]";
    }
    function isRegExp(obj) {
      return _class(obj) === "[object RegExp]";
    }
    function isFunction(obj) {
      return _class(obj) === "[object Function]";
    }
    function escapeRE(str) {
      return str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
    }
    var defaultOptions = {
      fuzzyLink: true,
      fuzzyEmail: true,
      fuzzyIP: false
    };
    function isOptionsObj(obj) {
      return Object.keys(obj || {}).reduce(function(acc, k) {
        return acc || defaultOptions.hasOwnProperty(k);
      }, false);
    }
    var defaultSchemas = {
      "http:": {
        validate: function(text3, pos2, self3) {
          const tail = text3.slice(pos2);
          if (!self3.re.http) {
            self3.re.http = new RegExp(
              "^\\/\\/" + self3.re.src_auth + self3.re.src_host_port_strict + self3.re.src_path,
              "i"
            );
          }
          if (self3.re.http.test(tail)) {
            return tail.match(self3.re.http)[0].length;
          }
          return 0;
        }
      },
      "https:": "http:",
      "ftp:": "http:",
      "//": {
        validate: function(text3, pos2, self3) {
          const tail = text3.slice(pos2);
          if (!self3.re.no_http) {
            self3.re.no_http = new RegExp(
              "^" + self3.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
              // with code comments
              "(?:localhost|(?:(?:" + self3.re.src_domain + ")\\.)+" + self3.re.src_domain_root + ")" + self3.re.src_port + self3.re.src_host_terminator + self3.re.src_path,
              "i"
            );
          }
          if (self3.re.no_http.test(tail)) {
            if (pos2 >= 3 && text3[pos2 - 3] === ":") {
              return 0;
            }
            if (pos2 >= 3 && text3[pos2 - 3] === "/") {
              return 0;
            }
            return tail.match(self3.re.no_http)[0].length;
          }
          return 0;
        }
      },
      "mailto:": {
        validate: function(text3, pos2, self3) {
          const tail = text3.slice(pos2);
          if (!self3.re.mailto) {
            self3.re.mailto = new RegExp(
              "^" + self3.re.src_email_name + "@" + self3.re.src_host_strict,
              "i"
            );
          }
          if (self3.re.mailto.test(tail)) {
            return tail.match(self3.re.mailto)[0].length;
          }
          return 0;
        }
      }
    };
    var tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
    var tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");
    function resetScanCache(self3) {
      self3.__index__ = -1;
      self3.__text_cache__ = "";
    }
    function createValidator(re) {
      return function(text3, pos2) {
        const tail = text3.slice(pos2);
        if (re.test(tail)) {
          return tail.match(re)[0].length;
        }
        return 0;
      };
    }
    function createNormalizer() {
      return function(match3, self3) {
        self3.normalize(match3);
      };
    }
    function compile(self3) {
      const re = self3.re = reFactory(self3.__opts__);
      const tlds = self3.__tlds__.slice();
      self3.onCompile();
      if (!self3.__tlds_replaced__) {
        tlds.push(tlds_2ch_src_re);
      }
      tlds.push(re.src_xn);
      re.src_tlds = tlds.join("|");
      function untpl(tpl) {
        return tpl.replace("%TLDS%", re.src_tlds);
      }
      re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i");
      re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i");
      re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
      re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
      const aliases = [];
      self3.__compiled__ = {};
      function schemaError(name, val) {
        throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
      }
      Object.keys(self3.__schemas__).forEach(function(name) {
        const val = self3.__schemas__[name];
        if (val === null) {
          return;
        }
        const compiled = { validate: null, link: null };
        self3.__compiled__[name] = compiled;
        if (isObject(val)) {
          if (isRegExp(val.validate)) {
            compiled.validate = createValidator(val.validate);
          } else if (isFunction(val.validate)) {
            compiled.validate = val.validate;
          } else {
            schemaError(name, val);
          }
          if (isFunction(val.normalize)) {
            compiled.normalize = val.normalize;
          } else if (!val.normalize) {
            compiled.normalize = createNormalizer();
          } else {
            schemaError(name, val);
          }
          return;
        }
        if (isString(val)) {
          aliases.push(name);
          return;
        }
        schemaError(name, val);
      });
      aliases.forEach(function(alias) {
        if (!self3.__compiled__[self3.__schemas__[alias]]) {
          return;
        }
        self3.__compiled__[alias].validate = self3.__compiled__[self3.__schemas__[alias]].validate;
        self3.__compiled__[alias].normalize = self3.__compiled__[self3.__schemas__[alias]].normalize;
      });
      self3.__compiled__[""] = { validate: null, normalize: createNormalizer() };
      const slist = Object.keys(self3.__compiled__).filter(function(name) {
        return name.length > 0 && self3.__compiled__[name];
      }).map(escapeRE).join("|");
      self3.re.schema_test = RegExp("(^|(?!_)(?:[><\uFF5C]|" + re.src_ZPCc + "))(" + slist + ")", "i");
      self3.re.schema_search = RegExp("(^|(?!_)(?:[><\uFF5C]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
      self3.re.schema_at_start = RegExp("^" + self3.re.schema_search.source, "i");
      self3.re.pretest = RegExp(
        "(" + self3.re.schema_test.source + ")|(" + self3.re.host_fuzzy_test.source + ")|@",
        "i"
      );
      resetScanCache(self3);
    }
    function Match(self3, shift) {
      const start = self3.__index__;
      const end = self3.__last_index__;
      const text3 = self3.__text_cache__.slice(start, end);
      this.schema = self3.__schema__.toLowerCase();
      this.index = start + shift;
      this.lastIndex = end + shift;
      this.raw = text3;
      this.text = text3;
      this.url = text3;
    }
    function createMatch(self3, shift) {
      const match3 = new Match(self3, shift);
      self3.__compiled__[match3.schema].normalize(match3, self3);
      return match3;
    }
    function LinkifyIt(schemas, options) {
      if (!(this instanceof LinkifyIt)) {
        return new LinkifyIt(schemas, options);
      }
      if (!options) {
        if (isOptionsObj(schemas)) {
          options = schemas;
          schemas = {};
        }
      }
      this.__opts__ = assign2({}, defaultOptions, options);
      this.__index__ = -1;
      this.__last_index__ = -1;
      this.__schema__ = "";
      this.__text_cache__ = "";
      this.__schemas__ = assign2({}, defaultSchemas, schemas);
      this.__compiled__ = {};
      this.__tlds__ = tlds_default;
      this.__tlds_replaced__ = false;
      this.re = {};
      compile(this);
    }
    LinkifyIt.prototype.add = function add(schema, definition) {
      this.__schemas__[schema] = definition;
      compile(this);
      return this;
    };
    LinkifyIt.prototype.set = function set2(options) {
      this.__opts__ = assign2(this.__opts__, options);
      return this;
    };
    LinkifyIt.prototype.test = function test(text3) {
      this.__text_cache__ = text3;
      this.__index__ = -1;
      if (!text3.length) {
        return false;
      }
      let m2, ml, me, len, shift, next2, re, tld_pos, at_pos;
      if (this.re.schema_test.test(text3)) {
        re = this.re.schema_search;
        re.lastIndex = 0;
        while ((m2 = re.exec(text3)) !== null) {
          len = this.testSchemaAt(text3, m2[2], re.lastIndex);
          if (len) {
            this.__schema__ = m2[2];
            this.__index__ = m2.index + m2[1].length;
            this.__last_index__ = m2.index + m2[0].length + len;
            break;
          }
        }
      }
      if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
        tld_pos = text3.search(this.re.host_fuzzy_test);
        if (tld_pos >= 0) {
          if (this.__index__ < 0 || tld_pos < this.__index__) {
            if ((ml = text3.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
              shift = ml.index + ml[1].length;
              if (this.__index__ < 0 || shift < this.__index__) {
                this.__schema__ = "";
                this.__index__ = shift;
                this.__last_index__ = ml.index + ml[0].length;
              }
            }
          }
        }
      }
      if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
        at_pos = text3.indexOf("@");
        if (at_pos >= 0) {
          if ((me = text3.match(this.re.email_fuzzy)) !== null) {
            shift = me.index + me[1].length;
            next2 = me.index + me[0].length;
            if (this.__index__ < 0 || shift < this.__index__ || shift === this.__index__ && next2 > this.__last_index__) {
              this.__schema__ = "mailto:";
              this.__index__ = shift;
              this.__last_index__ = next2;
            }
          }
        }
      }
      return this.__index__ >= 0;
    };
    LinkifyIt.prototype.pretest = function pretest(text3) {
      return this.re.pretest.test(text3);
    };
    LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text3, schema, pos2) {
      if (!this.__compiled__[schema.toLowerCase()]) {
        return 0;
      }
      return this.__compiled__[schema.toLowerCase()].validate(text3, pos2, this);
    };
    LinkifyIt.prototype.match = function match3(text3) {
      const result = [];
      let shift = 0;
      if (this.__index__ >= 0 && this.__text_cache__ === text3) {
        result.push(createMatch(this, shift));
        shift = this.__last_index__;
      }
      let tail = shift ? text3.slice(shift) : text3;
      while (this.test(tail)) {
        result.push(createMatch(this, shift));
        tail = tail.slice(this.__last_index__);
        shift += this.__last_index__;
      }
      if (result.length) {
        return result;
      }
      return null;
    };
    LinkifyIt.prototype.matchAtStart = function matchAtStart(text3) {
      this.__text_cache__ = text3;
      this.__index__ = -1;
      if (!text3.length) return null;
      const m2 = this.re.schema_at_start.exec(text3);
      if (!m2) return null;
      const len = this.testSchemaAt(text3, m2[2], m2[0].length);
      if (!len) return null;
      this.__schema__ = m2[2];
      this.__index__ = m2.index + m2[1].length;
      this.__last_index__ = m2.index + m2[0].length + len;
      return createMatch(this, 0);
    };
    LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
      list = Array.isArray(list) ? list : [list];
      if (!keepOld) {
        this.__tlds__ = list.slice();
        this.__tlds_replaced__ = true;
        compile(this);
        return this;
      }
      this.__tlds__ = this.__tlds__.concat(list).sort().filter(function(el, idx2, arr) {
        return el !== arr[idx2 - 1];
      }).reverse();
      compile(this);
      return this;
    };
    LinkifyIt.prototype.normalize = function normalize4(match3) {
      if (!match3.schema) {
        match3.url = "http://" + match3.url;
      }
      if (match3.schema === "mailto:" && !/^mailto:/i.test(match3.url)) {
        match3.url = "mailto:" + match3.url;
      }
    };
    LinkifyIt.prototype.onCompile = function onCompile() {
    };
    module2.exports = LinkifyIt;
  }
});

// node_modules/punycode.js/punycode.es6.js
var punycode_es6_exports = {};
__export2(punycode_es6_exports, {
  decode: () => decode,
  default: () => punycode_es6_default,
  encode: () => encode,
  toASCII: () => toASCII,
  toUnicode: () => toUnicode,
  ucs2decode: () => ucs2decode,
  ucs2encode: () => ucs2encode
});
function error(type) {
  throw new RangeError(errors[type]);
}
function map(array, callback) {
  const result = [];
  let length = array.length;
  while (length--) {
    result[length] = callback(array[length]);
  }
  return result;
}
function mapDomain(domain, callback) {
  const parts = domain.split("@");
  let result = "";
  if (parts.length > 1) {
    result = parts[0] + "@";
    domain = parts[1];
  }
  domain = domain.replace(regexSeparators, ".");
  const labels = domain.split(".");
  const encoded = map(labels, callback).join(".");
  return result + encoded;
}
function ucs2decode(string) {
  const output = [];
  let counter = 0;
  const length = string.length;
  while (counter < length) {
    const value2 = string.charCodeAt(counter++);
    if (value2 >= 55296 && value2 <= 56319 && counter < length) {
      const extra = string.charCodeAt(counter++);
      if ((extra & 64512) == 56320) {
        output.push(((value2 & 1023) << 10) + (extra & 1023) + 65536);
      } else {
        output.push(value2);
        counter--;
      }
    } else {
      output.push(value2);
    }
  }
  return output;
}
var maxInt, base, tMin, tMax, skew, damp, initialBias, initialN, delimiter, regexPunycode, regexNonASCII, regexSeparators, errors, baseMinusTMin, floor, stringFromCharCode, ucs2encode, basicToDigit, digitToBasic, adapt, decode, encode, toUnicode, toASCII, punycode, punycode_es6_default;
var init_punycode_es6 = __esm({
  "node_modules/punycode.js/punycode.es6.js"() {
    "use strict";
    maxInt = 2147483647;
    base = 36;
    tMin = 1;
    tMax = 26;
    skew = 38;
    damp = 700;
    initialBias = 72;
    initialN = 128;
    delimiter = "-";
    regexPunycode = /^xn--/;
    regexNonASCII = /[^\0-\x7F]/;
    regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
    errors = {
      "overflow": "Overflow: input needs wider integers to process",
      "not-basic": "Illegal input >= 0x80 (not a basic code point)",
      "invalid-input": "Invalid input"
    };
    baseMinusTMin = base - tMin;
    floor = Math.floor;
    stringFromCharCode = String.fromCharCode;
    ucs2encode = (codePoints) => String.fromCodePoint(...codePoints);
    basicToDigit = function(codePoint) {
      if (codePoint >= 48 && codePoint < 58) {
        return 26 + (codePoint - 48);
      }
      if (codePoint >= 65 && codePoint < 91) {
        return codePoint - 65;
      }
      if (codePoint >= 97 && codePoint < 123) {
        return codePoint - 97;
      }
      return base;
    };
    digitToBasic = function(digit, flag) {
      return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
    };
    adapt = function(delta, numPoints, firstTime) {
      let k = 0;
      delta = firstTime ? floor(delta / damp) : delta >> 1;
      delta += floor(delta / numPoints);
      for (; delta > baseMinusTMin * tMax >> 1; k += base) {
        delta = floor(delta / baseMinusTMin);
      }
      return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
    };
    decode = function(input) {
      const output = [];
      const inputLength = input.length;
      let i = 0;
      let n3 = initialN;
      let bias = initialBias;
      let basic = input.lastIndexOf(delimiter);
      if (basic < 0) {
        basic = 0;
      }
      for (let j = 0; j < basic; ++j) {
        if (input.charCodeAt(j) >= 128) {
          error("not-basic");
        }
        output.push(input.charCodeAt(j));
      }
      for (let index6 = basic > 0 ? basic + 1 : 0; index6 < inputLength; ) {
        const oldi = i;
        for (let w2 = 1, k = base; ; k += base) {
          if (index6 >= inputLength) {
            error("invalid-input");
          }
          const digit = basicToDigit(input.charCodeAt(index6++));
          if (digit >= base) {
            error("invalid-input");
          }
          if (digit > floor((maxInt - i) / w2)) {
            error("overflow");
          }
          i += digit * w2;
          const t2 = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
          if (digit < t2) {
            break;
          }
          const baseMinusT = base - t2;
          if (w2 > floor(maxInt / baseMinusT)) {
            error("overflow");
          }
          w2 *= baseMinusT;
        }
        const out = output.length + 1;
        bias = adapt(i - oldi, out, oldi == 0);
        if (floor(i / out) > maxInt - n3) {
          error("overflow");
        }
        n3 += floor(i / out);
        i %= out;
        output.splice(i++, 0, n3);
      }
      return String.fromCodePoint(...output);
    };
    encode = function(input) {
      const output = [];
      input = ucs2decode(input);
      const inputLength = input.length;
      let n3 = initialN;
      let delta = 0;
      let bias = initialBias;
      for (const currentValue of input) {
        if (currentValue < 128) {
          output.push(stringFromCharCode(currentValue));
        }
      }
      const basicLength = output.length;
      let handledCPCount = basicLength;
      if (basicLength) {
        output.push(delimiter);
      }
      while (handledCPCount < inputLength) {
        let m2 = maxInt;
        for (const currentValue of input) {
          if (currentValue >= n3 && currentValue < m2) {
            m2 = currentValue;
          }
        }
        const handledCPCountPlusOne = handledCPCount + 1;
        if (m2 - n3 > floor((maxInt - delta) / handledCPCountPlusOne)) {
          error("overflow");
        }
        delta += (m2 - n3) * handledCPCountPlusOne;
        n3 = m2;
        for (const currentValue of input) {
          if (currentValue < n3 && ++delta > maxInt) {
            error("overflow");
          }
          if (currentValue === n3) {
            let q = delta;
            for (let k = base; ; k += base) {
              const t2 = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
              if (q < t2) {
                break;
              }
              const qMinusT = q - t2;
              const baseMinusT = base - t2;
              output.push(
                stringFromCharCode(digitToBasic(t2 + qMinusT % baseMinusT, 0))
              );
              q = floor(qMinusT / baseMinusT);
            }
            output.push(stringFromCharCode(digitToBasic(q, 0)));
            bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
            delta = 0;
            ++handledCPCount;
          }
        }
        ++delta;
        ++n3;
      }
      return output.join("");
    };
    toUnicode = function(input) {
      return mapDomain(input, function(string) {
        return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
      });
    };
    toASCII = function(input) {
      return mapDomain(input, function(string) {
        return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
      });
    };
    punycode = {
      /**
       * A string representing the current Punycode.js version number.
       * @memberOf punycode
       * @type String
       */
      "version": "2.3.1",
      /**
       * An object of methods to convert from JavaScript's internal character
       * representation (UCS-2) to Unicode code points, and back.
       * @see <https://mathiasbynens.be/notes/javascript-encoding>
       * @memberOf punycode
       * @type Object
       */
      "ucs2": {
        "decode": ucs2decode,
        "encode": ucs2encode
      },
      "decode": decode,
      "encode": encode,
      "toASCII": toASCII,
      "toUnicode": toUnicode
    };
    punycode_es6_default = punycode;
  }
});

// node_modules/markdown-it/dist/index.cjs.js
var require_index_cjs4 = __commonJS({
  "node_modules/markdown-it/dist/index.cjs.js"(exports2, module2) {
    "use strict";
    var mdurl = require_index_cjs();
    var ucmicro = require_index_cjs2();
    var entities = require_lib();
    var LinkifyIt = require_index_cjs3();
    var punycode2 = (init_punycode_es6(), __toCommonJS2(punycode_es6_exports));
    function _interopNamespaceDefault(e2) {
      var n3 = /* @__PURE__ */ Object.create(null);
      if (e2) {
        Object.keys(e2).forEach(function(k) {
          if (k !== "default") {
            var d = Object.getOwnPropertyDescriptor(e2, k);
            Object.defineProperty(n3, k, d.get ? d : {
              enumerable: true,
              get: function() {
                return e2[k];
              }
            });
          }
        });
      }
      n3.default = e2;
      return Object.freeze(n3);
    }
    var mdurl__namespace = /* @__PURE__ */ _interopNamespaceDefault(mdurl);
    var ucmicro__namespace = /* @__PURE__ */ _interopNamespaceDefault(ucmicro);
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function isString(obj) {
      return _class(obj) === "[object String]";
    }
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    function has(object, key4) {
      return _hasOwnProperty.call(object, key4);
    }
    function assign2(obj) {
      const sources = Array.prototype.slice.call(arguments, 1);
      sources.forEach(function(source2) {
        if (!source2) {
          return;
        }
        if (typeof source2 !== "object") {
          throw new TypeError(source2 + "must be object");
        }
        Object.keys(source2).forEach(function(key4) {
          obj[key4] = source2[key4];
        });
      });
      return obj;
    }
    function arrayReplaceAt(src, pos2, newElements) {
      return [].concat(src.slice(0, pos2), newElements, src.slice(pos2 + 1));
    }
    function isValidEntityCode(c) {
      if (c >= 55296 && c <= 57343) {
        return false;
      }
      if (c >= 64976 && c <= 65007) {
        return false;
      }
      if ((c & 65535) === 65535 || (c & 65535) === 65534) {
        return false;
      }
      if (c >= 0 && c <= 8) {
        return false;
      }
      if (c === 11) {
        return false;
      }
      if (c >= 14 && c <= 31) {
        return false;
      }
      if (c >= 127 && c <= 159) {
        return false;
      }
      if (c > 1114111) {
        return false;
      }
      return true;
    }
    function fromCodePoint(c) {
      if (c > 65535) {
        c -= 65536;
        const surrogate1 = 55296 + (c >> 10);
        const surrogate2 = 56320 + (c & 1023);
        return String.fromCharCode(surrogate1, surrogate2);
      }
      return String.fromCharCode(c);
    }
    var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
    var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
    var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + "|" + ENTITY_RE.source, "gi");
    var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
    function replaceEntityPattern(match3, name) {
      if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
        const code2 = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
        if (isValidEntityCode(code2)) {
          return fromCodePoint(code2);
        }
        return match3;
      }
      const decoded = entities.decodeHTML(match3);
      if (decoded !== match3) {
        return decoded;
      }
      return match3;
    }
    function unescapeMd(str) {
      if (str.indexOf("\\") < 0) {
        return str;
      }
      return str.replace(UNESCAPE_MD_RE, "$1");
    }
    function unescapeAll(str) {
      if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) {
        return str;
      }
      return str.replace(UNESCAPE_ALL_RE, function(match3, escaped, entity2) {
        if (escaped) {
          return escaped;
        }
        return replaceEntityPattern(match3, entity2);
      });
    }
    var HTML_ESCAPE_TEST_RE = /[&<>"]/;
    var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
    var HTML_REPLACEMENTS = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;"
    };
    function replaceUnsafeChar(ch3) {
      return HTML_REPLACEMENTS[ch3];
    }
    function escapeHtml(str) {
      if (HTML_ESCAPE_TEST_RE.test(str)) {
        return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
      }
      return str;
    }
    var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
    function escapeRE(str) {
      return str.replace(REGEXP_ESCAPE_RE, "\\$&");
    }
    function isSpace2(code2) {
      switch (code2) {
        case 9:
        case 32:
          return true;
      }
      return false;
    }
    function isWhiteSpace(code2) {
      if (code2 >= 8192 && code2 <= 8202) {
        return true;
      }
      switch (code2) {
        case 9:
        // \t
        case 10:
        // \n
        case 11:
        // \v
        case 12:
        // \f
        case 13:
        // \r
        case 32:
        case 160:
        case 5760:
        case 8239:
        case 8287:
        case 12288:
          return true;
      }
      return false;
    }
    function isPunctChar(ch3) {
      return ucmicro__namespace.P.test(ch3) || ucmicro__namespace.S.test(ch3);
    }
    function isMdAsciiPunct(ch3) {
      switch (ch3) {
        case 33:
        case 34:
        case 35:
        case 36:
        case 37:
        case 38:
        case 39:
        case 40:
        case 41:
        case 42:
        case 43:
        case 44:
        case 45:
        case 46:
        case 47:
        case 58:
        case 59:
        case 60:
        case 61:
        case 62:
        case 63:
        case 64:
        case 91:
        case 92:
        case 93:
        case 94:
        case 95:
        case 96:
        case 123:
        case 124:
        case 125:
        case 126:
          return true;
        default:
          return false;
      }
    }
    function normalizeReference(str) {
      str = str.trim().replace(/\s+/g, " ");
      if ("\u1E9E".toLowerCase() === "\u1E7E") {
        str = str.replace(/ẞ/g, "\xDF");
      }
      return str.toLowerCase().toUpperCase();
    }
    var lib = {
      mdurl: mdurl__namespace,
      ucmicro: ucmicro__namespace
    };
    var utils = /* @__PURE__ */ Object.freeze({
      __proto__: null,
      arrayReplaceAt,
      assign: assign2,
      escapeHtml,
      escapeRE,
      fromCodePoint,
      has,
      isMdAsciiPunct,
      isPunctChar,
      isSpace: isSpace2,
      isString,
      isValidEntityCode,
      isWhiteSpace,
      lib,
      normalizeReference,
      unescapeAll,
      unescapeMd
    });
    function parseLinkLabel(state2, start, disableNested) {
      let level, found, marker, prevPos;
      const max3 = state2.posMax;
      const oldPos = state2.pos;
      state2.pos = start + 1;
      level = 1;
      while (state2.pos < max3) {
        marker = state2.src.charCodeAt(state2.pos);
        if (marker === 93) {
          level--;
          if (level === 0) {
            found = true;
            break;
          }
        }
        prevPos = state2.pos;
        state2.md.inline.skipToken(state2);
        if (marker === 91) {
          if (prevPos === state2.pos - 1) {
            level++;
          } else if (disableNested) {
            state2.pos = oldPos;
            return -1;
          }
        }
      }
      let labelEnd = -1;
      if (found) {
        labelEnd = state2.pos;
      }
      state2.pos = oldPos;
      return labelEnd;
    }
    function parseLinkDestination(str, start, max3) {
      let code2;
      let pos2 = start;
      const result = {
        ok: false,
        pos: 0,
        str: ""
      };
      if (str.charCodeAt(pos2) === 60) {
        pos2++;
        while (pos2 < max3) {
          code2 = str.charCodeAt(pos2);
          if (code2 === 10) {
            return result;
          }
          if (code2 === 60) {
            return result;
          }
          if (code2 === 62) {
            result.pos = pos2 + 1;
            result.str = unescapeAll(str.slice(start + 1, pos2));
            result.ok = true;
            return result;
          }
          if (code2 === 92 && pos2 + 1 < max3) {
            pos2 += 2;
            continue;
          }
          pos2++;
        }
        return result;
      }
      let level = 0;
      while (pos2 < max3) {
        code2 = str.charCodeAt(pos2);
        if (code2 === 32) {
          break;
        }
        if (code2 < 32 || code2 === 127) {
          break;
        }
        if (code2 === 92 && pos2 + 1 < max3) {
          if (str.charCodeAt(pos2 + 1) === 32) {
            break;
          }
          pos2 += 2;
          continue;
        }
        if (code2 === 40) {
          level++;
          if (level > 32) {
            return result;
          }
        }
        if (code2 === 41) {
          if (level === 0) {
            break;
          }
          level--;
        }
        pos2++;
      }
      if (start === pos2) {
        return result;
      }
      if (level !== 0) {
        return result;
      }
      result.str = unescapeAll(str.slice(start, pos2));
      result.pos = pos2;
      result.ok = true;
      return result;
    }
    function parseLinkTitle(str, start, max3, prev_state) {
      let code2;
      let pos2 = start;
      const state2 = {
        // if `true`, this is a valid link title
        ok: false,
        // if `true`, this link can be continued on the next line
        can_continue: false,
        // if `ok`, it's the position of the first character after the closing marker
        pos: 0,
        // if `ok`, it's the unescaped title
        str: "",
        // expected closing marker character code
        marker: 0
      };
      if (prev_state) {
        state2.str = prev_state.str;
        state2.marker = prev_state.marker;
      } else {
        if (pos2 >= max3) {
          return state2;
        }
        let marker = str.charCodeAt(pos2);
        if (marker !== 34 && marker !== 39 && marker !== 40) {
          return state2;
        }
        start++;
        pos2++;
        if (marker === 40) {
          marker = 41;
        }
        state2.marker = marker;
      }
      while (pos2 < max3) {
        code2 = str.charCodeAt(pos2);
        if (code2 === state2.marker) {
          state2.pos = pos2 + 1;
          state2.str += unescapeAll(str.slice(start, pos2));
          state2.ok = true;
          return state2;
        } else if (code2 === 40 && state2.marker === 41) {
          return state2;
        } else if (code2 === 92 && pos2 + 1 < max3) {
          pos2++;
        }
        pos2++;
      }
      state2.can_continue = true;
      state2.str += unescapeAll(str.slice(start, pos2));
      return state2;
    }
    var helpers = /* @__PURE__ */ Object.freeze({
      __proto__: null,
      parseLinkDestination,
      parseLinkLabel,
      parseLinkTitle
    });
    var default_rules = {};
    default_rules.code_inline = function(tokens, idx2, options, env, slf) {
      const token = tokens[idx2];
      return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
    };
    default_rules.code_block = function(tokens, idx2, options, env, slf) {
      const token = tokens[idx2];
      return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx2].content) + "</code></pre>\n";
    };
    default_rules.fence = function(tokens, idx2, options, env, slf) {
      const token = tokens[idx2];
      const info3 = token.info ? unescapeAll(token.info).trim() : "";
      let langName = "";
      let langAttrs = "";
      if (info3) {
        const arr = info3.split(/(\s+)/g);
        langName = arr[0];
        langAttrs = arr.slice(2).join("");
      }
      let highlighted;
      if (options.highlight) {
        highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
      } else {
        highlighted = escapeHtml(token.content);
      }
      if (highlighted.indexOf("<pre") === 0) {
        return highlighted + "\n";
      }
      if (info3) {
        const i = token.attrIndex("class");
        const tmpAttrs = token.attrs ? token.attrs.slice() : [];
        if (i < 0) {
          tmpAttrs.push(["class", options.langPrefix + langName]);
        } else {
          tmpAttrs[i] = tmpAttrs[i].slice();
          tmpAttrs[i][1] += " " + options.langPrefix + langName;
        }
        const tmpToken = {
          attrs: tmpAttrs
        };
        return `<pre><code${slf.renderAttrs(tmpToken)}>${highlighted}</code></pre>
`;
      }
      return `<pre><code${slf.renderAttrs(token)}>${highlighted}</code></pre>
`;
    };
    default_rules.image = function(tokens, idx2, options, env, slf) {
      const token = tokens[idx2];
      token.attrs[token.attrIndex("alt")][1] = slf.renderInlineAsText(token.children, options, env);
      return slf.renderToken(tokens, idx2, options);
    };
    default_rules.hardbreak = function(tokens, idx2, options) {
      return options.xhtmlOut ? "<br />\n" : "<br>\n";
    };
    default_rules.softbreak = function(tokens, idx2, options) {
      return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
    };
    default_rules.text = function(tokens, idx2) {
      return escapeHtml(tokens[idx2].content);
    };
    default_rules.html_block = function(tokens, idx2) {
      return tokens[idx2].content;
    };
    default_rules.html_inline = function(tokens, idx2) {
      return tokens[idx2].content;
    };
    function Renderer() {
      this.rules = assign2({}, default_rules);
    }
    Renderer.prototype.renderAttrs = function renderAttrs(token) {
      let i, l, result;
      if (!token.attrs) {
        return "";
      }
      result = "";
      for (i = 0, l = token.attrs.length; i < l; i++) {
        result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
      }
      return result;
    };
    Renderer.prototype.renderToken = function renderToken(tokens, idx2, options) {
      const token = tokens[idx2];
      let result = "";
      if (token.hidden) {
        return "";
      }
      if (token.block && token.nesting !== -1 && idx2 && tokens[idx2 - 1].hidden) {
        result += "\n";
      }
      result += (token.nesting === -1 ? "</" : "<") + token.tag;
      result += this.renderAttrs(token);
      if (token.nesting === 0 && options.xhtmlOut) {
        result += " /";
      }
      let needLf = false;
      if (token.block) {
        needLf = true;
        if (token.nesting === 1) {
          if (idx2 + 1 < tokens.length) {
            const nextToken = tokens[idx2 + 1];
            if (nextToken.type === "inline" || nextToken.hidden) {
              needLf = false;
            } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
              needLf = false;
            }
          }
        }
      }
      result += needLf ? ">\n" : ">";
      return result;
    };
    Renderer.prototype.renderInline = function(tokens, options, env) {
      let result = "";
      const rules = this.rules;
      for (let i = 0, len = tokens.length; i < len; i++) {
        const type = tokens[i].type;
        if (typeof rules[type] !== "undefined") {
          result += rules[type](tokens, i, options, env, this);
        } else {
          result += this.renderToken(tokens, i, options);
        }
      }
      return result;
    };
    Renderer.prototype.renderInlineAsText = function(tokens, options, env) {
      let result = "";
      for (let i = 0, len = tokens.length; i < len; i++) {
        switch (tokens[i].type) {
          case "text":
            result += tokens[i].content;
            break;
          case "image":
            result += this.renderInlineAsText(tokens[i].children, options, env);
            break;
          case "html_inline":
          case "html_block":
            result += tokens[i].content;
            break;
          case "softbreak":
          case "hardbreak":
            result += "\n";
            break;
        }
      }
      return result;
    };
    Renderer.prototype.render = function(tokens, options, env) {
      let result = "";
      const rules = this.rules;
      for (let i = 0, len = tokens.length; i < len; i++) {
        const type = tokens[i].type;
        if (type === "inline") {
          result += this.renderInline(tokens[i].children, options, env);
        } else if (typeof rules[type] !== "undefined") {
          result += rules[type](tokens, i, options, env, this);
        } else {
          result += this.renderToken(tokens, i, options, env);
        }
      }
      return result;
    };
    function Ruler() {
      this.__rules__ = [];
      this.__cache__ = null;
    }
    Ruler.prototype.__find__ = function(name) {
      for (let i = 0; i < this.__rules__.length; i++) {
        if (this.__rules__[i].name === name) {
          return i;
        }
      }
      return -1;
    };
    Ruler.prototype.__compile__ = function() {
      const self3 = this;
      const chains = [""];
      self3.__rules__.forEach(function(rule) {
        if (!rule.enabled) {
          return;
        }
        rule.alt.forEach(function(altName) {
          if (chains.indexOf(altName) < 0) {
            chains.push(altName);
          }
        });
      });
      self3.__cache__ = {};
      chains.forEach(function(chain) {
        self3.__cache__[chain] = [];
        self3.__rules__.forEach(function(rule) {
          if (!rule.enabled) {
            return;
          }
          if (chain && rule.alt.indexOf(chain) < 0) {
            return;
          }
          self3.__cache__[chain].push(rule.fn);
        });
      });
    };
    Ruler.prototype.at = function(name, fn, options) {
      const index6 = this.__find__(name);
      const opt = options || {};
      if (index6 === -1) {
        throw new Error("Parser rule not found: " + name);
      }
      this.__rules__[index6].fn = fn;
      this.__rules__[index6].alt = opt.alt || [];
      this.__cache__ = null;
    };
    Ruler.prototype.before = function(beforeName, ruleName, fn, options) {
      const index6 = this.__find__(beforeName);
      const opt = options || {};
      if (index6 === -1) {
        throw new Error("Parser rule not found: " + beforeName);
      }
      this.__rules__.splice(index6, 0, {
        name: ruleName,
        enabled: true,
        fn,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.after = function(afterName, ruleName, fn, options) {
      const index6 = this.__find__(afterName);
      const opt = options || {};
      if (index6 === -1) {
        throw new Error("Parser rule not found: " + afterName);
      }
      this.__rules__.splice(index6 + 1, 0, {
        name: ruleName,
        enabled: true,
        fn,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.push = function(ruleName, fn, options) {
      const opt = options || {};
      this.__rules__.push({
        name: ruleName,
        enabled: true,
        fn,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.enable = function(list2, ignoreInvalid) {
      if (!Array.isArray(list2)) {
        list2 = [list2];
      }
      const result = [];
      list2.forEach(function(name) {
        const idx2 = this.__find__(name);
        if (idx2 < 0) {
          if (ignoreInvalid) {
            return;
          }
          throw new Error("Rules manager: invalid rule name " + name);
        }
        this.__rules__[idx2].enabled = true;
        result.push(name);
      }, this);
      this.__cache__ = null;
      return result;
    };
    Ruler.prototype.enableOnly = function(list2, ignoreInvalid) {
      if (!Array.isArray(list2)) {
        list2 = [list2];
      }
      this.__rules__.forEach(function(rule) {
        rule.enabled = false;
      });
      this.enable(list2, ignoreInvalid);
    };
    Ruler.prototype.disable = function(list2, ignoreInvalid) {
      if (!Array.isArray(list2)) {
        list2 = [list2];
      }
      const result = [];
      list2.forEach(function(name) {
        const idx2 = this.__find__(name);
        if (idx2 < 0) {
          if (ignoreInvalid) {
            return;
          }
          throw new Error("Rules manager: invalid rule name " + name);
        }
        this.__rules__[idx2].enabled = false;
        result.push(name);
      }, this);
      this.__cache__ = null;
      return result;
    };
    Ruler.prototype.getRules = function(chainName) {
      if (this.__cache__ === null) {
        this.__compile__();
      }
      return this.__cache__[chainName] || [];
    };
    function Token2(type, tag2, nesting) {
      this.type = type;
      this.tag = tag2;
      this.attrs = null;
      this.map = null;
      this.nesting = nesting;
      this.level = 0;
      this.children = null;
      this.content = "";
      this.markup = "";
      this.info = "";
      this.meta = null;
      this.block = false;
      this.hidden = false;
    }
    Token2.prototype.attrIndex = function attrIndex2(name) {
      if (!this.attrs) {
        return -1;
      }
      const attrs = this.attrs;
      for (let i = 0, len = attrs.length; i < len; i++) {
        if (attrs[i][0] === name) {
          return i;
        }
      }
      return -1;
    };
    Token2.prototype.attrPush = function attrPush2(attrData) {
      if (this.attrs) {
        this.attrs.push(attrData);
      } else {
        this.attrs = [attrData];
      }
    };
    Token2.prototype.attrSet = function attrSet2(name, value2) {
      const idx2 = this.attrIndex(name);
      const attrData = [name, value2];
      if (idx2 < 0) {
        this.attrPush(attrData);
      } else {
        this.attrs[idx2] = attrData;
      }
    };
    Token2.prototype.attrGet = function attrGet2(name) {
      const idx2 = this.attrIndex(name);
      let value2 = null;
      if (idx2 >= 0) {
        value2 = this.attrs[idx2][1];
      }
      return value2;
    };
    Token2.prototype.attrJoin = function attrJoin2(name, value2) {
      const idx2 = this.attrIndex(name);
      if (idx2 < 0) {
        this.attrPush([name, value2]);
      } else {
        this.attrs[idx2][1] = this.attrs[idx2][1] + " " + value2;
      }
    };
    function StateCore(src, md, env) {
      this.src = src;
      this.env = env;
      this.tokens = [];
      this.inlineMode = false;
      this.md = md;
    }
    StateCore.prototype.Token = Token2;
    var NEWLINES_RE = /\r\n?|\n/g;
    var NULL_RE = /\0/g;
    function normalize4(state2) {
      let str;
      str = state2.src.replace(NEWLINES_RE, "\n");
      str = str.replace(NULL_RE, "\uFFFD");
      state2.src = str;
    }
    function block2(state2) {
      let token;
      if (state2.inlineMode) {
        token = new state2.Token("inline", "", 0);
        token.content = state2.src;
        token.map = [0, 1];
        token.children = [];
        state2.tokens.push(token);
      } else {
        state2.md.block.parse(state2.src, state2.md, state2.env, state2.tokens);
      }
    }
    function inline(state2) {
      const tokens = state2.tokens;
      for (let i = 0, l = tokens.length; i < l; i++) {
        const tok = tokens[i];
        if (tok.type === "inline") {
          state2.md.inline.parse(tok.content, state2.md, state2.env, tok.children);
        }
      }
    }
    function isLinkOpen$1(str) {
      return /^<a[>\s]/i.test(str);
    }
    function isLinkClose$1(str) {
      return /^<\/a\s*>/i.test(str);
    }
    function linkify$1(state2) {
      const blockTokens = state2.tokens;
      if (!state2.md.options.linkify) {
        return;
      }
      for (let j = 0, l = blockTokens.length; j < l; j++) {
        if (blockTokens[j].type !== "inline" || !state2.md.linkify.pretest(blockTokens[j].content)) {
          continue;
        }
        let tokens = blockTokens[j].children;
        let htmlLinkLevel = 0;
        for (let i = tokens.length - 1; i >= 0; i--) {
          const currentToken = tokens[i];
          if (currentToken.type === "link_close") {
            i--;
            while (tokens[i].level !== currentToken.level && tokens[i].type !== "link_open") {
              i--;
            }
            continue;
          }
          if (currentToken.type === "html_inline") {
            if (isLinkOpen$1(currentToken.content) && htmlLinkLevel > 0) {
              htmlLinkLevel--;
            }
            if (isLinkClose$1(currentToken.content)) {
              htmlLinkLevel++;
            }
          }
          if (htmlLinkLevel > 0) {
            continue;
          }
          if (currentToken.type === "text" && state2.md.linkify.test(currentToken.content)) {
            const text4 = currentToken.content;
            let links = state2.md.linkify.match(text4);
            const nodes = [];
            let level = currentToken.level;
            let lastPos = 0;
            if (links.length > 0 && links[0].index === 0 && i > 0 && tokens[i - 1].type === "text_special") {
              links = links.slice(1);
            }
            for (let ln2 = 0; ln2 < links.length; ln2++) {
              const url = links[ln2].url;
              const fullUrl = state2.md.normalizeLink(url);
              if (!state2.md.validateLink(fullUrl)) {
                continue;
              }
              let urlText = links[ln2].text;
              if (!links[ln2].schema) {
                urlText = state2.md.normalizeLinkText("http://" + urlText).replace(/^http:\/\//, "");
              } else if (links[ln2].schema === "mailto:" && !/^mailto:/i.test(urlText)) {
                urlText = state2.md.normalizeLinkText("mailto:" + urlText).replace(/^mailto:/, "");
              } else {
                urlText = state2.md.normalizeLinkText(urlText);
              }
              const pos2 = links[ln2].index;
              if (pos2 > lastPos) {
                const token = new state2.Token("text", "", 0);
                token.content = text4.slice(lastPos, pos2);
                token.level = level;
                nodes.push(token);
              }
              const token_o = new state2.Token("link_open", "a", 1);
              token_o.attrs = [["href", fullUrl]];
              token_o.level = level++;
              token_o.markup = "linkify";
              token_o.info = "auto";
              nodes.push(token_o);
              const token_t = new state2.Token("text", "", 0);
              token_t.content = urlText;
              token_t.level = level;
              nodes.push(token_t);
              const token_c = new state2.Token("link_close", "a", -1);
              token_c.level = --level;
              token_c.markup = "linkify";
              token_c.info = "auto";
              nodes.push(token_c);
              lastPos = links[ln2].lastIndex;
            }
            if (lastPos < text4.length) {
              const token = new state2.Token("text", "", 0);
              token.content = text4.slice(lastPos);
              token.level = level;
              nodes.push(token);
            }
            blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
          }
        }
      }
    }
    var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
    var SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
    var SCOPED_ABBR_RE = /\((c|tm|r)\)/ig;
    var SCOPED_ABBR = {
      c: "\xA9",
      r: "\xAE",
      tm: "\u2122"
    };
    function replaceFn(match3, name) {
      return SCOPED_ABBR[name.toLowerCase()];
    }
    function replace_scoped(inlineTokens) {
      let inside_autolink = 0;
      for (let i = inlineTokens.length - 1; i >= 0; i--) {
        const token = inlineTokens[i];
        if (token.type === "text" && !inside_autolink) {
          token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
        }
        if (token.type === "link_open" && token.info === "auto") {
          inside_autolink--;
        }
        if (token.type === "link_close" && token.info === "auto") {
          inside_autolink++;
        }
      }
    }
    function replace_rare(inlineTokens) {
      let inside_autolink = 0;
      for (let i = inlineTokens.length - 1; i >= 0; i--) {
        const token = inlineTokens[i];
        if (token.type === "text" && !inside_autolink) {
          if (RARE_RE.test(token.content)) {
            token.content = token.content.replace(/\+-/g, "\xB1").replace(/\.{2,}/g, "\u2026").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/mg, "$1\u2014").replace(/(^|\s)--(?=\s|$)/mg, "$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg, "$1\u2013");
          }
        }
        if (token.type === "link_open" && token.info === "auto") {
          inside_autolink--;
        }
        if (token.type === "link_close" && token.info === "auto") {
          inside_autolink++;
        }
      }
    }
    function replace(state2) {
      let blkIdx;
      if (!state2.md.options.typographer) {
        return;
      }
      for (blkIdx = state2.tokens.length - 1; blkIdx >= 0; blkIdx--) {
        if (state2.tokens[blkIdx].type !== "inline") {
          continue;
        }
        if (SCOPED_ABBR_TEST_RE.test(state2.tokens[blkIdx].content)) {
          replace_scoped(state2.tokens[blkIdx].children);
        }
        if (RARE_RE.test(state2.tokens[blkIdx].content)) {
          replace_rare(state2.tokens[blkIdx].children);
        }
      }
    }
    var QUOTE_TEST_RE = /['"]/;
    var QUOTE_RE = /['"]/g;
    var APOSTROPHE = "\u2019";
    function replaceAt(str, index6, ch3) {
      return str.slice(0, index6) + ch3 + str.slice(index6 + 1);
    }
    function process_inlines(tokens, state2) {
      let j;
      const stack2 = [];
      for (let i = 0; i < tokens.length; i++) {
        const token = tokens[i];
        const thisLevel = tokens[i].level;
        for (j = stack2.length - 1; j >= 0; j--) {
          if (stack2[j].level <= thisLevel) {
            break;
          }
        }
        stack2.length = j + 1;
        if (token.type !== "text") {
          continue;
        }
        let text4 = token.content;
        let pos2 = 0;
        let max3 = text4.length;
        OUTER: while (pos2 < max3) {
          QUOTE_RE.lastIndex = pos2;
          const t2 = QUOTE_RE.exec(text4);
          if (!t2) {
            break;
          }
          let canOpen = true;
          let canClose = true;
          pos2 = t2.index + 1;
          const isSingle = t2[0] === "'";
          let lastChar = 32;
          if (t2.index - 1 >= 0) {
            lastChar = text4.charCodeAt(t2.index - 1);
          } else {
            for (j = i - 1; j >= 0; j--) {
              if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
              if (!tokens[j].content) continue;
              lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
              break;
            }
          }
          let nextChar = 32;
          if (pos2 < max3) {
            nextChar = text4.charCodeAt(pos2);
          } else {
            for (j = i + 1; j < tokens.length; j++) {
              if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
              if (!tokens[j].content) continue;
              nextChar = tokens[j].content.charCodeAt(0);
              break;
            }
          }
          const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
          const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
          const isLastWhiteSpace = isWhiteSpace(lastChar);
          const isNextWhiteSpace = isWhiteSpace(nextChar);
          if (isNextWhiteSpace) {
            canOpen = false;
          } else if (isNextPunctChar) {
            if (!(isLastWhiteSpace || isLastPunctChar)) {
              canOpen = false;
            }
          }
          if (isLastWhiteSpace) {
            canClose = false;
          } else if (isLastPunctChar) {
            if (!(isNextWhiteSpace || isNextPunctChar)) {
              canClose = false;
            }
          }
          if (nextChar === 34 && t2[0] === '"') {
            if (lastChar >= 48 && lastChar <= 57) {
              canClose = canOpen = false;
            }
          }
          if (canOpen && canClose) {
            canOpen = isLastPunctChar;
            canClose = isNextPunctChar;
          }
          if (!canOpen && !canClose) {
            if (isSingle) {
              token.content = replaceAt(token.content, t2.index, APOSTROPHE);
            }
            continue;
          }
          if (canClose) {
            for (j = stack2.length - 1; j >= 0; j--) {
              let item = stack2[j];
              if (stack2[j].level < thisLevel) {
                break;
              }
              if (item.single === isSingle && stack2[j].level === thisLevel) {
                item = stack2[j];
                let openQuote;
                let closeQuote;
                if (isSingle) {
                  openQuote = state2.md.options.quotes[2];
                  closeQuote = state2.md.options.quotes[3];
                } else {
                  openQuote = state2.md.options.quotes[0];
                  closeQuote = state2.md.options.quotes[1];
                }
                token.content = replaceAt(token.content, t2.index, closeQuote);
                tokens[item.token].content = replaceAt(tokens[item.token].content, item.pos, openQuote);
                pos2 += closeQuote.length - 1;
                if (item.token === i) {
                  pos2 += openQuote.length - 1;
                }
                text4 = token.content;
                max3 = text4.length;
                stack2.length = j;
                continue OUTER;
              }
            }
          }
          if (canOpen) {
            stack2.push({
              token: i,
              pos: t2.index,
              single: isSingle,
              level: thisLevel
            });
          } else if (canClose && isSingle) {
            token.content = replaceAt(token.content, t2.index, APOSTROPHE);
          }
        }
      }
    }
    function smartquotes(state2) {
      if (!state2.md.options.typographer) {
        return;
      }
      for (let blkIdx = state2.tokens.length - 1; blkIdx >= 0; blkIdx--) {
        if (state2.tokens[blkIdx].type !== "inline" || !QUOTE_TEST_RE.test(state2.tokens[blkIdx].content)) {
          continue;
        }
        process_inlines(state2.tokens[blkIdx].children, state2);
      }
    }
    function text_join(state2) {
      let curr, last;
      const blockTokens = state2.tokens;
      const l = blockTokens.length;
      for (let j = 0; j < l; j++) {
        if (blockTokens[j].type !== "inline") continue;
        const tokens = blockTokens[j].children;
        const max3 = tokens.length;
        for (curr = 0; curr < max3; curr++) {
          if (tokens[curr].type === "text_special") {
            tokens[curr].type = "text";
          }
        }
        for (curr = last = 0; curr < max3; curr++) {
          if (tokens[curr].type === "text" && curr + 1 < max3 && tokens[curr + 1].type === "text") {
            tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
          } else {
            if (curr !== last) {
              tokens[last] = tokens[curr];
            }
            last++;
          }
        }
        if (curr !== last) {
          tokens.length = last;
        }
      }
    }
    var _rules$2 = [
      ["normalize", normalize4],
      ["block", block2],
      ["inline", inline],
      ["linkify", linkify$1],
      ["replacements", replace],
      ["smartquotes", smartquotes],
      // `text_join` finds `text_special` tokens (for escape sequences)
      // and joins them with the rest of the text
      ["text_join", text_join]
    ];
    function Core() {
      this.ruler = new Ruler();
      for (let i = 0; i < _rules$2.length; i++) {
        this.ruler.push(_rules$2[i][0], _rules$2[i][1]);
      }
    }
    Core.prototype.process = function(state2) {
      const rules = this.ruler.getRules("");
      for (let i = 0, l = rules.length; i < l; i++) {
        rules[i](state2);
      }
    };
    Core.prototype.State = StateCore;
    function StateBlock(src, md, env, tokens) {
      this.src = src;
      this.md = md;
      this.env = env;
      this.tokens = tokens;
      this.bMarks = [];
      this.eMarks = [];
      this.tShift = [];
      this.sCount = [];
      this.bsCount = [];
      this.blkIndent = 0;
      this.line = 0;
      this.lineMax = 0;
      this.tight = false;
      this.ddIndent = -1;
      this.listIndent = -1;
      this.parentType = "root";
      this.level = 0;
      const s = this.src;
      for (let start = 0, pos2 = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos2 < len; pos2++) {
        const ch3 = s.charCodeAt(pos2);
        if (!indent_found) {
          if (isSpace2(ch3)) {
            indent++;
            if (ch3 === 9) {
              offset += 4 - offset % 4;
            } else {
              offset++;
            }
            continue;
          } else {
            indent_found = true;
          }
        }
        if (ch3 === 10 || pos2 === len - 1) {
          if (ch3 !== 10) {
            pos2++;
          }
          this.bMarks.push(start);
          this.eMarks.push(pos2);
          this.tShift.push(indent);
          this.sCount.push(offset);
          this.bsCount.push(0);
          indent_found = false;
          indent = 0;
          offset = 0;
          start = pos2 + 1;
        }
      }
      this.bMarks.push(s.length);
      this.eMarks.push(s.length);
      this.tShift.push(0);
      this.sCount.push(0);
      this.bsCount.push(0);
      this.lineMax = this.bMarks.length - 1;
    }
    StateBlock.prototype.push = function(type, tag2, nesting) {
      const token = new Token2(type, tag2, nesting);
      token.block = true;
      if (nesting < 0) this.level--;
      token.level = this.level;
      if (nesting > 0) this.level++;
      this.tokens.push(token);
      return token;
    };
    StateBlock.prototype.isEmpty = function isEmpty(line) {
      return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
    };
    StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
      for (let max3 = this.lineMax; from < max3; from++) {
        if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
          break;
        }
      }
      return from;
    };
    StateBlock.prototype.skipSpaces = function skipSpaces(pos2) {
      for (let max3 = this.src.length; pos2 < max3; pos2++) {
        const ch3 = this.src.charCodeAt(pos2);
        if (!isSpace2(ch3)) {
          break;
        }
      }
      return pos2;
    };
    StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos2, min) {
      if (pos2 <= min) {
        return pos2;
      }
      while (pos2 > min) {
        if (!isSpace2(this.src.charCodeAt(--pos2))) {
          return pos2 + 1;
        }
      }
      return pos2;
    };
    StateBlock.prototype.skipChars = function skipChars(pos2, code2) {
      for (let max3 = this.src.length; pos2 < max3; pos2++) {
        if (this.src.charCodeAt(pos2) !== code2) {
          break;
        }
      }
      return pos2;
    };
    StateBlock.prototype.skipCharsBack = function skipCharsBack(pos2, code2, min) {
      if (pos2 <= min) {
        return pos2;
      }
      while (pos2 > min) {
        if (code2 !== this.src.charCodeAt(--pos2)) {
          return pos2 + 1;
        }
      }
      return pos2;
    };
    StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
      if (begin >= end) {
        return "";
      }
      const queue2 = new Array(end - begin);
      for (let i = 0, line = begin; line < end; line++, i++) {
        let lineIndent = 0;
        const lineStart = this.bMarks[line];
        let first = lineStart;
        let last;
        if (line + 1 < end || keepLastLF) {
          last = this.eMarks[line] + 1;
        } else {
          last = this.eMarks[line];
        }
        while (first < last && lineIndent < indent) {
          const ch3 = this.src.charCodeAt(first);
          if (isSpace2(ch3)) {
            if (ch3 === 9) {
              lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
            } else {
              lineIndent++;
            }
          } else if (first - lineStart < this.tShift[line]) {
            lineIndent++;
          } else {
            break;
          }
          first++;
        }
        if (lineIndent > indent) {
          queue2[i] = new Array(lineIndent - indent + 1).join(" ") + this.src.slice(first, last);
        } else {
          queue2[i] = this.src.slice(first, last);
        }
      }
      return queue2.join("");
    };
    StateBlock.prototype.Token = Token2;
    var MAX_AUTOCOMPLETED_CELLS = 65536;
    function getLine(state2, line) {
      const pos2 = state2.bMarks[line] + state2.tShift[line];
      const max3 = state2.eMarks[line];
      return state2.src.slice(pos2, max3);
    }
    function escapedSplit(str) {
      const result = [];
      const max3 = str.length;
      let pos2 = 0;
      let ch3 = str.charCodeAt(pos2);
      let isEscaped = false;
      let lastPos = 0;
      let current = "";
      while (pos2 < max3) {
        if (ch3 === 124) {
          if (!isEscaped) {
            result.push(current + str.substring(lastPos, pos2));
            current = "";
            lastPos = pos2 + 1;
          } else {
            current += str.substring(lastPos, pos2 - 1);
            lastPos = pos2;
          }
        }
        isEscaped = ch3 === 92;
        pos2++;
        ch3 = str.charCodeAt(pos2);
      }
      result.push(current + str.substring(lastPos));
      return result;
    }
    function table2(state2, startLine, endLine, silent) {
      if (startLine + 2 > endLine) {
        return false;
      }
      let nextLine = startLine + 1;
      if (state2.sCount[nextLine] < state2.blkIndent) {
        return false;
      }
      if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
        return false;
      }
      let pos2 = state2.bMarks[nextLine] + state2.tShift[nextLine];
      if (pos2 >= state2.eMarks[nextLine]) {
        return false;
      }
      const firstCh = state2.src.charCodeAt(pos2++);
      if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) {
        return false;
      }
      if (pos2 >= state2.eMarks[nextLine]) {
        return false;
      }
      const secondCh = state2.src.charCodeAt(pos2++);
      if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace2(secondCh)) {
        return false;
      }
      if (firstCh === 45 && isSpace2(secondCh)) {
        return false;
      }
      while (pos2 < state2.eMarks[nextLine]) {
        const ch3 = state2.src.charCodeAt(pos2);
        if (ch3 !== 124 && ch3 !== 45 && ch3 !== 58 && !isSpace2(ch3)) {
          return false;
        }
        pos2++;
      }
      let lineText = getLine(state2, startLine + 1);
      let columns = lineText.split("|");
      const aligns = [];
      for (let i = 0; i < columns.length; i++) {
        const t2 = columns[i].trim();
        if (!t2) {
          if (i === 0 || i === columns.length - 1) {
            continue;
          } else {
            return false;
          }
        }
        if (!/^:?-+:?$/.test(t2)) {
          return false;
        }
        if (t2.charCodeAt(t2.length - 1) === 58) {
          aligns.push(t2.charCodeAt(0) === 58 ? "center" : "right");
        } else if (t2.charCodeAt(0) === 58) {
          aligns.push("left");
        } else {
          aligns.push("");
        }
      }
      lineText = getLine(state2, startLine).trim();
      if (lineText.indexOf("|") === -1) {
        return false;
      }
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      columns = escapedSplit(lineText);
      if (columns.length && columns[0] === "") columns.shift();
      if (columns.length && columns[columns.length - 1] === "") columns.pop();
      const columnCount = columns.length;
      if (columnCount === 0 || columnCount !== aligns.length) {
        return false;
      }
      if (silent) {
        return true;
      }
      const oldParentType = state2.parentType;
      state2.parentType = "table";
      const terminatorRules = state2.md.block.ruler.getRules("blockquote");
      const token_to = state2.push("table_open", "table", 1);
      const tableLines = [startLine, 0];
      token_to.map = tableLines;
      const token_tho = state2.push("thead_open", "thead", 1);
      token_tho.map = [startLine, startLine + 1];
      const token_htro = state2.push("tr_open", "tr", 1);
      token_htro.map = [startLine, startLine + 1];
      for (let i = 0; i < columns.length; i++) {
        const token_ho = state2.push("th_open", "th", 1);
        if (aligns[i]) {
          token_ho.attrs = [["style", "text-align:" + aligns[i]]];
        }
        const token_il = state2.push("inline", "", 0);
        token_il.content = columns[i].trim();
        token_il.children = [];
        state2.push("th_close", "th", -1);
      }
      state2.push("tr_close", "tr", -1);
      state2.push("thead_close", "thead", -1);
      let tbodyLines;
      let autocompletedCells = 0;
      for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
        if (state2.sCount[nextLine] < state2.blkIndent) {
          break;
        }
        let terminate = false;
        for (let i = 0, l = terminatorRules.length; i < l; i++) {
          if (terminatorRules[i](state2, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
        lineText = getLine(state2, nextLine).trim();
        if (!lineText) {
          break;
        }
        if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
          break;
        }
        columns = escapedSplit(lineText);
        if (columns.length && columns[0] === "") columns.shift();
        if (columns.length && columns[columns.length - 1] === "") columns.pop();
        autocompletedCells += columnCount - columns.length;
        if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) {
          break;
        }
        if (nextLine === startLine + 2) {
          const token_tbo = state2.push("tbody_open", "tbody", 1);
          token_tbo.map = tbodyLines = [startLine + 2, 0];
        }
        const token_tro = state2.push("tr_open", "tr", 1);
        token_tro.map = [nextLine, nextLine + 1];
        for (let i = 0; i < columnCount; i++) {
          const token_tdo = state2.push("td_open", "td", 1);
          if (aligns[i]) {
            token_tdo.attrs = [["style", "text-align:" + aligns[i]]];
          }
          const token_il = state2.push("inline", "", 0);
          token_il.content = columns[i] ? columns[i].trim() : "";
          token_il.children = [];
          state2.push("td_close", "td", -1);
        }
        state2.push("tr_close", "tr", -1);
      }
      if (tbodyLines) {
        state2.push("tbody_close", "tbody", -1);
        tbodyLines[1] = nextLine;
      }
      state2.push("table_close", "table", -1);
      tableLines[1] = nextLine;
      state2.parentType = oldParentType;
      state2.line = nextLine;
      return true;
    }
    function code(state2, startLine, endLine) {
      if (state2.sCount[startLine] - state2.blkIndent < 4) {
        return false;
      }
      let nextLine = startLine + 1;
      let last = nextLine;
      while (nextLine < endLine) {
        if (state2.isEmpty(nextLine)) {
          nextLine++;
          continue;
        }
        if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
          nextLine++;
          last = nextLine;
          continue;
        }
        break;
      }
      state2.line = last;
      const token = state2.push("code_block", "code", 0);
      token.content = state2.getLines(startLine, last, 4 + state2.blkIndent, false) + "\n";
      token.map = [startLine, state2.line];
      return true;
    }
    function fence(state2, startLine, endLine, silent) {
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      let max3 = state2.eMarks[startLine];
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      if (pos2 + 3 > max3) {
        return false;
      }
      const marker = state2.src.charCodeAt(pos2);
      if (marker !== 126 && marker !== 96) {
        return false;
      }
      let mem = pos2;
      pos2 = state2.skipChars(pos2, marker);
      let len = pos2 - mem;
      if (len < 3) {
        return false;
      }
      const markup = state2.src.slice(mem, pos2);
      const params = state2.src.slice(pos2, max3);
      if (marker === 96) {
        if (params.indexOf(String.fromCharCode(marker)) >= 0) {
          return false;
        }
      }
      if (silent) {
        return true;
      }
      let nextLine = startLine;
      let haveEndMarker = false;
      for (; ; ) {
        nextLine++;
        if (nextLine >= endLine) {
          break;
        }
        pos2 = mem = state2.bMarks[nextLine] + state2.tShift[nextLine];
        max3 = state2.eMarks[nextLine];
        if (pos2 < max3 && state2.sCount[nextLine] < state2.blkIndent) {
          break;
        }
        if (state2.src.charCodeAt(pos2) !== marker) {
          continue;
        }
        if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
          continue;
        }
        pos2 = state2.skipChars(pos2, marker);
        if (pos2 - mem < len) {
          continue;
        }
        pos2 = state2.skipSpaces(pos2);
        if (pos2 < max3) {
          continue;
        }
        haveEndMarker = true;
        break;
      }
      len = state2.sCount[startLine];
      state2.line = nextLine + (haveEndMarker ? 1 : 0);
      const token = state2.push("fence", "code", 0);
      token.info = params;
      token.content = state2.getLines(startLine + 1, nextLine, len, true);
      token.markup = markup;
      token.map = [startLine, state2.line];
      return true;
    }
    function blockquote(state2, startLine, endLine, silent) {
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      let max3 = state2.eMarks[startLine];
      const oldLineMax = state2.lineMax;
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      if (state2.src.charCodeAt(pos2) !== 62) {
        return false;
      }
      if (silent) {
        return true;
      }
      const oldBMarks = [];
      const oldBSCount = [];
      const oldSCount = [];
      const oldTShift = [];
      const terminatorRules = state2.md.block.ruler.getRules("blockquote");
      const oldParentType = state2.parentType;
      state2.parentType = "blockquote";
      let lastLineEmpty = false;
      let nextLine;
      for (nextLine = startLine; nextLine < endLine; nextLine++) {
        const isOutdented = state2.sCount[nextLine] < state2.blkIndent;
        pos2 = state2.bMarks[nextLine] + state2.tShift[nextLine];
        max3 = state2.eMarks[nextLine];
        if (pos2 >= max3) {
          break;
        }
        if (state2.src.charCodeAt(pos2++) === 62 && !isOutdented) {
          let initial = state2.sCount[nextLine] + 1;
          let spaceAfterMarker;
          let adjustTab;
          if (state2.src.charCodeAt(pos2) === 32) {
            pos2++;
            initial++;
            adjustTab = false;
            spaceAfterMarker = true;
          } else if (state2.src.charCodeAt(pos2) === 9) {
            spaceAfterMarker = true;
            if ((state2.bsCount[nextLine] + initial) % 4 === 3) {
              pos2++;
              initial++;
              adjustTab = false;
            } else {
              adjustTab = true;
            }
          } else {
            spaceAfterMarker = false;
          }
          let offset = initial;
          oldBMarks.push(state2.bMarks[nextLine]);
          state2.bMarks[nextLine] = pos2;
          while (pos2 < max3) {
            const ch3 = state2.src.charCodeAt(pos2);
            if (isSpace2(ch3)) {
              if (ch3 === 9) {
                offset += 4 - (offset + state2.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
              } else {
                offset++;
              }
            } else {
              break;
            }
            pos2++;
          }
          lastLineEmpty = pos2 >= max3;
          oldBSCount.push(state2.bsCount[nextLine]);
          state2.bsCount[nextLine] = state2.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
          oldSCount.push(state2.sCount[nextLine]);
          state2.sCount[nextLine] = offset - initial;
          oldTShift.push(state2.tShift[nextLine]);
          state2.tShift[nextLine] = pos2 - state2.bMarks[nextLine];
          continue;
        }
        if (lastLineEmpty) {
          break;
        }
        let terminate = false;
        for (let i = 0, l = terminatorRules.length; i < l; i++) {
          if (terminatorRules[i](state2, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          state2.lineMax = nextLine;
          if (state2.blkIndent !== 0) {
            oldBMarks.push(state2.bMarks[nextLine]);
            oldBSCount.push(state2.bsCount[nextLine]);
            oldTShift.push(state2.tShift[nextLine]);
            oldSCount.push(state2.sCount[nextLine]);
            state2.sCount[nextLine] -= state2.blkIndent;
          }
          break;
        }
        oldBMarks.push(state2.bMarks[nextLine]);
        oldBSCount.push(state2.bsCount[nextLine]);
        oldTShift.push(state2.tShift[nextLine]);
        oldSCount.push(state2.sCount[nextLine]);
        state2.sCount[nextLine] = -1;
      }
      const oldIndent = state2.blkIndent;
      state2.blkIndent = 0;
      const token_o = state2.push("blockquote_open", "blockquote", 1);
      token_o.markup = ">";
      const lines = [startLine, 0];
      token_o.map = lines;
      state2.md.block.tokenize(state2, startLine, nextLine);
      const token_c = state2.push("blockquote_close", "blockquote", -1);
      token_c.markup = ">";
      state2.lineMax = oldLineMax;
      state2.parentType = oldParentType;
      lines[1] = state2.line;
      for (let i = 0; i < oldTShift.length; i++) {
        state2.bMarks[i + startLine] = oldBMarks[i];
        state2.tShift[i + startLine] = oldTShift[i];
        state2.sCount[i + startLine] = oldSCount[i];
        state2.bsCount[i + startLine] = oldBSCount[i];
      }
      state2.blkIndent = oldIndent;
      return true;
    }
    function hr(state2, startLine, endLine, silent) {
      const max3 = state2.eMarks[startLine];
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      const marker = state2.src.charCodeAt(pos2++);
      if (marker !== 42 && marker !== 45 && marker !== 95) {
        return false;
      }
      let cnt = 1;
      while (pos2 < max3) {
        const ch3 = state2.src.charCodeAt(pos2++);
        if (ch3 !== marker && !isSpace2(ch3)) {
          return false;
        }
        if (ch3 === marker) {
          cnt++;
        }
      }
      if (cnt < 3) {
        return false;
      }
      if (silent) {
        return true;
      }
      state2.line = startLine + 1;
      const token = state2.push("hr", "hr", 0);
      token.map = [startLine, state2.line];
      token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
      return true;
    }
    function skipBulletListMarker(state2, startLine) {
      const max3 = state2.eMarks[startLine];
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      const marker = state2.src.charCodeAt(pos2++);
      if (marker !== 42 && marker !== 45 && marker !== 43) {
        return -1;
      }
      if (pos2 < max3) {
        const ch3 = state2.src.charCodeAt(pos2);
        if (!isSpace2(ch3)) {
          return -1;
        }
      }
      return pos2;
    }
    function skipOrderedListMarker(state2, startLine) {
      const start = state2.bMarks[startLine] + state2.tShift[startLine];
      const max3 = state2.eMarks[startLine];
      let pos2 = start;
      if (pos2 + 1 >= max3) {
        return -1;
      }
      let ch3 = state2.src.charCodeAt(pos2++);
      if (ch3 < 48 || ch3 > 57) {
        return -1;
      }
      for (; ; ) {
        if (pos2 >= max3) {
          return -1;
        }
        ch3 = state2.src.charCodeAt(pos2++);
        if (ch3 >= 48 && ch3 <= 57) {
          if (pos2 - start >= 10) {
            return -1;
          }
          continue;
        }
        if (ch3 === 41 || ch3 === 46) {
          break;
        }
        return -1;
      }
      if (pos2 < max3) {
        ch3 = state2.src.charCodeAt(pos2);
        if (!isSpace2(ch3)) {
          return -1;
        }
      }
      return pos2;
    }
    function markTightParagraphs(state2, idx2) {
      const level = state2.level + 2;
      for (let i = idx2 + 2, l = state2.tokens.length - 2; i < l; i++) {
        if (state2.tokens[i].level === level && state2.tokens[i].type === "paragraph_open") {
          state2.tokens[i + 2].hidden = true;
          state2.tokens[i].hidden = true;
          i += 2;
        }
      }
    }
    function list(state2, startLine, endLine, silent) {
      let max3, pos2, start, token;
      let nextLine = startLine;
      let tight = true;
      if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
        return false;
      }
      if (state2.listIndent >= 0 && state2.sCount[nextLine] - state2.listIndent >= 4 && state2.sCount[nextLine] < state2.blkIndent) {
        return false;
      }
      let isTerminatingParagraph = false;
      if (silent && state2.parentType === "paragraph") {
        if (state2.sCount[nextLine] >= state2.blkIndent) {
          isTerminatingParagraph = true;
        }
      }
      let isOrdered;
      let markerValue;
      let posAfterMarker;
      if ((posAfterMarker = skipOrderedListMarker(state2, nextLine)) >= 0) {
        isOrdered = true;
        start = state2.bMarks[nextLine] + state2.tShift[nextLine];
        markerValue = Number(state2.src.slice(start, posAfterMarker - 1));
        if (isTerminatingParagraph && markerValue !== 1) return false;
      } else if ((posAfterMarker = skipBulletListMarker(state2, nextLine)) >= 0) {
        isOrdered = false;
      } else {
        return false;
      }
      if (isTerminatingParagraph) {
        if (state2.skipSpaces(posAfterMarker) >= state2.eMarks[nextLine]) return false;
      }
      if (silent) {
        return true;
      }
      const markerCharCode = state2.src.charCodeAt(posAfterMarker - 1);
      const listTokIdx = state2.tokens.length;
      if (isOrdered) {
        token = state2.push("ordered_list_open", "ol", 1);
        if (markerValue !== 1) {
          token.attrs = [["start", markerValue]];
        }
      } else {
        token = state2.push("bullet_list_open", "ul", 1);
      }
      const listLines = [nextLine, 0];
      token.map = listLines;
      token.markup = String.fromCharCode(markerCharCode);
      let prevEmptyEnd = false;
      const terminatorRules = state2.md.block.ruler.getRules("list");
      const oldParentType = state2.parentType;
      state2.parentType = "list";
      while (nextLine < endLine) {
        pos2 = posAfterMarker;
        max3 = state2.eMarks[nextLine];
        const initial = state2.sCount[nextLine] + posAfterMarker - (state2.bMarks[nextLine] + state2.tShift[nextLine]);
        let offset = initial;
        while (pos2 < max3) {
          const ch3 = state2.src.charCodeAt(pos2);
          if (ch3 === 9) {
            offset += 4 - (offset + state2.bsCount[nextLine]) % 4;
          } else if (ch3 === 32) {
            offset++;
          } else {
            break;
          }
          pos2++;
        }
        const contentStart = pos2;
        let indentAfterMarker;
        if (contentStart >= max3) {
          indentAfterMarker = 1;
        } else {
          indentAfterMarker = offset - initial;
        }
        if (indentAfterMarker > 4) {
          indentAfterMarker = 1;
        }
        const indent = initial + indentAfterMarker;
        token = state2.push("list_item_open", "li", 1);
        token.markup = String.fromCharCode(markerCharCode);
        const itemLines = [nextLine, 0];
        token.map = itemLines;
        if (isOrdered) {
          token.info = state2.src.slice(start, posAfterMarker - 1);
        }
        const oldTight = state2.tight;
        const oldTShift = state2.tShift[nextLine];
        const oldSCount = state2.sCount[nextLine];
        const oldListIndent = state2.listIndent;
        state2.listIndent = state2.blkIndent;
        state2.blkIndent = indent;
        state2.tight = true;
        state2.tShift[nextLine] = contentStart - state2.bMarks[nextLine];
        state2.sCount[nextLine] = offset;
        if (contentStart >= max3 && state2.isEmpty(nextLine + 1)) {
          state2.line = Math.min(state2.line + 2, endLine);
        } else {
          state2.md.block.tokenize(state2, nextLine, endLine, true);
        }
        if (!state2.tight || prevEmptyEnd) {
          tight = false;
        }
        prevEmptyEnd = state2.line - nextLine > 1 && state2.isEmpty(state2.line - 1);
        state2.blkIndent = state2.listIndent;
        state2.listIndent = oldListIndent;
        state2.tShift[nextLine] = oldTShift;
        state2.sCount[nextLine] = oldSCount;
        state2.tight = oldTight;
        token = state2.push("list_item_close", "li", -1);
        token.markup = String.fromCharCode(markerCharCode);
        nextLine = state2.line;
        itemLines[1] = nextLine;
        if (nextLine >= endLine) {
          break;
        }
        if (state2.sCount[nextLine] < state2.blkIndent) {
          break;
        }
        if (state2.sCount[nextLine] - state2.blkIndent >= 4) {
          break;
        }
        let terminate = false;
        for (let i = 0, l = terminatorRules.length; i < l; i++) {
          if (terminatorRules[i](state2, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
        if (isOrdered) {
          posAfterMarker = skipOrderedListMarker(state2, nextLine);
          if (posAfterMarker < 0) {
            break;
          }
          start = state2.bMarks[nextLine] + state2.tShift[nextLine];
        } else {
          posAfterMarker = skipBulletListMarker(state2, nextLine);
          if (posAfterMarker < 0) {
            break;
          }
        }
        if (markerCharCode !== state2.src.charCodeAt(posAfterMarker - 1)) {
          break;
        }
      }
      if (isOrdered) {
        token = state2.push("ordered_list_close", "ol", -1);
      } else {
        token = state2.push("bullet_list_close", "ul", -1);
      }
      token.markup = String.fromCharCode(markerCharCode);
      listLines[1] = nextLine;
      state2.line = nextLine;
      state2.parentType = oldParentType;
      if (tight) {
        markTightParagraphs(state2, listTokIdx);
      }
      return true;
    }
    function reference(state2, startLine, _endLine, silent) {
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      let max3 = state2.eMarks[startLine];
      let nextLine = startLine + 1;
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      if (state2.src.charCodeAt(pos2) !== 91) {
        return false;
      }
      function getNextLine(nextLine2) {
        const endLine = state2.lineMax;
        if (nextLine2 >= endLine || state2.isEmpty(nextLine2)) {
          return null;
        }
        let isContinuation = false;
        if (state2.sCount[nextLine2] - state2.blkIndent > 3) {
          isContinuation = true;
        }
        if (state2.sCount[nextLine2] < 0) {
          isContinuation = true;
        }
        if (!isContinuation) {
          const terminatorRules = state2.md.block.ruler.getRules("reference");
          const oldParentType = state2.parentType;
          state2.parentType = "reference";
          let terminate = false;
          for (let i = 0, l = terminatorRules.length; i < l; i++) {
            if (terminatorRules[i](state2, nextLine2, endLine, true)) {
              terminate = true;
              break;
            }
          }
          state2.parentType = oldParentType;
          if (terminate) {
            return null;
          }
        }
        const pos3 = state2.bMarks[nextLine2] + state2.tShift[nextLine2];
        const max4 = state2.eMarks[nextLine2];
        return state2.src.slice(pos3, max4 + 1);
      }
      let str = state2.src.slice(pos2, max3 + 1);
      max3 = str.length;
      let labelEnd = -1;
      for (pos2 = 1; pos2 < max3; pos2++) {
        const ch3 = str.charCodeAt(pos2);
        if (ch3 === 91) {
          return false;
        } else if (ch3 === 93) {
          labelEnd = pos2;
          break;
        } else if (ch3 === 10) {
          const lineContent = getNextLine(nextLine);
          if (lineContent !== null) {
            str += lineContent;
            max3 = str.length;
            nextLine++;
          }
        } else if (ch3 === 92) {
          pos2++;
          if (pos2 < max3 && str.charCodeAt(pos2) === 10) {
            const lineContent = getNextLine(nextLine);
            if (lineContent !== null) {
              str += lineContent;
              max3 = str.length;
              nextLine++;
            }
          }
        }
      }
      if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) {
        return false;
      }
      for (pos2 = labelEnd + 2; pos2 < max3; pos2++) {
        const ch3 = str.charCodeAt(pos2);
        if (ch3 === 10) {
          const lineContent = getNextLine(nextLine);
          if (lineContent !== null) {
            str += lineContent;
            max3 = str.length;
            nextLine++;
          }
        } else if (isSpace2(ch3)) ;
        else {
          break;
        }
      }
      const destRes = state2.md.helpers.parseLinkDestination(str, pos2, max3);
      if (!destRes.ok) {
        return false;
      }
      const href = state2.md.normalizeLink(destRes.str);
      if (!state2.md.validateLink(href)) {
        return false;
      }
      pos2 = destRes.pos;
      const destEndPos = pos2;
      const destEndLineNo = nextLine;
      const start = pos2;
      for (; pos2 < max3; pos2++) {
        const ch3 = str.charCodeAt(pos2);
        if (ch3 === 10) {
          const lineContent = getNextLine(nextLine);
          if (lineContent !== null) {
            str += lineContent;
            max3 = str.length;
            nextLine++;
          }
        } else if (isSpace2(ch3)) ;
        else {
          break;
        }
      }
      let titleRes = state2.md.helpers.parseLinkTitle(str, pos2, max3);
      while (titleRes.can_continue) {
        const lineContent = getNextLine(nextLine);
        if (lineContent === null) break;
        str += lineContent;
        pos2 = max3;
        max3 = str.length;
        nextLine++;
        titleRes = state2.md.helpers.parseLinkTitle(str, pos2, max3, titleRes);
      }
      let title;
      if (pos2 < max3 && start !== pos2 && titleRes.ok) {
        title = titleRes.str;
        pos2 = titleRes.pos;
      } else {
        title = "";
        pos2 = destEndPos;
        nextLine = destEndLineNo;
      }
      while (pos2 < max3) {
        const ch3 = str.charCodeAt(pos2);
        if (!isSpace2(ch3)) {
          break;
        }
        pos2++;
      }
      if (pos2 < max3 && str.charCodeAt(pos2) !== 10) {
        if (title) {
          title = "";
          pos2 = destEndPos;
          nextLine = destEndLineNo;
          while (pos2 < max3) {
            const ch3 = str.charCodeAt(pos2);
            if (!isSpace2(ch3)) {
              break;
            }
            pos2++;
          }
        }
      }
      if (pos2 < max3 && str.charCodeAt(pos2) !== 10) {
        return false;
      }
      const label = normalizeReference(str.slice(1, labelEnd));
      if (!label) {
        return false;
      }
      if (silent) {
        return true;
      }
      if (typeof state2.env.references === "undefined") {
        state2.env.references = {};
      }
      if (typeof state2.env.references[label] === "undefined") {
        state2.env.references[label] = {
          title,
          href
        };
      }
      state2.line = nextLine;
      return true;
    }
    var block_names = ["address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "search", "section", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"];
    var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
    var unquoted = "[^\"'=<>`\\x00-\\x20]+";
    var single_quoted = "'[^']*'";
    var double_quoted = '"[^"]*"';
    var attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
    var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
    var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
    var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
    var comment2 = "<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->";
    var processing = "<[?][\\s\\S]*?[?]>";
    var declaration = "<![A-Za-z][^>]*>";
    var cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>";
    var HTML_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + "|" + comment2 + "|" + processing + "|" + declaration + "|" + cdata + ")");
    var HTML_OPEN_CLOSE_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + ")");
    var HTML_SEQUENCES = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true], [/^<!--/, /-->/, true], [/^<\?/, /\?>/, true], [/^<![A-Z]/, />/, true], [/^<!\[CDATA\[/, /\]\]>/, true], [new RegExp("^</?(" + block_names.join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, true], [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"), /^$/, false]];
    function html_block(state2, startLine, endLine, silent) {
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      let max3 = state2.eMarks[startLine];
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      if (!state2.md.options.html) {
        return false;
      }
      if (state2.src.charCodeAt(pos2) !== 60) {
        return false;
      }
      let lineText = state2.src.slice(pos2, max3);
      let i = 0;
      for (; i < HTML_SEQUENCES.length; i++) {
        if (HTML_SEQUENCES[i][0].test(lineText)) {
          break;
        }
      }
      if (i === HTML_SEQUENCES.length) {
        return false;
      }
      if (silent) {
        return HTML_SEQUENCES[i][2];
      }
      let nextLine = startLine + 1;
      if (!HTML_SEQUENCES[i][1].test(lineText)) {
        for (; nextLine < endLine; nextLine++) {
          if (state2.sCount[nextLine] < state2.blkIndent) {
            break;
          }
          pos2 = state2.bMarks[nextLine] + state2.tShift[nextLine];
          max3 = state2.eMarks[nextLine];
          lineText = state2.src.slice(pos2, max3);
          if (HTML_SEQUENCES[i][1].test(lineText)) {
            if (lineText.length !== 0) {
              nextLine++;
            }
            break;
          }
        }
      }
      state2.line = nextLine;
      const token = state2.push("html_block", "", 0);
      token.map = [startLine, nextLine];
      token.content = state2.getLines(startLine, nextLine, state2.blkIndent, true);
      return true;
    }
    function heading(state2, startLine, endLine, silent) {
      let pos2 = state2.bMarks[startLine] + state2.tShift[startLine];
      let max3 = state2.eMarks[startLine];
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      let ch3 = state2.src.charCodeAt(pos2);
      if (ch3 !== 35 || pos2 >= max3) {
        return false;
      }
      let level = 1;
      ch3 = state2.src.charCodeAt(++pos2);
      while (ch3 === 35 && pos2 < max3 && level <= 6) {
        level++;
        ch3 = state2.src.charCodeAt(++pos2);
      }
      if (level > 6 || pos2 < max3 && !isSpace2(ch3)) {
        return false;
      }
      if (silent) {
        return true;
      }
      max3 = state2.skipSpacesBack(max3, pos2);
      const tmp = state2.skipCharsBack(max3, 35, pos2);
      if (tmp > pos2 && isSpace2(state2.src.charCodeAt(tmp - 1))) {
        max3 = tmp;
      }
      state2.line = startLine + 1;
      const token_o = state2.push("heading_open", "h" + String(level), 1);
      token_o.markup = "########".slice(0, level);
      token_o.map = [startLine, state2.line];
      const token_i = state2.push("inline", "", 0);
      token_i.content = state2.src.slice(pos2, max3).trim();
      token_i.map = [startLine, state2.line];
      token_i.children = [];
      const token_c = state2.push("heading_close", "h" + String(level), -1);
      token_c.markup = "########".slice(0, level);
      return true;
    }
    function lheading(state2, startLine, endLine) {
      const terminatorRules = state2.md.block.ruler.getRules("paragraph");
      if (state2.sCount[startLine] - state2.blkIndent >= 4) {
        return false;
      }
      const oldParentType = state2.parentType;
      state2.parentType = "paragraph";
      let level = 0;
      let marker;
      let nextLine = startLine + 1;
      for (; nextLine < endLine && !state2.isEmpty(nextLine); nextLine++) {
        if (state2.sCount[nextLine] - state2.blkIndent > 3) {
          continue;
        }
        if (state2.sCount[nextLine] >= state2.blkIndent) {
          let pos2 = state2.bMarks[nextLine] + state2.tShift[nextLine];
          const max3 = state2.eMarks[nextLine];
          if (pos2 < max3) {
            marker = state2.src.charCodeAt(pos2);
            if (marker === 45 || marker === 61) {
              pos2 = state2.skipChars(pos2, marker);
              pos2 = state2.skipSpaces(pos2);
              if (pos2 >= max3) {
                level = marker === 61 ? 1 : 2;
                break;
              }
            }
          }
        }
        if (state2.sCount[nextLine] < 0) {
          continue;
        }
        let terminate = false;
        for (let i = 0, l = terminatorRules.length; i < l; i++) {
          if (terminatorRules[i](state2, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
      }
      if (!level) {
        return false;
      }
      const content = state2.getLines(startLine, nextLine, state2.blkIndent, false).trim();
      state2.line = nextLine + 1;
      const token_o = state2.push("heading_open", "h" + String(level), 1);
      token_o.markup = String.fromCharCode(marker);
      token_o.map = [startLine, state2.line];
      const token_i = state2.push("inline", "", 0);
      token_i.content = content;
      token_i.map = [startLine, state2.line - 1];
      token_i.children = [];
      const token_c = state2.push("heading_close", "h" + String(level), -1);
      token_c.markup = String.fromCharCode(marker);
      state2.parentType = oldParentType;
      return true;
    }
    function paragraph(state2, startLine, endLine) {
      const terminatorRules = state2.md.block.ruler.getRules("paragraph");
      const oldParentType = state2.parentType;
      let nextLine = startLine + 1;
      state2.parentType = "paragraph";
      for (; nextLine < endLine && !state2.isEmpty(nextLine); nextLine++) {
        if (state2.sCount[nextLine] - state2.blkIndent > 3) {
          continue;
        }
        if (state2.sCount[nextLine] < 0) {
          continue;
        }
        let terminate = false;
        for (let i = 0, l = terminatorRules.length; i < l; i++) {
          if (terminatorRules[i](state2, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
      }
      const content = state2.getLines(startLine, nextLine, state2.blkIndent, false).trim();
      state2.line = nextLine;
      const token_o = state2.push("paragraph_open", "p", 1);
      token_o.map = [startLine, state2.line];
      const token_i = state2.push("inline", "", 0);
      token_i.content = content;
      token_i.map = [startLine, state2.line];
      token_i.children = [];
      state2.push("paragraph_close", "p", -1);
      state2.parentType = oldParentType;
      return true;
    }
    var _rules$1 = [
      // First 2 params - rule name & source. Secondary array - list of rules,
      // which can be terminated by this one.
      ["table", table2, ["paragraph", "reference"]],
      ["code", code],
      ["fence", fence, ["paragraph", "reference", "blockquote", "list"]],
      ["blockquote", blockquote, ["paragraph", "reference", "blockquote", "list"]],
      ["hr", hr, ["paragraph", "reference", "blockquote", "list"]],
      ["list", list, ["paragraph", "reference", "blockquote"]],
      ["reference", reference],
      ["html_block", html_block, ["paragraph", "reference", "blockquote"]],
      ["heading", heading, ["paragraph", "reference", "blockquote"]],
      ["lheading", lheading],
      ["paragraph", paragraph]
    ];
    function ParserBlock() {
      this.ruler = new Ruler();
      for (let i = 0; i < _rules$1.length; i++) {
        this.ruler.push(_rules$1[i][0], _rules$1[i][1], {
          alt: (_rules$1[i][2] || []).slice()
        });
      }
    }
    ParserBlock.prototype.tokenize = function(state2, startLine, endLine) {
      const rules = this.ruler.getRules("");
      const len = rules.length;
      const maxNesting = state2.md.options.maxNesting;
      let line = startLine;
      let hasEmptyLines = false;
      while (line < endLine) {
        state2.line = line = state2.skipEmptyLines(line);
        if (line >= endLine) {
          break;
        }
        if (state2.sCount[line] < state2.blkIndent) {
          break;
        }
        if (state2.level >= maxNesting) {
          state2.line = endLine;
          break;
        }
        const prevLine = state2.line;
        let ok = false;
        for (let i = 0; i < len; i++) {
          ok = rules[i](state2, line, endLine, false);
          if (ok) {
            if (prevLine >= state2.line) {
              throw new Error("block rule didn't increment state.line");
            }
            break;
          }
        }
        if (!ok) throw new Error("none of the block rules matched");
        state2.tight = !hasEmptyLines;
        if (state2.isEmpty(state2.line - 1)) {
          hasEmptyLines = true;
        }
        line = state2.line;
        if (line < endLine && state2.isEmpty(line)) {
          hasEmptyLines = true;
          line++;
          state2.line = line;
        }
      }
    };
    ParserBlock.prototype.parse = function(src, md, env, outTokens) {
      if (!src) {
        return;
      }
      const state2 = new this.State(src, md, env, outTokens);
      this.tokenize(state2, state2.line, state2.lineMax);
    };
    ParserBlock.prototype.State = StateBlock;
    function StateInline(src, md, env, outTokens) {
      this.src = src;
      this.env = env;
      this.md = md;
      this.tokens = outTokens;
      this.tokens_meta = Array(outTokens.length);
      this.pos = 0;
      this.posMax = this.src.length;
      this.level = 0;
      this.pending = "";
      this.pendingLevel = 0;
      this.cache = {};
      this.delimiters = [];
      this._prev_delimiters = [];
      this.backticks = {};
      this.backticksScanned = false;
      this.linkLevel = 0;
    }
    StateInline.prototype.pushPending = function() {
      const token = new Token2("text", "", 0);
      token.content = this.pending;
      token.level = this.pendingLevel;
      this.tokens.push(token);
      this.pending = "";
      return token;
    };
    StateInline.prototype.push = function(type, tag2, nesting) {
      if (this.pending) {
        this.pushPending();
      }
      const token = new Token2(type, tag2, nesting);
      let token_meta = null;
      if (nesting < 0) {
        this.level--;
        this.delimiters = this._prev_delimiters.pop();
      }
      token.level = this.level;
      if (nesting > 0) {
        this.level++;
        this._prev_delimiters.push(this.delimiters);
        this.delimiters = [];
        token_meta = {
          delimiters: this.delimiters
        };
      }
      this.pendingLevel = this.level;
      this.tokens.push(token);
      this.tokens_meta.push(token_meta);
      return token;
    };
    StateInline.prototype.scanDelims = function(start, canSplitWord) {
      const max3 = this.posMax;
      const marker = this.src.charCodeAt(start);
      const lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 32;
      let pos2 = start;
      while (pos2 < max3 && this.src.charCodeAt(pos2) === marker) {
        pos2++;
      }
      const count = pos2 - start;
      const nextChar = pos2 < max3 ? this.src.charCodeAt(pos2) : 32;
      const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
      const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
      const isLastWhiteSpace = isWhiteSpace(lastChar);
      const isNextWhiteSpace = isWhiteSpace(nextChar);
      const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
      const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
      const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
      const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
      return {
        can_open,
        can_close,
        length: count
      };
    };
    StateInline.prototype.Token = Token2;
    function isTerminatorChar(ch3) {
      switch (ch3) {
        case 10:
        case 33:
        case 35:
        case 36:
        case 37:
        case 38:
        case 42:
        case 43:
        case 45:
        case 58:
        case 60:
        case 61:
        case 62:
        case 64:
        case 91:
        case 92:
        case 93:
        case 94:
        case 95:
        case 96:
        case 123:
        case 125:
        case 126:
          return true;
        default:
          return false;
      }
    }
    function text3(state2, silent) {
      let pos2 = state2.pos;
      while (pos2 < state2.posMax && !isTerminatorChar(state2.src.charCodeAt(pos2))) {
        pos2++;
      }
      if (pos2 === state2.pos) {
        return false;
      }
      if (!silent) {
        state2.pending += state2.src.slice(state2.pos, pos2);
      }
      state2.pos = pos2;
      return true;
    }
    var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
    function linkify(state2, silent) {
      if (!state2.md.options.linkify) return false;
      if (state2.linkLevel > 0) return false;
      const pos2 = state2.pos;
      const max3 = state2.posMax;
      if (pos2 + 3 > max3) return false;
      if (state2.src.charCodeAt(pos2) !== 58) return false;
      if (state2.src.charCodeAt(pos2 + 1) !== 47) return false;
      if (state2.src.charCodeAt(pos2 + 2) !== 47) return false;
      const match3 = state2.pending.match(SCHEME_RE);
      if (!match3) return false;
      const proto = match3[1];
      const link3 = state2.md.linkify.matchAtStart(state2.src.slice(pos2 - proto.length));
      if (!link3) return false;
      let url = link3.url;
      if (url.length <= proto.length) return false;
      let urlEnd = url.length;
      while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) {
        urlEnd--;
      }
      if (urlEnd !== url.length) {
        url = url.slice(0, urlEnd);
      }
      const fullUrl = state2.md.normalizeLink(url);
      if (!state2.md.validateLink(fullUrl)) return false;
      if (!silent) {
        state2.pending = state2.pending.slice(0, -proto.length);
        const token_o = state2.push("link_open", "a", 1);
        token_o.attrs = [["href", fullUrl]];
        token_o.markup = "linkify";
        token_o.info = "auto";
        const token_t = state2.push("text", "", 0);
        token_t.content = state2.md.normalizeLinkText(url);
        const token_c = state2.push("link_close", "a", -1);
        token_c.markup = "linkify";
        token_c.info = "auto";
      }
      state2.pos += url.length - proto.length;
      return true;
    }
    function newline(state2, silent) {
      let pos2 = state2.pos;
      if (state2.src.charCodeAt(pos2) !== 10) {
        return false;
      }
      const pmax = state2.pending.length - 1;
      const max3 = state2.posMax;
      if (!silent) {
        if (pmax >= 0 && state2.pending.charCodeAt(pmax) === 32) {
          if (pmax >= 1 && state2.pending.charCodeAt(pmax - 1) === 32) {
            let ws = pmax - 1;
            while (ws >= 1 && state2.pending.charCodeAt(ws - 1) === 32) ws--;
            state2.pending = state2.pending.slice(0, ws);
            state2.push("hardbreak", "br", 0);
          } else {
            state2.pending = state2.pending.slice(0, -1);
            state2.push("softbreak", "br", 0);
          }
        } else {
          state2.push("softbreak", "br", 0);
        }
      }
      pos2++;
      while (pos2 < max3 && isSpace2(state2.src.charCodeAt(pos2))) {
        pos2++;
      }
      state2.pos = pos2;
      return true;
    }
    var ESCAPED = [];
    for (let i = 0; i < 256; i++) {
      ESCAPED.push(0);
    }
    "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch3) {
      ESCAPED[ch3.charCodeAt(0)] = 1;
    });
    function escape3(state2, silent) {
      let pos2 = state2.pos;
      const max3 = state2.posMax;
      if (state2.src.charCodeAt(pos2) !== 92) return false;
      pos2++;
      if (pos2 >= max3) return false;
      let ch1 = state2.src.charCodeAt(pos2);
      if (ch1 === 10) {
        if (!silent) {
          state2.push("hardbreak", "br", 0);
        }
        pos2++;
        while (pos2 < max3) {
          ch1 = state2.src.charCodeAt(pos2);
          if (!isSpace2(ch1)) break;
          pos2++;
        }
        state2.pos = pos2;
        return true;
      }
      let escapedStr = state2.src[pos2];
      if (ch1 >= 55296 && ch1 <= 56319 && pos2 + 1 < max3) {
        const ch22 = state2.src.charCodeAt(pos2 + 1);
        if (ch22 >= 56320 && ch22 <= 57343) {
          escapedStr += state2.src[pos2 + 1];
          pos2++;
        }
      }
      const origStr = "\\" + escapedStr;
      if (!silent) {
        const token = state2.push("text_special", "", 0);
        if (ch1 < 256 && ESCAPED[ch1] !== 0) {
          token.content = escapedStr;
        } else {
          token.content = origStr;
        }
        token.markup = origStr;
        token.info = "escape";
      }
      state2.pos = pos2 + 1;
      return true;
    }
    function backtick(state2, silent) {
      let pos2 = state2.pos;
      const ch3 = state2.src.charCodeAt(pos2);
      if (ch3 !== 96) {
        return false;
      }
      const start = pos2;
      pos2++;
      const max3 = state2.posMax;
      while (pos2 < max3 && state2.src.charCodeAt(pos2) === 96) {
        pos2++;
      }
      const marker = state2.src.slice(start, pos2);
      const openerLength = marker.length;
      if (state2.backticksScanned && (state2.backticks[openerLength] || 0) <= start) {
        if (!silent) state2.pending += marker;
        state2.pos += openerLength;
        return true;
      }
      let matchEnd = pos2;
      let matchStart;
      while ((matchStart = state2.src.indexOf("`", matchEnd)) !== -1) {
        matchEnd = matchStart + 1;
        while (matchEnd < max3 && state2.src.charCodeAt(matchEnd) === 96) {
          matchEnd++;
        }
        const closerLength = matchEnd - matchStart;
        if (closerLength === openerLength) {
          if (!silent) {
            const token = state2.push("code_inline", "code", 0);
            token.markup = marker;
            token.content = state2.src.slice(pos2, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
          }
          state2.pos = matchEnd;
          return true;
        }
        state2.backticks[closerLength] = matchStart;
      }
      state2.backticksScanned = true;
      if (!silent) state2.pending += marker;
      state2.pos += openerLength;
      return true;
    }
    function strikethrough_tokenize(state2, silent) {
      const start = state2.pos;
      const marker = state2.src.charCodeAt(start);
      if (silent) {
        return false;
      }
      if (marker !== 126) {
        return false;
      }
      const scanned = state2.scanDelims(state2.pos, true);
      let len = scanned.length;
      const ch3 = String.fromCharCode(marker);
      if (len < 2) {
        return false;
      }
      let token;
      if (len % 2) {
        token = state2.push("text", "", 0);
        token.content = ch3;
        len--;
      }
      for (let i = 0; i < len; i += 2) {
        token = state2.push("text", "", 0);
        token.content = ch3 + ch3;
        state2.delimiters.push({
          marker,
          length: 0,
          // disable "rule of 3" length checks meant for emphasis
          token: state2.tokens.length - 1,
          end: -1,
          open: scanned.can_open,
          close: scanned.can_close
        });
      }
      state2.pos += scanned.length;
      return true;
    }
    function postProcess$1(state2, delimiters) {
      let token;
      const loneMarkers = [];
      const max3 = delimiters.length;
      for (let i = 0; i < max3; i++) {
        const startDelim = delimiters[i];
        if (startDelim.marker !== 126) {
          continue;
        }
        if (startDelim.end === -1) {
          continue;
        }
        const endDelim = delimiters[startDelim.end];
        token = state2.tokens[startDelim.token];
        token.type = "s_open";
        token.tag = "s";
        token.nesting = 1;
        token.markup = "~~";
        token.content = "";
        token = state2.tokens[endDelim.token];
        token.type = "s_close";
        token.tag = "s";
        token.nesting = -1;
        token.markup = "~~";
        token.content = "";
        if (state2.tokens[endDelim.token - 1].type === "text" && state2.tokens[endDelim.token - 1].content === "~") {
          loneMarkers.push(endDelim.token - 1);
        }
      }
      while (loneMarkers.length) {
        const i = loneMarkers.pop();
        let j = i + 1;
        while (j < state2.tokens.length && state2.tokens[j].type === "s_close") {
          j++;
        }
        j--;
        if (i !== j) {
          token = state2.tokens[j];
          state2.tokens[j] = state2.tokens[i];
          state2.tokens[i] = token;
        }
      }
    }
    function strikethrough_postProcess(state2) {
      const tokens_meta = state2.tokens_meta;
      const max3 = state2.tokens_meta.length;
      postProcess$1(state2, state2.delimiters);
      for (let curr = 0; curr < max3; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          postProcess$1(state2, tokens_meta[curr].delimiters);
        }
      }
    }
    var r_strikethrough = {
      tokenize: strikethrough_tokenize,
      postProcess: strikethrough_postProcess
    };
    function emphasis_tokenize(state2, silent) {
      const start = state2.pos;
      const marker = state2.src.charCodeAt(start);
      if (silent) {
        return false;
      }
      if (marker !== 95 && marker !== 42) {
        return false;
      }
      const scanned = state2.scanDelims(state2.pos, marker === 42);
      for (let i = 0; i < scanned.length; i++) {
        const token = state2.push("text", "", 0);
        token.content = String.fromCharCode(marker);
        state2.delimiters.push({
          // Char code of the starting marker (number).
          //
          marker,
          // Total length of these series of delimiters.
          //
          length: scanned.length,
          // A position of the token this delimiter corresponds to.
          //
          token: state2.tokens.length - 1,
          // If this delimiter is matched as a valid opener, `end` will be
          // equal to its position, otherwise it's `-1`.
          //
          end: -1,
          // Boolean flags that determine if this delimiter could open or close
          // an emphasis.
          //
          open: scanned.can_open,
          close: scanned.can_close
        });
      }
      state2.pos += scanned.length;
      return true;
    }
    function postProcess(state2, delimiters) {
      const max3 = delimiters.length;
      for (let i = max3 - 1; i >= 0; i--) {
        const startDelim = delimiters[i];
        if (startDelim.marker !== 95 && startDelim.marker !== 42) {
          continue;
        }
        if (startDelim.end === -1) {
          continue;
        }
        const endDelim = delimiters[startDelim.end];
        const isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && // check that first two markers match and adjacent
        delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 && // check that last two markers are adjacent (we can safely assume they match)
        delimiters[startDelim.end + 1].token === endDelim.token + 1;
        const ch3 = String.fromCharCode(startDelim.marker);
        const token_o = state2.tokens[startDelim.token];
        token_o.type = isStrong ? "strong_open" : "em_open";
        token_o.tag = isStrong ? "strong" : "em";
        token_o.nesting = 1;
        token_o.markup = isStrong ? ch3 + ch3 : ch3;
        token_o.content = "";
        const token_c = state2.tokens[endDelim.token];
        token_c.type = isStrong ? "strong_close" : "em_close";
        token_c.tag = isStrong ? "strong" : "em";
        token_c.nesting = -1;
        token_c.markup = isStrong ? ch3 + ch3 : ch3;
        token_c.content = "";
        if (isStrong) {
          state2.tokens[delimiters[i - 1].token].content = "";
          state2.tokens[delimiters[startDelim.end + 1].token].content = "";
          i--;
        }
      }
    }
    function emphasis_post_process(state2) {
      const tokens_meta = state2.tokens_meta;
      const max3 = state2.tokens_meta.length;
      postProcess(state2, state2.delimiters);
      for (let curr = 0; curr < max3; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          postProcess(state2, tokens_meta[curr].delimiters);
        }
      }
    }
    var r_emphasis = {
      tokenize: emphasis_tokenize,
      postProcess: emphasis_post_process
    };
    function link2(state2, silent) {
      let code2, label, res2, ref;
      let href = "";
      let title = "";
      let start = state2.pos;
      let parseReference = true;
      if (state2.src.charCodeAt(state2.pos) !== 91) {
        return false;
      }
      const oldPos = state2.pos;
      const max3 = state2.posMax;
      const labelStart = state2.pos + 1;
      const labelEnd = state2.md.helpers.parseLinkLabel(state2, state2.pos, true);
      if (labelEnd < 0) {
        return false;
      }
      let pos2 = labelEnd + 1;
      if (pos2 < max3 && state2.src.charCodeAt(pos2) === 40) {
        parseReference = false;
        pos2++;
        for (; pos2 < max3; pos2++) {
          code2 = state2.src.charCodeAt(pos2);
          if (!isSpace2(code2) && code2 !== 10) {
            break;
          }
        }
        if (pos2 >= max3) {
          return false;
        }
        start = pos2;
        res2 = state2.md.helpers.parseLinkDestination(state2.src, pos2, state2.posMax);
        if (res2.ok) {
          href = state2.md.normalizeLink(res2.str);
          if (state2.md.validateLink(href)) {
            pos2 = res2.pos;
          } else {
            href = "";
          }
          start = pos2;
          for (; pos2 < max3; pos2++) {
            code2 = state2.src.charCodeAt(pos2);
            if (!isSpace2(code2) && code2 !== 10) {
              break;
            }
          }
          res2 = state2.md.helpers.parseLinkTitle(state2.src, pos2, state2.posMax);
          if (pos2 < max3 && start !== pos2 && res2.ok) {
            title = res2.str;
            pos2 = res2.pos;
            for (; pos2 < max3; pos2++) {
              code2 = state2.src.charCodeAt(pos2);
              if (!isSpace2(code2) && code2 !== 10) {
                break;
              }
            }
          }
        }
        if (pos2 >= max3 || state2.src.charCodeAt(pos2) !== 41) {
          parseReference = true;
        }
        pos2++;
      }
      if (parseReference) {
        if (typeof state2.env.references === "undefined") {
          return false;
        }
        if (pos2 < max3 && state2.src.charCodeAt(pos2) === 91) {
          start = pos2 + 1;
          pos2 = state2.md.helpers.parseLinkLabel(state2, pos2);
          if (pos2 >= 0) {
            label = state2.src.slice(start, pos2++);
          } else {
            pos2 = labelEnd + 1;
          }
        } else {
          pos2 = labelEnd + 1;
        }
        if (!label) {
          label = state2.src.slice(labelStart, labelEnd);
        }
        ref = state2.env.references[normalizeReference(label)];
        if (!ref) {
          state2.pos = oldPos;
          return false;
        }
        href = ref.href;
        title = ref.title;
      }
      if (!silent) {
        state2.pos = labelStart;
        state2.posMax = labelEnd;
        const token_o = state2.push("link_open", "a", 1);
        const attrs = [["href", href]];
        token_o.attrs = attrs;
        if (title) {
          attrs.push(["title", title]);
        }
        state2.linkLevel++;
        state2.md.inline.tokenize(state2);
        state2.linkLevel--;
        state2.push("link_close", "a", -1);
      }
      state2.pos = pos2;
      state2.posMax = max3;
      return true;
    }
    function image(state2, silent) {
      let code2, content, label, pos2, ref, res2, title, start;
      let href = "";
      const oldPos = state2.pos;
      const max3 = state2.posMax;
      if (state2.src.charCodeAt(state2.pos) !== 33) {
        return false;
      }
      if (state2.src.charCodeAt(state2.pos + 1) !== 91) {
        return false;
      }
      const labelStart = state2.pos + 2;
      const labelEnd = state2.md.helpers.parseLinkLabel(state2, state2.pos + 1, false);
      if (labelEnd < 0) {
        return false;
      }
      pos2 = labelEnd + 1;
      if (pos2 < max3 && state2.src.charCodeAt(pos2) === 40) {
        pos2++;
        for (; pos2 < max3; pos2++) {
          code2 = state2.src.charCodeAt(pos2);
          if (!isSpace2(code2) && code2 !== 10) {
            break;
          }
        }
        if (pos2 >= max3) {
          return false;
        }
        start = pos2;
        res2 = state2.md.helpers.parseLinkDestination(state2.src, pos2, state2.posMax);
        if (res2.ok) {
          href = state2.md.normalizeLink(res2.str);
          if (state2.md.validateLink(href)) {
            pos2 = res2.pos;
          } else {
            href = "";
          }
        }
        start = pos2;
        for (; pos2 < max3; pos2++) {
          code2 = state2.src.charCodeAt(pos2);
          if (!isSpace2(code2) && code2 !== 10) {
            break;
          }
        }
        res2 = state2.md.helpers.parseLinkTitle(state2.src, pos2, state2.posMax);
        if (pos2 < max3 && start !== pos2 && res2.ok) {
          title = res2.str;
          pos2 = res2.pos;
          for (; pos2 < max3; pos2++) {
            code2 = state2.src.charCodeAt(pos2);
            if (!isSpace2(code2) && code2 !== 10) {
              break;
            }
          }
        } else {
          title = "";
        }
        if (pos2 >= max3 || state2.src.charCodeAt(pos2) !== 41) {
          state2.pos = oldPos;
          return false;
        }
        pos2++;
      } else {
        if (typeof state2.env.references === "undefined") {
          return false;
        }
        if (pos2 < max3 && state2.src.charCodeAt(pos2) === 91) {
          start = pos2 + 1;
          pos2 = state2.md.helpers.parseLinkLabel(state2, pos2);
          if (pos2 >= 0) {
            label = state2.src.slice(start, pos2++);
          } else {
            pos2 = labelEnd + 1;
          }
        } else {
          pos2 = labelEnd + 1;
        }
        if (!label) {
          label = state2.src.slice(labelStart, labelEnd);
        }
        ref = state2.env.references[normalizeReference(label)];
        if (!ref) {
          state2.pos = oldPos;
          return false;
        }
        href = ref.href;
        title = ref.title;
      }
      if (!silent) {
        content = state2.src.slice(labelStart, labelEnd);
        const tokens = [];
        state2.md.inline.parse(content, state2.md, state2.env, tokens);
        const token = state2.push("image", "img", 0);
        const attrs = [["src", href], ["alt", ""]];
        token.attrs = attrs;
        token.children = tokens;
        token.content = content;
        if (title) {
          attrs.push(["title", title]);
        }
      }
      state2.pos = pos2;
      state2.posMax = max3;
      return true;
    }
    var EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
    var AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
    function autolink(state2, silent) {
      let pos2 = state2.pos;
      if (state2.src.charCodeAt(pos2) !== 60) {
        return false;
      }
      const start = state2.pos;
      const max3 = state2.posMax;
      for (; ; ) {
        if (++pos2 >= max3) return false;
        const ch3 = state2.src.charCodeAt(pos2);
        if (ch3 === 60) return false;
        if (ch3 === 62) break;
      }
      const url = state2.src.slice(start + 1, pos2);
      if (AUTOLINK_RE.test(url)) {
        const fullUrl = state2.md.normalizeLink(url);
        if (!state2.md.validateLink(fullUrl)) {
          return false;
        }
        if (!silent) {
          const token_o = state2.push("link_open", "a", 1);
          token_o.attrs = [["href", fullUrl]];
          token_o.markup = "autolink";
          token_o.info = "auto";
          const token_t = state2.push("text", "", 0);
          token_t.content = state2.md.normalizeLinkText(url);
          const token_c = state2.push("link_close", "a", -1);
          token_c.markup = "autolink";
          token_c.info = "auto";
        }
        state2.pos += url.length + 2;
        return true;
      }
      if (EMAIL_RE.test(url)) {
        const fullUrl = state2.md.normalizeLink("mailto:" + url);
        if (!state2.md.validateLink(fullUrl)) {
          return false;
        }
        if (!silent) {
          const token_o = state2.push("link_open", "a", 1);
          token_o.attrs = [["href", fullUrl]];
          token_o.markup = "autolink";
          token_o.info = "auto";
          const token_t = state2.push("text", "", 0);
          token_t.content = state2.md.normalizeLinkText(url);
          const token_c = state2.push("link_close", "a", -1);
          token_c.markup = "autolink";
          token_c.info = "auto";
        }
        state2.pos += url.length + 2;
        return true;
      }
      return false;
    }
    function isLinkOpen(str) {
      return /^<a[>\s]/i.test(str);
    }
    function isLinkClose(str) {
      return /^<\/a\s*>/i.test(str);
    }
    function isLetter(ch3) {
      const lc2 = ch3 | 32;
      return lc2 >= 97 && lc2 <= 122;
    }
    function html_inline(state2, silent) {
      if (!state2.md.options.html) {
        return false;
      }
      const max3 = state2.posMax;
      const pos2 = state2.pos;
      if (state2.src.charCodeAt(pos2) !== 60 || pos2 + 2 >= max3) {
        return false;
      }
      const ch3 = state2.src.charCodeAt(pos2 + 1);
      if (ch3 !== 33 && ch3 !== 63 && ch3 !== 47 && !isLetter(ch3)) {
        return false;
      }
      const match3 = state2.src.slice(pos2).match(HTML_TAG_RE);
      if (!match3) {
        return false;
      }
      if (!silent) {
        const token = state2.push("html_inline", "", 0);
        token.content = match3[0];
        if (isLinkOpen(token.content)) state2.linkLevel++;
        if (isLinkClose(token.content)) state2.linkLevel--;
      }
      state2.pos += match3[0].length;
      return true;
    }
    var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
    var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
    function entity(state2, silent) {
      const pos2 = state2.pos;
      const max3 = state2.posMax;
      if (state2.src.charCodeAt(pos2) !== 38) return false;
      if (pos2 + 1 >= max3) return false;
      const ch3 = state2.src.charCodeAt(pos2 + 1);
      if (ch3 === 35) {
        const match3 = state2.src.slice(pos2).match(DIGITAL_RE);
        if (match3) {
          if (!silent) {
            const code2 = match3[1][0].toLowerCase() === "x" ? parseInt(match3[1].slice(1), 16) : parseInt(match3[1], 10);
            const token = state2.push("text_special", "", 0);
            token.content = isValidEntityCode(code2) ? fromCodePoint(code2) : fromCodePoint(65533);
            token.markup = match3[0];
            token.info = "entity";
          }
          state2.pos += match3[0].length;
          return true;
        }
      } else {
        const match3 = state2.src.slice(pos2).match(NAMED_RE);
        if (match3) {
          const decoded = entities.decodeHTML(match3[0]);
          if (decoded !== match3[0]) {
            if (!silent) {
              const token = state2.push("text_special", "", 0);
              token.content = decoded;
              token.markup = match3[0];
              token.info = "entity";
            }
            state2.pos += match3[0].length;
            return true;
          }
        }
      }
      return false;
    }
    function processDelimiters(delimiters) {
      const openersBottom = {};
      const max3 = delimiters.length;
      if (!max3) return;
      let headerIdx = 0;
      let lastTokenIdx = -2;
      const jumps = [];
      for (let closerIdx = 0; closerIdx < max3; closerIdx++) {
        const closer = delimiters[closerIdx];
        jumps.push(0);
        if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {
          headerIdx = closerIdx;
        }
        lastTokenIdx = closer.token;
        closer.length = closer.length || 0;
        if (!closer.close) continue;
        if (!openersBottom.hasOwnProperty(closer.marker)) {
          openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1];
        }
        const minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
        let openerIdx = headerIdx - jumps[headerIdx] - 1;
        let newMinOpenerIdx = openerIdx;
        for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
          const opener = delimiters[openerIdx];
          if (opener.marker !== closer.marker) continue;
          if (opener.open && opener.end < 0) {
            let isOddMatch = false;
            if (opener.close || closer.open) {
              if ((opener.length + closer.length) % 3 === 0) {
                if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
                  isOddMatch = true;
                }
              }
            }
            if (!isOddMatch) {
              const lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
              jumps[closerIdx] = closerIdx - openerIdx + lastJump;
              jumps[openerIdx] = lastJump;
              closer.open = false;
              opener.end = closerIdx;
              opener.close = false;
              newMinOpenerIdx = -1;
              lastTokenIdx = -2;
              break;
            }
          }
        }
        if (newMinOpenerIdx !== -1) {
          openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length || 0) % 3] = newMinOpenerIdx;
        }
      }
    }
    function link_pairs(state2) {
      const tokens_meta = state2.tokens_meta;
      const max3 = state2.tokens_meta.length;
      processDelimiters(state2.delimiters);
      for (let curr = 0; curr < max3; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          processDelimiters(tokens_meta[curr].delimiters);
        }
      }
    }
    function fragments_join(state2) {
      let curr, last;
      let level = 0;
      const tokens = state2.tokens;
      const max3 = state2.tokens.length;
      for (curr = last = 0; curr < max3; curr++) {
        if (tokens[curr].nesting < 0) level--;
        tokens[curr].level = level;
        if (tokens[curr].nesting > 0) level++;
        if (tokens[curr].type === "text" && curr + 1 < max3 && tokens[curr + 1].type === "text") {
          tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
        } else {
          if (curr !== last) {
            tokens[last] = tokens[curr];
          }
          last++;
        }
      }
      if (curr !== last) {
        tokens.length = last;
      }
    }
    var _rules = [["text", text3], ["linkify", linkify], ["newline", newline], ["escape", escape3], ["backticks", backtick], ["strikethrough", r_strikethrough.tokenize], ["emphasis", r_emphasis.tokenize], ["link", link2], ["image", image], ["autolink", autolink], ["html_inline", html_inline], ["entity", entity]];
    var _rules2 = [
      ["balance_pairs", link_pairs],
      ["strikethrough", r_strikethrough.postProcess],
      ["emphasis", r_emphasis.postProcess],
      // rules for pairs separate '**' into its own text tokens, which may be left unused,
      // rule below merges unused segments back with the rest of the text
      ["fragments_join", fragments_join]
    ];
    function ParserInline() {
      this.ruler = new Ruler();
      for (let i = 0; i < _rules.length; i++) {
        this.ruler.push(_rules[i][0], _rules[i][1]);
      }
      this.ruler2 = new Ruler();
      for (let i = 0; i < _rules2.length; i++) {
        this.ruler2.push(_rules2[i][0], _rules2[i][1]);
      }
    }
    ParserInline.prototype.skipToken = function(state2) {
      const pos2 = state2.pos;
      const rules = this.ruler.getRules("");
      const len = rules.length;
      const maxNesting = state2.md.options.maxNesting;
      const cache = state2.cache;
      if (typeof cache[pos2] !== "undefined") {
        state2.pos = cache[pos2];
        return;
      }
      let ok = false;
      if (state2.level < maxNesting) {
        for (let i = 0; i < len; i++) {
          state2.level++;
          ok = rules[i](state2, true);
          state2.level--;
          if (ok) {
            if (pos2 >= state2.pos) {
              throw new Error("inline rule didn't increment state.pos");
            }
            break;
          }
        }
      } else {
        state2.pos = state2.posMax;
      }
      if (!ok) {
        state2.pos++;
      }
      cache[pos2] = state2.pos;
    };
    ParserInline.prototype.tokenize = function(state2) {
      const rules = this.ruler.getRules("");
      const len = rules.length;
      const end = state2.posMax;
      const maxNesting = state2.md.options.maxNesting;
      while (state2.pos < end) {
        const prevPos = state2.pos;
        let ok = false;
        if (state2.level < maxNesting) {
          for (let i = 0; i < len; i++) {
            ok = rules[i](state2, false);
            if (ok) {
              if (prevPos >= state2.pos) {
                throw new Error("inline rule didn't increment state.pos");
              }
              break;
            }
          }
        }
        if (ok) {
          if (state2.pos >= end) {
            break;
          }
          continue;
        }
        state2.pending += state2.src[state2.pos++];
      }
      if (state2.pending) {
        state2.pushPending();
      }
    };
    ParserInline.prototype.parse = function(str, md, env, outTokens) {
      const state2 = new this.State(str, md, env, outTokens);
      this.tokenize(state2);
      const rules = this.ruler2.getRules("");
      const len = rules.length;
      for (let i = 0; i < len; i++) {
        rules[i](state2);
      }
    };
    ParserInline.prototype.State = StateInline;
    var cfg_default = {
      options: {
        // Enable HTML tags in source
        html: false,
        // Use '/' to close single tags (<br />)
        xhtmlOut: false,
        // Convert '\n' in paragraphs into <br>
        breaks: false,
        // CSS language prefix for fenced blocks
        langPrefix: "language-",
        // autoconvert URL-like texts to links
        linkify: false,
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        // Internal protection, recursion limit
        maxNesting: 100
      },
      components: {
        core: {},
        block: {},
        inline: {}
      }
    };
    var cfg_zero = {
      options: {
        // Enable HTML tags in source
        html: false,
        // Use '/' to close single tags (<br />)
        xhtmlOut: false,
        // Convert '\n' in paragraphs into <br>
        breaks: false,
        // CSS language prefix for fenced blocks
        langPrefix: "language-",
        // autoconvert URL-like texts to links
        linkify: false,
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        // Internal protection, recursion limit
        maxNesting: 20
      },
      components: {
        core: {
          rules: ["normalize", "block", "inline", "text_join"]
        },
        block: {
          rules: ["paragraph"]
        },
        inline: {
          rules: ["text"],
          rules2: ["balance_pairs", "fragments_join"]
        }
      }
    };
    var cfg_commonmark = {
      options: {
        // Enable HTML tags in source
        html: true,
        // Use '/' to close single tags (<br />)
        xhtmlOut: true,
        // Convert '\n' in paragraphs into <br>
        breaks: false,
        // CSS language prefix for fenced blocks
        langPrefix: "language-",
        // autoconvert URL-like texts to links
        linkify: false,
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        // Internal protection, recursion limit
        maxNesting: 20
      },
      components: {
        core: {
          rules: ["normalize", "block", "inline", "text_join"]
        },
        block: {
          rules: ["blockquote", "code", "fence", "heading", "hr", "html_block", "lheading", "list", "reference", "paragraph"]
        },
        inline: {
          rules: ["autolink", "backticks", "emphasis", "entity", "escape", "html_inline", "image", "link", "newline", "text"],
          rules2: ["balance_pairs", "emphasis", "fragments_join"]
        }
      }
    };
    var config = {
      default: cfg_default,
      zero: cfg_zero,
      commonmark: cfg_commonmark
    };
    var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
    var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
    function validateLink(url) {
      const str = url.trim().toLowerCase();
      return BAD_PROTO_RE.test(str) ? GOOD_DATA_RE.test(str) : true;
    }
    var RECODE_HOSTNAME_FOR = ["http:", "https:", "mailto:"];
    function normalizeLink(url) {
      const parsed = mdurl__namespace.parse(url, true);
      if (parsed.hostname) {
        if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
          try {
            parsed.hostname = punycode2.toASCII(parsed.hostname);
          } catch (er) {
          }
        }
      }
      return mdurl__namespace.encode(mdurl__namespace.format(parsed));
    }
    function normalizeLinkText(url) {
      const parsed = mdurl__namespace.parse(url, true);
      if (parsed.hostname) {
        if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
          try {
            parsed.hostname = punycode2.toUnicode(parsed.hostname);
          } catch (er) {
          }
        }
      }
      return mdurl__namespace.decode(mdurl__namespace.format(parsed), mdurl__namespace.decode.defaultChars + "%");
    }
    function MarkdownIt(presetName, options) {
      if (!(this instanceof MarkdownIt)) {
        return new MarkdownIt(presetName, options);
      }
      if (!options) {
        if (!isString(presetName)) {
          options = presetName || {};
          presetName = "default";
        }
      }
      this.inline = new ParserInline();
      this.block = new ParserBlock();
      this.core = new Core();
      this.renderer = new Renderer();
      this.linkify = new LinkifyIt();
      this.validateLink = validateLink;
      this.normalizeLink = normalizeLink;
      this.normalizeLinkText = normalizeLinkText;
      this.utils = utils;
      this.helpers = assign2({}, helpers);
      this.options = {};
      this.configure(presetName);
      if (options) {
        this.set(options);
      }
    }
    MarkdownIt.prototype.set = function(options) {
      assign2(this.options, options);
      return this;
    };
    MarkdownIt.prototype.configure = function(presets) {
      const self3 = this;
      if (isString(presets)) {
        const presetName = presets;
        presets = config[presetName];
        if (!presets) {
          throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
        }
      }
      if (!presets) {
        throw new Error("Wrong `markdown-it` preset, can't be empty");
      }
      if (presets.options) {
        self3.set(presets.options);
      }
      if (presets.components) {
        Object.keys(presets.components).forEach(function(name) {
          if (presets.components[name].rules) {
            self3[name].ruler.enableOnly(presets.components[name].rules);
          }
          if (presets.components[name].rules2) {
            self3[name].ruler2.enableOnly(presets.components[name].rules2);
          }
        });
      }
      return this;
    };
    MarkdownIt.prototype.enable = function(list2, ignoreInvalid) {
      let result = [];
      if (!Array.isArray(list2)) {
        list2 = [list2];
      }
      ["core", "block", "inline"].forEach(function(chain) {
        result = result.concat(this[chain].ruler.enable(list2, true));
      }, this);
      result = result.concat(this.inline.ruler2.enable(list2, true));
      const missed = list2.filter(function(name) {
        return result.indexOf(name) < 0;
      });
      if (missed.length && !ignoreInvalid) {
        throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + missed);
      }
      return this;
    };
    MarkdownIt.prototype.disable = function(list2, ignoreInvalid) {
      let result = [];
      if (!Array.isArray(list2)) {
        list2 = [list2];
      }
      ["core", "block", "inline"].forEach(function(chain) {
        result = result.concat(this[chain].ruler.disable(list2, true));
      }, this);
      result = result.concat(this.inline.ruler2.disable(list2, true));
      const missed = list2.filter(function(name) {
        return result.indexOf(name) < 0;
      });
      if (missed.length && !ignoreInvalid) {
        throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + missed);
      }
      return this;
    };
    MarkdownIt.prototype.use = function(plugin2) {
      const args = [this].concat(Array.prototype.slice.call(arguments, 1));
      plugin2.apply(plugin2, args);
      return this;
    };
    MarkdownIt.prototype.parse = function(src, env) {
      if (typeof src !== "string") {
        throw new Error("Input data should be a String");
      }
      const state2 = new this.core.State(src, this, env);
      this.core.process(state2);
      return state2.tokens;
    };
    MarkdownIt.prototype.render = function(src, env) {
      env = env || {};
      return this.renderer.render(this.parse(src, env), this.options, env);
    };
    MarkdownIt.prototype.parseInline = function(src, env) {
      const state2 = new this.core.State(src, this, env);
      state2.inlineMode = true;
      this.core.process(state2);
      return state2.tokens;
    };
    MarkdownIt.prototype.renderInline = function(src, env) {
      env = env || {};
      return this.renderer.render(this.parseInline(src, env), this.options, env);
    };
    module2.exports = MarkdownIt;
  }
});

// node_modules/@mdfriday/text-template/dist/index.js
var require_dist2 = __commonJS({
  "node_modules/@mdfriday/text-template/dist/index.js"(exports, module) {
    var __create = Object.create;
    var __defProp = Object.defineProperty;
    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
    var __getOwnPropNames = Object.getOwnPropertyNames;
    var __getOwnPropSymbols = Object.getOwnPropertySymbols;
    var __getProtoOf = Object.getPrototypeOf;
    var __hasOwnProp = Object.prototype.hasOwnProperty;
    var __propIsEnum = Object.prototype.propertyIsEnumerable;
    var __defNormalProp = (t2, e2, r) => e2 in t2 ? __defProp(t2, e2, { enumerable: true, configurable: true, writable: true, value: r }) : t2[e2] = r;
    var __spreadValues = (t2, e2) => {
      for (var r in e2 || (e2 = {})) __hasOwnProp.call(e2, r) && __defNormalProp(t2, r, e2[r]);
      if (__getOwnPropSymbols) for (var r of __getOwnPropSymbols(e2)) __propIsEnum.call(e2, r) && __defNormalProp(t2, r, e2[r]);
      return t2;
    };
    var __export = (t2, e2) => {
      for (var r in e2) __defProp(t2, r, { get: e2[r], enumerable: true });
    };
    var __copyProps = (t2, e2, r, i) => {
      if (e2 && "object" == typeof e2 || "function" == typeof e2) for (let n3 of __getOwnPropNames(e2)) __hasOwnProp.call(t2, n3) || n3 === r || __defProp(t2, n3, { get: () => e2[n3], enumerable: !(i = __getOwnPropDesc(e2, n3)) || i.enumerable });
      return t2;
    };
    var __toESM = (t2, e2, r) => (r = null != t2 ? __create(__getProtoOf(t2)) : {}, __copyProps(!e2 && t2 && t2.t ? r : __defProp(r, "default", { value: t2, enumerable: true }), t2));
    var __toCommonJS = (t2) => __copyProps(__defProp({}, "__esModule", { value: true }), t2);
    var __async = (t2, e2, r) => new Promise((i, n3) => {
      var s = (t3) => {
        try {
          h2(r.next(t3));
        } catch (t4) {
          n3(t4);
        }
      }, o = (t3) => {
        try {
          h2(r.throw(t3));
        } catch (t4) {
          n3(t4);
        }
      }, h2 = (t3) => t3.done ? i(t3.value) : Promise.resolve(t3.value).then(s, o);
      h2((r = r.apply(t2, e2)).next());
    });
    var src_exports = {};
    __export(src_exports, { ActionNode: () => ActionNode, BoolNode: () => BoolNode, CommandNode: () => CommandNode, DotNode: () => DotNode, ExecError: () => ExecError, FieldNode: () => FieldNode, IdentifierNode: () => IdentifierNode, IfNode: () => IfNode, IsEmptyTree: () => IsEmptyTree, JSEscapeString: () => JSEscapeString, ListNode: () => ListNode, Mode: () => Mode, Must: () => Must, New: () => New2, NilNode: () => NilNode, NodeType: () => NodeType, NumberNode: () => NumberNode, ParseContents: () => ParseContents, ParseFiles: () => ParseFiles, PipeNode: () => PipeNode, RangeNode: () => RangeNode, StringNode: () => StringNode, Template: () => Template, TemplateNode: () => TemplateNode, TextNode: () => TextNode, Tree: () => Tree2, VariableNode: () => VariableNode, WithNode: () => WithNode, getTextFormat: () => getTextFormat, lex: () => lex, parse: () => parse, setTextFormat: () => setTextFormat }), module.exports = __toCommonJS(src_exports);
    var textFormat = "%s";
    function setTextFormat(t2) {
      const e2 = textFormat;
      return textFormat = t2, e2;
    }
    function getTextFormat() {
      return textFormat;
    }
    var NodeType = ((t2) => (t2[t2.NodeText = 0] = "NodeText", t2[t2.NodeAction = 1] = "NodeAction", t2[t2.NodeBool = 2] = "NodeBool", t2[t2.NodeChain = 3] = "NodeChain", t2[t2.NodeCommand = 4] = "NodeCommand", t2[t2.NodeDot = 5] = "NodeDot", t2[t2.NodeElse = 6] = "NodeElse", t2[t2.NodeEnd = 7] = "NodeEnd", t2[t2.NodeField = 8] = "NodeField", t2[t2.NodeIdentifier = 9] = "NodeIdentifier", t2[t2.NodeIf = 10] = "NodeIf", t2[t2.NodeList = 11] = "NodeList", t2[t2.NodeNil = 12] = "NodeNil", t2[t2.NodeNumber = 13] = "NodeNumber", t2[t2.NodePipe = 14] = "NodePipe", t2[t2.NodeRange = 15] = "NodeRange", t2[t2.NodeString = 16] = "NodeString", t2[t2.NodeTemplate = 17] = "NodeTemplate", t2[t2.NodeVariable = 18] = "NodeVariable", t2[t2.NodeWith = 19] = "NodeWith", t2[t2.NodeComment = 20] = "NodeComment", t2[t2.NodeBreak = 21] = "NodeBreak", t2[t2.NodeContinue = 22] = "NodeContinue", t2))(NodeType || {});
    var StringBuilderImpl = class {
      constructor() {
        this.parts = [];
      }
      WriteString(t2) {
        this.parts.push(t2);
      }
      String() {
        return this.parts.join("");
      }
    };
    var TextNode = class t2 {
      constructor(t3, e2, r) {
        this.nodeType = 0, this.tr = t3, this.pos = e2, this.Text = new TextEncoder().encode(r);
      }
      Type() {
        return this.nodeType;
      }
      String() {
        return sprintf(textFormat, new TextDecoder().decode(this.Text));
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      Copy() {
        return new t2(this.tr, this.pos, new TextDecoder().decode(this.Text));
      }
      writeTo(t3) {
        const e2 = new TextDecoder().decode(this.Text);
        t3.WriteString(sprintf(textFormat, e2));
      }
    };
    function sprintf(t2, ...e2) {
      let r = 0;
      return t2.replace(/%[sqd%vT]/g, (t3) => {
        if ("%%" === t3) return "%";
        if (r >= e2.length) return t3;
        const i = e2[r++];
        switch (t3) {
          case "%s":
            return String(i);
          case "%q":
            return "string" == typeof i ? `"${i}"` : String(i);
          case "%d":
            return Number(i).toString();
          case "%v":
            return i instanceof Error ? i.message : String(i);
          case "%T":
            return typeof i;
          default:
            return t3;
        }
      });
    }
    var ListNode = class t2 {
      constructor(t3) {
        this.Nodes = [], this.pos = t3;
      }
      Type() {
        return 11;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      append(t3) {
        this.Nodes.push(t3);
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      CopyList() {
        const e2 = new t2(this.pos);
        return e2.tr = this.tr, e2.Nodes = this.Nodes.map((t3) => t3.Copy()), e2;
      }
      Copy() {
        return this.CopyList();
      }
      writeTo(t3) {
        this.Nodes.forEach((e2) => e2.writeTo(t3));
      }
    };
    var ActionNode = class t2 {
      constructor(t3, e2, r) {
        this.pos = t3, this.line = e2, this.Pipe = r;
      }
      Type() {
        return 1;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      setPos(t3) {
        return this.pos = t3, this;
      }
      String() {
        return `{{${this.Pipe.String()}}}`;
      }
      Copy() {
        return new t2(this.pos, this.line, this.Pipe.Copy());
      }
      writeTo(t3) {
        t3.WriteString("{{"), this.Pipe.writeTo(t3), t3.WriteString("}}");
      }
    };
    var PipeNode = class t2 {
      constructor(t3, e2) {
        this.IsAssign = false, this.Decl = [], this.Cmds = [], this.pos = t3, this.Line = e2;
      }
      Type() {
        return 14;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      append(t3) {
        this.Cmds.push(t3);
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        const e2 = new t2(this.pos, this.Line);
        return e2.IsAssign = this.IsAssign, e2.Decl = this.Decl.map((t3) => t3.Copy()), e2.Cmds = this.Cmds.map((t3) => t3.Copy()), e2;
      }
      writeTo(t3) {
        this.Decl.length > 0 && (this.Decl.forEach((e2, r) => {
          r > 0 && t3.WriteString(", "), e2.writeTo(t3);
        }), t3.WriteString(" := ")), this.Cmds.forEach((e2, r) => {
          r > 0 && t3.WriteString(" | "), e2.writeTo(t3);
        });
      }
    };
    var CommandNode = class t2 {
      constructor(t3) {
        this.Args = [], this.pos = t3;
      }
      Type() {
        return 4;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      append(t3) {
        this.Args.push(t3);
      }
      Copy() {
        const e2 = new t2(this.pos);
        return e2.Args = this.Args.map((t3) => t3.Copy()), e2;
      }
      writeTo(t3) {
        this.Args.forEach((e2, r) => {
          r > 0 && t3.WriteString(" "), 14 === e2.Type() ? (t3.WriteString("("), e2.writeTo(t3), t3.WriteString(")")) : e2.writeTo(t3);
        });
      }
    };
    var CommentNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Text = e2;
      }
      Type() {
        return 20;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Text);
      }
      writeTo(t3) {
        this.tr && 1 & this.tr.Mode && (t3.WriteString("{{"), t3.WriteString(this.Text), t3.WriteString("}}"));
      }
    };
    var VariableNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Ident = e2;
      }
      Type() {
        return 18;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Ident.slice());
      }
      writeTo(t3) {
        for (let e2 = 0; e2 < this.Ident.length; e2++) e2 > 0 && t3.WriteString("."), t3.WriteString(this.Ident[e2]);
      }
    };
    var IdentifierNode = class t2 {
      constructor(t3) {
        this.Ident = t3;
      }
      Type() {
        return 9;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      setPos(t3) {
        return this.pos = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.Ident).setTree(this.tr).setPos(this.pos);
      }
      writeTo(t3) {
        t3.WriteString(this.Ident);
      }
    };
    var DotNode = class t2 {
      constructor(t3) {
        this.pos = t3;
      }
      Type() {
        return 5;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos);
      }
      writeTo(t3) {
        t3.WriteString(".");
      }
    };
    var NilNode = class t2 {
      constructor(t3) {
        this.pos = t3;
      }
      Type() {
        return 12;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      setPos(t3) {
        return this.pos = t3, this;
      }
      String() {
        return "nil";
      }
      Copy() {
        return new t2(this.pos);
      }
      writeTo(t3) {
        t3.WriteString("nil");
      }
    };
    var FieldNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Ident = e2;
      }
      Type() {
        return 8;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      setPos(t3) {
        return this.pos = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Ident.slice());
      }
      writeTo(t3) {
        for (const e2 of this.Ident) t3.WriteString("."), t3.WriteString(e2);
      }
    };
    var ChainNode = class t2 {
      constructor(t3, e2) {
        this.Field = [], this.pos = t3, this.Node = e2;
      }
      Type() {
        return 3;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      setPos(t3) {
        return this.pos = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      add(t3) {
        if (0 === t3.length || "." !== t3[0]) throw console.error(`[ChainNode.add] Field does not start with a dot: "${t3}"`), new Error("no dot in field");
        const e2 = t3.substring(1);
        if ("" === e2) throw console.error("[ChainNode.add] Empty field after removing dot"), new Error("empty field");
        this.Field.push(e2);
      }
      Copy() {
        const e2 = new t2(this.pos, this.Node.Copy());
        return e2.Field = this.Field.slice(), e2;
      }
      writeTo(t3) {
        14 === this.Node.Type() ? (t3.WriteString("("), this.Node.writeTo(t3), t3.WriteString(")")) : this.Node.writeTo(t3), this.Field.forEach((e2) => {
          t3.WriteString("."), t3.WriteString(e2);
        });
      }
    };
    var BoolNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.True = e2;
      }
      Type() {
        return 2;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.True);
      }
      writeTo(t3) {
        t3.WriteString(this.True ? "true" : "false");
      }
    };
    var NumberNode = class t2 {
      constructor(t3, e2, r) {
        this.IsInt = false, this.IsUint = false, this.IsFloat = false, this.IsComplex = false, this.Int64 = 0, this.Uint64 = 0, this.Float64 = 0, this.Complex128 = { re: 0, im: 0 }, this.tr = t3, this.pos = e2, this.Text = r;
      }
      Type() {
        return 13;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      String() {
        return this.Text;
      }
      Copy() {
        const e2 = new t2(this.tr, this.pos, this.Text);
        return e2.IsInt = this.IsInt, e2.IsUint = this.IsUint, e2.IsFloat = this.IsFloat, e2.IsComplex = this.IsComplex, e2.Int64 = this.Int64, e2.Uint64 = this.Uint64, e2.Float64 = this.Float64, e2.Complex128 = __spreadValues({}, this.Complex128), e2;
      }
      writeTo(t3) {
        t3.WriteString(this.Text);
      }
      simplifyComplex() {
        0 === this.Complex128.im && (this.IsFloat = true, this.Float64 = this.Complex128.re, Number.isInteger(this.Float64) && (this.IsInt = true, this.Int64 = this.Float64, this.Float64 >= 0 && (this.IsUint = true, this.Uint64 = this.Float64)));
      }
    };
    var StringNode = class t2 {
      constructor(t3, e2, r) {
        this.pos = t3, this.Quoted = e2, this.Text = r;
      }
      Type() {
        return 16;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Quoted, this.Text);
      }
      writeTo(t3) {
        t3.WriteString(this.Quoted);
      }
    };
    var EndNode = class t2 {
      constructor(t3) {
        this.pos = t3;
      }
      Type() {
        return 7;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos);
      }
      writeTo(t3) {
        t3.WriteString("{{end}}");
      }
    };
    var ElseNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Line = e2;
      }
      Type() {
        return 6;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Line);
      }
      writeTo(t3) {
        t3.WriteString("{{else}}");
      }
    };
    var BreakNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Line = e2;
      }
      Type() {
        return 21;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Line);
      }
      writeTo(t3) {
        t3.WriteString("{{break}}");
      }
    };
    var ContinueNode = class t2 {
      constructor(t3, e2) {
        this.pos = t3, this.Line = e2;
      }
      Type() {
        return 22;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        const t3 = new StringBuilderImpl();
        return this.writeTo(t3), t3.String();
      }
      Copy() {
        return new t2(this.pos, this.Line);
      }
      writeTo(t3) {
        t3.WriteString("{{continue}}");
      }
    };
    var BranchNode = class {
      constructor(t2, e2, r, i, n3, s, o) {
        this.nodeType = t2, this.tr = e2, this.pos = r, this.Line = i, this.Pipe = n3, this.List = s, this.ElseList = o;
      }
      Type() {
        return this.nodeType;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      String() {
        const t2 = new StringBuilderImpl();
        return this.writeTo(t2), t2.String();
      }
      Copy() {
        throw new Error("Copy() must be implemented by derived classes");
      }
      writeTo(t2) {
        const e2 = 10 === this.nodeType ? "if" : 15 === this.nodeType ? "range" : 19 === this.nodeType ? "with" : "unknown";
        t2.WriteString("{{" + e2 + " "), this.Pipe.writeTo(t2), t2.WriteString("}}"), this.List.writeTo(t2), this.ElseList && (t2.WriteString("{{else}}"), this.ElseList.writeTo(t2)), t2.WriteString("{{end}}");
      }
    };
    var IfNode = class t2 extends BranchNode {
      constructor(t3, e2, r, i, n3, s) {
        super(10, t3, e2, r, i, n3, s);
      }
      Copy() {
        var e2;
        return new t2(this.tr, this.pos, this.Line, this.Pipe.Copy(), this.List.CopyList(), (null == (e2 = this.ElseList) ? void 0 : e2.CopyList()) || null);
      }
    };
    var RangeNode = class t2 extends BranchNode {
      constructor(t3, e2, r, i, n3, s) {
        super(15, t3, e2, r, i, n3, s);
      }
      Copy() {
        var e2;
        return new t2(this.tr, this.pos, this.Line, this.Pipe.Copy(), this.List.CopyList(), (null == (e2 = this.ElseList) ? void 0 : e2.CopyList()) || null);
      }
    };
    var WithNode = class t2 extends BranchNode {
      constructor(t3, e2, r, i, n3, s) {
        super(19, t3, e2, r, i, n3, s);
      }
      Copy() {
        var e2;
        return new t2(this.tr, this.pos, this.Line, this.Pipe.Copy(), this.List.CopyList(), (null == (e2 = this.ElseList) ? void 0 : e2.CopyList()) || null);
      }
    };
    var TemplateNode = class t2 {
      constructor(t3, e2, r, i) {
        this.pos = t3, this.Line = e2, this.Name = r, this.Pipe = i;
      }
      Type() {
        return 17;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        return "{{template " + JSON.stringify(this.Name) + (this.Pipe ? " " + this.Pipe.String() : "") + "}}";
      }
      Copy() {
        return new t2(this.pos, this.Line, this.Name, this.Pipe ? this.Pipe.Copy() : null).setTree(this.tr);
      }
      writeTo(t3) {
        t3.WriteString("{{template "), t3.WriteString(JSON.stringify(this.Name)), this.Pipe && (t3.WriteString(" "), this.Pipe.writeTo(t3)), t3.WriteString("}}");
      }
    };
    var DefineNode = class t2 {
      constructor(t3, e2, r, i) {
        this.pos = t3, this.Line = e2, this.Name = r, this.Pipe = i;
      }
      Type() {
        return 17;
      }
      Position() {
        return this.pos;
      }
      tree() {
        return this.tr;
      }
      setTree(t3) {
        return this.tr = t3, this;
      }
      String() {
        return "{{define " + this.Name + "}}";
      }
      Copy() {
        return new t2(this.pos, this.Line, this.Name, this.Pipe.Copy()).setTree(this.tr);
      }
      writeTo(t3) {
        t3.WriteString("{{define " + this.Name + "}}"), this.Pipe && (t3.WriteString(" "), this.Pipe.writeTo(t3)), t3.WriteString("}}");
      }
    };
    var key = { ".": 26, block: 23, break: 24, continue: 25, define: 27, else: 28, end: 29, if: 30, range: 32, nil: 31, template: 33, with: 34 };
    var EOF = -1;
    var spaceChars = " 	\r\n";
    var trimMarker = "-";
    var trimMarkerLen = 2;
    var leftDelim = "{{";
    var rightDelim = "}}";
    var leftComment = "/*";
    var rightComment = "*/";
    var Lexer = class {
      constructor(t2, e2, r, i) {
        this.name = t2, this.input = e2, this.leftDelim = r || leftDelim, this.rightDelim = i || rightDelim, this.pos = 0, this.start = 0, this.atEOF = false, this.parenDepth = 0, this.line = 1, this.startLine = 1, this.insideAction = false, this.options = { emitComment: false, breakOK: false, continueOK: false }, this.item = { typ: 8, pos: 0, val: "", line: 1 };
      }
      next() {
        if (this.pos >= this.input.length) return this.atEOF = true, String.fromCharCode(EOF);
        const t2 = this.input[this.pos];
        return this.pos++, "\n" === t2 && this.line++, t2;
      }
      peek() {
        const t2 = this.next();
        return this.backup(), t2;
      }
      backup() {
        !this.atEOF && this.pos > 0 && (this.pos--, "\n" === this.input[this.pos] && this.line--);
      }
      emit(t2) {
        return this.item = { typ: t2, pos: this.start, val: this.input.slice(this.start, this.pos), line: this.startLine }, this.start = this.pos, this.startLine = this.line, null;
      }
      ignore() {
        this.line += (this.input.slice(this.start, this.pos).match(/\n/g) || []).length, this.start = this.pos, this.startLine = this.line;
      }
      accept(t2) {
        return !!t2.includes(this.next()) || (this.backup(), false);
      }
      acceptRun(t2) {
        for (; t2.includes(this.next()); ) ;
        this.backup();
      }
      errorf(t2, ...e2) {
        return this.item = { typ: 0, pos: this.start, val: t2.replace(/%[sdq%]/g, () => {
          const t3 = e2.shift();
          return String(t3);
        }), line: this.startLine }, null;
      }
      nextItem() {
        this.item = { typ: 8, pos: this.pos, val: "EOF", line: this.startLine };
        let t2 = this.insideAction ? lexInsideAction : lexText;
        for (; t2; ) if (t2 = t2(this), 0 === this.item.typ) return this.item;
        return this.item;
      }
      atRightDelim() {
        const t2 = this.input.slice(this.pos);
        return t2.length >= 2 && isSpace(t2[0]) && t2[1] === trimMarker && t2.slice(trimMarkerLen).startsWith(this.rightDelim) ? [true, true] : t2.startsWith(this.rightDelim) ? [true, false] : [false, false];
      }
      atTerminator() {
        const t2 = this.peek();
        if (isSpace(t2)) return true;
        switch (t2) {
          case String.fromCharCode(EOF):
          case ".":
          case ",":
          case "|":
          case ":":
          case ")":
          case "(":
            return true;
        }
        return this.input.slice(this.pos).startsWith(this.rightDelim);
      }
      scanNumber() {
        this.accept("+-");
        let t2 = "0123456789_";
        return this.accept("0") && (this.accept("xX") ? t2 = "0123456789abcdefABCDEF_" : this.accept("oO") ? t2 = "01234567_" : this.accept("bB") && (t2 = "01_")), this.acceptRun(t2), this.accept(".") && this.acceptRun(t2), "0123456789_" === t2 && this.accept("eE") && (this.accept("+-"), this.acceptRun("0123456789_")), "0123456789abcdefABCDEF_" === t2 && this.accept("pP") && (this.accept("+-"), this.acceptRun("0123456789_")), this.accept("i"), !isAlphaNumeric(this.peek()) || (this.next(), false);
      }
      thisItem(t2) {
        const e2 = { typ: t2, pos: this.start, val: this.input.slice(this.start, this.pos), line: this.startLine };
        return this.start = this.pos, this.startLine = this.line, e2;
      }
      emitItem(t2) {
        return this.item = t2, null;
      }
    };
    function isSpace(t2) {
      return " " === t2 || "	" === t2 || "\r" === t2 || "\n" === t2;
    }
    function isAlphaNumeric(t2) {
      return "_" === t2 || /[a-zA-Z0-9]/.test(t2);
    }
    function leftTrimLength(t2) {
      let e2 = 0;
      for (; e2 < t2.length && spaceChars.includes(t2[e2]); ) e2++;
      return e2;
    }
    function rightTrimLength(t2) {
      let e2 = t2.length - 1;
      for (; e2 >= 0 && spaceChars.includes(t2[e2]); ) e2--;
      return t2.length - (e2 + 1);
    }
    function hasLeftTrimMarker(t2) {
      return t2.length >= 2 && t2[0] === trimMarker && spaceChars.includes(t2[1]);
    }
    function hasRightTrimMarker(t2) {
      return t2.length >= 2 && spaceChars.includes(t2[0]) && t2[1] === trimMarker;
    }
    function lexText(t2) {
      const e2 = t2.input.indexOf(t2.leftDelim, t2.pos);
      if (e2 >= 0) {
        if (e2 > t2.pos) {
          t2.pos += e2 - t2.pos;
          let r = 0;
          const i = t2.pos + t2.leftDelim.length;
          hasLeftTrimMarker(t2.input.slice(i)) && (r = rightTrimLength(t2.input.slice(t2.start, t2.pos))), t2.pos -= r, t2.line += (t2.input.slice(t2.start, t2.pos).match(/\n/g) || []).length;
          const n3 = t2.thisItem(20);
          if (t2.pos += r, t2.ignore(), n3.val.length > 0) return t2.emitItem(n3);
        }
        return lexLeftDelim;
      }
      return t2.pos = t2.input.length, t2.pos > t2.start ? (t2.line += (t2.input.slice(t2.start, t2.pos).match(/\n/g) || []).length, t2.emit(20)) : t2.emit(8);
    }
    function lexLeftDelim(t2) {
      t2.pos += t2.leftDelim.length;
      let e2 = 0;
      if (hasLeftTrimMarker(t2.input.slice(t2.pos)) && (e2 = trimMarkerLen), t2.input.slice(t2.pos + e2).startsWith(leftComment)) return t2.pos += e2, t2.ignore(), lexComment;
      const r = t2.thisItem(11);
      return t2.insideAction = true, t2.pos += e2, t2.ignore(), t2.parenDepth = 0, t2.emitItem(r);
    }
    function lexComment(t2) {
      t2.pos += leftComment.length;
      const e2 = t2.input.slice(t2.pos).indexOf(rightComment);
      if (e2 < 0) return t2.errorf("unclosed comment");
      t2.pos += e2 + rightComment.length;
      const [r, i] = t2.atRightDelim();
      if (!r) return t2.errorf("comment ends before closing delimiter");
      const n3 = t2.thisItem(4);
      return i && (t2.pos += trimMarkerLen), t2.pos += t2.rightDelim.length, i && (t2.pos += leftTrimLength(t2.input.slice(t2.pos))), t2.ignore(), t2.options.emitComment ? t2.emitItem(n3) : lexText;
    }
    function lexRightDelim(t2) {
      const [e2, r] = t2.atRightDelim();
      r && (t2.pos += trimMarkerLen, t2.ignore()), t2.pos += t2.rightDelim.length;
      const i = t2.thisItem(16);
      return r && (t2.pos += leftTrimLength(t2.input.slice(t2.pos)), t2.ignore()), t2.insideAction = false, t2.emitItem(i);
    }
    function lexInsideAction(t2) {
      const [e2, r] = t2.atRightDelim();
      if (e2) return 0 === t2.parenDepth ? lexRightDelim : t2.errorf("unclosed left paren");
      const i = t2.next();
      if (i === String.fromCharCode(EOF)) return t2.errorf("unclosed action");
      if (isSpace(i)) return t2.backup(), lexSpace;
      switch (i) {
        case "=":
          return t2.emit(6);
        case ":":
          return "=" !== t2.next() ? t2.errorf("expected :=") : t2.emit(7);
        case "|":
          return t2.emit(14);
        case '"':
          return lexQuote;
        case "`":
          return lexRawQuote;
        case "$":
          return lexVariable;
        case "'":
          return lexChar;
        case ".":
          if (t2.pos < t2.input.length) {
            const e4 = t2.input[t2.pos];
            if (!/[0-9]/.test(e4)) return lexField;
          }
          return t2.backup(), lexNumber;
        case "+":
        case "-":
          return t2.backup(), lexNumber;
        case "(":
          return t2.parenDepth++, t2.emit(12);
        case ")":
          return t2.parenDepth--, t2.parenDepth < 0 ? t2.errorf("unexpected right paren") : t2.emit(17);
        default:
          if (/[0-9]/.test(i)) return t2.backup(), lexNumber;
          if (isAlphaNumeric(i)) return t2.backup(), lexIdentifier;
          if (i.charCodeAt(0) <= 127 && /[\x20-\x7E]/.test(i)) return t2.emit(2);
          const e3 = i.codePointAt(0) || 0;
          return t2.errorf(`unrecognized character in action: U+${e3.toString(16).padStart(4, "0").toUpperCase()}`);
      }
    }
    function lexSpace(t2) {
      let e2 = 0;
      for (; isSpace(t2.peek()); ) t2.next(), e2++;
      return hasRightTrimMarker(t2.input.slice(t2.pos - 1)) && t2.input.slice(t2.pos - 1 + trimMarkerLen).startsWith(t2.rightDelim) && (t2.backup(), 1 === e2) ? lexRightDelim : t2.emit(18);
    }
    function lexIdentifier(t2) {
      for (; ; ) {
        const e2 = t2.next();
        if (!isAlphaNumeric(e2)) {
          t2.backup();
          const r = t2.input.slice(t2.start, t2.pos);
          if (!t2.atTerminator()) return t2.errorf(`bad character ${e2}`);
          if (key[r] > 22) {
            const e3 = key[r];
            return 24 === e3 && !t2.options.breakOK || 25 === e3 && !t2.options.continueOK ? t2.emit(10) : t2.emit(e3);
          }
          return "." === r[0] ? t2.emit(9) : "true" === r || "false" === r ? t2.emit(1) : t2.emit(10);
        }
      }
    }
    function lexField(t2) {
      return lexFieldOrVariable(t2, 9);
    }
    function lexVariable(t2) {
      return t2.atTerminator() ? t2.emit(21) : lexFieldOrVariable(t2, 21);
    }
    function lexFieldOrVariable(t2, e2) {
      if (t2.atTerminator()) return 21 === e2 ? t2.emit(21) : t2.emit(26);
      for (; ; ) if (!isAlphaNumeric(t2.next())) {
        t2.backup();
        break;
      }
      return t2.atTerminator() ? t2.emit(e2) : t2.errorf(`bad character ${t2.peek()}`);
    }
    function lexChar(t2) {
      const e2 = t2.pos - 1;
      t: for (; ; ) switch (t2.next()) {
        case "\\": {
          const e3 = t2.next();
          if (e3 === String.fromCharCode(EOF) || "\n" === e3) return t2.errorf("unterminated character constant");
          continue t;
        }
        case String.fromCharCode(EOF):
        case "\n":
          return t2.errorf("unterminated character constant");
        case "'":
          break t;
      }
      return t2.item = { typ: 3, pos: t2.start, val: t2.input.slice(e2, t2.pos), line: t2.startLine }, t2.start = t2.pos, null;
    }
    function lexNumber(t2) {
      return t2.scanNumber() ? "+" === t2.peek() || "-" === t2.peek() ? t2.scanNumber() && "i" === t2.input[t2.pos - 1] ? t2.emit(5) : t2.errorf(`bad number syntax: "${t2.input.slice(t2.start, t2.pos)}"`) : t2.emit(13) : t2.errorf(`bad number syntax: "${t2.input.slice(t2.start, t2.pos)}"`);
    }
    function lexQuote(t2) {
      const e2 = t2.pos - 1;
      t: for (; ; ) switch (t2.next()) {
        case "\\": {
          const e3 = t2.next();
          if (e3 === String.fromCharCode(EOF) || "\n" === e3) return t2.errorf("unterminated quoted string");
          continue t;
        }
        case String.fromCharCode(EOF):
        case "\n":
          return t2.errorf("unterminated quoted string");
        case '"':
          break t;
      }
      return t2.item = { typ: 19, pos: t2.start, val: t2.input.slice(e2, t2.pos), line: t2.startLine }, t2.start = t2.pos, null;
    }
    function lexRawQuote(t2) {
      for (; ; ) {
        const e2 = t2.next();
        if (e2 === String.fromCharCode(EOF)) return t2.errorf("unterminated raw quoted string");
        if ("`" === e2) break;
      }
      return t2.emit(15);
    }
    function lex(t2, e2, r = "", i = "") {
      return new Lexer(t2, e2, r, i);
    }
    var Mode = ((t2) => (t2[t2.ParseComments = 1] = "ParseComments", t2[t2.SkipFuncCheck = 2] = "SkipFuncCheck", t2))(Mode || {});
    function New(t2, e2 = []) {
      return new Tree2(t2, e2);
    }
    var Tree2 = class __Tree {
      constructor(t2, e2 = []) {
        this.Name = t2, this.ParseName = "", this.Root = null, this.Mode = 0, this.text = "", this.funcs = e2, this.lex = null, this.tokenArray = new Array(3).fill(null), this.peekCount = 0, this.vars = [], this.treeSet = /* @__PURE__ */ new Map(), this.actionLine = 0, this.rangeDepth = 0;
      }
      copy() {
        var t2;
        return this ? new __Tree(this.Name, []).setProperties({ ParseName: this.ParseName, Root: null == (t2 = this.Root) ? void 0 : t2.CopyList(), text: this.text }) : null;
      }
      setProperties(t2) {
        return Object.assign(this, t2), this;
      }
      next() {
        if (this.peekCount > 0) this.peekCount--;
        else {
          if (!this.lex) throw new Error("Lexer not initialized");
          const t3 = this.lex.nextItem();
          if (!t3) throw new Error("No token available from lexer");
          this.tokenArray[0] = t3;
        }
        const t2 = this.tokenArray[this.peekCount];
        if (!t2) throw new Error("No token available");
        return t2;
      }
      backup() {
        this.peekCount++;
      }
      backup2(t2) {
        this.tokenArray[1] = t2, this.peekCount = 2;
      }
      backup3(t2, e2) {
        this.tokenArray[1] = e2, this.tokenArray[2] = t2, this.peekCount = 3;
      }
      peek() {
        if (this.peekCount > 0) {
          const t3 = this.tokenArray[this.peekCount - 1];
          if (!t3) throw new Error("No token available");
          return t3;
        }
        if (this.peekCount = 1, !this.lex) throw new Error("Lexer not initialized");
        const t2 = this.lex.nextItem();
        if (!t2) throw new Error("No token available from lexer");
        return this.tokenArray[0] = t2, t2;
      }
      nextNonSpace() {
        let t2;
        for (; t2 = this.next(), 18 === t2.typ; ) ;
        return t2;
      }
      peekNonSpace() {
        const t2 = this.nextNonSpace();
        return this.backup(), t2;
      }
      errorContext(t2) {
        const e2 = t2.Position(), r = t2.tree() || this, i = r.text.substring(0, e2);
        let n3 = i.lastIndexOf("\n");
        -1 === n3 ? n3 = e2 : (n3++, n3 = e2 - n3);
        const s = 1 + (i.match(/\n/g) || []).length, o = t2.toString();
        return [`${r.ParseName}:${s}:${n3}`, o];
      }
      errorf(t2, ...e2) {
        this.Root = null;
        const r = this.tokenArray[0];
        if (!r) throw new Error(`template: ${this.ParseName}: ${sprintf(t2, ...e2)}`);
        throw t2 = `template: ${this.ParseName}:${r.line}: ${t2}`, new Error(sprintf(t2, ...e2));
      }
      error(t2) {
        this.errorf("%s", t2);
      }
      expect(t2, e2) {
        const r = this.nextNonSpace();
        return r.typ !== t2 && this.unexpected(r, e2), r;
      }
      expectOneOf(t2, e2, r) {
        const i = this.nextNonSpace();
        return i.typ !== t2 && i.typ !== e2 && this.unexpected(i, r), i;
      }
      unexpected(t2, e2) {
        if (0 === t2.typ) {
          let e3 = "";
          0 !== this.actionLine && this.actionLine !== t2.line && (e3 = ` in action started at ${this.ParseName}:${this.actionLine}`, t2.val.endsWith(" action") && (e3 = e3.substring(10))), this.errorf("%s%s", t2.val, e3);
        }
        this.errorf("unexpected %s in %s", t2.val, e2);
      }
      recover(t2) {
        var e2;
        const r = t2.err;
        if (r) {
          if (r instanceof Error && (null == (e2 = r.stack) ? void 0 : e2.includes("runtime error:"))) throw r;
          this && this.stopParse(), t2.err = r;
        }
      }
      newList(t2) {
        return new ListNode(t2).setTree(this);
      }
      newText(t2, e2) {
        return new TextNode(this, t2, e2);
      }
      newAction(t2, e2, r) {
        if (!(r instanceof PipeNode)) throw new Error("Pipeline must be a PipeNode");
        return new ActionNode(t2, e2, r).setTree(this);
      }
      newComment(t2, e2) {
        return new CommentNode(t2, e2).setTree(this);
      }
      newIf(t2, e2, r, i, n3) {
        if (!(r instanceof PipeNode)) throw new Error("Pipe must be a PipeNode");
        return new IfNode(this, t2, e2, r, i, n3);
      }
      newRange(t2, e2, r, i, n3) {
        if (!(r instanceof PipeNode)) throw new Error("Pipe must be a PipeNode");
        return new RangeNode(this, t2, e2, r, i, n3);
      }
      newTemplate(t2, e2, r, i) {
        if (null !== i && !(i instanceof PipeNode)) throw new Error("Pipe must be a PipeNode");
        return new TemplateNode(t2, e2, r, i).setTree(this);
      }
      newWith(t2, e2, r, i, n3) {
        if (!(r instanceof PipeNode)) throw new Error("Pipe must be a PipeNode");
        return new WithNode(this, t2, e2, r, i, n3);
      }
      newPipeline(t2, e2, r = []) {
        const i = new PipeNode(t2, e2).setTree(this);
        return r && (i.Decl = r), i;
      }
      newCommand(t2) {
        return new CommandNode(t2).setTree(this);
      }
      newChain(t2, e2) {
        return new ChainNode(t2, e2).setTree(this);
      }
      textOrAction() {
        const t2 = this.nextNonSpace();
        switch (t2.typ) {
          case 20:
            return this.newText(t2.pos, t2.val);
          case 11:
            this.actionLine = t2.line;
            const e2 = this.action();
            return this.clearActionLine(), e2;
          case 4:
            return this.newComment(t2.pos, t2.val);
          default:
            return this.unexpected(t2, "input"), this.newText(t2.pos, "");
        }
      }
      action() {
        const t2 = this.nextNonSpace();
        switch (this.actionLine = t2.line, t2.typ) {
          case 23:
            return this.blockControl();
          case 24:
            return this.breakControl(t2.pos, t2.line);
          case 25:
            return this.continueControl(t2.pos, t2.line);
          case 28:
            return this.elseControl();
          case 29:
            return this.endControl();
          case 30:
            return this.ifControl();
          case 32:
            return this.rangeControl();
          case 33:
            return this.templateControl();
          case 34:
            return this.withControl();
        }
        this.backup();
        const e2 = this.peek().pos, r = this.peek().line, i = this.pipeline("command", 16);
        return this.newAction(e2, r, i);
      }
      parse(t2, e2, r, i, n3 = []) {
        this.ParseName = this.Name;
        const s = lex(this.Name, t2, e2, r);
        this.startParse(n3, s, i), this.text = t2;
        let o = null;
        try {
          return this.doParse(), this.add(), [this, null];
        } catch (t3) {
          return o = t3 instanceof Error ? t3 : new Error(String(t3)), [this, o];
        } finally {
          this.stopParse();
        }
      }
      startParse(t2, e2, r) {
        this.Root = null, this.lex = e2, this.funcs = t2, this.treeSet = r, this.tokenArray = new Array(3).fill(null), this.peekCount = 0, this.vars = ["$"], this.actionLine = 0, this.lex && (this.lex.options = { emitComment: !!(1 & this.Mode), breakOK: !this.hasFunction("break"), continueOK: !this.hasFunction("continue") });
      }
      stopParse() {
        this.lex = null, this.funcs = [], this.treeSet = /* @__PURE__ */ new Map(), this.tokenArray = new Array(3).fill(null), this.peekCount = 0, this.vars = [], this.actionLine = 0;
      }
      doParse() {
        for (this.Root = this.newList(this.peek().pos); 8 !== this.peek().typ; ) {
          if (11 === this.peek().typ) {
            const t3 = this.next();
            if (27 === this.nextNonSpace().typ) {
              const t4 = New("definition");
              t4.text = this.text, t4.Mode = this.Mode, t4.ParseName = this.ParseName, t4.startParse(this.funcs, this.lex, this.treeSet), t4.parseDefinition();
              continue;
            }
            this.backup2(t3);
          }
          const t2 = this.textOrAction();
          switch (t2.Type()) {
            case 7:
            case 6:
              this.errorf("unexpected %s", t2);
              break;
            default:
              this.Root.append(t2);
          }
        }
      }
      parseDefinition() {
        const t2 = "define clause", e2 = this.expectOneOf(19, 15, t2), r = this.unquote(e2.val);
        let i;
        r instanceof Error && this.error(r), this.Name = r, this.expect(16, t2), [this.Root, i] = this.itemList(), 7 !== i.Type() && this.errorf("unexpected %s in %s", i, t2), this.add(), this.stopParse();
      }
      breakControl(t2, e2) {
        const r = this.tokenArray[0];
        if (!r) throw new Error("No token available");
        return 16 !== this.nextNonSpace().typ && this.unexpected(r, "{{break}}"), 0 === this.rangeDepth && this.errorf("{{break}} outside of range"), this.newBreak(t2, e2);
      }
      continueControl(t2, e2) {
        const r = this.tokenArray[0];
        if (!r) throw new Error("No token available");
        return 16 !== this.nextNonSpace().typ && this.unexpected(r, "{{continue}}"), 0 === this.rangeDepth && this.errorf("{{continue}} outside of range"), this.newContinue(t2, e2);
      }
      endControl() {
        return new EndNode(this.expect(16, "end").pos).setTree(this);
      }
      elseControl() {
        const t2 = this.peekNonSpace();
        if (30 === t2.typ) return new ElseNode(t2.pos, t2.line).setTree(this);
        const e2 = this.expect(16, "else");
        return new ElseNode(e2.pos, e2.line).setTree(this);
      }
      ifControl() {
        const [t2, e2, r, i, n3] = this.parseControl(true, "if");
        return this.newIf(t2, e2, r, i, n3);
      }
      rangeControl() {
        const [t2, e2, r, i, n3] = this.parseControl(false, "range");
        return this.newRange(t2, e2, r, i, n3);
      }
      withControl() {
        const [t2, e2, r, i, n3] = this.parseControl(false, "with");
        return this.newWith(t2, e2, r, i, n3);
      }
      templateControl() {
        const t2 = "template clause", e2 = this.nextNonSpace(), r = this.parseTemplateName(e2, t2);
        let i = null;
        return 16 !== this.nextNonSpace().typ && (this.backup(), i = this.pipeline(t2, 16)), this.newTemplate(e2.pos, e2.line, r, i);
      }
      blockControl() {
        const t2 = "block clause", e2 = this.nextNonSpace(), r = this.parseTemplateName(e2, t2), i = this.pipeline(t2, 16), n3 = this.lex, s = [...this.tokenArray], o = this.peekCount;
        n3 || this.errorf("Failed to save lexer state");
        const h2 = new __Tree(r);
        let u;
        return h2.Mode = this.Mode, h2.Root = this.newList(e2.pos), h2.ParseName = this.ParseName, h2.startParse(this.funcs, n3, this.treeSet), [h2.Root, u] = h2.itemList(), 7 !== u.Type() && this.errorf("unexpected %s in %s", u.toString(), t2), h2.add(), this.lex = n3, this.tokenArray = s, this.peekCount = o, this.newTemplate(e2.pos, e2.line, r, i);
      }
      itemList() {
        const t2 = this.newList(this.peekNonSpace().pos);
        for (; 8 !== this.peekNonSpace().typ; ) {
          const e2 = this.textOrAction();
          switch (e2.Type()) {
            case 7:
            case 6:
              return [t2, e2];
          }
          t2.append(e2);
        }
        return this.errorf("unexpected EOF"), [t2, this.newEnd(0)];
      }
      parseTemplateName(t2, e2) {
        switch (t2.typ) {
          case 19:
          case 15:
            const r = this.unquote(t2.val);
            return r instanceof Error && this.error(r), r;
          default:
            this.unexpected(t2, e2);
        }
        return "";
      }
      popVars(t2) {
        this.vars = this.vars.slice(0, t2);
      }
      pipeline(t2, e2) {
        let r = this.peekNonSpace();
        const i = this.newPipeline(r.pos, r.line);
        let n3 = true;
        for (; n3 && 21 === this.peekNonSpace().typ; ) {
          let e3 = this.next();
          const r3 = this.peek(), s = this.peekNonSpace();
          switch (true) {
            case (6 === s.typ || 7 === s.typ):
              i.IsAssign = 6 === s.typ, this.nextNonSpace(), i.Decl.push(this.newVariable(e3.pos, e3.val)), this.vars.push(e3.val), n3 = false;
              break;
            case (2 === s.typ && "," === s.val):
              if (this.nextNonSpace(), i.Decl.push(this.newVariable(e3.pos, e3.val)), this.vars.push(e3.val), "range" === t2 && i.Decl.length < 2) switch (this.peekNonSpace().typ) {
                case 21:
                  break;
                case 16:
                case 17:
                  n3 = false;
                  break;
                default:
                  this.errorf("range can only initialize variables");
              }
              else this.errorf("too many declarations in %s", t2);
              break;
            case 18 === r3.typ:
              this.backup3(e3, r3), n3 = false;
              break;
            default:
              this.backup2(e3), n3 = false;
          }
        }
        for (; ; ) {
          const r3 = this.nextNonSpace();
          switch (r3.typ) {
            case e2:
              return this.checkPipeline(i, t2), i;
            case 1:
            case 3:
            case 5:
            case 26:
            case 9:
            case 10:
            case 13:
            case 31:
            case 15:
            case 19:
            case 21:
            case 12:
              this.backup(), i.append(this.command());
              break;
            default:
              this.unexpected(r3, t2);
          }
        }
      }
      command() {
        const t2 = this.newCommand(this.peekNonSpace().pos);
        for (; ; ) {
          this.peekNonSpace();
          const e2 = this.operand();
          e2 && t2.Args.push(e2);
          const r = this.next();
          switch (r.typ) {
            case 18:
              continue;
            case 16:
            case 17:
              this.backup();
              break;
            case 14:
              break;
            default:
              this.unexpected(r, "operand");
          }
          break;
        }
        return 0 === t2.Args.length && this.errorf("empty command"), t2;
      }
      operand() {
        const t2 = this.term();
        if (t2) {
          if (9 === this.peek().typ) {
            const e2 = this.newChain(this.peek().pos, t2);
            for (; 9 === this.peek().typ; ) {
              const t3 = this.next().val;
              e2.add(t3);
            }
            switch (t2.Type()) {
              case 8:
                return this.newField(e2.Position(), e2.String());
              case 18:
                const r = e2.String();
                return this.newVariable(e2.Position(), r);
              case 2:
              case 16:
              case 13:
              case 12:
              case 5:
                this.errorf("unexpected . after term %q", t2.String());
              default:
                return e2;
            }
          }
          return t2;
        }
      }
      term() {
        const t2 = this.nextNonSpace();
        if (t2) {
          switch (t2.typ) {
            case 10:
              return !(2 & this.Mode) && !this.hasFunction(t2.val) && this.errorf("function %q not defined", t2.val), new IdentifierNode(t2.val).setTree(this).setPos(t2.pos);
            case 26:
              return this.newDot(t2.pos);
            case 31:
              return this.newNil(t2.pos);
            case 21:
              return this.useVar(t2.pos, t2.val);
            case 9:
              return this.newField(t2.pos, t2.val);
            case 1:
              return this.newBool(t2.pos, "true" === t2.val);
            case 3:
            case 5:
            case 13:
              const e2 = this.newNumber(t2.pos, t2.val, t2.typ);
              return e2 instanceof Error && this.error(e2), e2;
            case 12:
              return this.pipeline("parenthesized pipeline", 17);
            case 19:
            case 15:
              const r = this.unquote(t2.val);
              if ("string" == typeof r) return this.newString(t2.pos, t2.val, r);
              this.error(r);
          }
          this.backup();
        }
      }
      checkPipeline(t2, e2) {
        0 === t2.Cmds.length && this.errorf("missing value for %s", e2);
        for (let e3 = 0; e3 < t2.Cmds.length - 1; e3++) {
          const r = t2.Cmds[e3 + 1];
          if (r.Args.length) switch (r.Args[0].Type()) {
            case 2:
            case 5:
            case 12:
            case 13:
            case 16:
              this.errorf("non executable command in pipeline stage %d", e3 + 2);
          }
        }
      }
      useVar(t2, e2) {
        const r = this.newVariable(t2, e2);
        for (const t3 of this.vars) if (t3 === r.Ident[0]) return r;
        throw this.errorf("undefined variable %q", r.Ident[0]), new Error("unreachable");
      }
      newVariable(t2, e2) {
        const r = e2.split(".").filter((t3) => "" !== t3);
        return new VariableNode(t2, r).setTree(this);
      }
      newField(t2, e2) {
        return new FieldNode(t2, e2.substring(1).split(".")).setTree(this);
      }
      newNumber(pos, text, typ) {
        const n = new NumberNode(this, pos, text);
        try {
          switch (typ) {
            case 3: {
              if (text.length < 2 || "'" !== text[0] || "'" !== text[text.length - 1]) throw new Error(`malformed character constant: ${text}`);
              const char = text.slice(1, -1), rune = 1 === char.length ? char.charCodeAt(0) : char.startsWith("\\u") || char.startsWith("\\x") ? parseInt(char.slice(2), 16) : char.startsWith("\\") ? eval(`"${text}"`.slice(1, -1)).charCodeAt(0) : char.charCodeAt(0);
              return n.IsInt = true, n.Int64 = rune, n.IsUint = true, n.Uint64 = rune, n.IsFloat = true, n.Float64 = rune, n;
            }
            case 5: {
              const t2 = text.match(/^([-+]?\d*\.?\d*(?:[eE][-+]?\d+)?)([-+]\d*\.?\d*(?:[eE][-+]?\d+)?)?i$/);
              if (!t2) throw new Error(`illegal complex number syntax: ${text}`);
              const e2 = t2[1] ? parseFloat(t2[1]) : 0, r = t2[2] ? parseFloat(t2[2] + "1") : 1;
              return n.IsComplex = true, n.Complex128 = { re: e2, im: r }, this.simplifyComplex(n), n;
            }
          }
          if (text.endsWith("i")) {
            const t2 = parseFloat(text.slice(0, -1));
            if (!isNaN(t2)) return n.IsComplex = true, n.Complex128 = { re: 0, im: t2 }, this.simplifyComplex(n), n;
          }
          const cleanText = text.replace(/_/g, "");
          let value, isInt = false;
          if (cleanText.startsWith("0x") || cleanText.startsWith("0X")) value = parseInt(cleanText.slice(2), 16), isInt = true;
          else if (cleanText.startsWith("0o") || cleanText.startsWith("0O")) value = parseInt(cleanText.slice(2), 8), isInt = true;
          else if (cleanText.startsWith("0b") || cleanText.startsWith("0B")) value = parseInt(cleanText.slice(2), 2), isInt = true;
          else if (cleanText.startsWith("0") && cleanText.length > 1 && !/[.eE]/.test(cleanText)) value = parseInt(cleanText, 8), isInt = true;
          else {
            const t2 = parseInt(cleanText, 10);
            isNaN(t2) || t2.toString() !== cleanText ? (value = parseFloat(cleanText), isInt = false) : (value = t2, isInt = true);
          }
          if (!isNaN(value)) return isInt && (n.IsInt = true, n.Int64 = value, value >= 0 && (n.IsUint = true, n.Uint64 = value)), n.IsFloat = true, n.Float64 = value, n;
          throw new Error(`illegal number syntax: ${text}`);
        } catch (t2) {
          throw console.error(`[newNumber] Error creating number node: ${t2}`), t2 instanceof Error ? t2 : new Error(String(t2));
        }
      }
      simplifyComplex(t2) {
        0 === t2.Complex128.im && (t2.IsFloat = true, t2.Float64 = t2.Complex128.re, Number.isInteger(t2.Float64) && (t2.IsInt = true, t2.Int64 = t2.Float64, t2.Float64 >= 0 && (t2.IsUint = true, t2.Uint64 = t2.Float64)));
      }
      newBreak(t2, e2) {
        return new BreakNode(t2, e2).setTree(this);
      }
      newContinue(t2, e2) {
        return new ContinueNode(t2, e2).setTree(this);
      }
      newDot(t2) {
        return new DotNode(t2).setTree(this);
      }
      newNil(t2) {
        return new NilNode(t2).setTree(this);
      }
      newBool(t2, e2) {
        return new BoolNode(t2, e2).setTree(this);
      }
      newString(t2, e2, r) {
        return new StringNode(t2, e2, r).setTree(this);
      }
      newEnd(t2) {
        return new EndNode(t2).setTree(this);
      }
      newDefine(t2, e2, r, i) {
        return new DefineNode(t2, e2, r, i).setTree(this);
      }
      unquote(t2) {
        if (t2.length < 2) return new Error("invalid quoted string");
        const e2 = t2[0];
        if (e2 !== t2[t2.length - 1]) return new Error("invalid quoted string");
        if (t2 = t2.slice(1, -1), "`" === e2) return t2;
        let r = "";
        for (let e3 = 0; e3 < t2.length; e3++) if ("\\" === t2[e3]) {
          if (e3 + 1 >= t2.length) return new Error("unterminated escape sequence");
          switch (e3++, t2[e3]) {
            case "a":
              r += "\x07";
              break;
            case "b":
              r += "\b";
              break;
            case "f":
              r += "\f";
              break;
            case "n":
              r += "\n";
              break;
            case "r":
              r += "\r";
              break;
            case "t":
              r += "	";
              break;
            case "v":
              r += "\v";
              break;
            case "\\":
              r += "\\";
              break;
            case '"':
              r += '"';
              break;
            case "'":
              r += "'";
              break;
            default:
              return new Error(`invalid escape sequence: \\${t2[e3]}`);
          }
        } else r += t2[e3];
        return r;
      }
      clearActionLine() {
        this.actionLine = 0;
      }
      add() {
        const t2 = this.treeSet.get(this.Name);
        t2 && !this.isEmptyTree(t2.Root) ? this.isEmptyTree(this.Root) || this.errorf("template: multiple definition of template %q", this.Name) : this.treeSet.set(this.Name, this);
      }
      isEmptyTree(t2) {
        return IsEmptyTree(t2);
      }
      hasFunction(t2) {
        for (const e2 of this.funcs) if (e2 && e2.has(t2)) return true;
        return false;
      }
      parseControl(t2, e2) {
        const r = this.vars.length;
        try {
          const r3 = this.pipeline(e2, 16);
          let i, n3;
          "range" === e2 && this.rangeDepth++, [i, n3] = this.itemList(), "range" === e2 && this.rangeDepth--;
          let s = null;
          switch (n3.Type()) {
            case 7:
              break;
            case 6:
              if (t2 && 30 === this.peek().typ) {
                this.next(), s = this.newList(n3.Position()), s.append(this.ifControl());
                break;
              }
              [s, n3] = this.itemList(), 7 !== n3.Type() && this.errorf("expected end; found %s", n3);
          }
          return [r3.Position(), r3.Line, r3, i, s];
        } finally {
          this.popVars(r);
        }
      }
    };
    function parse(t2, e2, r = "", i = "", n3 = []) {
      const s = New(t2, n3), o = /* @__PURE__ */ new Map(), [h2, u] = s.parse(e2, r, i, o, n3);
      return u ? (console.error(`[parse] Error parsing template: ${u.message}`), [/* @__PURE__ */ new Map(), u]) : (o.set(t2, h2), [o, null]);
    }
    function IsEmptyTree(t2) {
      if (!t2) return true;
      switch (t2.Type()) {
        case 1:
        case 10:
        case 15:
        case 17:
        case 19:
          return false;
        case 20:
          return true;
        case 11:
          const e2 = t2;
          for (const t3 of e2.Nodes) if (!IsEmptyTree(t3)) return false;
          return true;
        case 0:
          const r = t2;
          return 0 === r.Text.length || "" === new TextDecoder().decode(r.Text).trim();
        default:
          throw new Error("unknown node: " + t2.String());
      }
    }
    var StringBuffer = class {
      constructor(t2 = 64) {
        this.chunks = [], this.currentSize = 0, this.chunks = [], this.chunks.length = 0;
      }
      push(t2) {
        0 !== t2.length && (this.chunks.push(t2), this.currentSize += t2.length);
      }
      join() {
        if (0 === this.chunks.length) return "";
        const t2 = this.chunks.join("");
        return this.reset(), t2;
      }
      reset() {
        this.chunks.length = 0, this.currentSize = 0;
      }
      size() {
        return this.currentSize;
      }
      isEmpty() {
        return 0 === this.chunks.length;
      }
    };
    var common = class {
      constructor() {
        this.tmpl = /* @__PURE__ */ new Map(), this.option = { missingKey: "invalid" }, this.parseFuncs = /* @__PURE__ */ new Map(), this.execFuncs = /* @__PURE__ */ new Map();
      }
    };
    var Template = class t2 {
      constructor(t3) {
        this.Tree = null, this.common = null, this.leftDelim = "", this.rightDelim = "", this.rootName = "", this.name = t3, this.init();
      }
      Name() {
        return this.name;
      }
      New(e2) {
        this.init();
        const r = new t2(e2);
        return r.common = this.common, r.leftDelim = this.leftDelim, r.rightDelim = this.rightDelim, r;
      }
      init() {
        if (null === this.common) {
          this.common = new common();
          const t3 = builtins();
          for (const [e2, r] of t3.entries()) this.common.execFuncs.set(e2, r);
        }
      }
      Clone() {
        const t3 = this.copy(null);
        if (t3.init(), null === this.common) return [t3, null];
        for (const [e2, r] of this.common.tmpl.entries()) {
          if (e2 === this.name) {
            t3.common.tmpl.set(this.name, t3);
            continue;
          }
          const i = r.copy(t3.common);
          t3.common.tmpl.set(e2, i);
        }
        for (const [e2, r] of this.common.parseFuncs.entries()) t3.common.parseFuncs.set(e2, r);
        for (const [e2, r] of this.common.execFuncs.entries()) t3.common.execFuncs.set(e2, r);
        return [t3, null];
      }
      copy(e2) {
        const r = new t2(this.name);
        return r.Tree = this.Tree, r.common = e2, r.leftDelim = this.leftDelim, r.rightDelim = this.rightDelim, r;
      }
      AddParseTree(t3, e2) {
        this.init();
        let r = this;
        return t3 !== this.name && (r = this.New(t3)), (this.associate(r, e2) || null === r.Tree) && (r.Tree = e2), [r, null];
      }
      Templates() {
        if (null === this.common) return [];
        const t3 = [];
        for (const e2 of this.common.tmpl.values()) t3.push(e2);
        return t3;
      }
      Delims(t3, e2) {
        return this.init(), this.leftDelim = t3, this.rightDelim = e2, this;
      }
      Funcs(t3) {
        this.init();
        for (const [e2, r] of t3.entries()) {
          if (!this.goodName(e2)) throw new Error(`function name "${e2}" is not a valid identifier`);
          if ("function" != typeof r) throw new Error(`value for ${e2} not a function`);
          this.common.parseFuncs.set(e2, r), this.common.execFuncs.set(e2, r);
        }
        return this;
      }
      goodName(t3) {
        if ("" === t3) return false;
        for (let e2 = 0; e2 < t3.length; e2++) {
          const r = t3.charCodeAt(e2);
          if ("_" !== t3.charAt(e2)) {
            if (0 === e2 && !this.isLetter(r)) return false;
            if (!this.isLetter(r) && !this.isDigit(r)) return false;
          }
        }
        return true;
      }
      isLetter(t3) {
        return t3 >= 65 && t3 <= 90 || t3 >= 97 && t3 <= 122 || t3 > 127;
      }
      isDigit(t3) {
        return t3 >= 48 && t3 <= 57;
      }
      Lookup(t3) {
        return null === this.common ? null : this.common.tmpl.get(t3) || null;
      }
      Parse(t3) {
        this.init();
        const e2 = [builtins()];
        this.common.parseFuncs.size > 0 && e2.push(this.common.parseFuncs);
        const [r, i] = parse(this.name, t3, this.leftDelim, this.rightDelim, e2);
        if (null !== i) return [this, i];
        for (const [t4, e3] of r.entries()) {
          const [r3, i2] = this.AddParseTree(t4, e3);
          if (null !== i2) return [this, i2];
        }
        return [this, null];
      }
      associate(t3, e2) {
        if (t3.common !== this.common) throw new Error("internal error: associate not common");
        const r = this.common.tmpl.get(t3.name);
        return !(void 0 !== r && IsEmptyTree(e2.Root) && null !== r.Tree || (this.common.tmpl.set(t3.name, t3), 0));
      }
      Execute(t3) {
        return __async(this, null, function* () {
          if (null === this.Tree || null === this.Tree.Root) return ["", new Error(`template: ${this.name}: "${this.name}" is an incomplete or empty template`)];
          "" === this.rootName && (this.rootName = this.name);
          const e2 = new StringBuffer(), r = yield this.execute(e2, t3);
          return [e2.join(), r];
        });
      }
      ExecuteTemplate(t3, e2) {
        return __async(this, null, function* () {
          const r = this.Lookup(t3);
          return null === r ? ["", new Error(`template: ${t3} is undefined`)] : yield r.Execute(e2);
        });
      }
      execute(t3, e2) {
        return __async(this, null, function* () {
          try {
            if (null === this.Tree || null === this.Tree.Root) return new Error(`template: ${this.name}: "${this.name}" is an incomplete or empty template`);
            const r = new execContext(this, e2);
            return yield r.walk(t3, this.Tree.Root), null;
          } catch (t4) {
            return t4 instanceof Error ? new ExecError(this.name, t4) : new ExecError(this.name, new Error(String(t4)));
          }
        });
      }
      ErrorContext(t3) {
        if (!this.Tree) return ["", ""];
        const e2 = t3.Position(), r = t3.tree(), i = r.text.substring(0, e2);
        let n3 = i.lastIndexOf("\n");
        -1 === n3 ? n3 = e2 : (n3++, n3 = e2 - n3);
        const s = 1 + (i.match(/\n/g) || []).length, o = t3.String();
        return [`${r.ParseName}:${s}:${n3}`, o];
      }
      Option(...t3) {
        this.init();
        for (const e2 of t3) this.setOption(e2);
        return this;
      }
      setOption(t3) {
        if ("" === t3) throw new Error("empty option string");
        const e2 = t3.split("=");
        if (2 === e2.length) {
          const t4 = e2[0], r = e2[1];
          if ("missingkey" === t4) switch (r) {
            case "invalid":
            case "default":
              return void (this.common && (this.common.option.missingKey = "invalid"));
            case "zero":
              return void (this.common && (this.common.option.missingKey = "zero"));
            case "error":
              return void (this.common && (this.common.option.missingKey = "error"));
          }
        }
        throw new Error("unrecognized option: " + t3);
      }
    };
    var execContext = class t2 {
      constructor(t3, e2) {
        this.node = null, this.vars = [], this.depth = 0, this.funcCache = /* @__PURE__ */ new Map(), this.tmpl = t3, this.wr = [], this.dot = e2, this.rootDot = e2, this.vars.push(new Variable("$", e2));
      }
      resolveIfPromise(t3) {
        return __async(this, null, function* () {
          if (null == t3) return t3;
          const e2 = typeof t3;
          return "string" === e2 || "number" === e2 || "boolean" === e2 || "symbol" === e2 || "function" === e2 ? t3 : "object" === e2 && (t3 instanceof Promise || t3.then && "function" == typeof t3.then) ? yield t3 : t3;
        });
      }
      isLetter(t3) {
        return t3 >= 65 && t3 <= 90 || t3 >= 97 && t3 <= 122 || t3 > 127;
      }
      isDigit(t3) {
        return t3 >= 48 && t3 <= 57;
      }
      isValidIdentifier(t3) {
        if (0 === t3.length) return false;
        const e2 = t3.charCodeAt(0);
        if (!this.isLetter(e2) && 95 !== e2) return false;
        for (let e3 = 1; e3 < t3.length; e3++) {
          const r = t3.charCodeAt(e3);
          if (!this.isLetter(r) && !this.isDigit(r) && 95 !== r) return false;
        }
        return true;
      }
      push(t3, e2) {
        this.vars.push(new Variable(t3, e2));
      }
      mark() {
        return this.vars.length;
      }
      pop(t3) {
        t3 < this.vars.length && (this.vars.length = t3);
      }
      at(t3) {
        t3 && "object" == typeof t3 && t3.Type && "function" == typeof t3.Type ? this.node = t3 : this.node = null;
      }
      setVar(t3, e2) {
        for (let r = this.vars.length - 1; r >= 0; r--) if (this.vars[r].name === t3) return void (this.vars[r].value = e2);
        this.errorf(`undefined variable: ${t3}`);
      }
      setTopVar(t3, e2) {
        t3 >= 0 && t3 < this.vars.length && (this.vars[this.vars.length - t3 - 1].value = e2);
      }
      varValue(t3) {
        for (let e2 = this.vars.length - 1; e2 >= 0; e2--) if (this.vars[e2].name === t3) return this.vars[e2].value;
        return null;
      }
      errorf(t3, ...e2) {
        const r = this.tmpl.name;
        let i;
        if (null === this.node) i = this.sprintf(`template: %s: ${t3}`, r, ...e2);
        else {
          const [n3, s] = this.tmpl.ErrorContext(this.node);
          i = this.sprintf(`template: %s: executing "%s" at <%s>: ${t3}`, n3, r, s, ...e2);
        }
        throw new ExecError(this.tmpl.name, new Error(i));
      }
      sprintf(t3, ...e2) {
        let r = 0;
        return t3.replace(/%[sdvf]/g, () => {
          if (r < e2.length) {
            const t4 = e2[r++];
            return String(t4);
          }
          return "%?";
        });
      }
      isTrue(t3) {
        return null != t3 && ("boolean" == typeof t3 ? t3 : "number" == typeof t3 ? 0 !== t3 : "string" == typeof t3 ? "" !== t3 : Array.isArray(t3) ? t3.length > 0 : "object" != typeof t3 || Object.keys(t3).length > 0);
      }
      walk(t3, e2) {
        return __async(this, null, function* () {
          if (null !== e2) switch (this.at(e2), e2.Type()) {
            case 0:
              yield this.walkText(t3, e2);
              break;
            case 1:
              yield this.walkAction(t3, e2);
              break;
            case 11:
              yield this.walkList(t3, e2);
              break;
            case 10:
              yield this.walkIf(t3, e2);
              break;
            case 15:
              yield this.walkRange(t3, e2);
              break;
            case 17:
              yield this.walkTemplate(t3, e2);
              break;
            case 19:
              yield this.walkWith(t3, e2);
              break;
            default:
              this.errorf(`unexpected node type: ${e2.Type()}`);
          }
        });
      }
      walkText(t3, e2) {
        return __async(this, null, function* () {
          const r = new TextDecoder().decode(e2.Text);
          t3.push(r);
        });
      }
      walkAction(t3, e2) {
        return __async(this, null, function* () {
          const r = yield this.evalPipeline(e2.Pipe, yield this.evalDot());
          if (!(e2.Pipe && e2.Pipe.Decl && e2.Pipe.Decl.length > 0)) {
            if ("function" == typeof r && this.errorf("can't print %s of type %s", r, typeof r), e2.Pipe && e2.Pipe.Cmds && 1 === e2.Pipe.Cmds.length) {
              const t4 = e2.Pipe.Cmds[0];
              t4.Args && 1 === t4.Args.length && t4.Args[0].Type && 12 === t4.Args[0].Type() && this.errorf("nil is not a command");
            }
            yield this.printValue(t3, e2, r);
          }
        });
      }
      printValue(t3, e2, r) {
        return __async(this, null, function* () {
          this.at(e2);
          const [i, n3] = this.printableValue(r);
          n3 || this.errorf("can't print %s of type %s", e2, typeof r), t3.push(String(i));
        });
      }
      printableValue(t3) {
        if (null === t3) return ["", true];
        if (void 0 === t3) return ["", true];
        if ("function" == typeof t3) try {
          return [t3(), true];
        } catch (t4) {
          return t4 instanceof Error ? [t4.message, true] : [String(t4), true];
        }
        if ("object" == typeof t3) {
          if (Array.isArray(t3)) return [t3.join(","), true];
          if (Object.getPrototypeOf(t3) === Object.prototype) return ["[object Object]", true];
        }
        return t3 && "function" == typeof t3.String ? [t3.String(), true] : t3 instanceof Error ? [t3.message, true] : [t3, true];
      }
      walkList(t3, e2) {
        return __async(this, null, function* () {
          for (const r of e2.Nodes) yield this.walk(t3, r);
        });
      }
      walkIf(t3, e2) {
        return __async(this, null, function* () {
          const r = this.mark();
          try {
            const r3 = yield this.evalPipeline(e2.Pipe);
            this.isTrue(r3) ? yield this.walk(t3, e2.List) : null !== e2.ElseList && (yield this.walk(t3, e2.ElseList));
          } finally {
            this.pop(r);
          }
        });
      }
      walkRange(t3, e2) {
        return __async(this, null, function* () {
          const r = this.mark();
          try {
            const r3 = yield this.evalPipeline(e2.Pipe);
            if (null == r3) return void (null !== e2.ElseList && (yield this.walk(t3, e2.ElseList)));
            true === r3.i && this.errorf("range over send-only channel");
            const i = (r4, i2) => __async(this, null, function* () {
              const n3 = this.mark();
              try {
                const n4 = this.dot;
                this.dot = i2, e2.Pipe.Decl.length > 0 && (e2.Pipe.IsAssign ? e2.Pipe.Decl.length > 1 ? (this.setVar(e2.Pipe.Decl[0].Ident[0], r4), this.setVar(e2.Pipe.Decl[1].Ident[0], i2)) : this.setVar(e2.Pipe.Decl[0].Ident[0], i2) : e2.Pipe.Decl.length > 1 ? (this.push(e2.Pipe.Decl[0].Ident[0], r4), this.push(e2.Pipe.Decl[1].Ident[0], i2)) : this.push(e2.Pipe.Decl[0].Ident[0], i2)), yield this.walk(t3, e2.List), this.dot = n4;
              } finally {
                this.pop(n3);
              }
            });
            if (Array.isArray(r3)) {
              if (0 === r3.length) return void (null !== e2.ElseList && (yield this.walk(t3, e2.ElseList)));
              for (let t4 = 0; t4 < r3.length; t4++) yield i(t4, r3[t4]);
            } else if (r3 instanceof Map) {
              if (0 === r3.size) return void (null !== e2.ElseList && (yield this.walk(t3, e2.ElseList)));
              for (const [t4, e3] of r3.entries()) yield i(t4, e3);
            } else if ("object" == typeof r3 && null !== r3) {
              const n3 = Object.keys(r3);
              if (0 === n3.length) return void (null !== e2.ElseList && (yield this.walk(t3, e2.ElseList)));
              for (const t4 of n3) yield i(t4, r3[t4]);
            } else null !== e2.ElseList && (yield this.walk(t3, e2.ElseList));
          } finally {
            this.pop(r);
          }
        });
      }
      walkTemplate(e2, r) {
        return __async(this, null, function* () {
          this.at(r);
          const i = this.tmpl.Lookup(r.Name);
          i || this.errorf("template %q not defined", r.Name), this.depth >= 100 && this.errorf("exceeded maximum template depth (%v)", 100);
          const n3 = yield this.evalPipeline(r.Pipe), s = new t2(i, n3);
          s.depth = this.depth + 1, s.node = this.node, yield s.walk(e2, i.Tree.Root);
        });
      }
      walkWith(t3, e2) {
        return __async(this, null, function* () {
          const r = this.mark();
          try {
            const r3 = yield this.evalPipeline(e2.Pipe);
            if (this.isTrue(r3)) {
              const i = this.dot;
              try {
                this.dot = r3, yield this.walk(t3, e2.List);
              } finally {
                this.dot = i;
              }
            } else null !== e2.ElseList && (yield this.walk(t3, e2.ElseList));
          } finally {
            this.pop(r);
          }
        });
      }
      evalPipeline(t3, e2) {
        return __async(this, null, function* () {
          if (null === t3) return null;
          let e3 = null;
          for (const r of t3.Cmds) e3 = yield this.evalCommand(r, e3);
          e3 = yield this.resolveIfPromise(e3);
          for (const r of t3.Decl) t3.IsAssign ? this.setVar(r.Ident[0], e3) : this.push(r.Ident[0], e3);
          return e3;
        });
      }
      evalCommand(t3, e2 = null) {
        return __async(this, null, function* () {
          null !== t3.Args && 0 !== t3.Args.length || this.errorf("empty command");
          const r = t3.Args[0], i = t3.Args;
          switch (r.Type()) {
            case 9:
              return yield this.evalFunction(r, t3, i, e2);
            case 8:
              return yield this.evalFieldNode(r, i, e2);
            case 3:
              const n3 = yield this.evalArg(r.Node);
              return null == n3 && this.errorf("indirection through explicit nil in %s", r.String()), yield this.evalFieldChain(n3, n3, r, r.Field, i, e2);
            case 5:
              return yield this.evalDot();
            case 12:
              return null;
            case 18:
              return yield this.evalVariable(r, i, e2);
            default:
              return yield this.evalArg(r);
          }
        });
      }
      notAFunction(t3, e2) {
        (t3 && t3.length > 1 || null !== e2) && this.errorf("can't give argument to non-function %s", t3[0]);
      }
      evalFieldNode(t3, e2, r) {
        return __async(this, null, function* () {
          const i = yield this.evalDot();
          return this.at(t3), yield this.evalFieldChain(i, i, t3, t3.Ident, e2, r);
        });
      }
      evalFieldChain(t3, e2, r, i) {
        return __async(this, arguments, function* (t4, e3, r3, i2, n3 = [], s = null) {
          const o = i2.length;
          for (let n4 = 0; n4 < o - 1; n4++) e3 = yield this.evalField(t4, i2[n4], r3, [], null, e3);
          return yield this.evalField(t4, i2[o - 1], r3, n3, s, e3);
        });
      }
      evalField(t3, e2, r, i, n3, s) {
        return __async(this, null, function* () {
          if (s && "object" == typeof s && !Array.isArray(s) && null !== s && !e2.startsWith("_") && "unexported" !== e2) {
            const t4 = s[e2];
            if (void 0 !== t4 && "function" != typeof t4 && (!t4 || "function" != typeof t4.then)) return (i && i.length > 1 || null !== n3) && this.notAFunction(i || [], n3), t4;
          }
          return yield this.evalFieldSlow(t3, e2, r, i, n3, s);
        });
      }
      evalFieldSlow(t3, e2, r, i, n3, s) {
        return __async(this, null, function* () {
          var t4, o, h2;
          if (s = yield this.resolveIfPromise(s), e2.startsWith("_") && this.errorf("can't evaluate unexported field %s in type %s", e2, typeof s), "unexported" === e2 && this.errorf("can't evaluate unexported field %s in type %s", e2, typeof s), null == s) return "error" === (null == (t4 = this.tmpl.common) ? void 0 : t4.option.missingKey) && this.errorf("nil data; no entry for key %q", e2), void this.errorf("can't evaluate field %s in type %s", e2, typeof s);
          if (Array.isArray(s) && s.length > 0) {
            const t5 = s[0];
            if (t5 && "object" == typeof t5 && "function" == typeof t5[e2]) return yield Promise.all(s.map((t6) => __async(this, null, function* () {
              if (t6 && "object" == typeof t6 && "function" == typeof t6[e2]) return "String" === e2 ? yield this.resolveIfPromise(t6[e2].call(t6)) : t6[e2].bind(t6);
            })));
          }
          s && "object" == typeof s && ("map .WRONG type" === this.tmpl.name && "one" === e2 && s.hasOwnProperty("1") || s.hasOwnProperty("1") && s.hasOwnProperty("2") && s.hasOwnProperty("3") && !s.hasOwnProperty("one") && !s.hasOwnProperty("two") && !s.hasOwnProperty("three")) && this.errorf("map has key %s of type %s, not %s", e2, "number", "string");
          const u = yield this.resolveIfPromise(s[e2]);
          if ("function" == typeof u) return "String" === e2 ? yield this.resolveIfPromise(u.call(s)) : this.isMethod(s, e2) || i && i.length > 1 || null !== n3 ? yield this.evalCall(u.bind(s), e2, r, i, n3) : u.bind(s);
          if (void 0 === u) if ("object" != typeof s || null === s || Object.getPrototypeOf(s) !== Object.prototype && null !== Object.getPrototypeOf(s)) this.errorf("can't evaluate field %s in type %s", e2, typeof s);
          else if (0 === Object.keys(s).length) switch (null == (o = this.tmpl.common) ? void 0 : o.option.missingKey) {
            case "invalid":
            case "default":
              return;
            case "zero":
              return null;
            case "error":
              this.errorf("map has no entry for key %q", e2);
          }
          else switch (null == (h2 = this.tmpl.common) ? void 0 : h2.option.missingKey) {
            case "invalid":
            case "default":
              return;
            case "zero":
              return null;
            case "error":
              this.errorf("map has no entry for key %q", e2);
          }
          return (i && i.length > 1 || null !== n3) && this.notAFunction(i || [], n3), u;
        });
      }
      evalFunction(t3, e2, r, i) {
        return __async(this, null, function* () {
          this.at(t3);
          const n3 = t3.Ident, s = this.evalFunctionByName(n3);
          return null === s && this.errorf("%q is not a defined function", n3), yield this.evalCall(s, n3, e2, r, i);
        });
      }
      evalFunctionByName(t3) {
        if (this.funcCache.has(t3)) return this.funcCache.get(t3);
        if (null === this.tmpl.common) return null;
        const e2 = this.tmpl.common.execFuncs.get(t3);
        return this.funcCache.set(t3, e2 || null), e2 || null;
      }
      safeCall(t3, e2) {
        return __async(this, null, function* () {
          try {
            const r = t3(...e2), i = yield this.resolveIfPromise(r);
            if (Array.isArray(i) && 2 === i.length) {
              const t4 = i[1];
              if (null !== t4 && (t4 instanceof Error || "object" == typeof t4 && "message" in t4)) return [i[0], t4 instanceof Error ? t4 : new Error(t4.message)];
            }
            return [i, null];
          } catch (t4) {
            return t4 instanceof Error ? [null, t4] : [null, new Error(String(t4))];
          }
        });
      }
      evalCall(t3, e2, r, i, n3) {
        return __async(this, null, function* () {
          null !== i && (i = i.slice(1));
          const s = [];
          for (let t4 = 0; t4 < i.length; t4++) s.push(yield this.evalArg(i[t4]));
          null !== n3 && s.push(n3);
          const [o, h2] = yield this.safeCall(t3, s);
          return null !== h2 && (this.at(r), this.errorf("error calling %s: %s", e2, h2.message)), o;
        });
      }
      evalArg(t3) {
        return __async(this, null, function* () {
          switch (this.at(t3), t3.Type()) {
            case 5:
              return yield this.evalDot();
            case 12:
              return null;
            case 18:
              return yield this.evalVariable(t3);
            case 8:
              return yield this.evalFieldNode(t3, [], null);
            case 2:
              return t3.True;
            case 16:
              return t3.Text;
            case 13:
              return this.evalNumber(t3);
            case 9:
              const e2 = { Args: [t3] };
              return yield this.evalFunction(t3, e2, [t3], null);
            case 3:
              const r = yield this.evalArg(t3.Node);
              return null == r && this.errorf("indirection through explicit nil in %s", t3.String()), yield this.evalFieldChain(r, r, t3, t3.Field, [], null);
            case 14:
              return yield this.evalPipeline(t3, yield this.evalDot());
            default:
              return this.errorf("can't handle %s yet", t3.Type()), null;
          }
        });
      }
      evalDot() {
        return __async(this, null, function* () {
          return this.dot;
        });
      }
      evalVariable(t3) {
        return __async(this, arguments, function* (t4, e2 = [], r = null) {
          const i = t4.Ident[0];
          if ("$" === i) return 1 === t4.Ident.length ? (this.notAFunction(e2, r), this.rootDot) : yield this.evalFieldChain(this.rootDot, this.rootDot, t4, t4.Ident.slice(1), e2, r);
          const n3 = this.varValue(i);
          return 1 === t4.Ident.length ? (this.notAFunction(e2, r), n3) : yield this.evalFieldChain(n3, n3, t4, t4.Ident.slice(1), e2, r);
        });
      }
      evalNumber(t3) {
        return t3.IsInt ? t3.Int64 : t3.IsUint ? t3.Uint64 : t3.IsFloat ? t3.Float64 : t3.IsComplex ? t3.Complex128 : 0;
      }
      isMethod(t3, e2) {
        let r = Object.getPrototypeOf(t3);
        for (; null !== r; ) {
          if (r.hasOwnProperty(e2) && "function" == typeof r[e2]) return true;
          r = Object.getPrototypeOf(r);
        }
        return false;
      }
    };
    function New2(t2) {
      return new Template(t2);
    }
    function builtins() {
      const t2 = /* @__PURE__ */ new Map();
      return t2.set("and", (...t3) => {
        if (0 === t3.length) return false;
        let e2 = t3[0];
        for (let r = 1; r < t3.length; r++) {
          if (!e2) return e2;
          e2 = t3[r];
        }
        return e2;
      }), t2.set("call", (...t3) => {
        if (0 === t3.length) return "";
        const e2 = t3[0];
        if (null == e2) throw new Error("call of nil");
        return e2(...t3.slice(1));
      }), t2.set("or", (...t3) => {
        if (0 === t3.length) return false;
        for (const e2 of t3) if (e2) return e2;
        return t3[t3.length - 1];
      }), t2.set("not", (t3) => !t3), t2.set("eq", (t3, ...e2) => {
        if (0 === e2.length) return false;
        for (const r of e2) if (t3 === r) return true;
        return false;
      }), t2.set("ne", (t3, e2) => t3 !== e2), t2.set("lt", (t3, e2) => t3 < e2), t2.set("le", (t3, e2) => t3 <= e2), t2.set("gt", (t3, e2) => t3 > e2), t2.set("ge", (t3, e2) => t3 >= e2), t2.set("div", (t3, e2) => t3 / e2), t2.set("sub", (t3, e2) => t3 - e2), t2.set("mul", (t3, e2) => t3 * e2), t2.set("float", (t3) => parseFloat(t3)), t2.set("print", (...t3) => t3.join("")), t2.set("printf", (t3, ...e2) => {
        if (null == t3) return "";
        if (0 === e2.length) return t3;
        let r = t3, i = 0;
        return r = r.replace(/%[vsdT]/g, (t4) => {
          if (i < e2.length) {
            const r3 = e2[i++];
            switch (t4) {
              case "%v":
              case "%s":
              default:
                return String(r3);
              case "%d":
                return Number(r3).toString();
              case "%T":
                return typeof r3;
            }
          }
          return "";
        }), r;
      }), t2.set("println", (...t3) => t3.join(" ") + "\n"), t2.set("len", (t3) => null == t3 ? 0 : Array.isArray(t3) || "string" == typeof t3 ? t3.length : "object" == typeof t3 ? Object.keys(t3).length : 0), t2.set("index", (t3, ...e2) => {
        if (null == t3) throw new Error("index of untyped nil");
        let r = t3;
        for (const t4 of e2) {
          if (null == r) throw new Error("index of nil pointer");
          if (Array.isArray(r) || "string" == typeof r) {
            const e3 = Number(t4);
            if (isNaN(e3)) throw new Error(`cannot index array/string with ${t4} (type ${typeof t4})`);
            if (e3 < 0 || e3 >= r.length) throw new Error(`index out of range: ${e3}`);
            r = r[e3];
          } else {
            if ("object" != typeof r) throw new Error("can't index item of type " + typeof r);
            r = r[t4], void 0 === r && (r = null);
          }
        }
        return r;
      }), t2.set("html", (t3) => String(t3).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;")), t2.set("urlquery", (t3) => encodeURIComponent(String(t3))), t2;
    }
    var Variable = class {
      constructor(t2, e2) {
        this.name = t2, this.value = e2;
      }
    };
    var ExecError = class extends Error {
      constructor(t2, e2) {
        super(), this.name = t2, this.err = e2, this.message = e2.message;
      }
      Error() {
        return this.message;
      }
    };
    function JSEscapeString(t2) {
      let e2 = "";
      for (let r = 0; r < t2.length; r++) {
        const i = t2.charAt(r);
        if ("\\" === i || '"' === i || "'" === i) {
          e2 += "\\" + i;
          continue;
        }
        if ("\b" === i) {
          e2 += "\\b";
          continue;
        }
        if ("	" === i) {
          e2 += "\\t";
          continue;
        }
        if ("\n" === i) {
          e2 += "\\n";
          continue;
        }
        if ("\f" === i) {
          e2 += "\\f";
          continue;
        }
        if ("\r" === i) {
          e2 += "\\r";
          continue;
        }
        if ("<" === i) {
          e2 += "\\u003C";
          continue;
        }
        if (">" === i) {
          e2 += "\\u003E";
          continue;
        }
        if ("&" === i) {
          e2 += "\\u0026";
          continue;
        }
        if ("=" === i) {
          e2 += "\\u003D";
          continue;
        }
        if ("`" === i) {
          e2 += "\\u0060";
          continue;
        }
        const n3 = i.charCodeAt(0);
        e2 += n3 < 32 || n3 >= 127 && n3 <= 159 || 65534 === n3 || 65535 === n3 ? "\\u" + ("000" + n3.toString(16).toUpperCase()).slice(-4) : i;
      }
      return e2;
    }
    var fs = __toESM(require("fs"));
    var path = __toESM(require("path"));
    function Must(t2) {
      const [e2, r] = t2;
      if (null !== r) throw r;
      return e2;
    }
    function ParseContents(t2) {
      return parseContents(null, t2);
    }
    function ParseFiles(...t2) {
      return parseFiles(null, readFileFS, ...t2);
    }
    function parseContents(t2, e2) {
      if (0 === e2.size) return [new Template(""), new Error("template: no contents provided in call to ParseContents")];
      const r = Array.from(e2.entries())[0][0];
      for (const [i, n3] of e2.entries()) {
        let e3;
        null === t2 && (t2 = new Template(r)), e3 = i === t2.Name() ? t2 : t2.New(i);
        const [s, o] = e3.Parse(n3);
        if (null !== o) return [new Template(""), o];
      }
      return [t2, null];
    }
    function parseFiles(t2, e2, ...r) {
      if (0 === r.length) return [new Template(""), new Error("template: no files named in call to ParseFiles")];
      for (const i of r) {
        const [r3, n3, s] = e2(i);
        if (null !== s) return [new Template(""), s];
        let o;
        null === t2 && (t2 = new Template(r3)), o = r3 === t2.Name() ? t2 : t2.New(r3);
        const [h2, u] = o.Parse(n3);
        if (null !== u) return [new Template(""), u];
      }
      return [t2, null];
    }
    function readFileFS(t2) {
      try {
        return [path.basename(t2), fs.readFileSync(t2, "utf-8"), null];
      } catch (t3) {
        return ["", "", t3 instanceof Error ? t3 : new Error(String(t3))];
      }
    }
    Template.prototype.ParseContents = function(t2) {
      return this.init(), parseContents(this, t2);
    }, Template.prototype.ParseFiles = function(...t2) {
      return this.init(), parseFiles(this, readFileFS, ...t2);
    };
  }
});

// node_modules/github-slugger/regex.js
var regex;
var init_regex2 = __esm({
  "node_modules/github-slugger/regex.js"() {
    regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g;
  }
});

// node_modules/github-slugger/index.js
var github_slugger_exports = {};
__export2(github_slugger_exports, {
  default: () => BananaSlug,
  slug: () => slug
});
function slug(value2, maintainCase) {
  if (typeof value2 !== "string") return "";
  if (!maintainCase) value2 = value2.toLowerCase();
  return value2.replace(regex, "").replace(/ /g, "-");
}
var own, BananaSlug;
var init_github_slugger = __esm({
  "node_modules/github-slugger/index.js"() {
    init_regex2();
    own = Object.hasOwnProperty;
    BananaSlug = class {
      /**
       * Create a new slug class.
       */
      constructor() {
        this.occurrences;
        this.reset();
      }
      /**
       * Generate a unique slug.
      *
      * Tracks previously generated slugs: repeated calls with the same value
      * will result in different slugs.
      * Use the `slug` function to get same slugs.
       *
       * @param  {string} value
       *   String of text to slugify
       * @param  {boolean} [maintainCase=false]
       *   Keep the current case, otherwise make all lowercase
       * @return {string}
       *   A unique slug string
       */
      slug(value2, maintainCase) {
        const self3 = this;
        let result = slug(value2, maintainCase === true);
        const originalSlug = result;
        while (own.call(self3.occurrences, result)) {
          self3.occurrences[originalSlug]++;
          result = originalSlug + "-" + self3.occurrences[originalSlug];
        }
        self3.occurrences[result] = 0;
        return result;
      }
      /**
       * Reset - Forget all previous slugs
       *
       * @return void
       */
      reset() {
        this.occurrences = /* @__PURE__ */ Object.create(null);
      }
    };
  }
});

// node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
var require_sourcemap_codec_umd = __commonJS({
  "node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"(exports2, module2) {
    (function(global2, factory) {
      if (typeof exports2 === "object" && typeof module2 !== "undefined") {
        factory(module2);
        module2.exports = def(module2);
      } else if (typeof define === "function" && define.amd) {
        define(["module"], function(mod) {
          factory.apply(this, arguments);
          mod.exports = def(mod);
        });
      } else {
        const mod = { exports: {} };
        factory(mod);
        global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self;
        global2.sourcemapCodec = def(mod);
      }
      function def(m2) {
        return "default" in m2.exports ? m2.exports.default : m2.exports;
      }
    })(exports2, function(module3) {
      "use strict";
      var __defProp3 = Object.defineProperty;
      var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
      var __getOwnPropNames3 = Object.getOwnPropertyNames;
      var __hasOwnProp3 = Object.prototype.hasOwnProperty;
      var __export3 = (target, all) => {
        for (var name in all)
          __defProp3(target, name, { get: all[name], enumerable: true });
      };
      var __copyProps3 = (to, from, except, desc) => {
        if (from && typeof from === "object" || typeof from === "function") {
          for (let key4 of __getOwnPropNames3(from))
            if (!__hasOwnProp3.call(to, key4) && key4 !== except)
              __defProp3(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc3(from, key4)) || desc.enumerable });
        }
        return to;
      };
      var __toCommonJS3 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
      var sourcemap_codec_exports = {};
      __export3(sourcemap_codec_exports, {
        decode: () => decode2,
        decodeGeneratedRanges: () => decodeGeneratedRanges,
        decodeOriginalScopes: () => decodeOriginalScopes,
        encode: () => encode2,
        encodeGeneratedRanges: () => encodeGeneratedRanges,
        encodeOriginalScopes: () => encodeOriginalScopes
      });
      module3.exports = __toCommonJS3(sourcemap_codec_exports);
      var comma = ",".charCodeAt(0);
      var semicolon = ";".charCodeAt(0);
      var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
      var intToChar = new Uint8Array(64);
      var charToInt = new Uint8Array(128);
      for (let i = 0; i < chars.length; i++) {
        const c = chars.charCodeAt(i);
        intToChar[i] = c;
        charToInt[c] = i;
      }
      function decodeInteger(reader, relative) {
        let value2 = 0;
        let shift = 0;
        let integer = 0;
        do {
          const c = reader.next();
          integer = charToInt[c];
          value2 |= (integer & 31) << shift;
          shift += 5;
        } while (integer & 32);
        const shouldNegate = value2 & 1;
        value2 >>>= 1;
        if (shouldNegate) {
          value2 = -2147483648 | -value2;
        }
        return relative + value2;
      }
      function encodeInteger(builder, num, relative) {
        let delta = num - relative;
        delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
        do {
          let clamped = delta & 31;
          delta >>>= 5;
          if (delta > 0) clamped |= 32;
          builder.write(intToChar[clamped]);
        } while (delta > 0);
        return num;
      }
      function hasMoreVlq(reader, max3) {
        if (reader.pos >= max3) return false;
        return reader.peek() !== comma;
      }
      var bufLength = 1024 * 16;
      var td3 = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
        decode(buf) {
          const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
          return out.toString();
        }
      } : {
        decode(buf) {
          let out = "";
          for (let i = 0; i < buf.length; i++) {
            out += String.fromCharCode(buf[i]);
          }
          return out;
        }
      };
      var StringWriter = class {
        constructor() {
          this.pos = 0;
          this.out = "";
          this.buffer = new Uint8Array(bufLength);
        }
        write(v) {
          const { buffer } = this;
          buffer[this.pos++] = v;
          if (this.pos === bufLength) {
            this.out += td3.decode(buffer);
            this.pos = 0;
          }
        }
        flush() {
          const { buffer, out, pos: pos2 } = this;
          return pos2 > 0 ? out + td3.decode(buffer.subarray(0, pos2)) : out;
        }
      };
      var StringReader = class {
        constructor(buffer) {
          this.pos = 0;
          this.buffer = buffer;
        }
        next() {
          return this.buffer.charCodeAt(this.pos++);
        }
        peek() {
          return this.buffer.charCodeAt(this.pos);
        }
        indexOf(char2) {
          const { buffer, pos: pos2 } = this;
          const idx2 = buffer.indexOf(char2, pos2);
          return idx2 === -1 ? buffer.length : idx2;
        }
      };
      var EMPTY = [];
      function decodeOriginalScopes(input) {
        const { length } = input;
        const reader = new StringReader(input);
        const scopes = [];
        const stack2 = [];
        let line = 0;
        for (; reader.pos < length; reader.pos++) {
          line = decodeInteger(reader, line);
          const column = decodeInteger(reader, 0);
          if (!hasMoreVlq(reader, length)) {
            const last = stack2.pop();
            last[2] = line;
            last[3] = column;
            continue;
          }
          const kind = decodeInteger(reader, 0);
          const fields = decodeInteger(reader, 0);
          const hasName2 = fields & 1;
          const scope = hasName2 ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
          let vars = EMPTY;
          if (hasMoreVlq(reader, length)) {
            vars = [];
            do {
              const varsIndex = decodeInteger(reader, 0);
              vars.push(varsIndex);
            } while (hasMoreVlq(reader, length));
          }
          scope.vars = vars;
          scopes.push(scope);
          stack2.push(scope);
        }
        return scopes;
      }
      function encodeOriginalScopes(scopes) {
        const writer = new StringWriter();
        for (let i = 0; i < scopes.length; ) {
          i = _encodeOriginalScopes(scopes, i, writer, [0]);
        }
        return writer.flush();
      }
      function _encodeOriginalScopes(scopes, index6, writer, state2) {
        const scope = scopes[index6];
        const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
        if (index6 > 0) writer.write(comma);
        state2[0] = encodeInteger(writer, startLine, state2[0]);
        encodeInteger(writer, startColumn, 0);
        encodeInteger(writer, kind, 0);
        const fields = scope.length === 6 ? 1 : 0;
        encodeInteger(writer, fields, 0);
        if (scope.length === 6) encodeInteger(writer, scope[5], 0);
        for (const v of vars) {
          encodeInteger(writer, v, 0);
        }
        for (index6++; index6 < scopes.length; ) {
          const next2 = scopes[index6];
          const { 0: l, 1: c } = next2;
          if (l > endLine || l === endLine && c >= endColumn) {
            break;
          }
          index6 = _encodeOriginalScopes(scopes, index6, writer, state2);
        }
        writer.write(comma);
        state2[0] = encodeInteger(writer, endLine, state2[0]);
        encodeInteger(writer, endColumn, 0);
        return index6;
      }
      function decodeGeneratedRanges(input) {
        const { length } = input;
        const reader = new StringReader(input);
        const ranges = [];
        const stack2 = [];
        let genLine = 0;
        let definitionSourcesIndex = 0;
        let definitionScopeIndex = 0;
        let callsiteSourcesIndex = 0;
        let callsiteLine = 0;
        let callsiteColumn = 0;
        let bindingLine = 0;
        let bindingColumn = 0;
        do {
          const semi = reader.indexOf(";");
          let genColumn = 0;
          for (; reader.pos < semi; reader.pos++) {
            genColumn = decodeInteger(reader, genColumn);
            if (!hasMoreVlq(reader, semi)) {
              const last = stack2.pop();
              last[2] = genLine;
              last[3] = genColumn;
              continue;
            }
            const fields = decodeInteger(reader, 0);
            const hasDefinition = fields & 1;
            const hasCallsite = fields & 2;
            const hasScope = fields & 4;
            let callsite = null;
            let bindings = EMPTY;
            let range2;
            if (hasDefinition) {
              const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
              definitionScopeIndex = decodeInteger(
                reader,
                definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0
              );
              definitionSourcesIndex = defSourcesIndex;
              range2 = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
            } else {
              range2 = [genLine, genColumn, 0, 0];
            }
            range2.isScope = !!hasScope;
            if (hasCallsite) {
              const prevCsi = callsiteSourcesIndex;
              const prevLine = callsiteLine;
              callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
              const sameSource = prevCsi === callsiteSourcesIndex;
              callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
              callsiteColumn = decodeInteger(
                reader,
                sameSource && prevLine === callsiteLine ? callsiteColumn : 0
              );
              callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
            }
            range2.callsite = callsite;
            if (hasMoreVlq(reader, semi)) {
              bindings = [];
              do {
                bindingLine = genLine;
                bindingColumn = genColumn;
                const expressionsCount = decodeInteger(reader, 0);
                let expressionRanges;
                if (expressionsCount < -1) {
                  expressionRanges = [[decodeInteger(reader, 0)]];
                  for (let i = -1; i > expressionsCount; i--) {
                    const prevBl = bindingLine;
                    bindingLine = decodeInteger(reader, bindingLine);
                    bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
                    const expression = decodeInteger(reader, 0);
                    expressionRanges.push([expression, bindingLine, bindingColumn]);
                  }
                } else {
                  expressionRanges = [[expressionsCount]];
                }
                bindings.push(expressionRanges);
              } while (hasMoreVlq(reader, semi));
            }
            range2.bindings = bindings;
            ranges.push(range2);
            stack2.push(range2);
          }
          genLine++;
          reader.pos = semi + 1;
        } while (reader.pos < length);
        return ranges;
      }
      function encodeGeneratedRanges(ranges) {
        if (ranges.length === 0) return "";
        const writer = new StringWriter();
        for (let i = 0; i < ranges.length; ) {
          i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
        }
        return writer.flush();
      }
      function _encodeGeneratedRanges(ranges, index6, writer, state2) {
        const range2 = ranges[index6];
        const {
          0: startLine,
          1: startColumn,
          2: endLine,
          3: endColumn,
          isScope,
          callsite,
          bindings
        } = range2;
        if (state2[0] < startLine) {
          catchupLine(writer, state2[0], startLine);
          state2[0] = startLine;
          state2[1] = 0;
        } else if (index6 > 0) {
          writer.write(comma);
        }
        state2[1] = encodeInteger(writer, range2[1], state2[1]);
        const fields = (range2.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
        encodeInteger(writer, fields, 0);
        if (range2.length === 6) {
          const { 4: sourcesIndex, 5: scopesIndex } = range2;
          if (sourcesIndex !== state2[2]) {
            state2[3] = 0;
          }
          state2[2] = encodeInteger(writer, sourcesIndex, state2[2]);
          state2[3] = encodeInteger(writer, scopesIndex, state2[3]);
        }
        if (callsite) {
          const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range2.callsite;
          if (sourcesIndex !== state2[4]) {
            state2[5] = 0;
            state2[6] = 0;
          } else if (callLine !== state2[5]) {
            state2[6] = 0;
          }
          state2[4] = encodeInteger(writer, sourcesIndex, state2[4]);
          state2[5] = encodeInteger(writer, callLine, state2[5]);
          state2[6] = encodeInteger(writer, callColumn, state2[6]);
        }
        if (bindings) {
          for (const binding of bindings) {
            if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
            const expression = binding[0][0];
            encodeInteger(writer, expression, 0);
            let bindingStartLine = startLine;
            let bindingStartColumn = startColumn;
            for (let i = 1; i < binding.length; i++) {
              const expRange = binding[i];
              bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
              bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
              encodeInteger(writer, expRange[0], 0);
            }
          }
        }
        for (index6++; index6 < ranges.length; ) {
          const next2 = ranges[index6];
          const { 0: l, 1: c } = next2;
          if (l > endLine || l === endLine && c >= endColumn) {
            break;
          }
          index6 = _encodeGeneratedRanges(ranges, index6, writer, state2);
        }
        if (state2[0] < endLine) {
          catchupLine(writer, state2[0], endLine);
          state2[0] = endLine;
          state2[1] = 0;
        } else {
          writer.write(comma);
        }
        state2[1] = encodeInteger(writer, endColumn, state2[1]);
        return index6;
      }
      function catchupLine(writer, lastLine, line) {
        do {
          writer.write(semicolon);
        } while (++lastLine < line);
      }
      function decode2(mappings) {
        const { length } = mappings;
        const reader = new StringReader(mappings);
        const decoded = [];
        let genColumn = 0;
        let sourcesIndex = 0;
        let sourceLine = 0;
        let sourceColumn = 0;
        let namesIndex = 0;
        do {
          const semi = reader.indexOf(";");
          const line = [];
          let sorted = true;
          let lastCol = 0;
          genColumn = 0;
          while (reader.pos < semi) {
            let seg;
            genColumn = decodeInteger(reader, genColumn);
            if (genColumn < lastCol) sorted = false;
            lastCol = genColumn;
            if (hasMoreVlq(reader, semi)) {
              sourcesIndex = decodeInteger(reader, sourcesIndex);
              sourceLine = decodeInteger(reader, sourceLine);
              sourceColumn = decodeInteger(reader, sourceColumn);
              if (hasMoreVlq(reader, semi)) {
                namesIndex = decodeInteger(reader, namesIndex);
                seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
              } else {
                seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
              }
            } else {
              seg = [genColumn];
            }
            line.push(seg);
            reader.pos++;
          }
          if (!sorted) sort(line);
          decoded.push(line);
          reader.pos = semi + 1;
        } while (reader.pos <= length);
        return decoded;
      }
      function sort(line) {
        line.sort(sortComparator);
      }
      function sortComparator(a, b) {
        return a[0] - b[0];
      }
      function encode2(decoded) {
        const writer = new StringWriter();
        let sourcesIndex = 0;
        let sourceLine = 0;
        let sourceColumn = 0;
        let namesIndex = 0;
        for (let i = 0; i < decoded.length; i++) {
          const line = decoded[i];
          if (i > 0) writer.write(semicolon);
          if (line.length === 0) continue;
          let genColumn = 0;
          for (let j = 0; j < line.length; j++) {
            const segment = line[j];
            if (j > 0) writer.write(comma);
            genColumn = encodeInteger(writer, segment[0], genColumn);
            if (segment.length === 1) continue;
            sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
            sourceLine = encodeInteger(writer, segment[2], sourceLine);
            sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
            if (segment.length === 4) continue;
            namesIndex = encodeInteger(writer, segment[4], namesIndex);
          }
        }
        return writer.flush();
      }
    });
  }
});

// node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js
var require_resolve_uri_umd = __commonJS({
  "node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js"(exports2, module2) {
    (function(global2, factory) {
      typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.resolveURI = factory());
    })(exports2, function() {
      "use strict";
      const schemeRegex = /^[\w+.-]+:\/\//;
      const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
      const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
      function isAbsoluteUrl(input) {
        return schemeRegex.test(input);
      }
      function isSchemeRelativeUrl(input) {
        return input.startsWith("//");
      }
      function isAbsolutePath(input) {
        return input.startsWith("/");
      }
      function isFileUrl(input) {
        return input.startsWith("file:");
      }
      function isRelative(input) {
        return /^[.?#]/.test(input);
      }
      function parseAbsoluteUrl(input) {
        const match3 = urlRegex.exec(input);
        return makeUrl(match3[1], match3[2] || "", match3[3], match3[4] || "", match3[5] || "/", match3[6] || "", match3[7] || "");
      }
      function parseFileUrl(input) {
        const match3 = fileRegex.exec(input);
        const path8 = match3[2];
        return makeUrl("file:", "", match3[1] || "", "", isAbsolutePath(path8) ? path8 : "/" + path8, match3[3] || "", match3[4] || "");
      }
      function makeUrl(scheme, user, host, port, path8, query3, hash2) {
        return {
          scheme,
          user,
          host,
          port,
          path: path8,
          query: query3,
          hash: hash2,
          type: 7
        };
      }
      function parseUrl(input) {
        if (isSchemeRelativeUrl(input)) {
          const url2 = parseAbsoluteUrl("http:" + input);
          url2.scheme = "";
          url2.type = 6;
          return url2;
        }
        if (isAbsolutePath(input)) {
          const url2 = parseAbsoluteUrl("http://foo.com" + input);
          url2.scheme = "";
          url2.host = "";
          url2.type = 5;
          return url2;
        }
        if (isFileUrl(input))
          return parseFileUrl(input);
        if (isAbsoluteUrl(input))
          return parseAbsoluteUrl(input);
        const url = parseAbsoluteUrl("http://foo.com/" + input);
        url.scheme = "";
        url.host = "";
        url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
        return url;
      }
      function stripPathFilename(path8) {
        if (path8.endsWith("/.."))
          return path8;
        const index6 = path8.lastIndexOf("/");
        return path8.slice(0, index6 + 1);
      }
      function mergePaths(url, base2) {
        normalizePath(base2, base2.type);
        if (url.path === "/") {
          url.path = base2.path;
        } else {
          url.path = stripPathFilename(base2.path) + url.path;
        }
      }
      function normalizePath(url, type) {
        const rel = type <= 4;
        const pieces = url.path.split("/");
        let pointer = 1;
        let positive = 0;
        let addTrailingSlash = false;
        for (let i = 1; i < pieces.length; i++) {
          const piece = pieces[i];
          if (!piece) {
            addTrailingSlash = true;
            continue;
          }
          addTrailingSlash = false;
          if (piece === ".")
            continue;
          if (piece === "..") {
            if (positive) {
              addTrailingSlash = true;
              positive--;
              pointer--;
            } else if (rel) {
              pieces[pointer++] = piece;
            }
            continue;
          }
          pieces[pointer++] = piece;
          positive++;
        }
        let path8 = "";
        for (let i = 1; i < pointer; i++) {
          path8 += "/" + pieces[i];
        }
        if (!path8 || addTrailingSlash && !path8.endsWith("/..")) {
          path8 += "/";
        }
        url.path = path8;
      }
      function resolve(input, base2) {
        if (!input && !base2)
          return "";
        const url = parseUrl(input);
        let inputType = url.type;
        if (base2 && inputType !== 7) {
          const baseUrl = parseUrl(base2);
          const baseType = baseUrl.type;
          switch (inputType) {
            case 1:
              url.hash = baseUrl.hash;
            // fall through
            case 2:
              url.query = baseUrl.query;
            // fall through
            case 3:
            case 4:
              mergePaths(url, baseUrl);
            // fall through
            case 5:
              url.user = baseUrl.user;
              url.host = baseUrl.host;
              url.port = baseUrl.port;
            // fall through
            case 6:
              url.scheme = baseUrl.scheme;
          }
          if (baseType > inputType)
            inputType = baseType;
        }
        normalizePath(url, inputType);
        const queryHash = url.query + url.hash;
        switch (inputType) {
          // This is impossible, because of the empty checks at the start of the function.
          // case UrlType.Empty:
          case 2:
          case 3:
            return queryHash;
          case 4: {
            const path8 = url.path.slice(1);
            if (!path8)
              return queryHash || ".";
            if (isRelative(base2 || input) && !isRelative(path8)) {
              return "./" + path8 + queryHash;
            }
            return path8 + queryHash;
          }
          case 5:
            return url.path + queryHash;
          default:
            return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
        }
      }
      return resolve;
    });
  }
});

// node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js
var require_trace_mapping_umd = __commonJS({
  "node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js"(exports2, module2) {
    (function(global2, factory) {
      if (typeof exports2 === "object" && typeof module2 !== "undefined") {
        factory(module2, require_resolve_uri_umd(), require_sourcemap_codec_umd());
        module2.exports = def(module2);
      } else if (typeof define === "function" && define.amd) {
        define(["module", "@jridgewell/resolve-uri", "@jridgewell/sourcemap-codec"], function(mod) {
          factory.apply(this, arguments);
          mod.exports = def(mod);
        });
      } else {
        const mod = { exports: {} };
        factory(mod, global2.resolveURI, global2.sourcemapCodec);
        global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self;
        global2.traceMapping = def(mod);
      }
      function def(m2) {
        return "default" in m2.exports ? m2.exports.default : m2.exports;
      }
    })(exports2, function(module3, require_resolveURI, require_sourcemapCodec) {
      "use strict";
      var __create3 = Object.create;
      var __defProp3 = Object.defineProperty;
      var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
      var __getOwnPropNames3 = Object.getOwnPropertyNames;
      var __getProtoOf3 = Object.getPrototypeOf;
      var __hasOwnProp3 = Object.prototype.hasOwnProperty;
      var __commonJS2 = (cb, mod) => function __require() {
        return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
      };
      var __export3 = (target, all) => {
        for (var name in all)
          __defProp3(target, name, { get: all[name], enumerable: true });
      };
      var __copyProps3 = (to, from, except, desc) => {
        if (from && typeof from === "object" || typeof from === "function") {
          for (let key4 of __getOwnPropNames3(from))
            if (!__hasOwnProp3.call(to, key4) && key4 !== except)
              __defProp3(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc3(from, key4)) || desc.enumerable });
        }
        return to;
      };
      var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(
        // If the importer is in node compatibility mode or this is not an ESM
        // file that has been converted to a CommonJS file using a Babel-
        // compatible transform (i.e. "__esModule" has not been set), then set
        // "default" to the CommonJS "module.exports" for node compatibility.
        isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
        mod
      ));
      var __toCommonJS3 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
      var require_sourcemap_codec = __commonJS2({
        "umd:@jridgewell/sourcemap-codec"(exports3, module22) {
          module22.exports = require_sourcemapCodec;
        }
      });
      var require_resolve_uri = __commonJS2({
        "umd:@jridgewell/resolve-uri"(exports3, module22) {
          module22.exports = require_resolveURI;
        }
      });
      var trace_mapping_exports = {};
      __export3(trace_mapping_exports, {
        AnyMap: () => FlattenMap,
        FlattenMap: () => FlattenMap,
        GREATEST_LOWER_BOUND: () => GREATEST_LOWER_BOUND,
        LEAST_UPPER_BOUND: () => LEAST_UPPER_BOUND,
        TraceMap: () => TraceMap,
        allGeneratedPositionsFor: () => allGeneratedPositionsFor,
        decodedMap: () => decodedMap,
        decodedMappings: () => decodedMappings,
        eachMapping: () => eachMapping,
        encodedMap: () => encodedMap,
        encodedMappings: () => encodedMappings,
        generatedPositionFor: () => generatedPositionFor,
        isIgnored: () => isIgnored,
        originalPositionFor: () => originalPositionFor,
        presortedDecodedMap: () => presortedDecodedMap,
        sourceContentFor: () => sourceContentFor,
        traceSegment: () => traceSegment
      });
      module3.exports = __toCommonJS3(trace_mapping_exports);
      var import_sourcemap_codec = __toESM3(require_sourcemap_codec());
      var import_resolve_uri = __toESM3(require_resolve_uri());
      function stripFilename(path8) {
        if (!path8) return "";
        const index6 = path8.lastIndexOf("/");
        return path8.slice(0, index6 + 1);
      }
      function resolver(mapUrl, sourceRoot) {
        const from = stripFilename(mapUrl);
        const prefix = sourceRoot ? sourceRoot + "/" : "";
        return (source2) => (0, import_resolve_uri.default)(prefix + (source2 || ""), from);
      }
      var COLUMN = 0;
      var SOURCES_INDEX = 1;
      var SOURCE_LINE = 2;
      var SOURCE_COLUMN = 3;
      var NAMES_INDEX = 4;
      var REV_GENERATED_LINE = 1;
      var REV_GENERATED_COLUMN = 2;
      function maybeSort(mappings, owned) {
        const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
        if (unsortedIndex === mappings.length) return mappings;
        if (!owned) mappings = mappings.slice();
        for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
          mappings[i] = sortSegments(mappings[i], owned);
        }
        return mappings;
      }
      function nextUnsortedSegmentLine(mappings, start) {
        for (let i = start; i < mappings.length; i++) {
          if (!isSorted(mappings[i])) return i;
        }
        return mappings.length;
      }
      function isSorted(line) {
        for (let j = 1; j < line.length; j++) {
          if (line[j][COLUMN] < line[j - 1][COLUMN]) {
            return false;
          }
        }
        return true;
      }
      function sortSegments(line, owned) {
        if (!owned) line = line.slice();
        return line.sort(sortComparator);
      }
      function sortComparator(a, b) {
        return a[COLUMN] - b[COLUMN];
      }
      function buildBySources(decoded, memos) {
        const sources = memos.map(() => []);
        for (let i = 0; i < decoded.length; i++) {
          const line = decoded[i];
          for (let j = 0; j < line.length; j++) {
            const seg = line[j];
            if (seg.length === 1) continue;
            const sourceIndex2 = seg[SOURCES_INDEX];
            const sourceLine = seg[SOURCE_LINE];
            const sourceColumn = seg[SOURCE_COLUMN];
            const source2 = sources[sourceIndex2];
            const segs = source2[sourceLine] || (source2[sourceLine] = []);
            segs.push([sourceColumn, i, seg[COLUMN]]);
          }
        }
        for (let i = 0; i < sources.length; i++) {
          const source2 = sources[i];
          for (let j = 0; j < source2.length; j++) {
            const line = source2[j];
            if (line) line.sort(sortComparator);
          }
        }
        return sources;
      }
      var found = false;
      function binarySearch2(haystack, needle, low, high) {
        while (low <= high) {
          const mid = low + (high - low >> 1);
          const cmp = haystack[mid][COLUMN] - needle;
          if (cmp === 0) {
            found = true;
            return mid;
          }
          if (cmp < 0) {
            low = mid + 1;
          } else {
            high = mid - 1;
          }
        }
        found = false;
        return low - 1;
      }
      function upperBound(haystack, needle, index6) {
        for (let i = index6 + 1; i < haystack.length; index6 = i++) {
          if (haystack[i][COLUMN] !== needle) break;
        }
        return index6;
      }
      function lowerBound(haystack, needle, index6) {
        for (let i = index6 - 1; i >= 0; index6 = i--) {
          if (haystack[i][COLUMN] !== needle) break;
        }
        return index6;
      }
      function memoizedState() {
        return {
          lastKey: -1,
          lastNeedle: -1,
          lastIndex: -1
        };
      }
      function memoizedBinarySearch(haystack, needle, state2, key4) {
        const { lastKey, lastNeedle, lastIndex } = state2;
        let low = 0;
        let high = haystack.length - 1;
        if (key4 === lastKey) {
          if (needle === lastNeedle) {
            found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
            return lastIndex;
          }
          if (needle >= lastNeedle) {
            low = lastIndex === -1 ? 0 : lastIndex;
          } else {
            high = lastIndex;
          }
        }
        state2.lastKey = key4;
        state2.lastNeedle = needle;
        return state2.lastIndex = binarySearch2(haystack, needle, low, high);
      }
      function parse2(map2) {
        return typeof map2 === "string" ? JSON.parse(map2) : map2;
      }
      var FlattenMap = function(map2, mapUrl) {
        const parsed = parse2(map2);
        if (!("sections" in parsed)) {
          return new TraceMap(parsed, mapUrl);
        }
        const mappings = [];
        const sources = [];
        const sourcesContent = [];
        const names = [];
        const ignoreList = [];
        recurse(
          parsed,
          mapUrl,
          mappings,
          sources,
          sourcesContent,
          names,
          ignoreList,
          0,
          0,
          Infinity,
          Infinity
        );
        const joined = {
          version: 3,
          file: parsed.file,
          names,
          sources,
          sourcesContent,
          mappings,
          ignoreList
        };
        return presortedDecodedMap(joined);
      };
      function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
        const { sections } = input;
        for (let i = 0; i < sections.length; i++) {
          const { map: map2, offset } = sections[i];
          let sl = stopLine;
          let sc = stopColumn;
          if (i + 1 < sections.length) {
            const nextOffset = sections[i + 1].offset;
            sl = Math.min(stopLine, lineOffset + nextOffset.line);
            if (sl === stopLine) {
              sc = Math.min(stopColumn, columnOffset + nextOffset.column);
            } else if (sl < stopLine) {
              sc = columnOffset + nextOffset.column;
            }
          }
          addSection(
            map2,
            mapUrl,
            mappings,
            sources,
            sourcesContent,
            names,
            ignoreList,
            lineOffset + offset.line,
            columnOffset + offset.column,
            sl,
            sc
          );
        }
      }
      function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
        const parsed = parse2(input);
        if ("sections" in parsed) return recurse(...arguments);
        const map2 = new TraceMap(parsed, mapUrl);
        const sourcesOffset = sources.length;
        const namesOffset = names.length;
        const decoded = decodedMappings(map2);
        const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map2;
        append2(sources, resolvedSources);
        append2(names, map2.names);
        if (contents) append2(sourcesContent, contents);
        else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);
        if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);
        for (let i = 0; i < decoded.length; i++) {
          const lineI = lineOffset + i;
          if (lineI > stopLine) return;
          const out = getLine(mappings, lineI);
          const cOffset = i === 0 ? columnOffset : 0;
          const line = decoded[i];
          for (let j = 0; j < line.length; j++) {
            const seg = line[j];
            const column = cOffset + seg[COLUMN];
            if (lineI === stopLine && column >= stopColumn) return;
            if (seg.length === 1) {
              out.push([column]);
              continue;
            }
            const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
            const sourceLine = seg[SOURCE_LINE];
            const sourceColumn = seg[SOURCE_COLUMN];
            out.push(
              seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]
            );
          }
        }
      }
      function append2(arr, other) {
        for (let i = 0; i < other.length; i++) arr.push(other[i]);
      }
      function getLine(arr, index6) {
        for (let i = arr.length; i <= index6; i++) arr[i] = [];
        return arr[index6];
      }
      var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
      var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
      var LEAST_UPPER_BOUND = -1;
      var GREATEST_LOWER_BOUND = 1;
      var TraceMap = class {
        constructor(map2, mapUrl) {
          const isString = typeof map2 === "string";
          if (!isString && map2._decodedMemo) return map2;
          const parsed = parse2(map2);
          const { version: version2, file, names, sourceRoot, sources, sourcesContent } = parsed;
          this.version = version2;
          this.file = file;
          this.names = names || [];
          this.sourceRoot = sourceRoot;
          this.sources = sources;
          this.sourcesContent = sourcesContent;
          this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
          const resolve = resolver(mapUrl, sourceRoot);
          this.resolvedSources = sources.map(resolve);
          const { mappings } = parsed;
          if (typeof mappings === "string") {
            this._encoded = mappings;
            this._decoded = void 0;
          } else if (Array.isArray(mappings)) {
            this._encoded = void 0;
            this._decoded = maybeSort(mappings, isString);
          } else if (parsed.sections) {
            throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
          } else {
            throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
          }
          this._decodedMemo = memoizedState();
          this._bySources = void 0;
          this._bySourceMemos = void 0;
        }
      };
      function cast(map2) {
        return map2;
      }
      function encodedMappings(map2) {
        var _a6, _b4;
        return (_b4 = (_a6 = cast(map2))._encoded) != null ? _b4 : _a6._encoded = (0, import_sourcemap_codec.encode)(cast(map2)._decoded);
      }
      function decodedMappings(map2) {
        var _a6;
        return (_a6 = cast(map2))._decoded || (_a6._decoded = (0, import_sourcemap_codec.decode)(cast(map2)._encoded));
      }
      function traceSegment(map2, line, column) {
        const decoded = decodedMappings(map2);
        if (line >= decoded.length) return null;
        const segments = decoded[line];
        const index6 = traceSegmentInternal(
          segments,
          cast(map2)._decodedMemo,
          line,
          column,
          GREATEST_LOWER_BOUND
        );
        return index6 === -1 ? null : segments[index6];
      }
      function originalPositionFor(map2, needle) {
        let { line, column, bias } = needle;
        line--;
        if (line < 0) throw new Error(LINE_GTR_ZERO);
        if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
        const decoded = decodedMappings(map2);
        if (line >= decoded.length) return OMapping(null, null, null, null);
        const segments = decoded[line];
        const index6 = traceSegmentInternal(
          segments,
          cast(map2)._decodedMemo,
          line,
          column,
          bias || GREATEST_LOWER_BOUND
        );
        if (index6 === -1) return OMapping(null, null, null, null);
        const segment = segments[index6];
        if (segment.length === 1) return OMapping(null, null, null, null);
        const { names, resolvedSources } = map2;
        return OMapping(
          resolvedSources[segment[SOURCES_INDEX]],
          segment[SOURCE_LINE] + 1,
          segment[SOURCE_COLUMN],
          segment.length === 5 ? names[segment[NAMES_INDEX]] : null
        );
      }
      function generatedPositionFor(map2, needle) {
        const { source: source2, line, column, bias } = needle;
        return generatedPosition(map2, source2, line, column, bias || GREATEST_LOWER_BOUND, false);
      }
      function allGeneratedPositionsFor(map2, needle) {
        const { source: source2, line, column, bias } = needle;
        return generatedPosition(map2, source2, line, column, bias || LEAST_UPPER_BOUND, true);
      }
      function eachMapping(map2, cb) {
        const decoded = decodedMappings(map2);
        const { names, resolvedSources } = map2;
        for (let i = 0; i < decoded.length; i++) {
          const line = decoded[i];
          for (let j = 0; j < line.length; j++) {
            const seg = line[j];
            const generatedLine = i + 1;
            const generatedColumn = seg[0];
            let source2 = null;
            let originalLine = null;
            let originalColumn = null;
            let name = null;
            if (seg.length !== 1) {
              source2 = resolvedSources[seg[1]];
              originalLine = seg[2] + 1;
              originalColumn = seg[3];
            }
            if (seg.length === 5) name = names[seg[4]];
            cb({
              generatedLine,
              generatedColumn,
              source: source2,
              originalLine,
              originalColumn,
              name
            });
          }
        }
      }
      function sourceIndex(map2, source2) {
        const { sources, resolvedSources } = map2;
        let index6 = sources.indexOf(source2);
        if (index6 === -1) index6 = resolvedSources.indexOf(source2);
        return index6;
      }
      function sourceContentFor(map2, source2) {
        const { sourcesContent } = map2;
        if (sourcesContent == null) return null;
        const index6 = sourceIndex(map2, source2);
        return index6 === -1 ? null : sourcesContent[index6];
      }
      function isIgnored(map2, source2) {
        const { ignoreList } = map2;
        if (ignoreList == null) return false;
        const index6 = sourceIndex(map2, source2);
        return index6 === -1 ? false : ignoreList.includes(index6);
      }
      function presortedDecodedMap(map2, mapUrl) {
        const tracer = new TraceMap(clone2(map2, []), mapUrl);
        cast(tracer)._decoded = map2.mappings;
        return tracer;
      }
      function decodedMap(map2) {
        return clone2(map2, decodedMappings(map2));
      }
      function encodedMap(map2) {
        return clone2(map2, encodedMappings(map2));
      }
      function clone2(map2, mappings) {
        return {
          version: map2.version,
          file: map2.file,
          names: map2.names,
          sourceRoot: map2.sourceRoot,
          sources: map2.sources,
          sourcesContent: map2.sourcesContent,
          mappings,
          ignoreList: map2.ignoreList || map2.x_google_ignoreList
        };
      }
      function OMapping(source2, line, column, name) {
        return { source: source2, line, column, name };
      }
      function GMapping(line, column) {
        return { line, column };
      }
      function traceSegmentInternal(segments, memo, line, column, bias) {
        let index6 = memoizedBinarySearch(segments, column, memo, line);
        if (found) {
          index6 = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index6);
        } else if (bias === LEAST_UPPER_BOUND) index6++;
        if (index6 === -1 || index6 === segments.length) return -1;
        return index6;
      }
      function sliceGeneratedPositions(segments, memo, line, column, bias) {
        let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
        if (!found && bias === LEAST_UPPER_BOUND) min++;
        if (min === -1 || min === segments.length) return [];
        const matchedColumn = found ? column : segments[min][COLUMN];
        if (!found) min = lowerBound(segments, matchedColumn, min);
        const max3 = upperBound(segments, matchedColumn, min);
        const result = [];
        for (; min <= max3; min++) {
          const segment = segments[min];
          result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
        }
        return result;
      }
      function generatedPosition(map2, source2, line, column, bias, all) {
        var _a6, _b4;
        line--;
        if (line < 0) throw new Error(LINE_GTR_ZERO);
        if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
        const { sources, resolvedSources } = map2;
        let sourceIndex2 = sources.indexOf(source2);
        if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source2);
        if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
        const bySourceMemos = (_a6 = cast(map2))._bySourceMemos || (_a6._bySourceMemos = sources.map(memoizedState));
        const generated = (_b4 = cast(map2))._bySources || (_b4._bySources = buildBySources(decodedMappings(map2), bySourceMemos));
        const segments = generated[sourceIndex2][line];
        if (segments == null) return all ? [] : GMapping(null, null);
        const memo = bySourceMemos[sourceIndex2];
        if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
        const index6 = traceSegmentInternal(segments, memo, line, column, bias);
        if (index6 === -1) return GMapping(null, null);
        const segment = segments[index6];
        return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
      }
    });
  }
});

// node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js
var require_gen_mapping_umd = __commonJS({
  "node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js"(exports2, module2) {
    (function(global2, factory) {
      if (typeof exports2 === "object" && typeof module2 !== "undefined") {
        factory(module2, require_sourcemap_codec_umd(), require_trace_mapping_umd());
        module2.exports = def(module2);
      } else if (typeof define === "function" && define.amd) {
        define(["module", "@jridgewell/sourcemap-codec", "@jridgewell/trace-mapping"], function(mod) {
          factory.apply(this, arguments);
          mod.exports = def(mod);
        });
      } else {
        const mod = { exports: {} };
        factory(mod, global2.sourcemapCodec, global2.traceMapping);
        global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self;
        global2.genMapping = def(mod);
      }
      function def(m2) {
        return "default" in m2.exports ? m2.exports.default : m2.exports;
      }
    })(exports2, function(module3, require_sourcemapCodec, require_traceMapping) {
      "use strict";
      var __create3 = Object.create;
      var __defProp3 = Object.defineProperty;
      var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
      var __getOwnPropNames3 = Object.getOwnPropertyNames;
      var __getProtoOf3 = Object.getPrototypeOf;
      var __hasOwnProp3 = Object.prototype.hasOwnProperty;
      var __commonJS2 = (cb, mod) => function __require() {
        return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
      };
      var __export3 = (target, all) => {
        for (var name in all)
          __defProp3(target, name, { get: all[name], enumerable: true });
      };
      var __copyProps3 = (to, from, except, desc) => {
        if (from && typeof from === "object" || typeof from === "function") {
          for (let key4 of __getOwnPropNames3(from))
            if (!__hasOwnProp3.call(to, key4) && key4 !== except)
              __defProp3(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc3(from, key4)) || desc.enumerable });
        }
        return to;
      };
      var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(
        // If the importer is in node compatibility mode or this is not an ESM
        // file that has been converted to a CommonJS file using a Babel-
        // compatible transform (i.e. "__esModule" has not been set), then set
        // "default" to the CommonJS "module.exports" for node compatibility.
        isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
        mod
      ));
      var __toCommonJS3 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
      var require_sourcemap_codec = __commonJS2({
        "umd:@jridgewell/sourcemap-codec"(exports3, module22) {
          module22.exports = require_sourcemapCodec;
        }
      });
      var require_trace_mapping = __commonJS2({
        "umd:@jridgewell/trace-mapping"(exports3, module22) {
          module22.exports = require_traceMapping;
        }
      });
      var gen_mapping_exports = {};
      __export3(gen_mapping_exports, {
        GenMapping: () => GenMapping,
        addMapping: () => addMapping,
        addSegment: () => addSegment,
        allMappings: () => allMappings,
        fromMap: () => fromMap,
        maybeAddMapping: () => maybeAddMapping,
        maybeAddSegment: () => maybeAddSegment,
        setIgnore: () => setIgnore,
        setSourceContent: () => setSourceContent,
        toDecodedMap: () => toDecodedMap,
        toEncodedMap: () => toEncodedMap
      });
      module3.exports = __toCommonJS3(gen_mapping_exports);
      var SetArray = class {
        constructor() {
          this._indexes = { __proto__: null };
          this.array = [];
        }
      };
      function cast(set2) {
        return set2;
      }
      function get4(setarr, key4) {
        return cast(setarr)._indexes[key4];
      }
      function put(setarr, key4) {
        const index6 = get4(setarr, key4);
        if (index6 !== void 0) return index6;
        const { array, _indexes: indexes2 } = cast(setarr);
        const length = array.push(key4);
        return indexes2[key4] = length - 1;
      }
      function remove(setarr, key4) {
        const index6 = get4(setarr, key4);
        if (index6 === void 0) return;
        const { array, _indexes: indexes2 } = cast(setarr);
        for (let i = index6 + 1; i < array.length; i++) {
          const k = array[i];
          array[i - 1] = k;
          indexes2[k]--;
        }
        indexes2[key4] = void 0;
        array.pop();
      }
      var import_sourcemap_codec = __toESM3(require_sourcemap_codec());
      var import_trace_mapping = __toESM3(require_trace_mapping());
      var COLUMN = 0;
      var SOURCES_INDEX = 1;
      var SOURCE_LINE = 2;
      var SOURCE_COLUMN = 3;
      var NAMES_INDEX = 4;
      var NO_NAME = -1;
      var GenMapping = class {
        constructor({ file, sourceRoot } = {}) {
          this._names = new SetArray();
          this._sources = new SetArray();
          this._sourcesContent = [];
          this._mappings = [];
          this.file = file;
          this.sourceRoot = sourceRoot;
          this._ignoreList = new SetArray();
        }
      };
      function cast2(map2) {
        return map2;
      }
      function addSegment(map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
        return addSegmentInternal(
          false,
          map2,
          genLine,
          genColumn,
          source2,
          sourceLine,
          sourceColumn,
          name,
          content
        );
      }
      function addMapping(map2, mapping) {
        return addMappingInternal(false, map2, mapping);
      }
      var maybeAddSegment = (map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) => {
        return addSegmentInternal(
          true,
          map2,
          genLine,
          genColumn,
          source2,
          sourceLine,
          sourceColumn,
          name,
          content
        );
      };
      var maybeAddMapping = (map2, mapping) => {
        return addMappingInternal(true, map2, mapping);
      };
      function setSourceContent(map2, source2, content) {
        const {
          _sources: sources,
          _sourcesContent: sourcesContent
          // _originalScopes: originalScopes,
        } = cast2(map2);
        const index6 = put(sources, source2);
        sourcesContent[index6] = content;
      }
      function setIgnore(map2, source2, ignore = true) {
        const {
          _sources: sources,
          _sourcesContent: sourcesContent,
          _ignoreList: ignoreList
          // _originalScopes: originalScopes,
        } = cast2(map2);
        const index6 = put(sources, source2);
        if (index6 === sourcesContent.length) sourcesContent[index6] = null;
        if (ignore) put(ignoreList, index6);
        else remove(ignoreList, index6);
      }
      function toDecodedMap(map2) {
        const {
          _mappings: mappings,
          _sources: sources,
          _sourcesContent: sourcesContent,
          _names: names,
          _ignoreList: ignoreList
          // _originalScopes: originalScopes,
          // _generatedRanges: generatedRanges,
        } = cast2(map2);
        removeEmptyFinalLines(mappings);
        return {
          version: 3,
          file: map2.file || void 0,
          names: names.array,
          sourceRoot: map2.sourceRoot || void 0,
          sources: sources.array,
          sourcesContent,
          mappings,
          // originalScopes,
          // generatedRanges,
          ignoreList: ignoreList.array
        };
      }
      function toEncodedMap(map2) {
        const decoded = toDecodedMap(map2);
        return Object.assign({}, decoded, {
          // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)),
          // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]),
          mappings: (0, import_sourcemap_codec.encode)(decoded.mappings)
        });
      }
      function fromMap(input) {
        const map2 = new import_trace_mapping.TraceMap(input);
        const gen = new GenMapping({ file: map2.file, sourceRoot: map2.sourceRoot });
        putAll(cast2(gen)._names, map2.names);
        putAll(cast2(gen)._sources, map2.sources);
        cast2(gen)._sourcesContent = map2.sourcesContent || map2.sources.map(() => null);
        cast2(gen)._mappings = (0, import_trace_mapping.decodedMappings)(map2);
        if (map2.ignoreList) putAll(cast2(gen)._ignoreList, map2.ignoreList);
        return gen;
      }
      function allMappings(map2) {
        const out = [];
        const { _mappings: mappings, _sources: sources, _names: names } = cast2(map2);
        for (let i = 0; i < mappings.length; i++) {
          const line = mappings[i];
          for (let j = 0; j < line.length; j++) {
            const seg = line[j];
            const generated = { line: i + 1, column: seg[COLUMN] };
            let source2 = void 0;
            let original = void 0;
            let name = void 0;
            if (seg.length !== 1) {
              source2 = sources.array[seg[SOURCES_INDEX]];
              original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
              if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];
            }
            out.push({ generated, source: source2, original, name });
          }
        }
        return out;
      }
      function addSegmentInternal(skipable, map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
        const {
          _mappings: mappings,
          _sources: sources,
          _sourcesContent: sourcesContent,
          _names: names
          // _originalScopes: originalScopes,
        } = cast2(map2);
        const line = getIndex(mappings, genLine);
        const index6 = getColumnIndex(line, genColumn);
        if (!source2) {
          if (skipable && skipSourceless(line, index6)) return;
          return insert(line, index6, [genColumn]);
        }
        assert(sourceLine);
        assert(sourceColumn);
        const sourcesIndex = put(sources, source2);
        const namesIndex = name ? put(names, name) : NO_NAME;
        if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
        if (skipable && skipSource(line, index6, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
          return;
        }
        return insert(
          line,
          index6,
          name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]
        );
      }
      function assert(_val) {
      }
      function getIndex(arr, index6) {
        for (let i = arr.length; i <= index6; i++) {
          arr[i] = [];
        }
        return arr[index6];
      }
      function getColumnIndex(line, genColumn) {
        let index6 = line.length;
        for (let i = index6 - 1; i >= 0; index6 = i--) {
          const current = line[i];
          if (genColumn >= current[COLUMN]) break;
        }
        return index6;
      }
      function insert(array, index6, value2) {
        for (let i = array.length; i > index6; i--) {
          array[i] = array[i - 1];
        }
        array[index6] = value2;
      }
      function removeEmptyFinalLines(mappings) {
        const { length } = mappings;
        let len = length;
        for (let i = len - 1; i >= 0; len = i, i--) {
          if (mappings[i].length > 0) break;
        }
        if (len < length) mappings.length = len;
      }
      function putAll(setarr, array) {
        for (let i = 0; i < array.length; i++) put(setarr, array[i]);
      }
      function skipSourceless(line, index6) {
        if (index6 === 0) return true;
        const prev = line[index6 - 1];
        return prev.length === 1;
      }
      function skipSource(line, index6, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
        if (index6 === 0) return false;
        const prev = line[index6 - 1];
        if (prev.length === 1) return false;
        return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
      }
      function addMappingInternal(skipable, map2, mapping) {
        const { generated, source: source2, original, name, content } = mapping;
        if (!source2) {
          return addSegmentInternal(
            skipable,
            map2,
            generated.line - 1,
            generated.column,
            null,
            null,
            null,
            null,
            null
          );
        }
        assert(original);
        return addSegmentInternal(
          skipable,
          map2,
          generated.line - 1,
          generated.column,
          source2,
          original.line - 1,
          original.column,
          name,
          content
        );
      }
    });
  }
});

// node_modules/@jridgewell/source-map/dist/source-map.umd.js
var require_source_map_umd = __commonJS({
  "node_modules/@jridgewell/source-map/dist/source-map.umd.js"(exports2, module2) {
    (function(global2, factory) {
      if (typeof exports2 === "object" && typeof module2 !== "undefined") {
        factory(module2, require_gen_mapping_umd(), require_trace_mapping_umd());
        module2.exports = def(module2);
      } else if (typeof define === "function" && define.amd) {
        define(["module", "@jridgewell/gen-mapping", "@jridgewell/trace-mapping"], function(mod) {
          factory.apply(this, arguments);
          mod.exports = def(mod);
        });
      } else {
        const mod = { exports: {} };
        factory(mod, global2.genMapping, global2.traceMapping);
        global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self;
        global2.sourceMap = def(mod);
      }
      function def(m2) {
        return "default" in m2.exports ? m2.exports.default : m2.exports;
      }
    })(exports2, function(module3, require_genMapping, require_traceMapping) {
      "use strict";
      var __create3 = Object.create;
      var __defProp3 = Object.defineProperty;
      var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
      var __getOwnPropNames3 = Object.getOwnPropertyNames;
      var __getProtoOf3 = Object.getPrototypeOf;
      var __hasOwnProp3 = Object.prototype.hasOwnProperty;
      var __commonJS2 = (cb, mod) => function __require() {
        return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
      };
      var __export3 = (target, all) => {
        for (var name in all)
          __defProp3(target, name, { get: all[name], enumerable: true });
      };
      var __copyProps3 = (to, from, except, desc) => {
        if (from && typeof from === "object" || typeof from === "function") {
          for (let key4 of __getOwnPropNames3(from))
            if (!__hasOwnProp3.call(to, key4) && key4 !== except)
              __defProp3(to, key4, { get: () => from[key4], enumerable: !(desc = __getOwnPropDesc3(from, key4)) || desc.enumerable });
        }
        return to;
      };
      var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(
        // If the importer is in node compatibility mode or this is not an ESM
        // file that has been converted to a CommonJS file using a Babel-
        // compatible transform (i.e. "__esModule" has not been set), then set
        // "default" to the CommonJS "module.exports" for node compatibility.
        isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
        mod
      ));
      var __toCommonJS3 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
      var require_trace_mapping = __commonJS2({
        "umd:@jridgewell/trace-mapping"(exports3, module22) {
          module22.exports = require_traceMapping;
        }
      });
      var require_gen_mapping = __commonJS2({
        "umd:@jridgewell/gen-mapping"(exports3, module22) {
          module22.exports = require_genMapping;
        }
      });
      var source_map_exports = {};
      __export3(source_map_exports, {
        SourceMapConsumer: () => SourceMapConsumer,
        SourceMapGenerator: () => SourceMapGenerator
      });
      module3.exports = __toCommonJS3(source_map_exports);
      var import_trace_mapping = __toESM3(require_trace_mapping());
      var import_gen_mapping = __toESM3(require_gen_mapping());
      var SourceMapConsumer = class _SourceMapConsumer {
        constructor(map2, mapUrl) {
          const trace2 = this._map = new import_trace_mapping.AnyMap(map2, mapUrl);
          this.file = trace2.file;
          this.names = trace2.names;
          this.sourceRoot = trace2.sourceRoot;
          this.sources = trace2.resolvedSources;
          this.sourcesContent = trace2.sourcesContent;
          this.version = trace2.version;
        }
        static fromSourceMap(map2, mapUrl) {
          if (map2.toDecodedMap) {
            return new _SourceMapConsumer(map2.toDecodedMap(), mapUrl);
          }
          return new _SourceMapConsumer(map2.toJSON(), mapUrl);
        }
        get mappings() {
          return (0, import_trace_mapping.encodedMappings)(this._map);
        }
        originalPositionFor(needle) {
          return (0, import_trace_mapping.originalPositionFor)(this._map, needle);
        }
        generatedPositionFor(originalPosition) {
          return (0, import_trace_mapping.generatedPositionFor)(this._map, originalPosition);
        }
        allGeneratedPositionsFor(originalPosition) {
          return (0, import_trace_mapping.allGeneratedPositionsFor)(this._map, originalPosition);
        }
        hasContentsOfAllSources() {
          if (!this.sourcesContent || this.sourcesContent.length !== this.sources.length) {
            return false;
          }
          for (const content of this.sourcesContent) {
            if (content == null) {
              return false;
            }
          }
          return true;
        }
        sourceContentFor(source2, nullOnMissing) {
          const sourceContent = (0, import_trace_mapping.sourceContentFor)(this._map, source2);
          if (sourceContent != null) {
            return sourceContent;
          }
          if (nullOnMissing) {
            return null;
          }
          throw new Error(`"${source2}" is not in the SourceMap.`);
        }
        eachMapping(callback, context2) {
          (0, import_trace_mapping.eachMapping)(this._map, context2 ? callback.bind(context2) : callback);
        }
        destroy() {
        }
      };
      var SourceMapGenerator = class _SourceMapGenerator {
        constructor(opts) {
          this._map = opts instanceof import_gen_mapping.GenMapping ? opts : new import_gen_mapping.GenMapping(opts);
        }
        static fromSourceMap(consumer) {
          return new _SourceMapGenerator((0, import_gen_mapping.fromMap)(consumer));
        }
        addMapping(mapping) {
          (0, import_gen_mapping.maybeAddMapping)(this._map, mapping);
        }
        setSourceContent(source2, content) {
          (0, import_gen_mapping.setSourceContent)(this._map, source2, content);
        }
        toJSON() {
          return (0, import_gen_mapping.toEncodedMap)(this._map);
        }
        toString() {
          return JSON.stringify(this.toJSON());
        }
        toDecodedMap() {
          return (0, import_gen_mapping.toDecodedMap)(this._map);
        }
      };
    });
  }
});

// node_modules/acorn/dist/acorn.js
var require_acorn = __commonJS({
  "node_modules/acorn/dist/acorn.js"(exports2, module2) {
    (function(global2, factory) {
      typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.acorn = {}));
    })(exports2, function(exports3) {
      "use strict";
      var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
      var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
      var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
      var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
      var reservedWords2 = {
        3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
        5: "class enum extends super const export import",
        6: "enum",
        strict: "implements interface let package private protected public static yield",
        strictBind: "eval arguments"
      };
      var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
      var keywords$1 = {
        5: ecma5AndLessKeywords,
        "5module": ecma5AndLessKeywords + " export import",
        6: ecma5AndLessKeywords + " const class extends export import super"
      };
      var keywordRelationalOperator = /^in(stanceof)?$/;
      var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
      var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
      function isInAstralSet(code, set2) {
        var pos2 = 65536;
        for (var i2 = 0; i2 < set2.length; i2 += 2) {
          pos2 += set2[i2];
          if (pos2 > code) {
            return false;
          }
          pos2 += set2[i2 + 1];
          if (pos2 >= code) {
            return true;
          }
        }
        return false;
      }
      function isIdentifierStart(code, astral) {
        if (code < 65) {
          return code === 36;
        }
        if (code < 91) {
          return true;
        }
        if (code < 97) {
          return code === 95;
        }
        if (code < 123) {
          return true;
        }
        if (code <= 65535) {
          return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
        }
        if (astral === false) {
          return false;
        }
        return isInAstralSet(code, astralIdentifierStartCodes);
      }
      function isIdentifierChar(code, astral) {
        if (code < 48) {
          return code === 36;
        }
        if (code < 58) {
          return true;
        }
        if (code < 65) {
          return false;
        }
        if (code < 91) {
          return true;
        }
        if (code < 97) {
          return code === 95;
        }
        if (code < 123) {
          return true;
        }
        if (code <= 65535) {
          return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
        }
        if (astral === false) {
          return false;
        }
        return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
      }
      var TokenType = function TokenType2(label, conf) {
        if (conf === void 0) conf = {};
        this.label = label;
        this.keyword = conf.keyword;
        this.beforeExpr = !!conf.beforeExpr;
        this.startsExpr = !!conf.startsExpr;
        this.isLoop = !!conf.isLoop;
        this.isAssign = !!conf.isAssign;
        this.prefix = !!conf.prefix;
        this.postfix = !!conf.postfix;
        this.binop = conf.binop || null;
        this.updateContext = null;
      };
      function binop(name, prec) {
        return new TokenType(name, { beforeExpr: true, binop: prec });
      }
      var beforeExpr = { beforeExpr: true }, startsExpr = { startsExpr: true };
      var keywords = {};
      function kw(name, options) {
        if (options === void 0) options = {};
        options.keyword = name;
        return keywords[name] = new TokenType(name, options);
      }
      var types$1 = {
        num: new TokenType("num", startsExpr),
        regexp: new TokenType("regexp", startsExpr),
        string: new TokenType("string", startsExpr),
        name: new TokenType("name", startsExpr),
        privateId: new TokenType("privateId", startsExpr),
        eof: new TokenType("eof"),
        // Punctuation token types.
        bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
        bracketR: new TokenType("]"),
        braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
        braceR: new TokenType("}"),
        parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
        parenR: new TokenType(")"),
        comma: new TokenType(",", beforeExpr),
        semi: new TokenType(";", beforeExpr),
        colon: new TokenType(":", beforeExpr),
        dot: new TokenType("."),
        question: new TokenType("?", beforeExpr),
        questionDot: new TokenType("?."),
        arrow: new TokenType("=>", beforeExpr),
        template: new TokenType("template"),
        invalidTemplate: new TokenType("invalidTemplate"),
        ellipsis: new TokenType("...", beforeExpr),
        backQuote: new TokenType("`", startsExpr),
        dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
        // Operators. These carry several kinds of properties to help the
        // parser use them properly (the presence of these properties is
        // what categorizes them as operators).
        //
        // `binop`, when present, specifies that this operator is a binary
        // operator, and will refer to its precedence.
        //
        // `prefix` and `postfix` mark the operator as a prefix or postfix
        // unary operator.
        //
        // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
        // binary operators with a very low precedence, that should result
        // in AssignmentExpression nodes.
        eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
        assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
        incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
        prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }),
        logicalOR: binop("||", 1),
        logicalAND: binop("&&", 2),
        bitwiseOR: binop("|", 3),
        bitwiseXOR: binop("^", 4),
        bitwiseAND: binop("&", 5),
        equality: binop("==/!=/===/!==", 6),
        relational: binop("</>/<=/>=", 7),
        bitShift: binop("<</>>/>>>", 8),
        plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
        modulo: binop("%", 10),
        star: binop("*", 10),
        slash: binop("/", 10),
        starstar: new TokenType("**", { beforeExpr: true }),
        coalesce: binop("??", 1),
        // Keyword token types.
        _break: kw("break"),
        _case: kw("case", beforeExpr),
        _catch: kw("catch"),
        _continue: kw("continue"),
        _debugger: kw("debugger"),
        _default: kw("default", beforeExpr),
        _do: kw("do", { isLoop: true, beforeExpr: true }),
        _else: kw("else", beforeExpr),
        _finally: kw("finally"),
        _for: kw("for", { isLoop: true }),
        _function: kw("function", startsExpr),
        _if: kw("if"),
        _return: kw("return", beforeExpr),
        _switch: kw("switch"),
        _throw: kw("throw", beforeExpr),
        _try: kw("try"),
        _var: kw("var"),
        _const: kw("const"),
        _while: kw("while", { isLoop: true }),
        _with: kw("with"),
        _new: kw("new", { beforeExpr: true, startsExpr: true }),
        _this: kw("this", startsExpr),
        _super: kw("super", startsExpr),
        _class: kw("class", startsExpr),
        _extends: kw("extends", beforeExpr),
        _export: kw("export"),
        _import: kw("import", startsExpr),
        _null: kw("null", startsExpr),
        _true: kw("true", startsExpr),
        _false: kw("false", startsExpr),
        _in: kw("in", { beforeExpr: true, binop: 7 }),
        _instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }),
        _typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }),
        _void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }),
        _delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true })
      };
      var lineBreak = /\r\n?|\n|\u2028|\u2029/;
      var lineBreakG = new RegExp(lineBreak.source, "g");
      function isNewLine(code) {
        return code === 10 || code === 13 || code === 8232 || code === 8233;
      }
      function nextLineBreak(code, from, end) {
        if (end === void 0) end = code.length;
        for (var i2 = from; i2 < end; i2++) {
          var next2 = code.charCodeAt(i2);
          if (isNewLine(next2)) {
            return i2 < end - 1 && next2 === 13 && code.charCodeAt(i2 + 1) === 10 ? i2 + 2 : i2 + 1;
          }
        }
        return -1;
      }
      var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
      var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
      var ref = Object.prototype;
      var hasOwnProperty = ref.hasOwnProperty;
      var toString = ref.toString;
      var hasOwn = Object.hasOwn || function(obj, propName) {
        return hasOwnProperty.call(obj, propName);
      };
      var isArray2 = Array.isArray || function(obj) {
        return toString.call(obj) === "[object Array]";
      };
      var regexpCache = /* @__PURE__ */ Object.create(null);
      function wordsRegexp(words) {
        return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
      }
      function codePointToString(code) {
        if (code <= 65535) {
          return String.fromCharCode(code);
        }
        code -= 65536;
        return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
      }
      var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
      var Position = function Position2(line, col) {
        this.line = line;
        this.column = col;
      };
      Position.prototype.offset = function offset(n3) {
        return new Position(this.line, this.column + n3);
      };
      var SourceLocation = function SourceLocation2(p, start, end) {
        this.start = start;
        this.end = end;
        if (p.sourceFile !== null) {
          this.source = p.sourceFile;
        }
      };
      function getLineInfo(input, offset) {
        for (var line = 1, cur = 0; ; ) {
          var nextBreak = nextLineBreak(input, cur, offset);
          if (nextBreak < 0) {
            return new Position(line, offset - cur);
          }
          ++line;
          cur = nextBreak;
        }
      }
      var defaultOptions = {
        // `ecmaVersion` indicates the ECMAScript version to parse. Must be
        // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
        // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
        // (the latest version the library supports). This influences
        // support for strict mode, the set of reserved words, and support
        // for new syntax features.
        ecmaVersion: null,
        // `sourceType` indicates the mode the code should be parsed in.
        // Can be either `"script"` or `"module"`. This influences global
        // strict mode and parsing of `import` and `export` declarations.
        sourceType: "script",
        // `onInsertedSemicolon` can be a callback that will be called when
        // a semicolon is automatically inserted. It will be passed the
        // position of the inserted semicolon as an offset, and if
        // `locations` is enabled, it is given the location as a `{line,
        // column}` object as second argument.
        onInsertedSemicolon: null,
        // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
        // trailing commas.
        onTrailingComma: null,
        // By default, reserved words are only enforced if ecmaVersion >= 5.
        // Set `allowReserved` to a boolean value to explicitly turn this on
        // an off. When this option has the value "never", reserved words
        // and keywords can also not be used as property names.
        allowReserved: null,
        // When enabled, a return at the top level is not considered an
        // error.
        allowReturnOutsideFunction: false,
        // When enabled, import/export statements are not constrained to
        // appearing at the top of the program, and an import.meta expression
        // in a script isn't considered an error.
        allowImportExportEverywhere: false,
        // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
        // When enabled, await identifiers are allowed to appear at the top-level scope,
        // but they are still not allowed in non-async functions.
        allowAwaitOutsideFunction: null,
        // When enabled, super identifiers are not constrained to
        // appearing in methods and do not raise an error when they appear elsewhere.
        allowSuperOutsideMethod: null,
        // When enabled, hashbang directive in the beginning of file is
        // allowed and treated as a line comment. Enabled by default when
        // `ecmaVersion` >= 2023.
        allowHashBang: false,
        // By default, the parser will verify that private properties are
        // only used in places where they are valid and have been declared.
        // Set this to false to turn such checks off.
        checkPrivateFields: true,
        // When `locations` is on, `loc` properties holding objects with
        // `start` and `end` properties in `{line, column}` form (with
        // line being 1-based and column 0-based) will be attached to the
        // nodes.
        locations: false,
        // A function can be passed as `onToken` option, which will
        // cause Acorn to call that function with object in the same
        // format as tokens returned from `tokenizer().getToken()`. Note
        // that you are not allowed to call the parser from the
        // callback—that will corrupt its internal state.
        onToken: null,
        // A function can be passed as `onComment` option, which will
        // cause Acorn to call that function with `(block, text, start,
        // end)` parameters whenever a comment is skipped. `block` is a
        // boolean indicating whether this is a block (`/* */`) comment,
        // `text` is the content of the comment, and `start` and `end` are
        // character offsets that denote the start and end of the comment.
        // When the `locations` option is on, two more parameters are
        // passed, the full `{line, column}` locations of the start and
        // end of the comments. Note that you are not allowed to call the
        // parser from the callback—that will corrupt its internal state.
        // When this option has an array as value, objects representing the
        // comments are pushed to it.
        onComment: null,
        // Nodes have their start and end characters offsets recorded in
        // `start` and `end` properties (directly on the node, rather than
        // the `loc` object, which holds line/column data. To also add a
        // [semi-standardized][range] `range` property holding a `[start,
        // end]` array with the same numbers, set the `ranges` option to
        // `true`.
        //
        // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
        ranges: false,
        // It is possible to parse multiple files into a single AST by
        // passing the tree produced by parsing the first file as
        // `program` option in subsequent parses. This will add the
        // toplevel forms of the parsed file to the `Program` (top) node
        // of an existing parse tree.
        program: null,
        // When `locations` is on, you can pass this to record the source
        // file in every node's `loc` object.
        sourceFile: null,
        // This value, if given, is stored in every node, whether
        // `locations` is on or off.
        directSourceFile: null,
        // When enabled, parenthesized expressions are represented by
        // (non-standard) ParenthesizedExpression nodes
        preserveParens: false
      };
      var warnedAboutEcmaVersion = false;
      function getOptions(opts) {
        var options = {};
        for (var opt in defaultOptions) {
          options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
        }
        if (options.ecmaVersion === "latest") {
          options.ecmaVersion = 1e8;
        } else if (options.ecmaVersion == null) {
          if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
            warnedAboutEcmaVersion = true;
            console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
          }
          options.ecmaVersion = 11;
        } else if (options.ecmaVersion >= 2015) {
          options.ecmaVersion -= 2009;
        }
        if (options.allowReserved == null) {
          options.allowReserved = options.ecmaVersion < 5;
        }
        if (!opts || opts.allowHashBang == null) {
          options.allowHashBang = options.ecmaVersion >= 14;
        }
        if (isArray2(options.onToken)) {
          var tokens = options.onToken;
          options.onToken = function(token) {
            return tokens.push(token);
          };
        }
        if (isArray2(options.onComment)) {
          options.onComment = pushComment(options, options.onComment);
        }
        return options;
      }
      function pushComment(options, array) {
        return function(block2, text3, start, end, startLoc, endLoc) {
          var comment2 = {
            type: block2 ? "Block" : "Line",
            value: text3,
            start,
            end
          };
          if (options.locations) {
            comment2.loc = new SourceLocation(this, startLoc, endLoc);
          }
          if (options.ranges) {
            comment2.range = [start, end];
          }
          array.push(comment2);
        };
      }
      var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
      function functionFlags(async2, generator) {
        return SCOPE_FUNCTION | (async2 ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
      }
      var BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5;
      var Parser = function Parser2(options, input, startPos) {
        this.options = options = getOptions(options);
        this.sourceFile = options.sourceFile;
        this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
        var reserved = "";
        if (options.allowReserved !== true) {
          reserved = reservedWords2[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
          if (options.sourceType === "module") {
            reserved += " await";
          }
        }
        this.reservedWords = wordsRegexp(reserved);
        var reservedStrict = (reserved ? reserved + " " : "") + reservedWords2.strict;
        this.reservedWordsStrict = wordsRegexp(reservedStrict);
        this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords2.strictBind);
        this.input = String(input);
        this.containsEsc = false;
        if (startPos) {
          this.pos = startPos;
          this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
          this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
        } else {
          this.pos = this.lineStart = 0;
          this.curLine = 1;
        }
        this.type = types$1.eof;
        this.value = null;
        this.start = this.end = this.pos;
        this.startLoc = this.endLoc = this.curPosition();
        this.lastTokEndLoc = this.lastTokStartLoc = null;
        this.lastTokStart = this.lastTokEnd = this.pos;
        this.context = this.initialContext();
        this.exprAllowed = true;
        this.inModule = options.sourceType === "module";
        this.strict = this.inModule || this.strictDirective(this.pos);
        this.potentialArrowAt = -1;
        this.potentialArrowInForAwait = false;
        this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
        this.labels = [];
        this.undefinedExports = /* @__PURE__ */ Object.create(null);
        if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") {
          this.skipLineComment(2);
        }
        this.scopeStack = [];
        this.enterScope(SCOPE_TOP);
        this.regexpState = null;
        this.privateNameStack = [];
      };
      var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
      Parser.prototype.parse = function parse3() {
        var node = this.options.program || this.startNode();
        this.nextToken();
        return this.parseTopLevel(node);
      };
      prototypeAccessors.inFunction.get = function() {
        return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
      };
      prototypeAccessors.inGenerator.get = function() {
        return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0;
      };
      prototypeAccessors.inAsync.get = function() {
        return (this.currentVarScope().flags & SCOPE_ASYNC) > 0;
      };
      prototypeAccessors.canAwait.get = function() {
        for (var i2 = this.scopeStack.length - 1; i2 >= 0; i2--) {
          var ref2 = this.scopeStack[i2];
          var flags2 = ref2.flags;
          if (flags2 & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) {
            return false;
          }
          if (flags2 & SCOPE_FUNCTION) {
            return (flags2 & SCOPE_ASYNC) > 0;
          }
        }
        return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
      };
      prototypeAccessors.allowSuper.get = function() {
        var ref2 = this.currentThisScope();
        var flags2 = ref2.flags;
        return (flags2 & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
      };
      prototypeAccessors.allowDirectSuper.get = function() {
        return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
      };
      prototypeAccessors.treatFunctionsAsVar.get = function() {
        return this.treatFunctionsAsVarInScope(this.currentScope());
      };
      prototypeAccessors.allowNewDotTarget.get = function() {
        for (var i2 = this.scopeStack.length - 1; i2 >= 0; i2--) {
          var ref2 = this.scopeStack[i2];
          var flags2 = ref2.flags;
          if (flags2 & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags2 & SCOPE_FUNCTION && !(flags2 & SCOPE_ARROW)) {
            return true;
          }
        }
        return false;
      };
      prototypeAccessors.inClassStaticBlock.get = function() {
        return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
      };
      Parser.extend = function extend() {
        var plugins = [], len = arguments.length;
        while (len--) plugins[len] = arguments[len];
        var cls = this;
        for (var i2 = 0; i2 < plugins.length; i2++) {
          cls = plugins[i2](cls);
        }
        return cls;
      };
      Parser.parse = function parse3(input, options) {
        return new this(options, input).parse();
      };
      Parser.parseExpressionAt = function parseExpressionAt2(input, pos2, options) {
        var parser2 = new this(options, input, pos2);
        parser2.nextToken();
        return parser2.parseExpression();
      };
      Parser.tokenizer = function tokenizer2(input, options) {
        return new this(options, input);
      };
      Object.defineProperties(Parser.prototype, prototypeAccessors);
      var pp$9 = Parser.prototype;
      var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
      pp$9.strictDirective = function(start) {
        if (this.options.ecmaVersion < 5) {
          return false;
        }
        for (; ; ) {
          skipWhiteSpace.lastIndex = start;
          start += skipWhiteSpace.exec(this.input)[0].length;
          var match3 = literal.exec(this.input.slice(start));
          if (!match3) {
            return false;
          }
          if ((match3[1] || match3[2]) === "use strict") {
            skipWhiteSpace.lastIndex = start + match3[0].length;
            var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
            var next2 = this.input.charAt(end);
            return next2 === ";" || next2 === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next2) || next2 === "!" && this.input.charAt(end + 1) === "=");
          }
          start += match3[0].length;
          skipWhiteSpace.lastIndex = start;
          start += skipWhiteSpace.exec(this.input)[0].length;
          if (this.input[start] === ";") {
            start++;
          }
        }
      };
      pp$9.eat = function(type) {
        if (this.type === type) {
          this.next();
          return true;
        } else {
          return false;
        }
      };
      pp$9.isContextual = function(name) {
        return this.type === types$1.name && this.value === name && !this.containsEsc;
      };
      pp$9.eatContextual = function(name) {
        if (!this.isContextual(name)) {
          return false;
        }
        this.next();
        return true;
      };
      pp$9.expectContextual = function(name) {
        if (!this.eatContextual(name)) {
          this.unexpected();
        }
      };
      pp$9.canInsertSemicolon = function() {
        return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
      };
      pp$9.insertSemicolon = function() {
        if (this.canInsertSemicolon()) {
          if (this.options.onInsertedSemicolon) {
            this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
          }
          return true;
        }
      };
      pp$9.semicolon = function() {
        if (!this.eat(types$1.semi) && !this.insertSemicolon()) {
          this.unexpected();
        }
      };
      pp$9.afterTrailingComma = function(tokType, notNext) {
        if (this.type === tokType) {
          if (this.options.onTrailingComma) {
            this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
          }
          if (!notNext) {
            this.next();
          }
          return true;
        }
      };
      pp$9.expect = function(type) {
        this.eat(type) || this.unexpected();
      };
      pp$9.unexpected = function(pos2) {
        this.raise(pos2 != null ? pos2 : this.start, "Unexpected token");
      };
      var DestructuringErrors = function DestructuringErrors2() {
        this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
      };
      pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
        if (!refDestructuringErrors) {
          return;
        }
        if (refDestructuringErrors.trailingComma > -1) {
          this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
        }
        var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
        if (parens > -1) {
          this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern");
        }
      };
      pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
        if (!refDestructuringErrors) {
          return false;
        }
        var shorthandAssign = refDestructuringErrors.shorthandAssign;
        var doubleProto = refDestructuringErrors.doubleProto;
        if (!andThrow) {
          return shorthandAssign >= 0 || doubleProto >= 0;
        }
        if (shorthandAssign >= 0) {
          this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns");
        }
        if (doubleProto >= 0) {
          this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
        }
      };
      pp$9.checkYieldAwaitInDefaultParams = function() {
        if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) {
          this.raise(this.yieldPos, "Yield expression cannot be a default value");
        }
        if (this.awaitPos) {
          this.raise(this.awaitPos, "Await expression cannot be a default value");
        }
      };
      pp$9.isSimpleAssignTarget = function(expr) {
        if (expr.type === "ParenthesizedExpression") {
          return this.isSimpleAssignTarget(expr.expression);
        }
        return expr.type === "Identifier" || expr.type === "MemberExpression";
      };
      var pp$8 = Parser.prototype;
      pp$8.parseTopLevel = function(node) {
        var exports4 = /* @__PURE__ */ Object.create(null);
        if (!node.body) {
          node.body = [];
        }
        while (this.type !== types$1.eof) {
          var stmt = this.parseStatement(null, true, exports4);
          node.body.push(stmt);
        }
        if (this.inModule) {
          for (var i2 = 0, list2 = Object.keys(this.undefinedExports); i2 < list2.length; i2 += 1) {
            var name = list2[i2];
            this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
          }
        }
        this.adaptDirectivePrologue(node.body);
        this.next();
        node.sourceType = this.options.sourceType;
        return this.finishNode(node, "Program");
      };
      var loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
      pp$8.isLet = function(context2) {
        if (this.options.ecmaVersion < 6 || !this.isContextual("let")) {
          return false;
        }
        skipWhiteSpace.lastIndex = this.pos;
        var skip = skipWhiteSpace.exec(this.input);
        var next2 = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next2);
        if (nextCh === 91 || nextCh === 92) {
          return true;
        }
        if (context2) {
          return false;
        }
        if (nextCh === 123 || nextCh > 55295 && nextCh < 56320) {
          return true;
        }
        if (isIdentifierStart(nextCh, true)) {
          var pos2 = next2 + 1;
          while (isIdentifierChar(nextCh = this.input.charCodeAt(pos2), true)) {
            ++pos2;
          }
          if (nextCh === 92 || nextCh > 55295 && nextCh < 56320) {
            return true;
          }
          var ident = this.input.slice(next2, pos2);
          if (!keywordRelationalOperator.test(ident)) {
            return true;
          }
        }
        return false;
      };
      pp$8.isAsyncFunction = function() {
        if (this.options.ecmaVersion < 8 || !this.isContextual("async")) {
          return false;
        }
        skipWhiteSpace.lastIndex = this.pos;
        var skip = skipWhiteSpace.exec(this.input);
        var next2 = this.pos + skip[0].length, after;
        return !lineBreak.test(this.input.slice(this.pos, next2)) && this.input.slice(next2, next2 + 8) === "function" && (next2 + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next2 + 8)) || after > 55295 && after < 56320));
      };
      pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
        if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) {
          return false;
        }
        skipWhiteSpace.lastIndex = this.pos;
        var skip = skipWhiteSpace.exec(this.input);
        var next2 = this.pos + skip[0].length;
        if (lineBreak.test(this.input.slice(this.pos, next2))) {
          return false;
        }
        if (isAwaitUsing) {
          var awaitEndPos = next2 + 5, after;
          if (this.input.slice(next2, awaitEndPos) !== "using" || awaitEndPos === this.input.length || isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) || after > 55295 && after < 56320) {
            return false;
          }
          skipWhiteSpace.lastIndex = awaitEndPos;
          var skipAfterUsing = skipWhiteSpace.exec(this.input);
          if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) {
            return false;
          }
        }
        if (isFor) {
          var ofEndPos = next2 + 2, after$1;
          if (this.input.slice(next2, ofEndPos) === "of") {
            if (ofEndPos === this.input.length || !isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 55295 && after$1 < 56320)) {
              return false;
            }
          }
        }
        var ch3 = this.input.charCodeAt(next2);
        return isIdentifierStart(ch3, true) || ch3 === 92;
      };
      pp$8.isAwaitUsing = function(isFor) {
        return this.isUsingKeyword(true, isFor);
      };
      pp$8.isUsing = function(isFor) {
        return this.isUsingKeyword(false, isFor);
      };
      pp$8.parseStatement = function(context2, topLevel, exports4) {
        var starttype = this.type, node = this.startNode(), kind;
        if (this.isLet(context2)) {
          starttype = types$1._var;
          kind = "let";
        }
        switch (starttype) {
          case types$1._break:
          case types$1._continue:
            return this.parseBreakContinueStatement(node, starttype.keyword);
          case types$1._debugger:
            return this.parseDebuggerStatement(node);
          case types$1._do:
            return this.parseDoStatement(node);
          case types$1._for:
            return this.parseForStatement(node);
          case types$1._function:
            if (context2 && (this.strict || context2 !== "if" && context2 !== "label") && this.options.ecmaVersion >= 6) {
              this.unexpected();
            }
            return this.parseFunctionStatement(node, false, !context2);
          case types$1._class:
            if (context2) {
              this.unexpected();
            }
            return this.parseClass(node, true);
          case types$1._if:
            return this.parseIfStatement(node);
          case types$1._return:
            return this.parseReturnStatement(node);
          case types$1._switch:
            return this.parseSwitchStatement(node);
          case types$1._throw:
            return this.parseThrowStatement(node);
          case types$1._try:
            return this.parseTryStatement(node);
          case types$1._const:
          case types$1._var:
            kind = kind || this.value;
            if (context2 && kind !== "var") {
              this.unexpected();
            }
            return this.parseVarStatement(node, kind);
          case types$1._while:
            return this.parseWhileStatement(node);
          case types$1._with:
            return this.parseWithStatement(node);
          case types$1.braceL:
            return this.parseBlock(true, node);
          case types$1.semi:
            return this.parseEmptyStatement(node);
          case types$1._export:
          case types$1._import:
            if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
              skipWhiteSpace.lastIndex = this.pos;
              var skip = skipWhiteSpace.exec(this.input);
              var next2 = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next2);
              if (nextCh === 40 || nextCh === 46) {
                return this.parseExpressionStatement(node, this.parseExpression());
              }
            }
            if (!this.options.allowImportExportEverywhere) {
              if (!topLevel) {
                this.raise(this.start, "'import' and 'export' may only appear at the top level");
              }
              if (!this.inModule) {
                this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
              }
            }
            return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports4);
          // If the statement does not start with a statement keyword or a
          // brace, it's an ExpressionStatement or LabeledStatement. We
          // simply start parsing an expression, and afterwards, if the
          // next token is a colon and the expression was a simple
          // Identifier node, we switch to interpreting it as a label.
          default:
            if (this.isAsyncFunction()) {
              if (context2) {
                this.unexpected();
              }
              this.next();
              return this.parseFunctionStatement(node, true, !context2);
            }
            var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
            if (usingKind) {
              if (topLevel && this.options.sourceType === "script") {
                this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
              }
              if (usingKind === "await using") {
                if (!this.canAwait) {
                  this.raise(this.start, "Await using cannot appear outside of async function");
                }
                this.next();
              }
              this.next();
              this.parseVar(node, false, usingKind);
              this.semicolon();
              return this.finishNode(node, "VariableDeclaration");
            }
            var maybeName = this.value, expr = this.parseExpression();
            if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
              return this.parseLabeledStatement(node, maybeName, expr, context2);
            } else {
              return this.parseExpressionStatement(node, expr);
            }
        }
      };
      pp$8.parseBreakContinueStatement = function(node, keyword) {
        var isBreak = keyword === "break";
        this.next();
        if (this.eat(types$1.semi) || this.insertSemicolon()) {
          node.label = null;
        } else if (this.type !== types$1.name) {
          this.unexpected();
        } else {
          node.label = this.parseIdent();
          this.semicolon();
        }
        var i2 = 0;
        for (; i2 < this.labels.length; ++i2) {
          var lab = this.labels[i2];
          if (node.label == null || lab.name === node.label.name) {
            if (lab.kind != null && (isBreak || lab.kind === "loop")) {
              break;
            }
            if (node.label && isBreak) {
              break;
            }
          }
        }
        if (i2 === this.labels.length) {
          this.raise(node.start, "Unsyntactic " + keyword);
        }
        return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
      };
      pp$8.parseDebuggerStatement = function(node) {
        this.next();
        this.semicolon();
        return this.finishNode(node, "DebuggerStatement");
      };
      pp$8.parseDoStatement = function(node) {
        this.next();
        this.labels.push(loopLabel);
        node.body = this.parseStatement("do");
        this.labels.pop();
        this.expect(types$1._while);
        node.test = this.parseParenExpression();
        if (this.options.ecmaVersion >= 6) {
          this.eat(types$1.semi);
        } else {
          this.semicolon();
        }
        return this.finishNode(node, "DoWhileStatement");
      };
      pp$8.parseForStatement = function(node) {
        this.next();
        var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
        this.labels.push(loopLabel);
        this.enterScope(0);
        this.expect(types$1.parenL);
        if (this.type === types$1.semi) {
          if (awaitAt > -1) {
            this.unexpected(awaitAt);
          }
          return this.parseFor(node, null);
        }
        var isLet = this.isLet();
        if (this.type === types$1._var || this.type === types$1._const || isLet) {
          var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
          this.next();
          this.parseVar(init$1, true, kind);
          this.finishNode(init$1, "VariableDeclaration");
          return this.parseForAfterInit(node, init$1, awaitAt);
        }
        var startsWithLet = this.isContextual("let"), isForOf = false;
        var usingKind = this.isUsing(true) ? "using" : this.isAwaitUsing(true) ? "await using" : null;
        if (usingKind) {
          var init$2 = this.startNode();
          this.next();
          if (usingKind === "await using") {
            this.next();
          }
          this.parseVar(init$2, true, usingKind);
          this.finishNode(init$2, "VariableDeclaration");
          return this.parseForAfterInit(node, init$2, awaitAt);
        }
        var containsEsc = this.containsEsc;
        var refDestructuringErrors = new DestructuringErrors();
        var initPos = this.start;
        var init3 = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(true, refDestructuringErrors);
        if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
          if (awaitAt > -1) {
            if (this.type === types$1._in) {
              this.unexpected(awaitAt);
            }
            node.await = true;
          } else if (isForOf && this.options.ecmaVersion >= 8) {
            if (init3.start === initPos && !containsEsc && init3.type === "Identifier" && init3.name === "async") {
              this.unexpected();
            } else if (this.options.ecmaVersion >= 9) {
              node.await = false;
            }
          }
          if (startsWithLet && isForOf) {
            this.raise(init3.start, "The left-hand side of a for-of loop may not start with 'let'.");
          }
          this.toAssignable(init3, false, refDestructuringErrors);
          this.checkLValPattern(init3);
          return this.parseForIn(node, init3);
        } else {
          this.checkExpressionErrors(refDestructuringErrors, true);
        }
        if (awaitAt > -1) {
          this.unexpected(awaitAt);
        }
        return this.parseFor(node, init3);
      };
      pp$8.parseForAfterInit = function(node, init3, awaitAt) {
        if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init3.declarations.length === 1) {
          if (this.options.ecmaVersion >= 9) {
            if (this.type === types$1._in) {
              if (awaitAt > -1) {
                this.unexpected(awaitAt);
              }
            } else {
              node.await = awaitAt > -1;
            }
          }
          return this.parseForIn(node, init3);
        }
        if (awaitAt > -1) {
          this.unexpected(awaitAt);
        }
        return this.parseFor(node, init3);
      };
      pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
        this.next();
        return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
      };
      pp$8.parseIfStatement = function(node) {
        this.next();
        node.test = this.parseParenExpression();
        node.consequent = this.parseStatement("if");
        node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
        return this.finishNode(node, "IfStatement");
      };
      pp$8.parseReturnStatement = function(node) {
        if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
          this.raise(this.start, "'return' outside of function");
        }
        this.next();
        if (this.eat(types$1.semi) || this.insertSemicolon()) {
          node.argument = null;
        } else {
          node.argument = this.parseExpression();
          this.semicolon();
        }
        return this.finishNode(node, "ReturnStatement");
      };
      pp$8.parseSwitchStatement = function(node) {
        this.next();
        node.discriminant = this.parseParenExpression();
        node.cases = [];
        this.expect(types$1.braceL);
        this.labels.push(switchLabel);
        this.enterScope(0);
        var cur;
        for (var sawDefault = false; this.type !== types$1.braceR; ) {
          if (this.type === types$1._case || this.type === types$1._default) {
            var isCase = this.type === types$1._case;
            if (cur) {
              this.finishNode(cur, "SwitchCase");
            }
            node.cases.push(cur = this.startNode());
            cur.consequent = [];
            this.next();
            if (isCase) {
              cur.test = this.parseExpression();
            } else {
              if (sawDefault) {
                this.raiseRecoverable(this.lastTokStart, "Multiple default clauses");
              }
              sawDefault = true;
              cur.test = null;
            }
            this.expect(types$1.colon);
          } else {
            if (!cur) {
              this.unexpected();
            }
            cur.consequent.push(this.parseStatement(null));
          }
        }
        this.exitScope();
        if (cur) {
          this.finishNode(cur, "SwitchCase");
        }
        this.next();
        this.labels.pop();
        return this.finishNode(node, "SwitchStatement");
      };
      pp$8.parseThrowStatement = function(node) {
        this.next();
        if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) {
          this.raise(this.lastTokEnd, "Illegal newline after throw");
        }
        node.argument = this.parseExpression();
        this.semicolon();
        return this.finishNode(node, "ThrowStatement");
      };
      var empty$1 = [];
      pp$8.parseCatchClauseParam = function() {
        var param = this.parseBindingAtom();
        var simple = param.type === "Identifier";
        this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
        this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
        this.expect(types$1.parenR);
        return param;
      };
      pp$8.parseTryStatement = function(node) {
        this.next();
        node.block = this.parseBlock();
        node.handler = null;
        if (this.type === types$1._catch) {
          var clause = this.startNode();
          this.next();
          if (this.eat(types$1.parenL)) {
            clause.param = this.parseCatchClauseParam();
          } else {
            if (this.options.ecmaVersion < 10) {
              this.unexpected();
            }
            clause.param = null;
            this.enterScope(0);
          }
          clause.body = this.parseBlock(false);
          this.exitScope();
          node.handler = this.finishNode(clause, "CatchClause");
        }
        node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
        if (!node.handler && !node.finalizer) {
          this.raise(node.start, "Missing catch or finally clause");
        }
        return this.finishNode(node, "TryStatement");
      };
      pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
        this.next();
        this.parseVar(node, false, kind, allowMissingInitializer);
        this.semicolon();
        return this.finishNode(node, "VariableDeclaration");
      };
      pp$8.parseWhileStatement = function(node) {
        this.next();
        node.test = this.parseParenExpression();
        this.labels.push(loopLabel);
        node.body = this.parseStatement("while");
        this.labels.pop();
        return this.finishNode(node, "WhileStatement");
      };
      pp$8.parseWithStatement = function(node) {
        if (this.strict) {
          this.raise(this.start, "'with' in strict mode");
        }
        this.next();
        node.object = this.parseParenExpression();
        node.body = this.parseStatement("with");
        return this.finishNode(node, "WithStatement");
      };
      pp$8.parseEmptyStatement = function(node) {
        this.next();
        return this.finishNode(node, "EmptyStatement");
      };
      pp$8.parseLabeledStatement = function(node, maybeName, expr, context2) {
        for (var i$1 = 0, list2 = this.labels; i$1 < list2.length; i$1 += 1) {
          var label = list2[i$1];
          if (label.name === maybeName) {
            this.raise(expr.start, "Label '" + maybeName + "' is already declared");
          }
        }
        var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
        for (var i2 = this.labels.length - 1; i2 >= 0; i2--) {
          var label$1 = this.labels[i2];
          if (label$1.statementStart === node.start) {
            label$1.statementStart = this.start;
            label$1.kind = kind;
          } else {
            break;
          }
        }
        this.labels.push({ name: maybeName, kind, statementStart: this.start });
        node.body = this.parseStatement(context2 ? context2.indexOf("label") === -1 ? context2 + "label" : context2 : "label");
        this.labels.pop();
        node.label = expr;
        return this.finishNode(node, "LabeledStatement");
      };
      pp$8.parseExpressionStatement = function(node, expr) {
        node.expression = expr;
        this.semicolon();
        return this.finishNode(node, "ExpressionStatement");
      };
      pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
        if (createNewLexicalScope === void 0) createNewLexicalScope = true;
        if (node === void 0) node = this.startNode();
        node.body = [];
        this.expect(types$1.braceL);
        if (createNewLexicalScope) {
          this.enterScope(0);
        }
        while (this.type !== types$1.braceR) {
          var stmt = this.parseStatement(null);
          node.body.push(stmt);
        }
        if (exitStrict) {
          this.strict = false;
        }
        this.next();
        if (createNewLexicalScope) {
          this.exitScope();
        }
        return this.finishNode(node, "BlockStatement");
      };
      pp$8.parseFor = function(node, init3) {
        node.init = init3;
        this.expect(types$1.semi);
        node.test = this.type === types$1.semi ? null : this.parseExpression();
        this.expect(types$1.semi);
        node.update = this.type === types$1.parenR ? null : this.parseExpression();
        this.expect(types$1.parenR);
        node.body = this.parseStatement("for");
        this.exitScope();
        this.labels.pop();
        return this.finishNode(node, "ForStatement");
      };
      pp$8.parseForIn = function(node, init3) {
        var isForIn = this.type === types$1._in;
        this.next();
        if (init3.type === "VariableDeclaration" && init3.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init3.kind !== "var" || init3.declarations[0].id.type !== "Identifier")) {
          this.raise(
            init3.start,
            (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"
          );
        }
        node.left = init3;
        node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
        this.expect(types$1.parenR);
        node.body = this.parseStatement("for");
        this.exitScope();
        this.labels.pop();
        return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
      };
      pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
        node.declarations = [];
        node.kind = kind;
        for (; ; ) {
          var decl = this.startNode();
          this.parseVarId(decl, kind);
          if (this.eat(types$1.eq)) {
            decl.init = this.parseMaybeAssign(isFor);
          } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
            this.unexpected();
          } else if (!allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) {
            this.raise(this.lastTokEnd, "Missing initializer in " + kind + " declaration");
          } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
            this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
          } else {
            decl.init = null;
          }
          node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
          if (!this.eat(types$1.comma)) {
            break;
          }
        }
        return node;
      };
      pp$8.parseVarId = function(decl, kind) {
        decl.id = kind === "using" || kind === "await using" ? this.parseIdent() : this.parseBindingAtom();
        this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
      };
      var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
      pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
        this.initFunction(node);
        if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
          if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) {
            this.unexpected();
          }
          node.generator = this.eat(types$1.star);
        }
        if (this.options.ecmaVersion >= 8) {
          node.async = !!isAsync;
        }
        if (statement & FUNC_STATEMENT) {
          node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent();
          if (node.id && !(statement & FUNC_HANGING_STATEMENT)) {
            this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
          }
        }
        var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
        this.yieldPos = 0;
        this.awaitPos = 0;
        this.awaitIdentPos = 0;
        this.enterScope(functionFlags(node.async, node.generator));
        if (!(statement & FUNC_STATEMENT)) {
          node.id = this.type === types$1.name ? this.parseIdent() : null;
        }
        this.parseFunctionParams(node);
        this.parseFunctionBody(node, allowExpressionBody, false, forInit);
        this.yieldPos = oldYieldPos;
        this.awaitPos = oldAwaitPos;
        this.awaitIdentPos = oldAwaitIdentPos;
        return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
      };
      pp$8.parseFunctionParams = function(node) {
        this.expect(types$1.parenL);
        node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
        this.checkYieldAwaitInDefaultParams();
      };
      pp$8.parseClass = function(node, isStatement) {
        this.next();
        var oldStrict = this.strict;
        this.strict = true;
        this.parseClassId(node, isStatement);
        this.parseClassSuper(node);
        var privateNameMap = this.enterClassBody();
        var classBody = this.startNode();
        var hadConstructor = false;
        classBody.body = [];
        this.expect(types$1.braceL);
        while (this.type !== types$1.braceR) {
          var element2 = this.parseClassElement(node.superClass !== null);
          if (element2) {
            classBody.body.push(element2);
            if (element2.type === "MethodDefinition" && element2.kind === "constructor") {
              if (hadConstructor) {
                this.raiseRecoverable(element2.start, "Duplicate constructor in the same class");
              }
              hadConstructor = true;
            } else if (element2.key && element2.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element2)) {
              this.raiseRecoverable(element2.key.start, "Identifier '#" + element2.key.name + "' has already been declared");
            }
          }
        }
        this.strict = oldStrict;
        this.next();
        node.body = this.finishNode(classBody, "ClassBody");
        this.exitClassBody();
        return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
      };
      pp$8.parseClassElement = function(constructorAllowsSuper) {
        if (this.eat(types$1.semi)) {
          return null;
        }
        var ecmaVersion2 = this.options.ecmaVersion;
        var node = this.startNode();
        var keyName = "";
        var isGenerator = false;
        var isAsync = false;
        var kind = "method";
        var isStatic = false;
        if (this.eatContextual("static")) {
          if (ecmaVersion2 >= 13 && this.eat(types$1.braceL)) {
            this.parseClassStaticBlock(node);
            return node;
          }
          if (this.isClassElementNameStart() || this.type === types$1.star) {
            isStatic = true;
          } else {
            keyName = "static";
          }
        }
        node.static = isStatic;
        if (!keyName && ecmaVersion2 >= 8 && this.eatContextual("async")) {
          if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
            isAsync = true;
          } else {
            keyName = "async";
          }
        }
        if (!keyName && (ecmaVersion2 >= 9 || !isAsync) && this.eat(types$1.star)) {
          isGenerator = true;
        }
        if (!keyName && !isAsync && !isGenerator) {
          var lastValue = this.value;
          if (this.eatContextual("get") || this.eatContextual("set")) {
            if (this.isClassElementNameStart()) {
              kind = lastValue;
            } else {
              keyName = lastValue;
            }
          }
        }
        if (keyName) {
          node.computed = false;
          node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
          node.key.name = keyName;
          this.finishNode(node.key, "Identifier");
        } else {
          this.parseClassElementName(node);
        }
        if (ecmaVersion2 < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
          var isConstructor = !node.static && checkKeyName(node, "constructor");
          var allowsDirectSuper = isConstructor && constructorAllowsSuper;
          if (isConstructor && kind !== "method") {
            this.raise(node.key.start, "Constructor can't have get/set modifier");
          }
          node.kind = isConstructor ? "constructor" : kind;
          this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
        } else {
          this.parseClassField(node);
        }
        return node;
      };
      pp$8.isClassElementNameStart = function() {
        return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword;
      };
      pp$8.parseClassElementName = function(element2) {
        if (this.type === types$1.privateId) {
          if (this.value === "constructor") {
            this.raise(this.start, "Classes can't have an element named '#constructor'");
          }
          element2.computed = false;
          element2.key = this.parsePrivateIdent();
        } else {
          this.parsePropertyName(element2);
        }
      };
      pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
        var key4 = method.key;
        if (method.kind === "constructor") {
          if (isGenerator) {
            this.raise(key4.start, "Constructor can't be a generator");
          }
          if (isAsync) {
            this.raise(key4.start, "Constructor can't be an async method");
          }
        } else if (method.static && checkKeyName(method, "prototype")) {
          this.raise(key4.start, "Classes may not have a static property named prototype");
        }
        var value2 = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
        if (method.kind === "get" && value2.params.length !== 0) {
          this.raiseRecoverable(value2.start, "getter should have no params");
        }
        if (method.kind === "set" && value2.params.length !== 1) {
          this.raiseRecoverable(value2.start, "setter should have exactly one param");
        }
        if (method.kind === "set" && value2.params[0].type === "RestElement") {
          this.raiseRecoverable(value2.params[0].start, "Setter cannot use rest params");
        }
        return this.finishNode(method, "MethodDefinition");
      };
      pp$8.parseClassField = function(field) {
        if (checkKeyName(field, "constructor")) {
          this.raise(field.key.start, "Classes can't have a field named 'constructor'");
        } else if (field.static && checkKeyName(field, "prototype")) {
          this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
        }
        if (this.eat(types$1.eq)) {
          this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
          field.value = this.parseMaybeAssign();
          this.exitScope();
        } else {
          field.value = null;
        }
        this.semicolon();
        return this.finishNode(field, "PropertyDefinition");
      };
      pp$8.parseClassStaticBlock = function(node) {
        node.body = [];
        var oldLabels = this.labels;
        this.labels = [];
        this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
        while (this.type !== types$1.braceR) {
          var stmt = this.parseStatement(null);
          node.body.push(stmt);
        }
        this.next();
        this.exitScope();
        this.labels = oldLabels;
        return this.finishNode(node, "StaticBlock");
      };
      pp$8.parseClassId = function(node, isStatement) {
        if (this.type === types$1.name) {
          node.id = this.parseIdent();
          if (isStatement) {
            this.checkLValSimple(node.id, BIND_LEXICAL, false);
          }
        } else {
          if (isStatement === true) {
            this.unexpected();
          }
          node.id = null;
        }
      };
      pp$8.parseClassSuper = function(node) {
        node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
      };
      pp$8.enterClassBody = function() {
        var element2 = { declared: /* @__PURE__ */ Object.create(null), used: [] };
        this.privateNameStack.push(element2);
        return element2.declared;
      };
      pp$8.exitClassBody = function() {
        var ref2 = this.privateNameStack.pop();
        var declared = ref2.declared;
        var used = ref2.used;
        if (!this.options.checkPrivateFields) {
          return;
        }
        var len = this.privateNameStack.length;
        var parent = len === 0 ? null : this.privateNameStack[len - 1];
        for (var i2 = 0; i2 < used.length; ++i2) {
          var id = used[i2];
          if (!hasOwn(declared, id.name)) {
            if (parent) {
              parent.used.push(id);
            } else {
              this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
            }
          }
        }
      };
      function isPrivateNameConflicted(privateNameMap, element2) {
        var name = element2.key.name;
        var curr = privateNameMap[name];
        var next2 = "true";
        if (element2.type === "MethodDefinition" && (element2.kind === "get" || element2.kind === "set")) {
          next2 = (element2.static ? "s" : "i") + element2.kind;
        }
        if (curr === "iget" && next2 === "iset" || curr === "iset" && next2 === "iget" || curr === "sget" && next2 === "sset" || curr === "sset" && next2 === "sget") {
          privateNameMap[name] = "true";
          return false;
        } else if (!curr) {
          privateNameMap[name] = next2;
          return false;
        } else {
          return true;
        }
      }
      function checkKeyName(node, name) {
        var computed2 = node.computed;
        var key4 = node.key;
        return !computed2 && (key4.type === "Identifier" && key4.name === name || key4.type === "Literal" && key4.value === name);
      }
      pp$8.parseExportAllDeclaration = function(node, exports4) {
        if (this.options.ecmaVersion >= 11) {
          if (this.eatContextual("as")) {
            node.exported = this.parseModuleExportName();
            this.checkExport(exports4, node.exported, this.lastTokStart);
          } else {
            node.exported = null;
          }
        }
        this.expectContextual("from");
        if (this.type !== types$1.string) {
          this.unexpected();
        }
        node.source = this.parseExprAtom();
        if (this.options.ecmaVersion >= 16) {
          node.attributes = this.parseWithClause();
        }
        this.semicolon();
        return this.finishNode(node, "ExportAllDeclaration");
      };
      pp$8.parseExport = function(node, exports4) {
        this.next();
        if (this.eat(types$1.star)) {
          return this.parseExportAllDeclaration(node, exports4);
        }
        if (this.eat(types$1._default)) {
          this.checkExport(exports4, "default", this.lastTokStart);
          node.declaration = this.parseExportDefaultDeclaration();
          return this.finishNode(node, "ExportDefaultDeclaration");
        }
        if (this.shouldParseExportStatement()) {
          node.declaration = this.parseExportDeclaration(node);
          if (node.declaration.type === "VariableDeclaration") {
            this.checkVariableExport(exports4, node.declaration.declarations);
          } else {
            this.checkExport(exports4, node.declaration.id, node.declaration.id.start);
          }
          node.specifiers = [];
          node.source = null;
          if (this.options.ecmaVersion >= 16) {
            node.attributes = [];
          }
        } else {
          node.declaration = null;
          node.specifiers = this.parseExportSpecifiers(exports4);
          if (this.eatContextual("from")) {
            if (this.type !== types$1.string) {
              this.unexpected();
            }
            node.source = this.parseExprAtom();
            if (this.options.ecmaVersion >= 16) {
              node.attributes = this.parseWithClause();
            }
          } else {
            for (var i2 = 0, list2 = node.specifiers; i2 < list2.length; i2 += 1) {
              var spec = list2[i2];
              this.checkUnreserved(spec.local);
              this.checkLocalExport(spec.local);
              if (spec.local.type === "Literal") {
                this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
              }
            }
            node.source = null;
            if (this.options.ecmaVersion >= 16) {
              node.attributes = [];
            }
          }
          this.semicolon();
        }
        return this.finishNode(node, "ExportNamedDeclaration");
      };
      pp$8.parseExportDeclaration = function(node) {
        return this.parseStatement(null);
      };
      pp$8.parseExportDefaultDeclaration = function() {
        var isAsync;
        if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
          var fNode = this.startNode();
          this.next();
          if (isAsync) {
            this.next();
          }
          return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
        } else if (this.type === types$1._class) {
          var cNode = this.startNode();
          return this.parseClass(cNode, "nullableID");
        } else {
          var declaration = this.parseMaybeAssign();
          this.semicolon();
          return declaration;
        }
      };
      pp$8.checkExport = function(exports4, name, pos2) {
        if (!exports4) {
          return;
        }
        if (typeof name !== "string") {
          name = name.type === "Identifier" ? name.name : name.value;
        }
        if (hasOwn(exports4, name)) {
          this.raiseRecoverable(pos2, "Duplicate export '" + name + "'");
        }
        exports4[name] = true;
      };
      pp$8.checkPatternExport = function(exports4, pat) {
        var type = pat.type;
        if (type === "Identifier") {
          this.checkExport(exports4, pat, pat.start);
        } else if (type === "ObjectPattern") {
          for (var i2 = 0, list2 = pat.properties; i2 < list2.length; i2 += 1) {
            var prop2 = list2[i2];
            this.checkPatternExport(exports4, prop2);
          }
        } else if (type === "ArrayPattern") {
          for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
            var elt = list$1[i$1];
            if (elt) {
              this.checkPatternExport(exports4, elt);
            }
          }
        } else if (type === "Property") {
          this.checkPatternExport(exports4, pat.value);
        } else if (type === "AssignmentPattern") {
          this.checkPatternExport(exports4, pat.left);
        } else if (type === "RestElement") {
          this.checkPatternExport(exports4, pat.argument);
        }
      };
      pp$8.checkVariableExport = function(exports4, decls) {
        if (!exports4) {
          return;
        }
        for (var i2 = 0, list2 = decls; i2 < list2.length; i2 += 1) {
          var decl = list2[i2];
          this.checkPatternExport(exports4, decl.id);
        }
      };
      pp$8.shouldParseExportStatement = function() {
        return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
      };
      pp$8.parseExportSpecifier = function(exports4) {
        var node = this.startNode();
        node.local = this.parseModuleExportName();
        node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
        this.checkExport(
          exports4,
          node.exported,
          node.exported.start
        );
        return this.finishNode(node, "ExportSpecifier");
      };
      pp$8.parseExportSpecifiers = function(exports4) {
        var nodes = [], first = true;
        this.expect(types$1.braceL);
        while (!this.eat(types$1.braceR)) {
          if (!first) {
            this.expect(types$1.comma);
            if (this.afterTrailingComma(types$1.braceR)) {
              break;
            }
          } else {
            first = false;
          }
          nodes.push(this.parseExportSpecifier(exports4));
        }
        return nodes;
      };
      pp$8.parseImport = function(node) {
        this.next();
        if (this.type === types$1.string) {
          node.specifiers = empty$1;
          node.source = this.parseExprAtom();
        } else {
          node.specifiers = this.parseImportSpecifiers();
          this.expectContextual("from");
          node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
        }
        if (this.options.ecmaVersion >= 16) {
          node.attributes = this.parseWithClause();
        }
        this.semicolon();
        return this.finishNode(node, "ImportDeclaration");
      };
      pp$8.parseImportSpecifier = function() {
        var node = this.startNode();
        node.imported = this.parseModuleExportName();
        if (this.eatContextual("as")) {
          node.local = this.parseIdent();
        } else {
          this.checkUnreserved(node.imported);
          node.local = node.imported;
        }
        this.checkLValSimple(node.local, BIND_LEXICAL);
        return this.finishNode(node, "ImportSpecifier");
      };
      pp$8.parseImportDefaultSpecifier = function() {
        var node = this.startNode();
        node.local = this.parseIdent();
        this.checkLValSimple(node.local, BIND_LEXICAL);
        return this.finishNode(node, "ImportDefaultSpecifier");
      };
      pp$8.parseImportNamespaceSpecifier = function() {
        var node = this.startNode();
        this.next();
        this.expectContextual("as");
        node.local = this.parseIdent();
        this.checkLValSimple(node.local, BIND_LEXICAL);
        return this.finishNode(node, "ImportNamespaceSpecifier");
      };
      pp$8.parseImportSpecifiers = function() {
        var nodes = [], first = true;
        if (this.type === types$1.name) {
          nodes.push(this.parseImportDefaultSpecifier());
          if (!this.eat(types$1.comma)) {
            return nodes;
          }
        }
        if (this.type === types$1.star) {
          nodes.push(this.parseImportNamespaceSpecifier());
          return nodes;
        }
        this.expect(types$1.braceL);
        while (!this.eat(types$1.braceR)) {
          if (!first) {
            this.expect(types$1.comma);
            if (this.afterTrailingComma(types$1.braceR)) {
              break;
            }
          } else {
            first = false;
          }
          nodes.push(this.parseImportSpecifier());
        }
        return nodes;
      };
      pp$8.parseWithClause = function() {
        var nodes = [];
        if (!this.eat(types$1._with)) {
          return nodes;
        }
        this.expect(types$1.braceL);
        var attributeKeys = {};
        var first = true;
        while (!this.eat(types$1.braceR)) {
          if (!first) {
            this.expect(types$1.comma);
            if (this.afterTrailingComma(types$1.braceR)) {
              break;
            }
          } else {
            first = false;
          }
          var attr2 = this.parseImportAttribute();
          var keyName = attr2.key.type === "Identifier" ? attr2.key.name : attr2.key.value;
          if (hasOwn(attributeKeys, keyName)) {
            this.raiseRecoverable(attr2.key.start, "Duplicate attribute key '" + keyName + "'");
          }
          attributeKeys[keyName] = true;
          nodes.push(attr2);
        }
        return nodes;
      };
      pp$8.parseImportAttribute = function() {
        var node = this.startNode();
        node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
        this.expect(types$1.colon);
        if (this.type !== types$1.string) {
          this.unexpected();
        }
        node.value = this.parseExprAtom();
        return this.finishNode(node, "ImportAttribute");
      };
      pp$8.parseModuleExportName = function() {
        if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
          var stringLiteral = this.parseLiteral(this.value);
          if (loneSurrogate.test(stringLiteral.value)) {
            this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
          }
          return stringLiteral;
        }
        return this.parseIdent(true);
      };
      pp$8.adaptDirectivePrologue = function(statements) {
        for (var i2 = 0; i2 < statements.length && this.isDirectiveCandidate(statements[i2]); ++i2) {
          statements[i2].directive = statements[i2].expression.raw.slice(1, -1);
        }
      };
      pp$8.isDirectiveCandidate = function(statement) {
        return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && // Reject parenthesized strings.
        (this.input[statement.start] === '"' || this.input[statement.start] === "'");
      };
      var pp$7 = Parser.prototype;
      pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
        if (this.options.ecmaVersion >= 6 && node) {
          switch (node.type) {
            case "Identifier":
              if (this.inAsync && node.name === "await") {
                this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
              }
              break;
            case "ObjectPattern":
            case "ArrayPattern":
            case "AssignmentPattern":
            case "RestElement":
              break;
            case "ObjectExpression":
              node.type = "ObjectPattern";
              if (refDestructuringErrors) {
                this.checkPatternErrors(refDestructuringErrors, true);
              }
              for (var i2 = 0, list2 = node.properties; i2 < list2.length; i2 += 1) {
                var prop2 = list2[i2];
                this.toAssignable(prop2, isBinding);
                if (prop2.type === "RestElement" && (prop2.argument.type === "ArrayPattern" || prop2.argument.type === "ObjectPattern")) {
                  this.raise(prop2.argument.start, "Unexpected token");
                }
              }
              break;
            case "Property":
              if (node.kind !== "init") {
                this.raise(node.key.start, "Object pattern can't contain getter or setter");
              }
              this.toAssignable(node.value, isBinding);
              break;
            case "ArrayExpression":
              node.type = "ArrayPattern";
              if (refDestructuringErrors) {
                this.checkPatternErrors(refDestructuringErrors, true);
              }
              this.toAssignableList(node.elements, isBinding);
              break;
            case "SpreadElement":
              node.type = "RestElement";
              this.toAssignable(node.argument, isBinding);
              if (node.argument.type === "AssignmentPattern") {
                this.raise(node.argument.start, "Rest elements cannot have a default value");
              }
              break;
            case "AssignmentExpression":
              if (node.operator !== "=") {
                this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
              }
              node.type = "AssignmentPattern";
              delete node.operator;
              this.toAssignable(node.left, isBinding);
              break;
            case "ParenthesizedExpression":
              this.toAssignable(node.expression, isBinding, refDestructuringErrors);
              break;
            case "ChainExpression":
              this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
              break;
            case "MemberExpression":
              if (!isBinding) {
                break;
              }
            default:
              this.raise(node.start, "Assigning to rvalue");
          }
        } else if (refDestructuringErrors) {
          this.checkPatternErrors(refDestructuringErrors, true);
        }
        return node;
      };
      pp$7.toAssignableList = function(exprList, isBinding) {
        var end = exprList.length;
        for (var i2 = 0; i2 < end; i2++) {
          var elt = exprList[i2];
          if (elt) {
            this.toAssignable(elt, isBinding);
          }
        }
        if (end) {
          var last = exprList[end - 1];
          if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") {
            this.unexpected(last.argument.start);
          }
        }
        return exprList;
      };
      pp$7.parseSpread = function(refDestructuringErrors) {
        var node = this.startNode();
        this.next();
        node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
        return this.finishNode(node, "SpreadElement");
      };
      pp$7.parseRestBinding = function() {
        var node = this.startNode();
        this.next();
        if (this.options.ecmaVersion === 6 && this.type !== types$1.name) {
          this.unexpected();
        }
        node.argument = this.parseBindingAtom();
        return this.finishNode(node, "RestElement");
      };
      pp$7.parseBindingAtom = function() {
        if (this.options.ecmaVersion >= 6) {
          switch (this.type) {
            case types$1.bracketL:
              var node = this.startNode();
              this.next();
              node.elements = this.parseBindingList(types$1.bracketR, true, true);
              return this.finishNode(node, "ArrayPattern");
            case types$1.braceL:
              return this.parseObj(true);
          }
        }
        return this.parseIdent();
      };
      pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
        var elts = [], first = true;
        while (!this.eat(close)) {
          if (first) {
            first = false;
          } else {
            this.expect(types$1.comma);
          }
          if (allowEmpty && this.type === types$1.comma) {
            elts.push(null);
          } else if (allowTrailingComma && this.afterTrailingComma(close)) {
            break;
          } else if (this.type === types$1.ellipsis) {
            var rest = this.parseRestBinding();
            this.parseBindingListItem(rest);
            elts.push(rest);
            if (this.type === types$1.comma) {
              this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
            }
            this.expect(close);
            break;
          } else {
            elts.push(this.parseAssignableListItem(allowModifiers));
          }
        }
        return elts;
      };
      pp$7.parseAssignableListItem = function(allowModifiers) {
        var elem = this.parseMaybeDefault(this.start, this.startLoc);
        this.parseBindingListItem(elem);
        return elem;
      };
      pp$7.parseBindingListItem = function(param) {
        return param;
      };
      pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
        left = left || this.parseBindingAtom();
        if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
          return left;
        }
        var node = this.startNodeAt(startPos, startLoc);
        node.left = left;
        node.right = this.parseMaybeAssign();
        return this.finishNode(node, "AssignmentPattern");
      };
      pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
        if (bindingType === void 0) bindingType = BIND_NONE;
        var isBind = bindingType !== BIND_NONE;
        switch (expr.type) {
          case "Identifier":
            if (this.strict && this.reservedWordsStrictBind.test(expr.name)) {
              this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
            }
            if (isBind) {
              if (bindingType === BIND_LEXICAL && expr.name === "let") {
                this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
              }
              if (checkClashes) {
                if (hasOwn(checkClashes, expr.name)) {
                  this.raiseRecoverable(expr.start, "Argument name clash");
                }
                checkClashes[expr.name] = true;
              }
              if (bindingType !== BIND_OUTSIDE) {
                this.declareName(expr.name, bindingType, expr.start);
              }
            }
            break;
          case "ChainExpression":
            this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
            break;
          case "MemberExpression":
            if (isBind) {
              this.raiseRecoverable(expr.start, "Binding member expression");
            }
            break;
          case "ParenthesizedExpression":
            if (isBind) {
              this.raiseRecoverable(expr.start, "Binding parenthesized expression");
            }
            return this.checkLValSimple(expr.expression, bindingType, checkClashes);
          default:
            this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
        }
      };
      pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
        if (bindingType === void 0) bindingType = BIND_NONE;
        switch (expr.type) {
          case "ObjectPattern":
            for (var i2 = 0, list2 = expr.properties; i2 < list2.length; i2 += 1) {
              var prop2 = list2[i2];
              this.checkLValInnerPattern(prop2, bindingType, checkClashes);
            }
            break;
          case "ArrayPattern":
            for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
              var elem = list$1[i$1];
              if (elem) {
                this.checkLValInnerPattern(elem, bindingType, checkClashes);
              }
            }
            break;
          default:
            this.checkLValSimple(expr, bindingType, checkClashes);
        }
      };
      pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
        if (bindingType === void 0) bindingType = BIND_NONE;
        switch (expr.type) {
          case "Property":
            this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
            break;
          case "AssignmentPattern":
            this.checkLValPattern(expr.left, bindingType, checkClashes);
            break;
          case "RestElement":
            this.checkLValPattern(expr.argument, bindingType, checkClashes);
            break;
          default:
            this.checkLValPattern(expr, bindingType, checkClashes);
        }
      };
      var TokContext = function TokContext2(token, isExpr, preserveSpace, override, generator) {
        this.token = token;
        this.isExpr = !!isExpr;
        this.preserveSpace = !!preserveSpace;
        this.override = override;
        this.generator = !!generator;
      };
      var types2 = {
        b_stat: new TokContext("{", false),
        b_expr: new TokContext("{", true),
        b_tmpl: new TokContext("${", false),
        p_stat: new TokContext("(", false),
        p_expr: new TokContext("(", true),
        q_tmpl: new TokContext("`", true, true, function(p) {
          return p.tryReadTemplateToken();
        }),
        f_stat: new TokContext("function", false),
        f_expr: new TokContext("function", true),
        f_expr_gen: new TokContext("function", true, false, null, true),
        f_gen: new TokContext("function", false, false, null, true)
      };
      var pp$6 = Parser.prototype;
      pp$6.initialContext = function() {
        return [types2.b_stat];
      };
      pp$6.curContext = function() {
        return this.context[this.context.length - 1];
      };
      pp$6.braceIsBlock = function(prevType) {
        var parent = this.curContext();
        if (parent === types2.f_expr || parent === types2.f_stat) {
          return true;
        }
        if (prevType === types$1.colon && (parent === types2.b_stat || parent === types2.b_expr)) {
          return !parent.isExpr;
        }
        if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) {
          return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
        }
        if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) {
          return true;
        }
        if (prevType === types$1.braceL) {
          return parent === types2.b_stat;
        }
        if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) {
          return false;
        }
        return !this.exprAllowed;
      };
      pp$6.inGeneratorContext = function() {
        for (var i2 = this.context.length - 1; i2 >= 1; i2--) {
          var context2 = this.context[i2];
          if (context2.token === "function") {
            return context2.generator;
          }
        }
        return false;
      };
      pp$6.updateContext = function(prevType) {
        var update2, type = this.type;
        if (type.keyword && prevType === types$1.dot) {
          this.exprAllowed = false;
        } else if (update2 = type.updateContext) {
          update2.call(this, prevType);
        } else {
          this.exprAllowed = type.beforeExpr;
        }
      };
      pp$6.overrideContext = function(tokenCtx) {
        if (this.curContext() !== tokenCtx) {
          this.context[this.context.length - 1] = tokenCtx;
        }
      };
      types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
        if (this.context.length === 1) {
          this.exprAllowed = true;
          return;
        }
        var out = this.context.pop();
        if (out === types2.b_stat && this.curContext().token === "function") {
          out = this.context.pop();
        }
        this.exprAllowed = !out.isExpr;
      };
      types$1.braceL.updateContext = function(prevType) {
        this.context.push(this.braceIsBlock(prevType) ? types2.b_stat : types2.b_expr);
        this.exprAllowed = true;
      };
      types$1.dollarBraceL.updateContext = function() {
        this.context.push(types2.b_tmpl);
        this.exprAllowed = true;
      };
      types$1.parenL.updateContext = function(prevType) {
        var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
        this.context.push(statementParens ? types2.p_stat : types2.p_expr);
        this.exprAllowed = true;
      };
      types$1.incDec.updateContext = function() {
      };
      types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
        if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types2.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types2.b_stat)) {
          this.context.push(types2.f_expr);
        } else {
          this.context.push(types2.f_stat);
        }
        this.exprAllowed = false;
      };
      types$1.colon.updateContext = function() {
        if (this.curContext().token === "function") {
          this.context.pop();
        }
        this.exprAllowed = true;
      };
      types$1.backQuote.updateContext = function() {
        if (this.curContext() === types2.q_tmpl) {
          this.context.pop();
        } else {
          this.context.push(types2.q_tmpl);
        }
        this.exprAllowed = false;
      };
      types$1.star.updateContext = function(prevType) {
        if (prevType === types$1._function) {
          var index6 = this.context.length - 1;
          if (this.context[index6] === types2.f_expr) {
            this.context[index6] = types2.f_expr_gen;
          } else {
            this.context[index6] = types2.f_gen;
          }
        }
        this.exprAllowed = true;
      };
      types$1.name.updateContext = function(prevType) {
        var allowed = false;
        if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
          if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) {
            allowed = true;
          }
        }
        this.exprAllowed = allowed;
      };
      var pp$5 = Parser.prototype;
      pp$5.checkPropClash = function(prop2, propHash, refDestructuringErrors) {
        if (this.options.ecmaVersion >= 9 && prop2.type === "SpreadElement") {
          return;
        }
        if (this.options.ecmaVersion >= 6 && (prop2.computed || prop2.method || prop2.shorthand)) {
          return;
        }
        var key4 = prop2.key;
        var name;
        switch (key4.type) {
          case "Identifier":
            name = key4.name;
            break;
          case "Literal":
            name = String(key4.value);
            break;
          default:
            return;
        }
        var kind = prop2.kind;
        if (this.options.ecmaVersion >= 6) {
          if (name === "__proto__" && kind === "init") {
            if (propHash.proto) {
              if (refDestructuringErrors) {
                if (refDestructuringErrors.doubleProto < 0) {
                  refDestructuringErrors.doubleProto = key4.start;
                }
              } else {
                this.raiseRecoverable(key4.start, "Redefinition of __proto__ property");
              }
            }
            propHash.proto = true;
          }
          return;
        }
        name = "$" + name;
        var other = propHash[name];
        if (other) {
          var redefinition;
          if (kind === "init") {
            redefinition = this.strict && other.init || other.get || other.set;
          } else {
            redefinition = other.init || other[kind];
          }
          if (redefinition) {
            this.raiseRecoverable(key4.start, "Redefinition of property");
          }
        } else {
          other = propHash[name] = {
            init: false,
            get: false,
            set: false
          };
        }
        other[kind] = true;
      };
      pp$5.parseExpression = function(forInit, refDestructuringErrors) {
        var startPos = this.start, startLoc = this.startLoc;
        var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
        if (this.type === types$1.comma) {
          var node = this.startNodeAt(startPos, startLoc);
          node.expressions = [expr];
          while (this.eat(types$1.comma)) {
            node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
          }
          return this.finishNode(node, "SequenceExpression");
        }
        return expr;
      };
      pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
        if (this.isContextual("yield")) {
          if (this.inGenerator) {
            return this.parseYield(forInit);
          } else {
            this.exprAllowed = false;
          }
        }
        var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
        if (refDestructuringErrors) {
          oldParenAssign = refDestructuringErrors.parenthesizedAssign;
          oldTrailingComma = refDestructuringErrors.trailingComma;
          oldDoubleProto = refDestructuringErrors.doubleProto;
          refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
        } else {
          refDestructuringErrors = new DestructuringErrors();
          ownDestructuringErrors = true;
        }
        var startPos = this.start, startLoc = this.startLoc;
        if (this.type === types$1.parenL || this.type === types$1.name) {
          this.potentialArrowAt = this.start;
          this.potentialArrowInForAwait = forInit === "await";
        }
        var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
        if (afterLeftParse) {
          left = afterLeftParse.call(this, left, startPos, startLoc);
        }
        if (this.type.isAssign) {
          var node = this.startNodeAt(startPos, startLoc);
          node.operator = this.value;
          if (this.type === types$1.eq) {
            left = this.toAssignable(left, false, refDestructuringErrors);
          }
          if (!ownDestructuringErrors) {
            refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
          }
          if (refDestructuringErrors.shorthandAssign >= left.start) {
            refDestructuringErrors.shorthandAssign = -1;
          }
          if (this.type === types$1.eq) {
            this.checkLValPattern(left);
          } else {
            this.checkLValSimple(left);
          }
          node.left = left;
          this.next();
          node.right = this.parseMaybeAssign(forInit);
          if (oldDoubleProto > -1) {
            refDestructuringErrors.doubleProto = oldDoubleProto;
          }
          return this.finishNode(node, "AssignmentExpression");
        } else {
          if (ownDestructuringErrors) {
            this.checkExpressionErrors(refDestructuringErrors, true);
          }
        }
        if (oldParenAssign > -1) {
          refDestructuringErrors.parenthesizedAssign = oldParenAssign;
        }
        if (oldTrailingComma > -1) {
          refDestructuringErrors.trailingComma = oldTrailingComma;
        }
        return left;
      };
      pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
        var startPos = this.start, startLoc = this.startLoc;
        var expr = this.parseExprOps(forInit, refDestructuringErrors);
        if (this.checkExpressionErrors(refDestructuringErrors)) {
          return expr;
        }
        if (this.eat(types$1.question)) {
          var node = this.startNodeAt(startPos, startLoc);
          node.test = expr;
          node.consequent = this.parseMaybeAssign();
          this.expect(types$1.colon);
          node.alternate = this.parseMaybeAssign(forInit);
          return this.finishNode(node, "ConditionalExpression");
        }
        return expr;
      };
      pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
        var startPos = this.start, startLoc = this.startLoc;
        var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
        if (this.checkExpressionErrors(refDestructuringErrors)) {
          return expr;
        }
        return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit);
      };
      pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
        var prec = this.type.binop;
        if (prec != null && (!forInit || this.type !== types$1._in)) {
          if (prec > minPrec) {
            var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
            var coalesce = this.type === types$1.coalesce;
            if (coalesce) {
              prec = types$1.logicalAND.binop;
            }
            var op = this.value;
            this.next();
            var startPos = this.start, startLoc = this.startLoc;
            var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
            var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
            if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) {
              this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
            }
            return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit);
          }
        }
        return left;
      };
      pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
        if (right.type === "PrivateIdentifier") {
          this.raise(right.start, "Private identifier can only be left side of binary expression");
        }
        var node = this.startNodeAt(startPos, startLoc);
        node.left = left;
        node.operator = op;
        node.right = right;
        return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
      };
      pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
        var startPos = this.start, startLoc = this.startLoc, expr;
        if (this.isContextual("await") && this.canAwait) {
          expr = this.parseAwait(forInit);
          sawUnary = true;
        } else if (this.type.prefix) {
          var node = this.startNode(), update2 = this.type === types$1.incDec;
          node.operator = this.value;
          node.prefix = true;
          this.next();
          node.argument = this.parseMaybeUnary(null, true, update2, forInit);
          this.checkExpressionErrors(refDestructuringErrors, true);
          if (update2) {
            this.checkLValSimple(node.argument);
          } else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
            this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
          } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
            this.raiseRecoverable(node.start, "Private fields can not be deleted");
          } else {
            sawUnary = true;
          }
          expr = this.finishNode(node, update2 ? "UpdateExpression" : "UnaryExpression");
        } else if (!sawUnary && this.type === types$1.privateId) {
          if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) {
            this.unexpected();
          }
          expr = this.parsePrivateIdent();
          if (this.type !== types$1._in) {
            this.unexpected();
          }
        } else {
          expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
          if (this.checkExpressionErrors(refDestructuringErrors)) {
            return expr;
          }
          while (this.type.postfix && !this.canInsertSemicolon()) {
            var node$1 = this.startNodeAt(startPos, startLoc);
            node$1.operator = this.value;
            node$1.prefix = false;
            node$1.argument = expr;
            this.checkLValSimple(expr);
            this.next();
            expr = this.finishNode(node$1, "UpdateExpression");
          }
        }
        if (!incDec && this.eat(types$1.starstar)) {
          if (sawUnary) {
            this.unexpected(this.lastTokStart);
          } else {
            return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false);
          }
        } else {
          return expr;
        }
      };
      function isLocalVariableAccess(node) {
        return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
      }
      function isPrivateFieldAccess(node) {
        return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression);
      }
      pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
        var startPos = this.start, startLoc = this.startLoc;
        var expr = this.parseExprAtom(refDestructuringErrors, forInit);
        if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") {
          return expr;
        }
        var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
        if (refDestructuringErrors && result.type === "MemberExpression") {
          if (refDestructuringErrors.parenthesizedAssign >= result.start) {
            refDestructuringErrors.parenthesizedAssign = -1;
          }
          if (refDestructuringErrors.parenthesizedBind >= result.start) {
            refDestructuringErrors.parenthesizedBind = -1;
          }
          if (refDestructuringErrors.trailingComma >= result.start) {
            refDestructuringErrors.trailingComma = -1;
          }
        }
        return result;
      };
      pp$5.parseSubscripts = function(base2, startPos, startLoc, noCalls, forInit) {
        var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base2.type === "Identifier" && base2.name === "async" && this.lastTokEnd === base2.end && !this.canInsertSemicolon() && base2.end - base2.start === 5 && this.potentialArrowAt === base2.start;
        var optionalChained = false;
        while (true) {
          var element2 = this.parseSubscript(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
          if (element2.optional) {
            optionalChained = true;
          }
          if (element2 === base2 || element2.type === "ArrowFunctionExpression") {
            if (optionalChained) {
              var chainNode = this.startNodeAt(startPos, startLoc);
              chainNode.expression = element2;
              element2 = this.finishNode(chainNode, "ChainExpression");
            }
            return element2;
          }
          base2 = element2;
        }
      };
      pp$5.shouldParseAsyncArrow = function() {
        return !this.canInsertSemicolon() && this.eat(types$1.arrow);
      };
      pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
        return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit);
      };
      pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
        var optionalSupported = this.options.ecmaVersion >= 11;
        var optional = optionalSupported && this.eat(types$1.questionDot);
        if (noCalls && optional) {
          this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
        }
        var computed2 = this.eat(types$1.bracketL);
        if (computed2 || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) {
          var node = this.startNodeAt(startPos, startLoc);
          node.object = base2;
          if (computed2) {
            node.property = this.parseExpression();
            this.expect(types$1.bracketR);
          } else if (this.type === types$1.privateId && base2.type !== "Super") {
            node.property = this.parsePrivateIdent();
          } else {
            node.property = this.parseIdent(this.options.allowReserved !== "never");
          }
          node.computed = !!computed2;
          if (optionalSupported) {
            node.optional = optional;
          }
          base2 = this.finishNode(node, "MemberExpression");
        } else if (!noCalls && this.eat(types$1.parenL)) {
          var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
          this.yieldPos = 0;
          this.awaitPos = 0;
          this.awaitIdentPos = 0;
          var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
          if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
            this.checkPatternErrors(refDestructuringErrors, false);
            this.checkYieldAwaitInDefaultParams();
            if (this.awaitIdentPos > 0) {
              this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function");
            }
            this.yieldPos = oldYieldPos;
            this.awaitPos = oldAwaitPos;
            this.awaitIdentPos = oldAwaitIdentPos;
            return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit);
          }
          this.checkExpressionErrors(refDestructuringErrors, true);
          this.yieldPos = oldYieldPos || this.yieldPos;
          this.awaitPos = oldAwaitPos || this.awaitPos;
          this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
          var node$1 = this.startNodeAt(startPos, startLoc);
          node$1.callee = base2;
          node$1.arguments = exprList;
          if (optionalSupported) {
            node$1.optional = optional;
          }
          base2 = this.finishNode(node$1, "CallExpression");
        } else if (this.type === types$1.backQuote) {
          if (optional || optionalChained) {
            this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
          }
          var node$2 = this.startNodeAt(startPos, startLoc);
          node$2.tag = base2;
          node$2.quasi = this.parseTemplate({ isTagged: true });
          base2 = this.finishNode(node$2, "TaggedTemplateExpression");
        }
        return base2;
      };
      pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
        if (this.type === types$1.slash) {
          this.readRegexp();
        }
        var node, canBeArrow = this.potentialArrowAt === this.start;
        switch (this.type) {
          case types$1._super:
            if (!this.allowSuper) {
              this.raise(this.start, "'super' keyword outside a method");
            }
            node = this.startNode();
            this.next();
            if (this.type === types$1.parenL && !this.allowDirectSuper) {
              this.raise(node.start, "super() call outside constructor of a subclass");
            }
            if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) {
              this.unexpected();
            }
            return this.finishNode(node, "Super");
          case types$1._this:
            node = this.startNode();
            this.next();
            return this.finishNode(node, "ThisExpression");
          case types$1.name:
            var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
            var id = this.parseIdent(false);
            if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
              this.overrideContext(types2.f_expr);
              return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit);
            }
            if (canBeArrow && !this.canInsertSemicolon()) {
              if (this.eat(types$1.arrow)) {
                return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit);
              }
              if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
                id = this.parseIdent(false);
                if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) {
                  this.unexpected();
                }
                return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit);
              }
            }
            return id;
          case types$1.regexp:
            var value2 = this.value;
            node = this.parseLiteral(value2.value);
            node.regex = { pattern: value2.pattern, flags: value2.flags };
            return node;
          case types$1.num:
          case types$1.string:
            return this.parseLiteral(this.value);
          case types$1._null:
          case types$1._true:
          case types$1._false:
            node = this.startNode();
            node.value = this.type === types$1._null ? null : this.type === types$1._true;
            node.raw = this.type.keyword;
            this.next();
            return this.finishNode(node, "Literal");
          case types$1.parenL:
            var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
            if (refDestructuringErrors) {
              if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) {
                refDestructuringErrors.parenthesizedAssign = start;
              }
              if (refDestructuringErrors.parenthesizedBind < 0) {
                refDestructuringErrors.parenthesizedBind = start;
              }
            }
            return expr;
          case types$1.bracketL:
            node = this.startNode();
            this.next();
            node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
            return this.finishNode(node, "ArrayExpression");
          case types$1.braceL:
            this.overrideContext(types2.b_expr);
            return this.parseObj(false, refDestructuringErrors);
          case types$1._function:
            node = this.startNode();
            this.next();
            return this.parseFunction(node, 0);
          case types$1._class:
            return this.parseClass(this.startNode(), false);
          case types$1._new:
            return this.parseNew();
          case types$1.backQuote:
            return this.parseTemplate();
          case types$1._import:
            if (this.options.ecmaVersion >= 11) {
              return this.parseExprImport(forNew);
            } else {
              return this.unexpected();
            }
          default:
            return this.parseExprAtomDefault();
        }
      };
      pp$5.parseExprAtomDefault = function() {
        this.unexpected();
      };
      pp$5.parseExprImport = function(forNew) {
        var node = this.startNode();
        if (this.containsEsc) {
          this.raiseRecoverable(this.start, "Escape sequence in keyword import");
        }
        this.next();
        if (this.type === types$1.parenL && !forNew) {
          return this.parseDynamicImport(node);
        } else if (this.type === types$1.dot) {
          var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
          meta.name = "import";
          node.meta = this.finishNode(meta, "Identifier");
          return this.parseImportMeta(node);
        } else {
          this.unexpected();
        }
      };
      pp$5.parseDynamicImport = function(node) {
        this.next();
        node.source = this.parseMaybeAssign();
        if (this.options.ecmaVersion >= 16) {
          if (!this.eat(types$1.parenR)) {
            this.expect(types$1.comma);
            if (!this.afterTrailingComma(types$1.parenR)) {
              node.options = this.parseMaybeAssign();
              if (!this.eat(types$1.parenR)) {
                this.expect(types$1.comma);
                if (!this.afterTrailingComma(types$1.parenR)) {
                  this.unexpected();
                }
              }
            } else {
              node.options = null;
            }
          } else {
            node.options = null;
          }
        } else {
          if (!this.eat(types$1.parenR)) {
            var errorPos = this.start;
            if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
              this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
            } else {
              this.unexpected(errorPos);
            }
          }
        }
        return this.finishNode(node, "ImportExpression");
      };
      pp$5.parseImportMeta = function(node) {
        this.next();
        var containsEsc = this.containsEsc;
        node.property = this.parseIdent(true);
        if (node.property.name !== "meta") {
          this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
        }
        if (containsEsc) {
          this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
        }
        if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) {
          this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
        }
        return this.finishNode(node, "MetaProperty");
      };
      pp$5.parseLiteral = function(value2) {
        var node = this.startNode();
        node.value = value2;
        node.raw = this.input.slice(this.start, this.end);
        if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
          node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, "");
        }
        this.next();
        return this.finishNode(node, "Literal");
      };
      pp$5.parseParenExpression = function() {
        this.expect(types$1.parenL);
        var val = this.parseExpression();
        this.expect(types$1.parenR);
        return val;
      };
      pp$5.shouldParseArrow = function(exprList) {
        return !this.canInsertSemicolon();
      };
      pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
        var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
        if (this.options.ecmaVersion >= 6) {
          this.next();
          var innerStartPos = this.start, innerStartLoc = this.startLoc;
          var exprList = [], first = true, lastIsComma = false;
          var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
          this.yieldPos = 0;
          this.awaitPos = 0;
          while (this.type !== types$1.parenR) {
            first ? first = false : this.expect(types$1.comma);
            if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
              lastIsComma = true;
              break;
            } else if (this.type === types$1.ellipsis) {
              spreadStart = this.start;
              exprList.push(this.parseParenItem(this.parseRestBinding()));
              if (this.type === types$1.comma) {
                this.raiseRecoverable(
                  this.start,
                  "Comma is not permitted after the rest element"
                );
              }
              break;
            } else {
              exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
            }
          }
          var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
          this.expect(types$1.parenR);
          if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
            this.checkPatternErrors(refDestructuringErrors, false);
            this.checkYieldAwaitInDefaultParams();
            this.yieldPos = oldYieldPos;
            this.awaitPos = oldAwaitPos;
            return this.parseParenArrowList(startPos, startLoc, exprList, forInit);
          }
          if (!exprList.length || lastIsComma) {
            this.unexpected(this.lastTokStart);
          }
          if (spreadStart) {
            this.unexpected(spreadStart);
          }
          this.checkExpressionErrors(refDestructuringErrors, true);
          this.yieldPos = oldYieldPos || this.yieldPos;
          this.awaitPos = oldAwaitPos || this.awaitPos;
          if (exprList.length > 1) {
            val = this.startNodeAt(innerStartPos, innerStartLoc);
            val.expressions = exprList;
            this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
          } else {
            val = exprList[0];
          }
        } else {
          val = this.parseParenExpression();
        }
        if (this.options.preserveParens) {
          var par = this.startNodeAt(startPos, startLoc);
          par.expression = val;
          return this.finishNode(par, "ParenthesizedExpression");
        } else {
          return val;
        }
      };
      pp$5.parseParenItem = function(item) {
        return item;
      };
      pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
        return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit);
      };
      var empty = [];
      pp$5.parseNew = function() {
        if (this.containsEsc) {
          this.raiseRecoverable(this.start, "Escape sequence in keyword new");
        }
        var node = this.startNode();
        this.next();
        if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
          var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
          meta.name = "new";
          node.meta = this.finishNode(meta, "Identifier");
          this.next();
          var containsEsc = this.containsEsc;
          node.property = this.parseIdent(true);
          if (node.property.name !== "target") {
            this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
          }
          if (containsEsc) {
            this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
          }
          if (!this.allowNewDotTarget) {
            this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
          }
          return this.finishNode(node, "MetaProperty");
        }
        var startPos = this.start, startLoc = this.startLoc;
        node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
        if (this.eat(types$1.parenL)) {
          node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
        } else {
          node.arguments = empty;
        }
        return this.finishNode(node, "NewExpression");
      };
      pp$5.parseTemplateElement = function(ref2) {
        var isTagged = ref2.isTagged;
        var elem = this.startNode();
        if (this.type === types$1.invalidTemplate) {
          if (!isTagged) {
            this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
          }
          elem.value = {
            raw: this.value.replace(/\r\n?/g, "\n"),
            cooked: null
          };
        } else {
          elem.value = {
            raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
            cooked: this.value
          };
        }
        this.next();
        elem.tail = this.type === types$1.backQuote;
        return this.finishNode(elem, "TemplateElement");
      };
      pp$5.parseTemplate = function(ref2) {
        if (ref2 === void 0) ref2 = {};
        var isTagged = ref2.isTagged;
        if (isTagged === void 0) isTagged = false;
        var node = this.startNode();
        this.next();
        node.expressions = [];
        var curElt = this.parseTemplateElement({ isTagged });
        node.quasis = [curElt];
        while (!curElt.tail) {
          if (this.type === types$1.eof) {
            this.raise(this.pos, "Unterminated template literal");
          }
          this.expect(types$1.dollarBraceL);
          node.expressions.push(this.parseExpression());
          this.expect(types$1.braceR);
          node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
        }
        this.next();
        return this.finishNode(node, "TemplateLiteral");
      };
      pp$5.isAsyncProp = function(prop2) {
        return !prop2.computed && prop2.key.type === "Identifier" && prop2.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
      };
      pp$5.parseObj = function(isPattern, refDestructuringErrors) {
        var node = this.startNode(), first = true, propHash = {};
        node.properties = [];
        this.next();
        while (!this.eat(types$1.braceR)) {
          if (!first) {
            this.expect(types$1.comma);
            if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) {
              break;
            }
          } else {
            first = false;
          }
          var prop2 = this.parseProperty(isPattern, refDestructuringErrors);
          if (!isPattern) {
            this.checkPropClash(prop2, propHash, refDestructuringErrors);
          }
          node.properties.push(prop2);
        }
        return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
      };
      pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
        var prop2 = this.startNode(), isGenerator, isAsync, startPos, startLoc;
        if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
          if (isPattern) {
            prop2.argument = this.parseIdent(false);
            if (this.type === types$1.comma) {
              this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
            }
            return this.finishNode(prop2, "RestElement");
          }
          prop2.argument = this.parseMaybeAssign(false, refDestructuringErrors);
          if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
            refDestructuringErrors.trailingComma = this.start;
          }
          return this.finishNode(prop2, "SpreadElement");
        }
        if (this.options.ecmaVersion >= 6) {
          prop2.method = false;
          prop2.shorthand = false;
          if (isPattern || refDestructuringErrors) {
            startPos = this.start;
            startLoc = this.startLoc;
          }
          if (!isPattern) {
            isGenerator = this.eat(types$1.star);
          }
        }
        var containsEsc = this.containsEsc;
        this.parsePropertyName(prop2);
        if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop2)) {
          isAsync = true;
          isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
          this.parsePropertyName(prop2);
        } else {
          isAsync = false;
        }
        this.parsePropertyValue(prop2, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
        return this.finishNode(prop2, "Property");
      };
      pp$5.parseGetterSetter = function(prop2) {
        var kind = prop2.key.name;
        this.parsePropertyName(prop2);
        prop2.value = this.parseMethod(false);
        prop2.kind = kind;
        var paramCount = prop2.kind === "get" ? 0 : 1;
        if (prop2.value.params.length !== paramCount) {
          var start = prop2.value.start;
          if (prop2.kind === "get") {
            this.raiseRecoverable(start, "getter should have no params");
          } else {
            this.raiseRecoverable(start, "setter should have exactly one param");
          }
        } else {
          if (prop2.kind === "set" && prop2.value.params[0].type === "RestElement") {
            this.raiseRecoverable(prop2.value.params[0].start, "Setter cannot use rest params");
          }
        }
      };
      pp$5.parsePropertyValue = function(prop2, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
        if ((isGenerator || isAsync) && this.type === types$1.colon) {
          this.unexpected();
        }
        if (this.eat(types$1.colon)) {
          prop2.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
          prop2.kind = "init";
        } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
          if (isPattern) {
            this.unexpected();
          }
          prop2.method = true;
          prop2.value = this.parseMethod(isGenerator, isAsync);
          prop2.kind = "init";
        } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop2.computed && prop2.key.type === "Identifier" && (prop2.key.name === "get" || prop2.key.name === "set") && (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
          if (isGenerator || isAsync) {
            this.unexpected();
          }
          this.parseGetterSetter(prop2);
        } else if (this.options.ecmaVersion >= 6 && !prop2.computed && prop2.key.type === "Identifier") {
          if (isGenerator || isAsync) {
            this.unexpected();
          }
          this.checkUnreserved(prop2.key);
          if (prop2.key.name === "await" && !this.awaitIdentPos) {
            this.awaitIdentPos = startPos;
          }
          if (isPattern) {
            prop2.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop2.key));
          } else if (this.type === types$1.eq && refDestructuringErrors) {
            if (refDestructuringErrors.shorthandAssign < 0) {
              refDestructuringErrors.shorthandAssign = this.start;
            }
            prop2.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop2.key));
          } else {
            prop2.value = this.copyNode(prop2.key);
          }
          prop2.kind = "init";
          prop2.shorthand = true;
        } else {
          this.unexpected();
        }
      };
      pp$5.parsePropertyName = function(prop2) {
        if (this.options.ecmaVersion >= 6) {
          if (this.eat(types$1.bracketL)) {
            prop2.computed = true;
            prop2.key = this.parseMaybeAssign();
            this.expect(types$1.bracketR);
            return prop2.key;
          } else {
            prop2.computed = false;
          }
        }
        return prop2.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
      };
      pp$5.initFunction = function(node) {
        node.id = null;
        if (this.options.ecmaVersion >= 6) {
          node.generator = node.expression = false;
        }
        if (this.options.ecmaVersion >= 8) {
          node.async = false;
        }
      };
      pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
        var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
        this.initFunction(node);
        if (this.options.ecmaVersion >= 6) {
          node.generator = isGenerator;
        }
        if (this.options.ecmaVersion >= 8) {
          node.async = !!isAsync;
        }
        this.yieldPos = 0;
        this.awaitPos = 0;
        this.awaitIdentPos = 0;
        this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
        this.expect(types$1.parenL);
        node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
        this.checkYieldAwaitInDefaultParams();
        this.parseFunctionBody(node, false, true, false);
        this.yieldPos = oldYieldPos;
        this.awaitPos = oldAwaitPos;
        this.awaitIdentPos = oldAwaitIdentPos;
        return this.finishNode(node, "FunctionExpression");
      };
      pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
        var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
        this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
        this.initFunction(node);
        if (this.options.ecmaVersion >= 8) {
          node.async = !!isAsync;
        }
        this.yieldPos = 0;
        this.awaitPos = 0;
        this.awaitIdentPos = 0;
        node.params = this.toAssignableList(params, true);
        this.parseFunctionBody(node, true, false, forInit);
        this.yieldPos = oldYieldPos;
        this.awaitPos = oldAwaitPos;
        this.awaitIdentPos = oldAwaitIdentPos;
        return this.finishNode(node, "ArrowFunctionExpression");
      };
      pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
        var isExpression = isArrowFunction && this.type !== types$1.braceL;
        var oldStrict = this.strict, useStrict = false;
        if (isExpression) {
          node.body = this.parseMaybeAssign(forInit);
          node.expression = true;
          this.checkParams(node, false);
        } else {
          var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
          if (!oldStrict || nonSimple) {
            useStrict = this.strictDirective(this.end);
            if (useStrict && nonSimple) {
              this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
            }
          }
          var oldLabels = this.labels;
          this.labels = [];
          if (useStrict) {
            this.strict = true;
          }
          this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
          if (this.strict && node.id) {
            this.checkLValSimple(node.id, BIND_OUTSIDE);
          }
          node.body = this.parseBlock(false, void 0, useStrict && !oldStrict);
          node.expression = false;
          this.adaptDirectivePrologue(node.body.body);
          this.labels = oldLabels;
        }
        this.exitScope();
      };
      pp$5.isSimpleParamList = function(params) {
        for (var i2 = 0, list2 = params; i2 < list2.length; i2 += 1) {
          var param = list2[i2];
          if (param.type !== "Identifier") {
            return false;
          }
        }
        return true;
      };
      pp$5.checkParams = function(node, allowDuplicates) {
        var nameHash = /* @__PURE__ */ Object.create(null);
        for (var i2 = 0, list2 = node.params; i2 < list2.length; i2 += 1) {
          var param = list2[i2];
          this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
        }
      };
      pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
        var elts = [], first = true;
        while (!this.eat(close)) {
          if (!first) {
            this.expect(types$1.comma);
            if (allowTrailingComma && this.afterTrailingComma(close)) {
              break;
            }
          } else {
            first = false;
          }
          var elt = void 0;
          if (allowEmpty && this.type === types$1.comma) {
            elt = null;
          } else if (this.type === types$1.ellipsis) {
            elt = this.parseSpread(refDestructuringErrors);
            if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) {
              refDestructuringErrors.trailingComma = this.start;
            }
          } else {
            elt = this.parseMaybeAssign(false, refDestructuringErrors);
          }
          elts.push(elt);
        }
        return elts;
      };
      pp$5.checkUnreserved = function(ref2) {
        var start = ref2.start;
        var end = ref2.end;
        var name = ref2.name;
        if (this.inGenerator && name === "yield") {
          this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
        }
        if (this.inAsync && name === "await") {
          this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
        }
        if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") {
          this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
        }
        if (this.inClassStaticBlock && (name === "arguments" || name === "await")) {
          this.raise(start, "Cannot use " + name + " in class static initialization block");
        }
        if (this.keywords.test(name)) {
          this.raise(start, "Unexpected keyword '" + name + "'");
        }
        if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) {
          return;
        }
        var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
        if (re.test(name)) {
          if (!this.inAsync && name === "await") {
            this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
          }
          this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
        }
      };
      pp$5.parseIdent = function(liberal) {
        var node = this.parseIdentNode();
        this.next(!!liberal);
        this.finishNode(node, "Identifier");
        if (!liberal) {
          this.checkUnreserved(node);
          if (node.name === "await" && !this.awaitIdentPos) {
            this.awaitIdentPos = node.start;
          }
        }
        return node;
      };
      pp$5.parseIdentNode = function() {
        var node = this.startNode();
        if (this.type === types$1.name) {
          node.name = this.value;
        } else if (this.type.keyword) {
          node.name = this.type.keyword;
          if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
            this.context.pop();
          }
          this.type = types$1.name;
        } else {
          this.unexpected();
        }
        return node;
      };
      pp$5.parsePrivateIdent = function() {
        var node = this.startNode();
        if (this.type === types$1.privateId) {
          node.name = this.value;
        } else {
          this.unexpected();
        }
        this.next();
        this.finishNode(node, "PrivateIdentifier");
        if (this.options.checkPrivateFields) {
          if (this.privateNameStack.length === 0) {
            this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
          } else {
            this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
          }
        }
        return node;
      };
      pp$5.parseYield = function(forInit) {
        if (!this.yieldPos) {
          this.yieldPos = this.start;
        }
        var node = this.startNode();
        this.next();
        if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) {
          node.delegate = false;
          node.argument = null;
        } else {
          node.delegate = this.eat(types$1.star);
          node.argument = this.parseMaybeAssign(forInit);
        }
        return this.finishNode(node, "YieldExpression");
      };
      pp$5.parseAwait = function(forInit) {
        if (!this.awaitPos) {
          this.awaitPos = this.start;
        }
        var node = this.startNode();
        this.next();
        node.argument = this.parseMaybeUnary(null, true, false, forInit);
        return this.finishNode(node, "AwaitExpression");
      };
      var pp$4 = Parser.prototype;
      pp$4.raise = function(pos2, message) {
        var loc = getLineInfo(this.input, pos2);
        message += " (" + loc.line + ":" + loc.column + ")";
        if (this.sourceFile) {
          message += " in " + this.sourceFile;
        }
        var err2 = new SyntaxError(message);
        err2.pos = pos2;
        err2.loc = loc;
        err2.raisedAt = this.pos;
        throw err2;
      };
      pp$4.raiseRecoverable = pp$4.raise;
      pp$4.curPosition = function() {
        if (this.options.locations) {
          return new Position(this.curLine, this.pos - this.lineStart);
        }
      };
      var pp$3 = Parser.prototype;
      var Scope = function Scope2(flags2) {
        this.flags = flags2;
        this.var = [];
        this.lexical = [];
        this.functions = [];
      };
      pp$3.enterScope = function(flags2) {
        this.scopeStack.push(new Scope(flags2));
      };
      pp$3.exitScope = function() {
        this.scopeStack.pop();
      };
      pp$3.treatFunctionsAsVarInScope = function(scope) {
        return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP;
      };
      pp$3.declareName = function(name, bindingType, pos2) {
        var redeclared = false;
        if (bindingType === BIND_LEXICAL) {
          var scope = this.currentScope();
          redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
          scope.lexical.push(name);
          if (this.inModule && scope.flags & SCOPE_TOP) {
            delete this.undefinedExports[name];
          }
        } else if (bindingType === BIND_SIMPLE_CATCH) {
          var scope$1 = this.currentScope();
          scope$1.lexical.push(name);
        } else if (bindingType === BIND_FUNCTION) {
          var scope$2 = this.currentScope();
          if (this.treatFunctionsAsVar) {
            redeclared = scope$2.lexical.indexOf(name) > -1;
          } else {
            redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1;
          }
          scope$2.functions.push(name);
        } else {
          for (var i2 = this.scopeStack.length - 1; i2 >= 0; --i2) {
            var scope$3 = this.scopeStack[i2];
            if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
              redeclared = true;
              break;
            }
            scope$3.var.push(name);
            if (this.inModule && scope$3.flags & SCOPE_TOP) {
              delete this.undefinedExports[name];
            }
            if (scope$3.flags & SCOPE_VAR) {
              break;
            }
          }
        }
        if (redeclared) {
          this.raiseRecoverable(pos2, "Identifier '" + name + "' has already been declared");
        }
      };
      pp$3.checkLocalExport = function(id) {
        if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) {
          this.undefinedExports[id.name] = id;
        }
      };
      pp$3.currentScope = function() {
        return this.scopeStack[this.scopeStack.length - 1];
      };
      pp$3.currentVarScope = function() {
        for (var i2 = this.scopeStack.length - 1; ; i2--) {
          var scope = this.scopeStack[i2];
          if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) {
            return scope;
          }
        }
      };
      pp$3.currentThisScope = function() {
        for (var i2 = this.scopeStack.length - 1; ; i2--) {
          var scope = this.scopeStack[i2];
          if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW)) {
            return scope;
          }
        }
      };
      var Node2 = function Node3(parser2, pos2, loc) {
        this.type = "";
        this.start = pos2;
        this.end = 0;
        if (parser2.options.locations) {
          this.loc = new SourceLocation(parser2, loc);
        }
        if (parser2.options.directSourceFile) {
          this.sourceFile = parser2.options.directSourceFile;
        }
        if (parser2.options.ranges) {
          this.range = [pos2, 0];
        }
      };
      var pp$2 = Parser.prototype;
      pp$2.startNode = function() {
        return new Node2(this, this.start, this.startLoc);
      };
      pp$2.startNodeAt = function(pos2, loc) {
        return new Node2(this, pos2, loc);
      };
      function finishNodeAt(node, type, pos2, loc) {
        node.type = type;
        node.end = pos2;
        if (this.options.locations) {
          node.loc.end = loc;
        }
        if (this.options.ranges) {
          node.range[1] = pos2;
        }
        return node;
      }
      pp$2.finishNode = function(node, type) {
        return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
      };
      pp$2.finishNodeAt = function(node, type, pos2, loc) {
        return finishNodeAt.call(this, node, type, pos2, loc);
      };
      pp$2.copyNode = function(node) {
        var newNode = new Node2(this, node.start, this.startLoc);
        for (var prop2 in node) {
          newNode[prop2] = node[prop2];
        }
        return newNode;
      };
      var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
      var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
      var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
      var ecma11BinaryProperties = ecma10BinaryProperties;
      var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
      var ecma13BinaryProperties = ecma12BinaryProperties;
      var ecma14BinaryProperties = ecma13BinaryProperties;
      var unicodeBinaryProperties = {
        9: ecma9BinaryProperties,
        10: ecma10BinaryProperties,
        11: ecma11BinaryProperties,
        12: ecma12BinaryProperties,
        13: ecma13BinaryProperties,
        14: ecma14BinaryProperties
      };
      var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
      var unicodeBinaryPropertiesOfStrings = {
        9: "",
        10: "",
        11: "",
        12: "",
        13: "",
        14: ecma14BinaryPropertiesOfStrings
      };
      var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
      var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
      var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
      var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
      var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
      var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
      var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
      var unicodeScriptValues = {
        9: ecma9ScriptValues,
        10: ecma10ScriptValues,
        11: ecma11ScriptValues,
        12: ecma12ScriptValues,
        13: ecma13ScriptValues,
        14: ecma14ScriptValues
      };
      var data = {};
      function buildUnicodeData(ecmaVersion2) {
        var d = data[ecmaVersion2] = {
          binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion2] + " " + unicodeGeneralCategoryValues),
          binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion2]),
          nonBinary: {
            General_Category: wordsRegexp(unicodeGeneralCategoryValues),
            Script: wordsRegexp(unicodeScriptValues[ecmaVersion2])
          }
        };
        d.nonBinary.Script_Extensions = d.nonBinary.Script;
        d.nonBinary.gc = d.nonBinary.General_Category;
        d.nonBinary.sc = d.nonBinary.Script;
        d.nonBinary.scx = d.nonBinary.Script_Extensions;
      }
      for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
        var ecmaVersion = list[i];
        buildUnicodeData(ecmaVersion);
      }
      var pp$1 = Parser.prototype;
      var BranchID = function BranchID2(parent, base2) {
        this.parent = parent;
        this.base = base2 || this;
      };
      BranchID.prototype.separatedFrom = function separatedFrom(alt) {
        for (var self3 = this; self3; self3 = self3.parent) {
          for (var other = alt; other; other = other.parent) {
            if (self3.base === other.base && self3 !== other) {
              return true;
            }
          }
        }
        return false;
      };
      BranchID.prototype.sibling = function sibling2() {
        return new BranchID(this.parent, this.base);
      };
      var RegExpValidationState = function RegExpValidationState2(parser2) {
        this.parser = parser2;
        this.validFlags = "gim" + (parser2.options.ecmaVersion >= 6 ? "uy" : "") + (parser2.options.ecmaVersion >= 9 ? "s" : "") + (parser2.options.ecmaVersion >= 13 ? "d" : "") + (parser2.options.ecmaVersion >= 15 ? "v" : "");
        this.unicodeProperties = data[parser2.options.ecmaVersion >= 14 ? 14 : parser2.options.ecmaVersion];
        this.source = "";
        this.flags = "";
        this.start = 0;
        this.switchU = false;
        this.switchV = false;
        this.switchN = false;
        this.pos = 0;
        this.lastIntValue = 0;
        this.lastStringValue = "";
        this.lastAssertionIsQuantifiable = false;
        this.numCapturingParens = 0;
        this.maxBackReference = 0;
        this.groupNames = /* @__PURE__ */ Object.create(null);
        this.backReferenceNames = [];
        this.branchID = null;
      };
      RegExpValidationState.prototype.reset = function reset2(start, pattern, flags2) {
        var unicodeSets = flags2.indexOf("v") !== -1;
        var unicode = flags2.indexOf("u") !== -1;
        this.start = start | 0;
        this.source = pattern + "";
        this.flags = flags2;
        if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
          this.switchU = true;
          this.switchV = true;
          this.switchN = true;
        } else {
          this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
          this.switchV = false;
          this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
        }
      };
      RegExpValidationState.prototype.raise = function raise(message) {
        this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
      };
      RegExpValidationState.prototype.at = function at(i2, forceU) {
        if (forceU === void 0) forceU = false;
        var s = this.source;
        var l = s.length;
        if (i2 >= l) {
          return -1;
        }
        var c = s.charCodeAt(i2);
        if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i2 + 1 >= l) {
          return c;
        }
        var next2 = s.charCodeAt(i2 + 1);
        return next2 >= 56320 && next2 <= 57343 ? (c << 10) + next2 - 56613888 : c;
      };
      RegExpValidationState.prototype.nextIndex = function nextIndex(i2, forceU) {
        if (forceU === void 0) forceU = false;
        var s = this.source;
        var l = s.length;
        if (i2 >= l) {
          return l;
        }
        var c = s.charCodeAt(i2), next2;
        if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i2 + 1 >= l || (next2 = s.charCodeAt(i2 + 1)) < 56320 || next2 > 57343) {
          return i2 + 1;
        }
        return i2 + 2;
      };
      RegExpValidationState.prototype.current = function current(forceU) {
        if (forceU === void 0) forceU = false;
        return this.at(this.pos, forceU);
      };
      RegExpValidationState.prototype.lookahead = function lookahead(forceU) {
        if (forceU === void 0) forceU = false;
        return this.at(this.nextIndex(this.pos, forceU), forceU);
      };
      RegExpValidationState.prototype.advance = function advance(forceU) {
        if (forceU === void 0) forceU = false;
        this.pos = this.nextIndex(this.pos, forceU);
      };
      RegExpValidationState.prototype.eat = function eat(ch3, forceU) {
        if (forceU === void 0) forceU = false;
        if (this.current(forceU) === ch3) {
          this.advance(forceU);
          return true;
        }
        return false;
      };
      RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
        if (forceU === void 0) forceU = false;
        var pos2 = this.pos;
        for (var i2 = 0, list2 = chs; i2 < list2.length; i2 += 1) {
          var ch3 = list2[i2];
          var current = this.at(pos2, forceU);
          if (current === -1 || current !== ch3) {
            return false;
          }
          pos2 = this.nextIndex(pos2, forceU);
        }
        this.pos = pos2;
        return true;
      };
      pp$1.validateRegExpFlags = function(state2) {
        var validFlags = state2.validFlags;
        var flags2 = state2.flags;
        var u = false;
        var v = false;
        for (var i2 = 0; i2 < flags2.length; i2++) {
          var flag = flags2.charAt(i2);
          if (validFlags.indexOf(flag) === -1) {
            this.raise(state2.start, "Invalid regular expression flag");
          }
          if (flags2.indexOf(flag, i2 + 1) > -1) {
            this.raise(state2.start, "Duplicate regular expression flag");
          }
          if (flag === "u") {
            u = true;
          }
          if (flag === "v") {
            v = true;
          }
        }
        if (this.options.ecmaVersion >= 15 && u && v) {
          this.raise(state2.start, "Invalid regular expression flag");
        }
      };
      function hasProp(obj) {
        for (var _ in obj) {
          return true;
        }
        return false;
      }
      pp$1.validateRegExpPattern = function(state2) {
        this.regexp_pattern(state2);
        if (!state2.switchN && this.options.ecmaVersion >= 9 && hasProp(state2.groupNames)) {
          state2.switchN = true;
          this.regexp_pattern(state2);
        }
      };
      pp$1.regexp_pattern = function(state2) {
        state2.pos = 0;
        state2.lastIntValue = 0;
        state2.lastStringValue = "";
        state2.lastAssertionIsQuantifiable = false;
        state2.numCapturingParens = 0;
        state2.maxBackReference = 0;
        state2.groupNames = /* @__PURE__ */ Object.create(null);
        state2.backReferenceNames.length = 0;
        state2.branchID = null;
        this.regexp_disjunction(state2);
        if (state2.pos !== state2.source.length) {
          if (state2.eat(
            41
            /* ) */
          )) {
            state2.raise("Unmatched ')'");
          }
          if (state2.eat(
            93
            /* ] */
          ) || state2.eat(
            125
            /* } */
          )) {
            state2.raise("Lone quantifier brackets");
          }
        }
        if (state2.maxBackReference > state2.numCapturingParens) {
          state2.raise("Invalid escape");
        }
        for (var i2 = 0, list2 = state2.backReferenceNames; i2 < list2.length; i2 += 1) {
          var name = list2[i2];
          if (!state2.groupNames[name]) {
            state2.raise("Invalid named capture referenced");
          }
        }
      };
      pp$1.regexp_disjunction = function(state2) {
        var trackDisjunction = this.options.ecmaVersion >= 16;
        if (trackDisjunction) {
          state2.branchID = new BranchID(state2.branchID, null);
        }
        this.regexp_alternative(state2);
        while (state2.eat(
          124
          /* | */
        )) {
          if (trackDisjunction) {
            state2.branchID = state2.branchID.sibling();
          }
          this.regexp_alternative(state2);
        }
        if (trackDisjunction) {
          state2.branchID = state2.branchID.parent;
        }
        if (this.regexp_eatQuantifier(state2, true)) {
          state2.raise("Nothing to repeat");
        }
        if (state2.eat(
          123
          /* { */
        )) {
          state2.raise("Lone quantifier brackets");
        }
      };
      pp$1.regexp_alternative = function(state2) {
        while (state2.pos < state2.source.length && this.regexp_eatTerm(state2)) {
        }
      };
      pp$1.regexp_eatTerm = function(state2) {
        if (this.regexp_eatAssertion(state2)) {
          if (state2.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state2)) {
            if (state2.switchU) {
              state2.raise("Invalid quantifier");
            }
          }
          return true;
        }
        if (state2.switchU ? this.regexp_eatAtom(state2) : this.regexp_eatExtendedAtom(state2)) {
          this.regexp_eatQuantifier(state2);
          return true;
        }
        return false;
      };
      pp$1.regexp_eatAssertion = function(state2) {
        var start = state2.pos;
        state2.lastAssertionIsQuantifiable = false;
        if (state2.eat(
          94
          /* ^ */
        ) || state2.eat(
          36
          /* $ */
        )) {
          return true;
        }
        if (state2.eat(
          92
          /* \ */
        )) {
          if (state2.eat(
            66
            /* B */
          ) || state2.eat(
            98
            /* b */
          )) {
            return true;
          }
          state2.pos = start;
        }
        if (state2.eat(
          40
          /* ( */
        ) && state2.eat(
          63
          /* ? */
        )) {
          var lookbehind = false;
          if (this.options.ecmaVersion >= 9) {
            lookbehind = state2.eat(
              60
              /* < */
            );
          }
          if (state2.eat(
            61
            /* = */
          ) || state2.eat(
            33
            /* ! */
          )) {
            this.regexp_disjunction(state2);
            if (!state2.eat(
              41
              /* ) */
            )) {
              state2.raise("Unterminated group");
            }
            state2.lastAssertionIsQuantifiable = !lookbehind;
            return true;
          }
        }
        state2.pos = start;
        return false;
      };
      pp$1.regexp_eatQuantifier = function(state2, noError) {
        if (noError === void 0) noError = false;
        if (this.regexp_eatQuantifierPrefix(state2, noError)) {
          state2.eat(
            63
            /* ? */
          );
          return true;
        }
        return false;
      };
      pp$1.regexp_eatQuantifierPrefix = function(state2, noError) {
        return state2.eat(
          42
          /* * */
        ) || state2.eat(
          43
          /* + */
        ) || state2.eat(
          63
          /* ? */
        ) || this.regexp_eatBracedQuantifier(state2, noError);
      };
      pp$1.regexp_eatBracedQuantifier = function(state2, noError) {
        var start = state2.pos;
        if (state2.eat(
          123
          /* { */
        )) {
          var min = 0, max3 = -1;
          if (this.regexp_eatDecimalDigits(state2)) {
            min = state2.lastIntValue;
            if (state2.eat(
              44
              /* , */
            ) && this.regexp_eatDecimalDigits(state2)) {
              max3 = state2.lastIntValue;
            }
            if (state2.eat(
              125
              /* } */
            )) {
              if (max3 !== -1 && max3 < min && !noError) {
                state2.raise("numbers out of order in {} quantifier");
              }
              return true;
            }
          }
          if (state2.switchU && !noError) {
            state2.raise("Incomplete quantifier");
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatAtom = function(state2) {
        return this.regexp_eatPatternCharacters(state2) || state2.eat(
          46
          /* . */
        ) || this.regexp_eatReverseSolidusAtomEscape(state2) || this.regexp_eatCharacterClass(state2) || this.regexp_eatUncapturingGroup(state2) || this.regexp_eatCapturingGroup(state2);
      };
      pp$1.regexp_eatReverseSolidusAtomEscape = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          92
          /* \ */
        )) {
          if (this.regexp_eatAtomEscape(state2)) {
            return true;
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatUncapturingGroup = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          40
          /* ( */
        )) {
          if (state2.eat(
            63
            /* ? */
          )) {
            if (this.options.ecmaVersion >= 16) {
              var addModifiers = this.regexp_eatModifiers(state2);
              var hasHyphen = state2.eat(
                45
                /* - */
              );
              if (addModifiers || hasHyphen) {
                for (var i2 = 0; i2 < addModifiers.length; i2++) {
                  var modifier = addModifiers.charAt(i2);
                  if (addModifiers.indexOf(modifier, i2 + 1) > -1) {
                    state2.raise("Duplicate regular expression modifiers");
                  }
                }
                if (hasHyphen) {
                  var removeModifiers = this.regexp_eatModifiers(state2);
                  if (!addModifiers && !removeModifiers && state2.current() === 58) {
                    state2.raise("Invalid regular expression modifiers");
                  }
                  for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
                    var modifier$1 = removeModifiers.charAt(i$1);
                    if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || addModifiers.indexOf(modifier$1) > -1) {
                      state2.raise("Duplicate regular expression modifiers");
                    }
                  }
                }
              }
            }
            if (state2.eat(
              58
              /* : */
            )) {
              this.regexp_disjunction(state2);
              if (state2.eat(
                41
                /* ) */
              )) {
                return true;
              }
              state2.raise("Unterminated group");
            }
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatCapturingGroup = function(state2) {
        if (state2.eat(
          40
          /* ( */
        )) {
          if (this.options.ecmaVersion >= 9) {
            this.regexp_groupSpecifier(state2);
          } else if (state2.current() === 63) {
            state2.raise("Invalid group");
          }
          this.regexp_disjunction(state2);
          if (state2.eat(
            41
            /* ) */
          )) {
            state2.numCapturingParens += 1;
            return true;
          }
          state2.raise("Unterminated group");
        }
        return false;
      };
      pp$1.regexp_eatModifiers = function(state2) {
        var modifiers = "";
        var ch3 = 0;
        while ((ch3 = state2.current()) !== -1 && isRegularExpressionModifier(ch3)) {
          modifiers += codePointToString(ch3);
          state2.advance();
        }
        return modifiers;
      };
      function isRegularExpressionModifier(ch3) {
        return ch3 === 105 || ch3 === 109 || ch3 === 115;
      }
      pp$1.regexp_eatExtendedAtom = function(state2) {
        return state2.eat(
          46
          /* . */
        ) || this.regexp_eatReverseSolidusAtomEscape(state2) || this.regexp_eatCharacterClass(state2) || this.regexp_eatUncapturingGroup(state2) || this.regexp_eatCapturingGroup(state2) || this.regexp_eatInvalidBracedQuantifier(state2) || this.regexp_eatExtendedPatternCharacter(state2);
      };
      pp$1.regexp_eatInvalidBracedQuantifier = function(state2) {
        if (this.regexp_eatBracedQuantifier(state2, true)) {
          state2.raise("Nothing to repeat");
        }
        return false;
      };
      pp$1.regexp_eatSyntaxCharacter = function(state2) {
        var ch3 = state2.current();
        if (isSyntaxCharacter(ch3)) {
          state2.lastIntValue = ch3;
          state2.advance();
          return true;
        }
        return false;
      };
      function isSyntaxCharacter(ch3) {
        return ch3 === 36 || ch3 >= 40 && ch3 <= 43 || ch3 === 46 || ch3 === 63 || ch3 >= 91 && ch3 <= 94 || ch3 >= 123 && ch3 <= 125;
      }
      pp$1.regexp_eatPatternCharacters = function(state2) {
        var start = state2.pos;
        var ch3 = 0;
        while ((ch3 = state2.current()) !== -1 && !isSyntaxCharacter(ch3)) {
          state2.advance();
        }
        return state2.pos !== start;
      };
      pp$1.regexp_eatExtendedPatternCharacter = function(state2) {
        var ch3 = state2.current();
        if (ch3 !== -1 && ch3 !== 36 && !(ch3 >= 40 && ch3 <= 43) && ch3 !== 46 && ch3 !== 63 && ch3 !== 91 && ch3 !== 94 && ch3 !== 124) {
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_groupSpecifier = function(state2) {
        if (state2.eat(
          63
          /* ? */
        )) {
          if (!this.regexp_eatGroupName(state2)) {
            state2.raise("Invalid group");
          }
          var trackDisjunction = this.options.ecmaVersion >= 16;
          var known = state2.groupNames[state2.lastStringValue];
          if (known) {
            if (trackDisjunction) {
              for (var i2 = 0, list2 = known; i2 < list2.length; i2 += 1) {
                var altID = list2[i2];
                if (!altID.separatedFrom(state2.branchID)) {
                  state2.raise("Duplicate capture group name");
                }
              }
            } else {
              state2.raise("Duplicate capture group name");
            }
          }
          if (trackDisjunction) {
            (known || (state2.groupNames[state2.lastStringValue] = [])).push(state2.branchID);
          } else {
            state2.groupNames[state2.lastStringValue] = true;
          }
        }
      };
      pp$1.regexp_eatGroupName = function(state2) {
        state2.lastStringValue = "";
        if (state2.eat(
          60
          /* < */
        )) {
          if (this.regexp_eatRegExpIdentifierName(state2) && state2.eat(
            62
            /* > */
          )) {
            return true;
          }
          state2.raise("Invalid capture group name");
        }
        return false;
      };
      pp$1.regexp_eatRegExpIdentifierName = function(state2) {
        state2.lastStringValue = "";
        if (this.regexp_eatRegExpIdentifierStart(state2)) {
          state2.lastStringValue += codePointToString(state2.lastIntValue);
          while (this.regexp_eatRegExpIdentifierPart(state2)) {
            state2.lastStringValue += codePointToString(state2.lastIntValue);
          }
          return true;
        }
        return false;
      };
      pp$1.regexp_eatRegExpIdentifierStart = function(state2) {
        var start = state2.pos;
        var forceU = this.options.ecmaVersion >= 11;
        var ch3 = state2.current(forceU);
        state2.advance(forceU);
        if (ch3 === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state2, forceU)) {
          ch3 = state2.lastIntValue;
        }
        if (isRegExpIdentifierStart(ch3)) {
          state2.lastIntValue = ch3;
          return true;
        }
        state2.pos = start;
        return false;
      };
      function isRegExpIdentifierStart(ch3) {
        return isIdentifierStart(ch3, true) || ch3 === 36 || ch3 === 95;
      }
      pp$1.regexp_eatRegExpIdentifierPart = function(state2) {
        var start = state2.pos;
        var forceU = this.options.ecmaVersion >= 11;
        var ch3 = state2.current(forceU);
        state2.advance(forceU);
        if (ch3 === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state2, forceU)) {
          ch3 = state2.lastIntValue;
        }
        if (isRegExpIdentifierPart(ch3)) {
          state2.lastIntValue = ch3;
          return true;
        }
        state2.pos = start;
        return false;
      };
      function isRegExpIdentifierPart(ch3) {
        return isIdentifierChar(ch3, true) || ch3 === 36 || ch3 === 95 || ch3 === 8204 || ch3 === 8205;
      }
      pp$1.regexp_eatAtomEscape = function(state2) {
        if (this.regexp_eatBackReference(state2) || this.regexp_eatCharacterClassEscape(state2) || this.regexp_eatCharacterEscape(state2) || state2.switchN && this.regexp_eatKGroupName(state2)) {
          return true;
        }
        if (state2.switchU) {
          if (state2.current() === 99) {
            state2.raise("Invalid unicode escape");
          }
          state2.raise("Invalid escape");
        }
        return false;
      };
      pp$1.regexp_eatBackReference = function(state2) {
        var start = state2.pos;
        if (this.regexp_eatDecimalEscape(state2)) {
          var n3 = state2.lastIntValue;
          if (state2.switchU) {
            if (n3 > state2.maxBackReference) {
              state2.maxBackReference = n3;
            }
            return true;
          }
          if (n3 <= state2.numCapturingParens) {
            return true;
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatKGroupName = function(state2) {
        if (state2.eat(
          107
          /* k */
        )) {
          if (this.regexp_eatGroupName(state2)) {
            state2.backReferenceNames.push(state2.lastStringValue);
            return true;
          }
          state2.raise("Invalid named reference");
        }
        return false;
      };
      pp$1.regexp_eatCharacterEscape = function(state2) {
        return this.regexp_eatControlEscape(state2) || this.regexp_eatCControlLetter(state2) || this.regexp_eatZero(state2) || this.regexp_eatHexEscapeSequence(state2) || this.regexp_eatRegExpUnicodeEscapeSequence(state2, false) || !state2.switchU && this.regexp_eatLegacyOctalEscapeSequence(state2) || this.regexp_eatIdentityEscape(state2);
      };
      pp$1.regexp_eatCControlLetter = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          99
          /* c */
        )) {
          if (this.regexp_eatControlLetter(state2)) {
            return true;
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatZero = function(state2) {
        if (state2.current() === 48 && !isDecimalDigit(state2.lookahead())) {
          state2.lastIntValue = 0;
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_eatControlEscape = function(state2) {
        var ch3 = state2.current();
        if (ch3 === 116) {
          state2.lastIntValue = 9;
          state2.advance();
          return true;
        }
        if (ch3 === 110) {
          state2.lastIntValue = 10;
          state2.advance();
          return true;
        }
        if (ch3 === 118) {
          state2.lastIntValue = 11;
          state2.advance();
          return true;
        }
        if (ch3 === 102) {
          state2.lastIntValue = 12;
          state2.advance();
          return true;
        }
        if (ch3 === 114) {
          state2.lastIntValue = 13;
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_eatControlLetter = function(state2) {
        var ch3 = state2.current();
        if (isControlLetter(ch3)) {
          state2.lastIntValue = ch3 % 32;
          state2.advance();
          return true;
        }
        return false;
      };
      function isControlLetter(ch3) {
        return ch3 >= 65 && ch3 <= 90 || ch3 >= 97 && ch3 <= 122;
      }
      pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state2, forceU) {
        if (forceU === void 0) forceU = false;
        var start = state2.pos;
        var switchU = forceU || state2.switchU;
        if (state2.eat(
          117
          /* u */
        )) {
          if (this.regexp_eatFixedHexDigits(state2, 4)) {
            var lead = state2.lastIntValue;
            if (switchU && lead >= 55296 && lead <= 56319) {
              var leadSurrogateEnd = state2.pos;
              if (state2.eat(
                92
                /* \ */
              ) && state2.eat(
                117
                /* u */
              ) && this.regexp_eatFixedHexDigits(state2, 4)) {
                var trail = state2.lastIntValue;
                if (trail >= 56320 && trail <= 57343) {
                  state2.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536;
                  return true;
                }
              }
              state2.pos = leadSurrogateEnd;
              state2.lastIntValue = lead;
            }
            return true;
          }
          if (switchU && state2.eat(
            123
            /* { */
          ) && this.regexp_eatHexDigits(state2) && state2.eat(
            125
            /* } */
          ) && isValidUnicode(state2.lastIntValue)) {
            return true;
          }
          if (switchU) {
            state2.raise("Invalid unicode escape");
          }
          state2.pos = start;
        }
        return false;
      };
      function isValidUnicode(ch3) {
        return ch3 >= 0 && ch3 <= 1114111;
      }
      pp$1.regexp_eatIdentityEscape = function(state2) {
        if (state2.switchU) {
          if (this.regexp_eatSyntaxCharacter(state2)) {
            return true;
          }
          if (state2.eat(
            47
            /* / */
          )) {
            state2.lastIntValue = 47;
            return true;
          }
          return false;
        }
        var ch3 = state2.current();
        if (ch3 !== 99 && (!state2.switchN || ch3 !== 107)) {
          state2.lastIntValue = ch3;
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_eatDecimalEscape = function(state2) {
        state2.lastIntValue = 0;
        var ch3 = state2.current();
        if (ch3 >= 49 && ch3 <= 57) {
          do {
            state2.lastIntValue = 10 * state2.lastIntValue + (ch3 - 48);
            state2.advance();
          } while ((ch3 = state2.current()) >= 48 && ch3 <= 57);
          return true;
        }
        return false;
      };
      var CharSetNone = 0;
      var CharSetOk = 1;
      var CharSetString = 2;
      pp$1.regexp_eatCharacterClassEscape = function(state2) {
        var ch3 = state2.current();
        if (isCharacterClassEscape(ch3)) {
          state2.lastIntValue = -1;
          state2.advance();
          return CharSetOk;
        }
        var negate = false;
        if (state2.switchU && this.options.ecmaVersion >= 9 && ((negate = ch3 === 80) || ch3 === 112)) {
          state2.lastIntValue = -1;
          state2.advance();
          var result;
          if (state2.eat(
            123
            /* { */
          ) && (result = this.regexp_eatUnicodePropertyValueExpression(state2)) && state2.eat(
            125
            /* } */
          )) {
            if (negate && result === CharSetString) {
              state2.raise("Invalid property name");
            }
            return result;
          }
          state2.raise("Invalid property name");
        }
        return CharSetNone;
      };
      function isCharacterClassEscape(ch3) {
        return ch3 === 100 || ch3 === 68 || ch3 === 115 || ch3 === 83 || ch3 === 119 || ch3 === 87;
      }
      pp$1.regexp_eatUnicodePropertyValueExpression = function(state2) {
        var start = state2.pos;
        if (this.regexp_eatUnicodePropertyName(state2) && state2.eat(
          61
          /* = */
        )) {
          var name = state2.lastStringValue;
          if (this.regexp_eatUnicodePropertyValue(state2)) {
            var value2 = state2.lastStringValue;
            this.regexp_validateUnicodePropertyNameAndValue(state2, name, value2);
            return CharSetOk;
          }
        }
        state2.pos = start;
        if (this.regexp_eatLoneUnicodePropertyNameOrValue(state2)) {
          var nameOrValue = state2.lastStringValue;
          return this.regexp_validateUnicodePropertyNameOrValue(state2, nameOrValue);
        }
        return CharSetNone;
      };
      pp$1.regexp_validateUnicodePropertyNameAndValue = function(state2, name, value2) {
        if (!hasOwn(state2.unicodeProperties.nonBinary, name)) {
          state2.raise("Invalid property name");
        }
        if (!state2.unicodeProperties.nonBinary[name].test(value2)) {
          state2.raise("Invalid property value");
        }
      };
      pp$1.regexp_validateUnicodePropertyNameOrValue = function(state2, nameOrValue) {
        if (state2.unicodeProperties.binary.test(nameOrValue)) {
          return CharSetOk;
        }
        if (state2.switchV && state2.unicodeProperties.binaryOfStrings.test(nameOrValue)) {
          return CharSetString;
        }
        state2.raise("Invalid property name");
      };
      pp$1.regexp_eatUnicodePropertyName = function(state2) {
        var ch3 = 0;
        state2.lastStringValue = "";
        while (isUnicodePropertyNameCharacter(ch3 = state2.current())) {
          state2.lastStringValue += codePointToString(ch3);
          state2.advance();
        }
        return state2.lastStringValue !== "";
      };
      function isUnicodePropertyNameCharacter(ch3) {
        return isControlLetter(ch3) || ch3 === 95;
      }
      pp$1.regexp_eatUnicodePropertyValue = function(state2) {
        var ch3 = 0;
        state2.lastStringValue = "";
        while (isUnicodePropertyValueCharacter(ch3 = state2.current())) {
          state2.lastStringValue += codePointToString(ch3);
          state2.advance();
        }
        return state2.lastStringValue !== "";
      };
      function isUnicodePropertyValueCharacter(ch3) {
        return isUnicodePropertyNameCharacter(ch3) || isDecimalDigit(ch3);
      }
      pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state2) {
        return this.regexp_eatUnicodePropertyValue(state2);
      };
      pp$1.regexp_eatCharacterClass = function(state2) {
        if (state2.eat(
          91
          /* [ */
        )) {
          var negate = state2.eat(
            94
            /* ^ */
          );
          var result = this.regexp_classContents(state2);
          if (!state2.eat(
            93
            /* ] */
          )) {
            state2.raise("Unterminated character class");
          }
          if (negate && result === CharSetString) {
            state2.raise("Negated character class may contain strings");
          }
          return true;
        }
        return false;
      };
      pp$1.regexp_classContents = function(state2) {
        if (state2.current() === 93) {
          return CharSetOk;
        }
        if (state2.switchV) {
          return this.regexp_classSetExpression(state2);
        }
        this.regexp_nonEmptyClassRanges(state2);
        return CharSetOk;
      };
      pp$1.regexp_nonEmptyClassRanges = function(state2) {
        while (this.regexp_eatClassAtom(state2)) {
          var left = state2.lastIntValue;
          if (state2.eat(
            45
            /* - */
          ) && this.regexp_eatClassAtom(state2)) {
            var right = state2.lastIntValue;
            if (state2.switchU && (left === -1 || right === -1)) {
              state2.raise("Invalid character class");
            }
            if (left !== -1 && right !== -1 && left > right) {
              state2.raise("Range out of order in character class");
            }
          }
        }
      };
      pp$1.regexp_eatClassAtom = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          92
          /* \ */
        )) {
          if (this.regexp_eatClassEscape(state2)) {
            return true;
          }
          if (state2.switchU) {
            var ch$1 = state2.current();
            if (ch$1 === 99 || isOctalDigit(ch$1)) {
              state2.raise("Invalid class escape");
            }
            state2.raise("Invalid escape");
          }
          state2.pos = start;
        }
        var ch3 = state2.current();
        if (ch3 !== 93) {
          state2.lastIntValue = ch3;
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_eatClassEscape = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          98
          /* b */
        )) {
          state2.lastIntValue = 8;
          return true;
        }
        if (state2.switchU && state2.eat(
          45
          /* - */
        )) {
          state2.lastIntValue = 45;
          return true;
        }
        if (!state2.switchU && state2.eat(
          99
          /* c */
        )) {
          if (this.regexp_eatClassControlLetter(state2)) {
            return true;
          }
          state2.pos = start;
        }
        return this.regexp_eatCharacterClassEscape(state2) || this.regexp_eatCharacterEscape(state2);
      };
      pp$1.regexp_classSetExpression = function(state2) {
        var result = CharSetOk, subResult;
        if (this.regexp_eatClassSetRange(state2)) ;
        else if (subResult = this.regexp_eatClassSetOperand(state2)) {
          if (subResult === CharSetString) {
            result = CharSetString;
          }
          var start = state2.pos;
          while (state2.eatChars(
            [38, 38]
            /* && */
          )) {
            if (state2.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state2))) {
              if (subResult !== CharSetString) {
                result = CharSetOk;
              }
              continue;
            }
            state2.raise("Invalid character in character class");
          }
          if (start !== state2.pos) {
            return result;
          }
          while (state2.eatChars(
            [45, 45]
            /* -- */
          )) {
            if (this.regexp_eatClassSetOperand(state2)) {
              continue;
            }
            state2.raise("Invalid character in character class");
          }
          if (start !== state2.pos) {
            return result;
          }
        } else {
          state2.raise("Invalid character in character class");
        }
        for (; ; ) {
          if (this.regexp_eatClassSetRange(state2)) {
            continue;
          }
          subResult = this.regexp_eatClassSetOperand(state2);
          if (!subResult) {
            return result;
          }
          if (subResult === CharSetString) {
            result = CharSetString;
          }
        }
      };
      pp$1.regexp_eatClassSetRange = function(state2) {
        var start = state2.pos;
        if (this.regexp_eatClassSetCharacter(state2)) {
          var left = state2.lastIntValue;
          if (state2.eat(
            45
            /* - */
          ) && this.regexp_eatClassSetCharacter(state2)) {
            var right = state2.lastIntValue;
            if (left !== -1 && right !== -1 && left > right) {
              state2.raise("Range out of order in character class");
            }
            return true;
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatClassSetOperand = function(state2) {
        if (this.regexp_eatClassSetCharacter(state2)) {
          return CharSetOk;
        }
        return this.regexp_eatClassStringDisjunction(state2) || this.regexp_eatNestedClass(state2);
      };
      pp$1.regexp_eatNestedClass = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          91
          /* [ */
        )) {
          var negate = state2.eat(
            94
            /* ^ */
          );
          var result = this.regexp_classContents(state2);
          if (state2.eat(
            93
            /* ] */
          )) {
            if (negate && result === CharSetString) {
              state2.raise("Negated character class may contain strings");
            }
            return result;
          }
          state2.pos = start;
        }
        if (state2.eat(
          92
          /* \ */
        )) {
          var result$1 = this.regexp_eatCharacterClassEscape(state2);
          if (result$1) {
            return result$1;
          }
          state2.pos = start;
        }
        return null;
      };
      pp$1.regexp_eatClassStringDisjunction = function(state2) {
        var start = state2.pos;
        if (state2.eatChars(
          [92, 113]
          /* \q */
        )) {
          if (state2.eat(
            123
            /* { */
          )) {
            var result = this.regexp_classStringDisjunctionContents(state2);
            if (state2.eat(
              125
              /* } */
            )) {
              return result;
            }
          } else {
            state2.raise("Invalid escape");
          }
          state2.pos = start;
        }
        return null;
      };
      pp$1.regexp_classStringDisjunctionContents = function(state2) {
        var result = this.regexp_classString(state2);
        while (state2.eat(
          124
          /* | */
        )) {
          if (this.regexp_classString(state2) === CharSetString) {
            result = CharSetString;
          }
        }
        return result;
      };
      pp$1.regexp_classString = function(state2) {
        var count = 0;
        while (this.regexp_eatClassSetCharacter(state2)) {
          count++;
        }
        return count === 1 ? CharSetOk : CharSetString;
      };
      pp$1.regexp_eatClassSetCharacter = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          92
          /* \ */
        )) {
          if (this.regexp_eatCharacterEscape(state2) || this.regexp_eatClassSetReservedPunctuator(state2)) {
            return true;
          }
          if (state2.eat(
            98
            /* b */
          )) {
            state2.lastIntValue = 8;
            return true;
          }
          state2.pos = start;
          return false;
        }
        var ch3 = state2.current();
        if (ch3 < 0 || ch3 === state2.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch3)) {
          return false;
        }
        if (isClassSetSyntaxCharacter(ch3)) {
          return false;
        }
        state2.advance();
        state2.lastIntValue = ch3;
        return true;
      };
      function isClassSetReservedDoublePunctuatorCharacter(ch3) {
        return ch3 === 33 || ch3 >= 35 && ch3 <= 38 || ch3 >= 42 && ch3 <= 44 || ch3 === 46 || ch3 >= 58 && ch3 <= 64 || ch3 === 94 || ch3 === 96 || ch3 === 126;
      }
      function isClassSetSyntaxCharacter(ch3) {
        return ch3 === 40 || ch3 === 41 || ch3 === 45 || ch3 === 47 || ch3 >= 91 && ch3 <= 93 || ch3 >= 123 && ch3 <= 125;
      }
      pp$1.regexp_eatClassSetReservedPunctuator = function(state2) {
        var ch3 = state2.current();
        if (isClassSetReservedPunctuator(ch3)) {
          state2.lastIntValue = ch3;
          state2.advance();
          return true;
        }
        return false;
      };
      function isClassSetReservedPunctuator(ch3) {
        return ch3 === 33 || ch3 === 35 || ch3 === 37 || ch3 === 38 || ch3 === 44 || ch3 === 45 || ch3 >= 58 && ch3 <= 62 || ch3 === 64 || ch3 === 96 || ch3 === 126;
      }
      pp$1.regexp_eatClassControlLetter = function(state2) {
        var ch3 = state2.current();
        if (isDecimalDigit(ch3) || ch3 === 95) {
          state2.lastIntValue = ch3 % 32;
          state2.advance();
          return true;
        }
        return false;
      };
      pp$1.regexp_eatHexEscapeSequence = function(state2) {
        var start = state2.pos;
        if (state2.eat(
          120
          /* x */
        )) {
          if (this.regexp_eatFixedHexDigits(state2, 2)) {
            return true;
          }
          if (state2.switchU) {
            state2.raise("Invalid escape");
          }
          state2.pos = start;
        }
        return false;
      };
      pp$1.regexp_eatDecimalDigits = function(state2) {
        var start = state2.pos;
        var ch3 = 0;
        state2.lastIntValue = 0;
        while (isDecimalDigit(ch3 = state2.current())) {
          state2.lastIntValue = 10 * state2.lastIntValue + (ch3 - 48);
          state2.advance();
        }
        return state2.pos !== start;
      };
      function isDecimalDigit(ch3) {
        return ch3 >= 48 && ch3 <= 57;
      }
      pp$1.regexp_eatHexDigits = function(state2) {
        var start = state2.pos;
        var ch3 = 0;
        state2.lastIntValue = 0;
        while (isHexDigit(ch3 = state2.current())) {
          state2.lastIntValue = 16 * state2.lastIntValue + hexToInt(ch3);
          state2.advance();
        }
        return state2.pos !== start;
      };
      function isHexDigit(ch3) {
        return ch3 >= 48 && ch3 <= 57 || ch3 >= 65 && ch3 <= 70 || ch3 >= 97 && ch3 <= 102;
      }
      function hexToInt(ch3) {
        if (ch3 >= 65 && ch3 <= 70) {
          return 10 + (ch3 - 65);
        }
        if (ch3 >= 97 && ch3 <= 102) {
          return 10 + (ch3 - 97);
        }
        return ch3 - 48;
      }
      pp$1.regexp_eatLegacyOctalEscapeSequence = function(state2) {
        if (this.regexp_eatOctalDigit(state2)) {
          var n1 = state2.lastIntValue;
          if (this.regexp_eatOctalDigit(state2)) {
            var n22 = state2.lastIntValue;
            if (n1 <= 3 && this.regexp_eatOctalDigit(state2)) {
              state2.lastIntValue = n1 * 64 + n22 * 8 + state2.lastIntValue;
            } else {
              state2.lastIntValue = n1 * 8 + n22;
            }
          } else {
            state2.lastIntValue = n1;
          }
          return true;
        }
        return false;
      };
      pp$1.regexp_eatOctalDigit = function(state2) {
        var ch3 = state2.current();
        if (isOctalDigit(ch3)) {
          state2.lastIntValue = ch3 - 48;
          state2.advance();
          return true;
        }
        state2.lastIntValue = 0;
        return false;
      };
      function isOctalDigit(ch3) {
        return ch3 >= 48 && ch3 <= 55;
      }
      pp$1.regexp_eatFixedHexDigits = function(state2, length) {
        var start = state2.pos;
        state2.lastIntValue = 0;
        for (var i2 = 0; i2 < length; ++i2) {
          var ch3 = state2.current();
          if (!isHexDigit(ch3)) {
            state2.pos = start;
            return false;
          }
          state2.lastIntValue = 16 * state2.lastIntValue + hexToInt(ch3);
          state2.advance();
        }
        return true;
      };
      var Token2 = function Token3(p) {
        this.type = p.type;
        this.value = p.value;
        this.start = p.start;
        this.end = p.end;
        if (p.options.locations) {
          this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
        }
        if (p.options.ranges) {
          this.range = [p.start, p.end];
        }
      };
      var pp = Parser.prototype;
      pp.next = function(ignoreEscapeSequenceInKeyword) {
        if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) {
          this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword);
        }
        if (this.options.onToken) {
          this.options.onToken(new Token2(this));
        }
        this.lastTokEnd = this.end;
        this.lastTokStart = this.start;
        this.lastTokEndLoc = this.endLoc;
        this.lastTokStartLoc = this.startLoc;
        this.nextToken();
      };
      pp.getToken = function() {
        this.next();
        return new Token2(this);
      };
      if (typeof Symbol !== "undefined") {
        pp[Symbol.iterator] = function() {
          var this$1$1 = this;
          return {
            next: function() {
              var token = this$1$1.getToken();
              return {
                done: token.type === types$1.eof,
                value: token
              };
            }
          };
        };
      }
      pp.nextToken = function() {
        var curContext = this.curContext();
        if (!curContext || !curContext.preserveSpace) {
          this.skipSpace();
        }
        this.start = this.pos;
        if (this.options.locations) {
          this.startLoc = this.curPosition();
        }
        if (this.pos >= this.input.length) {
          return this.finishToken(types$1.eof);
        }
        if (curContext.override) {
          return curContext.override(this);
        } else {
          this.readToken(this.fullCharCodeAtPos());
        }
      };
      pp.readToken = function(code) {
        if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) {
          return this.readWord();
        }
        return this.getTokenFromCode(code);
      };
      pp.fullCharCodeAtPos = function() {
        var code = this.input.charCodeAt(this.pos);
        if (code <= 55295 || code >= 56320) {
          return code;
        }
        var next2 = this.input.charCodeAt(this.pos + 1);
        return next2 <= 56319 || next2 >= 57344 ? code : (code << 10) + next2 - 56613888;
      };
      pp.skipBlockComment = function() {
        var startLoc = this.options.onComment && this.curPosition();
        var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
        if (end === -1) {
          this.raise(this.pos - 2, "Unterminated comment");
        }
        this.pos = end + 2;
        if (this.options.locations) {
          for (var nextBreak = void 0, pos2 = start; (nextBreak = nextLineBreak(this.input, pos2, this.pos)) > -1; ) {
            ++this.curLine;
            pos2 = this.lineStart = nextBreak;
          }
        }
        if (this.options.onComment) {
          this.options.onComment(
            true,
            this.input.slice(start + 2, end),
            start,
            this.pos,
            startLoc,
            this.curPosition()
          );
        }
      };
      pp.skipLineComment = function(startSkip) {
        var start = this.pos;
        var startLoc = this.options.onComment && this.curPosition();
        var ch3 = this.input.charCodeAt(this.pos += startSkip);
        while (this.pos < this.input.length && !isNewLine(ch3)) {
          ch3 = this.input.charCodeAt(++this.pos);
        }
        if (this.options.onComment) {
          this.options.onComment(
            false,
            this.input.slice(start + startSkip, this.pos),
            start,
            this.pos,
            startLoc,
            this.curPosition()
          );
        }
      };
      pp.skipSpace = function() {
        loop: while (this.pos < this.input.length) {
          var ch3 = this.input.charCodeAt(this.pos);
          switch (ch3) {
            case 32:
            case 160:
              ++this.pos;
              break;
            case 13:
              if (this.input.charCodeAt(this.pos + 1) === 10) {
                ++this.pos;
              }
            case 10:
            case 8232:
            case 8233:
              ++this.pos;
              if (this.options.locations) {
                ++this.curLine;
                this.lineStart = this.pos;
              }
              break;
            case 47:
              switch (this.input.charCodeAt(this.pos + 1)) {
                case 42:
                  this.skipBlockComment();
                  break;
                case 47:
                  this.skipLineComment(2);
                  break;
                default:
                  break loop;
              }
              break;
            default:
              if (ch3 > 8 && ch3 < 14 || ch3 >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch3))) {
                ++this.pos;
              } else {
                break loop;
              }
          }
        }
      };
      pp.finishToken = function(type, val) {
        this.end = this.pos;
        if (this.options.locations) {
          this.endLoc = this.curPosition();
        }
        var prevType = this.type;
        this.type = type;
        this.value = val;
        this.updateContext(prevType);
      };
      pp.readToken_dot = function() {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (next2 >= 48 && next2 <= 57) {
          return this.readNumber(true);
        }
        var next22 = this.input.charCodeAt(this.pos + 2);
        if (this.options.ecmaVersion >= 6 && next2 === 46 && next22 === 46) {
          this.pos += 3;
          return this.finishToken(types$1.ellipsis);
        } else {
          ++this.pos;
          return this.finishToken(types$1.dot);
        }
      };
      pp.readToken_slash = function() {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (this.exprAllowed) {
          ++this.pos;
          return this.readRegexp();
        }
        if (next2 === 61) {
          return this.finishOp(types$1.assign, 2);
        }
        return this.finishOp(types$1.slash, 1);
      };
      pp.readToken_mult_modulo_exp = function(code) {
        var next2 = this.input.charCodeAt(this.pos + 1);
        var size = 1;
        var tokentype = code === 42 ? types$1.star : types$1.modulo;
        if (this.options.ecmaVersion >= 7 && code === 42 && next2 === 42) {
          ++size;
          tokentype = types$1.starstar;
          next2 = this.input.charCodeAt(this.pos + 2);
        }
        if (next2 === 61) {
          return this.finishOp(types$1.assign, size + 1);
        }
        return this.finishOp(tokentype, size);
      };
      pp.readToken_pipe_amp = function(code) {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (next2 === code) {
          if (this.options.ecmaVersion >= 12) {
            var next22 = this.input.charCodeAt(this.pos + 2);
            if (next22 === 61) {
              return this.finishOp(types$1.assign, 3);
            }
          }
          return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
        }
        if (next2 === 61) {
          return this.finishOp(types$1.assign, 2);
        }
        return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
      };
      pp.readToken_caret = function() {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (next2 === 61) {
          return this.finishOp(types$1.assign, 2);
        }
        return this.finishOp(types$1.bitwiseXOR, 1);
      };
      pp.readToken_plus_min = function(code) {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (next2 === code) {
          if (next2 === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
            this.skipLineComment(3);
            this.skipSpace();
            return this.nextToken();
          }
          return this.finishOp(types$1.incDec, 2);
        }
        if (next2 === 61) {
          return this.finishOp(types$1.assign, 2);
        }
        return this.finishOp(types$1.plusMin, 1);
      };
      pp.readToken_lt_gt = function(code) {
        var next2 = this.input.charCodeAt(this.pos + 1);
        var size = 1;
        if (next2 === code) {
          size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
          if (this.input.charCodeAt(this.pos + size) === 61) {
            return this.finishOp(types$1.assign, size + 1);
          }
          return this.finishOp(types$1.bitShift, size);
        }
        if (next2 === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
          this.skipLineComment(4);
          this.skipSpace();
          return this.nextToken();
        }
        if (next2 === 61) {
          size = 2;
        }
        return this.finishOp(types$1.relational, size);
      };
      pp.readToken_eq_excl = function(code) {
        var next2 = this.input.charCodeAt(this.pos + 1);
        if (next2 === 61) {
          return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
        }
        if (code === 61 && next2 === 62 && this.options.ecmaVersion >= 6) {
          this.pos += 2;
          return this.finishToken(types$1.arrow);
        }
        return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
      };
      pp.readToken_question = function() {
        var ecmaVersion2 = this.options.ecmaVersion;
        if (ecmaVersion2 >= 11) {
          var next2 = this.input.charCodeAt(this.pos + 1);
          if (next2 === 46) {
            var next22 = this.input.charCodeAt(this.pos + 2);
            if (next22 < 48 || next22 > 57) {
              return this.finishOp(types$1.questionDot, 2);
            }
          }
          if (next2 === 63) {
            if (ecmaVersion2 >= 12) {
              var next2$1 = this.input.charCodeAt(this.pos + 2);
              if (next2$1 === 61) {
                return this.finishOp(types$1.assign, 3);
              }
            }
            return this.finishOp(types$1.coalesce, 2);
          }
        }
        return this.finishOp(types$1.question, 1);
      };
      pp.readToken_numberSign = function() {
        var ecmaVersion2 = this.options.ecmaVersion;
        var code = 35;
        if (ecmaVersion2 >= 13) {
          ++this.pos;
          code = this.fullCharCodeAtPos();
          if (isIdentifierStart(code, true) || code === 92) {
            return this.finishToken(types$1.privateId, this.readWord1());
          }
        }
        this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
      };
      pp.getTokenFromCode = function(code) {
        switch (code) {
          // The interpretation of a dot depends on whether it is followed
          // by a digit or another two dots.
          case 46:
            return this.readToken_dot();
          // Punctuation tokens.
          case 40:
            ++this.pos;
            return this.finishToken(types$1.parenL);
          case 41:
            ++this.pos;
            return this.finishToken(types$1.parenR);
          case 59:
            ++this.pos;
            return this.finishToken(types$1.semi);
          case 44:
            ++this.pos;
            return this.finishToken(types$1.comma);
          case 91:
            ++this.pos;
            return this.finishToken(types$1.bracketL);
          case 93:
            ++this.pos;
            return this.finishToken(types$1.bracketR);
          case 123:
            ++this.pos;
            return this.finishToken(types$1.braceL);
          case 125:
            ++this.pos;
            return this.finishToken(types$1.braceR);
          case 58:
            ++this.pos;
            return this.finishToken(types$1.colon);
          case 96:
            if (this.options.ecmaVersion < 6) {
              break;
            }
            ++this.pos;
            return this.finishToken(types$1.backQuote);
          case 48:
            var next2 = this.input.charCodeAt(this.pos + 1);
            if (next2 === 120 || next2 === 88) {
              return this.readRadixNumber(16);
            }
            if (this.options.ecmaVersion >= 6) {
              if (next2 === 111 || next2 === 79) {
                return this.readRadixNumber(8);
              }
              if (next2 === 98 || next2 === 66) {
                return this.readRadixNumber(2);
              }
            }
          // Anything else beginning with a digit is an integer, octal
          // number, or float.
          case 49:
          case 50:
          case 51:
          case 52:
          case 53:
          case 54:
          case 55:
          case 56:
          case 57:
            return this.readNumber(false);
          // Quotes produce strings.
          case 34:
          case 39:
            return this.readString(code);
          // Operators are parsed inline in tiny state machines. '=' (61) is
          // often referred to. `finishOp` simply skips the amount of
          // characters it is given as second argument, and returns a token
          // of the type given by its first argument.
          case 47:
            return this.readToken_slash();
          case 37:
          case 42:
            return this.readToken_mult_modulo_exp(code);
          case 124:
          case 38:
            return this.readToken_pipe_amp(code);
          case 94:
            return this.readToken_caret();
          case 43:
          case 45:
            return this.readToken_plus_min(code);
          case 60:
          case 62:
            return this.readToken_lt_gt(code);
          case 61:
          case 33:
            return this.readToken_eq_excl(code);
          case 63:
            return this.readToken_question();
          case 126:
            return this.finishOp(types$1.prefix, 1);
          case 35:
            return this.readToken_numberSign();
        }
        this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
      };
      pp.finishOp = function(type, size) {
        var str = this.input.slice(this.pos, this.pos + size);
        this.pos += size;
        return this.finishToken(type, str);
      };
      pp.readRegexp = function() {
        var escaped, inClass, start = this.pos;
        for (; ; ) {
          if (this.pos >= this.input.length) {
            this.raise(start, "Unterminated regular expression");
          }
          var ch3 = this.input.charAt(this.pos);
          if (lineBreak.test(ch3)) {
            this.raise(start, "Unterminated regular expression");
          }
          if (!escaped) {
            if (ch3 === "[") {
              inClass = true;
            } else if (ch3 === "]" && inClass) {
              inClass = false;
            } else if (ch3 === "/" && !inClass) {
              break;
            }
            escaped = ch3 === "\\";
          } else {
            escaped = false;
          }
          ++this.pos;
        }
        var pattern = this.input.slice(start, this.pos);
        ++this.pos;
        var flagsStart = this.pos;
        var flags2 = this.readWord1();
        if (this.containsEsc) {
          this.unexpected(flagsStart);
        }
        var state2 = this.regexpState || (this.regexpState = new RegExpValidationState(this));
        state2.reset(start, pattern, flags2);
        this.validateRegExpFlags(state2);
        this.validateRegExpPattern(state2);
        var value2 = null;
        try {
          value2 = new RegExp(pattern, flags2);
        } catch (e2) {
        }
        return this.finishToken(types$1.regexp, { pattern, flags: flags2, value: value2 });
      };
      pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
        var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0;
        var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
        var start = this.pos, total = 0, lastCode = 0;
        for (var i2 = 0, e2 = len == null ? Infinity : len; i2 < e2; ++i2, ++this.pos) {
          var code = this.input.charCodeAt(this.pos), val = void 0;
          if (allowSeparators && code === 95) {
            if (isLegacyOctalNumericLiteral) {
              this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
            }
            if (lastCode === 95) {
              this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
            }
            if (i2 === 0) {
              this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
            }
            lastCode = code;
            continue;
          }
          if (code >= 97) {
            val = code - 97 + 10;
          } else if (code >= 65) {
            val = code - 65 + 10;
          } else if (code >= 48 && code <= 57) {
            val = code - 48;
          } else {
            val = Infinity;
          }
          if (val >= radix) {
            break;
          }
          lastCode = code;
          total = total * radix + val;
        }
        if (allowSeparators && lastCode === 95) {
          this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits");
        }
        if (this.pos === start || len != null && this.pos - start !== len) {
          return null;
        }
        return total;
      };
      function stringToNumber(str, isLegacyOctalNumericLiteral) {
        if (isLegacyOctalNumericLiteral) {
          return parseInt(str, 8);
        }
        return parseFloat(str.replace(/_/g, ""));
      }
      function stringToBigInt(str) {
        if (typeof BigInt !== "function") {
          return null;
        }
        return BigInt(str.replace(/_/g, ""));
      }
      pp.readRadixNumber = function(radix) {
        var start = this.pos;
        this.pos += 2;
        var val = this.readInt(radix);
        if (val == null) {
          this.raise(this.start + 2, "Expected number in radix " + radix);
        }
        if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
          val = stringToBigInt(this.input.slice(start, this.pos));
          ++this.pos;
        } else if (isIdentifierStart(this.fullCharCodeAtPos())) {
          this.raise(this.pos, "Identifier directly after number");
        }
        return this.finishToken(types$1.num, val);
      };
      pp.readNumber = function(startsWithDot) {
        var start = this.pos;
        if (!startsWithDot && this.readInt(10, void 0, true) === null) {
          this.raise(start, "Invalid number");
        }
        var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
        if (octal && this.strict) {
          this.raise(start, "Invalid number");
        }
        var next2 = this.input.charCodeAt(this.pos);
        if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next2 === 110) {
          var val$1 = stringToBigInt(this.input.slice(start, this.pos));
          ++this.pos;
          if (isIdentifierStart(this.fullCharCodeAtPos())) {
            this.raise(this.pos, "Identifier directly after number");
          }
          return this.finishToken(types$1.num, val$1);
        }
        if (octal && /[89]/.test(this.input.slice(start, this.pos))) {
          octal = false;
        }
        if (next2 === 46 && !octal) {
          ++this.pos;
          this.readInt(10);
          next2 = this.input.charCodeAt(this.pos);
        }
        if ((next2 === 69 || next2 === 101) && !octal) {
          next2 = this.input.charCodeAt(++this.pos);
          if (next2 === 43 || next2 === 45) {
            ++this.pos;
          }
          if (this.readInt(10) === null) {
            this.raise(start, "Invalid number");
          }
        }
        if (isIdentifierStart(this.fullCharCodeAtPos())) {
          this.raise(this.pos, "Identifier directly after number");
        }
        var val = stringToNumber(this.input.slice(start, this.pos), octal);
        return this.finishToken(types$1.num, val);
      };
      pp.readCodePoint = function() {
        var ch3 = this.input.charCodeAt(this.pos), code;
        if (ch3 === 123) {
          if (this.options.ecmaVersion < 6) {
            this.unexpected();
          }
          var codePos = ++this.pos;
          code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
          ++this.pos;
          if (code > 1114111) {
            this.invalidStringToken(codePos, "Code point out of bounds");
          }
        } else {
          code = this.readHexChar(4);
        }
        return code;
      };
      pp.readString = function(quote) {
        var out = "", chunkStart = ++this.pos;
        for (; ; ) {
          if (this.pos >= this.input.length) {
            this.raise(this.start, "Unterminated string constant");
          }
          var ch3 = this.input.charCodeAt(this.pos);
          if (ch3 === quote) {
            break;
          }
          if (ch3 === 92) {
            out += this.input.slice(chunkStart, this.pos);
            out += this.readEscapedChar(false);
            chunkStart = this.pos;
          } else if (ch3 === 8232 || ch3 === 8233) {
            if (this.options.ecmaVersion < 10) {
              this.raise(this.start, "Unterminated string constant");
            }
            ++this.pos;
            if (this.options.locations) {
              this.curLine++;
              this.lineStart = this.pos;
            }
          } else {
            if (isNewLine(ch3)) {
              this.raise(this.start, "Unterminated string constant");
            }
            ++this.pos;
          }
        }
        out += this.input.slice(chunkStart, this.pos++);
        return this.finishToken(types$1.string, out);
      };
      var INVALID_TEMPLATE_ESCAPE_ERROR = {};
      pp.tryReadTemplateToken = function() {
        this.inTemplateElement = true;
        try {
          this.readTmplToken();
        } catch (err2) {
          if (err2 === INVALID_TEMPLATE_ESCAPE_ERROR) {
            this.readInvalidTemplateToken();
          } else {
            throw err2;
          }
        }
        this.inTemplateElement = false;
      };
      pp.invalidStringToken = function(position, message) {
        if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
          throw INVALID_TEMPLATE_ESCAPE_ERROR;
        } else {
          this.raise(position, message);
        }
      };
      pp.readTmplToken = function() {
        var out = "", chunkStart = this.pos;
        for (; ; ) {
          if (this.pos >= this.input.length) {
            this.raise(this.start, "Unterminated template");
          }
          var ch3 = this.input.charCodeAt(this.pos);
          if (ch3 === 96 || ch3 === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
            if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
              if (ch3 === 36) {
                this.pos += 2;
                return this.finishToken(types$1.dollarBraceL);
              } else {
                ++this.pos;
                return this.finishToken(types$1.backQuote);
              }
            }
            out += this.input.slice(chunkStart, this.pos);
            return this.finishToken(types$1.template, out);
          }
          if (ch3 === 92) {
            out += this.input.slice(chunkStart, this.pos);
            out += this.readEscapedChar(true);
            chunkStart = this.pos;
          } else if (isNewLine(ch3)) {
            out += this.input.slice(chunkStart, this.pos);
            ++this.pos;
            switch (ch3) {
              case 13:
                if (this.input.charCodeAt(this.pos) === 10) {
                  ++this.pos;
                }
              case 10:
                out += "\n";
                break;
              default:
                out += String.fromCharCode(ch3);
                break;
            }
            if (this.options.locations) {
              ++this.curLine;
              this.lineStart = this.pos;
            }
            chunkStart = this.pos;
          } else {
            ++this.pos;
          }
        }
      };
      pp.readInvalidTemplateToken = function() {
        for (; this.pos < this.input.length; this.pos++) {
          switch (this.input[this.pos]) {
            case "\\":
              ++this.pos;
              break;
            case "$":
              if (this.input[this.pos + 1] !== "{") {
                break;
              }
            // fall through
            case "`":
              return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
            case "\r":
              if (this.input[this.pos + 1] === "\n") {
                ++this.pos;
              }
            // fall through
            case "\n":
            case "\u2028":
            case "\u2029":
              ++this.curLine;
              this.lineStart = this.pos + 1;
              break;
          }
        }
        this.raise(this.start, "Unterminated template");
      };
      pp.readEscapedChar = function(inTemplate) {
        var ch3 = this.input.charCodeAt(++this.pos);
        ++this.pos;
        switch (ch3) {
          case 110:
            return "\n";
          // 'n' -> '\n'
          case 114:
            return "\r";
          // 'r' -> '\r'
          case 120:
            return String.fromCharCode(this.readHexChar(2));
          // 'x'
          case 117:
            return codePointToString(this.readCodePoint());
          // 'u'
          case 116:
            return "	";
          // 't' -> '\t'
          case 98:
            return "\b";
          // 'b' -> '\b'
          case 118:
            return "\v";
          // 'v' -> '\u000b'
          case 102:
            return "\f";
          // 'f' -> '\f'
          case 13:
            if (this.input.charCodeAt(this.pos) === 10) {
              ++this.pos;
            }
          // '\r\n'
          case 10:
            if (this.options.locations) {
              this.lineStart = this.pos;
              ++this.curLine;
            }
            return "";
          case 56:
          case 57:
            if (this.strict) {
              this.invalidStringToken(
                this.pos - 1,
                "Invalid escape sequence"
              );
            }
            if (inTemplate) {
              var codePos = this.pos - 1;
              this.invalidStringToken(
                codePos,
                "Invalid escape sequence in template string"
              );
            }
          default:
            if (ch3 >= 48 && ch3 <= 55) {
              var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
              var octal = parseInt(octalStr, 8);
              if (octal > 255) {
                octalStr = octalStr.slice(0, -1);
                octal = parseInt(octalStr, 8);
              }
              this.pos += octalStr.length - 1;
              ch3 = this.input.charCodeAt(this.pos);
              if ((octalStr !== "0" || ch3 === 56 || ch3 === 57) && (this.strict || inTemplate)) {
                this.invalidStringToken(
                  this.pos - 1 - octalStr.length,
                  inTemplate ? "Octal literal in template string" : "Octal literal in strict mode"
                );
              }
              return String.fromCharCode(octal);
            }
            if (isNewLine(ch3)) {
              if (this.options.locations) {
                this.lineStart = this.pos;
                ++this.curLine;
              }
              return "";
            }
            return String.fromCharCode(ch3);
        }
      };
      pp.readHexChar = function(len) {
        var codePos = this.pos;
        var n3 = this.readInt(16, len);
        if (n3 === null) {
          this.invalidStringToken(codePos, "Bad character escape sequence");
        }
        return n3;
      };
      pp.readWord1 = function() {
        this.containsEsc = false;
        var word = "", first = true, chunkStart = this.pos;
        var astral = this.options.ecmaVersion >= 6;
        while (this.pos < this.input.length) {
          var ch3 = this.fullCharCodeAtPos();
          if (isIdentifierChar(ch3, astral)) {
            this.pos += ch3 <= 65535 ? 1 : 2;
          } else if (ch3 === 92) {
            this.containsEsc = true;
            word += this.input.slice(chunkStart, this.pos);
            var escStart = this.pos;
            if (this.input.charCodeAt(++this.pos) !== 117) {
              this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX");
            }
            ++this.pos;
            var esc = this.readCodePoint();
            if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) {
              this.invalidStringToken(escStart, "Invalid Unicode escape");
            }
            word += codePointToString(esc);
            chunkStart = this.pos;
          } else {
            break;
          }
          first = false;
        }
        return word + this.input.slice(chunkStart, this.pos);
      };
      pp.readWord = function() {
        var word = this.readWord1();
        var type = types$1.name;
        if (this.keywords.test(word)) {
          type = keywords[word];
        }
        return this.finishToken(type, word);
      };
      var version2 = "8.15.0";
      Parser.acorn = {
        Parser,
        version: version2,
        defaultOptions,
        Position,
        SourceLocation,
        getLineInfo,
        Node: Node2,
        TokenType,
        tokTypes: types$1,
        keywordTypes: keywords,
        TokContext,
        tokContexts: types2,
        isIdentifierChar,
        isIdentifierStart,
        Token: Token2,
        isNewLine,
        lineBreak,
        lineBreakG,
        nonASCIIwhitespace
      };
      function parse2(input, options) {
        return Parser.parse(input, options);
      }
      function parseExpressionAt(input, pos2, options) {
        return Parser.parseExpressionAt(input, pos2, options);
      }
      function tokenizer(input, options) {
        return Parser.tokenizer(input, options);
      }
      exports3.Node = Node2;
      exports3.Parser = Parser;
      exports3.Position = Position;
      exports3.SourceLocation = SourceLocation;
      exports3.TokContext = TokContext;
      exports3.Token = Token2;
      exports3.TokenType = TokenType;
      exports3.defaultOptions = defaultOptions;
      exports3.getLineInfo = getLineInfo;
      exports3.isIdentifierChar = isIdentifierChar;
      exports3.isIdentifierStart = isIdentifierStart;
      exports3.isNewLine = isNewLine;
      exports3.keywordTypes = keywords;
      exports3.lineBreak = lineBreak;
      exports3.lineBreakG = lineBreakG;
      exports3.nonASCIIwhitespace = nonASCIIwhitespace;
      exports3.parse = parse2;
      exports3.parseExpressionAt = parseExpressionAt;
      exports3.tokContexts = types2;
      exports3.tokTypes = types$1;
      exports3.tokenizer = tokenizer;
      exports3.version = version2;
    });
  }
});

// node_modules/terser/dist/bundle.min.js
var require_bundle_min = __commonJS({
  "node_modules/terser/dist/bundle.min.js"(exports2, module2) {
    (function(global2, factory) {
      typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2, require_source_map_umd()) : typeof define === "function" && define.amd ? define(["exports", "@jridgewell/source-map"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.Terser = {}, global2.sourceMap));
    })(exports2, function(exports3, sourceMap) {
      "use strict";
      function characters(str) {
        return str.split("");
      }
      function member(name, array) {
        return array.includes(name);
      }
      class DefaultsError extends Error {
        constructor(msg, defs) {
          super();
          this.name = "DefaultsError";
          this.message = msg;
          this.defs = defs;
        }
      }
      function defaults2(args, defs, croak) {
        if (args === true) {
          args = {};
        } else if (args != null && typeof args === "object") {
          args = { ...args };
        }
        const ret = args || {};
        if (croak) {
          for (const i in ret) if (HOP(ret, i) && !HOP(defs, i)) {
            throw new DefaultsError("`" + i + "` is not a supported option", defs);
          }
        }
        for (const i in defs) if (HOP(defs, i)) {
          if (!args || !HOP(args, i)) {
            ret[i] = defs[i];
          } else if (i === "ecma") {
            let ecma = args[i] | 0;
            if (ecma > 5 && ecma < 2015) ecma += 2009;
            ret[i] = ecma;
          } else {
            ret[i] = args && HOP(args, i) ? args[i] : defs[i];
          }
        }
        return ret;
      }
      function noop3() {
      }
      function return_false() {
        return false;
      }
      function return_true() {
        return true;
      }
      function return_this() {
        return this;
      }
      function return_null() {
        return null;
      }
      var MAP = function() {
        function MAP2(a, tw, allow_splicing = true) {
          const new_a = [];
          for (let i = 0; i < a.length; ++i) {
            let item = a[i];
            let ret = item.transform(tw, allow_splicing);
            if (ret instanceof AST_Node) {
              new_a.push(ret);
            } else if (ret instanceof Splice) {
              new_a.push(...ret.v);
            }
          }
          return new_a;
        }
        MAP2.splice = function(val) {
          return new Splice(val);
        };
        MAP2.skip = {};
        function Splice(val) {
          this.v = val;
        }
        return MAP2;
      }();
      function make_node(ctor, orig, props) {
        if (!props) props = {};
        if (orig) {
          if (!props.start) props.start = orig.start;
          if (!props.end) props.end = orig.end;
        }
        return new ctor(props);
      }
      function push_uniq(array, el) {
        if (!array.includes(el))
          array.push(el);
      }
      function string_template(text3, props) {
        return text3.replace(/{(.+?)}/g, function(str, p) {
          return props && props[p];
        });
      }
      function remove(array, el) {
        for (var i = array.length; --i >= 0; ) {
          if (array[i] === el) array.splice(i, 1);
        }
      }
      function mergeSort(array, cmp) {
        if (array.length < 2) return array.slice();
        function merge2(a, b) {
          var r = [], ai = 0, bi = 0, i = 0;
          while (ai < a.length && bi < b.length) {
            cmp(a[ai], b[bi]) <= 0 ? r[i++] = a[ai++] : r[i++] = b[bi++];
          }
          if (ai < a.length) r.push.apply(r, a.slice(ai));
          if (bi < b.length) r.push.apply(r, b.slice(bi));
          return r;
        }
        function _ms(a) {
          if (a.length <= 1)
            return a;
          var m2 = Math.floor(a.length / 2), left = a.slice(0, m2), right = a.slice(m2);
          left = _ms(left);
          right = _ms(right);
          return merge2(left, right);
        }
        return _ms(array);
      }
      function makePredicate(words) {
        if (!Array.isArray(words)) words = words.split(" ");
        return new Set(words.sort());
      }
      function map_add(map2, key4, value2) {
        if (map2.has(key4)) {
          map2.get(key4).push(value2);
        } else {
          map2.set(key4, [value2]);
        }
      }
      function map_from_object(obj) {
        var map2 = /* @__PURE__ */ new Map();
        for (var key4 in obj) {
          if (HOP(obj, key4) && key4.charAt(0) === "$") {
            map2.set(key4.substr(1), obj[key4]);
          }
        }
        return map2;
      }
      function map_to_object(map2) {
        var obj = /* @__PURE__ */ Object.create(null);
        map2.forEach(function(value2, key4) {
          obj["$" + key4] = value2;
        });
        return obj;
      }
      function HOP(obj, prop2) {
        return Object.prototype.hasOwnProperty.call(obj, prop2);
      }
      function keep_name(keep_setting, name) {
        return keep_setting === true || keep_setting instanceof RegExp && keep_setting.test(name);
      }
      var lineTerminatorEscape = {
        "\0": "0",
        "\n": "n",
        "\r": "r",
        "\u2028": "u2028",
        "\u2029": "u2029"
      };
      function regexp_source_fix(source2) {
        return source2.replace(/[\0\n\r\u2028\u2029]/g, function(match3, offset) {
          var escaped = source2[offset - 1] == "\\" && (source2[offset - 2] != "\\" || /(?:^|[^\\])(?:\\{2})*$/.test(source2.slice(0, offset - 1)));
          return (escaped ? "" : "\\") + lineTerminatorEscape[match3];
        });
      }
      const re_safe_regexp = /^[\\/|\0\s\w^$.[\]()]*$/;
      const regexp_is_safe = (source2) => re_safe_regexp.test(source2);
      const all_flags = "dgimsuyv";
      function sort_regexp_flags(flags2) {
        const existing_flags = new Set(flags2.split(""));
        let out = "";
        for (const flag of all_flags) {
          if (existing_flags.has(flag)) {
            out += flag;
            existing_flags.delete(flag);
          }
        }
        if (existing_flags.size) {
          existing_flags.forEach((flag) => {
            out += flag;
          });
        }
        return out;
      }
      function has_annotation(node, annotation) {
        return node._annotations & annotation;
      }
      function set_annotation(node, annotation) {
        node._annotations |= annotation;
      }
      function clear_annotation(node, annotation) {
        node._annotations &= ~annotation;
      }
      var LATEST_RAW = "";
      var TEMPLATE_RAWS = /* @__PURE__ */ new Map();
      var KEYWORDS = "break case catch class const continue debugger default delete do else export extends finally for function if in instanceof let new return switch throw try typeof var void while with";
      var KEYWORDS_ATOM = "false null true";
      var RESERVED_WORDS = "enum import super this " + KEYWORDS_ATOM + " " + KEYWORDS;
      var ALL_RESERVED_WORDS = "implements interface package private protected public static " + RESERVED_WORDS;
      var KEYWORDS_BEFORE_EXPRESSION = "return new delete throw else case yield await";
      KEYWORDS = makePredicate(KEYWORDS);
      RESERVED_WORDS = makePredicate(RESERVED_WORDS);
      KEYWORDS_BEFORE_EXPRESSION = makePredicate(KEYWORDS_BEFORE_EXPRESSION);
      KEYWORDS_ATOM = makePredicate(KEYWORDS_ATOM);
      ALL_RESERVED_WORDS = makePredicate(ALL_RESERVED_WORDS);
      var OPERATOR_CHARS = makePredicate(characters("+-*&%=<>!?|~^"));
      var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;
      var RE_OCT_NUMBER = /^0[0-7]+$/;
      var RE_ES6_OCT_NUMBER = /^0o[0-7]+$/i;
      var RE_BIN_NUMBER = /^0b[01]+$/i;
      var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
      var RE_BIG_INT = /^(0[xob])?[0-9a-f]+n$/i;
      var RE_KEYWORD_RELATIONAL_OPERATORS = /in(?:stanceof)?/y;
      var OPERATORS = makePredicate([
        "in",
        "instanceof",
        "typeof",
        "new",
        "void",
        "delete",
        "++",
        "--",
        "+",
        "-",
        "!",
        "~",
        "&",
        "|",
        "^",
        "*",
        "**",
        "/",
        "%",
        ">>",
        "<<",
        ">>>",
        "<",
        ">",
        "<=",
        ">=",
        "==",
        "===",
        "!=",
        "!==",
        "?",
        "=",
        "+=",
        "-=",
        "||=",
        "&&=",
        "??=",
        "/=",
        "*=",
        "**=",
        "%=",
        ">>=",
        "<<=",
        ">>>=",
        "|=",
        "^=",
        "&=",
        "&&",
        "??",
        "||"
      ]);
      var WHITESPACE_CHARS = makePredicate(characters(" \xA0\n\r	\f\v\u200B\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF"));
      var NEWLINE_CHARS = makePredicate(characters("\n\r\u2028\u2029"));
      var PUNC_AFTER_EXPRESSION = makePredicate(characters(";]),:"));
      var PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,;:"));
      var PUNC_CHARS = makePredicate(characters("[]{}(),;:"));
      var UNICODE = {
        ID_Start: /[$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
        ID_Continue: /(?:[$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])+/
      };
      function get_full_char(str, pos2) {
        if (is_surrogate_pair_head(str.charCodeAt(pos2))) {
          if (is_surrogate_pair_tail(str.charCodeAt(pos2 + 1))) {
            return str.charAt(pos2) + str.charAt(pos2 + 1);
          }
        } else if (is_surrogate_pair_tail(str.charCodeAt(pos2))) {
          if (is_surrogate_pair_head(str.charCodeAt(pos2 - 1))) {
            return str.charAt(pos2 - 1) + str.charAt(pos2);
          }
        }
        return str.charAt(pos2);
      }
      function get_full_char_code(str, pos2) {
        if (is_surrogate_pair_head(str.charCodeAt(pos2))) {
          return 65536 + (str.charCodeAt(pos2) - 55296 << 10) + str.charCodeAt(pos2 + 1) - 56320;
        }
        return str.charCodeAt(pos2);
      }
      function get_full_char_length(str) {
        var surrogates = 0;
        for (var i = 0; i < str.length; i++) {
          if (is_surrogate_pair_head(str.charCodeAt(i)) && is_surrogate_pair_tail(str.charCodeAt(i + 1))) {
            surrogates++;
            i++;
          }
        }
        return str.length - surrogates;
      }
      function from_char_code(code) {
        if (code > 65535) {
          code -= 65536;
          return String.fromCharCode((code >> 10) + 55296) + String.fromCharCode(code % 1024 + 56320);
        }
        return String.fromCharCode(code);
      }
      function is_surrogate_pair_head(code) {
        return code >= 55296 && code <= 56319;
      }
      function is_surrogate_pair_tail(code) {
        return code >= 56320 && code <= 57343;
      }
      function is_digit(code) {
        return code >= 48 && code <= 57;
      }
      function is_identifier_start(ch3) {
        return UNICODE.ID_Start.test(ch3);
      }
      function is_identifier_char(ch3) {
        return UNICODE.ID_Continue.test(ch3);
      }
      const BASIC_IDENT = /^[a-z_$][a-z0-9_$]*$/i;
      function is_basic_identifier_string(str) {
        return BASIC_IDENT.test(str);
      }
      function is_identifier_string(str, allow_surrogates) {
        if (BASIC_IDENT.test(str)) {
          return true;
        }
        if (!allow_surrogates && /[\ud800-\udfff]/.test(str)) {
          return false;
        }
        var match3 = UNICODE.ID_Start.exec(str);
        if (!match3 || match3.index !== 0) {
          return false;
        }
        str = str.slice(match3[0].length);
        if (!str) {
          return true;
        }
        match3 = UNICODE.ID_Continue.exec(str);
        return !!match3 && match3[0].length === str.length;
      }
      function parse_js_number(num, allow_e = true) {
        if (!allow_e && num.includes("e")) {
          return NaN;
        }
        if (RE_HEX_NUMBER.test(num)) {
          return parseInt(num.substr(2), 16);
        } else if (RE_OCT_NUMBER.test(num)) {
          return parseInt(num.substr(1), 8);
        } else if (RE_ES6_OCT_NUMBER.test(num)) {
          return parseInt(num.substr(2), 8);
        } else if (RE_BIN_NUMBER.test(num)) {
          return parseInt(num.substr(2), 2);
        } else if (RE_DEC_NUMBER.test(num)) {
          return parseFloat(num);
        } else {
          var val = parseFloat(num);
          if (val == num) return val;
        }
      }
      class JS_Parse_Error extends Error {
        constructor(message, filename, line, col, pos2) {
          super();
          this.name = "SyntaxError";
          this.message = message;
          this.filename = filename;
          this.line = line;
          this.col = col;
          this.pos = pos2;
        }
      }
      function js_error(message, filename, line, col, pos2) {
        throw new JS_Parse_Error(message, filename, line, col, pos2);
      }
      function is_token(token, type, val) {
        return token.type == type && (val == null || token.value == val);
      }
      var EX_EOF = {};
      function tokenizer($TEXT, filename, html5_comments, shebang) {
        var S = {
          text: $TEXT,
          filename,
          pos: 0,
          tokpos: 0,
          line: 1,
          tokline: 0,
          col: 0,
          tokcol: 0,
          newline_before: false,
          regex_allowed: false,
          brace_counter: 0,
          template_braces: [],
          comments_before: [],
          directives: {},
          directive_stack: []
        };
        function peek() {
          return get_full_char(S.text, S.pos);
        }
        function is_option_chain_op() {
          const must_be_dot = S.text.charCodeAt(S.pos + 1) === 46;
          if (!must_be_dot) return false;
          const cannot_be_digit = S.text.charCodeAt(S.pos + 2);
          return cannot_be_digit < 48 || cannot_be_digit > 57;
        }
        function next2(signal_eof, in_string) {
          var ch3 = get_full_char(S.text, S.pos++);
          if (signal_eof && !ch3)
            throw EX_EOF;
          if (NEWLINE_CHARS.has(ch3)) {
            S.newline_before = S.newline_before || !in_string;
            ++S.line;
            S.col = 0;
            if (ch3 == "\r" && peek() == "\n") {
              ++S.pos;
              ch3 = "\n";
            }
          } else {
            if (ch3.length > 1) {
              ++S.pos;
              ++S.col;
            }
            ++S.col;
          }
          return ch3;
        }
        function forward(i) {
          while (i--) next2();
        }
        function looking_at(str) {
          return S.text.substr(S.pos, str.length) == str;
        }
        function find_eol() {
          var text3 = S.text;
          for (var i = S.pos, n3 = S.text.length; i < n3; ++i) {
            var ch3 = text3[i];
            if (NEWLINE_CHARS.has(ch3))
              return i;
          }
          return -1;
        }
        function find2(what, signal_eof) {
          var pos2 = S.text.indexOf(what, S.pos);
          if (signal_eof && pos2 == -1) throw EX_EOF;
          return pos2;
        }
        function start_token() {
          S.tokline = S.line;
          S.tokcol = S.col;
          S.tokpos = S.pos;
        }
        var prev_was_dot = false;
        var previous_token = null;
        function token(type, value2, is_comment) {
          S.regex_allowed = type == "operator" && !UNARY_POSTFIX.has(value2) || type == "keyword" && KEYWORDS_BEFORE_EXPRESSION.has(value2) || type == "punc" && PUNC_BEFORE_EXPRESSION.has(value2) || type == "arrow";
          if (type == "punc" && (value2 == "." || value2 == "?.")) {
            prev_was_dot = true;
          } else if (!is_comment) {
            prev_was_dot = false;
          }
          const line = S.tokline;
          const col = S.tokcol;
          const pos2 = S.tokpos;
          const nlb = S.newline_before;
          const file = filename;
          let comments_before = [];
          let comments_after = [];
          if (!is_comment) {
            comments_before = S.comments_before;
            comments_after = S.comments_before = [];
          }
          S.newline_before = false;
          const tok = new AST_Token(type, value2, line, col, pos2, nlb, comments_before, comments_after, file);
          if (!is_comment) previous_token = tok;
          return tok;
        }
        function skip_whitespace() {
          while (WHITESPACE_CHARS.has(peek()))
            next2();
        }
        function peek_next_token_start_or_newline() {
          var pos2 = S.pos;
          for (var in_multiline_comment = false; pos2 < S.text.length; ) {
            var ch3 = get_full_char(S.text, pos2);
            if (NEWLINE_CHARS.has(ch3)) {
              return { char: ch3, pos: pos2 };
            } else if (in_multiline_comment) {
              if (ch3 == "*" && get_full_char(S.text, pos2 + 1) == "/") {
                pos2 += 2;
                in_multiline_comment = false;
              } else {
                pos2++;
              }
            } else if (!WHITESPACE_CHARS.has(ch3)) {
              if (ch3 == "/") {
                var next_ch = get_full_char(S.text, pos2 + 1);
                if (next_ch == "/") {
                  pos2 = find_eol();
                  return { char: get_full_char(S.text, pos2), pos: pos2 };
                } else if (next_ch == "*") {
                  in_multiline_comment = true;
                  pos2 += 2;
                  continue;
                }
              }
              return { char: ch3, pos: pos2 };
            } else {
              pos2++;
            }
          }
          return { char: null, pos: pos2 };
        }
        function ch_starts_binding_identifier(ch3, pos2) {
          if (ch3 == "\\") {
            return true;
          } else if (is_identifier_start(ch3)) {
            RE_KEYWORD_RELATIONAL_OPERATORS.lastIndex = pos2;
            if (RE_KEYWORD_RELATIONAL_OPERATORS.test(S.text)) {
              var after = get_full_char(S.text, RE_KEYWORD_RELATIONAL_OPERATORS.lastIndex);
              if (!is_identifier_char(after) && after != "\\") {
                return false;
              }
            }
            return true;
          }
          return false;
        }
        function read_while(pred) {
          var ret = "", ch3, i = 0;
          while ((ch3 = peek()) && pred(ch3, i++))
            ret += next2();
          return ret;
        }
        function parse_error(err2) {
          js_error(err2, filename, S.tokline, S.tokcol, S.tokpos);
        }
        function read_num(prefix) {
          var has_e = false, after_e = false, has_x = false, has_dot = prefix == ".", is_big_int = false, numeric_separator = false;
          var num = read_while(function(ch3, i) {
            if (is_big_int) return false;
            var code = ch3.charCodeAt(0);
            switch (code) {
              case 95:
                return numeric_separator = true;
              case 98:
              case 66:
                return has_x = true;
              // Can occur in hex sequence, don't return false yet
              case 111:
              case 79:
              // oO
              case 120:
              case 88:
                return has_x ? false : has_x = true;
              case 101:
              case 69:
                return has_x ? true : has_e ? false : has_e = after_e = true;
              case 45:
                return after_e || i == 0 && !prefix;
              case 43:
                return after_e;
              case (after_e = false, 46):
                return !has_dot && !has_x && !has_e ? has_dot = true : false;
              case 110:
                is_big_int = true;
                return true;
            }
            return code >= 48 && code <= 57 || code >= 97 && code <= 102 || code >= 65 && code <= 70;
          });
          if (prefix) num = prefix + num;
          LATEST_RAW = num;
          if (RE_OCT_NUMBER.test(num) && next_token.has_directive("use strict")) {
            parse_error("Legacy octal literals are not allowed in strict mode");
          }
          if (numeric_separator) {
            if (num.endsWith("_")) {
              parse_error("Numeric separators are not allowed at the end of numeric literals");
            } else if (num.includes("__")) {
              parse_error("Only one underscore is allowed as numeric separator");
            }
            num = num.replace(/_/g, "");
          }
          if (is_big_int) {
            const without_n = num.slice(0, -1);
            const allow_e = RE_HEX_NUMBER.test(without_n);
            const valid2 = parse_js_number(without_n, allow_e);
            if (!has_dot && RE_BIG_INT.test(num) && !isNaN(valid2))
              return token("big_int", without_n);
            parse_error("Invalid or unexpected token");
          }
          var valid = parse_js_number(num);
          if (!isNaN(valid)) {
            return token("num", valid);
          } else {
            parse_error("Invalid syntax: " + num);
          }
        }
        function is_octal(ch3) {
          return ch3 >= "0" && ch3 <= "7";
        }
        function read_escaped_char(in_string, strict_hex, template_string) {
          var ch3 = next2(true, in_string);
          switch (ch3.charCodeAt(0)) {
            case 110:
              return "\n";
            case 114:
              return "\r";
            case 116:
              return "	";
            case 98:
              return "\b";
            case 118:
              return "\v";
            // \v
            case 102:
              return "\f";
            case 120:
              return String.fromCharCode(hex_bytes(2, strict_hex));
            // \x
            case 117:
              if (peek() == "{") {
                next2(true);
                if (peek() === "}")
                  parse_error("Expecting hex-character between {}");
                while (peek() == "0") next2(true);
                var result, length = find2("}", true) - S.pos;
                if (length > 6 || (result = hex_bytes(length, strict_hex)) > 1114111) {
                  parse_error("Unicode reference out of bounds");
                }
                next2(true);
                return from_char_code(result);
              }
              return String.fromCharCode(hex_bytes(4, strict_hex));
            case 10:
              return "";
            // newline
            case 13:
              if (peek() == "\n") {
                next2(true, in_string);
                return "";
              }
          }
          if (is_octal(ch3)) {
            if (template_string && strict_hex) {
              const represents_null_character = ch3 === "0" && !is_octal(peek());
              if (!represents_null_character) {
                parse_error("Octal escape sequences are not allowed in template strings");
              }
            }
            return read_octal_escape_sequence(ch3, strict_hex);
          }
          return ch3;
        }
        function read_octal_escape_sequence(ch3, strict_octal) {
          var p = peek();
          if (p >= "0" && p <= "7") {
            ch3 += next2(true);
            if (ch3[0] <= "3" && (p = peek()) >= "0" && p <= "7")
              ch3 += next2(true);
          }
          if (ch3 === "0") return "\0";
          if (ch3.length > 0 && next_token.has_directive("use strict") && strict_octal)
            parse_error("Legacy octal escape sequences are not allowed in strict mode");
          return String.fromCharCode(parseInt(ch3, 8));
        }
        function hex_bytes(n3, strict_hex) {
          var num = 0;
          for (; n3 > 0; --n3) {
            if (!strict_hex && isNaN(parseInt(peek(), 16))) {
              return parseInt(num, 16) || "";
            }
            var digit = next2(true);
            if (isNaN(parseInt(digit, 16)))
              parse_error("Invalid hex-character pattern in string");
            num += digit;
          }
          return parseInt(num, 16);
        }
        var read_string = with_eof_error("Unterminated string constant", function() {
          const start_pos = S.pos;
          var quote = next2(), ret = [];
          for (; ; ) {
            var ch3 = next2(true, true);
            if (ch3 == "\\") ch3 = read_escaped_char(true, true);
            else if (ch3 == "\r" || ch3 == "\n") parse_error("Unterminated string constant");
            else if (ch3 == quote) break;
            ret.push(ch3);
          }
          var tok = token("string", ret.join(""));
          LATEST_RAW = S.text.slice(start_pos, S.pos);
          tok.quote = quote;
          return tok;
        });
        var read_template_characters = with_eof_error("Unterminated template", function(begin) {
          if (begin) {
            S.template_braces.push(S.brace_counter);
          }
          var content = "", raw = "", ch3, tok;
          next2(true, true);
          while ((ch3 = next2(true, true)) != "`") {
            if (ch3 == "\r") {
              if (peek() == "\n") ++S.pos;
              ch3 = "\n";
            } else if (ch3 == "$" && peek() == "{") {
              next2(true, true);
              S.brace_counter++;
              tok = token(begin ? "template_head" : "template_cont", content);
              TEMPLATE_RAWS.set(tok, raw);
              tok.template_end = false;
              return tok;
            }
            raw += ch3;
            if (ch3 == "\\") {
              var tmp = S.pos;
              var prev_is_tag = previous_token && (previous_token.type === "name" || previous_token.type === "punc" && (previous_token.value === ")" || previous_token.value === "]"));
              ch3 = read_escaped_char(true, !prev_is_tag, true);
              raw += S.text.substr(tmp, S.pos - tmp);
            }
            content += ch3;
          }
          S.template_braces.pop();
          tok = token(begin ? "template_head" : "template_cont", content);
          TEMPLATE_RAWS.set(tok, raw);
          tok.template_end = true;
          return tok;
        });
        function skip_line_comment(type) {
          var regex_allowed = S.regex_allowed;
          var i = find_eol(), ret;
          if (i == -1) {
            ret = S.text.substr(S.pos);
            S.pos = S.text.length;
          } else {
            ret = S.text.substring(S.pos, i);
            S.pos = i;
          }
          S.col = S.tokcol + (S.pos - S.tokpos);
          S.comments_before.push(token(type, ret, true));
          S.regex_allowed = regex_allowed;
          return next_token;
        }
        var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function() {
          var regex_allowed = S.regex_allowed;
          var i = find2("*/", true);
          var text3 = S.text.substring(S.pos, i).replace(/\r\n|\r|\u2028|\u2029/g, "\n");
          forward(get_full_char_length(text3) + 2);
          S.comments_before.push(token("comment2", text3, true));
          S.newline_before = S.newline_before || text3.includes("\n");
          S.regex_allowed = regex_allowed;
          return next_token;
        });
        var read_name = function() {
          let start = S.pos, end = start - 1, ch3 = "c";
          while ((ch3 = S.text.charAt(++end)) && (ch3 >= "a" && ch3 <= "z" || ch3 >= "A" && ch3 <= "Z")) ;
          if (end > start + 1 && ch3 && ch3 !== "\\" && !is_identifier_char(ch3) && ch3 <= "~") {
            S.pos += end - start;
            S.col += end - start;
            return S.text.slice(start, S.pos);
          }
          return read_name_hard();
        };
        var read_name_hard = with_eof_error("Unterminated identifier name", function() {
          var name = [], ch3, escaped = false;
          var read_escaped_identifier_char = function() {
            escaped = true;
            next2();
            if (peek() !== "u") {
              parse_error("Expecting UnicodeEscapeSequence -- uXXXX or u{XXXX}");
            }
            return read_escaped_char(false, true);
          };
          if ((ch3 = peek()) === "\\") {
            ch3 = read_escaped_identifier_char();
            if (!is_identifier_start(ch3)) {
              parse_error("First identifier char is an invalid identifier char");
            }
          } else if (is_identifier_start(ch3)) {
            next2();
          } else {
            return "";
          }
          name.push(ch3);
          while ((ch3 = peek()) != null) {
            if ((ch3 = peek()) === "\\") {
              ch3 = read_escaped_identifier_char();
              if (!is_identifier_char(ch3)) {
                parse_error("Invalid escaped identifier char");
              }
            } else {
              if (!is_identifier_char(ch3)) {
                break;
              }
              next2();
            }
            name.push(ch3);
          }
          const name_str = name.join("");
          if (RESERVED_WORDS.has(name_str) && escaped) {
            parse_error("Escaped characters are not allowed in keywords");
          }
          return name_str;
        });
        var read_regexp = with_eof_error("Unterminated regular expression", function(source2) {
          var prev_backslash = false, ch3, in_class = false;
          while (ch3 = next2(true)) if (NEWLINE_CHARS.has(ch3)) {
            parse_error("Unexpected line terminator");
          } else if (prev_backslash) {
            if (/^[\u0000-\u007F]$/.test(ch3)) {
              source2 += "\\" + ch3;
            } else {
              source2 += ch3;
            }
            prev_backslash = false;
          } else if (ch3 == "[") {
            in_class = true;
            source2 += ch3;
          } else if (ch3 == "]" && in_class) {
            in_class = false;
            source2 += ch3;
          } else if (ch3 == "/" && !in_class) {
            break;
          } else if (ch3 == "\\") {
            prev_backslash = true;
          } else {
            source2 += ch3;
          }
          const flags2 = read_name();
          return token("regexp", "/" + source2 + "/" + flags2);
        });
        function read_operator(prefix) {
          function grow(op) {
            if (!peek()) return op;
            var bigger = op + peek();
            if (OPERATORS.has(bigger)) {
              next2();
              return grow(bigger);
            } else {
              return op;
            }
          }
          return token("operator", grow(prefix || next2()));
        }
        function handle_slash() {
          next2();
          switch (peek()) {
            case "/":
              next2();
              return skip_line_comment("comment1");
            case "*":
              next2();
              return skip_multiline_comment();
          }
          return S.regex_allowed ? read_regexp("") : read_operator("/");
        }
        function handle_eq_sign() {
          next2();
          if (peek() === ">") {
            next2();
            return token("arrow", "=>");
          } else {
            return read_operator("=");
          }
        }
        function handle_dot() {
          next2();
          if (is_digit(peek().charCodeAt(0))) {
            return read_num(".");
          }
          if (peek() === ".") {
            next2();
            next2();
            return token("expand", "...");
          }
          return token("punc", ".");
        }
        function read_word() {
          var word = read_name();
          if (prev_was_dot) return token("name", word);
          return KEYWORDS_ATOM.has(word) ? token("atom", word) : !KEYWORDS.has(word) ? token("name", word) : OPERATORS.has(word) ? token("operator", word) : token("keyword", word);
        }
        function read_private_word() {
          next2();
          return token("privatename", read_name());
        }
        function with_eof_error(eof_error, cont) {
          return function(x) {
            try {
              return cont(x);
            } catch (ex) {
              if (ex === EX_EOF) parse_error(eof_error);
              else throw ex;
            }
          };
        }
        function next_token(force_regexp) {
          if (force_regexp != null)
            return read_regexp(force_regexp);
          if (shebang && S.pos == 0 && looking_at("#!")) {
            start_token();
            forward(2);
            skip_line_comment("comment5");
          }
          for (; ; ) {
            skip_whitespace();
            start_token();
            if (html5_comments) {
              if (looking_at("<!--")) {
                forward(4);
                skip_line_comment("comment3");
                continue;
              }
              if (looking_at("-->") && S.newline_before) {
                forward(3);
                skip_line_comment("comment4");
                continue;
              }
            }
            var ch3 = peek();
            if (!ch3) return token("eof");
            var code = ch3.charCodeAt(0);
            switch (code) {
              case 34:
              case 39:
                return read_string();
              case 46:
                return handle_dot();
              case 47: {
                var tok = handle_slash();
                if (tok === next_token) continue;
                return tok;
              }
              case 61:
                return handle_eq_sign();
              case 63: {
                if (!is_option_chain_op()) break;
                next2();
                next2();
                return token("punc", "?.");
              }
              case 96:
                return read_template_characters(true);
              case 123:
                S.brace_counter++;
                break;
              case 125:
                S.brace_counter--;
                if (S.template_braces.length > 0 && S.template_braces[S.template_braces.length - 1] === S.brace_counter)
                  return read_template_characters(false);
                break;
            }
            if (is_digit(code)) return read_num();
            if (PUNC_CHARS.has(ch3)) return token("punc", next2());
            if (OPERATOR_CHARS.has(ch3)) return read_operator();
            if (code == 92 || is_identifier_start(ch3)) return read_word();
            if (code == 35) return read_private_word();
            break;
          }
          parse_error("Unexpected character '" + ch3 + "'");
        }
        next_token.next = next2;
        next_token.peek = peek;
        next_token.context = function(nc) {
          if (nc) S = nc;
          return S;
        };
        next_token.add_directive = function(directive) {
          S.directive_stack[S.directive_stack.length - 1].push(directive);
          if (S.directives[directive] === void 0) {
            S.directives[directive] = 1;
          } else {
            S.directives[directive]++;
          }
        };
        next_token.push_directives_stack = function() {
          S.directive_stack.push([]);
        };
        next_token.pop_directives_stack = function() {
          var directives2 = S.directive_stack[S.directive_stack.length - 1];
          for (var i = 0; i < directives2.length; i++) {
            S.directives[directives2[i]]--;
          }
          S.directive_stack.pop();
        };
        next_token.has_directive = function(directive) {
          return S.directives[directive] > 0;
        };
        next_token.peek_next_token_start_or_newline = peek_next_token_start_or_newline;
        next_token.ch_starts_binding_identifier = ch_starts_binding_identifier;
        return next_token;
      }
      var UNARY_PREFIX = makePredicate([
        "typeof",
        "void",
        "delete",
        "--",
        "++",
        "!",
        "~",
        "-",
        "+"
      ]);
      var UNARY_POSTFIX = makePredicate(["--", "++"]);
      var ASSIGNMENT = makePredicate(["=", "+=", "-=", "??=", "&&=", "||=", "/=", "*=", "**=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&="]);
      var LOGICAL_ASSIGNMENT = makePredicate(["??=", "&&=", "||="]);
      var PRECEDENCE = function(a, ret) {
        for (var i = 0; i < a.length; ++i) {
          for (const op of a[i]) {
            ret[op] = i + 1;
          }
        }
        return ret;
      }(
        [
          ["||"],
          ["??"],
          ["&&"],
          ["|"],
          ["^"],
          ["&"],
          ["==", "===", "!=", "!=="],
          ["<", ">", "<=", ">=", "in", "instanceof"],
          [">>", "<<", ">>>"],
          ["+", "-"],
          ["*", "/", "%"],
          ["**"]
        ],
        {}
      );
      var ATOMIC_START_TOKEN = makePredicate(["atom", "num", "big_int", "string", "regexp", "name"]);
      function parse2($TEXT, options) {
        const outer_comments_before_counts = /* @__PURE__ */ new WeakMap();
        options = defaults2(options, {
          bare_returns: false,
          ecma: null,
          // Legacy
          expression: false,
          filename: null,
          html5_comments: true,
          module: false,
          shebang: true,
          strict: false,
          toplevel: null
        }, true);
        var S = {
          input: typeof $TEXT == "string" ? tokenizer(
            $TEXT,
            options.filename,
            options.html5_comments,
            options.shebang
          ) : $TEXT,
          token: null,
          prev: null,
          peeked: null,
          in_function: 0,
          in_async: -1,
          in_generator: -1,
          in_directives: true,
          in_loop: 0,
          labels: []
        };
        S.token = next2();
        function is2(type, value2) {
          return is_token(S.token, type, value2);
        }
        function peek() {
          return S.peeked || (S.peeked = S.input());
        }
        function next2() {
          S.prev = S.token;
          if (!S.peeked) peek();
          S.token = S.peeked;
          S.peeked = null;
          S.in_directives = S.in_directives && (S.token.type == "string" || is2("punc", ";"));
          return S.token;
        }
        function prev() {
          return S.prev;
        }
        function croak(msg, line, col, pos2) {
          var ctx = S.input.context();
          js_error(
            msg,
            ctx.filename,
            line != null ? line : ctx.tokline,
            col != null ? col : ctx.tokcol,
            pos2 != null ? pos2 : ctx.tokpos
          );
        }
        function token_error(token, msg) {
          croak(msg, token.line, token.col);
        }
        function unexpected(token) {
          if (token == null)
            token = S.token;
          token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")");
        }
        function expect_token(type, val) {
          if (is2(type, val)) {
            return next2();
          }
          token_error(S.token, "Unexpected token " + S.token.type + " \xAB" + S.token.value + "\xBB, expected " + type + " \xAB" + val + "\xBB");
        }
        function expect(punc) {
          return expect_token("punc", punc);
        }
        function has_newline_before(token) {
          return token.nlb || !token.comments_before.every((comment2) => !comment2.nlb);
        }
        function can_insert_semicolon() {
          return !options.strict && (is2("eof") || is2("punc", "}") || has_newline_before(S.token));
        }
        function is_in_generator() {
          return S.in_generator === S.in_function;
        }
        function is_in_async() {
          return S.in_async === S.in_function;
        }
        function can_await() {
          return S.in_async === S.in_function || S.in_function === 0 && S.input.has_directive("use strict");
        }
        function semicolon(optional) {
          if (is2("punc", ";")) next2();
          else if (!optional && !can_insert_semicolon()) unexpected();
        }
        function parenthesised() {
          expect("(");
          var exp = expression(true);
          expect(")");
          return exp;
        }
        function embed_tokens(parser2) {
          return function _embed_tokens_wrapper(...args) {
            const start = S.token;
            const expr = parser2(...args);
            expr.start = start;
            expr.end = prev();
            return expr;
          };
        }
        function handle_regexp() {
          if (is2("operator", "/") || is2("operator", "/=")) {
            S.peeked = null;
            S.token = S.input(S.token.value.substr(1));
          }
        }
        var statement = embed_tokens(function statement2(is_export_default, is_for_body, is_if_body) {
          handle_regexp();
          switch (S.token.type) {
            case "string":
              if (S.in_directives) {
                var token = peek();
                if (!LATEST_RAW.includes("\\") && (is_token(token, "punc", ";") || is_token(token, "punc", "}") || has_newline_before(token) || is_token(token, "eof"))) {
                  S.input.add_directive(S.token.value);
                } else {
                  S.in_directives = false;
                }
              }
              var dir = S.in_directives, stat = simple_statement();
              return dir && stat.body instanceof AST_String ? new AST_Directive(stat.body) : stat;
            case "template_head":
            case "num":
            case "big_int":
            case "regexp":
            case "operator":
            case "atom":
              return simple_statement();
            case "name":
              if (S.token.value == "async" && is_token(peek(), "keyword", "function")) {
                next2();
                next2();
                if (is_for_body) {
                  croak("functions are not allowed as the body of a loop");
                }
                return function_(AST_Defun, false, true, is_export_default);
              }
              if (S.token.value == "import" && !is_token(peek(), "punc", "(") && !is_token(peek(), "punc", ".")) {
                next2();
                var node = import_statement();
                semicolon();
                return node;
              }
              if (S.token.value == "using" && is_token(peek(), "name") && !has_newline_before(peek())) {
                next2();
                var node = using_();
                semicolon();
                return node;
              }
              if (S.token.value == "await" && can_await() && is_token(peek(), "name", "using") && !has_newline_before(peek())) {
                var next_next = S.input.peek_next_token_start_or_newline();
                if (S.input.ch_starts_binding_identifier(next_next.char, next_next.pos)) {
                  next2();
                  var node = await_using_();
                  semicolon();
                  return node;
                }
              }
              return is_token(peek(), "punc", ":") ? labeled_statement() : simple_statement();
            case "privatename":
              if (!S.in_class)
                croak("Private field must be used in an enclosing class");
              return simple_statement();
            case "punc":
              switch (S.token.value) {
                case "{":
                  return new AST_BlockStatement({
                    start: S.token,
                    body: block_(),
                    end: prev()
                  });
                case "[":
                case "(":
                  return simple_statement();
                case ";":
                  S.in_directives = false;
                  next2();
                  return new AST_EmptyStatement();
                default:
                  unexpected();
              }
            case "keyword":
              switch (S.token.value) {
                case "break":
                  next2();
                  return break_cont(AST_Break);
                case "continue":
                  next2();
                  return break_cont(AST_Continue);
                case "debugger":
                  next2();
                  semicolon();
                  return new AST_Debugger();
                case "do":
                  next2();
                  var body = in_loop(statement2);
                  expect_token("keyword", "while");
                  var condition = parenthesised();
                  semicolon(true);
                  return new AST_Do({
                    body,
                    condition
                  });
                case "while":
                  next2();
                  return new AST_While({
                    condition: parenthesised(),
                    body: in_loop(function() {
                      return statement2(false, true);
                    })
                  });
                case "for":
                  next2();
                  return for_();
                case "class":
                  next2();
                  if (is_for_body) {
                    croak("classes are not allowed as the body of a loop");
                  }
                  if (is_if_body) {
                    croak("classes are not allowed as the body of an if");
                  }
                  return class_(AST_DefClass, is_export_default);
                case "function":
                  next2();
                  if (is_for_body) {
                    croak("functions are not allowed as the body of a loop");
                  }
                  return function_(AST_Defun, false, false, is_export_default);
                case "if":
                  next2();
                  return if_();
                case "return":
                  if (S.in_function == 0 && !options.bare_returns)
                    croak("'return' outside of function");
                  next2();
                  var value2 = null;
                  if (is2("punc", ";")) {
                    next2();
                  } else if (!can_insert_semicolon()) {
                    value2 = expression(true);
                    semicolon();
                  }
                  return new AST_Return({
                    value: value2
                  });
                case "switch":
                  next2();
                  return new AST_Switch({
                    expression: parenthesised(),
                    body: in_loop(switch_body_)
                  });
                case "throw":
                  next2();
                  if (has_newline_before(S.token))
                    croak("Illegal newline after 'throw'");
                  var value2 = expression(true);
                  semicolon();
                  return new AST_Throw({
                    value: value2
                  });
                case "try":
                  next2();
                  return try_();
                case "var":
                  next2();
                  var node = var_();
                  semicolon();
                  return node;
                case "let":
                  next2();
                  var node = let_();
                  semicolon();
                  return node;
                case "const":
                  next2();
                  var node = const_();
                  semicolon();
                  return node;
                case "with":
                  if (S.input.has_directive("use strict")) {
                    croak("Strict mode may not include a with statement");
                  }
                  next2();
                  return new AST_With({
                    expression: parenthesised(),
                    body: statement2()
                  });
                case "export":
                  if (!is_token(peek(), "punc", "(")) {
                    next2();
                    var node = export_statement();
                    if (is2("punc", ";")) semicolon();
                    return node;
                  }
              }
          }
          unexpected();
        });
        function labeled_statement() {
          var label = as_symbol(AST_Label);
          if (label.name === "await" && is_in_async()) {
            token_error(S.prev, "await cannot be used as label inside async function");
          }
          if (S.labels.some((l) => l.name === label.name)) {
            croak("Label " + label.name + " defined twice");
          }
          expect(":");
          S.labels.push(label);
          var stat = statement();
          S.labels.pop();
          if (!(stat instanceof AST_IterationStatement)) {
            label.references.forEach(function(ref) {
              if (ref instanceof AST_Continue) {
                ref = ref.label.start;
                croak(
                  "Continue label `" + label.name + "` refers to non-IterationStatement.",
                  ref.line,
                  ref.col,
                  ref.pos
                );
              }
            });
          }
          return new AST_LabeledStatement({ body: stat, label });
        }
        function simple_statement(tmp) {
          return new AST_SimpleStatement({ body: (tmp = expression(true), semicolon(), tmp) });
        }
        function break_cont(type) {
          var label = null, ldef;
          if (!can_insert_semicolon()) {
            label = as_symbol(AST_LabelRef, true);
          }
          if (label != null) {
            ldef = S.labels.find((l) => l.name === label.name);
            if (!ldef)
              croak("Undefined label " + label.name);
            label.thedef = ldef;
          } else if (S.in_loop == 0)
            croak(type.TYPE + " not inside a loop or switch");
          semicolon();
          var stat = new type({ label });
          if (ldef) ldef.references.push(stat);
          return stat;
        }
        function for_() {
          var for_await_error = "`for await` invalid in this context";
          var await_tok = S.token;
          if (await_tok.type == "name" && await_tok.value == "await") {
            if (!can_await()) {
              token_error(await_tok, for_await_error);
            }
            next2();
          } else {
            await_tok = false;
          }
          expect("(");
          var init3 = null;
          if (!is2("punc", ";")) {
            init3 = is2("keyword", "var") ? (next2(), var_(true)) : is2("keyword", "let") ? (next2(), let_(true)) : is2("keyword", "const") ? (next2(), const_(true)) : is2("name", "using") && is_token(peek(), "name") && (peek().value != "of" || S.input.peek_next_token_start_or_newline().char == "=") ? (next2(), using_(true)) : is2("name", "await") && can_await() && is_token(peek(), "name", "using") ? (next2(), await_using_(true)) : expression(true, true);
            var is_in = is2("operator", "in");
            var is_of = is2("name", "of");
            if (await_tok && !is_of) {
              token_error(await_tok, for_await_error);
            }
            if (is_in || is_of) {
              if (init3 instanceof AST_DefinitionsLike) {
                if (init3.definitions.length > 1)
                  token_error(init3.start, "Only one variable declaration allowed in for..in loop");
                if (is_in && init3 instanceof AST_Using) {
                  token_error(init3.start, "Invalid using declaration in for..in loop");
                }
              } else if (!(is_assignable(init3) || (init3 = to_destructuring(init3)) instanceof AST_Destructuring)) {
                token_error(init3.start, "Invalid left-hand side in for..in loop");
              }
              next2();
              if (is_in) {
                return for_in(init3);
              } else {
                return for_of(init3, !!await_tok);
              }
            }
          } else if (await_tok) {
            token_error(await_tok, for_await_error);
          }
          return regular_for(init3);
        }
        function regular_for(init3) {
          expect(";");
          var test = is2("punc", ";") ? null : expression(true);
          expect(";");
          var step = is2("punc", ")") ? null : expression(true);
          expect(")");
          return new AST_For({
            init: init3,
            condition: test,
            step,
            body: in_loop(function() {
              return statement(false, true);
            })
          });
        }
        function for_of(init3, is_await) {
          var lhs = init3 instanceof AST_DefinitionsLike ? init3.definitions[0].name : null;
          var obj = expression(true);
          expect(")");
          return new AST_ForOf({
            await: is_await,
            init: init3,
            name: lhs,
            object: obj,
            body: in_loop(function() {
              return statement(false, true);
            })
          });
        }
        function for_in(init3) {
          var obj = expression(true);
          expect(")");
          return new AST_ForIn({
            init: init3,
            object: obj,
            body: in_loop(function() {
              return statement(false, true);
            })
          });
        }
        var arrow_function = function(start, argnames, is_async) {
          if (has_newline_before(S.token)) {
            croak("Unexpected newline before arrow (=>)");
          }
          expect_token("arrow", "=>");
          var body = _function_body(is2("punc", "{"), false, is_async);
          return new AST_Arrow({
            start,
            end: body.end,
            async: is_async,
            argnames,
            body
          });
        };
        var function_ = function(ctor, is_generator, is_async, is_export_default) {
          var in_statement = ctor === AST_Defun;
          if (is2("operator", "*")) {
            is_generator = true;
            next2();
          }
          var name = is2("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null;
          if (in_statement && !name) {
            if (is_export_default) {
              ctor = AST_Function;
            } else {
              unexpected();
            }
          }
          if (name && ctor !== AST_Accessor && !(name instanceof AST_SymbolDeclaration))
            unexpected(prev());
          var args = [];
          var body = _function_body(true, is_generator, is_async, name, args);
          return new ctor({
            start: args.start,
            end: body.end,
            is_generator,
            async: is_async,
            name,
            argnames: args,
            body
          });
        };
        class UsedParametersTracker {
          constructor(is_parameter, strict, duplicates_ok = false) {
            this.is_parameter = is_parameter;
            this.duplicates_ok = duplicates_ok;
            this.parameters = /* @__PURE__ */ new Set();
            this.duplicate = null;
            this.default_assignment = false;
            this.spread = false;
            this.strict_mode = !!strict;
          }
          add_parameter(token) {
            if (this.parameters.has(token.value)) {
              if (this.duplicate === null) {
                this.duplicate = token;
              }
              this.check_strict();
            } else {
              this.parameters.add(token.value);
              if (this.is_parameter) {
                switch (token.value) {
                  case "arguments":
                  case "eval":
                  case "yield":
                    if (this.strict_mode) {
                      token_error(token, "Unexpected " + token.value + " identifier as parameter inside strict mode");
                    }
                    break;
                  default:
                    if (RESERVED_WORDS.has(token.value)) {
                      unexpected();
                    }
                }
              }
            }
          }
          mark_default_assignment(token) {
            if (this.default_assignment === false) {
              this.default_assignment = token;
            }
          }
          mark_spread(token) {
            if (this.spread === false) {
              this.spread = token;
            }
          }
          mark_strict_mode() {
            this.strict_mode = true;
          }
          is_strict() {
            return this.default_assignment !== false || this.spread !== false || this.strict_mode;
          }
          check_strict() {
            if (this.is_strict() && this.duplicate !== null && !this.duplicates_ok) {
              token_error(this.duplicate, "Parameter " + this.duplicate.value + " was used already");
            }
          }
        }
        function parameters(params) {
          var used_parameters = new UsedParametersTracker(true, S.input.has_directive("use strict"));
          expect("(");
          while (!is2("punc", ")")) {
            var param = parameter(used_parameters);
            params.push(param);
            if (!is2("punc", ")")) {
              expect(",");
            }
            if (param instanceof AST_Expansion) {
              break;
            }
          }
          next2();
        }
        function parameter(used_parameters, symbol_type) {
          var param;
          var expand2 = false;
          if (used_parameters === void 0) {
            used_parameters = new UsedParametersTracker(true, S.input.has_directive("use strict"));
          }
          if (is2("expand", "...")) {
            expand2 = S.token;
            used_parameters.mark_spread(S.token);
            next2();
          }
          param = binding_element(used_parameters, symbol_type);
          if (is2("operator", "=") && expand2 === false) {
            used_parameters.mark_default_assignment(S.token);
            next2();
            param = new AST_DefaultAssign({
              start: param.start,
              left: param,
              operator: "=",
              right: expression(false),
              end: S.token
            });
          }
          if (expand2 !== false) {
            if (!is2("punc", ")")) {
              unexpected();
            }
            param = new AST_Expansion({
              start: expand2,
              expression: param,
              end: expand2
            });
          }
          used_parameters.check_strict();
          return param;
        }
        function binding_element(used_parameters, symbol_type) {
          var elements = [];
          var first = true;
          var is_expand = false;
          var expand_token;
          var first_token = S.token;
          if (used_parameters === void 0) {
            const strict = S.input.has_directive("use strict");
            const duplicates_ok = symbol_type === AST_SymbolVar;
            used_parameters = new UsedParametersTracker(false, strict, duplicates_ok);
          }
          symbol_type = symbol_type === void 0 ? AST_SymbolFunarg : symbol_type;
          if (is2("punc", "[")) {
            next2();
            while (!is2("punc", "]")) {
              if (first) {
                first = false;
              } else {
                expect(",");
              }
              if (is2("expand", "...")) {
                is_expand = true;
                expand_token = S.token;
                used_parameters.mark_spread(S.token);
                next2();
              }
              if (is2("punc")) {
                switch (S.token.value) {
                  case ",":
                    elements.push(new AST_Hole({
                      start: S.token,
                      end: S.token
                    }));
                    continue;
                  case "]":
                    break;
                  case "[":
                  case "{":
                    elements.push(binding_element(used_parameters, symbol_type));
                    break;
                  default:
                    unexpected();
                }
              } else if (is2("name")) {
                used_parameters.add_parameter(S.token);
                elements.push(as_symbol(symbol_type));
              } else {
                croak("Invalid function parameter");
              }
              if (is2("operator", "=") && is_expand === false) {
                used_parameters.mark_default_assignment(S.token);
                next2();
                elements[elements.length - 1] = new AST_DefaultAssign({
                  start: elements[elements.length - 1].start,
                  left: elements[elements.length - 1],
                  operator: "=",
                  right: expression(false),
                  end: S.token
                });
              }
              if (is_expand) {
                if (!is2("punc", "]")) {
                  croak("Rest element must be last element");
                }
                elements[elements.length - 1] = new AST_Expansion({
                  start: expand_token,
                  expression: elements[elements.length - 1],
                  end: expand_token
                });
              }
            }
            expect("]");
            used_parameters.check_strict();
            return new AST_Destructuring({
              start: first_token,
              names: elements,
              is_array: true,
              end: prev()
            });
          } else if (is2("punc", "{")) {
            next2();
            while (!is2("punc", "}")) {
              if (first) {
                first = false;
              } else {
                expect(",");
              }
              if (is2("expand", "...")) {
                is_expand = true;
                expand_token = S.token;
                used_parameters.mark_spread(S.token);
                next2();
              }
              if (is2("name") && (is_token(peek(), "punc") || is_token(peek(), "operator")) && [",", "}", "="].includes(peek().value)) {
                used_parameters.add_parameter(S.token);
                var start = prev();
                var value2 = as_symbol(symbol_type);
                if (is_expand) {
                  elements.push(new AST_Expansion({
                    start: expand_token,
                    expression: value2,
                    end: value2.end
                  }));
                } else {
                  elements.push(new AST_ObjectKeyVal({
                    start,
                    key: value2.name,
                    value: value2,
                    end: value2.end
                  }));
                }
              } else if (is2("punc", "}")) {
                continue;
              } else {
                var property_token = S.token;
                var property = as_property_name();
                if (property === null) {
                  unexpected(prev());
                } else if (prev().type === "name" && !is2("punc", ":")) {
                  elements.push(new AST_ObjectKeyVal({
                    start: prev(),
                    key: property,
                    value: new symbol_type({
                      start: prev(),
                      name: property,
                      end: prev()
                    }),
                    end: prev()
                  }));
                } else {
                  expect(":");
                  elements.push(new AST_ObjectKeyVal({
                    start: property_token,
                    quote: property_token.quote,
                    key: property,
                    value: binding_element(used_parameters, symbol_type),
                    end: prev()
                  }));
                }
              }
              if (is_expand) {
                if (!is2("punc", "}")) {
                  croak("Rest element must be last element");
                }
              } else if (is2("operator", "=")) {
                used_parameters.mark_default_assignment(S.token);
                next2();
                elements[elements.length - 1].value = new AST_DefaultAssign({
                  start: elements[elements.length - 1].value.start,
                  left: elements[elements.length - 1].value,
                  operator: "=",
                  right: expression(false),
                  end: S.token
                });
              }
            }
            expect("}");
            used_parameters.check_strict();
            return new AST_Destructuring({
              start: first_token,
              names: elements,
              is_array: false,
              end: prev()
            });
          } else if (is2("name")) {
            used_parameters.add_parameter(S.token);
            return as_symbol(symbol_type);
          } else {
            croak("Invalid function parameter");
          }
        }
        function params_or_seq_(allow_arrows, maybe_sequence) {
          var spread_token;
          var invalid_sequence;
          var trailing_comma;
          var a = [];
          expect("(");
          while (!is2("punc", ")")) {
            if (spread_token) unexpected(spread_token);
            if (is2("expand", "...")) {
              spread_token = S.token;
              if (maybe_sequence) invalid_sequence = S.token;
              next2();
              a.push(new AST_Expansion({
                start: prev(),
                expression: expression(),
                end: S.token
              }));
            } else {
              a.push(expression());
            }
            if (!is2("punc", ")")) {
              expect(",");
              if (is2("punc", ")")) {
                trailing_comma = prev();
                if (maybe_sequence) invalid_sequence = trailing_comma;
              }
            }
          }
          expect(")");
          if (allow_arrows && is2("arrow", "=>")) {
            if (spread_token && trailing_comma) unexpected(trailing_comma);
          } else if (invalid_sequence) {
            unexpected(invalid_sequence);
          }
          return a;
        }
        function _function_body(block2, generator, is_async, name, args) {
          var loop2 = S.in_loop;
          var labels = S.labels;
          var current_generator = S.in_generator;
          var current_async = S.in_async;
          ++S.in_function;
          if (generator)
            S.in_generator = S.in_function;
          if (is_async)
            S.in_async = S.in_function;
          if (args) parameters(args);
          if (block2)
            S.in_directives = true;
          S.in_loop = 0;
          S.labels = [];
          if (block2) {
            S.input.push_directives_stack();
            var a = block_();
            if (name) _verify_symbol(name);
            if (args) args.forEach(_verify_symbol);
            S.input.pop_directives_stack();
          } else {
            var a = [new AST_Return({
              start: S.token,
              value: expression(false),
              end: S.token
            })];
          }
          --S.in_function;
          S.in_loop = loop2;
          S.labels = labels;
          S.in_generator = current_generator;
          S.in_async = current_async;
          return a;
        }
        function _await_expression() {
          if (!can_await()) {
            croak(
              "Unexpected await expression outside async function",
              S.prev.line,
              S.prev.col,
              S.prev.pos
            );
          }
          return new AST_Await({
            start: prev(),
            end: S.token,
            expression: maybe_unary(true)
          });
        }
        function _yield_expression() {
          var start = S.token;
          var star3 = false;
          var has_expression = true;
          if (can_insert_semicolon() || is2("punc") && PUNC_AFTER_EXPRESSION.has(S.token.value) || is2("template_cont")) {
            has_expression = false;
          } else if (is2("operator", "*")) {
            star3 = true;
            next2();
          }
          return new AST_Yield({
            start,
            is_star: star3,
            expression: has_expression ? expression() : null,
            end: prev()
          });
        }
        function if_() {
          var cond = parenthesised(), body = statement(false, false, true), belse = null;
          if (is2("keyword", "else")) {
            next2();
            belse = statement(false, false, true);
          }
          return new AST_If({
            condition: cond,
            body,
            alternative: belse
          });
        }
        function block_() {
          expect("{");
          var a = [];
          while (!is2("punc", "}")) {
            if (is2("eof")) unexpected();
            a.push(statement());
          }
          next2();
          return a;
        }
        function switch_body_() {
          expect("{");
          var a = [], cur = null, branch2 = null, tmp;
          while (!is2("punc", "}")) {
            if (is2("eof")) unexpected();
            if (is2("keyword", "case")) {
              if (branch2) branch2.end = prev();
              cur = [];
              branch2 = new AST_Case({
                start: (tmp = S.token, next2(), tmp),
                expression: expression(true),
                body: cur
              });
              a.push(branch2);
              expect(":");
            } else if (is2("keyword", "default")) {
              if (branch2) branch2.end = prev();
              cur = [];
              branch2 = new AST_Default({
                start: (tmp = S.token, next2(), expect(":"), tmp),
                body: cur
              });
              a.push(branch2);
            } else {
              if (!cur) unexpected();
              cur.push(statement());
            }
          }
          if (branch2) branch2.end = prev();
          next2();
          return a;
        }
        function try_() {
          var body, bcatch = null, bfinally = null;
          body = new AST_TryBlock({
            start: S.token,
            body: block_(),
            end: prev()
          });
          if (is2("keyword", "catch")) {
            var start = S.token;
            next2();
            if (is2("punc", "{")) {
              var name = null;
            } else {
              expect("(");
              var name = parameter(void 0, AST_SymbolCatch);
              expect(")");
            }
            bcatch = new AST_Catch({
              start,
              argname: name,
              body: block_(),
              end: prev()
            });
          }
          if (is2("keyword", "finally")) {
            var start = S.token;
            next2();
            bfinally = new AST_Finally({
              start,
              body: block_(),
              end: prev()
            });
          }
          if (!bcatch && !bfinally)
            croak("Missing catch/finally blocks");
          return new AST_Try({
            body,
            bcatch,
            bfinally
          });
        }
        function vardefs(no_in, kind) {
          var var_defs = [];
          var def;
          for (; ; ) {
            var sym_type = kind === "var" ? AST_SymbolVar : kind === "const" ? AST_SymbolConst : kind === "let" ? AST_SymbolLet : kind === "using" ? AST_SymbolUsing : kind === "await using" ? AST_SymbolUsing : null;
            var def_type = kind === "using" || kind === "await using" ? AST_UsingDef : AST_VarDef;
            if (is2("punc", "{") || is2("punc", "[")) {
              def = new def_type({
                start: S.token,
                name: binding_element(void 0, sym_type),
                value: is2("operator", "=") ? (expect_token("operator", "="), expression(false, no_in)) : null,
                end: prev()
              });
            } else {
              def = new def_type({
                start: S.token,
                name: as_symbol(sym_type),
                value: is2("operator", "=") ? (next2(), expression(false, no_in)) : !no_in && (kind === "const" || kind === "using" || kind === "await using") ? croak("Missing initializer in " + kind + " declaration") : null,
                end: prev()
              });
              if (def.name.name == "import") croak("Unexpected token: import");
            }
            var_defs.push(def);
            if (!is2("punc", ","))
              break;
            next2();
          }
          return var_defs;
        }
        var var_ = function(no_in) {
          return new AST_Var({
            start: prev(),
            definitions: vardefs(no_in, "var"),
            end: prev()
          });
        };
        var let_ = function(no_in) {
          return new AST_Let({
            start: prev(),
            definitions: vardefs(no_in, "let"),
            end: prev()
          });
        };
        var const_ = function(no_in) {
          return new AST_Const({
            start: prev(),
            definitions: vardefs(no_in, "const"),
            end: prev()
          });
        };
        var using_ = function(no_in) {
          return new AST_Using({
            start: prev(),
            await: false,
            definitions: vardefs(no_in, "using"),
            end: prev()
          });
        };
        var await_using_ = function(no_in) {
          return new AST_Using({
            start: prev(),
            await: true,
            definitions: (next2(), vardefs(no_in, "await using")),
            end: prev()
          });
        };
        var new_ = function(allow_calls) {
          var start = S.token;
          expect_token("operator", "new");
          if (is2("punc", ".")) {
            next2();
            expect_token("name", "target");
            return subscripts(new AST_NewTarget({
              start,
              end: prev()
            }), allow_calls);
          }
          var newexp = expr_atom(false), args;
          if (is2("punc", "(")) {
            next2();
            args = expr_list(")", true);
          } else {
            args = [];
          }
          var call = new AST_New({
            start,
            expression: newexp,
            args,
            end: prev()
          });
          annotate(call);
          return subscripts(call, allow_calls);
        };
        function as_atom_node() {
          var tok = S.token, ret;
          switch (tok.type) {
            case "name":
              ret = _make_symbol(AST_SymbolRef);
              break;
            case "num":
              ret = new AST_Number({
                start: tok,
                end: tok,
                value: tok.value,
                raw: LATEST_RAW
              });
              break;
            case "big_int":
              ret = new AST_BigInt({
                start: tok,
                end: tok,
                value: tok.value,
                raw: LATEST_RAW
              });
              break;
            case "string":
              ret = new AST_String({
                start: tok,
                end: tok,
                value: tok.value,
                quote: tok.quote
              });
              annotate(ret);
              break;
            case "regexp":
              const [_, source2, flags2] = tok.value.match(/^\/(.*)\/(\w*)$/);
              ret = new AST_RegExp({ start: tok, end: tok, value: { source: source2, flags: flags2 } });
              break;
            case "atom":
              switch (tok.value) {
                case "false":
                  ret = new AST_False({ start: tok, end: tok });
                  break;
                case "true":
                  ret = new AST_True({ start: tok, end: tok });
                  break;
                case "null":
                  ret = new AST_Null({ start: tok, end: tok });
                  break;
              }
              break;
          }
          next2();
          return ret;
        }
        function to_fun_args(ex, default_seen_above) {
          var insert_default = function(ex2, default_value) {
            if (default_value) {
              return new AST_DefaultAssign({
                start: ex2.start,
                left: ex2,
                operator: "=",
                right: default_value,
                end: default_value.end
              });
            }
            return ex2;
          };
          if (ex instanceof AST_Object) {
            return insert_default(new AST_Destructuring({
              start: ex.start,
              end: ex.end,
              is_array: false,
              names: ex.properties.map((prop2) => to_fun_args(prop2))
            }), default_seen_above);
          } else if (ex instanceof AST_ObjectKeyVal) {
            ex.value = to_fun_args(ex.value);
            return insert_default(ex, default_seen_above);
          } else if (ex instanceof AST_Hole) {
            return ex;
          } else if (ex instanceof AST_Destructuring) {
            ex.names = ex.names.map((name) => to_fun_args(name));
            return insert_default(ex, default_seen_above);
          } else if (ex instanceof AST_SymbolRef) {
            return insert_default(new AST_SymbolFunarg({
              name: ex.name,
              start: ex.start,
              end: ex.end
            }), default_seen_above);
          } else if (ex instanceof AST_Expansion) {
            ex.expression = to_fun_args(ex.expression);
            return insert_default(ex, default_seen_above);
          } else if (ex instanceof AST_Array) {
            return insert_default(new AST_Destructuring({
              start: ex.start,
              end: ex.end,
              is_array: true,
              names: ex.elements.map((elm) => to_fun_args(elm))
            }), default_seen_above);
          } else if (ex instanceof AST_Assign) {
            return insert_default(to_fun_args(ex.left, ex.right), default_seen_above);
          } else if (ex instanceof AST_DefaultAssign) {
            ex.left = to_fun_args(ex.left);
            return ex;
          } else {
            croak("Invalid function parameter", ex.start.line, ex.start.col);
          }
        }
        var expr_atom = function(allow_calls, allow_arrows) {
          if (is2("operator", "new")) {
            return new_(allow_calls);
          }
          if (is2("name", "import") && is_token(peek(), "punc", ".")) {
            return import_meta(allow_calls);
          }
          var start = S.token;
          var peeked;
          var async2 = is2("name", "async") && (peeked = peek()).value != "[" && peeked.type != "arrow" && as_atom_node();
          if (is2("punc")) {
            switch (S.token.value) {
              case "(":
                if (async2 && !allow_calls) break;
                var exprs = params_or_seq_(allow_arrows, !async2);
                if (allow_arrows && is2("arrow", "=>")) {
                  return arrow_function(start, exprs.map((e2) => to_fun_args(e2)), !!async2);
                }
                var ex = async2 ? new AST_Call({
                  expression: async2,
                  args: exprs
                }) : to_expr_or_sequence(start, exprs);
                if (ex.start) {
                  const outer_comments_before = start.comments_before.length;
                  outer_comments_before_counts.set(start, outer_comments_before);
                  ex.start.comments_before.unshift(...start.comments_before);
                  start.comments_before = ex.start.comments_before;
                  if (outer_comments_before == 0 && start.comments_before.length > 0) {
                    var comment2 = start.comments_before[0];
                    if (!comment2.nlb) {
                      comment2.nlb = start.nlb;
                      start.nlb = false;
                    }
                  }
                  start.comments_after = ex.start.comments_after;
                }
                ex.start = start;
                var end = prev();
                if (ex.end) {
                  end.comments_before = ex.end.comments_before;
                  ex.end.comments_after.push(...end.comments_after);
                  end.comments_after = ex.end.comments_after;
                }
                ex.end = end;
                if (ex instanceof AST_Call) annotate(ex);
                return subscripts(ex, allow_calls);
              case "[":
                return subscripts(array_(), allow_calls);
              case "{":
                return subscripts(object_or_destructuring_(), allow_calls);
            }
            if (!async2) unexpected();
          }
          if (allow_arrows && is2("name") && is_token(peek(), "arrow")) {
            var param = new AST_SymbolFunarg({
              name: S.token.value,
              start,
              end: start
            });
            next2();
            return arrow_function(start, [param], !!async2);
          }
          if (is2("keyword", "function")) {
            next2();
            var func = function_(AST_Function, false, !!async2);
            func.start = start;
            func.end = prev();
            return subscripts(func, allow_calls);
          }
          if (async2) return subscripts(async2, allow_calls);
          if (is2("keyword", "class")) {
            next2();
            var cls = class_(AST_ClassExpression);
            cls.start = start;
            cls.end = prev();
            return subscripts(cls, allow_calls);
          }
          if (is2("template_head")) {
            return subscripts(template_string(), allow_calls);
          }
          if (ATOMIC_START_TOKEN.has(S.token.type)) {
            return subscripts(as_atom_node(), allow_calls);
          }
          unexpected();
        };
        function template_string() {
          var segments = [], start = S.token;
          segments.push(new AST_TemplateSegment({
            start: S.token,
            raw: TEMPLATE_RAWS.get(S.token),
            value: S.token.value,
            end: S.token
          }));
          while (!S.token.template_end) {
            next2();
            handle_regexp();
            segments.push(expression(true));
            segments.push(new AST_TemplateSegment({
              start: S.token,
              raw: TEMPLATE_RAWS.get(S.token),
              value: S.token.value,
              end: S.token
            }));
          }
          next2();
          return new AST_TemplateString({
            start,
            segments,
            end: S.token
          });
        }
        function expr_list(closing, allow_trailing_comma, allow_empty) {
          var first = true, a = [];
          while (!is2("punc", closing)) {
            if (first) first = false;
            else expect(",");
            if (allow_trailing_comma && is2("punc", closing)) break;
            if (is2("punc", ",") && allow_empty) {
              a.push(new AST_Hole({ start: S.token, end: S.token }));
            } else if (is2("expand", "...")) {
              next2();
              a.push(new AST_Expansion({ start: prev(), expression: expression(), end: S.token }));
            } else {
              a.push(expression(false));
            }
          }
          next2();
          return a;
        }
        var array_ = embed_tokens(function() {
          expect("[");
          return new AST_Array({
            elements: expr_list("]", !options.strict, true)
          });
        });
        var create_accessor = embed_tokens((is_generator, is_async) => {
          return function_(AST_Accessor, is_generator, is_async);
        });
        var object_or_destructuring_ = embed_tokens(function object_or_destructuring_2() {
          var start = S.token, first = true, a = [];
          expect("{");
          while (!is2("punc", "}")) {
            if (first) first = false;
            else expect(",");
            if (!options.strict && is2("punc", "}"))
              break;
            start = S.token;
            if (start.type == "expand") {
              next2();
              a.push(new AST_Expansion({
                start,
                expression: expression(false),
                end: prev()
              }));
              continue;
            }
            if (is2("privatename")) {
              croak("private fields are not allowed in an object");
            }
            var name = as_property_name();
            var value2;
            if (!is2("punc", ":")) {
              var concise = object_or_class_property(name, start);
              if (concise) {
                a.push(concise);
                continue;
              }
              value2 = new AST_SymbolRef({
                start: prev(),
                name,
                end: prev()
              });
            } else if (name === null) {
              unexpected(prev());
            } else {
              next2();
              value2 = expression(false);
            }
            if (is2("operator", "=")) {
              next2();
              value2 = new AST_Assign({
                start,
                left: value2,
                operator: "=",
                right: expression(false),
                logical: false,
                end: prev()
              });
            }
            const kv = new AST_ObjectKeyVal({
              start,
              quote: start.quote,
              key: name,
              value: value2,
              end: prev()
            });
            a.push(annotate(kv));
          }
          next2();
          return new AST_Object({ properties: a });
        });
        function class_(KindOfClass, is_export_default) {
          var start, method, class_name, extends_, properties = [];
          S.input.push_directives_stack();
          S.input.add_directive("use strict");
          if (S.token.type == "name" && S.token.value != "extends") {
            class_name = as_symbol(KindOfClass === AST_DefClass ? AST_SymbolDefClass : AST_SymbolClass);
          }
          if (KindOfClass === AST_DefClass && !class_name) {
            if (is_export_default) {
              KindOfClass = AST_ClassExpression;
            } else {
              unexpected();
            }
          }
          if (S.token.value == "extends") {
            next2();
            extends_ = expression(true);
          }
          expect("{");
          const save_in_class = S.in_class;
          S.in_class = true;
          while (is2("punc", ";")) {
            next2();
          }
          while (!is2("punc", "}")) {
            start = S.token;
            method = object_or_class_property(as_property_name(), start, true);
            if (!method) {
              unexpected();
            }
            properties.push(method);
            while (is2("punc", ";")) {
              next2();
            }
          }
          S.in_class = save_in_class;
          S.input.pop_directives_stack();
          next2();
          return new KindOfClass({
            start,
            name: class_name,
            extends: extends_,
            properties,
            end: prev()
          });
        }
        function object_or_class_property(name, start, is_class) {
          const get_symbol_ast = (name2, SymbolClass) => {
            if (typeof name2 === "string") {
              return new SymbolClass({ start, name: name2, end: prev() });
            } else if (name2 === null) {
              unexpected();
            }
            return name2;
          };
          var is_private = prev().type === "privatename";
          const is_not_method_start = () => !is2("punc", "(") && !is2("punc", ",") && !is2("punc", "}") && !is2("punc", ";") && !is2("operator", "=") && !is_private;
          var is_async = false;
          var is_static = false;
          var is_generator = false;
          var accessor_type = null;
          if (is_class && name === "static" && is_not_method_start()) {
            const static_block = class_static_block();
            if (static_block != null) {
              return static_block;
            }
            is_static = true;
            name = as_property_name();
          }
          if (name === "async" && is_not_method_start()) {
            is_async = true;
            name = as_property_name();
          }
          if (prev().type === "operator" && prev().value === "*") {
            is_generator = true;
            name = as_property_name();
          }
          if ((name === "get" || name === "set") && is_not_method_start()) {
            accessor_type = name;
            name = as_property_name();
          }
          if (!is_private && prev().type === "privatename") {
            is_private = true;
          }
          const property_token = prev();
          if (accessor_type != null) {
            if (!is_private) {
              const AccessorClass = accessor_type === "get" ? AST_ObjectGetter : AST_ObjectSetter;
              name = get_symbol_ast(name, AST_SymbolMethod);
              return annotate(new AccessorClass({
                start,
                static: is_static,
                key: name,
                quote: name instanceof AST_SymbolMethod ? property_token.quote : void 0,
                value: create_accessor(),
                end: prev()
              }));
            } else {
              const AccessorClass = accessor_type === "get" ? AST_PrivateGetter : AST_PrivateSetter;
              return annotate(new AccessorClass({
                start,
                static: is_static,
                key: get_symbol_ast(name, AST_SymbolMethod),
                value: create_accessor(),
                end: prev()
              }));
            }
          }
          if (is2("punc", "(")) {
            name = get_symbol_ast(name, AST_SymbolMethod);
            const AST_MethodVariant = is_private ? AST_PrivateMethod : AST_ConciseMethod;
            var node = new AST_MethodVariant({
              start,
              static: is_static,
              key: name,
              quote: name instanceof AST_SymbolMethod ? property_token.quote : void 0,
              value: create_accessor(is_generator, is_async),
              end: prev()
            });
            return annotate(node);
          }
          if (is_class) {
            const AST_SymbolVariant = is_private ? AST_SymbolPrivateProperty : AST_SymbolClassProperty;
            const AST_ClassPropertyVariant = is_private ? AST_ClassPrivateProperty : AST_ClassProperty;
            const key4 = get_symbol_ast(name, AST_SymbolVariant);
            const quote = key4 instanceof AST_SymbolClassProperty ? property_token.quote : void 0;
            if (is2("operator", "=")) {
              next2();
              return annotate(
                new AST_ClassPropertyVariant({
                  start,
                  static: is_static,
                  quote,
                  key: key4,
                  value: expression(false),
                  end: prev()
                })
              );
            } else if (is2("name") || is2("privatename") || is2("punc", "[") || is2("operator", "*") || is2("punc", ";") || is2("punc", "}") || is2("string") || is2("num") || is2("big_int")) {
              return annotate(
                new AST_ClassPropertyVariant({
                  start,
                  static: is_static,
                  quote,
                  key: key4,
                  end: prev()
                })
              );
            }
          }
        }
        function class_static_block() {
          if (!is2("punc", "{")) {
            return null;
          }
          const start = S.token;
          const body = [];
          next2();
          while (!is2("punc", "}")) {
            body.push(statement());
          }
          next2();
          return new AST_ClassStaticBlock({ start, body, end: prev() });
        }
        function maybe_import_attributes() {
          if ((is2("keyword", "with") || is2("name", "assert")) && !has_newline_before(S.token)) {
            next2();
            return object_or_destructuring_();
          }
          return null;
        }
        function import_statement() {
          var start = prev();
          var imported_name;
          var imported_names;
          if (is2("name")) {
            imported_name = as_symbol(AST_SymbolImport);
          }
          if (is2("punc", ",")) {
            next2();
          }
          imported_names = map_names(true);
          if (imported_names || imported_name) {
            expect_token("name", "from");
          }
          var mod_str = S.token;
          if (mod_str.type !== "string") {
            unexpected();
          }
          next2();
          const attributes = maybe_import_attributes();
          return new AST_Import({
            start,
            imported_name,
            imported_names,
            module_name: new AST_String({
              start: mod_str,
              value: mod_str.value,
              quote: mod_str.quote,
              end: mod_str
            }),
            attributes,
            end: S.token
          });
        }
        function import_meta(allow_calls) {
          var start = S.token;
          expect_token("name", "import");
          expect_token("punc", ".");
          expect_token("name", "meta");
          return subscripts(new AST_ImportMeta({
            start,
            end: prev()
          }), allow_calls);
        }
        function map_name(is_import) {
          function make_symbol(type2, quote) {
            return new type2({
              name: as_property_name(),
              quote: quote || void 0,
              start: prev(),
              end: prev()
            });
          }
          var foreign_type = is_import ? AST_SymbolImportForeign : AST_SymbolExportForeign;
          var type = is_import ? AST_SymbolImport : AST_SymbolExport;
          var start = S.token;
          var foreign_name;
          var name;
          if (is_import) {
            foreign_name = make_symbol(foreign_type, start.quote);
          } else {
            name = make_symbol(type, start.quote);
          }
          if (is2("name", "as")) {
            next2();
            if (is_import) {
              name = make_symbol(type);
            } else {
              foreign_name = make_symbol(foreign_type, S.token.quote);
            }
          } else {
            if (is_import) {
              name = new type(foreign_name);
            } else {
              foreign_name = new foreign_type(name);
            }
          }
          return new AST_NameMapping({
            start,
            foreign_name,
            name,
            end: prev()
          });
        }
        function map_nameAsterisk(is_import, import_or_export_foreign_name) {
          var foreign_type = is_import ? AST_SymbolImportForeign : AST_SymbolExportForeign;
          var type = is_import ? AST_SymbolImport : AST_SymbolExport;
          var start = S.token;
          var name, foreign_name;
          var end = prev();
          if (is_import) {
            name = import_or_export_foreign_name;
          } else {
            foreign_name = import_or_export_foreign_name;
          }
          name = name || new type({
            start,
            name: "*",
            end
          });
          foreign_name = foreign_name || new foreign_type({
            start,
            name: "*",
            end
          });
          return new AST_NameMapping({
            start,
            foreign_name,
            name,
            end
          });
        }
        function map_names(is_import) {
          var names;
          if (is2("punc", "{")) {
            next2();
            names = [];
            while (!is2("punc", "}")) {
              names.push(map_name(is_import));
              if (is2("punc", ",")) {
                next2();
              }
            }
            next2();
          } else if (is2("operator", "*")) {
            var name;
            next2();
            if (is2("name", "as")) {
              next2();
              name = is_import ? as_symbol(AST_SymbolImport) : as_symbol_or_string(AST_SymbolExportForeign);
            }
            names = [map_nameAsterisk(is_import, name)];
          }
          return names;
        }
        function export_statement() {
          var start = S.token;
          var is_default;
          var exported_names;
          if (is2("keyword", "default")) {
            is_default = true;
            next2();
          } else if (exported_names = map_names(false)) {
            if (is2("name", "from")) {
              next2();
              var mod_str = S.token;
              if (mod_str.type !== "string") {
                unexpected();
              }
              next2();
              const attributes = maybe_import_attributes();
              return new AST_Export({
                start,
                is_default,
                exported_names,
                module_name: new AST_String({
                  start: mod_str,
                  value: mod_str.value,
                  quote: mod_str.quote,
                  end: mod_str
                }),
                end: prev(),
                attributes
              });
            } else {
              return new AST_Export({
                start,
                is_default,
                exported_names,
                end: prev()
              });
            }
          }
          var node;
          var exported_value;
          var exported_definition;
          if (is2("punc", "{") || is_default && (is2("keyword", "class") || is2("keyword", "function")) && is_token(peek(), "punc")) {
            exported_value = expression(false);
            semicolon();
          } else if ((node = statement(is_default)) instanceof AST_Definitions && is_default) {
            unexpected(node.start);
          } else if (node instanceof AST_Definitions || node instanceof AST_Defun || node instanceof AST_DefClass) {
            exported_definition = node;
          } else if (node instanceof AST_ClassExpression || node instanceof AST_Function) {
            exported_value = node;
          } else if (node instanceof AST_SimpleStatement) {
            exported_value = node.body;
          } else {
            unexpected(node.start);
          }
          return new AST_Export({
            start,
            is_default,
            exported_value,
            exported_definition,
            end: prev(),
            attributes: null
          });
        }
        function as_property_name() {
          var tmp = S.token;
          switch (tmp.type) {
            case "punc":
              if (tmp.value === "[") {
                next2();
                var ex = expression(false);
                expect("]");
                return ex;
              } else unexpected(tmp);
            case "operator":
              if (tmp.value === "*") {
                next2();
                return null;
              }
              if (!["delete", "in", "instanceof", "new", "typeof", "void"].includes(tmp.value)) {
                unexpected(tmp);
              }
            /* falls through */
            case "name":
            case "privatename":
            case "string":
            case "keyword":
            case "atom":
              next2();
              return tmp.value;
            case "num":
            case "big_int":
              next2();
              return "" + tmp.value;
            default:
              unexpected(tmp);
          }
        }
        function as_name() {
          var tmp = S.token;
          if (tmp.type != "name" && tmp.type != "privatename") unexpected();
          next2();
          return tmp.value;
        }
        function _make_symbol(type) {
          var name = S.token.value;
          return new (name == "this" ? AST_This : name == "super" ? AST_Super : type)({
            name: String(name),
            start: S.token,
            end: S.token
          });
        }
        function _verify_symbol(sym) {
          var name = sym.name;
          if (is_in_generator() && name == "yield") {
            token_error(sym.start, "Yield cannot be used as identifier inside generators");
          }
          if (S.input.has_directive("use strict")) {
            if (name == "yield") {
              token_error(sym.start, "Unexpected yield identifier inside strict mode");
            }
            if (sym instanceof AST_SymbolDeclaration && (name == "arguments" || name == "eval")) {
              token_error(sym.start, "Unexpected " + name + " in strict mode");
            }
          }
        }
        function as_symbol(type, noerror) {
          if (!is2("name")) {
            if (!noerror) croak("Name expected");
            return null;
          }
          var sym = _make_symbol(type);
          _verify_symbol(sym);
          next2();
          return sym;
        }
        function as_symbol_or_string(type) {
          if (!is2("name")) {
            if (!is2("string")) {
              croak("Name or string expected");
            }
            var tok = S.token;
            var ret = new type({
              start: tok,
              end: tok,
              name: tok.value,
              quote: tok.quote
            });
            next2();
            return ret;
          }
          var sym = _make_symbol(type);
          _verify_symbol(sym);
          next2();
          return sym;
        }
        function annotate(node, before_token = node.start) {
          var comments = before_token.comments_before;
          const comments_outside_parens = outer_comments_before_counts.get(before_token);
          var i = comments_outside_parens != null ? comments_outside_parens : comments.length;
          while (--i >= 0) {
            var comment2 = comments[i];
            if (/[@#]__/.test(comment2.value)) {
              if (/[@#]__PURE__/.test(comment2.value)) {
                set_annotation(node, _PURE);
                break;
              }
              if (/[@#]__INLINE__/.test(comment2.value)) {
                set_annotation(node, _INLINE);
                break;
              }
              if (/[@#]__NOINLINE__/.test(comment2.value)) {
                set_annotation(node, _NOINLINE);
                break;
              }
              if (/[@#]__KEY__/.test(comment2.value)) {
                set_annotation(node, _KEY);
                break;
              }
              if (/[@#]__MANGLE_PROP__/.test(comment2.value)) {
                set_annotation(node, _MANGLEPROP);
                break;
              }
            }
          }
          return node;
        }
        var subscripts = function(expr, allow_calls, is_chain) {
          var start = expr.start;
          if (is2("punc", ".")) {
            next2();
            if (is2("privatename") && !S.in_class)
              croak("Private field must be used in an enclosing class");
            const AST_DotVariant = is2("privatename") ? AST_DotHash : AST_Dot;
            return annotate(subscripts(new AST_DotVariant({
              start,
              expression: expr,
              optional: false,
              property: as_name(),
              end: prev()
            }), allow_calls, is_chain));
          }
          if (is2("punc", "[")) {
            next2();
            var prop2 = expression(true);
            expect("]");
            return annotate(subscripts(new AST_Sub({
              start,
              expression: expr,
              optional: false,
              property: prop2,
              end: prev()
            }), allow_calls, is_chain));
          }
          if (allow_calls && is2("punc", "(")) {
            next2();
            var call = new AST_Call({
              start,
              expression: expr,
              optional: false,
              args: call_args(),
              end: prev()
            });
            annotate(call);
            return subscripts(call, true, is_chain);
          }
          if (is2("punc", "?.")) {
            next2();
            let chain_contents;
            if (allow_calls && is2("punc", "(")) {
              next2();
              const call2 = new AST_Call({
                start,
                optional: true,
                expression: expr,
                args: call_args(),
                end: prev()
              });
              annotate(call2);
              chain_contents = subscripts(call2, true, true);
            } else if (is2("name") || is2("privatename")) {
              if (is2("privatename") && !S.in_class)
                croak("Private field must be used in an enclosing class");
              const AST_DotVariant = is2("privatename") ? AST_DotHash : AST_Dot;
              chain_contents = annotate(subscripts(new AST_DotVariant({
                start,
                expression: expr,
                optional: true,
                property: as_name(),
                end: prev()
              }), allow_calls, true));
            } else if (is2("punc", "[")) {
              next2();
              const property = expression(true);
              expect("]");
              chain_contents = annotate(subscripts(new AST_Sub({
                start,
                expression: expr,
                optional: true,
                property,
                end: prev()
              }), allow_calls, true));
            }
            if (!chain_contents) unexpected();
            if (chain_contents instanceof AST_Chain) return chain_contents;
            return new AST_Chain({
              start,
              expression: chain_contents,
              end: prev()
            });
          }
          if (is2("template_head")) {
            if (is_chain) {
              unexpected();
            }
            return subscripts(new AST_PrefixedTemplateString({
              start,
              prefix: expr,
              template_string: template_string(),
              end: prev()
            }), allow_calls);
          }
          return expr;
        };
        function call_args() {
          var args = [];
          while (!is2("punc", ")")) {
            if (is2("expand", "...")) {
              next2();
              args.push(new AST_Expansion({
                start: prev(),
                expression: expression(false),
                end: prev()
              }));
            } else {
              args.push(expression(false));
            }
            if (!is2("punc", ")")) {
              expect(",");
            }
          }
          next2();
          return args;
        }
        var maybe_unary = function(allow_calls, allow_arrows) {
          var start = S.token;
          if (start.type == "name" && start.value == "await" && can_await()) {
            next2();
            return _await_expression();
          }
          if (is2("operator") && UNARY_PREFIX.has(start.value)) {
            next2();
            handle_regexp();
            var ex = make_unary(AST_UnaryPrefix, start, maybe_unary(allow_calls));
            ex.start = start;
            ex.end = prev();
            return ex;
          }
          var val = expr_atom(allow_calls, allow_arrows);
          while (is2("operator") && UNARY_POSTFIX.has(S.token.value) && !has_newline_before(S.token)) {
            if (val instanceof AST_Arrow) unexpected();
            val = make_unary(AST_UnaryPostfix, S.token, val);
            val.start = start;
            val.end = S.token;
            next2();
          }
          return val;
        };
        function make_unary(ctor, token, expr) {
          var op = token.value;
          switch (op) {
            case "++":
            case "--":
              if (!is_assignable(expr))
                croak("Invalid use of " + op + " operator", token.line, token.col, token.pos);
              break;
            case "delete":
              if (expr instanceof AST_SymbolRef && S.input.has_directive("use strict"))
                croak("Calling delete on expression not allowed in strict mode", expr.start.line, expr.start.col, expr.start.pos);
              break;
          }
          return new ctor({ operator: op, expression: expr });
        }
        var expr_op = function(left, min_prec, no_in) {
          var op = is2("operator") ? S.token.value : null;
          if (op == "in" && no_in) op = null;
          if (op == "**" && left instanceof AST_UnaryPrefix && !is_token(left.start, "punc", "(") && left.operator !== "--" && left.operator !== "++")
            unexpected(left.start);
          var prec = op != null ? PRECEDENCE[op] : null;
          if (prec != null && (prec > min_prec || op === "**" && min_prec === prec)) {
            next2();
            var right = expr_ops(no_in, prec, true);
            return expr_op(new AST_Binary({
              start: left.start,
              left,
              operator: op,
              right,
              end: right.end
            }), min_prec, no_in);
          }
          return left;
        };
        function expr_ops(no_in, min_prec, allow_calls, allow_arrows) {
          if (!no_in && min_prec < PRECEDENCE["in"] && is2("privatename")) {
            if (!S.in_class) {
              croak("Private field must be used in an enclosing class");
            }
            const start = S.token;
            const key4 = new AST_SymbolPrivateProperty({
              start,
              name: start.value,
              end: start
            });
            next2();
            expect_token("operator", "in");
            const private_in = new AST_PrivateIn({
              start,
              key: key4,
              value: expr_ops(no_in, PRECEDENCE["in"], true),
              end: prev()
            });
            return expr_op(private_in, 0, no_in);
          } else {
            return expr_op(maybe_unary(allow_calls, allow_arrows), min_prec, no_in);
          }
        }
        var maybe_conditional = function(no_in) {
          var start = S.token;
          var expr = expr_ops(no_in, 0, true, true);
          if (is2("operator", "?")) {
            next2();
            var yes = expression(false);
            expect(":");
            return new AST_Conditional({
              start,
              condition: expr,
              consequent: yes,
              alternative: expression(false, no_in),
              end: prev()
            });
          }
          return expr;
        };
        function is_assignable(expr) {
          return expr instanceof AST_PropAccess || expr instanceof AST_SymbolRef;
        }
        function to_destructuring(node) {
          if (node instanceof AST_Object) {
            node = new AST_Destructuring({
              start: node.start,
              names: node.properties.map(to_destructuring),
              is_array: false,
              end: node.end
            });
          } else if (node instanceof AST_Array) {
            var names = [];
            for (var i = 0; i < node.elements.length; i++) {
              if (node.elements[i] instanceof AST_Expansion) {
                if (i + 1 !== node.elements.length) {
                  token_error(node.elements[i].start, "Spread must the be last element in destructuring array");
                }
                node.elements[i].expression = to_destructuring(node.elements[i].expression);
              }
              names.push(to_destructuring(node.elements[i]));
            }
            node = new AST_Destructuring({
              start: node.start,
              names,
              is_array: true,
              end: node.end
            });
          } else if (node instanceof AST_ObjectProperty) {
            node.value = to_destructuring(node.value);
          } else if (node instanceof AST_Assign) {
            node = new AST_DefaultAssign({
              start: node.start,
              left: node.left,
              operator: "=",
              right: node.right,
              end: node.end
            });
          }
          return node;
        }
        var maybe_assign = function(no_in) {
          handle_regexp();
          var start = S.token;
          if (start.type == "name" && start.value == "yield") {
            if (is_in_generator()) {
              next2();
              return _yield_expression();
            } else if (S.input.has_directive("use strict")) {
              token_error(S.token, "Unexpected yield identifier inside strict mode");
            }
          }
          var left = maybe_conditional(no_in);
          var val = S.token.value;
          if (is2("operator") && ASSIGNMENT.has(val)) {
            if (is_assignable(left) || (left = to_destructuring(left)) instanceof AST_Destructuring) {
              next2();
              return new AST_Assign({
                start,
                left,
                operator: val,
                right: maybe_assign(no_in),
                logical: LOGICAL_ASSIGNMENT.has(val),
                end: prev()
              });
            }
            croak("Invalid assignment");
          }
          return left;
        };
        var to_expr_or_sequence = function(start, exprs) {
          if (exprs.length === 1) {
            return exprs[0];
          } else if (exprs.length > 1) {
            return new AST_Sequence({ start, expressions: exprs, end: peek() });
          } else {
            croak("Invalid parenthesized expression");
          }
        };
        var expression = function(commas, no_in) {
          var start = S.token;
          var exprs = [];
          while (true) {
            exprs.push(maybe_assign(no_in));
            if (!commas || !is2("punc", ",")) break;
            next2();
            commas = true;
          }
          return to_expr_or_sequence(start, exprs);
        };
        function in_loop(cont) {
          ++S.in_loop;
          var ret = cont();
          --S.in_loop;
          return ret;
        }
        if (options.expression) {
          return expression(true);
        }
        return function parse_toplevel() {
          var start = S.token;
          var body = [];
          S.input.push_directives_stack();
          if (options.module) S.input.add_directive("use strict");
          while (!is2("eof")) {
            body.push(statement());
          }
          S.input.pop_directives_stack();
          var end = prev();
          var toplevel = options.toplevel;
          if (toplevel) {
            toplevel.body = toplevel.body.concat(body);
            toplevel.end = end;
          } else {
            toplevel = new AST_Toplevel({ start, body, end });
          }
          TEMPLATE_RAWS = /* @__PURE__ */ new Map();
          return toplevel;
        }();
      }
      function DEFNODE(type, props, ctor, methods, base2 = AST_Node) {
        if (!props) props = [];
        else props = props.split(/\s+/);
        var self_props = props;
        if (base2 && base2.PROPS)
          props = props.concat(base2.PROPS);
        const proto = base2 && Object.create(base2.prototype);
        if (proto) {
          ctor.prototype = proto;
          ctor.BASE = base2;
        }
        if (base2) base2.SUBCLASSES.push(ctor);
        ctor.prototype.CTOR = ctor;
        ctor.prototype.constructor = ctor;
        ctor.PROPS = props || null;
        ctor.SELF_PROPS = self_props;
        ctor.SUBCLASSES = [];
        if (type) {
          ctor.prototype.TYPE = ctor.TYPE = type;
        }
        if (methods) {
          for (let i in methods) if (HOP(methods, i)) {
            if (i[0] === "$") {
              ctor[i.substr(1)] = methods[i];
            } else {
              ctor.prototype[i] = methods[i];
            }
          }
        }
        ctor.DEFMETHOD = function(name, method) {
          this.prototype[name] = method;
        };
        return ctor;
      }
      const has_tok_flag = (tok, flag) => Boolean(tok.flags & flag);
      const set_tok_flag = (tok, flag, truth) => {
        if (truth) {
          tok.flags |= flag;
        } else {
          tok.flags &= ~flag;
        }
      };
      const TOK_FLAG_NLB = 1;
      const TOK_FLAG_QUOTE_SINGLE = 2;
      const TOK_FLAG_QUOTE_EXISTS = 4;
      const TOK_FLAG_TEMPLATE_END = 8;
      class AST_Token {
        constructor(type, value2, line, col, pos2, nlb, comments_before, comments_after, file) {
          this.flags = nlb ? 1 : 0;
          this.type = type;
          this.value = value2;
          this.line = line;
          this.col = col;
          this.pos = pos2;
          this.comments_before = comments_before;
          this.comments_after = comments_after;
          this.file = file;
          Object.seal(this);
        }
        // Return a string summary of the token for node.js console.log
        [Symbol.for("nodejs.util.inspect.custom")](_depth, options) {
          const special = (str) => options.stylize(str, "special");
          const quote = typeof this.value === "string" && this.value.includes("`") ? "'" : "`";
          const value2 = `${quote}${this.value}${quote}`;
          return `${special("[AST_Token")} ${value2} at ${this.line}:${this.col}${special("]")}`;
        }
        get nlb() {
          return has_tok_flag(this, TOK_FLAG_NLB);
        }
        set nlb(new_nlb) {
          set_tok_flag(this, TOK_FLAG_NLB, new_nlb);
        }
        get quote() {
          return !has_tok_flag(this, TOK_FLAG_QUOTE_EXISTS) ? "" : has_tok_flag(this, TOK_FLAG_QUOTE_SINGLE) ? "'" : '"';
        }
        set quote(quote_type) {
          set_tok_flag(this, TOK_FLAG_QUOTE_SINGLE, quote_type === "'");
          set_tok_flag(this, TOK_FLAG_QUOTE_EXISTS, !!quote_type);
        }
        get template_end() {
          return has_tok_flag(this, TOK_FLAG_TEMPLATE_END);
        }
        set template_end(new_template_end) {
          set_tok_flag(this, TOK_FLAG_TEMPLATE_END, new_template_end);
        }
      }
      var AST_Node = DEFNODE("Node", "start end", function AST_Node2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        _clone: function(deep) {
          if (deep) {
            var self3 = this.clone();
            return self3.transform(new TreeTransformer(function(node) {
              if (node !== self3) {
                return node.clone(true);
              }
            }));
          }
          return new this.CTOR(this);
        },
        clone: function(deep) {
          return this._clone(deep);
        },
        $documentation: "Base class of all AST nodes",
        $propdoc: {
          start: "[AST_Token] The first token of this node",
          end: "[AST_Token] The last token of this node"
        },
        _walk: function(visitor) {
          return visitor._visit(this);
        },
        walk: function(visitor) {
          return this._walk(visitor);
        },
        _children_backwards: () => {
        }
      }, null);
      var AST_Statement = DEFNODE("Statement", null, function AST_Statement2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class of all statements"
      });
      var AST_Debugger = DEFNODE("Debugger", null, function AST_Debugger2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Represents a debugger statement"
      }, AST_Statement);
      var AST_Directive = DEFNODE("Directive", "value quote", function AST_Directive2(props) {
        if (props) {
          this.value = props.value;
          this.quote = props.quote;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: 'Represents a directive, like "use strict";',
        $propdoc: {
          value: "[string] The value of this directive as a plain string (it's not an AST_String!)",
          quote: "[string] the original quote character"
        }
      }, AST_Statement);
      var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", function AST_SimpleStatement2(props) {
        if (props) {
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A statement consisting of an expression, i.e. a = 1 + 2",
        $propdoc: {
          body: "[AST_Node] an expression node (should not be instanceof AST_Statement)"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
        }
      }, AST_Statement);
      function walk_body(node, visitor) {
        const body = node.body;
        for (var i = 0, len = body.length; i < len; i++) {
          body[i]._walk(visitor);
        }
      }
      function clone_block_scope(deep) {
        var clone2 = this._clone(deep);
        if (this.block_scope) {
          clone2.block_scope = this.block_scope.clone();
        }
        return clone2;
      }
      var AST_Block = DEFNODE("Block", "body block_scope", function AST_Block2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A body of statements (usually braced)",
        $propdoc: {
          body: "[AST_Statement*] an array of statements",
          block_scope: "[AST_Scope] the block scope"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            walk_body(this, visitor);
          });
        },
        _children_backwards(push3) {
          let i = this.body.length;
          while (i--) push3(this.body[i]);
        },
        clone: clone_block_scope
      }, AST_Statement);
      var AST_BlockStatement = DEFNODE("BlockStatement", null, function AST_BlockStatement2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A block statement"
      }, AST_Block);
      var AST_EmptyStatement = DEFNODE("EmptyStatement", null, function AST_EmptyStatement2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The empty statement (empty block or simply a semicolon)"
      }, AST_Statement);
      var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", function AST_StatementWithBody2(props) {
        if (props) {
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`",
        $propdoc: {
          body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement"
        }
      }, AST_Statement);
      var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", function AST_LabeledStatement2(props) {
        if (props) {
          this.label = props.label;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Statement with a label",
        $propdoc: {
          label: "[AST_Label] a label definition"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.label._walk(visitor);
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
          push3(this.label);
        },
        clone: function(deep) {
          var node = this._clone(deep);
          if (deep) {
            var label = node.label;
            var def = this.label;
            node.walk(new TreeWalker(function(node2) {
              if (node2 instanceof AST_LoopControl && node2.label && node2.label.thedef === def) {
                node2.label.thedef = label;
                label.references.push(node2);
              }
            }));
          }
          return node;
        }
      }, AST_StatementWithBody);
      var AST_IterationStatement = DEFNODE(
        "IterationStatement",
        "block_scope",
        function AST_IterationStatement2(props) {
          if (props) {
            this.block_scope = props.block_scope;
            this.body = props.body;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "Internal class.  All loops inherit from it.",
          $propdoc: {
            block_scope: "[AST_Scope] the block scope for this iteration statement."
          },
          clone: clone_block_scope
        },
        AST_StatementWithBody
      );
      var AST_DWLoop = DEFNODE("DWLoop", "condition", function AST_DWLoop2(props) {
        if (props) {
          this.condition = props.condition;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for do/while statements",
        $propdoc: {
          condition: "[AST_Node] the loop condition.  Should not be instanceof AST_Statement"
        }
      }, AST_IterationStatement);
      var AST_Do = DEFNODE("Do", null, function AST_Do2(props) {
        if (props) {
          this.condition = props.condition;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `do` statement",
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.body._walk(visitor);
            this.condition._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.condition);
          push3(this.body);
        }
      }, AST_DWLoop);
      var AST_While = DEFNODE("While", null, function AST_While2(props) {
        if (props) {
          this.condition = props.condition;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `while` statement",
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.condition._walk(visitor);
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
          push3(this.condition);
        }
      }, AST_DWLoop);
      var AST_For = DEFNODE("For", "init condition step", function AST_For2(props) {
        if (props) {
          this.init = props.init;
          this.condition = props.condition;
          this.step = props.step;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `for` statement",
        $propdoc: {
          init: "[AST_Node?] the `for` initialization code, or null if empty",
          condition: "[AST_Node?] the `for` termination clause, or null if empty",
          step: "[AST_Node?] the `for` update clause, or null if empty"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            if (this.init) this.init._walk(visitor);
            if (this.condition) this.condition._walk(visitor);
            if (this.step) this.step._walk(visitor);
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
          if (this.step) push3(this.step);
          if (this.condition) push3(this.condition);
          if (this.init) push3(this.init);
        }
      }, AST_IterationStatement);
      var AST_ForIn = DEFNODE("ForIn", "init object", function AST_ForIn2(props) {
        if (props) {
          this.init = props.init;
          this.object = props.object;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `for ... in` statement",
        $propdoc: {
          init: "[AST_Node] the `for/in` initialization code",
          object: "[AST_Node] the object that we're looping through"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.init._walk(visitor);
            this.object._walk(visitor);
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
          if (this.object) push3(this.object);
          if (this.init) push3(this.init);
        }
      }, AST_IterationStatement);
      var AST_ForOf = DEFNODE("ForOf", "await", function AST_ForOf2(props) {
        if (props) {
          this.await = props.await;
          this.init = props.init;
          this.object = props.object;
          this.block_scope = props.block_scope;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `for ... of` statement"
      }, AST_ForIn);
      var AST_With = DEFNODE("With", "expression", function AST_With2(props) {
        if (props) {
          this.expression = props.expression;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `with` statement",
        $propdoc: {
          expression: "[AST_Node] the `with` expression"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
            this.body._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.body);
          push3(this.expression);
        }
      }, AST_StatementWithBody);
      var AST_Scope = DEFNODE(
        "Scope",
        "variables uses_with uses_eval parent_scope enclosed cname",
        function AST_Scope2(props) {
          if (props) {
            this.variables = props.variables;
            this.uses_with = props.uses_with;
            this.uses_eval = props.uses_eval;
            this.parent_scope = props.parent_scope;
            this.enclosed = props.enclosed;
            this.cname = props.cname;
            this.body = props.body;
            this.block_scope = props.block_scope;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "Base class for all statements introducing a lexical scope",
          $propdoc: {
            variables: "[Map/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
            uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
            uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
            parent_scope: "[AST_Scope?/S] link to the parent scope",
            enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
            cname: "[integer/S] current index for mangling variables (used internally by the mangler)"
          },
          get_defun_scope: function() {
            var self3 = this;
            while (self3.is_block_scope()) {
              self3 = self3.parent_scope;
            }
            return self3;
          },
          clone: function(deep, toplevel) {
            var node = this._clone(deep);
            if (deep && this.variables && toplevel && !this._block_scope) {
              node.figure_out_scope({}, {
                toplevel,
                parent_scope: this.parent_scope
              });
            } else {
              if (this.variables) node.variables = new Map(this.variables);
              if (this.enclosed) node.enclosed = this.enclosed.slice();
              if (this._block_scope) node._block_scope = this._block_scope;
            }
            return node;
          },
          pinned: function() {
            return this.uses_eval || this.uses_with;
          }
        },
        AST_Block
      );
      var AST_Toplevel = DEFNODE("Toplevel", "globals", function AST_Toplevel2(props) {
        if (props) {
          this.globals = props.globals;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The toplevel scope",
        $propdoc: {
          globals: "[Map/S] a map of name -> SymbolDef for all undeclared names"
        },
        wrap_commonjs: function(name) {
          var body = this.body;
          var wrapped_tl = "(function(exports){'$ORIG';})(typeof " + name + "=='undefined'?(" + name + "={}):" + name + ");";
          wrapped_tl = parse2(wrapped_tl);
          wrapped_tl = wrapped_tl.transform(new TreeTransformer(function(node) {
            if (node instanceof AST_Directive && node.value == "$ORIG") {
              return MAP.splice(body);
            }
          }));
          return wrapped_tl;
        },
        wrap_enclose: function(args_values) {
          if (typeof args_values != "string") args_values = "";
          var index6 = args_values.indexOf(":");
          if (index6 < 0) index6 = args_values.length;
          var body = this.body;
          return parse2([
            "(function(",
            args_values.slice(0, index6),
            '){"$ORIG"})(',
            args_values.slice(index6 + 1),
            ")"
          ].join("")).transform(new TreeTransformer(function(node) {
            if (node instanceof AST_Directive && node.value == "$ORIG") {
              return MAP.splice(body);
            }
          }));
        }
      }, AST_Scope);
      var AST_Expansion = DEFNODE("Expansion", "expression", function AST_Expansion2(props) {
        if (props) {
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An expandible argument, such as ...rest, a splat, such as [1,2,...all], or an expansion in a variable declaration, such as var [first, ...rest] = list",
        $propdoc: {
          expression: "[AST_Node] the thing to be expanded"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression.walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      });
      var AST_Lambda = DEFNODE(
        "Lambda",
        "name argnames uses_arguments is_generator async",
        function AST_Lambda2(props) {
          if (props) {
            this.name = props.name;
            this.argnames = props.argnames;
            this.uses_arguments = props.uses_arguments;
            this.is_generator = props.is_generator;
            this.async = props.async;
            this.variables = props.variables;
            this.uses_with = props.uses_with;
            this.uses_eval = props.uses_eval;
            this.parent_scope = props.parent_scope;
            this.enclosed = props.enclosed;
            this.cname = props.cname;
            this.body = props.body;
            this.block_scope = props.block_scope;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "Base class for functions",
          $propdoc: {
            name: "[AST_SymbolDeclaration?] the name of this function",
            argnames: "[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",
            uses_arguments: "[boolean/S] tells whether this function accesses the arguments array",
            is_generator: "[boolean] is this a generator method",
            async: "[boolean] is this method async"
          },
          args_as_names: function() {
            var out = [];
            for (var i = 0; i < this.argnames.length; i++) {
              if (this.argnames[i] instanceof AST_Destructuring) {
                out.push(...this.argnames[i].all_symbols());
              } else {
                out.push(this.argnames[i]);
              }
            }
            return out;
          },
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              if (this.name) this.name._walk(visitor);
              var argnames = this.argnames;
              for (var i = 0, len = argnames.length; i < len; i++) {
                argnames[i]._walk(visitor);
              }
              walk_body(this, visitor);
            });
          },
          _children_backwards(push3) {
            let i = this.body.length;
            while (i--) push3(this.body[i]);
            i = this.argnames.length;
            while (i--) push3(this.argnames[i]);
            if (this.name) push3(this.name);
          },
          is_braceless() {
            return this.body[0] instanceof AST_Return && this.body[0].value;
          },
          // Default args and expansion don't count, so .argnames.length doesn't cut it
          length_property() {
            let length = 0;
            for (const arg of this.argnames) {
              if (arg instanceof AST_SymbolFunarg || arg instanceof AST_Destructuring) {
                length++;
              }
            }
            return length;
          }
        },
        AST_Scope
      );
      var AST_Accessor = DEFNODE("Accessor", null, function AST_Accessor2(props) {
        if (props) {
          this.name = props.name;
          this.argnames = props.argnames;
          this.uses_arguments = props.uses_arguments;
          this.is_generator = props.is_generator;
          this.async = props.async;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A setter/getter function.  The `name` property is always null."
      }, AST_Lambda);
      var AST_Function = DEFNODE("Function", null, function AST_Function2(props) {
        if (props) {
          this.name = props.name;
          this.argnames = props.argnames;
          this.uses_arguments = props.uses_arguments;
          this.is_generator = props.is_generator;
          this.async = props.async;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A function expression"
      }, AST_Lambda);
      var AST_Arrow = DEFNODE("Arrow", null, function AST_Arrow2(props) {
        if (props) {
          this.name = props.name;
          this.argnames = props.argnames;
          this.uses_arguments = props.uses_arguments;
          this.is_generator = props.is_generator;
          this.async = props.async;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An ES6 Arrow function ((a) => b)"
      }, AST_Lambda);
      var AST_Defun = DEFNODE("Defun", null, function AST_Defun2(props) {
        if (props) {
          this.name = props.name;
          this.argnames = props.argnames;
          this.uses_arguments = props.uses_arguments;
          this.is_generator = props.is_generator;
          this.async = props.async;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A function definition"
      }, AST_Lambda);
      var AST_Destructuring = DEFNODE("Destructuring", "names is_array", function AST_Destructuring2(props) {
        if (props) {
          this.names = props.names;
          this.is_array = props.is_array;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A destructuring of several names. Used in destructuring assignment and with destructuring function argument names",
        $propdoc: {
          "names": "[AST_Node*] Array of properties or elements",
          "is_array": "[Boolean] Whether the destructuring represents an object or array"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.names.forEach(function(name) {
              name._walk(visitor);
            });
          });
        },
        _children_backwards(push3) {
          let i = this.names.length;
          while (i--) push3(this.names[i]);
        },
        all_symbols: function() {
          var out = [];
          walk(this, (node) => {
            if (node instanceof AST_SymbolDeclaration) {
              out.push(node);
            }
            if (node instanceof AST_Lambda) {
              return true;
            }
          });
          return out;
        }
      });
      var AST_PrefixedTemplateString = DEFNODE(
        "PrefixedTemplateString",
        "template_string prefix",
        function AST_PrefixedTemplateString2(props) {
          if (props) {
            this.template_string = props.template_string;
            this.prefix = props.prefix;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "A templatestring with a prefix, such as String.raw`foobarbaz`",
          $propdoc: {
            template_string: "[AST_TemplateString] The template string",
            prefix: "[AST_Node] The prefix, which will get called."
          },
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              this.prefix._walk(visitor);
              this.template_string._walk(visitor);
            });
          },
          _children_backwards(push3) {
            push3(this.template_string);
            push3(this.prefix);
          }
        }
      );
      var AST_TemplateString = DEFNODE("TemplateString", "segments", function AST_TemplateString2(props) {
        if (props) {
          this.segments = props.segments;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A template string literal",
        $propdoc: {
          segments: "[AST_Node*] One or more segments, starting with AST_TemplateSegment. AST_Node may follow AST_TemplateSegment, but each AST_Node must be followed by AST_TemplateSegment."
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.segments.forEach(function(seg) {
              seg._walk(visitor);
            });
          });
        },
        _children_backwards(push3) {
          let i = this.segments.length;
          while (i--) push3(this.segments[i]);
        }
      });
      var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", function AST_TemplateSegment2(props) {
        if (props) {
          this.value = props.value;
          this.raw = props.raw;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A segment of a template string literal",
        $propdoc: {
          value: "Content of the segment",
          raw: "Raw source of the segment"
        }
      });
      var AST_Jump = DEFNODE("Jump", null, function AST_Jump2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for \u201Cjumps\u201D (for now that's `return`, `throw`, `break` and `continue`)"
      }, AST_Statement);
      var AST_Exit = DEFNODE("Exit", "value", function AST_Exit2(props) {
        if (props) {
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for \u201Cexits\u201D (`return` and `throw`)",
        $propdoc: {
          value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"
        },
        _walk: function(visitor) {
          return visitor._visit(this, this.value && function() {
            this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.value) push3(this.value);
        }
      }, AST_Jump);
      var AST_Return = DEFNODE("Return", null, function AST_Return2(props) {
        if (props) {
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `return` statement"
      }, AST_Exit);
      var AST_Throw = DEFNODE("Throw", null, function AST_Throw2(props) {
        if (props) {
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `throw` statement"
      }, AST_Exit);
      var AST_LoopControl = DEFNODE("LoopControl", "label", function AST_LoopControl2(props) {
        if (props) {
          this.label = props.label;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for loop control statements (`break` and `continue`)",
        $propdoc: {
          label: "[AST_LabelRef?] the label, or null if none"
        },
        _walk: function(visitor) {
          return visitor._visit(this, this.label && function() {
            this.label._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.label) push3(this.label);
        }
      }, AST_Jump);
      var AST_Break = DEFNODE("Break", null, function AST_Break2(props) {
        if (props) {
          this.label = props.label;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `break` statement"
      }, AST_LoopControl);
      var AST_Continue = DEFNODE("Continue", null, function AST_Continue2(props) {
        if (props) {
          this.label = props.label;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `continue` statement"
      }, AST_LoopControl);
      var AST_Await = DEFNODE("Await", "expression", function AST_Await2(props) {
        if (props) {
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An `await` statement",
        $propdoc: {
          expression: "[AST_Node] the mandatory expression being awaited"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      });
      var AST_Yield = DEFNODE("Yield", "expression is_star", function AST_Yield2(props) {
        if (props) {
          this.expression = props.expression;
          this.is_star = props.is_star;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `yield` statement",
        $propdoc: {
          expression: "[AST_Node?] the value returned or thrown by this statement; could be null (representing undefined) but only when is_star is set to false",
          is_star: "[Boolean] Whether this is a yield or yield* statement"
        },
        _walk: function(visitor) {
          return visitor._visit(this, this.expression && function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.expression) push3(this.expression);
        }
      });
      var AST_If = DEFNODE("If", "condition alternative", function AST_If2(props) {
        if (props) {
          this.condition = props.condition;
          this.alternative = props.alternative;
          this.body = props.body;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `if` statement",
        $propdoc: {
          condition: "[AST_Node] the `if` condition",
          alternative: "[AST_Statement?] the `else` part, or null if not present"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.condition._walk(visitor);
            this.body._walk(visitor);
            if (this.alternative) this.alternative._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.alternative) {
            push3(this.alternative);
          }
          push3(this.body);
          push3(this.condition);
        }
      }, AST_StatementWithBody);
      var AST_Switch = DEFNODE("Switch", "expression", function AST_Switch2(props) {
        if (props) {
          this.expression = props.expression;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `switch` statement",
        $propdoc: {
          expression: "[AST_Node] the `switch` \u201Cdiscriminant\u201D"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
            walk_body(this, visitor);
          });
        },
        _children_backwards(push3) {
          let i = this.body.length;
          while (i--) push3(this.body[i]);
          push3(this.expression);
        }
      }, AST_Block);
      var AST_SwitchBranch = DEFNODE("SwitchBranch", null, function AST_SwitchBranch2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for `switch` branches"
      }, AST_Block);
      var AST_Default = DEFNODE("Default", null, function AST_Default2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `default` switch branch"
      }, AST_SwitchBranch);
      var AST_Case = DEFNODE("Case", "expression", function AST_Case2(props) {
        if (props) {
          this.expression = props.expression;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `case` switch branch",
        $propdoc: {
          expression: "[AST_Node] the `case` expression"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
            walk_body(this, visitor);
          });
        },
        _children_backwards(push3) {
          let i = this.body.length;
          while (i--) push3(this.body[i]);
          push3(this.expression);
        }
      }, AST_SwitchBranch);
      var AST_Try = DEFNODE("Try", "body bcatch bfinally", function AST_Try2(props) {
        if (props) {
          this.body = props.body;
          this.bcatch = props.bcatch;
          this.bfinally = props.bfinally;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `try` statement",
        $propdoc: {
          body: "[AST_TryBlock] the try block",
          bcatch: "[AST_Catch?] the catch block, or null if not present",
          bfinally: "[AST_Finally?] the finally block, or null if not present"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.body._walk(visitor);
            if (this.bcatch) this.bcatch._walk(visitor);
            if (this.bfinally) this.bfinally._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.bfinally) push3(this.bfinally);
          if (this.bcatch) push3(this.bcatch);
          push3(this.body);
        }
      }, AST_Statement);
      var AST_TryBlock = DEFNODE("TryBlock", null, function AST_TryBlock2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `try` block of a try statement"
      }, AST_Block);
      var AST_Catch = DEFNODE("Catch", "argname", function AST_Catch2(props) {
        if (props) {
          this.argname = props.argname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `catch` node; only makes sense as part of a `try` statement",
        $propdoc: {
          argname: "[AST_SymbolCatch|AST_Destructuring|AST_Expansion|AST_DefaultAssign] symbol for the exception"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            if (this.argname) this.argname._walk(visitor);
            walk_body(this, visitor);
          });
        },
        _children_backwards(push3) {
          let i = this.body.length;
          while (i--) push3(this.body[i]);
          if (this.argname) push3(this.argname);
        }
      }, AST_Block);
      var AST_Finally = DEFNODE("Finally", null, function AST_Finally2(props) {
        if (props) {
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `finally` node; only makes sense as part of a `try` statement"
      }, AST_Block);
      var AST_DefinitionsLike = DEFNODE("DefinitionsLike", "definitions", function AST_DefinitionsLike2(props) {
        if (props) {
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for variable definitions and `using`",
        $propdoc: {
          definitions: "[AST_VarDef*|AST_UsingDef*] array of variable definitions"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            var definitions = this.definitions;
            for (var i = 0, len = definitions.length; i < len; i++) {
              definitions[i]._walk(visitor);
            }
          });
        },
        _children_backwards(push3) {
          let i = this.definitions.length;
          while (i--) push3(this.definitions[i]);
        }
      }, AST_Statement);
      var AST_Definitions = DEFNODE("Definitions", null, function AST_Definitions2(props) {
        if (props) {
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)"
      }, AST_DefinitionsLike);
      var AST_Var = DEFNODE("Var", null, function AST_Var2(props) {
        if (props) {
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `var` statement"
      }, AST_Definitions);
      var AST_Let = DEFNODE("Let", null, function AST_Let2(props) {
        if (props) {
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `let` statement"
      }, AST_Definitions);
      var AST_Const = DEFNODE("Const", null, function AST_Const2(props) {
        if (props) {
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `const` statement"
      }, AST_Definitions);
      var AST_Using = DEFNODE("Using", "await", function AST_Using2(props) {
        if (props) {
          this.await = props.await;
          this.definitions = props.definitions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `using` statement",
        $propdoc: {
          await: "[boolean] Whether it's `await using`"
        }
      }, AST_DefinitionsLike);
      var AST_VarDefLike = DEFNODE("VarDefLike", "name value", function AST_VarDefLike2(props) {
        if (props) {
          this.name = props.name;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A name=value pair in a variable definition statement or `using`",
        $propdoc: {
          name: "[AST_Destructuring|AST_SymbolDeclaration] name of the variable",
          value: "[AST_Node?] initializer, or null of there's no initializer"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.name._walk(visitor);
            if (this.value) this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.value) push3(this.value);
          push3(this.name);
        },
        declarations_as_names() {
          if (this.name instanceof AST_SymbolDeclaration) {
            return [this.name];
          } else {
            return this.name.all_symbols();
          }
        }
      });
      var AST_VarDef = DEFNODE("VarDef", null, function AST_VarDef2(props) {
        if (props) {
          this.name = props.name;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A variable declaration; only appears in a AST_Definitions node"
      }, AST_VarDefLike);
      var AST_UsingDef = DEFNODE("UsingDef", null, function AST_UsingDef2(props) {
        if (props) {
          this.name = props.name;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Like VarDef but specific to AST_Using"
      }, AST_VarDefLike);
      var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", function AST_NameMapping2(props) {
        if (props) {
          this.foreign_name = props.foreign_name;
          this.name = props.name;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The part of the export/import statement that declare names from a module.",
        $propdoc: {
          foreign_name: "[AST_SymbolExportForeign|AST_SymbolImportForeign] The name being exported/imported (as specified in the module)",
          name: "[AST_SymbolExport|AST_SymbolImport] The name as it is visible to this module."
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.foreign_name._walk(visitor);
            this.name._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.name);
          push3(this.foreign_name);
        }
      });
      var AST_Import = DEFNODE(
        "Import",
        "imported_name imported_names module_name attributes",
        function AST_Import2(props) {
          if (props) {
            this.imported_name = props.imported_name;
            this.imported_names = props.imported_names;
            this.module_name = props.module_name;
            this.attributes = props.attributes;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "An `import` statement",
          $propdoc: {
            imported_name: "[AST_SymbolImport] The name of the variable holding the module's default export.",
            imported_names: "[AST_NameMapping*] The names of non-default imported variables",
            module_name: "[AST_String] String literal describing where this module came from",
            attributes: "[AST_Object?] The import attributes (with {...})"
          },
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              if (this.imported_name) {
                this.imported_name._walk(visitor);
              }
              if (this.imported_names) {
                this.imported_names.forEach(function(name_import) {
                  name_import._walk(visitor);
                });
              }
              this.module_name._walk(visitor);
            });
          },
          _children_backwards(push3) {
            push3(this.module_name);
            if (this.imported_names) {
              let i = this.imported_names.length;
              while (i--) push3(this.imported_names[i]);
            }
            if (this.imported_name) push3(this.imported_name);
          }
        }
      );
      var AST_ImportMeta = DEFNODE("ImportMeta", null, function AST_ImportMeta2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A reference to import.meta"
      });
      var AST_Export = DEFNODE(
        "Export",
        "exported_definition exported_value is_default exported_names module_name attributes",
        function AST_Export2(props) {
          if (props) {
            this.exported_definition = props.exported_definition;
            this.exported_value = props.exported_value;
            this.is_default = props.is_default;
            this.exported_names = props.exported_names;
            this.module_name = props.module_name;
            this.attributes = props.attributes;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "An `export` statement",
          $propdoc: {
            exported_definition: "[AST_Defun|AST_Definitions|AST_DefClass?] An exported definition",
            exported_value: "[AST_Node?] An exported value",
            exported_names: "[AST_NameMapping*?] List of exported names",
            module_name: "[AST_String?] Name of the file to load exports from",
            is_default: "[Boolean] Whether this is the default exported value of this module",
            attributes: "[AST_Object?] The import attributes"
          },
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              if (this.exported_definition) {
                this.exported_definition._walk(visitor);
              }
              if (this.exported_value) {
                this.exported_value._walk(visitor);
              }
              if (this.exported_names) {
                this.exported_names.forEach(function(name_export) {
                  name_export._walk(visitor);
                });
              }
              if (this.module_name) {
                this.module_name._walk(visitor);
              }
            });
          },
          _children_backwards(push3) {
            if (this.module_name) push3(this.module_name);
            if (this.exported_names) {
              let i = this.exported_names.length;
              while (i--) push3(this.exported_names[i]);
            }
            if (this.exported_value) push3(this.exported_value);
            if (this.exported_definition) push3(this.exported_definition);
          }
        },
        AST_Statement
      );
      var AST_Call = DEFNODE(
        "Call",
        "expression args optional _annotations",
        function AST_Call2(props) {
          if (props) {
            this.expression = props.expression;
            this.args = props.args;
            this.optional = props.optional;
            this._annotations = props._annotations;
            this.start = props.start;
            this.end = props.end;
            this.initialize();
          }
          this.flags = 0;
        },
        {
          $documentation: "A function call expression",
          $propdoc: {
            expression: "[AST_Node] expression to invoke as function",
            args: "[AST_Node*] array of arguments",
            optional: "[boolean] whether this is an optional call (IE ?.() )",
            _annotations: "[number] bitfield containing information about the call"
          },
          initialize() {
            if (this._annotations == null) this._annotations = 0;
          },
          _walk(visitor) {
            return visitor._visit(this, function() {
              var args = this.args;
              for (var i = 0, len = args.length; i < len; i++) {
                args[i]._walk(visitor);
              }
              this.expression._walk(visitor);
            });
          },
          _children_backwards(push3) {
            let i = this.args.length;
            while (i--) push3(this.args[i]);
            push3(this.expression);
          }
        }
      );
      var AST_New = DEFNODE("New", null, function AST_New2(props) {
        if (props) {
          this.expression = props.expression;
          this.args = props.args;
          this.optional = props.optional;
          this._annotations = props._annotations;
          this.start = props.start;
          this.end = props.end;
          this.initialize();
        }
        this.flags = 0;
      }, {
        $documentation: "An object instantiation.  Derives from a function call since it has exactly the same properties"
      }, AST_Call);
      var AST_Sequence = DEFNODE("Sequence", "expressions", function AST_Sequence2(props) {
        if (props) {
          this.expressions = props.expressions;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A sequence expression (comma-separated expressions)",
        $propdoc: {
          expressions: "[AST_Node*] array of expressions (at least two)"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expressions.forEach(function(node) {
              node._walk(visitor);
            });
          });
        },
        _children_backwards(push3) {
          let i = this.expressions.length;
          while (i--) push3(this.expressions[i]);
        }
      });
      var AST_PropAccess = DEFNODE(
        "PropAccess",
        "expression property optional",
        function AST_PropAccess2(props) {
          if (props) {
            this.expression = props.expression;
            this.property = props.property;
            this.optional = props.optional;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: 'Base class for property access expressions, i.e. `a.foo` or `a["foo"]`',
          $propdoc: {
            expression: "[AST_Node] the \u201Ccontainer\u201D expression",
            property: "[AST_Node|string] the property to access.  For AST_Dot & AST_DotHash this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",
            optional: "[boolean] whether this is an optional property access (IE ?.)"
          }
        }
      );
      var AST_Dot = DEFNODE("Dot", "quote", function AST_Dot2(props) {
        if (props) {
          this.quote = props.quote;
          this.expression = props.expression;
          this.property = props.property;
          this.optional = props.optional;
          this._annotations = props._annotations;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A dotted property access expression",
        $propdoc: {
          quote: "[string] the original quote character when transformed from AST_Sub"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      }, AST_PropAccess);
      var AST_DotHash = DEFNODE("DotHash", "", function AST_DotHash2(props) {
        if (props) {
          this.expression = props.expression;
          this.property = props.property;
          this.optional = props.optional;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A dotted property access to a private property",
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      }, AST_PropAccess);
      var AST_Sub = DEFNODE("Sub", null, function AST_Sub2(props) {
        if (props) {
          this.expression = props.expression;
          this.property = props.property;
          this.optional = props.optional;
          this._annotations = props._annotations;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: 'Index-style property access, i.e. `a["foo"]`',
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
            this.property._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.property);
          push3(this.expression);
        }
      }, AST_PropAccess);
      var AST_Chain = DEFNODE("Chain", "expression", function AST_Chain2(props) {
        if (props) {
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A chain expression like a?.b?.(c)?.[d]",
        $propdoc: {
          expression: "[AST_Call|AST_Dot|AST_DotHash|AST_Sub] chain element."
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      });
      var AST_Unary = DEFNODE("Unary", "operator expression", function AST_Unary2(props) {
        if (props) {
          this.operator = props.operator;
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for unary expressions",
        $propdoc: {
          operator: "[string] the operator",
          expression: "[AST_Node] expression that this unary operator applies to"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.expression._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.expression);
        }
      });
      var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, function AST_UnaryPrefix2(props) {
        if (props) {
          this.operator = props.operator;
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Unary prefix expression, i.e. `typeof i` or `++i`"
      }, AST_Unary);
      var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, function AST_UnaryPostfix2(props) {
        if (props) {
          this.operator = props.operator;
          this.expression = props.expression;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Unary postfix expression, i.e. `i++`"
      }, AST_Unary);
      var AST_Binary = DEFNODE("Binary", "operator left right", function AST_Binary2(props) {
        if (props) {
          this.operator = props.operator;
          this.left = props.left;
          this.right = props.right;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Binary expression, i.e. `a + b`",
        $propdoc: {
          left: "[AST_Node] left-hand side expression",
          operator: "[string] the operator",
          right: "[AST_Node] right-hand side expression"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.left._walk(visitor);
            this.right._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.right);
          push3(this.left);
        }
      });
      var AST_Conditional = DEFNODE(
        "Conditional",
        "condition consequent alternative",
        function AST_Conditional2(props) {
          if (props) {
            this.condition = props.condition;
            this.consequent = props.consequent;
            this.alternative = props.alternative;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`",
          $propdoc: {
            condition: "[AST_Node]",
            consequent: "[AST_Node]",
            alternative: "[AST_Node]"
          },
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              this.condition._walk(visitor);
              this.consequent._walk(visitor);
              this.alternative._walk(visitor);
            });
          },
          _children_backwards(push3) {
            push3(this.alternative);
            push3(this.consequent);
            push3(this.condition);
          }
        }
      );
      var AST_Assign = DEFNODE("Assign", "logical", function AST_Assign2(props) {
        if (props) {
          this.logical = props.logical;
          this.operator = props.operator;
          this.left = props.left;
          this.right = props.right;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An assignment expression \u2014 `a = b + 5`",
        $propdoc: {
          logical: "Whether it's a logical assignment"
        }
      }, AST_Binary);
      var AST_DefaultAssign = DEFNODE("DefaultAssign", null, function AST_DefaultAssign2(props) {
        if (props) {
          this.operator = props.operator;
          this.left = props.left;
          this.right = props.right;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A default assignment expression like in `(a = 3) => a`"
      }, AST_Binary);
      var AST_Array = DEFNODE("Array", "elements", function AST_Array2(props) {
        if (props) {
          this.elements = props.elements;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An array literal",
        $propdoc: {
          elements: "[AST_Node*] array of elements"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            var elements = this.elements;
            for (var i = 0, len = elements.length; i < len; i++) {
              elements[i]._walk(visitor);
            }
          });
        },
        _children_backwards(push3) {
          let i = this.elements.length;
          while (i--) push3(this.elements[i]);
        }
      });
      var AST_Object = DEFNODE("Object", "properties", function AST_Object2(props) {
        if (props) {
          this.properties = props.properties;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An object literal",
        $propdoc: {
          properties: "[AST_ObjectProperty*] array of properties"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            var properties = this.properties;
            for (var i = 0, len = properties.length; i < len; i++) {
              properties[i]._walk(visitor);
            }
          });
        },
        _children_backwards(push3) {
          let i = this.properties.length;
          while (i--) push3(this.properties[i]);
        }
      });
      var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_ObjectProperty2(props) {
        if (props) {
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for literal object properties",
        $propdoc: {
          key: "[string|AST_Node] property name. For ObjectKeyVal this is a string. For getters, setters and computed property this is an AST_Node.",
          value: "[AST_Node] property value.  For getters, setters and methods this is an AST_Accessor."
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            if (this.key instanceof AST_Node)
              this.key._walk(visitor);
            this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.value);
          if (this.key instanceof AST_Node) push3(this.key);
        }
      });
      var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", function AST_ObjectKeyVal2(props) {
        if (props) {
          this.quote = props.quote;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $documentation: "A key: value object property",
        $propdoc: {
          quote: "[string] the original quote character"
        },
        computed_key() {
          return this.key instanceof AST_Node;
        }
      }, AST_ObjectProperty);
      var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", function AST_PrivateSetter2(props) {
        if (props) {
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          static: "[boolean] whether this is a static private setter"
        },
        $documentation: "A private setter property",
        computed_key() {
          return false;
        }
      }, AST_ObjectProperty);
      var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", function AST_PrivateGetter2(props) {
        if (props) {
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          static: "[boolean] whether this is a static private getter"
        },
        $documentation: "A private getter property",
        computed_key() {
          return false;
        }
      }, AST_ObjectProperty);
      var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", function AST_ObjectSetter2(props) {
        if (props) {
          this.quote = props.quote;
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          quote: "[string|undefined] the original quote character, if any",
          static: "[boolean] whether this is a static setter (classes only)"
        },
        $documentation: "An object setter property",
        computed_key() {
          return !(this.key instanceof AST_SymbolMethod);
        }
      }, AST_ObjectProperty);
      var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_ObjectGetter2(props) {
        if (props) {
          this.quote = props.quote;
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          quote: "[string|undefined] the original quote character, if any",
          static: "[boolean] whether this is a static getter (classes only)"
        },
        $documentation: "An object getter property",
        computed_key() {
          return !(this.key instanceof AST_SymbolMethod);
        }
      }, AST_ObjectProperty);
      var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static", function AST_ConciseMethod2(props) {
        if (props) {
          this.quote = props.quote;
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          quote: "[string|undefined] the original quote character, if any",
          static: "[boolean] is this method static (classes only)"
        },
        $documentation: "An ES6 concise method inside an object or class",
        computed_key() {
          return !(this.key instanceof AST_SymbolMethod);
        }
      }, AST_ObjectProperty);
      var AST_PrivateMethod = DEFNODE("PrivateMethod", "static", function AST_PrivateMethod2(props) {
        if (props) {
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A private class method inside a class",
        $propdoc: {
          static: "[boolean] is this a static private method"
        },
        computed_key() {
          return false;
        }
      }, AST_ObjectProperty);
      var AST_Class = DEFNODE(
        "Class",
        "name extends properties",
        function AST_Class2(props) {
          if (props) {
            this.name = props.name;
            this.extends = props.extends;
            this.properties = props.properties;
            this.variables = props.variables;
            this.uses_with = props.uses_with;
            this.uses_eval = props.uses_eval;
            this.parent_scope = props.parent_scope;
            this.enclosed = props.enclosed;
            this.cname = props.cname;
            this.body = props.body;
            this.block_scope = props.block_scope;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $propdoc: {
            name: "[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",
            extends: "[AST_Node]? optional parent class",
            properties: "[AST_ObjectProperty|AST_ClassStaticBlock]* array of properties or static blocks"
          },
          $documentation: "An ES6 class",
          _walk: function(visitor) {
            return visitor._visit(this, function() {
              if (this.name) {
                this.name._walk(visitor);
              }
              if (this.extends) {
                this.extends._walk(visitor);
              }
              this.properties.forEach((prop2) => prop2._walk(visitor));
            });
          },
          _children_backwards(push3) {
            let i = this.properties.length;
            while (i--) push3(this.properties[i]);
            if (this.extends) push3(this.extends);
            if (this.name) push3(this.name);
          },
          /** go through the bits that are executed instantly, not when the class is `new`'d. Doesn't walk the name. */
          visit_nondeferred_class_parts(visitor) {
            if (this.extends) {
              this.extends._walk(visitor);
            }
            this.properties.forEach((prop2) => {
              if (prop2 instanceof AST_ClassStaticBlock) {
                prop2._walk(visitor);
                return;
              }
              if (prop2.computed_key()) {
                visitor.push(prop2);
                prop2.key._walk(visitor);
                visitor.pop();
              }
              if (prop2 instanceof AST_ClassPrivateProperty && prop2.static && prop2.value || prop2 instanceof AST_ClassProperty && prop2.static && prop2.value) {
                visitor.push(prop2);
                prop2.value._walk(visitor);
                visitor.pop();
              }
            });
          },
          /** go through the bits that are executed later, when the class is `new`'d or a static method is called */
          visit_deferred_class_parts(visitor) {
            this.properties.forEach((prop2) => {
              if (prop2 instanceof AST_ConciseMethod || prop2 instanceof AST_PrivateMethod) {
                prop2.walk(visitor);
              } else if (prop2 instanceof AST_ClassProperty && !prop2.static && prop2.value || prop2 instanceof AST_ClassPrivateProperty && !prop2.static && prop2.value) {
                visitor.push(prop2);
                prop2.value._walk(visitor);
                visitor.pop();
              }
            });
          },
          is_self_referential: function() {
            const this_id = this.name && this.name.definition().id;
            let found = false;
            let class_this = true;
            this.visit_nondeferred_class_parts(new TreeWalker((node, descend) => {
              if (found) return true;
              if (node instanceof AST_This) return found = class_this;
              if (node instanceof AST_SymbolRef) return found = node.definition().id === this_id;
              if (node instanceof AST_Lambda && !(node instanceof AST_Arrow)) {
                const class_this_save = class_this;
                class_this = false;
                descend();
                class_this = class_this_save;
                return true;
              }
            }));
            return found;
          }
        },
        AST_Scope
        /* TODO a class might have a scope but it's not a scope */
      );
      var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_ClassProperty2(props) {
        if (props) {
          this.static = props.static;
          this.quote = props.quote;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $documentation: "A class property",
        $propdoc: {
          static: "[boolean] whether this is a static key",
          quote: "[string] which quote is being used"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            if (this.key instanceof AST_Node)
              this.key._walk(visitor);
            if (this.value instanceof AST_Node)
              this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.value instanceof AST_Node) push3(this.value);
          if (this.key instanceof AST_Node) push3(this.key);
        },
        computed_key() {
          return !(this.key instanceof AST_SymbolClassProperty);
        }
      }, AST_ObjectProperty);
      var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", function AST_ClassPrivateProperty2(props) {
        if (props) {
          this.static = props.static;
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A class property for a private property",
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            if (this.value instanceof AST_Node)
              this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          if (this.value instanceof AST_Node) push3(this.value);
        },
        computed_key() {
          return false;
        }
      }, AST_ObjectProperty);
      var AST_PrivateIn = DEFNODE("PrivateIn", "key value", function AST_PrivateIn2(props) {
        if (props) {
          this.key = props.key;
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "An `in` binop when the key is private, eg #x in this",
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            this.key._walk(visitor);
            this.value._walk(visitor);
          });
        },
        _children_backwards(push3) {
          push3(this.value);
          push3(this.key);
        }
      });
      var AST_DefClass = DEFNODE("DefClass", null, function AST_DefClass2(props) {
        if (props) {
          this.name = props.name;
          this.extends = props.extends;
          this.properties = props.properties;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A class definition"
      }, AST_Class);
      var AST_ClassStaticBlock = DEFNODE("ClassStaticBlock", "body block_scope", function AST_ClassStaticBlock2(props) {
        this.body = props.body;
        this.block_scope = props.block_scope;
        this.start = props.start;
        this.end = props.end;
      }, {
        $documentation: "A block containing statements to be executed in the context of the class",
        $propdoc: {
          body: "[AST_Statement*] an array of statements"
        },
        _walk: function(visitor) {
          return visitor._visit(this, function() {
            walk_body(this, visitor);
          });
        },
        _children_backwards(push3) {
          let i = this.body.length;
          while (i--) push3(this.body[i]);
        },
        clone: clone_block_scope,
        computed_key() {
          return false;
        }
      }, AST_Scope);
      var AST_ClassExpression = DEFNODE("ClassExpression", null, function AST_ClassExpression2(props) {
        if (props) {
          this.name = props.name;
          this.extends = props.extends;
          this.properties = props.properties;
          this.variables = props.variables;
          this.uses_with = props.uses_with;
          this.uses_eval = props.uses_eval;
          this.parent_scope = props.parent_scope;
          this.enclosed = props.enclosed;
          this.cname = props.cname;
          this.body = props.body;
          this.block_scope = props.block_scope;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A class expression."
      }, AST_Class);
      var AST_Symbol = DEFNODE("Symbol", "scope name thedef", function AST_Symbol2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $propdoc: {
          name: "[string] name of this symbol",
          scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)",
          thedef: "[SymbolDef/S] the definition of this symbol"
        },
        $documentation: "Base class for all symbols"
      });
      var AST_NewTarget = DEFNODE("NewTarget", null, function AST_NewTarget2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A reference to new.target"
      });
      var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", function AST_SymbolDeclaration2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)"
      }, AST_Symbol);
      var AST_SymbolVar = DEFNODE("SymbolVar", null, function AST_SymbolVar2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol defining a variable"
      }, AST_SymbolDeclaration);
      var AST_SymbolBlockDeclaration = DEFNODE(
        "SymbolBlockDeclaration",
        null,
        function AST_SymbolBlockDeclaration2(props) {
          if (props) {
            this.init = props.init;
            this.scope = props.scope;
            this.name = props.name;
            this.thedef = props.thedef;
            this.start = props.start;
            this.end = props.end;
          }
          this.flags = 0;
        },
        {
          $documentation: "Base class for block-scoped declaration symbols"
        },
        AST_SymbolDeclaration
      );
      var AST_SymbolConst = DEFNODE("SymbolConst", null, function AST_SymbolConst2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A constant declaration"
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolUsing = DEFNODE("SymbolUsing", null, function AST_SymbolUsing2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A `using` declaration"
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolLet = DEFNODE("SymbolLet", null, function AST_SymbolLet2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A block-scoped `let` declaration"
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, function AST_SymbolFunarg2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming a function argument"
      }, AST_SymbolVar);
      var AST_SymbolDefun = DEFNODE("SymbolDefun", null, function AST_SymbolDefun2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol defining a function"
      }, AST_SymbolDeclaration);
      var AST_SymbolMethod = DEFNODE("SymbolMethod", null, function AST_SymbolMethod2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol in an object defining a method"
      }, AST_Symbol);
      var AST_SymbolClassProperty = DEFNODE("SymbolClassProperty", null, function AST_SymbolClassProperty2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol for a class property"
      }, AST_Symbol);
      var AST_SymbolLambda = DEFNODE("SymbolLambda", null, function AST_SymbolLambda2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming a function expression"
      }, AST_SymbolDeclaration);
      var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, function AST_SymbolDefClass2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming a class's name in a class declaration. Lexically scoped to its containing scope, and accessible within the class."
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolClass = DEFNODE("SymbolClass", null, function AST_SymbolClass2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming a class's name. Lexically scoped to the class."
      }, AST_SymbolDeclaration);
      var AST_SymbolCatch = DEFNODE("SymbolCatch", null, function AST_SymbolCatch2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming the exception in catch"
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolImport = DEFNODE("SymbolImport", null, function AST_SymbolImport2(props) {
        if (props) {
          this.init = props.init;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol referring to an imported name"
      }, AST_SymbolBlockDeclaration);
      var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", "quote", function AST_SymbolImportForeign2(props) {
        if (props) {
          this.quote = props.quote;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A symbol imported from a module, but it is defined in the other module, and its real name is irrelevant for this module's purposes"
      }, AST_Symbol);
      var AST_Label = DEFNODE("Label", "references", function AST_Label2(props) {
        if (props) {
          this.references = props.references;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
          this.initialize();
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol naming a label (declaration)",
        $propdoc: {
          references: "[AST_LoopControl*] a list of nodes referring to this label"
        },
        initialize: function() {
          this.references = [];
          this.thedef = this;
        }
      }, AST_Symbol);
      var AST_SymbolRef = DEFNODE("SymbolRef", null, function AST_SymbolRef2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Reference to some symbol (not definition/declaration)"
      }, AST_Symbol);
      var AST_SymbolExport = DEFNODE("SymbolExport", "quote", function AST_SymbolExport2(props) {
        if (props) {
          this.quote = props.quote;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Symbol referring to a name to export"
      }, AST_SymbolRef);
      var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", "quote", function AST_SymbolExportForeign2(props) {
        if (props) {
          this.quote = props.quote;
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A symbol exported from this module, but it is used in the other module, and its real name is irrelevant for this module's purposes"
      }, AST_Symbol);
      var AST_LabelRef = DEFNODE("LabelRef", null, function AST_LabelRef2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Reference to a label symbol"
      }, AST_Symbol);
      var AST_SymbolPrivateProperty = DEFNODE("SymbolPrivateProperty", null, function AST_SymbolPrivateProperty2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A symbol that refers to a private property"
      }, AST_Symbol);
      var AST_This = DEFNODE("This", null, function AST_This2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `this` symbol"
      }, AST_Symbol);
      var AST_Super = DEFNODE("Super", null, function AST_Super2(props) {
        if (props) {
          this.scope = props.scope;
          this.name = props.name;
          this.thedef = props.thedef;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `super` symbol"
      }, AST_This);
      var AST_Constant = DEFNODE("Constant", null, function AST_Constant2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for all constants",
        getValue: function() {
          return this.value;
        }
      });
      var AST_String = DEFNODE("String", "value quote", function AST_String2(props) {
        if (props) {
          this.value = props.value;
          this.quote = props.quote;
          this.start = props.start;
          this.end = props.end;
          this._annotations = props._annotations;
        }
        this.flags = 0;
      }, {
        $documentation: "A string literal",
        $propdoc: {
          value: "[string] the contents of this string",
          quote: "[string] the original quote character"
        }
      }, AST_Constant);
      var AST_Number = DEFNODE("Number", "value raw", function AST_Number2(props) {
        if (props) {
          this.value = props.value;
          this.raw = props.raw;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A number literal",
        $propdoc: {
          value: "[number] the numeric value",
          raw: "[string] numeric value as string"
        }
      }, AST_Constant);
      var AST_BigInt = DEFNODE("BigInt", "value raw", function AST_BigInt2(props) {
        if (props) {
          this.value = props.value;
          this.raw = props.raw;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A big int literal",
        $propdoc: {
          value: "[string] big int value, represented as a string",
          raw: "[string] the original format preserved"
        }
      }, AST_Constant);
      var AST_RegExp = DEFNODE("RegExp", "value", function AST_RegExp2(props) {
        if (props) {
          this.value = props.value;
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A regexp literal",
        $propdoc: {
          value: "[RegExp] the actual regexp"
        }
      }, AST_Constant);
      var AST_Atom = DEFNODE("Atom", null, function AST_Atom2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for atoms"
      }, AST_Constant);
      var AST_Null = DEFNODE("Null", null, function AST_Null2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `null` atom",
        value: null
      }, AST_Atom);
      var AST_NaN = DEFNODE("NaN", null, function AST_NaN2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The impossible value",
        value: 0 / 0
      }, AST_Atom);
      var AST_Undefined = DEFNODE("Undefined", null, function AST_Undefined2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `undefined` value",
        value: /* @__PURE__ */ function() {
        }()
      }, AST_Atom);
      var AST_Hole = DEFNODE("Hole", null, function AST_Hole2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "A hole in an array",
        value: /* @__PURE__ */ function() {
        }()
      }, AST_Atom);
      var AST_Infinity = DEFNODE("Infinity", null, function AST_Infinity2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `Infinity` value",
        value: 1 / 0
      }, AST_Atom);
      var AST_Boolean = DEFNODE("Boolean", null, function AST_Boolean2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "Base class for booleans"
      }, AST_Atom);
      var AST_False = DEFNODE("False", null, function AST_False2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `false` atom",
        value: false
      }, AST_Boolean);
      var AST_True = DEFNODE("True", null, function AST_True2(props) {
        if (props) {
          this.start = props.start;
          this.end = props.end;
        }
        this.flags = 0;
      }, {
        $documentation: "The `true` atom",
        value: true
      }, AST_Boolean);
      function walk(node, cb, to_visit = [node]) {
        const push3 = to_visit.push.bind(to_visit);
        while (to_visit.length) {
          const node2 = to_visit.pop();
          const ret = cb(node2, to_visit);
          if (ret) {
            if (ret === walk_abort) return true;
            continue;
          }
          node2._children_backwards(push3);
        }
        return false;
      }
      function walk_parent(node, cb, initial_stack) {
        const to_visit = [node];
        const push3 = to_visit.push.bind(to_visit);
        const stack2 = initial_stack ? initial_stack.slice() : [];
        const parent_pop_indices = [];
        let current;
        const info3 = {
          parent: (n3 = 0) => {
            if (n3 === -1) {
              return current;
            }
            if (initial_stack && n3 >= stack2.length) {
              n3 -= stack2.length;
              return initial_stack[initial_stack.length - (n3 + 1)];
            }
            return stack2[stack2.length - (1 + n3)];
          }
        };
        while (to_visit.length) {
          current = to_visit.pop();
          while (parent_pop_indices.length && to_visit.length == parent_pop_indices[parent_pop_indices.length - 1]) {
            stack2.pop();
            parent_pop_indices.pop();
          }
          const ret = cb(current, info3);
          if (ret) {
            if (ret === walk_abort) return true;
            continue;
          }
          const visit_length = to_visit.length;
          current._children_backwards(push3);
          if (to_visit.length > visit_length) {
            stack2.push(current);
            parent_pop_indices.push(visit_length - 1);
          }
        }
        return false;
      }
      const walk_abort = Symbol("abort walk");
      class TreeWalker {
        constructor(callback) {
          this.visit = callback;
          this.stack = [];
          this.directives = /* @__PURE__ */ Object.create(null);
        }
        _visit(node, descend) {
          this.push(node);
          var ret = this.visit(node, descend ? function() {
            descend.call(node);
          } : noop3);
          if (!ret && descend) {
            descend.call(node);
          }
          this.pop();
          return ret;
        }
        parent(n3) {
          return this.stack[this.stack.length - 2 - (n3 || 0)];
        }
        push(node) {
          if (node instanceof AST_Lambda) {
            this.directives = Object.create(this.directives);
          } else if (node instanceof AST_Directive && !this.directives[node.value]) {
            this.directives[node.value] = node;
          } else if (node instanceof AST_Class) {
            this.directives = Object.create(this.directives);
            if (!this.directives["use strict"]) {
              this.directives["use strict"] = node;
            }
          }
          this.stack.push(node);
        }
        pop() {
          var node = this.stack.pop();
          if (node instanceof AST_Lambda || node instanceof AST_Class) {
            this.directives = Object.getPrototypeOf(this.directives);
          }
        }
        self() {
          return this.stack[this.stack.length - 1];
        }
        find_parent(type) {
          var stack2 = this.stack;
          for (var i = stack2.length; --i >= 0; ) {
            var x = stack2[i];
            if (x instanceof type) return x;
          }
        }
        is_within_loop() {
          let i = this.stack.length - 1;
          let child2 = this.stack[i];
          while (i--) {
            const node = this.stack[i];
            if (node instanceof AST_Lambda) return false;
            if (node instanceof AST_IterationStatement && !(node instanceof AST_For && child2 === node.init) && !((node instanceof AST_ForIn || node instanceof AST_ForOf) && child2 === node.object)) {
              return true;
            }
            child2 = node;
          }
          return false;
        }
        find_scope() {
          var stack2 = this.stack;
          for (var i = stack2.length; --i >= 0; ) {
            const p = stack2[i];
            if (p instanceof AST_Toplevel) return p;
            if (p instanceof AST_Lambda) return p;
            if (p.block_scope) return p.block_scope;
          }
        }
        has_directive(type) {
          var dir = this.directives[type];
          if (dir) return dir;
          var node = this.stack[this.stack.length - 1];
          if (node instanceof AST_Scope && node.body) {
            for (var i = 0; i < node.body.length; ++i) {
              var st = node.body[i];
              if (!(st instanceof AST_Directive)) break;
              if (st.value == type) return st;
            }
          }
        }
        loopcontrol_target(node) {
          var stack2 = this.stack;
          if (node.label) for (var i = stack2.length; --i >= 0; ) {
            var x = stack2[i];
            if (x instanceof AST_LabeledStatement && x.label.name == node.label.name)
              return x.body;
          }
          else for (var i = stack2.length; --i >= 0; ) {
            var x = stack2[i];
            if (x instanceof AST_IterationStatement || node instanceof AST_Break && x instanceof AST_Switch)
              return x;
          }
        }
      }
      class TreeTransformer extends TreeWalker {
        constructor(before, after) {
          super();
          this.before = before;
          this.after = after;
        }
      }
      const _PURE = 1;
      const _INLINE = 2;
      const _NOINLINE = 4;
      const _KEY = 8;
      const _MANGLEPROP = 16;
      function def_transform(node, descend) {
        node.DEFMETHOD("transform", function(tw, in_list) {
          let transformed = void 0;
          tw.push(this);
          if (tw.before) transformed = tw.before(this, descend, in_list);
          if (transformed === void 0) {
            transformed = this;
            descend(transformed, tw);
            if (tw.after) {
              const after_ret = tw.after(transformed, in_list);
              if (after_ret !== void 0) transformed = after_ret;
            }
          }
          tw.pop();
          return transformed;
        });
      }
      def_transform(AST_Node, noop3);
      def_transform(AST_LabeledStatement, function(self3, tw) {
        self3.label = self3.label.transform(tw);
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_SimpleStatement, function(self3, tw) {
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_Block, function(self3, tw) {
        self3.body = MAP(self3.body, tw);
      });
      def_transform(AST_Do, function(self3, tw) {
        self3.body = self3.body.transform(tw);
        self3.condition = self3.condition.transform(tw);
      });
      def_transform(AST_While, function(self3, tw) {
        self3.condition = self3.condition.transform(tw);
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_For, function(self3, tw) {
        if (self3.init) self3.init = self3.init.transform(tw);
        if (self3.condition) self3.condition = self3.condition.transform(tw);
        if (self3.step) self3.step = self3.step.transform(tw);
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_ForIn, function(self3, tw) {
        self3.init = self3.init.transform(tw);
        self3.object = self3.object.transform(tw);
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_With, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
        self3.body = self3.body.transform(tw);
      });
      def_transform(AST_Exit, function(self3, tw) {
        if (self3.value) self3.value = self3.value.transform(tw);
      });
      def_transform(AST_LoopControl, function(self3, tw) {
        if (self3.label) self3.label = self3.label.transform(tw);
      });
      def_transform(AST_If, function(self3, tw) {
        self3.condition = self3.condition.transform(tw);
        self3.body = self3.body.transform(tw);
        if (self3.alternative) self3.alternative = self3.alternative.transform(tw);
      });
      def_transform(AST_Switch, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
        self3.body = MAP(self3.body, tw);
      });
      def_transform(AST_Case, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
        self3.body = MAP(self3.body, tw);
      });
      def_transform(AST_Try, function(self3, tw) {
        self3.body = self3.body.transform(tw);
        if (self3.bcatch) self3.bcatch = self3.bcatch.transform(tw);
        if (self3.bfinally) self3.bfinally = self3.bfinally.transform(tw);
      });
      def_transform(AST_Catch, function(self3, tw) {
        if (self3.argname) self3.argname = self3.argname.transform(tw);
        self3.body = MAP(self3.body, tw);
      });
      def_transform(AST_DefinitionsLike, function(self3, tw) {
        self3.definitions = MAP(self3.definitions, tw);
      });
      def_transform(AST_VarDefLike, function(self3, tw) {
        self3.name = self3.name.transform(tw);
        if (self3.value) self3.value = self3.value.transform(tw);
      });
      def_transform(AST_Destructuring, function(self3, tw) {
        self3.names = MAP(self3.names, tw);
      });
      def_transform(AST_Lambda, function(self3, tw) {
        if (self3.name) self3.name = self3.name.transform(tw);
        self3.argnames = MAP(
          self3.argnames,
          tw,
          /* allow_splicing */
          false
        );
        if (self3.body instanceof AST_Node) {
          self3.body = self3.body.transform(tw);
        } else {
          self3.body = MAP(self3.body, tw);
        }
      });
      def_transform(AST_Call, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
        self3.args = MAP(
          self3.args,
          tw,
          /* allow_splicing */
          false
        );
      });
      def_transform(AST_Sequence, function(self3, tw) {
        const result = MAP(self3.expressions, tw);
        self3.expressions = result.length ? result : [new AST_Number({ value: 0 })];
      });
      def_transform(AST_PropAccess, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_Sub, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
        self3.property = self3.property.transform(tw);
      });
      def_transform(AST_Chain, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_Yield, function(self3, tw) {
        if (self3.expression) self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_Await, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_Unary, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_Binary, function(self3, tw) {
        self3.left = self3.left.transform(tw);
        self3.right = self3.right.transform(tw);
      });
      def_transform(AST_PrivateIn, function(self3, tw) {
        self3.key = self3.key.transform(tw);
        self3.value = self3.value.transform(tw);
      });
      def_transform(AST_Conditional, function(self3, tw) {
        self3.condition = self3.condition.transform(tw);
        self3.consequent = self3.consequent.transform(tw);
        self3.alternative = self3.alternative.transform(tw);
      });
      def_transform(AST_Array, function(self3, tw) {
        self3.elements = MAP(self3.elements, tw);
      });
      def_transform(AST_Object, function(self3, tw) {
        self3.properties = MAP(self3.properties, tw);
      });
      def_transform(AST_ObjectProperty, function(self3, tw) {
        if (self3.key instanceof AST_Node) {
          self3.key = self3.key.transform(tw);
        }
        if (self3.value) self3.value = self3.value.transform(tw);
      });
      def_transform(AST_Class, function(self3, tw) {
        if (self3.name) self3.name = self3.name.transform(tw);
        if (self3.extends) self3.extends = self3.extends.transform(tw);
        self3.properties = MAP(self3.properties, tw);
      });
      def_transform(AST_ClassStaticBlock, function(self3, tw) {
        self3.body = MAP(self3.body, tw);
      });
      def_transform(AST_Expansion, function(self3, tw) {
        self3.expression = self3.expression.transform(tw);
      });
      def_transform(AST_NameMapping, function(self3, tw) {
        self3.foreign_name = self3.foreign_name.transform(tw);
        self3.name = self3.name.transform(tw);
      });
      def_transform(AST_Import, function(self3, tw) {
        if (self3.imported_name) self3.imported_name = self3.imported_name.transform(tw);
        if (self3.imported_names) MAP(self3.imported_names, tw);
        self3.module_name = self3.module_name.transform(tw);
      });
      def_transform(AST_Export, function(self3, tw) {
        if (self3.exported_definition) self3.exported_definition = self3.exported_definition.transform(tw);
        if (self3.exported_value) self3.exported_value = self3.exported_value.transform(tw);
        if (self3.exported_names) MAP(self3.exported_names, tw);
        if (self3.module_name) self3.module_name = self3.module_name.transform(tw);
      });
      def_transform(AST_TemplateString, function(self3, tw) {
        self3.segments = MAP(self3.segments, tw);
      });
      def_transform(AST_PrefixedTemplateString, function(self3, tw) {
        self3.prefix = self3.prefix.transform(tw);
        self3.template_string = self3.template_string.transform(tw);
      });
      (function() {
        var normalize_directives = function(body) {
          for (var i = 0; i < body.length; i++) {
            if (body[i] instanceof AST_Statement && body[i].body instanceof AST_String) {
              body[i] = new AST_Directive({
                start: body[i].start,
                end: body[i].end,
                quote: '"',
                value: body[i].body.value
              });
            } else {
              return body;
            }
          }
          return body;
        };
        function import_attributes_from_moz(attributes) {
          if (attributes && attributes.length > 0) {
            return new AST_Object({
              start: my_start_token(attributes),
              end: my_end_token(attributes),
              properties: attributes.map(
                (attr2) => new AST_ObjectKeyVal({
                  start: my_start_token(attr2),
                  end: my_end_token(attr2),
                  key: attr2.key.name || attr2.key.value,
                  value: from_moz(attr2.value)
                })
              )
            });
          }
          return null;
        }
        var MOZ_TO_ME = {
          Program: function(M) {
            return new AST_Toplevel({
              start: my_start_token(M),
              end: my_end_token(M),
              body: normalize_directives(M.body.map(from_moz))
            });
          },
          ArrayPattern: function(M) {
            return new AST_Destructuring({
              start: my_start_token(M),
              end: my_end_token(M),
              names: M.elements.map(function(elm) {
                if (elm === null) {
                  return new AST_Hole();
                }
                return from_moz(elm);
              }),
              is_array: true
            });
          },
          ObjectPattern: function(M) {
            return new AST_Destructuring({
              start: my_start_token(M),
              end: my_end_token(M),
              names: M.properties.map(from_moz),
              is_array: false
            });
          },
          AssignmentPattern: function(M) {
            return new AST_DefaultAssign({
              start: my_start_token(M),
              end: my_end_token(M),
              left: from_moz(M.left),
              operator: "=",
              right: from_moz(M.right)
            });
          },
          SpreadElement: function(M) {
            return new AST_Expansion({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.argument)
            });
          },
          RestElement: function(M) {
            return new AST_Expansion({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.argument)
            });
          },
          TemplateElement: function(M) {
            return new AST_TemplateSegment({
              start: my_start_token(M),
              end: my_end_token(M),
              value: M.value.cooked,
              raw: M.value.raw
            });
          },
          TemplateLiteral: function(M) {
            var segments = [];
            for (var i = 0; i < M.quasis.length; i++) {
              segments.push(from_moz(M.quasis[i]));
              if (M.expressions[i]) {
                segments.push(from_moz(M.expressions[i]));
              }
            }
            return new AST_TemplateString({
              start: my_start_token(M),
              end: my_end_token(M),
              segments
            });
          },
          TaggedTemplateExpression: function(M) {
            return new AST_PrefixedTemplateString({
              start: my_start_token(M),
              end: my_end_token(M),
              template_string: from_moz(M.quasi),
              prefix: from_moz(M.tag)
            });
          },
          FunctionDeclaration: function(M) {
            return new AST_Defun({
              start: my_start_token(M),
              end: my_end_token(M),
              name: M.id && from_moz_symbol(AST_SymbolDefun, M.id),
              argnames: M.params.map((M2) => from_moz_pattern(M2, AST_SymbolFunarg)),
              is_generator: M.generator,
              async: M.async,
              body: normalize_directives(from_moz(M.body).body)
            });
          },
          FunctionExpression: function(M) {
            return from_moz_lambda(
              M,
              /*is_method=*/
              false
            );
          },
          ArrowFunctionExpression: function(M) {
            const body = M.body.type === "BlockStatement" ? from_moz(M.body).body : [make_node(AST_Return, {}, { value: from_moz(M.body) })];
            return new AST_Arrow({
              start: my_start_token(M),
              end: my_end_token(M),
              argnames: M.params.map((p) => from_moz_pattern(p, AST_SymbolFunarg)),
              body,
              async: M.async
            });
          },
          ExpressionStatement: function(M) {
            return new AST_SimpleStatement({
              start: my_start_token(M),
              end: my_end_token(M),
              body: from_moz(M.expression)
            });
          },
          TryStatement: function(M) {
            var handlers = M.handlers || [M.handler];
            if (handlers.length > 1 || M.guardedHandlers && M.guardedHandlers.length) {
              throw new Error("Multiple catch clauses are not supported.");
            }
            return new AST_Try({
              start: my_start_token(M),
              end: my_end_token(M),
              body: new AST_TryBlock(from_moz(M.block)),
              bcatch: from_moz(handlers[0]),
              bfinally: M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null
            });
          },
          Property: function(M) {
            if (M.kind == "init" && !M.method) {
              var args = {
                start: my_start_token(M.key || M.value),
                end: my_end_token(M.value),
                key: M.computed ? from_moz(M.key) : M.key.name || String(M.key.value),
                quote: from_moz_quote(M.key, M.computed),
                static: false,
                // always an object
                value: from_moz(M.value)
              };
              return new AST_ObjectKeyVal(args);
            } else {
              var value2 = from_moz_lambda(
                M.value,
                /*is_method=*/
                true
              );
              var args = {
                start: my_start_token(M.key || M.value),
                end: my_end_token(M.value),
                key: M.computed ? from_moz(M.key) : from_moz_symbol(AST_SymbolMethod, M.key),
                quote: from_moz_quote(M.key, M.computed),
                static: false,
                // always an object
                value: value2
              };
              if (M.kind == "get") return new AST_ObjectGetter(args);
              if (M.kind == "set") return new AST_ObjectSetter(args);
              if (M.method) return new AST_ConciseMethod(args);
            }
          },
          MethodDefinition: function(M) {
            const is_private = M.key.type === "PrivateIdentifier";
            const key4 = M.computed ? from_moz(M.key) : new AST_SymbolMethod({ name: M.key.name || String(M.key.value) });
            var args = {
              start: my_start_token(M),
              end: my_end_token(M),
              key: key4,
              quote: from_moz_quote(M.key, M.computed),
              value: from_moz_lambda(
                M.value,
                /*is_method=*/
                true
              ),
              static: M.static
            };
            if (M.kind == "get") {
              return new (is_private ? AST_PrivateGetter : AST_ObjectGetter)(args);
            }
            if (M.kind == "set") {
              return new (is_private ? AST_PrivateSetter : AST_ObjectSetter)(args);
            }
            return new (is_private ? AST_PrivateMethod : AST_ConciseMethod)(args);
          },
          FieldDefinition: function(M) {
            let key4;
            if (M.computed) {
              key4 = from_moz(M.key);
            } else {
              if (M.key.type !== "Identifier") throw new Error("Non-Identifier key in FieldDefinition");
              key4 = from_moz(M.key);
            }
            return new AST_ClassProperty({
              start: my_start_token(M),
              end: my_end_token(M),
              quote: from_moz_quote(M.key, M.computed),
              key: key4,
              value: from_moz(M.value),
              static: M.static
            });
          },
          PropertyDefinition: function(M) {
            let key4;
            if (M.computed) {
              key4 = from_moz(M.key);
            } else if (M.key.type === "PrivateIdentifier") {
              return new AST_ClassPrivateProperty({
                start: my_start_token(M),
                end: my_end_token(M),
                key: from_moz(M.key),
                value: from_moz(M.value),
                static: M.static
              });
            } else {
              key4 = from_moz_symbol(AST_SymbolClassProperty, M.key);
            }
            return new AST_ClassProperty({
              start: my_start_token(M),
              end: my_end_token(M),
              quote: from_moz_quote(M.key, M.computed),
              key: key4,
              value: from_moz(M.value),
              static: M.static
            });
          },
          PrivateIdentifier: function(M) {
            return new AST_SymbolPrivateProperty({
              start: my_start_token(M),
              end: my_end_token(M),
              name: M.name
            });
          },
          StaticBlock: function(M) {
            return new AST_ClassStaticBlock({
              start: my_start_token(M),
              end: my_end_token(M),
              body: M.body.map(from_moz)
            });
          },
          ArrayExpression: function(M) {
            return new AST_Array({
              start: my_start_token(M),
              end: my_end_token(M),
              elements: M.elements.map(function(elem) {
                return elem === null ? new AST_Hole() : from_moz(elem);
              })
            });
          },
          ObjectExpression: function(M) {
            return new AST_Object({
              start: my_start_token(M),
              end: my_end_token(M),
              properties: M.properties.map(function(prop2) {
                if (prop2.type === "SpreadElement") {
                  return from_moz(prop2);
                }
                prop2.type = "Property";
                return from_moz(prop2);
              })
            });
          },
          SequenceExpression: function(M) {
            return new AST_Sequence({
              start: my_start_token(M),
              end: my_end_token(M),
              expressions: M.expressions.map(from_moz)
            });
          },
          MemberExpression: function(M) {
            if (M.property.type === "PrivateIdentifier") {
              return new AST_DotHash({
                start: my_start_token(M),
                end: my_end_token(M),
                property: M.property.name,
                expression: from_moz(M.object),
                optional: M.optional || false
              });
            }
            return new (M.computed ? AST_Sub : AST_Dot)({
              start: my_start_token(M),
              end: my_end_token(M),
              property: M.computed ? from_moz(M.property) : M.property.name,
              expression: from_moz(M.object),
              optional: M.optional || false
            });
          },
          ChainExpression: function(M) {
            return new AST_Chain({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.expression)
            });
          },
          SwitchCase: function(M) {
            return new (M.test ? AST_Case : AST_Default)({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.test),
              body: M.consequent.map(from_moz)
            });
          },
          VariableDeclaration: function(M) {
            let decl_type;
            let defs_type = AST_VarDef;
            let sym_type;
            let await_using = false;
            if (M.kind === "const") {
              decl_type = AST_Const;
              sym_type = AST_SymbolConst;
            } else if (M.kind === "let") {
              decl_type = AST_Let;
              sym_type = AST_SymbolLet;
            } else if (M.kind === "using") {
              decl_type = AST_Using;
              defs_type = AST_UsingDef;
              sym_type = AST_SymbolUsing;
            } else if (M.kind === "await using") {
              decl_type = AST_Using;
              defs_type = AST_UsingDef;
              sym_type = AST_SymbolUsing;
              await_using = true;
            } else {
              decl_type = AST_Var;
              sym_type = AST_SymbolVar;
            }
            const definitions = M.declarations.map((M2) => {
              return new defs_type({
                start: my_start_token(M2),
                end: my_end_token(M2),
                name: from_moz_pattern(M2.id, sym_type),
                value: from_moz(M2.init)
              });
            });
            return new decl_type({
              start: my_start_token(M),
              end: my_end_token(M),
              definitions,
              await: await_using
            });
          },
          ImportDeclaration: function(M) {
            var imported_name = null;
            var imported_names = null;
            M.specifiers.forEach(function(specifier) {
              if (specifier.type === "ImportSpecifier" || specifier.type === "ImportNamespaceSpecifier") {
                if (!imported_names) {
                  imported_names = [];
                }
                imported_names.push(from_moz(specifier));
              } else if (specifier.type === "ImportDefaultSpecifier") {
                imported_name = from_moz(specifier);
              }
            });
            return new AST_Import({
              start: my_start_token(M),
              end: my_end_token(M),
              imported_name,
              imported_names,
              module_name: from_moz(M.source),
              attributes: import_attributes_from_moz(M.attributes || M.assertions)
            });
          },
          ImportSpecifier: function(M) {
            return new AST_NameMapping({
              start: my_start_token(M),
              end: my_end_token(M),
              foreign_name: from_moz_symbol(AST_SymbolImportForeign, M.imported, M.imported.type === "Literal"),
              name: from_moz_symbol(AST_SymbolImport, M.local)
            });
          },
          ImportDefaultSpecifier: function(M) {
            return from_moz_symbol(AST_SymbolImport, M.local);
          },
          ImportNamespaceSpecifier: function(M) {
            return new AST_NameMapping({
              start: my_start_token(M),
              end: my_end_token(M),
              foreign_name: new AST_SymbolImportForeign({ name: "*" }),
              name: from_moz_symbol(AST_SymbolImport, M.local)
            });
          },
          ImportExpression: function(M) {
            const args = [from_moz(M.source)];
            if (M.options) {
              args.push(from_moz(M.options));
            }
            return new AST_Call({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz({
                type: "Identifier",
                name: "import"
              }),
              optional: false,
              args
            });
          },
          ExportAllDeclaration: function(M) {
            var foreign_name = M.exported == null ? new AST_SymbolExportForeign({ name: "*" }) : from_moz_symbol(AST_SymbolExportForeign, M.exported, M.exported.type === "Literal");
            return new AST_Export({
              start: my_start_token(M),
              end: my_end_token(M),
              exported_names: [
                new AST_NameMapping({
                  start: my_start_token(M),
                  end: my_end_token(M),
                  name: new AST_SymbolExport({ name: "*" }),
                  foreign_name
                })
              ],
              module_name: from_moz(M.source),
              attributes: import_attributes_from_moz(M.attributes || M.assertions)
            });
          },
          ExportNamedDeclaration: function(M) {
            if (M.declaration) {
              return new AST_Export({
                start: my_start_token(M),
                end: my_end_token(M),
                exported_definition: from_moz(M.declaration),
                exported_names: null,
                module_name: null,
                attributes: null
              });
            } else {
              return new AST_Export({
                start: my_start_token(M),
                end: my_end_token(M),
                exported_definition: null,
                exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(from_moz) : [],
                module_name: from_moz(M.source),
                attributes: import_attributes_from_moz(M.attributes || M.assertions)
              });
            }
          },
          ExportDefaultDeclaration: function(M) {
            return new AST_Export({
              start: my_start_token(M),
              end: my_end_token(M),
              exported_value: from_moz(M.declaration),
              is_default: true
            });
          },
          ExportSpecifier: function(M) {
            return new AST_NameMapping({
              start: my_start_token(M),
              end: my_end_token(M),
              foreign_name: from_moz_symbol(AST_SymbolExportForeign, M.exported, M.exported.type === "Literal"),
              name: from_moz_symbol(AST_SymbolExport, M.local, M.local.type === "Literal")
            });
          },
          Literal: function(M) {
            var val = M.value, args = {
              start: my_start_token(M),
              end: my_end_token(M)
            };
            var rx = M.regex;
            if (rx && rx.pattern) {
              args.value = {
                source: rx.pattern,
                flags: rx.flags
              };
              return new AST_RegExp(args);
            } else if (rx) {
              const rx_source = M.raw || val;
              const match3 = rx_source.match(/^\/(.*)\/(\w*)$/);
              if (!match3) throw new Error("Invalid regex source " + rx_source);
              const [_, source2, flags2] = match3;
              args.value = { source: source2, flags: flags2 };
              return new AST_RegExp(args);
            }
            const bi = typeof M.value === "bigint" ? M.value.toString() : M.bigint;
            if (typeof bi === "string") {
              args.value = bi;
              args.raw = M.raw;
              return new AST_BigInt(args);
            }
            if (val === null) return new AST_Null(args);
            switch (typeof val) {
              case "string":
                args.quote = '"';
                args.value = val;
                return new AST_String(args);
              case "number":
                args.value = val;
                args.raw = M.raw || val.toString();
                return new AST_Number(args);
              case "boolean":
                return new (val ? AST_True : AST_False)(args);
            }
          },
          MetaProperty: function(M) {
            if (M.meta.name === "new" && M.property.name === "target") {
              return new AST_NewTarget({
                start: my_start_token(M),
                end: my_end_token(M)
              });
            } else if (M.meta.name === "import" && M.property.name === "meta") {
              return new AST_ImportMeta({
                start: my_start_token(M),
                end: my_end_token(M)
              });
            }
          },
          Identifier: function(M) {
            return new AST_SymbolRef({
              start: my_start_token(M),
              end: my_end_token(M),
              name: M.name
            });
          },
          EmptyStatement: function(M) {
            return new AST_EmptyStatement({
              start: my_start_token(M),
              end: my_end_token(M)
            });
          },
          BlockStatement: function(M) {
            return new AST_BlockStatement({
              start: my_start_token(M),
              end: my_end_token(M),
              body: M.body.map(from_moz)
            });
          },
          IfStatement: function(M) {
            return new AST_If({
              start: my_start_token(M),
              end: my_end_token(M),
              condition: from_moz(M.test),
              body: from_moz(M.consequent),
              alternative: from_moz(M.alternate)
            });
          },
          LabeledStatement: function(M) {
            try {
              const label = from_moz_symbol(AST_Label, M.label);
              FROM_MOZ_LABELS.push(label);
              const stat = new AST_LabeledStatement({
                start: my_start_token(M),
                end: my_end_token(M),
                label,
                body: from_moz(M.body)
              });
              return stat;
            } finally {
              FROM_MOZ_LABELS.pop();
            }
          },
          BreakStatement: function(M) {
            return new AST_Break({
              start: my_start_token(M),
              end: my_end_token(M),
              label: from_moz_label_ref(M.label)
            });
          },
          ContinueStatement: function(M) {
            return new AST_Continue({
              start: my_start_token(M),
              end: my_end_token(M),
              label: from_moz_label_ref(M.label)
            });
          },
          WithStatement: function(M) {
            return new AST_With({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.object),
              body: from_moz(M.body)
            });
          },
          SwitchStatement: function(M) {
            return new AST_Switch({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.discriminant),
              body: M.cases.map(from_moz)
            });
          },
          ReturnStatement: function(M) {
            return new AST_Return({
              start: my_start_token(M),
              end: my_end_token(M),
              value: from_moz(M.argument)
            });
          },
          ThrowStatement: function(M) {
            return new AST_Throw({
              start: my_start_token(M),
              end: my_end_token(M),
              value: from_moz(M.argument)
            });
          },
          WhileStatement: function(M) {
            return new AST_While({
              start: my_start_token(M),
              end: my_end_token(M),
              condition: from_moz(M.test),
              body: from_moz(M.body)
            });
          },
          DoWhileStatement: function(M) {
            return new AST_Do({
              start: my_start_token(M),
              end: my_end_token(M),
              condition: from_moz(M.test),
              body: from_moz(M.body)
            });
          },
          ForStatement: function(M) {
            return new AST_For({
              start: my_start_token(M),
              end: my_end_token(M),
              init: from_moz(M.init),
              condition: from_moz(M.test),
              step: from_moz(M.update),
              body: from_moz(M.body)
            });
          },
          ForInStatement: function(M) {
            return new AST_ForIn({
              start: my_start_token(M),
              end: my_end_token(M),
              init: from_moz(M.left),
              object: from_moz(M.right),
              body: from_moz(M.body)
            });
          },
          ForOfStatement: function(M) {
            return new AST_ForOf({
              start: my_start_token(M),
              end: my_end_token(M),
              init: from_moz(M.left),
              object: from_moz(M.right),
              body: from_moz(M.body),
              await: M.await
            });
          },
          AwaitExpression: function(M) {
            return new AST_Await({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.argument)
            });
          },
          YieldExpression: function(M) {
            return new AST_Yield({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.argument),
              is_star: M.delegate
            });
          },
          DebuggerStatement: function(M) {
            return new AST_Debugger({
              start: my_start_token(M),
              end: my_end_token(M)
            });
          },
          CatchClause: function(M) {
            return new AST_Catch({
              start: my_start_token(M),
              end: my_end_token(M),
              argname: M.param ? from_moz_pattern(M.param, AST_SymbolCatch) : null,
              body: from_moz(M.body).body
            });
          },
          ThisExpression: function(M) {
            return new AST_This({
              start: my_start_token(M),
              name: "this",
              end: my_end_token(M)
            });
          },
          Super: function(M) {
            return new AST_Super({
              start: my_start_token(M),
              end: my_end_token(M),
              name: "super"
            });
          },
          BinaryExpression: function(M) {
            if (M.left.type === "PrivateIdentifier") {
              return new AST_PrivateIn({
                start: my_start_token(M),
                end: my_end_token(M),
                key: new AST_SymbolPrivateProperty({
                  start: my_start_token(M.left),
                  end: my_end_token(M.left),
                  name: M.left.name
                }),
                value: from_moz(M.right)
              });
            }
            return new AST_Binary({
              start: my_start_token(M),
              end: my_end_token(M),
              operator: M.operator,
              left: from_moz(M.left),
              right: from_moz(M.right)
            });
          },
          LogicalExpression: function(M) {
            return new AST_Binary({
              start: my_start_token(M),
              end: my_end_token(M),
              operator: M.operator,
              left: from_moz(M.left),
              right: from_moz(M.right)
            });
          },
          AssignmentExpression: function(M) {
            return new AST_Assign({
              start: my_start_token(M),
              end: my_end_token(M),
              operator: M.operator,
              logical: M.operator === "??=" || M.operator === "&&=" || M.operator === "||=",
              left: from_moz(M.left),
              right: from_moz(M.right)
            });
          },
          ConditionalExpression: function(M) {
            return new AST_Conditional({
              start: my_start_token(M),
              end: my_end_token(M),
              condition: from_moz(M.test),
              consequent: from_moz(M.consequent),
              alternative: from_moz(M.alternate)
            });
          },
          NewExpression: function(M) {
            return new AST_New({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.callee),
              args: M.arguments.map(from_moz)
            });
          },
          CallExpression: function(M) {
            return new AST_Call({
              start: my_start_token(M),
              end: my_end_token(M),
              expression: from_moz(M.callee),
              optional: M.optional,
              args: M.arguments.map(from_moz)
            });
          }
        };
        MOZ_TO_ME.UpdateExpression = MOZ_TO_ME.UnaryExpression = function To_Moz_Unary(M) {
          var prefix = "prefix" in M ? M.prefix : M.type == "UnaryExpression" ? true : false;
          return new (prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({
            start: my_start_token(M),
            end: my_end_token(M),
            operator: M.operator,
            expression: from_moz(M.argument)
          });
        };
        MOZ_TO_ME.ClassDeclaration = MOZ_TO_ME.ClassExpression = function From_Moz_Class(M) {
          return new (M.type === "ClassDeclaration" ? AST_DefClass : AST_ClassExpression)({
            start: my_start_token(M),
            end: my_end_token(M),
            name: M.id && from_moz_symbol(M.type === "ClassDeclaration" ? AST_SymbolDefClass : AST_SymbolClass, M.id),
            extends: from_moz(M.superClass),
            properties: M.body.body.map(from_moz)
          });
        };
        def_to_moz(AST_EmptyStatement, function To_Moz_EmptyStatement() {
          return {
            type: "EmptyStatement"
          };
        });
        def_to_moz(AST_BlockStatement, function To_Moz_BlockStatement(M) {
          return {
            type: "BlockStatement",
            body: M.body.map(to_moz)
          };
        });
        def_to_moz(AST_If, function To_Moz_IfStatement(M) {
          return {
            type: "IfStatement",
            test: to_moz(M.condition),
            consequent: to_moz(M.body),
            alternate: to_moz(M.alternative)
          };
        });
        def_to_moz(AST_LabeledStatement, function To_Moz_LabeledStatement(M) {
          return {
            type: "LabeledStatement",
            label: to_moz(M.label),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_Break, function To_Moz_BreakStatement(M) {
          return {
            type: "BreakStatement",
            label: to_moz(M.label)
          };
        });
        def_to_moz(AST_Continue, function To_Moz_ContinueStatement(M) {
          return {
            type: "ContinueStatement",
            label: to_moz(M.label)
          };
        });
        def_to_moz(AST_With, function To_Moz_WithStatement(M) {
          return {
            type: "WithStatement",
            object: to_moz(M.expression),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_Switch, function To_Moz_SwitchStatement(M) {
          return {
            type: "SwitchStatement",
            discriminant: to_moz(M.expression),
            cases: M.body.map(to_moz)
          };
        });
        def_to_moz(AST_Return, function To_Moz_ReturnStatement(M) {
          return {
            type: "ReturnStatement",
            argument: to_moz(M.value)
          };
        });
        def_to_moz(AST_Throw, function To_Moz_ThrowStatement(M) {
          return {
            type: "ThrowStatement",
            argument: to_moz(M.value)
          };
        });
        def_to_moz(AST_While, function To_Moz_WhileStatement(M) {
          return {
            type: "WhileStatement",
            test: to_moz(M.condition),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_Do, function To_Moz_DoWhileStatement(M) {
          return {
            type: "DoWhileStatement",
            test: to_moz(M.condition),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_For, function To_Moz_ForStatement(M) {
          return {
            type: "ForStatement",
            init: to_moz(M.init),
            test: to_moz(M.condition),
            update: to_moz(M.step),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_ForIn, function To_Moz_ForInStatement(M) {
          return {
            type: "ForInStatement",
            left: to_moz(M.init),
            right: to_moz(M.object),
            body: to_moz(M.body)
          };
        });
        def_to_moz(AST_ForOf, function To_Moz_ForOfStatement(M) {
          return {
            type: "ForOfStatement",
            left: to_moz(M.init),
            right: to_moz(M.object),
            body: to_moz(M.body),
            await: M.await
          };
        });
        def_to_moz(AST_Await, function To_Moz_AwaitExpression(M) {
          return {
            type: "AwaitExpression",
            argument: to_moz(M.expression)
          };
        });
        def_to_moz(AST_Yield, function To_Moz_YieldExpression(M) {
          return {
            type: "YieldExpression",
            argument: to_moz(M.expression),
            delegate: M.is_star
          };
        });
        def_to_moz(AST_Debugger, function To_Moz_DebuggerStatement() {
          return {
            type: "DebuggerStatement"
          };
        });
        def_to_moz(AST_VarDefLike, function To_Moz_VariableDeclarator(M) {
          return {
            type: "VariableDeclarator",
            id: to_moz(M.name),
            init: to_moz(M.value)
          };
        });
        def_to_moz(AST_This, function To_Moz_ThisExpression() {
          return {
            type: "ThisExpression"
          };
        });
        def_to_moz(AST_Super, function To_Moz_Super() {
          return {
            type: "Super"
          };
        });
        def_to_moz(AST_Conditional, function To_Moz_ConditionalExpression(M) {
          return {
            type: "ConditionalExpression",
            test: to_moz(M.condition),
            consequent: to_moz(M.consequent),
            alternate: to_moz(M.alternative)
          };
        });
        def_to_moz(AST_New, function To_Moz_NewExpression(M) {
          return {
            type: "NewExpression",
            callee: to_moz(M.expression),
            arguments: M.args.map(to_moz)
          };
        });
        def_to_moz(AST_Call, function To_Moz_CallExpression(M) {
          if (M.expression instanceof AST_SymbolRef && M.expression.name === "import") {
            const [source2, options] = M.args.map(to_moz);
            return {
              type: "ImportExpression",
              source: source2,
              options: options || null
            };
          }
          return {
            type: "CallExpression",
            callee: to_moz(M.expression),
            optional: M.optional,
            arguments: M.args.map(to_moz)
          };
        });
        def_to_moz(AST_Toplevel, function To_Moz_Program(M) {
          return to_moz_scope("Program", M);
        });
        def_to_moz(AST_Expansion, function To_Moz_Spread(M) {
          return {
            type: to_moz_in_destructuring() ? "RestElement" : "SpreadElement",
            argument: to_moz(M.expression)
          };
        });
        def_to_moz(AST_PrefixedTemplateString, function To_Moz_TaggedTemplateExpression(M) {
          return {
            type: "TaggedTemplateExpression",
            tag: to_moz(M.prefix),
            quasi: to_moz(M.template_string)
          };
        });
        def_to_moz(AST_TemplateString, function To_Moz_TemplateLiteral(M) {
          var quasis = [];
          var expressions = [];
          for (var i = 0; i < M.segments.length; i++) {
            if (i % 2 !== 0) {
              expressions.push(to_moz(M.segments[i]));
            } else {
              quasis.push({
                type: "TemplateElement",
                value: {
                  raw: M.segments[i].raw,
                  cooked: M.segments[i].value
                },
                tail: i === M.segments.length - 1
              });
            }
          }
          return {
            type: "TemplateLiteral",
            quasis,
            expressions
          };
        });
        def_to_moz(AST_Defun, function To_Moz_FunctionDeclaration(M) {
          return {
            type: "FunctionDeclaration",
            id: to_moz(M.name),
            params: M.argnames.map(to_moz_pattern),
            generator: M.is_generator,
            async: M.async,
            body: to_moz_scope("BlockStatement", M)
          };
        });
        def_to_moz(AST_Function, function To_Moz_FunctionExpression(M) {
          return {
            type: "FunctionExpression",
            id: to_moz(M.name),
            params: M.argnames.map(to_moz_pattern),
            generator: M.is_generator || false,
            async: M.async || false,
            body: to_moz_scope("BlockStatement", M)
          };
        });
        def_to_moz(AST_Arrow, function To_Moz_ArrowFunctionExpression(M) {
          var body = M.body.length === 1 && M.body[0] instanceof AST_Return && M.body[0].value ? to_moz(M.body[0].value) : {
            type: "BlockStatement",
            body: M.body.map(to_moz)
          };
          return {
            type: "ArrowFunctionExpression",
            params: M.argnames.map(to_moz_pattern),
            async: M.async,
            body
          };
        });
        def_to_moz(AST_Destructuring, function To_Moz_ObjectPattern(M) {
          if (M.is_array) {
            return {
              type: "ArrayPattern",
              elements: M.names.map(
                (M2) => M2 instanceof AST_Hole ? null : to_moz_pattern(M2)
              )
            };
          }
          return {
            type: "ObjectPattern",
            properties: M.names.map((M2) => {
              if (M2 instanceof AST_ObjectKeyVal) {
                var computed2 = M2.computed_key();
                const [shorthand, key4] = to_moz_property_key(M2.key, computed2, M2.quote, M2.value);
                return {
                  type: "Property",
                  computed: computed2,
                  kind: "init",
                  key: key4,
                  method: false,
                  shorthand,
                  value: to_moz_pattern(M2.value)
                };
              } else {
                return to_moz_pattern(M2);
              }
            })
          };
        });
        def_to_moz(AST_DefaultAssign, function To_Moz_AssignmentExpression(M) {
          return {
            type: "AssignmentPattern",
            left: to_moz_pattern(M.left),
            right: to_moz(M.right)
          };
        });
        def_to_moz(AST_Directive, function To_Moz_Directive(M) {
          return {
            type: "ExpressionStatement",
            expression: {
              type: "Literal",
              value: M.value,
              raw: M.print_to_string()
            },
            directive: M.value
          };
        });
        def_to_moz(AST_SimpleStatement, function To_Moz_ExpressionStatement(M) {
          return {
            type: "ExpressionStatement",
            expression: to_moz(M.body)
          };
        });
        def_to_moz(AST_SwitchBranch, function To_Moz_SwitchCase(M) {
          return {
            type: "SwitchCase",
            test: to_moz(M.expression),
            consequent: M.body.map(to_moz)
          };
        });
        def_to_moz(AST_Try, function To_Moz_TryStatement(M) {
          return {
            type: "TryStatement",
            block: to_moz_block(M.body),
            handler: to_moz(M.bcatch),
            guardedHandlers: [],
            finalizer: to_moz(M.bfinally)
          };
        });
        def_to_moz(AST_Catch, function To_Moz_CatchClause(M) {
          return {
            type: "CatchClause",
            param: M.argname != null ? to_moz_pattern(M.argname) : null,
            body: to_moz_block(M)
          };
        });
        def_to_moz(AST_DefinitionsLike, function To_Moz_VariableDeclaration(M) {
          return {
            type: "VariableDeclaration",
            kind: M instanceof AST_Const ? "const" : M instanceof AST_Let ? "let" : M instanceof AST_Using ? M.await ? "await using" : "using" : "var",
            declarations: M.definitions.map(to_moz)
          };
        });
        function import_attributes_to_moz(attribute) {
          const import_attributes6 = [];
          if (attribute) {
            for (const { key: key4, value: value2 } of attribute.properties) {
              const key_moz = is_basic_identifier_string(key4) ? { type: "Identifier", name: key4 } : { type: "Literal", value: key4, raw: JSON.stringify(key4) };
              import_attributes6.push({
                type: "ImportAttribute",
                key: key_moz,
                value: to_moz(value2)
              });
            }
          }
          return import_attributes6;
        }
        def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) {
          if (M.exported_names) {
            var first_exported = M.exported_names[0];
            if (first_exported && first_exported.name.name === "*" && !first_exported.name.quote) {
              var foreign_name = first_exported.foreign_name;
              var exported = foreign_name.name === "*" && !foreign_name.quote ? null : to_moz(foreign_name);
              return {
                type: "ExportAllDeclaration",
                source: to_moz(M.module_name),
                exported,
                attributes: import_attributes_to_moz(M.attributes)
              };
            }
            return {
              type: "ExportNamedDeclaration",
              specifiers: M.exported_names.map(function(name_mapping) {
                return {
                  type: "ExportSpecifier",
                  exported: to_moz(name_mapping.foreign_name),
                  local: to_moz(name_mapping.name)
                };
              }),
              declaration: to_moz(M.exported_definition),
              source: to_moz(M.module_name),
              attributes: import_attributes_to_moz(M.attributes)
            };
          }
          if (M.is_default) {
            return {
              type: "ExportDefaultDeclaration",
              declaration: to_moz(M.exported_value || M.exported_definition)
            };
          } else {
            return {
              type: "ExportNamedDeclaration",
              declaration: to_moz(M.exported_value || M.exported_definition),
              specifiers: [],
              source: null
            };
          }
        });
        def_to_moz(AST_Import, function To_Moz_ImportDeclaration(M) {
          var specifiers = [];
          if (M.imported_name) {
            specifiers.push({
              type: "ImportDefaultSpecifier",
              local: to_moz(M.imported_name)
            });
          }
          if (M.imported_names) {
            var first_imported_foreign_name = M.imported_names[0].foreign_name;
            if (first_imported_foreign_name.name === "*" && !first_imported_foreign_name.quote) {
              specifiers.push({
                type: "ImportNamespaceSpecifier",
                local: to_moz(M.imported_names[0].name)
              });
            } else {
              M.imported_names.forEach(function(name_mapping) {
                specifiers.push({
                  type: "ImportSpecifier",
                  local: to_moz(name_mapping.name),
                  imported: to_moz(name_mapping.foreign_name)
                });
              });
            }
          }
          return {
            type: "ImportDeclaration",
            specifiers,
            source: to_moz(M.module_name),
            attributes: import_attributes_to_moz(M.attributes)
          };
        });
        def_to_moz(AST_ImportMeta, function To_Moz_MetaProperty() {
          return {
            type: "MetaProperty",
            meta: {
              type: "Identifier",
              name: "import"
            },
            property: {
              type: "Identifier",
              name: "meta"
            }
          };
        });
        def_to_moz(AST_Sequence, function To_Moz_SequenceExpression(M) {
          return {
            type: "SequenceExpression",
            expressions: M.expressions.map(to_moz)
          };
        });
        def_to_moz(AST_DotHash, function To_Moz_PrivateMemberExpression(M) {
          return {
            type: "MemberExpression",
            object: to_moz(M.expression),
            computed: false,
            property: {
              type: "PrivateIdentifier",
              name: M.property
            },
            optional: M.optional
          };
        });
        def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) {
          var isComputed = M instanceof AST_Sub;
          return {
            type: "MemberExpression",
            object: to_moz(M.expression),
            computed: isComputed,
            property: isComputed ? to_moz(M.property) : { type: "Identifier", name: M.property },
            optional: M.optional
          };
        });
        def_to_moz(AST_Chain, function To_Moz_ChainExpression(M) {
          return {
            type: "ChainExpression",
            expression: to_moz(M.expression)
          };
        });
        def_to_moz(AST_Unary, function To_Moz_Unary(M) {
          return {
            type: M.operator == "++" || M.operator == "--" ? "UpdateExpression" : "UnaryExpression",
            operator: M.operator,
            prefix: M instanceof AST_UnaryPrefix,
            argument: to_moz(M.expression)
          };
        });
        def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) {
          if (M.operator == "=" && to_moz_in_destructuring()) {
            return {
              type: "AssignmentPattern",
              left: to_moz(M.left),
              right: to_moz(M.right)
            };
          }
          const type = M.operator == "&&" || M.operator == "||" || M.operator === "??" ? "LogicalExpression" : "BinaryExpression";
          return {
            type,
            left: to_moz(M.left),
            operator: M.operator,
            right: to_moz(M.right)
          };
        });
        def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
          return {
            type: "AssignmentExpression",
            operator: M.operator,
            left: to_moz(M.left),
            right: to_moz(M.right)
          };
        });
        def_to_moz(AST_PrivateIn, function To_Moz_BinaryExpression_PrivateIn(M) {
          return {
            type: "BinaryExpression",
            left: { type: "PrivateIdentifier", name: M.key.name },
            operator: "in",
            right: to_moz(M.value)
          };
        });
        def_to_moz(AST_Array, function To_Moz_ArrayExpression(M) {
          return {
            type: "ArrayExpression",
            elements: M.elements.map(to_moz)
          };
        });
        def_to_moz(AST_Object, function To_Moz_ObjectExpression(M) {
          return {
            type: "ObjectExpression",
            properties: M.properties.map(to_moz)
          };
        });
        def_to_moz(AST_ObjectProperty, function To_Moz_Property(M, parent) {
          var computed2 = M.computed_key();
          const [shorthand, key4] = to_moz_property_key(M.key, computed2, M.quote, M.value);
          var kind;
          if (M instanceof AST_ObjectGetter) {
            kind = "get";
          } else if (M instanceof AST_ObjectSetter) {
            kind = "set";
          }
          if (M instanceof AST_PrivateGetter || M instanceof AST_PrivateSetter) {
            const kind2 = M instanceof AST_PrivateGetter ? "get" : "set";
            return {
              type: "MethodDefinition",
              computed: false,
              kind: kind2,
              static: M.static,
              key: {
                type: "PrivateIdentifier",
                name: M.key.name
              },
              value: to_moz(M.value)
            };
          }
          if (M instanceof AST_ClassPrivateProperty) {
            return {
              type: "PropertyDefinition",
              key: {
                type: "PrivateIdentifier",
                name: M.key.name
              },
              value: to_moz(M.value),
              computed: false,
              static: M.static
            };
          }
          if (M instanceof AST_ClassProperty) {
            return {
              type: "PropertyDefinition",
              key: key4,
              value: to_moz(M.value),
              computed: computed2,
              static: M.static
            };
          }
          if (parent instanceof AST_Class) {
            return {
              type: "MethodDefinition",
              computed: computed2,
              kind,
              static: M.static,
              key: to_moz(M.key),
              value: to_moz(M.value)
            };
          }
          return {
            type: "Property",
            computed: computed2,
            method: false,
            shorthand,
            kind,
            key: key4,
            value: to_moz(M.value)
          };
        });
        def_to_moz(AST_ObjectKeyVal, function To_Moz_Property(M) {
          var computed2 = M.computed_key();
          const [shorthand, key4] = to_moz_property_key(M.key, computed2, M.quote, M.value);
          return {
            type: "Property",
            computed: computed2,
            shorthand,
            method: false,
            kind: "init",
            key: key4,
            value: to_moz(M.value)
          };
        });
        def_to_moz(AST_ConciseMethod, function To_Moz_MethodDefinition(M, parent) {
          const computed2 = M.computed_key();
          const [_always_false, key4] = to_moz_property_key(M.key, computed2, M.quote, M.value);
          if (parent instanceof AST_Object) {
            return {
              type: "Property",
              kind: "init",
              computed: computed2,
              method: true,
              shorthand: false,
              key: key4,
              value: to_moz(M.value)
            };
          }
          return {
            type: "MethodDefinition",
            kind: !computed2 && M.key.name === "constructor" ? "constructor" : "method",
            computed: computed2,
            key: key4,
            value: to_moz(M.value),
            static: M.static
          };
        });
        def_to_moz(AST_PrivateMethod, function To_Moz_MethodDefinition(M) {
          return {
            type: "MethodDefinition",
            kind: "method",
            key: { type: "PrivateIdentifier", name: M.key.name },
            value: to_moz(M.value),
            computed: false,
            static: M.static
          };
        });
        def_to_moz(AST_Class, function To_Moz_Class(M) {
          var type = M instanceof AST_ClassExpression ? "ClassExpression" : "ClassDeclaration";
          return {
            type,
            superClass: to_moz(M.extends),
            id: M.name ? to_moz(M.name) : null,
            body: {
              type: "ClassBody",
              body: M.properties.map(to_moz)
            }
          };
        });
        def_to_moz(AST_ClassStaticBlock, function To_Moz_StaticBlock(M) {
          return {
            type: "StaticBlock",
            body: M.body.map(to_moz)
          };
        });
        def_to_moz(AST_NewTarget, function To_Moz_MetaProperty() {
          return {
            type: "MetaProperty",
            meta: {
              type: "Identifier",
              name: "new"
            },
            property: {
              type: "Identifier",
              name: "target"
            }
          };
        });
        def_to_moz(AST_Symbol, function To_Moz_Identifier(M, parent) {
          if (M instanceof AST_SymbolMethod && parent.quote || (M instanceof AST_SymbolImportForeign || M instanceof AST_SymbolExportForeign || M instanceof AST_SymbolExport) && M.quote) {
            return {
              type: "Literal",
              value: M.name
            };
          }
          var def = M.definition();
          return {
            type: "Identifier",
            name: def ? def.mangled_name || def.name : M.name
          };
        });
        def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) {
          const pattern = M.value.source;
          const flags2 = M.value.flags;
          return {
            type: "Literal",
            value: null,
            raw: M.print_to_string(),
            regex: { pattern, flags: flags2 }
          };
        });
        def_to_moz(AST_Constant, function To_Moz_Literal(M) {
          var value2 = M.value;
          return {
            type: "Literal",
            value: value2,
            raw: M.raw || M.print_to_string()
          };
        });
        def_to_moz(AST_Atom, function To_Moz_Atom(M) {
          return {
            type: "Identifier",
            name: String(M.value)
          };
        });
        def_to_moz(AST_BigInt, (M) => ({
          type: "Literal",
          // value cannot be represented natively
          // see: https://github.com/estree/estree/blob/master/es2020.md#bigintliteral
          value: null,
          // `M.value` is a string that may be a hex number representation.
          // but "bigint" property should have only decimal digits
          bigint: typeof BigInt === "function" ? BigInt(M.value).toString() : M.value,
          raw: M.raw
        }));
        AST_Boolean.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
        AST_Null.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
        AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() {
          return null;
        });
        AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast);
        AST_Lambda.DEFMETHOD("to_mozilla_ast", AST_Function.prototype.to_mozilla_ast);
        function my_start_token(moznode) {
          var loc = moznode.loc, start = loc && loc.start;
          var range2 = moznode.range;
          return new AST_Token(
            "",
            "",
            start && start.line || 0,
            start && start.column || 0,
            range2 ? range2[0] : moznode.start,
            false,
            [],
            [],
            loc && loc.source
          );
        }
        function my_end_token(moznode) {
          var loc = moznode.loc, end = loc && loc.end;
          var range2 = moznode.range;
          return new AST_Token(
            "",
            "",
            end && end.line || 0,
            end && end.column || 0,
            range2 ? range2[0] : moznode.end,
            false,
            [],
            [],
            loc && loc.source
          );
        }
        var FROM_MOZ_LABELS = null;
        function from_moz(node) {
          if (node == null) return null;
          return MOZ_TO_ME[node.type](node);
        }
        function from_moz_quote(moz_key, computed2) {
          if (!computed2 && moz_key.type === "Literal" && typeof moz_key.value === "string") {
            return '"';
          } else {
            return "";
          }
        }
        function from_moz_symbol(symbol_type, M, has_quote) {
          return new symbol_type({
            start: my_start_token(M),
            quote: has_quote ? '"' : void 0,
            name: M.type === "Identifier" ? M.name : String(M.value),
            end: my_end_token(M)
          });
        }
        function from_moz_lambda(M, is_method) {
          return new (is_method ? AST_Accessor : AST_Function)({
            start: my_start_token(M),
            end: my_end_token(M),
            name: M.id && from_moz_symbol(is_method ? AST_SymbolMethod : AST_SymbolLambda, M.id),
            argnames: M.params.map((M2) => from_moz_pattern(M2, AST_SymbolFunarg)),
            is_generator: M.generator,
            async: M.async,
            body: normalize_directives(from_moz(M.body).body)
          });
        }
        function from_moz_pattern(M, sym_type) {
          switch (M.type) {
            case "ObjectPattern":
              return new AST_Destructuring({
                start: my_start_token(M),
                end: my_end_token(M),
                names: M.properties.map((p) => from_moz_pattern(p, sym_type)),
                is_array: false
              });
            case "Property":
              var key4 = M.key;
              var args = {
                start: my_start_token(key4 || M.value),
                end: my_end_token(M.value),
                key: key4.type == "Identifier" ? key4.name : String(key4.value),
                quote: !M.computed && key4.type === "Literal" && typeof key4.value === "string" ? '"' : "",
                value: from_moz_pattern(M.value, sym_type)
              };
              if (M.computed) {
                args.key = from_moz(M.key);
              }
              return new AST_ObjectKeyVal(args);
            case "ArrayPattern":
              return new AST_Destructuring({
                start: my_start_token(M),
                end: my_end_token(M),
                names: M.elements.map(function(elm) {
                  if (elm === null) {
                    return new AST_Hole();
                  }
                  return from_moz_pattern(elm, sym_type);
                }),
                is_array: true
              });
            case "SpreadElement":
            case "RestElement":
              return new AST_Expansion({
                start: my_start_token(M),
                end: my_end_token(M),
                expression: from_moz_pattern(M.argument, sym_type)
              });
            case "AssignmentPattern":
              return new AST_DefaultAssign({
                start: my_start_token(M),
                end: my_end_token(M),
                left: from_moz_pattern(M.left, sym_type),
                operator: "=",
                right: from_moz(M.right)
              });
            case "Identifier":
              return new sym_type({
                start: my_start_token(M),
                end: my_end_token(M),
                name: M.name
              });
            default:
              throw new Error("Invalid node type for destructuring: " + M.type);
          }
        }
        function from_moz_label_ref(m_label) {
          if (!m_label) return null;
          const label = from_moz_symbol(AST_LabelRef, m_label);
          let i = FROM_MOZ_LABELS.length;
          while (i--) {
            const label_origin = FROM_MOZ_LABELS[i];
            if (label.name === label_origin.name) {
              label.thedef = label_origin;
              break;
            }
          }
          return label;
        }
        AST_Node.from_mozilla_ast = function(node) {
          var save_labels = FROM_MOZ_LABELS;
          FROM_MOZ_LABELS = [];
          var ast = from_moz(node);
          FROM_MOZ_LABELS = save_labels;
          return ast;
        };
        function set_moz_loc(mynode, moznode) {
          var start = mynode.start;
          var end = mynode.end;
          if (!(start && end)) {
            return moznode;
          }
          if (start.pos != null && end.endpos != null) {
            moznode.range = [start.pos, end.endpos];
          }
          if (start.line) {
            moznode.loc = {
              start: { line: start.line, column: start.col },
              end: end.endline ? { line: end.endline, column: end.endcol } : null
            };
            if (start.file) {
              moznode.loc.source = start.file;
            }
          }
          return moznode;
        }
        function def_to_moz(mytype, handler) {
          mytype.DEFMETHOD("to_mozilla_ast", function(parent) {
            return set_moz_loc(this, handler(this, parent));
          });
        }
        var TO_MOZ_STACK = null;
        function to_moz(node) {
          if (TO_MOZ_STACK === null) {
            TO_MOZ_STACK = [];
          }
          TO_MOZ_STACK.push(node);
          var ast = node != null ? node.to_mozilla_ast(TO_MOZ_STACK[TO_MOZ_STACK.length - 2]) : null;
          TO_MOZ_STACK.pop();
          if (TO_MOZ_STACK.length === 0) {
            TO_MOZ_STACK = null;
          }
          return ast;
        }
        function to_moz_property_key(key4, computed2 = false, quote = false, value2 = null) {
          if (computed2) {
            return [false, to_moz(key4)];
          }
          const key_name = typeof key4 === "string" ? key4 : key4.name;
          let moz_key;
          if (quote) {
            moz_key = { type: "Literal", value: key_name, raw: JSON.stringify(key_name) };
          } else if ("" + +key_name === key_name && +key_name >= 0) {
            moz_key = { type: "Literal", value: +key_name, raw: JSON.stringify(+key_name) };
          } else {
            moz_key = { type: "Identifier", name: key_name };
          }
          const shorthand = moz_key.type === "Identifier" && moz_key.name === key_name && (value2 instanceof AST_Symbol && value2.name === key_name || value2 instanceof AST_DefaultAssign && value2.left.name === key_name);
          return [shorthand, moz_key];
        }
        function to_moz_pattern(node) {
          if (node instanceof AST_Expansion) {
            return {
              type: "RestElement",
              argument: to_moz_pattern(node.expression)
            };
          }
          if (node instanceof AST_Symbol || node instanceof AST_Destructuring || node instanceof AST_DefaultAssign || node instanceof AST_PropAccess) {
            return to_moz(node);
          }
          throw new Error(node.TYPE);
        }
        function to_moz_in_destructuring() {
          var i = TO_MOZ_STACK.length;
          while (i--) {
            if (TO_MOZ_STACK[i] instanceof AST_Destructuring) {
              return true;
            }
          }
          return false;
        }
        function to_moz_block(node) {
          return {
            type: "BlockStatement",
            body: node.body.map(to_moz)
          };
        }
        function to_moz_scope(type, node) {
          var body = node.body.map(to_moz);
          if (node.body[0] instanceof AST_SimpleStatement && node.body[0].body instanceof AST_String) {
            body.unshift(to_moz(new AST_EmptyStatement(node.body[0])));
          }
          return {
            type,
            body
          };
        }
      })();
      function first_in_statement(stack2) {
        let node = stack2.parent(-1);
        for (let i = 0, p; p = stack2.parent(i); i++) {
          if (p instanceof AST_Statement && p.body === node)
            return true;
          if (p instanceof AST_Sequence && p.expressions[0] === node || p.TYPE === "Call" && p.expression === node || p instanceof AST_PrefixedTemplateString && p.prefix === node || p instanceof AST_Dot && p.expression === node || p instanceof AST_Sub && p.expression === node || p instanceof AST_Chain && p.expression === node || p instanceof AST_Conditional && p.condition === node || p instanceof AST_Binary && p.left === node || p instanceof AST_UnaryPostfix && p.expression === node) {
            node = p;
          } else {
            return false;
          }
        }
      }
      function left_is_object(node) {
        if (node instanceof AST_Object) return true;
        if (node instanceof AST_Sequence) return left_is_object(node.expressions[0]);
        if (node.TYPE === "Call") return left_is_object(node.expression);
        if (node instanceof AST_PrefixedTemplateString) return left_is_object(node.prefix);
        if (node instanceof AST_Dot || node instanceof AST_Sub) return left_is_object(node.expression);
        if (node instanceof AST_Chain) return left_is_object(node.expression);
        if (node instanceof AST_Conditional) return left_is_object(node.condition);
        if (node instanceof AST_Binary) return left_is_object(node.left);
        if (node instanceof AST_UnaryPostfix) return left_is_object(node.expression);
        return false;
      }
      const CODE_LINE_BREAK = 10;
      const CODE_SPACE = 32;
      const r_annotation = /[@#]__(PURE|INLINE|NOINLINE)__/;
      function is_some_comments(comment2) {
        return (comment2.type === "comment2" || comment2.type === "comment1") && /@preserve|@copyright|@lic|@cc_on|^\**!/i.test(comment2.value);
      }
      const ROPE_COMMIT_WHEN = 8 * 1e3;
      class Rope {
        constructor() {
          this.committed = "";
          this.current = "";
        }
        append(str) {
          if (this.current.length > ROPE_COMMIT_WHEN) {
            this.committed += this.current + str;
            this.current = "";
          } else {
            this.current += str;
          }
        }
        insertAt(char2, index6) {
          const { committed, current } = this;
          if (index6 < committed.length) {
            this.committed = committed.slice(0, index6) + char2 + committed.slice(index6);
          } else if (index6 === committed.length) {
            this.committed += char2;
          } else {
            index6 -= committed.length;
            this.committed += current.slice(0, index6) + char2;
            this.current = current.slice(index6);
          }
        }
        charAt(index6) {
          const { committed } = this;
          if (index6 < committed.length) return committed[index6];
          return this.current[index6 - committed.length];
        }
        charCodeAt(index6) {
          const { committed } = this;
          if (index6 < committed.length) return committed.charCodeAt(index6);
          return this.current.charCodeAt(index6 - committed.length);
        }
        length() {
          return this.committed.length + this.current.length;
        }
        expectDirective() {
          let ch3, n3 = this.length();
          if (n3 <= 0) return true;
          while ((ch3 = this.charCodeAt(--n3)) && (ch3 == CODE_SPACE || ch3 == CODE_LINE_BREAK)) ;
          return !ch3 || ch3 === 59 || ch3 === 123;
        }
        hasNLB() {
          let n3 = this.length() - 1;
          while (n3 >= 0) {
            const code = this.charCodeAt(n3--);
            if (code === CODE_LINE_BREAK) return true;
            if (code !== CODE_SPACE) return false;
          }
          return true;
        }
        toString() {
          return this.committed + this.current;
        }
      }
      function OutputStream(options) {
        var readonly2 = !options;
        options = defaults2(options, {
          ascii_only: false,
          beautify: false,
          braces: false,
          comments: "some",
          ecma: 5,
          ie8: false,
          indent_level: 4,
          indent_start: 0,
          inline_script: true,
          keep_numbers: false,
          keep_quoted_props: false,
          max_line_len: false,
          preamble: null,
          preserve_annotations: false,
          quote_keys: false,
          quote_style: 0,
          safari10: false,
          semicolons: true,
          shebang: true,
          shorthand: void 0,
          source_map: null,
          webkit: false,
          width: 80,
          wrap_iife: false,
          wrap_func_args: false,
          _destroy_ast: false
        }, true);
        if (options.shorthand === void 0)
          options.shorthand = options.ecma > 5;
        var comment_filter = return_false;
        if (options.comments) {
          let comments = options.comments;
          if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) {
            var regex_pos = options.comments.lastIndexOf("/");
            comments = new RegExp(
              options.comments.substr(1, regex_pos - 1),
              options.comments.substr(regex_pos + 1)
            );
          }
          if (comments instanceof RegExp) {
            comment_filter = function(comment2) {
              return comment2.type != "comment5" && comments.test(comment2.value);
            };
          } else if (typeof comments === "function") {
            comment_filter = function(comment2) {
              return comment2.type != "comment5" && comments(this, comment2);
            };
          } else if (comments === "some") {
            comment_filter = is_some_comments;
          } else {
            comment_filter = return_true;
          }
        }
        if (options.preserve_annotations) {
          let prev_comment_filter = comment_filter;
          comment_filter = function(comment2) {
            return r_annotation.test(comment2.value) || prev_comment_filter.apply(this, arguments);
          };
        }
        var indentation = 0;
        var current_col = 0;
        var current_line = 1;
        var current_pos = 0;
        var OUTPUT = new Rope();
        let printed_comments = /* @__PURE__ */ new Set();
        var to_utf8 = options.ascii_only ? function(str, identifier = false, regexp = false) {
          if (options.ecma >= 2015 && !options.safari10 && !regexp) {
            str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch3) {
              var code = get_full_char_code(ch3, 0).toString(16);
              return "\\u{" + code + "}";
            });
          }
          return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch3) {
            var code = ch3.charCodeAt(0).toString(16);
            if (code.length <= 2 && !identifier) {
              while (code.length < 2) code = "0" + code;
              return "\\x" + code;
            } else {
              while (code.length < 4) code = "0" + code;
              return "\\u" + code;
            }
          });
        } : function(str) {
          return str.replace(/[\ud800-\udbff][\udc00-\udfff]|([\ud800-\udbff]|[\udc00-\udfff])/g, function(match3, lone) {
            if (lone) {
              return "\\u" + lone.charCodeAt(0).toString(16);
            }
            return match3;
          });
        };
        function make_string(str, quote) {
          var dq = 0, sq = 0;
          str = str.replace(
            /[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g,
            function(s, i) {
              switch (s) {
                case '"':
                  ++dq;
                  return '"';
                case "'":
                  ++sq;
                  return "'";
                case "\\":
                  return "\\\\";
                case "\n":
                  return "\\n";
                case "\r":
                  return "\\r";
                case "	":
                  return "\\t";
                case "\b":
                  return "\\b";
                case "\f":
                  return "\\f";
                case "\v":
                  return options.ie8 ? "\\x0B" : "\\v";
                case "\u2028":
                  return "\\u2028";
                case "\u2029":
                  return "\\u2029";
                case "\uFEFF":
                  return "\\ufeff";
                case "\0":
                  return /[0-9]/.test(get_full_char(str, i + 1)) ? "\\x00" : "\\0";
              }
              return s;
            }
          );
          function quote_single() {
            return "'" + str.replace(/\x27/g, "\\'") + "'";
          }
          function quote_double() {
            return '"' + str.replace(/\x22/g, '\\"') + '"';
          }
          function quote_template() {
            return "`" + str.replace(/`/g, "\\`") + "`";
          }
          str = to_utf8(str);
          if (quote === "`") return quote_template();
          switch (options.quote_style) {
            case 1:
              return quote_single();
            case 2:
              return quote_double();
            case 3:
              return quote == "'" ? quote_single() : quote_double();
            default:
              return dq > sq ? quote_single() : quote_double();
          }
        }
        function encode_string(str, quote) {
          var ret = make_string(str, quote);
          if (options.inline_script) {
            ret = ret.replace(/<\x2f(script)([>\/\t\n\f\r ])/gi, "<\\/$1$2");
            ret = ret.replace(/\x3c!--/g, "\\x3c!--");
            ret = ret.replace(/--\x3e/g, "--\\x3e");
          }
          return ret;
        }
        function make_name(name) {
          name = name.toString();
          name = to_utf8(name, true);
          return name;
        }
        function make_indent(back) {
          return " ".repeat(options.indent_start + indentation - back * options.indent_level);
        }
        var has_parens = false;
        var might_need_space = false;
        var might_need_semicolon = false;
        var might_add_newline = 0;
        var need_newline_indented = false;
        var need_space = false;
        var newline_insert = -1;
        var last = "";
        var mapping_token, mapping_name, mappings = options.source_map && [];
        var do_add_mapping = mappings ? function() {
          mappings.forEach(function(mapping) {
            try {
              let { name, token } = mapping;
              if (name !== false) {
                if (token.type == "name" || token.type === "privatename") {
                  name = token.value;
                } else if (name instanceof AST_Symbol) {
                  name = token.type === "string" ? token.value : name.name;
                }
              }
              options.source_map.add(
                mapping.token.file,
                mapping.line,
                mapping.col,
                mapping.token.line,
                mapping.token.col,
                is_basic_identifier_string(name) ? name : void 0
              );
            } catch (ex) {
            }
          });
          mappings = [];
        } : noop3;
        var ensure_line_len = options.max_line_len ? function() {
          if (current_col > options.max_line_len) {
            if (might_add_newline) {
              OUTPUT.insertAt("\n", might_add_newline);
              const len_after_newline = OUTPUT.length() - might_add_newline - 1;
              if (mappings) {
                var delta = len_after_newline - current_col;
                mappings.forEach(function(mapping) {
                  mapping.line++;
                  mapping.col += delta;
                });
              }
              current_line++;
              current_pos++;
              current_col = len_after_newline;
            }
          }
          if (might_add_newline) {
            might_add_newline = 0;
            do_add_mapping();
          }
        } : noop3;
        var requireSemicolonChars = makePredicate("( [ + * / - , . `");
        function print(str) {
          str = String(str);
          var ch3 = get_full_char(str, 0);
          if (need_newline_indented && ch3) {
            need_newline_indented = false;
            if (ch3 !== "\n") {
              print("\n");
              indent();
            }
          }
          if (need_space && ch3) {
            need_space = false;
            if (!/[\s;})]/.test(ch3)) {
              space();
            }
          }
          newline_insert = -1;
          var prev = last.charAt(last.length - 1);
          if (might_need_semicolon) {
            might_need_semicolon = false;
            if (prev === ":" && ch3 === "}" || (!ch3 || !";}".includes(ch3)) && prev !== ";") {
              if (options.semicolons || requireSemicolonChars.has(ch3)) {
                OUTPUT.append(";");
                current_col++;
                current_pos++;
              } else {
                ensure_line_len();
                if (current_col > 0) {
                  OUTPUT.append("\n");
                  current_pos++;
                  current_line++;
                  current_col = 0;
                }
                if (/^\s+$/.test(str)) {
                  might_need_semicolon = true;
                }
              }
              if (!options.beautify)
                might_need_space = false;
            }
          }
          if (might_need_space) {
            if (is_identifier_char(prev) && (is_identifier_char(ch3) || ch3 == "\\") || ch3 == "/" && ch3 == prev || (ch3 == "+" || ch3 == "-") && ch3 == last) {
              OUTPUT.append(" ");
              current_col++;
              current_pos++;
            }
            might_need_space = false;
          }
          if (mapping_token) {
            mappings.push({
              token: mapping_token,
              name: mapping_name,
              line: current_line,
              col: current_col
            });
            mapping_token = false;
            if (!might_add_newline) do_add_mapping();
          }
          OUTPUT.append(str);
          has_parens = str[str.length - 1] == "(";
          current_pos += str.length;
          var a = str.split(/\r?\n/), n3 = a.length - 1;
          current_line += n3;
          current_col += a[0].length;
          if (n3 > 0) {
            ensure_line_len();
            current_col = a[n3].length;
          }
          last = str;
        }
        var star3 = function() {
          print("*");
        };
        var space = options.beautify ? function() {
          print(" ");
        } : function() {
          might_need_space = true;
        };
        var indent = options.beautify ? function(half) {
          if (options.beautify) {
            print(make_indent(half ? 0.5 : 0));
          }
        } : noop3;
        var with_indent = options.beautify ? function(col, cont) {
          if (col === true) col = next_indent();
          var save_indentation = indentation;
          indentation = col;
          var ret = cont();
          indentation = save_indentation;
          return ret;
        } : function(col, cont) {
          return cont();
        };
        var newline = options.beautify ? function() {
          if (newline_insert < 0) return print("\n");
          if (OUTPUT.charAt(newline_insert) != "\n") {
            OUTPUT.insertAt("\n", newline_insert);
            current_pos++;
            current_line++;
          }
          newline_insert++;
        } : options.max_line_len ? function() {
          ensure_line_len();
          might_add_newline = OUTPUT.length();
        } : noop3;
        var semicolon = options.beautify ? function() {
          print(";");
        } : function() {
          might_need_semicolon = true;
        };
        function force_semicolon() {
          might_need_semicolon = false;
          print(";");
        }
        function next_indent() {
          return indentation + options.indent_level;
        }
        function with_block(cont) {
          var ret;
          print("{");
          newline();
          with_indent(next_indent(), function() {
            ret = cont();
          });
          indent();
          print("}");
          return ret;
        }
        function with_parens(cont) {
          print("(");
          var ret = cont();
          print(")");
          return ret;
        }
        function with_square(cont) {
          print("[");
          var ret = cont();
          print("]");
          return ret;
        }
        function comma() {
          print(",");
          space();
        }
        function colon() {
          print(":");
          space();
        }
        var add_mapping = mappings ? function(token, name) {
          mapping_token = token;
          mapping_name = name;
        } : noop3;
        function get4() {
          if (might_add_newline) {
            ensure_line_len();
          }
          return OUTPUT.toString();
        }
        function filter_comment(comment2) {
          if (!options.preserve_annotations) {
            comment2 = comment2.replace(r_annotation, " ");
          }
          if (/^\s*$/.test(comment2)) {
            return "";
          }
          return comment2.replace(/(<\s*\/\s*)(script)/i, "<\\/$2");
        }
        function prepend_comments(node) {
          var self3 = this;
          var start = node.start;
          if (!start) return;
          var printed_comments2 = self3.printed_comments;
          const keyword_with_value = node instanceof AST_Exit && node.value || (node instanceof AST_Await || node instanceof AST_Yield) && node.expression;
          if (start.comments_before && printed_comments2.has(start.comments_before)) {
            if (keyword_with_value) {
              start.comments_before = [];
            } else {
              return;
            }
          }
          var comments = start.comments_before;
          if (!comments) {
            comments = start.comments_before = [];
          }
          printed_comments2.add(comments);
          if (keyword_with_value) {
            var tw = new TreeWalker(function(node2) {
              var parent = tw.parent();
              if (parent instanceof AST_Exit || parent instanceof AST_Await || parent instanceof AST_Yield || parent instanceof AST_Binary && parent.left === node2 || parent.TYPE == "Call" && parent.expression === node2 || parent instanceof AST_Conditional && parent.condition === node2 || parent instanceof AST_Dot && parent.expression === node2 || parent instanceof AST_Sequence && parent.expressions[0] === node2 || parent instanceof AST_Sub && parent.expression === node2 || parent instanceof AST_UnaryPostfix) {
                if (!node2.start) return;
                var text3 = node2.start.comments_before;
                if (text3 && !printed_comments2.has(text3)) {
                  printed_comments2.add(text3);
                  comments = comments.concat(text3);
                }
              } else {
                return true;
              }
            });
            tw.push(node);
            keyword_with_value.walk(tw);
          }
          if (current_pos == 0) {
            if (comments.length > 0 && options.shebang && comments[0].type === "comment5" && !printed_comments2.has(comments[0])) {
              print("#!" + comments.shift().value + "\n");
              indent();
            }
            var preamble = options.preamble;
            if (preamble) {
              print(preamble.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g, "\n"));
            }
          }
          comments = comments.filter(comment_filter, node).filter((c) => !printed_comments2.has(c));
          if (comments.length == 0) return;
          var last_nlb = OUTPUT.hasNLB();
          comments.forEach(function(c, i) {
            printed_comments2.add(c);
            if (!last_nlb) {
              if (c.nlb) {
                print("\n");
                indent();
                last_nlb = true;
              } else if (i > 0) {
                space();
              }
            }
            if (/comment[134]/.test(c.type)) {
              var value2 = filter_comment(c.value);
              if (value2) {
                print("//" + value2 + "\n");
                indent();
              }
              last_nlb = true;
            } else if (c.type == "comment2") {
              var value2 = filter_comment(c.value);
              if (value2) {
                print("/*" + value2 + "*/");
              }
              last_nlb = false;
            }
          });
          if (!last_nlb) {
            if (start.nlb) {
              print("\n");
              indent();
            } else {
              space();
            }
          }
        }
        function append_comments(node, tail) {
          var self3 = this;
          var token = node.end;
          if (!token) return;
          var printed_comments2 = self3.printed_comments;
          var comments = token[tail ? "comments_before" : "comments_after"];
          if (!comments || printed_comments2.has(comments)) return;
          if (!(node instanceof AST_Statement || comments.every(
            (c) => !/comment[134]/.test(c.type)
          ))) return;
          printed_comments2.add(comments);
          var insert = OUTPUT.length();
          comments.filter(comment_filter, node).forEach(function(c, i) {
            if (printed_comments2.has(c)) return;
            printed_comments2.add(c);
            need_space = false;
            if (need_newline_indented) {
              print("\n");
              indent();
              need_newline_indented = false;
            } else if (c.nlb && (i > 0 || !OUTPUT.hasNLB())) {
              print("\n");
              indent();
            } else if (i > 0 || !tail) {
              space();
            }
            if (/comment[134]/.test(c.type)) {
              const value2 = filter_comment(c.value);
              if (value2) {
                print("//" + value2);
              }
              need_newline_indented = true;
            } else if (c.type == "comment2") {
              const value2 = filter_comment(c.value);
              if (value2) {
                print("/*" + value2 + "*/");
              }
              need_space = true;
            }
          });
          if (OUTPUT.length() > insert) newline_insert = insert;
        }
        const gc_scope = options["_destroy_ast"] ? function gc_scope2(scope) {
          scope.body.length = 0;
          scope.argnames.length = 0;
        } : noop3;
        var stack2 = [];
        return {
          get: get4,
          toString: get4,
          indent,
          in_directive: false,
          use_asm: null,
          active_scope: null,
          indentation: function() {
            return indentation;
          },
          current_width: function() {
            return current_col - indentation;
          },
          should_break: function() {
            return options.width && this.current_width() >= options.width;
          },
          has_parens: function() {
            return has_parens;
          },
          newline,
          print,
          star: star3,
          space,
          comma,
          colon,
          last: function() {
            return last;
          },
          semicolon,
          force_semicolon,
          to_utf8,
          print_name: function(name) {
            print(make_name(name));
          },
          print_string: function(str, quote, escape_directive) {
            var encoded = encode_string(str, quote);
            if (escape_directive === true && !encoded.includes("\\")) {
              if (!OUTPUT.expectDirective()) {
                force_semicolon();
              }
              force_semicolon();
            }
            print(encoded);
          },
          print_template_string_chars: function(str) {
            var encoded = encode_string(str, "`").replace(/\${/g, "\\${");
            return print(encoded.substr(1, encoded.length - 2));
          },
          encode_string,
          next_indent,
          with_indent,
          with_block,
          with_parens,
          with_square,
          add_mapping,
          option: function(opt) {
            return options[opt];
          },
          gc_scope,
          printed_comments,
          prepend_comments: readonly2 ? noop3 : prepend_comments,
          append_comments: readonly2 || comment_filter === return_false ? noop3 : append_comments,
          line: function() {
            return current_line;
          },
          col: function() {
            return current_col;
          },
          pos: function() {
            return current_pos;
          },
          push_node: function(node) {
            stack2.push(node);
          },
          pop_node: function() {
            return stack2.pop();
          },
          parent: function(n3) {
            return stack2[stack2.length - 2 - (n3 || 0)];
          }
        };
      }
      (function() {
        function DEFPRINT(nodetype, generator) {
          nodetype.DEFMETHOD("_codegen", generator);
        }
        AST_Node.DEFMETHOD("print", function(output, force_parens) {
          var self3 = this, generator = self3._codegen;
          if (self3 instanceof AST_Scope) {
            output.active_scope = self3;
          } else if (!output.use_asm && self3 instanceof AST_Directive && self3.value == "use asm") {
            output.use_asm = output.active_scope;
          }
          function doit() {
            output.prepend_comments(self3);
            self3.add_source_map(output);
            generator(self3, output);
            output.append_comments(self3);
          }
          output.push_node(self3);
          if (force_parens || self3.needs_parens(output)) {
            output.with_parens(doit);
          } else {
            doit();
          }
          output.pop_node();
          if (self3 === output.use_asm) {
            output.use_asm = null;
          }
        });
        AST_Node.DEFMETHOD("_print", AST_Node.prototype.print);
        AST_Node.DEFMETHOD("print_to_string", function(options) {
          var output = OutputStream(options);
          this.print(output);
          return output.get();
        });
        function PARENS(nodetype, func) {
          if (Array.isArray(nodetype)) {
            nodetype.forEach(function(nodetype2) {
              PARENS(nodetype2, func);
            });
          } else {
            nodetype.DEFMETHOD("needs_parens", func);
          }
        }
        PARENS(AST_Node, return_false);
        PARENS(AST_Function, function(output) {
          if (!output.has_parens() && first_in_statement(output)) {
            return true;
          }
          if (output.option("webkit")) {
            var p = output.parent();
            if (p instanceof AST_PropAccess && p.expression === this) {
              return true;
            }
          }
          if (output.option("wrap_iife")) {
            var p = output.parent();
            if (p instanceof AST_Call && p.expression === this) {
              return true;
            }
          }
          if (output.option("wrap_func_args")) {
            var p = output.parent();
            if (p instanceof AST_Call && p.args.includes(this)) {
              return true;
            }
          }
          return false;
        });
        PARENS(AST_Arrow, function(output) {
          var p = output.parent();
          if (output.option("wrap_func_args") && p instanceof AST_Call && p.args.includes(this)) {
            return true;
          }
          return p instanceof AST_PropAccess && p.expression === this || p instanceof AST_Conditional && p.condition === this;
        });
        PARENS(AST_Object, function(output) {
          return !output.has_parens() && first_in_statement(output);
        });
        PARENS(AST_ClassExpression, first_in_statement);
        PARENS(AST_Unary, function(output) {
          var p = output.parent();
          return p instanceof AST_PropAccess && p.expression === this || p instanceof AST_Call && p.expression === this || p instanceof AST_Binary && p.operator === "**" && this instanceof AST_UnaryPrefix && p.left === this && this.operator !== "++" && this.operator !== "--";
        });
        PARENS(AST_Await, function(output) {
          var p = output.parent();
          return p instanceof AST_PropAccess && p.expression === this || p instanceof AST_Call && p.expression === this || p instanceof AST_Binary && p.operator === "**" && p.left === this || output.option("safari10") && p instanceof AST_UnaryPrefix;
        });
        PARENS(AST_Sequence, function(output) {
          var p = output.parent();
          return p instanceof AST_Call || p instanceof AST_Unary || p instanceof AST_Binary || p instanceof AST_VarDefLike || p instanceof AST_PropAccess || p instanceof AST_Array || p instanceof AST_ObjectProperty || p instanceof AST_Conditional || p instanceof AST_Arrow || p instanceof AST_DefaultAssign || p instanceof AST_Expansion || p instanceof AST_ForOf && this === p.object || p instanceof AST_Yield || p instanceof AST_Export;
        });
        PARENS(AST_Binary, function(output) {
          var p = output.parent();
          if (p instanceof AST_Call && p.expression === this)
            return true;
          if (p instanceof AST_Unary)
            return true;
          if (p instanceof AST_PropAccess && p.expression === this)
            return true;
          if (p instanceof AST_Binary) {
            const parent_op = p.operator;
            const op = this.operator;
            if (op === "??" && (parent_op === "||" || parent_op === "&&")) {
              return true;
            }
            if (parent_op === "??" && (op === "||" || op === "&&")) {
              return true;
            }
            const pp = PRECEDENCE[parent_op];
            const sp = PRECEDENCE[op];
            if (pp > sp || pp == sp && (this === p.right || parent_op == "**")) {
              return true;
            }
          }
          if (p instanceof AST_PrivateIn) {
            const op = this.operator;
            const pp = PRECEDENCE["in"];
            const sp = PRECEDENCE[op];
            if (pp > sp || pp == sp && this === p.value) {
              return true;
            }
          }
        });
        PARENS(AST_PrivateIn, function(output) {
          var p = output.parent();
          if (p instanceof AST_Call && p.expression === this) {
            return true;
          }
          if (p instanceof AST_Unary) {
            return true;
          }
          if (p instanceof AST_PropAccess && p.expression === this) {
            return true;
          }
          if (p instanceof AST_Binary) {
            const parent_op = p.operator;
            const pp = PRECEDENCE[parent_op];
            const sp = PRECEDENCE["in"];
            if (pp > sp || pp == sp && (this === p.right || parent_op == "**")) {
              return true;
            }
          }
          if (p instanceof AST_PrivateIn && this === p.value) {
            return true;
          }
        });
        PARENS(AST_Yield, function(output) {
          var p = output.parent();
          if (p instanceof AST_Binary && p.operator !== "=")
            return true;
          if (p instanceof AST_Call && p.expression === this)
            return true;
          if (p instanceof AST_Conditional && p.condition === this)
            return true;
          if (p instanceof AST_Unary)
            return true;
          if (p instanceof AST_PropAccess && p.expression === this)
            return true;
        });
        PARENS(AST_Chain, function(output) {
          var p = output.parent();
          if (!(p instanceof AST_Call || p instanceof AST_PropAccess)) return false;
          return p.expression === this;
        });
        PARENS(AST_PropAccess, function(output) {
          var p = output.parent();
          if (p instanceof AST_New && p.expression === this) {
            return walk(this, (node) => {
              if (node instanceof AST_Scope) return true;
              if (node instanceof AST_Call) {
                return walk_abort;
              }
            });
          }
        });
        PARENS(AST_Call, function(output) {
          var p = output.parent(), p1;
          if (p instanceof AST_New && p.expression === this || p instanceof AST_Export && p.is_default && this.expression instanceof AST_Function)
            return true;
          return this.expression instanceof AST_Function && p instanceof AST_PropAccess && p.expression === this && (p1 = output.parent(1)) instanceof AST_Assign && p1.left === p;
        });
        PARENS(AST_New, function(output) {
          var p = output.parent();
          if (this.args.length === 0 && (p instanceof AST_PropAccess || p instanceof AST_Call && p.expression === this || p instanceof AST_PrefixedTemplateString && p.prefix === this))
            return true;
        });
        PARENS(AST_Number, function(output) {
          var p = output.parent();
          if (p instanceof AST_PropAccess && p.expression === this) {
            var value2 = this.getValue();
            if (value2 < 0 || /^0/.test(make_num(value2))) {
              return true;
            }
          }
        });
        PARENS(AST_BigInt, function(output) {
          var p = output.parent();
          if (p instanceof AST_PropAccess && p.expression === this) {
            var value2 = this.getValue();
            if (value2.startsWith("-")) {
              return true;
            }
          }
        });
        PARENS([AST_Assign, AST_Conditional], function(output) {
          var p = output.parent();
          if (p instanceof AST_Unary)
            return true;
          if (p instanceof AST_Binary && !(p instanceof AST_Assign))
            return true;
          if (p instanceof AST_Call && p.expression === this)
            return true;
          if (p instanceof AST_Conditional && p.condition === this)
            return true;
          if (p instanceof AST_PropAccess && p.expression === this)
            return true;
          if (this instanceof AST_Assign && this.left instanceof AST_Destructuring && this.left.is_array === false)
            return true;
        });
        DEFPRINT(AST_Directive, function(self3, output) {
          output.print_string(self3.value, self3.quote);
          output.semicolon();
        });
        DEFPRINT(AST_Expansion, function(self3, output) {
          output.print("...");
          self3.expression.print(output);
        });
        DEFPRINT(AST_Destructuring, function(self3, output) {
          output.print(self3.is_array ? "[" : "{");
          var len = self3.names.length;
          self3.names.forEach(function(name, i) {
            if (i > 0) output.comma();
            name.print(output);
            if (i == len - 1 && name instanceof AST_Hole) output.comma();
          });
          output.print(self3.is_array ? "]" : "}");
        });
        DEFPRINT(AST_Debugger, function(self3, output) {
          output.print("debugger");
          output.semicolon();
        });
        function display_body(body, is_toplevel, output, allow_directives) {
          var last = body.length - 1;
          output.in_directive = allow_directives;
          body.forEach(function(stmt, i) {
            if (output.in_directive === true && !(stmt instanceof AST_Directive || stmt instanceof AST_EmptyStatement || stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String)) {
              output.in_directive = false;
            }
            if (!(stmt instanceof AST_EmptyStatement)) {
              output.indent();
              stmt.print(output);
              if (!(i == last && is_toplevel)) {
                output.newline();
                if (is_toplevel) output.newline();
              }
            }
            if (output.in_directive === true && stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String) {
              output.in_directive = false;
            }
          });
          output.in_directive = false;
        }
        AST_StatementWithBody.DEFMETHOD("_do_print_body", function(output) {
          print_maybe_braced_body(this.body, output);
        });
        DEFPRINT(AST_Statement, function(self3, output) {
          self3.body.print(output);
          output.semicolon();
        });
        DEFPRINT(AST_Toplevel, function(self3, output) {
          display_body(self3.body, true, output, true);
          output.print("");
        });
        DEFPRINT(AST_LabeledStatement, function(self3, output) {
          self3.label.print(output);
          output.colon();
          self3.body.print(output);
        });
        DEFPRINT(AST_SimpleStatement, function(self3, output) {
          self3.body.print(output);
          output.semicolon();
        });
        function print_braced_empty(self3, output) {
          output.print("{");
          output.with_indent(output.next_indent(), function() {
            output.append_comments(self3, true);
          });
          output.add_mapping(self3.end);
          output.print("}");
        }
        function print_braced(self3, output, allow_directives) {
          if (self3.body.length > 0) {
            output.with_block(function() {
              display_body(self3.body, false, output, allow_directives);
              output.add_mapping(self3.end);
            });
          } else print_braced_empty(self3, output);
        }
        DEFPRINT(AST_BlockStatement, function(self3, output) {
          print_braced(self3, output);
        });
        DEFPRINT(AST_EmptyStatement, function(self3, output) {
          output.semicolon();
        });
        DEFPRINT(AST_Do, function(self3, output) {
          output.print("do");
          output.space();
          make_block(self3.body, output);
          output.space();
          output.print("while");
          output.space();
          output.with_parens(function() {
            self3.condition.print(output);
          });
          output.semicolon();
        });
        DEFPRINT(AST_While, function(self3, output) {
          output.print("while");
          output.space();
          output.with_parens(function() {
            self3.condition.print(output);
          });
          output.space();
          self3._do_print_body(output);
        });
        DEFPRINT(AST_For, function(self3, output) {
          output.print("for");
          output.space();
          output.with_parens(function() {
            if (self3.init) {
              if (self3.init instanceof AST_DefinitionsLike) {
                self3.init.print(output);
              } else {
                parenthesize_for_noin(self3.init, output, true);
              }
              output.print(";");
              output.space();
            } else {
              output.print(";");
            }
            if (self3.condition) {
              self3.condition.print(output);
              output.print(";");
              output.space();
            } else {
              output.print(";");
            }
            if (self3.step) {
              self3.step.print(output);
            }
          });
          output.space();
          self3._do_print_body(output);
        });
        DEFPRINT(AST_ForIn, function(self3, output) {
          output.print("for");
          if (self3.await) {
            output.space();
            output.print("await");
          }
          output.space();
          output.with_parens(function() {
            self3.init.print(output);
            output.space();
            output.print(self3 instanceof AST_ForOf ? "of" : "in");
            output.space();
            self3.object.print(output);
          });
          output.space();
          self3._do_print_body(output);
        });
        DEFPRINT(AST_With, function(self3, output) {
          output.print("with");
          output.space();
          output.with_parens(function() {
            self3.expression.print(output);
          });
          output.space();
          self3._do_print_body(output);
        });
        AST_Lambda.DEFMETHOD("_do_print", function(output, nokeyword) {
          var self3 = this;
          if (!nokeyword) {
            if (self3.async) {
              output.print("async");
              output.space();
            }
            output.print("function");
            if (self3.is_generator) {
              output.star();
            }
            if (self3.name) {
              output.space();
            }
          }
          if (self3.name instanceof AST_Symbol) {
            self3.name.print(output);
          } else if (nokeyword && self3.name instanceof AST_Node) {
            output.with_square(function() {
              self3.name.print(output);
            });
          }
          output.with_parens(function() {
            self3.argnames.forEach(function(arg, i) {
              if (i) output.comma();
              arg.print(output);
            });
          });
          output.space();
          print_braced(self3, output, true);
        });
        DEFPRINT(AST_Lambda, function(self3, output) {
          self3._do_print(output);
          output.gc_scope(self3);
        });
        DEFPRINT(AST_PrefixedTemplateString, function(self3, output) {
          var tag2 = self3.prefix;
          var parenthesize_tag = tag2 instanceof AST_Lambda || tag2 instanceof AST_Binary || tag2 instanceof AST_Conditional || tag2 instanceof AST_Sequence || tag2 instanceof AST_Unary || tag2 instanceof AST_Dot && tag2.expression instanceof AST_Object;
          if (parenthesize_tag) output.print("(");
          self3.prefix.print(output);
          if (parenthesize_tag) output.print(")");
          self3.template_string.print(output);
        });
        DEFPRINT(AST_TemplateString, function(self3, output) {
          var is_tagged = output.parent() instanceof AST_PrefixedTemplateString;
          output.print("`");
          for (var i = 0; i < self3.segments.length; i++) {
            if (!(self3.segments[i] instanceof AST_TemplateSegment)) {
              output.print("${");
              self3.segments[i].print(output);
              output.print("}");
            } else if (is_tagged) {
              output.print(self3.segments[i].raw);
            } else {
              output.print_template_string_chars(self3.segments[i].value);
            }
          }
          output.print("`");
        });
        DEFPRINT(AST_TemplateSegment, function(self3, output) {
          output.print_template_string_chars(self3.value);
        });
        AST_Arrow.DEFMETHOD("_do_print", function(output) {
          var self3 = this;
          var parent = output.parent();
          var needs_parens = parent instanceof AST_Binary && !(parent instanceof AST_Assign) && !(parent instanceof AST_DefaultAssign) || parent instanceof AST_Unary || parent instanceof AST_Call && self3 === parent.expression;
          if (needs_parens) {
            output.print("(");
          }
          if (self3.async) {
            output.print("async");
            output.space();
          }
          if (self3.argnames.length === 1 && self3.argnames[0] instanceof AST_Symbol) {
            self3.argnames[0].print(output);
          } else {
            output.with_parens(function() {
              self3.argnames.forEach(function(arg, i) {
                if (i) output.comma();
                arg.print(output);
              });
            });
          }
          output.space();
          output.print("=>");
          output.space();
          const first_statement = self3.body[0];
          if (self3.body.length === 1 && first_statement instanceof AST_Return) {
            const returned = first_statement.value;
            if (!returned) {
              output.print("{}");
            } else if (left_is_object(returned)) {
              output.print("(");
              returned.print(output);
              output.print(")");
            } else {
              returned.print(output);
            }
          } else {
            print_braced(self3, output);
          }
          if (needs_parens) {
            output.print(")");
          }
          output.gc_scope(self3);
        });
        AST_Exit.DEFMETHOD("_do_print", function(output, kind) {
          output.print(kind);
          if (this.value) {
            output.space();
            const comments = this.value.start.comments_before;
            if (comments && comments.length && !output.printed_comments.has(comments)) {
              output.print("(");
              this.value.print(output);
              output.print(")");
            } else {
              this.value.print(output);
            }
          }
          output.semicolon();
        });
        DEFPRINT(AST_Return, function(self3, output) {
          self3._do_print(output, "return");
        });
        DEFPRINT(AST_Throw, function(self3, output) {
          self3._do_print(output, "throw");
        });
        DEFPRINT(AST_Yield, function(self3, output) {
          var star3 = self3.is_star ? "*" : "";
          output.print("yield" + star3);
          if (self3.expression) {
            output.space();
            self3.expression.print(output);
          }
        });
        DEFPRINT(AST_Await, function(self3, output) {
          output.print("await");
          output.space();
          var e2 = self3.expression;
          var parens = !(e2 instanceof AST_Call || e2 instanceof AST_SymbolRef || e2 instanceof AST_PropAccess || e2 instanceof AST_Unary || e2 instanceof AST_Constant || e2 instanceof AST_Await || e2 instanceof AST_Object);
          if (parens) output.print("(");
          self3.expression.print(output);
          if (parens) output.print(")");
        });
        AST_LoopControl.DEFMETHOD("_do_print", function(output, kind) {
          output.print(kind);
          if (this.label) {
            output.space();
            this.label.print(output);
          }
          output.semicolon();
        });
        DEFPRINT(AST_Break, function(self3, output) {
          self3._do_print(output, "break");
        });
        DEFPRINT(AST_Continue, function(self3, output) {
          self3._do_print(output, "continue");
        });
        function make_then(self3, output) {
          var b = self3.body;
          if (output.option("braces") || output.option("ie8") && b instanceof AST_Do)
            return make_block(b, output);
          if (!b) return output.force_semicolon();
          while (true) {
            if (b instanceof AST_If) {
              if (!b.alternative) {
                make_block(self3.body, output);
                return;
              }
              b = b.alternative;
            } else if (b instanceof AST_StatementWithBody) {
              b = b.body;
            } else break;
          }
          print_maybe_braced_body(self3.body, output);
        }
        DEFPRINT(AST_If, function(self3, output) {
          output.print("if");
          output.space();
          output.with_parens(function() {
            self3.condition.print(output);
          });
          output.space();
          if (self3.alternative) {
            make_then(self3, output);
            output.space();
            output.print("else");
            output.space();
            if (self3.alternative instanceof AST_If)
              self3.alternative.print(output);
            else
              print_maybe_braced_body(self3.alternative, output);
          } else {
            self3._do_print_body(output);
          }
        });
        DEFPRINT(AST_Switch, function(self3, output) {
          output.print("switch");
          output.space();
          output.with_parens(function() {
            self3.expression.print(output);
          });
          output.space();
          var last = self3.body.length - 1;
          if (last < 0) print_braced_empty(self3, output);
          else output.with_block(function() {
            self3.body.forEach(function(branch2, i) {
              output.indent(true);
              branch2.print(output);
              if (i < last && branch2.body.length > 0)
                output.newline();
            });
          });
        });
        AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output) {
          output.newline();
          this.body.forEach(function(stmt) {
            output.indent();
            stmt.print(output);
            output.newline();
          });
        });
        DEFPRINT(AST_Default, function(self3, output) {
          output.print("default:");
          self3._do_print_body(output);
        });
        DEFPRINT(AST_Case, function(self3, output) {
          output.print("case");
          output.space();
          self3.expression.print(output);
          output.print(":");
          self3._do_print_body(output);
        });
        DEFPRINT(AST_Try, function(self3, output) {
          output.print("try");
          output.space();
          self3.body.print(output);
          if (self3.bcatch) {
            output.space();
            self3.bcatch.print(output);
          }
          if (self3.bfinally) {
            output.space();
            self3.bfinally.print(output);
          }
        });
        DEFPRINT(AST_TryBlock, function(self3, output) {
          print_braced(self3, output);
        });
        DEFPRINT(AST_Catch, function(self3, output) {
          output.print("catch");
          if (self3.argname) {
            output.space();
            output.with_parens(function() {
              self3.argname.print(output);
            });
          }
          output.space();
          print_braced(self3, output);
        });
        DEFPRINT(AST_Finally, function(self3, output) {
          output.print("finally");
          output.space();
          print_braced(self3, output);
        });
        AST_DefinitionsLike.DEFMETHOD("_do_print", function(output, kind) {
          output.print(kind);
          output.space();
          this.definitions.forEach(function(def, i) {
            if (i) output.comma();
            def.print(output);
          });
          var p = output.parent();
          var in_for = p instanceof AST_For || p instanceof AST_ForIn;
          var output_semicolon = !in_for || p && p.init !== this;
          if (output_semicolon)
            output.semicolon();
        });
        DEFPRINT(AST_Let, function(self3, output) {
          self3._do_print(output, "let");
        });
        DEFPRINT(AST_Var, function(self3, output) {
          self3._do_print(output, "var");
        });
        DEFPRINT(AST_Const, function(self3, output) {
          self3._do_print(output, "const");
        });
        DEFPRINT(AST_Using, function(self3, output) {
          self3._do_print(output, self3.await ? "await using" : "using");
        });
        DEFPRINT(AST_Import, function(self3, output) {
          output.print("import");
          output.space();
          if (self3.imported_name) {
            self3.imported_name.print(output);
          }
          if (self3.imported_name && self3.imported_names) {
            output.print(",");
            output.space();
          }
          if (self3.imported_names) {
            if (self3.imported_names.length === 1 && self3.imported_names[0].foreign_name.name === "*" && !self3.imported_names[0].foreign_name.quote) {
              self3.imported_names[0].print(output);
            } else {
              output.print("{");
              self3.imported_names.forEach(function(name_import, i) {
                output.space();
                name_import.print(output);
                if (i < self3.imported_names.length - 1) {
                  output.print(",");
                }
              });
              output.space();
              output.print("}");
            }
          }
          if (self3.imported_name || self3.imported_names) {
            output.space();
            output.print("from");
            output.space();
          }
          self3.module_name.print(output);
          if (self3.attributes) {
            output.print("with");
            self3.attributes.print(output);
          }
          output.semicolon();
        });
        DEFPRINT(AST_ImportMeta, function(self3, output) {
          output.print("import.meta");
        });
        DEFPRINT(AST_NameMapping, function(self3, output) {
          var is_import = output.parent() instanceof AST_Import;
          var definition = self3.name.definition();
          var foreign_name = self3.foreign_name;
          var names_are_different = (definition && definition.mangled_name || self3.name.name) !== foreign_name.name;
          if (!names_are_different && foreign_name.name === "*" && !!foreign_name.quote != !!self3.name.quote) {
            names_are_different = true;
          }
          var foreign_name_is_name = !foreign_name.quote;
          if (names_are_different) {
            if (is_import) {
              if (foreign_name_is_name) {
                output.print(foreign_name.name);
              } else {
                output.print_string(foreign_name.name, foreign_name.quote);
              }
            } else {
              if (!self3.name.quote) {
                self3.name.print(output);
              } else {
                output.print_string(self3.name.name, self3.name.quote);
              }
            }
            output.space();
            output.print("as");
            output.space();
            if (is_import) {
              self3.name.print(output);
            } else {
              if (foreign_name_is_name) {
                output.print(foreign_name.name);
              } else {
                output.print_string(foreign_name.name, foreign_name.quote);
              }
            }
          } else {
            if (!self3.name.quote) {
              self3.name.print(output);
            } else {
              output.print_string(self3.name.name, self3.name.quote);
            }
          }
        });
        DEFPRINT(AST_Export, function(self3, output) {
          output.print("export");
          output.space();
          if (self3.is_default) {
            output.print("default");
            output.space();
          }
          if (self3.exported_names) {
            if (self3.exported_names.length === 1 && self3.exported_names[0].name.name === "*" && !self3.exported_names[0].name.quote) {
              self3.exported_names[0].print(output);
            } else {
              output.print("{");
              self3.exported_names.forEach(function(name_export, i) {
                output.space();
                name_export.print(output);
                if (i < self3.exported_names.length - 1) {
                  output.print(",");
                }
              });
              output.space();
              output.print("}");
            }
          } else if (self3.exported_value) {
            self3.exported_value.print(output);
          } else if (self3.exported_definition) {
            self3.exported_definition.print(output);
            if (self3.exported_definition instanceof AST_Definitions) return;
          }
          if (self3.module_name) {
            output.space();
            output.print("from");
            output.space();
            self3.module_name.print(output);
          }
          if (self3.attributes) {
            output.print("with");
            self3.attributes.print(output);
          }
          if (self3.exported_value && !(self3.exported_value instanceof AST_Defun || self3.exported_value instanceof AST_Function || self3.exported_value instanceof AST_Class) || self3.module_name || self3.exported_names) {
            output.semicolon();
          }
        });
        function parenthesize_for_noin(node, output, noin) {
          var parens = false;
          if (noin) {
            parens = walk(node, (node2) => {
              if (node2 instanceof AST_Scope && !(node2 instanceof AST_Arrow)) {
                return true;
              }
              if (node2 instanceof AST_Binary && node2.operator == "in" || node2 instanceof AST_PrivateIn) {
                return walk_abort;
              }
            });
          }
          node.print(output, parens);
        }
        DEFPRINT(AST_VarDefLike, function(self3, output) {
          self3.name.print(output);
          if (self3.value) {
            output.space();
            output.print("=");
            output.space();
            var p = output.parent(1);
            var noin = p instanceof AST_For || p instanceof AST_ForIn;
            parenthesize_for_noin(self3.value, output, noin);
          }
        });
        DEFPRINT(AST_Call, function(self3, output) {
          self3.expression.print(output);
          if (self3 instanceof AST_New && self3.args.length === 0)
            return;
          if (self3.expression instanceof AST_Call || self3.expression instanceof AST_Lambda) {
            output.add_mapping(self3.start);
          }
          if (self3.optional) output.print("?.");
          output.with_parens(function() {
            self3.args.forEach(function(expr, i) {
              if (i) output.comma();
              expr.print(output);
            });
          });
        });
        DEFPRINT(AST_New, function(self3, output) {
          output.print("new");
          output.space();
          AST_Call.prototype._codegen(self3, output);
        });
        AST_Sequence.DEFMETHOD("_do_print", function(output) {
          this.expressions.forEach(function(node, index6) {
            if (index6 > 0) {
              output.comma();
              if (output.should_break()) {
                output.newline();
                output.indent();
              }
            }
            node.print(output);
          });
        });
        DEFPRINT(AST_Sequence, function(self3, output) {
          self3._do_print(output);
        });
        DEFPRINT(AST_Dot, function(self3, output) {
          var expr = self3.expression;
          expr.print(output);
          var prop2 = self3.property;
          var print_computed = ALL_RESERVED_WORDS.has(prop2) ? output.option("ie8") : !is_identifier_string(
            prop2,
            output.option("ecma") >= 2015 && !output.option("safari10")
          );
          if (self3.optional) output.print("?.");
          if (print_computed) {
            output.print("[");
            output.add_mapping(self3.end);
            output.print_string(prop2);
            output.print("]");
          } else {
            if (expr instanceof AST_Number && expr.getValue() >= 0) {
              if (!/[xa-f.)]/i.test(output.last())) {
                output.print(".");
              }
            }
            if (!self3.optional) output.print(".");
            output.add_mapping(self3.end);
            output.print_name(prop2);
          }
        });
        DEFPRINT(AST_DotHash, function(self3, output) {
          var expr = self3.expression;
          expr.print(output);
          var prop2 = self3.property;
          if (self3.optional) output.print("?");
          output.print(".#");
          output.add_mapping(self3.end);
          output.print_name(prop2);
        });
        DEFPRINT(AST_Sub, function(self3, output) {
          self3.expression.print(output);
          if (self3.optional) output.print("?.");
          output.print("[");
          self3.property.print(output);
          output.print("]");
        });
        DEFPRINT(AST_Chain, function(self3, output) {
          self3.expression.print(output);
        });
        DEFPRINT(AST_UnaryPrefix, function(self3, output) {
          var op = self3.operator;
          if (op === "--" && output.last().endsWith("!")) {
            output.print(" ");
          }
          output.print(op);
          if (/^[a-z]/i.test(op) || /[+-]$/.test(op) && self3.expression instanceof AST_UnaryPrefix && /^[+-]/.test(self3.expression.operator)) {
            output.space();
          }
          self3.expression.print(output);
        });
        DEFPRINT(AST_UnaryPostfix, function(self3, output) {
          self3.expression.print(output);
          output.print(self3.operator);
        });
        DEFPRINT(AST_Binary, function(self3, output) {
          var op = self3.operator;
          self3.left.print(output);
          if (op[0] == ">" && output.last().endsWith("--")) {
            output.print(" ");
          } else {
            output.space();
          }
          output.print(op);
          output.space();
          self3.right.print(output);
        });
        DEFPRINT(AST_Conditional, function(self3, output) {
          self3.condition.print(output);
          output.space();
          output.print("?");
          output.space();
          self3.consequent.print(output);
          output.space();
          output.colon();
          self3.alternative.print(output);
        });
        DEFPRINT(AST_Array, function(self3, output) {
          output.with_square(function() {
            var a = self3.elements, len = a.length;
            if (len > 0) output.space();
            a.forEach(function(exp, i) {
              if (i) output.comma();
              exp.print(output);
              if (i === len - 1 && exp instanceof AST_Hole)
                output.comma();
            });
            if (len > 0) output.space();
          });
        });
        DEFPRINT(AST_Object, function(self3, output) {
          if (self3.properties.length > 0) output.with_block(function() {
            self3.properties.forEach(function(prop2, i) {
              if (i) {
                output.print(",");
                output.newline();
              }
              output.indent();
              prop2.print(output);
            });
            output.newline();
          });
          else print_braced_empty(self3, output);
        });
        DEFPRINT(AST_Class, function(self3, output) {
          output.print("class");
          output.space();
          if (self3.name) {
            self3.name.print(output);
            output.space();
          }
          if (self3.extends) {
            var parens = !(self3.extends instanceof AST_SymbolRef) && !(self3.extends instanceof AST_PropAccess) && !(self3.extends instanceof AST_ClassExpression) && !(self3.extends instanceof AST_Function);
            output.print("extends");
            if (parens) {
              output.print("(");
            } else {
              output.space();
            }
            self3.extends.print(output);
            if (parens) {
              output.print(")");
            } else {
              output.space();
            }
          }
          if (self3.properties.length > 0) output.with_block(function() {
            self3.properties.forEach(function(prop2, i) {
              if (i) {
                output.newline();
              }
              output.indent();
              prop2.print(output);
            });
            output.newline();
          });
          else output.print("{}");
        });
        DEFPRINT(AST_NewTarget, function(self3, output) {
          output.print("new.target");
        });
        function print_property_name(key4, quote, output) {
          if (output.option("quote_keys")) {
            output.print_string(key4);
            return false;
          }
          if ("" + +key4 == key4 && key4 >= 0) {
            if (output.option("keep_numbers")) {
              output.print(key4);
              return false;
            }
            output.print(make_num(key4));
            return false;
          }
          var print_string = ALL_RESERVED_WORDS.has(key4) ? output.option("ie8") : output.option("ecma") < 2015 || output.option("safari10") ? !is_basic_identifier_string(key4) : !is_identifier_string(key4, true);
          if (print_string || quote && output.option("keep_quoted_props")) {
            output.print_string(key4, quote);
            return false;
          }
          output.print_name(key4);
          return true;
        }
        DEFPRINT(AST_ObjectKeyVal, function(self3, output) {
          function get_name(self4) {
            var def = self4.definition();
            return def ? def.mangled_name || def.name : self4.name;
          }
          const try_shorthand = output.option("shorthand") && !(self3.key instanceof AST_Node);
          if (try_shorthand && self3.value instanceof AST_Symbol && get_name(self3.value) === self3.key && !ALL_RESERVED_WORDS.has(self3.key)) {
            const was_shorthand = print_property_name(self3.key, self3.quote, output);
            if (!was_shorthand) {
              output.colon();
              self3.value.print(output);
            }
          } else if (try_shorthand && self3.value instanceof AST_DefaultAssign && self3.value.left instanceof AST_Symbol && get_name(self3.value.left) === self3.key) {
            const was_shorthand = print_property_name(self3.key, self3.quote, output);
            if (!was_shorthand) {
              output.colon();
              self3.value.left.print(output);
            }
            output.space();
            output.print("=");
            output.space();
            self3.value.right.print(output);
          } else {
            if (!(self3.key instanceof AST_Node)) {
              print_property_name(self3.key, self3.quote, output);
            } else {
              output.with_square(function() {
                self3.key.print(output);
              });
            }
            output.colon();
            self3.value.print(output);
          }
        });
        DEFPRINT(AST_ClassPrivateProperty, (self3, output) => {
          if (self3.static) {
            output.print("static");
            output.space();
          }
          output.print("#");
          print_property_name(self3.key.name, void 0, output);
          if (self3.value) {
            output.print("=");
            self3.value.print(output);
          }
          output.semicolon();
        });
        DEFPRINT(AST_ClassProperty, (self3, output) => {
          if (self3.static) {
            output.print("static");
            output.space();
          }
          if (self3.key instanceof AST_SymbolClassProperty) {
            print_property_name(self3.key.name, self3.quote, output);
          } else {
            output.print("[");
            self3.key.print(output);
            output.print("]");
          }
          if (self3.value) {
            output.print("=");
            self3.value.print(output);
          }
          output.semicolon();
        });
        AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, is_private, output) {
          var self3 = this;
          if (self3.static) {
            output.print("static");
            output.space();
          }
          if (type) {
            output.print(type);
            output.space();
          }
          if (self3.key instanceof AST_SymbolMethod) {
            if (is_private) output.print("#");
            print_property_name(self3.key.name, self3.quote, output);
            self3.key.add_source_map(output);
          } else {
            output.with_square(function() {
              self3.key.print(output);
            });
          }
          self3.value._do_print(output, true);
        });
        DEFPRINT(AST_ObjectSetter, function(self3, output) {
          self3._print_getter_setter("set", false, output);
        });
        DEFPRINT(AST_ObjectGetter, function(self3, output) {
          self3._print_getter_setter("get", false, output);
        });
        DEFPRINT(AST_PrivateSetter, function(self3, output) {
          self3._print_getter_setter("set", true, output);
        });
        DEFPRINT(AST_PrivateGetter, function(self3, output) {
          self3._print_getter_setter("get", true, output);
        });
        DEFPRINT(AST_ConciseMethod, function(self3, output) {
          var type;
          if (self3.value.is_generator && self3.value.async) {
            type = "async*";
          } else if (self3.value.is_generator) {
            type = "*";
          } else if (self3.value.async) {
            type = "async";
          }
          self3._print_getter_setter(type, false, output);
        });
        DEFPRINT(AST_PrivateMethod, function(self3, output) {
          var type;
          if (self3.value.is_generator && self3.value.async) {
            type = "async*";
          } else if (self3.value.is_generator) {
            type = "*";
          } else if (self3.value.async) {
            type = "async";
          }
          self3._print_getter_setter(type, true, output);
        });
        DEFPRINT(AST_PrivateIn, function(self3, output) {
          self3.key.print(output);
          output.space();
          output.print("in");
          output.space();
          self3.value.print(output);
        });
        DEFPRINT(AST_SymbolPrivateProperty, function(self3, output) {
          output.print("#" + self3.name);
        });
        DEFPRINT(AST_ClassStaticBlock, function(self3, output) {
          output.print("static");
          output.space();
          print_braced(self3, output);
        });
        AST_Symbol.DEFMETHOD("_do_print", function(output) {
          var def = this.definition();
          output.print_name(def ? def.mangled_name || def.name : this.name);
        });
        DEFPRINT(AST_Symbol, function(self3, output) {
          self3._do_print(output);
        });
        DEFPRINT(AST_Hole, noop3);
        DEFPRINT(AST_This, function(self3, output) {
          output.print("this");
        });
        DEFPRINT(AST_Super, function(self3, output) {
          output.print("super");
        });
        DEFPRINT(AST_Constant, function(self3, output) {
          output.print(self3.getValue());
        });
        DEFPRINT(AST_String, function(self3, output) {
          output.print_string(self3.getValue(), self3.quote, output.in_directive);
        });
        DEFPRINT(AST_Number, function(self3, output) {
          if ((output.option("keep_numbers") || output.use_asm) && self3.raw) {
            output.print(self3.raw);
          } else {
            output.print(make_num(self3.getValue()));
          }
        });
        DEFPRINT(AST_BigInt, function(self3, output) {
          if (output.option("keep_numbers") && self3.raw) {
            output.print(self3.raw);
          } else {
            output.print(self3.getValue() + "n");
          }
        });
        const r_slash_script = /(<\s*\/\s*script)/i;
        const r_starts_with_script = /^\s*script/i;
        const slash_script_replace = (_, $1) => $1.replace("/", "\\/");
        DEFPRINT(AST_RegExp, function(self3, output) {
          let { source: source2, flags: flags2 } = self3.getValue();
          source2 = regexp_source_fix(source2);
          flags2 = flags2 ? sort_regexp_flags(flags2) : "";
          source2 = source2.replace(r_slash_script, slash_script_replace);
          if (r_starts_with_script.test(source2) && output.last().endsWith("<")) {
            output.print(" ");
          }
          output.print(output.to_utf8(`/${source2}/${flags2}`, false, true));
          const parent = output.parent();
          if (parent instanceof AST_Binary && /^\w/.test(parent.operator) && parent.left === self3) {
            output.print(" ");
          }
        });
        function print_maybe_braced_body(stat, output) {
          if (output.option("braces")) {
            make_block(stat, output);
          } else {
            if (!stat || stat instanceof AST_EmptyStatement)
              output.force_semicolon();
            else if (stat instanceof AST_DefinitionsLike && !(stat instanceof AST_Var) || stat instanceof AST_Class)
              make_block(stat, output);
            else
              stat.print(output);
          }
        }
        function best_of2(a) {
          var best = a[0], len = best.length;
          for (var i = 1; i < a.length; ++i) {
            if (a[i].length < len) {
              best = a[i];
              len = best.length;
            }
          }
          return best;
        }
        function make_num(num) {
          var str = num.toString(10).replace(/^0\./, ".").replace("e+", "e");
          var candidates = [str];
          if (Math.floor(num) === num) {
            if (num < 0) {
              candidates.push("-0x" + (-num).toString(16).toLowerCase());
            } else {
              candidates.push("0x" + num.toString(16).toLowerCase());
            }
          }
          var match3, len, digits;
          if (match3 = /^\.0+/.exec(str)) {
            len = match3[0].length;
            digits = str.slice(len);
            candidates.push(digits + "e-" + (digits.length + len - 1));
          } else if (match3 = /0+$/.exec(str)) {
            len = match3[0].length;
            candidates.push(str.slice(0, -len) + "e" + len);
          } else if (match3 = /^(\d)\.(\d+)e(-?\d+)$/.exec(str)) {
            candidates.push(match3[1] + match3[2] + "e" + (match3[3] - match3[2].length));
          }
          return best_of2(candidates);
        }
        function make_block(stmt, output) {
          if (!stmt || stmt instanceof AST_EmptyStatement)
            output.print("{}");
          else if (stmt instanceof AST_BlockStatement)
            stmt.print(output);
          else output.with_block(function() {
            output.indent();
            stmt.print(output);
            output.newline();
          });
        }
        function DEFMAP(nodetype, generator) {
          nodetype.forEach(function(nodetype2) {
            nodetype2.DEFMETHOD("add_source_map", generator);
          });
        }
        DEFMAP([
          // We could easily add info for ALL nodes, but it seems to me that
          // would be quite wasteful, hence this noop in the base class.
          AST_Node,
          // since the label symbol will mark it
          AST_LabeledStatement,
          AST_Toplevel
        ], noop3);
        DEFMAP([
          AST_Array,
          AST_BlockStatement,
          AST_Catch,
          AST_Class,
          AST_Constant,
          AST_Debugger,
          AST_DefinitionsLike,
          AST_Directive,
          AST_Finally,
          AST_Jump,
          AST_Lambda,
          AST_New,
          AST_Object,
          AST_StatementWithBody,
          AST_Symbol,
          AST_Switch,
          AST_SwitchBranch,
          AST_TemplateString,
          AST_TemplateSegment,
          AST_Try
        ], function(output) {
          output.add_mapping(this.start);
        });
        DEFMAP([
          AST_ObjectGetter,
          AST_ObjectSetter,
          AST_PrivateGetter,
          AST_PrivateSetter,
          AST_ConciseMethod,
          AST_PrivateMethod
        ], function(output) {
          output.add_mapping(
            this.start,
            false
            /*name handled below*/
          );
        });
        DEFMAP([
          AST_SymbolMethod,
          AST_SymbolPrivateProperty
        ], function(output) {
          const tok_type = this.end && this.end.type;
          if (tok_type === "name" || tok_type === "privatename") {
            output.add_mapping(this.end, this.name);
          } else {
            output.add_mapping(this.end);
          }
        });
        DEFMAP([AST_ObjectProperty], function(output) {
          output.add_mapping(this.start, this.key);
        });
      })();
      const shallow_cmp = (node1, node2) => {
        return node1 === null && node2 === null || node1.TYPE === node2.TYPE && node1.shallow_cmp(node2);
      };
      const equivalent_to = (tree1, tree2) => {
        if (!shallow_cmp(tree1, tree2)) return false;
        const walk_1_state = [tree1];
        const walk_2_state = [tree2];
        const walk_1_push = walk_1_state.push.bind(walk_1_state);
        const walk_2_push = walk_2_state.push.bind(walk_2_state);
        while (walk_1_state.length && walk_2_state.length) {
          const node_1 = walk_1_state.pop();
          const node_2 = walk_2_state.pop();
          if (!shallow_cmp(node_1, node_2)) return false;
          node_1._children_backwards(walk_1_push);
          node_2._children_backwards(walk_2_push);
          if (walk_1_state.length !== walk_2_state.length) {
            return false;
          }
        }
        return walk_1_state.length == 0 && walk_2_state.length == 0;
      };
      const pass_through = () => true;
      AST_Node.prototype.shallow_cmp = function() {
        throw new Error("did not find a shallow_cmp function for " + this.constructor.name);
      };
      AST_Debugger.prototype.shallow_cmp = pass_through;
      AST_Directive.prototype.shallow_cmp = function(other) {
        return this.value === other.value;
      };
      AST_SimpleStatement.prototype.shallow_cmp = pass_through;
      AST_Block.prototype.shallow_cmp = pass_through;
      AST_EmptyStatement.prototype.shallow_cmp = pass_through;
      AST_LabeledStatement.prototype.shallow_cmp = function(other) {
        return this.label.name === other.label.name;
      };
      AST_Do.prototype.shallow_cmp = pass_through;
      AST_While.prototype.shallow_cmp = pass_through;
      AST_For.prototype.shallow_cmp = function(other) {
        return (this.init == null ? other.init == null : this.init === other.init) && (this.condition == null ? other.condition == null : this.condition === other.condition) && (this.step == null ? other.step == null : this.step === other.step);
      };
      AST_ForIn.prototype.shallow_cmp = pass_through;
      AST_ForOf.prototype.shallow_cmp = pass_through;
      AST_With.prototype.shallow_cmp = pass_through;
      AST_Toplevel.prototype.shallow_cmp = pass_through;
      AST_Expansion.prototype.shallow_cmp = pass_through;
      AST_Lambda.prototype.shallow_cmp = function(other) {
        return this.is_generator === other.is_generator && this.async === other.async;
      };
      AST_Destructuring.prototype.shallow_cmp = function(other) {
        return this.is_array === other.is_array;
      };
      AST_PrefixedTemplateString.prototype.shallow_cmp = pass_through;
      AST_TemplateString.prototype.shallow_cmp = pass_through;
      AST_TemplateSegment.prototype.shallow_cmp = function(other) {
        return this.value === other.value;
      };
      AST_Jump.prototype.shallow_cmp = pass_through;
      AST_LoopControl.prototype.shallow_cmp = pass_through;
      AST_Await.prototype.shallow_cmp = pass_through;
      AST_Yield.prototype.shallow_cmp = function(other) {
        return this.is_star === other.is_star;
      };
      AST_If.prototype.shallow_cmp = function(other) {
        return this.alternative == null ? other.alternative == null : this.alternative === other.alternative;
      };
      AST_Switch.prototype.shallow_cmp = pass_through;
      AST_SwitchBranch.prototype.shallow_cmp = pass_through;
      AST_Try.prototype.shallow_cmp = function(other) {
        return this.body === other.body && (this.bcatch == null ? other.bcatch == null : this.bcatch === other.bcatch) && (this.bfinally == null ? other.bfinally == null : this.bfinally === other.bfinally);
      };
      AST_Catch.prototype.shallow_cmp = function(other) {
        return this.argname == null ? other.argname == null : this.argname === other.argname;
      };
      AST_Finally.prototype.shallow_cmp = pass_through;
      AST_DefinitionsLike.prototype.shallow_cmp = pass_through;
      AST_VarDefLike.prototype.shallow_cmp = function(other) {
        return this.value == null ? other.value == null : this.value === other.value;
      };
      AST_NameMapping.prototype.shallow_cmp = pass_through;
      AST_Import.prototype.shallow_cmp = function(other) {
        return (this.imported_name == null ? other.imported_name == null : this.imported_name === other.imported_name) && (this.imported_names == null ? other.imported_names == null : this.imported_names === other.imported_names) && (this.attributes == null ? other.attributes == null : this.attributes === other.attributes);
      };
      AST_ImportMeta.prototype.shallow_cmp = pass_through;
      AST_Export.prototype.shallow_cmp = function(other) {
        return (this.exported_definition == null ? other.exported_definition == null : this.exported_definition === other.exported_definition) && (this.exported_value == null ? other.exported_value == null : this.exported_value === other.exported_value) && (this.exported_names == null ? other.exported_names == null : this.exported_names === other.exported_names) && (this.attributes == null ? other.attributes == null : this.attributes === other.attributes) && this.module_name === other.module_name && this.is_default === other.is_default;
      };
      AST_Call.prototype.shallow_cmp = pass_through;
      AST_Sequence.prototype.shallow_cmp = pass_through;
      AST_PropAccess.prototype.shallow_cmp = pass_through;
      AST_Chain.prototype.shallow_cmp = pass_through;
      AST_Dot.prototype.shallow_cmp = function(other) {
        return this.property === other.property;
      };
      AST_DotHash.prototype.shallow_cmp = function(other) {
        return this.property === other.property;
      };
      AST_Unary.prototype.shallow_cmp = function(other) {
        return this.operator === other.operator;
      };
      AST_Binary.prototype.shallow_cmp = function(other) {
        return this.operator === other.operator;
      };
      AST_PrivateIn.prototype.shallow_cmp = pass_through;
      AST_Conditional.prototype.shallow_cmp = pass_through;
      AST_Array.prototype.shallow_cmp = pass_through;
      AST_Object.prototype.shallow_cmp = pass_through;
      AST_ObjectProperty.prototype.shallow_cmp = pass_through;
      AST_ObjectKeyVal.prototype.shallow_cmp = function(other) {
        return this.key === other.key && this.quote === other.quote;
      };
      AST_ObjectSetter.prototype.shallow_cmp = function(other) {
        return this.static === other.static;
      };
      AST_ObjectGetter.prototype.shallow_cmp = function(other) {
        return this.static === other.static;
      };
      AST_ConciseMethod.prototype.shallow_cmp = function(other) {
        return this.static === other.static;
      };
      AST_PrivateMethod.prototype.shallow_cmp = function(other) {
        return this.static === other.static;
      };
      AST_Class.prototype.shallow_cmp = function(other) {
        return (this.name == null ? other.name == null : this.name === other.name) && (this.extends == null ? other.extends == null : this.extends === other.extends);
      };
      AST_ClassProperty.prototype.shallow_cmp = function(other) {
        return this.static === other.static && (typeof this.key === "string" ? this.key === other.key : true);
      };
      AST_ClassPrivateProperty.prototype.shallow_cmp = function(other) {
        return this.static === other.static;
      };
      AST_Symbol.prototype.shallow_cmp = function(other) {
        return this.name === other.name;
      };
      AST_NewTarget.prototype.shallow_cmp = pass_through;
      AST_This.prototype.shallow_cmp = pass_through;
      AST_Super.prototype.shallow_cmp = pass_through;
      AST_String.prototype.shallow_cmp = function(other) {
        return this.value === other.value;
      };
      AST_Number.prototype.shallow_cmp = function(other) {
        return this.value === other.value;
      };
      AST_BigInt.prototype.shallow_cmp = function(other) {
        return this.value === other.value;
      };
      AST_RegExp.prototype.shallow_cmp = function(other) {
        return this.value.flags === other.value.flags && this.value.source === other.value.source;
      };
      AST_Atom.prototype.shallow_cmp = pass_through;
      const MASK_EXPORT_DONT_MANGLE = 1 << 0;
      const MASK_EXPORT_WANT_MANGLE = 1 << 1;
      let function_defs = null;
      let unmangleable_names = null;
      let scopes_with_block_defuns = null;
      class SymbolDef {
        constructor(scope, orig, init3) {
          this.name = orig.name;
          this.orig = [orig];
          this.init = init3;
          this.eliminated = 0;
          this.assignments = 0;
          this.scope = scope;
          this.replaced = 0;
          this.global = false;
          this.export = 0;
          this.mangled_name = null;
          this.undeclared = false;
          this.id = SymbolDef.next_id++;
          this.chained = false;
          this.direct_access = false;
          this.escaped = 0;
          this.recursive_refs = 0;
          this.references = [];
          this.should_replace = void 0;
          this.single_use = false;
          this.fixed = false;
          Object.seal(this);
        }
        fixed_value() {
          if (!this.fixed || this.fixed instanceof AST_Node) return this.fixed;
          return this.fixed();
        }
        unmangleable(options) {
          if (!options) options = {};
          if (function_defs && function_defs.has(this.id) && keep_name(options.keep_fnames, this.orig[0].name)) return true;
          return this.global && !options.toplevel || this.export & MASK_EXPORT_DONT_MANGLE || this.undeclared || !options.eval && this.scope.pinned() || (this.orig[0] instanceof AST_SymbolLambda || this.orig[0] instanceof AST_SymbolDefun) && keep_name(options.keep_fnames, this.orig[0].name) || this.orig[0] instanceof AST_SymbolMethod || (this.orig[0] instanceof AST_SymbolClass || this.orig[0] instanceof AST_SymbolDefClass) && keep_name(options.keep_classnames, this.orig[0].name);
        }
        mangle(options) {
          const cache = options.cache && options.cache.props;
          if (this.global && cache && cache.has(this.name)) {
            this.mangled_name = cache.get(this.name);
          } else if (!this.mangled_name && !this.unmangleable(options)) {
            var s = this.scope;
            var sym = this.orig[0];
            if (options.ie8 && sym instanceof AST_SymbolLambda)
              s = s.parent_scope;
            const redefinition = redefined_catch_def(this);
            this.mangled_name = redefinition ? redefinition.mangled_name || redefinition.name : s.next_mangled(options, this);
            if (this.global && cache) {
              cache.set(this.name, this.mangled_name);
            }
          }
        }
      }
      SymbolDef.next_id = 1;
      function redefined_catch_def(def) {
        if (def.orig[0] instanceof AST_SymbolCatch && def.scope.is_block_scope()) {
          return def.scope.get_defun_scope().variables.get(def.name);
        }
      }
      AST_Scope.DEFMETHOD("figure_out_scope", function(options, { parent_scope = void 0, toplevel = this } = {}) {
        options = defaults2(options, {
          cache: null,
          ie8: false,
          safari10: false,
          module: false
        });
        if (!(toplevel instanceof AST_Toplevel)) {
          throw new Error("Invalid toplevel scope");
        }
        var scope = this.parent_scope = parent_scope;
        var labels = /* @__PURE__ */ new Map();
        var defun = null;
        var in_destructuring = null;
        var for_scopes = [];
        var tw = new TreeWalker((node, descend) => {
          if (node.is_block_scope()) {
            const save_scope2 = scope;
            node.block_scope = scope = new AST_Scope(node);
            scope._block_scope = true;
            scope.init_scope_vars(save_scope2);
            scope.uses_with = save_scope2.uses_with;
            scope.uses_eval = save_scope2.uses_eval;
            if (options.safari10) {
              if (node instanceof AST_For || node instanceof AST_ForIn || node instanceof AST_ForOf) {
                for_scopes.push(scope);
              }
            }
            if (node instanceof AST_Switch) {
              const the_block_scope = scope;
              scope = save_scope2;
              node.expression.walk(tw);
              scope = the_block_scope;
              for (let i = 0; i < node.body.length; i++) {
                node.body[i].walk(tw);
              }
            } else {
              descend();
            }
            scope = save_scope2;
            return true;
          }
          if (node instanceof AST_Destructuring) {
            const save_destructuring = in_destructuring;
            in_destructuring = node;
            descend();
            in_destructuring = save_destructuring;
            return true;
          }
          if (node instanceof AST_Scope) {
            node.init_scope_vars(scope);
            var save_scope = scope;
            var save_defun = defun;
            var save_labels = labels;
            defun = scope = node;
            labels = /* @__PURE__ */ new Map();
            descend();
            scope = save_scope;
            defun = save_defun;
            labels = save_labels;
            return true;
          }
          if (node instanceof AST_LabeledStatement) {
            var l = node.label;
            if (labels.has(l.name)) {
              throw new Error(string_template("Label {name} defined twice", l));
            }
            labels.set(l.name, l);
            descend();
            labels.delete(l.name);
            return true;
          }
          if (node instanceof AST_With) {
            for (var s = scope; s; s = s.parent_scope)
              s.uses_with = true;
            return;
          }
          if (node instanceof AST_Symbol) {
            node.scope = scope;
          }
          if (node instanceof AST_Label) {
            node.thedef = node;
            node.references = [];
          }
          if (node instanceof AST_SymbolLambda) {
            defun.def_function(node, node.name == "arguments" ? void 0 : defun);
          } else if (node instanceof AST_SymbolDefun) {
            const closest_scope = defun.parent_scope;
            node.scope = tw.directives["use strict"] ? closest_scope : closest_scope.get_defun_scope();
            mark_export(node.scope.def_function(node, defun), 1);
          } else if (node instanceof AST_SymbolClass) {
            mark_export(defun.def_variable(node, defun), 1);
          } else if (node instanceof AST_SymbolImport) {
            scope.def_variable(node);
          } else if (node instanceof AST_SymbolDefClass) {
            mark_export((node.scope = defun.parent_scope).def_function(node, defun), 1);
          } else if (node instanceof AST_SymbolVar || node instanceof AST_SymbolLet || node instanceof AST_SymbolConst || node instanceof AST_SymbolUsing || node instanceof AST_SymbolCatch) {
            var def;
            if (node instanceof AST_SymbolBlockDeclaration) {
              def = scope.def_variable(node, null);
            } else {
              def = defun.def_variable(node, node.TYPE == "SymbolVar" ? null : void 0);
            }
            if (!def.orig.every((sym2) => {
              if (sym2 === node) return true;
              if (node instanceof AST_SymbolBlockDeclaration) {
                return sym2 instanceof AST_SymbolLambda;
              }
              return !(sym2 instanceof AST_SymbolLet || sym2 instanceof AST_SymbolConst || sym2 instanceof AST_SymbolUsing);
            })) {
              js_error(
                `"${node.name}" is redeclared`,
                node.start.file,
                node.start.line,
                node.start.col,
                node.start.pos
              );
            }
            if (!(node instanceof AST_SymbolFunarg)) mark_export(def, 2);
            if (defun !== scope) {
              node.mark_enclosed();
              var def = scope.find_variable(node);
              if (node.thedef !== def) {
                node.thedef = def;
                node.reference();
              }
            }
          } else if (node instanceof AST_LabelRef) {
            var sym = labels.get(node.name);
            if (!sym) throw new Error(string_template("Undefined label {name} [{line},{col}]", {
              name: node.name,
              line: node.start.line,
              col: node.start.col
            }));
            node.thedef = sym;
          }
          if (!(scope instanceof AST_Toplevel) && (node instanceof AST_Export || node instanceof AST_Import)) {
            js_error(
              `"${node.TYPE}" statement may only appear at the top level`,
              node.start.file,
              node.start.line,
              node.start.col,
              node.start.pos
            );
          }
        });
        if (options.module) {
          tw.directives["use strict"] = true;
        }
        this.walk(tw);
        function mark_export(def, level) {
          if (in_destructuring) {
            var i = 0;
            do {
              level++;
            } while (tw.parent(i++) !== in_destructuring);
          }
          var node = tw.parent(level);
          if (def.export = node instanceof AST_Export ? MASK_EXPORT_DONT_MANGLE : 0) {
            var exported = node.exported_definition;
            if ((exported instanceof AST_Defun || exported instanceof AST_DefClass) && node.is_default) {
              def.export = MASK_EXPORT_WANT_MANGLE;
            }
          }
        }
        const is_toplevel = this instanceof AST_Toplevel;
        if (is_toplevel) {
          this.globals = /* @__PURE__ */ new Map();
        }
        var tw = new TreeWalker((node) => {
          if (node instanceof AST_LoopControl && node.label) {
            node.label.thedef.references.push(node);
            return true;
          }
          if (node instanceof AST_SymbolRef) {
            var name = node.name;
            if (name == "eval" && tw.parent() instanceof AST_Call) {
              for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) {
                s.uses_eval = true;
              }
            }
            var sym;
            if (tw.parent() instanceof AST_NameMapping && tw.parent(1).module_name || !(sym = node.scope.find_variable(name))) {
              sym = toplevel.def_global(node);
              if (node instanceof AST_SymbolExport) sym.export = MASK_EXPORT_DONT_MANGLE;
            } else if (sym.scope instanceof AST_Lambda && name == "arguments") {
              sym.scope.get_defun_scope().uses_arguments = true;
            }
            node.thedef = sym;
            node.reference();
            if (node.scope.is_block_scope() && !(sym.orig[0] instanceof AST_SymbolBlockDeclaration)) {
              node.scope = node.scope.get_defun_scope();
            }
            return true;
          }
          var def;
          if (node instanceof AST_SymbolCatch && (def = redefined_catch_def(node.definition()))) {
            var s = node.scope;
            while (s) {
              push_uniq(s.enclosed, def);
              if (s === def.scope) break;
              s = s.parent_scope;
            }
          }
        });
        this.walk(tw);
        if (options.ie8 || options.safari10) {
          walk(this, (node) => {
            if (node instanceof AST_SymbolCatch) {
              var name = node.name;
              var refs = node.thedef.references;
              var scope2 = node.scope.get_defun_scope();
              var def = scope2.find_variable(name) || toplevel.globals.get(name) || scope2.def_variable(node);
              refs.forEach(function(ref) {
                ref.thedef = def;
                ref.reference();
              });
              node.thedef = def;
              node.reference();
              return true;
            }
          });
        }
        if (options.safari10) {
          for (const scope2 of for_scopes) {
            scope2.parent_scope.variables.forEach(function(def) {
              push_uniq(scope2.enclosed, def);
            });
          }
        }
      });
      AST_Toplevel.DEFMETHOD("def_global", function(node) {
        var globals = this.globals, name = node.name;
        if (globals.has(name)) {
          return globals.get(name);
        } else {
          var g = new SymbolDef(this, node);
          g.undeclared = true;
          g.global = true;
          globals.set(name, g);
          return g;
        }
      });
      AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope) {
        this.variables = /* @__PURE__ */ new Map();
        this.uses_with = false;
        this.uses_eval = false;
        this.parent_scope = parent_scope;
        this.enclosed = [];
        this.cname = -1;
      });
      AST_Scope.DEFMETHOD("conflicting_def", function(name) {
        return this.enclosed.find((def) => def.name === name) || this.variables.has(name) || this.parent_scope && this.parent_scope.conflicting_def(name);
      });
      AST_Scope.DEFMETHOD("conflicting_def_shallow", function(name) {
        return this.enclosed.find((def) => def.name === name) || this.variables.has(name);
      });
      AST_Scope.DEFMETHOD("add_child_scope", function(scope) {
        if (scope.parent_scope === this) return;
        scope.parent_scope = this;
        if (scope instanceof AST_Arrow && (this instanceof AST_Lambda && !this.uses_arguments)) {
          this.uses_arguments = walk(scope, (node) => {
            if (node instanceof AST_SymbolRef && node.scope instanceof AST_Lambda && node.name === "arguments") {
              return walk_abort;
            }
            if (node instanceof AST_Lambda && !(node instanceof AST_Arrow)) {
              return true;
            }
          });
        }
        this.uses_with = this.uses_with || scope.uses_with;
        this.uses_eval = this.uses_eval || scope.uses_eval;
        const scope_ancestry = (() => {
          const ancestry = [];
          let cur = this;
          do {
            ancestry.push(cur);
          } while (cur = cur.parent_scope);
          ancestry.reverse();
          return ancestry;
        })();
        const new_scope_enclosed_set = new Set(scope.enclosed);
        const to_enclose = [];
        for (const scope_topdown of scope_ancestry) {
          to_enclose.forEach((e2) => push_uniq(scope_topdown.enclosed, e2));
          for (const def of scope_topdown.variables.values()) {
            if (new_scope_enclosed_set.has(def)) {
              push_uniq(to_enclose, def);
              push_uniq(scope_topdown.enclosed, def);
            }
          }
        }
      });
      function find_scopes_visible_from(scopes) {
        const found_scopes = /* @__PURE__ */ new Set();
        for (const scope of new Set(scopes)) {
          (function bubble_up(scope2) {
            if (scope2 == null || found_scopes.has(scope2)) return;
            found_scopes.add(scope2);
            bubble_up(scope2.parent_scope);
          })(scope);
        }
        return [...found_scopes];
      }
      AST_Scope.DEFMETHOD("create_symbol", function(SymClass, {
        source: source2,
        tentative_name,
        scope,
        conflict_scopes = [scope],
        init: init3 = null
      } = {}) {
        let symbol_name;
        conflict_scopes = find_scopes_visible_from(conflict_scopes);
        if (tentative_name) {
          tentative_name = symbol_name = tentative_name.replace(/(?:^[^a-z_$]|[^a-z0-9_$])/ig, "_");
          let i = 0;
          while (conflict_scopes.find((s) => s.conflicting_def_shallow(symbol_name))) {
            symbol_name = tentative_name + "$" + i++;
          }
        }
        if (!symbol_name) {
          throw new Error("No symbol name could be generated in create_symbol()");
        }
        const symbol = make_node(SymClass, source2, {
          name: symbol_name,
          scope
        });
        this.def_variable(symbol, init3 || null);
        symbol.mark_enclosed();
        return symbol;
      });
      AST_Node.DEFMETHOD("is_block_scope", return_false);
      AST_Class.DEFMETHOD("is_block_scope", return_false);
      AST_Lambda.DEFMETHOD("is_block_scope", return_false);
      AST_Toplevel.DEFMETHOD("is_block_scope", return_false);
      AST_SwitchBranch.DEFMETHOD("is_block_scope", return_false);
      AST_Block.DEFMETHOD("is_block_scope", return_true);
      AST_Scope.DEFMETHOD("is_block_scope", function() {
        return this._block_scope || false;
      });
      AST_IterationStatement.DEFMETHOD("is_block_scope", return_true);
      AST_Lambda.DEFMETHOD("init_scope_vars", function() {
        AST_Scope.prototype.init_scope_vars.apply(this, arguments);
        this.uses_arguments = false;
        this.def_variable(new AST_SymbolFunarg({
          name: "arguments",
          start: this.start,
          end: this.end
        }));
      });
      AST_Arrow.DEFMETHOD("init_scope_vars", function() {
        AST_Scope.prototype.init_scope_vars.apply(this, arguments);
        this.uses_arguments = false;
      });
      AST_Symbol.DEFMETHOD("mark_enclosed", function() {
        var def = this.definition();
        var s = this.scope;
        while (s) {
          push_uniq(s.enclosed, def);
          if (s === def.scope) break;
          s = s.parent_scope;
        }
      });
      AST_Symbol.DEFMETHOD("reference", function() {
        this.definition().references.push(this);
        this.mark_enclosed();
      });
      AST_Scope.DEFMETHOD("find_variable", function(name) {
        if (name instanceof AST_Symbol) name = name.name;
        return this.variables.get(name) || this.parent_scope && this.parent_scope.find_variable(name);
      });
      AST_Scope.DEFMETHOD("def_function", function(symbol, init3) {
        var def = this.def_variable(symbol, init3);
        if (!def.init || def.init instanceof AST_Defun) def.init = init3;
        return def;
      });
      AST_Scope.DEFMETHOD("def_variable", function(symbol, init3) {
        var def = this.variables.get(symbol.name);
        if (def) {
          def.orig.push(symbol);
          if (def.init && (def.scope !== symbol.scope || def.init instanceof AST_Function)) {
            def.init = init3;
          }
        } else {
          def = new SymbolDef(this, symbol, init3);
          this.variables.set(symbol.name, def);
          def.global = !this.parent_scope;
        }
        return symbol.thedef = def;
      });
      function next_mangled(scope, options) {
        let defun_scope;
        if (scopes_with_block_defuns && (defun_scope = scope.get_defun_scope()) && scopes_with_block_defuns.has(defun_scope)) {
          scope = defun_scope;
        }
        var ext2 = scope.enclosed;
        var nth_identifier = options.nth_identifier;
        out: while (true) {
          var m2 = nth_identifier.get(++scope.cname);
          if (ALL_RESERVED_WORDS.has(m2)) continue;
          if (options.reserved.has(m2)) continue;
          if (unmangleable_names && unmangleable_names.has(m2)) continue out;
          for (let i = ext2.length; --i >= 0; ) {
            const def = ext2[i];
            const name = def.mangled_name || def.unmangleable(options) && def.name;
            if (m2 == name) continue out;
          }
          return m2;
        }
      }
      AST_Scope.DEFMETHOD("next_mangled", function(options) {
        return next_mangled(this, options);
      });
      AST_Toplevel.DEFMETHOD("next_mangled", function(options) {
        let name;
        const mangled_names = this.mangled_names;
        do {
          name = next_mangled(this, options);
        } while (mangled_names.has(name));
        return name;
      });
      AST_Function.DEFMETHOD("next_mangled", function(options, def) {
        var tricky_def = def.orig[0] instanceof AST_SymbolFunarg && this.name && this.name.definition();
        var tricky_name = tricky_def ? tricky_def.mangled_name || tricky_def.name : null;
        while (true) {
          var name = next_mangled(this, options);
          if (!tricky_name || tricky_name != name)
            return name;
        }
      });
      AST_Symbol.DEFMETHOD("unmangleable", function(options) {
        var def = this.definition();
        return !def || def.unmangleable(options);
      });
      AST_Label.DEFMETHOD("unmangleable", return_false);
      AST_Symbol.DEFMETHOD("unreferenced", function() {
        return !this.definition().references.length && !this.scope.pinned();
      });
      AST_Symbol.DEFMETHOD("definition", function() {
        return this.thedef;
      });
      AST_Symbol.DEFMETHOD("global", function() {
        return this.thedef.global;
      });
      function format_mangler_options(options) {
        options = defaults2(options, {
          eval: false,
          nth_identifier: base54,
          ie8: false,
          keep_classnames: false,
          keep_fnames: false,
          module: false,
          reserved: [],
          toplevel: false
        });
        if (options.module) options.toplevel = true;
        if (!Array.isArray(options.reserved) && !(options.reserved instanceof Set)) {
          options.reserved = [];
        }
        options.reserved = new Set(options.reserved);
        options.reserved.add("arguments");
        return options;
      }
      AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
        options = format_mangler_options(options);
        var nth_identifier = options.nth_identifier;
        var lname = -1;
        var to_mangle = [];
        if (options.keep_fnames) {
          function_defs = /* @__PURE__ */ new Set();
        }
        const mangled_names = this.mangled_names = /* @__PURE__ */ new Set();
        unmangleable_names = /* @__PURE__ */ new Set();
        if (options.cache) {
          this.globals.forEach(collect);
          if (options.cache.props) {
            options.cache.props.forEach(function(mangled_name) {
              mangled_names.add(mangled_name);
            });
          }
        }
        var tw = new TreeWalker(function(node, descend) {
          if (node instanceof AST_LabeledStatement) {
            var save_nesting = lname;
            descend();
            lname = save_nesting;
            return true;
          }
          if (node instanceof AST_Defun && !(tw.parent() instanceof AST_Scope)) {
            scopes_with_block_defuns = scopes_with_block_defuns || /* @__PURE__ */ new Set();
            scopes_with_block_defuns.add(node.parent_scope.get_defun_scope());
          }
          if (node instanceof AST_Scope) {
            node.variables.forEach(collect);
            return;
          }
          if (node.is_block_scope()) {
            node.block_scope.variables.forEach(collect);
            return;
          }
          if (function_defs && node instanceof AST_VarDef && node.value instanceof AST_Lambda && !node.value.name && keep_name(options.keep_fnames, node.name.name)) {
            function_defs.add(node.name.definition().id);
            return;
          }
          if (node instanceof AST_Label) {
            let name;
            do {
              name = nth_identifier.get(++lname);
            } while (ALL_RESERVED_WORDS.has(name));
            node.mangled_name = name;
            return true;
          }
          if (!(options.ie8 || options.safari10) && node instanceof AST_SymbolCatch) {
            to_mangle.push(node.definition());
            return;
          }
        });
        this.walk(tw);
        if (options.keep_fnames || options.keep_classnames) {
          to_mangle.forEach((def) => {
            if (def.name.length < 6 && def.unmangleable(options)) {
              unmangleable_names.add(def.name);
            }
          });
        }
        to_mangle.forEach((def) => {
          def.mangle(options);
        });
        function_defs = null;
        unmangleable_names = null;
        scopes_with_block_defuns = null;
        function collect(symbol) {
          if (symbol.export & MASK_EXPORT_DONT_MANGLE) {
            unmangleable_names.add(symbol.name);
          } else if (!options.reserved.has(symbol.name)) {
            to_mangle.push(symbol);
          }
        }
      });
      AST_Toplevel.DEFMETHOD("find_colliding_names", function(options) {
        const cache = options.cache && options.cache.props;
        const avoid = /* @__PURE__ */ new Set();
        options.reserved.forEach(to_avoid);
        this.globals.forEach(add_def);
        this.walk(new TreeWalker(function(node) {
          if (node instanceof AST_Scope) node.variables.forEach(add_def);
          if (node instanceof AST_SymbolCatch) add_def(node.definition());
        }));
        return avoid;
        function to_avoid(name) {
          avoid.add(name);
        }
        function add_def(def) {
          var name = def.name;
          if (def.global && cache && cache.has(name)) name = cache.get(name);
          else if (!def.unmangleable(options)) return;
          to_avoid(name);
        }
      });
      AST_Toplevel.DEFMETHOD("expand_names", function(options) {
        options = format_mangler_options(options);
        var nth_identifier = options.nth_identifier;
        if (nth_identifier.reset && nth_identifier.sort) {
          nth_identifier.reset();
          nth_identifier.sort();
        }
        var avoid = this.find_colliding_names(options);
        var cname = 0;
        this.globals.forEach(rename);
        this.walk(new TreeWalker(function(node) {
          if (node instanceof AST_Scope) node.variables.forEach(rename);
          if (node instanceof AST_SymbolCatch) rename(node.definition());
        }));
        function next_name() {
          var name;
          do {
            name = nth_identifier.get(cname++);
          } while (avoid.has(name) || ALL_RESERVED_WORDS.has(name));
          return name;
        }
        function rename(def) {
          if (def.global && options.cache) return;
          if (def.unmangleable(options)) return;
          if (options.reserved.has(def.name)) return;
          const redefinition = redefined_catch_def(def);
          const name = def.name = redefinition ? redefinition.name : next_name();
          def.orig.forEach(function(sym) {
            sym.name = name;
          });
          def.references.forEach(function(sym) {
            sym.name = name;
          });
        }
      });
      AST_Node.DEFMETHOD("tail_node", return_this);
      AST_Sequence.DEFMETHOD("tail_node", function() {
        return this.expressions[this.expressions.length - 1];
      });
      AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) {
        options = format_mangler_options(options);
        var nth_identifier = options.nth_identifier;
        if (!nth_identifier.reset || !nth_identifier.consider || !nth_identifier.sort) {
          return;
        }
        nth_identifier.reset();
        try {
          AST_Node.prototype.print = function(stream, force_parens) {
            this._print(stream, force_parens);
            if (this instanceof AST_Symbol && !this.unmangleable(options)) {
              nth_identifier.consider(this.name, -1);
            } else if (options.properties) {
              if (this instanceof AST_DotHash) {
                nth_identifier.consider("#" + this.property, -1);
              } else if (this instanceof AST_Dot) {
                nth_identifier.consider(this.property, -1);
              } else if (this instanceof AST_Sub) {
                skip_string(this.property);
              }
            }
          };
          nth_identifier.consider(this.print_to_string(), 1);
        } finally {
          AST_Node.prototype.print = AST_Node.prototype._print;
        }
        nth_identifier.sort();
        function skip_string(node) {
          if (node instanceof AST_String) {
            nth_identifier.consider(node.value, -1);
          } else if (node instanceof AST_Conditional) {
            skip_string(node.consequent);
            skip_string(node.alternative);
          } else if (node instanceof AST_Sequence) {
            skip_string(node.tail_node());
          }
        }
      });
      const base54 = (() => {
        const leading = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_".split("");
        const digits = "0123456789".split("");
        let chars;
        let frequency;
        function reset2() {
          frequency = /* @__PURE__ */ new Map();
          leading.forEach(function(ch3) {
            frequency.set(ch3, 0);
          });
          digits.forEach(function(ch3) {
            frequency.set(ch3, 0);
          });
        }
        function consider(str, delta) {
          for (var i = str.length; --i >= 0; ) {
            frequency.set(str[i], frequency.get(str[i]) + delta);
          }
        }
        function compare2(a, b) {
          return frequency.get(b) - frequency.get(a);
        }
        function sort() {
          chars = mergeSort(leading, compare2).concat(mergeSort(digits, compare2));
        }
        reset2();
        sort();
        function base542(num) {
          var ret = "", base2 = 54;
          num++;
          do {
            num--;
            ret += chars[num % base2];
            num = Math.floor(num / base2);
            base2 = 64;
          } while (num > 0);
          return ret;
        }
        return {
          get: base542,
          consider,
          reset: reset2,
          sort
        };
      })();
      let mangle_options = void 0;
      AST_Node.prototype.size = function(compressor, stack2) {
        mangle_options = compressor && compressor._mangle_options;
        let size = 0;
        walk_parent(this, (node, info3) => {
          size += node._size(info3);
          if (node instanceof AST_Arrow && node.is_braceless()) {
            size += node.body[0].value._size(info3);
            return true;
          }
        }, stack2 || compressor && compressor.stack);
        mangle_options = void 0;
        return size;
      };
      AST_Node.prototype._size = () => 0;
      AST_Debugger.prototype._size = () => 8;
      AST_Directive.prototype._size = function() {
        return 2 + this.value.length;
      };
      const list_overhead = (array) => array.length && array.length - 1;
      AST_Block.prototype._size = function() {
        return 2 + list_overhead(this.body);
      };
      AST_Toplevel.prototype._size = function() {
        return list_overhead(this.body);
      };
      AST_EmptyStatement.prototype._size = () => 1;
      AST_LabeledStatement.prototype._size = () => 2;
      AST_Do.prototype._size = () => 9;
      AST_While.prototype._size = () => 7;
      AST_For.prototype._size = () => 8;
      AST_ForIn.prototype._size = () => 8;
      AST_With.prototype._size = () => 6;
      AST_Expansion.prototype._size = () => 3;
      const lambda_modifiers = (func) => (func.is_generator ? 1 : 0) + (func.async ? 6 : 0);
      AST_Accessor.prototype._size = function() {
        return lambda_modifiers(this) + 4 + list_overhead(this.argnames) + list_overhead(this.body);
      };
      AST_Function.prototype._size = function(info3) {
        const first = !!first_in_statement(info3);
        return first * 2 + lambda_modifiers(this) + 12 + list_overhead(this.argnames) + list_overhead(this.body);
      };
      AST_Defun.prototype._size = function() {
        return lambda_modifiers(this) + 13 + list_overhead(this.argnames) + list_overhead(this.body);
      };
      AST_Arrow.prototype._size = function() {
        let args_and_arrow = 2 + list_overhead(this.argnames);
        if (!(this.argnames.length === 1 && this.argnames[0] instanceof AST_Symbol)) {
          args_and_arrow += 2;
        }
        const body_overhead = this.is_braceless() ? 0 : list_overhead(this.body) + 2;
        return lambda_modifiers(this) + args_and_arrow + body_overhead;
      };
      AST_Destructuring.prototype._size = () => 2;
      AST_TemplateString.prototype._size = function() {
        return 2 + Math.floor(this.segments.length / 2) * 3;
      };
      AST_TemplateSegment.prototype._size = function() {
        return this.value.length;
      };
      AST_Return.prototype._size = function() {
        return this.value ? 7 : 6;
      };
      AST_Throw.prototype._size = () => 6;
      AST_Break.prototype._size = function() {
        return this.label ? 6 : 5;
      };
      AST_Continue.prototype._size = function() {
        return this.label ? 9 : 8;
      };
      AST_If.prototype._size = () => 4;
      AST_Switch.prototype._size = function() {
        return 8 + list_overhead(this.body);
      };
      AST_Case.prototype._size = function() {
        return 5 + list_overhead(this.body);
      };
      AST_Default.prototype._size = function() {
        return 8 + list_overhead(this.body);
      };
      AST_Try.prototype._size = () => 3;
      AST_Catch.prototype._size = function() {
        let size = 7 + list_overhead(this.body);
        if (this.argname) {
          size += 2;
        }
        return size;
      };
      AST_Finally.prototype._size = function() {
        return 7 + list_overhead(this.body);
      };
      AST_Var.prototype._size = function() {
        return 4 + list_overhead(this.definitions);
      };
      AST_Let.prototype._size = function() {
        return 4 + list_overhead(this.definitions);
      };
      AST_Const.prototype._size = function() {
        return 6 + list_overhead(this.definitions);
      };
      AST_Using.prototype._size = function() {
        const await_size = this.await ? 6 : 0;
        return await_size + 6 + list_overhead(this.definitions);
      };
      AST_VarDefLike.prototype._size = function() {
        return this.value ? 1 : 0;
      };
      AST_NameMapping.prototype._size = function() {
        return this.name ? 4 : 0;
      };
      AST_Import.prototype._size = function() {
        let size = 6;
        if (this.imported_name) size += 1;
        if (this.imported_name || this.imported_names) size += 5;
        if (this.imported_names) {
          size += 2 + list_overhead(this.imported_names);
        }
        return size;
      };
      AST_ImportMeta.prototype._size = () => 11;
      AST_Export.prototype._size = function() {
        let size = 7 + (this.is_default ? 8 : 0);
        if (this.exported_value) {
          size += this.exported_value._size();
        }
        if (this.exported_names) {
          size += 2 + list_overhead(this.exported_names);
        }
        if (this.module_name) {
          size += 5;
        }
        return size;
      };
      AST_Call.prototype._size = function() {
        if (this.optional) {
          return 4 + list_overhead(this.args);
        }
        return 2 + list_overhead(this.args);
      };
      AST_New.prototype._size = function() {
        return 6 + list_overhead(this.args);
      };
      AST_Sequence.prototype._size = function() {
        return list_overhead(this.expressions);
      };
      AST_Dot.prototype._size = function() {
        if (this.optional) {
          return this.property.length + 2;
        }
        return this.property.length + 1;
      };
      AST_DotHash.prototype._size = function() {
        if (this.optional) {
          return this.property.length + 3;
        }
        return this.property.length + 2;
      };
      AST_Sub.prototype._size = function() {
        return this.optional ? 4 : 2;
      };
      AST_Unary.prototype._size = function() {
        if (this.operator === "typeof") return 7;
        if (this.operator === "void") return 5;
        return this.operator.length;
      };
      AST_Binary.prototype._size = function(info3) {
        if (this.operator === "in") return 4;
        let size = this.operator.length;
        if ((this.operator === "+" || this.operator === "-") && this.right instanceof AST_Unary && this.right.operator === this.operator) {
          size += 1;
        }
        if (this.needs_parens(info3)) {
          size += 2;
        }
        return size;
      };
      AST_Conditional.prototype._size = () => 3;
      AST_Array.prototype._size = function() {
        return 2 + list_overhead(this.elements);
      };
      AST_Object.prototype._size = function(info3) {
        let base2 = 2;
        if (first_in_statement(info3)) {
          base2 += 2;
        }
        return base2 + list_overhead(this.properties);
      };
      const key_size = (key4) => typeof key4 === "string" ? key4.length : 0;
      AST_ObjectKeyVal.prototype._size = function() {
        return key_size(this.key) + 1;
      };
      const static_size = (is_static) => is_static ? 7 : 0;
      AST_ObjectGetter.prototype._size = function() {
        return 5 + static_size(this.static) + key_size(this.key);
      };
      AST_ObjectSetter.prototype._size = function() {
        return 5 + static_size(this.static) + key_size(this.key);
      };
      AST_ConciseMethod.prototype._size = function() {
        return static_size(this.static) + key_size(this.key);
      };
      AST_PrivateMethod.prototype._size = function() {
        return AST_ConciseMethod.prototype._size.call(this) + 1;
      };
      AST_PrivateGetter.prototype._size = function() {
        return AST_ConciseMethod.prototype._size.call(this) + 4;
      };
      AST_PrivateSetter.prototype._size = function() {
        return AST_ConciseMethod.prototype._size.call(this) + 4;
      };
      AST_PrivateIn.prototype._size = function() {
        return 5;
      };
      AST_Class.prototype._size = function() {
        return (this.name ? 8 : 7) + (this.extends ? 8 : 0);
      };
      AST_ClassStaticBlock.prototype._size = function() {
        return 8 + list_overhead(this.body);
      };
      AST_ClassProperty.prototype._size = function() {
        return static_size(this.static) + (typeof this.key === "string" ? this.key.length + 2 : 0) + (this.value ? 1 : 0);
      };
      AST_ClassPrivateProperty.prototype._size = function() {
        return AST_ClassProperty.prototype._size.call(this) + 1;
      };
      AST_Symbol.prototype._size = function() {
        if (!(mangle_options && this.thedef && !this.thedef.unmangleable(mangle_options))) {
          return this.name.length;
        } else {
          return 1;
        }
      };
      AST_SymbolClassProperty.prototype._size = function() {
        return this.name.length;
      };
      AST_SymbolRef.prototype._size = AST_SymbolDeclaration.prototype._size = function() {
        if (this.name === "arguments") return 9;
        return AST_Symbol.prototype._size.call(this);
      };
      AST_NewTarget.prototype._size = () => 10;
      AST_SymbolImportForeign.prototype._size = function() {
        return this.name.length;
      };
      AST_SymbolExportForeign.prototype._size = function() {
        return this.name.length;
      };
      AST_This.prototype._size = () => 4;
      AST_Super.prototype._size = () => 5;
      AST_String.prototype._size = function() {
        return this.value.length + 2;
      };
      AST_Number.prototype._size = function() {
        const { value: value2 } = this;
        if (value2 === 0) return 1;
        if (value2 > 0 && Math.floor(value2) === value2) {
          return Math.floor(Math.log10(value2) + 1);
        }
        return value2.toString().length;
      };
      AST_BigInt.prototype._size = function() {
        return this.value.length;
      };
      AST_RegExp.prototype._size = function() {
        return this.value.toString().length;
      };
      AST_Null.prototype._size = () => 4;
      AST_NaN.prototype._size = () => 3;
      AST_Undefined.prototype._size = () => 6;
      AST_Hole.prototype._size = () => 0;
      AST_Infinity.prototype._size = () => 8;
      AST_True.prototype._size = () => 4;
      AST_False.prototype._size = () => 5;
      AST_Await.prototype._size = () => 6;
      AST_Yield.prototype._size = () => 6;
      const UNUSED = 1;
      const TRUTHY = 2;
      const FALSY = 4;
      const UNDEFINED2 = 8;
      const INLINED = 16;
      const WRITE_ONLY = 32;
      const SQUEEZED = 256;
      const OPTIMIZED = 512;
      const TOP = 1024;
      const CLEAR_BETWEEN_PASSES = SQUEEZED | OPTIMIZED | TOP;
      const has_flag = (node, flag) => node.flags & flag;
      const set_flag = (node, flag) => {
        node.flags |= flag;
      };
      const clear_flag = (node, flag) => {
        node.flags &= ~flag;
      };
      function merge_sequence(array, node) {
        if (node instanceof AST_Sequence) {
          array.push(...node.expressions);
        } else {
          array.push(node);
        }
        return array;
      }
      function make_sequence(orig, expressions) {
        if (expressions.length == 1) return expressions[0];
        if (expressions.length == 0) throw new Error("trying to create a sequence with length zero!");
        return make_node(AST_Sequence, orig, {
          expressions: expressions.reduce(merge_sequence, [])
        });
      }
      function make_empty_function(self3) {
        return make_node(AST_Function, self3, {
          uses_arguments: false,
          argnames: [],
          body: [],
          is_generator: false,
          async: false,
          variables: /* @__PURE__ */ new Map(),
          uses_with: false,
          uses_eval: false,
          parent_scope: null,
          enclosed: [],
          cname: 0,
          block_scope: void 0
        });
      }
      function make_node_from_constant(val, orig) {
        switch (typeof val) {
          case "string":
            return make_node(AST_String, orig, {
              value: val
            });
          case "number":
            if (isNaN(val)) return make_node(AST_NaN, orig);
            if (isFinite(val)) {
              return 1 / val < 0 ? make_node(AST_UnaryPrefix, orig, {
                operator: "-",
                expression: make_node(AST_Number, orig, { value: -val })
              }) : make_node(AST_Number, orig, { value: val });
            }
            return val < 0 ? make_node(AST_UnaryPrefix, orig, {
              operator: "-",
              expression: make_node(AST_Infinity, orig)
            }) : make_node(AST_Infinity, orig);
          case "bigint":
            return make_node(AST_BigInt, orig, { value: val.toString() });
          case "boolean":
            return make_node(val ? AST_True : AST_False, orig);
          case "undefined":
            return make_node(AST_Undefined, orig);
          default:
            if (val === null) {
              return make_node(AST_Null, orig, { value: null });
            }
            if (val instanceof RegExp) {
              return make_node(AST_RegExp, orig, {
                value: {
                  source: regexp_source_fix(val.source),
                  flags: val.flags
                }
              });
            }
            throw new Error(string_template("Can't handle constant of type: {type}", {
              type: typeof val
            }));
        }
      }
      function best_of_expression(ast1, ast2) {
        return ast1.size() > ast2.size() ? ast2 : ast1;
      }
      function best_of_statement(ast1, ast2) {
        return best_of_expression(
          make_node(AST_SimpleStatement, ast1, {
            body: ast1
          }),
          make_node(AST_SimpleStatement, ast2, {
            body: ast2
          })
        ).body;
      }
      function best_of(compressor, ast1, ast2) {
        if (first_in_statement(compressor)) {
          return best_of_statement(ast1, ast2);
        } else {
          return best_of_expression(ast1, ast2);
        }
      }
      function get_simple_key(key4) {
        if (key4 instanceof AST_Constant) {
          return key4.getValue();
        }
        if (key4 instanceof AST_UnaryPrefix && key4.operator == "void" && key4.expression instanceof AST_Constant) {
          return void 0;
        }
        return key4;
      }
      function read_property(obj, key4) {
        key4 = get_simple_key(key4);
        if (key4 instanceof AST_Node) return;
        var value2;
        if (obj instanceof AST_Array) {
          var elements = obj.elements;
          if (key4 == "length") return make_node_from_constant(elements.length, obj);
          if (typeof key4 == "number" && key4 in elements) value2 = elements[key4];
        } else if (obj instanceof AST_Object) {
          key4 = "" + key4;
          var props = obj.properties;
          for (var i = props.length; --i >= 0; ) {
            var prop2 = props[i];
            if (!(prop2 instanceof AST_ObjectKeyVal)) return;
            if (!value2 && props[i].key === key4) value2 = props[i].value;
          }
        }
        return value2 instanceof AST_SymbolRef && value2.fixed_value() || value2;
      }
      function has_break_or_continue(loop2, parent) {
        var found = false;
        var tw = new TreeWalker(function(node) {
          if (found || node instanceof AST_Scope) return true;
          if (node instanceof AST_LoopControl && tw.loopcontrol_target(node) === loop2) {
            return found = true;
          }
        });
        if (parent instanceof AST_LabeledStatement) tw.push(parent);
        tw.push(loop2);
        loop2.body.walk(tw);
        return found;
      }
      function maintain_this_binding(parent, orig, val) {
        if (requires_sequence_to_maintain_binding(parent, orig, val)) {
          const zero = make_node(AST_Number, orig, { value: 0 });
          return make_sequence(orig, [zero, val]);
        } else {
          return val;
        }
      }
      function requires_sequence_to_maintain_binding(parent, orig, val) {
        return parent instanceof AST_UnaryPrefix && parent.operator == "delete" || parent instanceof AST_Call && parent.expression === orig && (val instanceof AST_Chain || val instanceof AST_PropAccess || val instanceof AST_SymbolRef && val.name == "eval");
      }
      function is_func_expr(node) {
        return node instanceof AST_Arrow || node instanceof AST_Function;
      }
      function is_iife_call(node) {
        if (node.TYPE != "Call") return false;
        return node.expression instanceof AST_Function || is_iife_call(node.expression);
      }
      function is_empty(thing) {
        if (thing === null) return true;
        if (thing instanceof AST_EmptyStatement) return true;
        if (thing instanceof AST_BlockStatement) return thing.body.length == 0;
        return false;
      }
      const identifier_atom = makePredicate("Infinity NaN undefined");
      function is_identifier_atom(node) {
        return node instanceof AST_Infinity || node instanceof AST_NaN || node instanceof AST_Undefined;
      }
      function is_ref_of(ref, type) {
        if (!(ref instanceof AST_SymbolRef)) return false;
        var orig = ref.definition().orig;
        for (var i = orig.length; --i >= 0; ) {
          if (orig[i] instanceof type) return true;
        }
      }
      function can_be_evicted_from_block(node) {
        return !(node instanceof AST_DefClass || node instanceof AST_Defun || node instanceof AST_Let || node instanceof AST_Const || node instanceof AST_Using || node instanceof AST_Export || node instanceof AST_Import);
      }
      function as_statement_array(thing) {
        if (thing === null) return [];
        if (thing instanceof AST_BlockStatement) return thing.body;
        if (thing instanceof AST_EmptyStatement) return [];
        if (thing instanceof AST_Statement) return [thing];
        throw new Error("Can't convert thing to statement array");
      }
      function is_reachable(scope_node, defs) {
        const find_ref = (node) => {
          if (node instanceof AST_SymbolRef && defs.includes(node.definition())) {
            return walk_abort;
          }
        };
        return walk_parent(scope_node, (node, info3) => {
          if (node instanceof AST_Scope && node !== scope_node) {
            var parent = info3.parent();
            if (parent instanceof AST_Call && parent.expression === node && !(node.async || node.is_generator)) {
              return;
            }
            if (walk(node, find_ref)) return walk_abort;
            return true;
          }
        });
      }
      function is_recursive_ref(tw, def) {
        var node;
        for (var i = 0; node = tw.parent(i); i++) {
          if (node instanceof AST_Lambda || node instanceof AST_Class) {
            var name = node.name;
            if (name && name.definition() === def) {
              return true;
            }
          }
        }
        return false;
      }
      function retain_top_func(fn, compressor) {
        return compressor.top_retain && fn instanceof AST_Defun && has_flag(fn, TOP) && fn.name && compressor.top_retain(fn.name.definition());
      }
      function make_nested_lookup(obj) {
        const out = /* @__PURE__ */ new Map();
        for (var key4 of Object.keys(obj)) {
          out.set(key4, makePredicate(obj[key4]));
        }
        const does_have = (global_name, fname) => {
          const inner_map = out.get(global_name);
          return inner_map != null && inner_map.has(fname);
        };
        return does_have;
      }
      const pure_prop_access_globals = /* @__PURE__ */ new Set([
        "Number",
        "String",
        "Array",
        "Object",
        "Function",
        "Promise"
      ]);
      const object_methods = [
        "constructor",
        "toString",
        "valueOf"
      ];
      const is_pure_native_method = make_nested_lookup({
        Array: [
          "at",
          "flat",
          "includes",
          "indexOf",
          "join",
          "lastIndexOf",
          "slice",
          ...object_methods
        ],
        Boolean: object_methods,
        Function: object_methods,
        Number: [
          "toExponential",
          "toFixed",
          "toPrecision",
          ...object_methods
        ],
        Object: object_methods,
        RegExp: [
          "test",
          ...object_methods
        ],
        String: [
          "at",
          "charAt",
          "charCodeAt",
          "charPointAt",
          "concat",
          "endsWith",
          "fromCharCode",
          "fromCodePoint",
          "includes",
          "indexOf",
          "italics",
          "lastIndexOf",
          "localeCompare",
          "match",
          "matchAll",
          "normalize",
          "padStart",
          "padEnd",
          "repeat",
          "replace",
          "replaceAll",
          "search",
          "slice",
          "split",
          "startsWith",
          "substr",
          "substring",
          "repeat",
          "toLocaleLowerCase",
          "toLocaleUpperCase",
          "toLowerCase",
          "toUpperCase",
          "trim",
          "trimEnd",
          "trimStart",
          ...object_methods
        ]
      });
      const is_pure_native_fn = make_nested_lookup({
        Array: [
          "isArray"
        ],
        Math: [
          "abs",
          "acos",
          "asin",
          "atan",
          "ceil",
          "cos",
          "exp",
          "floor",
          "log",
          "round",
          "sin",
          "sqrt",
          "tan",
          "atan2",
          "pow",
          "max",
          "min"
        ],
        Number: [
          "isFinite",
          "isNaN"
        ],
        Object: [
          "create",
          "getOwnPropertyDescriptor",
          "getOwnPropertyNames",
          "getPrototypeOf",
          "isExtensible",
          "isFrozen",
          "isSealed",
          "hasOwn",
          "keys"
        ],
        String: [
          "fromCharCode"
        ]
      });
      const is_pure_native_value = make_nested_lookup({
        Math: [
          "E",
          "LN10",
          "LN2",
          "LOG2E",
          "LOG10E",
          "PI",
          "SQRT1_2",
          "SQRT2"
        ],
        Number: [
          "MAX_VALUE",
          "MIN_VALUE",
          "NaN",
          "NEGATIVE_INFINITY",
          "POSITIVE_INFINITY"
        ]
      });
      const is_undeclared_ref = (node) => node instanceof AST_SymbolRef && node.definition().undeclared;
      const bitwise_binop = makePredicate("<<< >> << & | ^ ~");
      const lazy_op = makePredicate("&& || ??");
      const unary_side_effects = makePredicate("delete ++ --");
      (function(def_is_boolean) {
        const unary_bool = makePredicate("! delete");
        const binary_bool = makePredicate("in instanceof == != === !== < <= >= >");
        def_is_boolean(AST_Node, return_false);
        def_is_boolean(AST_UnaryPrefix, function() {
          return unary_bool.has(this.operator);
        });
        def_is_boolean(AST_Binary, function() {
          return binary_bool.has(this.operator) || lazy_op.has(this.operator) && this.left.is_boolean() && this.right.is_boolean();
        });
        def_is_boolean(AST_Conditional, function() {
          return this.consequent.is_boolean() && this.alternative.is_boolean();
        });
        def_is_boolean(AST_Assign, function() {
          return this.operator == "=" && this.right.is_boolean();
        });
        def_is_boolean(AST_Sequence, function() {
          return this.tail_node().is_boolean();
        });
        def_is_boolean(AST_True, return_true);
        def_is_boolean(AST_False, return_true);
      })(function(node, func) {
        node.DEFMETHOD("is_boolean", func);
      });
      (function(def_is_number) {
        def_is_number(AST_Node, return_false);
        def_is_number(AST_Number, return_true);
        const unary = makePredicate("+ - ~ ++ --");
        def_is_number(AST_Unary, function(compressor) {
          return unary.has(this.operator) && this.expression.is_number(compressor);
        });
        const numeric_ops = makePredicate("- * / % & | ^ << >> >>>");
        def_is_number(AST_Binary, function(compressor) {
          if (this.operator === "+") {
            return this.left.is_number(compressor) && this.right.is_number_or_bigint(compressor) || this.right.is_number(compressor) && this.left.is_number_or_bigint(compressor);
          } else if (numeric_ops.has(this.operator)) {
            return this.left.is_number(compressor) || this.right.is_number(compressor);
          } else {
            return false;
          }
        });
        def_is_number(AST_Assign, function(compressor) {
          return (this.operator === "=" || numeric_ops.has(this.operator.slice(0, -1))) && this.right.is_number(compressor);
        });
        def_is_number(AST_Sequence, function(compressor) {
          return this.tail_node().is_number(compressor);
        });
        def_is_number(AST_Conditional, function(compressor) {
          return this.consequent.is_number(compressor) && this.alternative.is_number(compressor);
        });
      })(function(node, func) {
        node.DEFMETHOD("is_number", func);
      });
      (function(def_is_bigint) {
        def_is_bigint(AST_Node, return_false);
        def_is_bigint(AST_BigInt, return_true);
        const unary = makePredicate("+ - ~ ++ --");
        def_is_bigint(AST_Unary, function(compressor) {
          return unary.has(this.operator) && this.expression.is_bigint(compressor);
        });
        const numeric_ops = makePredicate("- * / % & | ^ << >>");
        def_is_bigint(AST_Binary, function(compressor) {
          if (this.operator === "+") {
            return this.left.is_bigint(compressor) && this.right.is_number_or_bigint(compressor) || this.right.is_bigint(compressor) && this.left.is_number_or_bigint(compressor);
          } else if (numeric_ops.has(this.operator)) {
            return this.left.is_bigint(compressor) || this.right.is_bigint(compressor);
          } else {
            return false;
          }
        });
        def_is_bigint(AST_Assign, function(compressor) {
          return (numeric_ops.has(this.operator.slice(0, -1)) || this.operator == "=") && this.right.is_bigint(compressor);
        });
        def_is_bigint(AST_Sequence, function(compressor) {
          return this.tail_node().is_bigint(compressor);
        });
        def_is_bigint(AST_Conditional, function(compressor) {
          return this.consequent.is_bigint(compressor) && this.alternative.is_bigint(compressor);
        });
      })(function(node, func) {
        node.DEFMETHOD("is_bigint", func);
      });
      (function(def_is_number_or_bigint) {
        def_is_number_or_bigint(AST_Node, return_false);
        def_is_number_or_bigint(AST_Number, return_true);
        def_is_number_or_bigint(AST_BigInt, return_true);
        const numeric_unary_ops = makePredicate("+ - ~ ++ --");
        def_is_number_or_bigint(AST_Unary, function(_compressor) {
          return numeric_unary_ops.has(this.operator);
        });
        const numeric_ops = makePredicate("- * / % & | ^ << >>");
        def_is_number_or_bigint(AST_Binary, function(compressor) {
          return this.operator === "+" ? this.left.is_number_or_bigint(compressor) && this.right.is_number_or_bigint(compressor) : numeric_ops.has(this.operator);
        });
        def_is_number_or_bigint(AST_Assign, function(compressor) {
          return numeric_ops.has(this.operator.slice(0, -1)) || this.operator == "=" && this.right.is_number_or_bigint(compressor);
        });
        def_is_number_or_bigint(AST_Sequence, function(compressor) {
          return this.tail_node().is_number_or_bigint(compressor);
        });
        def_is_number_or_bigint(AST_Conditional, function(compressor) {
          return this.consequent.is_number_or_bigint(compressor) && this.alternative.is_number_or_bigint(compressor);
        });
      })(function(node, func) {
        node.DEFMETHOD("is_number_or_bigint", func);
      });
      (function(def_is_32_bit_integer) {
        def_is_32_bit_integer(AST_Node, return_false);
        def_is_32_bit_integer(AST_Number, function(_compressor) {
          return this.value === (this.value | 0);
        });
        def_is_32_bit_integer(AST_UnaryPrefix, function(compressor) {
          return this.operator == "~" ? this.expression.is_number(compressor) : this.operator === "+" ? this.expression.is_32_bit_integer(compressor) : false;
        });
        def_is_32_bit_integer(AST_Binary, function(compressor) {
          return bitwise_binop.has(this.operator) && (this.left.is_number(compressor) || this.right.is_number(compressor));
        });
      })(function(node, func) {
        node.DEFMETHOD("is_32_bit_integer", func);
      });
      (function(def_is_string) {
        def_is_string(AST_Node, return_false);
        def_is_string(AST_String, return_true);
        def_is_string(AST_TemplateString, return_true);
        def_is_string(AST_UnaryPrefix, function() {
          return this.operator == "typeof";
        });
        def_is_string(AST_Binary, function(compressor) {
          return this.operator == "+" && (this.left.is_string(compressor) || this.right.is_string(compressor));
        });
        def_is_string(AST_Assign, function(compressor) {
          return (this.operator == "=" || this.operator == "+=") && this.right.is_string(compressor);
        });
        def_is_string(AST_Sequence, function(compressor) {
          return this.tail_node().is_string(compressor);
        });
        def_is_string(AST_Conditional, function(compressor) {
          return this.consequent.is_string(compressor) && this.alternative.is_string(compressor);
        });
      })(function(node, func) {
        node.DEFMETHOD("is_string", func);
      });
      function is_undefined(node, compressor) {
        return has_flag(node, UNDEFINED2) || node instanceof AST_Undefined || node instanceof AST_UnaryPrefix && node.operator == "void" && !node.expression.has_side_effects(compressor);
      }
      function is_null_or_undefined(node, compressor) {
        let fixed;
        return node instanceof AST_Null || is_undefined(node, compressor) || node instanceof AST_SymbolRef && (fixed = node.definition().fixed) instanceof AST_Node && is_nullish(fixed, compressor);
      }
      function is_nullish_shortcircuited(node, compressor) {
        if (node instanceof AST_PropAccess || node instanceof AST_Call) {
          return node.optional && is_null_or_undefined(node.expression, compressor) || is_nullish_shortcircuited(node.expression, compressor);
        }
        if (node instanceof AST_Chain) return is_nullish_shortcircuited(node.expression, compressor);
        return false;
      }
      function is_nullish(node, compressor) {
        if (is_null_or_undefined(node, compressor)) return true;
        return is_nullish_shortcircuited(node, compressor);
      }
      (function(def_has_side_effects) {
        def_has_side_effects(AST_Node, return_true);
        def_has_side_effects(AST_EmptyStatement, return_false);
        def_has_side_effects(AST_Constant, return_false);
        def_has_side_effects(AST_This, return_false);
        function any(list, compressor) {
          for (var i = list.length; --i >= 0; )
            if (list[i].has_side_effects(compressor))
              return true;
          return false;
        }
        def_has_side_effects(AST_Block, function(compressor) {
          return any(this.body, compressor);
        });
        def_has_side_effects(AST_Call, function(compressor) {
          if (!this.is_callee_pure(compressor) && (!this.expression.is_call_pure(compressor) || this.expression.has_side_effects(compressor))) {
            return true;
          }
          return any(this.args, compressor);
        });
        def_has_side_effects(AST_Switch, function(compressor) {
          return this.expression.has_side_effects(compressor) || any(this.body, compressor);
        });
        def_has_side_effects(AST_Case, function(compressor) {
          return this.expression.has_side_effects(compressor) || any(this.body, compressor);
        });
        def_has_side_effects(AST_Try, function(compressor) {
          return this.body.has_side_effects(compressor) || this.bcatch && this.bcatch.has_side_effects(compressor) || this.bfinally && this.bfinally.has_side_effects(compressor);
        });
        def_has_side_effects(AST_If, function(compressor) {
          return this.condition.has_side_effects(compressor) || this.body && this.body.has_side_effects(compressor) || this.alternative && this.alternative.has_side_effects(compressor);
        });
        def_has_side_effects(AST_ImportMeta, return_false);
        def_has_side_effects(AST_LabeledStatement, function(compressor) {
          return this.body.has_side_effects(compressor);
        });
        def_has_side_effects(AST_SimpleStatement, function(compressor) {
          return this.body.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Lambda, return_false);
        def_has_side_effects(AST_Class, function(compressor) {
          if (this.extends && this.extends.has_side_effects(compressor)) {
            return true;
          }
          return any(this.properties, compressor);
        });
        def_has_side_effects(AST_ClassStaticBlock, function(compressor) {
          return any(this.body, compressor);
        });
        def_has_side_effects(AST_Binary, function(compressor) {
          return this.left.has_side_effects(compressor) || this.right.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Assign, return_true);
        def_has_side_effects(AST_Conditional, function(compressor) {
          return this.condition.has_side_effects(compressor) || this.consequent.has_side_effects(compressor) || this.alternative.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Unary, function(compressor) {
          return unary_side_effects.has(this.operator) || this.expression.has_side_effects(compressor);
        });
        def_has_side_effects(AST_SymbolRef, function(compressor) {
          return !this.is_declared(compressor) && !pure_prop_access_globals.has(this.name);
        });
        def_has_side_effects(AST_SymbolClassProperty, return_false);
        def_has_side_effects(AST_SymbolDeclaration, return_false);
        def_has_side_effects(AST_Object, function(compressor) {
          return any(this.properties, compressor);
        });
        def_has_side_effects(AST_ObjectKeyVal, function(compressor) {
          return this.computed_key() && this.key.has_side_effects(compressor) || this.value && this.value.has_side_effects(compressor);
        });
        def_has_side_effects([
          AST_ClassProperty,
          AST_ClassPrivateProperty
        ], function(compressor) {
          return this.computed_key() && this.key.has_side_effects(compressor) || this.static && this.value && this.value.has_side_effects(compressor);
        });
        def_has_side_effects([
          AST_PrivateMethod,
          AST_PrivateGetter,
          AST_PrivateSetter,
          AST_ConciseMethod,
          AST_ObjectGetter,
          AST_ObjectSetter
        ], function(compressor) {
          return this.computed_key() && this.key.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Array, function(compressor) {
          return any(this.elements, compressor);
        });
        def_has_side_effects(AST_Dot, function(compressor) {
          if (is_nullish(this, compressor)) {
            return this.expression.has_side_effects(compressor);
          }
          if (!this.optional && this.expression.may_throw_on_access(compressor)) {
            return true;
          }
          return this.expression.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Sub, function(compressor) {
          if (is_nullish(this, compressor)) {
            return this.expression.has_side_effects(compressor);
          }
          if (!this.optional && this.expression.may_throw_on_access(compressor)) {
            return true;
          }
          var property = this.property.has_side_effects(compressor);
          if (property && this.optional) return true;
          return property || this.expression.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Chain, function(compressor) {
          return this.expression.has_side_effects(compressor);
        });
        def_has_side_effects(AST_Sequence, function(compressor) {
          return any(this.expressions, compressor);
        });
        def_has_side_effects(AST_Definitions, function(compressor) {
          return any(this.definitions, compressor);
        });
        def_has_side_effects(AST_VarDef, function() {
          return this.value != null;
        });
        def_has_side_effects(AST_TemplateSegment, return_false);
        def_has_side_effects(AST_TemplateString, function(compressor) {
          return any(this.segments, compressor);
        });
      })(function(node_or_nodes, func) {
        for (const node of [].concat(node_or_nodes)) {
          node.DEFMETHOD("has_side_effects", func);
        }
      });
      (function(def_may_throw) {
        def_may_throw(AST_Node, return_true);
        def_may_throw(AST_Constant, return_false);
        def_may_throw(AST_EmptyStatement, return_false);
        def_may_throw(AST_Lambda, return_false);
        def_may_throw(AST_SymbolDeclaration, return_false);
        def_may_throw(AST_This, return_false);
        def_may_throw(AST_ImportMeta, return_false);
        function any(list, compressor) {
          for (var i = list.length; --i >= 0; )
            if (list[i].may_throw(compressor))
              return true;
          return false;
        }
        def_may_throw(AST_Class, function(compressor) {
          if (this.extends && this.extends.may_throw(compressor)) return true;
          return any(this.properties, compressor);
        });
        def_may_throw(AST_ClassStaticBlock, function(compressor) {
          return any(this.body, compressor);
        });
        def_may_throw(AST_Array, function(compressor) {
          return any(this.elements, compressor);
        });
        def_may_throw(AST_Assign, function(compressor) {
          if (this.right.may_throw(compressor)) return true;
          if (!compressor.has_directive("use strict") && this.operator == "=" && this.left instanceof AST_SymbolRef) {
            return false;
          }
          return this.left.may_throw(compressor);
        });
        def_may_throw(AST_Binary, function(compressor) {
          return this.left.may_throw(compressor) || this.right.may_throw(compressor);
        });
        def_may_throw(AST_Block, function(compressor) {
          return any(this.body, compressor);
        });
        def_may_throw(AST_Call, function(compressor) {
          if (is_nullish(this, compressor)) return false;
          if (any(this.args, compressor)) return true;
          if (this.is_callee_pure(compressor)) return false;
          if (this.expression.may_throw(compressor)) return true;
          return !(this.expression instanceof AST_Lambda) || any(this.expression.body, compressor);
        });
        def_may_throw(AST_Case, function(compressor) {
          return this.expression.may_throw(compressor) || any(this.body, compressor);
        });
        def_may_throw(AST_Conditional, function(compressor) {
          return this.condition.may_throw(compressor) || this.consequent.may_throw(compressor) || this.alternative.may_throw(compressor);
        });
        def_may_throw(AST_Definitions, function(compressor) {
          return any(this.definitions, compressor);
        });
        def_may_throw(AST_If, function(compressor) {
          return this.condition.may_throw(compressor) || this.body && this.body.may_throw(compressor) || this.alternative && this.alternative.may_throw(compressor);
        });
        def_may_throw(AST_LabeledStatement, function(compressor) {
          return this.body.may_throw(compressor);
        });
        def_may_throw(AST_Object, function(compressor) {
          return any(this.properties, compressor);
        });
        def_may_throw(AST_ObjectKeyVal, function(compressor) {
          return this.computed_key() && this.key.may_throw(compressor) || this.value ? this.value.may_throw(compressor) : false;
        });
        def_may_throw([
          AST_ClassProperty,
          AST_ClassPrivateProperty
        ], function(compressor) {
          return this.computed_key() && this.key.may_throw(compressor) || this.static && this.value && this.value.may_throw(compressor);
        });
        def_may_throw([
          AST_ConciseMethod,
          AST_ObjectGetter,
          AST_ObjectSetter
        ], function(compressor) {
          return this.computed_key() && this.key.may_throw(compressor);
        });
        def_may_throw([
          AST_PrivateMethod,
          AST_PrivateGetter,
          AST_PrivateSetter
        ], return_false);
        def_may_throw(AST_Return, function(compressor) {
          return this.value && this.value.may_throw(compressor);
        });
        def_may_throw(AST_Sequence, function(compressor) {
          return any(this.expressions, compressor);
        });
        def_may_throw(AST_SimpleStatement, function(compressor) {
          return this.body.may_throw(compressor);
        });
        def_may_throw(AST_Dot, function(compressor) {
          if (is_nullish(this, compressor)) return false;
          return !this.optional && this.expression.may_throw_on_access(compressor) || this.expression.may_throw(compressor);
        });
        def_may_throw(AST_Sub, function(compressor) {
          if (is_nullish(this, compressor)) return false;
          return !this.optional && this.expression.may_throw_on_access(compressor) || this.expression.may_throw(compressor) || this.property.may_throw(compressor);
        });
        def_may_throw(AST_Chain, function(compressor) {
          return this.expression.may_throw(compressor);
        });
        def_may_throw(AST_Switch, function(compressor) {
          return this.expression.may_throw(compressor) || any(this.body, compressor);
        });
        def_may_throw(AST_SymbolRef, function(compressor) {
          return !this.is_declared(compressor) && !pure_prop_access_globals.has(this.name);
        });
        def_may_throw(AST_SymbolClassProperty, return_false);
        def_may_throw(AST_Try, function(compressor) {
          return this.bcatch ? this.bcatch.may_throw(compressor) : this.body.may_throw(compressor) || this.bfinally && this.bfinally.may_throw(compressor);
        });
        def_may_throw(AST_Unary, function(compressor) {
          if (this.operator == "typeof" && this.expression instanceof AST_SymbolRef)
            return false;
          return this.expression.may_throw(compressor);
        });
        def_may_throw(AST_VarDef, function(compressor) {
          if (!this.value) return false;
          return this.value.may_throw(compressor);
        });
      })(function(node_or_nodes, func) {
        for (const node of [].concat(node_or_nodes)) {
          node.DEFMETHOD("may_throw", func);
        }
      });
      (function(def_is_constant_expression) {
        function all_refs_local(scope) {
          let result = true;
          walk(this, (node) => {
            if (node instanceof AST_SymbolRef) {
              if (has_flag(this, INLINED)) {
                result = false;
                return walk_abort;
              }
              var def = node.definition();
              if (member(def, this.enclosed) && !this.variables.has(def.name)) {
                if (scope) {
                  var scope_def = scope.find_variable(node);
                  if (def.undeclared ? !scope_def : scope_def === def) {
                    result = "f";
                    return true;
                  }
                }
                result = false;
                return walk_abort;
              }
              return true;
            }
            if (node instanceof AST_This && this instanceof AST_Arrow) {
              result = false;
              return walk_abort;
            }
          });
          return result;
        }
        def_is_constant_expression(AST_Node, return_false);
        def_is_constant_expression(AST_Constant, return_true);
        def_is_constant_expression(AST_Class, function(scope) {
          if (this.extends && !this.extends.is_constant_expression(scope)) {
            return false;
          }
          for (const prop2 of this.properties) {
            if (prop2.computed_key() && !prop2.key.is_constant_expression(scope)) {
              return false;
            }
            if (prop2.static && prop2.value && !prop2.value.is_constant_expression(scope)) {
              return false;
            }
            if (prop2 instanceof AST_ClassStaticBlock) {
              return false;
            }
          }
          return all_refs_local.call(this, scope);
        });
        def_is_constant_expression(AST_Lambda, all_refs_local);
        def_is_constant_expression(AST_Unary, function() {
          return this.expression.is_constant_expression();
        });
        def_is_constant_expression(AST_Binary, function() {
          return this.left.is_constant_expression() && this.right.is_constant_expression();
        });
        def_is_constant_expression(AST_Array, function() {
          return this.elements.every((l) => l.is_constant_expression());
        });
        def_is_constant_expression(AST_Object, function() {
          return this.properties.every((l) => l.is_constant_expression());
        });
        def_is_constant_expression(AST_ObjectProperty, function() {
          return !!(!(this.key instanceof AST_Node) && this.value && this.value.is_constant_expression());
        });
      })(function(node, func) {
        node.DEFMETHOD("is_constant_expression", func);
      });
      (function(def_may_throw_on_access) {
        AST_Node.DEFMETHOD("may_throw_on_access", function(compressor) {
          return !compressor.option("pure_getters") || this._dot_throw(compressor);
        });
        function is_strict(compressor) {
          return /strict/.test(compressor.option("pure_getters"));
        }
        def_may_throw_on_access(AST_Node, is_strict);
        def_may_throw_on_access(AST_Null, return_true);
        def_may_throw_on_access(AST_Undefined, return_true);
        def_may_throw_on_access(AST_Constant, return_false);
        def_may_throw_on_access(AST_Array, return_false);
        def_may_throw_on_access(AST_Object, function(compressor) {
          if (!is_strict(compressor)) return false;
          for (var i = this.properties.length; --i >= 0; )
            if (this.properties[i]._dot_throw(compressor)) return true;
          return false;
        });
        def_may_throw_on_access(AST_Class, return_false);
        def_may_throw_on_access(AST_ObjectProperty, return_false);
        def_may_throw_on_access(AST_ObjectGetter, return_true);
        def_may_throw_on_access(AST_Expansion, function(compressor) {
          return this.expression._dot_throw(compressor);
        });
        def_may_throw_on_access(AST_Function, return_false);
        def_may_throw_on_access(AST_Arrow, return_false);
        def_may_throw_on_access(AST_UnaryPostfix, return_false);
        def_may_throw_on_access(AST_UnaryPrefix, function() {
          return this.operator == "void";
        });
        def_may_throw_on_access(AST_Binary, function(compressor) {
          return (this.operator == "&&" || this.operator == "||" || this.operator == "??") && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor));
        });
        def_may_throw_on_access(AST_Assign, function(compressor) {
          if (this.logical) return true;
          return this.operator == "=" && this.right._dot_throw(compressor);
        });
        def_may_throw_on_access(AST_Conditional, function(compressor) {
          return this.consequent._dot_throw(compressor) || this.alternative._dot_throw(compressor);
        });
        def_may_throw_on_access(AST_Dot, function(compressor) {
          if (!is_strict(compressor)) return false;
          if (this.property == "prototype") {
            return !(this.expression instanceof AST_Function || this.expression instanceof AST_Class);
          }
          return true;
        });
        def_may_throw_on_access(AST_Chain, function(compressor) {
          return this.expression._dot_throw(compressor);
        });
        def_may_throw_on_access(AST_Sequence, function(compressor) {
          return this.tail_node()._dot_throw(compressor);
        });
        def_may_throw_on_access(AST_SymbolRef, function(compressor) {
          if (this.name === "arguments" && this.scope instanceof AST_Lambda) return false;
          if (has_flag(this, UNDEFINED2)) return true;
          if (!is_strict(compressor)) return false;
          if (is_undeclared_ref(this) && this.is_declared(compressor)) return false;
          if (this.is_immutable()) return false;
          var fixed = this.fixed_value();
          return !fixed || fixed._dot_throw(compressor);
        });
      })(function(node, func) {
        node.DEFMETHOD("_dot_throw", func);
      });
      function is_lhs(node, parent) {
        if (parent instanceof AST_Unary && unary_side_effects.has(parent.operator)) return parent.expression;
        if (parent instanceof AST_Assign && parent.left === node) return node;
        if (parent instanceof AST_ForIn && parent.init === node) return node;
      }
      (function(def_negate) {
        function basic_negation(exp) {
          return make_node(AST_UnaryPrefix, exp, {
            operator: "!",
            expression: exp
          });
        }
        function best(orig, alt, first_in_statement2) {
          var negated = basic_negation(orig);
          if (first_in_statement2) {
            var stat = make_node(AST_SimpleStatement, alt, {
              body: alt
            });
            return best_of_expression(negated, stat) === stat ? alt : negated;
          }
          return best_of_expression(negated, alt);
        }
        def_negate(AST_Node, function() {
          return basic_negation(this);
        });
        def_negate(AST_Statement, function() {
          throw new Error("Cannot negate a statement");
        });
        def_negate(AST_Function, function() {
          return basic_negation(this);
        });
        def_negate(AST_Class, function() {
          return basic_negation(this);
        });
        def_negate(AST_Arrow, function() {
          return basic_negation(this);
        });
        def_negate(AST_UnaryPrefix, function() {
          if (this.operator == "!")
            return this.expression;
          return basic_negation(this);
        });
        def_negate(AST_Sequence, function(compressor) {
          var expressions = this.expressions.slice();
          expressions.push(expressions.pop().negate(compressor));
          return make_sequence(this, expressions);
        });
        def_negate(AST_Conditional, function(compressor, first_in_statement2) {
          var self3 = this.clone();
          self3.consequent = self3.consequent.negate(compressor);
          self3.alternative = self3.alternative.negate(compressor);
          return best(this, self3, first_in_statement2);
        });
        def_negate(AST_Binary, function(compressor, first_in_statement2) {
          var self3 = this.clone(), op = this.operator;
          if (compressor.option("unsafe_comps")) {
            switch (op) {
              case "<=":
                self3.operator = ">";
                return self3;
              case "<":
                self3.operator = ">=";
                return self3;
              case ">=":
                self3.operator = "<";
                return self3;
              case ">":
                self3.operator = "<=";
                return self3;
            }
          }
          switch (op) {
            case "==":
              self3.operator = "!=";
              return self3;
            case "!=":
              self3.operator = "==";
              return self3;
            case "===":
              self3.operator = "!==";
              return self3;
            case "!==":
              self3.operator = "===";
              return self3;
            case "&&":
              self3.operator = "||";
              self3.left = self3.left.negate(compressor, first_in_statement2);
              self3.right = self3.right.negate(compressor);
              return best(this, self3, first_in_statement2);
            case "||":
              self3.operator = "&&";
              self3.left = self3.left.negate(compressor, first_in_statement2);
              self3.right = self3.right.negate(compressor);
              return best(this, self3, first_in_statement2);
          }
          return basic_negation(this);
        });
      })(function(node, func) {
        node.DEFMETHOD("negate", function(compressor, first_in_statement2) {
          return func.call(this, compressor, first_in_statement2);
        });
      });
      (function(def_bitwise_negate) {
        function basic_bitwise_negation(exp) {
          return make_node(AST_UnaryPrefix, exp, {
            operator: "~",
            expression: exp
          });
        }
        def_bitwise_negate(AST_Node, function(_compressor) {
          return basic_bitwise_negation(this);
        });
        def_bitwise_negate(AST_Number, function(_compressor) {
          const neg = ~this.value;
          if (neg.toString().length > this.value.toString().length) {
            return basic_bitwise_negation(this);
          }
          return make_node(AST_Number, this, { value: neg });
        });
        def_bitwise_negate(AST_UnaryPrefix, function(compressor, in_32_bit_context) {
          if (this.operator == "~" && (this.expression.is_32_bit_integer(compressor) || (in_32_bit_context != null ? in_32_bit_context : compressor.in_32_bit_context()))) {
            return this.expression;
          } else {
            return basic_bitwise_negation(this);
          }
        });
      })(function(node, func) {
        node.DEFMETHOD("bitwise_negate", func);
      });
      var global_pure_fns = makePredicate("Boolean decodeURI decodeURIComponent Date encodeURI encodeURIComponent Error escape EvalError isFinite isNaN Number Object parseFloat parseInt RangeError ReferenceError String SyntaxError TypeError unescape URIError");
      AST_Call.DEFMETHOD("is_callee_pure", function(compressor) {
        if (compressor.option("unsafe")) {
          var expr = this.expression;
          var first_arg = this.args && this.args[0] && this.args[0].evaluate(compressor);
          if (expr.expression && expr.expression.name === "hasOwnProperty" && (first_arg == null || first_arg.thedef && first_arg.thedef.undeclared)) {
            return false;
          }
          if (is_undeclared_ref(expr) && global_pure_fns.has(expr.name)) return true;
          if (expr instanceof AST_Dot && is_undeclared_ref(expr.expression) && is_pure_native_fn(expr.expression.name, expr.property)) {
            return true;
          }
        }
        if (this instanceof AST_New && compressor.option("pure_new")) {
          return true;
        }
        if (compressor.option("side_effects") && has_annotation(this, _PURE)) {
          return true;
        }
        return !compressor.pure_funcs(this);
      });
      AST_Node.DEFMETHOD("is_call_pure", return_false);
      AST_Dot.DEFMETHOD("is_call_pure", function(compressor) {
        if (!compressor.option("unsafe")) return;
        const expr = this.expression;
        let native_obj;
        if (expr instanceof AST_Array) {
          native_obj = "Array";
        } else if (expr.is_boolean()) {
          native_obj = "Boolean";
        } else if (expr.is_number(compressor)) {
          native_obj = "Number";
        } else if (expr instanceof AST_RegExp) {
          native_obj = "RegExp";
        } else if (expr.is_string(compressor)) {
          native_obj = "String";
        } else if (!this.may_throw_on_access(compressor)) {
          native_obj = "Object";
        }
        return native_obj != null && is_pure_native_method(native_obj, this.property);
      });
      const aborts = (thing) => thing && thing.aborts();
      (function(def_aborts) {
        def_aborts(AST_Statement, return_null);
        def_aborts(AST_Jump, return_this);
        function block_aborts() {
          for (var i = 0; i < this.body.length; i++) {
            if (aborts(this.body[i])) {
              return this.body[i];
            }
          }
          return null;
        }
        def_aborts(AST_Import, return_null);
        def_aborts(AST_BlockStatement, block_aborts);
        def_aborts(AST_SwitchBranch, block_aborts);
        def_aborts(AST_DefClass, function() {
          for (const prop2 of this.properties) {
            if (prop2 instanceof AST_ClassStaticBlock) {
              if (prop2.aborts()) return prop2;
            }
          }
          return null;
        });
        def_aborts(AST_ClassStaticBlock, block_aborts);
        def_aborts(AST_If, function() {
          return this.alternative && aborts(this.body) && aborts(this.alternative) && this;
        });
      })(function(node, func) {
        node.DEFMETHOD("aborts", func);
      });
      AST_Node.DEFMETHOD("contains_this", function() {
        return walk(this, (node) => {
          if (node instanceof AST_This) return walk_abort;
          if (node !== this && node instanceof AST_Scope && !(node instanceof AST_Arrow)) {
            return true;
          }
        });
      });
      function is_modified(compressor, tw, node, value2, level, immutable) {
        var parent = tw.parent(level);
        var lhs = is_lhs(node, parent);
        if (lhs) return lhs;
        if (!immutable && parent instanceof AST_Call && parent.expression === node && !(value2 instanceof AST_Arrow) && !(value2 instanceof AST_Class) && !parent.is_callee_pure(compressor) && (!(value2 instanceof AST_Function) || !(parent instanceof AST_New) && value2.contains_this())) {
          return true;
        }
        if (parent instanceof AST_Array) {
          return is_modified(compressor, tw, parent, parent, level + 1);
        }
        if (parent instanceof AST_ObjectKeyVal && node === parent.value) {
          var obj = tw.parent(level + 1);
          return is_modified(compressor, tw, obj, obj, level + 2);
        }
        if (parent instanceof AST_PropAccess && parent.expression === node) {
          var prop2 = read_property(value2, parent.property);
          return !immutable && is_modified(compressor, tw, parent, prop2, level + 1);
        }
      }
      function is_used_in_expression(tw) {
        for (let p = -1, node, parent; node = tw.parent(p), parent = tw.parent(p + 1); p++) {
          if (parent instanceof AST_Sequence) {
            const nth_expression = parent.expressions.indexOf(node);
            if (nth_expression !== parent.expressions.length - 1) {
              const grandparent = tw.parent(p + 2);
              if (parent.expressions.length > 2 || parent.expressions.length === 1 || !requires_sequence_to_maintain_binding(grandparent, parent, parent.expressions[1])) {
                return false;
              }
              return true;
            } else {
              continue;
            }
          }
          if (parent instanceof AST_Unary) {
            const op = parent.operator;
            if (op === "void") {
              return false;
            }
            if (op === "typeof" || op === "+" || op === "-" || op === "!" || op === "~") {
              continue;
            }
          }
          if (parent instanceof AST_SimpleStatement || parent instanceof AST_LabeledStatement) {
            return false;
          }
          if (parent instanceof AST_Scope) {
            return false;
          }
          return true;
        }
        return true;
      }
      function def_eval(node, func) {
        node.DEFMETHOD("_eval", func);
      }
      const nullish = Symbol("This AST_Chain is nullish");
      AST_Node.DEFMETHOD("evaluate", function(compressor) {
        if (!compressor.option("evaluate"))
          return this;
        var val = this._eval(compressor, 1);
        if (!val || val instanceof RegExp)
          return val;
        if (typeof val == "function" || typeof val == "object" || val == nullish)
          return this;
        if (typeof val === "string") {
          const unevaluated_size = this.size(compressor);
          if (val.length + 2 > unevaluated_size) return this;
        }
        return val;
      });
      var unaryPrefix = makePredicate("! ~ - + void");
      AST_Node.DEFMETHOD("is_constant", function() {
        if (this instanceof AST_Constant) {
          return !(this instanceof AST_RegExp);
        } else {
          return this instanceof AST_UnaryPrefix && unaryPrefix.has(this.operator) && // `this.expression` may be an `AST_RegExp`,
          // so not only `.is_constant()`.
          (this.expression instanceof AST_Constant || this.expression.is_constant());
        }
      });
      def_eval(AST_Statement, function() {
        throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start));
      });
      def_eval(AST_Lambda, return_this);
      def_eval(AST_Class, return_this);
      def_eval(AST_Node, return_this);
      def_eval(AST_Constant, function() {
        return this.getValue();
      });
      const supports_bigint = typeof BigInt === "function";
      def_eval(AST_BigInt, function() {
        if (supports_bigint) {
          return BigInt(this.value);
        } else {
          return this;
        }
      });
      def_eval(AST_RegExp, function(compressor) {
        let evaluated = compressor.evaluated_regexps.get(this.value);
        if (evaluated === void 0 && regexp_is_safe(this.value.source)) {
          try {
            const { source: source2, flags: flags2 } = this.value;
            evaluated = new RegExp(source2, flags2);
          } catch (e2) {
            evaluated = null;
          }
          compressor.evaluated_regexps.set(this.value, evaluated);
        }
        return evaluated || this;
      });
      def_eval(AST_TemplateString, function() {
        if (this.segments.length !== 1) return this;
        return this.segments[0].value;
      });
      def_eval(AST_Function, function(compressor) {
        if (compressor.option("unsafe")) {
          var fn = function() {
          };
          fn.node = this;
          fn.toString = () => this.print_to_string();
          return fn;
        }
        return this;
      });
      def_eval(AST_Array, function(compressor, depth) {
        if (compressor.option("unsafe")) {
          var elements = [];
          for (var i = 0, len = this.elements.length; i < len; i++) {
            var element2 = this.elements[i];
            var value2 = element2._eval(compressor, depth);
            if (element2 === value2)
              return this;
            elements.push(value2);
          }
          return elements;
        }
        return this;
      });
      def_eval(AST_Object, function(compressor, depth) {
        if (compressor.option("unsafe")) {
          var val = {};
          for (var i = 0, len = this.properties.length; i < len; i++) {
            var prop2 = this.properties[i];
            if (prop2 instanceof AST_Expansion)
              return this;
            var key4 = prop2.key;
            if (key4 instanceof AST_Symbol) {
              key4 = key4.name;
            } else if (key4 instanceof AST_Node) {
              key4 = key4._eval(compressor, depth);
              if (key4 === prop2.key)
                return this;
            }
            if (typeof Object.prototype[key4] === "function") {
              return this;
            }
            if (prop2.value instanceof AST_Function)
              continue;
            val[key4] = prop2.value._eval(compressor, depth);
            if (val[key4] === prop2.value)
              return this;
          }
          return val;
        }
        return this;
      });
      var non_converting_unary = makePredicate("! typeof void");
      def_eval(AST_UnaryPrefix, function(compressor, depth) {
        var e2 = this.expression;
        if (compressor.option("typeofs") && this.operator == "typeof") {
          if (e2 instanceof AST_Lambda || e2 instanceof AST_SymbolRef && e2.fixed_value() instanceof AST_Lambda) {
            return "function";
          }
          if ((e2 instanceof AST_Object || e2 instanceof AST_Array || e2 instanceof AST_SymbolRef && (e2.fixed_value() instanceof AST_Object || e2.fixed_value() instanceof AST_Array)) && !e2.has_side_effects(compressor)) {
            return typeof {};
          }
        }
        if (!non_converting_unary.has(this.operator))
          depth++;
        e2 = e2._eval(compressor, depth);
        if (e2 === this.expression)
          return this;
        switch (this.operator) {
          case "!":
            return !e2;
          case "typeof":
            if (e2 instanceof RegExp)
              return this;
            return typeof e2;
          case "void":
            return void e2;
          case "~":
            return ~e2;
          case "-":
            return -e2;
          case "+":
            return +e2;
        }
        return this;
      });
      var non_converting_binary = makePredicate("&& || ?? === !==");
      const identity_comparison = makePredicate("== != === !==");
      const has_identity = (value2) => typeof value2 === "object" || typeof value2 === "function" || typeof value2 === "symbol";
      def_eval(AST_Binary, function(compressor, depth) {
        if (!non_converting_binary.has(this.operator))
          depth++;
        var left = this.left._eval(compressor, depth);
        if (left === this.left)
          return this;
        var right = this.right._eval(compressor, depth);
        if (right === this.right)
          return this;
        if (left != null && right != null && identity_comparison.has(this.operator) && has_identity(left) && has_identity(right) && typeof left === typeof right) {
          return this;
        }
        if (typeof left === "bigint" !== (typeof right === "bigint") || typeof left === "bigint" && (this.operator === ">>>" || this.operator === "/" && Number(right) === 0)) {
          return this;
        }
        var result;
        switch (this.operator) {
          case "&&":
            result = left && right;
            break;
          case "||":
            result = left || right;
            break;
          case "??":
            result = left != null ? left : right;
            break;
          case "|":
            result = left | right;
            break;
          case "&":
            result = left & right;
            break;
          case "^":
            result = left ^ right;
            break;
          case "+":
            result = left + right;
            break;
          case "*":
            result = left * right;
            break;
          case "**":
            result = left ** right;
            break;
          case "/":
            result = left / right;
            break;
          case "%":
            result = left % right;
            break;
          case "-":
            result = left - right;
            break;
          case "<<":
            result = left << right;
            break;
          case ">>":
            result = left >> right;
            break;
          case ">>>":
            result = left >>> right;
            break;
          case "==":
            result = left == right;
            break;
          case "===":
            result = left === right;
            break;
          case "!=":
            result = left != right;
            break;
          case "!==":
            result = left !== right;
            break;
          case "<":
            result = left < right;
            break;
          case "<=":
            result = left <= right;
            break;
          case ">":
            result = left > right;
            break;
          case ">=":
            result = left >= right;
            break;
          default:
            return this;
        }
        if (typeof result === "number" && isNaN(result) && compressor.find_parent(AST_With)) {
          return this;
        }
        return result;
      });
      def_eval(AST_Conditional, function(compressor, depth) {
        var condition = this.condition._eval(compressor, depth);
        if (condition === this.condition)
          return this;
        var node = condition ? this.consequent : this.alternative;
        var value2 = node._eval(compressor, depth);
        return value2 === node ? this : value2;
      });
      const reentrant_ref_eval = /* @__PURE__ */ new Set();
      def_eval(AST_SymbolRef, function(compressor, depth) {
        if (reentrant_ref_eval.has(this))
          return this;
        var fixed = this.fixed_value();
        if (!fixed)
          return this;
        reentrant_ref_eval.add(this);
        const value2 = fixed._eval(compressor, depth);
        reentrant_ref_eval.delete(this);
        if (value2 === fixed)
          return this;
        if (value2 && typeof value2 == "object") {
          var escaped = this.definition().escaped;
          if (escaped && depth > escaped)
            return this;
        }
        return value2;
      });
      const global_objs = { Array, Math, Number, Object, String };
      const regexp_flags = /* @__PURE__ */ new Set([
        "dotAll",
        "global",
        "ignoreCase",
        "multiline",
        "sticky",
        "unicode"
      ]);
      def_eval(AST_PropAccess, function(compressor, depth) {
        let obj = this.expression._eval(compressor, depth + 1);
        if (obj === nullish || this.optional && obj == null) return nullish;
        if (this.property === "length") {
          if (typeof obj === "string") {
            return obj.length;
          }
          const is_spreadless_array = obj instanceof AST_Array && obj.elements.every((el) => !(el instanceof AST_Expansion));
          if (is_spreadless_array && obj.elements.every((el) => !el.has_side_effects(compressor))) {
            return obj.elements.length;
          }
        }
        if (compressor.option("unsafe")) {
          var key4 = this.property;
          if (key4 instanceof AST_Node) {
            key4 = key4._eval(compressor, depth);
            if (key4 === this.property)
              return this;
          }
          var exp = this.expression;
          if (is_undeclared_ref(exp)) {
            var aa;
            var first_arg = exp.name === "hasOwnProperty" && key4 === "call" && (aa = compressor.parent() && compressor.parent().args) && (aa && aa[0] && aa[0].evaluate(compressor));
            first_arg = first_arg instanceof AST_Dot ? first_arg.expression : first_arg;
            if (first_arg == null || first_arg.thedef && first_arg.thedef.undeclared) {
              return this.clone();
            }
            if (!is_pure_native_value(exp.name, key4))
              return this;
            obj = global_objs[exp.name];
          } else {
            if (obj instanceof RegExp) {
              if (key4 == "source") {
                return regexp_source_fix(obj.source);
              } else if (key4 == "flags" || regexp_flags.has(key4)) {
                return obj[key4];
              }
            }
            if (!obj || obj === exp || !HOP(obj, key4))
              return this;
            if (typeof obj == "function")
              switch (key4) {
                case "name":
                  return obj.node.name ? obj.node.name.name : "";
                case "length":
                  return obj.node.length_property();
                default:
                  return this;
              }
          }
          return obj[key4];
        }
        return this;
      });
      def_eval(AST_Chain, function(compressor, depth) {
        const evaluated = this.expression._eval(compressor, depth);
        return evaluated === nullish ? void 0 : evaluated === this.expression ? this : evaluated;
      });
      def_eval(AST_Call, function(compressor, depth) {
        var exp = this.expression;
        const callee = exp._eval(compressor, depth);
        if (callee === nullish || this.optional && callee == null) return nullish;
        if (compressor.option("unsafe") && exp instanceof AST_PropAccess) {
          var key4 = exp.property;
          if (key4 instanceof AST_Node) {
            key4 = key4._eval(compressor, depth);
            if (key4 === exp.property)
              return this;
          }
          var val;
          var e2 = exp.expression;
          if (is_undeclared_ref(e2)) {
            var first_arg = e2.name === "hasOwnProperty" && key4 === "call" && (this.args[0] && this.args[0].evaluate(compressor));
            first_arg = first_arg instanceof AST_Dot ? first_arg.expression : first_arg;
            if (first_arg == null || first_arg.thedef && first_arg.thedef.undeclared) {
              return this.clone();
            }
            if (!is_pure_native_fn(e2.name, key4)) return this;
            val = global_objs[e2.name];
          } else {
            val = e2._eval(compressor, depth + 1);
            if (val === e2 || !val)
              return this;
            if (!is_pure_native_method(val.constructor.name, key4))
              return this;
          }
          var args = [];
          for (var i = 0, len = this.args.length; i < len; i++) {
            var arg = this.args[i];
            var value2 = arg._eval(compressor, depth);
            if (arg === value2)
              return this;
            if (arg instanceof AST_Lambda)
              return this;
            args.push(value2);
          }
          try {
            return val[key4].apply(val, args);
          } catch (ex) {
          }
        }
        return this;
      });
      def_eval(AST_New, return_this);
      function def_drop_side_effect_free(node_or_nodes, func) {
        for (const node of [].concat(node_or_nodes)) {
          node.DEFMETHOD("drop_side_effect_free", func);
        }
      }
      function trim(nodes, compressor, first_in_statement2) {
        var len = nodes.length;
        if (!len) return null;
        var ret = [], changed = false;
        for (var i = 0; i < len; i++) {
          var node = nodes[i].drop_side_effect_free(compressor, first_in_statement2);
          changed |= node !== nodes[i];
          if (node) {
            ret.push(node);
            first_in_statement2 = false;
          }
        }
        return changed ? ret.length ? ret : null : nodes;
      }
      def_drop_side_effect_free(AST_Node, return_this);
      def_drop_side_effect_free(AST_Constant, return_null);
      def_drop_side_effect_free(AST_This, return_null);
      def_drop_side_effect_free(AST_Call, function(compressor, first_in_statement2) {
        if (is_nullish_shortcircuited(this, compressor)) {
          return this.expression.drop_side_effect_free(compressor, first_in_statement2);
        }
        if (!this.is_callee_pure(compressor)) {
          if (this.expression.is_call_pure(compressor)) {
            var exprs = this.args.slice();
            exprs.unshift(this.expression.expression);
            exprs = trim(exprs, compressor, first_in_statement2);
            return exprs && make_sequence(this, exprs);
          }
          if (is_func_expr(this.expression) && (!this.expression.name || !this.expression.name.definition().references.length)) {
            var node = this.clone();
            node.expression.process_expression(false, compressor);
            return node;
          }
          return this;
        }
        var args = trim(this.args, compressor, first_in_statement2);
        return args && make_sequence(this, args);
      });
      def_drop_side_effect_free(AST_Accessor, return_null);
      def_drop_side_effect_free(AST_Function, return_null);
      def_drop_side_effect_free(AST_Arrow, return_null);
      def_drop_side_effect_free(AST_Class, function(compressor) {
        const with_effects = [];
        if (this.is_self_referential() && this.has_side_effects(compressor)) {
          return this;
        }
        const trimmed_extends = this.extends && this.extends.drop_side_effect_free(compressor);
        if (trimmed_extends) with_effects.push(trimmed_extends);
        for (const prop2 of this.properties) {
          if (prop2 instanceof AST_ClassStaticBlock) {
            if (prop2.has_side_effects(compressor)) {
              return this;
            }
          } else {
            const trimmed_prop = prop2.drop_side_effect_free(compressor);
            if (trimmed_prop) with_effects.push(trimmed_prop);
          }
        }
        if (!with_effects.length)
          return null;
        const exprs = make_sequence(this, with_effects);
        if (this instanceof AST_DefClass) {
          return make_node(AST_SimpleStatement, this, { body: exprs });
        } else {
          return exprs;
        }
      });
      def_drop_side_effect_free([
        AST_ClassProperty,
        AST_ClassPrivateProperty
      ], function(compressor) {
        const key4 = this.computed_key() && this.key.drop_side_effect_free(compressor);
        const value2 = this.static && this.value && this.value.drop_side_effect_free(compressor);
        if (key4 && value2)
          return make_sequence(this, [key4, value2]);
        return key4 || value2 || null;
      });
      def_drop_side_effect_free(AST_Binary, function(compressor, first_in_statement2) {
        var right = this.right.drop_side_effect_free(compressor);
        if (!right)
          return this.left.drop_side_effect_free(compressor, first_in_statement2);
        if (lazy_op.has(this.operator)) {
          if (right === this.right)
            return this;
          var node = this.clone();
          node.right = right;
          return node;
        } else {
          var left = this.left.drop_side_effect_free(compressor, first_in_statement2);
          if (!left)
            return this.right.drop_side_effect_free(compressor, first_in_statement2);
          return make_sequence(this, [left, right]);
        }
      });
      def_drop_side_effect_free(AST_Assign, function(compressor) {
        if (this.logical)
          return this;
        var left = this.left;
        if (left.has_side_effects(compressor) || compressor.has_directive("use strict") && left instanceof AST_PropAccess && left.expression.is_constant()) {
          return this;
        }
        set_flag(this, WRITE_ONLY);
        while (left instanceof AST_PropAccess) {
          left = left.expression;
        }
        if (left.is_constant_expression(compressor.find_parent(AST_Scope))) {
          return this.right.drop_side_effect_free(compressor);
        }
        return this;
      });
      def_drop_side_effect_free(AST_Conditional, function(compressor) {
        var consequent = this.consequent.drop_side_effect_free(compressor);
        var alternative = this.alternative.drop_side_effect_free(compressor);
        if (consequent === this.consequent && alternative === this.alternative)
          return this;
        if (!consequent)
          return alternative ? make_node(AST_Binary, this, {
            operator: "||",
            left: this.condition,
            right: alternative
          }) : this.condition.drop_side_effect_free(compressor);
        if (!alternative)
          return make_node(AST_Binary, this, {
            operator: "&&",
            left: this.condition,
            right: consequent
          });
        var node = this.clone();
        node.consequent = consequent;
        node.alternative = alternative;
        return node;
      });
      def_drop_side_effect_free(AST_Unary, function(compressor, first_in_statement2) {
        if (unary_side_effects.has(this.operator)) {
          if (!this.expression.has_side_effects(compressor)) {
            set_flag(this, WRITE_ONLY);
          } else {
            clear_flag(this, WRITE_ONLY);
          }
          return this;
        }
        if (this.operator == "typeof" && this.expression instanceof AST_SymbolRef)
          return null;
        var expression = this.expression.drop_side_effect_free(compressor, first_in_statement2);
        if (first_in_statement2 && expression && is_iife_call(expression)) {
          if (expression === this.expression && this.operator == "!")
            return this;
          return expression.negate(compressor, first_in_statement2);
        }
        return expression;
      });
      def_drop_side_effect_free(AST_SymbolRef, function(compressor) {
        const safe_access = this.is_declared(compressor) || pure_prop_access_globals.has(this.name);
        return safe_access ? null : this;
      });
      def_drop_side_effect_free(AST_Object, function(compressor, first_in_statement2) {
        var values = trim(this.properties, compressor, first_in_statement2);
        return values && make_sequence(this, values);
      });
      def_drop_side_effect_free(AST_ObjectKeyVal, function(compressor, first_in_statement2) {
        const computed_key = this.key instanceof AST_Node;
        const key4 = computed_key && this.key.drop_side_effect_free(compressor, first_in_statement2);
        const value2 = this.value.drop_side_effect_free(compressor, first_in_statement2);
        if (key4 && value2) {
          return make_sequence(this, [key4, value2]);
        }
        return key4 || value2;
      });
      def_drop_side_effect_free([
        AST_ConciseMethod,
        AST_ObjectGetter,
        AST_ObjectSetter
      ], function() {
        return this.computed_key() ? this.key : null;
      });
      def_drop_side_effect_free([
        AST_PrivateMethod,
        AST_PrivateGetter,
        AST_PrivateSetter
      ], function() {
        return null;
      });
      def_drop_side_effect_free(AST_Array, function(compressor, first_in_statement2) {
        var values = trim(this.elements, compressor, first_in_statement2);
        return values && make_sequence(this, values);
      });
      def_drop_side_effect_free(AST_Dot, function(compressor, first_in_statement2) {
        if (is_nullish_shortcircuited(this, compressor)) {
          return this.expression.drop_side_effect_free(compressor, first_in_statement2);
        }
        if (!this.optional && this.expression.may_throw_on_access(compressor)) {
          return this;
        }
        return this.expression.drop_side_effect_free(compressor, first_in_statement2);
      });
      def_drop_side_effect_free(AST_Sub, function(compressor, first_in_statement2) {
        if (is_nullish_shortcircuited(this, compressor)) {
          return this.expression.drop_side_effect_free(compressor, first_in_statement2);
        }
        if (!this.optional && this.expression.may_throw_on_access(compressor)) {
          return this;
        }
        var property = this.property.drop_side_effect_free(compressor);
        if (property && this.optional) return this;
        var expression = this.expression.drop_side_effect_free(compressor, first_in_statement2);
        if (expression && property) return make_sequence(this, [expression, property]);
        return expression || property;
      });
      def_drop_side_effect_free(AST_Chain, function(compressor, first_in_statement2) {
        return this.expression.drop_side_effect_free(compressor, first_in_statement2);
      });
      def_drop_side_effect_free(AST_Sequence, function(compressor) {
        var last = this.tail_node();
        var expr = last.drop_side_effect_free(compressor);
        if (expr === last)
          return this;
        var expressions = this.expressions.slice(0, -1);
        if (expr)
          expressions.push(expr);
        if (!expressions.length) {
          return make_node(AST_Number, this, { value: 0 });
        }
        return make_sequence(this, expressions);
      });
      def_drop_side_effect_free(AST_Expansion, function(compressor, first_in_statement2) {
        return this.expression.drop_side_effect_free(compressor, first_in_statement2);
      });
      def_drop_side_effect_free(AST_TemplateSegment, return_null);
      def_drop_side_effect_free(AST_TemplateString, function(compressor) {
        var values = trim(this.segments, compressor, first_in_statement);
        return values && make_sequence(this, values);
      });
      const r_keep_assign = /keep_assign/;
      AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
        if (!compressor.option("unused")) return;
        if (compressor.has_directive("use asm")) return;
        if (!this.variables) return;
        var self3 = this;
        if (self3.pinned()) return;
        var drop_funcs = !(self3 instanceof AST_Toplevel) || compressor.toplevel.funcs;
        var drop_vars = !(self3 instanceof AST_Toplevel) || compressor.toplevel.vars;
        const assign_as_unused = r_keep_assign.test(compressor.option("unused")) ? return_false : function(node) {
          if (node instanceof AST_Assign && !node.logical && (has_flag(node, WRITE_ONLY) || node.operator == "=")) {
            return node.left;
          }
          if (node instanceof AST_Unary && has_flag(node, WRITE_ONLY)) {
            return node.expression;
          }
        };
        var in_use_ids = /* @__PURE__ */ new Map();
        var fixed_ids = /* @__PURE__ */ new Map();
        if (self3 instanceof AST_Toplevel && compressor.top_retain) {
          self3.variables.forEach(function(def) {
            if (compressor.top_retain(def)) {
              in_use_ids.set(def.id, def);
            }
          });
        }
        var var_defs_by_id = /* @__PURE__ */ new Map();
        var initializations = /* @__PURE__ */ new Map();
        var scope = this;
        var tw = new TreeWalker(function(node, descend) {
          if (node instanceof AST_Lambda && node.uses_arguments && !tw.has_directive("use strict")) {
            node.argnames.forEach(function(argname) {
              if (!(argname instanceof AST_SymbolDeclaration)) return;
              var def = argname.definition();
              in_use_ids.set(def.id, def);
            });
          }
          if (node === self3) return;
          if (node instanceof AST_Class && node.has_side_effects(compressor)) {
            if (node.is_self_referential()) {
              descend();
            } else {
              node.visit_nondeferred_class_parts(tw);
            }
          }
          if (node instanceof AST_Defun || node instanceof AST_DefClass) {
            var node_def = node.name.definition();
            const in_export = tw.parent() instanceof AST_Export;
            if (in_export || !drop_funcs && scope === self3) {
              if (node_def.global) {
                in_use_ids.set(node_def.id, node_def);
              }
            }
            map_add(initializations, node_def.id, node);
            return true;
          }
          const in_root_scope = scope === self3;
          if (node instanceof AST_SymbolFunarg && in_root_scope) {
            map_add(var_defs_by_id, node.definition().id, node);
          }
          if (node instanceof AST_Definitions && in_root_scope) {
            const in_export = tw.parent() instanceof AST_Export;
            node.definitions.forEach(function(def) {
              if (def.name instanceof AST_SymbolVar) {
                map_add(var_defs_by_id, def.name.definition().id, def);
              }
              if (in_export || !drop_vars) {
                walk(def.name, (node2) => {
                  if (node2 instanceof AST_SymbolDeclaration) {
                    const def2 = node2.definition();
                    if (def2.global) {
                      in_use_ids.set(def2.id, def2);
                    }
                  }
                });
              }
              if (def.name instanceof AST_Destructuring) {
                def.walk(tw);
              }
              if (def.name instanceof AST_SymbolDeclaration && def.value) {
                var node_def2 = def.name.definition();
                map_add(initializations, node_def2.id, def.value);
                if (!node_def2.chained && def.name.fixed_value() === def.value) {
                  fixed_ids.set(node_def2.id, def);
                }
                if (def.value.has_side_effects(compressor)) {
                  def.value.walk(tw);
                }
              }
            });
            return true;
          }
          return scan_ref_scoped(node, descend);
        });
        self3.walk(tw);
        tw = new TreeWalker(scan_ref_scoped);
        in_use_ids.forEach(function(def) {
          var init3 = initializations.get(def.id);
          if (init3) init3.forEach(function(init4) {
            init4.walk(tw);
          });
        });
        var tt = new TreeTransformer(
          function before(node, descend, in_list) {
            var parent = tt.parent();
            if (drop_vars) {
              const sym2 = assign_as_unused(node);
              if (sym2 instanceof AST_SymbolRef) {
                var def = sym2.definition();
                var in_use = in_use_ids.has(def.id);
                if (node instanceof AST_Assign) {
                  if (!in_use || fixed_ids.has(def.id) && fixed_ids.get(def.id) !== node) {
                    const assignee = node.right.transform(tt);
                    if (!in_use && !assignee.has_side_effects(compressor) && !is_used_in_expression(tt)) {
                      return in_list ? MAP.skip : make_node(AST_Number, node, { value: 0 });
                    }
                    return maintain_this_binding(parent, node, assignee);
                  }
                } else if (!in_use) {
                  return in_list ? MAP.skip : make_node(AST_Number, node, { value: 0 });
                }
              }
            }
            if (scope !== self3) return;
            var def;
            if (node.name && (node instanceof AST_ClassExpression && !keep_name(compressor.option("keep_classnames"), (def = node.name.definition()).name) || node instanceof AST_Function && !keep_name(compressor.option("keep_fnames"), (def = node.name.definition()).name))) {
              if (!in_use_ids.has(def.id) || def.orig.length > 1) node.name = null;
            }
            if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) {
              var trim2 = !compressor.option("keep_fargs") || parent instanceof AST_Call && parent.expression === node && !node.pinned() && (!node.name || node.name.unreferenced());
              for (var a = node.argnames, i = a.length; --i >= 0; ) {
                var sym = a[i];
                if (sym instanceof AST_Expansion) {
                  sym = sym.expression;
                }
                if (sym instanceof AST_DefaultAssign) {
                  sym = sym.left;
                }
                if (!(sym instanceof AST_Destructuring) && !in_use_ids.has(sym.definition().id)) {
                  set_flag(sym, UNUSED);
                  if (trim2) {
                    a.pop();
                  }
                } else {
                  trim2 = false;
                }
              }
            }
            if (node instanceof AST_DefClass && node !== self3) {
              const def2 = node.name.definition();
              descend(node, this);
              const keep_class = def2.global && !drop_funcs || in_use_ids.has(def2.id);
              if (!keep_class) {
                const kept = node.drop_side_effect_free(compressor);
                if (kept == null) {
                  def2.eliminated++;
                  return in_list ? MAP.skip : make_node(AST_EmptyStatement, node);
                }
                return kept;
              }
              return node;
            }
            if (node instanceof AST_Defun && node !== self3) {
              const def2 = node.name.definition();
              const keep = def2.global && !drop_funcs || in_use_ids.has(def2.id);
              if (!keep) {
                def2.eliminated++;
                return in_list ? MAP.skip : make_node(AST_EmptyStatement, node);
              }
            }
            if (node instanceof AST_Definitions && !(parent instanceof AST_ForIn && parent.init === node)) {
              var drop_block = !(parent instanceof AST_Toplevel) && !(node instanceof AST_Var);
              var body = [], head2 = [], tail = [];
              var side_effects = [];
              node.definitions.forEach(function(def2) {
                if (def2.value) def2.value = def2.value.transform(tt);
                var is_destructure = def2.name instanceof AST_Destructuring;
                var sym2 = is_destructure ? new SymbolDef(null, { name: "<destructure>" }) : def2.name.definition();
                if (drop_block && sym2.global) return tail.push(def2);
                if (!(drop_vars || drop_block) || is_destructure && (def2.name.names.length || def2.name.is_array || compressor.option("pure_getters") != true) || in_use_ids.has(sym2.id)) {
                  if (def2.value && fixed_ids.has(sym2.id) && fixed_ids.get(sym2.id) !== def2) {
                    def2.value = def2.value.drop_side_effect_free(compressor);
                  }
                  if (def2.name instanceof AST_SymbolVar) {
                    var var_defs = var_defs_by_id.get(sym2.id);
                    if (var_defs.length > 1 && (!def2.value || sym2.orig.indexOf(def2.name) > sym2.eliminated)) {
                      if (def2.value) {
                        var ref = make_node(AST_SymbolRef, def2.name, def2.name);
                        sym2.references.push(ref);
                        var assign2 = make_node(AST_Assign, def2, {
                          operator: "=",
                          logical: false,
                          left: ref,
                          right: def2.value
                        });
                        if (fixed_ids.get(sym2.id) === def2) {
                          fixed_ids.set(sym2.id, assign2);
                        }
                        side_effects.push(assign2.transform(tt));
                      }
                      remove(var_defs, def2);
                      sym2.eliminated++;
                      return;
                    }
                  }
                  if (def2.value) {
                    if (side_effects.length > 0) {
                      if (tail.length > 0) {
                        side_effects.push(def2.value);
                        def2.value = make_sequence(def2.value, side_effects);
                      } else {
                        body.push(make_node(AST_SimpleStatement, node, {
                          body: make_sequence(node, side_effects)
                        }));
                      }
                      side_effects = [];
                    }
                    tail.push(def2);
                  } else {
                    head2.push(def2);
                  }
                } else if (sym2.orig[0] instanceof AST_SymbolCatch) {
                  var value2 = def2.value && def2.value.drop_side_effect_free(compressor);
                  if (value2) side_effects.push(value2);
                  def2.value = null;
                  head2.push(def2);
                } else {
                  var value2 = def2.value && def2.value.drop_side_effect_free(compressor);
                  if (value2) {
                    side_effects.push(value2);
                  }
                  sym2.eliminated++;
                }
              });
              if (head2.length > 0 || tail.length > 0) {
                node.definitions = head2.concat(tail);
                body.push(node);
              }
              if (side_effects.length > 0) {
                body.push(make_node(AST_SimpleStatement, node, {
                  body: make_sequence(node, side_effects)
                }));
              }
              switch (body.length) {
                case 0:
                  return in_list ? MAP.skip : make_node(AST_EmptyStatement, node);
                case 1:
                  return body[0];
                default:
                  return in_list ? MAP.splice(body) : make_node(AST_BlockStatement, node, { body });
              }
            }
            if (node instanceof AST_For) {
              descend(node, this);
              var block2;
              if (node.init instanceof AST_BlockStatement) {
                block2 = node.init;
                node.init = block2.body.pop();
                block2.body.push(node);
              }
              if (node.init instanceof AST_SimpleStatement) {
                node.init = node.init.body;
              } else if (is_empty(node.init)) {
                node.init = null;
              }
              return !block2 ? node : in_list ? MAP.splice(block2.body) : block2;
            }
            if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) {
              descend(node, this);
              if (node.body instanceof AST_BlockStatement) {
                var block2 = node.body;
                node.body = block2.body.pop();
                block2.body.push(node);
                return in_list ? MAP.splice(block2.body) : block2;
              }
              return node;
            }
            if (node instanceof AST_BlockStatement) {
              descend(node, this);
              if (in_list && node.body.every(can_be_evicted_from_block)) {
                return MAP.splice(node.body);
              }
              return node;
            }
            if (node instanceof AST_Scope && !(node instanceof AST_ClassStaticBlock)) {
              const save_scope = scope;
              scope = node;
              descend(node, this);
              scope = save_scope;
              return node;
            }
          },
          function after(node, in_list) {
            if (node instanceof AST_Sequence) {
              switch (node.expressions.length) {
                case 0:
                  return in_list ? MAP.skip : make_node(AST_Number, node, { value: 0 });
                case 1:
                  return node.expressions[0];
              }
            }
          }
        );
        self3.transform(tt);
        function scan_ref_scoped(node, descend) {
          var node_def;
          const sym = assign_as_unused(node);
          if (sym instanceof AST_SymbolRef && !is_ref_of(node.left, AST_SymbolBlockDeclaration) && self3.variables.get(sym.name) === (node_def = sym.definition())) {
            if (node instanceof AST_Assign) {
              node.right.walk(tw);
              if (!node_def.chained && node.left.fixed_value() === node.right) {
                fixed_ids.set(node_def.id, node);
              }
            }
            return true;
          }
          if (node instanceof AST_SymbolRef) {
            node_def = node.definition();
            if (!in_use_ids.has(node_def.id)) {
              in_use_ids.set(node_def.id, node_def);
              if (node_def.orig[0] instanceof AST_SymbolCatch) {
                const redef = node_def.scope.is_block_scope() && node_def.scope.get_defun_scope().variables.get(node_def.name);
                if (redef) in_use_ids.set(redef.id, redef);
              }
            }
            return true;
          }
          if (node instanceof AST_Class) {
            descend();
            return true;
          }
          if (node instanceof AST_Scope && !(node instanceof AST_ClassStaticBlock)) {
            var save_scope = scope;
            scope = node;
            descend();
            scope = save_scope;
            return true;
          }
        }
      });
      function def_reduce_vars(node, func) {
        node.DEFMETHOD("reduce_vars", func);
      }
      def_reduce_vars(AST_Node, noop3);
      function reset_def(compressor, def) {
        def.assignments = 0;
        def.chained = false;
        def.direct_access = false;
        def.escaped = 0;
        def.recursive_refs = 0;
        def.references = [];
        def.single_use = void 0;
        if (def.scope.pinned() || def.orig[0] instanceof AST_SymbolFunarg && def.scope.uses_arguments) {
          def.fixed = false;
        } else if (def.orig[0] instanceof AST_SymbolConst || !compressor.exposed(def)) {
          def.fixed = def.init;
        } else {
          def.fixed = false;
        }
      }
      function reset_variables(tw, compressor, node) {
        node.variables.forEach(function(def) {
          reset_def(compressor, def);
          if (def.fixed === null) {
            tw.defs_to_safe_ids.set(def.id, tw.safe_ids);
            mark(tw, def, true);
          } else if (def.fixed) {
            tw.loop_ids.set(def.id, tw.in_loop);
            mark(tw, def, true);
          }
        });
      }
      function reset_block_variables(compressor, node) {
        if (node.block_scope) node.block_scope.variables.forEach((def) => {
          reset_def(compressor, def);
        });
      }
      function push2(tw) {
        tw.safe_ids = Object.create(tw.safe_ids);
      }
      function pop3(tw) {
        tw.safe_ids = Object.getPrototypeOf(tw.safe_ids);
      }
      function mark(tw, def, safe) {
        tw.safe_ids[def.id] = safe;
      }
      function safe_to_read(tw, def) {
        if (def.single_use == "m") return false;
        if (tw.safe_ids[def.id]) {
          if (def.fixed == null) {
            var orig = def.orig[0];
            if (orig instanceof AST_SymbolFunarg || orig.name == "arguments") return false;
            def.fixed = make_node(AST_Undefined, orig);
          }
          return true;
        }
        return def.fixed instanceof AST_Defun;
      }
      function safe_to_assign(tw, def, scope, value2) {
        if (def.fixed === void 0) return true;
        let def_safe_ids;
        if (def.fixed === null && (def_safe_ids = tw.defs_to_safe_ids.get(def.id))) {
          def_safe_ids[def.id] = false;
          tw.defs_to_safe_ids.delete(def.id);
          return true;
        }
        if (!HOP(tw.safe_ids, def.id)) return false;
        if (!safe_to_read(tw, def)) return false;
        if (def.fixed === false) return false;
        if (def.fixed != null && (!value2 || def.references.length > def.assignments)) return false;
        if (def.fixed instanceof AST_Defun) {
          return value2 instanceof AST_Node && def.fixed.parent_scope === scope;
        }
        return def.orig.every((sym) => {
          return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolDefun || sym instanceof AST_SymbolLambda);
        });
      }
      function ref_once(tw, compressor, def) {
        return compressor.option("unused") && !def.scope.pinned() && def.references.length - def.recursive_refs == 1 && tw.loop_ids.get(def.id) === tw.in_loop;
      }
      function is_immutable(value2) {
        if (!value2) return false;
        return value2.is_constant() || value2 instanceof AST_Lambda || value2 instanceof AST_This;
      }
      function mark_escaped(tw, d, scope, node, value2, level = 0, depth = 1) {
        var parent = tw.parent(level);
        if (value2) {
          if (value2.is_constant()) return;
          if (value2 instanceof AST_ClassExpression) return;
        }
        if (parent instanceof AST_Assign && (parent.operator === "=" || parent.logical) && node === parent.right || parent instanceof AST_Call && (node !== parent.expression || parent instanceof AST_New) || parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope || parent instanceof AST_VarDefLike && node === parent.value || parent instanceof AST_Yield && node === parent.value && node.scope !== d.scope) {
          if (depth > 1 && !(value2 && value2.is_constant_expression(scope))) depth = 1;
          if (!d.escaped || d.escaped > depth) d.escaped = depth;
          return;
        } else if (parent instanceof AST_Array || parent instanceof AST_Await || parent instanceof AST_Binary && lazy_op.has(parent.operator) || parent instanceof AST_Conditional && node !== parent.condition || parent instanceof AST_Expansion || parent instanceof AST_Sequence && node === parent.tail_node()) {
          mark_escaped(tw, d, scope, parent, parent, level + 1, depth);
        } else if (parent instanceof AST_ObjectKeyVal && node === parent.value) {
          var obj = tw.parent(level + 1);
          mark_escaped(tw, d, scope, obj, obj, level + 2, depth);
        } else if (parent instanceof AST_PropAccess && node === parent.expression) {
          value2 = read_property(value2, parent.property);
          mark_escaped(tw, d, scope, parent, value2, level + 1, depth + 1);
          if (value2) return;
        }
        if (level > 0) return;
        if (parent instanceof AST_Sequence && node !== parent.tail_node()) return;
        if (parent instanceof AST_SimpleStatement) return;
        d.direct_access = true;
      }
      const suppress = (node) => walk(node, (node2) => {
        if (!(node2 instanceof AST_Symbol)) return;
        var d = node2.definition();
        if (!d) return;
        if (node2 instanceof AST_SymbolRef) d.references.push(node2);
        d.fixed = false;
      });
      def_reduce_vars(AST_Accessor, function(tw, descend, compressor) {
        push2(tw);
        reset_variables(tw, compressor, this);
        descend();
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_Assign, function(tw, descend, compressor) {
        var node = this;
        if (node.left instanceof AST_Destructuring) {
          suppress(node.left);
          return;
        }
        const finish_walk = () => {
          if (node.logical) {
            node.left.walk(tw);
            push2(tw);
            node.right.walk(tw);
            pop3(tw);
            return true;
          }
        };
        var sym = node.left;
        if (!(sym instanceof AST_SymbolRef)) return finish_walk();
        var def = sym.definition();
        var safe = safe_to_assign(tw, def, sym.scope, node.right);
        def.assignments++;
        if (!safe) return finish_walk();
        var fixed = def.fixed;
        if (!fixed && node.operator != "=" && !node.logical) return finish_walk();
        var eq = node.operator == "=";
        var value2 = eq ? node.right : node;
        if (is_modified(compressor, tw, node, value2, 0)) return finish_walk();
        def.references.push(sym);
        if (!node.logical) {
          if (!eq) def.chained = true;
          def.fixed = eq ? function() {
            return node.right;
          } : function() {
            return make_node(AST_Binary, node, {
              operator: node.operator.slice(0, -1),
              left: fixed instanceof AST_Node ? fixed : fixed(),
              right: node.right
            });
          };
        }
        if (node.logical) {
          mark(tw, def, false);
          push2(tw);
          node.right.walk(tw);
          pop3(tw);
          return true;
        }
        mark(tw, def, false);
        node.right.walk(tw);
        mark(tw, def, true);
        mark_escaped(tw, def, sym.scope, node, value2, 0, 1);
        return true;
      });
      def_reduce_vars(AST_Binary, function(tw) {
        if (!lazy_op.has(this.operator)) return;
        this.left.walk(tw);
        push2(tw);
        this.right.walk(tw);
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_Block, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
      });
      def_reduce_vars(AST_Case, function(tw) {
        push2(tw);
        this.expression.walk(tw);
        pop3(tw);
        push2(tw);
        walk_body(this, tw);
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_Class, function(tw, descend) {
        clear_flag(this, INLINED);
        push2(tw);
        descend();
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_ClassStaticBlock, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
      });
      def_reduce_vars(AST_Conditional, function(tw) {
        this.condition.walk(tw);
        push2(tw);
        this.consequent.walk(tw);
        pop3(tw);
        push2(tw);
        this.alternative.walk(tw);
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_Chain, function(tw, descend) {
        const safe_ids = tw.safe_ids;
        descend();
        tw.safe_ids = safe_ids;
        return true;
      });
      def_reduce_vars(AST_Call, function(tw) {
        this.expression.walk(tw);
        if (this.optional) {
          push2(tw);
        }
        for (const arg of this.args) arg.walk(tw);
        return true;
      });
      def_reduce_vars(AST_PropAccess, function(tw) {
        if (!this.optional) return;
        this.expression.walk(tw);
        push2(tw);
        if (this.property instanceof AST_Node) this.property.walk(tw);
        return true;
      });
      def_reduce_vars(AST_Default, function(tw, descend) {
        push2(tw);
        descend();
        pop3(tw);
        return true;
      });
      function mark_lambda(tw, descend, compressor) {
        clear_flag(this, INLINED);
        push2(tw);
        reset_variables(tw, compressor, this);
        var iife;
        if (!this.name && !this.uses_arguments && !this.pinned() && (iife = tw.parent()) instanceof AST_Call && iife.expression === this && !iife.args.some((arg) => arg instanceof AST_Expansion) && this.argnames.every((arg_name) => arg_name instanceof AST_Symbol)) {
          this.argnames.forEach((arg, i) => {
            if (!arg.definition) return;
            var d = arg.definition();
            if (d.orig.length > 1) return;
            if (d.fixed === void 0 && (!this.uses_arguments || tw.has_directive("use strict"))) {
              d.fixed = function() {
                return iife.args[i] || make_node(AST_Undefined, iife);
              };
              tw.loop_ids.set(d.id, tw.in_loop);
              mark(tw, d, true);
            } else {
              d.fixed = false;
            }
          });
        }
        descend();
        pop3(tw);
        handle_defined_after_hoist(this);
        return true;
      }
      function handle_defined_after_hoist(parent) {
        const defuns = [];
        walk(parent, (node) => {
          if (node === parent) return;
          if (node instanceof AST_Defun) {
            defuns.push(node);
            return true;
          }
          if (node instanceof AST_Scope || node instanceof AST_SimpleStatement) return true;
        });
        const defun_dependencies_map = /* @__PURE__ */ new Map();
        const dependencies_map = /* @__PURE__ */ new Map();
        const symbols_of_interest = /* @__PURE__ */ new Set();
        const defuns_of_interest = /* @__PURE__ */ new Set();
        for (const defun of defuns) {
          const fname_def = defun.name.definition();
          const enclosing_defs = [];
          for (const def of defun.enclosed) {
            if (def.fixed === false || def === fname_def || def.scope.get_defun_scope() !== parent) {
              continue;
            }
            symbols_of_interest.add(def.id);
            if (def.assignments === 0 && def.orig.length === 1 && def.orig[0] instanceof AST_SymbolDefun) {
              defuns_of_interest.add(def.id);
              symbols_of_interest.add(def.id);
              defuns_of_interest.add(fname_def.id);
              symbols_of_interest.add(fname_def.id);
              if (!defun_dependencies_map.has(fname_def.id)) {
                defun_dependencies_map.set(fname_def.id, []);
              }
              defun_dependencies_map.get(fname_def.id).push(def.id);
              continue;
            }
            enclosing_defs.push(def);
          }
          if (enclosing_defs.length) {
            dependencies_map.set(fname_def.id, enclosing_defs);
            defuns_of_interest.add(fname_def.id);
            symbols_of_interest.add(fname_def.id);
          }
        }
        if (!dependencies_map.size) {
          return;
        }
        let symbol_index = 1;
        const defun_first_read_map = /* @__PURE__ */ new Map();
        const symbol_last_write_map = /* @__PURE__ */ new Map();
        walk_parent(parent, (node, walk_info) => {
          if (node instanceof AST_Symbol && node.thedef) {
            const id = node.definition().id;
            symbol_index++;
            if (symbols_of_interest.has(id)) {
              if (node instanceof AST_SymbolDeclaration || is_lhs(node, walk_info.parent())) {
                symbol_last_write_map.set(id, symbol_index);
              }
            }
            if (defuns_of_interest.has(id)) {
              if (!defun_first_read_map.has(id) && !is_recursive_ref(walk_info, id)) {
                defun_first_read_map.set(id, symbol_index);
              }
            }
          }
        });
        for (const [defun, defun_first_read] of defun_first_read_map) {
          const queue2 = new Set(defun_dependencies_map.get(defun));
          for (const enclosed_defun of queue2) {
            let enclosed_defun_first_read = defun_first_read_map.get(enclosed_defun);
            if (enclosed_defun_first_read != null && enclosed_defun_first_read < defun_first_read) {
              continue;
            }
            defun_first_read_map.set(enclosed_defun, defun_first_read);
            for (const enclosed_enclosed_defun of defun_dependencies_map.get(enclosed_defun) || []) {
              queue2.add(enclosed_enclosed_defun);
            }
          }
        }
        for (const [defun, defs] of dependencies_map) {
          const defun_first_read = defun_first_read_map.get(defun);
          if (defun_first_read === void 0) {
            continue;
          }
          for (const def of defs) {
            if (def.fixed === false) {
              continue;
            }
            let def_last_write = symbol_last_write_map.get(def.id) || 0;
            if (defun_first_read < def_last_write) {
              def.fixed = false;
            }
          }
        }
      }
      def_reduce_vars(AST_Lambda, mark_lambda);
      def_reduce_vars(AST_Do, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
        const saved_loop = tw.in_loop;
        tw.in_loop = this;
        push2(tw);
        this.body.walk(tw);
        if (has_break_or_continue(this)) {
          pop3(tw);
          push2(tw);
        }
        this.condition.walk(tw);
        pop3(tw);
        tw.in_loop = saved_loop;
        return true;
      });
      def_reduce_vars(AST_For, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
        if (this.init) this.init.walk(tw);
        const saved_loop = tw.in_loop;
        tw.in_loop = this;
        push2(tw);
        if (this.condition) this.condition.walk(tw);
        this.body.walk(tw);
        if (this.step) {
          if (has_break_or_continue(this)) {
            pop3(tw);
            push2(tw);
          }
          this.step.walk(tw);
        }
        pop3(tw);
        tw.in_loop = saved_loop;
        return true;
      });
      def_reduce_vars(AST_ForIn, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
        suppress(this.init);
        this.object.walk(tw);
        const saved_loop = tw.in_loop;
        tw.in_loop = this;
        push2(tw);
        this.body.walk(tw);
        pop3(tw);
        tw.in_loop = saved_loop;
        return true;
      });
      def_reduce_vars(AST_If, function(tw) {
        this.condition.walk(tw);
        push2(tw);
        this.body.walk(tw);
        pop3(tw);
        if (this.alternative) {
          push2(tw);
          this.alternative.walk(tw);
          pop3(tw);
        }
        return true;
      });
      def_reduce_vars(AST_LabeledStatement, function(tw) {
        push2(tw);
        this.body.walk(tw);
        pop3(tw);
        return true;
      });
      def_reduce_vars(AST_SymbolCatch, function() {
        this.definition().fixed = false;
      });
      def_reduce_vars(AST_SymbolRef, function(tw, descend, compressor) {
        var d = this.definition();
        d.references.push(this);
        if (d.references.length == 1 && !d.fixed && d.orig[0] instanceof AST_SymbolDefun) {
          tw.loop_ids.set(d.id, tw.in_loop);
        }
        var fixed_value;
        if (d.fixed === void 0 || !safe_to_read(tw, d)) {
          d.fixed = false;
        } else if (d.fixed) {
          fixed_value = this.fixed_value();
          if (fixed_value instanceof AST_Lambda && is_recursive_ref(tw, d)) {
            d.recursive_refs++;
          } else if (fixed_value && !compressor.exposed(d) && ref_once(tw, compressor, d)) {
            d.single_use = fixed_value instanceof AST_Lambda && !fixed_value.pinned() || fixed_value instanceof AST_Class || d.scope === this.scope && fixed_value.is_constant_expression();
          } else {
            d.single_use = false;
          }
          if (is_modified(compressor, tw, this, fixed_value, 0, is_immutable(fixed_value))) {
            if (d.single_use) {
              d.single_use = "m";
            } else {
              d.fixed = false;
            }
          }
        }
        mark_escaped(tw, d, this.scope, this, fixed_value, 0, 1);
      });
      def_reduce_vars(AST_Toplevel, function(tw, descend, compressor) {
        this.globals.forEach(function(def) {
          reset_def(compressor, def);
        });
        reset_variables(tw, compressor, this);
        descend();
        handle_defined_after_hoist(this);
        return true;
      });
      def_reduce_vars(AST_Try, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
        push2(tw);
        this.body.walk(tw);
        pop3(tw);
        if (this.bcatch) {
          push2(tw);
          this.bcatch.walk(tw);
          pop3(tw);
        }
        if (this.bfinally) this.bfinally.walk(tw);
        return true;
      });
      def_reduce_vars(AST_Unary, function(tw) {
        var node = this;
        if (node.operator !== "++" && node.operator !== "--") return;
        var exp = node.expression;
        if (!(exp instanceof AST_SymbolRef)) return;
        var def = exp.definition();
        var safe = safe_to_assign(tw, def, exp.scope, true);
        def.assignments++;
        if (!safe) return;
        var fixed = def.fixed;
        if (!fixed) return;
        def.references.push(exp);
        def.chained = true;
        def.fixed = function() {
          return make_node(AST_Binary, node, {
            operator: node.operator.slice(0, -1),
            left: make_node(AST_UnaryPrefix, node, {
              operator: "+",
              expression: fixed instanceof AST_Node ? fixed : fixed()
            }),
            right: make_node(AST_Number, node, {
              value: 1
            })
          });
        };
        mark(tw, def, true);
        return true;
      });
      def_reduce_vars(AST_VarDef, function(tw, descend) {
        var node = this;
        if (node.name instanceof AST_Destructuring) {
          suppress(node.name);
          return;
        }
        var d = node.name.definition();
        if (node.value) {
          if (safe_to_assign(tw, d, node.name.scope, node.value)) {
            d.fixed = function() {
              return node.value;
            };
            tw.loop_ids.set(d.id, tw.in_loop);
            mark(tw, d, false);
            descend();
            mark(tw, d, true);
            return true;
          } else {
            d.fixed = false;
          }
        }
      });
      def_reduce_vars(AST_UsingDef, function() {
        suppress(this.name);
      });
      def_reduce_vars(AST_While, function(tw, descend, compressor) {
        reset_block_variables(compressor, this);
        const saved_loop = tw.in_loop;
        tw.in_loop = this;
        push2(tw);
        descend();
        pop3(tw);
        tw.in_loop = saved_loop;
        return true;
      });
      function loop_body(x) {
        if (x instanceof AST_IterationStatement) {
          return x.body instanceof AST_BlockStatement ? x.body : x;
        }
        return x;
      }
      function is_lhs_read_only(lhs) {
        if (lhs instanceof AST_This) return true;
        if (lhs instanceof AST_SymbolRef) return lhs.definition().orig[0] instanceof AST_SymbolLambda;
        if (lhs instanceof AST_PropAccess) {
          lhs = lhs.expression;
          if (lhs instanceof AST_SymbolRef) {
            if (lhs.is_immutable()) return false;
            lhs = lhs.fixed_value();
          }
          if (!lhs) return true;
          if (lhs instanceof AST_RegExp) return false;
          if (lhs instanceof AST_Constant) return true;
          return is_lhs_read_only(lhs);
        }
        return false;
      }
      function remove_initializers(var_statement) {
        var decls = [];
        var_statement.definitions.forEach(function(def) {
          if (def.name instanceof AST_SymbolDeclaration) {
            def.value = null;
            decls.push(def);
          } else {
            def.declarations_as_names().forEach((name) => {
              decls.push(make_node(AST_VarDef, def, {
                name,
                value: null
              }));
            });
          }
        });
        return decls.length ? make_node(AST_Var, var_statement, { definitions: decls }) : null;
      }
      function extract_from_unreachable_code(compressor, stat, target) {
        walk(stat, (node) => {
          if (node instanceof AST_Var) {
            const no_initializers = remove_initializers(node);
            if (no_initializers) target.push(no_initializers);
            return true;
          }
          if (node instanceof AST_Defun && (node === stat || !compressor.has_directive("use strict"))) {
            target.push(node === stat ? node : make_node(AST_Var, node, {
              definitions: [
                make_node(AST_VarDef, node, {
                  name: make_node(AST_SymbolVar, node.name, node.name),
                  value: null
                })
              ]
            }));
            return true;
          }
          if (node instanceof AST_Export || node instanceof AST_Import) {
            target.push(node);
            return true;
          }
          if (node instanceof AST_Scope || node instanceof AST_Class) {
            return true;
          }
        });
      }
      function tighten_body(statements, compressor) {
        const nearest_scope = compressor.find_scope();
        const defun_scope = nearest_scope.get_defun_scope();
        const { in_loop, in_try } = find_loop_scope_try();
        var CHANGED, max_iter = 10;
        do {
          CHANGED = false;
          eliminate_spurious_blocks(statements);
          if (compressor.option("dead_code")) {
            eliminate_dead_code(statements, compressor);
          }
          if (compressor.option("if_return")) {
            handle_if_return(statements, compressor);
          }
          if (compressor.sequences_limit > 0) {
            sequencesize(statements, compressor);
            sequencesize_2(statements, compressor);
          }
          if (compressor.option("join_vars")) {
            join_consecutive_vars(statements);
          }
          if (compressor.option("collapse_vars")) {
            collapse(statements, compressor);
          }
        } while (CHANGED && max_iter-- > 0);
        function find_loop_scope_try() {
          var node = compressor.self(), level = 0, in_loop2 = false, in_try2 = false;
          do {
            if (node instanceof AST_IterationStatement) {
              in_loop2 = true;
            } else if (node instanceof AST_Scope) {
              break;
            } else if (node instanceof AST_TryBlock) {
              in_try2 = true;
            }
          } while (node = compressor.parent(level++));
          return { in_loop: in_loop2, in_try: in_try2 };
        }
        function collapse(statements2, compressor2) {
          if (nearest_scope.pinned() || defun_scope.pinned())
            return statements2;
          var args;
          var candidates = [];
          var stat_index = statements2.length;
          var scanner = new TreeTransformer(function(node) {
            if (abort)
              return node;
            if (!hit) {
              if (node !== hit_stack[hit_index])
                return node;
              hit_index++;
              if (hit_index < hit_stack.length)
                return handle_custom_scan_order(node);
              hit = true;
              stop_after = find_stop(node, 0);
              if (stop_after === node)
                abort = true;
              return node;
            }
            var parent = scanner.parent();
            if (node instanceof AST_Assign && (node.logical || node.operator != "=" && lhs.equivalent_to(node.left)) || node instanceof AST_Await || node instanceof AST_Using || node instanceof AST_Call && lhs instanceof AST_PropAccess && lhs.equivalent_to(node.expression) || (node instanceof AST_Call || node instanceof AST_PropAccess) && node.optional || node instanceof AST_Debugger || node instanceof AST_Destructuring || node instanceof AST_Expansion && node.expression instanceof AST_Symbol && (node.expression instanceof AST_This || node.expression.definition().references.length > 1) || node instanceof AST_IterationStatement && !(node instanceof AST_For) || node instanceof AST_LoopControl || node instanceof AST_Try || node instanceof AST_With || node instanceof AST_Yield || node instanceof AST_Export || node instanceof AST_Class || parent instanceof AST_For && node !== parent.init || !replace_all && (node instanceof AST_SymbolRef && !node.is_declared(compressor2) && !pure_prop_access_globals.has(node)) || node instanceof AST_SymbolRef && parent instanceof AST_Call && has_annotation(parent, _NOINLINE) || node instanceof AST_ObjectProperty && node.key instanceof AST_Node) {
              abort = true;
              return node;
            }
            if (!stop_if_hit && (!lhs_local || !replace_all) && (parent instanceof AST_Binary && lazy_op.has(parent.operator) && parent.left !== node || parent instanceof AST_Conditional && parent.condition !== node || parent instanceof AST_If && parent.condition !== node)) {
              stop_if_hit = parent;
            }
            if (can_replace && !(node instanceof AST_SymbolDeclaration) && lhs.equivalent_to(node) && !shadows(scanner.find_scope() || nearest_scope, lvalues)) {
              if (stop_if_hit) {
                abort = true;
                return node;
              }
              if (is_lhs(node, parent)) {
                if (value_def)
                  replaced++;
                return node;
              } else {
                replaced++;
                if (value_def && candidate instanceof AST_VarDef)
                  return node;
              }
              CHANGED = abort = true;
              if (candidate instanceof AST_UnaryPostfix) {
                return make_node(AST_UnaryPrefix, candidate, candidate);
              }
              if (candidate instanceof AST_VarDef) {
                var def2 = candidate.name.definition();
                var value2 = candidate.value;
                if (def2.references.length - def2.replaced == 1 && !compressor2.exposed(def2)) {
                  def2.replaced++;
                  if (funarg && is_identifier_atom(value2)) {
                    return value2.transform(compressor2);
                  } else {
                    return maintain_this_binding(parent, node, value2);
                  }
                }
                return make_node(AST_Assign, candidate, {
                  operator: "=",
                  logical: false,
                  left: make_node(AST_SymbolRef, candidate.name, candidate.name),
                  right: value2
                });
              }
              clear_flag(candidate, WRITE_ONLY);
              return candidate;
            }
            var sym;
            if (node instanceof AST_Call || node instanceof AST_Exit && (side_effects || lhs instanceof AST_PropAccess || may_modify(lhs)) || node instanceof AST_PropAccess && (side_effects || node.expression.may_throw_on_access(compressor2)) || node instanceof AST_SymbolRef && (lvalues.has(node.name) && lvalues.get(node.name).modified || side_effects && may_modify(node)) || node instanceof AST_VarDef && node.value && (lvalues.has(node.name.name) || side_effects && may_modify(node.name)) || node instanceof AST_Using || (sym = is_lhs(node.left, node)) && (sym instanceof AST_PropAccess || lvalues.has(sym.name)) || may_throw && (in_try ? node.has_side_effects(compressor2) : side_effects_external(node))) {
              stop_after = node;
              if (node instanceof AST_Scope)
                abort = true;
            }
            return handle_custom_scan_order(node);
          }, function(node) {
            if (abort)
              return;
            if (stop_after === node)
              abort = true;
            if (stop_if_hit === node)
              stop_if_hit = null;
          });
          var multi_replacer = new TreeTransformer(function(node) {
            if (abort)
              return node;
            if (!hit) {
              if (node !== hit_stack[hit_index])
                return node;
              hit_index++;
              if (hit_index < hit_stack.length)
                return;
              hit = true;
              return node;
            }
            if (node instanceof AST_SymbolRef && node.name == def.name) {
              if (!--replaced)
                abort = true;
              if (is_lhs(node, multi_replacer.parent()))
                return node;
              def.replaced++;
              value_def.replaced--;
              return candidate.value;
            }
            if (node instanceof AST_Default || node instanceof AST_Scope)
              return node;
          });
          while (--stat_index >= 0) {
            if (stat_index == 0 && compressor2.option("unused"))
              extract_args();
            var hit_stack = [];
            extract_candidates(statements2[stat_index]);
            while (candidates.length > 0) {
              hit_stack = candidates.pop();
              var hit_index = 0;
              var candidate = hit_stack[hit_stack.length - 1];
              var value_def = null;
              var stop_after = null;
              var stop_if_hit = null;
              var lhs = get_lhs(candidate);
              if (!lhs || is_lhs_read_only(lhs) || lhs.has_side_effects(compressor2))
                continue;
              var lvalues = get_lvalues(candidate);
              var lhs_local = is_lhs_local(lhs);
              if (lhs instanceof AST_SymbolRef) {
                lvalues.set(lhs.name, { def: lhs.definition(), modified: false });
              }
              var side_effects = value_has_side_effects(candidate);
              var replace_all = replace_all_symbols();
              var may_throw = candidate.may_throw(compressor2);
              var funarg = candidate.name instanceof AST_SymbolFunarg;
              var hit = funarg;
              var abort = false, replaced = 0, can_replace = !args || !hit;
              if (!can_replace) {
                for (let j = compressor2.self().argnames.lastIndexOf(candidate.name) + 1; !abort && j < args.length; j++) {
                  args[j].transform(scanner);
                }
                can_replace = true;
              }
              for (var i = stat_index; !abort && i < statements2.length; i++) {
                statements2[i].transform(scanner);
              }
              if (value_def) {
                var def = candidate.name.definition();
                if (abort && def.references.length - def.replaced > replaced)
                  replaced = false;
                else {
                  abort = false;
                  hit_index = 0;
                  hit = funarg;
                  for (var i = stat_index; !abort && i < statements2.length; i++) {
                    statements2[i].transform(multi_replacer);
                  }
                  value_def.single_use = false;
                }
              }
              if (replaced && !remove_candidate(candidate))
                statements2.splice(stat_index, 1);
            }
          }
          function handle_custom_scan_order(node) {
            if (node instanceof AST_Scope)
              return node;
            if (node instanceof AST_Switch) {
              node.expression = node.expression.transform(scanner);
              for (var i2 = 0, len = node.body.length; !abort && i2 < len; i2++) {
                var branch2 = node.body[i2];
                if (branch2 instanceof AST_Case) {
                  if (!hit) {
                    if (branch2 !== hit_stack[hit_index])
                      continue;
                    hit_index++;
                  }
                  branch2.expression = branch2.expression.transform(scanner);
                  if (!replace_all)
                    break;
                }
              }
              abort = true;
              return node;
            }
          }
          function redefined_within_scope(def2, scope) {
            if (def2.global)
              return false;
            let cur_scope = def2.scope;
            while (cur_scope && cur_scope !== scope) {
              if (cur_scope.variables.has(def2.name)) {
                return true;
              }
              cur_scope = cur_scope.parent_scope;
            }
            return false;
          }
          function has_overlapping_symbol(fn, arg, fn_strict) {
            var found = false, scan_this = !(fn instanceof AST_Arrow);
            arg.walk(new TreeWalker(function(node, descend) {
              if (found)
                return true;
              if (node instanceof AST_SymbolRef && (fn.variables.has(node.name) || redefined_within_scope(node.definition(), fn))) {
                var s = node.definition().scope;
                if (s !== defun_scope)
                  while (s = s.parent_scope) {
                    if (s === defun_scope)
                      return true;
                  }
                return found = true;
              }
              if ((fn_strict || scan_this) && node instanceof AST_This) {
                return found = true;
              }
              if (node instanceof AST_Scope && !(node instanceof AST_Arrow)) {
                var prev = scan_this;
                scan_this = false;
                descend();
                scan_this = prev;
                return true;
              }
            }));
            return found;
          }
          function arg_is_injectable(arg) {
            if (arg instanceof AST_Expansion) return false;
            const contains_await = walk(arg, (node) => {
              if (node instanceof AST_Await) return walk_abort;
            });
            if (contains_await) return false;
            return true;
          }
          function extract_args() {
            var iife, fn = compressor2.self();
            if (is_func_expr(fn) && !fn.name && !fn.uses_arguments && !fn.pinned() && (iife = compressor2.parent()) instanceof AST_Call && iife.expression === fn && iife.args.every(arg_is_injectable)) {
              var fn_strict = compressor2.has_directive("use strict");
              if (fn_strict && !member(fn_strict, fn.body))
                fn_strict = false;
              var len = fn.argnames.length;
              args = iife.args.slice(len);
              var names = /* @__PURE__ */ new Set();
              for (var i2 = len; --i2 >= 0; ) {
                var sym = fn.argnames[i2];
                var arg = iife.args[i2];
                const def2 = sym.definition && sym.definition();
                const is_reassigned = def2 && def2.orig.length > 1;
                if (is_reassigned)
                  continue;
                args.unshift(make_node(AST_VarDef, sym, {
                  name: sym,
                  value: arg
                }));
                if (names.has(sym.name))
                  continue;
                names.add(sym.name);
                if (sym instanceof AST_Expansion) {
                  var elements = iife.args.slice(i2);
                  if (elements.every(
                    (arg2) => !has_overlapping_symbol(fn, arg2, fn_strict)
                  )) {
                    candidates.unshift([make_node(AST_VarDef, sym, {
                      name: sym.expression,
                      value: make_node(AST_Array, iife, {
                        elements
                      })
                    })]);
                  }
                } else {
                  if (!arg) {
                    arg = make_node(AST_Undefined, sym).transform(compressor2);
                  } else if (arg instanceof AST_Lambda && arg.pinned() || has_overlapping_symbol(fn, arg, fn_strict)) {
                    arg = null;
                  }
                  if (arg)
                    candidates.unshift([make_node(AST_VarDef, sym, {
                      name: sym,
                      value: arg
                    })]);
                }
              }
            }
          }
          function extract_candidates(expr) {
            hit_stack.push(expr);
            if (expr instanceof AST_Assign) {
              if (!expr.left.has_side_effects(compressor2) && !(expr.right instanceof AST_Chain)) {
                candidates.push(hit_stack.slice());
              }
              extract_candidates(expr.right);
            } else if (expr instanceof AST_Binary) {
              extract_candidates(expr.left);
              extract_candidates(expr.right);
            } else if (expr instanceof AST_Call && !has_annotation(expr, _NOINLINE)) {
              extract_candidates(expr.expression);
              expr.args.forEach(extract_candidates);
            } else if (expr instanceof AST_Case) {
              extract_candidates(expr.expression);
            } else if (expr instanceof AST_Conditional) {
              extract_candidates(expr.condition);
              extract_candidates(expr.consequent);
              extract_candidates(expr.alternative);
            } else if (expr instanceof AST_Definitions) {
              var len = expr.definitions.length;
              var i2 = len - 200;
              if (i2 < 0)
                i2 = 0;
              for (; i2 < len; i2++) {
                extract_candidates(expr.definitions[i2]);
              }
            } else if (expr instanceof AST_DWLoop) {
              extract_candidates(expr.condition);
              if (!(expr.body instanceof AST_Block)) {
                extract_candidates(expr.body);
              }
            } else if (expr instanceof AST_Exit) {
              if (expr.value)
                extract_candidates(expr.value);
            } else if (expr instanceof AST_For) {
              if (expr.init)
                extract_candidates(expr.init);
              if (expr.condition)
                extract_candidates(expr.condition);
              if (expr.step)
                extract_candidates(expr.step);
              if (!(expr.body instanceof AST_Block)) {
                extract_candidates(expr.body);
              }
            } else if (expr instanceof AST_ForIn) {
              extract_candidates(expr.object);
              if (!(expr.body instanceof AST_Block)) {
                extract_candidates(expr.body);
              }
            } else if (expr instanceof AST_If) {
              extract_candidates(expr.condition);
              if (!(expr.body instanceof AST_Block)) {
                extract_candidates(expr.body);
              }
              if (expr.alternative && !(expr.alternative instanceof AST_Block)) {
                extract_candidates(expr.alternative);
              }
            } else if (expr instanceof AST_Sequence) {
              expr.expressions.forEach(extract_candidates);
            } else if (expr instanceof AST_SimpleStatement) {
              extract_candidates(expr.body);
            } else if (expr instanceof AST_Switch) {
              extract_candidates(expr.expression);
              expr.body.forEach(extract_candidates);
            } else if (expr instanceof AST_Unary) {
              if (expr.operator == "++" || expr.operator == "--") {
                candidates.push(hit_stack.slice());
              }
            } else if (expr instanceof AST_VarDef) {
              if (expr.value && !(expr.value instanceof AST_Chain)) {
                candidates.push(hit_stack.slice());
                extract_candidates(expr.value);
              }
            }
            hit_stack.pop();
          }
          function find_stop(node, level, write_only) {
            var parent = scanner.parent(level);
            if (parent instanceof AST_Assign) {
              if (write_only && !parent.logical && !(parent.left instanceof AST_PropAccess || lvalues.has(parent.left.name))) {
                return find_stop(parent, level + 1, write_only);
              }
              return node;
            }
            if (parent instanceof AST_Binary) {
              if (write_only && (!lazy_op.has(parent.operator) || parent.left === node)) {
                return find_stop(parent, level + 1, write_only);
              }
              return node;
            }
            if (parent instanceof AST_Call)
              return node;
            if (parent instanceof AST_Case)
              return node;
            if (parent instanceof AST_Conditional) {
              if (write_only && parent.condition === node) {
                return find_stop(parent, level + 1, write_only);
              }
              return node;
            }
            if (parent instanceof AST_Definitions) {
              return find_stop(parent, level + 1, true);
            }
            if (parent instanceof AST_Exit) {
              return write_only ? find_stop(parent, level + 1, write_only) : node;
            }
            if (parent instanceof AST_If) {
              if (write_only && parent.condition === node) {
                return find_stop(parent, level + 1, write_only);
              }
              return node;
            }
            if (parent instanceof AST_IterationStatement)
              return node;
            if (parent instanceof AST_Sequence) {
              return find_stop(parent, level + 1, parent.tail_node() !== node);
            }
            if (parent instanceof AST_SimpleStatement) {
              return find_stop(parent, level + 1, true);
            }
            if (parent instanceof AST_Switch)
              return node;
            if (parent instanceof AST_VarDef)
              return node;
            return null;
          }
          function mangleable_var(var_def) {
            var value2 = var_def.value;
            if (!(value2 instanceof AST_SymbolRef))
              return;
            if (value2.name == "arguments")
              return;
            var def2 = value2.definition();
            if (def2.undeclared)
              return;
            return value_def = def2;
          }
          function get_lhs(expr) {
            if (expr instanceof AST_Assign && expr.logical) {
              return false;
            } else if (expr instanceof AST_VarDef && expr.name instanceof AST_SymbolDeclaration) {
              var def2 = expr.name.definition();
              if (!member(expr.name, def2.orig))
                return;
              var referenced = def2.references.length - def2.replaced;
              if (!referenced)
                return;
              var declared = def2.orig.length - def2.eliminated;
              if (declared > 1 && !(expr.name instanceof AST_SymbolFunarg) || (referenced > 1 ? mangleable_var(expr) : !compressor2.exposed(def2))) {
                return make_node(AST_SymbolRef, expr.name, expr.name);
              }
            } else {
              const lhs2 = expr instanceof AST_Assign ? expr.left : expr.expression;
              return !is_ref_of(lhs2, AST_SymbolConst) && !is_ref_of(lhs2, AST_SymbolLet) && !is_ref_of(lhs2, AST_SymbolUsing) && lhs2;
            }
          }
          function get_rvalue(expr) {
            if (expr instanceof AST_Assign) {
              return expr.right;
            } else {
              return expr.value;
            }
          }
          function get_lvalues(expr) {
            var lvalues2 = /* @__PURE__ */ new Map();
            if (expr instanceof AST_Unary)
              return lvalues2;
            var tw = new TreeWalker(function(node) {
              var sym = node;
              while (sym instanceof AST_PropAccess)
                sym = sym.expression;
              if (sym instanceof AST_SymbolRef) {
                const prev = lvalues2.get(sym.name);
                if (!prev || !prev.modified) {
                  lvalues2.set(sym.name, {
                    def: sym.definition(),
                    modified: is_modified(compressor2, tw, node, node, 0)
                  });
                }
              }
            });
            get_rvalue(expr).walk(tw);
            return lvalues2;
          }
          function remove_candidate(expr) {
            if (expr.name instanceof AST_SymbolFunarg) {
              var iife = compressor2.parent(), argnames = compressor2.self().argnames;
              var index6 = argnames.indexOf(expr.name);
              if (index6 < 0) {
                iife.args.length = Math.min(iife.args.length, argnames.length - 1);
              } else {
                var args2 = iife.args;
                if (args2[index6])
                  args2[index6] = make_node(AST_Number, args2[index6], {
                    value: 0
                  });
              }
              return true;
            }
            var found = false;
            return statements2[stat_index].transform(new TreeTransformer(function(node, descend, in_list) {
              if (found)
                return node;
              if (node === expr || node.body === expr) {
                found = true;
                if (node instanceof AST_VarDef) {
                  node.value = node.name instanceof AST_SymbolConst ? make_node(AST_Undefined, node.value) : null;
                  return node;
                }
                return in_list ? MAP.skip : null;
              }
            }, function(node) {
              if (node instanceof AST_Sequence)
                switch (node.expressions.length) {
                  case 0:
                    return null;
                  case 1:
                    return node.expressions[0];
                }
            }));
          }
          function is_lhs_local(lhs2) {
            while (lhs2 instanceof AST_PropAccess)
              lhs2 = lhs2.expression;
            return lhs2 instanceof AST_SymbolRef && lhs2.definition().scope.get_defun_scope() === defun_scope && !(in_loop && (lvalues.has(lhs2.name) || candidate instanceof AST_Unary || candidate instanceof AST_Assign && !candidate.logical && candidate.operator != "="));
          }
          function value_has_side_effects(expr) {
            if (expr instanceof AST_Unary)
              return unary_side_effects.has(expr.operator);
            return get_rvalue(expr).has_side_effects(compressor2);
          }
          function replace_all_symbols() {
            if (side_effects)
              return false;
            if (value_def)
              return true;
            if (lhs instanceof AST_SymbolRef) {
              var def2 = lhs.definition();
              if (def2.references.length - def2.replaced == (candidate instanceof AST_VarDef ? 1 : 2)) {
                return true;
              }
            }
            return false;
          }
          function may_modify(sym) {
            if (!sym.definition)
              return true;
            var def2 = sym.definition();
            if (def2.orig.length == 1 && def2.orig[0] instanceof AST_SymbolDefun)
              return false;
            if (def2.scope.get_defun_scope() !== defun_scope)
              return true;
            return def2.references.some(
              (ref) => ref.scope.get_defun_scope() !== defun_scope
            );
          }
          function side_effects_external(node, lhs2) {
            if (node instanceof AST_Assign)
              return side_effects_external(node.left, true);
            if (node instanceof AST_Unary)
              return side_effects_external(node.expression, true);
            if (node instanceof AST_VarDef)
              return node.value && side_effects_external(node.value);
            if (lhs2) {
              if (node instanceof AST_Dot)
                return side_effects_external(node.expression, true);
              if (node instanceof AST_Sub)
                return side_effects_external(node.expression, true);
              if (node instanceof AST_SymbolRef)
                return node.definition().scope.get_defun_scope() !== defun_scope;
            }
            return false;
          }
          function shadows(my_scope, lvalues2) {
            for (const { def: def2 } of lvalues2.values()) {
              const looked_up = my_scope.find_variable(def2.name);
              if (looked_up) {
                if (looked_up === def2) continue;
                return true;
              }
            }
            return false;
          }
        }
        function eliminate_spurious_blocks(statements2) {
          var seen_dirs = [];
          for (var i = 0; i < statements2.length; ) {
            var stat = statements2[i];
            if (stat instanceof AST_BlockStatement && stat.body.every(can_be_evicted_from_block)) {
              CHANGED = true;
              eliminate_spurious_blocks(stat.body);
              statements2.splice(i, 1, ...stat.body);
              i += stat.body.length;
            } else if (stat instanceof AST_EmptyStatement) {
              CHANGED = true;
              statements2.splice(i, 1);
            } else if (stat instanceof AST_Directive) {
              if (seen_dirs.indexOf(stat.value) < 0) {
                i++;
                seen_dirs.push(stat.value);
              } else {
                CHANGED = true;
                statements2.splice(i, 1);
              }
            } else
              i++;
          }
        }
        function handle_if_return(statements2, compressor2) {
          var self3 = compressor2.self();
          var multiple_if_returns = has_multiple_if_returns(statements2);
          var in_lambda = self3 instanceof AST_Lambda;
          const iteration_start = Math.min(statements2.length, 500);
          for (var i = iteration_start; --i >= 0; ) {
            var stat = statements2[i];
            var j = next_index(i);
            var next2 = statements2[j];
            if (in_lambda && !next2 && stat instanceof AST_Return) {
              if (!stat.value) {
                CHANGED = true;
                statements2.splice(i, 1);
                continue;
              }
              if (stat.value instanceof AST_UnaryPrefix && stat.value.operator == "void") {
                CHANGED = true;
                statements2[i] = make_node(AST_SimpleStatement, stat, {
                  body: stat.value.expression
                });
                continue;
              }
            }
            if (stat instanceof AST_If) {
              let ab, new_else;
              ab = aborts(stat.body);
              if (can_merge_flow(ab) && (new_else = as_statement_array_with_return(stat.body, ab))) {
                if (ab.label) {
                  remove(ab.label.thedef.references, ab);
                }
                CHANGED = true;
                stat = stat.clone();
                stat.condition = stat.condition.negate(compressor2);
                stat.body = make_node(AST_BlockStatement, stat, {
                  body: as_statement_array(stat.alternative).concat(extract_defuns())
                });
                stat.alternative = make_node(AST_BlockStatement, stat, {
                  body: new_else
                });
                statements2[i] = stat.transform(compressor2);
                continue;
              }
              ab = aborts(stat.alternative);
              if (can_merge_flow(ab) && (new_else = as_statement_array_with_return(stat.alternative, ab))) {
                if (ab.label) {
                  remove(ab.label.thedef.references, ab);
                }
                CHANGED = true;
                stat = stat.clone();
                stat.body = make_node(AST_BlockStatement, stat.body, {
                  body: as_statement_array(stat.body).concat(extract_defuns())
                });
                stat.alternative = make_node(AST_BlockStatement, stat.alternative, {
                  body: new_else
                });
                statements2[i] = stat.transform(compressor2);
                continue;
              }
            }
            if (stat instanceof AST_If && stat.body instanceof AST_Return) {
              var value2 = stat.body.value;
              if (!value2 && !stat.alternative && (in_lambda && !next2 || next2 instanceof AST_Return && !next2.value)) {
                CHANGED = true;
                statements2[i] = make_node(AST_SimpleStatement, stat.condition, {
                  body: stat.condition
                });
                continue;
              }
              if (value2 && !stat.alternative && next2 instanceof AST_Return && next2.value) {
                CHANGED = true;
                stat = stat.clone();
                stat.alternative = next2;
                statements2[i] = stat.transform(compressor2);
                statements2.splice(j, 1);
                continue;
              }
              if (value2 && !stat.alternative && (!next2 && in_lambda && multiple_if_returns || next2 instanceof AST_Return)) {
                CHANGED = true;
                stat = stat.clone();
                stat.alternative = next2 || make_node(AST_Return, stat, {
                  value: null
                });
                statements2[i] = stat.transform(compressor2);
                if (next2)
                  statements2.splice(j, 1);
                continue;
              }
              var prev = statements2[prev_index(i)];
              if (compressor2.option("sequences") && in_lambda && !stat.alternative && prev instanceof AST_If && prev.body instanceof AST_Return && next_index(j) == statements2.length && next2 instanceof AST_SimpleStatement) {
                CHANGED = true;
                stat = stat.clone();
                stat.alternative = make_node(AST_BlockStatement, next2, {
                  body: [
                    next2,
                    make_node(AST_Return, next2, {
                      value: null
                    })
                  ]
                });
                statements2[i] = stat.transform(compressor2);
                statements2.splice(j, 1);
                continue;
              }
            }
          }
          function has_multiple_if_returns(statements3) {
            var n3 = 0;
            for (var i2 = statements3.length; --i2 >= 0; ) {
              var stat2 = statements3[i2];
              if (stat2 instanceof AST_If && stat2.body instanceof AST_Return) {
                if (++n3 > 1)
                  return true;
              }
            }
            return false;
          }
          function is_return_void(value3) {
            return !value3 || value3 instanceof AST_UnaryPrefix && value3.operator == "void";
          }
          function can_merge_flow(ab) {
            if (!ab)
              return false;
            for (var j2 = i + 1, len = statements2.length; j2 < len; j2++) {
              var stat2 = statements2[j2];
              if (stat2 instanceof AST_DefinitionsLike && !(stat2 instanceof AST_Var))
                return false;
            }
            var lct = ab instanceof AST_LoopControl ? compressor2.loopcontrol_target(ab) : null;
            return ab instanceof AST_Return && in_lambda && is_return_void(ab.value) || ab instanceof AST_Continue && self3 === loop_body(lct) || ab instanceof AST_Break && lct instanceof AST_BlockStatement && self3 === lct;
          }
          function extract_defuns() {
            var tail = statements2.slice(i + 1);
            statements2.length = i + 1;
            return tail.filter(function(stat2) {
              if (stat2 instanceof AST_Defun) {
                statements2.push(stat2);
                return false;
              }
              return true;
            });
          }
          function as_statement_array_with_return(node, ab) {
            var body = as_statement_array(node);
            if (ab !== body[body.length - 1]) {
              return void 0;
            }
            body = body.slice(0, -1);
            if (!body.every((stat2) => can_be_evicted_from_block(stat2))) {
              return void 0;
            }
            if (ab.value) {
              body.push(make_node(AST_SimpleStatement, ab.value, {
                body: ab.value.expression
              }));
            }
            return body;
          }
          function next_index(i2) {
            for (var j2 = i2 + 1, len = statements2.length; j2 < len; j2++) {
              var stat2 = statements2[j2];
              if (!(stat2 instanceof AST_Var && declarations_only(stat2))) {
                break;
              }
            }
            return j2;
          }
          function prev_index(i2) {
            for (var j2 = i2; --j2 >= 0; ) {
              var stat2 = statements2[j2];
              if (!(stat2 instanceof AST_Var && declarations_only(stat2))) {
                break;
              }
            }
            return j2;
          }
        }
        function eliminate_dead_code(statements2, compressor2) {
          var has_quit;
          var self3 = compressor2.self();
          for (var i = 0, n3 = 0, len = statements2.length; i < len; i++) {
            var stat = statements2[i];
            if (stat instanceof AST_LoopControl) {
              var lct = compressor2.loopcontrol_target(stat);
              if (stat instanceof AST_Break && !(lct instanceof AST_IterationStatement) && loop_body(lct) === self3 || stat instanceof AST_Continue && loop_body(lct) === self3) {
                if (stat.label) {
                  remove(stat.label.thedef.references, stat);
                }
              } else {
                statements2[n3++] = stat;
              }
            } else {
              statements2[n3++] = stat;
            }
            if (aborts(stat)) {
              has_quit = statements2.slice(i + 1);
              break;
            }
          }
          statements2.length = n3;
          CHANGED = n3 != len;
          if (has_quit)
            has_quit.forEach(function(stat2) {
              extract_from_unreachable_code(compressor2, stat2, statements2);
            });
        }
        function declarations_only(node) {
          return node.definitions.every((var_def) => !var_def.value);
        }
        function sequencesize(statements2, compressor2) {
          if (statements2.length < 2)
            return;
          var seq = [], n3 = 0;
          function push_seq() {
            if (!seq.length)
              return;
            var body2 = make_sequence(seq[0], seq);
            statements2[n3++] = make_node(AST_SimpleStatement, body2, { body: body2 });
            seq = [];
          }
          for (var i = 0, len = statements2.length; i < len; i++) {
            var stat = statements2[i];
            if (stat instanceof AST_SimpleStatement) {
              if (seq.length >= compressor2.sequences_limit)
                push_seq();
              var body = stat.body;
              if (seq.length > 0)
                body = body.drop_side_effect_free(compressor2);
              if (body)
                merge_sequence(seq, body);
            } else if (stat instanceof AST_Definitions && declarations_only(stat) || stat instanceof AST_Defun) {
              statements2[n3++] = stat;
            } else {
              push_seq();
              statements2[n3++] = stat;
            }
          }
          push_seq();
          statements2.length = n3;
          if (n3 != len)
            CHANGED = true;
        }
        function to_simple_statement(block2, decls) {
          if (!(block2 instanceof AST_BlockStatement))
            return block2;
          var stat = null;
          for (var i = 0, len = block2.body.length; i < len; i++) {
            var line = block2.body[i];
            if (line instanceof AST_Var && declarations_only(line)) {
              decls.push(line);
            } else if (stat || line instanceof AST_DefinitionsLike && !(line instanceof AST_Var)) {
              return false;
            } else {
              stat = line;
            }
          }
          return stat;
        }
        function sequencesize_2(statements2, compressor2) {
          function cons_seq(right) {
            n3--;
            CHANGED = true;
            var left = prev.body;
            return make_sequence(left, [left, right]).transform(compressor2);
          }
          var n3 = 0, prev;
          for (var i = 0; i < statements2.length; i++) {
            var stat = statements2[i];
            if (prev) {
              if (stat instanceof AST_Exit) {
                stat.value = cons_seq(stat.value || make_node(AST_Undefined, stat).transform(compressor2));
              } else if (stat instanceof AST_For) {
                if (!(stat.init instanceof AST_DefinitionsLike)) {
                  const abort = walk(prev.body, (node) => {
                    if (node instanceof AST_Scope)
                      return true;
                    if (node instanceof AST_Binary && node.operator === "in") {
                      return walk_abort;
                    }
                  });
                  if (!abort) {
                    if (stat.init)
                      stat.init = cons_seq(stat.init);
                    else {
                      stat.init = prev.body;
                      n3--;
                      CHANGED = true;
                    }
                  }
                }
              } else if (stat instanceof AST_ForIn) {
                if (!(stat.init instanceof AST_DefinitionsLike) || stat.init instanceof AST_Var) {
                  stat.object = cons_seq(stat.object);
                }
              } else if (stat instanceof AST_If) {
                stat.condition = cons_seq(stat.condition);
              } else if (stat instanceof AST_Switch) {
                stat.expression = cons_seq(stat.expression);
              } else if (stat instanceof AST_With) {
                stat.expression = cons_seq(stat.expression);
              }
            }
            if (compressor2.option("conditionals") && stat instanceof AST_If) {
              var decls = [];
              var body = to_simple_statement(stat.body, decls);
              var alt = to_simple_statement(stat.alternative, decls);
              if (body !== false && alt !== false && decls.length > 0) {
                var len = decls.length;
                decls.push(make_node(AST_If, stat, {
                  condition: stat.condition,
                  body: body || make_node(AST_EmptyStatement, stat.body),
                  alternative: alt
                }));
                decls.unshift(n3, 1);
                [].splice.apply(statements2, decls);
                i += len;
                n3 += len + 1;
                prev = null;
                CHANGED = true;
                continue;
              }
            }
            statements2[n3++] = stat;
            prev = stat instanceof AST_SimpleStatement ? stat : null;
          }
          statements2.length = n3;
        }
        function join_object_assignments(defn, body) {
          if (!(defn instanceof AST_Definitions))
            return;
          var def = defn.definitions[defn.definitions.length - 1];
          if (!(def.value instanceof AST_Object))
            return;
          var exprs;
          if (body instanceof AST_Assign && !body.logical) {
            exprs = [body];
          } else if (body instanceof AST_Sequence) {
            exprs = body.expressions.slice();
          }
          if (!exprs)
            return;
          var trimmed = false;
          do {
            var node = exprs[0];
            if (!(node instanceof AST_Assign))
              break;
            if (node.operator != "=")
              break;
            if (!(node.left instanceof AST_PropAccess))
              break;
            var sym = node.left.expression;
            if (!(sym instanceof AST_SymbolRef))
              break;
            if (def.name.name != sym.name)
              break;
            if (!node.right.is_constant_expression(nearest_scope))
              break;
            var prop2 = node.left.property;
            if (prop2 instanceof AST_Node) {
              prop2 = prop2.evaluate(compressor);
            }
            if (prop2 instanceof AST_Node)
              break;
            prop2 = "" + prop2;
            var diff = compressor.option("ecma") < 2015 && compressor.has_directive("use strict") ? function(node2) {
              return node2.key != prop2 && (node2.key && node2.key.name != prop2);
            } : function(node2) {
              return node2.key && node2.key.name != prop2;
            };
            if (!def.value.properties.every(diff))
              break;
            var p = def.value.properties.filter(function(p2) {
              return p2.key === prop2;
            })[0];
            if (!p) {
              def.value.properties.push(make_node(AST_ObjectKeyVal, node, {
                key: prop2,
                value: node.right
              }));
            } else {
              p.value = new AST_Sequence({
                start: p.start,
                expressions: [p.value.clone(), node.right.clone()],
                end: p.end
              });
            }
            exprs.shift();
            trimmed = true;
          } while (exprs.length);
          return trimmed && exprs;
        }
        function join_consecutive_vars(statements2) {
          var defs;
          for (var i = 0, j = -1, len = statements2.length; i < len; i++) {
            var stat = statements2[i];
            var prev = statements2[j];
            if (stat instanceof AST_Definitions) {
              if (prev && prev.TYPE == stat.TYPE) {
                prev.definitions = prev.definitions.concat(stat.definitions);
                CHANGED = true;
              } else if (defs && defs.TYPE == stat.TYPE && declarations_only(stat)) {
                defs.definitions = defs.definitions.concat(stat.definitions);
                CHANGED = true;
              } else {
                statements2[++j] = stat;
                defs = stat;
              }
            } else if (stat instanceof AST_Using && prev instanceof AST_Using && prev.await === stat.await) {
              prev.definitions = prev.definitions.concat(stat.definitions);
            } else if (stat instanceof AST_Exit) {
              stat.value = extract_object_assignments(stat.value);
            } else if (stat instanceof AST_For) {
              var exprs = join_object_assignments(prev, stat.init);
              if (exprs) {
                CHANGED = true;
                stat.init = exprs.length ? make_sequence(stat.init, exprs) : null;
                statements2[++j] = stat;
              } else if (prev instanceof AST_Var && (!stat.init || stat.init.TYPE == prev.TYPE)) {
                if (stat.init) {
                  prev.definitions = prev.definitions.concat(stat.init.definitions);
                }
                stat.init = prev;
                statements2[j] = stat;
                CHANGED = true;
              } else if (defs instanceof AST_Var && stat.init instanceof AST_Var && declarations_only(stat.init)) {
                defs.definitions = defs.definitions.concat(stat.init.definitions);
                stat.init = null;
                statements2[++j] = stat;
                CHANGED = true;
              } else {
                statements2[++j] = stat;
              }
            } else if (stat instanceof AST_ForIn) {
              stat.object = extract_object_assignments(stat.object);
            } else if (stat instanceof AST_If) {
              stat.condition = extract_object_assignments(stat.condition);
            } else if (stat instanceof AST_SimpleStatement) {
              var exprs = join_object_assignments(prev, stat.body);
              if (exprs) {
                CHANGED = true;
                if (!exprs.length)
                  continue;
                stat.body = make_sequence(stat.body, exprs);
              }
              statements2[++j] = stat;
            } else if (stat instanceof AST_Switch) {
              stat.expression = extract_object_assignments(stat.expression);
            } else if (stat instanceof AST_With) {
              stat.expression = extract_object_assignments(stat.expression);
            } else {
              statements2[++j] = stat;
            }
          }
          statements2.length = j + 1;
          function extract_object_assignments(value2) {
            statements2[++j] = stat;
            var exprs2 = join_object_assignments(prev, value2);
            if (exprs2) {
              CHANGED = true;
              if (exprs2.length) {
                return make_sequence(value2, exprs2);
              } else if (value2 instanceof AST_Sequence) {
                return value2.tail_node().left;
              } else {
                return value2.left;
              }
            }
            return value2;
          }
        }
      }
      function within_array_or_object_literal(compressor) {
        var node, level = 0;
        while (node = compressor.parent(level++)) {
          if (node instanceof AST_Statement) return false;
          if (node instanceof AST_Array || node instanceof AST_ObjectKeyVal || node instanceof AST_Object) {
            return true;
          }
        }
        return false;
      }
      function scope_encloses_variables_in_this_scope(scope, pulled_scope) {
        for (const enclosed of pulled_scope.enclosed) {
          if (pulled_scope.variables.has(enclosed.name)) {
            continue;
          }
          const looked_up = scope.find_variable(enclosed.name);
          if (looked_up) {
            if (looked_up === enclosed) continue;
            return true;
          }
        }
        return false;
      }
      function is_const_symbol_short_than_init_value(def, fixed_value) {
        if (def.orig.length === 1 && fixed_value) {
          const init_value_length = fixed_value.size();
          const identifer_length = def.name.length;
          return init_value_length > identifer_length;
        }
        return true;
      }
      function inline_into_symbolref(self3, compressor) {
        if (compressor.in_computed_key()) return self3;
        const parent = compressor.parent();
        const def = self3.definition();
        const nearest_scope = compressor.find_scope();
        let fixed = self3.fixed_value();
        if (compressor.top_retain && def.global && compressor.top_retain(def) && // when identifier is in top_retain option dose not mean we can always inline it.
        // if identifier name is longer then init value, we can replace it.
        is_const_symbol_short_than_init_value(def, fixed)) {
          def.fixed = false;
          def.single_use = false;
          return self3;
        }
        if (dont_inline_lambda_in_loop(compressor, fixed)) return self3;
        let single_use = def.single_use && !(parent instanceof AST_Call && parent.is_callee_pure(compressor) || has_annotation(parent, _NOINLINE)) && !(parent instanceof AST_Export && fixed instanceof AST_Lambda && fixed.name);
        if (single_use && fixed instanceof AST_Node) {
          single_use = !fixed.has_side_effects(compressor) && !fixed.may_throw(compressor);
        }
        if (fixed instanceof AST_Class && def.scope !== self3.scope) {
          return self3;
        }
        if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
          if (retain_top_func(fixed, compressor)) {
            single_use = false;
          } else if (def.scope !== self3.scope && (def.escaped == 1 || has_flag(fixed, INLINED) || within_array_or_object_literal(compressor) || !compressor.option("reduce_funcs"))) {
            single_use = false;
          } else if (is_recursive_ref(compressor, def)) {
            single_use = false;
          } else if (def.scope !== self3.scope || def.orig[0] instanceof AST_SymbolFunarg) {
            single_use = fixed.is_constant_expression(self3.scope);
            if (single_use == "f") {
              var scope = self3.scope;
              do {
                if (scope instanceof AST_Defun || is_func_expr(scope)) {
                  set_flag(scope, INLINED);
                }
              } while (scope = scope.parent_scope);
            }
          }
        }
        if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
          single_use = def.scope === self3.scope && !scope_encloses_variables_in_this_scope(nearest_scope, fixed) || parent instanceof AST_Call && parent.expression === self3 && !scope_encloses_variables_in_this_scope(nearest_scope, fixed) && !(fixed.name && fixed.name.definition().recursive_refs > 0);
        }
        if (single_use && fixed) {
          if (fixed instanceof AST_DefClass) {
            set_flag(fixed, SQUEEZED);
            fixed = make_node(AST_ClassExpression, fixed, fixed);
          }
          if (fixed instanceof AST_Defun) {
            set_flag(fixed, SQUEEZED);
            fixed = make_node(AST_Function, fixed, fixed);
          }
          if (def.recursive_refs > 0 && fixed.name instanceof AST_SymbolDefun) {
            const defun_def = fixed.name.definition();
            let lambda_def = fixed.variables.get(fixed.name.name);
            let name = lambda_def && lambda_def.orig[0];
            if (!(name instanceof AST_SymbolLambda)) {
              name = make_node(AST_SymbolLambda, fixed.name, fixed.name);
              name.scope = fixed;
              fixed.name = name;
              lambda_def = fixed.def_function(name);
            }
            walk(fixed, (node) => {
              if (node instanceof AST_SymbolRef && node.definition() === defun_def) {
                node.thedef = lambda_def;
                lambda_def.references.push(node);
              }
            });
          }
          if ((fixed instanceof AST_Lambda || fixed instanceof AST_Class) && fixed.parent_scope !== nearest_scope) {
            fixed = fixed.clone(true, compressor.get_toplevel());
            nearest_scope.add_child_scope(fixed);
          }
          return fixed.optimize(compressor);
        }
        if (fixed) {
          let replace;
          if (fixed instanceof AST_This) {
            if (!(def.orig[0] instanceof AST_SymbolFunarg) && def.references.every(
              (ref) => def.scope === ref.scope
            )) {
              replace = fixed;
            }
          } else {
            var ev = fixed.evaluate(compressor);
            if (ev !== fixed && (compressor.option("unsafe_regexp") || !(ev instanceof RegExp))) {
              replace = make_node_from_constant(ev, fixed);
            }
          }
          if (replace) {
            const name_length = self3.size(compressor);
            const replace_size = replace.size(compressor);
            let overhead = 0;
            if (compressor.option("unused") && !compressor.exposed(def)) {
              overhead = (name_length + 2 + fixed.size(compressor)) / (def.references.length - def.assignments);
            }
            if (replace_size <= name_length + overhead) {
              return replace;
            }
          }
        }
        return self3;
      }
      function inline_into_call(self3, compressor) {
        if (compressor.in_computed_key()) return self3;
        var exp = self3.expression;
        var fn = exp;
        var simple_args = self3.args.every((arg) => !(arg instanceof AST_Expansion));
        if (compressor.option("reduce_vars") && fn instanceof AST_SymbolRef && !has_annotation(self3, _NOINLINE)) {
          const fixed = fn.fixed_value();
          if (retain_top_func(fixed, compressor) || !compressor.toplevel.funcs && exp.definition().global) {
            return self3;
          }
          fn = fixed;
        }
        if (dont_inline_lambda_in_loop(compressor, fn) && !has_annotation(self3, _INLINE)) return self3;
        var is_func = fn instanceof AST_Lambda;
        var stat = is_func && fn.body[0];
        var is_regular_func = is_func && !fn.is_generator && !fn.async;
        var can_inline = is_regular_func && compressor.option("inline") && !self3.is_callee_pure(compressor);
        if (can_inline && stat instanceof AST_Return) {
          let returned = stat.value;
          if (!returned || returned.is_constant_expression()) {
            if (returned) {
              returned = returned.clone(true);
            } else {
              returned = make_node(AST_Undefined, self3);
            }
            const args2 = self3.args.concat(returned);
            return make_sequence(self3, args2).optimize(compressor);
          }
          if (fn.argnames.length === 1 && fn.argnames[0] instanceof AST_SymbolFunarg && self3.args.length < 2 && !(self3.args[0] instanceof AST_Expansion) && returned instanceof AST_SymbolRef && returned.name === fn.argnames[0].name) {
            const replacement = (self3.args[0] || make_node(AST_Undefined)).optimize(compressor);
            let parent;
            if (replacement instanceof AST_PropAccess && (parent = compressor.parent()) instanceof AST_Call && parent.expression === self3) {
              return make_sequence(self3, [
                make_node(AST_Number, self3, { value: 0 }),
                replacement
              ]);
            }
            return replacement;
          }
        }
        if (can_inline) {
          var scope, in_loop, level = -1;
          let def;
          let returned_value;
          let nearest_scope;
          if (simple_args && !fn.uses_arguments && !(compressor.parent() instanceof AST_Class) && !(fn.name && fn instanceof AST_Function) && (returned_value = can_flatten_body(stat)) && (exp === fn || has_annotation(self3, _INLINE) || compressor.option("unused") && (def = exp.definition()).references.length == 1 && !is_recursive_ref(compressor, def) && fn.is_constant_expression(exp.scope)) && !has_annotation(self3, _PURE | _NOINLINE) && !fn.contains_this() && can_inject_symbols() && (nearest_scope = compressor.find_scope()) && !scope_encloses_variables_in_this_scope(nearest_scope, fn) && !function in_default_assign() {
            let i = 0;
            let p;
            while (p = compressor.parent(i++)) {
              if (p instanceof AST_DefaultAssign) return true;
              if (p instanceof AST_Block) break;
            }
            return false;
          }() && !(scope instanceof AST_Class)) {
            set_flag(fn, SQUEEZED);
            nearest_scope.add_child_scope(fn);
            return make_sequence(self3, flatten_fn(returned_value)).optimize(compressor);
          }
        }
        if (can_inline && has_annotation(self3, _INLINE)) {
          set_flag(fn, SQUEEZED);
          fn = make_node(fn.CTOR === AST_Defun ? AST_Function : fn.CTOR, fn, fn);
          fn = fn.clone(true);
          fn.figure_out_scope({}, {
            parent_scope: compressor.find_scope(),
            toplevel: compressor.get_toplevel()
          });
          return make_node(AST_Call, self3, {
            expression: fn,
            args: self3.args
          }).optimize(compressor);
        }
        const can_drop_this_call = is_regular_func && compressor.option("side_effects") && fn.body.every(is_empty);
        if (can_drop_this_call) {
          var args = self3.args.concat(make_node(AST_Undefined, self3));
          return make_sequence(self3, args).optimize(compressor);
        }
        if (compressor.option("negate_iife") && compressor.parent() instanceof AST_SimpleStatement && is_iife_call(self3)) {
          return self3.negate(compressor, true);
        }
        var ev = self3.evaluate(compressor);
        if (ev !== self3) {
          ev = make_node_from_constant(ev, self3).optimize(compressor);
          return best_of(compressor, ev, self3);
        }
        return self3;
        function return_value(stat2) {
          if (!stat2) return make_node(AST_Undefined, self3);
          if (stat2 instanceof AST_Return) {
            if (!stat2.value) return make_node(AST_Undefined, self3);
            return stat2.value.clone(true);
          }
          if (stat2 instanceof AST_SimpleStatement) {
            return make_node(AST_UnaryPrefix, stat2, {
              operator: "void",
              expression: stat2.body.clone(true)
            });
          }
        }
        function can_flatten_body(stat2) {
          var body = fn.body;
          var len = body.length;
          if (compressor.option("inline") < 3) {
            return len == 1 && return_value(stat2);
          }
          stat2 = null;
          for (var i = 0; i < len; i++) {
            var line = body[i];
            if (line instanceof AST_Var) {
              if (stat2 && !line.definitions.every(
                (var_def) => !var_def.value
              )) {
                return false;
              }
            } else if (stat2) {
              return false;
            } else if (!(line instanceof AST_EmptyStatement)) {
              stat2 = line;
            }
          }
          return return_value(stat2);
        }
        function can_inject_args(block_scoped, safe_to_inject) {
          for (var i = 0, len = fn.argnames.length; i < len; i++) {
            var arg = fn.argnames[i];
            if (arg instanceof AST_DefaultAssign) {
              if (has_flag(arg.left, UNUSED)) continue;
              return false;
            }
            if (arg instanceof AST_Destructuring) return false;
            if (arg instanceof AST_Expansion) {
              if (has_flag(arg.expression, UNUSED)) continue;
              return false;
            }
            if (has_flag(arg, UNUSED)) continue;
            if (!safe_to_inject || block_scoped.has(arg.name) || identifier_atom.has(arg.name) || scope.conflicting_def(arg.name)) {
              return false;
            }
            if (in_loop) in_loop.push(arg.definition());
          }
          return true;
        }
        function can_inject_vars(block_scoped, safe_to_inject) {
          var len = fn.body.length;
          for (var i = 0; i < len; i++) {
            var stat2 = fn.body[i];
            if (!(stat2 instanceof AST_Var)) continue;
            if (!safe_to_inject) return false;
            for (var j = stat2.definitions.length; --j >= 0; ) {
              var name = stat2.definitions[j].name;
              if (name instanceof AST_Destructuring || block_scoped.has(name.name) || identifier_atom.has(name.name) || scope.conflicting_def(name.name)) {
                return false;
              }
              if (in_loop) in_loop.push(name.definition());
            }
          }
          return true;
        }
        function can_inject_symbols() {
          var block_scoped = /* @__PURE__ */ new Set();
          do {
            scope = compressor.parent(++level);
            if (scope.is_block_scope() && scope.block_scope) {
              scope.block_scope.variables.forEach(function(variable) {
                block_scoped.add(variable.name);
              });
            }
            if (scope instanceof AST_Catch) {
              if (scope.argname) {
                block_scoped.add(scope.argname.name);
              }
            } else if (scope instanceof AST_IterationStatement) {
              in_loop = [];
            } else if (scope instanceof AST_SymbolRef) {
              if (scope.fixed_value() instanceof AST_Scope) return false;
            }
          } while (!(scope instanceof AST_Scope));
          var safe_to_inject = !(scope instanceof AST_Toplevel) || compressor.toplevel.vars;
          var inline = compressor.option("inline");
          if (!can_inject_vars(block_scoped, inline >= 3 && safe_to_inject)) return false;
          if (!can_inject_args(block_scoped, inline >= 2 && safe_to_inject)) return false;
          return !in_loop || in_loop.length == 0 || !is_reachable(fn, in_loop);
        }
        function append_var(decls, expressions, name, value2) {
          var def = name.definition();
          const already_appended = scope.variables.has(name.name);
          if (!already_appended) {
            scope.variables.set(name.name, def);
            scope.enclosed.push(def);
            decls.push(make_node(AST_VarDef, name, {
              name,
              value: null
            }));
          }
          var sym = make_node(AST_SymbolRef, name, name);
          def.references.push(sym);
          if (value2) expressions.push(make_node(AST_Assign, self3, {
            operator: "=",
            logical: false,
            left: sym,
            right: value2.clone()
          }));
        }
        function flatten_args(decls, expressions) {
          var len = fn.argnames.length;
          for (var i = self3.args.length; --i >= len; ) {
            expressions.push(self3.args[i]);
          }
          for (i = len; --i >= 0; ) {
            var name = fn.argnames[i];
            var value2 = self3.args[i];
            if (has_flag(name, UNUSED) || !name.name || scope.conflicting_def(name.name)) {
              if (value2) expressions.push(value2);
            } else {
              var symbol = make_node(AST_SymbolVar, name, name);
              name.definition().orig.push(symbol);
              if (!value2 && in_loop) value2 = make_node(AST_Undefined, self3);
              append_var(decls, expressions, symbol, value2);
            }
          }
          decls.reverse();
          expressions.reverse();
        }
        function flatten_vars(decls, expressions) {
          var pos2 = expressions.length;
          for (var i = 0, lines = fn.body.length; i < lines; i++) {
            var stat2 = fn.body[i];
            if (!(stat2 instanceof AST_Var)) continue;
            for (var j = 0, defs = stat2.definitions.length; j < defs; j++) {
              var var_def = stat2.definitions[j];
              var name = var_def.name;
              append_var(decls, expressions, name, var_def.value);
              if (in_loop && fn.argnames.every(
                (argname) => argname.name != name.name
              )) {
                var def = fn.variables.get(name.name);
                var sym = make_node(AST_SymbolRef, name, name);
                def.references.push(sym);
                expressions.splice(pos2++, 0, make_node(AST_Assign, var_def, {
                  operator: "=",
                  logical: false,
                  left: sym,
                  right: make_node(AST_Undefined, name)
                }));
              }
            }
          }
        }
        function flatten_fn(returned_value) {
          var decls = [];
          var expressions = [];
          flatten_args(decls, expressions);
          flatten_vars(decls, expressions);
          expressions.push(returned_value);
          if (decls.length) {
            const i = scope.body.indexOf(compressor.parent(level - 1)) + 1;
            scope.body.splice(i, 0, make_node(AST_Var, fn, {
              definitions: decls
            }));
          }
          return expressions.map((exp2) => exp2.clone(true));
        }
      }
      function dont_inline_lambda_in_loop(compressor, maybe_lambda) {
        return (maybe_lambda instanceof AST_Lambda || maybe_lambda instanceof AST_Class) && !!compressor.is_within_loop();
      }
      (function(def_find_defs) {
        function to_node(value2, orig) {
          if (value2 instanceof AST_Node) {
            if (!(value2 instanceof AST_Constant)) {
              value2 = value2.clone(true);
            }
            return make_node(value2.CTOR, orig, value2);
          }
          if (Array.isArray(value2)) return make_node(AST_Array, orig, {
            elements: value2.map(function(value3) {
              return to_node(value3, orig);
            })
          });
          if (value2 && typeof value2 == "object") {
            var props = [];
            for (var key4 in value2) if (HOP(value2, key4)) {
              props.push(make_node(AST_ObjectKeyVal, orig, {
                key: key4,
                value: to_node(value2[key4], orig)
              }));
            }
            return make_node(AST_Object, orig, {
              properties: props
            });
          }
          return make_node_from_constant(value2, orig);
        }
        AST_Toplevel.DEFMETHOD("resolve_defines", function(compressor) {
          if (!compressor.option("global_defs")) return this;
          this.figure_out_scope({ ie8: compressor.option("ie8") });
          return this.transform(new TreeTransformer(function(node) {
            var def = node._find_defs(compressor, "");
            if (!def) return;
            var level = 0, child2 = node, parent;
            while (parent = this.parent(level++)) {
              if (!(parent instanceof AST_PropAccess)) break;
              if (parent.expression !== child2) break;
              child2 = parent;
            }
            if (is_lhs(child2, parent)) {
              return;
            }
            return def;
          }));
        });
        def_find_defs(AST_Node, noop3);
        def_find_defs(AST_Chain, function(compressor, suffix) {
          return this.expression._find_defs(compressor, suffix);
        });
        def_find_defs(AST_Dot, function(compressor, suffix) {
          return this.expression._find_defs(compressor, "." + this.property + suffix);
        });
        def_find_defs(AST_SymbolDeclaration, function() {
          if (!this.global()) return;
        });
        def_find_defs(AST_SymbolRef, function(compressor, suffix) {
          if (!this.global()) return;
          var defines = compressor.option("global_defs");
          var name = this.name + suffix;
          if (HOP(defines, name)) return to_node(defines[name], this);
        });
        def_find_defs(AST_ImportMeta, function(compressor, suffix) {
          var defines = compressor.option("global_defs");
          var name = "import.meta" + suffix;
          if (HOP(defines, name)) return to_node(defines[name], this);
        });
      })(function(node, func) {
        node.DEFMETHOD("_find_defs", func);
      });
      class Compressor extends TreeWalker {
        constructor(options, { false_by_default = false, mangle_options: mangle_options2 = false }) {
          super();
          if (options.defaults !== void 0 && !options.defaults) false_by_default = true;
          this.options = defaults2(options, {
            arguments: false,
            arrows: !false_by_default,
            booleans: !false_by_default,
            booleans_as_integers: false,
            collapse_vars: !false_by_default,
            comparisons: !false_by_default,
            computed_props: !false_by_default,
            conditionals: !false_by_default,
            dead_code: !false_by_default,
            defaults: true,
            directives: !false_by_default,
            drop_console: false,
            drop_debugger: !false_by_default,
            ecma: 5,
            evaluate: !false_by_default,
            expression: false,
            global_defs: false,
            hoist_funs: false,
            hoist_props: !false_by_default,
            hoist_vars: false,
            ie8: false,
            if_return: !false_by_default,
            inline: !false_by_default,
            join_vars: !false_by_default,
            keep_classnames: false,
            keep_fargs: true,
            keep_fnames: false,
            keep_infinity: false,
            lhs_constants: !false_by_default,
            loops: !false_by_default,
            module: false,
            negate_iife: !false_by_default,
            passes: 1,
            properties: !false_by_default,
            pure_getters: !false_by_default && "strict",
            pure_funcs: null,
            pure_new: false,
            reduce_funcs: !false_by_default,
            reduce_vars: !false_by_default,
            sequences: !false_by_default,
            side_effects: !false_by_default,
            switches: !false_by_default,
            top_retain: null,
            toplevel: !!(options && options["top_retain"]),
            typeofs: !false_by_default,
            unsafe: false,
            unsafe_arrows: false,
            unsafe_comps: false,
            unsafe_Function: false,
            unsafe_math: false,
            unsafe_symbols: false,
            unsafe_methods: false,
            unsafe_proto: false,
            unsafe_regexp: false,
            unsafe_undefined: false,
            unused: !false_by_default,
            warnings: false
            // legacy
          }, true);
          var global_defs = this.options["global_defs"];
          if (typeof global_defs == "object") for (var key4 in global_defs) {
            if (key4[0] === "@" && HOP(global_defs, key4)) {
              global_defs[key4.slice(1)] = parse2(global_defs[key4], {
                expression: true
              });
            }
          }
          if (this.options["inline"] === true) this.options["inline"] = 3;
          var pure_funcs = this.options["pure_funcs"];
          if (typeof pure_funcs == "function") {
            this.pure_funcs = pure_funcs;
          } else {
            this.pure_funcs = pure_funcs ? function(node) {
              return !pure_funcs.includes(node.expression.print_to_string());
            } : return_true;
          }
          var top_retain = this.options["top_retain"];
          if (top_retain instanceof RegExp) {
            this.top_retain = function(def) {
              return top_retain.test(def.name);
            };
          } else if (typeof top_retain == "function") {
            this.top_retain = top_retain;
          } else if (top_retain) {
            if (typeof top_retain == "string") {
              top_retain = top_retain.split(/,/);
            }
            this.top_retain = function(def) {
              return top_retain.includes(def.name);
            };
          }
          if (this.options["module"]) {
            this.directives["use strict"] = true;
            this.options["toplevel"] = true;
          }
          var toplevel = this.options["toplevel"];
          this.toplevel = typeof toplevel == "string" ? {
            funcs: /funcs/.test(toplevel),
            vars: /vars/.test(toplevel)
          } : {
            funcs: toplevel,
            vars: toplevel
          };
          var sequences = this.options["sequences"];
          this.sequences_limit = sequences == 1 ? 800 : sequences | 0;
          this.evaluated_regexps = /* @__PURE__ */ new Map();
          this._toplevel = void 0;
          this._mangle_options = mangle_options2 ? format_mangler_options(mangle_options2) : mangle_options2;
        }
        mangle_options() {
          var nth_identifier = this._mangle_options && this._mangle_options.nth_identifier || base54;
          var module3 = this._mangle_options && this._mangle_options.module || this.option("module");
          return { ie8: this.option("ie8"), nth_identifier, module: module3 };
        }
        option(key4) {
          return this.options[key4];
        }
        exposed(def) {
          if (def.export) return true;
          if (def.global) {
            for (var i = 0, len = def.orig.length; i < len; i++)
              if (!this.toplevel[def.orig[i] instanceof AST_SymbolDefun ? "funcs" : "vars"])
                return true;
          }
          return false;
        }
        in_boolean_context() {
          if (!this.option("booleans")) return false;
          var self3 = this.self();
          for (var i = 0, p; p = this.parent(i); i++) {
            if (p instanceof AST_SimpleStatement || p instanceof AST_Conditional && p.condition === self3 || p instanceof AST_DWLoop && p.condition === self3 || p instanceof AST_For && p.condition === self3 || p instanceof AST_If && p.condition === self3 || p instanceof AST_UnaryPrefix && p.operator == "!" && p.expression === self3) {
              return true;
            }
            if (p instanceof AST_Binary && (p.operator == "&&" || p.operator == "||" || p.operator == "??") || p instanceof AST_Conditional || p.tail_node() === self3) {
              self3 = p;
            } else {
              return false;
            }
          }
        }
        /** True if compressor.self()'s result will be turned into a 32-bit integer.
         * ex:
         * ~{expr}
         * (1, 2, {expr}) | 0
         **/
        in_32_bit_context(other_operand_must_be_number) {
          if (!this.option("evaluate")) return false;
          var self3 = this.self();
          for (var i = 0, p; p = this.parent(i); i++) {
            if (p instanceof AST_Binary && bitwise_binop.has(p.operator)) {
              if (other_operand_must_be_number) {
                return (self3 === p.left ? p.right : p.left).is_number(this);
              } else {
                return true;
              }
            }
            if (p instanceof AST_UnaryPrefix) {
              return p.operator === "~";
            }
            if (p instanceof AST_Binary && // Don't talk about p.left. Can change branch taken
            (p.operator == "&&" && p.right === self3 || p.operator == "||" && p.right === self3 || p.operator == "??" && p.right === self3) || p instanceof AST_Conditional && p.condition !== self3 || p.tail_node() === self3) {
              self3 = p;
            } else {
              return false;
            }
          }
        }
        in_computed_key() {
          if (!this.option("evaluate")) return false;
          var self3 = this.self();
          for (var i = 0, p; p = this.parent(i); i++) {
            if (p instanceof AST_ObjectProperty && p.key === self3) {
              return true;
            }
          }
          return false;
        }
        get_toplevel() {
          return this._toplevel;
        }
        compress(toplevel) {
          toplevel = toplevel.resolve_defines(this);
          this._toplevel = toplevel;
          if (this.option("expression")) {
            this._toplevel.process_expression(true);
          }
          var passes = +this.options.passes || 1;
          var min_count = 1 / 0;
          var stopping = false;
          var mangle = this.mangle_options();
          for (var pass = 0; pass < passes; pass++) {
            this._toplevel.figure_out_scope(mangle);
            if (pass === 0 && this.option("drop_console")) {
              this._toplevel = this._toplevel.drop_console(this.option("drop_console"));
            }
            if (pass > 0 || this.option("reduce_vars")) {
              this._toplevel.reset_opt_flags(this);
            }
            this._toplevel = this._toplevel.transform(this);
            if (passes > 1) {
              let count = 0;
              walk(this._toplevel, () => {
                count++;
              });
              if (count < min_count) {
                min_count = count;
                stopping = false;
              } else if (stopping) {
                break;
              } else {
                stopping = true;
              }
            }
          }
          if (this.option("expression")) {
            this._toplevel.process_expression(false);
          }
          toplevel = this._toplevel;
          this._toplevel = void 0;
          return toplevel;
        }
        before(node, descend) {
          if (has_flag(node, SQUEEZED)) return node;
          var was_scope = false;
          if (node instanceof AST_Scope) {
            node = node.hoist_properties(this);
            node = node.hoist_declarations(this);
            was_scope = true;
          }
          descend(node, this);
          descend(node, this);
          var opt = node.optimize(this);
          if (was_scope && opt instanceof AST_Scope) {
            opt.drop_unused(this);
            descend(opt, this);
          }
          if (opt === node) set_flag(opt, SQUEEZED);
          return opt;
        }
        /** Alternative to plain is_lhs() which doesn't work within .optimize() */
        is_lhs() {
          const self3 = this.stack[this.stack.length - 1];
          const parent = this.stack[this.stack.length - 2];
          return is_lhs(self3, parent);
        }
      }
      function def_optimize(node, optimizer) {
        node.DEFMETHOD("optimize", function(compressor) {
          var self3 = this;
          if (has_flag(self3, OPTIMIZED)) return self3;
          if (compressor.has_directive("use asm")) return self3;
          var opt = optimizer(self3, compressor);
          set_flag(opt, OPTIMIZED);
          return opt;
        });
      }
      def_optimize(AST_Node, function(self3) {
        return self3;
      });
      AST_Toplevel.DEFMETHOD("drop_console", function(options) {
        const isArray2 = Array.isArray(options);
        const tt = new TreeTransformer(function(self3) {
          if (self3.TYPE !== "Call") {
            return;
          }
          var exp = self3.expression;
          if (!(exp instanceof AST_PropAccess)) {
            return;
          }
          var name = exp.expression;
          var property = exp.property;
          var depth = 2;
          while (name.expression) {
            property = name.property;
            name = name.expression;
            depth++;
          }
          if (isArray2 && !options.includes(property)) {
            return;
          }
          if (is_undeclared_ref(name) && name.name == "console") {
            if (depth === 3 && !["call", "apply"].includes(exp.property) && is_used_in_expression(tt)) {
              exp.expression = make_empty_function(self3);
              set_flag(exp.expression, SQUEEZED);
              self3.args = [];
            } else {
              return make_node(AST_Undefined, self3);
            }
          }
        });
        return this.transform(tt);
      });
      AST_Node.DEFMETHOD("equivalent_to", function(node) {
        return equivalent_to(this, node);
      });
      AST_Scope.DEFMETHOD("process_expression", function(insert, compressor) {
        var self3 = this;
        var tt = new TreeTransformer(function(node) {
          if (insert && node instanceof AST_SimpleStatement) {
            return make_node(AST_Return, node, {
              value: node.body
            });
          }
          if (!insert && node instanceof AST_Return) {
            if (compressor) {
              var value2 = node.value && node.value.drop_side_effect_free(compressor, true);
              return value2 ? make_node(AST_SimpleStatement, node, { body: value2 }) : make_node(AST_EmptyStatement, node);
            }
            return make_node(AST_SimpleStatement, node, {
              body: node.value || make_node(AST_UnaryPrefix, node, {
                operator: "void",
                expression: make_node(AST_Number, node, {
                  value: 0
                })
              })
            });
          }
          if (node instanceof AST_Class || node instanceof AST_Lambda && node !== self3) {
            return node;
          }
          if (node instanceof AST_Block) {
            var index6 = node.body.length - 1;
            if (index6 >= 0) {
              node.body[index6] = node.body[index6].transform(tt);
            }
          } else if (node instanceof AST_If) {
            node.body = node.body.transform(tt);
            if (node.alternative) {
              node.alternative = node.alternative.transform(tt);
            }
          } else if (node instanceof AST_With) {
            node.body = node.body.transform(tt);
          }
          return node;
        });
        self3.transform(tt);
      });
      AST_Toplevel.DEFMETHOD("reset_opt_flags", function(compressor) {
        const self3 = this;
        const reduce_vars = compressor.option("reduce_vars");
        const preparation = new TreeWalker(function(node, descend) {
          clear_flag(node, CLEAR_BETWEEN_PASSES);
          if (reduce_vars) {
            if (compressor.top_retain && node instanceof AST_Defun && preparation.parent() === self3) {
              set_flag(node, TOP);
            }
            return node.reduce_vars(preparation, descend, compressor);
          }
        });
        preparation.safe_ids = /* @__PURE__ */ Object.create(null);
        preparation.in_loop = null;
        preparation.loop_ids = /* @__PURE__ */ new Map();
        preparation.defs_to_safe_ids = /* @__PURE__ */ new Map();
        self3.walk(preparation);
      });
      AST_Symbol.DEFMETHOD("fixed_value", function() {
        var fixed = this.thedef.fixed;
        if (!fixed || fixed instanceof AST_Node) return fixed;
        return fixed();
      });
      AST_SymbolRef.DEFMETHOD("is_immutable", function() {
        var orig = this.definition().orig;
        return orig.length == 1 && orig[0] instanceof AST_SymbolLambda;
      });
      function find_variable(compressor, name) {
        var scope, i = 0;
        while (scope = compressor.parent(i++)) {
          if (scope instanceof AST_Scope) break;
          if (scope instanceof AST_Catch && scope.argname) {
            scope = scope.argname.definition().scope;
            break;
          }
        }
        return scope.find_variable(name);
      }
      var global_names = makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Math Number parseFloat parseInt RangeError ReferenceError RegExp Object setInterval setTimeout String SyntaxError TypeError unescape URIError");
      AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
        return !this.definition().undeclared || compressor.option("unsafe") && global_names.has(this.name);
      });
      var directives = /* @__PURE__ */ new Set(["use asm", "use strict"]);
      def_optimize(AST_Directive, function(self3, compressor) {
        if (compressor.option("directives") && (!directives.has(self3.value) || compressor.has_directive(self3.value) !== self3)) {
          return make_node(AST_EmptyStatement, self3);
        }
        return self3;
      });
      def_optimize(AST_Debugger, function(self3, compressor) {
        if (compressor.option("drop_debugger"))
          return make_node(AST_EmptyStatement, self3);
        return self3;
      });
      def_optimize(AST_LabeledStatement, function(self3, compressor) {
        if (self3.body instanceof AST_Break && compressor.loopcontrol_target(self3.body) === self3.body) {
          return make_node(AST_EmptyStatement, self3);
        }
        return self3.label.references.length == 0 ? self3.body : self3;
      });
      def_optimize(AST_Block, function(self3, compressor) {
        tighten_body(self3.body, compressor);
        return self3;
      });
      function can_be_extracted_from_if_block(node) {
        return !(node instanceof AST_Const || node instanceof AST_Let || node instanceof AST_Using || node instanceof AST_Class);
      }
      def_optimize(AST_BlockStatement, function(self3, compressor) {
        tighten_body(self3.body, compressor);
        switch (self3.body.length) {
          case 1:
            if (!compressor.has_directive("use strict") && compressor.parent() instanceof AST_If && can_be_extracted_from_if_block(self3.body[0]) || can_be_evicted_from_block(self3.body[0])) {
              return self3.body[0];
            }
            break;
          case 0:
            return make_node(AST_EmptyStatement, self3);
        }
        return self3;
      });
      function opt_AST_Lambda(self3, compressor) {
        tighten_body(self3.body, compressor);
        if (compressor.option("side_effects") && self3.body.length == 1 && self3.body[0] === compressor.has_directive("use strict")) {
          self3.body.length = 0;
        }
        return self3;
      }
      def_optimize(AST_Lambda, opt_AST_Lambda);
      AST_Scope.DEFMETHOD("hoist_declarations", function(compressor) {
        var self3 = this;
        if (compressor.has_directive("use asm")) return self3;
        var hoist_funs = compressor.option("hoist_funs");
        var hoist_vars = compressor.option("hoist_vars");
        if (hoist_funs || hoist_vars) {
          var dirs = [];
          var hoisted = [];
          var vars = /* @__PURE__ */ new Map(), vars_found = 0, var_decl = 0;
          walk(self3, (node) => {
            if (node instanceof AST_Scope && node !== self3)
              return true;
            if (node instanceof AST_Var) {
              ++var_decl;
              return true;
            }
          });
          hoist_vars = hoist_vars && var_decl > 1;
          var tt = new TreeTransformer(
            function before(node) {
              if (node !== self3) {
                if (node instanceof AST_Directive) {
                  dirs.push(node);
                  return make_node(AST_EmptyStatement, node);
                }
                if (hoist_funs && node instanceof AST_Defun && !(tt.parent() instanceof AST_Export) && tt.parent() === self3) {
                  hoisted.push(node);
                  return make_node(AST_EmptyStatement, node);
                }
                if (hoist_vars && node instanceof AST_Var && !node.definitions.some((def3) => def3.name instanceof AST_Destructuring)) {
                  node.definitions.forEach(function(def3) {
                    vars.set(def3.name.name, def3);
                    ++vars_found;
                  });
                  var seq = node.to_assignments(compressor);
                  var p = tt.parent();
                  if (p instanceof AST_ForIn && p.init === node) {
                    if (seq == null) {
                      var def2 = node.definitions[0].name;
                      return make_node(AST_SymbolRef, def2, def2);
                    }
                    return seq;
                  }
                  if (p instanceof AST_For && p.init === node) {
                    return seq;
                  }
                  if (!seq) return make_node(AST_EmptyStatement, node);
                  return make_node(AST_SimpleStatement, node, {
                    body: seq
                  });
                }
                if (node instanceof AST_Scope)
                  return node;
              }
            }
          );
          self3 = self3.transform(tt);
          if (vars_found > 0) {
            var defs = [];
            const is_lambda = self3 instanceof AST_Lambda;
            const args_as_names = is_lambda ? self3.args_as_names() : null;
            vars.forEach((def2, name) => {
              if (is_lambda && args_as_names.some((x) => x.name === def2.name.name)) {
                vars.delete(name);
              } else {
                def2 = def2.clone();
                def2.value = null;
                defs.push(def2);
                vars.set(name, def2);
              }
            });
            if (defs.length > 0) {
              for (var i = 0; i < self3.body.length; ) {
                if (self3.body[i] instanceof AST_SimpleStatement) {
                  var expr = self3.body[i].body, sym, assign2;
                  if (expr instanceof AST_Assign && expr.operator == "=" && (sym = expr.left) instanceof AST_Symbol && vars.has(sym.name)) {
                    var def = vars.get(sym.name);
                    if (def.value) break;
                    def.value = expr.right;
                    remove(defs, def);
                    defs.push(def);
                    self3.body.splice(i, 1);
                    continue;
                  }
                  if (expr instanceof AST_Sequence && (assign2 = expr.expressions[0]) instanceof AST_Assign && assign2.operator == "=" && (sym = assign2.left) instanceof AST_Symbol && vars.has(sym.name)) {
                    var def = vars.get(sym.name);
                    if (def.value) break;
                    def.value = assign2.right;
                    remove(defs, def);
                    defs.push(def);
                    self3.body[i].body = make_sequence(expr, expr.expressions.slice(1));
                    continue;
                  }
                }
                if (self3.body[i] instanceof AST_EmptyStatement) {
                  self3.body.splice(i, 1);
                  continue;
                }
                if (self3.body[i] instanceof AST_BlockStatement) {
                  self3.body.splice(i, 1, ...self3.body[i].body);
                  continue;
                }
                break;
              }
              defs = make_node(AST_Var, self3, {
                definitions: defs
              });
              hoisted.push(defs);
            }
          }
          self3.body = dirs.concat(hoisted, self3.body);
        }
        return self3;
      });
      AST_Scope.DEFMETHOD("hoist_properties", function(compressor) {
        var self3 = this;
        if (!compressor.option("hoist_props") || compressor.has_directive("use asm")) return self3;
        var top_retain = self3 instanceof AST_Toplevel && compressor.top_retain || return_false;
        var defs_by_id = /* @__PURE__ */ new Map();
        var hoister = new TreeTransformer(function(node, descend) {
          if (node instanceof AST_VarDef) {
            const sym = node.name;
            let def;
            let value2;
            if (sym.scope === self3 && !(sym instanceof AST_SymbolUsing) && (def = sym.definition()).escaped != 1 && !def.assignments && !def.direct_access && !def.single_use && !compressor.exposed(def) && !top_retain(def) && (value2 = sym.fixed_value()) === node.value && value2 instanceof AST_Object && !value2.properties.some(
              (prop2) => prop2 instanceof AST_Expansion || prop2.computed_key()
            )) {
              descend(node, this);
              const defs = /* @__PURE__ */ new Map();
              const assignments = [];
              value2.properties.forEach(({ key: key4, value: value3 }) => {
                const scope = hoister.find_scope();
                const symbol = self3.create_symbol(sym.CTOR, {
                  source: sym,
                  scope,
                  conflict_scopes: /* @__PURE__ */ new Set([
                    scope,
                    ...sym.definition().references.map((ref) => ref.scope)
                  ]),
                  tentative_name: sym.name + "_" + key4
                });
                defs.set(String(key4), symbol.definition());
                assignments.push(make_node(AST_VarDef, node, {
                  name: symbol,
                  value: value3
                }));
              });
              defs_by_id.set(def.id, defs);
              return MAP.splice(assignments);
            }
          } else if (node instanceof AST_PropAccess && node.expression instanceof AST_SymbolRef) {
            const defs = defs_by_id.get(node.expression.definition().id);
            if (defs) {
              const def = defs.get(String(get_simple_key(node.property)));
              const sym = make_node(AST_SymbolRef, node, {
                name: def.name,
                scope: node.expression.scope,
                thedef: def
              });
              sym.reference({});
              return sym;
            }
          }
        });
        return self3.transform(hoister);
      });
      def_optimize(AST_SimpleStatement, function(self3, compressor) {
        if (compressor.option("side_effects")) {
          var body = self3.body;
          var node = body.drop_side_effect_free(compressor, true);
          if (!node) {
            return make_node(AST_EmptyStatement, self3);
          }
          if (node !== body) {
            return make_node(AST_SimpleStatement, self3, { body: node });
          }
        }
        return self3;
      });
      def_optimize(AST_While, function(self3, compressor) {
        return compressor.option("loops") ? make_node(AST_For, self3, self3).optimize(compressor) : self3;
      });
      def_optimize(AST_Do, function(self3, compressor) {
        if (!compressor.option("loops")) return self3;
        var cond = self3.condition.tail_node().evaluate(compressor);
        if (!(cond instanceof AST_Node)) {
          if (cond) return make_node(AST_For, self3, {
            body: make_node(AST_BlockStatement, self3.body, {
              body: [
                self3.body,
                make_node(AST_SimpleStatement, self3.condition, {
                  body: self3.condition
                })
              ]
            })
          }).optimize(compressor);
          if (!has_break_or_continue(self3, compressor.parent())) {
            return make_node(AST_BlockStatement, self3.body, {
              body: [
                self3.body,
                make_node(AST_SimpleStatement, self3.condition, {
                  body: self3.condition
                })
              ]
            }).optimize(compressor);
          }
        }
        return self3;
      });
      function if_break_in_loop(self3, compressor) {
        var first = self3.body instanceof AST_BlockStatement ? self3.body.body[0] : self3.body;
        if (compressor.option("dead_code") && is_break(first)) {
          var body = [];
          if (self3.init instanceof AST_Statement) {
            body.push(self3.init);
          } else if (self3.init) {
            body.push(make_node(AST_SimpleStatement, self3.init, {
              body: self3.init
            }));
          }
          if (self3.condition) {
            body.push(make_node(AST_SimpleStatement, self3.condition, {
              body: self3.condition
            }));
          }
          extract_from_unreachable_code(compressor, self3.body, body);
          return make_node(AST_BlockStatement, self3, {
            body
          });
        }
        if (first instanceof AST_If) {
          if (is_break(first.body)) {
            if (self3.condition) {
              self3.condition = make_node(AST_Binary, self3.condition, {
                left: self3.condition,
                operator: "&&",
                right: first.condition.negate(compressor)
              });
            } else {
              self3.condition = first.condition.negate(compressor);
            }
            drop_it(first.alternative);
          } else if (is_break(first.alternative)) {
            if (self3.condition) {
              self3.condition = make_node(AST_Binary, self3.condition, {
                left: self3.condition,
                operator: "&&",
                right: first.condition
              });
            } else {
              self3.condition = first.condition;
            }
            drop_it(first.body);
          }
        }
        return self3;
        function is_break(node) {
          return node instanceof AST_Break && compressor.loopcontrol_target(node) === compressor.self();
        }
        function drop_it(rest) {
          rest = as_statement_array(rest);
          if (self3.body instanceof AST_BlockStatement) {
            self3.body = self3.body.clone();
            self3.body.body = rest.concat(self3.body.body.slice(1));
            self3.body = self3.body.transform(compressor);
          } else {
            self3.body = make_node(AST_BlockStatement, self3.body, {
              body: rest
            }).transform(compressor);
          }
          self3 = if_break_in_loop(self3, compressor);
        }
      }
      def_optimize(AST_For, function(self3, compressor) {
        if (!compressor.option("loops")) return self3;
        if (compressor.option("side_effects") && self3.init) {
          self3.init = self3.init.drop_side_effect_free(compressor);
        }
        if (self3.condition) {
          var cond = self3.condition.evaluate(compressor);
          if (!(cond instanceof AST_Node)) {
            if (cond) self3.condition = null;
            else if (!compressor.option("dead_code")) {
              var orig = self3.condition;
              self3.condition = make_node_from_constant(cond, self3.condition);
              self3.condition = best_of_expression(self3.condition.transform(compressor), orig);
            }
          }
          if (compressor.option("dead_code")) {
            if (cond instanceof AST_Node) cond = self3.condition.tail_node().evaluate(compressor);
            if (!cond) {
              var body = [];
              extract_from_unreachable_code(compressor, self3.body, body);
              if (self3.init instanceof AST_Statement) {
                body.push(self3.init);
              } else if (self3.init) {
                body.push(make_node(AST_SimpleStatement, self3.init, {
                  body: self3.init
                }));
              }
              body.push(make_node(AST_SimpleStatement, self3.condition, {
                body: self3.condition
              }));
              return make_node(AST_BlockStatement, self3, { body }).optimize(compressor);
            }
          }
        }
        return if_break_in_loop(self3, compressor);
      });
      def_optimize(AST_If, function(self3, compressor) {
        if (is_empty(self3.alternative)) self3.alternative = null;
        if (!compressor.option("conditionals")) return self3;
        var cond = self3.condition.evaluate(compressor);
        if (!compressor.option("dead_code") && !(cond instanceof AST_Node)) {
          var orig = self3.condition;
          self3.condition = make_node_from_constant(cond, orig);
          self3.condition = best_of_expression(self3.condition.transform(compressor), orig);
        }
        if (compressor.option("dead_code")) {
          if (cond instanceof AST_Node) cond = self3.condition.tail_node().evaluate(compressor);
          if (!cond) {
            var body = [];
            extract_from_unreachable_code(compressor, self3.body, body);
            body.push(make_node(AST_SimpleStatement, self3.condition, {
              body: self3.condition
            }));
            if (self3.alternative) body.push(self3.alternative);
            return make_node(AST_BlockStatement, self3, { body }).optimize(compressor);
          } else if (!(cond instanceof AST_Node)) {
            var body = [];
            body.push(make_node(AST_SimpleStatement, self3.condition, {
              body: self3.condition
            }));
            body.push(self3.body);
            if (self3.alternative) {
              extract_from_unreachable_code(compressor, self3.alternative, body);
            }
            return make_node(AST_BlockStatement, self3, { body }).optimize(compressor);
          }
        }
        var negated = self3.condition.negate(compressor);
        var self_condition_length = self3.condition.size();
        var negated_length = negated.size();
        var negated_is_best = negated_length < self_condition_length;
        if (self3.alternative && negated_is_best) {
          negated_is_best = false;
          self3.condition = negated;
          var tmp = self3.body;
          self3.body = self3.alternative || make_node(AST_EmptyStatement, self3);
          self3.alternative = tmp;
        }
        if (is_empty(self3.body) && is_empty(self3.alternative)) {
          return make_node(AST_SimpleStatement, self3.condition, {
            body: self3.condition.clone()
          }).optimize(compressor);
        }
        if (self3.body instanceof AST_SimpleStatement && self3.alternative instanceof AST_SimpleStatement) {
          return make_node(AST_SimpleStatement, self3, {
            body: make_node(AST_Conditional, self3, {
              condition: self3.condition,
              consequent: self3.body.body,
              alternative: self3.alternative.body
            })
          }).optimize(compressor);
        }
        if (is_empty(self3.alternative) && self3.body instanceof AST_SimpleStatement) {
          if (self_condition_length === negated_length && !negated_is_best && self3.condition instanceof AST_Binary && self3.condition.operator == "||") {
            negated_is_best = true;
          }
          if (negated_is_best) return make_node(AST_SimpleStatement, self3, {
            body: make_node(AST_Binary, self3, {
              operator: "||",
              left: negated,
              right: self3.body.body
            })
          }).optimize(compressor);
          return make_node(AST_SimpleStatement, self3, {
            body: make_node(AST_Binary, self3, {
              operator: "&&",
              left: self3.condition,
              right: self3.body.body
            })
          }).optimize(compressor);
        }
        if (self3.body instanceof AST_EmptyStatement && self3.alternative instanceof AST_SimpleStatement) {
          return make_node(AST_SimpleStatement, self3, {
            body: make_node(AST_Binary, self3, {
              operator: "||",
              left: self3.condition,
              right: self3.alternative.body
            })
          }).optimize(compressor);
        }
        if (self3.body instanceof AST_Exit && self3.alternative instanceof AST_Exit && self3.body.TYPE == self3.alternative.TYPE) {
          return make_node(self3.body.CTOR, self3, {
            value: make_node(AST_Conditional, self3, {
              condition: self3.condition,
              consequent: self3.body.value || make_node(AST_Undefined, self3.body),
              alternative: self3.alternative.value || make_node(AST_Undefined, self3.alternative)
            }).transform(compressor)
          }).optimize(compressor);
        }
        if (self3.body instanceof AST_If && !self3.body.alternative && !self3.alternative) {
          self3 = make_node(AST_If, self3, {
            condition: make_node(AST_Binary, self3.condition, {
              operator: "&&",
              left: self3.condition,
              right: self3.body.condition
            }),
            body: self3.body.body,
            alternative: null
          });
        }
        if (aborts(self3.body)) {
          if (self3.alternative) {
            var alt = self3.alternative;
            self3.alternative = null;
            return make_node(AST_BlockStatement, self3, {
              body: [self3, alt]
            }).optimize(compressor);
          }
        }
        if (aborts(self3.alternative)) {
          var body = self3.body;
          self3.body = self3.alternative;
          self3.condition = negated_is_best ? negated : self3.condition.negate(compressor);
          self3.alternative = null;
          return make_node(AST_BlockStatement, self3, {
            body: [self3, body]
          }).optimize(compressor);
        }
        return self3;
      });
      def_optimize(AST_Switch, function(self3, compressor) {
        if (!compressor.option("switches")) return self3;
        var branch2;
        var value2 = self3.expression.evaluate(compressor);
        if (!(value2 instanceof AST_Node)) {
          var orig = self3.expression;
          self3.expression = make_node_from_constant(value2, orig);
          self3.expression = best_of_expression(self3.expression.transform(compressor), orig);
        }
        if (!compressor.option("dead_code")) return self3;
        if (value2 instanceof AST_Node) {
          value2 = self3.expression.tail_node().evaluate(compressor);
        }
        var decl = [];
        var body = [];
        var default_branch;
        var exact_match;
        for (var i = 0, len = self3.body.length; i < len && !exact_match; i++) {
          branch2 = self3.body[i];
          if (branch2 instanceof AST_Default) {
            if (!default_branch) {
              default_branch = branch2;
            } else {
              eliminate_branch(branch2, body[body.length - 1]);
            }
          } else if (!(value2 instanceof AST_Node)) {
            var exp = branch2.expression.evaluate(compressor);
            if (!(exp instanceof AST_Node) && exp !== value2) {
              eliminate_branch(branch2, body[body.length - 1]);
              continue;
            }
            if (exp instanceof AST_Node && !exp.has_side_effects(compressor)) {
              exp = branch2.expression.tail_node().evaluate(compressor);
            }
            if (exp === value2) {
              exact_match = branch2;
              if (default_branch) {
                var default_index = body.indexOf(default_branch);
                body.splice(default_index, 1);
                eliminate_branch(default_branch, body[default_index - 1]);
                default_branch = null;
              }
            }
          }
          body.push(branch2);
        }
        while (i < len) eliminate_branch(self3.body[i++], body[body.length - 1]);
        self3.body = body;
        let default_or_exact = default_branch || exact_match;
        default_branch = null;
        exact_match = null;
        if (body.every((branch3, i2) => (branch3 === default_or_exact || branch3.expression instanceof AST_Constant) && (branch3.body.length === 0 || aborts(branch3) || body.length - 1 === i2))) {
          for (let i2 = 0; i2 < body.length; i2++) {
            const branch3 = body[i2];
            for (let j = i2 + 1; j < body.length; j++) {
              const next2 = body[j];
              if (next2.body.length === 0) continue;
              const last_branch = j === body.length - 1;
              const equivalentBranch = branches_equivalent(next2, branch3, false);
              if (equivalentBranch || last_branch && branches_equivalent(next2, branch3, true)) {
                if (!equivalentBranch && last_branch) {
                  next2.body.push(make_node(AST_Break));
                }
                let x = j - 1;
                let fallthroughDepth = 0;
                while (x > i2) {
                  if (is_inert_body(body[x--])) {
                    fallthroughDepth++;
                  } else {
                    break;
                  }
                }
                const plucked = body.splice(j - fallthroughDepth, 1 + fallthroughDepth);
                body.splice(i2 + 1, 0, ...plucked);
                i2 += plucked.length;
              }
            }
          }
        }
        for (let i2 = 0; i2 < body.length; i2++) {
          let branch3 = body[i2];
          if (branch3.body.length === 0) continue;
          if (!aborts(branch3)) continue;
          for (let j = i2 + 1; j < body.length; i2++, j++) {
            let next2 = body[j];
            if (next2.body.length === 0) continue;
            if (branches_equivalent(next2, branch3, false) || j === body.length - 1 && branches_equivalent(next2, branch3, true)) {
              branch3.body = [];
              branch3 = next2;
              continue;
            }
            break;
          }
        }
        {
          let i2 = body.length - 1;
          for (; i2 >= 0; i2--) {
            let bbody = body[i2].body;
            while (is_break(bbody[bbody.length - 1], compressor)) bbody.pop();
            if (!is_inert_body(body[i2])) break;
          }
          i2++;
          if (!default_or_exact || body.indexOf(default_or_exact) >= i2) {
            for (let j = body.length - 1; j >= i2; j--) {
              let branch3 = body[j];
              if (branch3 === default_or_exact) {
                default_or_exact = null;
                eliminate_branch(body.pop());
              } else if (!branch3.expression.has_side_effects(compressor)) {
                eliminate_branch(body.pop());
              } else {
                break;
              }
            }
          }
        }
        DEFAULT: if (default_or_exact) {
          let default_index2 = body.indexOf(default_or_exact);
          let default_body_index = default_index2;
          for (; default_body_index < body.length - 1; default_body_index++) {
            if (!is_inert_body(body[default_body_index])) break;
          }
          if (default_body_index < body.length - 1) {
            break DEFAULT;
          }
          let side_effect_index = body.length - 1;
          for (; side_effect_index >= 0; side_effect_index--) {
            let branch3 = body[side_effect_index];
            if (branch3 === default_or_exact) continue;
            if (branch3.expression.has_side_effects(compressor)) break;
          }
          if (default_body_index > side_effect_index) {
            let prev_body_index = default_index2 - 1;
            for (; prev_body_index >= 0; prev_body_index--) {
              if (!is_inert_body(body[prev_body_index])) break;
            }
            let before = Math.max(side_effect_index, prev_body_index) + 1;
            let after = default_index2;
            if (side_effect_index > default_index2) {
              after = side_effect_index;
              body[side_effect_index].body = body[default_body_index].body;
            } else {
              default_or_exact.body = body[default_body_index].body;
            }
            body.splice(after + 1, default_body_index - after);
            body.splice(before, default_index2 - before);
          }
        }
        DEFAULT: if (default_or_exact) {
          let i2 = body.findIndex((branch3) => !is_inert_body(branch3));
          let caseBody;
          if (i2 === body.length - 1) {
            let branch3 = body[i2];
            if (has_nested_break(self3)) break DEFAULT;
            caseBody = make_node(AST_BlockStatement, branch3, {
              body: branch3.body
            });
            branch3.body = [];
          } else if (i2 !== -1) {
            break DEFAULT;
          }
          let sideEffect = body.find(
            (branch3) => branch3 !== default_or_exact && branch3.expression.has_side_effects(compressor)
          );
          if (!sideEffect) {
            return make_node(AST_BlockStatement, self3, {
              body: decl.concat(
                statement(self3.expression),
                default_or_exact.expression ? statement(default_or_exact.expression) : [],
                caseBody || []
              )
            }).optimize(compressor);
          }
          const default_index2 = body.indexOf(default_or_exact);
          body.splice(default_index2, 1);
          default_or_exact = null;
          if (caseBody) {
            return make_node(AST_BlockStatement, self3, {
              body: decl.concat(self3, caseBody)
            }).optimize(compressor);
          }
        }
        if (body.length > 0) {
          body[0].body = decl.concat(body[0].body);
        }
        if (body.length == 0) {
          return make_node(AST_BlockStatement, self3, {
            body: decl.concat(statement(self3.expression))
          }).optimize(compressor);
        }
        if (body.length == 1 && !has_nested_break(self3)) {
          let branch3 = body[0];
          return make_node(AST_If, self3, {
            condition: make_node(AST_Binary, self3, {
              operator: "===",
              left: self3.expression,
              right: branch3.expression
            }),
            body: make_node(AST_BlockStatement, branch3, {
              body: branch3.body
            }),
            alternative: null
          }).optimize(compressor);
        }
        if (body.length === 2 && default_or_exact && !has_nested_break(self3)) {
          let branch3 = body[0] === default_or_exact ? body[1] : body[0];
          let exact_exp = default_or_exact.expression && statement(default_or_exact.expression);
          if (aborts(body[0])) {
            let first = body[0];
            if (is_break(first.body[first.body.length - 1], compressor)) {
              first.body.pop();
            }
            return make_node(AST_If, self3, {
              condition: make_node(AST_Binary, self3, {
                operator: "===",
                left: self3.expression,
                right: branch3.expression
              }),
              body: make_node(AST_BlockStatement, branch3, {
                body: branch3.body
              }),
              alternative: make_node(AST_BlockStatement, default_or_exact, {
                body: [].concat(
                  exact_exp || [],
                  default_or_exact.body
                )
              })
            }).optimize(compressor);
          }
          let operator = "===";
          let consequent = make_node(AST_BlockStatement, branch3, {
            body: branch3.body
          });
          let always = make_node(AST_BlockStatement, default_or_exact, {
            body: [].concat(
              exact_exp || [],
              default_or_exact.body
            )
          });
          if (body[0] === default_or_exact) {
            operator = "!==";
            let tmp = always;
            always = consequent;
            consequent = tmp;
          }
          return make_node(AST_BlockStatement, self3, {
            body: [
              make_node(AST_If, self3, {
                condition: make_node(AST_Binary, self3, {
                  operator,
                  left: self3.expression,
                  right: branch3.expression
                }),
                body: consequent,
                alternative: null
              }),
              always
            ]
          }).optimize(compressor);
        }
        return self3;
        function eliminate_branch(branch3, prev) {
          if (prev && !aborts(prev)) {
            prev.body = prev.body.concat(branch3.body);
          } else {
            extract_from_unreachable_code(compressor, branch3, decl);
          }
        }
        function branches_equivalent(branch3, prev, insertBreak) {
          let bbody = branch3.body;
          let pbody = prev.body;
          if (insertBreak) {
            bbody = bbody.concat(make_node(AST_Break));
          }
          if (bbody.length !== pbody.length) return false;
          let bblock = make_node(AST_BlockStatement, branch3, { body: bbody });
          let pblock = make_node(AST_BlockStatement, prev, { body: pbody });
          return bblock.equivalent_to(pblock);
        }
        function statement(body2) {
          return make_node(AST_SimpleStatement, body2, { body: body2 });
        }
        function has_nested_break(root5) {
          let has_break = false;
          let tw = new TreeWalker((node) => {
            if (has_break) return true;
            if (node instanceof AST_Lambda) return true;
            if (node instanceof AST_SimpleStatement) return true;
            if (!is_break(node, tw)) return;
            let parent = tw.parent();
            if (parent instanceof AST_SwitchBranch && parent.body[parent.body.length - 1] === node) {
              return;
            }
            has_break = true;
          });
          root5.walk(tw);
          return has_break;
        }
        function is_break(node, stack2) {
          return node instanceof AST_Break && stack2.loopcontrol_target(node) === self3;
        }
        function is_inert_body(branch3) {
          return !aborts(branch3) && !make_node(AST_BlockStatement, branch3, {
            body: branch3.body
          }).has_side_effects(compressor);
        }
      });
      def_optimize(AST_Try, function(self3, compressor) {
        if (self3.bcatch && self3.bfinally && self3.bfinally.body.every(is_empty)) self3.bfinally = null;
        if (compressor.option("dead_code") && self3.body.body.every(is_empty)) {
          var body = [];
          if (self3.bcatch) {
            extract_from_unreachable_code(compressor, self3.bcatch, body);
          }
          if (self3.bfinally) body.push(...self3.bfinally.body);
          return make_node(AST_BlockStatement, self3, {
            body
          }).optimize(compressor);
        }
        return self3;
      });
      AST_Definitions.DEFMETHOD("to_assignments", function(compressor) {
        var reduce_vars = compressor.option("reduce_vars");
        var assignments = [];
        for (const def of this.definitions) {
          if (def.value) {
            var name = make_node(AST_SymbolRef, def.name, def.name);
            assignments.push(make_node(AST_Assign, def, {
              operator: "=",
              logical: false,
              left: name,
              right: def.value
            }));
            if (reduce_vars) name.definition().fixed = false;
          }
          const thedef = def.name.definition();
          thedef.eliminated++;
          thedef.replaced--;
        }
        if (assignments.length == 0) return null;
        return make_sequence(this, assignments);
      });
      def_optimize(AST_Definitions, function(self3) {
        if (self3.definitions.length == 0) {
          return make_node(AST_EmptyStatement, self3);
        }
        return self3;
      });
      def_optimize(AST_VarDef, function(self3, compressor) {
        if (self3.name instanceof AST_SymbolLet && self3.value != null && is_undefined(self3.value, compressor)) {
          self3.value = null;
        }
        return self3;
      });
      def_optimize(AST_Import, function(self3) {
        return self3;
      });
      def_optimize(AST_Call, function(self3, compressor) {
        var exp = self3.expression;
        var fn = exp;
        inline_array_like_spread(self3.args);
        var simple_args = self3.args.every((arg2) => !(arg2 instanceof AST_Expansion));
        if (compressor.option("reduce_vars") && fn instanceof AST_SymbolRef) {
          fn = fn.fixed_value();
        }
        var is_func = fn instanceof AST_Lambda;
        if (is_func && fn.pinned()) return self3;
        if (compressor.option("unused") && simple_args && is_func && !fn.uses_arguments) {
          var pos2 = 0, last = 0;
          for (var i = 0, len = self3.args.length; i < len; i++) {
            if (fn.argnames[i] instanceof AST_Expansion) {
              if (has_flag(fn.argnames[i].expression, UNUSED)) while (i < len) {
                var node = self3.args[i++].drop_side_effect_free(compressor);
                if (node) {
                  self3.args[pos2++] = node;
                }
              }
              else while (i < len) {
                self3.args[pos2++] = self3.args[i++];
              }
              last = pos2;
              break;
            }
            var trim2 = i >= fn.argnames.length;
            if (trim2 || has_flag(fn.argnames[i], UNUSED)) {
              var node = self3.args[i].drop_side_effect_free(compressor);
              if (node) {
                self3.args[pos2++] = node;
              } else if (!trim2) {
                self3.args[pos2++] = make_node(AST_Number, self3.args[i], {
                  value: 0
                });
                continue;
              }
            } else {
              self3.args[pos2++] = self3.args[i];
            }
            last = pos2;
          }
          self3.args.length = last;
        }
        if (exp instanceof AST_Dot && exp.expression instanceof AST_SymbolRef && exp.expression.name === "console" && exp.expression.definition().undeclared && exp.property === "assert") {
          const condition = self3.args[0];
          if (condition) {
            const value3 = condition.evaluate(compressor);
            if (value3 === 1 || value3 === true) {
              return make_node(AST_Undefined, self3);
            }
          }
        }
        if (compressor.option("unsafe") && !exp.contains_optional()) {
          if (exp instanceof AST_Dot && exp.start.value === "Array" && exp.property === "from" && self3.args.length === 1) {
            const [argument] = self3.args;
            if (argument instanceof AST_Array) {
              return make_node(AST_Array, argument, {
                elements: argument.elements
              }).optimize(compressor);
            }
          }
          if (is_undeclared_ref(exp)) switch (exp.name) {
            case "Array":
              if (self3.args.length != 1) {
                return make_node(AST_Array, self3, {
                  elements: self3.args
                }).optimize(compressor);
              } else if (self3.args[0] instanceof AST_Number && self3.args[0].value <= 11) {
                const elements2 = [];
                for (let i2 = 0; i2 < self3.args[0].value; i2++) elements2.push(new AST_Hole());
                return new AST_Array({ elements: elements2 });
              }
              break;
            case "Object":
              if (self3.args.length == 0) {
                return make_node(AST_Object, self3, {
                  properties: []
                });
              }
              break;
            case "String":
              if (self3.args.length == 0) return make_node(AST_String, self3, {
                value: ""
              });
              if (self3.args.length <= 1) return make_node(AST_Binary, self3, {
                left: self3.args[0],
                operator: "+",
                right: make_node(AST_String, self3, { value: "" })
              }).optimize(compressor);
              break;
            case "Number":
              if (self3.args.length == 0) return make_node(AST_Number, self3, {
                value: 0
              });
              if (self3.args.length == 1 && compressor.option("unsafe_math")) {
                return make_node(AST_UnaryPrefix, self3, {
                  expression: self3.args[0],
                  operator: "+"
                }).optimize(compressor);
              }
              break;
            case "Symbol":
              if (self3.args.length == 1 && self3.args[0] instanceof AST_String && compressor.option("unsafe_symbols"))
                self3.args.length = 0;
              break;
            case "Boolean":
              if (self3.args.length == 0) return make_node(AST_False, self3);
              if (self3.args.length == 1) return make_node(AST_UnaryPrefix, self3, {
                expression: make_node(AST_UnaryPrefix, self3, {
                  expression: self3.args[0],
                  operator: "!"
                }),
                operator: "!"
              }).optimize(compressor);
              break;
            case "RegExp":
              var params = [];
              if (self3.args.length >= 1 && self3.args.length <= 2 && self3.args.every((arg2) => {
                var value3 = arg2.evaluate(compressor);
                params.push(value3);
                return arg2 !== value3;
              }) && regexp_is_safe(params[0])) {
                let [source2, flags2] = params;
                source2 = regexp_source_fix(new RegExp(source2).source);
                const rx = make_node(AST_RegExp, self3, {
                  value: { source: source2, flags: flags2 }
                });
                if (rx._eval(compressor) !== rx) {
                  return rx;
                }
              }
              break;
          }
          else if (exp instanceof AST_Dot) switch (exp.property) {
            case "toString":
              if (self3.args.length == 0 && !exp.expression.may_throw_on_access(compressor)) {
                return make_node(AST_Binary, self3, {
                  left: make_node(AST_String, self3, { value: "" }),
                  operator: "+",
                  right: exp.expression
                }).optimize(compressor);
              }
              break;
            case "join":
              if (exp.expression instanceof AST_Array) EXIT: {
                var separator;
                if (self3.args.length > 0) {
                  separator = self3.args[0].evaluate(compressor);
                  if (separator === self3.args[0]) break EXIT;
                }
                var elements = [];
                var consts = [];
                for (var i = 0, len = exp.expression.elements.length; i < len; i++) {
                  var el = exp.expression.elements[i];
                  if (el instanceof AST_Expansion) break EXIT;
                  var value2 = el.evaluate(compressor);
                  if (value2 !== el) {
                    consts.push(value2);
                  } else {
                    if (consts.length > 0) {
                      elements.push(make_node(AST_String, self3, {
                        value: consts.join(separator)
                      }));
                      consts.length = 0;
                    }
                    elements.push(el);
                  }
                }
                if (consts.length > 0) {
                  elements.push(make_node(AST_String, self3, {
                    value: consts.join(separator)
                  }));
                }
                if (elements.length == 0) return make_node(AST_String, self3, { value: "" });
                if (elements.length == 1) {
                  if (elements[0].is_string(compressor)) {
                    return elements[0];
                  }
                  return make_node(AST_Binary, elements[0], {
                    operator: "+",
                    left: make_node(AST_String, self3, { value: "" }),
                    right: elements[0]
                  });
                }
                if (separator == "") {
                  var first;
                  if (elements[0].is_string(compressor) || elements[1].is_string(compressor)) {
                    first = elements.shift();
                  } else {
                    first = make_node(AST_String, self3, { value: "" });
                  }
                  return elements.reduce(function(prev, el2) {
                    return make_node(AST_Binary, el2, {
                      operator: "+",
                      left: prev,
                      right: el2
                    });
                  }, first).optimize(compressor);
                }
                var node = self3.clone();
                node.expression = node.expression.clone();
                node.expression.expression = node.expression.expression.clone();
                node.expression.expression.elements = elements;
                return best_of(compressor, self3, node);
              }
              break;
            case "charAt":
              if (exp.expression.is_string(compressor)) {
                var arg = self3.args[0];
                var index6 = arg ? arg.evaluate(compressor) : 0;
                if (index6 !== arg) {
                  return make_node(AST_Sub, exp, {
                    expression: exp.expression,
                    property: make_node_from_constant(index6 | 0, arg || exp)
                  }).optimize(compressor);
                }
              }
              break;
            case "apply":
              if (self3.args.length == 2 && self3.args[1] instanceof AST_Array) {
                var args = self3.args[1].elements.slice();
                args.unshift(self3.args[0]);
                return make_node(AST_Call, self3, {
                  expression: make_node(AST_Dot, exp, {
                    expression: exp.expression,
                    optional: false,
                    property: "call"
                  }),
                  args
                }).optimize(compressor);
              }
              break;
            case "call":
              var func = exp.expression;
              if (func instanceof AST_SymbolRef) {
                func = func.fixed_value();
              }
              if (func instanceof AST_Lambda && !func.contains_this()) {
                return (self3.args.length ? make_sequence(this, [
                  self3.args[0],
                  make_node(AST_Call, self3, {
                    expression: exp.expression,
                    args: self3.args.slice(1)
                  })
                ]) : make_node(AST_Call, self3, {
                  expression: exp.expression,
                  args: []
                })).optimize(compressor);
              }
              break;
          }
        }
        if (compressor.option("unsafe_Function") && is_undeclared_ref(exp) && exp.name == "Function") {
          if (self3.args.length == 0) return make_empty_function(self3).optimize(compressor);
          if (self3.args.every((x) => x instanceof AST_String)) {
            try {
              var code = "n(function(" + self3.args.slice(0, -1).map(function(arg2) {
                return arg2.value;
              }).join(",") + "){" + self3.args[self3.args.length - 1].value + "})";
              var ast = parse2(code);
              var mangle = compressor.mangle_options();
              ast.figure_out_scope(mangle);
              var comp = new Compressor(compressor.options, {
                mangle_options: compressor._mangle_options
              });
              ast = ast.transform(comp);
              ast.figure_out_scope(mangle);
              ast.compute_char_frequency(mangle);
              ast.mangle_names(mangle);
              var fun;
              walk(ast, (node2) => {
                if (is_func_expr(node2)) {
                  fun = node2;
                  return walk_abort;
                }
              });
              var code = OutputStream();
              AST_BlockStatement.prototype._codegen.call(fun, fun, code);
              self3.args = [
                make_node(AST_String, self3, {
                  value: fun.argnames.map(function(arg2) {
                    return arg2.print_to_string();
                  }).join(",")
                }),
                make_node(AST_String, self3.args[self3.args.length - 1], {
                  value: code.get().replace(/^{|}$/g, "")
                })
              ];
              return self3;
            } catch (ex) {
              if (!(ex instanceof JS_Parse_Error)) {
                throw ex;
              }
            }
          }
        }
        return inline_into_call(self3, compressor);
      });
      AST_Node.DEFMETHOD("contains_optional", function() {
        if (this instanceof AST_PropAccess || this instanceof AST_Call || this instanceof AST_Chain) {
          if (this.optional) {
            return true;
          } else {
            return this.expression.contains_optional();
          }
        } else {
          return false;
        }
      });
      def_optimize(AST_New, function(self3, compressor) {
        if (compressor.option("unsafe") && is_undeclared_ref(self3.expression) && ["Object", "RegExp", "Function", "Error", "Array"].includes(self3.expression.name)) return make_node(AST_Call, self3, self3).transform(compressor);
        return self3;
      });
      def_optimize(AST_Sequence, function(self3, compressor) {
        if (!compressor.option("side_effects")) return self3;
        var expressions = [];
        filter_for_side_effects();
        var end = expressions.length - 1;
        trim_right_for_undefined();
        if (end == 0) {
          self3 = maintain_this_binding(compressor.parent(), compressor.self(), expressions[0]);
          if (!(self3 instanceof AST_Sequence)) self3 = self3.optimize(compressor);
          return self3;
        }
        self3.expressions = expressions;
        return self3;
        function filter_for_side_effects() {
          var first = first_in_statement(compressor);
          var last = self3.expressions.length - 1;
          self3.expressions.forEach(function(expr, index6) {
            if (index6 < last) expr = expr.drop_side_effect_free(compressor, first);
            if (expr) {
              merge_sequence(expressions, expr);
              first = false;
            }
          });
        }
        function trim_right_for_undefined() {
          while (end > 0 && is_undefined(expressions[end], compressor)) end--;
          if (end < expressions.length - 1) {
            expressions[end] = make_node(AST_UnaryPrefix, self3, {
              operator: "void",
              expression: expressions[end]
            });
            expressions.length = end + 1;
          }
        }
      });
      AST_Unary.DEFMETHOD("lift_sequences", function(compressor) {
        if (compressor.option("sequences")) {
          if (this.expression instanceof AST_Sequence) {
            var x = this.expression.expressions.slice();
            var e2 = this.clone();
            e2.expression = x.pop();
            x.push(e2);
            return make_sequence(this, x).optimize(compressor);
          }
        }
        return this;
      });
      def_optimize(AST_UnaryPostfix, function(self3, compressor) {
        return self3.lift_sequences(compressor);
      });
      def_optimize(AST_UnaryPrefix, function(self3, compressor) {
        var e2 = self3.expression;
        if (self3.operator == "delete" && !(e2 instanceof AST_SymbolRef || e2 instanceof AST_PropAccess || e2 instanceof AST_Chain || is_identifier_atom(e2))) {
          return make_sequence(self3, [e2, make_node(AST_True, self3)]).optimize(compressor);
        }
        var seq = self3.lift_sequences(compressor);
        if (seq !== self3) {
          return seq;
        }
        if (compressor.option("side_effects") && self3.operator == "void") {
          e2 = e2.drop_side_effect_free(compressor);
          if (e2) {
            self3.expression = e2;
            return self3;
          } else {
            return make_node(AST_Undefined, self3).optimize(compressor);
          }
        }
        if (compressor.in_boolean_context()) {
          switch (self3.operator) {
            case "!":
              if (e2 instanceof AST_UnaryPrefix && e2.operator == "!") {
                return e2.expression;
              }
              if (e2 instanceof AST_Binary) {
                self3 = best_of(compressor, self3, e2.negate(compressor, first_in_statement(compressor)));
              }
              break;
            case "typeof":
              return (e2 instanceof AST_SymbolRef ? make_node(AST_True, self3) : make_sequence(self3, [
                e2,
                make_node(AST_True, self3)
              ])).optimize(compressor);
          }
        }
        if (self3.operator == "-" && e2 instanceof AST_Infinity) {
          e2 = e2.transform(compressor);
        }
        if (e2 instanceof AST_Binary && (self3.operator == "+" || self3.operator == "-") && (e2.operator == "*" || e2.operator == "/" || e2.operator == "%")) {
          return make_node(AST_Binary, self3, {
            operator: e2.operator,
            left: make_node(AST_UnaryPrefix, e2.left, {
              operator: self3.operator,
              expression: e2.left
            }),
            right: e2.right
          });
        }
        if (compressor.option("evaluate")) {
          if (self3.operator === "~" && self3.expression instanceof AST_UnaryPrefix && self3.expression.operator === "~" && (compressor.in_32_bit_context(false) || self3.expression.expression.is_32_bit_integer(compressor))) {
            return self3.expression.expression;
          }
          if (self3.operator === "~" && e2 instanceof AST_Binary && e2.operator === "^") {
            if (e2.left instanceof AST_UnaryPrefix && e2.left.operator === "~") {
              e2.left = e2.left.bitwise_negate(compressor, true);
            } else {
              e2.right = e2.right.bitwise_negate(compressor, true);
            }
            return e2;
          }
        }
        if (self3.operator != "-" || !(e2 instanceof AST_Number || e2 instanceof AST_Infinity || e2 instanceof AST_BigInt)) {
          var ev = self3.evaluate(compressor);
          if (ev !== self3) {
            ev = make_node_from_constant(ev, self3).optimize(compressor);
            return best_of(compressor, ev, self3);
          }
        }
        return self3;
      });
      AST_Binary.DEFMETHOD("lift_sequences", function(compressor) {
        if (compressor.option("sequences")) {
          if (this.left instanceof AST_Sequence) {
            var x = this.left.expressions.slice();
            var e2 = this.clone();
            e2.left = x.pop();
            x.push(e2);
            return make_sequence(this, x).optimize(compressor);
          }
          if (this.right instanceof AST_Sequence && !this.left.has_side_effects(compressor)) {
            var assign2 = this.operator == "=" && this.left instanceof AST_SymbolRef;
            var x = this.right.expressions;
            var last = x.length - 1;
            for (var i = 0; i < last; i++) {
              if (!assign2 && x[i].has_side_effects(compressor)) break;
            }
            if (i == last) {
              x = x.slice();
              var e2 = this.clone();
              e2.right = x.pop();
              x.push(e2);
              return make_sequence(this, x).optimize(compressor);
            } else if (i > 0) {
              var e2 = this.clone();
              e2.right = make_sequence(this.right, x.slice(i));
              x = x.slice(0, i);
              x.push(e2);
              return make_sequence(this, x).optimize(compressor);
            }
          }
        }
        return this;
      });
      var commutativeOperators = makePredicate("== === != !== * & | ^");
      function is_object(node) {
        return node instanceof AST_Array || node instanceof AST_Lambda || node instanceof AST_Object || node instanceof AST_Class;
      }
      def_optimize(AST_Binary, function(self3, compressor) {
        function reversible() {
          return self3.left.is_constant() || self3.right.is_constant() || !self3.left.has_side_effects(compressor) && !self3.right.has_side_effects(compressor);
        }
        function reverse(op) {
          if (reversible()) {
            if (op) self3.operator = op;
            var tmp = self3.left;
            self3.left = self3.right;
            self3.right = tmp;
          }
        }
        if (compressor.option("lhs_constants") && commutativeOperators.has(self3.operator)) {
          if (self3.right.is_constant() && !self3.left.is_constant()) {
            if (!(self3.left instanceof AST_Binary && PRECEDENCE[self3.left.operator] >= PRECEDENCE[self3.operator])) {
              reverse();
            }
          }
        }
        self3 = self3.lift_sequences(compressor);
        if (compressor.option("comparisons")) switch (self3.operator) {
          case "===":
          case "!==":
            var is_strict_comparison = true;
            if (self3.left.is_string(compressor) && self3.right.is_string(compressor) || self3.left.is_number(compressor) && self3.right.is_number(compressor) || self3.left.is_bigint(compressor) && self3.right.is_bigint(compressor) || self3.left.is_boolean() && self3.right.is_boolean() || self3.left.equivalent_to(self3.right)) {
              self3.operator = self3.operator.substr(0, 2);
            }
          // XXX: intentionally falling down to the next case
          case "==":
          case "!=":
            if (!is_strict_comparison && is_undefined(self3.left, compressor)) {
              self3.left = make_node(AST_Null, self3.left);
            } else if (!is_strict_comparison && is_undefined(self3.right, compressor)) {
              self3.right = make_node(AST_Null, self3.right);
            } else if (compressor.option("typeofs") && self3.left instanceof AST_String && self3.left.value == "undefined" && self3.right instanceof AST_UnaryPrefix && self3.right.operator == "typeof") {
              var expr = self3.right.expression;
              if (expr instanceof AST_SymbolRef ? expr.is_declared(compressor) : !(expr instanceof AST_PropAccess && compressor.option("ie8"))) {
                self3.right = expr;
                self3.left = make_node(AST_Undefined, self3.left).optimize(compressor);
                if (self3.operator.length == 2) self3.operator += "=";
              }
            } else if (compressor.option("typeofs") && self3.left instanceof AST_UnaryPrefix && self3.left.operator == "typeof" && self3.right instanceof AST_String && self3.right.value == "undefined") {
              var expr = self3.left.expression;
              if (expr instanceof AST_SymbolRef ? expr.is_declared(compressor) : !(expr instanceof AST_PropAccess && compressor.option("ie8"))) {
                self3.left = expr;
                self3.right = make_node(AST_Undefined, self3.right).optimize(compressor);
                if (self3.operator.length == 2) self3.operator += "=";
              }
            } else if (self3.left instanceof AST_SymbolRef && self3.right instanceof AST_SymbolRef && self3.left.definition() === self3.right.definition() && is_object(self3.left.fixed_value())) {
              return make_node(self3.operator[0] == "=" ? AST_True : AST_False, self3);
            } else if (self3.left.is_32_bit_integer(compressor) && self3.right.is_32_bit_integer(compressor)) {
              const not = (node) => make_node(AST_UnaryPrefix, node, {
                operator: "!",
                expression: node
              });
              const booleanify = (node, truthy) => {
                if (truthy) {
                  return compressor.in_boolean_context() ? node : not(not(node));
                } else {
                  return not(node);
                }
              };
              if (self3.left instanceof AST_Number && self3.left.value === 0) {
                return booleanify(self3.right, self3.operator[0] === "!");
              }
              if (self3.right instanceof AST_Number && self3.right.value === 0) {
                return booleanify(self3.left, self3.operator[0] === "!");
              }
              let and_op, x, mask;
              if ((and_op = self3.left instanceof AST_Binary ? self3.left : self3.right instanceof AST_Binary ? self3.right : null) && (mask = and_op === self3.left ? self3.right : self3.left) && and_op.operator === "&" && mask instanceof AST_Number && mask.is_32_bit_integer(compressor) && (x = and_op.left.equivalent_to(mask) ? and_op.right : and_op.right.equivalent_to(mask) ? and_op.left : null)) {
                let optimized = booleanify(make_node(AST_Binary, self3, {
                  operator: "&",
                  left: mask,
                  right: make_node(AST_UnaryPrefix, self3, {
                    operator: "~",
                    expression: x
                  })
                }), self3.operator[0] === "!");
                return best_of(compressor, optimized, self3);
              }
            }
            break;
          case "&&":
          case "||":
            var lhs = self3.left;
            if (lhs.operator == self3.operator) {
              lhs = lhs.right;
            }
            if (lhs instanceof AST_Binary && lhs.operator == (self3.operator == "&&" ? "!==" : "===") && self3.right instanceof AST_Binary && lhs.operator == self3.right.operator && (is_undefined(lhs.left, compressor) && self3.right.left instanceof AST_Null || lhs.left instanceof AST_Null && is_undefined(self3.right.left, compressor)) && !lhs.right.has_side_effects(compressor) && lhs.right.equivalent_to(self3.right.right)) {
              var combined = make_node(AST_Binary, self3, {
                operator: lhs.operator.slice(0, -1),
                left: make_node(AST_Null, self3),
                right: lhs.right
              });
              if (lhs !== self3.left) {
                combined = make_node(AST_Binary, self3, {
                  operator: self3.operator,
                  left: self3.left.left,
                  right: combined
                });
              }
              return combined;
            }
            break;
        }
        if (self3.operator == "+" && compressor.in_boolean_context()) {
          var ll = self3.left.evaluate(compressor);
          var rr = self3.right.evaluate(compressor);
          if (ll && typeof ll == "string") {
            return make_sequence(self3, [
              self3.right,
              make_node(AST_True, self3)
            ]).optimize(compressor);
          }
          if (rr && typeof rr == "string") {
            return make_sequence(self3, [
              self3.left,
              make_node(AST_True, self3)
            ]).optimize(compressor);
          }
        }
        if (compressor.option("comparisons") && self3.is_boolean()) {
          if (!(compressor.parent() instanceof AST_Binary) || compressor.parent() instanceof AST_Assign) {
            var negated = make_node(AST_UnaryPrefix, self3, {
              operator: "!",
              expression: self3.negate(compressor, first_in_statement(compressor))
            });
            self3 = best_of(compressor, self3, negated);
          }
          if (compressor.option("unsafe_comps")) {
            switch (self3.operator) {
              case "<":
                reverse(">");
                break;
              case "<=":
                reverse(">=");
                break;
            }
          }
        }
        if (self3.operator == "+") {
          if (self3.right instanceof AST_String && self3.right.getValue() == "" && self3.left.is_string(compressor)) {
            return self3.left;
          }
          if (self3.left instanceof AST_String && self3.left.getValue() == "" && self3.right.is_string(compressor)) {
            return self3.right;
          }
          if (self3.left instanceof AST_Binary && self3.left.operator == "+" && self3.left.left instanceof AST_String && self3.left.left.getValue() == "" && self3.right.is_string(compressor)) {
            self3.left = self3.left.right;
            return self3;
          }
        }
        if (compressor.option("evaluate")) {
          switch (self3.operator) {
            case "&&":
              var ll = has_flag(self3.left, TRUTHY) ? true : has_flag(self3.left, FALSY) ? false : self3.left.evaluate(compressor);
              if (!ll) {
                return maintain_this_binding(compressor.parent(), compressor.self(), self3.left).optimize(compressor);
              } else if (!(ll instanceof AST_Node)) {
                return make_sequence(self3, [self3.left, self3.right]).optimize(compressor);
              }
              var rr = self3.right.evaluate(compressor);
              if (!rr) {
                if (compressor.in_boolean_context()) {
                  return make_sequence(self3, [
                    self3.left,
                    make_node(AST_False, self3)
                  ]).optimize(compressor);
                } else {
                  set_flag(self3, FALSY);
                }
              } else if (!(rr instanceof AST_Node)) {
                var parent = compressor.parent();
                if (parent.operator == "&&" && parent.left === compressor.self() || compressor.in_boolean_context()) {
                  return self3.left.optimize(compressor);
                }
              }
              if (self3.left.operator == "||") {
                var lr = self3.left.right.evaluate(compressor);
                if (!lr) return make_node(AST_Conditional, self3, {
                  condition: self3.left.left,
                  consequent: self3.right,
                  alternative: self3.left.right
                }).optimize(compressor);
              }
              break;
            case "||":
              var ll = has_flag(self3.left, TRUTHY) ? true : has_flag(self3.left, FALSY) ? false : self3.left.evaluate(compressor);
              if (!ll) {
                return make_sequence(self3, [self3.left, self3.right]).optimize(compressor);
              } else if (!(ll instanceof AST_Node)) {
                return maintain_this_binding(compressor.parent(), compressor.self(), self3.left).optimize(compressor);
              }
              var rr = self3.right.evaluate(compressor);
              if (!rr) {
                var parent = compressor.parent();
                if (parent.operator == "||" && parent.left === compressor.self() || compressor.in_boolean_context()) {
                  return self3.left.optimize(compressor);
                }
              } else if (!(rr instanceof AST_Node)) {
                if (compressor.in_boolean_context()) {
                  return make_sequence(self3, [
                    self3.left,
                    make_node(AST_True, self3)
                  ]).optimize(compressor);
                } else {
                  set_flag(self3, TRUTHY);
                }
              }
              if (self3.left.operator == "&&") {
                var lr = self3.left.right.evaluate(compressor);
                if (lr && !(lr instanceof AST_Node)) return make_node(AST_Conditional, self3, {
                  condition: self3.left.left,
                  consequent: self3.left.right,
                  alternative: self3.right
                }).optimize(compressor);
              }
              break;
            case "??":
              if (is_nullish(self3.left, compressor)) {
                return self3.right;
              }
              var ll = self3.left.evaluate(compressor);
              if (!(ll instanceof AST_Node)) {
                return ll == null ? self3.right : self3.left;
              }
              if (compressor.in_boolean_context()) {
                const rr2 = self3.right.evaluate(compressor);
                if (!(rr2 instanceof AST_Node) && !rr2) {
                  return self3.left;
                }
              }
          }
          var associative = true;
          switch (self3.operator) {
            case "+":
              if (self3.right instanceof AST_Constant && self3.left instanceof AST_Binary && self3.left.operator == "+" && self3.left.is_string(compressor)) {
                var binary = make_node(AST_Binary, self3, {
                  operator: "+",
                  left: self3.left.right,
                  right: self3.right
                });
                var r = binary.optimize(compressor);
                if (binary !== r) {
                  self3 = make_node(AST_Binary, self3, {
                    operator: "+",
                    left: self3.left.left,
                    right: r
                  });
                }
              }
              if (self3.left instanceof AST_Binary && self3.left.operator == "+" && self3.left.is_string(compressor) && self3.right instanceof AST_Binary && self3.right.operator == "+" && self3.right.is_string(compressor)) {
                var binary = make_node(AST_Binary, self3, {
                  operator: "+",
                  left: self3.left.right,
                  right: self3.right.left
                });
                var m2 = binary.optimize(compressor);
                if (binary !== m2) {
                  self3 = make_node(AST_Binary, self3, {
                    operator: "+",
                    left: make_node(AST_Binary, self3.left, {
                      operator: "+",
                      left: self3.left.left,
                      right: m2
                    }),
                    right: self3.right.right
                  });
                }
              }
              if (self3.right instanceof AST_UnaryPrefix && self3.right.operator == "-" && self3.left.is_number_or_bigint(compressor)) {
                self3 = make_node(AST_Binary, self3, {
                  operator: "-",
                  left: self3.left,
                  right: self3.right.expression
                });
                break;
              }
              if (self3.left instanceof AST_UnaryPrefix && self3.left.operator == "-" && reversible() && self3.right.is_number_or_bigint(compressor)) {
                self3 = make_node(AST_Binary, self3, {
                  operator: "-",
                  left: self3.right,
                  right: self3.left.expression
                });
                break;
              }
              if (self3.left instanceof AST_TemplateString) {
                var l = self3.left;
                var r = self3.right.evaluate(compressor);
                if (r != self3.right) {
                  l.segments[l.segments.length - 1].value += String(r);
                  return l;
                }
              }
              if (self3.right instanceof AST_TemplateString) {
                var r = self3.right;
                var l = self3.left.evaluate(compressor);
                if (l != self3.left) {
                  r.segments[0].value = String(l) + r.segments[0].value;
                  return r;
                }
              }
              if (self3.left instanceof AST_TemplateString && self3.right instanceof AST_TemplateString) {
                var l = self3.left;
                var segments = l.segments;
                var r = self3.right;
                segments[segments.length - 1].value += r.segments[0].value;
                for (var i = 1; i < r.segments.length; i++) {
                  segments.push(r.segments[i]);
                }
                return l;
              }
            case "*":
              associative = compressor.option("unsafe_math");
            case "&":
            case "|":
            case "^":
              if (self3.left.is_number_or_bigint(compressor) && self3.right.is_number_or_bigint(compressor) && reversible() && !(self3.left instanceof AST_Binary && self3.left.operator != self3.operator && PRECEDENCE[self3.left.operator] >= PRECEDENCE[self3.operator])) {
                var reversed = make_node(AST_Binary, self3, {
                  operator: self3.operator,
                  left: self3.right,
                  right: self3.left
                });
                if (self3.right instanceof AST_Constant && !(self3.left instanceof AST_Constant)) {
                  self3 = best_of(compressor, reversed, self3);
                } else {
                  self3 = best_of(compressor, self3, reversed);
                }
              }
              if (associative && self3.is_number_or_bigint(compressor)) {
                if (self3.right instanceof AST_Binary && self3.right.operator == self3.operator) {
                  self3 = make_node(AST_Binary, self3, {
                    operator: self3.operator,
                    left: make_node(AST_Binary, self3.left, {
                      operator: self3.operator,
                      left: self3.left,
                      right: self3.right.left,
                      start: self3.left.start,
                      end: self3.right.left.end
                    }),
                    right: self3.right.right
                  });
                }
                if (self3.right instanceof AST_Constant && self3.left instanceof AST_Binary && self3.left.operator == self3.operator) {
                  if (self3.left.left instanceof AST_Constant) {
                    self3 = make_node(AST_Binary, self3, {
                      operator: self3.operator,
                      left: make_node(AST_Binary, self3.left, {
                        operator: self3.operator,
                        left: self3.left.left,
                        right: self3.right,
                        start: self3.left.left.start,
                        end: self3.right.end
                      }),
                      right: self3.left.right
                    });
                  } else if (self3.left.right instanceof AST_Constant) {
                    self3 = make_node(AST_Binary, self3, {
                      operator: self3.operator,
                      left: make_node(AST_Binary, self3.left, {
                        operator: self3.operator,
                        left: self3.left.right,
                        right: self3.right,
                        start: self3.left.right.start,
                        end: self3.right.end
                      }),
                      right: self3.left.left
                    });
                  }
                }
                if (self3.left instanceof AST_Binary && self3.left.operator == self3.operator && self3.left.right instanceof AST_Constant && self3.right instanceof AST_Binary && self3.right.operator == self3.operator && self3.right.left instanceof AST_Constant) {
                  self3 = make_node(AST_Binary, self3, {
                    operator: self3.operator,
                    left: make_node(AST_Binary, self3.left, {
                      operator: self3.operator,
                      left: make_node(AST_Binary, self3.left.left, {
                        operator: self3.operator,
                        left: self3.left.right,
                        right: self3.right.left,
                        start: self3.left.right.start,
                        end: self3.right.left.end
                      }),
                      right: self3.left.left
                    }),
                    right: self3.right.right
                  });
                }
              }
          }
          if (bitwise_binop.has(self3.operator)) {
            let y, z, x_node, y_node, z_node = self3.left;
            if (self3.operator === "&" && self3.right instanceof AST_Binary && self3.right.operator === "|" && typeof (z = self3.left.evaluate(compressor)) === "number") {
              if (typeof (y = self3.right.right.evaluate(compressor)) === "number") {
                x_node = self3.right.left;
                y_node = self3.right.right;
              } else if (typeof (y = self3.right.left.evaluate(compressor)) === "number") {
                x_node = self3.right.right;
                y_node = self3.right.left;
              }
              if (x_node && y_node) {
                if ((y & z) === 0) {
                  self3 = make_node(AST_Binary, self3, {
                    operator: self3.operator,
                    left: z_node,
                    right: x_node
                  });
                } else {
                  const reordered_ops = make_node(AST_Binary, self3, {
                    operator: "|",
                    left: make_node(AST_Binary, self3, {
                      operator: "&",
                      left: x_node,
                      right: z_node
                    }),
                    right: make_node_from_constant(y & z, y_node)
                  });
                  self3 = best_of(compressor, self3, reordered_ops);
                }
              }
            }
            if ((self3.operator === "|" || self3.operator === "&") && self3.left.equivalent_to(self3.right) && !self3.left.has_side_effects(compressor) && compressor.in_32_bit_context(true)) {
              self3.left = make_node(AST_Number, self3, { value: 0 });
              self3.operator = "|";
            }
            if (self3.operator === "^" && self3.left instanceof AST_UnaryPrefix && self3.left.operator === "~" && self3.right instanceof AST_UnaryPrefix && self3.right.operator === "~") {
              self3 = make_node(AST_Binary, self3, {
                operator: "^",
                left: self3.left.expression,
                right: self3.right.expression
              });
            }
            if ((self3.operator === "<<" || self3.operator === ">>") && self3.right instanceof AST_Number && self3.right.value === 0) {
              self3.operator = "|";
            }
            const zero_side = self3.right instanceof AST_Number && self3.right.value === 0 ? self3.right : self3.left instanceof AST_Number && self3.left.value === 0 ? self3.left : null;
            const non_zero_side = zero_side && (zero_side === self3.right ? self3.left : self3.right);
            if (zero_side && (self3.operator === "|" || self3.operator === "^") && (non_zero_side.is_32_bit_integer(compressor) || compressor.in_32_bit_context(true))) {
              return non_zero_side;
            }
            if (zero_side && self3.operator === "&" && !non_zero_side.has_side_effects(compressor) && non_zero_side.is_32_bit_integer(compressor)) {
              return zero_side;
            }
            const is_full_mask = (node) => node instanceof AST_Number && node.value === -1 || node instanceof AST_UnaryPrefix && node.operator === "-" && node.expression instanceof AST_Number && node.expression.value === 1;
            const full_mask = is_full_mask(self3.right) ? self3.right : is_full_mask(self3.left) ? self3.left : null;
            const other_side = full_mask === self3.right ? self3.left : self3.right;
            if (full_mask && self3.operator === "&" && (other_side.is_32_bit_integer(compressor) || compressor.in_32_bit_context(true))) {
              return other_side;
            }
            if (full_mask && self3.operator === "^" && (other_side.is_32_bit_integer(compressor) || compressor.in_32_bit_context(true))) {
              return other_side.bitwise_negate(compressor);
            }
          }
        }
        if (self3.right instanceof AST_Binary && self3.right.operator == self3.operator && (lazy_op.has(self3.operator) || self3.operator == "+" && (self3.right.left.is_string(compressor) || self3.left.is_string(compressor) && self3.right.right.is_string(compressor)))) {
          self3.left = make_node(AST_Binary, self3.left, {
            operator: self3.operator,
            left: self3.left.transform(compressor),
            right: self3.right.left.transform(compressor)
          });
          self3.right = self3.right.right.transform(compressor);
          return self3.transform(compressor);
        }
        var ev = self3.evaluate(compressor);
        if (ev !== self3) {
          ev = make_node_from_constant(ev, self3).optimize(compressor);
          return best_of(compressor, ev, self3);
        }
        return self3;
      });
      def_optimize(AST_SymbolExport, function(self3) {
        return self3;
      });
      def_optimize(AST_SymbolRef, function(self3, compressor) {
        if (!compressor.option("ie8") && is_undeclared_ref(self3) && !compressor.find_parent(AST_With)) {
          switch (self3.name) {
            case "undefined":
              return make_node(AST_Undefined, self3).optimize(compressor);
            case "NaN":
              return make_node(AST_NaN, self3).optimize(compressor);
            case "Infinity":
              return make_node(AST_Infinity, self3).optimize(compressor);
          }
        }
        if (compressor.option("reduce_vars") && !compressor.is_lhs()) {
          return inline_into_symbolref(self3, compressor);
        } else {
          return self3;
        }
      });
      function is_atomic(lhs, self3) {
        return lhs instanceof AST_SymbolRef || lhs.TYPE === self3.TYPE;
      }
      def_optimize(AST_Undefined, function(self3, compressor) {
        if (compressor.option("unsafe_undefined")) {
          var undef = find_variable(compressor, "undefined");
          if (undef) {
            var ref = make_node(AST_SymbolRef, self3, {
              name: "undefined",
              scope: undef.scope,
              thedef: undef
            });
            set_flag(ref, UNDEFINED2);
            return ref;
          }
        }
        var lhs = compressor.is_lhs();
        if (lhs && is_atomic(lhs, self3)) return self3;
        return make_node(AST_UnaryPrefix, self3, {
          operator: "void",
          expression: make_node(AST_Number, self3, {
            value: 0
          })
        });
      });
      def_optimize(AST_Infinity, function(self3, compressor) {
        var lhs = compressor.is_lhs();
        if (lhs && is_atomic(lhs, self3)) return self3;
        if (compressor.option("keep_infinity") && !(lhs && !is_atomic(lhs, self3)) && !find_variable(compressor, "Infinity")) {
          return self3;
        }
        return make_node(AST_Binary, self3, {
          operator: "/",
          left: make_node(AST_Number, self3, {
            value: 1
          }),
          right: make_node(AST_Number, self3, {
            value: 0
          })
        });
      });
      def_optimize(AST_NaN, function(self3, compressor) {
        var lhs = compressor.is_lhs();
        if (lhs && !is_atomic(lhs, self3) || find_variable(compressor, "NaN")) {
          return make_node(AST_Binary, self3, {
            operator: "/",
            left: make_node(AST_Number, self3, {
              value: 0
            }),
            right: make_node(AST_Number, self3, {
              value: 0
            })
          });
        }
        return self3;
      });
      const ASSIGN_OPS = makePredicate("+ - / * % >> << >>> | ^ &");
      const ASSIGN_OPS_COMMUTATIVE = makePredicate("* | ^ &");
      def_optimize(AST_Assign, function(self3, compressor) {
        if (self3.logical) {
          return self3.lift_sequences(compressor);
        }
        var def;
        if (self3.operator === "=" && self3.left instanceof AST_SymbolRef && self3.left.name !== "arguments" && !(def = self3.left.definition()).undeclared && self3.right.equivalent_to(self3.left)) {
          return self3.right;
        }
        if (compressor.option("dead_code") && self3.left instanceof AST_SymbolRef && (def = self3.left.definition()).scope === compressor.find_parent(AST_Lambda)) {
          var level = 0, node, parent = self3;
          do {
            node = parent;
            parent = compressor.parent(level++);
            if (parent instanceof AST_Exit) {
              if (in_try(level, parent)) break;
              if (is_reachable(def.scope, [def])) break;
              if (self3.operator == "=") return self3.right;
              def.fixed = false;
              return make_node(AST_Binary, self3, {
                operator: self3.operator.slice(0, -1),
                left: self3.left,
                right: self3.right
              }).optimize(compressor);
            }
          } while (parent instanceof AST_Binary && parent.right === node || parent instanceof AST_Sequence && parent.tail_node() === node);
        }
        self3 = self3.lift_sequences(compressor);
        if (self3.operator == "=" && self3.left instanceof AST_SymbolRef && self3.right instanceof AST_Binary) {
          if (self3.right.left instanceof AST_SymbolRef && self3.right.left.name == self3.left.name && ASSIGN_OPS.has(self3.right.operator)) {
            self3.operator = self3.right.operator + "=";
            self3.right = self3.right.right;
          } else if (self3.right.right instanceof AST_SymbolRef && self3.right.right.name == self3.left.name && ASSIGN_OPS_COMMUTATIVE.has(self3.right.operator) && !self3.right.left.has_side_effects(compressor)) {
            self3.operator = self3.right.operator + "=";
            self3.right = self3.right.left;
          }
        }
        return self3;
        function in_try(level2, node2) {
          function may_assignment_throw() {
            const right = self3.right;
            self3.right = make_node(AST_Null, right);
            const may_throw = node2.may_throw(compressor);
            self3.right = right;
            return may_throw;
          }
          var stop_at = self3.left.definition().scope.get_defun_scope();
          var parent2;
          while ((parent2 = compressor.parent(level2++)) !== stop_at) {
            if (parent2 instanceof AST_Try) {
              if (parent2.bfinally) return true;
              if (parent2.bcatch && may_assignment_throw()) return true;
            }
          }
        }
      });
      def_optimize(AST_DefaultAssign, function(self3, compressor) {
        if (!compressor.option("evaluate")) {
          return self3;
        }
        var evaluateRight = self3.right.evaluate(compressor);
        let lambda, iife;
        if (evaluateRight === void 0) {
          if ((lambda = compressor.parent()) instanceof AST_Lambda ? compressor.option("keep_fargs") === false || (iife = compressor.parent(1)).TYPE === "Call" && iife.expression === lambda : true) {
            self3 = self3.left;
          }
        } else if (evaluateRight !== self3.right) {
          evaluateRight = make_node_from_constant(evaluateRight, self3.right);
          self3.right = best_of_expression(evaluateRight, self3.right);
        }
        return self3;
      });
      function is_nullish_check(check, check_subject, compressor) {
        if (check_subject.may_throw(compressor)) return false;
        let nullish_side;
        if (check instanceof AST_Binary && check.operator === "==" && ((nullish_side = is_nullish(check.left, compressor) && check.left) || (nullish_side = is_nullish(check.right, compressor) && check.right)) && (nullish_side === check.left ? check.right : check.left).equivalent_to(check_subject)) {
          return true;
        }
        if (check instanceof AST_Binary && check.operator === "||") {
          let null_cmp;
          let undefined_cmp;
          const find_comparison = (cmp) => {
            if (!(cmp instanceof AST_Binary && (cmp.operator === "===" || cmp.operator === "=="))) {
              return false;
            }
            let found = 0;
            let defined_side;
            if (cmp.left instanceof AST_Null) {
              found++;
              null_cmp = cmp;
              defined_side = cmp.right;
            }
            if (cmp.right instanceof AST_Null) {
              found++;
              null_cmp = cmp;
              defined_side = cmp.left;
            }
            if (is_undefined(cmp.left, compressor)) {
              found++;
              undefined_cmp = cmp;
              defined_side = cmp.right;
            }
            if (is_undefined(cmp.right, compressor)) {
              found++;
              undefined_cmp = cmp;
              defined_side = cmp.left;
            }
            if (found !== 1) {
              return false;
            }
            if (!defined_side.equivalent_to(check_subject)) {
              return false;
            }
            return true;
          };
          if (!find_comparison(check.left)) return false;
          if (!find_comparison(check.right)) return false;
          if (null_cmp && undefined_cmp && null_cmp !== undefined_cmp) {
            return true;
          }
        }
        return false;
      }
      def_optimize(AST_Conditional, function(self3, compressor) {
        if (!compressor.option("conditionals")) return self3;
        if (self3.condition instanceof AST_Sequence) {
          var expressions = self3.condition.expressions.slice();
          self3.condition = expressions.pop();
          expressions.push(self3);
          return make_sequence(self3, expressions);
        }
        var cond = self3.condition.evaluate(compressor);
        if (cond !== self3.condition) {
          if (cond) {
            return maintain_this_binding(compressor.parent(), compressor.self(), self3.consequent);
          } else {
            return maintain_this_binding(compressor.parent(), compressor.self(), self3.alternative);
          }
        }
        var negated = cond.negate(compressor, first_in_statement(compressor));
        if (best_of(compressor, cond, negated) === negated) {
          self3 = make_node(AST_Conditional, self3, {
            condition: negated,
            consequent: self3.alternative,
            alternative: self3.consequent
          });
        }
        var condition = self3.condition;
        var consequent = self3.consequent;
        var alternative = self3.alternative;
        if (condition instanceof AST_SymbolRef && consequent instanceof AST_SymbolRef && condition.definition() === consequent.definition()) {
          return make_node(AST_Binary, self3, {
            operator: "||",
            left: condition,
            right: alternative
          });
        }
        if (consequent instanceof AST_Assign && alternative instanceof AST_Assign && consequent.operator === alternative.operator && consequent.logical === alternative.logical && consequent.left.equivalent_to(alternative.left) && (!self3.condition.has_side_effects(compressor) || consequent.operator == "=" && !consequent.left.has_side_effects(compressor))) {
          return make_node(AST_Assign, self3, {
            operator: consequent.operator,
            left: consequent.left,
            logical: consequent.logical,
            right: make_node(AST_Conditional, self3, {
              condition: self3.condition,
              consequent: consequent.right,
              alternative: alternative.right
            })
          });
        }
        var arg_index;
        if (consequent instanceof AST_Call && alternative.TYPE === consequent.TYPE && consequent.args.length > 0 && consequent.args.length == alternative.args.length && consequent.expression.equivalent_to(alternative.expression) && !self3.condition.has_side_effects(compressor) && !consequent.expression.has_side_effects(compressor) && typeof (arg_index = single_arg_diff()) == "number") {
          var node = consequent.clone();
          node.args[arg_index] = make_node(AST_Conditional, self3, {
            condition: self3.condition,
            consequent: consequent.args[arg_index],
            alternative: alternative.args[arg_index]
          });
          return node;
        }
        if (alternative instanceof AST_Conditional && consequent.equivalent_to(alternative.consequent)) {
          return make_node(AST_Conditional, self3, {
            condition: make_node(AST_Binary, self3, {
              operator: "||",
              left: condition,
              right: alternative.condition
            }),
            consequent,
            alternative: alternative.alternative
          }).optimize(compressor);
        }
        if (compressor.option("ecma") >= 2020 && is_nullish_check(condition, alternative, compressor)) {
          return make_node(AST_Binary, self3, {
            operator: "??",
            left: alternative,
            right: consequent
          }).optimize(compressor);
        }
        if (alternative instanceof AST_Sequence && consequent.equivalent_to(alternative.expressions[alternative.expressions.length - 1])) {
          return make_sequence(self3, [
            make_node(AST_Binary, self3, {
              operator: "||",
              left: condition,
              right: make_sequence(self3, alternative.expressions.slice(0, -1))
            }),
            consequent
          ]).optimize(compressor);
        }
        if (alternative instanceof AST_Binary && alternative.operator == "&&" && consequent.equivalent_to(alternative.right)) {
          return make_node(AST_Binary, self3, {
            operator: "&&",
            left: make_node(AST_Binary, self3, {
              operator: "||",
              left: condition,
              right: alternative.left
            }),
            right: consequent
          }).optimize(compressor);
        }
        if (consequent instanceof AST_Conditional && consequent.alternative.equivalent_to(alternative)) {
          return make_node(AST_Conditional, self3, {
            condition: make_node(AST_Binary, self3, {
              left: self3.condition,
              operator: "&&",
              right: consequent.condition
            }),
            consequent: consequent.consequent,
            alternative
          });
        }
        if (consequent.equivalent_to(alternative)) {
          return make_sequence(self3, [
            self3.condition,
            consequent
          ]).optimize(compressor);
        }
        if (consequent instanceof AST_Binary && consequent.operator == "||" && consequent.right.equivalent_to(alternative)) {
          return make_node(AST_Binary, self3, {
            operator: "||",
            left: make_node(AST_Binary, self3, {
              operator: "&&",
              left: self3.condition,
              right: consequent.left
            }),
            right: alternative
          }).optimize(compressor);
        }
        const in_bool = compressor.in_boolean_context();
        if (is_true(self3.consequent)) {
          if (is_false(self3.alternative)) {
            return booleanize(self3.condition);
          }
          return make_node(AST_Binary, self3, {
            operator: "||",
            left: booleanize(self3.condition),
            right: self3.alternative
          });
        }
        if (is_false(self3.consequent)) {
          if (is_true(self3.alternative)) {
            return booleanize(self3.condition.negate(compressor));
          }
          return make_node(AST_Binary, self3, {
            operator: "&&",
            left: booleanize(self3.condition.negate(compressor)),
            right: self3.alternative
          });
        }
        if (is_true(self3.alternative)) {
          return make_node(AST_Binary, self3, {
            operator: "||",
            left: booleanize(self3.condition.negate(compressor)),
            right: self3.consequent
          });
        }
        if (is_false(self3.alternative)) {
          return make_node(AST_Binary, self3, {
            operator: "&&",
            left: booleanize(self3.condition),
            right: self3.consequent
          });
        }
        return self3;
        function booleanize(node2) {
          if (node2.is_boolean()) return node2;
          return make_node(AST_UnaryPrefix, node2, {
            operator: "!",
            expression: node2.negate(compressor)
          });
        }
        function is_true(node2) {
          return node2 instanceof AST_True || in_bool && node2 instanceof AST_Constant && node2.getValue() || node2 instanceof AST_UnaryPrefix && node2.operator == "!" && node2.expression instanceof AST_Constant && !node2.expression.getValue();
        }
        function is_false(node2) {
          return node2 instanceof AST_False || in_bool && node2 instanceof AST_Constant && !node2.getValue() || node2 instanceof AST_UnaryPrefix && node2.operator == "!" && node2.expression instanceof AST_Constant && node2.expression.getValue();
        }
        function single_arg_diff() {
          var a = consequent.args;
          var b = alternative.args;
          for (var i = 0, len = a.length; i < len; i++) {
            if (a[i] instanceof AST_Expansion) return;
            if (!a[i].equivalent_to(b[i])) {
              if (b[i] instanceof AST_Expansion) return;
              for (var j = i + 1; j < len; j++) {
                if (a[j] instanceof AST_Expansion) return;
                if (!a[j].equivalent_to(b[j])) return;
              }
              return i;
            }
          }
        }
      });
      def_optimize(AST_Boolean, function(self3, compressor) {
        if (compressor.in_boolean_context()) return make_node(AST_Number, self3, {
          value: +self3.value
        });
        var p = compressor.parent();
        if (compressor.option("booleans_as_integers")) {
          if (p instanceof AST_Binary && (p.operator == "===" || p.operator == "!==")) {
            p.operator = p.operator.replace(/=$/, "");
          }
          return make_node(AST_Number, self3, {
            value: +self3.value
          });
        }
        if (compressor.option("booleans")) {
          if (p instanceof AST_Binary && (p.operator == "==" || p.operator == "!=")) {
            return make_node(AST_Number, self3, {
              value: +self3.value
            });
          }
          return make_node(AST_UnaryPrefix, self3, {
            operator: "!",
            expression: make_node(AST_Number, self3, {
              value: 1 - self3.value
            })
          });
        }
        return self3;
      });
      function safe_to_flatten(value2, compressor) {
        if (value2 instanceof AST_SymbolRef) {
          value2 = value2.fixed_value();
        }
        if (!value2) return false;
        if (!(value2 instanceof AST_Lambda || value2 instanceof AST_Class)) return true;
        if (!(value2 instanceof AST_Lambda && value2.contains_this())) return true;
        return compressor.parent() instanceof AST_New;
      }
      AST_PropAccess.DEFMETHOD("flatten_object", function(key4, compressor) {
        if (!compressor.option("properties")) return;
        if (key4 === "__proto__") return;
        if (this instanceof AST_DotHash) return;
        var arrows = compressor.option("unsafe_arrows") && compressor.option("ecma") >= 2015;
        var expr = this.expression;
        if (expr instanceof AST_Object) {
          var props = expr.properties;
          for (var i = props.length; --i >= 0; ) {
            var prop2 = props[i];
            if ("" + (prop2 instanceof AST_ConciseMethod ? prop2.key.name : prop2.key) == key4) {
              const all_props_flattenable = props.every(
                (p) => (p instanceof AST_ObjectKeyVal || arrows && p instanceof AST_ConciseMethod && !p.value.is_generator) && !p.computed_key()
              );
              if (!all_props_flattenable) return;
              if (!safe_to_flatten(prop2.value, compressor)) return;
              return make_node(AST_Sub, this, {
                expression: make_node(AST_Array, expr, {
                  elements: props.map(function(prop3) {
                    var v = prop3.value;
                    if (v instanceof AST_Accessor) {
                      v = make_node(AST_Function, v, v);
                    }
                    var k = prop3.key;
                    if (k instanceof AST_Node && !(k instanceof AST_SymbolMethod)) {
                      return make_sequence(prop3, [k, v]);
                    }
                    return v;
                  })
                }),
                property: make_node(AST_Number, this, {
                  value: i
                })
              });
            }
          }
        }
      });
      def_optimize(AST_Sub, function(self3, compressor) {
        var expr = self3.expression;
        var prop2 = self3.property;
        if (compressor.option("properties")) {
          var key4 = prop2.evaluate(compressor);
          if (key4 !== prop2) {
            if (typeof key4 == "string") {
              if (key4 == "undefined") {
                key4 = void 0;
              } else {
                var value2 = parseFloat(key4);
                if (value2.toString() == key4) {
                  key4 = value2;
                }
              }
            }
            prop2 = self3.property = best_of_expression(
              prop2,
              make_node_from_constant(key4, prop2).transform(compressor)
            );
            var property = "" + key4;
            if (is_basic_identifier_string(property) && property.length <= prop2.size() + 1) {
              return make_node(AST_Dot, self3, {
                expression: expr,
                optional: self3.optional,
                property,
                quote: prop2.quote
              }).optimize(compressor);
            }
          }
        }
        var fn;
        OPT_ARGUMENTS: if (compressor.option("arguments") && expr instanceof AST_SymbolRef && expr.name == "arguments" && expr.definition().orig.length == 1 && (fn = expr.scope) instanceof AST_Lambda && fn.uses_arguments && !(fn instanceof AST_Arrow) && prop2 instanceof AST_Number) {
          var index6 = prop2.getValue();
          var params = /* @__PURE__ */ new Set();
          var argnames = fn.argnames;
          for (var n3 = 0; n3 < argnames.length; n3++) {
            if (!(argnames[n3] instanceof AST_SymbolFunarg)) {
              break OPT_ARGUMENTS;
            }
            var param = argnames[n3].name;
            if (params.has(param)) {
              break OPT_ARGUMENTS;
            }
            params.add(param);
          }
          var argname = fn.argnames[index6];
          if (argname && compressor.has_directive("use strict")) {
            var def = argname.definition();
            if (!compressor.option("reduce_vars") || def.assignments || def.orig.length > 1) {
              argname = null;
            }
          } else if (!argname && !compressor.option("keep_fargs") && index6 < fn.argnames.length + 5) {
            while (index6 >= fn.argnames.length) {
              argname = fn.create_symbol(AST_SymbolFunarg, {
                source: fn,
                scope: fn,
                tentative_name: "argument_" + fn.argnames.length
              });
              fn.argnames.push(argname);
            }
          }
          if (argname) {
            var sym = make_node(AST_SymbolRef, self3, argname);
            sym.reference({});
            clear_flag(argname, UNUSED);
            return sym;
          }
        }
        if (compressor.is_lhs()) return self3;
        if (key4 !== prop2) {
          var sub = self3.flatten_object(property, compressor);
          if (sub) {
            expr = self3.expression = sub.expression;
            prop2 = self3.property = sub.property;
          }
        }
        if (compressor.option("properties") && compressor.option("side_effects") && prop2 instanceof AST_Number && expr instanceof AST_Array) {
          var index6 = prop2.getValue();
          var elements = expr.elements;
          var retValue = elements[index6];
          FLATTEN: if (safe_to_flatten(retValue, compressor)) {
            var flatten3 = true;
            var values = [];
            for (var i = elements.length; --i > index6; ) {
              var value2 = elements[i].drop_side_effect_free(compressor);
              if (value2) {
                values.unshift(value2);
                if (flatten3 && value2.has_side_effects(compressor)) flatten3 = false;
              }
            }
            if (retValue instanceof AST_Expansion) break FLATTEN;
            retValue = retValue instanceof AST_Hole ? make_node(AST_Undefined, retValue) : retValue;
            if (!flatten3) values.unshift(retValue);
            while (--i >= 0) {
              var value2 = elements[i];
              if (value2 instanceof AST_Expansion) break FLATTEN;
              value2 = value2.drop_side_effect_free(compressor);
              if (value2) values.unshift(value2);
              else index6--;
            }
            if (flatten3) {
              values.push(retValue);
              return make_sequence(self3, values).optimize(compressor);
            } else return make_node(AST_Sub, self3, {
              expression: make_node(AST_Array, expr, {
                elements: values
              }),
              property: make_node(AST_Number, prop2, {
                value: index6
              })
            });
          }
        }
        var ev = self3.evaluate(compressor);
        if (ev !== self3) {
          ev = make_node_from_constant(ev, self3).optimize(compressor);
          return best_of(compressor, ev, self3);
        }
        return self3;
      });
      def_optimize(AST_Chain, function(self3, compressor) {
        if (is_nullish(self3.expression, compressor)) {
          let parent = compressor.parent();
          if (parent instanceof AST_UnaryPrefix && parent.operator === "delete") {
            return make_node_from_constant(0, self3);
          }
          return make_node(AST_Undefined, self3);
        }
        if (self3.expression instanceof AST_PropAccess || self3.expression instanceof AST_Call) {
          return self3;
        } else {
          return self3.expression;
        }
      });
      def_optimize(AST_Dot, function(self3, compressor) {
        const parent = compressor.parent();
        if (compressor.is_lhs()) return self3;
        if (compressor.option("unsafe_proto") && self3.expression instanceof AST_Dot && self3.expression.property == "prototype") {
          var exp = self3.expression.expression;
          if (is_undeclared_ref(exp)) switch (exp.name) {
            case "Array":
              self3.expression = make_node(AST_Array, self3.expression, {
                elements: []
              });
              break;
            case "Function":
              self3.expression = make_empty_function(self3.expression);
              break;
            case "Number":
              self3.expression = make_node(AST_Number, self3.expression, {
                value: 0
              });
              break;
            case "Object":
              self3.expression = make_node(AST_Object, self3.expression, {
                properties: []
              });
              break;
            case "RegExp":
              self3.expression = make_node(AST_RegExp, self3.expression, {
                value: { source: "t", flags: "" }
              });
              break;
            case "String":
              self3.expression = make_node(AST_String, self3.expression, {
                value: ""
              });
              break;
          }
        }
        if (!(parent instanceof AST_Call) || !has_annotation(parent, _NOINLINE)) {
          const sub = self3.flatten_object(self3.property, compressor);
          if (sub) return sub.optimize(compressor);
        }
        if (self3.expression instanceof AST_PropAccess && parent instanceof AST_PropAccess) {
          return self3;
        }
        let ev = self3.evaluate(compressor);
        if (ev !== self3) {
          ev = make_node_from_constant(ev, self3).optimize(compressor);
          return best_of(compressor, ev, self3);
        }
        return self3;
      });
      function literals_in_boolean_context(self3, compressor) {
        if (compressor.in_boolean_context()) {
          return best_of(compressor, self3, make_sequence(self3, [
            self3,
            make_node(AST_True, self3)
          ]).optimize(compressor));
        }
        return self3;
      }
      function inline_array_like_spread(elements) {
        for (var i = 0; i < elements.length; i++) {
          var el = elements[i];
          if (el instanceof AST_Expansion) {
            var expr = el.expression;
            if (expr instanceof AST_Array && !expr.elements.some((elm) => elm instanceof AST_Hole)) {
              elements.splice(i, 1, ...expr.elements);
              i--;
            }
          }
        }
      }
      def_optimize(AST_Array, function(self3, compressor) {
        var optimized = literals_in_boolean_context(self3, compressor);
        if (optimized !== self3) {
          return optimized;
        }
        inline_array_like_spread(self3.elements);
        return self3;
      });
      function inline_object_prop_spread(props) {
        for (var i = 0; i < props.length; i++) {
          var prop2 = props[i];
          if (prop2 instanceof AST_Expansion) {
            const expr = prop2.expression;
            if (expr instanceof AST_Object && expr.properties.every((prop3) => prop3 instanceof AST_ObjectKeyVal)) {
              props.splice(i, 1, ...expr.properties);
              i--;
            } else if (
              // `expr.is_constant()` returns `false` for `AST_RegExp`, so need both.
              (expr instanceof AST_Constant || expr.is_constant()) && !(expr instanceof AST_String)
            ) {
              props.splice(i, 1);
              i--;
            }
          }
        }
      }
      def_optimize(AST_Object, function(self3, compressor) {
        var optimized = literals_in_boolean_context(self3, compressor);
        if (optimized !== self3) {
          return optimized;
        }
        inline_object_prop_spread(self3.properties);
        return self3;
      });
      def_optimize(AST_RegExp, literals_in_boolean_context);
      def_optimize(AST_Return, function(self3, compressor) {
        if (self3.value && is_undefined(self3.value, compressor)) {
          self3.value = null;
        }
        return self3;
      });
      def_optimize(AST_Arrow, opt_AST_Lambda);
      def_optimize(AST_Function, function(self3, compressor) {
        self3 = opt_AST_Lambda(self3, compressor);
        if (compressor.option("unsafe_arrows") && compressor.option("ecma") >= 2015 && !self3.name && !self3.is_generator && !self3.uses_arguments && !self3.pinned()) {
          const uses_this = walk(self3, (node) => {
            if (node instanceof AST_This) return walk_abort;
          });
          if (!uses_this) return make_node(AST_Arrow, self3, self3).optimize(compressor);
        }
        return self3;
      });
      def_optimize(AST_Class, function(self3) {
        for (let i = 0; i < self3.properties.length; i++) {
          const prop2 = self3.properties[i];
          if (prop2 instanceof AST_ClassStaticBlock && prop2.body.length == 0) {
            self3.properties.splice(i, 1);
            i--;
          }
        }
        return self3;
      });
      def_optimize(AST_ClassStaticBlock, function(self3, compressor) {
        tighten_body(self3.body, compressor);
        return self3;
      });
      def_optimize(AST_Yield, function(self3, compressor) {
        if (self3.expression && !self3.is_star && is_undefined(self3.expression, compressor)) {
          self3.expression = null;
        }
        return self3;
      });
      def_optimize(AST_TemplateString, function(self3, compressor) {
        if (!compressor.option("evaluate") || compressor.parent() instanceof AST_PrefixedTemplateString) {
          return self3;
        }
        var segments = [];
        for (var i = 0; i < self3.segments.length; i++) {
          var segment = self3.segments[i];
          if (segment instanceof AST_Node) {
            var result = segment.evaluate(compressor);
            if (result !== segment && (result + "").length <= segment.size() + "${}".length) {
              segments[segments.length - 1].value = segments[segments.length - 1].value + result + self3.segments[++i].value;
              continue;
            }
            if (segment instanceof AST_TemplateString) {
              var inners = segment.segments;
              segments[segments.length - 1].value += inners[0].value;
              for (var j = 1; j < inners.length; j++) {
                segment = inners[j];
                segments.push(segment);
              }
              continue;
            }
          }
          segments.push(segment);
        }
        self3.segments = segments;
        if (segments.length == 1) {
          return make_node(AST_String, self3, segments[0]);
        }
        if (segments.length === 3 && segments[1] instanceof AST_Node && (segments[1].is_string(compressor) || segments[1].is_number_or_bigint(compressor) || is_nullish(segments[1], compressor) || compressor.option("unsafe"))) {
          if (segments[2].value === "") {
            return make_node(AST_Binary, self3, {
              operator: "+",
              left: make_node(AST_String, self3, {
                value: segments[0].value
              }),
              right: segments[1]
            });
          }
          if (segments[0].value === "") {
            return make_node(AST_Binary, self3, {
              operator: "+",
              left: segments[1],
              right: make_node(AST_String, self3, {
                value: segments[2].value
              })
            });
          }
        }
        return self3;
      });
      def_optimize(AST_PrefixedTemplateString, function(self3) {
        return self3;
      });
      function lift_key(self3, compressor) {
        if (!compressor.option("computed_props")) return self3;
        if (!(self3.key instanceof AST_Constant)) return self3;
        if (self3.key instanceof AST_String || self3.key instanceof AST_Number) {
          const key4 = self3.key.value.toString();
          if (key4 === "__proto__") return self3;
          if (key4 == "constructor" && compressor.parent() instanceof AST_Class) return self3;
          if (self3 instanceof AST_ObjectKeyVal) {
            self3.quote = self3.key.quote;
            self3.key = key4;
          } else if (self3 instanceof AST_ClassProperty) {
            self3.quote = self3.key.quote;
            self3.key = make_node(AST_SymbolClassProperty, self3.key, {
              name: key4
            });
          } else {
            self3.quote = self3.key.quote;
            self3.key = make_node(AST_SymbolMethod, self3.key, {
              name: key4
            });
          }
        }
        return self3;
      }
      def_optimize(AST_ObjectProperty, lift_key);
      def_optimize(AST_ConciseMethod, function(self3, compressor) {
        lift_key(self3, compressor);
        if (compressor.option("arrows") && compressor.parent() instanceof AST_Object && !self3.value.is_generator && !self3.value.uses_arguments && !self3.value.pinned() && self3.value.body.length == 1 && self3.value.body[0] instanceof AST_Return && self3.value.body[0].value && !self3.value.contains_this()) {
          var arrow = make_node(AST_Arrow, self3.value, self3.value);
          arrow.async = self3.value.async;
          arrow.is_generator = self3.value.is_generator;
          return make_node(AST_ObjectKeyVal, self3, {
            key: self3.key instanceof AST_SymbolMethod ? self3.key.name : self3.key,
            value: arrow,
            quote: self3.quote
          });
        }
        return self3;
      });
      def_optimize(AST_ObjectKeyVal, function(self3, compressor) {
        lift_key(self3, compressor);
        var unsafe_methods = compressor.option("unsafe_methods");
        if (unsafe_methods && compressor.option("ecma") >= 2015 && (!(unsafe_methods instanceof RegExp) || unsafe_methods.test(self3.key + ""))) {
          var key4 = self3.key;
          var value2 = self3.value;
          var is_arrow_with_block = value2 instanceof AST_Arrow && Array.isArray(value2.body) && !value2.contains_this();
          if ((is_arrow_with_block || value2 instanceof AST_Function) && !value2.name) {
            return make_node(AST_ConciseMethod, self3, {
              key: key4 instanceof AST_Node ? key4 : make_node(AST_SymbolMethod, self3, {
                name: key4
              }),
              value: make_node(AST_Accessor, value2, value2),
              quote: self3.quote
            });
          }
        }
        return self3;
      });
      def_optimize(AST_Destructuring, function(self3, compressor) {
        if (compressor.option("pure_getters") == true && compressor.option("unused") && !self3.is_array && Array.isArray(self3.names) && !is_destructuring_export_decl(compressor) && !(self3.names[self3.names.length - 1] instanceof AST_Expansion)) {
          var keep = [];
          for (var i = 0; i < self3.names.length; i++) {
            var elem = self3.names[i];
            if (!(elem instanceof AST_ObjectKeyVal && typeof elem.key == "string" && elem.value instanceof AST_SymbolDeclaration && !should_retain(compressor, elem.value.definition()))) {
              keep.push(elem);
            }
          }
          if (keep.length != self3.names.length) {
            self3.names = keep;
          }
        }
        return self3;
        function is_destructuring_export_decl(compressor2) {
          var ancestors = [/^VarDef$/, /^(Const|Let|Var)$/, /^Export$/];
          for (var a = 0, p = 0, len = ancestors.length; a < len; p++) {
            var parent = compressor2.parent(p);
            if (!parent) return false;
            if (a === 0 && parent.TYPE == "Destructuring") continue;
            if (!ancestors[a].test(parent.TYPE)) {
              return false;
            }
            a++;
          }
          return true;
        }
        function should_retain(compressor2, def) {
          if (def.references.length) return true;
          if (!def.global) return false;
          if (compressor2.toplevel.vars) {
            if (compressor2.top_retain) {
              return compressor2.top_retain(def);
            }
            return false;
          }
          return true;
        }
      });
      function* SourceMap(options) {
        options = defaults2(options, {
          file: null,
          root: null,
          orig: null,
          files: {}
        });
        var orig_map;
        var generator = new sourceMap.SourceMapGenerator({
          file: options.file,
          sourceRoot: options.root
        });
        let sourcesContent = { __proto__: null };
        let files = options.files;
        for (var name in files) if (HOP(files, name)) {
          sourcesContent[name] = files[name];
        }
        if (options.orig) {
          orig_map = yield new sourceMap.SourceMapConsumer(options.orig);
          if (orig_map.sourcesContent) {
            orig_map.sources.forEach(function(source2, i) {
              var content = orig_map.sourcesContent[i];
              if (content) {
                sourcesContent[source2] = content;
              }
            });
          }
        }
        function add(source2, gen_line, gen_col, orig_line, orig_col, name2) {
          let generatedPos = { line: gen_line, column: gen_col };
          if (orig_map) {
            var info3 = orig_map.originalPositionFor({
              line: orig_line,
              column: orig_col
            });
            if (info3.source === null) {
              generator.addMapping({
                generated: generatedPos,
                original: null,
                source: null,
                name: null
              });
              return;
            }
            source2 = info3.source;
            orig_line = info3.line;
            orig_col = info3.column;
            name2 = info3.name || name2;
          }
          generator.addMapping({
            generated: generatedPos,
            original: { line: orig_line, column: orig_col },
            source: source2,
            name: name2
          });
          generator.setSourceContent(source2, sourcesContent[source2]);
        }
        function clean(map2) {
          const allNull = map2.sourcesContent && map2.sourcesContent.every((c) => c == null);
          if (allNull) delete map2.sourcesContent;
          if (map2.file === void 0) delete map2.file;
          if (map2.sourceRoot === void 0) delete map2.sourceRoot;
          return map2;
        }
        function getDecoded() {
          if (!generator.toDecodedMap) return null;
          return clean(generator.toDecodedMap());
        }
        function getEncoded() {
          return clean(generator.toJSON());
        }
        function destroy2() {
          if (orig_map && orig_map.destroy) orig_map.destroy();
        }
        return {
          add,
          getDecoded,
          getEncoded,
          destroy: destroy2
        };
      }
      var domprops = [
        "$&",
        "$'",
        "$*",
        "$+",
        "$1",
        "$2",
        "$3",
        "$4",
        "$5",
        "$6",
        "$7",
        "$8",
        "$9",
        "$_",
        "$`",
        "$input",
        "-moz-animation",
        "-moz-animation-delay",
        "-moz-animation-direction",
        "-moz-animation-duration",
        "-moz-animation-fill-mode",
        "-moz-animation-iteration-count",
        "-moz-animation-name",
        "-moz-animation-play-state",
        "-moz-animation-timing-function",
        "-moz-appearance",
        "-moz-backface-visibility",
        "-moz-border-end",
        "-moz-border-end-color",
        "-moz-border-end-style",
        "-moz-border-end-width",
        "-moz-border-image",
        "-moz-border-start",
        "-moz-border-start-color",
        "-moz-border-start-style",
        "-moz-border-start-width",
        "-moz-box-align",
        "-moz-box-direction",
        "-moz-box-flex",
        "-moz-box-ordinal-group",
        "-moz-box-orient",
        "-moz-box-pack",
        "-moz-box-sizing",
        "-moz-float-edge",
        "-moz-font-feature-settings",
        "-moz-font-language-override",
        "-moz-force-broken-image-icon",
        "-moz-hyphens",
        "-moz-image-region",
        "-moz-margin-end",
        "-moz-margin-start",
        "-moz-orient",
        "-moz-osx-font-smoothing",
        "-moz-outline-radius",
        "-moz-outline-radius-bottomleft",
        "-moz-outline-radius-bottomright",
        "-moz-outline-radius-topleft",
        "-moz-outline-radius-topright",
        "-moz-padding-end",
        "-moz-padding-start",
        "-moz-perspective",
        "-moz-perspective-origin",
        "-moz-tab-size",
        "-moz-text-size-adjust",
        "-moz-transform",
        "-moz-transform-origin",
        "-moz-transform-style",
        "-moz-transition",
        "-moz-transition-delay",
        "-moz-transition-duration",
        "-moz-transition-property",
        "-moz-transition-timing-function",
        "-moz-user-focus",
        "-moz-user-input",
        "-moz-user-modify",
        "-moz-user-select",
        "-moz-window-dragging",
        "-webkit-align-content",
        "-webkit-align-items",
        "-webkit-align-self",
        "-webkit-animation",
        "-webkit-animation-delay",
        "-webkit-animation-direction",
        "-webkit-animation-duration",
        "-webkit-animation-fill-mode",
        "-webkit-animation-iteration-count",
        "-webkit-animation-name",
        "-webkit-animation-play-state",
        "-webkit-animation-timing-function",
        "-webkit-appearance",
        "-webkit-backface-visibility",
        "-webkit-background-clip",
        "-webkit-background-origin",
        "-webkit-background-size",
        "-webkit-border-bottom-left-radius",
        "-webkit-border-bottom-right-radius",
        "-webkit-border-image",
        "-webkit-border-radius",
        "-webkit-border-top-left-radius",
        "-webkit-border-top-right-radius",
        "-webkit-box-align",
        "-webkit-box-direction",
        "-webkit-box-flex",
        "-webkit-box-ordinal-group",
        "-webkit-box-orient",
        "-webkit-box-pack",
        "-webkit-box-shadow",
        "-webkit-box-sizing",
        "-webkit-clip-path",
        "-webkit-filter",
        "-webkit-flex",
        "-webkit-flex-basis",
        "-webkit-flex-direction",
        "-webkit-flex-flow",
        "-webkit-flex-grow",
        "-webkit-flex-shrink",
        "-webkit-flex-wrap",
        "-webkit-font-feature-settings",
        "-webkit-justify-content",
        "-webkit-line-clamp",
        "-webkit-mask",
        "-webkit-mask-clip",
        "-webkit-mask-composite",
        "-webkit-mask-image",
        "-webkit-mask-origin",
        "-webkit-mask-position",
        "-webkit-mask-position-x",
        "-webkit-mask-position-y",
        "-webkit-mask-repeat",
        "-webkit-mask-size",
        "-webkit-order",
        "-webkit-perspective",
        "-webkit-perspective-origin",
        "-webkit-text-fill-color",
        "-webkit-text-security",
        "-webkit-text-size-adjust",
        "-webkit-text-stroke",
        "-webkit-text-stroke-color",
        "-webkit-text-stroke-width",
        "-webkit-transform",
        "-webkit-transform-origin",
        "-webkit-transform-style",
        "-webkit-transition",
        "-webkit-transition-delay",
        "-webkit-transition-duration",
        "-webkit-transition-property",
        "-webkit-transition-timing-function",
        "-webkit-user-select",
        "@@iterator",
        "ABORT_ERR",
        "ACTIVE",
        "ACTIVE_ATTRIBUTES",
        "ACTIVE_TEXTURE",
        "ACTIVE_UNIFORMS",
        "ACTIVE_UNIFORM_BLOCKS",
        "ADDITION",
        "ALIASED_LINE_WIDTH_RANGE",
        "ALIASED_POINT_SIZE_RANGE",
        "ALL",
        "ALLOW_KEYBOARD_INPUT",
        "ALLPASS",
        "ALPHA",
        "ALPHA_BITS",
        "ALREADY_SIGNALED",
        "ALT_MASK",
        "ALWAYS",
        "ANY_SAMPLES_PASSED",
        "ANY_SAMPLES_PASSED_CONSERVATIVE",
        "ANY_TYPE",
        "ANY_UNORDERED_NODE_TYPE",
        "ARRAY_BUFFER",
        "ARRAY_BUFFER_BINDING",
        "ATTACHED_SHADERS",
        "ATTRIBUTE_NODE",
        "AT_TARGET",
        "AbortController",
        "AbortSignal",
        "AbsoluteOrientationSensor",
        "AbstractRange",
        "Accelerometer",
        "AddSearchProvider",
        "AggregateError",
        "AnalyserNode",
        "Animation",
        "AnimationEffect",
        "AnimationEvent",
        "AnimationPlaybackEvent",
        "AnimationTimeline",
        "AnonXMLHttpRequest",
        "Any",
        "AnyPermissions",
        "ApplicationCache",
        "ApplicationCacheErrorEvent",
        "Array",
        "ArrayBuffer",
        "ArrayType",
        "Atomics",
        "Attr",
        "Audio",
        "AudioBuffer",
        "AudioBufferSourceNode",
        "AudioContext",
        "AudioData",
        "AudioDecoder",
        "AudioDestinationNode",
        "AudioEncoder",
        "AudioListener",
        "AudioNode",
        "AudioParam",
        "AudioParamMap",
        "AudioProcessingEvent",
        "AudioScheduledSourceNode",
        "AudioSinkInfo",
        "AudioStreamTrack",
        "AudioWorklet",
        "AudioWorkletNode",
        "AuthenticatorAssertionResponse",
        "AuthenticatorAttestationResponse",
        "AuthenticatorResponse",
        "AutocompleteErrorEvent",
        "BACK",
        "BAD_BOUNDARYPOINTS_ERR",
        "BAD_REQUEST",
        "BANDPASS",
        "BLEND",
        "BLEND_COLOR",
        "BLEND_DST_ALPHA",
        "BLEND_DST_RGB",
        "BLEND_EQUATION",
        "BLEND_EQUATION_ALPHA",
        "BLEND_EQUATION_RGB",
        "BLEND_SRC_ALPHA",
        "BLEND_SRC_RGB",
        "BLUE",
        "BLUE_BITS",
        "BLUR",
        "BOOL",
        "BOOLEAN_TYPE",
        "BOOL_VEC2",
        "BOOL_VEC3",
        "BOOL_VEC4",
        "BOTH",
        "BROWSER_DEFAULT_WEBGL",
        "BUBBLING_PHASE",
        "BUFFER_SIZE",
        "BUFFER_USAGE",
        "BYTE",
        "BYTES_PER_ELEMENT",
        "BackgroundFetchManager",
        "BackgroundFetchRecord",
        "BackgroundFetchRegistration",
        "BarProp",
        "BarcodeDetector",
        "BaseAudioContext",
        "BaseHref",
        "BatteryManager",
        "BeforeInstallPromptEvent",
        "BeforeLoadEvent",
        "BeforeUnloadEvent",
        "BigInt",
        "BigInt64Array",
        "BigUint64Array",
        "BiquadFilterNode",
        "Blob",
        "BlobEvent",
        "Bluetooth",
        "BluetoothCharacteristicProperties",
        "BluetoothDevice",
        "BluetoothRemoteGATTCharacteristic",
        "BluetoothRemoteGATTDescriptor",
        "BluetoothRemoteGATTServer",
        "BluetoothRemoteGATTService",
        "BluetoothUUID",
        "Boolean",
        "BroadcastChannel",
        "BrowserCaptureMediaStreamTrack",
        "BrowserInfo",
        "ByteLengthQueuingStrategy",
        "CAPTURING_PHASE",
        "CCW",
        "CDATASection",
        "CDATA_SECTION_NODE",
        "CHANGE",
        "CHARSET_RULE",
        "CHECKING",
        "CLAMP_TO_EDGE",
        "CLICK",
        "CLOSED",
        "CLOSING",
        "COLOR",
        "COLOR_ATTACHMENT0",
        "COLOR_ATTACHMENT1",
        "COLOR_ATTACHMENT10",
        "COLOR_ATTACHMENT11",
        "COLOR_ATTACHMENT12",
        "COLOR_ATTACHMENT13",
        "COLOR_ATTACHMENT14",
        "COLOR_ATTACHMENT15",
        "COLOR_ATTACHMENT2",
        "COLOR_ATTACHMENT3",
        "COLOR_ATTACHMENT4",
        "COLOR_ATTACHMENT5",
        "COLOR_ATTACHMENT6",
        "COLOR_ATTACHMENT7",
        "COLOR_ATTACHMENT8",
        "COLOR_ATTACHMENT9",
        "COLOR_BUFFER_BIT",
        "COLOR_CLEAR_VALUE",
        "COLOR_WRITEMASK",
        "COMMENT_NODE",
        "COMPARE_REF_TO_TEXTURE",
        "COMPILE_STATUS",
        "COMPLETION_STATUS_KHR",
        "COMPRESSED_RGBA_S3TC_DXT1_EXT",
        "COMPRESSED_RGBA_S3TC_DXT3_EXT",
        "COMPRESSED_RGBA_S3TC_DXT5_EXT",
        "COMPRESSED_RGB_S3TC_DXT1_EXT",
        "COMPRESSED_TEXTURE_FORMATS",
        "COMPUTE",
        "CONDITION_SATISFIED",
        "CONFIGURATION_UNSUPPORTED",
        "CONNECTING",
        "CONSTANT_ALPHA",
        "CONSTANT_COLOR",
        "CONSTRAINT_ERR",
        "CONTEXT_LOST_WEBGL",
        "CONTROL_MASK",
        "COPY_DST",
        "COPY_READ_BUFFER",
        "COPY_READ_BUFFER_BINDING",
        "COPY_SRC",
        "COPY_WRITE_BUFFER",
        "COPY_WRITE_BUFFER_BINDING",
        "COUNTER_STYLE_RULE",
        "CSS",
        "CSS2Properties",
        "CSSAnimation",
        "CSSCharsetRule",
        "CSSConditionRule",
        "CSSContainerRule",
        "CSSCounterStyleRule",
        "CSSFontFaceRule",
        "CSSFontFeatureValuesRule",
        "CSSFontPaletteValuesRule",
        "CSSGroupingRule",
        "CSSImageValue",
        "CSSImportRule",
        "CSSKeyframeRule",
        "CSSKeyframesRule",
        "CSSKeywordValue",
        "CSSLayerBlockRule",
        "CSSLayerStatementRule",
        "CSSMarginRule",
        "CSSMathClamp",
        "CSSMathInvert",
        "CSSMathMax",
        "CSSMathMin",
        "CSSMathNegate",
        "CSSMathProduct",
        "CSSMathSum",
        "CSSMathValue",
        "CSSMatrixComponent",
        "CSSMediaRule",
        "CSSMozDocumentRule",
        "CSSNameSpaceRule",
        "CSSNamespaceRule",
        "CSSNestedDeclarations",
        "CSSNumericArray",
        "CSSNumericValue",
        "CSSPageDescriptors",
        "CSSPageRule",
        "CSSPerspective",
        "CSSPositionTryDescriptors",
        "CSSPositionTryRule",
        "CSSPositionValue",
        "CSSPrimitiveValue",
        "CSSPropertyRule",
        "CSSRotate",
        "CSSRule",
        "CSSRuleList",
        "CSSScale",
        "CSSScopeRule",
        "CSSSkew",
        "CSSSkewX",
        "CSSSkewY",
        "CSSStartingStyleRule",
        "CSSStyleDeclaration",
        "CSSStyleRule",
        "CSSStyleSheet",
        "CSSStyleValue",
        "CSSSupportsRule",
        "CSSTransformComponent",
        "CSSTransformValue",
        "CSSTransition",
        "CSSTranslate",
        "CSSUnitValue",
        "CSSUnknownRule",
        "CSSUnparsedValue",
        "CSSValue",
        "CSSValueList",
        "CSSVariableReferenceValue",
        "CSSVariablesDeclaration",
        "CSSVariablesRule",
        "CSSViewTransitionRule",
        "CSSViewportRule",
        "CSS_ATTR",
        "CSS_CM",
        "CSS_COUNTER",
        "CSS_CUSTOM",
        "CSS_DEG",
        "CSS_DIMENSION",
        "CSS_EMS",
        "CSS_EXS",
        "CSS_FILTER_BLUR",
        "CSS_FILTER_BRIGHTNESS",
        "CSS_FILTER_CONTRAST",
        "CSS_FILTER_CUSTOM",
        "CSS_FILTER_DROP_SHADOW",
        "CSS_FILTER_GRAYSCALE",
        "CSS_FILTER_HUE_ROTATE",
        "CSS_FILTER_INVERT",
        "CSS_FILTER_OPACITY",
        "CSS_FILTER_REFERENCE",
        "CSS_FILTER_SATURATE",
        "CSS_FILTER_SEPIA",
        "CSS_GRAD",
        "CSS_HZ",
        "CSS_IDENT",
        "CSS_IN",
        "CSS_INHERIT",
        "CSS_KHZ",
        "CSS_MATRIX",
        "CSS_MATRIX3D",
        "CSS_MM",
        "CSS_MS",
        "CSS_NUMBER",
        "CSS_PC",
        "CSS_PERCENTAGE",
        "CSS_PERSPECTIVE",
        "CSS_PRIMITIVE_VALUE",
        "CSS_PT",
        "CSS_PX",
        "CSS_RAD",
        "CSS_RECT",
        "CSS_RGBCOLOR",
        "CSS_ROTATE",
        "CSS_ROTATE3D",
        "CSS_ROTATEX",
        "CSS_ROTATEY",
        "CSS_ROTATEZ",
        "CSS_S",
        "CSS_SCALE",
        "CSS_SCALE3D",
        "CSS_SCALEX",
        "CSS_SCALEY",
        "CSS_SCALEZ",
        "CSS_SKEW",
        "CSS_SKEWX",
        "CSS_SKEWY",
        "CSS_STRING",
        "CSS_TRANSLATE",
        "CSS_TRANSLATE3D",
        "CSS_TRANSLATEX",
        "CSS_TRANSLATEY",
        "CSS_TRANSLATEZ",
        "CSS_UNKNOWN",
        "CSS_URI",
        "CSS_VALUE_LIST",
        "CSS_VH",
        "CSS_VMAX",
        "CSS_VMIN",
        "CSS_VW",
        "CULL_FACE",
        "CULL_FACE_MODE",
        "CURRENT_PROGRAM",
        "CURRENT_QUERY",
        "CURRENT_VERTEX_ATTRIB",
        "CUSTOM",
        "CW",
        "Cache",
        "CacheStorage",
        "CanvasCaptureMediaStream",
        "CanvasCaptureMediaStreamTrack",
        "CanvasGradient",
        "CanvasPattern",
        "CanvasRenderingContext2D",
        "CaptureController",
        "CaretPosition",
        "ChannelMergerNode",
        "ChannelSplitterNode",
        "ChapterInformation",
        "CharacterBoundsUpdateEvent",
        "CharacterData",
        "ClientRect",
        "ClientRectList",
        "Clipboard",
        "ClipboardEvent",
        "ClipboardItem",
        "CloseEvent",
        "CloseWatcher",
        "Collator",
        "ColorArray",
        "ColorValue",
        "CommandEvent",
        "Comment",
        "CompileError",
        "CompositionEvent",
        "CompressionStream",
        "Console",
        "ConstantSourceNode",
        "ContentVisibilityAutoStateChangeEvent",
        "ContextFilter",
        "ContextType",
        "Controllers",
        "ConvolverNode",
        "CookieChangeEvent",
        "CookieStore",
        "CookieStoreManager",
        "CountQueuingStrategy",
        "Counter",
        "CreateType",
        "Credential",
        "CredentialsContainer",
        "CropTarget",
        "Crypto",
        "CryptoKey",
        "CustomElementRegistry",
        "CustomEvent",
        "CustomStateSet",
        "DATABASE_ERR",
        "DATA_CLONE_ERR",
        "DATA_ERR",
        "DBLCLICK",
        "DECR",
        "DECR_WRAP",
        "DELETE_STATUS",
        "DEPTH",
        "DEPTH24_STENCIL8",
        "DEPTH32F_STENCIL8",
        "DEPTH_ATTACHMENT",
        "DEPTH_BITS",
        "DEPTH_BUFFER_BIT",
        "DEPTH_CLEAR_VALUE",
        "DEPTH_COMPONENT",
        "DEPTH_COMPONENT16",
        "DEPTH_COMPONENT24",
        "DEPTH_COMPONENT32F",
        "DEPTH_FUNC",
        "DEPTH_RANGE",
        "DEPTH_STENCIL",
        "DEPTH_STENCIL_ATTACHMENT",
        "DEPTH_TEST",
        "DEPTH_WRITEMASK",
        "DEVICE_INELIGIBLE",
        "DIRECTION_DOWN",
        "DIRECTION_LEFT",
        "DIRECTION_RIGHT",
        "DIRECTION_UP",
        "DISABLED",
        "DISPATCH_REQUEST_ERR",
        "DITHER",
        "DOCUMENT_FRAGMENT_NODE",
        "DOCUMENT_NODE",
        "DOCUMENT_POSITION_CONTAINED_BY",
        "DOCUMENT_POSITION_CONTAINS",
        "DOCUMENT_POSITION_DISCONNECTED",
        "DOCUMENT_POSITION_FOLLOWING",
        "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC",
        "DOCUMENT_POSITION_PRECEDING",
        "DOCUMENT_TYPE_NODE",
        "DOMCursor",
        "DOMError",
        "DOMException",
        "DOMImplementation",
        "DOMImplementationLS",
        "DOMMatrix",
        "DOMMatrixReadOnly",
        "DOMParser",
        "DOMPoint",
        "DOMPointReadOnly",
        "DOMQuad",
        "DOMRect",
        "DOMRectList",
        "DOMRectReadOnly",
        "DOMRequest",
        "DOMSTRING_SIZE_ERR",
        "DOMSettableTokenList",
        "DOMStringList",
        "DOMStringMap",
        "DOMTokenList",
        "DOMTransactionEvent",
        "DOM_DELTA_LINE",
        "DOM_DELTA_PAGE",
        "DOM_DELTA_PIXEL",
        "DOM_INPUT_METHOD_DROP",
        "DOM_INPUT_METHOD_HANDWRITING",
        "DOM_INPUT_METHOD_IME",
        "DOM_INPUT_METHOD_KEYBOARD",
        "DOM_INPUT_METHOD_MULTIMODAL",
        "DOM_INPUT_METHOD_OPTION",
        "DOM_INPUT_METHOD_PASTE",
        "DOM_INPUT_METHOD_SCRIPT",
        "DOM_INPUT_METHOD_UNKNOWN",
        "DOM_INPUT_METHOD_VOICE",
        "DOM_KEY_LOCATION_JOYSTICK",
        "DOM_KEY_LOCATION_LEFT",
        "DOM_KEY_LOCATION_MOBILE",
        "DOM_KEY_LOCATION_NUMPAD",
        "DOM_KEY_LOCATION_RIGHT",
        "DOM_KEY_LOCATION_STANDARD",
        "DOM_VK_0",
        "DOM_VK_1",
        "DOM_VK_2",
        "DOM_VK_3",
        "DOM_VK_4",
        "DOM_VK_5",
        "DOM_VK_6",
        "DOM_VK_7",
        "DOM_VK_8",
        "DOM_VK_9",
        "DOM_VK_A",
        "DOM_VK_ACCEPT",
        "DOM_VK_ADD",
        "DOM_VK_ALT",
        "DOM_VK_ALTGR",
        "DOM_VK_AMPERSAND",
        "DOM_VK_ASTERISK",
        "DOM_VK_AT",
        "DOM_VK_ATTN",
        "DOM_VK_B",
        "DOM_VK_BACKSPACE",
        "DOM_VK_BACK_QUOTE",
        "DOM_VK_BACK_SLASH",
        "DOM_VK_BACK_SPACE",
        "DOM_VK_C",
        "DOM_VK_CANCEL",
        "DOM_VK_CAPS_LOCK",
        "DOM_VK_CIRCUMFLEX",
        "DOM_VK_CLEAR",
        "DOM_VK_CLOSE_BRACKET",
        "DOM_VK_CLOSE_CURLY_BRACKET",
        "DOM_VK_CLOSE_PAREN",
        "DOM_VK_COLON",
        "DOM_VK_COMMA",
        "DOM_VK_CONTEXT_MENU",
        "DOM_VK_CONTROL",
        "DOM_VK_CONVERT",
        "DOM_VK_CRSEL",
        "DOM_VK_CTRL",
        "DOM_VK_D",
        "DOM_VK_DECIMAL",
        "DOM_VK_DELETE",
        "DOM_VK_DIVIDE",
        "DOM_VK_DOLLAR",
        "DOM_VK_DOUBLE_QUOTE",
        "DOM_VK_DOWN",
        "DOM_VK_E",
        "DOM_VK_EISU",
        "DOM_VK_END",
        "DOM_VK_ENTER",
        "DOM_VK_EQUALS",
        "DOM_VK_EREOF",
        "DOM_VK_ESCAPE",
        "DOM_VK_EXCLAMATION",
        "DOM_VK_EXECUTE",
        "DOM_VK_EXSEL",
        "DOM_VK_F",
        "DOM_VK_F1",
        "DOM_VK_F10",
        "DOM_VK_F11",
        "DOM_VK_F12",
        "DOM_VK_F13",
        "DOM_VK_F14",
        "DOM_VK_F15",
        "DOM_VK_F16",
        "DOM_VK_F17",
        "DOM_VK_F18",
        "DOM_VK_F19",
        "DOM_VK_F2",
        "DOM_VK_F20",
        "DOM_VK_F21",
        "DOM_VK_F22",
        "DOM_VK_F23",
        "DOM_VK_F24",
        "DOM_VK_F25",
        "DOM_VK_F26",
        "DOM_VK_F27",
        "DOM_VK_F28",
        "DOM_VK_F29",
        "DOM_VK_F3",
        "DOM_VK_F30",
        "DOM_VK_F31",
        "DOM_VK_F32",
        "DOM_VK_F33",
        "DOM_VK_F34",
        "DOM_VK_F35",
        "DOM_VK_F36",
        "DOM_VK_F4",
        "DOM_VK_F5",
        "DOM_VK_F6",
        "DOM_VK_F7",
        "DOM_VK_F8",
        "DOM_VK_F9",
        "DOM_VK_FINAL",
        "DOM_VK_FRONT",
        "DOM_VK_G",
        "DOM_VK_GREATER_THAN",
        "DOM_VK_H",
        "DOM_VK_HANGUL",
        "DOM_VK_HANJA",
        "DOM_VK_HASH",
        "DOM_VK_HELP",
        "DOM_VK_HK_TOGGLE",
        "DOM_VK_HOME",
        "DOM_VK_HYPHEN_MINUS",
        "DOM_VK_I",
        "DOM_VK_INSERT",
        "DOM_VK_J",
        "DOM_VK_JUNJA",
        "DOM_VK_K",
        "DOM_VK_KANA",
        "DOM_VK_KANJI",
        "DOM_VK_L",
        "DOM_VK_LEFT",
        "DOM_VK_LEFT_TAB",
        "DOM_VK_LESS_THAN",
        "DOM_VK_M",
        "DOM_VK_META",
        "DOM_VK_MODECHANGE",
        "DOM_VK_MULTIPLY",
        "DOM_VK_N",
        "DOM_VK_NONCONVERT",
        "DOM_VK_NUMPAD0",
        "DOM_VK_NUMPAD1",
        "DOM_VK_NUMPAD2",
        "DOM_VK_NUMPAD3",
        "DOM_VK_NUMPAD4",
        "DOM_VK_NUMPAD5",
        "DOM_VK_NUMPAD6",
        "DOM_VK_NUMPAD7",
        "DOM_VK_NUMPAD8",
        "DOM_VK_NUMPAD9",
        "DOM_VK_NUM_LOCK",
        "DOM_VK_O",
        "DOM_VK_OEM_1",
        "DOM_VK_OEM_102",
        "DOM_VK_OEM_2",
        "DOM_VK_OEM_3",
        "DOM_VK_OEM_4",
        "DOM_VK_OEM_5",
        "DOM_VK_OEM_6",
        "DOM_VK_OEM_7",
        "DOM_VK_OEM_8",
        "DOM_VK_OEM_COMMA",
        "DOM_VK_OEM_MINUS",
        "DOM_VK_OEM_PERIOD",
        "DOM_VK_OEM_PLUS",
        "DOM_VK_OPEN_BRACKET",
        "DOM_VK_OPEN_CURLY_BRACKET",
        "DOM_VK_OPEN_PAREN",
        "DOM_VK_P",
        "DOM_VK_PA1",
        "DOM_VK_PAGEDOWN",
        "DOM_VK_PAGEUP",
        "DOM_VK_PAGE_DOWN",
        "DOM_VK_PAGE_UP",
        "DOM_VK_PAUSE",
        "DOM_VK_PERCENT",
        "DOM_VK_PERIOD",
        "DOM_VK_PIPE",
        "DOM_VK_PLAY",
        "DOM_VK_PLUS",
        "DOM_VK_PRINT",
        "DOM_VK_PRINTSCREEN",
        "DOM_VK_PROCESSKEY",
        "DOM_VK_PROPERITES",
        "DOM_VK_Q",
        "DOM_VK_QUESTION_MARK",
        "DOM_VK_QUOTE",
        "DOM_VK_R",
        "DOM_VK_REDO",
        "DOM_VK_RETURN",
        "DOM_VK_RIGHT",
        "DOM_VK_S",
        "DOM_VK_SCROLL_LOCK",
        "DOM_VK_SELECT",
        "DOM_VK_SEMICOLON",
        "DOM_VK_SEPARATOR",
        "DOM_VK_SHIFT",
        "DOM_VK_SLASH",
        "DOM_VK_SLEEP",
        "DOM_VK_SPACE",
        "DOM_VK_SUBTRACT",
        "DOM_VK_T",
        "DOM_VK_TAB",
        "DOM_VK_TILDE",
        "DOM_VK_U",
        "DOM_VK_UNDERSCORE",
        "DOM_VK_UNDO",
        "DOM_VK_UNICODE",
        "DOM_VK_UP",
        "DOM_VK_V",
        "DOM_VK_VOLUME_DOWN",
        "DOM_VK_VOLUME_MUTE",
        "DOM_VK_VOLUME_UP",
        "DOM_VK_W",
        "DOM_VK_WIN",
        "DOM_VK_WINDOW",
        "DOM_VK_WIN_ICO_00",
        "DOM_VK_WIN_ICO_CLEAR",
        "DOM_VK_WIN_ICO_HELP",
        "DOM_VK_WIN_OEM_ATTN",
        "DOM_VK_WIN_OEM_AUTO",
        "DOM_VK_WIN_OEM_BACKTAB",
        "DOM_VK_WIN_OEM_CLEAR",
        "DOM_VK_WIN_OEM_COPY",
        "DOM_VK_WIN_OEM_CUSEL",
        "DOM_VK_WIN_OEM_ENLW",
        "DOM_VK_WIN_OEM_FINISH",
        "DOM_VK_WIN_OEM_FJ_JISHO",
        "DOM_VK_WIN_OEM_FJ_LOYA",
        "DOM_VK_WIN_OEM_FJ_MASSHOU",
        "DOM_VK_WIN_OEM_FJ_ROYA",
        "DOM_VK_WIN_OEM_FJ_TOUROKU",
        "DOM_VK_WIN_OEM_JUMP",
        "DOM_VK_WIN_OEM_PA1",
        "DOM_VK_WIN_OEM_PA2",
        "DOM_VK_WIN_OEM_PA3",
        "DOM_VK_WIN_OEM_RESET",
        "DOM_VK_WIN_OEM_WSCTRL",
        "DOM_VK_X",
        "DOM_VK_XF86XK_ADD_FAVORITE",
        "DOM_VK_XF86XK_APPLICATION_LEFT",
        "DOM_VK_XF86XK_APPLICATION_RIGHT",
        "DOM_VK_XF86XK_AUDIO_CYCLE_TRACK",
        "DOM_VK_XF86XK_AUDIO_FORWARD",
        "DOM_VK_XF86XK_AUDIO_LOWER_VOLUME",
        "DOM_VK_XF86XK_AUDIO_MEDIA",
        "DOM_VK_XF86XK_AUDIO_MUTE",
        "DOM_VK_XF86XK_AUDIO_NEXT",
        "DOM_VK_XF86XK_AUDIO_PAUSE",
        "DOM_VK_XF86XK_AUDIO_PLAY",
        "DOM_VK_XF86XK_AUDIO_PREV",
        "DOM_VK_XF86XK_AUDIO_RAISE_VOLUME",
        "DOM_VK_XF86XK_AUDIO_RANDOM_PLAY",
        "DOM_VK_XF86XK_AUDIO_RECORD",
        "DOM_VK_XF86XK_AUDIO_REPEAT",
        "DOM_VK_XF86XK_AUDIO_REWIND",
        "DOM_VK_XF86XK_AUDIO_STOP",
        "DOM_VK_XF86XK_AWAY",
        "DOM_VK_XF86XK_BACK",
        "DOM_VK_XF86XK_BACK_FORWARD",
        "DOM_VK_XF86XK_BATTERY",
        "DOM_VK_XF86XK_BLUE",
        "DOM_VK_XF86XK_BLUETOOTH",
        "DOM_VK_XF86XK_BOOK",
        "DOM_VK_XF86XK_BRIGHTNESS_ADJUST",
        "DOM_VK_XF86XK_CALCULATOR",
        "DOM_VK_XF86XK_CALENDAR",
        "DOM_VK_XF86XK_CD",
        "DOM_VK_XF86XK_CLOSE",
        "DOM_VK_XF86XK_COMMUNITY",
        "DOM_VK_XF86XK_CONTRAST_ADJUST",
        "DOM_VK_XF86XK_COPY",
        "DOM_VK_XF86XK_CUT",
        "DOM_VK_XF86XK_CYCLE_ANGLE",
        "DOM_VK_XF86XK_DISPLAY",
        "DOM_VK_XF86XK_DOCUMENTS",
        "DOM_VK_XF86XK_DOS",
        "DOM_VK_XF86XK_EJECT",
        "DOM_VK_XF86XK_EXCEL",
        "DOM_VK_XF86XK_EXPLORER",
        "DOM_VK_XF86XK_FAVORITES",
        "DOM_VK_XF86XK_FINANCE",
        "DOM_VK_XF86XK_FORWARD",
        "DOM_VK_XF86XK_FRAME_BACK",
        "DOM_VK_XF86XK_FRAME_FORWARD",
        "DOM_VK_XF86XK_GAME",
        "DOM_VK_XF86XK_GO",
        "DOM_VK_XF86XK_GREEN",
        "DOM_VK_XF86XK_HIBERNATE",
        "DOM_VK_XF86XK_HISTORY",
        "DOM_VK_XF86XK_HOME_PAGE",
        "DOM_VK_XF86XK_HOT_LINKS",
        "DOM_VK_XF86XK_I_TOUCH",
        "DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN",
        "DOM_VK_XF86XK_KBD_BRIGHTNESS_UP",
        "DOM_VK_XF86XK_KBD_LIGHT_ON_OFF",
        "DOM_VK_XF86XK_LAUNCH0",
        "DOM_VK_XF86XK_LAUNCH1",
        "DOM_VK_XF86XK_LAUNCH2",
        "DOM_VK_XF86XK_LAUNCH3",
        "DOM_VK_XF86XK_LAUNCH4",
        "DOM_VK_XF86XK_LAUNCH5",
        "DOM_VK_XF86XK_LAUNCH6",
        "DOM_VK_XF86XK_LAUNCH7",
        "DOM_VK_XF86XK_LAUNCH8",
        "DOM_VK_XF86XK_LAUNCH9",
        "DOM_VK_XF86XK_LAUNCH_A",
        "DOM_VK_XF86XK_LAUNCH_B",
        "DOM_VK_XF86XK_LAUNCH_C",
        "DOM_VK_XF86XK_LAUNCH_D",
        "DOM_VK_XF86XK_LAUNCH_E",
        "DOM_VK_XF86XK_LAUNCH_F",
        "DOM_VK_XF86XK_LIGHT_BULB",
        "DOM_VK_XF86XK_LOG_OFF",
        "DOM_VK_XF86XK_MAIL",
        "DOM_VK_XF86XK_MAIL_FORWARD",
        "DOM_VK_XF86XK_MARKET",
        "DOM_VK_XF86XK_MEETING",
        "DOM_VK_XF86XK_MEMO",
        "DOM_VK_XF86XK_MENU_KB",
        "DOM_VK_XF86XK_MENU_PB",
        "DOM_VK_XF86XK_MESSENGER",
        "DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN",
        "DOM_VK_XF86XK_MON_BRIGHTNESS_UP",
        "DOM_VK_XF86XK_MUSIC",
        "DOM_VK_XF86XK_MY_COMPUTER",
        "DOM_VK_XF86XK_MY_SITES",
        "DOM_VK_XF86XK_NEW",
        "DOM_VK_XF86XK_NEWS",
        "DOM_VK_XF86XK_OFFICE_HOME",
        "DOM_VK_XF86XK_OPEN",
        "DOM_VK_XF86XK_OPEN_URL",
        "DOM_VK_XF86XK_OPTION",
        "DOM_VK_XF86XK_PASTE",
        "DOM_VK_XF86XK_PHONE",
        "DOM_VK_XF86XK_PICTURES",
        "DOM_VK_XF86XK_POWER_DOWN",
        "DOM_VK_XF86XK_POWER_OFF",
        "DOM_VK_XF86XK_RED",
        "DOM_VK_XF86XK_REFRESH",
        "DOM_VK_XF86XK_RELOAD",
        "DOM_VK_XF86XK_REPLY",
        "DOM_VK_XF86XK_ROCKER_DOWN",
        "DOM_VK_XF86XK_ROCKER_ENTER",
        "DOM_VK_XF86XK_ROCKER_UP",
        "DOM_VK_XF86XK_ROTATE_WINDOWS",
        "DOM_VK_XF86XK_ROTATION_KB",
        "DOM_VK_XF86XK_ROTATION_PB",
        "DOM_VK_XF86XK_SAVE",
        "DOM_VK_XF86XK_SCREEN_SAVER",
        "DOM_VK_XF86XK_SCROLL_CLICK",
        "DOM_VK_XF86XK_SCROLL_DOWN",
        "DOM_VK_XF86XK_SCROLL_UP",
        "DOM_VK_XF86XK_SEARCH",
        "DOM_VK_XF86XK_SEND",
        "DOM_VK_XF86XK_SHOP",
        "DOM_VK_XF86XK_SPELL",
        "DOM_VK_XF86XK_SPLIT_SCREEN",
        "DOM_VK_XF86XK_STANDBY",
        "DOM_VK_XF86XK_START",
        "DOM_VK_XF86XK_STOP",
        "DOM_VK_XF86XK_SUBTITLE",
        "DOM_VK_XF86XK_SUPPORT",
        "DOM_VK_XF86XK_SUSPEND",
        "DOM_VK_XF86XK_TASK_PANE",
        "DOM_VK_XF86XK_TERMINAL",
        "DOM_VK_XF86XK_TIME",
        "DOM_VK_XF86XK_TOOLS",
        "DOM_VK_XF86XK_TOP_MENU",
        "DOM_VK_XF86XK_TO_DO_LIST",
        "DOM_VK_XF86XK_TRAVEL",
        "DOM_VK_XF86XK_USER1KB",
        "DOM_VK_XF86XK_USER2KB",
        "DOM_VK_XF86XK_USER_PB",
        "DOM_VK_XF86XK_UWB",
        "DOM_VK_XF86XK_VENDOR_HOME",
        "DOM_VK_XF86XK_VIDEO",
        "DOM_VK_XF86XK_VIEW",
        "DOM_VK_XF86XK_WAKE_UP",
        "DOM_VK_XF86XK_WEB_CAM",
        "DOM_VK_XF86XK_WHEEL_BUTTON",
        "DOM_VK_XF86XK_WLAN",
        "DOM_VK_XF86XK_WORD",
        "DOM_VK_XF86XK_WWW",
        "DOM_VK_XF86XK_XFER",
        "DOM_VK_XF86XK_YELLOW",
        "DOM_VK_XF86XK_ZOOM_IN",
        "DOM_VK_XF86XK_ZOOM_OUT",
        "DOM_VK_Y",
        "DOM_VK_Z",
        "DOM_VK_ZOOM",
        "DONE",
        "DONT_CARE",
        "DOWNLOADING",
        "DRAGDROP",
        "DRAW_BUFFER0",
        "DRAW_BUFFER1",
        "DRAW_BUFFER10",
        "DRAW_BUFFER11",
        "DRAW_BUFFER12",
        "DRAW_BUFFER13",
        "DRAW_BUFFER14",
        "DRAW_BUFFER15",
        "DRAW_BUFFER2",
        "DRAW_BUFFER3",
        "DRAW_BUFFER4",
        "DRAW_BUFFER5",
        "DRAW_BUFFER6",
        "DRAW_BUFFER7",
        "DRAW_BUFFER8",
        "DRAW_BUFFER9",
        "DRAW_FRAMEBUFFER",
        "DRAW_FRAMEBUFFER_BINDING",
        "DST_ALPHA",
        "DST_COLOR",
        "DYNAMIC_COPY",
        "DYNAMIC_DRAW",
        "DYNAMIC_READ",
        "DataChannel",
        "DataTransfer",
        "DataTransferItem",
        "DataTransferItemList",
        "DataView",
        "Date",
        "DateTimeFormat",
        "DecompressionStream",
        "DelayNode",
        "DelegatedInkTrailPresenter",
        "DeprecationReportBody",
        "DesktopNotification",
        "DesktopNotificationCenter",
        "Details",
        "DeviceLightEvent",
        "DeviceMotionEvent",
        "DeviceMotionEventAcceleration",
        "DeviceMotionEventRotationRate",
        "DeviceOrientationEvent",
        "DeviceProximityEvent",
        "DeviceStorage",
        "DeviceStorageChangeEvent",
        "Directory",
        "DisplayNames",
        "Document",
        "DocumentFragment",
        "DocumentPictureInPicture",
        "DocumentPictureInPictureEvent",
        "DocumentTimeline",
        "DocumentType",
        "DragEvent",
        "DurationFormat",
        "DynamicsCompressorNode",
        "E",
        "ELEMENT_ARRAY_BUFFER",
        "ELEMENT_ARRAY_BUFFER_BINDING",
        "ELEMENT_NODE",
        "EMPTY",
        "ENCODING_ERR",
        "ENDED",
        "END_TO_END",
        "END_TO_START",
        "ENTITY_NODE",
        "ENTITY_REFERENCE_NODE",
        "EPSILON",
        "EQUAL",
        "EQUALPOWER",
        "ERROR",
        "EXPONENTIAL_DISTANCE",
        "EditContext",
        "Element",
        "ElementInternals",
        "ElementQuery",
        "EncodedAudioChunk",
        "EncodedVideoChunk",
        "EnterPictureInPictureEvent",
        "Entity",
        "EntityReference",
        "Error",
        "ErrorEvent",
        "EvalError",
        "Event",
        "EventCounts",
        "EventException",
        "EventSource",
        "EventTarget",
        "Exception",
        "ExtensionContext",
        "ExtensionDisabledReason",
        "ExtensionInfo",
        "ExtensionInstallType",
        "ExtensionType",
        "External",
        "EyeDropper",
        "FASTEST",
        "FIDOSDK",
        "FILTER_ACCEPT",
        "FILTER_INTERRUPT",
        "FILTER_REJECT",
        "FILTER_SKIP",
        "FINISHED_STATE",
        "FIRST_ORDERED_NODE_TYPE",
        "FLOAT",
        "FLOAT_32_UNSIGNED_INT_24_8_REV",
        "FLOAT_MAT2",
        "FLOAT_MAT2x3",
        "FLOAT_MAT2x4",
        "FLOAT_MAT3",
        "FLOAT_MAT3x2",
        "FLOAT_MAT3x4",
        "FLOAT_MAT4",
        "FLOAT_MAT4x2",
        "FLOAT_MAT4x3",
        "FLOAT_VEC2",
        "FLOAT_VEC3",
        "FLOAT_VEC4",
        "FOCUS",
        "FONT_FACE_RULE",
        "FONT_FEATURE_VALUES_RULE",
        "FRAGMENT",
        "FRAGMENT_SHADER",
        "FRAGMENT_SHADER_DERIVATIVE_HINT",
        "FRAGMENT_SHADER_DERIVATIVE_HINT_OES",
        "FRAMEBUFFER",
        "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",
        "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",
        "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",
        "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",
        "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",
        "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",
        "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",
        "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",
        "FRAMEBUFFER_ATTACHMENT_RED_SIZE",
        "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",
        "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",
        "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",
        "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",
        "FRAMEBUFFER_BINDING",
        "FRAMEBUFFER_COMPLETE",
        "FRAMEBUFFER_DEFAULT",
        "FRAMEBUFFER_INCOMPLETE_ATTACHMENT",
        "FRAMEBUFFER_INCOMPLETE_DIMENSIONS",
        "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
        "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",
        "FRAMEBUFFER_UNSUPPORTED",
        "FRONT",
        "FRONT_AND_BACK",
        "FRONT_FACE",
        "FUNC_ADD",
        "FUNC_REVERSE_SUBTRACT",
        "FUNC_SUBTRACT",
        "FeaturePolicy",
        "FeaturePolicyViolationReportBody",
        "FederatedCredential",
        "Feed",
        "FeedEntry",
        "Fence",
        "FencedFrameConfig",
        "File",
        "FileError",
        "FileList",
        "FileReader",
        "FileSystem",
        "FileSystemDirectoryEntry",
        "FileSystemDirectoryHandle",
        "FileSystemDirectoryReader",
        "FileSystemEntry",
        "FileSystemFileEntry",
        "FileSystemFileHandle",
        "FileSystemHandle",
        "FileSystemWritableFileStream",
        "FinalizationRegistry",
        "FindInPage",
        "Float16Array",
        "Float32Array",
        "Float64Array",
        "FocusEvent",
        "FontData",
        "FontFace",
        "FontFaceSet",
        "FontFaceSetLoadEvent",
        "FormData",
        "FormDataEvent",
        "FragmentDirective",
        "Function",
        "GENERATE_MIPMAP_HINT",
        "GEQUAL",
        "GPU",
        "GPUAdapter",
        "GPUAdapterInfo",
        "GPUBindGroup",
        "GPUBindGroupLayout",
        "GPUBuffer",
        "GPUBufferUsage",
        "GPUCanvasContext",
        "GPUColorWrite",
        "GPUCommandBuffer",
        "GPUCommandEncoder",
        "GPUCompilationInfo",
        "GPUCompilationMessage",
        "GPUComputePassEncoder",
        "GPUComputePipeline",
        "GPUDevice",
        "GPUDeviceLostInfo",
        "GPUError",
        "GPUExternalTexture",
        "GPUInternalError",
        "GPUMapMode",
        "GPUOutOfMemoryError",
        "GPUPipelineError",
        "GPUPipelineLayout",
        "GPUQuerySet",
        "GPUQueue",
        "GPURenderBundle",
        "GPURenderBundleEncoder",
        "GPURenderPassEncoder",
        "GPURenderPipeline",
        "GPUSampler",
        "GPUShaderModule",
        "GPUShaderStage",
        "GPUSupportedFeatures",
        "GPUSupportedLimits",
        "GPUTexture",
        "GPUTextureUsage",
        "GPUTextureView",
        "GPUUncapturedErrorEvent",
        "GPUValidationError",
        "GREATER",
        "GREEN",
        "GREEN_BITS",
        "GainNode",
        "Gamepad",
        "GamepadAxisMoveEvent",
        "GamepadButton",
        "GamepadButtonEvent",
        "GamepadEvent",
        "GamepadHapticActuator",
        "GamepadPose",
        "Geolocation",
        "GeolocationCoordinates",
        "GeolocationPosition",
        "GeolocationPositionError",
        "GestureEvent",
        "GetInfo",
        "Global",
        "GravitySensor",
        "Gyroscope",
        "HALF_FLOAT",
        "HAVE_CURRENT_DATA",
        "HAVE_ENOUGH_DATA",
        "HAVE_FUTURE_DATA",
        "HAVE_METADATA",
        "HAVE_NOTHING",
        "HEADERS_RECEIVED",
        "HID",
        "HIDConnectionEvent",
        "HIDDEN",
        "HIDDevice",
        "HIDInputReportEvent",
        "HIERARCHY_REQUEST_ERR",
        "HIGHPASS",
        "HIGHSHELF",
        "HIGH_FLOAT",
        "HIGH_INT",
        "HORIZONTAL",
        "HORIZONTAL_AXIS",
        "HRTF",
        "HTMLAllCollection",
        "HTMLAnchorElement",
        "HTMLAppletElement",
        "HTMLAreaElement",
        "HTMLAudioElement",
        "HTMLBRElement",
        "HTMLBaseElement",
        "HTMLBaseFontElement",
        "HTMLBlockquoteElement",
        "HTMLBodyElement",
        "HTMLButtonElement",
        "HTMLCanvasElement",
        "HTMLCollection",
        "HTMLCommandElement",
        "HTMLContentElement",
        "HTMLDListElement",
        "HTMLDataElement",
        "HTMLDataListElement",
        "HTMLDetailsElement",
        "HTMLDialogElement",
        "HTMLDirectoryElement",
        "HTMLDivElement",
        "HTMLDocument",
        "HTMLElement",
        "HTMLEmbedElement",
        "HTMLFencedFrameElement",
        "HTMLFieldSetElement",
        "HTMLFontElement",
        "HTMLFormControlsCollection",
        "HTMLFormElement",
        "HTMLFrameElement",
        "HTMLFrameSetElement",
        "HTMLHRElement",
        "HTMLHeadElement",
        "HTMLHeadingElement",
        "HTMLHtmlElement",
        "HTMLIFrameElement",
        "HTMLImageElement",
        "HTMLInputElement",
        "HTMLIsIndexElement",
        "HTMLKeygenElement",
        "HTMLLIElement",
        "HTMLLabelElement",
        "HTMLLegendElement",
        "HTMLLinkElement",
        "HTMLMapElement",
        "HTMLMarqueeElement",
        "HTMLMediaElement",
        "HTMLMenuElement",
        "HTMLMenuItemElement",
        "HTMLMetaElement",
        "HTMLMeterElement",
        "HTMLModElement",
        "HTMLOListElement",
        "HTMLObjectElement",
        "HTMLOptGroupElement",
        "HTMLOptionElement",
        "HTMLOptionsCollection",
        "HTMLOutputElement",
        "HTMLParagraphElement",
        "HTMLParamElement",
        "HTMLPictureElement",
        "HTMLPreElement",
        "HTMLProgressElement",
        "HTMLPropertiesCollection",
        "HTMLQuoteElement",
        "HTMLScriptElement",
        "HTMLSelectElement",
        "HTMLShadowElement",
        "HTMLSlotElement",
        "HTMLSourceElement",
        "HTMLSpanElement",
        "HTMLStyleElement",
        "HTMLTableCaptionElement",
        "HTMLTableCellElement",
        "HTMLTableColElement",
        "HTMLTableElement",
        "HTMLTableRowElement",
        "HTMLTableSectionElement",
        "HTMLTemplateElement",
        "HTMLTextAreaElement",
        "HTMLTimeElement",
        "HTMLTitleElement",
        "HTMLTrackElement",
        "HTMLUListElement",
        "HTMLUnknownElement",
        "HTMLVideoElement",
        "HashChangeEvent",
        "Headers",
        "Highlight",
        "HighlightRegistry",
        "History",
        "Hz",
        "ICE_CHECKING",
        "ICE_CLOSED",
        "ICE_COMPLETED",
        "ICE_CONNECTED",
        "ICE_FAILED",
        "ICE_GATHERING",
        "ICE_WAITING",
        "IDBCursor",
        "IDBCursorWithValue",
        "IDBDatabase",
        "IDBDatabaseException",
        "IDBFactory",
        "IDBFileHandle",
        "IDBFileRequest",
        "IDBIndex",
        "IDBKeyRange",
        "IDBMutableFile",
        "IDBObjectStore",
        "IDBOpenDBRequest",
        "IDBRequest",
        "IDBTransaction",
        "IDBVersionChangeEvent",
        "IDLE",
        "IIRFilterNode",
        "IMPLEMENTATION_COLOR_READ_FORMAT",
        "IMPLEMENTATION_COLOR_READ_TYPE",
        "IMPORT_RULE",
        "INCR",
        "INCR_WRAP",
        "INDEX",
        "INDEX_SIZE_ERR",
        "INDIRECT",
        "INT",
        "INTERLEAVED_ATTRIBS",
        "INT_2_10_10_10_REV",
        "INT_SAMPLER_2D",
        "INT_SAMPLER_2D_ARRAY",
        "INT_SAMPLER_3D",
        "INT_SAMPLER_CUBE",
        "INT_VEC2",
        "INT_VEC3",
        "INT_VEC4",
        "INUSE_ATTRIBUTE_ERR",
        "INVALID_ACCESS_ERR",
        "INVALID_CHARACTER_ERR",
        "INVALID_ENUM",
        "INVALID_EXPRESSION_ERR",
        "INVALID_FRAMEBUFFER_OPERATION",
        "INVALID_INDEX",
        "INVALID_MODIFICATION_ERR",
        "INVALID_NODE_TYPE_ERR",
        "INVALID_OPERATION",
        "INVALID_STATE_ERR",
        "INVALID_VALUE",
        "INVERSE_DISTANCE",
        "INVERT",
        "IceCandidate",
        "IconInfo",
        "IdentityCredential",
        "IdentityCredentialError",
        "IdentityProvider",
        "IdleDeadline",
        "IdleDetector",
        "Image",
        "ImageBitmap",
        "ImageBitmapRenderingContext",
        "ImageCapture",
        "ImageData",
        "ImageDataType",
        "ImageDecoder",
        "ImageTrack",
        "ImageTrackList",
        "Infinity",
        "Ink",
        "InputDeviceCapabilities",
        "InputDeviceInfo",
        "InputEvent",
        "InputMethodContext",
        "InstallTrigger",
        "InstallTriggerImpl",
        "Instance",
        "Int16Array",
        "Int32Array",
        "Int8Array",
        "Intent",
        "InternalError",
        "IntersectionObserver",
        "IntersectionObserverEntry",
        "Intl",
        "IsSearchProviderInstalled",
        "Iterator",
        "JSON",
        "JSTag",
        "KEEP",
        "KEYDOWN",
        "KEYFRAMES_RULE",
        "KEYFRAME_RULE",
        "KEYPRESS",
        "KEYUP",
        "KeyEvent",
        "Keyboard",
        "KeyboardEvent",
        "KeyboardLayoutMap",
        "KeyframeEffect",
        "LENGTHADJUST_SPACING",
        "LENGTHADJUST_SPACINGANDGLYPHS",
        "LENGTHADJUST_UNKNOWN",
        "LEQUAL",
        "LESS",
        "LINEAR",
        "LINEAR_DISTANCE",
        "LINEAR_MIPMAP_LINEAR",
        "LINEAR_MIPMAP_NEAREST",
        "LINES",
        "LINE_LOOP",
        "LINE_STRIP",
        "LINE_WIDTH",
        "LINK_STATUS",
        "LIVE",
        "LN10",
        "LN2",
        "LOADED",
        "LOADING",
        "LOG10E",
        "LOG2E",
        "LOWPASS",
        "LOWSHELF",
        "LOW_FLOAT",
        "LOW_INT",
        "LSException",
        "LSParserFilter",
        "LUMINANCE",
        "LUMINANCE_ALPHA",
        "LanguageCode",
        "LargestContentfulPaint",
        "LaunchParams",
        "LaunchQueue",
        "LaunchType",
        "LayoutShift",
        "LayoutShiftAttribution",
        "LinearAccelerationSensor",
        "LinkError",
        "ListFormat",
        "LocalMediaStream",
        "Locale",
        "Location",
        "Lock",
        "LockManager",
        "MAP_READ",
        "MAP_WRITE",
        "MARGIN_RULE",
        "MAX",
        "MAX_3D_TEXTURE_SIZE",
        "MAX_ARRAY_TEXTURE_LAYERS",
        "MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND",
        "MAX_CLIENT_WAIT_TIMEOUT_WEBGL",
        "MAX_COLOR_ATTACHMENTS",
        "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",
        "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
        "MAX_COMBINED_UNIFORM_BLOCKS",
        "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",
        "MAX_CUBE_MAP_TEXTURE_SIZE",
        "MAX_DRAW_BUFFERS",
        "MAX_ELEMENTS_INDICES",
        "MAX_ELEMENTS_VERTICES",
        "MAX_ELEMENT_INDEX",
        "MAX_FRAGMENT_INPUT_COMPONENTS",
        "MAX_FRAGMENT_UNIFORM_BLOCKS",
        "MAX_FRAGMENT_UNIFORM_COMPONENTS",
        "MAX_FRAGMENT_UNIFORM_VECTORS",
        "MAX_PROGRAM_TEXEL_OFFSET",
        "MAX_RENDERBUFFER_SIZE",
        "MAX_SAFE_INTEGER",
        "MAX_SAMPLES",
        "MAX_SERVER_WAIT_TIMEOUT",
        "MAX_TEXTURE_IMAGE_UNITS",
        "MAX_TEXTURE_LOD_BIAS",
        "MAX_TEXTURE_MAX_ANISOTROPY_EXT",
        "MAX_TEXTURE_SIZE",
        "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",
        "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",
        "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",
        "MAX_UNIFORM_BLOCK_SIZE",
        "MAX_UNIFORM_BUFFER_BINDINGS",
        "MAX_VALUE",
        "MAX_VARYING_COMPONENTS",
        "MAX_VARYING_VECTORS",
        "MAX_VERTEX_ATTRIBS",
        "MAX_VERTEX_OUTPUT_COMPONENTS",
        "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
        "MAX_VERTEX_UNIFORM_BLOCKS",
        "MAX_VERTEX_UNIFORM_COMPONENTS",
        "MAX_VERTEX_UNIFORM_VECTORS",
        "MAX_VIEWPORT_DIMS",
        "MEDIA_ERR_ABORTED",
        "MEDIA_ERR_DECODE",
        "MEDIA_ERR_ENCRYPTED",
        "MEDIA_ERR_NETWORK",
        "MEDIA_ERR_SRC_NOT_SUPPORTED",
        "MEDIA_KEYERR_CLIENT",
        "MEDIA_KEYERR_DOMAIN",
        "MEDIA_KEYERR_HARDWARECHANGE",
        "MEDIA_KEYERR_OUTPUT",
        "MEDIA_KEYERR_SERVICE",
        "MEDIA_KEYERR_UNKNOWN",
        "MEDIA_RULE",
        "MEDIUM_FLOAT",
        "MEDIUM_INT",
        "META_MASK",
        "MIDIAccess",
        "MIDIConnectionEvent",
        "MIDIInput",
        "MIDIInputMap",
        "MIDIMessageEvent",
        "MIDIOutput",
        "MIDIOutputMap",
        "MIDIPort",
        "MIN",
        "MIN_PROGRAM_TEXEL_OFFSET",
        "MIN_SAFE_INTEGER",
        "MIN_VALUE",
        "MIRRORED_REPEAT",
        "MODE_ASYNCHRONOUS",
        "MODE_SYNCHRONOUS",
        "MODIFICATION",
        "MOUSEDOWN",
        "MOUSEDRAG",
        "MOUSEMOVE",
        "MOUSEOUT",
        "MOUSEOVER",
        "MOUSEUP",
        "MOZ_KEYFRAMES_RULE",
        "MOZ_KEYFRAME_RULE",
        "MOZ_SOURCE_CURSOR",
        "MOZ_SOURCE_ERASER",
        "MOZ_SOURCE_KEYBOARD",
        "MOZ_SOURCE_MOUSE",
        "MOZ_SOURCE_PEN",
        "MOZ_SOURCE_TOUCH",
        "MOZ_SOURCE_UNKNOWN",
        "MSGESTURE_FLAG_BEGIN",
        "MSGESTURE_FLAG_CANCEL",
        "MSGESTURE_FLAG_END",
        "MSGESTURE_FLAG_INERTIA",
        "MSGESTURE_FLAG_NONE",
        "MSPOINTER_TYPE_MOUSE",
        "MSPOINTER_TYPE_PEN",
        "MSPOINTER_TYPE_TOUCH",
        "MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE",
        "MS_ASYNC_CALLBACK_STATUS_CANCEL",
        "MS_ASYNC_CALLBACK_STATUS_CHOOSEANY",
        "MS_ASYNC_CALLBACK_STATUS_ERROR",
        "MS_ASYNC_CALLBACK_STATUS_JOIN",
        "MS_ASYNC_OP_STATUS_CANCELED",
        "MS_ASYNC_OP_STATUS_ERROR",
        "MS_ASYNC_OP_STATUS_SUCCESS",
        "MS_MANIPULATION_STATE_ACTIVE",
        "MS_MANIPULATION_STATE_CANCELLED",
        "MS_MANIPULATION_STATE_COMMITTED",
        "MS_MANIPULATION_STATE_DRAGGING",
        "MS_MANIPULATION_STATE_INERTIA",
        "MS_MANIPULATION_STATE_PRESELECT",
        "MS_MANIPULATION_STATE_SELECTING",
        "MS_MANIPULATION_STATE_STOPPED",
        "MS_MEDIA_ERR_ENCRYPTED",
        "MS_MEDIA_KEYERR_CLIENT",
        "MS_MEDIA_KEYERR_DOMAIN",
        "MS_MEDIA_KEYERR_HARDWARECHANGE",
        "MS_MEDIA_KEYERR_OUTPUT",
        "MS_MEDIA_KEYERR_SERVICE",
        "MS_MEDIA_KEYERR_UNKNOWN",
        "Map",
        "Math",
        "MathMLElement",
        "MediaCapabilities",
        "MediaCapabilitiesInfo",
        "MediaController",
        "MediaDeviceInfo",
        "MediaDevices",
        "MediaElementAudioSourceNode",
        "MediaEncryptedEvent",
        "MediaError",
        "MediaKeyError",
        "MediaKeyEvent",
        "MediaKeyMessageEvent",
        "MediaKeyNeededEvent",
        "MediaKeySession",
        "MediaKeyStatusMap",
        "MediaKeySystemAccess",
        "MediaKeys",
        "MediaList",
        "MediaMetadata",
        "MediaQueryList",
        "MediaQueryListEvent",
        "MediaRecorder",
        "MediaRecorderErrorEvent",
        "MediaSession",
        "MediaSettingsRange",
        "MediaSource",
        "MediaSourceHandle",
        "MediaStream",
        "MediaStreamAudioDestinationNode",
        "MediaStreamAudioSourceNode",
        "MediaStreamEvent",
        "MediaStreamTrack",
        "MediaStreamTrackAudioSourceNode",
        "MediaStreamTrackAudioStats",
        "MediaStreamTrackEvent",
        "MediaStreamTrackGenerator",
        "MediaStreamTrackProcessor",
        "MediaStreamTrackVideoStats",
        "Memory",
        "MessageChannel",
        "MessageEvent",
        "MessagePort",
        "MessageSender",
        "Methods",
        "MimeType",
        "MimeTypeArray",
        "Module",
        "MouseEvent",
        "MouseScrollEvent",
        "MozAnimation",
        "MozAnimationDelay",
        "MozAnimationDirection",
        "MozAnimationDuration",
        "MozAnimationFillMode",
        "MozAnimationIterationCount",
        "MozAnimationName",
        "MozAnimationPlayState",
        "MozAnimationTimingFunction",
        "MozAppearance",
        "MozBackfaceVisibility",
        "MozBinding",
        "MozBorderBottomColors",
        "MozBorderEnd",
        "MozBorderEndColor",
        "MozBorderEndStyle",
        "MozBorderEndWidth",
        "MozBorderImage",
        "MozBorderLeftColors",
        "MozBorderRightColors",
        "MozBorderStart",
        "MozBorderStartColor",
        "MozBorderStartStyle",
        "MozBorderStartWidth",
        "MozBorderTopColors",
        "MozBoxAlign",
        "MozBoxDirection",
        "MozBoxFlex",
        "MozBoxOrdinalGroup",
        "MozBoxOrient",
        "MozBoxPack",
        "MozBoxSizing",
        "MozCSSKeyframeRule",
        "MozCSSKeyframesRule",
        "MozColumnCount",
        "MozColumnFill",
        "MozColumnGap",
        "MozColumnRule",
        "MozColumnRuleColor",
        "MozColumnRuleStyle",
        "MozColumnRuleWidth",
        "MozColumnWidth",
        "MozColumns",
        "MozContactChangeEvent",
        "MozFloatEdge",
        "MozFontFeatureSettings",
        "MozFontLanguageOverride",
        "MozForceBrokenImageIcon",
        "MozHyphens",
        "MozImageRegion",
        "MozMarginEnd",
        "MozMarginStart",
        "MozMmsEvent",
        "MozMmsMessage",
        "MozMobileMessageThread",
        "MozOSXFontSmoothing",
        "MozOrient",
        "MozOsxFontSmoothing",
        "MozOutlineRadius",
        "MozOutlineRadiusBottomleft",
        "MozOutlineRadiusBottomright",
        "MozOutlineRadiusTopleft",
        "MozOutlineRadiusTopright",
        "MozPaddingEnd",
        "MozPaddingStart",
        "MozPerspective",
        "MozPerspectiveOrigin",
        "MozPowerManager",
        "MozSettingsEvent",
        "MozSmsEvent",
        "MozSmsMessage",
        "MozStackSizing",
        "MozTabSize",
        "MozTextAlignLast",
        "MozTextDecorationColor",
        "MozTextDecorationLine",
        "MozTextDecorationStyle",
        "MozTextSizeAdjust",
        "MozTransform",
        "MozTransformOrigin",
        "MozTransformStyle",
        "MozTransition",
        "MozTransitionDelay",
        "MozTransitionDuration",
        "MozTransitionProperty",
        "MozTransitionTimingFunction",
        "MozUserFocus",
        "MozUserInput",
        "MozUserModify",
        "MozUserSelect",
        "MozWindowDragging",
        "MozWindowShadow",
        "MutationEvent",
        "MutationObserver",
        "MutationRecord",
        "MutedInfo",
        "MutedInfoReason",
        "NAMESPACE_ERR",
        "NAMESPACE_RULE",
        "NEAREST",
        "NEAREST_MIPMAP_LINEAR",
        "NEAREST_MIPMAP_NEAREST",
        "NEGATIVE_INFINITY",
        "NETWORK_EMPTY",
        "NETWORK_ERR",
        "NETWORK_IDLE",
        "NETWORK_LOADED",
        "NETWORK_LOADING",
        "NETWORK_NO_SOURCE",
        "NEVER",
        "NEW",
        "NEXT",
        "NEXT_NO_DUPLICATE",
        "NICEST",
        "NODE_AFTER",
        "NODE_BEFORE",
        "NODE_BEFORE_AND_AFTER",
        "NODE_INSIDE",
        "NONE",
        "NON_TRANSIENT_ERR",
        "NOTATION_NODE",
        "NOTCH",
        "NOTEQUAL",
        "NOT_ALLOWED_ERR",
        "NOT_FOUND_ERR",
        "NOT_READABLE_ERR",
        "NOT_SUPPORTED_ERR",
        "NO_DATA_ALLOWED_ERR",
        "NO_ERR",
        "NO_ERROR",
        "NO_MODIFICATION_ALLOWED_ERR",
        "NUMBER_TYPE",
        "NUM_COMPRESSED_TEXTURE_FORMATS",
        "NaN",
        "NamedNodeMap",
        "NavigateEvent",
        "Navigation",
        "NavigationActivation",
        "NavigationCurrentEntryChangeEvent",
        "NavigationDestination",
        "NavigationHistoryEntry",
        "NavigationPreloadManager",
        "NavigationTransition",
        "Navigator",
        "NavigatorLogin",
        "NavigatorManagedData",
        "NavigatorUAData",
        "NearbyLinks",
        "NetworkInformation",
        "Node",
        "NodeFilter",
        "NodeIterator",
        "NodeList",
        "NotRestoredReasonDetails",
        "NotRestoredReasons",
        "Notation",
        "Notification",
        "NotifyPaintEvent",
        "Number",
        "NumberFormat",
        "OBJECT_TYPE",
        "OBSOLETE",
        "OK",
        "ONE",
        "ONE_MINUS_CONSTANT_ALPHA",
        "ONE_MINUS_CONSTANT_COLOR",
        "ONE_MINUS_DST_ALPHA",
        "ONE_MINUS_DST_COLOR",
        "ONE_MINUS_SRC_ALPHA",
        "ONE_MINUS_SRC_COLOR",
        "OPEN",
        "OPENED",
        "OPENING",
        "ORDERED_NODE_ITERATOR_TYPE",
        "ORDERED_NODE_SNAPSHOT_TYPE",
        "OTHER_ERROR",
        "OTPCredential",
        "OUT_OF_MEMORY",
        "Object",
        "OfflineAudioCompletionEvent",
        "OfflineAudioContext",
        "OfflineResourceList",
        "OffscreenCanvas",
        "OffscreenCanvasRenderingContext2D",
        "OnClickData",
        "OnInstalledReason",
        "OnPerformanceWarningCategory",
        "OnPerformanceWarningSeverity",
        "OnRestartRequiredReason",
        "Option",
        "OrientationSensor",
        "OscillatorNode",
        "OverconstrainedError",
        "OverflowEvent",
        "PACK_ALIGNMENT",
        "PACK_ROW_LENGTH",
        "PACK_SKIP_PIXELS",
        "PACK_SKIP_ROWS",
        "PAGE_RULE",
        "PARSE_ERR",
        "PATHSEG_ARC_ABS",
        "PATHSEG_ARC_REL",
        "PATHSEG_CLOSEPATH",
        "PATHSEG_CURVETO_CUBIC_ABS",
        "PATHSEG_CURVETO_CUBIC_REL",
        "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS",
        "PATHSEG_CURVETO_CUBIC_SMOOTH_REL",
        "PATHSEG_CURVETO_QUADRATIC_ABS",
        "PATHSEG_CURVETO_QUADRATIC_REL",
        "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS",
        "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL",
        "PATHSEG_LINETO_ABS",
        "PATHSEG_LINETO_HORIZONTAL_ABS",
        "PATHSEG_LINETO_HORIZONTAL_REL",
        "PATHSEG_LINETO_REL",
        "PATHSEG_LINETO_VERTICAL_ABS",
        "PATHSEG_LINETO_VERTICAL_REL",
        "PATHSEG_MOVETO_ABS",
        "PATHSEG_MOVETO_REL",
        "PATHSEG_UNKNOWN",
        "PATH_EXISTS_ERR",
        "PEAKING",
        "PERMISSION_DENIED",
        "PERSISTENT",
        "PI",
        "PIXEL_PACK_BUFFER",
        "PIXEL_PACK_BUFFER_BINDING",
        "PIXEL_UNPACK_BUFFER",
        "PIXEL_UNPACK_BUFFER_BINDING",
        "PLAYING_STATE",
        "POINTS",
        "POLYGON_OFFSET_FACTOR",
        "POLYGON_OFFSET_FILL",
        "POLYGON_OFFSET_UNITS",
        "POSITION_UNAVAILABLE",
        "POSITIVE_INFINITY",
        "PREV",
        "PREV_NO_DUPLICATE",
        "PROCESSING_INSTRUCTION_NODE",
        "PageChangeEvent",
        "PageRevealEvent",
        "PageSettings",
        "PageSwapEvent",
        "PageTransitionEvent",
        "PaintRequest",
        "PaintRequestList",
        "PannerNode",
        "PasswordCredential",
        "Path2D",
        "PaymentAddress",
        "PaymentInstruments",
        "PaymentManager",
        "PaymentMethodChangeEvent",
        "PaymentRequest",
        "PaymentRequestUpdateEvent",
        "PaymentResponse",
        "Performance",
        "PerformanceElementTiming",
        "PerformanceEntry",
        "PerformanceEventTiming",
        "PerformanceLongAnimationFrameTiming",
        "PerformanceLongTaskTiming",
        "PerformanceMark",
        "PerformanceMeasure",
        "PerformanceNavigation",
        "PerformanceNavigationTiming",
        "PerformanceObserver",
        "PerformanceObserverEntryList",
        "PerformancePaintTiming",
        "PerformanceResourceTiming",
        "PerformanceScriptTiming",
        "PerformanceServerTiming",
        "PerformanceTiming",
        "PeriodicSyncManager",
        "PeriodicWave",
        "PermissionStatus",
        "Permissions",
        "PhotoCapabilities",
        "PictureInPictureEvent",
        "PictureInPictureWindow",
        "PlatformArch",
        "PlatformInfo",
        "PlatformNaclArch",
        "PlatformOs",
        "Plugin",
        "PluginArray",
        "PluralRules",
        "PointerEvent",
        "PopStateEvent",
        "PopupBlockedEvent",
        "Port",
        "Presentation",
        "PresentationAvailability",
        "PresentationConnection",
        "PresentationConnectionAvailableEvent",
        "PresentationConnectionCloseEvent",
        "PresentationConnectionList",
        "PresentationReceiver",
        "PresentationRequest",
        "PressureObserver",
        "PressureRecord",
        "ProcessingInstruction",
        "Profiler",
        "ProgressEvent",
        "Promise",
        "PromiseRejectionEvent",
        "PropertyNodeList",
        "ProtectedAudience",
        "Proxy",
        "PublicKeyCredential",
        "PushManager",
        "PushSubscription",
        "PushSubscriptionOptions",
        "Q",
        "QUERY_RESOLVE",
        "QUERY_RESULT",
        "QUERY_RESULT_AVAILABLE",
        "QUOTA_ERR",
        "QUOTA_EXCEEDED_ERR",
        "QueryInterface",
        "R11F_G11F_B10F",
        "R16F",
        "R16I",
        "R16UI",
        "R32F",
        "R32I",
        "R32UI",
        "R8",
        "R8I",
        "R8UI",
        "R8_SNORM",
        "RASTERIZER_DISCARD",
        "READ",
        "READ_BUFFER",
        "READ_FRAMEBUFFER",
        "READ_FRAMEBUFFER_BINDING",
        "READ_ONLY",
        "READ_ONLY_ERR",
        "READ_WRITE",
        "RED",
        "RED_BITS",
        "RED_INTEGER",
        "REMOVAL",
        "RENDERBUFFER",
        "RENDERBUFFER_ALPHA_SIZE",
        "RENDERBUFFER_BINDING",
        "RENDERBUFFER_BLUE_SIZE",
        "RENDERBUFFER_DEPTH_SIZE",
        "RENDERBUFFER_GREEN_SIZE",
        "RENDERBUFFER_HEIGHT",
        "RENDERBUFFER_INTERNAL_FORMAT",
        "RENDERBUFFER_RED_SIZE",
        "RENDERBUFFER_SAMPLES",
        "RENDERBUFFER_STENCIL_SIZE",
        "RENDERBUFFER_WIDTH",
        "RENDERER",
        "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC",
        "RENDERING_INTENT_AUTO",
        "RENDERING_INTENT_PERCEPTUAL",
        "RENDERING_INTENT_RELATIVE_COLORIMETRIC",
        "RENDERING_INTENT_SATURATION",
        "RENDERING_INTENT_UNKNOWN",
        "RENDER_ATTACHMENT",
        "REPEAT",
        "REPLACE",
        "RG",
        "RG16F",
        "RG16I",
        "RG16UI",
        "RG32F",
        "RG32I",
        "RG32UI",
        "RG8",
        "RG8I",
        "RG8UI",
        "RG8_SNORM",
        "RGB",
        "RGB10_A2",
        "RGB10_A2UI",
        "RGB16F",
        "RGB16I",
        "RGB16UI",
        "RGB32F",
        "RGB32I",
        "RGB32UI",
        "RGB565",
        "RGB5_A1",
        "RGB8",
        "RGB8I",
        "RGB8UI",
        "RGB8_SNORM",
        "RGB9_E5",
        "RGBA",
        "RGBA16F",
        "RGBA16I",
        "RGBA16UI",
        "RGBA32F",
        "RGBA32I",
        "RGBA32UI",
        "RGBA4",
        "RGBA8",
        "RGBA8I",
        "RGBA8UI",
        "RGBA8_SNORM",
        "RGBA_INTEGER",
        "RGBColor",
        "RGB_INTEGER",
        "RG_INTEGER",
        "ROTATION_CLOCKWISE",
        "ROTATION_COUNTERCLOCKWISE",
        "RTCCertificate",
        "RTCDTMFSender",
        "RTCDTMFToneChangeEvent",
        "RTCDataChannel",
        "RTCDataChannelEvent",
        "RTCDtlsTransport",
        "RTCEncodedAudioFrame",
        "RTCEncodedVideoFrame",
        "RTCError",
        "RTCErrorEvent",
        "RTCIceCandidate",
        "RTCIceTransport",
        "RTCPeerConnection",
        "RTCPeerConnectionIceErrorEvent",
        "RTCPeerConnectionIceEvent",
        "RTCRtpReceiver",
        "RTCRtpScriptTransform",
        "RTCRtpSender",
        "RTCRtpTransceiver",
        "RTCSctpTransport",
        "RTCSessionDescription",
        "RTCStatsReport",
        "RTCTrackEvent",
        "RadioNodeList",
        "Range",
        "RangeError",
        "RangeException",
        "ReadableByteStreamController",
        "ReadableStream",
        "ReadableStreamBYOBReader",
        "ReadableStreamBYOBRequest",
        "ReadableStreamDefaultController",
        "ReadableStreamDefaultReader",
        "RecordErrorEvent",
        "Rect",
        "ReferenceError",
        "Reflect",
        "RegExp",
        "RelativeOrientationSensor",
        "RelativeTimeFormat",
        "RemotePlayback",
        "Report",
        "ReportBody",
        "ReportingObserver",
        "Request",
        "RequestUpdateCheckStatus",
        "ResizeObserver",
        "ResizeObserverEntry",
        "ResizeObserverSize",
        "Response",
        "RuntimeError",
        "SAMPLER_2D",
        "SAMPLER_2D_ARRAY",
        "SAMPLER_2D_ARRAY_SHADOW",
        "SAMPLER_2D_SHADOW",
        "SAMPLER_3D",
        "SAMPLER_BINDING",
        "SAMPLER_CUBE",
        "SAMPLER_CUBE_SHADOW",
        "SAMPLES",
        "SAMPLE_ALPHA_TO_COVERAGE",
        "SAMPLE_BUFFERS",
        "SAMPLE_COVERAGE",
        "SAMPLE_COVERAGE_INVERT",
        "SAMPLE_COVERAGE_VALUE",
        "SAWTOOTH",
        "SCHEDULED_STATE",
        "SCISSOR_BOX",
        "SCISSOR_TEST",
        "SCROLL_PAGE_DOWN",
        "SCROLL_PAGE_UP",
        "SDP_ANSWER",
        "SDP_OFFER",
        "SDP_PRANSWER",
        "SECURITY_ERR",
        "SELECT",
        "SEPARATE_ATTRIBS",
        "SERIALIZE_ERR",
        "SEVERITY_ERROR",
        "SEVERITY_FATAL_ERROR",
        "SEVERITY_WARNING",
        "SHADER_COMPILER",
        "SHADER_TYPE",
        "SHADING_LANGUAGE_VERSION",
        "SHIFT_MASK",
        "SHORT",
        "SHOWING",
        "SHOW_ALL",
        "SHOW_ATTRIBUTE",
        "SHOW_CDATA_SECTION",
        "SHOW_COMMENT",
        "SHOW_DOCUMENT",
        "SHOW_DOCUMENT_FRAGMENT",
        "SHOW_DOCUMENT_TYPE",
        "SHOW_ELEMENT",
        "SHOW_ENTITY",
        "SHOW_ENTITY_REFERENCE",
        "SHOW_NOTATION",
        "SHOW_PROCESSING_INSTRUCTION",
        "SHOW_TEXT",
        "SIGNALED",
        "SIGNED_NORMALIZED",
        "SINE",
        "SOUNDFIELD",
        "SQLException",
        "SQRT1_2",
        "SQRT2",
        "SQUARE",
        "SRC_ALPHA",
        "SRC_ALPHA_SATURATE",
        "SRC_COLOR",
        "SRGB",
        "SRGB8",
        "SRGB8_ALPHA8",
        "START_TO_END",
        "START_TO_START",
        "STATIC_COPY",
        "STATIC_DRAW",
        "STATIC_READ",
        "STENCIL",
        "STENCIL_ATTACHMENT",
        "STENCIL_BACK_FAIL",
        "STENCIL_BACK_FUNC",
        "STENCIL_BACK_PASS_DEPTH_FAIL",
        "STENCIL_BACK_PASS_DEPTH_PASS",
        "STENCIL_BACK_REF",
        "STENCIL_BACK_VALUE_MASK",
        "STENCIL_BACK_WRITEMASK",
        "STENCIL_BITS",
        "STENCIL_BUFFER_BIT",
        "STENCIL_CLEAR_VALUE",
        "STENCIL_FAIL",
        "STENCIL_FUNC",
        "STENCIL_INDEX",
        "STENCIL_INDEX8",
        "STENCIL_PASS_DEPTH_FAIL",
        "STENCIL_PASS_DEPTH_PASS",
        "STENCIL_REF",
        "STENCIL_TEST",
        "STENCIL_VALUE_MASK",
        "STENCIL_WRITEMASK",
        "STORAGE",
        "STORAGE_BINDING",
        "STREAM_COPY",
        "STREAM_DRAW",
        "STREAM_READ",
        "STRING_TYPE",
        "STYLE_RULE",
        "SUBPIXEL_BITS",
        "SUPPORTS_RULE",
        "SVGAElement",
        "SVGAltGlyphDefElement",
        "SVGAltGlyphElement",
        "SVGAltGlyphItemElement",
        "SVGAngle",
        "SVGAnimateColorElement",
        "SVGAnimateElement",
        "SVGAnimateMotionElement",
        "SVGAnimateTransformElement",
        "SVGAnimatedAngle",
        "SVGAnimatedBoolean",
        "SVGAnimatedEnumeration",
        "SVGAnimatedInteger",
        "SVGAnimatedLength",
        "SVGAnimatedLengthList",
        "SVGAnimatedNumber",
        "SVGAnimatedNumberList",
        "SVGAnimatedPreserveAspectRatio",
        "SVGAnimatedRect",
        "SVGAnimatedString",
        "SVGAnimatedTransformList",
        "SVGAnimationElement",
        "SVGCircleElement",
        "SVGClipPathElement",
        "SVGColor",
        "SVGComponentTransferFunctionElement",
        "SVGCursorElement",
        "SVGDefsElement",
        "SVGDescElement",
        "SVGDiscardElement",
        "SVGDocument",
        "SVGElement",
        "SVGElementInstance",
        "SVGElementInstanceList",
        "SVGEllipseElement",
        "SVGException",
        "SVGFEBlendElement",
        "SVGFEColorMatrixElement",
        "SVGFEComponentTransferElement",
        "SVGFECompositeElement",
        "SVGFEConvolveMatrixElement",
        "SVGFEDiffuseLightingElement",
        "SVGFEDisplacementMapElement",
        "SVGFEDistantLightElement",
        "SVGFEDropShadowElement",
        "SVGFEFloodElement",
        "SVGFEFuncAElement",
        "SVGFEFuncBElement",
        "SVGFEFuncGElement",
        "SVGFEFuncRElement",
        "SVGFEGaussianBlurElement",
        "SVGFEImageElement",
        "SVGFEMergeElement",
        "SVGFEMergeNodeElement",
        "SVGFEMorphologyElement",
        "SVGFEOffsetElement",
        "SVGFEPointLightElement",
        "SVGFESpecularLightingElement",
        "SVGFESpotLightElement",
        "SVGFETileElement",
        "SVGFETurbulenceElement",
        "SVGFilterElement",
        "SVGFontElement",
        "SVGFontFaceElement",
        "SVGFontFaceFormatElement",
        "SVGFontFaceNameElement",
        "SVGFontFaceSrcElement",
        "SVGFontFaceUriElement",
        "SVGForeignObjectElement",
        "SVGGElement",
        "SVGGeometryElement",
        "SVGGlyphElement",
        "SVGGlyphRefElement",
        "SVGGradientElement",
        "SVGGraphicsElement",
        "SVGHKernElement",
        "SVGImageElement",
        "SVGLength",
        "SVGLengthList",
        "SVGLineElement",
        "SVGLinearGradientElement",
        "SVGMPathElement",
        "SVGMarkerElement",
        "SVGMaskElement",
        "SVGMatrix",
        "SVGMetadataElement",
        "SVGMissingGlyphElement",
        "SVGNumber",
        "SVGNumberList",
        "SVGPaint",
        "SVGPathElement",
        "SVGPathSeg",
        "SVGPathSegArcAbs",
        "SVGPathSegArcRel",
        "SVGPathSegClosePath",
        "SVGPathSegCurvetoCubicAbs",
        "SVGPathSegCurvetoCubicRel",
        "SVGPathSegCurvetoCubicSmoothAbs",
        "SVGPathSegCurvetoCubicSmoothRel",
        "SVGPathSegCurvetoQuadraticAbs",
        "SVGPathSegCurvetoQuadraticRel",
        "SVGPathSegCurvetoQuadraticSmoothAbs",
        "SVGPathSegCurvetoQuadraticSmoothRel",
        "SVGPathSegLinetoAbs",
        "SVGPathSegLinetoHorizontalAbs",
        "SVGPathSegLinetoHorizontalRel",
        "SVGPathSegLinetoRel",
        "SVGPathSegLinetoVerticalAbs",
        "SVGPathSegLinetoVerticalRel",
        "SVGPathSegList",
        "SVGPathSegMovetoAbs",
        "SVGPathSegMovetoRel",
        "SVGPatternElement",
        "SVGPoint",
        "SVGPointList",
        "SVGPolygonElement",
        "SVGPolylineElement",
        "SVGPreserveAspectRatio",
        "SVGRadialGradientElement",
        "SVGRect",
        "SVGRectElement",
        "SVGRenderingIntent",
        "SVGSVGElement",
        "SVGScriptElement",
        "SVGSetElement",
        "SVGStopElement",
        "SVGStringList",
        "SVGStyleElement",
        "SVGSwitchElement",
        "SVGSymbolElement",
        "SVGTRefElement",
        "SVGTSpanElement",
        "SVGTextContentElement",
        "SVGTextElement",
        "SVGTextPathElement",
        "SVGTextPositioningElement",
        "SVGTitleElement",
        "SVGTransform",
        "SVGTransformList",
        "SVGUnitTypes",
        "SVGUseElement",
        "SVGVKernElement",
        "SVGViewElement",
        "SVGViewSpec",
        "SVGZoomAndPan",
        "SVGZoomEvent",
        "SVG_ANGLETYPE_DEG",
        "SVG_ANGLETYPE_GRAD",
        "SVG_ANGLETYPE_RAD",
        "SVG_ANGLETYPE_UNKNOWN",
        "SVG_ANGLETYPE_UNSPECIFIED",
        "SVG_CHANNEL_A",
        "SVG_CHANNEL_B",
        "SVG_CHANNEL_G",
        "SVG_CHANNEL_R",
        "SVG_CHANNEL_UNKNOWN",
        "SVG_COLORTYPE_CURRENTCOLOR",
        "SVG_COLORTYPE_RGBCOLOR",
        "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR",
        "SVG_COLORTYPE_UNKNOWN",
        "SVG_EDGEMODE_DUPLICATE",
        "SVG_EDGEMODE_NONE",
        "SVG_EDGEMODE_UNKNOWN",
        "SVG_EDGEMODE_WRAP",
        "SVG_FEBLEND_MODE_COLOR",
        "SVG_FEBLEND_MODE_COLOR_BURN",
        "SVG_FEBLEND_MODE_COLOR_DODGE",
        "SVG_FEBLEND_MODE_DARKEN",
        "SVG_FEBLEND_MODE_DIFFERENCE",
        "SVG_FEBLEND_MODE_EXCLUSION",
        "SVG_FEBLEND_MODE_HARD_LIGHT",
        "SVG_FEBLEND_MODE_HUE",
        "SVG_FEBLEND_MODE_LIGHTEN",
        "SVG_FEBLEND_MODE_LUMINOSITY",
        "SVG_FEBLEND_MODE_MULTIPLY",
        "SVG_FEBLEND_MODE_NORMAL",
        "SVG_FEBLEND_MODE_OVERLAY",
        "SVG_FEBLEND_MODE_SATURATION",
        "SVG_FEBLEND_MODE_SCREEN",
        "SVG_FEBLEND_MODE_SOFT_LIGHT",
        "SVG_FEBLEND_MODE_UNKNOWN",
        "SVG_FECOLORMATRIX_TYPE_HUEROTATE",
        "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA",
        "SVG_FECOLORMATRIX_TYPE_MATRIX",
        "SVG_FECOLORMATRIX_TYPE_SATURATE",
        "SVG_FECOLORMATRIX_TYPE_UNKNOWN",
        "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE",
        "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA",
        "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY",
        "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR",
        "SVG_FECOMPONENTTRANSFER_TYPE_TABLE",
        "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN",
        "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC",
        "SVG_FECOMPOSITE_OPERATOR_ATOP",
        "SVG_FECOMPOSITE_OPERATOR_IN",
        "SVG_FECOMPOSITE_OPERATOR_LIGHTER",
        "SVG_FECOMPOSITE_OPERATOR_OUT",
        "SVG_FECOMPOSITE_OPERATOR_OVER",
        "SVG_FECOMPOSITE_OPERATOR_UNKNOWN",
        "SVG_FECOMPOSITE_OPERATOR_XOR",
        "SVG_INVALID_VALUE_ERR",
        "SVG_LENGTHTYPE_CM",
        "SVG_LENGTHTYPE_EMS",
        "SVG_LENGTHTYPE_EXS",
        "SVG_LENGTHTYPE_IN",
        "SVG_LENGTHTYPE_MM",
        "SVG_LENGTHTYPE_NUMBER",
        "SVG_LENGTHTYPE_PC",
        "SVG_LENGTHTYPE_PERCENTAGE",
        "SVG_LENGTHTYPE_PT",
        "SVG_LENGTHTYPE_PX",
        "SVG_LENGTHTYPE_UNKNOWN",
        "SVG_MARKERUNITS_STROKEWIDTH",
        "SVG_MARKERUNITS_UNKNOWN",
        "SVG_MARKERUNITS_USERSPACEONUSE",
        "SVG_MARKER_ORIENT_ANGLE",
        "SVG_MARKER_ORIENT_AUTO",
        "SVG_MARKER_ORIENT_AUTO_START_REVERSE",
        "SVG_MARKER_ORIENT_UNKNOWN",
        "SVG_MASKTYPE_ALPHA",
        "SVG_MASKTYPE_LUMINANCE",
        "SVG_MATRIX_NOT_INVERTABLE",
        "SVG_MEETORSLICE_MEET",
        "SVG_MEETORSLICE_SLICE",
        "SVG_MEETORSLICE_UNKNOWN",
        "SVG_MORPHOLOGY_OPERATOR_DILATE",
        "SVG_MORPHOLOGY_OPERATOR_ERODE",
        "SVG_MORPHOLOGY_OPERATOR_UNKNOWN",
        "SVG_PAINTTYPE_CURRENTCOLOR",
        "SVG_PAINTTYPE_NONE",
        "SVG_PAINTTYPE_RGBCOLOR",
        "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR",
        "SVG_PAINTTYPE_UNKNOWN",
        "SVG_PAINTTYPE_URI",
        "SVG_PAINTTYPE_URI_CURRENTCOLOR",
        "SVG_PAINTTYPE_URI_NONE",
        "SVG_PAINTTYPE_URI_RGBCOLOR",
        "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR",
        "SVG_PRESERVEASPECTRATIO_NONE",
        "SVG_PRESERVEASPECTRATIO_UNKNOWN",
        "SVG_PRESERVEASPECTRATIO_XMAXYMAX",
        "SVG_PRESERVEASPECTRATIO_XMAXYMID",
        "SVG_PRESERVEASPECTRATIO_XMAXYMIN",
        "SVG_PRESERVEASPECTRATIO_XMIDYMAX",
        "SVG_PRESERVEASPECTRATIO_XMIDYMID",
        "SVG_PRESERVEASPECTRATIO_XMIDYMIN",
        "SVG_PRESERVEASPECTRATIO_XMINYMAX",
        "SVG_PRESERVEASPECTRATIO_XMINYMID",
        "SVG_PRESERVEASPECTRATIO_XMINYMIN",
        "SVG_SPREADMETHOD_PAD",
        "SVG_SPREADMETHOD_REFLECT",
        "SVG_SPREADMETHOD_REPEAT",
        "SVG_SPREADMETHOD_UNKNOWN",
        "SVG_STITCHTYPE_NOSTITCH",
        "SVG_STITCHTYPE_STITCH",
        "SVG_STITCHTYPE_UNKNOWN",
        "SVG_TRANSFORM_MATRIX",
        "SVG_TRANSFORM_ROTATE",
        "SVG_TRANSFORM_SCALE",
        "SVG_TRANSFORM_SKEWX",
        "SVG_TRANSFORM_SKEWY",
        "SVG_TRANSFORM_TRANSLATE",
        "SVG_TRANSFORM_UNKNOWN",
        "SVG_TURBULENCE_TYPE_FRACTALNOISE",
        "SVG_TURBULENCE_TYPE_TURBULENCE",
        "SVG_TURBULENCE_TYPE_UNKNOWN",
        "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX",
        "SVG_UNIT_TYPE_UNKNOWN",
        "SVG_UNIT_TYPE_USERSPACEONUSE",
        "SVG_WRONG_TYPE_ERR",
        "SVG_ZOOMANDPAN_DISABLE",
        "SVG_ZOOMANDPAN_MAGNIFY",
        "SVG_ZOOMANDPAN_UNKNOWN",
        "SYNC_CONDITION",
        "SYNC_FENCE",
        "SYNC_FLAGS",
        "SYNC_FLUSH_COMMANDS_BIT",
        "SYNC_GPU_COMMANDS_COMPLETE",
        "SYNC_STATUS",
        "SYNTAX_ERR",
        "SavedPages",
        "Scheduler",
        "Scheduling",
        "Screen",
        "ScreenDetailed",
        "ScreenDetails",
        "ScreenOrientation",
        "Script",
        "ScriptProcessorNode",
        "ScrollAreaEvent",
        "ScrollTimeline",
        "SecurityPolicyViolationEvent",
        "Segmenter",
        "Selection",
        "Sensor",
        "SensorErrorEvent",
        "Serial",
        "SerialPort",
        "ServiceWorker",
        "ServiceWorkerContainer",
        "ServiceWorkerRegistration",
        "SessionDescription",
        "Set",
        "ShadowRoot",
        "SharedArrayBuffer",
        "SharedStorage",
        "SharedStorageWorklet",
        "SharedWorker",
        "SharingState",
        "SimpleGestureEvent",
        "SnapEvent",
        "SourceBuffer",
        "SourceBufferList",
        "SpeechSynthesis",
        "SpeechSynthesisErrorEvent",
        "SpeechSynthesisEvent",
        "SpeechSynthesisUtterance",
        "SpeechSynthesisVoice",
        "StaticRange",
        "StereoPannerNode",
        "StopIteration",
        "Storage",
        "StorageBucket",
        "StorageBucketManager",
        "StorageEvent",
        "StorageManager",
        "String",
        "StructType",
        "StylePropertyMap",
        "StylePropertyMapReadOnly",
        "StyleSheet",
        "StyleSheetList",
        "SubmitEvent",
        "SubtleCrypto",
        "Symbol",
        "SyncManager",
        "SyntaxError",
        "TAB_ID_NONE",
        "TAB_INDEX_NONE",
        "TEMPORARY",
        "TEXTPATH_METHODTYPE_ALIGN",
        "TEXTPATH_METHODTYPE_STRETCH",
        "TEXTPATH_METHODTYPE_UNKNOWN",
        "TEXTPATH_SPACINGTYPE_AUTO",
        "TEXTPATH_SPACINGTYPE_EXACT",
        "TEXTPATH_SPACINGTYPE_UNKNOWN",
        "TEXTURE",
        "TEXTURE0",
        "TEXTURE1",
        "TEXTURE10",
        "TEXTURE11",
        "TEXTURE12",
        "TEXTURE13",
        "TEXTURE14",
        "TEXTURE15",
        "TEXTURE16",
        "TEXTURE17",
        "TEXTURE18",
        "TEXTURE19",
        "TEXTURE2",
        "TEXTURE20",
        "TEXTURE21",
        "TEXTURE22",
        "TEXTURE23",
        "TEXTURE24",
        "TEXTURE25",
        "TEXTURE26",
        "TEXTURE27",
        "TEXTURE28",
        "TEXTURE29",
        "TEXTURE3",
        "TEXTURE30",
        "TEXTURE31",
        "TEXTURE4",
        "TEXTURE5",
        "TEXTURE6",
        "TEXTURE7",
        "TEXTURE8",
        "TEXTURE9",
        "TEXTURE_2D",
        "TEXTURE_2D_ARRAY",
        "TEXTURE_3D",
        "TEXTURE_BASE_LEVEL",
        "TEXTURE_BINDING",
        "TEXTURE_BINDING_2D",
        "TEXTURE_BINDING_2D_ARRAY",
        "TEXTURE_BINDING_3D",
        "TEXTURE_BINDING_CUBE_MAP",
        "TEXTURE_COMPARE_FUNC",
        "TEXTURE_COMPARE_MODE",
        "TEXTURE_CUBE_MAP",
        "TEXTURE_CUBE_MAP_NEGATIVE_X",
        "TEXTURE_CUBE_MAP_NEGATIVE_Y",
        "TEXTURE_CUBE_MAP_NEGATIVE_Z",
        "TEXTURE_CUBE_MAP_POSITIVE_X",
        "TEXTURE_CUBE_MAP_POSITIVE_Y",
        "TEXTURE_CUBE_MAP_POSITIVE_Z",
        "TEXTURE_IMMUTABLE_FORMAT",
        "TEXTURE_IMMUTABLE_LEVELS",
        "TEXTURE_MAG_FILTER",
        "TEXTURE_MAX_ANISOTROPY_EXT",
        "TEXTURE_MAX_LEVEL",
        "TEXTURE_MAX_LOD",
        "TEXTURE_MIN_FILTER",
        "TEXTURE_MIN_LOD",
        "TEXTURE_WRAP_R",
        "TEXTURE_WRAP_S",
        "TEXTURE_WRAP_T",
        "TEXT_NODE",
        "TIMEOUT",
        "TIMEOUT_ERR",
        "TIMEOUT_EXPIRED",
        "TIMEOUT_IGNORED",
        "TOO_LARGE_ERR",
        "TRANSACTION_INACTIVE_ERR",
        "TRANSFORM_FEEDBACK",
        "TRANSFORM_FEEDBACK_ACTIVE",
        "TRANSFORM_FEEDBACK_BINDING",
        "TRANSFORM_FEEDBACK_BUFFER",
        "TRANSFORM_FEEDBACK_BUFFER_BINDING",
        "TRANSFORM_FEEDBACK_BUFFER_MODE",
        "TRANSFORM_FEEDBACK_BUFFER_SIZE",
        "TRANSFORM_FEEDBACK_BUFFER_START",
        "TRANSFORM_FEEDBACK_PAUSED",
        "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",
        "TRANSFORM_FEEDBACK_VARYINGS",
        "TRIANGLE",
        "TRIANGLES",
        "TRIANGLE_FAN",
        "TRIANGLE_STRIP",
        "TYPE_BACK_FORWARD",
        "TYPE_ERR",
        "TYPE_MISMATCH_ERR",
        "TYPE_NAVIGATE",
        "TYPE_RELOAD",
        "TYPE_RESERVED",
        "Tab",
        "TabStatus",
        "Table",
        "Tag",
        "TaskAttributionTiming",
        "TaskController",
        "TaskPriorityChangeEvent",
        "TaskSignal",
        "Text",
        "TextDecoder",
        "TextDecoderStream",
        "TextEncoder",
        "TextEncoderStream",
        "TextEvent",
        "TextFormat",
        "TextFormatUpdateEvent",
        "TextMetrics",
        "TextTrack",
        "TextTrackCue",
        "TextTrackCueList",
        "TextTrackList",
        "TextUpdateEvent",
        "TimeEvent",
        "TimeRanges",
        "ToggleEvent",
        "Touch",
        "TouchEvent",
        "TouchList",
        "TrackEvent",
        "TransformStream",
        "TransformStreamDefaultController",
        "TransitionEvent",
        "TreeWalker",
        "TrustedHTML",
        "TrustedScript",
        "TrustedScriptURL",
        "TrustedTypePolicy",
        "TrustedTypePolicyFactory",
        "TypeError",
        "TypedObject",
        "U2F",
        "UIEvent",
        "UNCACHED",
        "UNIFORM",
        "UNIFORM_ARRAY_STRIDE",
        "UNIFORM_BLOCK_ACTIVE_UNIFORMS",
        "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",
        "UNIFORM_BLOCK_BINDING",
        "UNIFORM_BLOCK_DATA_SIZE",
        "UNIFORM_BLOCK_INDEX",
        "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",
        "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",
        "UNIFORM_BUFFER",
        "UNIFORM_BUFFER_BINDING",
        "UNIFORM_BUFFER_OFFSET_ALIGNMENT",
        "UNIFORM_BUFFER_SIZE",
        "UNIFORM_BUFFER_START",
        "UNIFORM_IS_ROW_MAJOR",
        "UNIFORM_MATRIX_STRIDE",
        "UNIFORM_OFFSET",
        "UNIFORM_SIZE",
        "UNIFORM_TYPE",
        "UNKNOWN_ERR",
        "UNKNOWN_RULE",
        "UNMASKED_RENDERER_WEBGL",
        "UNMASKED_VENDOR_WEBGL",
        "UNORDERED_NODE_ITERATOR_TYPE",
        "UNORDERED_NODE_SNAPSHOT_TYPE",
        "UNPACK_ALIGNMENT",
        "UNPACK_COLORSPACE_CONVERSION_WEBGL",
        "UNPACK_FLIP_Y_WEBGL",
        "UNPACK_IMAGE_HEIGHT",
        "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
        "UNPACK_ROW_LENGTH",
        "UNPACK_SKIP_IMAGES",
        "UNPACK_SKIP_PIXELS",
        "UNPACK_SKIP_ROWS",
        "UNSCHEDULED_STATE",
        "UNSENT",
        "UNSIGNALED",
        "UNSIGNED_BYTE",
        "UNSIGNED_INT",
        "UNSIGNED_INT_10F_11F_11F_REV",
        "UNSIGNED_INT_24_8",
        "UNSIGNED_INT_2_10_10_10_REV",
        "UNSIGNED_INT_5_9_9_9_REV",
        "UNSIGNED_INT_SAMPLER_2D",
        "UNSIGNED_INT_SAMPLER_2D_ARRAY",
        "UNSIGNED_INT_SAMPLER_3D",
        "UNSIGNED_INT_SAMPLER_CUBE",
        "UNSIGNED_INT_VEC2",
        "UNSIGNED_INT_VEC3",
        "UNSIGNED_INT_VEC4",
        "UNSIGNED_NORMALIZED",
        "UNSIGNED_SHORT",
        "UNSIGNED_SHORT_4_4_4_4",
        "UNSIGNED_SHORT_5_5_5_1",
        "UNSIGNED_SHORT_5_6_5",
        "UNSPECIFIED_EVENT_TYPE_ERR",
        "UPDATEREADY",
        "URIError",
        "URL",
        "URLPattern",
        "URLSearchParams",
        "URLUnencoded",
        "URL_MISMATCH_ERR",
        "USB",
        "USBAlternateInterface",
        "USBConfiguration",
        "USBConnectionEvent",
        "USBDevice",
        "USBEndpoint",
        "USBInTransferResult",
        "USBInterface",
        "USBIsochronousInTransferPacket",
        "USBIsochronousInTransferResult",
        "USBIsochronousOutTransferPacket",
        "USBIsochronousOutTransferResult",
        "USBOutTransferResult",
        "UTC",
        "Uint16Array",
        "Uint32Array",
        "Uint8Array",
        "Uint8ClampedArray",
        "UpdateFilter",
        "UpdatePropertyName",
        "UserActivation",
        "UserMessageHandler",
        "UserMessageHandlersNamespace",
        "UserProximityEvent",
        "VALIDATE_STATUS",
        "VALIDATION_ERR",
        "VARIABLES_RULE",
        "VENDOR",
        "VERSION",
        "VERSION_CHANGE",
        "VERSION_ERR",
        "VERTEX",
        "VERTEX_ARRAY_BINDING",
        "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",
        "VERTEX_ATTRIB_ARRAY_DIVISOR",
        "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",
        "VERTEX_ATTRIB_ARRAY_ENABLED",
        "VERTEX_ATTRIB_ARRAY_INTEGER",
        "VERTEX_ATTRIB_ARRAY_NORMALIZED",
        "VERTEX_ATTRIB_ARRAY_POINTER",
        "VERTEX_ATTRIB_ARRAY_SIZE",
        "VERTEX_ATTRIB_ARRAY_STRIDE",
        "VERTEX_ATTRIB_ARRAY_TYPE",
        "VERTEX_SHADER",
        "VERTICAL",
        "VERTICAL_AXIS",
        "VER_ERR",
        "VIEWPORT",
        "VIEWPORT_RULE",
        "VRDisplay",
        "VRDisplayCapabilities",
        "VRDisplayEvent",
        "VREyeParameters",
        "VRFieldOfView",
        "VRFrameData",
        "VRPose",
        "VRStageParameters",
        "VTTCue",
        "VTTRegion",
        "ValidityState",
        "VideoColorSpace",
        "VideoDecoder",
        "VideoEncoder",
        "VideoFrame",
        "VideoPlaybackQuality",
        "VideoStreamTrack",
        "ViewTimeline",
        "ViewTransition",
        "ViewTransitionTypeSet",
        "ViewType",
        "VirtualKeyboard",
        "VirtualKeyboardGeometryChangeEvent",
        "VisibilityStateEntry",
        "VisualViewport",
        "WAIT_FAILED",
        "WEBKIT_FILTER_RULE",
        "WEBKIT_KEYFRAMES_RULE",
        "WEBKIT_KEYFRAME_RULE",
        "WEBKIT_REGION_RULE",
        "WGSLLanguageFeatures",
        "WINDOW_ID_CURRENT",
        "WINDOW_ID_NONE",
        "WRITE",
        "WRONG_DOCUMENT_ERR",
        "WakeLock",
        "WakeLockSentinel",
        "WasmAnyRef",
        "WaveShaperNode",
        "WeakMap",
        "WeakRef",
        "WeakSet",
        "WebAssembly",
        "WebGL2RenderingContext",
        "WebGLActiveInfo",
        "WebGLBuffer",
        "WebGLContextEvent",
        "WebGLFramebuffer",
        "WebGLObject",
        "WebGLProgram",
        "WebGLQuery",
        "WebGLRenderbuffer",
        "WebGLRenderingContext",
        "WebGLSampler",
        "WebGLShader",
        "WebGLShaderPrecisionFormat",
        "WebGLSync",
        "WebGLTexture",
        "WebGLTransformFeedback",
        "WebGLUniformLocation",
        "WebGLVertexArray",
        "WebGLVertexArrayObject",
        "WebKitAnimationEvent",
        "WebKitBlobBuilder",
        "WebKitCSSFilterRule",
        "WebKitCSSFilterValue",
        "WebKitCSSKeyframeRule",
        "WebKitCSSKeyframesRule",
        "WebKitCSSMatrix",
        "WebKitCSSRegionRule",
        "WebKitCSSTransformValue",
        "WebKitDataCue",
        "WebKitGamepad",
        "WebKitMediaKeyError",
        "WebKitMediaKeyMessageEvent",
        "WebKitMediaKeySession",
        "WebKitMediaKeys",
        "WebKitMediaSource",
        "WebKitMutationObserver",
        "WebKitNamespace",
        "WebKitPlaybackTargetAvailabilityEvent",
        "WebKitPoint",
        "WebKitShadowRoot",
        "WebKitSourceBuffer",
        "WebKitSourceBufferList",
        "WebKitTransitionEvent",
        "WebSocket",
        "WebSocketError",
        "WebSocketStream",
        "WebTransport",
        "WebTransportBidirectionalStream",
        "WebTransportDatagramDuplexStream",
        "WebTransportError",
        "WebTransportReceiveStream",
        "WebTransportSendStream",
        "WebkitAlignContent",
        "WebkitAlignItems",
        "WebkitAlignSelf",
        "WebkitAnimation",
        "WebkitAnimationDelay",
        "WebkitAnimationDirection",
        "WebkitAnimationDuration",
        "WebkitAnimationFillMode",
        "WebkitAnimationIterationCount",
        "WebkitAnimationName",
        "WebkitAnimationPlayState",
        "WebkitAnimationTimingFunction",
        "WebkitAppearance",
        "WebkitBackfaceVisibility",
        "WebkitBackgroundClip",
        "WebkitBackgroundOrigin",
        "WebkitBackgroundSize",
        "WebkitBorderBottomLeftRadius",
        "WebkitBorderBottomRightRadius",
        "WebkitBorderImage",
        "WebkitBorderRadius",
        "WebkitBorderTopLeftRadius",
        "WebkitBorderTopRightRadius",
        "WebkitBoxAlign",
        "WebkitBoxDirection",
        "WebkitBoxFlex",
        "WebkitBoxOrdinalGroup",
        "WebkitBoxOrient",
        "WebkitBoxPack",
        "WebkitBoxShadow",
        "WebkitBoxSizing",
        "WebkitClipPath",
        "WebkitFilter",
        "WebkitFlex",
        "WebkitFlexBasis",
        "WebkitFlexDirection",
        "WebkitFlexFlow",
        "WebkitFlexGrow",
        "WebkitFlexShrink",
        "WebkitFlexWrap",
        "WebkitFontFeatureSettings",
        "WebkitJustifyContent",
        "WebkitLineClamp",
        "WebkitMask",
        "WebkitMaskClip",
        "WebkitMaskComposite",
        "WebkitMaskImage",
        "WebkitMaskOrigin",
        "WebkitMaskPosition",
        "WebkitMaskPositionX",
        "WebkitMaskPositionY",
        "WebkitMaskRepeat",
        "WebkitMaskSize",
        "WebkitOrder",
        "WebkitPerspective",
        "WebkitPerspectiveOrigin",
        "WebkitTextFillColor",
        "WebkitTextSecurity",
        "WebkitTextSizeAdjust",
        "WebkitTextStroke",
        "WebkitTextStrokeColor",
        "WebkitTextStrokeWidth",
        "WebkitTransform",
        "WebkitTransformOrigin",
        "WebkitTransformStyle",
        "WebkitTransition",
        "WebkitTransitionDelay",
        "WebkitTransitionDuration",
        "WebkitTransitionProperty",
        "WebkitTransitionTimingFunction",
        "WebkitUserSelect",
        "WheelEvent",
        "Window",
        "WindowControlsOverlay",
        "WindowControlsOverlayGeometryChangeEvent",
        "WindowState",
        "WindowType",
        "Worker",
        "Worklet",
        "WritableStream",
        "WritableStreamDefaultController",
        "WritableStreamDefaultWriter",
        "XMLDocument",
        "XMLHttpRequest",
        "XMLHttpRequestEventTarget",
        "XMLHttpRequestException",
        "XMLHttpRequestProgressEvent",
        "XMLHttpRequestUpload",
        "XMLSerializer",
        "XMLStylesheetProcessingInstruction",
        "XPathEvaluator",
        "XPathException",
        "XPathExpression",
        "XPathNSResolver",
        "XPathResult",
        "XRAnchor",
        "XRAnchorSet",
        "XRBoundedReferenceSpace",
        "XRCPUDepthInformation",
        "XRCamera",
        "XRDOMOverlayState",
        "XRDepthInformation",
        "XRFrame",
        "XRHand",
        "XRHitTestResult",
        "XRHitTestSource",
        "XRInputSource",
        "XRInputSourceArray",
        "XRInputSourceEvent",
        "XRInputSourcesChangeEvent",
        "XRJointPose",
        "XRJointSpace",
        "XRLayer",
        "XRLightEstimate",
        "XRLightProbe",
        "XRPose",
        "XRRay",
        "XRReferenceSpace",
        "XRReferenceSpaceEvent",
        "XRRenderState",
        "XRRigidTransform",
        "XRSession",
        "XRSessionEvent",
        "XRSpace",
        "XRSystem",
        "XRTransientInputHitTestResult",
        "XRTransientInputHitTestSource",
        "XRView",
        "XRViewerPose",
        "XRViewport",
        "XRWebGLBinding",
        "XRWebGLDepthInformation",
        "XRWebGLLayer",
        "XSLTProcessor",
        "ZERO",
        "ZoomSettings",
        "ZoomSettingsMode",
        "ZoomSettingsScope",
        "_XD0M_",
        "_YD0M_",
        "__REACT_DEVTOOLS_GLOBAL_HOOK__",
        "__brand",
        "__defineGetter__",
        "__defineSetter__",
        "__lookupGetter__",
        "__lookupSetter__",
        "__opera",
        "__proto__",
        "_browserjsran",
        "a",
        "aLink",
        "abbr",
        "abort",
        "aborted",
        "aboutConfigPrefs",
        "abs",
        "absolute",
        "acceleration",
        "accelerationIncludingGravity",
        "accelerator",
        "accent-color",
        "accentColor",
        "accept",
        "acceptCharset",
        "acceptNode",
        "access",
        "accessKey",
        "accessKeyLabel",
        "accuracy",
        "acos",
        "acosh",
        "action",
        "actionURL",
        "actions",
        "activated",
        "activation",
        "activationStart",
        "active",
        "activeCues",
        "activeElement",
        "activeSourceBuffers",
        "activeSourceCount",
        "activeTexture",
        "activeVRDisplays",
        "activityLog",
        "actualBoundingBoxAscent",
        "actualBoundingBoxDescent",
        "actualBoundingBoxLeft",
        "actualBoundingBoxRight",
        "adAuctionComponents",
        "adAuctionHeaders",
        "add",
        "addAll",
        "addBehavior",
        "addCandidate",
        "addColorStop",
        "addCue",
        "addElement",
        "addEventListener",
        "addFilter",
        "addFromString",
        "addFromUri",
        "addIceCandidate",
        "addImport",
        "addListener",
        "addModule",
        "addNamed",
        "addPageRule",
        "addPath",
        "addPointer",
        "addRange",
        "addRegion",
        "addRule",
        "addSearchEngine",
        "addSourceBuffer",
        "addStream",
        "addTextTrack",
        "addTrack",
        "addTransceiver",
        "addWakeLockListener",
        "added",
        "addedNodes",
        "additionalName",
        "additiveSymbols",
        "addons",
        "address",
        "addressLine",
        "addressModeU",
        "addressModeV",
        "addressModeW",
        "adoptNode",
        "adoptedCallback",
        "adoptedStyleSheets",
        "adr",
        "advance",
        "after",
        "alarms",
        "album",
        "alert",
        "algorithm",
        "align",
        "align-content",
        "align-items",
        "align-self",
        "alignContent",
        "alignItems",
        "alignSelf",
        "alignmentBaseline",
        "alinkColor",
        "all",
        "allSettled",
        "allocationSize",
        "allow",
        "allowFullscreen",
        "allowPaymentRequest",
        "allowedDirections",
        "allowedFeatures",
        "allowedToPlay",
        "allowsFeature",
        "alpha",
        "alphaMode",
        "alphaToCoverageEnabled",
        "alphabeticBaseline",
        "alt",
        "altGraphKey",
        "altHtml",
        "altKey",
        "altLeft",
        "alternate",
        "alternateSetting",
        "alternates",
        "altitude",
        "altitudeAccuracy",
        "altitudeAngle",
        "amplitude",
        "ancestorOrigins",
        "anchor",
        "anchorNode",
        "anchorOffset",
        "anchorSpace",
        "anchors",
        "and",
        "angle",
        "angularAcceleration",
        "angularVelocity",
        "animVal",
        "animate",
        "animated",
        "animatedInstanceRoot",
        "animatedNormalizedPathSegList",
        "animatedPathSegList",
        "animatedPoints",
        "animation",
        "animation-composition",
        "animation-delay",
        "animation-direction",
        "animation-duration",
        "animation-fill-mode",
        "animation-iteration-count",
        "animation-name",
        "animation-play-state",
        "animation-timing-function",
        "animationComposition",
        "animationDelay",
        "animationDirection",
        "animationDuration",
        "animationFillMode",
        "animationIterationCount",
        "animationName",
        "animationPlayState",
        "animationStartTime",
        "animationTimingFunction",
        "animationsPaused",
        "anniversary",
        "antialias",
        "anticipatedRemoval",
        "any",
        "app",
        "appCodeName",
        "appMinorVersion",
        "appName",
        "appNotifications",
        "appVersion",
        "appearance",
        "append",
        "appendBuffer",
        "appendChild",
        "appendData",
        "appendItem",
        "appendMedium",
        "appendNamed",
        "appendRule",
        "appendStream",
        "appendWindowEnd",
        "appendWindowStart",
        "applets",
        "applicationCache",
        "applicationServerKey",
        "apply",
        "applyConstraints",
        "applyElement",
        "arc",
        "arcTo",
        "arch",
        "architecture",
        "archive",
        "areas",
        "arguments",
        "ariaAtomic",
        "ariaAutoComplete",
        "ariaBrailleLabel",
        "ariaBrailleRoleDescription",
        "ariaBusy",
        "ariaChecked",
        "ariaColCount",
        "ariaColIndex",
        "ariaColIndexText",
        "ariaColSpan",
        "ariaCurrent",
        "ariaDescription",
        "ariaDisabled",
        "ariaExpanded",
        "ariaHasPopup",
        "ariaHidden",
        "ariaInvalid",
        "ariaKeyShortcuts",
        "ariaLabel",
        "ariaLevel",
        "ariaLive",
        "ariaModal",
        "ariaMultiLine",
        "ariaMultiSelectable",
        "ariaOrientation",
        "ariaPlaceholder",
        "ariaPosInSet",
        "ariaPressed",
        "ariaReadOnly",
        "ariaRelevant",
        "ariaRequired",
        "ariaRoleDescription",
        "ariaRowCount",
        "ariaRowIndex",
        "ariaRowIndexText",
        "ariaRowSpan",
        "ariaSelected",
        "ariaSetSize",
        "ariaSort",
        "ariaValueMax",
        "ariaValueMin",
        "ariaValueNow",
        "ariaValueText",
        "arrayBuffer",
        "arrayLayerCount",
        "arrayStride",
        "artist",
        "artwork",
        "as",
        "asIntN",
        "asUintN",
        "ascentOverride",
        "asin",
        "asinh",
        "aspect",
        "aspect-ratio",
        "aspectRatio",
        "assert",
        "assign",
        "assignedElements",
        "assignedNodes",
        "assignedSlot",
        "async",
        "asyncDispose",
        "asyncIterator",
        "at",
        "atEnd",
        "atan",
        "atan2",
        "atanh",
        "atob",
        "attachEvent",
        "attachInternals",
        "attachShader",
        "attachShadow",
        "attachedElements",
        "attachments",
        "attack",
        "attestationObject",
        "attrChange",
        "attrName",
        "attributeChangedCallback",
        "attributeFilter",
        "attributeName",
        "attributeNamespace",
        "attributeOldValue",
        "attributeStyleMap",
        "attributes",
        "attribution",
        "attributionSrc",
        "audioBitrateMode",
        "audioBitsPerSecond",
        "audioTracks",
        "audioWorklet",
        "authenticatedSignedWrites",
        "authenticatorAttachment",
        "authenticatorData",
        "autoIncrement",
        "autobuffer",
        "autocapitalize",
        "autocomplete",
        "autocorrect",
        "autofocus",
        "automationRate",
        "autoplay",
        "availHeight",
        "availLeft",
        "availTop",
        "availWidth",
        "availability",
        "available",
        "averageLatency",
        "aversion",
        "ax",
        "axes",
        "axis",
        "ay",
        "azimuth",
        "azimuthAngle",
        "b",
        "back",
        "backdrop-filter",
        "backdropFilter",
        "backends",
        "backface-visibility",
        "backfaceVisibility",
        "background",
        "background-attachment",
        "background-blend-mode",
        "background-clip",
        "background-color",
        "background-image",
        "background-origin",
        "background-position",
        "background-position-x",
        "background-position-y",
        "background-repeat",
        "background-size",
        "backgroundAttachment",
        "backgroundBlendMode",
        "backgroundClip",
        "backgroundColor",
        "backgroundFetch",
        "backgroundImage",
        "backgroundOrigin",
        "backgroundPosition",
        "backgroundPositionX",
        "backgroundPositionY",
        "backgroundRepeat",
        "backgroundSize",
        "badInput",
        "badge",
        "balance",
        "baseArrayLayer",
        "baseFrequencyX",
        "baseFrequencyY",
        "baseLatency",
        "baseLayer",
        "baseMipLevel",
        "baseNode",
        "baseOffset",
        "basePalette",
        "baseURI",
        "baseVal",
        "baseline-source",
        "baselineShift",
        "baselineSource",
        "battery",
        "bday",
        "before",
        "beginComputePass",
        "beginElement",
        "beginElementAt",
        "beginOcclusionQuery",
        "beginPath",
        "beginQuery",
        "beginRenderPass",
        "beginTransformFeedback",
        "beginningOfPassWriteIndex",
        "behavior",
        "behaviorCookie",
        "behaviorPart",
        "behaviorUrns",
        "beta",
        "bezierCurveTo",
        "bgColor",
        "bgProperties",
        "bias",
        "big",
        "bigint64",
        "biguint64",
        "binaryType",
        "bind",
        "bindAttribLocation",
        "bindBuffer",
        "bindBufferBase",
        "bindBufferRange",
        "bindFramebuffer",
        "bindGroupLayouts",
        "bindRenderbuffer",
        "bindSampler",
        "bindTexture",
        "bindTransformFeedback",
        "bindVertexArray",
        "binding",
        "bitness",
        "blend",
        "blendColor",
        "blendEquation",
        "blendEquationSeparate",
        "blendFunc",
        "blendFuncSeparate",
        "blink",
        "blitFramebuffer",
        "blob",
        "block-size",
        "blockDirection",
        "blockSize",
        "blockedURI",
        "blocking",
        "blockingDuration",
        "blue",
        "bluetooth",
        "blur",
        "body",
        "bodyUsed",
        "bold",
        "bookmarks",
        "booleanValue",
        "border",
        "border-block",
        "border-block-color",
        "border-block-end",
        "border-block-end-color",
        "border-block-end-style",
        "border-block-end-width",
        "border-block-start",
        "border-block-start-color",
        "border-block-start-style",
        "border-block-start-width",
        "border-block-style",
        "border-block-width",
        "border-bottom",
        "border-bottom-color",
        "border-bottom-left-radius",
        "border-bottom-right-radius",
        "border-bottom-style",
        "border-bottom-width",
        "border-collapse",
        "border-color",
        "border-end-end-radius",
        "border-end-start-radius",
        "border-image",
        "border-image-outset",
        "border-image-repeat",
        "border-image-slice",
        "border-image-source",
        "border-image-width",
        "border-inline",
        "border-inline-color",
        "border-inline-end",
        "border-inline-end-color",
        "border-inline-end-style",
        "border-inline-end-width",
        "border-inline-start",
        "border-inline-start-color",
        "border-inline-start-style",
        "border-inline-start-width",
        "border-inline-style",
        "border-inline-width",
        "border-left",
        "border-left-color",
        "border-left-style",
        "border-left-width",
        "border-radius",
        "border-right",
        "border-right-color",
        "border-right-style",
        "border-right-width",
        "border-spacing",
        "border-start-end-radius",
        "border-start-start-radius",
        "border-style",
        "border-top",
        "border-top-color",
        "border-top-left-radius",
        "border-top-right-radius",
        "border-top-style",
        "border-top-width",
        "border-width",
        "borderBlock",
        "borderBlockColor",
        "borderBlockEnd",
        "borderBlockEndColor",
        "borderBlockEndStyle",
        "borderBlockEndWidth",
        "borderBlockStart",
        "borderBlockStartColor",
        "borderBlockStartStyle",
        "borderBlockStartWidth",
        "borderBlockStyle",
        "borderBlockWidth",
        "borderBottom",
        "borderBottomColor",
        "borderBottomLeftRadius",
        "borderBottomRightRadius",
        "borderBottomStyle",
        "borderBottomWidth",
        "borderBoxSize",
        "borderCollapse",
        "borderColor",
        "borderColorDark",
        "borderColorLight",
        "borderEndEndRadius",
        "borderEndStartRadius",
        "borderImage",
        "borderImageOutset",
        "borderImageRepeat",
        "borderImageSlice",
        "borderImageSource",
        "borderImageWidth",
        "borderInline",
        "borderInlineColor",
        "borderInlineEnd",
        "borderInlineEndColor",
        "borderInlineEndStyle",
        "borderInlineEndWidth",
        "borderInlineStart",
        "borderInlineStartColor",
        "borderInlineStartStyle",
        "borderInlineStartWidth",
        "borderInlineStyle",
        "borderInlineWidth",
        "borderLeft",
        "borderLeftColor",
        "borderLeftStyle",
        "borderLeftWidth",
        "borderRadius",
        "borderRight",
        "borderRightColor",
        "borderRightStyle",
        "borderRightWidth",
        "borderSpacing",
        "borderStartEndRadius",
        "borderStartStartRadius",
        "borderStyle",
        "borderTop",
        "borderTopColor",
        "borderTopLeftRadius",
        "borderTopRightRadius",
        "borderTopStyle",
        "borderTopWidth",
        "borderWidth",
        "bottom",
        "bottomMargin",
        "bound",
        "boundElements",
        "boundingClientRect",
        "boundingHeight",
        "boundingLeft",
        "boundingRect",
        "boundingTop",
        "boundingWidth",
        "bounds",
        "boundsGeometry",
        "box-decoration-break",
        "box-shadow",
        "box-sizing",
        "boxDecorationBreak",
        "boxShadow",
        "boxSizing",
        "brand",
        "brands",
        "break-after",
        "break-before",
        "break-inside",
        "breakAfter",
        "breakBefore",
        "breakInside",
        "broadcast",
        "browser",
        "browserLanguage",
        "browserSettings",
        "browsingData",
        "browsingTopics",
        "btoa",
        "bubbles",
        "buffer",
        "bufferData",
        "bufferDepth",
        "bufferSize",
        "bufferSubData",
        "buffered",
        "bufferedAmount",
        "bufferedAmountLowThreshold",
        "buffers",
        "buildID",
        "buildNumber",
        "button",
        "buttonID",
        "buttons",
        "byobRequest",
        "byteLength",
        "byteOffset",
        "bytes",
        "bytesPerRow",
        "bytesWritten",
        "c",
        "cache",
        "caches",
        "call",
        "caller",
        "camera",
        "canBeFormatted",
        "canBeMounted",
        "canBeShared",
        "canConstructInDedicatedWorker",
        "canGoBack",
        "canGoForward",
        "canHaveChildren",
        "canHaveHTML",
        "canInsertDTMF",
        "canIntercept",
        "canLoadAdAuctionFencedFrame",
        "canLoadOpaqueURL",
        "canMakePayment",
        "canParse",
        "canPlayType",
        "canPresent",
        "canShare",
        "canTransition",
        "canTrickleIceCandidates",
        "cancel",
        "cancelAndHoldAtTime",
        "cancelAnimationFrame",
        "cancelBubble",
        "cancelIdleCallback",
        "cancelScheduledValues",
        "cancelVideoFrameCallback",
        "cancelWatchAvailability",
        "cancelable",
        "candidate",
        "canonicalUUID",
        "canvas",
        "cap",
        "capabilities",
        "caption",
        "caption-side",
        "captionSide",
        "captivePortal",
        "capture",
        "captureEvents",
        "captureStackTrace",
        "captureStream",
        "captureTab",
        "captureVisibleTab",
        "caret-color",
        "caretBidiLevel",
        "caretColor",
        "caretPositionFromPoint",
        "caretRangeFromPoint",
        "cast",
        "catch",
        "category",
        "cbrt",
        "cd",
        "ceil",
        "cellIndex",
        "cellPadding",
        "cellSpacing",
        "cells",
        "ch",
        "chOff",
        "chain",
        "challenge",
        "changeType",
        "changed",
        "changedTouches",
        "channel",
        "channelCount",
        "channelCountMode",
        "channelInterpretation",
        "chapterInfo",
        "char",
        "charAt",
        "charCode",
        "charCodeAt",
        "charIndex",
        "charLength",
        "characterBounds",
        "characterBoundsRangeStart",
        "characterData",
        "characterDataOldValue",
        "characterSet",
        "characteristic",
        "charging",
        "chargingTime",
        "charset",
        "check",
        "checkDCE",
        "checkEnclosure",
        "checkFramebufferStatus",
        "checkIntersection",
        "checkValidity",
        "checkVisibility",
        "checked",
        "childElementCount",
        "childList",
        "childNodes",
        "children",
        "chrome",
        "ciphertext",
        "cite",
        "city",
        "claimInterface",
        "claimed",
        "classList",
        "className",
        "classid",
        "clear",
        "clearAppBadge",
        "clearAttributes",
        "clearBuffer",
        "clearBufferfi",
        "clearBufferfv",
        "clearBufferiv",
        "clearBufferuiv",
        "clearColor",
        "clearData",
        "clearDepth",
        "clearHalt",
        "clearImmediate",
        "clearInterval",
        "clearLiveSeekableRange",
        "clearMarks",
        "clearMaxGCPauseAccumulator",
        "clearMeasures",
        "clearOriginJoinedAdInterestGroups",
        "clearParameters",
        "clearRect",
        "clearResourceTimings",
        "clearShadow",
        "clearStencil",
        "clearTimeout",
        "clearValue",
        "clearWatch",
        "click",
        "clickCount",
        "clientDataJSON",
        "clientHeight",
        "clientInformation",
        "clientLeft",
        "clientRect",
        "clientRects",
        "clientTop",
        "clientWaitSync",
        "clientWidth",
        "clientX",
        "clientY",
        "clip",
        "clip-path",
        "clip-rule",
        "clipBottom",
        "clipLeft",
        "clipPath",
        "clipPathUnits",
        "clipRight",
        "clipRule",
        "clipTop",
        "clipboard",
        "clipboardData",
        "clonable",
        "clone",
        "cloneContents",
        "cloneNode",
        "cloneRange",
        "close",
        "closeCode",
        "closePath",
        "closed",
        "closest",
        "clz",
        "clz32",
        "cm",
        "cmp",
        "code",
        "codeBase",
        "codePointAt",
        "codeType",
        "codedHeight",
        "codedRect",
        "codedWidth",
        "colSpan",
        "collapse",
        "collapseToEnd",
        "collapseToStart",
        "collapsed",
        "collect",
        "collections",
        "colno",
        "color",
        "color-adjust",
        "color-interpolation",
        "color-interpolation-filters",
        "color-scheme",
        "colorAdjust",
        "colorAttachments",
        "colorDepth",
        "colorFormats",
        "colorInterpolation",
        "colorInterpolationFilters",
        "colorMask",
        "colorScheme",
        "colorSpace",
        "colorType",
        "cols",
        "column-count",
        "column-fill",
        "column-gap",
        "column-rule",
        "column-rule-color",
        "column-rule-style",
        "column-rule-width",
        "column-span",
        "column-width",
        "columnCount",
        "columnFill",
        "columnGap",
        "columnNumber",
        "columnRule",
        "columnRuleColor",
        "columnRuleStyle",
        "columnRuleWidth",
        "columnSpan",
        "columnWidth",
        "columns",
        "command",
        "commands",
        "commit",
        "commitLoadTime",
        "commitPreferences",
        "commitStyles",
        "commonAncestorContainer",
        "compact",
        "compare",
        "compareBoundaryPoints",
        "compareDocumentPosition",
        "compareEndPoints",
        "compareExchange",
        "compareNode",
        "comparePoint",
        "compatMode",
        "compatible",
        "compile",
        "compileShader",
        "compileStreaming",
        "complete",
        "completed",
        "component",
        "componentFromPoint",
        "composed",
        "composedPath",
        "composite",
        "compositionEndOffset",
        "compositionStartOffset",
        "compressedTexImage2D",
        "compressedTexImage3D",
        "compressedTexSubImage2D",
        "compressedTexSubImage3D",
        "compute",
        "computedStyleMap",
        "concat",
        "conditionText",
        "coneInnerAngle",
        "coneOuterAngle",
        "coneOuterGain",
        "config",
        "configurable",
        "configuration",
        "configurationName",
        "configurationValue",
        "configurations",
        "configure",
        "confirm",
        "confirmComposition",
        "confirmSiteSpecificTrackingException",
        "confirmWebWideTrackingException",
        "congestionControl",
        "connect",
        "connectEnd",
        "connectNative",
        "connectShark",
        "connectStart",
        "connected",
        "connectedCallback",
        "connection",
        "connectionInfo",
        "connectionList",
        "connectionSpeed",
        "connectionState",
        "connections",
        "console",
        "consolidate",
        "constants",
        "constraint",
        "constrictionActive",
        "construct",
        "constructor",
        "contactID",
        "contain",
        "contain-intrinsic-block-size",
        "contain-intrinsic-height",
        "contain-intrinsic-inline-size",
        "contain-intrinsic-size",
        "contain-intrinsic-width",
        "containIntrinsicBlockSize",
        "containIntrinsicHeight",
        "containIntrinsicInlineSize",
        "containIntrinsicSize",
        "containIntrinsicWidth",
        "container",
        "container-name",
        "container-type",
        "containerId",
        "containerName",
        "containerQuery",
        "containerSrc",
        "containerType",
        "contains",
        "containsNode",
        "content",
        "content-visibility",
        "contentBoxSize",
        "contentDocument",
        "contentEditable",
        "contentHint",
        "contentOverflow",
        "contentRect",
        "contentScriptType",
        "contentStyleType",
        "contentType",
        "contentVisibility",
        "contentWindow",
        "context",
        "contextId",
        "contextIds",
        "contextMenu",
        "contextMenus",
        "contextType",
        "contextTypes",
        "contextmenu",
        "contextualIdentities",
        "continue",
        "continuePrimaryKey",
        "continuous",
        "control",
        "controlTransferIn",
        "controlTransferOut",
        "controller",
        "controls",
        "controlsList",
        "convertPointFromNode",
        "convertQuadFromNode",
        "convertRectFromNode",
        "convertToBlob",
        "convertToSpecifiedUnits",
        "cookie",
        "cookieEnabled",
        "cookieStore",
        "cookies",
        "coords",
        "copyBufferSubData",
        "copyBufferToBuffer",
        "copyBufferToTexture",
        "copyExternalImageToTexture",
        "copyFromChannel",
        "copyTexImage2D",
        "copyTexSubImage2D",
        "copyTexSubImage3D",
        "copyTextureToBuffer",
        "copyTextureToTexture",
        "copyTo",
        "copyToChannel",
        "copyWithin",
        "correspondingElement",
        "correspondingUseElement",
        "corruptedVideoFrames",
        "cos",
        "cosh",
        "count",
        "countReset",
        "counter-increment",
        "counter-reset",
        "counter-set",
        "counterIncrement",
        "counterReset",
        "counterSet",
        "country",
        "cpuClass",
        "cpuSleepAllowed",
        "cqb",
        "cqh",
        "cqi",
        "cqmax",
        "cqmin",
        "cqw",
        "create",
        "createAnalyser",
        "createAnchor",
        "createAnswer",
        "createAttribute",
        "createAttributeNS",
        "createAuctionNonce",
        "createBidirectionalStream",
        "createBindGroup",
        "createBindGroupLayout",
        "createBiquadFilter",
        "createBuffer",
        "createBufferSource",
        "createCDATASection",
        "createCSSStyleSheet",
        "createCaption",
        "createChannelMerger",
        "createChannelSplitter",
        "createCommandEncoder",
        "createComment",
        "createComputePipeline",
        "createComputePipelineAsync",
        "createConicGradient",
        "createConstantSource",
        "createContextualFragment",
        "createControlRange",
        "createConvolver",
        "createDTMFSender",
        "createDataChannel",
        "createDelay",
        "createDelayNode",
        "createDocument",
        "createDocumentFragment",
        "createDocumentType",
        "createDynamicsCompressor",
        "createElement",
        "createElementNS",
        "createEncodedStreams",
        "createEntityReference",
        "createEvent",
        "createEventObject",
        "createExpression",
        "createFramebuffer",
        "createFunction",
        "createGain",
        "createGainNode",
        "createHTML",
        "createHTMLDocument",
        "createIIRFilter",
        "createImageBitmap",
        "createImageData",
        "createIndex",
        "createJavaScriptNode",
        "createLinearGradient",
        "createMediaElementSource",
        "createMediaKeys",
        "createMediaStreamDestination",
        "createMediaStreamSource",
        "createMediaStreamTrackSource",
        "createMutableFile",
        "createNSResolver",
        "createNodeIterator",
        "createNotification",
        "createObjectStore",
        "createObjectURL",
        "createOffer",
        "createOscillator",
        "createPanner",
        "createPattern",
        "createPeriodicWave",
        "createPipelineLayout",
        "createPolicy",
        "createPopup",
        "createProcessingInstruction",
        "createProgram",
        "createQuery",
        "createQuerySet",
        "createRadialGradient",
        "createRange",
        "createRangeCollection",
        "createReader",
        "createRenderBundleEncoder",
        "createRenderPipeline",
        "createRenderPipelineAsync",
        "createRenderbuffer",
        "createSVGAngle",
        "createSVGLength",
        "createSVGMatrix",
        "createSVGNumber",
        "createSVGPathSegArcAbs",
        "createSVGPathSegArcRel",
        "createSVGPathSegClosePath",
        "createSVGPathSegCurvetoCubicAbs",
        "createSVGPathSegCurvetoCubicRel",
        "createSVGPathSegCurvetoCubicSmoothAbs",
        "createSVGPathSegCurvetoCubicSmoothRel",
        "createSVGPathSegCurvetoQuadraticAbs",
        "createSVGPathSegCurvetoQuadraticRel",
        "createSVGPathSegCurvetoQuadraticSmoothAbs",
        "createSVGPathSegCurvetoQuadraticSmoothRel",
        "createSVGPathSegLinetoAbs",
        "createSVGPathSegLinetoHorizontalAbs",
        "createSVGPathSegLinetoHorizontalRel",
        "createSVGPathSegLinetoRel",
        "createSVGPathSegLinetoVerticalAbs",
        "createSVGPathSegLinetoVerticalRel",
        "createSVGPathSegMovetoAbs",
        "createSVGPathSegMovetoRel",
        "createSVGPoint",
        "createSVGRect",
        "createSVGTransform",
        "createSVGTransformFromMatrix",
        "createSampler",
        "createScript",
        "createScriptProcessor",
        "createScriptURL",
        "createSession",
        "createShader",
        "createShaderModule",
        "createShadowRoot",
        "createStereoPanner",
        "createStyleSheet",
        "createTBody",
        "createTFoot",
        "createTHead",
        "createTask",
        "createTextNode",
        "createTextRange",
        "createTexture",
        "createTouch",
        "createTouchList",
        "createTransformFeedback",
        "createTreeWalker",
        "createUnidirectionalStream",
        "createVertexArray",
        "createView",
        "createWaveShaper",
        "createWorklet",
        "createWritable",
        "creationTime",
        "credentialless",
        "credentials",
        "criticalCHRestart",
        "cropTo",
        "crossOrigin",
        "crossOriginIsolated",
        "crypto",
        "csi",
        "csp",
        "cssFloat",
        "cssRules",
        "cssText",
        "cssValueType",
        "ctrlKey",
        "ctrlLeft",
        "cues",
        "cullFace",
        "cullMode",
        "currentCSSZoom",
        "currentDirection",
        "currentEntry",
        "currentLocalDescription",
        "currentNode",
        "currentPage",
        "currentRect",
        "currentRemoteDescription",
        "currentScale",
        "currentScreen",
        "currentScript",
        "currentSrc",
        "currentState",
        "currentStyle",
        "currentTarget",
        "currentTime",
        "currentTranslate",
        "currentView",
        "cursor",
        "curve",
        "customElements",
        "customError",
        "cx",
        "cy",
        "d",
        "data",
        "dataFld",
        "dataFormatAs",
        "dataLoss",
        "dataLossMessage",
        "dataPageSize",
        "dataSrc",
        "dataTransfer",
        "database",
        "databases",
        "datagrams",
        "dataset",
        "dateTime",
        "db",
        "debug",
        "debuggerEnabled",
        "declarativeNetRequest",
        "declare",
        "decode",
        "decodeAudioData",
        "decodeQueueSize",
        "decodeURI",
        "decodeURIComponent",
        "decodedBodySize",
        "decoding",
        "decodingInfo",
        "decrypt",
        "default",
        "defaultCharset",
        "defaultChecked",
        "defaultMuted",
        "defaultPlaybackRate",
        "defaultPolicy",
        "defaultPrevented",
        "defaultQueue",
        "defaultRequest",
        "defaultSelected",
        "defaultStatus",
        "defaultURL",
        "defaultValue",
        "defaultView",
        "defaultstatus",
        "defer",
        "define",
        "defineMagicFunction",
        "defineMagicVariable",
        "defineProperties",
        "defineProperty",
        "deg",
        "delay",
        "delayTime",
        "delegatesFocus",
        "delete",
        "deleteBuffer",
        "deleteCaption",
        "deleteCell",
        "deleteContents",
        "deleteData",
        "deleteDatabase",
        "deleteFramebuffer",
        "deleteFromDocument",
        "deleteIndex",
        "deleteMedium",
        "deleteObjectStore",
        "deleteProgram",
        "deleteProperty",
        "deleteQuery",
        "deleteRenderbuffer",
        "deleteRow",
        "deleteRule",
        "deleteSampler",
        "deleteShader",
        "deleteSync",
        "deleteTFoot",
        "deleteTHead",
        "deleteTexture",
        "deleteTransformFeedback",
        "deleteVertexArray",
        "deleted",
        "deliverChangeRecords",
        "deliveredFrames",
        "deliveredFramesDuration",
        "delivery",
        "deliveryInfo",
        "deliveryStatus",
        "deliveryTimestamp",
        "deliveryType",
        "delta",
        "deltaMode",
        "deltaX",
        "deltaY",
        "deltaZ",
        "dependentLocality",
        "deprecatedReplaceInURN",
        "deprecatedRunAdAuctionEnforcesKAnonymity",
        "deprecatedURNToURL",
        "depthBias",
        "depthBiasClamp",
        "depthBiasSlopeScale",
        "depthClearValue",
        "depthCompare",
        "depthDataFormat",
        "depthFailOp",
        "depthFar",
        "depthFunc",
        "depthLoadOp",
        "depthMask",
        "depthNear",
        "depthOrArrayLayers",
        "depthRange",
        "depthReadOnly",
        "depthStencil",
        "depthStencilAttachment",
        "depthStencilFormat",
        "depthStoreOp",
        "depthUsage",
        "depthWriteEnabled",
        "deref",
        "deriveBits",
        "deriveKey",
        "descentOverride",
        "description",
        "deselectAll",
        "designMode",
        "desiredSize",
        "destination",
        "destinationURL",
        "destroy",
        "detach",
        "detachEvent",
        "detachShader",
        "detached",
        "detail",
        "details",
        "detect",
        "detectLanguage",
        "detune",
        "device",
        "deviceClass",
        "deviceId",
        "deviceMemory",
        "devicePixelContentBoxSize",
        "devicePixelRatio",
        "deviceProtocol",
        "deviceSubclass",
        "deviceVersionMajor",
        "deviceVersionMinor",
        "deviceVersionSubminor",
        "deviceXDPI",
        "deviceYDPI",
        "devtools",
        "devtools_panels",
        "didTimeout",
        "difference",
        "diffuseConstant",
        "digest",
        "dimension",
        "dimensions",
        "dir",
        "dirName",
        "direction",
        "dirxml",
        "disable",
        "disablePictureInPicture",
        "disableRemotePlayback",
        "disableVertexAttribArray",
        "disabled",
        "discard",
        "discardedFrames",
        "dischargingTime",
        "disconnect",
        "disconnectShark",
        "disconnectedCallback",
        "dispatchEvent",
        "dispatchWorkgroups",
        "dispatchWorkgroupsIndirect",
        "display",
        "displayHeight",
        "displayId",
        "displayName",
        "displayWidth",
        "dispose",
        "disposition",
        "distanceModel",
        "div",
        "divisor",
        "djsapi",
        "djsproxy",
        "dns",
        "doImport",
        "doNotTrack",
        "doScroll",
        "doctype",
        "document",
        "documentElement",
        "documentId",
        "documentIds",
        "documentLifecycle",
        "documentMode",
        "documentOrigin",
        "documentOrigins",
        "documentPictureInPicture",
        "documentURI",
        "documentUrl",
        "documentUrls",
        "dolphin",
        "dolphinGameCenter",
        "dolphininfo",
        "dolphinmeta",
        "dom",
        "domComplete",
        "domContentLoadedEventEnd",
        "domContentLoadedEventStart",
        "domInteractive",
        "domLoading",
        "domOverlayState",
        "domain",
        "domainLookupEnd",
        "domainLookupStart",
        "dominant-baseline",
        "dominantBaseline",
        "done",
        "dopplerFactor",
        "dotAll",
        "downDegrees",
        "downlink",
        "download",
        "downloadRequest",
        "downloadTotal",
        "downloaded",
        "downloads",
        "dpcm",
        "dpi",
        "dppx",
        "dragDrop",
        "draggable",
        "draw",
        "drawArrays",
        "drawArraysInstanced",
        "drawArraysInstancedANGLE",
        "drawBuffers",
        "drawCustomFocusRing",
        "drawElements",
        "drawElementsInstanced",
        "drawElementsInstancedANGLE",
        "drawFocusIfNeeded",
        "drawImage",
        "drawImageFromRect",
        "drawIndexed",
        "drawIndexedIndirect",
        "drawIndirect",
        "drawRangeElements",
        "drawSystemFocusRing",
        "drawingBufferColorSpace",
        "drawingBufferFormat",
        "drawingBufferHeight",
        "drawingBufferStorage",
        "drawingBufferWidth",
        "drop",
        "dropEffect",
        "droppedVideoFrames",
        "dropzone",
        "dstFactor",
        "dtmf",
        "dump",
        "dumpProfile",
        "duplex",
        "duplicate",
        "durability",
        "duration",
        "dvb",
        "dvh",
        "dvi",
        "dvmax",
        "dvmin",
        "dvname",
        "dvnum",
        "dvw",
        "dx",
        "dy",
        "dynamicId",
        "dynsrc",
        "e",
        "edgeMode",
        "editContext",
        "effect",
        "effectAllowed",
        "effectiveDirective",
        "effectiveType",
        "effects",
        "elapsedTime",
        "element",
        "elementFromPoint",
        "elementTiming",
        "elements",
        "elementsFromPoint",
        "elevation",
        "ellipse",
        "em",
        "emHeightAscent",
        "emHeightDescent",
        "email",
        "embeds",
        "emit",
        "emma",
        "empty",
        "empty-cells",
        "emptyCells",
        "emptyHTML",
        "emptyScript",
        "emulatedPosition",
        "enable",
        "enableBackground",
        "enableDelegations",
        "enableStyleSheetsForSet",
        "enableVertexAttribArray",
        "enabled",
        "enabledFeatures",
        "enabledPlugin",
        "encode",
        "encodeInto",
        "encodeQueueSize",
        "encodeURI",
        "encodeURIComponent",
        "encodedBodySize",
        "encoding",
        "encodingInfo",
        "encrypt",
        "enctype",
        "end",
        "endContainer",
        "endElement",
        "endElementAt",
        "endOcclusionQuery",
        "endOfPassWriteIndex",
        "endOfStream",
        "endOffset",
        "endQuery",
        "endTime",
        "endTransformFeedback",
        "ended",
        "endpoint",
        "endpointNumber",
        "endpoints",
        "endsWith",
        "enqueue",
        "enterKeyHint",
        "entities",
        "entries",
        "entry",
        "entryPoint",
        "entryType",
        "enumerable",
        "enumerate",
        "enumerateDevices",
        "enumerateEditable",
        "environmentBlendMode",
        "equals",
        "error",
        "errorCode",
        "errorDetail",
        "errorText",
        "escape",
        "estimate",
        "eval",
        "evaluate",
        "event",
        "eventCounts",
        "eventPhase",
        "events",
        "every",
        "ex",
        "exception",
        "exchange",
        "exec",
        "execCommand",
        "execCommandShowHelp",
        "execScript",
        "executeBundles",
        "executionStart",
        "exitFullscreen",
        "exitPictureInPicture",
        "exitPointerLock",
        "exitPresent",
        "exp",
        "expand",
        "expandEntityReferences",
        "expando",
        "expansion",
        "expectedImprovement",
        "experiments",
        "expiration",
        "expirationTime",
        "expires",
        "expiryDate",
        "explicitOriginalTarget",
        "expm1",
        "exponent",
        "exponentialRampToValueAtTime",
        "exportKey",
        "exports",
        "extend",
        "extension",
        "extensionTypes",
        "extensions",
        "extentNode",
        "extentOffset",
        "external",
        "externalResourcesRequired",
        "externalTexture",
        "extractContents",
        "extractable",
        "eye",
        "f",
        "f16round",
        "face",
        "factoryReset",
        "failOp",
        "failureReason",
        "fallback",
        "family",
        "familyName",
        "farthestViewportElement",
        "fastSeek",
        "fatal",
        "featureId",
        "featurePolicy",
        "featureSettings",
        "features",
        "fence",
        "fenceSync",
        "fetch",
        "fetchPriority",
        "fetchStart",
        "fftSize",
        "fgColor",
        "fieldOfView",
        "file",
        "fileCreatedDate",
        "fileHandle",
        "fileModifiedDate",
        "fileName",
        "fileSize",
        "fileUpdatedDate",
        "filename",
        "files",
        "filesystem",
        "fill",
        "fill-opacity",
        "fill-rule",
        "fillJointRadii",
        "fillLightMode",
        "fillOpacity",
        "fillPoses",
        "fillRect",
        "fillRule",
        "fillStyle",
        "fillText",
        "filter",
        "filterResX",
        "filterResY",
        "filterUnits",
        "filters",
        "finally",
        "find",
        "findIndex",
        "findLast",
        "findLastIndex",
        "findRule",
        "findText",
        "finish",
        "finishDocumentLoadTime",
        "finishLoadTime",
        "finished",
        "fireEvent",
        "firesTouchEvents",
        "firstChild",
        "firstElementChild",
        "firstInterimResponseStart",
        "firstPage",
        "firstPaintAfterLoadTime",
        "firstPaintTime",
        "firstUIEventTimestamp",
        "fixed",
        "flags",
        "flat",
        "flatMap",
        "flex",
        "flex-basis",
        "flex-direction",
        "flex-flow",
        "flex-grow",
        "flex-shrink",
        "flex-wrap",
        "flexBasis",
        "flexDirection",
        "flexFlow",
        "flexGrow",
        "flexShrink",
        "flexWrap",
        "flipX",
        "flipY",
        "float",
        "float32",
        "float64",
        "flood-color",
        "flood-opacity",
        "floodColor",
        "floodOpacity",
        "floor",
        "flush",
        "focus",
        "focusNode",
        "focusOffset",
        "font",
        "font-family",
        "font-feature-settings",
        "font-kerning",
        "font-language-override",
        "font-optical-sizing",
        "font-palette",
        "font-size",
        "font-size-adjust",
        "font-stretch",
        "font-style",
        "font-synthesis",
        "font-synthesis-position",
        "font-synthesis-small-caps",
        "font-synthesis-style",
        "font-synthesis-weight",
        "font-variant",
        "font-variant-alternates",
        "font-variant-caps",
        "font-variant-east-asian",
        "font-variant-ligatures",
        "font-variant-numeric",
        "font-variant-position",
        "font-variation-settings",
        "font-weight",
        "fontBoundingBoxAscent",
        "fontBoundingBoxDescent",
        "fontFamily",
        "fontFeatureSettings",
        "fontKerning",
        "fontLanguageOverride",
        "fontOpticalSizing",
        "fontPalette",
        "fontSize",
        "fontSizeAdjust",
        "fontSmoothingEnabled",
        "fontStretch",
        "fontStyle",
        "fontSynthesis",
        "fontSynthesisPosition",
        "fontSynthesisSmallCaps",
        "fontSynthesisStyle",
        "fontSynthesisWeight",
        "fontVariant",
        "fontVariantAlternates",
        "fontVariantCaps",
        "fontVariantEastAsian",
        "fontVariantLigatures",
        "fontVariantNumeric",
        "fontVariantPosition",
        "fontVariationSettings",
        "fontWeight",
        "fontcolor",
        "fontfaces",
        "fonts",
        "fontsize",
        "for",
        "forEach",
        "force",
        "forceFallbackAdapter",
        "forceRedraw",
        "forced-color-adjust",
        "forcedColorAdjust",
        "forcedStyleAndLayoutDuration",
        "forget",
        "form",
        "formAction",
        "formData",
        "formEnctype",
        "formMethod",
        "formNoValidate",
        "formTarget",
        "format",
        "formatToParts",
        "forms",
        "forward",
        "forwardX",
        "forwardY",
        "forwardZ",
        "foundation",
        "fr",
        "fragment",
        "fragmentDirective",
        "frame",
        "frameBorder",
        "frameCount",
        "frameElement",
        "frameId",
        "frameIds",
        "frameSpacing",
        "framebuffer",
        "framebufferHeight",
        "framebufferRenderbuffer",
        "framebufferTexture2D",
        "framebufferTextureLayer",
        "framebufferWidth",
        "frames",
        "freeSpace",
        "freeze",
        "frequency",
        "frequencyBinCount",
        "from",
        "fromAsync",
        "fromBase64",
        "fromCharCode",
        "fromCodePoint",
        "fromElement",
        "fromEntries",
        "fromFloat32Array",
        "fromFloat64Array",
        "fromHex",
        "fromMatrix",
        "fromPoint",
        "fromQuad",
        "fromRect",
        "frontFace",
        "fround",
        "fullName",
        "fullPath",
        "fullRange",
        "fullScreen",
        "fullVersionList",
        "fullscreen",
        "fullscreenElement",
        "fullscreenEnabled",
        "fx",
        "fy",
        "g",
        "gain",
        "gamepad",
        "gamma",
        "gap",
        "gatheringState",
        "gatt",
        "geckoProfiler",
        "genderIdentity",
        "generateCertificate",
        "generateKey",
        "generateMipmap",
        "generateRequest",
        "geolocation",
        "gestureObject",
        "get",
        "getAcceptLanguages",
        "getActiveAttrib",
        "getActiveUniform",
        "getActiveUniformBlockName",
        "getActiveUniformBlockParameter",
        "getActiveUniforms",
        "getAdjacentText",
        "getAll",
        "getAllKeys",
        "getAllResponseHeaders",
        "getAllowlistForFeature",
        "getAnimations",
        "getAsFile",
        "getAsFileSystemHandle",
        "getAsString",
        "getAttachedShaders",
        "getAttribLocation",
        "getAttribute",
        "getAttributeNS",
        "getAttributeNames",
        "getAttributeNode",
        "getAttributeNodeNS",
        "getAttributeType",
        "getAudioTracks",
        "getAuthenticatorData",
        "getAutoplayPolicy",
        "getAvailability",
        "getBBox",
        "getBackgroundPage",
        "getBadgeBackgroundColor",
        "getBadgeText",
        "getBadgeTextColor",
        "getBattery",
        "getBigInt64",
        "getBigUint64",
        "getBindGroupLayout",
        "getBlob",
        "getBookmark",
        "getBoundingClientRect",
        "getBounds",
        "getBoxQuads",
        "getBrowserInfo",
        "getBufferParameter",
        "getBufferSubData",
        "getByteFrequencyData",
        "getByteTimeDomainData",
        "getCSSCanvasContext",
        "getCTM",
        "getCameraImage",
        "getCandidateWindowClientRect",
        "getCanonicalLocales",
        "getCapabilities",
        "getCaptureHandle",
        "getChannelData",
        "getCharNumAtPosition",
        "getCharacteristic",
        "getCharacteristics",
        "getClientExtensionResults",
        "getClientRect",
        "getClientRects",
        "getCoalescedEvents",
        "getCompilationInfo",
        "getCompositionAlternatives",
        "getComputedStyle",
        "getComputedTextLength",
        "getComputedTiming",
        "getConfiguration",
        "getConstraints",
        "getContext",
        "getContextAttributes",
        "getContexts",
        "getContributingSources",
        "getCounterValue",
        "getCueAsHTML",
        "getCueById",
        "getCurrent",
        "getCurrentPosition",
        "getCurrentTexture",
        "getCurrentTime",
        "getData",
        "getDatabaseNames",
        "getDate",
        "getDay",
        "getDefaultComputedStyle",
        "getDepthInMeters",
        "getDepthInformation",
        "getDescriptor",
        "getDescriptors",
        "getDestinationInsertionPoints",
        "getDevices",
        "getDirectory",
        "getDirectoryHandle",
        "getDisplayMedia",
        "getDistributedNodes",
        "getEditable",
        "getElementById",
        "getElementsByClassName",
        "getElementsByName",
        "getElementsByTagName",
        "getElementsByTagNameNS",
        "getEnclosureList",
        "getEndPositionOfChar",
        "getEntries",
        "getEntriesByName",
        "getEntriesByType",
        "getError",
        "getExtension",
        "getExtentOfChar",
        "getEyeParameters",
        "getFeature",
        "getFiberRoots",
        "getFile",
        "getFileHandle",
        "getFiles",
        "getFilesAndDirectories",
        "getFingerprints",
        "getFloat16",
        "getFloat32",
        "getFloat64",
        "getFloatFrequencyData",
        "getFloatTimeDomainData",
        "getFloatValue",
        "getFragDataLocation",
        "getFrameData",
        "getFrameId",
        "getFramebufferAttachmentParameter",
        "getFrequencyResponse",
        "getFullYear",
        "getGamepads",
        "getHTML",
        "getHeaderExtensionsToNegotiate",
        "getHighEntropyValues",
        "getHitTestResults",
        "getHitTestResultsForTransientInput",
        "getHours",
        "getIdentityAssertion",
        "getIds",
        "getImageData",
        "getIndexedParameter",
        "getInfo",
        "getInnerHTML",
        "getInstalledRelatedApps",
        "getInt16",
        "getInt32",
        "getInt8",
        "getInterestGroupAdAuctionData",
        "getInternalModuleRanges",
        "getInternalformatParameter",
        "getIntersectionList",
        "getItem",
        "getItems",
        "getJointPose",
        "getKey",
        "getKeyframes",
        "getLastFocused",
        "getLayers",
        "getLayoutMap",
        "getLightEstimate",
        "getLineDash",
        "getLocalCandidates",
        "getLocalParameters",
        "getLocalStreams",
        "getManagedConfiguration",
        "getManifest",
        "getMappedRange",
        "getMarks",
        "getMatchedCSSRules",
        "getMaxGCPauseSinceClear",
        "getMeasures",
        "getMessage",
        "getMetadata",
        "getMilliseconds",
        "getMinutes",
        "getModifierState",
        "getMonth",
        "getName",
        "getNamedItem",
        "getNamedItemNS",
        "getNativeFramebufferScaleFactor",
        "getNegotiatedHeaderExtensions",
        "getNestedConfigs",
        "getNotifications",
        "getNotifier",
        "getNumberOfChars",
        "getOffsetReferenceSpace",
        "getOutputTimestamp",
        "getOverrideHistoryNavigationMode",
        "getOverrideStyle",
        "getOwnPropertyDescriptor",
        "getOwnPropertyDescriptors",
        "getOwnPropertyNames",
        "getOwnPropertySymbols",
        "getPackageDirectoryEntry",
        "getParameter",
        "getParameters",
        "getParent",
        "getPathSegAtLength",
        "getPermissionWarningsByManifest",
        "getPhotoCapabilities",
        "getPhotoSettings",
        "getPlatformInfo",
        "getPointAtLength",
        "getPopup",
        "getPorts",
        "getPose",
        "getPredictedEvents",
        "getPreference",
        "getPreferenceDefault",
        "getPreferredCanvasFormat",
        "getPresentationAttribute",
        "getPreventDefault",
        "getPrimaryService",
        "getPrimaryServices",
        "getProgramInfoLog",
        "getProgramParameter",
        "getPropertyCSSValue",
        "getPropertyPriority",
        "getPropertyShorthand",
        "getPropertyType",
        "getPropertyValue",
        "getPrototypeOf",
        "getPublicKey",
        "getPublicKeyAlgorithm",
        "getQuery",
        "getQueryParameter",
        "getRGBColorValue",
        "getRandomValues",
        "getRangeAt",
        "getReader",
        "getReceivers",
        "getRectValue",
        "getReflectionCubeMap",
        "getRegistration",
        "getRegistrations",
        "getRemoteCandidates",
        "getRemoteCertificates",
        "getRemoteParameters",
        "getRemoteStreams",
        "getRenderbufferParameter",
        "getResponseHeader",
        "getRoot",
        "getRootNode",
        "getRotationOfChar",
        "getSVGDocument",
        "getSamplerParameter",
        "getScreenCTM",
        "getScreenDetails",
        "getSeconds",
        "getSelectedCandidatePair",
        "getSelection",
        "getSelf",
        "getSenders",
        "getService",
        "getSetCookie",
        "getSettings",
        "getShaderInfoLog",
        "getShaderParameter",
        "getShaderPrecisionFormat",
        "getShaderSource",
        "getSignals",
        "getSimpleDuration",
        "getSiteIcons",
        "getSources",
        "getSpeculativeParserUrls",
        "getStartPositionOfChar",
        "getStartTime",
        "getState",
        "getStats",
        "getStatusForPolicy",
        "getStorageUpdates",
        "getStreamById",
        "getStringValue",
        "getSubStringLength",
        "getSubscription",
        "getSubscriptions",
        "getSupportedConstraints",
        "getSupportedExtensions",
        "getSupportedFormats",
        "getSyncParameter",
        "getSynchronizationSources",
        "getTags",
        "getTargetRanges",
        "getTexParameter",
        "getTextFormats",
        "getTime",
        "getTimezoneOffset",
        "getTiming",
        "getTitle",
        "getTitlebarAreaRect",
        "getTotalLength",
        "getTrackById",
        "getTracks",
        "getTransceivers",
        "getTransform",
        "getTransformFeedbackVarying",
        "getTransformToElement",
        "getTransports",
        "getType",
        "getTypeMapping",
        "getUILanguage",
        "getURL",
        "getUTCDate",
        "getUTCDay",
        "getUTCFullYear",
        "getUTCHours",
        "getUTCMilliseconds",
        "getUTCMinutes",
        "getUTCMonth",
        "getUTCSeconds",
        "getUint16",
        "getUint32",
        "getUint8",
        "getUniform",
        "getUniformBlockIndex",
        "getUniformIndices",
        "getUniformLocation",
        "getUserInfo",
        "getUserMedia",
        "getUserSettings",
        "getVRDisplays",
        "getValues",
        "getVarDate",
        "getVariableValue",
        "getVertexAttrib",
        "getVertexAttribOffset",
        "getVideoPlaybackQuality",
        "getVideoTracks",
        "getViewerPose",
        "getViewport",
        "getViews",
        "getVoices",
        "getWakeLockState",
        "getWriter",
        "getYear",
        "getZoom",
        "getZoomSettings",
        "givenName",
        "global",
        "globalAlpha",
        "globalCompositeOperation",
        "globalPrivacyControl",
        "globalThis",
        "glyphOrientationHorizontal",
        "glyphOrientationVertical",
        "glyphRef",
        "go",
        "goBack",
        "goForward",
        "gpu",
        "grabFrame",
        "grad",
        "gradientTransform",
        "gradientUnits",
        "grammars",
        "green",
        "grid",
        "grid-area",
        "grid-auto-columns",
        "grid-auto-flow",
        "grid-auto-rows",
        "grid-column",
        "grid-column-end",
        "grid-column-gap",
        "grid-column-start",
        "grid-gap",
        "grid-row",
        "grid-row-end",
        "grid-row-gap",
        "grid-row-start",
        "grid-template",
        "grid-template-areas",
        "grid-template-columns",
        "grid-template-rows",
        "gridArea",
        "gridAutoColumns",
        "gridAutoFlow",
        "gridAutoRows",
        "gridColumn",
        "gridColumnEnd",
        "gridColumnGap",
        "gridColumnStart",
        "gridGap",
        "gridRow",
        "gridRowEnd",
        "gridRowGap",
        "gridRowStart",
        "gridTemplate",
        "gridTemplateAreas",
        "gridTemplateColumns",
        "gridTemplateRows",
        "gripSpace",
        "group",
        "groupBy",
        "groupCollapsed",
        "groupEnd",
        "groupId",
        "groups",
        "grow",
        "growable",
        "guestProcessId",
        "guestRenderFrameRoutingId",
        "hadRecentInput",
        "hand",
        "handedness",
        "hangingBaseline",
        "hapticActuators",
        "hardwareConcurrency",
        "has",
        "hasAttribute",
        "hasAttributeNS",
        "hasAttributes",
        "hasBeenActive",
        "hasChildNodes",
        "hasComposition",
        "hasDynamicOffset",
        "hasEnrolledInstrument",
        "hasExtension",
        "hasExternalDisplay",
        "hasFeature",
        "hasFocus",
        "hasIndices",
        "hasInstance",
        "hasLayout",
        "hasOrientation",
        "hasOwn",
        "hasOwnProperty",
        "hasPointerCapture",
        "hasPosition",
        "hasPrivateToken",
        "hasReading",
        "hasRedemptionRecord",
        "hasRegExpGroups",
        "hasStorageAccess",
        "hasUAVisualTransition",
        "hasUnpartitionedCookieAccess",
        "hash",
        "hashChange",
        "head",
        "headers",
        "heading",
        "height",
        "hid",
        "hidden",
        "hide",
        "hideFocus",
        "hidePopover",
        "high",
        "highWaterMark",
        "highlight",
        "highlights",
        "hint",
        "hints",
        "history",
        "honorificPrefix",
        "honorificSuffix",
        "horizontalOverflow",
        "host",
        "hostCandidate",
        "hostname",
        "href",
        "hrefTranslate",
        "hreflang",
        "hspace",
        "html5TagCheckInerface",
        "htmlFor",
        "htmlText",
        "httpEquiv",
        "httpRequestStatusCode",
        "hwTimestamp",
        "hyphenate-character",
        "hyphenateCharacter",
        "hyphens",
        "hypot",
        "i18n",
        "ic",
        "iccId",
        "iceConnectionState",
        "iceGatheringState",
        "iceTransport",
        "icon",
        "iconURL",
        "id",
        "identifier",
        "identity",
        "ideographicBaseline",
        "idle",
        "idpLoginUrl",
        "ignoreBOM",
        "ignoreCase",
        "ignoreDepthValues",
        "image",
        "image-orientation",
        "image-rendering",
        "imageHeight",
        "imageOrientation",
        "imageRendering",
        "imageSizes",
        "imageSmoothingEnabled",
        "imageSmoothingQuality",
        "imageSrcset",
        "imageWidth",
        "images",
        "ime-mode",
        "imeMode",
        "implementation",
        "importExternalTexture",
        "importKey",
        "importNode",
        "importStylesheet",
        "imports",
        "impp",
        "imul",
        "in",
        "in1",
        "in2",
        "inBandMetadataTrackDispatchType",
        "inIncognitoContext",
        "inRange",
        "includes",
        "incognito",
        "incomingBidirectionalStreams",
        "incomingHighWaterMark",
        "incomingMaxAge",
        "incomingUnidirectionalStreams",
        "incremental",
        "indeterminate",
        "index",
        "indexNames",
        "indexOf",
        "indexedDB",
        "indicate",
        "indices",
        "inert",
        "inertiaDestinationX",
        "inertiaDestinationY",
        "info",
        "inherits",
        "init",
        "initAnimationEvent",
        "initBeforeLoadEvent",
        "initClipboardEvent",
        "initCloseEvent",
        "initCommandEvent",
        "initCompositionEvent",
        "initCustomEvent",
        "initData",
        "initDataType",
        "initDeviceMotionEvent",
        "initDeviceOrientationEvent",
        "initDragEvent",
        "initErrorEvent",
        "initEvent",
        "initFocusEvent",
        "initGestureEvent",
        "initHashChangeEvent",
        "initKeyEvent",
        "initKeyboardEvent",
        "initMSManipulationEvent",
        "initMessageEvent",
        "initMouseEvent",
        "initMouseScrollEvent",
        "initMouseWheelEvent",
        "initMutationEvent",
        "initNSMouseEvent",
        "initOverflowEvent",
        "initPageEvent",
        "initPageTransitionEvent",
        "initPointerEvent",
        "initPopStateEvent",
        "initProgressEvent",
        "initScrollAreaEvent",
        "initSimpleGestureEvent",
        "initStorageEvent",
        "initTextEvent",
        "initTimeEvent",
        "initTouchEvent",
        "initTransitionEvent",
        "initUIEvent",
        "initWebKitAnimationEvent",
        "initWebKitTransitionEvent",
        "initWebKitWheelEvent",
        "initWheelEvent",
        "initialTime",
        "initialValue",
        "initialize",
        "initiatorType",
        "inject",
        "ink",
        "inline-size",
        "inlineSize",
        "inlineVerticalFieldOfView",
        "inner",
        "innerHTML",
        "innerHeight",
        "innerText",
        "innerWidth",
        "input",
        "inputBuffer",
        "inputEncoding",
        "inputMethod",
        "inputMode",
        "inputSource",
        "inputSources",
        "inputType",
        "inputs",
        "insertAdjacentElement",
        "insertAdjacentHTML",
        "insertAdjacentText",
        "insertBefore",
        "insertCell",
        "insertDTMF",
        "insertData",
        "insertDebugMarker",
        "insertItemBefore",
        "insertNode",
        "insertRow",
        "insertRule",
        "inset",
        "inset-block",
        "inset-block-end",
        "inset-block-start",
        "inset-inline",
        "inset-inline-end",
        "inset-inline-start",
        "insetBlock",
        "insetBlockEnd",
        "insetBlockStart",
        "insetInline",
        "insetInlineEnd",
        "insetInlineStart",
        "install",
        "installing",
        "instanceRoot",
        "instantiate",
        "instantiateStreaming",
        "instruments",
        "int16",
        "int32",
        "int8",
        "integrity",
        "interactionId",
        "interactionMode",
        "intercept",
        "interfaceClass",
        "interfaceName",
        "interfaceNumber",
        "interfaceProtocol",
        "interfaceSubclass",
        "interfaces",
        "interimResults",
        "internalSubset",
        "interpretation",
        "intersection",
        "intersectionRatio",
        "intersectionRect",
        "intersectsNode",
        "interval",
        "invalidIteratorState",
        "invalidateFramebuffer",
        "invalidateSubFramebuffer",
        "inverse",
        "invertSelf",
        "invoker",
        "invokerType",
        "is",
        "is2D",
        "isActive",
        "isAllowedFileSchemeAccess",
        "isAllowedIncognitoAccess",
        "isAlternate",
        "isArray",
        "isAutoSelected",
        "isBingCurrentSearchDefault",
        "isBuffer",
        "isCandidateWindowVisible",
        "isChar",
        "isCollapsed",
        "isComposing",
        "isConcatSpreadable",
        "isConditionalMediationAvailable",
        "isConfigSupported",
        "isConnected",
        "isContentEditable",
        "isContentHandlerRegistered",
        "isContextLost",
        "isDefaultNamespace",
        "isDirectory",
        "isDisabled",
        "isDisjointFrom",
        "isEnabled",
        "isEqual",
        "isEqualNode",
        "isExtended",
        "isExtensible",
        "isExternalCTAP2SecurityKeySupported",
        "isFallbackAdapter",
        "isFile",
        "isFinite",
        "isFirstPersonObserver",
        "isFramebuffer",
        "isFrozen",
        "isGenerator",
        "isHTML",
        "isHistoryNavigation",
        "isId",
        "isIdentity",
        "isInjected",
        "isInputPending",
        "isInteger",
        "isInternal",
        "isIntersecting",
        "isLockFree",
        "isMap",
        "isMultiLine",
        "isNaN",
        "isOpen",
        "isPointInFill",
        "isPointInPath",
        "isPointInRange",
        "isPointInStroke",
        "isPrefAlternate",
        "isPresenting",
        "isPrimary",
        "isProgram",
        "isPropertyImplicit",
        "isProtocolHandlerRegistered",
        "isPrototypeOf",
        "isQuery",
        "isRawJSON",
        "isRenderbuffer",
        "isSafeInteger",
        "isSameEntry",
        "isSameNode",
        "isSampler",
        "isScript",
        "isScriptURL",
        "isSealed",
        "isSecureContext",
        "isSessionSupported",
        "isShader",
        "isSubsetOf",
        "isSupersetOf",
        "isSupported",
        "isSync",
        "isTextEdit",
        "isTexture",
        "isTransformFeedback",
        "isTrusted",
        "isTypeSupported",
        "isUserVerifyingPlatformAuthenticatorAvailable",
        "isVertexArray",
        "isView",
        "isVisible",
        "isWellFormed",
        "isochronousTransferIn",
        "isochronousTransferOut",
        "isolation",
        "italics",
        "item",
        "itemId",
        "itemProp",
        "itemRef",
        "itemScope",
        "itemType",
        "itemValue",
        "items",
        "iterateNext",
        "iterationComposite",
        "iterator",
        "javaEnabled",
        "jitterBufferTarget",
        "jobTitle",
        "join",
        "joinAdInterestGroup",
        "jointName",
        "json",
        "justify-content",
        "justify-items",
        "justify-self",
        "justifyContent",
        "justifyItems",
        "justifySelf",
        "k1",
        "k2",
        "k3",
        "k4",
        "kHz",
        "keepalive",
        "kernelMatrix",
        "kernelUnitLengthX",
        "kernelUnitLengthY",
        "kerning",
        "key",
        "keyCode",
        "keyFor",
        "keyIdentifier",
        "keyLightEnabled",
        "keyLocation",
        "keyPath",
        "keyStatuses",
        "keySystem",
        "keyText",
        "keyUsage",
        "keyboard",
        "keys",
        "keytype",
        "kind",
        "knee",
        "knownSources",
        "label",
        "labels",
        "lang",
        "language",
        "languages",
        "largeArcFlag",
        "lastChild",
        "lastElementChild",
        "lastError",
        "lastEventId",
        "lastIndex",
        "lastIndexOf",
        "lastInputTime",
        "lastMatch",
        "lastMessageSubject",
        "lastMessageType",
        "lastModified",
        "lastModifiedDate",
        "lastPage",
        "lastParen",
        "lastState",
        "lastStyleSheetSet",
        "latency",
        "latitude",
        "launchQueue",
        "layerName",
        "layerX",
        "layerY",
        "layout",
        "layoutFlow",
        "layoutGrid",
        "layoutGridChar",
        "layoutGridLine",
        "layoutGridMode",
        "layoutGridType",
        "lbound",
        "leaveAdInterestGroup",
        "left",
        "leftContext",
        "leftDegrees",
        "leftMargin",
        "leftProjectionMatrix",
        "leftViewMatrix",
        "length",
        "lengthAdjust",
        "lengthComputable",
        "letter-spacing",
        "letterSpacing",
        "level",
        "lh",
        "lighting-color",
        "lightingColor",
        "limitingConeAngle",
        "limits",
        "line",
        "line-break",
        "line-height",
        "lineAlign",
        "lineBreak",
        "lineCap",
        "lineDashOffset",
        "lineGapOverride",
        "lineHeight",
        "lineJoin",
        "lineNum",
        "lineNumber",
        "linePos",
        "lineTo",
        "lineWidth",
        "linearAcceleration",
        "linearRampToValueAtTime",
        "linearVelocity",
        "lineno",
        "lines",
        "link",
        "linkColor",
        "linkProgram",
        "links",
        "list",
        "list-style",
        "list-style-image",
        "list-style-position",
        "list-style-type",
        "listStyle",
        "listStyleImage",
        "listStylePosition",
        "listStyleType",
        "listener",
        "listeners",
        "load",
        "loadEventEnd",
        "loadEventStart",
        "loadOp",
        "loadTime",
        "loadTimes",
        "loaded",
        "loading",
        "localDescription",
        "localName",
        "localService",
        "localStorage",
        "locale",
        "localeCompare",
        "location",
        "locationbar",
        "lock",
        "locked",
        "lockedFile",
        "locks",
        "lodMaxClamp",
        "lodMinClamp",
        "log",
        "log10",
        "log1p",
        "log2",
        "logicalXDPI",
        "logicalYDPI",
        "login",
        "loglevel",
        "longDesc",
        "longitude",
        "lookupNamespaceURI",
        "lookupPrefix",
        "loop",
        "loopEnd",
        "loopStart",
        "looping",
        "lost",
        "low",
        "lower",
        "lowerBound",
        "lowerOpen",
        "lowsrc",
        "lvb",
        "lvh",
        "lvi",
        "lvmax",
        "lvmin",
        "lvw",
        "m11",
        "m12",
        "m13",
        "m14",
        "m21",
        "m22",
        "m23",
        "m24",
        "m31",
        "m32",
        "m33",
        "m34",
        "m41",
        "m42",
        "m43",
        "m44",
        "magFilter",
        "makeXRCompatible",
        "managed",
        "management",
        "manifest",
        "manufacturer",
        "manufacturerName",
        "map",
        "mapAsync",
        "mapState",
        "mappedAtCreation",
        "mapping",
        "margin",
        "margin-block",
        "margin-block-end",
        "margin-block-start",
        "margin-bottom",
        "margin-inline",
        "margin-inline-end",
        "margin-inline-start",
        "margin-left",
        "margin-right",
        "margin-top",
        "marginBlock",
        "marginBlockEnd",
        "marginBlockStart",
        "marginBottom",
        "marginHeight",
        "marginInline",
        "marginInlineEnd",
        "marginInlineStart",
        "marginLeft",
        "marginRight",
        "marginTop",
        "marginWidth",
        "mark",
        "marker",
        "marker-end",
        "marker-mid",
        "marker-offset",
        "marker-start",
        "markerEnd",
        "markerHeight",
        "markerMid",
        "markerOffset",
        "markerStart",
        "markerUnits",
        "markerWidth",
        "marks",
        "mask",
        "mask-clip",
        "mask-composite",
        "mask-image",
        "mask-mode",
        "mask-origin",
        "mask-position",
        "mask-position-x",
        "mask-position-y",
        "mask-repeat",
        "mask-size",
        "mask-type",
        "maskClip",
        "maskComposite",
        "maskContentUnits",
        "maskImage",
        "maskMode",
        "maskOrigin",
        "maskPosition",
        "maskPositionX",
        "maskPositionY",
        "maskRepeat",
        "maskSize",
        "maskType",
        "maskUnits",
        "match",
        "matchAll",
        "matchMedia",
        "matchMedium",
        "matchPatterns",
        "matches",
        "math-depth",
        "math-style",
        "mathDepth",
        "mathStyle",
        "matrix",
        "matrixTransform",
        "max",
        "max-block-size",
        "max-height",
        "max-inline-size",
        "max-width",
        "maxActions",
        "maxAlternatives",
        "maxAnisotropy",
        "maxBindGroups",
        "maxBindGroupsPlusVertexBuffers",
        "maxBindingsPerBindGroup",
        "maxBlockSize",
        "maxBufferSize",
        "maxByteLength",
        "maxChannelCount",
        "maxChannels",
        "maxColorAttachmentBytesPerSample",
        "maxColorAttachments",
        "maxComputeInvocationsPerWorkgroup",
        "maxComputeWorkgroupSizeX",
        "maxComputeWorkgroupSizeY",
        "maxComputeWorkgroupSizeZ",
        "maxComputeWorkgroupStorageSize",
        "maxComputeWorkgroupsPerDimension",
        "maxConnectionsPerServer",
        "maxDatagramSize",
        "maxDecibels",
        "maxDistance",
        "maxDrawCount",
        "maxDynamicStorageBuffersPerPipelineLayout",
        "maxDynamicUniformBuffersPerPipelineLayout",
        "maxHeight",
        "maxInlineSize",
        "maxInterStageShaderComponents",
        "maxInterStageShaderVariables",
        "maxLayers",
        "maxLength",
        "maxMessageSize",
        "maxPacketLifeTime",
        "maxRetransmits",
        "maxSampledTexturesPerShaderStage",
        "maxSamplersPerShaderStage",
        "maxStorageBufferBindingSize",
        "maxStorageBuffersPerShaderStage",
        "maxStorageTexturesPerShaderStage",
        "maxTextureArrayLayers",
        "maxTextureDimension1D",
        "maxTextureDimension2D",
        "maxTextureDimension3D",
        "maxTouchPoints",
        "maxUniformBufferBindingSize",
        "maxUniformBuffersPerShaderStage",
        "maxValue",
        "maxVertexAttributes",
        "maxVertexBufferArrayStride",
        "maxVertexBuffers",
        "maxWidth",
        "maximumLatency",
        "measure",
        "measureText",
        "media",
        "mediaCapabilities",
        "mediaDevices",
        "mediaElement",
        "mediaGroup",
        "mediaKeys",
        "mediaSession",
        "mediaStream",
        "mediaText",
        "meetOrSlice",
        "memory",
        "menubar",
        "menus",
        "menusChild",
        "menusInternal",
        "mergeAttributes",
        "message",
        "messageClass",
        "messageHandlers",
        "messageType",
        "messages",
        "metaKey",
        "metadata",
        "method",
        "methodDetails",
        "methodName",
        "mid",
        "mimeType",
        "mimeTypes",
        "min",
        "min-block-size",
        "min-height",
        "min-inline-size",
        "min-width",
        "minBindingSize",
        "minBlockSize",
        "minDecibels",
        "minFilter",
        "minHeight",
        "minInlineSize",
        "minLength",
        "minStorageBufferOffsetAlignment",
        "minUniformBufferOffsetAlignment",
        "minValue",
        "minWidth",
        "minimumLatency",
        "mipLevel",
        "mipLevelCount",
        "mipmapFilter",
        "miterLimit",
        "mix-blend-mode",
        "mixBlendMode",
        "mm",
        "mobile",
        "mode",
        "model",
        "modify",
        "module",
        "mount",
        "move",
        "moveBy",
        "moveEnd",
        "moveFirst",
        "moveFocusDown",
        "moveFocusLeft",
        "moveFocusRight",
        "moveFocusUp",
        "moveInSuccession",
        "moveNext",
        "moveRow",
        "moveStart",
        "moveTo",
        "moveToBookmark",
        "moveToElementText",
        "moveToPoint",
        "movementX",
        "movementY",
        "mozAdd",
        "mozAnimationStartTime",
        "mozAnon",
        "mozApps",
        "mozAudioCaptured",
        "mozAudioChannelType",
        "mozAutoplayEnabled",
        "mozCancelAnimationFrame",
        "mozCancelFullScreen",
        "mozCancelRequestAnimationFrame",
        "mozCaptureStream",
        "mozCaptureStreamUntilEnded",
        "mozClearDataAt",
        "mozContact",
        "mozContacts",
        "mozCreateFileHandle",
        "mozCurrentTransform",
        "mozCurrentTransformInverse",
        "mozCursor",
        "mozDash",
        "mozDashOffset",
        "mozDecodedFrames",
        "mozExitPointerLock",
        "mozFillRule",
        "mozFragmentEnd",
        "mozFrameDelay",
        "mozFullScreen",
        "mozFullScreenElement",
        "mozFullScreenEnabled",
        "mozGetAll",
        "mozGetAllKeys",
        "mozGetAsFile",
        "mozGetDataAt",
        "mozGetMetadata",
        "mozGetUserMedia",
        "mozHasAudio",
        "mozHasItem",
        "mozHidden",
        "mozImageSmoothingEnabled",
        "mozIndexedDB",
        "mozInnerScreenX",
        "mozInnerScreenY",
        "mozInputSource",
        "mozIsTextField",
        "mozItem",
        "mozItemCount",
        "mozItems",
        "mozLength",
        "mozLockOrientation",
        "mozMatchesSelector",
        "mozMovementX",
        "mozMovementY",
        "mozOpaque",
        "mozOrientation",
        "mozPaintCount",
        "mozPaintedFrames",
        "mozParsedFrames",
        "mozPay",
        "mozPointerLockElement",
        "mozPresentedFrames",
        "mozPreservesPitch",
        "mozPressure",
        "mozPrintCallback",
        "mozRTCIceCandidate",
        "mozRTCPeerConnection",
        "mozRTCSessionDescription",
        "mozRemove",
        "mozRequestAnimationFrame",
        "mozRequestFullScreen",
        "mozRequestPointerLock",
        "mozSetDataAt",
        "mozSetImageElement",
        "mozSourceNode",
        "mozSrcObject",
        "mozSystem",
        "mozTCPSocket",
        "mozTextStyle",
        "mozTypesAt",
        "mozUnlockOrientation",
        "mozUserCancelled",
        "mozVisibilityState",
        "ms",
        "msAnimation",
        "msAnimationDelay",
        "msAnimationDirection",
        "msAnimationDuration",
        "msAnimationFillMode",
        "msAnimationIterationCount",
        "msAnimationName",
        "msAnimationPlayState",
        "msAnimationStartTime",
        "msAnimationTimingFunction",
        "msBackfaceVisibility",
        "msBlockProgression",
        "msCSSOMElementFloatMetrics",
        "msCaching",
        "msCachingEnabled",
        "msCancelRequestAnimationFrame",
        "msCapsLockWarningOff",
        "msClearImmediate",
        "msClose",
        "msContentZoomChaining",
        "msContentZoomFactor",
        "msContentZoomLimit",
        "msContentZoomLimitMax",
        "msContentZoomLimitMin",
        "msContentZoomSnap",
        "msContentZoomSnapPoints",
        "msContentZoomSnapType",
        "msContentZooming",
        "msConvertURL",
        "msCrypto",
        "msDoNotTrack",
        "msElementsFromPoint",
        "msElementsFromRect",
        "msExitFullscreen",
        "msExtendedCode",
        "msFillRule",
        "msFirstPaint",
        "msFlex",
        "msFlexAlign",
        "msFlexDirection",
        "msFlexFlow",
        "msFlexItemAlign",
        "msFlexLinePack",
        "msFlexNegative",
        "msFlexOrder",
        "msFlexPack",
        "msFlexPositive",
        "msFlexPreferredSize",
        "msFlexWrap",
        "msFlowFrom",
        "msFlowInto",
        "msFontFeatureSettings",
        "msFullscreenElement",
        "msFullscreenEnabled",
        "msGetInputContext",
        "msGetRegionContent",
        "msGetUntransformedBounds",
        "msGraphicsTrustStatus",
        "msGridColumn",
        "msGridColumnAlign",
        "msGridColumnSpan",
        "msGridColumns",
        "msGridRow",
        "msGridRowAlign",
        "msGridRowSpan",
        "msGridRows",
        "msHidden",
        "msHighContrastAdjust",
        "msHyphenateLimitChars",
        "msHyphenateLimitLines",
        "msHyphenateLimitZone",
        "msHyphens",
        "msImageSmoothingEnabled",
        "msImeAlign",
        "msIndexedDB",
        "msInterpolationMode",
        "msIsStaticHTML",
        "msKeySystem",
        "msKeys",
        "msLaunchUri",
        "msLockOrientation",
        "msManipulationViewsEnabled",
        "msMatchMedia",
        "msMatchesSelector",
        "msMaxTouchPoints",
        "msOrientation",
        "msOverflowStyle",
        "msPerspective",
        "msPerspectiveOrigin",
        "msPlayToDisabled",
        "msPlayToPreferredSourceUri",
        "msPlayToPrimary",
        "msPointerEnabled",
        "msRegionOverflow",
        "msReleasePointerCapture",
        "msRequestAnimationFrame",
        "msRequestFullscreen",
        "msSaveBlob",
        "msSaveOrOpenBlob",
        "msScrollChaining",
        "msScrollLimit",
        "msScrollLimitXMax",
        "msScrollLimitXMin",
        "msScrollLimitYMax",
        "msScrollLimitYMin",
        "msScrollRails",
        "msScrollSnapPointsX",
        "msScrollSnapPointsY",
        "msScrollSnapType",
        "msScrollSnapX",
        "msScrollSnapY",
        "msScrollTranslation",
        "msSetImmediate",
        "msSetMediaKeys",
        "msSetPointerCapture",
        "msTextCombineHorizontal",
        "msTextSizeAdjust",
        "msToBlob",
        "msTouchAction",
        "msTouchSelect",
        "msTraceAsyncCallbackCompleted",
        "msTraceAsyncCallbackStarting",
        "msTraceAsyncOperationCompleted",
        "msTraceAsyncOperationStarting",
        "msTransform",
        "msTransformOrigin",
        "msTransformStyle",
        "msTransition",
        "msTransitionDelay",
        "msTransitionDuration",
        "msTransitionProperty",
        "msTransitionTimingFunction",
        "msUnlockOrientation",
        "msUpdateAsyncCallbackRelation",
        "msUserSelect",
        "msVisibilityState",
        "msWrapFlow",
        "msWrapMargin",
        "msWrapThrough",
        "msWriteProfilerMark",
        "msZoom",
        "msZoomTo",
        "mt",
        "mul",
        "multiEntry",
        "multiSelectionObj",
        "multiline",
        "multiple",
        "multiply",
        "multiplySelf",
        "multisample",
        "multisampled",
        "mutableFile",
        "muted",
        "n",
        "nacl_arch",
        "name",
        "nameList",
        "nameProp",
        "namedItem",
        "namedRecordset",
        "names",
        "namespaceURI",
        "namespaces",
        "nativeApplication",
        "nativeMap",
        "nativeObjectCreate",
        "nativeSet",
        "nativeWeakMap",
        "naturalHeight",
        "naturalWidth",
        "navigate",
        "navigation",
        "navigationMode",
        "navigationPreload",
        "navigationStart",
        "navigationType",
        "navigator",
        "near",
        "nearestViewportElement",
        "negative",
        "negotiated",
        "netscape",
        "networkState",
        "networkStatus",
        "newScale",
        "newState",
        "newTranslate",
        "newURL",
        "newValue",
        "newValueSpecifiedUnits",
        "newVersion",
        "newhome",
        "next",
        "nextElementSibling",
        "nextHopProtocol",
        "nextNode",
        "nextPage",
        "nextSibling",
        "nickname",
        "noHref",
        "noModule",
        "noResize",
        "noShade",
        "noValidate",
        "noWrap",
        "node",
        "nodeName",
        "nodeType",
        "nodeValue",
        "nonce",
        "normDepthBufferFromNormView",
        "normalize",
        "normalizedPathSegList",
        "normandyAddonStudy",
        "notRestoredReasons",
        "notationName",
        "notations",
        "note",
        "noteGrainOn",
        "noteOff",
        "noteOn",
        "notifications",
        "notify",
        "now",
        "npnNegotiatedProtocol",
        "numOctaves",
        "number",
        "numberOfChannels",
        "numberOfFrames",
        "numberOfInputs",
        "numberOfItems",
        "numberOfOutputs",
        "numberValue",
        "oMatchesSelector",
        "object",
        "object-fit",
        "object-position",
        "objectFit",
        "objectPosition",
        "objectStore",
        "objectStoreNames",
        "objectType",
        "observe",
        "occlusionQuerySet",
        "of",
        "off",
        "offscreenBuffering",
        "offset",
        "offset-anchor",
        "offset-distance",
        "offset-path",
        "offset-position",
        "offset-rotate",
        "offsetAnchor",
        "offsetDistance",
        "offsetHeight",
        "offsetLeft",
        "offsetNode",
        "offsetParent",
        "offsetPath",
        "offsetPosition",
        "offsetRotate",
        "offsetTop",
        "offsetWidth",
        "offsetX",
        "offsetY",
        "ok",
        "oldState",
        "oldURL",
        "oldValue",
        "oldVersion",
        "olderShadowRoot",
        "omnibox",
        "on",
        "onActivated",
        "onAdded",
        "onAttached",
        "onBoundsChanged",
        "onBrowserUpdateAvailable",
        "onClicked",
        "onCommitFiberRoot",
        "onCommitFiberUnmount",
        "onConnect",
        "onConnectExternal",
        "onConnectNative",
        "onCreated",
        "onDetached",
        "onDisabled",
        "onEnabled",
        "onFocusChanged",
        "onHighlighted",
        "onInstalled",
        "onLine",
        "onMessage",
        "onMessageExternal",
        "onMoved",
        "onPerformanceWarning",
        "onPostCommitFiberRoot",
        "onRemoved",
        "onReplaced",
        "onRestartRequired",
        "onStartup",
        "onSubmittedWorkDone",
        "onSuspend",
        "onSuspendCanceled",
        "onUninstalled",
        "onUpdateAvailable",
        "onUpdated",
        "onUserScriptConnect",
        "onUserScriptMessage",
        "onUserSettingsChanged",
        "onZoomChange",
        "onabort",
        "onabsolutedeviceorientation",
        "onactivate",
        "onactive",
        "onaddsourcebuffer",
        "onaddstream",
        "onaddtrack",
        "onafterprint",
        "onafterscriptexecute",
        "onafterupdate",
        "onanimationcancel",
        "onanimationend",
        "onanimationiteration",
        "onanimationstart",
        "onappinstalled",
        "onaudioend",
        "onaudioprocess",
        "onaudiostart",
        "onautocomplete",
        "onautocompleteerror",
        "onauxclick",
        "onbeforeactivate",
        "onbeforecopy",
        "onbeforecut",
        "onbeforedeactivate",
        "onbeforeeditfocus",
        "onbeforeinput",
        "onbeforeinstallprompt",
        "onbeforematch",
        "onbeforepaste",
        "onbeforeprint",
        "onbeforescriptexecute",
        "onbeforetoggle",
        "onbeforeunload",
        "onbeforeupdate",
        "onbeforexrselect",
        "onbegin",
        "onblocked",
        "onblur",
        "onbounce",
        "onboundary",
        "onbufferedamountlow",
        "oncached",
        "oncancel",
        "oncandidatewindowhide",
        "oncandidatewindowshow",
        "oncandidatewindowupdate",
        "oncanplay",
        "oncanplaythrough",
        "oncapturehandlechange",
        "once",
        "oncellchange",
        "onchange",
        "oncharacterboundsupdate",
        "oncharacteristicvaluechanged",
        "onchargingchange",
        "onchargingtimechange",
        "onchecking",
        "onclick",
        "onclose",
        "onclosing",
        "oncompassneedscalibration",
        "oncomplete",
        "oncompositionend",
        "oncompositionstart",
        "onconnect",
        "onconnecting",
        "onconnectionavailable",
        "onconnectionstatechange",
        "oncontentvisibilityautostatechange",
        "oncontextlost",
        "oncontextmenu",
        "oncontextrestored",
        "oncontrollerchange",
        "oncontrolselect",
        "oncopy",
        "oncuechange",
        "oncurrententrychange",
        "oncurrentscreenchange",
        "oncut",
        "ondataavailable",
        "ondatachannel",
        "ondatasetchanged",
        "ondatasetcomplete",
        "ondblclick",
        "ondeactivate",
        "ondequeue",
        "ondevicechange",
        "ondevicelight",
        "ondevicemotion",
        "ondeviceorientation",
        "ondeviceorientationabsolute",
        "ondeviceproximity",
        "ondischargingtimechange",
        "ondisconnect",
        "ondisplay",
        "ondispose",
        "ondownloading",
        "ondrag",
        "ondragend",
        "ondragenter",
        "ondragexit",
        "ondragleave",
        "ondragover",
        "ondragstart",
        "ondrop",
        "ondurationchange",
        "onemptied",
        "onencrypted",
        "onend",
        "onended",
        "onenter",
        "onenterpictureinpicture",
        "onerror",
        "onerrorupdate",
        "onexit",
        "onfencedtreeclick",
        "onfilterchange",
        "onfinish",
        "onfocus",
        "onfocusin",
        "onfocusout",
        "onformdata",
        "onfreeze",
        "onfullscreenchange",
        "onfullscreenerror",
        "ongamepadconnected",
        "ongamepaddisconnected",
        "ongatheringstatechange",
        "ongattserverdisconnected",
        "ongeometrychange",
        "ongesturechange",
        "ongestureend",
        "ongesturestart",
        "ongotpointercapture",
        "onhashchange",
        "onhelp",
        "onicecandidate",
        "onicecandidateerror",
        "oniceconnectionstatechange",
        "onicegatheringstatechange",
        "oninactive",
        "oninput",
        "oninputreport",
        "oninputsourceschange",
        "oninvalid",
        "onkeydown",
        "onkeypress",
        "onkeystatuseschange",
        "onkeyup",
        "onlanguagechange",
        "onlayoutcomplete",
        "onleavepictureinpicture",
        "onlevelchange",
        "onload",
        "onloadT",
        "onloadeddata",
        "onloadedmetadata",
        "onloadend",
        "onloading",
        "onloadingdone",
        "onloadingerror",
        "onloadstart",
        "onlosecapture",
        "onlostpointercapture",
        "only",
        "onmanagedconfigurationchange",
        "onmark",
        "onmessage",
        "onmessageerror",
        "onmidimessage",
        "onmousedown",
        "onmouseenter",
        "onmouseleave",
        "onmousemove",
        "onmouseout",
        "onmouseover",
        "onmouseup",
        "onmousewheel",
        "onmove",
        "onmoveend",
        "onmovestart",
        "onmozfullscreenchange",
        "onmozfullscreenerror",
        "onmozorientationchange",
        "onmozpointerlockchange",
        "onmozpointerlockerror",
        "onmscontentzoom",
        "onmsfullscreenchange",
        "onmsfullscreenerror",
        "onmsgesturechange",
        "onmsgesturedoubletap",
        "onmsgestureend",
        "onmsgesturehold",
        "onmsgesturestart",
        "onmsgesturetap",
        "onmsgotpointercapture",
        "onmsinertiastart",
        "onmslostpointercapture",
        "onmsmanipulationstatechanged",
        "onmsneedkey",
        "onmsorientationchange",
        "onmspointercancel",
        "onmspointerdown",
        "onmspointerenter",
        "onmspointerhover",
        "onmspointerleave",
        "onmspointermove",
        "onmspointerout",
        "onmspointerover",
        "onmspointerup",
        "onmssitemodejumplistitemremoved",
        "onmsthumbnailclick",
        "onmute",
        "onnavigate",
        "onnavigateerror",
        "onnavigatesuccess",
        "onnegotiationneeded",
        "onnomatch",
        "onnoupdate",
        "onobsolete",
        "onoffline",
        "ononline",
        "onopen",
        "onorientationchange",
        "onpagechange",
        "onpagehide",
        "onpagereveal",
        "onpageshow",
        "onpageswap",
        "onpaste",
        "onpause",
        "onpayerdetailchange",
        "onpaymentmethodchange",
        "onplay",
        "onplaying",
        "onpluginstreamstart",
        "onpointercancel",
        "onpointerdown",
        "onpointerenter",
        "onpointerleave",
        "onpointerlockchange",
        "onpointerlockerror",
        "onpointermove",
        "onpointerout",
        "onpointerover",
        "onpointerrawupdate",
        "onpointerup",
        "onpopstate",
        "onprerenderingchange",
        "onprioritychange",
        "onprocessorerror",
        "onprogress",
        "onpropertychange",
        "onratechange",
        "onreading",
        "onreadystatechange",
        "onreflectionchange",
        "onrejectionhandled",
        "onrelease",
        "onremove",
        "onremovesourcebuffer",
        "onremovestream",
        "onremovetrack",
        "onrepeat",
        "onreset",
        "onresize",
        "onresizeend",
        "onresizestart",
        "onresourcetimingbufferfull",
        "onresult",
        "onresume",
        "onrowenter",
        "onrowexit",
        "onrowsdelete",
        "onrowsinserted",
        "onscreenschange",
        "onscroll",
        "onscrollend",
        "onscrollsnapchange",
        "onscrollsnapchanging",
        "onsearch",
        "onsecuritypolicyviolation",
        "onseeked",
        "onseeking",
        "onselect",
        "onselectedcandidatepairchange",
        "onselectend",
        "onselectionchange",
        "onselectstart",
        "onshippingaddresschange",
        "onshippingoptionchange",
        "onshow",
        "onsignalingstatechange",
        "onsinkchange",
        "onslotchange",
        "onsoundend",
        "onsoundstart",
        "onsourceclose",
        "onsourceclosed",
        "onsourceended",
        "onsourceopen",
        "onspeechend",
        "onspeechstart",
        "onsqueeze",
        "onsqueezeend",
        "onsqueezestart",
        "onstalled",
        "onstart",
        "onstatechange",
        "onstop",
        "onstorage",
        "onstoragecommit",
        "onsubmit",
        "onsuccess",
        "onsuspend",
        "onterminate",
        "ontextformatupdate",
        "ontextinput",
        "ontextupdate",
        "ontimeout",
        "ontimeupdate",
        "ontoggle",
        "ontonechange",
        "ontouchcancel",
        "ontouchend",
        "ontouchmove",
        "ontouchstart",
        "ontrack",
        "ontransitioncancel",
        "ontransitionend",
        "ontransitionrun",
        "ontransitionstart",
        "onuncapturederror",
        "onunhandledrejection",
        "onunload",
        "onunmute",
        "onupdate",
        "onupdateend",
        "onupdatefound",
        "onupdateready",
        "onupdatestart",
        "onupgradeneeded",
        "onuserproximity",
        "onversionchange",
        "onvisibilitychange",
        "onvoiceschanged",
        "onvolumechange",
        "onvrdisplayactivate",
        "onvrdisplayconnect",
        "onvrdisplaydeactivate",
        "onvrdisplaydisconnect",
        "onvrdisplaypresentchange",
        "onwaiting",
        "onwaitingforkey",
        "onwarning",
        "onwebkitanimationend",
        "onwebkitanimationiteration",
        "onwebkitanimationstart",
        "onwebkitcurrentplaybacktargetiswirelesschanged",
        "onwebkitfullscreenchange",
        "onwebkitfullscreenerror",
        "onwebkitkeyadded",
        "onwebkitkeyerror",
        "onwebkitkeymessage",
        "onwebkitneedkey",
        "onwebkitorientationchange",
        "onwebkitplaybacktargetavailabilitychanged",
        "onwebkitpointerlockchange",
        "onwebkitpointerlockerror",
        "onwebkitresourcetimingbufferfull",
        "onwebkittransitionend",
        "onwheel",
        "onzoom",
        "opacity",
        "open",
        "openCursor",
        "openDatabase",
        "openKeyCursor",
        "openOptionsPage",
        "openOrClosedShadowRoot",
        "openPopup",
        "opened",
        "opener",
        "opera",
        "operation",
        "operationType",
        "operator",
        "opr",
        "optimum",
        "options",
        "or",
        "order",
        "orderX",
        "orderY",
        "ordered",
        "org",
        "organization",
        "orient",
        "orientAngle",
        "orientType",
        "orientation",
        "orientationX",
        "orientationY",
        "orientationZ",
        "origin",
        "originAgentCluster",
        "originalPolicy",
        "originalTarget",
        "orphans",
        "os",
        "oscpu",
        "outerHTML",
        "outerHeight",
        "outerText",
        "outerWidth",
        "outgoingHighWaterMark",
        "outgoingMaxAge",
        "outline",
        "outline-color",
        "outline-offset",
        "outline-style",
        "outline-width",
        "outlineColor",
        "outlineOffset",
        "outlineStyle",
        "outlineWidth",
        "outputBuffer",
        "outputChannelCount",
        "outputLatency",
        "outputs",
        "overflow",
        "overflow-anchor",
        "overflow-block",
        "overflow-clip-margin",
        "overflow-inline",
        "overflow-wrap",
        "overflow-x",
        "overflow-y",
        "overflowAnchor",
        "overflowBlock",
        "overflowClipMargin",
        "overflowInline",
        "overflowWrap",
        "overflowX",
        "overflowY",
        "overlaysContent",
        "overrideColors",
        "overrideMimeType",
        "oversample",
        "overscroll-behavior",
        "overscroll-behavior-block",
        "overscroll-behavior-inline",
        "overscroll-behavior-x",
        "overscroll-behavior-y",
        "overscrollBehavior",
        "overscrollBehaviorBlock",
        "overscrollBehaviorInline",
        "overscrollBehaviorX",
        "overscrollBehaviorY",
        "ownKeys",
        "ownerDocument",
        "ownerElement",
        "ownerNode",
        "ownerRule",
        "ownerSVGElement",
        "owningElement",
        "p1",
        "p2",
        "p3",
        "p4",
        "packetSize",
        "packets",
        "pad",
        "padEnd",
        "padStart",
        "padding",
        "padding-block",
        "padding-block-end",
        "padding-block-start",
        "padding-bottom",
        "padding-inline",
        "padding-inline-end",
        "padding-inline-start",
        "padding-left",
        "padding-right",
        "padding-top",
        "paddingBlock",
        "paddingBlockEnd",
        "paddingBlockStart",
        "paddingBottom",
        "paddingInline",
        "paddingInlineEnd",
        "paddingInlineStart",
        "paddingLeft",
        "paddingRight",
        "paddingTop",
        "page",
        "page-break-after",
        "page-break-before",
        "page-break-inside",
        "page-orientation",
        "pageAction",
        "pageBreakAfter",
        "pageBreakBefore",
        "pageBreakInside",
        "pageCount",
        "pageLeft",
        "pageOrientation",
        "pageT",
        "pageTop",
        "pageX",
        "pageXOffset",
        "pageY",
        "pageYOffset",
        "pages",
        "paint-order",
        "paintOrder",
        "paintRequests",
        "paintType",
        "paintWorklet",
        "palette",
        "pan",
        "panningModel",
        "parameterData",
        "parameters",
        "parent",
        "parentElement",
        "parentNode",
        "parentRule",
        "parentStyleSheet",
        "parentTextEdit",
        "parentWindow",
        "parse",
        "parseAll",
        "parseCreationOptionsFromJSON",
        "parseFloat",
        "parseFromString",
        "parseHTMLUnsafe",
        "parseInt",
        "parseRequestOptionsFromJSON",
        "part",
        "participants",
        "passOp",
        "passive",
        "password",
        "pasteHTML",
        "path",
        "pathLength",
        "pathSegList",
        "pathSegType",
        "pathSegTypeAsLetter",
        "pathname",
        "pattern",
        "patternContentUnits",
        "patternMismatch",
        "patternTransform",
        "patternUnits",
        "pause",
        "pauseAnimations",
        "pauseDuration",
        "pauseOnExit",
        "pauseProfilers",
        "pauseTransformFeedback",
        "paused",
        "payerEmail",
        "payerName",
        "payerPhone",
        "paymentManager",
        "pc",
        "pdfViewerEnabled",
        "peerIdentity",
        "pending",
        "pendingLocalDescription",
        "pendingRemoteDescription",
        "percent",
        "performance",
        "periodicSync",
        "permission",
        "permissionState",
        "permissions",
        "persist",
        "persisted",
        "persistentDeviceId",
        "personalbar",
        "perspective",
        "perspective-origin",
        "perspectiveOrigin",
        "phone",
        "phoneticFamilyName",
        "phoneticGivenName",
        "photo",
        "pictureInPictureChild",
        "pictureInPictureElement",
        "pictureInPictureEnabled",
        "pictureInPictureWindow",
        "ping",
        "pipeThrough",
        "pipeTo",
        "pitch",
        "pixelBottom",
        "pixelDepth",
        "pixelHeight",
        "pixelLeft",
        "pixelRight",
        "pixelStorei",
        "pixelTop",
        "pixelUnitToMillimeterX",
        "pixelUnitToMillimeterY",
        "pixelWidth",
        "pkcs11",
        "place-content",
        "place-items",
        "place-self",
        "placeContent",
        "placeItems",
        "placeSelf",
        "placeholder",
        "platform",
        "platformVersion",
        "platforms",
        "play",
        "playEffect",
        "playState",
        "playbackRate",
        "playbackState",
        "playbackTime",
        "played",
        "playoutDelayHint",
        "playsInline",
        "plugins",
        "pluginspage",
        "pname",
        "pointer-events",
        "pointerBeforeReferenceNode",
        "pointerEnabled",
        "pointerEvents",
        "pointerId",
        "pointerLockElement",
        "pointerType",
        "points",
        "pointsAtX",
        "pointsAtY",
        "pointsAtZ",
        "polygonOffset",
        "pop",
        "popDebugGroup",
        "popErrorScope",
        "popover",
        "popoverTargetAction",
        "popoverTargetElement",
        "populateMatrix",
        "popupWindowFeatures",
        "popupWindowName",
        "popupWindowURI",
        "port",
        "port1",
        "port2",
        "ports",
        "posBottom",
        "posHeight",
        "posLeft",
        "posRight",
        "posTop",
        "posWidth",
        "pose",
        "position",
        "position-anchor",
        "position-area",
        "positionAlign",
        "positionAnchor",
        "positionArea",
        "positionX",
        "positionY",
        "positionZ",
        "postError",
        "postMessage",
        "postTask",
        "postalCode",
        "poster",
        "postscriptName",
        "pow",
        "powerEfficient",
        "powerOff",
        "powerPreference",
        "preMultiplySelf",
        "precision",
        "preferredReflectionFormat",
        "preferredStyleSheetSet",
        "preferredStylesheetSet",
        "prefix",
        "preload",
        "premultipliedAlpha",
        "prepend",
        "prerendering",
        "presentation",
        "presentationArea",
        "presentationStyle",
        "preserveAlpha",
        "preserveAspectRatio",
        "preserveAspectRatioString",
        "preservesPitch",
        "pressed",
        "pressure",
        "prevValue",
        "preventDefault",
        "preventExtensions",
        "preventSilentAccess",
        "previousElementSibling",
        "previousNode",
        "previousPage",
        "previousPriority",
        "previousRect",
        "previousScale",
        "previousSibling",
        "previousTranslate",
        "primaries",
        "primaryKey",
        "primaryLightDirection",
        "primaryLightIntensity",
        "primitive",
        "primitiveType",
        "primitiveUnits",
        "principals",
        "print",
        "print-color-adjust",
        "printColorAdjust",
        "printPreview",
        "priority",
        "privacy",
        "privateKey",
        "privateToken",
        "probablySupportsContext",
        "probeSpace",
        "process",
        "processIceMessage",
        "processingEnd",
        "processingStart",
        "processorOptions",
        "product",
        "productId",
        "productName",
        "productSub",
        "profile",
        "profileEnd",
        "profiles",
        "projectionMatrix",
        "promise",
        "prompt",
        "properties",
        "propertyIsEnumerable",
        "propertyName",
        "protectedAudience",
        "protocol",
        "protocolLong",
        "prototype",
        "provider",
        "proxy",
        "pseudoClass",
        "pseudoElement",
        "pt",
        "publicId",
        "publicKey",
        "published",
        "pulse",
        "push",
        "pushDebugGroup",
        "pushErrorScope",
        "pushManager",
        "pushNotification",
        "pushState",
        "put",
        "putImageData",
        "px",
        "quadraticCurveTo",
        "qualifier",
        "quaternion",
        "query",
        "queryCommandEnabled",
        "queryCommandIndeterm",
        "queryCommandState",
        "queryCommandSupported",
        "queryCommandText",
        "queryCommandValue",
        "queryFeatureSupport",
        "queryLocalFonts",
        "queryPermission",
        "querySelector",
        "querySelectorAll",
        "querySet",
        "queue",
        "queueMicrotask",
        "quote",
        "quotes",
        "r",
        "r1",
        "r2",
        "race",
        "rad",
        "radiogroup",
        "radius",
        "radiusX",
        "radiusY",
        "random",
        "randomUUID",
        "range",
        "rangeCount",
        "rangeEnd",
        "rangeMax",
        "rangeMin",
        "rangeOffset",
        "rangeOverflow",
        "rangeParent",
        "rangeStart",
        "rangeUnderflow",
        "rate",
        "ratio",
        "raw",
        "rawId",
        "rawJSON",
        "rawValueToMeters",
        "rcap",
        "rch",
        "read",
        "readAsArrayBuffer",
        "readAsBinaryString",
        "readAsBlob",
        "readAsDataURL",
        "readAsText",
        "readBuffer",
        "readEntries",
        "readOnly",
        "readPixels",
        "readReportRequested",
        "readText",
        "readValue",
        "readable",
        "ready",
        "readyState",
        "reason",
        "reasons",
        "reboot",
        "receiveFeatureReport",
        "receivedAlert",
        "receiver",
        "receivers",
        "recipient",
        "recommendedViewportScale",
        "reconnect",
        "recordNumber",
        "recordsAvailable",
        "recordset",
        "rect",
        "red",
        "redEyeReduction",
        "redirect",
        "redirectCount",
        "redirectEnd",
        "redirectStart",
        "redirected",
        "reduce",
        "reduceRight",
        "reduction",
        "refDistance",
        "refX",
        "refY",
        "referenceNode",
        "referenceSpace",
        "referrer",
        "referrerPolicy",
        "refresh",
        "region",
        "regionAnchorX",
        "regionAnchorY",
        "regionId",
        "regions",
        "register",
        "registerContentHandler",
        "registerElement",
        "registerInternalModuleStart",
        "registerInternalModuleStop",
        "registerProperty",
        "registerProtocolHandler",
        "reject",
        "rel",
        "relList",
        "relatedAddress",
        "relatedNode",
        "relatedPort",
        "relatedTarget",
        "relayProtocol",
        "release",
        "releaseCapture",
        "releaseEvents",
        "releaseInterface",
        "releaseLock",
        "releasePointerCapture",
        "releaseShaderCompiler",
        "released",
        "reliability",
        "reliable",
        "reliableWrite",
        "reload",
        "rem",
        "remainingSpace",
        "remote",
        "remoteDescription",
        "remove",
        "removeAllRanges",
        "removeAttribute",
        "removeAttributeNS",
        "removeAttributeNode",
        "removeBehavior",
        "removeChild",
        "removeCue",
        "removeEntry",
        "removeEventListener",
        "removeFilter",
        "removeImport",
        "removeItem",
        "removeListener",
        "removeNamedItem",
        "removeNamedItemNS",
        "removeNode",
        "removeParameter",
        "removeProperty",
        "removeRange",
        "removeRegion",
        "removeRule",
        "removeSiteSpecificTrackingException",
        "removeSourceBuffer",
        "removeStream",
        "removeTrack",
        "removeVariable",
        "removeWakeLockListener",
        "removeWebWideTrackingException",
        "removed",
        "removedNodes",
        "renderBlockingStatus",
        "renderHeight",
        "renderStart",
        "renderState",
        "renderTime",
        "renderWidth",
        "renderbufferStorage",
        "renderbufferStorageMultisample",
        "renderedBuffer",
        "rendererInterfaces",
        "renderers",
        "renderingMode",
        "renotify",
        "repeat",
        "repetitionCount",
        "replace",
        "replaceAdjacentText",
        "replaceAll",
        "replaceChild",
        "replaceChildren",
        "replaceData",
        "replaceId",
        "replaceItem",
        "replaceNode",
        "replaceState",
        "replaceSync",
        "replaceTrack",
        "replaceWholeText",
        "replaceWith",
        "reportError",
        "reportEvent",
        "reportId",
        "reportValidity",
        "request",
        "requestAdapter",
        "requestAdapterInfo",
        "requestAnimationFrame",
        "requestAutocomplete",
        "requestClose",
        "requestData",
        "requestDevice",
        "requestFrame",
        "requestFullscreen",
        "requestHitTestSource",
        "requestHitTestSourceForTransientInput",
        "requestId",
        "requestIdleCallback",
        "requestLightProbe",
        "requestMIDIAccess",
        "requestMediaKeySystemAccess",
        "requestPermission",
        "requestPictureInPicture",
        "requestPointerLock",
        "requestPort",
        "requestPresent",
        "requestPresenter",
        "requestReferenceSpace",
        "requestSession",
        "requestStart",
        "requestStorageAccess",
        "requestStorageAccessFor",
        "requestSubmit",
        "requestTime",
        "requestUpdateCheck",
        "requestVideoFrameCallback",
        "requestViewportScale",
        "requestWindow",
        "requestingWindow",
        "requireInteraction",
        "required",
        "requiredExtensions",
        "requiredFeatures",
        "requiredLimits",
        "reset",
        "resetLatency",
        "resetPose",
        "resetTransform",
        "resizable",
        "resize",
        "resizeBy",
        "resizeTo",
        "resolve",
        "resolveQuerySet",
        "resolveTarget",
        "resource",
        "respond",
        "respondWithNewView",
        "response",
        "responseBody",
        "responseEnd",
        "responseReady",
        "responseStart",
        "responseStatus",
        "responseText",
        "responseType",
        "responseURL",
        "responseXML",
        "restart",
        "restartAfterDelay",
        "restartIce",
        "restore",
        "result",
        "resultIndex",
        "resultType",
        "results",
        "resume",
        "resumeProfilers",
        "resumeTransformFeedback",
        "retry",
        "returnValue",
        "rev",
        "reverse",
        "reversed",
        "revocable",
        "revokeObjectURL",
        "rex",
        "rgbColor",
        "ric",
        "right",
        "rightContext",
        "rightDegrees",
        "rightMargin",
        "rightProjectionMatrix",
        "rightViewMatrix",
        "rlh",
        "role",
        "rolloffFactor",
        "root",
        "rootBounds",
        "rootElement",
        "rootMargin",
        "rotate",
        "rotateAxisAngle",
        "rotateAxisAngleSelf",
        "rotateFromVector",
        "rotateFromVectorSelf",
        "rotateSelf",
        "rotation",
        "rotationAngle",
        "rotationRate",
        "round",
        "roundRect",
        "row-gap",
        "rowGap",
        "rowIndex",
        "rowSpan",
        "rows",
        "rowsPerImage",
        "rtcpTransport",
        "rtt",
        "ruby-align",
        "ruby-position",
        "rubyAlign",
        "rubyOverhang",
        "rubyPosition",
        "rules",
        "run",
        "runAdAuction",
        "runtime",
        "runtimeStyle",
        "rx",
        "ry",
        "s",
        "safari",
        "sameDocument",
        "sample",
        "sampleCount",
        "sampleCoverage",
        "sampleInterval",
        "sampleRate",
        "sampleType",
        "sampler",
        "samplerParameterf",
        "samplerParameteri",
        "sandbox",
        "save",
        "saveAsPDF",
        "saveData",
        "scale",
        "scale3d",
        "scale3dSelf",
        "scaleNonUniform",
        "scaleNonUniformSelf",
        "scaleSelf",
        "scheduler",
        "scheduling",
        "scheme",
        "scissor",
        "scope",
        "scopeName",
        "scoped",
        "screen",
        "screenBrightness",
        "screenEnabled",
        "screenLeft",
        "screenPixelToMillimeterX",
        "screenPixelToMillimeterY",
        "screenState",
        "screenTop",
        "screenX",
        "screenY",
        "screens",
        "scriptURL",
        "scripting",
        "scripts",
        "scroll",
        "scroll-behavior",
        "scroll-margin",
        "scroll-margin-block",
        "scroll-margin-block-end",
        "scroll-margin-block-start",
        "scroll-margin-bottom",
        "scroll-margin-inline",
        "scroll-margin-inline-end",
        "scroll-margin-inline-start",
        "scroll-margin-left",
        "scroll-margin-right",
        "scroll-margin-top",
        "scroll-padding",
        "scroll-padding-block",
        "scroll-padding-block-end",
        "scroll-padding-block-start",
        "scroll-padding-bottom",
        "scroll-padding-inline",
        "scroll-padding-inline-end",
        "scroll-padding-inline-start",
        "scroll-padding-left",
        "scroll-padding-right",
        "scroll-padding-top",
        "scroll-snap-align",
        "scroll-snap-stop",
        "scroll-snap-type",
        "scrollAmount",
        "scrollBehavior",
        "scrollBy",
        "scrollByLines",
        "scrollByPages",
        "scrollDelay",
        "scrollHeight",
        "scrollIntoView",
        "scrollIntoViewIfNeeded",
        "scrollLeft",
        "scrollLeftMax",
        "scrollMargin",
        "scrollMarginBlock",
        "scrollMarginBlockEnd",
        "scrollMarginBlockStart",
        "scrollMarginBottom",
        "scrollMarginInline",
        "scrollMarginInlineEnd",
        "scrollMarginInlineStart",
        "scrollMarginLeft",
        "scrollMarginRight",
        "scrollMarginTop",
        "scrollMaxX",
        "scrollMaxY",
        "scrollPadding",
        "scrollPaddingBlock",
        "scrollPaddingBlockEnd",
        "scrollPaddingBlockStart",
        "scrollPaddingBottom",
        "scrollPaddingInline",
        "scrollPaddingInlineEnd",
        "scrollPaddingInlineStart",
        "scrollPaddingLeft",
        "scrollPaddingRight",
        "scrollPaddingTop",
        "scrollRestoration",
        "scrollSnapAlign",
        "scrollSnapStop",
        "scrollSnapType",
        "scrollTo",
        "scrollTop",
        "scrollTopMax",
        "scrollWidth",
        "scrollX",
        "scrollY",
        "scrollbar-color",
        "scrollbar-gutter",
        "scrollbar-width",
        "scrollbar3dLightColor",
        "scrollbarArrowColor",
        "scrollbarBaseColor",
        "scrollbarColor",
        "scrollbarDarkShadowColor",
        "scrollbarFaceColor",
        "scrollbarGutter",
        "scrollbarHighlightColor",
        "scrollbarShadowColor",
        "scrollbarTrackColor",
        "scrollbarWidth",
        "scrollbars",
        "scrolling",
        "scrollingElement",
        "sctp",
        "sctpCauseCode",
        "sdp",
        "sdpLineNumber",
        "sdpMLineIndex",
        "sdpMid",
        "seal",
        "search",
        "searchBox",
        "searchBoxJavaBridge_",
        "searchParams",
        "sectionRowIndex",
        "secureConnectionStart",
        "security",
        "seed",
        "seek",
        "seekToNextFrame",
        "seekable",
        "seeking",
        "select",
        "selectAllChildren",
        "selectAlternateInterface",
        "selectAudioOutput",
        "selectConfiguration",
        "selectNode",
        "selectNodeContents",
        "selectNodes",
        "selectSingleNode",
        "selectSubString",
        "selectURL",
        "selected",
        "selectedIndex",
        "selectedOptions",
        "selectedStyleSheetSet",
        "selectedStylesheetSet",
        "selectedTrack",
        "selection",
        "selectionDirection",
        "selectionEnd",
        "selectionStart",
        "selector",
        "selectorText",
        "self",
        "send",
        "sendAsBinary",
        "sendBeacon",
        "sendFeatureReport",
        "sendMessage",
        "sendNativeMessage",
        "sendOrder",
        "sendReport",
        "sender",
        "sentAlert",
        "sentTimestamp",
        "separator",
        "serial",
        "serialNumber",
        "serializable",
        "serializeToString",
        "serverTiming",
        "service",
        "serviceWorker",
        "session",
        "sessionId",
        "sessionStorage",
        "sessions",
        "set",
        "setActionHandler",
        "setActive",
        "setAlpha",
        "setAppBadge",
        "setAttribute",
        "setAttributeNS",
        "setAttributeNode",
        "setAttributeNodeNS",
        "setAttributionReporting",
        "setBadgeBackgroundColor",
        "setBadgeText",
        "setBadgeTextColor",
        "setBaseAndExtent",
        "setBigInt64",
        "setBigUint64",
        "setBindGroup",
        "setBingCurrentSearchDefault",
        "setBlendConstant",
        "setCameraActive",
        "setCapture",
        "setCaptureHandleConfig",
        "setCodecPreferences",
        "setColor",
        "setCompositeOperation",
        "setConfiguration",
        "setConsumer",
        "setCurrentTime",
        "setCustomValidity",
        "setData",
        "setDate",
        "setDragImage",
        "setEnabled",
        "setEnd",
        "setEndAfter",
        "setEndBefore",
        "setEndPoint",
        "setExpires",
        "setFillColor",
        "setFilterRes",
        "setFloat16",
        "setFloat32",
        "setFloat64",
        "setFloatValue",
        "setFocusBehavior",
        "setFormValue",
        "setFromBase64",
        "setFromHex",
        "setFullYear",
        "setHTMLUnsafe",
        "setHeaderExtensionsToNegotiate",
        "setHeaderValue",
        "setHours",
        "setIcon",
        "setIdentityProvider",
        "setImmediate",
        "setIndexBuffer",
        "setInt16",
        "setInt32",
        "setInt8",
        "setInterval",
        "setItem",
        "setKeyframes",
        "setLineCap",
        "setLineDash",
        "setLineJoin",
        "setLineWidth",
        "setLiveSeekableRange",
        "setLocalDescription",
        "setMatrix",
        "setMatrixValue",
        "setMediaKeys",
        "setMicrophoneActive",
        "setMilliseconds",
        "setMinutes",
        "setMiterLimit",
        "setMonth",
        "setNamedItem",
        "setNamedItemNS",
        "setNonUserCodeExceptions",
        "setOrientToAngle",
        "setOrientToAuto",
        "setOrientation",
        "setOverrideHistoryNavigationMode",
        "setPaint",
        "setParameter",
        "setParameters",
        "setPeriodicWave",
        "setPipeline",
        "setPointerCapture",
        "setPopup",
        "setPosition",
        "setPositionState",
        "setPreference",
        "setPriority",
        "setPrivateToken",
        "setProperty",
        "setPrototypeOf",
        "setRGBColor",
        "setRGBColorICCColor",
        "setRadius",
        "setRangeText",
        "setRemoteDescription",
        "setReportEventDataForAutomaticBeacons",
        "setRequestHeader",
        "setResizable",
        "setResourceTimingBufferSize",
        "setRotate",
        "setScale",
        "setScissorRect",
        "setSeconds",
        "setSelectionRange",
        "setServerCertificate",
        "setShadow",
        "setSharedStorageContext",
        "setSignals",
        "setSinkId",
        "setSkewX",
        "setSkewY",
        "setStart",
        "setStartAfter",
        "setStartBefore",
        "setStatus",
        "setStdDeviation",
        "setStencilReference",
        "setStreams",
        "setStrictMode",
        "setStringValue",
        "setStrokeColor",
        "setSuggestResult",
        "setTargetAtTime",
        "setTargetValueAtTime",
        "setTime",
        "setTimeout",
        "setTitle",
        "setTransform",
        "setTranslate",
        "setUTCDate",
        "setUTCFullYear",
        "setUTCHours",
        "setUTCMilliseconds",
        "setUTCMinutes",
        "setUTCMonth",
        "setUTCSeconds",
        "setUint16",
        "setUint32",
        "setUint8",
        "setUninstallURL",
        "setUpdateUrlData",
        "setUri",
        "setValidity",
        "setValueAtTime",
        "setValueCurveAtTime",
        "setVariable",
        "setVelocity",
        "setVersion",
        "setVertexBuffer",
        "setViewport",
        "setYear",
        "setZoom",
        "setZoomSettings",
        "settingName",
        "settingValue",
        "sex",
        "shaderLocation",
        "shaderSource",
        "shadowBlur",
        "shadowColor",
        "shadowOffsetX",
        "shadowOffsetY",
        "shadowRoot",
        "shadowRootClonable",
        "shadowRootDelegatesFocus",
        "shadowRootMode",
        "shadowRootSerializable",
        "shape",
        "shape-image-threshold",
        "shape-margin",
        "shape-outside",
        "shape-rendering",
        "shapeImageThreshold",
        "shapeMargin",
        "shapeOutside",
        "shapeRendering",
        "share",
        "sharedStorage",
        "sharedStorageWritable",
        "sheet",
        "shift",
        "shiftKey",
        "shiftLeft",
        "shippingAddress",
        "shippingOption",
        "shippingType",
        "show",
        "showDirectoryPicker",
        "showHelp",
        "showModal",
        "showModalDialog",
        "showModelessDialog",
        "showNotification",
        "showOpenFilePicker",
        "showPicker",
        "showPopover",
        "showSaveFilePicker",
        "sidebar",
        "sidebarAction",
        "sign",
        "signal",
        "signalingState",
        "signature",
        "silent",
        "sin",
        "singleNodeValue",
        "sinh",
        "sinkId",
        "sittingToStandingTransform",
        "size",
        "sizeAdjust",
        "sizeToContent",
        "sizeX",
        "sizeZ",
        "sizes",
        "skewX",
        "skewXSelf",
        "skewY",
        "skewYSelf",
        "skipTransition",
        "skipped",
        "slice",
        "slope",
        "slot",
        "slotAssignment",
        "small",
        "smil",
        "smooth",
        "smoothingTimeConstant",
        "snapTargetBlock",
        "snapTargetInline",
        "snapToLines",
        "snapshotItem",
        "snapshotLength",
        "some",
        "sort",
        "sortingCode",
        "source",
        "sourceBuffer",
        "sourceBuffers",
        "sourceCapabilities",
        "sourceCharPosition",
        "sourceFile",
        "sourceFunctionName",
        "sourceIndex",
        "sourceMap",
        "sourceURL",
        "sources",
        "spacing",
        "span",
        "speak",
        "speakAs",
        "speaking",
        "species",
        "specified",
        "specularConstant",
        "specularExponent",
        "speechSynthesis",
        "speed",
        "speedOfSound",
        "spellcheck",
        "sphericalHarmonicsCoefficients",
        "splice",
        "split",
        "splitText",
        "spreadMethod",
        "sqrt",
        "src",
        "srcElement",
        "srcFactor",
        "srcFilter",
        "srcObject",
        "srcUrn",
        "srcdoc",
        "srclang",
        "srcset",
        "stack",
        "stackTraceLimit",
        "stacktrace",
        "stageParameters",
        "standalone",
        "standby",
        "start",
        "startContainer",
        "startE",
        "startIce",
        "startLoadTime",
        "startMessages",
        "startNotifications",
        "startOffset",
        "startProfiling",
        "startRendering",
        "startShark",
        "startTime",
        "startViewTransition",
        "startsWith",
        "state",
        "states",
        "stats",
        "status",
        "statusCode",
        "statusMessage",
        "statusText",
        "statusbar",
        "stdDeviationX",
        "stdDeviationY",
        "stencilBack",
        "stencilClearValue",
        "stencilFront",
        "stencilFunc",
        "stencilFuncSeparate",
        "stencilLoadOp",
        "stencilMask",
        "stencilMaskSeparate",
        "stencilOp",
        "stencilOpSeparate",
        "stencilReadMask",
        "stencilReadOnly",
        "stencilStoreOp",
        "stencilWriteMask",
        "step",
        "stepDown",
        "stepMismatch",
        "stepMode",
        "stepUp",
        "sticky",
        "stitchTiles",
        "stop",
        "stop-color",
        "stop-opacity",
        "stopColor",
        "stopImmediatePropagation",
        "stopNotifications",
        "stopOpacity",
        "stopProfiling",
        "stopPropagation",
        "stopShark",
        "stopped",
        "storage",
        "storageArea",
        "storageBuckets",
        "storageName",
        "storageStatus",
        "storageTexture",
        "store",
        "storeOp",
        "storeSiteSpecificTrackingException",
        "storeWebWideTrackingException",
        "stpVersion",
        "stream",
        "streamErrorCode",
        "streams",
        "stretch",
        "strike",
        "string",
        "stringValue",
        "stringify",
        "stripIndexFormat",
        "stroke",
        "stroke-dasharray",
        "stroke-dashoffset",
        "stroke-linecap",
        "stroke-linejoin",
        "stroke-miterlimit",
        "stroke-opacity",
        "stroke-width",
        "strokeDasharray",
        "strokeDashoffset",
        "strokeLinecap",
        "strokeLinejoin",
        "strokeMiterlimit",
        "strokeOpacity",
        "strokeRect",
        "strokeStyle",
        "strokeText",
        "strokeWidth",
        "structuredClone",
        "style",
        "styleAndLayoutStart",
        "styleFloat",
        "styleMap",
        "styleMedia",
        "styleSheet",
        "styleSheetSets",
        "styleSheets",
        "sub",
        "subarray",
        "subject",
        "submit",
        "submitFrame",
        "submitter",
        "subscribe",
        "substr",
        "substring",
        "substringData",
        "subtle",
        "subtree",
        "suffix",
        "suffixes",
        "summary",
        "sup",
        "supported",
        "supportedContentEncodings",
        "supportedEntryTypes",
        "supportedValuesOf",
        "supports",
        "supportsFiber",
        "supportsSession",
        "supportsText",
        "surfaceScale",
        "surroundContents",
        "suspend",
        "suspendRedraw",
        "svb",
        "svh",
        "svi",
        "svmax",
        "svmin",
        "svw",
        "swapCache",
        "swapNode",
        "sweepFlag",
        "symbols",
        "symmetricDifference",
        "sync",
        "syntax",
        "sysexEnabled",
        "system",
        "systemCode",
        "systemId",
        "systemLanguage",
        "systemXDPI",
        "systemYDPI",
        "tBodies",
        "tFoot",
        "tHead",
        "tab",
        "tab-size",
        "tabId",
        "tabIds",
        "tabIndex",
        "tabSize",
        "table",
        "table-layout",
        "tableLayout",
        "tableValues",
        "tabs",
        "tag",
        "tagName",
        "tagUrn",
        "tags",
        "taintEnabled",
        "take",
        "takePhoto",
        "takeRecords",
        "tan",
        "tangentialPressure",
        "tanh",
        "target",
        "targetAddressSpace",
        "targetElement",
        "targetRayMode",
        "targetRaySpace",
        "targetTouches",
        "targetURL",
        "targetX",
        "targetY",
        "targets",
        "tcpType",
        "tee",
        "tel",
        "telemetry",
        "terminate",
        "test",
        "texImage2D",
        "texImage3D",
        "texParameterf",
        "texParameteri",
        "texStorage2D",
        "texStorage3D",
        "texSubImage2D",
        "texSubImage3D",
        "text",
        "text-align",
        "text-align-last",
        "text-anchor",
        "text-combine-upright",
        "text-decoration",
        "text-decoration-color",
        "text-decoration-line",
        "text-decoration-skip-ink",
        "text-decoration-style",
        "text-decoration-thickness",
        "text-emphasis",
        "text-emphasis-color",
        "text-emphasis-position",
        "text-emphasis-style",
        "text-indent",
        "text-justify",
        "text-orientation",
        "text-overflow",
        "text-rendering",
        "text-shadow",
        "text-transform",
        "text-underline-offset",
        "text-underline-position",
        "text-wrap",
        "text-wrap-mode",
        "text-wrap-style",
        "textAlign",
        "textAlignLast",
        "textAnchor",
        "textAutospace",
        "textBaseline",
        "textCombineUpright",
        "textContent",
        "textDecoration",
        "textDecorationBlink",
        "textDecorationColor",
        "textDecorationLine",
        "textDecorationLineThrough",
        "textDecorationNone",
        "textDecorationOverline",
        "textDecorationSkipInk",
        "textDecorationStyle",
        "textDecorationThickness",
        "textDecorationUnderline",
        "textEmphasis",
        "textEmphasisColor",
        "textEmphasisPosition",
        "textEmphasisStyle",
        "textIndent",
        "textJustify",
        "textJustifyTrim",
        "textKashida",
        "textKashidaSpace",
        "textLength",
        "textOrientation",
        "textOverflow",
        "textRendering",
        "textShadow",
        "textTracks",
        "textTransform",
        "textUnderlineOffset",
        "textUnderlinePosition",
        "textWrap",
        "textWrapMode",
        "textWrapStyle",
        "texture",
        "theme",
        "then",
        "threadId",
        "threshold",
        "thresholds",
        "throwIfAborted",
        "tiltX",
        "tiltY",
        "time",
        "timeEnd",
        "timeLog",
        "timeOrigin",
        "timeRemaining",
        "timeStamp",
        "timecode",
        "timeline",
        "timelineTime",
        "timeout",
        "timestamp",
        "timestampOffset",
        "timestampWrites",
        "timing",
        "title",
        "titlebarAreaRect",
        "tlsChannelId",
        "to",
        "toArray",
        "toBase64",
        "toBlob",
        "toDataURL",
        "toDateString",
        "toElement",
        "toExponential",
        "toFixed",
        "toFloat32Array",
        "toFloat64Array",
        "toGMTString",
        "toHex",
        "toISOString",
        "toJSON",
        "toLocaleDateString",
        "toLocaleFormat",
        "toLocaleLowerCase",
        "toLocaleString",
        "toLocaleTimeString",
        "toLocaleUpperCase",
        "toLowerCase",
        "toMatrix",
        "toMethod",
        "toPrecision",
        "toPrimitive",
        "toReversed",
        "toSdp",
        "toSorted",
        "toSource",
        "toSpliced",
        "toStaticHTML",
        "toString",
        "toStringTag",
        "toSum",
        "toTimeString",
        "toUTCString",
        "toUpperCase",
        "toWellFormed",
        "toggle",
        "toggleAttribute",
        "toggleLongPressEnabled",
        "togglePopover",
        "toggleReaderMode",
        "token",
        "tone",
        "toneBuffer",
        "tooLong",
        "tooShort",
        "toolbar",
        "top",
        "topMargin",
        "topSites",
        "topology",
        "total",
        "totalFrameDelay",
        "totalFrames",
        "totalFramesDuration",
        "totalVideoFrames",
        "touch-action",
        "touchAction",
        "touched",
        "touches",
        "trace",
        "track",
        "trackVisibility",
        "trackedAnchors",
        "tracks",
        "tran",
        "transaction",
        "transactions",
        "transceiver",
        "transfer",
        "transferControlToOffscreen",
        "transferFromImageBitmap",
        "transferImageBitmap",
        "transferIn",
        "transferOut",
        "transferSize",
        "transferToFixedLength",
        "transferToImageBitmap",
        "transform",
        "transform-box",
        "transform-origin",
        "transform-style",
        "transformBox",
        "transformFeedbackVaryings",
        "transformOrigin",
        "transformPoint",
        "transformString",
        "transformStyle",
        "transformToDocument",
        "transformToFragment",
        "transition",
        "transition-behavior",
        "transition-delay",
        "transition-duration",
        "transition-property",
        "transition-timing-function",
        "transitionBehavior",
        "transitionDelay",
        "transitionDuration",
        "transitionProperty",
        "transitionTimingFunction",
        "translate",
        "translateSelf",
        "translationX",
        "translationY",
        "transport",
        "traverseTo",
        "trim",
        "trimEnd",
        "trimLeft",
        "trimRight",
        "trimStart",
        "trueSpeed",
        "trunc",
        "truncate",
        "trustedTypes",
        "try",
        "turn",
        "twist",
        "type",
        "typeDetail",
        "typeMismatch",
        "typeMustMatch",
        "types",
        "u2f",
        "ubound",
        "uint16",
        "uint32",
        "uint8",
        "uint8Clamped",
        "unadjustedMovement",
        "unclippedDepth",
        "unconfigure",
        "undefined",
        "underlineStyle",
        "underlineThickness",
        "unescape",
        "uneval",
        "ungroup",
        "unicode",
        "unicode-bidi",
        "unicodeBidi",
        "unicodeRange",
        "unicodeSets",
        "uniform1f",
        "uniform1fv",
        "uniform1i",
        "uniform1iv",
        "uniform1ui",
        "uniform1uiv",
        "uniform2f",
        "uniform2fv",
        "uniform2i",
        "uniform2iv",
        "uniform2ui",
        "uniform2uiv",
        "uniform3f",
        "uniform3fv",
        "uniform3i",
        "uniform3iv",
        "uniform3ui",
        "uniform3uiv",
        "uniform4f",
        "uniform4fv",
        "uniform4i",
        "uniform4iv",
        "uniform4ui",
        "uniform4uiv",
        "uniformBlockBinding",
        "uniformMatrix2fv",
        "uniformMatrix2x3fv",
        "uniformMatrix2x4fv",
        "uniformMatrix3fv",
        "uniformMatrix3x2fv",
        "uniformMatrix3x4fv",
        "uniformMatrix4fv",
        "uniformMatrix4x2fv",
        "uniformMatrix4x3fv",
        "uninstallSelf",
        "union",
        "unique",
        "uniqueID",
        "uniqueNumber",
        "unit",
        "unitType",
        "units",
        "unloadEventEnd",
        "unloadEventStart",
        "unlock",
        "unmap",
        "unmount",
        "unobserve",
        "unpackColorSpace",
        "unpause",
        "unpauseAnimations",
        "unreadCount",
        "unregister",
        "unregisterContentHandler",
        "unregisterProtocolHandler",
        "unscopables",
        "unselectable",
        "unshift",
        "unsubscribe",
        "unsuspendRedraw",
        "unsuspendRedrawAll",
        "unwatch",
        "unwrapKey",
        "upDegrees",
        "upX",
        "upY",
        "upZ",
        "update",
        "updateAdInterestGroups",
        "updateCallbackDone",
        "updateCharacterBounds",
        "updateCommands",
        "updateControlBounds",
        "updateCurrentEntry",
        "updateIce",
        "updateInkTrailStartPoint",
        "updateInterval",
        "updatePlaybackRate",
        "updateRangeEnd",
        "updateRangeStart",
        "updateRenderState",
        "updateSelection",
        "updateSelectionBounds",
        "updateSettings",
        "updateText",
        "updateTiming",
        "updateViaCache",
        "updateWith",
        "updated",
        "updating",
        "upgrade",
        "upload",
        "uploadTotal",
        "uploaded",
        "upper",
        "upperBound",
        "upperOpen",
        "uri",
        "url",
        "urn",
        "urns",
        "usage",
        "usages",
        "usb",
        "usbVersionMajor",
        "usbVersionMinor",
        "usbVersionSubminor",
        "useCurrentView",
        "useMap",
        "useProgram",
        "usedSpace",
        "user-select",
        "userActivation",
        "userAgent",
        "userAgentData",
        "userChoice",
        "userHandle",
        "userHint",
        "userInitiated",
        "userLanguage",
        "userSelect",
        "userState",
        "userVisibleOnly",
        "username",
        "usernameFragment",
        "utterance",
        "uuid",
        "v8BreakIterator",
        "vAlign",
        "vLink",
        "valid",
        "validate",
        "validateProgram",
        "validationMessage",
        "validity",
        "value",
        "valueAsDate",
        "valueAsNumber",
        "valueAsString",
        "valueInSpecifiedUnits",
        "valueMissing",
        "valueOf",
        "valueText",
        "valueType",
        "values",
        "variable",
        "variant",
        "variationSettings",
        "vb",
        "vector-effect",
        "vectorEffect",
        "velocityAngular",
        "velocityExpansion",
        "velocityX",
        "velocityY",
        "vendor",
        "vendorId",
        "vendorSub",
        "verify",
        "version",
        "vertex",
        "vertexAttrib1f",
        "vertexAttrib1fv",
        "vertexAttrib2f",
        "vertexAttrib2fv",
        "vertexAttrib3f",
        "vertexAttrib3fv",
        "vertexAttrib4f",
        "vertexAttrib4fv",
        "vertexAttribDivisor",
        "vertexAttribDivisorANGLE",
        "vertexAttribI4i",
        "vertexAttribI4iv",
        "vertexAttribI4ui",
        "vertexAttribI4uiv",
        "vertexAttribIPointer",
        "vertexAttribPointer",
        "vertical",
        "vertical-align",
        "verticalAlign",
        "verticalOverflow",
        "vh",
        "vi",
        "vibrate",
        "vibrationActuator",
        "videoBitsPerSecond",
        "videoHeight",
        "videoTracks",
        "videoWidth",
        "view",
        "viewBox",
        "viewBoxString",
        "viewDimension",
        "viewFormats",
        "viewTarget",
        "viewTargetString",
        "viewTransition",
        "viewport",
        "viewportAnchorX",
        "viewportAnchorY",
        "viewportElement",
        "views",
        "violatedDirective",
        "virtualKeyboard",
        "virtualKeyboardPolicy",
        "visibility",
        "visibilityState",
        "visible",
        "visibleRect",
        "visualViewport",
        "vlinkColor",
        "vmax",
        "vmin",
        "voice",
        "voiceURI",
        "volume",
        "vrml",
        "vspace",
        "vw",
        "w",
        "wait",
        "waitAsync",
        "waitSync",
        "waiting",
        "wake",
        "wakeLock",
        "wand",
        "warmup",
        "warn",
        "wasAlternateProtocolAvailable",
        "wasClean",
        "wasDiscarded",
        "wasFetchedViaSpdy",
        "wasNpnNegotiated",
        "watch",
        "watchAvailability",
        "watchPosition",
        "webNavigation",
        "webRequest",
        "webdriver",
        "webkitAddKey",
        "webkitAlignContent",
        "webkitAlignItems",
        "webkitAlignSelf",
        "webkitAnimation",
        "webkitAnimationDelay",
        "webkitAnimationDirection",
        "webkitAnimationDuration",
        "webkitAnimationFillMode",
        "webkitAnimationIterationCount",
        "webkitAnimationName",
        "webkitAnimationPlayState",
        "webkitAnimationTimingFunction",
        "webkitAppearance",
        "webkitAudioContext",
        "webkitAudioDecodedByteCount",
        "webkitAudioPannerNode",
        "webkitBackfaceVisibility",
        "webkitBackground",
        "webkitBackgroundAttachment",
        "webkitBackgroundClip",
        "webkitBackgroundColor",
        "webkitBackgroundImage",
        "webkitBackgroundOrigin",
        "webkitBackgroundPosition",
        "webkitBackgroundPositionX",
        "webkitBackgroundPositionY",
        "webkitBackgroundRepeat",
        "webkitBackgroundSize",
        "webkitBackingStorePixelRatio",
        "webkitBorderBottomLeftRadius",
        "webkitBorderBottomRightRadius",
        "webkitBorderImage",
        "webkitBorderImageOutset",
        "webkitBorderImageRepeat",
        "webkitBorderImageSlice",
        "webkitBorderImageSource",
        "webkitBorderImageWidth",
        "webkitBorderRadius",
        "webkitBorderTopLeftRadius",
        "webkitBorderTopRightRadius",
        "webkitBoxAlign",
        "webkitBoxDirection",
        "webkitBoxFlex",
        "webkitBoxOrdinalGroup",
        "webkitBoxOrient",
        "webkitBoxPack",
        "webkitBoxShadow",
        "webkitBoxSizing",
        "webkitCancelAnimationFrame",
        "webkitCancelFullScreen",
        "webkitCancelKeyRequest",
        "webkitCancelRequestAnimationFrame",
        "webkitClearResourceTimings",
        "webkitClipPath",
        "webkitClosedCaptionsVisible",
        "webkitConvertPointFromNodeToPage",
        "webkitConvertPointFromPageToNode",
        "webkitCreateShadowRoot",
        "webkitCurrentFullScreenElement",
        "webkitCurrentPlaybackTargetIsWireless",
        "webkitDecodedFrameCount",
        "webkitDirectionInvertedFromDevice",
        "webkitDisplayingFullscreen",
        "webkitDroppedFrameCount",
        "webkitEnterFullScreen",
        "webkitEnterFullscreen",
        "webkitEntries",
        "webkitExitFullScreen",
        "webkitExitFullscreen",
        "webkitExitPointerLock",
        "webkitFilter",
        "webkitFlex",
        "webkitFlexBasis",
        "webkitFlexDirection",
        "webkitFlexFlow",
        "webkitFlexGrow",
        "webkitFlexShrink",
        "webkitFlexWrap",
        "webkitFontFeatureSettings",
        "webkitFullScreenKeyboardInputAllowed",
        "webkitFullscreenElement",
        "webkitFullscreenEnabled",
        "webkitGenerateKeyRequest",
        "webkitGetAsEntry",
        "webkitGetDatabaseNames",
        "webkitGetEntries",
        "webkitGetEntriesByName",
        "webkitGetEntriesByType",
        "webkitGetFlowByName",
        "webkitGetGamepads",
        "webkitGetImageDataHD",
        "webkitGetNamedFlows",
        "webkitGetRegionFlowRanges",
        "webkitGetUserMedia",
        "webkitHasClosedCaptions",
        "webkitHidden",
        "webkitIDBCursor",
        "webkitIDBDatabase",
        "webkitIDBDatabaseError",
        "webkitIDBDatabaseException",
        "webkitIDBFactory",
        "webkitIDBIndex",
        "webkitIDBKeyRange",
        "webkitIDBObjectStore",
        "webkitIDBRequest",
        "webkitIDBTransaction",
        "webkitImageSmoothingEnabled",
        "webkitIndexedDB",
        "webkitInitMessageEvent",
        "webkitIsFullScreen",
        "webkitJustifyContent",
        "webkitKeys",
        "webkitLineClamp",
        "webkitLineDashOffset",
        "webkitLockOrientation",
        "webkitMask",
        "webkitMaskClip",
        "webkitMaskComposite",
        "webkitMaskImage",
        "webkitMaskOrigin",
        "webkitMaskPosition",
        "webkitMaskPositionX",
        "webkitMaskPositionY",
        "webkitMaskRepeat",
        "webkitMaskSize",
        "webkitMatchesSelector",
        "webkitMediaStream",
        "webkitNotifications",
        "webkitOfflineAudioContext",
        "webkitOrder",
        "webkitOrientation",
        "webkitPeerConnection00",
        "webkitPersistentStorage",
        "webkitPerspective",
        "webkitPerspectiveOrigin",
        "webkitPointerLockElement",
        "webkitPostMessage",
        "webkitPreservesPitch",
        "webkitPutImageDataHD",
        "webkitRTCPeerConnection",
        "webkitRegionOverset",
        "webkitRelativePath",
        "webkitRequestAnimationFrame",
        "webkitRequestFileSystem",
        "webkitRequestFullScreen",
        "webkitRequestFullscreen",
        "webkitRequestPointerLock",
        "webkitResolveLocalFileSystemURL",
        "webkitSetMediaKeys",
        "webkitSetResourceTimingBufferSize",
        "webkitShadowRoot",
        "webkitShowPlaybackTargetPicker",
        "webkitSlice",
        "webkitSpeechGrammar",
        "webkitSpeechGrammarList",
        "webkitSpeechRecognition",
        "webkitSpeechRecognitionError",
        "webkitSpeechRecognitionEvent",
        "webkitStorageInfo",
        "webkitSupportsFullscreen",
        "webkitTemporaryStorage",
        "webkitTextFillColor",
        "webkitTextSecurity",
        "webkitTextSizeAdjust",
        "webkitTextStroke",
        "webkitTextStrokeColor",
        "webkitTextStrokeWidth",
        "webkitTransform",
        "webkitTransformOrigin",
        "webkitTransformStyle",
        "webkitTransition",
        "webkitTransitionDelay",
        "webkitTransitionDuration",
        "webkitTransitionProperty",
        "webkitTransitionTimingFunction",
        "webkitURL",
        "webkitUnlockOrientation",
        "webkitUserSelect",
        "webkitVideoDecodedByteCount",
        "webkitVisibilityState",
        "webkitWirelessVideoPlaybackDisabled",
        "webkitdirectory",
        "webkitdropzone",
        "webstore",
        "weight",
        "wgslLanguageFeatures",
        "whatToShow",
        "wheelDelta",
        "wheelDeltaX",
        "wheelDeltaY",
        "whenDefined",
        "which",
        "white-space",
        "white-space-collapse",
        "whiteSpace",
        "whiteSpaceCollapse",
        "wholeText",
        "widows",
        "width",
        "will-change",
        "willChange",
        "willValidate",
        "window",
        "windowAttribution",
        "windowControlsOverlay",
        "windowId",
        "windowIds",
        "windows",
        "with",
        "withCredentials",
        "withResolvers",
        "word-break",
        "word-spacing",
        "word-wrap",
        "wordBreak",
        "wordSpacing",
        "wordWrap",
        "workerStart",
        "worklet",
        "wow64",
        "wrap",
        "wrapKey",
        "writable",
        "writableAuxiliaries",
        "write",
        "writeBuffer",
        "writeMask",
        "writeText",
        "writeTexture",
        "writeTimestamp",
        "writeValue",
        "writeValueWithResponse",
        "writeValueWithoutResponse",
        "writeWithoutResponse",
        "writeln",
        "writing-mode",
        "writingMode",
        "writingSuggestions",
        "x",
        "x1",
        "x2",
        "xChannelSelector",
        "xmlEncoding",
        "xmlStandalone",
        "xmlVersion",
        "xmlbase",
        "xmllang",
        "xmlspace",
        "xor",
        "xr",
        "y",
        "y1",
        "y2",
        "yChannelSelector",
        "yandex",
        "yield",
        "z",
        "z-index",
        "zIndex",
        "zoom",
        "zoomAndPan",
        "zoomRectScreen"
      ];
      function find_builtins(reserved) {
        domprops.forEach(add);
        var new_globals = ["Symbol", "Map", "Promise", "Proxy", "Reflect", "Set", "WeakMap", "WeakSet"];
        var objects = {};
        var global_ref = typeof window === "object" ? window : self;
        new_globals.forEach(function(new_global) {
          objects[new_global] = global_ref[new_global] || function() {
          };
        });
        [
          "null",
          "true",
          "false",
          "NaN",
          "Infinity",
          "-Infinity",
          "undefined"
        ].forEach(add);
        [
          Object,
          Array,
          Function,
          Number,
          String,
          Boolean,
          Error,
          Math,
          Date,
          RegExp,
          objects.Symbol,
          ArrayBuffer,
          DataView,
          decodeURI,
          decodeURIComponent,
          encodeURI,
          encodeURIComponent,
          eval,
          EvalError,
          Float32Array,
          Float64Array,
          Int8Array,
          Int16Array,
          Int32Array,
          isFinite,
          isNaN,
          JSON,
          objects.Map,
          parseFloat,
          parseInt,
          objects.Promise,
          objects.Proxy,
          RangeError,
          ReferenceError,
          objects.Reflect,
          objects.Set,
          SyntaxError,
          TypeError,
          Uint8Array,
          Uint8ClampedArray,
          Uint16Array,
          Uint32Array,
          URIError,
          objects.WeakMap,
          objects.WeakSet
        ].forEach(function(ctor) {
          Object.getOwnPropertyNames(ctor).map(add);
          if (ctor.prototype) {
            Object.getOwnPropertyNames(ctor.prototype).map(add);
          }
        });
        function add(name) {
          reserved.add(name);
        }
      }
      function reserve_quoted_keys(ast, reserved) {
        function add(name) {
          push_uniq(reserved, name);
        }
        ast.walk(new TreeWalker(function(node) {
          if (node instanceof AST_ObjectKeyVal && node.quote) {
            add(node.key);
          } else if (node instanceof AST_ObjectProperty && node.quote) {
            add(node.key.name);
          } else if (node instanceof AST_Sub) {
            addStrings(node.property, add);
          }
        }));
      }
      function addStrings(node, add) {
        node.walk(new TreeWalker(function(node2) {
          if (node2 instanceof AST_Sequence) {
            addStrings(node2.tail_node(), add);
          } else if (node2 instanceof AST_String) {
            add(node2.value);
          } else if (node2 instanceof AST_Conditional) {
            addStrings(node2.consequent, add);
            addStrings(node2.alternative, add);
          }
          return true;
        }));
      }
      function mangle_private_properties(ast, options) {
        var cprivate = -1;
        var private_cache = /* @__PURE__ */ new Map();
        var nth_identifier = options.nth_identifier || base54;
        ast = ast.transform(new TreeTransformer(function(node) {
          if (node instanceof AST_ClassPrivateProperty || node instanceof AST_PrivateMethod || node instanceof AST_PrivateGetter || node instanceof AST_PrivateSetter || node instanceof AST_PrivateIn) {
            node.key.name = mangle_private(node.key.name);
          } else if (node instanceof AST_DotHash) {
            node.property = mangle_private(node.property);
          }
        }));
        return ast;
        function mangle_private(name) {
          let mangled = private_cache.get(name);
          if (!mangled) {
            mangled = nth_identifier.get(++cprivate);
            private_cache.set(name, mangled);
          }
          return mangled;
        }
      }
      function find_annotated_props(ast) {
        var annotated_props = /* @__PURE__ */ new Set();
        walk(ast, (node) => {
          if (node instanceof AST_ClassPrivateProperty || node instanceof AST_PrivateMethod || node instanceof AST_PrivateGetter || node instanceof AST_PrivateSetter || node instanceof AST_DotHash) ;
          else if (node instanceof AST_ObjectKeyVal) {
            if (typeof node.key == "string" && has_annotation(node, _MANGLEPROP)) {
              annotated_props.add(node.key);
            }
          } else if (node instanceof AST_ObjectProperty) {
            if (has_annotation(node, _MANGLEPROP)) {
              annotated_props.add(node.key.name);
            }
          } else if (node instanceof AST_Dot) {
            if (has_annotation(node, _MANGLEPROP)) {
              annotated_props.add(node.property);
            }
          } else if (node instanceof AST_Sub) {
            if (node.property instanceof AST_String && has_annotation(node, _MANGLEPROP)) {
              annotated_props.add(node.property.value);
            }
          }
        });
        return annotated_props;
      }
      function mangle_properties(ast, options, annotated_props = find_annotated_props(ast)) {
        options = defaults2(options, {
          builtins: false,
          cache: null,
          debug: false,
          keep_quoted: false,
          nth_identifier: base54,
          only_cache: false,
          regex: null,
          reserved: null,
          undeclared: false,
          only_annotated: false
        }, true);
        var nth_identifier = options.nth_identifier;
        var reserved_option = options.reserved;
        if (!Array.isArray(reserved_option)) reserved_option = [reserved_option];
        var reserved = new Set(reserved_option);
        if (!options.builtins) find_builtins(reserved);
        var cname = -1;
        var cache;
        if (options.cache) {
          cache = options.cache.props;
        } else {
          cache = /* @__PURE__ */ new Map();
        }
        var only_annotated = options.only_annotated;
        var regex2 = options.regex && new RegExp(options.regex);
        var debug = options.debug !== false;
        var debug_name_suffix;
        if (debug) {
          debug_name_suffix = options.debug === true ? "" : options.debug;
        }
        var names_to_mangle = /* @__PURE__ */ new Set();
        var unmangleable = /* @__PURE__ */ new Set();
        cache.forEach((mangled_name) => unmangleable.add(mangled_name));
        var keep_quoted = !!options.keep_quoted;
        ast.walk(new TreeWalker(function(node) {
          if (node instanceof AST_ClassPrivateProperty || node instanceof AST_PrivateMethod || node instanceof AST_PrivateGetter || node instanceof AST_PrivateSetter || node instanceof AST_DotHash) ;
          else if (node instanceof AST_ObjectKeyVal) {
            if (typeof node.key == "string" && (!keep_quoted || !node.quote)) {
              add(node.key);
            }
          } else if (node instanceof AST_ObjectProperty) {
            if (!keep_quoted || !node.quote) {
              add(node.key.name);
            }
          } else if (node instanceof AST_Dot) {
            var declared = !!options.undeclared;
            if (!declared) {
              var root5 = node;
              while (root5.expression) {
                root5 = root5.expression;
              }
              declared = !(root5.thedef && root5.thedef.undeclared);
            }
            if (declared && (!keep_quoted || !node.quote)) {
              add(node.property);
            }
          } else if (node instanceof AST_Sub) {
            if (!keep_quoted) {
              addStrings(node.property, add);
            }
          } else if (node instanceof AST_Call && node.expression.print_to_string() == "Object.defineProperty") {
            addStrings(node.args[1], add);
          } else if (node instanceof AST_Binary && node.operator === "in") {
            addStrings(node.left, add);
          } else if (node instanceof AST_String && has_annotation(node, _KEY)) {
            add(node.value);
          }
        }));
        return ast.transform(new TreeTransformer(function(node) {
          if (node instanceof AST_ClassPrivateProperty || node instanceof AST_PrivateMethod || node instanceof AST_PrivateGetter || node instanceof AST_PrivateSetter || node instanceof AST_DotHash) ;
          else if (node instanceof AST_ObjectKeyVal) {
            if (typeof node.key == "string" && (!keep_quoted || !node.quote)) {
              node.key = mangle(node.key);
            }
          } else if (node instanceof AST_ObjectProperty) {
            if (!keep_quoted || !node.quote) {
              if (!node.computed_key()) {
                node.key.name = mangle(node.key.name);
              }
            }
          } else if (node instanceof AST_Dot) {
            if (!keep_quoted || !node.quote) {
              node.property = mangle(node.property);
            }
          } else if (!keep_quoted && node instanceof AST_Sub) {
            node.property = mangleStrings(node.property);
          } else if (node instanceof AST_Call && node.expression.print_to_string() == "Object.defineProperty") {
            node.args[1] = mangleStrings(node.args[1]);
          } else if (node instanceof AST_Binary && node.operator === "in") {
            node.left = mangleStrings(node.left);
          } else if (node instanceof AST_String && has_annotation(node, _KEY)) {
            clear_annotation(node, _KEY);
            node.value = mangle(node.value);
          }
        }));
        function can_mangle(name) {
          if (unmangleable.has(name)) return false;
          if (reserved.has(name)) return false;
          if (options.only_cache) {
            return cache.has(name);
          }
          if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false;
          return true;
        }
        function should_mangle(name) {
          if (only_annotated && !annotated_props.has(name)) return false;
          if (regex2 && !regex2.test(name)) {
            return annotated_props.has(name);
          }
          if (reserved.has(name)) return false;
          return cache.has(name) || names_to_mangle.has(name);
        }
        function add(name) {
          if (can_mangle(name)) {
            names_to_mangle.add(name);
          }
          if (!should_mangle(name)) {
            unmangleable.add(name);
          }
        }
        function mangle(name) {
          if (!should_mangle(name)) {
            return name;
          }
          var mangled = cache.get(name);
          if (!mangled) {
            if (debug) {
              var debug_mangled = "_$" + name + "$" + debug_name_suffix + "_";
              if (can_mangle(debug_mangled)) {
                mangled = debug_mangled;
              }
            }
            if (!mangled) {
              do {
                mangled = nth_identifier.get(++cname);
              } while (!can_mangle(mangled));
            }
            cache.set(name, mangled);
          }
          return mangled;
        }
        function mangleStrings(node) {
          return node.transform(new TreeTransformer(function(node2) {
            if (node2 instanceof AST_Sequence) {
              var last = node2.expressions.length - 1;
              node2.expressions[last] = mangleStrings(node2.expressions[last]);
            } else if (node2 instanceof AST_String) {
              clear_annotation(node2, _KEY);
              node2.value = mangle(node2.value);
            } else if (node2 instanceof AST_Conditional) {
              node2.consequent = mangleStrings(node2.consequent);
              node2.alternative = mangleStrings(node2.alternative);
            }
            return node2;
          }));
        }
      }
      var to_ascii = typeof Buffer !== "undefined" ? (b64) => Buffer.from(b64, "base64").toString() : (b64) => decodeURIComponent(escape(atob(b64)));
      var to_base64 = typeof Buffer !== "undefined" ? (str) => Buffer.from(str).toString("base64") : (str) => btoa(unescape(encodeURIComponent(str)));
      function read_source_map(code) {
        var match3 = /(?:^|[^.])\/\/# sourceMappingURL=data:application\/json(;[\w=-]*)?;base64,([+/0-9A-Za-z]*=*)\s*$/.exec(code);
        if (!match3) {
          console.warn("inline source map not found");
          return null;
        }
        return to_ascii(match3[2]);
      }
      function set_shorthand(name, options, keys2) {
        if (options[name]) {
          keys2.forEach(function(key4) {
            if (options[key4]) {
              if (typeof options[key4] != "object") options[key4] = {};
              if (!(name in options[key4])) options[key4][name] = options[name];
            }
          });
        }
      }
      function init_cache(cache) {
        if (!cache) return;
        if (!("props" in cache)) {
          cache.props = /* @__PURE__ */ new Map();
        } else if (!(cache.props instanceof Map)) {
          cache.props = map_from_object(cache.props);
        }
      }
      function cache_to_json(cache) {
        return {
          props: map_to_object(cache.props)
        };
      }
      function log_input(files, options, fs7, debug_folder) {
        if (!(fs7 && fs7.writeFileSync && fs7.mkdirSync)) {
          return;
        }
        try {
          fs7.mkdirSync(debug_folder);
        } catch (e2) {
          if (e2.code !== "EEXIST") throw e2;
        }
        const log_path = `${debug_folder}/terser-debug-${Math.random() * 9999999 | 0}.log`;
        options = options || {};
        const options_str = JSON.stringify(options, (_key, thing) => {
          if (typeof thing === "function") return "[Function " + thing.toString() + "]";
          if (thing instanceof RegExp) return "[RegExp " + thing.toString() + "]";
          return thing;
        }, 4);
        const files_str = (file) => {
          if (typeof file === "object" && options.parse && options.parse.spidermonkey) {
            return JSON.stringify(file, null, 2);
          } else if (typeof file === "object") {
            return Object.keys(file).map((key4) => key4 + ": " + files_str(file[key4])).join("\n\n");
          } else if (typeof file === "string") {
            return "```\n" + file + "\n```";
          } else {
            return file;
          }
        };
        fs7.writeFileSync(log_path, "Options: \n" + options_str + "\n\nInput files:\n\n" + files_str(files) + "\n");
      }
      function* minify_sync_or_async(files, options, _fs_module) {
        if (_fs_module && typeof process === "object" && process.env && typeof process.env.TERSER_DEBUG_DIR === "string") {
          log_input(files, options, _fs_module, process.env.TERSER_DEBUG_DIR);
        }
        options = defaults2(options, {
          compress: {},
          ecma: void 0,
          enclose: false,
          ie8: false,
          keep_classnames: void 0,
          keep_fnames: false,
          mangle: {},
          module: false,
          nameCache: null,
          output: null,
          format: null,
          parse: {},
          rename: void 0,
          safari10: false,
          sourceMap: false,
          spidermonkey: false,
          timings: false,
          toplevel: false,
          warnings: false,
          wrap: false
        }, true);
        var timings = options.timings && {
          start: Date.now()
        };
        if (options.keep_classnames === void 0) {
          options.keep_classnames = options.keep_fnames;
        }
        if (options.rename === void 0) {
          options.rename = options.compress && options.mangle;
        }
        if (options.output && options.format) {
          throw new Error("Please only specify either output or format option, preferrably format.");
        }
        options.format = options.format || options.output || {};
        set_shorthand("ecma", options, ["parse", "compress", "format"]);
        set_shorthand("ie8", options, ["compress", "mangle", "format"]);
        set_shorthand("keep_classnames", options, ["compress", "mangle"]);
        set_shorthand("keep_fnames", options, ["compress", "mangle"]);
        set_shorthand("module", options, ["parse", "compress", "mangle"]);
        set_shorthand("safari10", options, ["mangle", "format"]);
        set_shorthand("toplevel", options, ["compress", "mangle"]);
        set_shorthand("warnings", options, ["compress"]);
        var quoted_props;
        if (options.mangle) {
          options.mangle = defaults2(options.mangle, {
            cache: options.nameCache && (options.nameCache.vars || {}),
            eval: false,
            ie8: false,
            keep_classnames: false,
            keep_fnames: false,
            module: false,
            nth_identifier: base54,
            properties: false,
            reserved: [],
            safari10: false,
            toplevel: false
          }, true);
          if (options.mangle.properties) {
            if (typeof options.mangle.properties != "object") {
              options.mangle.properties = {};
            }
            if (options.mangle.properties.keep_quoted) {
              quoted_props = options.mangle.properties.reserved;
              if (!Array.isArray(quoted_props)) quoted_props = [];
              options.mangle.properties.reserved = quoted_props;
            }
            if (options.nameCache && !("cache" in options.mangle.properties)) {
              options.mangle.properties.cache = options.nameCache.props || {};
            }
          }
          init_cache(options.mangle.cache);
          init_cache(options.mangle.properties.cache);
        }
        if (options.sourceMap) {
          options.sourceMap = defaults2(options.sourceMap, {
            asObject: false,
            content: null,
            filename: null,
            includeSources: false,
            root: null,
            url: null
          }, true);
        }
        if (timings) timings.parse = Date.now();
        var toplevel;
        if (files instanceof AST_Toplevel) {
          toplevel = files;
        } else {
          if (typeof files == "string" || options.parse.spidermonkey && !Array.isArray(files)) {
            files = [files];
          }
          options.parse = options.parse || {};
          options.parse.toplevel = null;
          if (options.parse.spidermonkey) {
            options.parse.toplevel = AST_Node.from_mozilla_ast(Object.keys(files).reduce(function(toplevel2, name2) {
              if (!toplevel2) return files[name2];
              toplevel2.body = toplevel2.body.concat(files[name2].body);
              return toplevel2;
            }, null));
          } else {
            delete options.parse.spidermonkey;
            for (var name in files) if (HOP(files, name)) {
              options.parse.filename = name;
              options.parse.toplevel = parse2(files[name], options.parse);
              if (options.sourceMap && options.sourceMap.content == "inline") {
                if (Object.keys(files).length > 1)
                  throw new Error("inline source map only works with singular input");
                options.sourceMap.content = read_source_map(files[name]);
              }
            }
          }
          if (options.parse.toplevel === null) {
            throw new Error("no source file given");
          }
          toplevel = options.parse.toplevel;
        }
        if (quoted_props && options.mangle.properties.keep_quoted !== "strict") {
          reserve_quoted_keys(toplevel, quoted_props);
        }
        var annotated_props;
        if (options.mangle && options.mangle.properties) {
          annotated_props = find_annotated_props(toplevel);
        }
        if (options.wrap) {
          toplevel = toplevel.wrap_commonjs(options.wrap);
        }
        if (options.enclose) {
          toplevel = toplevel.wrap_enclose(options.enclose);
        }
        if (timings) timings.rename = Date.now();
        if (timings) timings.compress = Date.now();
        if (options.compress) {
          toplevel = new Compressor(options.compress, {
            mangle_options: options.mangle
          }).compress(toplevel);
        }
        if (timings) timings.scope = Date.now();
        if (options.mangle) toplevel.figure_out_scope(options.mangle);
        if (timings) timings.mangle = Date.now();
        if (options.mangle) {
          toplevel.compute_char_frequency(options.mangle);
          toplevel.mangle_names(options.mangle);
          toplevel = mangle_private_properties(toplevel, options.mangle);
        }
        if (timings) timings.properties = Date.now();
        if (options.mangle && options.mangle.properties) {
          toplevel = mangle_properties(toplevel, options.mangle.properties, annotated_props);
        }
        if (timings) timings.format = Date.now();
        var result = {};
        if (options.format.ast) {
          result.ast = toplevel;
        }
        if (options.format.spidermonkey) {
          result.ast = toplevel.to_mozilla_ast();
        }
        let format_options;
        if (!HOP(options.format, "code") || options.format.code) {
          format_options = { ...options.format };
          if (!format_options.ast) {
            format_options._destroy_ast = true;
            walk(toplevel, (node) => {
              if (node instanceof AST_Scope) {
                node.variables = void 0;
                node.enclosed = void 0;
                node.parent_scope = void 0;
              }
              if (node.block_scope) {
                node.block_scope.variables = void 0;
                node.block_scope.enclosed = void 0;
                node.block_scope.parent_scope = void 0;
              }
            });
          }
          if (options.sourceMap) {
            if (options.sourceMap.includeSources && files instanceof AST_Toplevel) {
              throw new Error("original source content unavailable");
            }
            format_options.source_map = yield* SourceMap({
              file: options.sourceMap.filename,
              orig: options.sourceMap.content,
              root: options.sourceMap.root,
              files: options.sourceMap.includeSources ? files : null
            });
          }
          delete format_options.ast;
          delete format_options.code;
          delete format_options.spidermonkey;
          var stream = OutputStream(format_options);
          toplevel.print(stream);
          result.code = stream.get();
          if (options.sourceMap) {
            Object.defineProperty(result, "map", {
              configurable: true,
              enumerable: true,
              get() {
                const map2 = format_options.source_map.getEncoded();
                return result.map = options.sourceMap.asObject ? map2 : JSON.stringify(map2);
              },
              set(value2) {
                Object.defineProperty(result, "map", {
                  value: value2,
                  writable: true
                });
              }
            });
            result.decoded_map = format_options.source_map.getDecoded();
            if (options.sourceMap.url == "inline") {
              var sourceMap2 = typeof result.map === "object" ? JSON.stringify(result.map) : result.map;
              result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(sourceMap2);
            } else if (options.sourceMap.url) {
              result.code += "\n//# sourceMappingURL=" + options.sourceMap.url;
            }
          }
        }
        if (options.nameCache && options.mangle) {
          if (options.mangle.cache) options.nameCache.vars = cache_to_json(options.mangle.cache);
          if (options.mangle.properties && options.mangle.properties.cache) {
            options.nameCache.props = cache_to_json(options.mangle.properties.cache);
          }
        }
        if (format_options && format_options.source_map) {
          format_options.source_map.destroy();
        }
        if (timings) {
          timings.end = Date.now();
          result.timings = {
            parse: 1e-3 * (timings.rename - timings.parse),
            rename: 1e-3 * (timings.compress - timings.rename),
            compress: 1e-3 * (timings.scope - timings.compress),
            scope: 1e-3 * (timings.mangle - timings.scope),
            mangle: 1e-3 * (timings.properties - timings.mangle),
            properties: 1e-3 * (timings.format - timings.properties),
            format: 1e-3 * (timings.end - timings.format),
            total: 1e-3 * (timings.end - timings.start)
          };
        }
        return result;
      }
      async function minify(files, options, _fs_module) {
        const gen = minify_sync_or_async(files, options, _fs_module);
        let yielded;
        let val;
        do {
          val = gen.next(await yielded);
          yielded = val.value;
        } while (!val.done);
        return val.value;
      }
      function minify_sync(files, options, _fs_module) {
        const gen = minify_sync_or_async(files, options, _fs_module);
        let yielded;
        let val;
        do {
          if (yielded && typeof yielded.then === "function") {
            throw new Error("minify_sync cannot be used with the legacy source-map module");
          }
          val = gen.next(yielded);
          yielded = val.value;
        } while (!val.done);
        return val.value;
      }
      async function run_cli({ program, packageJson, fs: fs7, path: path8 }) {
        const skip_keys = /* @__PURE__ */ new Set(["cname", "parent_scope", "scope", "uses_eval", "uses_with"]);
        var files = {};
        var options = {
          compress: false,
          mangle: false
        };
        const default_options = await _default_options();
        program.version(packageJson.name + " " + packageJson.version);
        program.parseArgv = program.parse;
        program.parse = void 0;
        if (process.argv.includes("ast")) program.helpInformation = describe_ast;
        else if (process.argv.includes("options")) program.helpInformation = function() {
          var text3 = [];
          for (var option in default_options) {
            text3.push("--" + (option === "sourceMap" ? "source-map" : option) + " options:");
            text3.push(format_object(default_options[option]));
            text3.push("");
          }
          return text3.join("\n");
        };
        program.option("-p, --parse <options>", "Specify parser options.", parse_js());
        program.option("-c, --compress [options]", "Enable compressor/specify compressor options.", parse_js());
        program.option("-m, --mangle [options]", "Mangle names/specify mangler options.", parse_js());
        program.option("--mangle-props [options]", "Mangle properties/specify mangler options.", parse_js());
        program.option("-f, --format [options]", "Format options.", parse_js());
        program.option("-b, --beautify [options]", "Alias for --format.", parse_js());
        program.option("-o, --output <file>", "Output file (default STDOUT).");
        program.option("--comments [filter]", "Preserve copyright comments in the output.");
        program.option("--config-file <file>", "Read minify() options from JSON file.");
        program.option("-d, --define <expr>[=value]", "Global definitions.", parse_js("define"));
        program.option("--ecma <version>", "Specify ECMAScript release: 5, 2015, 2016 or 2017...");
        program.option("-e, --enclose [arg[,...][:value[,...]]]", "Embed output in a big function with configurable arguments and values.");
        program.option("--ie8", "Support non-standard Internet Explorer 8.");
        program.option("--keep-classnames", "Do not mangle/drop class names.");
        program.option("--keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.");
        program.option("--module", "Input is an ES6 module");
        program.option("--name-cache <file>", "File to hold mangled name mappings.");
        program.option("--rename", "Force symbol expansion.");
        program.option("--no-rename", "Disable symbol expansion.");
        program.option("--safari10", "Support non-standard Safari 10.");
        program.option("--source-map [options]", "Enable source map/specify source map options.", parse_js());
        program.option("--timings", "Display operations run time on STDERR.");
        program.option("--toplevel", "Compress and/or mangle variables in toplevel scope.");
        program.option("--wrap <name>", "Embed everything as a function with \u201Cexports\u201D corresponding to \u201Cname\u201D globally.");
        program.arguments("[files...]").parseArgv(process.argv);
        if (program.configFile) {
          options = JSON.parse(read_file(program.configFile));
        }
        if (!program.output && program.sourceMap && program.sourceMap.url != "inline") {
          fatal("ERROR: cannot write source map to STDOUT");
        }
        [
          "compress",
          "enclose",
          "ie8",
          "mangle",
          "module",
          "safari10",
          "sourceMap",
          "toplevel",
          "wrap"
        ].forEach(function(name) {
          if (name in program) {
            options[name] = program[name];
          }
        });
        if ("ecma" in program) {
          if (program.ecma != (program.ecma | 0)) fatal("ERROR: ecma must be an integer");
          const ecma = program.ecma | 0;
          if (ecma > 5 && ecma < 2015)
            options.ecma = ecma + 2009;
          else
            options.ecma = ecma;
        }
        if (program.format || program.beautify) {
          const chosenOption = program.format || program.beautify;
          options.format = typeof chosenOption === "object" ? chosenOption : {};
        }
        if (program.comments) {
          if (typeof options.format != "object") options.format = {};
          options.format.comments = typeof program.comments == "string" ? program.comments == "false" ? false : program.comments : "some";
        }
        if (program.define) {
          if (typeof options.compress != "object") options.compress = {};
          if (typeof options.compress.global_defs != "object") options.compress.global_defs = {};
          for (var expr in program.define) {
            options.compress.global_defs[expr] = program.define[expr];
          }
        }
        if (program.keepClassnames) {
          options.keep_classnames = true;
        }
        if (program.keepFnames) {
          options.keep_fnames = true;
        }
        if (program.mangleProps) {
          if (program.mangleProps.domprops) {
            delete program.mangleProps.domprops;
          } else {
            if (typeof program.mangleProps != "object") program.mangleProps = {};
            if (!Array.isArray(program.mangleProps.reserved)) program.mangleProps.reserved = [];
          }
          if (typeof options.mangle != "object") options.mangle = {};
          options.mangle.properties = program.mangleProps;
        }
        if (program.nameCache) {
          options.nameCache = JSON.parse(read_file(program.nameCache, "{}"));
        }
        if (program.output == "ast") {
          options.format = {
            ast: true,
            code: false
          };
        }
        if (program.parse) {
          if (!program.parse.acorn && !program.parse.spidermonkey) {
            options.parse = program.parse;
          } else if (program.sourceMap && program.sourceMap.content == "inline") {
            fatal("ERROR: inline source map only works with built-in parser");
          }
        }
        if (~program.rawArgs.indexOf("--rename")) {
          options.rename = true;
        } else if (!program.rename) {
          options.rename = false;
        }
        let convert_path = (name) => name;
        if (typeof program.sourceMap == "object" && "base" in program.sourceMap) {
          convert_path = function() {
            var base2 = program.sourceMap.base;
            delete options.sourceMap.base;
            return function(name) {
              return path8.relative(base2, name);
            };
          }();
        }
        let filesList;
        if (options.files && options.files.length) {
          filesList = options.files;
          delete options.files;
        } else if (program.args.length) {
          filesList = program.args;
        }
        if (filesList) {
          simple_glob(filesList).forEach(function(name) {
            files[convert_path(name)] = read_file(name);
          });
        } else {
          await new Promise((resolve) => {
            var chunks = [];
            process.stdin.setEncoding("utf8");
            process.stdin.on("data", function(chunk) {
              chunks.push(chunk);
            }).on("end", function() {
              files = [chunks.join("")];
              resolve();
            });
            process.stdin.resume();
          });
        }
        await run_cli2();
        function convert_ast(fn) {
          return AST_Node.from_mozilla_ast(Object.keys(files).reduce(fn, null));
        }
        async function run_cli2() {
          var content = program.sourceMap && program.sourceMap.content;
          if (content && content !== "inline") {
            options.sourceMap.content = read_file(content, content);
          }
          if (program.timings) options.timings = true;
          try {
            if (program.parse) {
              if (program.parse.acorn) {
                files = convert_ast(function(toplevel, name) {
                  return require_acorn().parse(files[name], {
                    ecmaVersion: 2024,
                    locations: true,
                    program: toplevel,
                    sourceFile: name,
                    sourceType: options.module || program.parse.module ? "module" : "script"
                  });
                });
              } else if (program.parse.spidermonkey) {
                files = convert_ast(function(toplevel, name) {
                  var obj = JSON.parse(files[name]);
                  if (!toplevel) return obj;
                  toplevel.body = toplevel.body.concat(obj.body);
                  return toplevel;
                });
              }
            }
          } catch (ex) {
            fatal(ex);
          }
          let result;
          try {
            result = await minify(files, options, fs7);
          } catch (ex) {
            if (ex.name == "SyntaxError") {
              print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col);
              var col = ex.col;
              var lines = files[ex.filename].split(/\r?\n/);
              var line = lines[ex.line - 1];
              if (!line && !col) {
                line = lines[ex.line - 2];
                col = line.length;
              }
              if (line) {
                var limit = 70;
                if (col > limit) {
                  line = line.slice(col - limit);
                  col = limit;
                }
                print_error(line.slice(0, 80));
                print_error(line.slice(0, col).replace(/\S/g, " ") + "^");
              }
            }
            if (ex.defs) {
              print_error("Supported options:");
              print_error(format_object(ex.defs));
            }
            fatal(ex);
            return;
          }
          if (program.output == "ast") {
            if (!options.compress && !options.mangle) {
              result.ast.figure_out_scope({});
            }
            console.log(JSON.stringify(result.ast, function(key4, value2) {
              if (value2) switch (key4) {
                case "thedef":
                  return symdef(value2);
                case "enclosed":
                  return value2.length ? value2.map(symdef) : void 0;
                case "variables":
                case "globals":
                  return value2.size ? collect_from_map(value2, symdef) : void 0;
              }
              if (skip_keys.has(key4)) return;
              if (value2 instanceof AST_Token) return;
              if (value2 instanceof Map) return;
              if (value2 instanceof AST_Node) {
                var result2 = {
                  _class: "AST_" + value2.TYPE
                };
                if (value2.block_scope) {
                  result2.variables = value2.block_scope.variables;
                  result2.enclosed = value2.block_scope.enclosed;
                }
                value2.CTOR.PROPS.forEach(function(prop2) {
                  if (prop2 !== "block_scope") {
                    result2[prop2] = value2[prop2];
                  }
                });
                return result2;
              }
              return value2;
            }, 2));
          } else if (program.output == "spidermonkey") {
            try {
              const minified = await minify(
                result.code,
                {
                  compress: false,
                  mangle: false,
                  format: {
                    ast: true,
                    code: false
                  }
                },
                fs7
              );
              console.log(JSON.stringify(minified.ast.to_mozilla_ast(), null, 2));
            } catch (ex) {
              fatal(ex);
              return;
            }
          } else if (program.output) {
            fs7.mkdirSync(path8.dirname(program.output), { recursive: true });
            fs7.writeFileSync(program.output, result.code);
            if (options.sourceMap && options.sourceMap.url !== "inline" && result.map) {
              fs7.writeFileSync(program.output + ".map", result.map);
            }
          } else {
            console.log(result.code);
          }
          if (program.nameCache) {
            fs7.writeFileSync(program.nameCache, JSON.stringify(options.nameCache));
          }
          if (result.timings) for (var phase in result.timings) {
            print_error("- " + phase + ": " + result.timings[phase].toFixed(3) + "s");
          }
        }
        function fatal(message) {
          if (message instanceof Error) message = message.stack.replace(/^\S*?Error:/, "ERROR:");
          print_error(message);
          process.exit(1);
        }
        function simple_glob(glob) {
          if (Array.isArray(glob)) {
            return [].concat.apply([], glob.map(simple_glob));
          }
          if (glob && glob.match(/[*?]/)) {
            var dir = path8.dirname(glob);
            try {
              var entries = fs7.readdirSync(dir);
            } catch (ex) {
            }
            if (entries) {
              var pattern = "^" + path8.basename(glob).replace(/[.+^$[\]\\(){}]/g, "\\$&").replace(/\*/g, "[^/\\\\]*").replace(/\?/g, "[^/\\\\]") + "$";
              var mod = process.platform === "win32" ? "i" : "";
              var rx = new RegExp(pattern, mod);
              var results = entries.filter(function(name) {
                return rx.test(name);
              }).map(function(name) {
                return path8.join(dir, name);
              });
              if (results.length) return results;
            }
          }
          return [glob];
        }
        function read_file(path9, default_value) {
          try {
            return fs7.readFileSync(path9, "utf8");
          } catch (ex) {
            if ((ex.code == "ENOENT" || ex.code == "ENAMETOOLONG") && default_value != null) return default_value;
            fatal(ex);
          }
        }
        function parse_js(flag) {
          return function(value2, options2) {
            options2 = options2 || {};
            try {
              walk(parse2(value2, { expression: true }), (node) => {
                if (node instanceof AST_Assign) {
                  var name = node.left.print_to_string();
                  var value3 = node.right;
                  if (flag) {
                    options2[name] = value3;
                  } else if (value3 instanceof AST_Array) {
                    options2[name] = value3.elements.map(to_string);
                  } else if (value3 instanceof AST_RegExp) {
                    value3 = value3.value;
                    options2[name] = new RegExp(value3.source, value3.flags);
                  } else {
                    options2[name] = to_string(value3);
                  }
                  return true;
                }
                if (node instanceof AST_Symbol || node instanceof AST_PropAccess) {
                  var name = node.print_to_string();
                  options2[name] = true;
                  return true;
                }
                if (!(node instanceof AST_Sequence)) throw node;
                function to_string(value4) {
                  return value4 instanceof AST_Constant ? value4.getValue() : value4.print_to_string({
                    quote_keys: true
                  });
                }
              });
            } catch (ex) {
              if (flag) {
                fatal("Error parsing arguments for '" + flag + "': " + value2);
              } else {
                options2[value2] = null;
              }
            }
            return options2;
          };
        }
        function symdef(def) {
          var ret = 1e6 + def.id + " " + def.name;
          if (def.mangled_name) ret += " " + def.mangled_name;
          return ret;
        }
        function collect_from_map(map2, callback) {
          var result = [];
          map2.forEach(function(def) {
            result.push(callback(def));
          });
          return result;
        }
        function format_object(obj) {
          var lines = [];
          var padding = "";
          Object.keys(obj).map(function(name) {
            if (padding.length < name.length) padding = Array(name.length + 1).join(" ");
            return [name, JSON.stringify(obj[name])];
          }).forEach(function(tokens) {
            lines.push("  " + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]);
          });
          return lines.join("\n");
        }
        function print_error(msg) {
          process.stderr.write(msg);
          process.stderr.write("\n");
        }
        function describe_ast() {
          var out = OutputStream({ beautify: true });
          function doitem(ctor) {
            out.print("AST_" + ctor.TYPE);
            const props = ctor.SELF_PROPS.filter((prop2) => !/^\$/.test(prop2));
            if (props.length > 0) {
              out.space();
              out.with_parens(function() {
                props.forEach(function(prop2, i) {
                  if (i) out.space();
                  out.print(prop2);
                });
              });
            }
            if (ctor.documentation) {
              out.space();
              out.print_string(ctor.documentation);
            }
            if (ctor.SUBCLASSES.length > 0) {
              out.space();
              out.with_block(function() {
                ctor.SUBCLASSES.forEach(function(ctor2) {
                  out.indent();
                  doitem(ctor2);
                  out.newline();
                });
              });
            }
          }
          doitem(AST_Node);
          return out + "\n";
        }
      }
      async function _default_options() {
        const defs = {};
        Object.keys(infer_options({ 0: 0 })).forEach((component2) => {
          const options = infer_options({
            [component2]: { 0: 0 }
          });
          if (options) defs[component2] = options;
        });
        return defs;
      }
      async function infer_options(options) {
        try {
          await minify("", options);
        } catch (error2) {
          return error2.defs;
        }
      }
      exports3._default_options = _default_options;
      exports3._run_cli = run_cli;
      exports3.minify = minify;
      exports3.minify_sync = minify_sync;
    });
  }
});

// node_modules/workerpool/dist/workerpool.js
var require_workerpool = __commonJS({
  "node_modules/workerpool/dist/workerpool.js"(exports2, module2) {
    (function(global2, factory) {
      typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.workerpool = {}));
    })(exports2, function(exports3) {
      "use strict";
      var src = {};
      var environment$1 = { exports: {} };
      (function(module3) {
        var isNode = function isNode2(nodeProcess) {
          return typeof nodeProcess !== "undefined" && nodeProcess.versions != null && nodeProcess.versions.node != null && nodeProcess + "" === "[object process]";
        };
        module3.exports.isNode = isNode;
        module3.exports.platform = typeof process !== "undefined" && isNode(process) ? "node" : "browser";
        var worker_threads = module3.exports.platform === "node" && require("worker_threads");
        module3.exports.isMainThread = module3.exports.platform === "node" ? (!worker_threads || worker_threads.isMainThread) && !process.connected : typeof Window !== "undefined";
        module3.exports.cpus = module3.exports.platform === "browser" ? self.navigator.hardwareConcurrency : require("os").cpus().length;
      })(environment$1);
      var environmentExports = environment$1.exports;
      function _arrayLikeToArray(r, a) {
        (null == a || a > r.length) && (a = r.length);
        for (var e2 = 0, n3 = Array(a); e2 < a; e2++) n3[e2] = r[e2];
        return n3;
      }
      function _assertThisInitialized(e2) {
        if (void 0 === e2) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return e2;
      }
      function _callSuper(t2, o, e2) {
        return o = _getPrototypeOf(o), _possibleConstructorReturn(t2, _isNativeReflectConstruct() ? Reflect.construct(o, e2 || [], _getPrototypeOf(t2).constructor) : o.apply(t2, e2));
      }
      function _classCallCheck(a, n3) {
        if (!(a instanceof n3)) throw new TypeError("Cannot call a class as a function");
      }
      function _construct(t2, e2, r) {
        if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
        var o = [null];
        o.push.apply(o, e2);
        var p = new (t2.bind.apply(t2, o))();
        return r && _setPrototypeOf(p, r.prototype), p;
      }
      function _createClass(e2, r, t2) {
        return Object.defineProperty(e2, "prototype", {
          writable: false
        }), e2;
      }
      function _createForOfIteratorHelper(r, e2) {
        var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
        if (!t2) {
          if (Array.isArray(r) || (t2 = _unsupportedIterableToArray(r)) || e2) {
            t2 && (r = t2);
            var n3 = 0, F = function() {
            };
            return {
              s: F,
              n: function() {
                return n3 >= r.length ? {
                  done: true
                } : {
                  done: false,
                  value: r[n3++]
                };
              },
              e: function(r3) {
                throw r3;
              },
              f: F
            };
          }
          throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }
        var o, a = true, u = false;
        return {
          s: function() {
            t2 = t2.call(r);
          },
          n: function() {
            var r3 = t2.next();
            return a = r3.done, r3;
          },
          e: function(r3) {
            u = true, o = r3;
          },
          f: function() {
            try {
              a || null == t2.return || t2.return();
            } finally {
              if (u) throw o;
            }
          }
        };
      }
      function _defineProperty(e2, r, t2) {
        return (r = _toPropertyKey(r)) in e2 ? Object.defineProperty(e2, r, {
          value: t2,
          enumerable: true,
          configurable: true,
          writable: true
        }) : e2[r] = t2, e2;
      }
      function _getPrototypeOf(t2) {
        return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
          return t3.__proto__ || Object.getPrototypeOf(t3);
        }, _getPrototypeOf(t2);
      }
      function _inherits(t2, e2) {
        if ("function" != typeof e2 && null !== e2) throw new TypeError("Super expression must either be null or a function");
        t2.prototype = Object.create(e2 && e2.prototype, {
          constructor: {
            value: t2,
            writable: true,
            configurable: true
          }
        }), Object.defineProperty(t2, "prototype", {
          writable: false
        }), e2 && _setPrototypeOf(t2, e2);
      }
      function _isNativeFunction(t2) {
        try {
          return -1 !== Function.toString.call(t2).indexOf("[native code]");
        } catch (n3) {
          return "function" == typeof t2;
        }
      }
      function _isNativeReflectConstruct() {
        try {
          var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
          }));
        } catch (t3) {
        }
        return (_isNativeReflectConstruct = function() {
          return !!t2;
        })();
      }
      function ownKeys(e2, r) {
        var t2 = Object.keys(e2);
        if (Object.getOwnPropertySymbols) {
          var o = Object.getOwnPropertySymbols(e2);
          r && (o = o.filter(function(r3) {
            return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
          })), t2.push.apply(t2, o);
        }
        return t2;
      }
      function _objectSpread2(e2) {
        for (var r = 1; r < arguments.length; r++) {
          var t2 = null != arguments[r] ? arguments[r] : {};
          r % 2 ? ownKeys(Object(t2), true).forEach(function(r3) {
            _defineProperty(e2, r3, t2[r3]);
          }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) {
            Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
          });
        }
        return e2;
      }
      function _possibleConstructorReturn(t2, e2) {
        if (e2 && ("object" == typeof e2 || "function" == typeof e2)) return e2;
        if (void 0 !== e2) throw new TypeError("Derived constructors may only return object or undefined");
        return _assertThisInitialized(t2);
      }
      function _setPrototypeOf(t2, e2) {
        return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
          return t3.__proto__ = e3, t3;
        }, _setPrototypeOf(t2, e2);
      }
      function _toPrimitive(t2, r) {
        if ("object" != typeof t2 || !t2) return t2;
        var e2 = t2[Symbol.toPrimitive];
        if (void 0 !== e2) {
          var i = e2.call(t2, r);
          if ("object" != typeof i) return i;
          throw new TypeError("@@toPrimitive must return a primitive value.");
        }
        return ("string" === r ? String : Number)(t2);
      }
      function _toPropertyKey(t2) {
        var i = _toPrimitive(t2, "string");
        return "symbol" == typeof i ? i : i + "";
      }
      function _typeof(o) {
        "@babel/helpers - typeof";
        return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
          return typeof o2;
        } : function(o2) {
          return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
        }, _typeof(o);
      }
      function _unsupportedIterableToArray(r, a) {
        if (r) {
          if ("string" == typeof r) return _arrayLikeToArray(r, a);
          var t2 = {}.toString.call(r).slice(8, -1);
          return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r, a) : void 0;
        }
      }
      function _wrapNativeSuper(t2) {
        var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
        return _wrapNativeSuper = function(t3) {
          if (null === t3 || !_isNativeFunction(t3)) return t3;
          if ("function" != typeof t3) throw new TypeError("Super expression must either be null or a function");
          if (void 0 !== r) {
            if (r.has(t3)) return r.get(t3);
            r.set(t3, Wrapper);
          }
          function Wrapper() {
            return _construct(t3, arguments, _getPrototypeOf(this).constructor);
          }
          return Wrapper.prototype = Object.create(t3.prototype, {
            constructor: {
              value: Wrapper,
              enumerable: false,
              writable: true,
              configurable: true
            }
          }), _setPrototypeOf(Wrapper, t3);
        }, _wrapNativeSuper(t2);
      }
      var WorkerHandler$1 = { exports: {} };
      var _Promise$1 = {};
      var hasRequired_Promise;
      function require_Promise() {
        if (hasRequired_Promise) return _Promise$1;
        hasRequired_Promise = 1;
        function Promise2(handler, parent) {
          var me = this;
          if (!(this instanceof Promise2)) {
            throw new SyntaxError("Constructor must be called with the new operator");
          }
          if (typeof handler !== "function") {
            throw new SyntaxError("Function parameter handler(resolve, reject) missing");
          }
          var _onSuccess = [];
          var _onFail = [];
          this.resolved = false;
          this.rejected = false;
          this.pending = true;
          this[Symbol.toStringTag] = "Promise";
          var _process = function _process2(onSuccess, onFail) {
            _onSuccess.push(onSuccess);
            _onFail.push(onFail);
          };
          this.then = function(onSuccess, onFail) {
            return new Promise2(function(resolve, reject) {
              var s = onSuccess ? _then(onSuccess, resolve, reject) : resolve;
              var f3 = onFail ? _then(onFail, resolve, reject) : reject;
              _process(s, f3);
            }, me);
          };
          var _resolve2 = function _resolve(result) {
            me.resolved = true;
            me.rejected = false;
            me.pending = false;
            _onSuccess.forEach(function(fn) {
              fn(result);
            });
            _process = function _process2(onSuccess, onFail) {
              onSuccess(result);
            };
            _resolve2 = _reject2 = function _reject() {
            };
            return me;
          };
          var _reject2 = function _reject(error2) {
            me.resolved = false;
            me.rejected = true;
            me.pending = false;
            _onFail.forEach(function(fn) {
              fn(error2);
            });
            _process = function _process2(onSuccess, onFail) {
              onFail(error2);
            };
            _resolve2 = _reject2 = function _reject3() {
            };
            return me;
          };
          this.cancel = function() {
            if (parent) {
              parent.cancel();
            } else {
              _reject2(new CancellationError());
            }
            return me;
          };
          this.timeout = function(delay2) {
            if (parent) {
              parent.timeout(delay2);
            } else {
              var timer = setTimeout(function() {
                _reject2(new TimeoutError("Promise timed out after " + delay2 + " ms"));
              }, delay2);
              me.always(function() {
                clearTimeout(timer);
              });
            }
            return me;
          };
          handler(function(result) {
            _resolve2(result);
          }, function(error2) {
            _reject2(error2);
          });
        }
        function _then(callback, resolve, reject) {
          return function(result) {
            try {
              var res2 = callback(result);
              if (res2 && typeof res2.then === "function" && typeof res2["catch"] === "function") {
                res2.then(resolve, reject);
              } else {
                resolve(res2);
              }
            } catch (error2) {
              reject(error2);
            }
          };
        }
        Promise2.prototype["catch"] = function(onFail) {
          return this.then(null, onFail);
        };
        Promise2.prototype.always = function(fn) {
          return this.then(fn, fn);
        };
        Promise2.prototype.finally = function(fn) {
          var me = this;
          var final = function final2() {
            return new Promise2(function(resolve) {
              return resolve();
            }).then(fn).then(function() {
              return me;
            });
          };
          return this.then(final, final);
        };
        Promise2.all = function(promises6) {
          return new Promise2(function(resolve, reject) {
            var remaining = promises6.length, results = [];
            if (remaining) {
              promises6.forEach(function(p, i) {
                p.then(function(result) {
                  results[i] = result;
                  remaining--;
                  if (remaining == 0) {
                    resolve(results);
                  }
                }, function(error2) {
                  remaining = 0;
                  reject(error2);
                });
              });
            } else {
              resolve(results);
            }
          });
        };
        Promise2.defer = function() {
          var resolver = {};
          resolver.promise = new Promise2(function(resolve, reject) {
            resolver.resolve = resolve;
            resolver.reject = reject;
          });
          return resolver;
        };
        function CancellationError(message) {
          this.message = message || "promise cancelled";
          this.stack = new Error().stack;
        }
        CancellationError.prototype = new Error();
        CancellationError.prototype.constructor = Error;
        CancellationError.prototype.name = "CancellationError";
        Promise2.CancellationError = CancellationError;
        function TimeoutError(message) {
          this.message = message || "timeout exceeded";
          this.stack = new Error().stack;
        }
        TimeoutError.prototype = new Error();
        TimeoutError.prototype.constructor = Error;
        TimeoutError.prototype.name = "TimeoutError";
        Promise2.TimeoutError = TimeoutError;
        _Promise$1.Promise = Promise2;
        return _Promise$1;
      }
      var validateOptions$1 = {};
      validateOptions$1.validateOptions = function validateOptions2(options, allowedOptionNames, objectName) {
        if (!options) {
          return;
        }
        var optionNames = options ? Object.keys(options) : [];
        var unknownOptionName = optionNames.find(function(optionName) {
          return !allowedOptionNames.includes(optionName);
        });
        if (unknownOptionName) {
          throw new Error('Object "' + objectName + '" contains an unknown option "' + unknownOptionName + '"');
        }
        var illegalOptionName = allowedOptionNames.find(function(allowedOptionName) {
          return Object.prototype[allowedOptionName] && !optionNames.includes(allowedOptionName);
        });
        if (illegalOptionName) {
          throw new Error('Object "' + objectName + '" contains an inherited option "' + illegalOptionName + '" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value "undefined".');
        }
        return options;
      };
      validateOptions$1.workerOptsNames = ["credentials", "name", "type"];
      validateOptions$1.forkOptsNames = ["cwd", "detached", "env", "execPath", "execArgv", "gid", "serialization", "signal", "killSignal", "silent", "stdio", "uid", "windowsVerbatimArguments", "timeout"];
      validateOptions$1.workerThreadOptsNames = ["argv", "env", "eval", "execArgv", "stdin", "stdout", "stderr", "workerData", "trackUnmanagedFds", "transferList", "resourceLimits", "name"];
      var embeddedWorker;
      var hasRequiredEmbeddedWorker;
      function requireEmbeddedWorker() {
        if (hasRequiredEmbeddedWorker) return embeddedWorker;
        hasRequiredEmbeddedWorker = 1;
        embeddedWorker = `!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).worker=n()}(this,(function(){"use strict";function e(n){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]="Promise";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i((function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)}),t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach((function(n){n(e)})),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach((function(n){n(e)})),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout((function(){d(new c("Promise timed out after "+e+" ms"))}),e);t.always((function(){clearTimeout(r)}))}return t},e((function(e){f(e)}),(function(e){d(e)}))}function s(e,n,t){return function(r){try{var o=e(r);o&&"function"==typeof o.then&&"function"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function c(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i((function(e){return e()})).then(e).then((function(){return n}))};return this.then(t,t)},i.all=function(e){return new i((function(n,t){var r=e.length,o=[];r?e.forEach((function(e,i){e.then((function(e){o[i]=e,0==--r&&n(o)}),(function(e){r=0,t(e)}))})):n(o)}))},i.defer=function(){var e={};return e.promise=new i((function(n,t){e.resolve=n,e.reject=t})),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name="CancellationError",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name="TimeoutError",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s="__workerpool-cleanup__",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)u.on=function(e,n){addEventListener(e,(function(e){n(e.data)}))},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");var a;try{a=require("worker_threads")}catch(n){if("object"!==e(n)||null===n||"MODULE_NOT_FOUND"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on("disconnect",(function(){process.exit(1)})),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function("return ("+e+").apply(this, arguments);");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i((function(e,n){n(new Error("Worker terminating"))})))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error("Worker terminating"))}),new i((function(e){e()}));var n,t=u.abortListeners.map((function(e){return e()})),r=new i((function(e,t){n=setTimeout((function(){t(new Error("Timeout occured waiting for abort handler, killing worker"))}),u.abortListenerTimeout)})),o=i.all(t).then((function(){clearTimeout(n),u.abortListeners.length||(u.abortListeners=[])}),(function(){clearTimeout(n),u.exit()}));return new i((function(e,n){o.then(e,n),r.then(e,n)})).then((function(){u.send({id:e,method:s,error:null})}),(function(n){u.send({id:e,method:s,error:n?d(n):null})}))};var p=null;u.on("message",(function(e){if("__workerpool-terminate__"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method "'+e.method+'"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then((function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null})).catch((function(n){u.send({id:e.id,result:null,error:d(n)}),p=null})):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}})),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send("ready")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)}));
//# sourceMappingURL=worker.min.js.map
`;
        return embeddedWorker;
      }
      var _require$$$1 = require_Promise(), Promise$2 = _require$$$1.Promise;
      var environment = environmentExports;
      var validateOptions = validateOptions$1.validateOptions, forkOptsNames = validateOptions$1.forkOptsNames, workerThreadOptsNames = validateOptions$1.workerThreadOptsNames, workerOptsNames = validateOptions$1.workerOptsNames;
      var TERMINATE_METHOD_ID = "__workerpool-terminate__";
      var CLEANUP_METHOD_ID = "__workerpool-cleanup__";
      function ensureWorkerThreads() {
        var WorkerThreads = tryRequireWorkerThreads();
        if (!WorkerThreads) {
          throw new Error("WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required");
        }
        return WorkerThreads;
      }
      function ensureWebWorker() {
        if (typeof Worker !== "function" && ((typeof Worker === "undefined" ? "undefined" : _typeof(Worker)) !== "object" || typeof Worker.prototype.constructor !== "function")) {
          throw new Error("WorkerPool: Web Workers not supported");
        }
      }
      function tryRequireWorkerThreads() {
        try {
          return require("worker_threads");
        } catch (error2) {
          if (_typeof(error2) === "object" && error2 !== null && error2.code === "MODULE_NOT_FOUND") {
            return null;
          } else {
            throw error2;
          }
        }
      }
      function getDefaultWorker() {
        if (environment.platform === "browser") {
          if (typeof Blob === "undefined") {
            throw new Error("Blob not supported by the browser");
          }
          if (!window.URL || typeof window.URL.createObjectURL !== "function") {
            throw new Error("URL.createObjectURL not supported by the browser");
          }
          var blob = new Blob([requireEmbeddedWorker()], {
            type: "text/javascript"
          });
          return window.URL.createObjectURL(blob);
        } else {
          return __dirname + "/worker.js";
        }
      }
      function setupWorker(script, options) {
        if (options.workerType === "web") {
          ensureWebWorker();
          return setupBrowserWorker(script, options.workerOpts, Worker);
        } else if (options.workerType === "thread") {
          WorkerThreads = ensureWorkerThreads();
          return setupWorkerThreadWorker(script, WorkerThreads, options);
        } else if (options.workerType === "process" || !options.workerType) {
          return setupProcessWorker(script, resolveForkOptions(options), require("child_process"));
        } else {
          if (environment.platform === "browser") {
            ensureWebWorker();
            return setupBrowserWorker(script, options.workerOpts, Worker);
          } else {
            var WorkerThreads = tryRequireWorkerThreads();
            if (WorkerThreads) {
              return setupWorkerThreadWorker(script, WorkerThreads, options);
            } else {
              return setupProcessWorker(script, resolveForkOptions(options), require("child_process"));
            }
          }
        }
      }
      function setupBrowserWorker(script, workerOpts, Worker3) {
        validateOptions(workerOpts, workerOptsNames, "workerOpts");
        var worker2 = new Worker3(script, workerOpts);
        worker2.isBrowserWorker = true;
        worker2.on = function(event2, callback) {
          this.addEventListener(event2, function(message) {
            callback(message.data);
          });
        };
        worker2.send = function(message, transfer2) {
          this.postMessage(message, transfer2);
        };
        return worker2;
      }
      function setupWorkerThreadWorker(script, WorkerThreads, options) {
        var _options$emitStdStrea, _options$emitStdStrea2;
        validateOptions(options === null || options === void 0 ? void 0 : options.workerThreadOpts, workerThreadOptsNames, "workerThreadOpts");
        var worker2 = new WorkerThreads.Worker(script, _objectSpread2({
          stdout: (_options$emitStdStrea = options === null || options === void 0 ? void 0 : options.emitStdStreams) !== null && _options$emitStdStrea !== void 0 ? _options$emitStdStrea : false,
          // pipe worker.STDOUT to process.STDOUT if not requested
          stderr: (_options$emitStdStrea2 = options === null || options === void 0 ? void 0 : options.emitStdStreams) !== null && _options$emitStdStrea2 !== void 0 ? _options$emitStdStrea2 : false
        }, options === null || options === void 0 ? void 0 : options.workerThreadOpts));
        worker2.isWorkerThread = true;
        worker2.send = function(message, transfer2) {
          this.postMessage(message, transfer2);
        };
        worker2.kill = function() {
          this.terminate();
          return true;
        };
        worker2.disconnect = function() {
          this.terminate();
        };
        if (options !== null && options !== void 0 && options.emitStdStreams) {
          worker2.stdout.on("data", function(data) {
            return worker2.emit("stdout", data);
          });
          worker2.stderr.on("data", function(data) {
            return worker2.emit("stderr", data);
          });
        }
        return worker2;
      }
      function setupProcessWorker(script, options, child_process) {
        validateOptions(options.forkOpts, forkOptsNames, "forkOpts");
        var worker2 = child_process.fork(script, options.forkArgs, options.forkOpts);
        var send = worker2.send;
        worker2.send = function(message) {
          return send.call(worker2, message);
        };
        if (options.emitStdStreams) {
          worker2.stdout.on("data", function(data) {
            return worker2.emit("stdout", data);
          });
          worker2.stderr.on("data", function(data) {
            return worker2.emit("stderr", data);
          });
        }
        worker2.isChildProcess = true;
        return worker2;
      }
      function resolveForkOptions(opts) {
        opts = opts || {};
        var processExecArgv = process.execArgv.join(" ");
        var inspectorActive = processExecArgv.indexOf("--inspect") !== -1;
        var debugBrk = processExecArgv.indexOf("--debug-brk") !== -1;
        var execArgv = [];
        if (inspectorActive) {
          execArgv.push("--inspect=" + opts.debugPort);
          if (debugBrk) {
            execArgv.push("--debug-brk");
          }
        }
        process.execArgv.forEach(function(arg) {
          if (arg.indexOf("--max-old-space-size") > -1) {
            execArgv.push(arg);
          }
        });
        return Object.assign({}, opts, {
          forkArgs: opts.forkArgs,
          forkOpts: Object.assign({}, opts.forkOpts, {
            execArgv: (opts.forkOpts && opts.forkOpts.execArgv || []).concat(execArgv),
            stdio: opts.emitStdStreams ? "pipe" : void 0
          })
        });
      }
      function objectToError(obj) {
        var temp = new Error("");
        var props = Object.keys(obj);
        for (var i = 0; i < props.length; i++) {
          temp[props[i]] = obj[props[i]];
        }
        return temp;
      }
      function handleEmittedStdPayload(handler, payload) {
        Object.values(handler.processing).forEach(function(task) {
          var _task$options;
          return task === null || task === void 0 || (_task$options = task.options) === null || _task$options === void 0 ? void 0 : _task$options.on(payload);
        });
        Object.values(handler.tracking).forEach(function(task) {
          var _task$options2;
          return task === null || task === void 0 || (_task$options2 = task.options) === null || _task$options2 === void 0 ? void 0 : _task$options2.on(payload);
        });
      }
      function WorkerHandler(script, _options2) {
        var me = this;
        var options = _options2 || {};
        this.script = script || getDefaultWorker();
        this.worker = setupWorker(this.script, options);
        this.debugPort = options.debugPort;
        this.forkOpts = options.forkOpts;
        this.forkArgs = options.forkArgs;
        this.workerOpts = options.workerOpts;
        this.workerThreadOpts = options.workerThreadOpts;
        this.workerTerminateTimeout = options.workerTerminateTimeout;
        if (!script) {
          this.worker.ready = true;
        }
        this.requestQueue = [];
        this.worker.on("stdout", function(data) {
          handleEmittedStdPayload(me, {
            "stdout": data.toString()
          });
        });
        this.worker.on("stderr", function(data) {
          handleEmittedStdPayload(me, {
            "stderr": data.toString()
          });
        });
        this.worker.on("message", function(response) {
          if (me.terminated) {
            return;
          }
          if (typeof response === "string" && response === "ready") {
            me.worker.ready = true;
            dispatchQueuedRequests();
          } else {
            var id = response.id;
            var task = me.processing[id];
            if (task !== void 0) {
              if (response.isEvent) {
                if (task.options && typeof task.options.on === "function") {
                  task.options.on(response.payload);
                }
              } else {
                delete me.processing[id];
                if (me.terminating === true) {
                  me.terminate();
                }
                if (response.error) {
                  task.resolver.reject(objectToError(response.error));
                } else {
                  task.resolver.resolve(response.result);
                }
              }
            } else {
              var task = me.tracking[id];
              if (task !== void 0) {
                if (response.isEvent) {
                  if (task.options && typeof task.options.on === "function") {
                    task.options.on(response.payload);
                  }
                }
              }
            }
            if (response.method === CLEANUP_METHOD_ID) {
              var trackedTask = me.tracking[response.id];
              if (trackedTask !== void 0) {
                if (response.error) {
                  clearTimeout(trackedTask.timeoutId);
                  trackedTask.resolver.reject(objectToError(response.error));
                } else {
                  me.tracking && clearTimeout(trackedTask.timeoutId);
                  trackedTask.resolver.reject(new WrappedTimeoutError(trackedTask.error));
                }
              }
              delete me.tracking[id];
            }
          }
        });
        function onError(error2) {
          me.terminated = true;
          for (var id in me.processing) {
            if (me.processing[id] !== void 0) {
              me.processing[id].resolver.reject(error2);
            }
          }
          me.processing = /* @__PURE__ */ Object.create(null);
        }
        function dispatchQueuedRequests() {
          var _iterator = _createForOfIteratorHelper(me.requestQueue.splice(0)), _step;
          try {
            for (_iterator.s(); !(_step = _iterator.n()).done; ) {
              var request = _step.value;
              me.worker.send(request.message, request.transfer);
            }
          } catch (err2) {
            _iterator.e(err2);
          } finally {
            _iterator.f();
          }
        }
        var worker2 = this.worker;
        this.worker.on("error", function(error2) {
          var message = error2 && error2.message ? error2.message : String(error2 || "Unknown worker error");
          onError(new TerminateError$1("Workerpool Worker error: " + message, error2));
        });
        this.worker.on("exit", function(exitCode, signalCode) {
          var message = "Workerpool Worker terminated Unexpectedly\n";
          message += "    exitCode: `" + exitCode + "`\n";
          message += "    signalCode: `" + signalCode + "`\n";
          message += "    workerpool.script: `" + me.script + "`\n";
          message += "    spawnArgs: `" + worker2.spawnargs + "`\n";
          message += "    spawnfile: `" + worker2.spawnfile + "`\n";
          message += "    stdout: `" + worker2.stdout + "`\n";
          message += "    stderr: `" + worker2.stderr + "`\n";
          onError(new TerminateError$1(message));
        });
        this.processing = /* @__PURE__ */ Object.create(null);
        this.tracking = /* @__PURE__ */ Object.create(null);
        this.terminating = false;
        this.terminated = false;
        this.cleaning = false;
        this.terminationHandler = null;
        this.lastId = 0;
      }
      WorkerHandler.prototype.methods = function() {
        return this.exec("methods");
      };
      WorkerHandler.prototype.exec = function(method, params, resolver, options) {
        if (!resolver) {
          resolver = Promise$2.defer();
        }
        var id = ++this.lastId;
        this.processing[id] = {
          id,
          resolver,
          options
        };
        var request = {
          message: {
            id,
            method,
            params
          },
          transfer: options && options.transfer
        };
        if (this.terminated) {
          resolver.reject(new TerminateError$1("Worker is terminated"));
        } else if (this.worker.ready) {
          this.worker.send(request.message, request.transfer);
        } else {
          this.requestQueue.push(request);
        }
        var me = this;
        return resolver.promise.catch(function(error2) {
          if (error2 instanceof Promise$2.CancellationError || error2 instanceof Promise$2.TimeoutError) {
            me.tracking[id] = {
              id,
              resolver: Promise$2.defer(),
              options,
              error: error2
            };
            delete me.processing[id];
            me.tracking[id].resolver.promise = me.tracking[id].resolver.promise.catch(function(err2) {
              delete me.tracking[id];
              if (err2 instanceof WrappedTimeoutError) {
                throw err2.error;
              }
              var promise = me.terminateAndNotify(true).then(function() {
                throw err2;
              }, function(err3) {
                throw err3;
              });
              return promise;
            });
            me.worker.send({
              id,
              method: CLEANUP_METHOD_ID
            });
            me.tracking[id].timeoutId = setTimeout(function() {
              me.tracking[id].resolver.reject(error2);
            }, me.workerTerminateTimeout);
            return me.tracking[id].resolver.promise;
          } else {
            throw error2;
          }
        });
      };
      WorkerHandler.prototype.busy = function() {
        return this.cleaning || Object.keys(this.processing).length > 0;
      };
      WorkerHandler.prototype.terminate = function(force, callback) {
        var me = this;
        if (force) {
          for (var id in this.processing) {
            if (this.processing[id] !== void 0) {
              this.processing[id].resolver.reject(new Error("Worker terminated"));
            }
          }
          this.processing = /* @__PURE__ */ Object.create(null);
        }
        for (var _i = 0, _Object$values = Object.values(me.tracking); _i < _Object$values.length; _i++) {
          var task = _Object$values[_i];
          clearTimeout(task.timeoutId);
          task.resolver.reject(new Error("Worker Terminating"));
        }
        me.tracking = /* @__PURE__ */ Object.create(null);
        if (typeof callback === "function") {
          this.terminationHandler = callback;
        }
        if (!this.busy()) {
          var cleanup = function cleanup2(err2) {
            me.terminated = true;
            me.cleaning = false;
            if (me.worker != null && me.worker.removeAllListeners) {
              me.worker.removeAllListeners("message");
            }
            me.worker = null;
            me.terminating = false;
            if (me.terminationHandler) {
              me.terminationHandler(err2, me);
            } else if (err2) {
              throw err2;
            }
          };
          if (this.worker) {
            if (typeof this.worker.kill === "function") {
              if (this.worker.killed) {
                cleanup(new Error("worker already killed!"));
                return;
              }
              var cleanExitTimeout = setTimeout(function() {
                if (me.worker) {
                  me.worker.kill();
                }
              }, this.workerTerminateTimeout);
              this.worker.once("exit", function() {
                clearTimeout(cleanExitTimeout);
                if (me.worker) {
                  me.worker.killed = true;
                }
                cleanup();
              });
              if (this.worker.ready) {
                this.worker.send(TERMINATE_METHOD_ID);
              } else {
                this.requestQueue.push({
                  message: TERMINATE_METHOD_ID
                });
              }
              this.cleaning = true;
              return;
            } else if (typeof this.worker.terminate === "function") {
              this.worker.terminate();
              this.worker.killed = true;
            } else {
              throw new Error("Failed to terminate worker");
            }
          }
          cleanup();
        } else {
          this.terminating = true;
        }
      };
      WorkerHandler.prototype.terminateAndNotify = function(force, timeout) {
        var resolver = Promise$2.defer();
        if (timeout) {
          resolver.promise.timeout(timeout);
        }
        this.terminate(force, function(err2, worker2) {
          if (err2) {
            resolver.reject(err2);
          } else {
            resolver.resolve(worker2);
          }
        });
        return resolver.promise;
      };
      function WrappedTimeoutError(timeoutError) {
        this.error = timeoutError;
        this.stack = new Error().stack;
      }
      var TerminateError$1 = /* @__PURE__ */ function(_Error) {
        function TerminateError2(message, cause) {
          var _this;
          _classCallCheck(this, TerminateError2);
          _this = _callSuper(this, TerminateError2, [message || "worker terminated"]);
          _this.cause = cause;
          return _this;
        }
        _inherits(TerminateError2, _Error);
        return _createClass(TerminateError2);
      }(/* @__PURE__ */ _wrapNativeSuper(Error));
      WorkerHandler$1.exports = WorkerHandler;
      WorkerHandler$1.exports._tryRequireWorkerThreads = tryRequireWorkerThreads;
      WorkerHandler$1.exports._setupProcessWorker = setupProcessWorker;
      WorkerHandler$1.exports._setupBrowserWorker = setupBrowserWorker;
      WorkerHandler$1.exports._setupWorkerThreadWorker = setupWorkerThreadWorker;
      WorkerHandler$1.exports.ensureWorkerThreads = ensureWorkerThreads;
      WorkerHandler$1.exports.TerminateError = TerminateError$1;
      var WorkerHandlerExports = WorkerHandler$1.exports;
      var queues;
      var hasRequiredQueues;
      function requireQueues() {
        if (hasRequiredQueues) return queues;
        hasRequiredQueues = 1;
        function FIFOQueue() {
          this.tasks = [];
        }
        FIFOQueue.prototype.push = function(task) {
          this.tasks.push(task);
        };
        FIFOQueue.prototype.pop = function() {
          return this.tasks.shift();
        };
        FIFOQueue.prototype.size = function() {
          return this.tasks.length;
        };
        FIFOQueue.prototype.contains = function(task) {
          return this.tasks.includes(task);
        };
        FIFOQueue.prototype.clear = function() {
          this.tasks.length = 0;
        };
        function LIFOQueue() {
          this.tasks = [];
        }
        LIFOQueue.prototype.push = function(task) {
          this.tasks.push(task);
        };
        LIFOQueue.prototype.pop = function() {
          return this.tasks.pop();
        };
        LIFOQueue.prototype.size = function() {
          return this.tasks.length;
        };
        LIFOQueue.prototype.contains = function(task) {
          return this.tasks.includes(task);
        };
        LIFOQueue.prototype.clear = function() {
          this.tasks.length = 0;
        };
        queues = {
          FIFOQueue,
          LIFOQueue
        };
        return queues;
      }
      var debugPortAllocator;
      var hasRequiredDebugPortAllocator;
      function requireDebugPortAllocator() {
        if (hasRequiredDebugPortAllocator) return debugPortAllocator;
        hasRequiredDebugPortAllocator = 1;
        var MAX_PORTS = 65535;
        debugPortAllocator = DebugPortAllocator;
        function DebugPortAllocator() {
          this.ports = /* @__PURE__ */ Object.create(null);
          this.length = 0;
        }
        DebugPortAllocator.prototype.nextAvailableStartingAt = function(starting) {
          while (this.ports[starting] === true) {
            starting++;
          }
          if (starting >= MAX_PORTS) {
            throw new Error("WorkerPool debug port limit reached: " + starting + ">= " + MAX_PORTS);
          }
          this.ports[starting] = true;
          this.length++;
          return starting;
        };
        DebugPortAllocator.prototype.releasePort = function(port) {
          delete this.ports[port];
          this.length--;
        };
        return debugPortAllocator;
      }
      var Pool_1;
      var hasRequiredPool;
      function requirePool() {
        if (hasRequiredPool) return Pool_1;
        hasRequiredPool = 1;
        var _require$$2 = require_Promise(), Promise2 = _require$$2.Promise;
        var WorkerHandler2 = WorkerHandlerExports;
        var environment2 = environmentExports;
        var _require$$22 = requireQueues(), FIFOQueue = _require$$22.FIFOQueue, LIFOQueue = _require$$22.LIFOQueue;
        var DebugPortAllocator = requireDebugPortAllocator();
        var DEBUG_PORT_ALLOCATOR = new DebugPortAllocator();
        function Pool(script, options) {
          if (typeof script === "string") {
            this.script = script || null;
          } else {
            this.script = null;
            options = script;
          }
          this.workers = [];
          this.taskQueue = this._createQueue(options && options.queueStrategy || "fifo");
          options = options || {};
          this.forkArgs = Object.freeze(options.forkArgs || []);
          this.forkOpts = Object.freeze(options.forkOpts || {});
          this.workerOpts = Object.freeze(options.workerOpts || {});
          this.workerThreadOpts = Object.freeze(options.workerThreadOpts || {});
          this.debugPortStart = options.debugPortStart || 43210;
          this.nodeWorker = options.nodeWorker;
          this.workerType = options.workerType || options.nodeWorker || "auto";
          this.maxQueueSize = options.maxQueueSize || Infinity;
          this.workerTerminateTimeout = options.workerTerminateTimeout || 1e3;
          this.onCreateWorker = options.onCreateWorker || function() {
            return null;
          };
          this.onTerminateWorker = options.onTerminateWorker || function() {
            return null;
          };
          this.emitStdStreams = options.emitStdStreams || false;
          if (options && "maxWorkers" in options) {
            validateMaxWorkers(options.maxWorkers);
            this.maxWorkers = options.maxWorkers;
          } else {
            this.maxWorkers = Math.max((environment2.cpus || 4) - 1, 1);
          }
          if (options && "minWorkers" in options) {
            if (options.minWorkers === "max") {
              this.minWorkers = this.maxWorkers;
            } else {
              validateMinWorkers(options.minWorkers);
              this.minWorkers = options.minWorkers;
              this.maxWorkers = Math.max(this.minWorkers, this.maxWorkers);
            }
            this._ensureMinWorkers();
          }
          this._boundNext = this._next.bind(this);
          if (this.workerType === "thread") {
            WorkerHandler2.ensureWorkerThreads();
          }
        }
        Pool.prototype.exec = function(method, params, options) {
          if (params && !Array.isArray(params)) {
            throw new TypeError('Array expected as argument "params"');
          }
          if (typeof method === "string") {
            var resolver = Promise2.defer();
            if (this.taskQueue.size() >= this.maxQueueSize) {
              throw new Error("Max queue size of " + this.maxQueueSize + " reached");
            }
            var task = {
              method,
              params,
              resolver,
              timeout: null,
              options
            };
            this.taskQueue.push(task);
            var originalTimeout = resolver.promise.timeout;
            var taskQueue = this.taskQueue;
            resolver.promise.timeout = function timeout(delay2) {
              if (taskQueue.contains(task)) {
                task.timeout = delay2;
                return resolver.promise;
              } else {
                return originalTimeout.call(resolver.promise, delay2);
              }
            };
            this._next();
            return resolver.promise;
          } else if (typeof method === "function") {
            return this.exec("run", [String(method), params], options);
          } else {
            throw new TypeError('Function or string expected as argument "method"');
          }
        };
        Pool.prototype.proxy = function() {
          if (arguments.length > 0) {
            throw new Error("No arguments expected");
          }
          var pool3 = this;
          return this.exec("methods").then(function(methods) {
            var proxy2 = {};
            methods.forEach(function(method) {
              proxy2[method] = function() {
                return pool3.exec(method, Array.prototype.slice.call(arguments));
              };
            });
            return proxy2;
          });
        };
        Pool.prototype._next = function() {
          if (this.taskQueue.size() > 0) {
            var worker2 = this._getWorker();
            if (worker2) {
              var me = this;
              var task = this.taskQueue.pop();
              if (task.resolver.promise.pending) {
                var promise = worker2.exec(task.method, task.params, task.resolver, task.options).then(me._boundNext).catch(function() {
                  if (worker2.terminated) {
                    return me._removeWorker(worker2);
                  }
                }).then(function() {
                  me._next();
                });
                if (typeof task.timeout === "number") {
                  promise.timeout(task.timeout);
                }
              } else {
                me._next();
              }
            }
          }
        };
        Pool.prototype._getWorker = function() {
          var workers2 = this.workers;
          for (var i = 0; i < workers2.length; i++) {
            var worker2 = workers2[i];
            if (worker2.busy() === false) {
              return worker2;
            }
          }
          if (workers2.length < this.maxWorkers) {
            worker2 = this._createWorkerHandler();
            workers2.push(worker2);
            return worker2;
          }
          return null;
        };
        Pool.prototype._removeWorker = function(worker2) {
          var me = this;
          DEBUG_PORT_ALLOCATOR.releasePort(worker2.debugPort);
          this._removeWorkerFromList(worker2);
          this._ensureMinWorkers();
          return new Promise2(function(resolve, reject) {
            worker2.terminate(false, function(err2) {
              me.onTerminateWorker({
                forkArgs: worker2.forkArgs,
                forkOpts: worker2.forkOpts,
                workerThreadOpts: worker2.workerThreadOpts,
                script: worker2.script
              });
              if (err2) {
                reject(err2);
              } else {
                resolve(worker2);
              }
            });
          });
        };
        Pool.prototype._removeWorkerFromList = function(worker2) {
          var index6 = this.workers.indexOf(worker2);
          if (index6 !== -1) {
            this.workers.splice(index6, 1);
          }
        };
        Pool.prototype.terminate = function(force, timeout) {
          var me = this;
          var taskQueue = this.taskQueue;
          while (taskQueue.size() > 0) {
            var task = taskQueue.pop();
            if (task) {
              task.resolver.reject(new Error("Pool terminated"));
            } else {
              break;
            }
          }
          taskQueue.clear();
          var f3 = function f4(worker2) {
            DEBUG_PORT_ALLOCATOR.releasePort(worker2.debugPort);
            this._removeWorkerFromList(worker2);
          };
          var removeWorker = f3.bind(this);
          var promises6 = [];
          var workers2 = this.workers.slice();
          workers2.forEach(function(worker2) {
            var termPromise = worker2.terminateAndNotify(force, timeout).then(removeWorker).always(function() {
              me.onTerminateWorker({
                forkArgs: worker2.forkArgs,
                forkOpts: worker2.forkOpts,
                workerThreadOpts: worker2.workerThreadOpts,
                script: worker2.script
              });
            });
            promises6.push(termPromise);
          });
          return Promise2.all(promises6);
        };
        Pool.prototype.stats = function() {
          var totalWorkers = this.workers.length;
          var busyWorkers = this.workers.filter(function(worker2) {
            return worker2.busy();
          }).length;
          return {
            totalWorkers,
            busyWorkers,
            idleWorkers: totalWorkers - busyWorkers,
            pendingTasks: this.taskQueue.size(),
            activeTasks: busyWorkers
          };
        };
        Pool.prototype._ensureMinWorkers = function() {
          if (this.minWorkers) {
            for (var i = this.workers.length; i < this.minWorkers; i++) {
              this.workers.push(this._createWorkerHandler());
            }
          }
        };
        Pool.prototype._createWorkerHandler = function() {
          var overriddenParams = this.onCreateWorker({
            forkArgs: this.forkArgs,
            forkOpts: this.forkOpts,
            workerOpts: this.workerOpts,
            workerThreadOpts: this.workerThreadOpts,
            script: this.script
          }) || {};
          return new WorkerHandler2(overriddenParams.script || this.script, {
            forkArgs: overriddenParams.forkArgs || this.forkArgs,
            forkOpts: overriddenParams.forkOpts || this.forkOpts,
            workerOpts: overriddenParams.workerOpts || this.workerOpts,
            workerThreadOpts: overriddenParams.workerThreadOpts || this.workerThreadOpts,
            debugPort: DEBUG_PORT_ALLOCATOR.nextAvailableStartingAt(this.debugPortStart),
            workerType: this.workerType,
            workerTerminateTimeout: this.workerTerminateTimeout,
            emitStdStreams: this.emitStdStreams
          });
        };
        Pool.prototype._createQueue = function(strategy) {
          if (typeof strategy === "string") {
            switch (strategy) {
              case "fifo":
                return new FIFOQueue();
              case "lifo":
                return new LIFOQueue();
              default:
                throw new Error("Unknown queue strategy: " + strategy);
            }
          }
          if (!strategy) {
            throw new Error("Queue strategy cannot be null or undefined");
          }
          var requiredMethods = ["push", "pop", "size", "contains", "clear"];
          for (var i = 0; i < requiredMethods.length; i++) {
            var method = requiredMethods[i];
            if (typeof strategy[method] !== "function") {
              throw new Error("Queue strategy must implement method: " + method);
            }
          }
          return strategy;
        };
        function validateMaxWorkers(maxWorkers) {
          if (!isNumber(maxWorkers) || !isInteger(maxWorkers) || maxWorkers < 1) {
            throw new TypeError("Option maxWorkers must be an integer number >= 1");
          }
        }
        function validateMinWorkers(minWorkers) {
          if (!isNumber(minWorkers) || !isInteger(minWorkers) || minWorkers < 0) {
            throw new TypeError("Option minWorkers must be an integer number >= 0");
          }
        }
        function isNumber(value2) {
          return typeof value2 === "number";
        }
        function isInteger(value2) {
          return Math.round(value2) == value2;
        }
        Pool_1 = Pool;
        return Pool_1;
      }
      var worker$1 = {};
      var transfer;
      var hasRequiredTransfer;
      function requireTransfer() {
        if (hasRequiredTransfer) return transfer;
        hasRequiredTransfer = 1;
        function Transfer2(message, transfer2) {
          this.message = message;
          this.transfer = transfer2;
        }
        transfer = Transfer2;
        return transfer;
      }
      var hasRequiredWorker;
      function requireWorker() {
        if (hasRequiredWorker) return worker$1;
        hasRequiredWorker = 1;
        (function(exports$1) {
          var Transfer2 = requireTransfer();
          var Promise2 = require_Promise().Promise;
          var TERMINATE_METHOD_ID2 = "__workerpool-terminate__";
          var CLEANUP_METHOD_ID2 = "__workerpool-cleanup__";
          var TIMEOUT_DEFAULT = 1e3;
          var worker2 = {
            exit: function exit() {
            }
          };
          var publicWorker = {
            /**
             * Registers listeners which will trigger when a task is timed out or cancled. If all listeners resolve, the worker executing the given task will not be terminated.
             * *Note*: If there is a blocking operation within a listener, the worker will be terminated.
             * @param {() => Promise<void>} listener
            */
            addAbortListener: function addAbortListener(listener) {
              worker2.abortListeners.push(listener);
            },
            /**
              * Emit an event from the worker thread to the main thread.
              * @param {any} payload
            */
            emit: worker2.emit
          };
          if (typeof self !== "undefined" && typeof postMessage === "function" && typeof addEventListener === "function") {
            worker2.on = function(event2, callback) {
              addEventListener(event2, function(message) {
                callback(message.data);
              });
            };
            worker2.send = function(message, transfer2) {
              transfer2 ? postMessage(message, transfer2) : postMessage(message);
            };
          } else if (typeof process !== "undefined") {
            var WorkerThreads;
            try {
              WorkerThreads = require("worker_threads");
            } catch (error2) {
              if (_typeof(error2) === "object" && error2 !== null && error2.code === "MODULE_NOT_FOUND") ;
              else {
                throw error2;
              }
            }
            if (WorkerThreads && /* if there is a parentPort, we are in a WorkerThread */
            WorkerThreads.parentPort !== null) {
              var parentPort = WorkerThreads.parentPort;
              worker2.send = parentPort.postMessage.bind(parentPort);
              worker2.on = parentPort.on.bind(parentPort);
              worker2.exit = process.exit.bind(process);
            } else {
              worker2.on = process.on.bind(process);
              worker2.send = function(message) {
                process.send(message);
              };
              worker2.on("disconnect", function() {
                process.exit(1);
              });
              worker2.exit = process.exit.bind(process);
            }
          } else {
            throw new Error("Script must be executed as a worker");
          }
          function convertError(error2) {
            if (error2 && error2.toJSON) {
              return JSON.parse(JSON.stringify(error2));
            }
            return JSON.parse(JSON.stringify(error2, Object.getOwnPropertyNames(error2)));
          }
          function isPromise(value2) {
            return value2 && typeof value2.then === "function" && typeof value2.catch === "function";
          }
          worker2.methods = {};
          worker2.methods.run = function run2(fn, args) {
            var f3 = new Function("return (" + fn + ").apply(this, arguments);");
            f3.worker = publicWorker;
            return f3.apply(f3, args);
          };
          worker2.methods.methods = function methods() {
            return Object.keys(worker2.methods);
          };
          worker2.terminationHandler = void 0;
          worker2.abortListenerTimeout = TIMEOUT_DEFAULT;
          worker2.abortListeners = [];
          worker2.terminateAndExit = function(code) {
            var _exit = function _exit2() {
              worker2.exit(code);
            };
            if (!worker2.terminationHandler) {
              return _exit();
            }
            var result = worker2.terminationHandler(code);
            if (isPromise(result)) {
              result.then(_exit, _exit);
              return result;
            } else {
              _exit();
              return new Promise2(function(_resolve, reject) {
                reject(new Error("Worker terminating"));
              });
            }
          };
          worker2.cleanup = function(requestId) {
            if (!worker2.abortListeners.length) {
              worker2.send({
                id: requestId,
                method: CLEANUP_METHOD_ID2,
                error: convertError(new Error("Worker terminating"))
              });
              return new Promise2(function(resolve) {
                resolve();
              });
            }
            var _exit = function _exit2() {
              worker2.exit();
            };
            var _abort = function _abort2() {
              if (!worker2.abortListeners.length) {
                worker2.abortListeners = [];
              }
            };
            var promises6 = worker2.abortListeners.map(function(listener) {
              return listener();
            });
            var timerId;
            var timeoutPromise = new Promise2(function(_resolve, reject) {
              timerId = setTimeout(function() {
                reject(new Error("Timeout occured waiting for abort handler, killing worker"));
              }, worker2.abortListenerTimeout);
            });
            var settlePromise = Promise2.all(promises6).then(function() {
              clearTimeout(timerId);
              _abort();
            }, function() {
              clearTimeout(timerId);
              _exit();
            });
            return new Promise2(function(resolve, reject) {
              settlePromise.then(resolve, reject);
              timeoutPromise.then(resolve, reject);
            }).then(function() {
              worker2.send({
                id: requestId,
                method: CLEANUP_METHOD_ID2,
                error: null
              });
            }, function(err2) {
              worker2.send({
                id: requestId,
                method: CLEANUP_METHOD_ID2,
                error: err2 ? convertError(err2) : null
              });
            });
          };
          var currentRequestId = null;
          worker2.on("message", function(request) {
            if (request === TERMINATE_METHOD_ID2) {
              return worker2.terminateAndExit(0);
            }
            if (request.method === CLEANUP_METHOD_ID2) {
              return worker2.cleanup(request.id);
            }
            try {
              var method = worker2.methods[request.method];
              if (method) {
                currentRequestId = request.id;
                var result = method.apply(method, request.params);
                if (isPromise(result)) {
                  result.then(function(result2) {
                    if (result2 instanceof Transfer2) {
                      worker2.send({
                        id: request.id,
                        result: result2.message,
                        error: null
                      }, result2.transfer);
                    } else {
                      worker2.send({
                        id: request.id,
                        result: result2,
                        error: null
                      });
                    }
                    currentRequestId = null;
                  }).catch(function(err2) {
                    worker2.send({
                      id: request.id,
                      result: null,
                      error: convertError(err2)
                    });
                    currentRequestId = null;
                  });
                } else {
                  if (result instanceof Transfer2) {
                    worker2.send({
                      id: request.id,
                      result: result.message,
                      error: null
                    }, result.transfer);
                  } else {
                    worker2.send({
                      id: request.id,
                      result,
                      error: null
                    });
                  }
                  currentRequestId = null;
                }
              } else {
                throw new Error('Unknown method "' + request.method + '"');
              }
            } catch (err2) {
              worker2.send({
                id: request.id,
                result: null,
                error: convertError(err2)
              });
            }
          });
          worker2.register = function(methods, options) {
            if (methods) {
              for (var name in methods) {
                if (methods.hasOwnProperty(name)) {
                  worker2.methods[name] = methods[name];
                  worker2.methods[name].worker = publicWorker;
                }
              }
            }
            if (options) {
              worker2.terminationHandler = options.onTerminate;
              worker2.abortListenerTimeout = options.abortListenerTimeout || TIMEOUT_DEFAULT;
            }
            worker2.send("ready");
          };
          worker2.emit = function(payload) {
            if (currentRequestId) {
              if (payload instanceof Transfer2) {
                worker2.send({
                  id: currentRequestId,
                  isEvent: true,
                  payload: payload.message
                }, payload.transfer);
                return;
              }
              worker2.send({
                id: currentRequestId,
                isEvent: true,
                payload
              });
            }
          };
          {
            exports$1.add = worker2.register;
            exports$1.emit = worker2.emit;
          }
        })(worker$1);
        return worker$1;
      }
      var platform = environmentExports.platform, isMainThread = environmentExports.isMainThread, cpus = environmentExports.cpus;
      var TerminateError = WorkerHandlerExports.TerminateError;
      function pool2(script, options) {
        var Pool = requirePool();
        return new Pool(script, options);
      }
      var pool_1 = src.pool = pool2;
      function worker(methods, options) {
        var worker2 = requireWorker();
        worker2.add(methods, options);
      }
      var worker_1 = src.worker = worker;
      function workerEmit(payload) {
        var worker2 = requireWorker();
        worker2.emit(payload);
      }
      var workerEmit_1 = src.workerEmit = workerEmit;
      var _require$$ = require_Promise(), Promise$1 = _require$$.Promise;
      var _Promise = src.Promise = Promise$1;
      var Transfer = src.Transfer = requireTransfer();
      var platform_1 = src.platform = platform;
      var isMainThread_1 = src.isMainThread = isMainThread;
      var cpus_1 = src.cpus = cpus;
      var TerminateError_1 = src.TerminateError = TerminateError;
      exports3.Promise = _Promise;
      exports3.TerminateError = TerminateError_1;
      exports3.Transfer = Transfer;
      exports3.cpus = cpus_1;
      exports3.default = src;
      exports3.isMainThread = isMainThread_1;
      exports3.platform = platform_1;
      exports3.pool = pool_1;
      exports3.worker = worker_1;
      exports3.workerEmit = workerEmit_1;
      Object.defineProperty(exports3, "__esModule", { value: true });
    });
  }
});

// node_modules/readdirp/index.js
var require_readdirp = __commonJS({
  "node_modules/readdirp/index.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ReaddirpStream = exports2.EntryTypes = void 0;
    exports2.readdirp = readdirp;
    exports2.readdirpPromise = readdirpPromise;
    var promises_1 = require("node:fs/promises");
    var node_stream_1 = require("node:stream");
    var node_path_1 = require("node:path");
    exports2.EntryTypes = {
      FILE_TYPE: "files",
      DIR_TYPE: "directories",
      FILE_DIR_TYPE: "files_directories",
      EVERYTHING_TYPE: "all"
    };
    var defaultOptions = {
      root: ".",
      fileFilter: (_entryInfo) => true,
      directoryFilter: (_entryInfo) => true,
      type: exports2.EntryTypes.FILE_TYPE,
      lstat: false,
      depth: 2147483648,
      alwaysStat: false,
      highWaterMark: 4096
    };
    Object.freeze(defaultOptions);
    var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
    var NORMAL_FLOW_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EPERM", "EACCES", "ELOOP", RECURSIVE_ERROR_CODE]);
    var ALL_TYPES = [
      exports2.EntryTypes.DIR_TYPE,
      exports2.EntryTypes.EVERYTHING_TYPE,
      exports2.EntryTypes.FILE_DIR_TYPE,
      exports2.EntryTypes.FILE_TYPE
    ];
    var DIR_TYPES = /* @__PURE__ */ new Set([
      exports2.EntryTypes.DIR_TYPE,
      exports2.EntryTypes.EVERYTHING_TYPE,
      exports2.EntryTypes.FILE_DIR_TYPE
    ]);
    var FILE_TYPES = /* @__PURE__ */ new Set([
      exports2.EntryTypes.EVERYTHING_TYPE,
      exports2.EntryTypes.FILE_DIR_TYPE,
      exports2.EntryTypes.FILE_TYPE
    ]);
    var isNormalFlowError = (error2) => NORMAL_FLOW_ERRORS.has(error2.code);
    var wantBigintFsStats = process.platform === "win32";
    var emptyFn = (_entryInfo) => true;
    var normalizeFilter = (filter3) => {
      if (filter3 === void 0)
        return emptyFn;
      if (typeof filter3 === "function")
        return filter3;
      if (typeof filter3 === "string") {
        const fl2 = filter3.trim();
        return (entry) => entry.basename === fl2;
      }
      if (Array.isArray(filter3)) {
        const trItems = filter3.map((item) => item.trim());
        return (entry) => trItems.some((f3) => entry.basename === f3);
      }
      return emptyFn;
    };
    var ReaddirpStream = class extends node_stream_1.Readable {
      constructor(options = {}) {
        var _a6;
        super({
          objectMode: true,
          autoDestroy: true,
          highWaterMark: options.highWaterMark
        });
        const opts = { ...defaultOptions, ...options };
        const { root: root5, type } = opts;
        this._fileFilter = normalizeFilter(opts.fileFilter);
        this._directoryFilter = normalizeFilter(opts.directoryFilter);
        const statMethod = opts.lstat ? promises_1.lstat : promises_1.stat;
        if (wantBigintFsStats) {
          this._stat = (path8) => statMethod(path8, { bigint: true });
        } else {
          this._stat = statMethod;
        }
        this._maxDepth = (_a6 = opts.depth) != null ? _a6 : defaultOptions.depth;
        this._wantsDir = type ? DIR_TYPES.has(type) : false;
        this._wantsFile = type ? FILE_TYPES.has(type) : false;
        this._wantsEverything = type === exports2.EntryTypes.EVERYTHING_TYPE;
        this._root = (0, node_path_1.resolve)(root5);
        this._isDirent = !opts.alwaysStat;
        this._statsProp = this._isDirent ? "dirent" : "stats";
        this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
        this.parents = [this._exploreDir(root5, 1)];
        this.reading = false;
        this.parent = void 0;
      }
      async _read(batch) {
        if (this.reading)
          return;
        this.reading = true;
        try {
          while (!this.destroyed && batch > 0) {
            const par = this.parent;
            const fil = par && par.files;
            if (fil && fil.length > 0) {
              const { path: path8, depth } = par;
              const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path8));
              const awaited = await Promise.all(slice);
              for (const entry of awaited) {
                if (!entry)
                  continue;
                if (this.destroyed)
                  return;
                const entryType = await this._getEntryType(entry);
                if (entryType === "directory" && this._directoryFilter(entry)) {
                  if (depth <= this._maxDepth) {
                    this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
                  }
                  if (this._wantsDir) {
                    this.push(entry);
                    batch--;
                  }
                } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
                  if (this._wantsFile) {
                    this.push(entry);
                    batch--;
                  }
                }
              }
            } else {
              const parent = this.parents.pop();
              if (!parent) {
                this.push(null);
                break;
              }
              this.parent = await parent;
              if (this.destroyed)
                return;
            }
          }
        } catch (error2) {
          this.destroy(error2);
        } finally {
          this.reading = false;
        }
      }
      async _exploreDir(path8, depth) {
        let files;
        try {
          files = await (0, promises_1.readdir)(path8, this._rdOptions);
        } catch (error2) {
          this._onError(error2);
        }
        return { files, depth, path: path8 };
      }
      async _formatEntry(dirent, path8) {
        let entry;
        const basename2 = this._isDirent ? dirent.name : dirent;
        try {
          const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path8, basename2));
          entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename: basename2 };
          entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
        } catch (err2) {
          this._onError(err2);
          return;
        }
        return entry;
      }
      _onError(err2) {
        if (isNormalFlowError(err2) && !this.destroyed) {
          this.emit("warn", err2);
        } else {
          this.destroy(err2);
        }
      }
      async _getEntryType(entry) {
        if (!entry && this._statsProp in entry) {
          return "";
        }
        const stats = entry[this._statsProp];
        if (stats.isFile())
          return "file";
        if (stats.isDirectory())
          return "directory";
        if (stats && stats.isSymbolicLink()) {
          const full = entry.fullPath;
          try {
            const entryRealPath = await (0, promises_1.realpath)(full);
            const entryRealPathStats = await (0, promises_1.lstat)(entryRealPath);
            if (entryRealPathStats.isFile()) {
              return "file";
            }
            if (entryRealPathStats.isDirectory()) {
              const len = entryRealPath.length;
              if (full.startsWith(entryRealPath) && full.substr(len, 1) === node_path_1.sep) {
                const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
                recursiveError.code = RECURSIVE_ERROR_CODE;
                return this._onError(recursiveError);
              }
              return "directory";
            }
          } catch (error2) {
            this._onError(error2);
            return "";
          }
        }
      }
      _includeAsFile(entry) {
        const stats = entry && entry[this._statsProp];
        return stats && this._wantsEverything && !stats.isDirectory();
      }
    };
    exports2.ReaddirpStream = ReaddirpStream;
    function readdirp(root5, options = {}) {
      let type = options.entryType || options.type;
      if (type === "both")
        type = exports2.EntryTypes.FILE_DIR_TYPE;
      if (type)
        options.type = type;
      if (!root5) {
        throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
      } else if (typeof root5 !== "string") {
        throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
      } else if (type && !ALL_TYPES.includes(type)) {
        throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
      }
      options.root = root5;
      return new ReaddirpStream(options);
    }
    function readdirpPromise(root5, options = {}) {
      return new Promise((resolve, reject) => {
        const files = [];
        readdirp(root5, options).on("data", (entry) => files.push(entry)).on("end", () => resolve(files)).on("error", (error2) => reject(error2));
      });
    }
    exports2.default = readdirp;
  }
});

// node_modules/chokidar/handler.js
var require_handler = __commonJS({
  "node_modules/chokidar/handler.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.NodeFsHandler = exports2.EVENTS = exports2.isIBMi = exports2.isFreeBSD = exports2.isLinux = exports2.isMacos = exports2.isWindows = exports2.IDENTITY_FN = exports2.EMPTY_FN = exports2.STR_CLOSE = exports2.STR_END = exports2.STR_DATA = void 0;
    var fs_1 = require("fs");
    var promises_1 = require("fs/promises");
    var sysPath = require("path");
    var os_1 = require("os");
    exports2.STR_DATA = "data";
    exports2.STR_END = "end";
    exports2.STR_CLOSE = "close";
    var EMPTY_FN = () => {
    };
    exports2.EMPTY_FN = EMPTY_FN;
    var IDENTITY_FN = (val) => val;
    exports2.IDENTITY_FN = IDENTITY_FN;
    var pl = process.platform;
    exports2.isWindows = pl === "win32";
    exports2.isMacos = pl === "darwin";
    exports2.isLinux = pl === "linux";
    exports2.isFreeBSD = pl === "freebsd";
    exports2.isIBMi = (0, os_1.type)() === "OS400";
    exports2.EVENTS = {
      ALL: "all",
      READY: "ready",
      ADD: "add",
      CHANGE: "change",
      ADD_DIR: "addDir",
      UNLINK: "unlink",
      UNLINK_DIR: "unlinkDir",
      RAW: "raw",
      ERROR: "error"
    };
    var EV = exports2.EVENTS;
    var THROTTLE_MODE_WATCH = "watch";
    var statMethods = { lstat: promises_1.lstat, stat: promises_1.stat };
    var KEY_LISTENERS = "listeners";
    var KEY_ERR = "errHandlers";
    var KEY_RAW = "rawEmitters";
    var HANDLER_KEYS = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
    var binaryExtensions = /* @__PURE__ */ new Set([
      "3dm",
      "3ds",
      "3g2",
      "3gp",
      "7z",
      "a",
      "aac",
      "adp",
      "afdesign",
      "afphoto",
      "afpub",
      "ai",
      "aif",
      "aiff",
      "alz",
      "ape",
      "apk",
      "appimage",
      "ar",
      "arj",
      "asf",
      "au",
      "avi",
      "bak",
      "baml",
      "bh",
      "bin",
      "bk",
      "bmp",
      "btif",
      "bz2",
      "bzip2",
      "cab",
      "caf",
      "cgm",
      "class",
      "cmx",
      "cpio",
      "cr2",
      "cur",
      "dat",
      "dcm",
      "deb",
      "dex",
      "djvu",
      "dll",
      "dmg",
      "dng",
      "doc",
      "docm",
      "docx",
      "dot",
      "dotm",
      "dra",
      "DS_Store",
      "dsk",
      "dts",
      "dtshd",
      "dvb",
      "dwg",
      "dxf",
      "ecelp4800",
      "ecelp7470",
      "ecelp9600",
      "egg",
      "eol",
      "eot",
      "epub",
      "exe",
      "f4v",
      "fbs",
      "fh",
      "fla",
      "flac",
      "flatpak",
      "fli",
      "flv",
      "fpx",
      "fst",
      "fvt",
      "g3",
      "gh",
      "gif",
      "graffle",
      "gz",
      "gzip",
      "h261",
      "h263",
      "h264",
      "icns",
      "ico",
      "ief",
      "img",
      "ipa",
      "iso",
      "jar",
      "jpeg",
      "jpg",
      "jpgv",
      "jpm",
      "jxr",
      "key",
      "ktx",
      "lha",
      "lib",
      "lvp",
      "lz",
      "lzh",
      "lzma",
      "lzo",
      "m3u",
      "m4a",
      "m4v",
      "mar",
      "mdi",
      "mht",
      "mid",
      "midi",
      "mj2",
      "mka",
      "mkv",
      "mmr",
      "mng",
      "mobi",
      "mov",
      "movie",
      "mp3",
      "mp4",
      "mp4a",
      "mpeg",
      "mpg",
      "mpga",
      "mxu",
      "nef",
      "npx",
      "numbers",
      "nupkg",
      "o",
      "odp",
      "ods",
      "odt",
      "oga",
      "ogg",
      "ogv",
      "otf",
      "ott",
      "pages",
      "pbm",
      "pcx",
      "pdb",
      "pdf",
      "pea",
      "pgm",
      "pic",
      "png",
      "pnm",
      "pot",
      "potm",
      "potx",
      "ppa",
      "ppam",
      "ppm",
      "pps",
      "ppsm",
      "ppsx",
      "ppt",
      "pptm",
      "pptx",
      "psd",
      "pya",
      "pyc",
      "pyo",
      "pyv",
      "qt",
      "rar",
      "ras",
      "raw",
      "resources",
      "rgb",
      "rip",
      "rlc",
      "rmf",
      "rmvb",
      "rpm",
      "rtf",
      "rz",
      "s3m",
      "s7z",
      "scpt",
      "sgi",
      "shar",
      "snap",
      "sil",
      "sketch",
      "slk",
      "smv",
      "snk",
      "so",
      "stl",
      "suo",
      "sub",
      "swf",
      "tar",
      "tbz",
      "tbz2",
      "tga",
      "tgz",
      "thmx",
      "tif",
      "tiff",
      "tlz",
      "ttc",
      "ttf",
      "txz",
      "udf",
      "uvh",
      "uvi",
      "uvm",
      "uvp",
      "uvs",
      "uvu",
      "viv",
      "vob",
      "war",
      "wav",
      "wax",
      "wbmp",
      "wdp",
      "weba",
      "webm",
      "webp",
      "whl",
      "wim",
      "wm",
      "wma",
      "wmv",
      "wmx",
      "woff",
      "woff2",
      "wrm",
      "wvx",
      "xbm",
      "xif",
      "xla",
      "xlam",
      "xls",
      "xlsb",
      "xlsm",
      "xlsx",
      "xlt",
      "xltm",
      "xltx",
      "xm",
      "xmind",
      "xpi",
      "xpm",
      "xwd",
      "xz",
      "z",
      "zip",
      "zipx"
    ]);
    var isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
    var foreach = (val, fn) => {
      if (val instanceof Set) {
        val.forEach(fn);
      } else {
        fn(val);
      }
    };
    var addAndConvert = (main, prop2, item) => {
      let container = main[prop2];
      if (!(container instanceof Set)) {
        main[prop2] = container = /* @__PURE__ */ new Set([container]);
      }
      container.add(item);
    };
    var clearItem = (cont) => (key4) => {
      const set2 = cont[key4];
      if (set2 instanceof Set) {
        set2.clear();
      } else {
        delete cont[key4];
      }
    };
    var delFromSet = (main, prop2, item) => {
      const container = main[prop2];
      if (container instanceof Set) {
        container.delete(item);
      } else if (container === item) {
        delete main[prop2];
      }
    };
    var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
    var FsWatchInstances = /* @__PURE__ */ new Map();
    function createFsWatchInstance(path8, options, listener, errHandler, emitRaw) {
      const handleEvent = (rawEvent, evPath) => {
        listener(path8);
        emitRaw(rawEvent, evPath, { watchedPath: path8 });
        if (evPath && path8 !== evPath) {
          fsWatchBroadcast(sysPath.resolve(path8, evPath), KEY_LISTENERS, sysPath.join(path8, evPath));
        }
      };
      try {
        return (0, fs_1.watch)(path8, {
          persistent: options.persistent
        }, handleEvent);
      } catch (error2) {
        errHandler(error2);
        return void 0;
      }
    }
    var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
      const cont = FsWatchInstances.get(fullPath);
      if (!cont)
        return;
      foreach(cont[listenerType], (listener) => {
        listener(val1, val2, val3);
      });
    };
    var setFsWatchListener = (path8, fullPath, options, handlers) => {
      const { listener, errHandler, rawEmitter } = handlers;
      let cont = FsWatchInstances.get(fullPath);
      let watcher;
      if (!options.persistent) {
        watcher = createFsWatchInstance(path8, options, listener, errHandler, rawEmitter);
        if (!watcher)
          return;
        return watcher.close.bind(watcher);
      }
      if (cont) {
        addAndConvert(cont, KEY_LISTENERS, listener);
        addAndConvert(cont, KEY_ERR, errHandler);
        addAndConvert(cont, KEY_RAW, rawEmitter);
      } else {
        watcher = createFsWatchInstance(
          path8,
          options,
          fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
          errHandler,
          // no need to use broadcast here
          fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
        );
        if (!watcher)
          return;
        watcher.on(EV.ERROR, async (error2) => {
          const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
          if (cont)
            cont.watcherUnusable = true;
          if (exports2.isWindows && error2.code === "EPERM") {
            try {
              const fd2 = await (0, promises_1.open)(path8, "r");
              await fd2.close();
              broadcastErr(error2);
            } catch (err2) {
            }
          } else {
            broadcastErr(error2);
          }
        });
        cont = {
          listeners: listener,
          errHandlers: errHandler,
          rawEmitters: rawEmitter,
          watcher
        };
        FsWatchInstances.set(fullPath, cont);
      }
      return () => {
        delFromSet(cont, KEY_LISTENERS, listener);
        delFromSet(cont, KEY_ERR, errHandler);
        delFromSet(cont, KEY_RAW, rawEmitter);
        if (isEmptySet(cont.listeners)) {
          cont.watcher.close();
          FsWatchInstances.delete(fullPath);
          HANDLER_KEYS.forEach(clearItem(cont));
          cont.watcher = void 0;
          Object.freeze(cont);
        }
      };
    };
    var FsWatchFileInstances = /* @__PURE__ */ new Map();
    var setFsWatchFileListener = (path8, fullPath, options, handlers) => {
      const { listener, rawEmitter } = handlers;
      let cont = FsWatchFileInstances.get(fullPath);
      const copts = cont && cont.options;
      if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
        (0, fs_1.unwatchFile)(fullPath);
        cont = void 0;
      }
      if (cont) {
        addAndConvert(cont, KEY_LISTENERS, listener);
        addAndConvert(cont, KEY_RAW, rawEmitter);
      } else {
        cont = {
          listeners: listener,
          rawEmitters: rawEmitter,
          options,
          watcher: (0, fs_1.watchFile)(fullPath, options, (curr, prev) => {
            foreach(cont.rawEmitters, (rawEmitter2) => {
              rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
            });
            const currmtime = curr.mtimeMs;
            if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
              foreach(cont.listeners, (listener2) => listener2(path8, curr));
            }
          })
        };
        FsWatchFileInstances.set(fullPath, cont);
      }
      return () => {
        delFromSet(cont, KEY_LISTENERS, listener);
        delFromSet(cont, KEY_RAW, rawEmitter);
        if (isEmptySet(cont.listeners)) {
          FsWatchFileInstances.delete(fullPath);
          (0, fs_1.unwatchFile)(fullPath);
          cont.options = cont.watcher = void 0;
          Object.freeze(cont);
        }
      };
    };
    var NodeFsHandler = class {
      constructor(fsW) {
        this.fsw = fsW;
        this._boundHandleError = (error2) => fsW._handleError(error2);
      }
      /**
       * Watch file for changes with fs_watchFile or fs_watch.
       * @param path to file or dir
       * @param listener on fs change
       * @returns closer for the watcher instance
       */
      _watchWithNodeFs(path8, listener) {
        const opts = this.fsw.options;
        const directory = sysPath.dirname(path8);
        const basename2 = sysPath.basename(path8);
        const parent = this.fsw._getWatchedDir(directory);
        parent.add(basename2);
        const absolutePath = sysPath.resolve(path8);
        const options = {
          persistent: opts.persistent
        };
        if (!listener)
          listener = exports2.EMPTY_FN;
        let closer;
        if (opts.usePolling) {
          const enableBin = opts.interval !== opts.binaryInterval;
          options.interval = enableBin && isBinaryPath(basename2) ? opts.binaryInterval : opts.interval;
          closer = setFsWatchFileListener(path8, absolutePath, options, {
            listener,
            rawEmitter: this.fsw._emitRaw
          });
        } else {
          closer = setFsWatchListener(path8, absolutePath, options, {
            listener,
            errHandler: this._boundHandleError,
            rawEmitter: this.fsw._emitRaw
          });
        }
        return closer;
      }
      /**
       * Watch a file and emit add event if warranted.
       * @returns closer for the watcher instance
       */
      _handleFile(file, stats, initialAdd) {
        if (this.fsw.closed) {
          return;
        }
        const dirname4 = sysPath.dirname(file);
        const basename2 = sysPath.basename(file);
        const parent = this.fsw._getWatchedDir(dirname4);
        let prevStats = stats;
        if (parent.has(basename2))
          return;
        const listener = async (path8, newStats) => {
          if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
            return;
          if (!newStats || newStats.mtimeMs === 0) {
            try {
              const newStats2 = await (0, promises_1.stat)(file);
              if (this.fsw.closed)
                return;
              const at = newStats2.atimeMs;
              const mt = newStats2.mtimeMs;
              if (!at || at <= mt || mt !== prevStats.mtimeMs) {
                this.fsw._emit(EV.CHANGE, file, newStats2);
              }
              if ((exports2.isMacos || exports2.isLinux || exports2.isFreeBSD) && prevStats.ino !== newStats2.ino) {
                this.fsw._closeFile(path8);
                prevStats = newStats2;
                const closer2 = this._watchWithNodeFs(file, listener);
                if (closer2)
                  this.fsw._addPathCloser(path8, closer2);
              } else {
                prevStats = newStats2;
              }
            } catch (error2) {
              this.fsw._remove(dirname4, basename2);
            }
          } else if (parent.has(basename2)) {
            const at = newStats.atimeMs;
            const mt = newStats.mtimeMs;
            if (!at || at <= mt || mt !== prevStats.mtimeMs) {
              this.fsw._emit(EV.CHANGE, file, newStats);
            }
            prevStats = newStats;
          }
        };
        const closer = this._watchWithNodeFs(file, listener);
        if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
          if (!this.fsw._throttle(EV.ADD, file, 0))
            return;
          this.fsw._emit(EV.ADD, file, stats);
        }
        return closer;
      }
      /**
       * Handle symlinks encountered while reading a dir.
       * @param entry returned by readdirp
       * @param directory path of dir being read
       * @param path of this item
       * @param item basename of this item
       * @returns true if no more processing is needed for this entry.
       */
      async _handleSymlink(entry, directory, path8, item) {
        if (this.fsw.closed) {
          return;
        }
        const full = entry.fullPath;
        const dir = this.fsw._getWatchedDir(directory);
        if (!this.fsw.options.followSymlinks) {
          this.fsw._incrReadyCount();
          let linkPath;
          try {
            linkPath = await (0, promises_1.realpath)(path8);
          } catch (e2) {
            this.fsw._emitReady();
            return true;
          }
          if (this.fsw.closed)
            return;
          if (dir.has(item)) {
            if (this.fsw._symlinkPaths.get(full) !== linkPath) {
              this.fsw._symlinkPaths.set(full, linkPath);
              this.fsw._emit(EV.CHANGE, path8, entry.stats);
            }
          } else {
            dir.add(item);
            this.fsw._symlinkPaths.set(full, linkPath);
            this.fsw._emit(EV.ADD, path8, entry.stats);
          }
          this.fsw._emitReady();
          return true;
        }
        if (this.fsw._symlinkPaths.has(full)) {
          return true;
        }
        this.fsw._symlinkPaths.set(full, true);
      }
      _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
        directory = sysPath.join(directory, "");
        throttler = this.fsw._throttle("readdir", directory, 1e3);
        if (!throttler)
          return;
        const previous = this.fsw._getWatchedDir(wh.path);
        const current = /* @__PURE__ */ new Set();
        let stream = this.fsw._readdirp(directory, {
          fileFilter: (entry) => wh.filterPath(entry),
          directoryFilter: (entry) => wh.filterDir(entry)
        });
        if (!stream)
          return;
        stream.on(exports2.STR_DATA, async (entry) => {
          if (this.fsw.closed) {
            stream = void 0;
            return;
          }
          const item = entry.path;
          let path8 = sysPath.join(directory, item);
          current.add(item);
          if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path8, item)) {
            return;
          }
          if (this.fsw.closed) {
            stream = void 0;
            return;
          }
          if (item === target || !target && !previous.has(item)) {
            this.fsw._incrReadyCount();
            path8 = sysPath.join(dir, sysPath.relative(dir, path8));
            this._addToNodeFs(path8, initialAdd, wh, depth + 1);
          }
        }).on(EV.ERROR, this._boundHandleError);
        return new Promise((resolve, reject) => {
          if (!stream)
            return reject();
          stream.once(exports2.STR_END, () => {
            if (this.fsw.closed) {
              stream = void 0;
              return;
            }
            const wasThrottled = throttler ? throttler.clear() : false;
            resolve(void 0);
            previous.getChildren().filter((item) => {
              return item !== directory && !current.has(item);
            }).forEach((item) => {
              this.fsw._remove(directory, item);
            });
            stream = void 0;
            if (wasThrottled)
              this._handleRead(directory, false, wh, target, dir, depth, throttler);
          });
        });
      }
      /**
       * Read directory to add / remove files from `@watched` list and re-read it on change.
       * @param dir fs path
       * @param stats
       * @param initialAdd
       * @param depth relative to user-supplied path
       * @param target child path targeted for watch
       * @param wh Common watch helpers for this path
       * @param realpath
       * @returns closer for the watcher instance.
       */
      async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
        const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
        const tracked = parentDir.has(sysPath.basename(dir));
        if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
          this.fsw._emit(EV.ADD_DIR, dir, stats);
        }
        parentDir.add(sysPath.basename(dir));
        this.fsw._getWatchedDir(dir);
        let throttler;
        let closer;
        const oDepth = this.fsw.options.depth;
        if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
          if (!target) {
            await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
            if (this.fsw.closed)
              return;
          }
          closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
            if (stats2 && stats2.mtimeMs === 0)
              return;
            this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
          });
        }
        return closer;
      }
      /**
       * Handle added file, directory, or glob pattern.
       * Delegates call to _handleFile / _handleDir after checks.
       * @param path to file or ir
       * @param initialAdd was the file added at watch instantiation?
       * @param priorWh depth relative to user-supplied path
       * @param depth Child path actually targeted for watch
       * @param target Child path actually targeted for watch
       */
      async _addToNodeFs(path8, initialAdd, priorWh, depth, target) {
        const ready = this.fsw._emitReady;
        if (this.fsw._isIgnored(path8) || this.fsw.closed) {
          ready();
          return false;
        }
        const wh = this.fsw._getWatchHelpers(path8);
        if (priorWh) {
          wh.filterPath = (entry) => priorWh.filterPath(entry);
          wh.filterDir = (entry) => priorWh.filterDir(entry);
        }
        try {
          const stats = await statMethods[wh.statMethod](wh.watchPath);
          if (this.fsw.closed)
            return;
          if (this.fsw._isIgnored(wh.watchPath, stats)) {
            ready();
            return false;
          }
          const follow = this.fsw.options.followSymlinks;
          let closer;
          if (stats.isDirectory()) {
            const absPath = sysPath.resolve(path8);
            const targetPath = follow ? await (0, promises_1.realpath)(path8) : path8;
            if (this.fsw.closed)
              return;
            closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
            if (this.fsw.closed)
              return;
            if (absPath !== targetPath && targetPath !== void 0) {
              this.fsw._symlinkPaths.set(absPath, targetPath);
            }
          } else if (stats.isSymbolicLink()) {
            const targetPath = follow ? await (0, promises_1.realpath)(path8) : path8;
            if (this.fsw.closed)
              return;
            const parent = sysPath.dirname(wh.watchPath);
            this.fsw._getWatchedDir(parent).add(wh.watchPath);
            this.fsw._emit(EV.ADD, wh.watchPath, stats);
            closer = await this._handleDir(parent, stats, initialAdd, depth, path8, wh, targetPath);
            if (this.fsw.closed)
              return;
            if (targetPath !== void 0) {
              this.fsw._symlinkPaths.set(sysPath.resolve(path8), targetPath);
            }
          } else {
            closer = this._handleFile(wh.watchPath, stats, initialAdd);
          }
          ready();
          if (closer)
            this.fsw._addPathCloser(path8, closer);
          return false;
        } catch (error2) {
          if (this.fsw._handleError(error2)) {
            ready();
            return path8;
          }
        }
      }
    };
    exports2.NodeFsHandler = NodeFsHandler;
  }
});

// node_modules/chokidar/index.js
var require_chokidar = __commonJS({
  "node_modules/chokidar/index.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.FSWatcher = exports2.WatchHelper = void 0;
    exports2.watch = watch;
    var fs_1 = require("fs");
    var promises_1 = require("fs/promises");
    var events_1 = require_events();
    var sysPath = require("path");
    var readdirp_1 = require_readdirp();
    var handler_js_1 = require_handler();
    var SLASH2 = "/";
    var SLASH_SLASH = "//";
    var ONE_DOT = ".";
    var TWO_DOTS = "..";
    var STRING_TYPE = "string";
    var BACK_SLASH_RE = /\\/g;
    var DOUBLE_SLASH_RE = /\/\//;
    var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
    var REPLACER_RE = /^\.[/\\]/;
    function arrify(item) {
      return Array.isArray(item) ? item : [item];
    }
    var isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
    function createPattern(matcher) {
      if (typeof matcher === "function")
        return matcher;
      if (typeof matcher === "string")
        return (string) => matcher === string;
      if (matcher instanceof RegExp)
        return (string) => matcher.test(string);
      if (typeof matcher === "object" && matcher !== null) {
        return (string) => {
          if (matcher.path === string)
            return true;
          if (matcher.recursive) {
            const relative = sysPath.relative(matcher.path, string);
            if (!relative) {
              return false;
            }
            return !relative.startsWith("..") && !sysPath.isAbsolute(relative);
          }
          return false;
        };
      }
      return () => false;
    }
    function normalizePath(path8) {
      if (typeof path8 !== "string")
        throw new Error("string expected");
      path8 = sysPath.normalize(path8);
      path8 = path8.replace(/\\/g, "/");
      let prepend = false;
      if (path8.startsWith("//"))
        prepend = true;
      const DOUBLE_SLASH_RE2 = /\/\//;
      while (path8.match(DOUBLE_SLASH_RE2))
        path8 = path8.replace(DOUBLE_SLASH_RE2, "/");
      if (prepend)
        path8 = "/" + path8;
      return path8;
    }
    function matchPatterns(patterns, testString, stats) {
      const path8 = normalizePath(testString);
      for (let index6 = 0; index6 < patterns.length; index6++) {
        const pattern = patterns[index6];
        if (pattern(path8, stats)) {
          return true;
        }
      }
      return false;
    }
    function anymatch(matchers2, testString) {
      if (matchers2 == null) {
        throw new TypeError("anymatch: specify first argument");
      }
      const matchersArray = arrify(matchers2);
      const patterns = matchersArray.map((matcher) => createPattern(matcher));
      if (testString == null) {
        return (testString2, stats) => {
          return matchPatterns(patterns, testString2, stats);
        };
      }
      return matchPatterns(patterns, testString);
    }
    var unifyPaths = (paths_) => {
      const paths = arrify(paths_).flat();
      if (!paths.every((p) => typeof p === STRING_TYPE)) {
        throw new TypeError(`Non-string provided as watch path: ${paths}`);
      }
      return paths.map(normalizePathToUnix);
    };
    var toUnix = (string) => {
      let str = string.replace(BACK_SLASH_RE, SLASH2);
      let prepend = false;
      if (str.startsWith(SLASH_SLASH)) {
        prepend = true;
      }
      while (str.match(DOUBLE_SLASH_RE)) {
        str = str.replace(DOUBLE_SLASH_RE, SLASH2);
      }
      if (prepend) {
        str = SLASH2 + str;
      }
      return str;
    };
    var normalizePathToUnix = (path8) => toUnix(sysPath.normalize(toUnix(path8)));
    var normalizeIgnored = (cwd = "") => (path8) => {
      if (typeof path8 === "string") {
        return normalizePathToUnix(sysPath.isAbsolute(path8) ? path8 : sysPath.join(cwd, path8));
      } else {
        return path8;
      }
    };
    var getAbsolutePath = (path8, cwd) => {
      if (sysPath.isAbsolute(path8)) {
        return path8;
      }
      return sysPath.join(cwd, path8);
    };
    var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
    var DirEntry = class {
      constructor(dir, removeWatcher) {
        this.path = dir;
        this._removeWatcher = removeWatcher;
        this.items = /* @__PURE__ */ new Set();
      }
      add(item) {
        const { items } = this;
        if (!items)
          return;
        if (item !== ONE_DOT && item !== TWO_DOTS)
          items.add(item);
      }
      async remove(item) {
        const { items } = this;
        if (!items)
          return;
        items.delete(item);
        if (items.size > 0)
          return;
        const dir = this.path;
        try {
          await (0, promises_1.readdir)(dir);
        } catch (err2) {
          if (this._removeWatcher) {
            this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
          }
        }
      }
      has(item) {
        const { items } = this;
        if (!items)
          return;
        return items.has(item);
      }
      getChildren() {
        const { items } = this;
        if (!items)
          return [];
        return [...items.values()];
      }
      dispose() {
        this.items.clear();
        this.path = "";
        this._removeWatcher = handler_js_1.EMPTY_FN;
        this.items = EMPTY_SET;
        Object.freeze(this);
      }
    };
    var STAT_METHOD_F = "stat";
    var STAT_METHOD_L = "lstat";
    var WatchHelper = class {
      constructor(path8, follow, fsw) {
        this.fsw = fsw;
        const watchPath = path8;
        this.path = path8 = path8.replace(REPLACER_RE, "");
        this.watchPath = watchPath;
        this.fullWatchPath = sysPath.resolve(watchPath);
        this.dirParts = [];
        this.dirParts.forEach((parts) => {
          if (parts.length > 1)
            parts.pop();
        });
        this.followSymlinks = follow;
        this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
      }
      entryPath(entry) {
        return sysPath.join(this.watchPath, sysPath.relative(this.watchPath, entry.fullPath));
      }
      filterPath(entry) {
        const { stats } = entry;
        if (stats && stats.isSymbolicLink())
          return this.filterDir(entry);
        const resolvedPath = this.entryPath(entry);
        return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
      }
      filterDir(entry) {
        return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
      }
    };
    exports2.WatchHelper = WatchHelper;
    var FSWatcher = class extends events_1.EventEmitter {
      // Not indenting methods for history sake; for now.
      constructor(_opts = {}) {
        super();
        this.closed = false;
        this._closers = /* @__PURE__ */ new Map();
        this._ignoredPaths = /* @__PURE__ */ new Set();
        this._throttled = /* @__PURE__ */ new Map();
        this._streams = /* @__PURE__ */ new Set();
        this._symlinkPaths = /* @__PURE__ */ new Map();
        this._watched = /* @__PURE__ */ new Map();
        this._pendingWrites = /* @__PURE__ */ new Map();
        this._pendingUnlinks = /* @__PURE__ */ new Map();
        this._readyCount = 0;
        this._readyEmitted = false;
        const awf = _opts.awaitWriteFinish;
        const DEF_AWF = { stabilityThreshold: 2e3, pollInterval: 100 };
        const opts = {
          // Defaults
          persistent: true,
          ignoreInitial: false,
          ignorePermissionErrors: false,
          interval: 100,
          binaryInterval: 300,
          followSymlinks: true,
          usePolling: false,
          // useAsync: false,
          atomic: true,
          // NOTE: overwritten later (depends on usePolling)
          ..._opts,
          // Change format
          ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
          awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? { ...DEF_AWF, ...awf } : false
        };
        if (handler_js_1.isIBMi)
          opts.usePolling = true;
        if (opts.atomic === void 0)
          opts.atomic = !opts.usePolling;
        const envPoll = process.env.CHOKIDAR_USEPOLLING;
        if (envPoll !== void 0) {
          const envLower = envPoll.toLowerCase();
          if (envLower === "false" || envLower === "0")
            opts.usePolling = false;
          else if (envLower === "true" || envLower === "1")
            opts.usePolling = true;
          else
            opts.usePolling = !!envLower;
        }
        const envInterval = process.env.CHOKIDAR_INTERVAL;
        if (envInterval)
          opts.interval = Number.parseInt(envInterval, 10);
        let readyCalls = 0;
        this._emitReady = () => {
          readyCalls++;
          if (readyCalls >= this._readyCount) {
            this._emitReady = handler_js_1.EMPTY_FN;
            this._readyEmitted = true;
            process.nextTick(() => this.emit(handler_js_1.EVENTS.READY));
          }
        };
        this._emitRaw = (...args) => this.emit(handler_js_1.EVENTS.RAW, ...args);
        this._boundRemove = this._remove.bind(this);
        this.options = opts;
        this._nodeFsHandler = new handler_js_1.NodeFsHandler(this);
        Object.freeze(opts);
      }
      _addIgnoredPath(matcher) {
        if (isMatcherObject(matcher)) {
          for (const ignored of this._ignoredPaths) {
            if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) {
              return;
            }
          }
        }
        this._ignoredPaths.add(matcher);
      }
      _removeIgnoredPath(matcher) {
        this._ignoredPaths.delete(matcher);
        if (typeof matcher === "string") {
          for (const ignored of this._ignoredPaths) {
            if (isMatcherObject(ignored) && ignored.path === matcher) {
              this._ignoredPaths.delete(ignored);
            }
          }
        }
      }
      // Public methods
      /**
       * Adds paths to be watched on an existing FSWatcher instance.
       * @param paths_ file or file list. Other arguments are unused
       */
      add(paths_, _origAdd, _internal) {
        const { cwd } = this.options;
        this.closed = false;
        this._closePromise = void 0;
        let paths = unifyPaths(paths_);
        if (cwd) {
          paths = paths.map((path8) => {
            const absPath = getAbsolutePath(path8, cwd);
            return absPath;
          });
        }
        paths.forEach((path8) => {
          this._removeIgnoredPath(path8);
        });
        this._userIgnored = void 0;
        if (!this._readyCount)
          this._readyCount = 0;
        this._readyCount += paths.length;
        Promise.all(paths.map(async (path8) => {
          const res2 = await this._nodeFsHandler._addToNodeFs(path8, !_internal, void 0, 0, _origAdd);
          if (res2)
            this._emitReady();
          return res2;
        })).then((results) => {
          if (this.closed)
            return;
          results.forEach((item) => {
            if (item)
              this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
          });
        });
        return this;
      }
      /**
       * Close watchers or start ignoring events from specified paths.
       */
      unwatch(paths_) {
        if (this.closed)
          return this;
        const paths = unifyPaths(paths_);
        const { cwd } = this.options;
        paths.forEach((path8) => {
          if (!sysPath.isAbsolute(path8) && !this._closers.has(path8)) {
            if (cwd)
              path8 = sysPath.join(cwd, path8);
            path8 = sysPath.resolve(path8);
          }
          this._closePath(path8);
          this._addIgnoredPath(path8);
          if (this._watched.has(path8)) {
            this._addIgnoredPath({
              path: path8,
              recursive: true
            });
          }
          this._userIgnored = void 0;
        });
        return this;
      }
      /**
       * Close watchers and remove all listeners from watched paths.
       */
      close() {
        if (this._closePromise) {
          return this._closePromise;
        }
        this.closed = true;
        this.removeAllListeners();
        const closers = [];
        this._closers.forEach((closerList) => closerList.forEach((closer) => {
          const promise = closer();
          if (promise instanceof Promise)
            closers.push(promise);
        }));
        this._streams.forEach((stream) => stream.destroy());
        this._userIgnored = void 0;
        this._readyCount = 0;
        this._readyEmitted = false;
        this._watched.forEach((dirent) => dirent.dispose());
        this._closers.clear();
        this._watched.clear();
        this._streams.clear();
        this._symlinkPaths.clear();
        this._throttled.clear();
        this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
        return this._closePromise;
      }
      /**
       * Expose list of watched paths
       * @returns for chaining
       */
      getWatched() {
        const watchList = {};
        this._watched.forEach((entry, dir) => {
          const key4 = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
          const index6 = key4 || ONE_DOT;
          watchList[index6] = entry.getChildren().sort();
        });
        return watchList;
      }
      emitWithAll(event2, args) {
        this.emit(event2, ...args);
        if (event2 !== handler_js_1.EVENTS.ERROR)
          this.emit(handler_js_1.EVENTS.ALL, event2, ...args);
      }
      // Common helpers
      // --------------
      /**
       * Normalize and emit events.
       * Calling _emit DOES NOT MEAN emit() would be called!
       * @param event Type of event
       * @param path File or directory path
       * @param stats arguments to be passed with event
       * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
       */
      async _emit(event2, path8, stats) {
        if (this.closed)
          return;
        const opts = this.options;
        if (handler_js_1.isWindows)
          path8 = sysPath.normalize(path8);
        if (opts.cwd)
          path8 = sysPath.relative(opts.cwd, path8);
        const args = [path8];
        if (stats != null)
          args.push(stats);
        const awf = opts.awaitWriteFinish;
        let pw;
        if (awf && (pw = this._pendingWrites.get(path8))) {
          pw.lastChange = /* @__PURE__ */ new Date();
          return this;
        }
        if (opts.atomic) {
          if (event2 === handler_js_1.EVENTS.UNLINK) {
            this._pendingUnlinks.set(path8, [event2, ...args]);
            setTimeout(() => {
              this._pendingUnlinks.forEach((entry, path9) => {
                this.emit(...entry);
                this.emit(handler_js_1.EVENTS.ALL, ...entry);
                this._pendingUnlinks.delete(path9);
              });
            }, typeof opts.atomic === "number" ? opts.atomic : 100);
            return this;
          }
          if (event2 === handler_js_1.EVENTS.ADD && this._pendingUnlinks.has(path8)) {
            event2 = handler_js_1.EVENTS.CHANGE;
            this._pendingUnlinks.delete(path8);
          }
        }
        if (awf && (event2 === handler_js_1.EVENTS.ADD || event2 === handler_js_1.EVENTS.CHANGE) && this._readyEmitted) {
          const awfEmit = (err2, stats2) => {
            if (err2) {
              event2 = handler_js_1.EVENTS.ERROR;
              args[0] = err2;
              this.emitWithAll(event2, args);
            } else if (stats2) {
              if (args.length > 1) {
                args[1] = stats2;
              } else {
                args.push(stats2);
              }
              this.emitWithAll(event2, args);
            }
          };
          this._awaitWriteFinish(path8, awf.stabilityThreshold, event2, awfEmit);
          return this;
        }
        if (event2 === handler_js_1.EVENTS.CHANGE) {
          const isThrottled = !this._throttle(handler_js_1.EVENTS.CHANGE, path8, 50);
          if (isThrottled)
            return this;
        }
        if (opts.alwaysStat && stats === void 0 && (event2 === handler_js_1.EVENTS.ADD || event2 === handler_js_1.EVENTS.ADD_DIR || event2 === handler_js_1.EVENTS.CHANGE)) {
          const fullPath = opts.cwd ? sysPath.join(opts.cwd, path8) : path8;
          let stats2;
          try {
            stats2 = await (0, promises_1.stat)(fullPath);
          } catch (err2) {
          }
          if (!stats2 || this.closed)
            return;
          args.push(stats2);
        }
        this.emitWithAll(event2, args);
        return this;
      }
      /**
       * Common handler for errors
       * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
       */
      _handleError(error2) {
        const code = error2 && error2.code;
        if (error2 && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
          this.emit(handler_js_1.EVENTS.ERROR, error2);
        }
        return error2 || this.closed;
      }
      /**
       * Helper utility for throttling
       * @param actionType type being throttled
       * @param path being acted upon
       * @param timeout duration of time to suppress duplicate actions
       * @returns tracking object or false if action should be suppressed
       */
      _throttle(actionType, path8, timeout) {
        if (!this._throttled.has(actionType)) {
          this._throttled.set(actionType, /* @__PURE__ */ new Map());
        }
        const action2 = this._throttled.get(actionType);
        if (!action2)
          throw new Error("invalid throttle");
        const actionPath = action2.get(path8);
        if (actionPath) {
          actionPath.count++;
          return false;
        }
        let timeoutObject;
        const clear = () => {
          const item = action2.get(path8);
          const count = item ? item.count : 0;
          action2.delete(path8);
          clearTimeout(timeoutObject);
          if (item)
            clearTimeout(item.timeoutObject);
          return count;
        };
        timeoutObject = setTimeout(clear, timeout);
        const thr = { timeoutObject, clear, count: 0 };
        action2.set(path8, thr);
        return thr;
      }
      _incrReadyCount() {
        return this._readyCount++;
      }
      /**
       * Awaits write operation to finish.
       * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
       * @param path being acted upon
       * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
       * @param event
       * @param awfEmit Callback to be called when ready for event to be emitted.
       */
      _awaitWriteFinish(path8, threshold, event2, awfEmit) {
        const awf = this.options.awaitWriteFinish;
        if (typeof awf !== "object")
          return;
        const pollInterval = awf.pollInterval;
        let timeoutHandler;
        let fullPath = path8;
        if (this.options.cwd && !sysPath.isAbsolute(path8)) {
          fullPath = sysPath.join(this.options.cwd, path8);
        }
        const now = /* @__PURE__ */ new Date();
        const writes = this._pendingWrites;
        function awaitWriteFinishFn(prevStat) {
          (0, fs_1.stat)(fullPath, (err2, curStat) => {
            if (err2 || !writes.has(path8)) {
              if (err2 && err2.code !== "ENOENT")
                awfEmit(err2);
              return;
            }
            const now2 = Number(/* @__PURE__ */ new Date());
            if (prevStat && curStat.size !== prevStat.size) {
              writes.get(path8).lastChange = now2;
            }
            const pw = writes.get(path8);
            const df = now2 - pw.lastChange;
            if (df >= threshold) {
              writes.delete(path8);
              awfEmit(void 0, curStat);
            } else {
              timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
            }
          });
        }
        if (!writes.has(path8)) {
          writes.set(path8, {
            lastChange: now,
            cancelWait: () => {
              writes.delete(path8);
              clearTimeout(timeoutHandler);
              return event2;
            }
          });
          timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
        }
      }
      /**
       * Determines whether user has asked to ignore this path.
       */
      _isIgnored(path8, stats) {
        if (this.options.atomic && DOT_RE.test(path8))
          return true;
        if (!this._userIgnored) {
          const { cwd } = this.options;
          const ign = this.options.ignored;
          const ignored = (ign || []).map(normalizeIgnored(cwd));
          const ignoredPaths = [...this._ignoredPaths];
          const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
          this._userIgnored = anymatch(list, void 0);
        }
        return this._userIgnored(path8, stats);
      }
      _isntIgnored(path8, stat) {
        return !this._isIgnored(path8, stat);
      }
      /**
       * Provides a set of common helpers and properties relating to symlink handling.
       * @param path file or directory pattern being watched
       */
      _getWatchHelpers(path8) {
        return new WatchHelper(path8, this.options.followSymlinks, this);
      }
      // Directory helpers
      // -----------------
      /**
       * Provides directory tracking objects
       * @param directory path of the directory
       */
      _getWatchedDir(directory) {
        const dir = sysPath.resolve(directory);
        if (!this._watched.has(dir))
          this._watched.set(dir, new DirEntry(dir, this._boundRemove));
        return this._watched.get(dir);
      }
      // File helpers
      // ------------
      /**
       * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
       */
      _hasReadPermissions(stats) {
        if (this.options.ignorePermissionErrors)
          return true;
        return Boolean(Number(stats.mode) & 256);
      }
      /**
       * Handles emitting unlink events for
       * files and directories, and via recursion, for
       * files and directories within directories that are unlinked
       * @param directory within which the following item is located
       * @param item      base path of item/directory
       */
      _remove(directory, item, isDirectory) {
        const path8 = sysPath.join(directory, item);
        const fullPath = sysPath.resolve(path8);
        isDirectory = isDirectory != null ? isDirectory : this._watched.has(path8) || this._watched.has(fullPath);
        if (!this._throttle("remove", path8, 100))
          return;
        if (!isDirectory && this._watched.size === 1) {
          this.add(directory, item, true);
        }
        const wp = this._getWatchedDir(path8);
        const nestedDirectoryChildren = wp.getChildren();
        nestedDirectoryChildren.forEach((nested) => this._remove(path8, nested));
        const parent = this._getWatchedDir(directory);
        const wasTracked = parent.has(item);
        parent.remove(item);
        if (this._symlinkPaths.has(fullPath)) {
          this._symlinkPaths.delete(fullPath);
        }
        let relPath = path8;
        if (this.options.cwd)
          relPath = sysPath.relative(this.options.cwd, path8);
        if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
          const event2 = this._pendingWrites.get(relPath).cancelWait();
          if (event2 === handler_js_1.EVENTS.ADD)
            return;
        }
        this._watched.delete(path8);
        this._watched.delete(fullPath);
        const eventName = isDirectory ? handler_js_1.EVENTS.UNLINK_DIR : handler_js_1.EVENTS.UNLINK;
        if (wasTracked && !this._isIgnored(path8))
          this._emit(eventName, path8);
        this._closePath(path8);
      }
      /**
       * Closes all watchers for a path
       */
      _closePath(path8) {
        this._closeFile(path8);
        const dir = sysPath.dirname(path8);
        this._getWatchedDir(dir).remove(sysPath.basename(path8));
      }
      /**
       * Closes only file-specific watchers
       */
      _closeFile(path8) {
        const closers = this._closers.get(path8);
        if (!closers)
          return;
        closers.forEach((closer) => closer());
        this._closers.delete(path8);
      }
      _addPathCloser(path8, closer) {
        if (!closer)
          return;
        let list = this._closers.get(path8);
        if (!list) {
          list = [];
          this._closers.set(path8, list);
        }
        list.push(closer);
      }
      _readdirp(root5, opts) {
        if (this.closed)
          return;
        const options = { type: handler_js_1.EVENTS.ALL, alwaysStat: true, lstat: true, ...opts, depth: 0 };
        let stream = (0, readdirp_1.readdirp)(root5, options);
        this._streams.add(stream);
        stream.once(handler_js_1.STR_CLOSE, () => {
          stream = void 0;
        });
        stream.once(handler_js_1.STR_END, () => {
          if (stream) {
            this._streams.delete(stream);
            stream = void 0;
          }
        });
        return stream;
      }
    };
    exports2.FSWatcher = FSWatcher;
    function watch(paths, options = {}) {
      const watcher = new FSWatcher(options);
      watcher.add(paths);
      return watcher;
    }
    exports2.default = { watch, FSWatcher };
  }
});

// node_modules/ws/browser.js
var require_browser = __commonJS({
  "node_modules/ws/browser.js"(exports2, module2) {
    "use strict";
    module2.exports = function() {
      throw new Error(
        "ws does not work in the browser. Browser clients must use the native WebSocket object"
      );
    };
  }
});

// node_modules/@mdfriday/foundry/dist/index.js
var require_dist3 = __commonJS({
  "node_modules/@mdfriday/foundry/dist/index.js"(exports2, module2) {
    var ConfigError;
    var Config;
    var DefaultRootConfig;
    var Root;
    var __create3 = Object.create;
    var __defProp3 = Object.defineProperty;
    var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
    var __getOwnPropNames3 = Object.getOwnPropertyNames;
    var __getProtoOf3 = Object.getPrototypeOf;
    var __hasOwnProp3 = Object.prototype.hasOwnProperty;
    var __esm2 = (e2, t2) => function() {
      return e2 && (t2 = (0, e2[__getOwnPropNames3(e2)[0]])(e2 = 0)), t2;
    };
    var __export3 = (e2, t2) => {
      for (var n3 in t2) __defProp3(e2, n3, { get: t2[n3], enumerable: true });
    };
    var __copyProps3 = (e2, t2, n3, r) => {
      if (t2 && "object" == typeof t2 || "function" == typeof t2) for (let i of __getOwnPropNames3(t2)) __hasOwnProp3.call(e2, i) || i === n3 || __defProp3(e2, i, { get: () => t2[i], enumerable: !(r = __getOwnPropDesc3(t2, i)) || r.enumerable });
      return e2;
    };
    var __toESM3 = (e2, t2, n3) => (n3 = null != e2 ? __create3(__getProtoOf3(e2)) : {}, __copyProps3(!t2 && e2 && e2.__esModule ? n3 : __defProp3(n3, "default", { value: e2, enumerable: true }), e2));
    var __toCommonJS3 = (e2) => __copyProps3(__defProp3({}, "__esModule", { value: true }), e2);
    var init_type = __esm2({ "internal/domain/config/type.ts"() {
      new (ConfigError = class extends Error {
        constructor(e2, t2) {
          super(e2), this.code = t2, this.name = "ConfigError";
        }
      })("configuration not found", "CONFIG_NOT_FOUND"), new ConfigError("invalid configuration", "INVALID_CONFIG"), new ConfigError("workspace not found", "WORKSPACE_NOT_FOUND"), new ConfigError("configuration file not found", "CONFIG_FILE_NOT_FOUND"), new ConfigError("invalid configuration format", "INVALID_CONFIG_FORMAT");
    } });
    var init_config = __esm2({ "internal/domain/config/entity/config.ts"() {
      Config = class {
        constructor(e2, t2, n3, r, i, s2, a, o, l, c) {
          __publicField(this, "configSourceFs");
          __publicField(this, "provider");
          __publicField(this, "root");
          __publicField(this, "dir");
          __publicField(this, "module");
          __publicField(this, "service");
          __publicField(this, "social");
          __publicField(this, "language");
          __publicField(this, "taxonomy");
          __publicField(this, "markdown");
          this.configSourceFs = e2, this.provider = t2, this.root = n3, this.dir = r, this.module = i, this.service = s2, this.social = a, this.language = o, this.taxonomy = l, this.markdown = c;
        }
        fs() {
          return this.configSourceFs;
        }
        getProvider() {
          return this.provider;
        }
        theme() {
          return this.root.defaultTheme();
        }
        getDir() {
          return this.dir;
        }
        getRoot() {
          return this.root;
        }
        getModule() {
          return this.module;
        }
        getService() {
          return this.service;
        }
        getSocial() {
          return this.social;
        }
        getLanguage() {
          return this.language;
        }
        getTaxonomy() {
          return this.taxonomy;
        }
        getMarkdown() {
          return this.markdown;
        }
        setLanguage(e2) {
          this.language = e2;
        }
        setTaxonomy(e2) {
          this.taxonomy = e2;
        }
        setMarkdown(e2) {
          this.markdown = e2;
        }
        validate() {
          let e2 = true;
          return this.language && (e2 = e2 && this.language.validate()), this.markdown && (e2 = e2 && this.markdown.validate()), e2;
        }
      };
    } });
    var init_root = __esm2({ "internal/domain/config/vo/root.ts"() {
      DefaultRootConfig = { baseURL: "", title: "", theme: [], timeout: "30s", contentDir: "content", dataDir: "data", layoutDir: "layouts", staticDir: "static", archetypeDir: "archetypes", assetDir: "assets", publishDir: "public", buildDrafts: false, buildExpired: false, buildFuture: false, copyright: "", defaultContentLanguage: "en", defaultContentLanguageInSubdir: false, disableAliases: false, disablePathToLower: false, disableKinds: [], disableLanguages: [], renderSegments: [], disableHugoGeneratorInject: false, disableLiveReload: false, enableEmoji: false };
    } });
    var Module;
    var init_root2 = __esm2({ "internal/domain/config/entity/root.ts"() {
      init_root(), Root = class {
        constructor(e2, t2 = {}) {
          __publicField(this, "rootConfig");
          __publicField(this, "rootParams");
          this.rootConfig = e2, this.rootParams = t2;
        }
        defaultTheme() {
          return this.rootConfig.theme.length > 0 ? this.rootConfig.theme[0] : "";
        }
        compiledTimeout() {
          const e2 = this.rootConfig.timeout;
          if (/^\d+$/.test(e2)) return 1e3 * parseInt(e2, 10);
          const t2 = e2.match(/^(\d+)([smh])$/);
          if (t2) {
            const e3 = parseInt(t2[1], 10);
            switch (t2[2]) {
              case "s":
                return 1e3 * e3;
              case "m":
                return 60 * e3 * 1e3;
              case "h":
                return 60 * e3 * 60 * 1e3;
            }
          }
          return 3e4;
        }
        baseUrl() {
          return this.rootConfig.baseURL;
        }
        configParams() {
          return this.rootParams;
        }
        siteTitle() {
          return this.rootConfig.title;
        }
        getRootConfig() {
          return this.rootConfig;
        }
        getThemes() {
          return this.rootConfig.theme;
        }
        getDefaultContentLanguage() {
          return this.rootConfig.defaultContentLanguage;
        }
        shouldBuildDrafts() {
          return this.rootConfig.buildDrafts;
        }
        shouldBuildFuture() {
          return this.rootConfig.buildFuture;
        }
        shouldBuildExpired() {
          return this.rootConfig.buildExpired;
        }
      };
    } });
    var init_module = __esm2({ "internal/domain/config/vo/module.ts"() {
    } });
    var DefaultServiceConfig;
    var Service;
    var init_module2 = __esm2({ "internal/domain/config/entity/module.ts"() {
      init_module(), Module = class {
        constructor(e2) {
          __publicField(this, "moduleConfig");
          this.moduleConfig = e2;
        }
        importPaths() {
          return this.moduleConfig.imports.map((e2) => e2.path);
        }
        getModuleConfig() {
          return this.moduleConfig;
        }
        getImports() {
          return this.moduleConfig.imports;
        }
        getMounts() {
          return this.moduleConfig.mounts;
        }
        importCount() {
          return this.moduleConfig.imports.length;
        }
        mountCount() {
          return this.moduleConfig.mounts.length;
        }
        hasImports() {
          return this.moduleConfig.imports.length > 0;
        }
        hasMounts() {
          return this.moduleConfig.mounts.length > 0;
        }
        findImport(e2) {
          return this.moduleConfig.imports.find((t2) => t2.path === e2);
        }
        findMount(e2) {
          return this.moduleConfig.mounts.find((t2) => t2.source === e2);
        }
      };
    } });
    var init_service3 = __esm2({ "internal/domain/config/vo/service.ts"() {
      DefaultServiceConfig = { disqus: { disable: false, shortname: "" }, googleAnalytics: { disable: false, respectDoNotTrack: false, id: "" }, rss: { limit: 0 }, x: { respectDoNotTrack: false, disableInlineCSS: false } };
    } });
    var LTR_LANGUAGES;
    var RTL_LANGUAGES;
    var ALL_LANGUAGES;
    var LANGUAGE_MAP;
    var CODE_NAME_MAP;
    var DefaultLanguageService;
    var serviceInstance;
    var init_service22 = __esm2({ "internal/domain/config/entity/service.ts"() {
      init_service3(), Service = class {
        constructor(e2) {
          __publicField(this, "serviceConfig");
          this.serviceConfig = e2;
        }
        isGoogleAnalyticsEnabled() {
          return !this.serviceConfig.googleAnalytics.disable;
        }
        googleAnalyticsID() {
          return this.serviceConfig.googleAnalytics.id;
        }
        isGoogleAnalyticsRespectDoNotTrack() {
          return this.serviceConfig.googleAnalytics.respectDoNotTrack;
        }
        isDisqusEnabled() {
          return !this.serviceConfig.disqus.disable;
        }
        disqusShortname() {
          return this.serviceConfig.disqus.shortname;
        }
        isXRespectDoNotTrack() {
          return this.serviceConfig.x.respectDoNotTrack;
        }
        isXDisableInlineCSS() {
          return this.serviceConfig.x.disableInlineCSS;
        }
        rssLimit() {
          return this.serviceConfig.rss.limit;
        }
        getServiceConfig() {
          return this.serviceConfig;
        }
        getGoogleAnalytics() {
          return this.serviceConfig.googleAnalytics;
        }
        getDisqus() {
          return this.serviceConfig.disqus;
        }
        getRSS() {
          return this.serviceConfig.rss;
        }
        hasEnabledServices() {
          return this.isGoogleAnalyticsEnabled() || this.isDisqusEnabled();
        }
      };
    } });
    var init_data = __esm2({ "pkg/lang/data.ts"() {
      LTR_LANGUAGES = [{ code: "en", name: "English", direction: "ltr", englishName: "English" }, { code: "zh", name: "\u4E2D\u6587", direction: "ltr", englishName: "Chinese" }, { code: "ja", name: "\u65E5\u672C\u8A9E", direction: "ltr", englishName: "Japanese" }, { code: "ko", name: "\uD55C\uAD6D\uC5B4", direction: "ltr", englishName: "Korean" }, { code: "fr", name: "Fran\xE7ais", direction: "ltr", englishName: "French" }, { code: "de", name: "Deutsch", direction: "ltr", englishName: "German" }, { code: "es", name: "Espa\xF1ol", direction: "ltr", englishName: "Spanish" }, { code: "pt", name: "Portugu\xEAs", direction: "ltr", englishName: "Portuguese" }, { code: "ru", name: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439", direction: "ltr", englishName: "Russian" }, { code: "hi", name: "\u0939\u093F\u0902\u0926\u0940", direction: "ltr", englishName: "Hindi" }, { code: "it", name: "Italiano", direction: "ltr", englishName: "Italian" }, { code: "nl", name: "Nederlands", direction: "ltr", englishName: "Dutch" }, { code: "tr", name: "T\xFCrk\xE7e", direction: "ltr", englishName: "Turkish" }, { code: "vi", name: "Ti\u1EBFng Vi\u1EC7t", direction: "ltr", englishName: "Vietnamese" }, { code: "th", name: "\u0E44\u0E17\u0E22", direction: "ltr", englishName: "Thai" }], RTL_LANGUAGES = [], ALL_LANGUAGES = [...LTR_LANGUAGES, ...RTL_LANGUAGES], LANGUAGE_MAP = ALL_LANGUAGES.reduce((e2, t2) => (e2[t2.code] = t2, e2), {}), CODE_NAME_MAP = ALL_LANGUAGES.reduce((e2, t2) => (e2[t2.code] = t2.name, e2), {});
    } });
    function getLanguageService() {
      return serviceInstance || (serviceInstance = new DefaultLanguageService()), serviceInstance;
    }
    function createLanguageService() {
      return new DefaultLanguageService();
    }
    var lang;
    var languages;
    var init_service32 = __esm2({ "pkg/lang/service.ts"() {
      init_data(), DefaultLanguageService = class {
        getAllCodes() {
          return ALL_LANGUAGES.map((e2) => e2.code);
        }
        getAllNames() {
          return ALL_LANGUAGES.map((e2) => e2.name);
        }
        getCodesByDirection(e2) {
          return ("ltr" === e2 ? LTR_LANGUAGES : RTL_LANGUAGES).map((e3) => e3.code);
        }
        getNamesByDirection(e2) {
          return ("ltr" === e2 ? LTR_LANGUAGES : RTL_LANGUAGES).map((e3) => e3.name);
        }
        getCodeNameMap() {
          return { ...CODE_NAME_MAP };
        }
        getCodeNameMapByDirection(e2) {
          return ("ltr" === e2 ? LTR_LANGUAGES : RTL_LANGUAGES).reduce((e3, t2) => (e3[t2.code] = t2.name, e3), {});
        }
        getNameByCode(e2) {
          var _a6;
          return (_a6 = LANGUAGE_MAP[e2]) == null ? void 0 : _a6.name;
        }
        getLanguageInfo(e2) {
          const t2 = LANGUAGE_MAP[e2];
          return t2 ? { ...t2 } : void 0;
        }
        isSupported(e2) {
          return e2 in LANGUAGE_MAP;
        }
        getDirection(e2) {
          var _a6;
          return (_a6 = LANGUAGE_MAP[e2]) == null ? void 0 : _a6.direction;
        }
        isLTR(e2) {
          var _a6;
          return "ltr" === ((_a6 = LANGUAGE_MAP[e2]) == null ? void 0 : _a6.direction);
        }
        isRTL(e2) {
          var _a6;
          return "rtl" === ((_a6 = LANGUAGE_MAP[e2]) == null ? void 0 : _a6.direction);
        }
      }, serviceInstance = null;
    } });
    var lang_exports = {};
    __export3(lang_exports, { ALL_LANGUAGES: () => ALL_LANGUAGES, CODE_NAME_MAP: () => CODE_NAME_MAP, DefaultLanguageService: () => DefaultLanguageService, LANGUAGE_MAP: () => LANGUAGE_MAP, LTR_LANGUAGES: () => LTR_LANGUAGES, RTL_LANGUAGES: () => RTL_LANGUAGES, createLanguageService: () => createLanguageService, getLanguageService: () => getLanguageService, lang: () => lang, languages: () => languages });
    var DefaultLanguageConfig;
    var Language;
    var init_lang = __esm2({ "pkg/lang/index.ts"() {
      init_data(), init_service32(), init_service32(), lang = getLanguageService(), languages = { getAllCodes: () => lang.getAllCodes(), getAllNames: () => lang.getAllNames(), getCodesByDirection: (e2) => lang.getCodesByDirection(e2), getNamesByDirection: (e2) => lang.getNamesByDirection(e2), getCodeNameMap: () => lang.getCodeNameMap(), getCodeNameMapByDirection: (e2) => lang.getCodeNameMapByDirection(e2), getNameByCode: (e2) => lang.getNameByCode(e2), getLanguageInfo: (e2) => lang.getLanguageInfo(e2), isSupported: (e2) => lang.isSupported(e2), getDirection: (e2) => lang.getDirection(e2), isLTR: (e2) => lang.isLTR(e2), isRTL: (e2) => lang.isRTL(e2) };
    } });
    var init_language = __esm2({ "internal/domain/config/vo/language.ts"() {
      init_lang(), DefaultLanguageConfig = { languageCode: "en", languageName: "English", title: "", weight: 0, contentDir: "content", disabled: false, params: {} };
    } });
    var DefaultTaxonomies;
    var init_language2 = __esm2({ "internal/domain/config/entity/language.ts"() {
      init_language(), Language = class {
        constructor(e2) {
          __publicField(this, "defaultLang");
          __publicField(this, "configs");
          __publicField(this, "indices");
          this.configs = e2, this.defaultLang = this.calculateDefaultLanguage(), this.indices = [], this.setIndices();
        }
        calculateDefaultLanguage() {
          if (0 === Object.keys(this.configs).length) return "en";
          let e2 = "", t2 = Number.MAX_SAFE_INTEGER;
          for (const [n3, r] of Object.entries(this.configs)) r.weight < t2 && (t2 = r.weight, e2 = n3);
          return e2 || Object.keys(this.configs)[0];
        }
        languages() {
          return Object.values(this.configs);
        }
        defaultLanguage() {
          return this.defaultLang;
        }
        isLanguageValid(e2) {
          return Object.prototype.hasOwnProperty.call(this.configs, e2);
        }
        otherLanguageKeys() {
          return Object.keys(this.configs).filter((e2) => e2 !== this.defaultLang);
        }
        getRelDir(e2, t2) {
          const n3 = this.configs[t2];
          if (!n3) throw new Error(`Language "${t2}" not found`);
          return n3.contentDir || "content";
        }
        validate() {
          return e2 = this.configs, t2 = this.defaultLang, Object.prototype.hasOwnProperty.call(e2, t2);
          var e2, t2;
        }
        setIndices() {
          const e2 = [];
          this.configs[this.defaultLang] && e2.push(this.defaultLang);
          for (const t2 of Object.keys(this.configs)) t2 !== this.defaultLang && e2.push(t2);
          this.indices = e2;
        }
        languageKeys() {
          return [...this.indices];
        }
        languageIndexes() {
          return this.indices.map((e2, t2) => t2);
        }
        getLanguageIndex(e2) {
          const t2 = this.indices.indexOf(e2);
          if (-1 === t2) throw new Error("Language not found in indices");
          return t2;
        }
        getLanguageByIndex(e2) {
          if (e2 < 0 || e2 >= this.indices.length) throw new Error("Language index out of range");
          return this.indices[e2];
        }
        getLanguageName(e2) {
          const t2 = this.configs[e2];
          return t2 ? t2.languageName : "";
        }
        getLanguageConfig(e2) {
          return this.configs[e2];
        }
        getConfigs() {
          return this.configs;
        }
      };
    } });
    function cleanTreeKey(...e2) {
      let t2 = "";
      return e2.length > 0 && (t2 = e2[0], e2.length > 1 && (t2 = e2.join("/"))), t2 = t2.replace(/^[.\s/]+|[.\s/]+$/g, ""), t2 = t2.toLowerCase(), t2 = t2.replace(/\\/g, "/"), "" === t2 || "/" === t2 ? "" : (t2.startsWith("/") || (t2 = "/" + t2), t2);
    }
    var Taxonomy;
    var init_taxonomy = __esm2({ "internal/domain/config/vo/taxonomy.ts"() {
      DefaultTaxonomies = { tag: "tags", category: "categories" };
    } });
    function newTaxonomy(e2) {
      const t2 = function(e3) {
        if (e3.taxonomies && "object" == typeof e3.taxonomies) {
          const t3 = {};
          for (const [n3, r] of Object.entries(e3.taxonomies)) "string" == typeof r && (t3[n3] = r);
          return t3;
        }
        return { ...DefaultTaxonomies };
      }(e2);
      return new Taxonomy(t2);
    }
    var DefaultSocialPlatformTemplates;
    var Social;
    var init_taxonomy2 = __esm2({ "internal/domain/config/entity/taxonomy.ts"() {
      init_taxonomy(), Taxonomy = class {
        constructor(e2) {
          __publicField(this, "taxonomies");
          __publicField(this, "views");
          __publicField(this, "viewsByTreeKey");
          this.taxonomies = e2, this.views = [], this.viewsByTreeKey = {}, this.setupViews();
        }
        getViews() {
          return [...this.views];
        }
        getTaxonomies() {
          return { ...this.taxonomies };
        }
        getViewByTreeKey(e2) {
          return this.viewsByTreeKey[e2];
        }
        hasTaxonomy(e2) {
          return Object.prototype.hasOwnProperty.call(this.taxonomies, e2);
        }
        getPluralForm(e2) {
          return this.taxonomies[e2];
        }
        getSingularForm(e2) {
          for (const [t2, n3] of Object.entries(this.taxonomies)) if (n3 === e2) return t2;
        }
        getSingularForms() {
          return Object.keys(this.taxonomies);
        }
        getPluralForms() {
          return Object.values(this.taxonomies);
        }
        setupViews() {
          this.views = function(e2) {
            const t2 = [];
            for (const [n3, r] of Object.entries(e2)) t2.push({ singular: n3, plural: r, pluralTreeKey: cleanTreeKey(r) });
            return t2.sort((e3, t3) => e3.plural.localeCompare(t3.plural)), t2;
          }(this.taxonomies), this.viewsByTreeKey = {};
          for (const e2 of this.views) this.viewsByTreeKey[e2.pluralTreeKey] = e2;
        }
        getViewCount() {
          return this.views.length;
        }
        isEmpty() {
          return 0 === Object.keys(this.taxonomies).length;
        }
      };
    } });
    var init_social = __esm2({ "internal/domain/config/vo/social.ts"() {
      DefaultSocialPlatformTemplates = [{ id: "email", title: "Email me" }, { id: "facebook", title: "Facebook" }, { id: "github", title: "GitHub" }, { id: "gitlab", title: "GitLab" }, { id: "bitbucket", title: "Bitbucket" }, { id: "twitter", title: "Twitter" }, { id: "slack", title: "Slack" }, { id: "reddit", title: "Reddit" }, { id: "linkedin", title: "LinkedIn" }, { id: "xing", title: "Xing" }, { id: "stackoverflow", title: "StackOverflow" }, { id: "snapchat", title: "Snapchat" }, { id: "instagram", title: "Instagram" }, { id: "youtube", title: "Youtube" }, { id: "soundcloud", title: "SoundCloud" }, { id: "spotify", title: "Spotify" }, { id: "bandcamp", title: "Bandcamp" }, { id: "itchio", title: "Itch.io" }, { id: "keybase", title: "Keybase" }, { id: "vk", title: "VK" }, { id: "paypal", title: "PayPal" }, { id: "telegram", title: "Telegram" }, { id: "500px", title: "500px" }, { id: "codepen", title: "CodePen" }, { id: "kaggle", title: "kaggle" }, { id: "mastodon", title: "Mastodon" }, { id: "weibo", title: "Weibo" }, { id: "medium", title: "Medium" }, { id: "discord", title: "Discord" }, { id: "strava", title: "Strava" }, { id: "steam", title: "Steam" }, { id: "quora", title: "Quora" }, { id: "amazonwishlist", title: "Amazon Wishlist" }, { id: "slideshare", title: "Slideshare" }, { id: "angellist", title: "AngelList" }, { id: "about", title: "About" }, { id: "lastfm", title: "Last.fm" }, { id: "bluesky", title: "Bluesky" }, { id: "goodreads", title: "Goodreads" }];
    } });
    var DefaultMarkdownPlugins;
    var DefaultMarkdownConfig;
    var Markdown;
    var init_social2 = __esm2({ "internal/domain/config/entity/social.ts"() {
      init_social(), Social = class {
        constructor(e2) {
          __publicField(this, "socialConfig");
          this.socialConfig = e2;
        }
        getUserConfig() {
          return this.socialConfig.userConfig;
        }
        getPlatformTemplates() {
          return this.socialConfig.platformTemplates;
        }
        getPlatformTemplate(e2) {
          return t2 = e2, DefaultSocialPlatformTemplates.find((e3) => e3.id === t2);
          var t2;
        }
        isPlatformConfigured(e2) {
          return e2 in this.socialConfig.userConfig;
        }
        getConfiguredPlatforms() {
          return Object.keys(this.socialConfig.userConfig);
        }
        getProcessedSocialLinks() {
          const e2 = [];
          for (const [t2, n3] of Object.entries(this.socialConfig.userConfig)) {
            const r = this.getPlatformTemplate(t2);
            r ? e2.push({ id: t2, title: r.title, url: n3.link }) : e2.push({ id: t2, title: t2.charAt(0).toUpperCase() + t2.slice(1), url: n3.link });
          }
          return e2;
        }
        getSocialLink(e2) {
          const t2 = this.socialConfig.userConfig[e2];
          if (!t2) return;
          const n3 = this.getPlatformTemplate(e2);
          return n3 ? { id: e2, title: n3.title, url: t2.link } : { id: e2, title: e2.charAt(0).toUpperCase() + e2.slice(1), url: t2.link };
        }
        hasSocialLinks() {
          return Object.keys(this.socialConfig.userConfig).length > 0;
        }
        getSocialLinkCount() {
          return Object.keys(this.socialConfig.userConfig).length;
        }
        getAvailablePlatforms() {
          return this.socialConfig.platformTemplates.map((e2) => e2.id);
        }
        getSocialConfig() {
          return this.socialConfig;
        }
      };
    } });
    var init_markdown2 = __esm2({ "internal/domain/config/vo/markdown.ts"() {
      DefaultMarkdownPlugins = { wikilink: true, tag: true, callout: true, latex: true, mermaid: true }, DefaultMarkdownConfig = { useInternalRenderer: false, plugins: { ...DefaultMarkdownPlugins } };
    } });
    var import_path9;
    var DEFAULT_PUBLISH_DIR;
    var Dir;
    var DefaultConfigProvider;
    var path22;
    var ConfigLoader;
    var ConfigSourceDescriptor;
    var path32;
    var init_markdown22 = __esm2({ "internal/domain/config/entity/markdown.ts"() {
      init_markdown2(), Markdown = class {
        constructor(e2) {
          __publicField(this, "markdownConfig");
          this.markdownConfig = e2;
        }
        useInternalRenderer() {
          return this.markdownConfig.useInternalRenderer;
        }
        isWikilinkEnabled() {
          return this.markdownConfig.plugins.wikilink;
        }
        isTagEnabled() {
          return this.markdownConfig.plugins.tag;
        }
        isCalloutEnabled() {
          return this.markdownConfig.plugins.callout;
        }
        isLatexEnabled() {
          return this.markdownConfig.plugins.latex;
        }
        isMermaidEnabled() {
          return this.markdownConfig.plugins.mermaid;
        }
        getMarkdownConfig() {
          return this.markdownConfig;
        }
        getPlugins() {
          return this.markdownConfig.plugins;
        }
        hasEnabledPlugins() {
          const e2 = this.markdownConfig.plugins;
          return e2.wikilink || e2.tag || e2.callout || e2.latex || e2.mermaid;
        }
        validate() {
          return !this.markdownConfig.useInternalRenderer || this.hasEnabledPlugins();
        }
      };
    } });
    var init_dir = __esm2({ "internal/domain/config/entity/dir.ts"() {
      import_path9 = __toESM3(require("path")), DEFAULT_PUBLISH_DIR = "public", Dir = class {
        constructor(e2, t2, n3 = DEFAULT_PUBLISH_DIR) {
          __publicField(this, "workingDir");
          __publicField(this, "themesDir");
          __publicField(this, "publishDir");
          this.workingDir = e2, this.themesDir = t2, this.publishDir = n3;
        }
        getWorkingDir() {
          return import_path9.default.resolve(this.workingDir);
        }
        getThemesDir() {
          return import_path9.default.resolve(this.themesDir);
        }
        getThemesCacheDir() {
          return import_path9.default.resolve(this.themesDir, ".cache");
        }
        getPublishDir() {
          return import_path9.default.resolve(this.publishDir);
        }
      };
    } });
    var init_provider = __esm2({ "internal/domain/config/factory/provider.ts"() {
      DefaultConfigProvider = class {
        constructor(e2 = {}) {
          __publicField(this, "root");
          __publicField(this, "keyCache");
          this.root = this.prepareParams(e2), this.keyCache = /* @__PURE__ */ new Map();
        }
        prepareParams(e2) {
          const t2 = {};
          for (const [n3, r] of Object.entries(e2)) t2[n3.toLowerCase()] = r;
          return t2;
        }
        getNestedKeyAndMap(e2, t2) {
          let n3;
          this.keyCache.has(e2) ? n3 = this.keyCache.get(e2) : (n3 = e2.split("."), this.keyCache.set(e2, n3));
          let r = this.root;
          for (let e3 = 0; e3 < n3.length - 1; e3++) {
            const i = n3[e3];
            if (!(i in r)) {
              if (!t2) return ["", null];
              r[i] = {};
            }
            const s2 = r[i];
            if ("object" != typeof s2 || null === s2) return ["", null];
            r = s2;
          }
          return [n3[n3.length - 1], r];
        }
        getString(e2) {
          const t2 = this.get(e2);
          return String(t2 || "");
        }
        getInt(e2) {
          const t2 = this.get(e2), n3 = Number(t2);
          return isNaN(n3) ? 0 : Math.floor(n3);
        }
        getBool(e2) {
          const t2 = this.get(e2);
          return "boolean" == typeof t2 ? t2 : "string" == typeof t2 ? "true" === t2.toLowerCase() : Boolean(t2);
        }
        getParams(e2) {
          const t2 = this.get(e2);
          return t2 && "object" == typeof t2 ? t2 : {};
        }
        getStringMap(e2) {
          const t2 = this.get(e2);
          return t2 && "object" == typeof t2 ? t2 : {};
        }
        getStringMapString(e2) {
          const t2 = this.get(e2);
          if (t2 && "object" == typeof t2) {
            const e3 = {};
            for (const [n3, r] of Object.entries(t2)) e3[n3] = String(r);
            return e3;
          }
          return {};
        }
        getStringSlice(e2) {
          const t2 = this.get(e2);
          return Array.isArray(t2) ? t2.map((e3) => String(e3)) : [];
        }
        get(e2) {
          if ("" === e2) return this.root;
          const [t2, n3] = this.getNestedKeyAndMap(e2.toLowerCase(), false);
          return null !== n3 ? n3[t2] : void 0;
        }
        set(e2, t2) {
          const n3 = e2.toLowerCase();
          if ("" === n3) return void (t2 && "object" == typeof t2 ? Object.assign(this.root, this.prepareParams(t2)) : this.root[n3] = t2);
          const [r, i] = this.getNestedKeyAndMap(n3, true);
          null !== i && (r in i && "object" == typeof i[r] && "object" == typeof t2 && null !== t2 ? Object.assign(i[r], t2) : i[r] = t2);
        }
        keys() {
          return Object.keys(this.root);
        }
        merge(e2, t2) {
          const n3 = e2.toLowerCase();
          if ("" === n3) return void (t2 && "object" == typeof t2 && Object.assign(this.root, this.prepareParams(t2)));
          const [r, i] = this.getNestedKeyAndMap(n3, true);
          null !== i && (r in i && "object" == typeof i[r] && "object" == typeof t2 && null !== t2 ? Object.assign(i[r], t2) : i[r] = t2);
        }
        setDefaults(e2) {
          const t2 = this.prepareParams(e2);
          for (const [e3, n3] of Object.entries(t2)) e3 in this.root || (this.root[e3] = n3);
        }
        setDefaultMergeStrategy() {
        }
        walkParams(e2) {
          const t2 = (n3) => {
            if (n3 && "object" == typeof n3 && !Array.isArray(n3)) {
              if (e2(n3)) return true;
              for (const e3 of Object.values(n3)) if (t2(e3)) return true;
            }
            return false;
          };
          t2(this.root);
        }
        isSet(e2) {
          const [t2, n3] = this.getNestedKeyAndMap(e2.toLowerCase(), false);
          return null !== n3 && t2 in n3;
        }
      };
    } });
    var init_loader = __esm2({ "internal/domain/config/factory/loader.ts"() {
      init_provider(), path22 = __toESM3(require("path")), ConfigLoader = class {
        constructor(e2, t2) {
          __publicField(this, "cfg");
          __publicField(this, "sourceDescriptor");
          __publicField(this, "baseDirs");
          this.cfg = new DefaultConfigProvider(), this.sourceDescriptor = e2, this.baseDirs = t2;
        }
        async loadConfigByDefault() {
          const e2 = this.sourceDescriptor.filename();
          if (await this.loadProvider(e2), this.applyDefaultConfig(), this.cfg.setDefaultMergeStrategy(), !this.cfg.isSet("languages")) {
            const e3 = this.cfg.getString("defaultContentLanguage");
            this.cfg.set("languages", { [e3]: {} });
          }
          return this.cfg;
        }
        deleteMergeStrategies() {
          this.cfg.walkParams((e2) => false);
        }
        async loadProvider(e2) {
          const t2 = this.baseDirs.workingDir;
          let n3;
          n3 = path22.isAbsolute(e2) ? e2 : path22.join(t2, e2);
          let r = "";
          if ("" !== path22.extname(e2) && await this.fileExists(n3) && (r = n3), "" === r) throw new Error("Unable to locate config file or config directory.");
          const i = await this.loadConfigFromFile(r);
          this.cfg.set("", i);
        }
        applyDefaultConfig() {
          this.cfg.setDefaults({ baseURL: "", cleanDestinationDir: false, watch: false, contentDir: "content", resourceDir: "resources", publishDir: "public", publishDirOrig: "public", themesDir: "themes", assetDir: "assets", layoutDir: "layouts", i18nDir: "i18n", dataDir: "data", archetypeDir: "archetypes", configDir: "config", staticDir: "static", buildDrafts: false, buildFuture: false, buildExpired: false, params: {}, environment: "production", uglyURLs: false, verbose: false, ignoreCache: false, canonifyURLs: false, relativeURLs: false, removePathAccents: false, titleCaseStyle: "AP", taxonomies: { tag: "tags", category: "categories" }, permalinks: {}, sitemap: { priority: -1, filename: "sitemap.xml" }, menus: {}, disableLiveReload: false, pluralizeListTitles: true, capitalizeListTitles: true, forceSyncStatic: false, footnoteAnchorPrefix: "", footnoteReturnLinkContents: "", newContentEditor: "", paginate: 10, paginatePath: "page", summaryLength: 70, rssLimit: -1, sectionPagesMenu: "", disablePathToLower: false, hasCJKLanguage: false, enableEmoji: false, defaultContentLanguage: "en", defaultContentLanguageInSubdir: false, enableMissingTranslationPlaceholders: false, enableGitInfo: false, ignoreFiles: [], disableAliases: false, debug: false, disableFastRender: false, timeout: "30s", timeZone: "", enableInlineShortcodes: false });
        }
        async fileExists(e2) {
          try {
            const t2 = this.sourceDescriptor.fs();
            return !(await t2.stat(e2)).isDir();
          } catch (e3) {
            return false;
          }
        }
        async loadConfigFromFile(e2) {
          const t2 = this.sourceDescriptor.fs(), n3 = await t2.open(e2);
          try {
            const e3 = new Uint8Array(1048576), { bytesRead: t3 } = await n3.read(e3), r = new TextDecoder().decode(e3.slice(0, t3));
            try {
              return JSON.parse(r);
            } catch (e4) {
              return {};
            }
          } finally {
            await n3.close();
          }
        }
      };
    } });
    var init_sourcedescriptor = __esm2({ "internal/domain/config/factory/sourcedescriptor.ts"() {
      ConfigSourceDescriptor = class {
        constructor(e2, t2) {
          __publicField(this, "fileSystem");
          __publicField(this, "configFilename");
          this.fileSystem = e2, this.configFilename = t2;
        }
        fs() {
          return this.fileSystem;
        }
        filename() {
          return this.configFilename;
        }
      };
    } });
    async function loadConfigWithParams(e2, t2, n3, r, i = {}) {
      const s2 = { workingDir: path32.resolve(n3), modulesDir: path32.resolve(r), publishDir: path32.resolve(DEFAULT_PUBLISH_DIR), cacheDir: "" };
      s2.cacheDir = await async function(e3, t3) {
        if ("" !== t3) return t3;
        const n4 = process.env.HOME || process.env.USERPROFILE || "", r3 = path32.join(n4, ".cache", "mdf");
        try {
          return await e3.mkdirAll(r3, 493), r3;
        } catch (e4) {
          return path32.join("/tmp", "hugo-cache");
        }
      }(e2, s2.cacheDir);
      const a = new ConfigLoader(function(e3, t3) {
        return new ConfigSourceDescriptor(e3, t3);
      }(e2, t2), s2);
      try {
        const t3 = await a.loadConfigByDefault();
        for (const [e3, n5] of Object.entries(i)) t3.set(e3, n5);
        const n4 = path32.resolve(t3.get("publishDir") || DEFAULT_PUBLISH_DIR);
        return await e2.mkdirAll(n4, 511), function(e3, t4, n5, r3, i2, s3, a2, o, l, c) {
          return new Config(e3, t4, n5, r3, i2, s3, a2, o, l, c);
        }(e2, t3, function(e3, t4 = {}) {
          const n5 = function(e4) {
            return { baseURL: e4.baseurl || DefaultRootConfig.baseURL, title: e4.title || DefaultRootConfig.title, theme: e4.theme || DefaultRootConfig.theme, timeout: e4.timeout || DefaultRootConfig.timeout, contentDir: e4.contentDir || DefaultRootConfig.contentDir, dataDir: e4.dataDir || DefaultRootConfig.dataDir, layoutDir: e4.layoutDir || DefaultRootConfig.layoutDir, staticDir: e4.staticDir || DefaultRootConfig.staticDir, archetypeDir: e4.archetypeDir || DefaultRootConfig.archetypeDir, assetDir: e4.assetDir || DefaultRootConfig.assetDir, publishDir: e4.publishDir || DefaultRootConfig.publishDir, buildDrafts: void 0 !== e4.buildDrafts ? e4.buildDrafts : DefaultRootConfig.buildDrafts, buildExpired: void 0 !== e4.buildExpired ? e4.buildExpired : DefaultRootConfig.buildExpired, buildFuture: void 0 !== e4.buildFuture ? e4.buildFuture : DefaultRootConfig.buildFuture, copyright: e4.copyright || DefaultRootConfig.copyright, defaultContentLanguage: e4.defaultContentLanguage || DefaultRootConfig.defaultContentLanguage, defaultContentLanguageInSubdir: void 0 !== e4.defaultContentLanguageInSubdir ? e4.defaultContentLanguageInSubdir : DefaultRootConfig.defaultContentLanguageInSubdir, disableAliases: void 0 !== e4.disableAliases ? e4.disableAliases : DefaultRootConfig.disableAliases, disablePathToLower: void 0 !== e4.disablePathToLower ? e4.disablePathToLower : DefaultRootConfig.disablePathToLower, disableKinds: e4.disableKinds || DefaultRootConfig.disableKinds, disableLanguages: e4.disableLanguages || DefaultRootConfig.disableLanguages, renderSegments: e4.renderSegments || DefaultRootConfig.renderSegments, disableHugoGeneratorInject: void 0 !== e4.disableHugoGeneratorInject ? e4.disableHugoGeneratorInject : DefaultRootConfig.disableHugoGeneratorInject, disableLiveReload: void 0 !== e4.disableLiveReload ? e4.disableLiveReload : DefaultRootConfig.disableLiveReload, enableEmoji: void 0 !== e4.enableEmoji ? e4.enableEmoji : DefaultRootConfig.enableEmoji };
          }(e3);
          return new Root(n5, t4);
        }(t3.get(""), t3.getParams("params")), function(e3, t4, n5) {
          return new Dir(e3, t4, n5);
        }(s2.workingDir, s2.modulesDir, n4), function(e3) {
          const t4 = function(e4) {
            const t5 = { mounts: [], imports: [] };
            return e4.mounts && Array.isArray(e4.mounts) && (t5.mounts = e4.mounts.map((e5) => ({ source: e5.source || "", target: e5.target || "", lang: e5.lang }))), e4.imports && Array.isArray(e4.imports) && (t5.imports = e4.imports.map((e5) => ({ path: e5.path || "", url: e5.url, version: e5.version, mounts: e5.mounts || [] }))), t5;
          }(e3);
          return new Module(t4);
        }(t3.get("module") || {}), function(e3) {
          const t4 = function(e4) {
            const t5 = { disqus: { ...DefaultServiceConfig.disqus }, googleAnalytics: { ...DefaultServiceConfig.googleAnalytics }, rss: { ...DefaultServiceConfig.rss }, x: { ...DefaultServiceConfig.x } };
            return e4 && (e4.disqus && (t5.disqus.shortname = e4.disqus.shortname || t5.disqus.shortname), e4.googleAnalytics && (t5.googleAnalytics.id = e4.googleAnalytics.id || t5.googleAnalytics.id), e4.rss && (t5.rss.limit = void 0 !== e4.rss.limit ? e4.rss.limit : t5.rss.limit)), t5;
          }(e3);
          return new Service(t4);
        }(t3.get("services")), function(e3) {
          const t4 = function(e4) {
            const t5 = { userConfig: {}, platformTemplates: [...DefaultSocialPlatformTemplates] };
            if (e4 && "object" == typeof e4) {
              for (const [n5, r3] of Object.entries(e4)) if (r3 && "object" == typeof r3) {
                const e5 = r3;
                e5.link && (t5.userConfig[n5] = { link: e5.link });
              }
            }
            return t5;
          }(e3);
          return new Social(t4);
        }(t3.get("social")), function(e3) {
          const t4 = function(e4) {
            const t5 = {};
            if (!e4 || 0 === Object.keys(e4).length) return t5.en = { ...DefaultLanguageConfig, title: (e4 == null ? void 0 : e4.title) || DefaultLanguageConfig.title, params: (e4 == null ? void 0 : e4.params) || DefaultLanguageConfig.params }, t5;
            for (const [n5, r3] of Object.entries(e4)) {
              const i2 = r3, s3 = languages.getNameByCode(n5) || n5;
              t5[n5] = { languageCode: n5, languageName: s3, title: i2.title || e4.title || "", weight: void 0 !== i2.weight ? i2.weight : 0, contentDir: i2.contentDir || "content", disabled: void 0 !== i2.disabled && i2.disabled, params: i2.params || e4.params || {} };
            }
            return t5;
          }(e3);
          return new Language(t4);
        }(t3.get("languages")), t3.isSet("taxonomies") ? newTaxonomy(t3.get("taxonomies")) : newTaxonomy(t3.get("")), function(e3) {
          const t4 = function(e4) {
            const t5 = { useInternalRenderer: DefaultMarkdownConfig.useInternalRenderer, plugins: { ...DefaultMarkdownConfig.plugins } };
            return e4 && (void 0 !== e4.useInternalRenderer && (t5.useInternalRenderer = Boolean(e4.useInternalRenderer)), e4.plugins && (void 0 !== e4.plugins.wikilink && (t5.plugins.wikilink = Boolean(e4.plugins.wikilink)), void 0 !== e4.plugins.tag && (t5.plugins.tag = Boolean(e4.plugins.tag)), void 0 !== e4.plugins.callout && (t5.plugins.callout = Boolean(e4.plugins.callout)), void 0 !== e4.plugins.latex && (t5.plugins.latex = Boolean(e4.plugins.latex)), void 0 !== e4.plugins.mermaid && (t5.plugins.mermaid = Boolean(e4.plugins.mermaid)))), t5;
          }(e3);
          return new Markdown(t4);
        }(t3.get("markdown")));
      } finally {
        a.deleteMergeStrategies();
      }
    }
    var ComponentFolderContent;
    var ComponentFolders;
    var ModuleError;
    var path42;
    var Mount;
    var util;
    var Logger2;
    var globalLoggerManager;
    var init_config2 = __esm2({ "internal/domain/config/factory/config.ts"() {
      init_config(), init_dir(), init_root2(), init_module2(), init_service22(), init_social2(), init_language2(), init_taxonomy2(), init_markdown22(), init_loader(), init_sourcedescriptor(), path32 = __toESM3(require("path"));
    } });
    var init_config3 = __esm2({ "internal/domain/config/index.ts"() {
      init_type(), init_config(), init_root2(), init_module2(), init_service22(), init_language2(), init_taxonomy2(), init_social2(), init_markdown22(), init_root(), init_module(), init_service3(), init_language(), init_taxonomy(), init_social(), init_markdown2(), init_config2();
    } });
    var init_type2 = __esm2({ "internal/domain/module/type.ts"() {
      ComponentFolders = ["workflows", "prompts", ComponentFolderContent = "content", "layouts", "static", "assets", "i18n"], new (ModuleError = class extends Error {
        constructor(e2, t2) {
          super(e2), this.code = t2, this.name = "ModuleError";
        }
      })("module not found", "MODULE_NOT_FOUND"), new ModuleError("download failed", "DOWNLOAD_FAILED"), new ModuleError("invalid zip file", "INVALID_ZIP"), new ModuleError("mount failed", "MOUNT_FAILED");
    } });
    var init_mount = __esm2({ "internal/domain/module/vo/mount.ts"() {
      path42 = __toESM3(require("path")), Mount = class e2 {
        constructor(e3, t2, n3 = "") {
          this.sourcePath = e3, this.targetPath = t2, this.language = n3;
        }
        source() {
          return this.sourcePath;
        }
        target() {
          return this.targetPath;
        }
        lang() {
          return this.language;
        }
        setLanguage(e3) {
          this.language = e3;
        }
        component() {
          return this.targetPath.split(path42.sep)[0] || "";
        }
        componentAndName() {
          const e3 = this.targetPath.split(path42.sep);
          return { component: e3[0] || "", name: e3.slice(1).join(path42.sep) };
        }
        copy() {
          return new e2(this.sourcePath, this.targetPath, this.language);
        }
        equals(e3) {
          return this.sourcePath === e3.sourcePath && this.targetPath === e3.targetPath && this.language === e3.language;
        }
        toConfig() {
          const e3 = { sourcePath: this.sourcePath, targetPath: this.targetPath };
          return this.language && (e3.language = this.language), e3;
        }
        toString() {
          return `${this.sourcePath} -> ${this.targetPath} (${this.language})`;
        }
      };
    } });
    var init_types3 = __esm2({ "pkg/log/types.ts"() {
    } });
    var init_logger3 = __esm2({ "pkg/log/logger.ts"() {
      util = __toESM3(require("util")), init_types3(), Logger2 = class e2 {
        constructor(e3) {
          __publicField(this, "config");
          __publicField(this, "fields");
          this.config = { enableCaller: true, jsonFormat: true, ...e3 }, this.fields = {};
        }
        shouldLog(e3) {
          const t2 = ["debug", "info", "warn", "error", "fatal"], n3 = t2.indexOf(this.config.level);
          return t2.indexOf(e3) >= n3;
        }
        getCaller() {
          if (!this.config.enableCaller) return;
          const e3 = new Error().stack;
          if (!e3) return;
          const t2 = e3.split("\n")[4];
          if (!t2) return;
          const n3 = t2.match(/at .* \((.+):(\d+):(\d+)\)/);
          if (n3) {
            const [, e4, t3] = n3;
            return `${e4.split("/").pop()}:${t3}`;
          }
          const r = t2.match(/at (.+):(\d+):(\d+)/);
          if (r) {
            const [, e4, t3] = r;
            return `${e4.split("/").pop()}:${t3}`;
          }
        }
        formatMessage(e3, t2) {
          return 0 === t2.length ? e3 : util.format(e3, ...t2);
        }
        writeLog(e3, t2) {
          if (!this.shouldLog(e3)) return;
          const n3 = { level: e3, timestamp: (/* @__PURE__ */ new Date()).toISOString(), message: t2, ...this.fields }, r = this.getCaller();
          r && (n3.caller = r);
          const i = this.config.jsonFormat ? JSON.stringify(n3) : this.formatPlainText(n3);
          "error" === e3 || "fatal" === e3 ? process.stderr.write(i + "\n") : process.stdout.write(i + "\n"), "fatal" === e3 && process.exit(1);
        }
        formatPlainText(e3) {
          const t2 = [e3.timestamp, e3.level.toUpperCase()];
          e3.caller && t2.push(`[${e3.caller}]`), t2.push(e3.message);
          const n3 = Object.keys(e3).filter((e4) => !["level", "timestamp", "message", "caller"].includes(e4)).map((t3) => `${t3}=${JSON.stringify(e3[t3])}`).join(" ");
          return n3 && t2.push(n3), t2.join(" ");
        }
        debug(e3, ...t2) {
          this.writeLog("debug", this.formatMessage(e3, t2));
        }
        info(e3, ...t2) {
          this.writeLog("info", this.formatMessage(e3, t2));
        }
        warn(e3, ...t2) {
          this.writeLog("warn", this.formatMessage(e3, t2));
        }
        error(e3, ...t2) {
          this.writeLog("error", this.formatMessage(e3, t2));
        }
        fatal(e3, ...t2) {
          this.writeLog("fatal", this.formatMessage(e3, t2));
        }
        debugf(e3, ...t2) {
          this.writeLog("debug", this.formatMessage(e3, t2));
        }
        infof(e3, ...t2) {
          this.writeLog("info", this.formatMessage(e3, t2));
        }
        warnf(e3, ...t2) {
          this.writeLog("warn", this.formatMessage(e3, t2));
        }
        errorf(e3, ...t2) {
          this.writeLog("error", this.formatMessage(e3, t2));
        }
        fatalf(e3, ...t2) {
          this.writeLog("fatal", this.formatMessage(e3, t2));
        }
        with(t2) {
          const n3 = new e2(this.config);
          return n3.fields = { ...this.fields, ...t2 }, n3;
        }
      };
    } });
    var init_http = __esm2({ "pkg/log/http.ts"() {
    } });
    function getDomainLogger(e2, t2) {
      return globalLoggerManager.getLogger(e2, t2);
    }
    var path52;
    var http;
    var https;
    var log2;
    var NodeHttpClient;
    var init_manager = __esm2({ "pkg/log/manager.ts"() {
      var _a6;
      init_logger3(), init_types3(), globalLoggerManager = (_a6 = class {
        constructor() {
          __publicField(this, "globalConfig");
          __publicField(this, "loggers");
          this.globalConfig = { level: "error", enableCaller: true, jsonFormat: true }, this.loggers = /* @__PURE__ */ new Map();
        }
        static getInstance() {
          return _a6.instance || (_a6.instance = new _a6()), _a6.instance;
        }
        setGlobalConfig(e2) {
          this.globalConfig = { ...this.globalConfig, ...e2 }, this.loggers.clear();
        }
        getGlobalConfig() {
          return { ...this.globalConfig };
        }
        getLogger(e2, t2) {
          const n3 = e2 + (t2 ? JSON.stringify(t2) : "");
          if (!this.loggers.has(n3)) {
            const i = (r = this.globalConfig, new Logger2(r)), s2 = { domain: e2, ...t2 }, a = i.with(s2);
            this.loggers.set(n3, a);
          }
          var r;
          return this.loggers.get(n3);
        }
        getComponentLogger(e2, t2, n3) {
          const r = { component: t2, ...n3 };
          return this.getLogger(e2, r);
        }
        clearCache() {
          this.loggers.clear();
        }
        getCachedDomains() {
          return Array.from(this.loggers.keys());
        }
        setLogLevel(e2) {
          this.setGlobalConfig({ level: e2 });
        }
        setCallerEnabled(e2) {
          this.setGlobalConfig({ enableCaller: e2 });
        }
        setJsonFormat(e2) {
          this.setGlobalConfig({ jsonFormat: e2 });
        }
      }, __publicField(_a6, "instance"), _a6).getInstance();
    } });
    var init_log = __esm2({ "pkg/log/index.ts"() {
      init_types3(), init_logger3(), init_http(), init_manager(), init_logger3(), init_types3(), function(e2 = "info") {
        new Logger2({ level: e2 });
      }("info");
    } });
    function newHttpClient(e2, t2, n3, r) {
      return r || new NodeHttpClient(e2, t2, n3);
    }
    var import_jszip3;
    var path62;
    var log22;
    var JsZipExtractor;
    var WebZipExtractor;
    var init_httpclient = __esm2({ "internal/domain/module/vo/httpclient.ts"() {
      init_type2(), path52 = __toESM3(require("path")), http = __toESM3(require("http")), https = __toESM3(require("https")), init_log(), log2 = getDomainLogger("module", { component: "httpclient" }), NodeHttpClient = class {
        constructor(e2, t2 = 3e4, n3 = {}) {
          __publicField(this, "defaultTimeout", 3e4);
          __publicField(this, "defaultHeaders", { "User-Agent": "MDFriday-CLI/1.0.0" });
          this.fs = e2, this.timeout = t2, this.headers = n3;
        }
        async download(e2, t2, n3) {
          return new Promise((r, i) => {
            try {
              const s2 = new URL(e2), a = "https:" === s2.protocol, o = a ? https : http, l = { ...this.defaultHeaders, ...this.headers, ...n3 == null ? void 0 : n3.headers }, c = { hostname: s2.hostname, port: s2.port || (a ? 443 : 80), path: s2.pathname + s2.search, method: "GET", headers: l, timeout: (n3 == null ? void 0 : n3.timeout) || this.timeout }, h3 = o.request(c, async (e3) => {
                if (!e3.statusCode || e3.statusCode < 200 || e3.statusCode >= 300) return void i(new ModuleError(`HTTP ${e3.statusCode}: ${e3.statusMessage}`, "HTTP_ERROR"));
                const s3 = parseInt(e3.headers["content-length"] || "0", 10);
                let a2 = 0, o2 = Date.now(), l2 = -1;
                try {
                  const c3 = path52.dirname(t2);
                  await this.fs.mkdirAll(c3, 493);
                  const h4 = await this.fs.create(t2), u = [];
                  e3.on("data", (e4) => {
                    if (u.push(e4), a2 += e4.length, (n3 == null ? void 0 : n3.onProgress) && s3 > 0) {
                      const e5 = Date.now(), t3 = Math.round(a2 / s3 * 100);
                      if (e5 - o2 >= 100 && t3 !== l2 || t3 - l2 >= 5) {
                        const r3 = { loaded: a2, total: s3, percentage: t3 };
                        try {
                          n3.onProgress(r3), l2 = t3;
                        } catch (e6) {
                          log2.error(`Progress callback error: ${e6}`);
                        }
                        o2 = e5;
                      }
                    }
                  }), e3.on("end", async () => {
                    try {
                      const e4 = Buffer.concat(u), t3 = new Uint8Array(e4);
                      if (await h4.write(t3), await h4.sync(), await h4.close(), (n3 == null ? void 0 : n3.onProgress) && s3 > 0) {
                        const e5 = { loaded: s3, total: s3, percentage: 100 };
                        try {
                          n3.onProgress(e5);
                        } catch (e6) {
                          log2.warn(`Progress callback error: ${e6}`);
                        }
                      }
                      r();
                    } catch (e4) {
                      const t3 = e4 instanceof Error ? e4.message : String(e4);
                      i(new ModuleError(`File write failed: ${t3}`, "WRITE_FAILED"));
                    }
                  }), e3.on("error", (e4) => {
                    log2.error(`Response error: ${e4.message}`), i(new ModuleError(`Download failed: ${e4.message}`, "DOWNLOAD_FAILED"));
                  });
                } catch (e4) {
                  const t3 = e4 instanceof Error ? e4.message : String(e4);
                  i(new ModuleError(`File system error: ${t3}`, "FS_ERROR"));
                }
              });
              h3.on("error", (e3) => {
                log2.error("Request error:", e3), i(new ModuleError(`Request failed: ${e3.message}`, "REQUEST_FAILED"));
              }), h3.on("timeout", () => {
                h3.destroy(), log2.error(`Request timeout for ${e2}`), i(new ModuleError("Request timeout", "TIMEOUT"));
              }), h3.end();
            } catch (e3) {
              const t3 = e3 instanceof Error ? e3.message : String(e3);
              i(new ModuleError(`Download failed: ${t3}`, "DOWNLOAD_FAILED"));
            }
          });
        }
        async get(e2, t2) {
          return new Promise((n3, r) => {
            try {
              const i = new URL(e2), s2 = "https:" === i.protocol, a = s2 ? https : http, o = { ...this.defaultHeaders, ...this.headers, ...t2 == null ? void 0 : t2.headers }, l = { hostname: i.hostname, port: i.port || (s2 ? 443 : 80), path: i.pathname + i.search, method: "GET", headers: o, timeout: (t2 == null ? void 0 : t2.timeout) || this.timeout }, c = a.request(l, (e3) => {
                const t3 = [], i2 = {};
                Object.entries(e3.headers).forEach(([e4, t4]) => {
                  i2[e4] = Array.isArray(t4) ? t4.join(", ") : t4 || "";
                }), e3.on("data", (e4) => {
                  t3.push(e4);
                }), e3.on("end", () => {
                  const r3 = Buffer.concat(t3), s3 = r3.buffer.slice(r3.byteOffset, r3.byteOffset + r3.byteLength);
                  n3({ data: s3, headers: i2, status: e3.statusCode || 0 });
                }), e3.on("error", (e4) => {
                  r(new ModuleError(`Response error: ${e4.message}`, "RESPONSE_ERROR"));
                });
              });
              c.on("error", (e3) => {
                r(new ModuleError(`GET request failed: ${e3.message}`, "REQUEST_FAILED"));
              }), c.on("timeout", () => {
                c.destroy(), r(new ModuleError("GET request timeout", "TIMEOUT"));
              }), c.end();
            } catch (e3) {
              const t3 = e3 instanceof Error ? e3.message : String(e3);
              r(new ModuleError(`GET request failed: ${t3}`, "REQUEST_FAILED"));
            }
          });
        }
      };
    } });
    function newZipExtractor(e2, t2 = "node") {
      switch (t2) {
        case "node":
          return new JsZipExtractor(e2);
        case "browser":
          return new WebZipExtractor(e2);
        default:
          throw new Error(`Unsupported environment: ${t2}`);
      }
    }
    var path72;
    var log3;
    var FsModuleCache;
    var init_zipextractor = __esm2({ "internal/domain/module/vo/zipextractor.ts"() {
      init_type2(), init_log(), import_jszip3 = __toESM3(require_jszip_min()), path62 = __toESM3(require("path")), log22 = getDomainLogger("module", { component: "zipextractor" }), JsZipExtractor = class {
        constructor(e2) {
          this.fs = e2;
        }
        async extract(e2, t2) {
          try {
            const n3 = await this.fs.open(e2), r = (await n3.stat()).size(), i = new Uint8Array(r), s2 = await n3.read(i);
            await n3.close(), await this.extractZipData(s2.buffer, t2);
          } catch (t3) {
            const n3 = t3 instanceof Error ? t3.message : String(t3);
            throw log22.error(`ZIP extraction failed for ${e2}: ${n3}`), new ModuleError(`ZIP extraction failed: ${n3}`, "EXTRACTION_FAILED");
          }
        }
        async list(e2) {
          try {
            const t2 = await this.fs.open(e2), n3 = await t2.stat(), r = new Uint8Array(n3.size()), i = await t2.read(r);
            return await t2.close(), await this.listZipContents(i.buffer);
          } catch (e3) {
            const t2 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`ZIP listing failed: ${t2}`, "LIST_FAILED");
          }
        }
        async extractZipData(e2, t2) {
          try {
            await this.fs.mkdirAll(t2, 493);
            const n3 = new import_jszip3.default(), r = await n3.loadAsync(e2), i = [];
            r.forEach((e3, t3) => {
              t3.dir || i.push(e3);
            });
            const s2 = [];
            let a = 0;
            r.forEach((e3, n4) => {
              s2.push(this.extractSingleEntry(e3, n4, t2).then(() => {
                a++;
              }));
            }), await Promise.all(s2);
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw log22.error(`Failed to extract ZIP data: ${t3}`), new ModuleError(`Failed to extract ZIP data: ${t3}`, "EXTRACTION_FAILED");
          }
        }
        async extractSingleEntry(e2, t2, n3) {
          const r = path62.join(n3, e2);
          if (t2.dir) await this.fs.mkdirAll(r, 493);
          else {
            const e3 = path62.dirname(r);
            e3 !== n3 && await this.fs.mkdirAll(e3, 493);
            const i = await t2.async("uint8array"), s2 = await this.fs.create(r);
            await s2.write(i), await s2.close();
          }
        }
        async listZipContents(e2) {
          try {
            const t2 = new import_jszip3.default(), n3 = await t2.loadAsync(e2), r = [];
            return n3.forEach((e3) => {
              r.push(e3);
            }), r;
          } catch (e3) {
            const t2 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`Failed to list ZIP contents: ${t2}`, "LIST_FAILED");
          }
        }
      }, WebZipExtractor = class {
        constructor(e2) {
          this.fs = e2;
        }
        async extract(e2, t2) {
          try {
            throw new ModuleError("Web ZIP extraction not implemented", "NOT_IMPLEMENTED");
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`Web ZIP extraction failed: ${t3}`, "WEB_EXTRACTION_FAILED");
          }
        }
        async list(e2) {
          try {
            throw new ModuleError("Web ZIP listing not implemented", "NOT_IMPLEMENTED");
          } catch (e3) {
            const t2 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`Web ZIP listing failed: ${t2}`, "WEB_LIST_FAILED");
          }
        }
      };
    } });
    function newModuleCache(e2, t2) {
      return new FsModuleCache(e2, t2);
    }
    var path8;
    var Module2;
    var ProjectModule;
    var init_cache = __esm2({ "internal/domain/module/vo/cache.ts"() {
      init_type2(), init_log(), path72 = __toESM3(require("path")), log3 = getDomainLogger("module", { component: "cache" }), FsModuleCache = class {
        constructor(e2, t2 = "./module/cache") {
          __publicField(this, "cacheDir");
          this.fs = e2, this.cacheDir = t2;
        }
        async get(e2) {
          var _a6, _b4;
          try {
            const t2 = this.getCacheFilePath(e2), n3 = await this.fs.open(t2), r = await n3.stat(), i = new Uint8Array(r.size());
            await n3.read(i), await n3.close();
            const s2 = new TextDecoder().decode(i);
            return JSON.parse(s2);
          } catch (t2) {
            if (((_a6 = t2.message) == null ? void 0 : _a6.includes("ENOENT")) || ((_b4 = t2.message) == null ? void 0 : _b4.includes("no such file"))) return log3.error(`Cache miss: ${e2}`, t2), null;
            const n3 = t2 instanceof Error ? t2.message : String(t2);
            throw log3.error(`Cache read error for ${e2}: ${n3}`), new ModuleError(`Failed to read cache: ${n3}`, "CACHE_READ_FAILED");
          }
        }
        async set(e2, t2) {
          try {
            await this.fs.mkdirAll(this.cacheDir, 493);
            const n3 = this.getCacheFilePath(e2), r = JSON.stringify(t2, null, 2), i = new TextEncoder().encode(r), s2 = await this.fs.create(n3);
            await s2.write(i), await s2.sync(), await s2.close();
          } catch (t3) {
            const n3 = t3 instanceof Error ? t3.message : String(t3);
            throw log3.error(`Cache write error for ${e2}: ${n3}`), new ModuleError(`Failed to write cache: ${n3}`, "CACHE_WRITE_FAILED");
          }
        }
        async has(e2) {
          try {
            const t2 = this.getCacheFilePath(e2);
            return await this.fs.stat(t2), true;
          } catch (e3) {
            return false;
          }
        }
        async delete(e2) {
          var _a6, _b4;
          try {
            const t2 = this.getCacheFilePath(e2);
            await this.fs.remove(t2);
          } catch (t2) {
            if (!((_a6 = t2.message) == null ? void 0 : _a6.includes("ENOENT")) && !((_b4 = t2.message) == null ? void 0 : _b4.includes("no such file"))) {
              const n3 = t2 instanceof Error ? t2.message : String(t2);
              throw log3.error(`Cache delete error for ${e2}: ${n3}`), new ModuleError(`Failed to delete cache: ${n3}`, "CACHE_DELETE_FAILED");
            }
          }
        }
        async clear() {
          var _a6, _b4;
          try {
            await this.fs.removeAll(this.cacheDir);
          } catch (e2) {
            if (!((_a6 = e2.message) == null ? void 0 : _a6.includes("ENOENT")) && !((_b4 = e2.message) == null ? void 0 : _b4.includes("no such file"))) {
              const t2 = e2 instanceof Error ? e2.message : String(e2);
              throw log3.error(`Cache clear error: ${t2}`), new ModuleError(`Failed to clear cache: ${t2}`, "CACHE_CLEAR_FAILED");
            }
          }
        }
        getCacheFilePath(e2) {
          const t2 = e2.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "") + ".json";
          return path72.join(this.cacheDir, t2);
        }
        getCacheDir() {
          return this.cacheDir;
        }
        async getStats() {
          try {
            const e2 = await this.listCacheFiles();
            let t2 = 0;
            for (const n3 of e2) try {
              const e3 = path72.join(this.cacheDir, n3);
              t2 += (await this.fs.stat(e3)).size();
            } catch (e3) {
            }
            return { totalEntries: e2.length, totalSize: t2 };
          } catch (e2) {
            return { totalEntries: 0, totalSize: 0 };
          }
        }
        async listCached() {
          try {
            return (await this.listCacheFiles()).map((e2) => path72.basename(e2, ".json").replace(/_/g, "/"));
          } catch (e2) {
            return [];
          }
        }
        async listCacheFiles() {
          try {
            const e2 = await this.fs.open(this.cacheDir), t2 = await e2.readdirnames(-1);
            return await e2.close(), t2.filter((e3) => e3.endsWith(".json"));
          } catch (e2) {
            return [];
          }
        }
      };
    } });
    function newModule2(e2, t2, n3, r) {
      return new Module2(e2, t2, n3, r || null, false);
    }
    var import_path22;
    var Lang;
    var Themes;
    var import_smol_toml;
    var path10;
    var log4;
    var Modules;
    var init_module3 = __esm2({ "internal/domain/module/vo/module.ts"() {
      init_type2(), init_mount(), path8 = __toESM3(require("path")), Module2 = class e2 {
        constructor(e3, t2, n3, r = null, i = false) {
          __publicField(this, "absoluteDir");
          __publicField(this, "modulePath");
          __publicField(this, "parentModule");
          __publicField(this, "mountDirs");
          __publicField(this, "metadata");
          __publicField(this, "isProject", false);
          this.fs = e3, this.absoluteDir = t2, this.modulePath = n3, this.parentModule = r, this.mountDirs = [], this.metadata = null, this.isProject = i;
        }
        isProjectModule() {
          return this.isProject;
        }
        owner() {
          return this.parentModule;
        }
        mounts() {
          return this.mountDirs.map((e3) => e3);
        }
        dir() {
          return this.absoluteDir;
        }
        path() {
          return this.modulePath;
        }
        setMetadata(e3) {
          this.metadata = e3;
        }
        getMetadata() {
          return this.metadata;
        }
        async applyMounts(e3) {
          try {
            let t2 = e3.mounts || [];
            if (0 === t2.length) for (const e4 of ComponentFolders) {
              const n3 = path8.join(this.absoluteDir, e4);
              try {
                (await this.fs.stat(n3)).isDir() && t2.push({ sourcePath: e4, targetPath: e4 });
              } catch (e5) {
              }
            }
            this.mountDirs = t2.map((e4) => {
              return t3 = e4.sourcePath, n3 = e4.targetPath, new Mount(t3, n3);
              var t3, n3;
            });
          } catch (e4) {
            const t2 = e4 instanceof Error ? e4.message : String(e4);
            throw new ModuleError(`Failed to apply mounts: ${t2}`, "MOUNT_FAILED");
          }
        }
        appendMount(e3) {
          this.mountDirs.push(e3);
        }
        removeMount(e3) {
          const t2 = this.mountDirs.findIndex((t3) => t3.equals(e3));
          return t2 >= 0 && (this.mountDirs.splice(t2, 1), true);
        }
        getMountByTarget(e3) {
          return this.mountDirs.find((t2) => t2.target() === e3) || null;
        }
        getMountsByComponent(e3) {
          return this.mountDirs.filter((t2) => t2.component() === e3);
        }
        isDownloaded() {
          var _a6;
          return "completed" === ((_a6 = this.metadata) == null ? void 0 : _a6.downloadStatus);
        }
        isDownloading() {
          var _a6;
          return "downloading" === ((_a6 = this.metadata) == null ? void 0 : _a6.downloadStatus);
        }
        isDownloadFailed() {
          var _a6;
          return "failed" === ((_a6 = this.metadata) == null ? void 0 : _a6.downloadStatus);
        }
        async exists() {
          try {
            return (await this.fs.stat(this.absoluteDir)).isDir();
          } catch (e3) {
            return false;
          }
        }
        copy() {
          const t2 = new e2(this.fs, this.absoluteDir, this.modulePath, this.parentModule, this.isProject);
          return t2.mountDirs = this.mountDirs.map((e3) => e3.copy()), t2.metadata = this.metadata ? { ...this.metadata } : null, t2;
        }
        toString() {
          return `Module{path: ${this.modulePath}, dir: ${this.absoluteDir}, mounts: ${this.mountDirs.length}}`;
        }
      }, ProjectModule = class {
        constructor(e2) {
          this.module = e2;
        }
        getModule() {
          return this.module;
        }
        appendMount(e2) {
          this.module.appendMount(e2);
        }
        setDefaultLanguage(e2) {
          const t2 = this.module.mounts();
          for (const n3 of t2) n3 instanceof Mount && n3.setLanguage(e2);
        }
        applyDefaultMounts() {
          const e2 = ComponentFolders.map((e3) => new Mount(e3, e3));
          for (const t2 of e2) this.module.appendMount(t2);
        }
        owner() {
          return this.module.owner();
        }
        mounts() {
          return this.module.mounts();
        }
        dir() {
          return this.module.dir();
        }
        path() {
          return this.module.path();
        }
      };
    } });
    var init_lang2 = __esm2({ "internal/domain/module/entity/lang.ts"() {
      import_path22 = __toESM3(require("path")), Lang = class {
        constructor(e2) {
          __publicField(this, "sourceLangMap");
          this.sourceLangMap = /* @__PURE__ */ new Map();
          for (const t2 of e2) for (const e3 of t2.mounts()) this.sourceLangMap.set(e3.source(), e3.lang());
        }
        getSourceLang(e2) {
          const t2 = this.sourceLangMap.get(import_path22.default.basename(e2));
          return void 0 !== t2 ? [t2, true] : ["", false];
        }
      };
    } });
    var init_themes = __esm2({ "internal/domain/module/vo/themes.ts"() {
      Themes = class e2 {
        constructor(e3) {
          __publicField(this, "themes");
          this.themes = e3;
        }
        static fromJson(t2) {
          return new e2(t2);
        }
        findThemeByUrl(e3) {
          const t2 = this.extractBaseUrl(e3);
          for (const e4 of this.themes) if (t2 === this.extractBaseUrl(e4.download_url)) return e4;
          return null;
        }
        resolveLatestVersion(e3) {
          const t2 = this.findThemeByUrl(e3);
          return t2 ? t2.download_url : e3;
        }
        extractBaseUrl(e3) {
          try {
            const t2 = new URL(e3);
            return t2.searchParams.delete("version"), t2.toString();
          } catch (t2) {
            const n3 = e3.indexOf("?");
            if (-1 === n3) return e3;
            const r = e3.substring(0, n3), i = new URLSearchParams(e3.substring(n3 + 1));
            i.delete("version");
            const s2 = i.toString();
            return s2 ? `${r}?${s2}` : r;
          }
        }
        getAllThemes() {
          return [...this.themes];
        }
        getThemeByName(e3) {
          return this.themes.find((t2) => t2.name.toLowerCase() === e3.toLowerCase()) || null;
        }
        getThemesByTag(e3) {
          return this.themes.filter((t2) => t2.tags.some((t3) => t3.toLowerCase() === e3.toLowerCase()));
        }
      };
    } });
    function newModules(e2, t2, n3, r) {
      return new Modules(e2, t2, n3, r);
    }
    var log5;
    var FsError;
    var ErrFileClosed;
    var ErrFileNotFound;
    var ErrSkipDir;
    var OverlayFsError;
    var ErrNoFilesystems;
    var OriginFs;
    var FileMeta;
    var init_module4 = __esm2({ "internal/domain/module/entity/module.ts"() {
      init_type2(), init_module3(), init_lang2(), init_themes(), init_log(), import_smol_toml = require_dist(), path10 = __toESM3(require("path")), log4 = getDomainLogger("module", { component: "modules" }), Modules = class {
        constructor(e2, t2, n3, r) {
          __publicField(this, "projectModule");
          __publicField(this, "modules", []);
          __publicField(this, "downloadedModules", /* @__PURE__ */ new Set());
          __publicField(this, "lang");
          __publicField(this, "themesCache", /* @__PURE__ */ new Map());
          var i;
          this.info = e2, this.httpClient = t2, this.zipExtractor = n3, this.moduleCache = r, this.projectModule = function(e3) {
            const t3 = e3.osFs(), n4 = e3.projDir(), r3 = e3.defaultLanguageKey(), i2 = new Module2(t3, n4, "project-root", null, true), s2 = new ProjectModule(i2);
            s2.applyDefaultMounts(), r3 && s2.setDefaultLanguage(r3);
            const a = e3.otherLanguageKeys();
            for (const t4 of a) try {
              const n5 = e3.getRelDir(ComponentFolderContent, t4);
              if (n5 && "" !== n5) {
                const e4 = new Mount(n5, ComponentFolderContent, t4);
                s2.appendMount(e4);
              }
            } catch (e4) {
              console.warn(`Failed to get relative directory for language ${t4}:`, e4);
            }
            return s2;
          }(this.info), this.lang = (i = this.all(), new Lang(i));
        }
        proj() {
          return this.projectModule.getModule();
        }
        all() {
          const e2 = [this.projectModule.getModule()];
          return e2.push(...this.modules), e2;
        }
        isProjMod(e2) {
          return e2 === this.projectModule.getModule();
        }
        async load(e2) {
          const t2 = this.info.importPaths();
          if (0 !== t2.length) for (let n3 = 0; n3 < t2.length; n3++) {
            const r = t2[n3], { cleanUrl: i, version: s2 } = this.parseVersionFromImportPath(r);
            let a = r;
            "latest" === s2 && (a = await this.resolveLatestVersion(r)), this.downloadedModules.has(a) ? log4.info(`Module already downloaded: ${a}`) : await this.addModule(this.projectModule.getModule(), a, (t3) => {
              e2 == null ? void 0 : e2({ modulePath: a, downloadPercentage: t3.percentage });
            });
          }
          else log4.warn("No import paths configured - no modules will be downloaded");
        }
        parseVersionFromImportPath(e2) {
          try {
            const t2 = new URL(e2), n3 = t2.searchParams.get("version") || "latest";
            return t2.searchParams.delete("version"), { cleanUrl: t2.toString(), version: n3 };
          } catch (t2) {
            return log4.warn(`Failed to parse import path ${e2}:`, t2), { cleanUrl: e2, version: "latest" };
          }
        }
        getThemeRegistryUrl(e2) {
          try {
            const t2 = new URL(e2).hostname;
            return "sunwei.xyz" === t2 || "www.sunwei.xyz" === t2 ? "https://sunwei.xyz/mdf/themes-zh.json" : "https://gohugo.net/themes.json";
          } catch (t2) {
            return log4.warn(`Failed to parse import path ${e2}, using default theme registry`), "https://gohugo.net/themes.json";
          }
        }
        async resolveLatestVersion(e2) {
          const { version: t2 } = this.parseVersionFromImportPath(e2);
          if ("latest" !== t2) return e2;
          try {
            const t3 = this.getThemeRegistryUrl(e2);
            log4.info(`Fetching latest theme versions from ${t3}...`);
            let n3 = this.themesCache.get(t3);
            if (!n3) {
              const e3 = await this.httpClient.get(t3), r3 = new TextDecoder().decode(e3.data), i = JSON.parse(r3);
              n3 = Themes.fromJson(i), this.themesCache.set(t3, n3);
            }
            const r = n3.resolveLatestVersion(e2);
            return r !== e2 ? log4.info(`Resolved latest version: ${e2} -> ${r}`) : log4.warn(`Could not resolve latest version for ${e2}, using original path`), r;
          } catch (t3) {
            return log4.error(`Failed to resolve latest version for ${e2}:`, t3), e2;
          }
        }
        async downloadModule(e2, t2) {
          try {
            let n3 = e2.version;
            if ("latest" === e2.version) {
              const t3 = await this.resolveLatestVersion(e2.path), { version: r3 } = this.parseVersionFromImportPath(t3);
              n3 = r3;
            }
            const r = await this.moduleCache.get(e2.path);
            if (r && "completed" === r.downloadStatus && this.isCacheValidForVersion(r.version, n3)) {
              const t3 = await this.createModuleFromCache(e2, r);
              if (await t3.exists()) return log4.info(`Using cached module ${e2.path} version ${r.version}`), t3;
            }
            r && "completed" === r.downloadStatus && !this.isCacheValidForVersion(r.version, n3) && log4.info(`Cache version mismatch for ${e2.path}: cached=${r.version}, requested=${n3 || "latest"}`);
            const i = this.getModuleDir(e2.path), s2 = path10.join(i, "module.zip"), a = { path: e2.path, version: e2.version || "latest", url: e2.url, dir: i, downloadStatus: "downloading", downloadedAt: /* @__PURE__ */ new Date() };
            await this.moduleCache.set(e2.path, a);
            try {
              const n4 = this.addTimestampToUrl(e2.url);
              await this.httpClient.download(n4, s2, { onProgress: (e3) => {
                t2 == null ? void 0 : t2({ percentage: e3.percentage });
              } }), await this.zipExtractor.extract(s2, i), a.downloadStatus = "completed", a.downloadedAt = /* @__PURE__ */ new Date();
              try {
                const e3 = await this.info.osFs().stat(s2);
                a.size = e3.size();
              } catch (e3) {
              }
              try {
                await this.info.osFs().remove(s2);
              } catch (e3) {
              }
              await this.moduleCache.set(e2.path, a);
              const r3 = newModule2(this.info.osFs(), i, e2.path);
              return r3.setMetadata(a), await r3.applyMounts(e2), r3;
            } catch (t3) {
              a.downloadStatus = "failed", await this.moduleCache.set(e2.path, a);
              const n4 = t3 instanceof Error ? t3.message : String(t3);
              throw new ModuleError(`Failed to download module ${e2.path}: ${n4}`, "DOWNLOAD_FAILED");
            }
          } catch (e3) {
            if (e3 instanceof ModuleError) throw e3;
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`Module download failed: ${t3}`, "DOWNLOAD_FAILED");
          }
        }
        async addModule(e2, t2, n3) {
          try {
            if (this.downloadedModules.has(t2)) return;
            const { cleanUrl: e3, version: r } = this.parseVersionFromImportPath(t2), i = { path: t2, url: this.getDownloadUrl(e3), ...r && { version: r } }, s2 = await this.downloadModule(i, n3);
            this.modules.push(s2), this.downloadedModules.add(t2);
            try {
              const e4 = await this.parseThemeToml(s2);
              for (const t3 of e4) {
                if (this.downloadedModules.has(t3)) {
                  log4.info(`Module ${t3} already downloaded, skipping`);
                  continue;
                }
                log4.info(`Recursively downloading module dependency: ${t3}`);
                const e5 = t3, { cleanUrl: r3, version: i2 } = this.parseVersionFromImportPath(e5);
                let a = e5;
                "latest" === i2 && (a = await this.resolveLatestVersion(e5)), await this.addModule(s2, a, (e6) => {
                  n3 == null ? void 0 : n3({ percentage: 0.5 * e6.percentage });
                });
              }
            } catch (e4) {
              const n4 = e4 instanceof Error ? e4.message : String(e4);
              log4.warn(`Failed to process recursive imports for module ${t2}: ${n4}`);
            }
          } catch (e3) {
            const n4 = e3 instanceof Error ? e3.message : String(e3);
            throw new ModuleError(`Failed to add module ${t2}: ${n4}`, "ADD_MODULE_FAILED");
          }
        }
        async createModuleFromCache(e2, t2) {
          const n3 = newModule2(this.info.osFs(), t2.dir, e2.path);
          return n3.setMetadata(t2), await n3.applyMounts(e2), n3;
        }
        getModuleDir(e2) {
          const t2 = e2.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "");
          return path10.join(this.info.moduleDir(), t2);
        }
        getDownloadUrl(e2) {
          return e2;
        }
        isCacheValidForVersion(e2, t2) {
          return !t2 || e2 === t2;
        }
        addTimestampToUrl(e2) {
          try {
            const t2 = new URL(e2), n3 = Date.now().toString();
            return t2.searchParams.set("_t", n3), t2.toString();
          } catch (t2) {
            const n3 = e2.includes("?") ? "&" : "?";
            return `${e2}${n3}_t=${Date.now()}`;
          }
        }
        getModuleByPath(e2) {
          return this.modules.find((t2) => t2.path() === e2) || null;
        }
        isModuleDownloaded(e2) {
          return this.downloadedModules.has(e2);
        }
        async getModuleStatus(e2) {
          const t2 = await this.moduleCache.get(e2);
          return (t2 == null ? void 0 : t2.downloadStatus) || "pending";
        }
        async removeModule(e2) {
          try {
            const t2 = this.modules.findIndex((t3) => t3.path() === e2);
            if (t2 >= 0) {
              const n3 = this.modules[t2];
              try {
                await this.info.osFs().removeAll(n3.dir());
              } catch (e3) {
              }
              this.modules.splice(t2, 1), this.downloadedModules.delete(e2), await this.moduleCache.delete(e2);
            }
          } catch (t2) {
            const n3 = t2 instanceof Error ? t2.message : String(t2);
            throw new ModuleError(`Failed to remove module ${e2}: ${n3}`, "REMOVE_MODULE_FAILED");
          }
        }
        async clearAll() {
          try {
            for (const e2 of this.modules) try {
              await this.info.osFs().removeAll(e2.dir());
            } catch (e3) {
            }
            this.modules = [], this.downloadedModules.clear(), await this.moduleCache.clear();
          } catch (e2) {
            const t2 = e2 instanceof Error ? e2.message : String(e2);
            throw new ModuleError(`Failed to clear modules: ${t2}`, "CLEAR_MODULES_FAILED");
          }
        }
        getSourceLang(e2) {
          return this.lang.getSourceLang(e2);
        }
        async parseThemeToml(e2) {
          var _a6;
          try {
            const t2 = path10.join(e2.dir(), "theme.toml");
            try {
              if ((await this.info.osFs().stat(t2)).isDir()) return [];
            } catch (e3) {
              return [];
            }
            let n3;
            try {
              const e3 = await this.info.osFs().open(t2);
              try {
                const t3 = [], r3 = new Uint8Array(4096);
                for (; ; ) {
                  const n4 = await e3.read(r3);
                  if (0 === n4.bytesRead) break;
                  t3.push(r3.slice(0, n4.bytesRead));
                }
                const i = t3.reduce((e4, t4) => e4 + t4.length, 0), s2 = new Uint8Array(i);
                let a = 0;
                for (const e4 of t3) s2.set(e4, a), a += e4.length;
                n3 = new TextDecoder("utf-8").decode(s2);
              } finally {
                await e3.close();
              }
            } catch (t3) {
              const n4 = t3 instanceof Error ? t3.message : String(t3);
              return log4.warn(`Failed to read theme.toml for module ${e2.path()}: ${n4}`), [];
            }
            const r = (0, import_smol_toml.parse)(n3);
            return ((_a6 = r.module) == null ? void 0 : _a6.imports) ? (log4.info(`Found ${r.module.imports.length} module imports in ${e2.path()}/theme.toml`), r.module.imports.map((e3) => e3.path)) : [];
          } catch (t2) {
            const n3 = t2 instanceof Error ? t2.message : String(t2);
            return log4.warn(`Failed to parse theme.toml for module ${e2.path()}: ${n3}`), [];
          }
        }
      };
    } });
    var init_module5 = __esm2({ "internal/domain/module/factory/module.ts"() {
      init_module4(), init_type2(), init_httpclient(), init_zipextractor(), init_cache(), init_log(), log5 = getDomainLogger("module", { component: "factory" });
    } });
    var init_module6 = __esm2({ "internal/domain/module/index.ts"() {
      init_type2(), init_type2(), init_mount(), init_httpclient(), init_zipextractor(), init_cache(), init_module3(), init_module4(), init_module5();
    } });
    var init_type3 = __esm2({ "internal/domain/fs/type.ts"() {
      FsError = class extends Error {
        constructor(e2, t2) {
          super(e2), this.code = t2, this.name = "FsError";
        }
      }, ErrFileClosed = new FsError("File is closed", "FILE_CLOSED"), new FsError("out of range", "OUT_OF_RANGE"), new FsError("too large", "TOO_LARGE"), ErrFileNotFound = new FsError("file not found", "FILE_NOT_FOUND"), new FsError("file exists", "FILE_EXISTS"), new FsError("destination exists", "DESTINATION_EXISTS"), ErrSkipDir = new Error("skip directory"), new FsError("walkway already walked", "ALREADY_WALKED"), ErrNoFilesystems = new (OverlayFsError = class extends FsError {
        constructor(e2, t2) {
          super(e2, t2), this.name = "OverlayFsError";
        }
      })("no filesystems to write to", "NO_FILESYSTEMS"), new OverlayFsError("operation not supported", "OPERATION_NOT_SUPPORTED");
    } });
    var init_originfs = __esm2({ "internal/domain/fs/entity/originfs.ts"() {
      OriginFs = class {
        constructor(e2, t2, n3) {
          __publicField(this, "source");
          __publicField(this, "origin");
          __publicField(this, "publishDir");
          this.source = e2, this.origin = t2, this.publishDir = n3;
        }
        getSource() {
          return this.source;
        }
        getOrigin() {
          return this.origin;
        }
        publish() {
          return this.publishDir;
        }
      };
    } });
    function newFileMeta(e2, t2) {
      return new FileMeta(e2, t2);
    }
    var FileInfo;
    var init_filemeta = __esm2({ "internal/domain/fs/vo/filemeta.ts"() {
      init_log(), getDomainLogger("fs", { component: "filemeta" }), FileMeta = class {
        constructor(e2 = "", t2 = null) {
          __publicField(this, "filename");
          __publicField(this, "componentRoot");
          __publicField(this, "componentDir");
          __publicField(this, "openFunc");
          this.filename = e2, this.componentRoot = "", this.componentDir = "", this.openFunc = t2;
        }
        fileName() {
          return this.filename;
        }
        relativeFilename() {
          if ("" === this.componentRoot) return this.filename;
          const e2 = this.filename.indexOf(this.componentRoot);
          if (-1 === e2) throw new Error(`filename ${this.filename} has no root ${this.componentRoot}`);
          let t2 = this.filename.substring(e2 + this.componentRoot.length);
          return t2.startsWith("/") || (t2 = "/" + t2), t2;
        }
        component() {
          return this.componentDir;
        }
        root() {
          return this.componentRoot;
        }
        async open() {
          if (null === this.openFunc) throw new Error("OpenFunc not set");
          return await this.openFunc();
        }
        setFileName(e2) {
          this.filename = e2;
        }
        setComponentRoot(e2) {
          this.componentRoot = e2;
        }
        setComponentDir(e2) {
          this.componentDir = e2;
        }
        setOpenFunc(e2) {
          this.openFunc = e2;
        }
        merge(e2) {
          e2 && (e2.filename && !this.filename && (this.filename = e2.filename), e2.componentRoot && !this.componentRoot && (this.componentRoot = e2.componentRoot), e2.componentDir && !this.componentDir && (this.componentDir = e2.componentDir), e2.openFunc && !this.openFunc && (this.openFunc = e2.openFunc));
        }
      };
    } });
    function newFileInfo(e2, t2) {
      const n3 = newFileMeta(t2), r = new FileInfo(e2, n3);
      return isMetaProvider(e2) && r.meta().merge(e2.meta()), r;
    }
    function newFileInfoWithMeta(e2, t2) {
      const n3 = new FileInfo(e2, t2);
      return isMetaProvider(e2) && n3.meta().merge(e2.meta()), n3;
    }
    function isMetaProvider(e2) {
      return e2 && "function" == typeof e2.meta;
    }
    var path11;
    var File;
    var DirFile;
    var path12;
    var BaseFs;
    var init_fileinfo = __esm2({ "internal/domain/fs/vo/fileinfo.ts"() {
      init_filemeta(), FileInfo = class {
        constructor(e2, t2) {
          __publicField(this, "fileInfo");
          __publicField(this, "_fileMeta");
          this.fileInfo = e2, this._fileMeta = t2;
        }
        meta() {
          return this._fileMeta;
        }
        type() {
          return this.fileInfo.mode();
        }
        info() {
          return this.fileInfo;
        }
        setMeta(e2) {
          this._fileMeta = e2;
        }
        name() {
          return this.fileInfo.name();
        }
        size() {
          return this.fileInfo.size();
        }
        mode() {
          return this.fileInfo.mode();
        }
        modTime() {
          return this.fileInfo.modTime();
        }
        isDir() {
          return this.fileInfo.isDir();
        }
        sys() {
          return this.fileInfo.sys();
        }
        fileName() {
          return this._fileMeta.fileName();
        }
        relativeFilename() {
          return this._fileMeta.relativeFilename();
        }
        component() {
          return this._fileMeta.component();
        }
        root() {
          return this._fileMeta.root();
        }
        async open() {
          return await this._fileMeta.open();
        }
      };
    } });
    var init_file = __esm2({ "internal/domain/fs/vo/file.ts"() {
      init_filemeta(), init_fileinfo(), path11 = __toESM3(require("path")), File = class {
        constructor(e2, t2, n3, r = false) {
          __publicField(this, "file");
          __publicField(this, "fileMeta");
          __publicField(this, "fs");
          __publicField(this, "_isDir");
          this.file = e2, this.fileMeta = t2, this.fs = n3, this._isDir = r;
        }
        isNop() {
          return null === this.file;
        }
        async close() {
          if (null !== this.file) return await this.file.close();
        }
        async readDir(e2) {
          const t2 = [];
          if (this._isDir && this.file) {
            const n3 = await this.file.readdir(e2);
            for (const e3 of n3) {
              const n4 = this.joinPath(this.fileMeta.fileName(), e3.name()), r = newFileMeta(n4, async () => await this.fs.open(n4));
              r.merge(this.fileMeta);
              const i = newFileInfo(e3, n4);
              i.setMeta(r), t2.push(i);
            }
          }
          return t2;
        }
        meta() {
          return this.fileMeta;
        }
        joinPath(e2, t2) {
          return e2.endsWith("/") ? e2 + t2 : e2 + "/" + t2;
        }
        async read(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.read(e2);
        }
        async readAt(e2, t2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.readAt(e2, t2);
        }
        async seek(e2, t2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.seek(e2, t2);
        }
        async write(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.write(e2);
        }
        async writeAt(e2, t2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.writeAt(e2, t2);
        }
        name() {
          return path11.basename(this.fileMeta.fileName());
        }
        async readdir(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.readDir(e2);
        }
        async readdirnames(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.readdirnames(e2);
        }
        async stat() {
          if (null === this.file) throw new Error("File is null");
          return await this.file.stat();
        }
        async sync() {
          if (null !== this.file) return await this.file.sync();
        }
        async truncate(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.truncate(e2);
        }
        async writeString(e2) {
          if (null === this.file) throw new Error("File is null");
          return await this.file.writeString(e2);
        }
      };
    } });
    var init_dir2 = __esm2({ "internal/domain/fs/vo/dir.ts"() {
      init_file(), DirFile = class extends File {
        constructor(e2, t2 = null, n3 = null) {
          super(e2.isNop() ? null : e2, e2.meta(), e2.fs, true);
          __publicField(this, "virtualOpener");
          __publicField(this, "filter");
          this.virtualOpener = t2, this.filter = n3;
        }
        async readDir(e2) {
          if (!this.isNop()) {
            let t2 = await super.readDir(e2);
            return null !== this.filter && (t2 = await this.filter(t2)), t2;
          }
          return await this.readVirtualDir();
        }
        async readVirtualDir() {
          if (null !== this.virtualOpener) return await this.virtualOpener();
          throw new Error("virtual dir opener not found");
        }
        setFilter(e2) {
          this.filter = e2;
        }
        setVirtualOpener(e2) {
          this.virtualOpener = e2;
        }
        getFilter() {
          return this.filter;
        }
        getVirtualOpener() {
          return this.virtualOpener;
        }
      };
    } });
    function newBaseFs(e2, t2) {
      return new BaseFs(e2, t2);
    }
    var path13;
    var log8;
    var Walkway;
    var log9;
    var StaticCopier;
    var log10;
    var init_basefs = __esm2({ "internal/domain/fs/entity/basefs.ts"() {
      init_filemeta(), init_fileinfo(), init_file(), init_dir2(), path12 = __toESM3(require("path")), init_log(), getDomainLogger("fs", { component: "basefs" }), BaseFs = class {
        constructor(e2, t2) {
          __publicField(this, "fs");
          __publicField(this, "roots");
          this.fs = e2, this.roots = t2;
        }
        toAbsolutePath(e2) {
          if (0 === this.roots.length) return e2;
          const t2 = this.roots[0];
          return "" === e2 ? t2 : path12.isAbsolute(e2) ? e2.startsWith(t2) ? e2 : path12.join(t2, e2.substring(1)) : path12.join(t2, e2);
        }
        isSameRootedPath(e2) {
          const t2 = this.roots[0];
          return e2.startsWith(path12.join(t2, path12.sep)) || e2 === t2;
        }
        async stat(e2) {
          const t2 = this.toAbsolutePath(e2);
          if (!this.isSameRootedPath(t2)) throw new Error(`path ${e2} is outside of the BaseFs root`);
          try {
            const n3 = await this.fs.stat(t2);
            if (n3.isDir()) {
              const r3 = newFileInfo(n3, t2);
              return r3.meta().setOpenFunc(async () => await this.openDir(e2)), r3;
            }
            const r = newFileInfo(n3, t2), i = this.getRoot(t2);
            return r.meta().setComponentRoot(i), r.meta().setOpenFunc(async () => await this.openInternal(e2)), r;
          } catch (e3) {
            throw e3;
          }
        }
        async open(e2) {
          const t2 = this.toAbsolutePath(e2);
          return (await this.fs.stat(t2)).isDir() ? await this.openDir(e2) : await this.openInternal(e2);
        }
        async openInternal(e2, t2 = false) {
          const n3 = this.toAbsolutePath(e2), r = await this.fs.open(n3), i = this.getRoot(n3), s2 = newFileMeta(n3);
          return s2.setComponentRoot(i), t2 ? function(e3, t3, n4) {
            return new File(e3, t3, n4, true);
          }(r, s2, this.fs) : function(e3, t3, n4) {
            return new File(e3, t3, n4);
          }(r, s2, this.fs);
        }
        getRoot(e2) {
          for (const t2 of this.roots) if (e2.startsWith(t2)) return t2;
          return "";
        }
        async openDir(e2) {
          const t2 = await this.openInternal(e2, true), n3 = this.toAbsolutePath(e2), r = this.getRoot(n3), i = newFileMeta(n3);
          return i.setComponentRoot(r), function(e3, t3, n4) {
            const r3 = new File(e3, t3, n4, true);
            return new DirFile(r3);
          }(t2, i, this.fs);
        }
        async create(e2) {
          const t2 = this.toAbsolutePath(e2);
          return await this.fs.create(t2);
        }
        async mkdir(e2, t2) {
          const n3 = this.toAbsolutePath(e2);
          return await this.fs.mkdir(n3, t2);
        }
        async mkdirAll(e2, t2) {
          const n3 = this.toAbsolutePath(e2);
          return await this.fs.mkdirAll(n3, t2);
        }
        async openFile(e2, t2, n3) {
          const r = this.toAbsolutePath(e2);
          return await this.fs.openFile(r, t2, n3);
        }
        async remove(e2) {
          const t2 = this.toAbsolutePath(e2);
          return await this.fs.remove(t2);
        }
        async removeAll(e2) {
          const t2 = this.toAbsolutePath(e2);
          return await this.fs.removeAll(t2);
        }
        async rename(e2, t2) {
          const n3 = this.toAbsolutePath(e2), r = this.toAbsolutePath(t2);
          return await this.fs.rename(n3, r);
        }
        name() {
          return `BaseFs(${this.fs.name()})`;
        }
        async chmod(e2, t2) {
          const n3 = this.toAbsolutePath(e2);
          return await this.fs.chmod(n3, t2);
        }
        async chown(e2, t2, n3) {
          const r = this.toAbsolutePath(e2);
          return await this.fs.chown(r, t2, n3);
        }
        async chtimes(e2, t2, n3) {
          const r = this.toAbsolutePath(e2);
          return await this.fs.chtimes(r, t2, n3);
        }
      };
    } });
    var init_walkway = __esm2({ "internal/domain/fs/vo/walkway.ts"() {
      path13 = __toESM3(require("path")), init_type3(), init_fileinfo(), init_filemeta(), init_log(), log8 = getDomainLogger("fs", { component: "walkway" }), Walkway = class {
        constructor(e2, t2) {
          __publicField(this, "fs");
          __publicField(this, "root");
          __publicField(this, "cb");
          __publicField(this, "cfg");
          __publicField(this, "walked", false);
          if (!e2) throw new Error("fs must be set");
          if (!t2.walkFn) throw new Error("walkFn must be set");
          this.fs = e2, this.cb = t2, this.root = "", this.cfg = {};
        }
        async walkWith(e2, t2) {
          return this.cfg = t2, this.root = e2, await this.walk();
        }
        async walk() {
          if (this.walked) throw new Error("this walkway is already walked");
          return this.walked = true, await this.walkRecursive(this.root, this.cfg.info, this.cfg.dirEntries);
        }
        checkErr(e2, t2) {
          return !(!this.isNotExistError(t2) || this.cfg.failOnNotExist || (log8.warn(`File "${e2}" not found, skipping.`), 0));
        }
        isNotExistError(e2) {
          return e2.message.includes("ENOENT") || e2.message.includes("no such file") || "ENOENT" === e2.code;
        }
        async walkRecursive(e2, t2, n3) {
          if (!t2) try {
            const n4 = await this.fs.stat(e2), r = newFileMeta(e2);
            r.setOpenFunc(async () => await this.fs.open(e2)), t2 = newFileInfoWithMeta(n4, r);
          } catch (t3) {
            if (e2 === this.root && this.isNotExistError(t3)) {
              if (this.cfg.failOnNotExist) throw new FsError(`walk: root not found: ${t3.message}`, "WALK_ROOT_NOT_FOUND");
              return;
            }
            if (this.checkErr(e2, t3)) return;
            throw new FsError(`walk: stat: ${t3.message}`, "WALK_STAT_FAILED");
          }
          try {
            const n4 = await this.cb.walkFn(e2, t2);
            if (n4 instanceof Error) throw n4;
          } catch (e3) {
            if (t2.isDir() && e3 === ErrSkipDir) return;
            throw e3;
          }
          if (t2.isDir()) {
            if (!n3) try {
              const t3 = await this.fs.open(e2), r = await t3.readdir(-1);
              await t3.close(), n3 = r.map((e3) => e3), this.cfg.sortDirEntries && n3.sort((e3, t4) => e3.name().localeCompare(t4.name()));
            } catch (t3) {
              if (this.checkErr(e2, t3)) return;
              throw new FsError(`walk: readdir: ${t3.message}`, "WALK_READDIR_FAILED");
            }
            if (this.cfg.ignoreFile && (n3 = n3.filter((e3) => !this.cfg.ignoreFile(e3.fileName()))), this.cb.hookPre) try {
              n3 = await this.cb.hookPre(t2, e2, n3);
            } catch (e3) {
              if (e3 === ErrSkipDir) return;
              throw e3;
            }
            for (const t3 of n3) {
              const n4 = path13.join(e2, t3.name());
              try {
                await this.walkRecursive(n4, t3);
              } catch (e3) {
                if (!t3.isDir() || e3 !== ErrSkipDir) throw e3;
              }
            }
            if (this.cb.hookPost) try {
              await this.cb.hookPost(t2, e2, n3);
            } catch (e3) {
              if (e3 === ErrSkipDir) return;
              throw e3;
            }
          }
        }
      };
    } });
    var init_static_copier = __esm2({ "internal/domain/fs/vo/static-copier.ts"() {
      init_log(), log9 = getDomainLogger("fs", { component: "static-copier" }), StaticCopier = class {
        constructor(e2, t2) {
          __publicField(this, "fromFss");
          __publicField(this, "toFs");
          this.fromFss = e2, this.toFs = t2;
        }
        async copy() {
          this.fromFss && 0 !== this.fromFss.length ? this.toFs ? await this.doWithPublishDirs(this.toFs, async (e2) => {
            for (const t2 of this.fromFss) await this.copyStaticTo(t2, e2);
          }) : log9.error("No publish filesystem found") : log9.error("No static filesystems found");
        }
        async doWithPublishDirs(e2, t2) {
          try {
            await t2("/");
          } catch (e3) {
            throw log9.error("Error in doWithPublishDirs:", e3), e3;
          }
        }
        async copyStaticTo(e2, t2) {
          try {
            return await this.walkSourceFiles(e2, t2);
          } catch (e3) {
            throw log9.error(`Error copying static files to ${t2}:`, e3), e3;
          }
        }
        async walkSourceFiles(e2, t2) {
          let n3 = 0;
          try {
            await this.walkFileSystem(e2, "/", async (r, i) => {
              i || (await this.copyFile(e2, r, this.toFs, t2), n3++);
            });
          } catch (e3) {
            throw log9.error("Error walking source files:", e3), e3;
          }
          return n3;
        }
        async walkFileSystem(e2, t2, n3) {
          try {
            const r = await e2.open(t2);
            if (!(await r.stat()).isDir()) return await r.close(), void await n3(t2, false);
            const i = await r.readdir(-1);
            await r.close();
            for (const r3 of i) {
              const i2 = this.joinPath(t2, r3.name());
              r3.isDir() ? (await n3(i2, true), await this.walkFileSystem(e2, i2, n3)) : await n3(i2, false);
            }
          } catch (e3) {
            log9.error(`Could not read directory ${t2}:`, e3);
          }
        }
        async copyFile(e2, t2, n3, r) {
          let i = null, s2 = null;
          try {
            const a = t2.startsWith("/") ? t2.slice(1) : t2, o = this.joinPath(r, a), l = this.dirname(o);
            "/" !== l && await n3.mkdirAll(l, 493), i = await e2.open(t2);
            const c = await i.stat(), h3 = new Uint8Array(c.size());
            await i.read(h3), s2 = await n3.create(o), await s2.write(h3);
          } catch (e3) {
            log9.warn(`Failed to copy static file ${t2}:`, e3);
          } finally {
            if (s2) try {
              await s2.close();
            } catch (e3) {
              log9.warn(`Failed to close target file: ${e3}`);
            }
            if (i) try {
              await i.close();
            } catch (e3) {
              log9.warn(`Failed to close source file: ${e3}`);
            }
          }
        }
        joinPath(...e2) {
          return e2.map((e3) => e3.replace(/^\/+|\/+$/g, "")).filter((e3) => e3.length > 0).join("/").replace(/^/, "/");
        }
        dirname(e2) {
          const t2 = e2.split("/").filter((e3) => e3.length > 0);
          return t2.length <= 1 ? "/" : "/" + t2.slice(0, -1).join("/");
        }
      };
    } });
    async function createFileMetaInfo(e2, t2) {
      try {
        const n3 = await t2.stat(e2), r = newFileMeta(e2);
        return r.setOpenFunc(async () => await t2.open(e2)), newFileInfoWithMeta(n3, r);
      } catch (t3) {
        throw new Error(`Failed to stat file ${e2}: ${t3.message}`);
      }
    }
    var Fs2;
    var defaultDirMerger;
    var OverlayOptions;
    var init_incremental_file_collector = __esm2({ "internal/domain/fs/vo/incremental-file-collector.ts"() {
      init_fileinfo(), init_filemeta(), init_log(), log10 = getDomainLogger("fs", { component: "incremental-file-collector" });
    } });
    var init_fs = __esm2({ "internal/domain/fs/entity/fs.ts"() {
      init_basefs(), init_walkway(), init_static_copier(), init_incremental_file_collector(), init_fs3(), Fs2 = class {
        constructor(e2, t2, n3, r, i, s2, a, o, l) {
          __publicField(this, "originFs");
          __publicField(this, "prompts");
          __publicField(this, "workflows");
          __publicField(this, "content");
          __publicField(this, "layouts");
          __publicField(this, "statics");
          __publicField(this, "assets");
          __publicField(this, "i18n");
          __publicField(this, "work");
          __publicField(this, "service");
          this.originFs = e2, this.prompts = t2, this.workflows = n3, this.content = r, this.layouts = i, this.statics = s2, this.assets = a, this.i18n = o, this.work = l, this.service = new Service3();
        }
        os() {
          return this.originFs.getOrigin();
        }
        workFs() {
          return this.work;
        }
        workflowFs() {
          return this.workflows;
        }
        promptFs() {
          return this.prompts;
        }
        contentFs() {
          return this.content;
        }
        layoutsFs() {
          return this.layouts;
        }
        staticFs() {
          return this.statics;
        }
        assetsFs() {
          return this.assets;
        }
        publishFs() {
          return this.originFs.publish();
        }
        copyStatic(e2, t2) {
          return new StaticCopier(e2, t2).copy();
        }
        newFileMetaInfo(e2) {
          return this.service.newFileMetaInfo(e2);
        }
        newFileMetaInfoWithContent(e2) {
          return this.service.newFileMetaInfoWithContent(e2);
        }
        async getFileMetaInfos(e2) {
          return async function(e3, t2) {
            const n3 = /* @__PURE__ */ new Map();
            let r = false;
            for (const i of e3) for (const e4 of t2) try {
              const t3 = await createFileMetaInfo(i, e4);
              if (n3.set(i, t3), r = true, r) break;
            } catch (t3) {
              log10.error(`Failed to create FileMetaInfo for ${i} with fs=${e4}:`, t3);
            }
            return n3;
          }(e2, this.content);
        }
        newBasePathFs(e2, t2) {
          return newBaseFs(e2, [t2]);
        }
        async walkPrompts(e2, t2, n3) {
          return await this.walk(this.prompts, e2, t2, n3);
        }
        async walkWorkflows(e2, t2, n3) {
          return await this.walk(this.workflows, e2, t2, n3);
        }
        async walkLayouts(e2, t2, n3) {
          return await this.walk(this.layouts, e2, t2, n3);
        }
        async walkContent(e2, t2, n3, r) {
          await this.walk(e2, t2, n3, r);
        }
        async walkStatics(e2, t2, n3) {
          return await this.walk(this.statics, e2, t2, n3);
        }
        async walkI18n(e2, t2, n3) {
          return await this.walk(this.i18n, e2, t2, n3);
        }
        async walk(e2, t2, n3, r) {
          const i = function(e3, t3) {
            return new Walkway(e3, t3);
          }(e2, n3);
          return "" === t2 && (t2 = "/"), await i.walkWith(t2, r);
        }
      };
    } });
    function newOverlayOptions(e2, t2 = false, n3) {
      const r = { fss: e2, firstWritable: t2 };
      return void 0 !== n3 && (r.dirsMerger = n3), new OverlayOptions(r);
    }
    function createDefaultOverlayOptions(e2) {
      return newOverlayOptions(e2, false, defaultDirMerger);
    }
    var OverlayDir;
    var dirPool;
    var init_overlayoptions = __esm2({ "internal/domain/fs/vo/overlayoptions.ts"() {
      defaultDirMerger = (e2, t2) => {
        const n3 = [...e2];
        for (const r of t2) {
          let t3 = false;
          for (const n4 of e2) if (r.name() === n4.name()) {
            t3 = true;
            break;
          }
          t3 || n3.push(r);
        }
        return n3;
      }, OverlayOptions = class e2 {
        constructor(e3) {
          __publicField(this, "fss");
          __publicField(this, "firstWritable");
          __publicField(this, "dirsMerger");
          var _a6, _b4;
          this.fss = [...e3.fss], this.firstWritable = (_a6 = e3.firstWritable) != null ? _a6 : false, this.dirsMerger = (_b4 = e3.dirsMerger) != null ? _b4 : defaultDirMerger;
        }
        withFilesystems(...t2) {
          return new e2({ fss: [...this.fss, ...t2], firstWritable: this.firstWritable, dirsMerger: this.dirsMerger });
        }
        withFirstWritable(t2) {
          return new e2({ fss: this.fss, firstWritable: t2, dirsMerger: this.dirsMerger });
        }
        withDirsMerger(t2) {
          return new e2({ fss: this.fss, firstWritable: this.firstWritable, dirsMerger: t2 });
        }
        getWritableFs() {
          return this.firstWritable && 0 !== this.fss.length ? this.fss[0] : null;
        }
        isValid() {
          return void 0 !== this.dirsMerger;
        }
        getFilesystemCount() {
          return this.fss.length;
        }
        getFilesystem(e3) {
          return e3 < 0 || e3 >= this.fss.length ? null : this.fss[e3];
        }
        hasFilesystem(e3) {
          return this.fss.includes(e3);
        }
        getFilesystems() {
          return this.fss;
        }
      };
    } });
    var OverlayFs;
    var init_overlaydir = __esm2({ "internal/domain/fs/entity/overlaydir.ts"() {
      init_type3(), init_overlayoptions(), OverlayDir = class {
        constructor(e2 = {}) {
          __publicField(this, "_name");
          __publicField(this, "fss");
          __publicField(this, "dirOpeners");
          __publicField(this, "info");
          __publicField(this, "merge");
          __publicField(this, "err");
          __publicField(this, "offset");
          __publicField(this, "fis");
          __publicField(this, "closed");
          this._name = e2.name || "", this.fss = e2.fss ? [...e2.fss] : [], this.dirOpeners = e2.dirOpeners ? [...e2.dirOpeners] : [], void 0 !== e2.info && (this.info = e2.info), this.merge = e2.merge || defaultDirMerger, this.offset = 0, this.fis = [], this.closed = false;
        }
        name() {
          return this._name;
        }
        isClosed() {
          return this.closed || 0 === this.fss.length && 0 === this.dirOpeners.length;
        }
        async readdir(e2) {
          if (this.isClosed()) throw ErrFileClosed;
          if (this.err) throw this.err;
          0 === this.offset && await this.loadDirectoryEntries();
          const t2 = this.fis.slice(this.offset);
          if (e2 <= 0) {
            if (this.err = new Error("EOF"), this.offset > 0 && 0 === t2.length) throw this.err;
            return [...t2];
          }
          if (0 === t2.length) throw this.err = new Error("EOF"), this.err;
          const n3 = t2.slice(0, e2);
          return this.offset += n3.length, n3;
        }
        async readdirnames(e2) {
          if (this.isClosed()) throw ErrFileClosed;
          return (await this.readdir(e2)).map((e3) => e3.name());
        }
        async loadDirectoryEntries() {
          for (let e2 = 0; e2 < this.fss.length; e2++) {
            const t2 = this.fss[e2];
            await this.readFromFilesystem(t2, null);
          }
          for (let e2 = 0; e2 < this.dirOpeners.length; e2++) {
            const t2 = await this.dirOpeners[e2]();
            await this.readFromFilesystem(null, t2);
          }
        }
        async readFromFilesystem(e2, t2) {
          let n3 = t2;
          try {
            if (!n3 && e2) {
              const t4 = "/" === this._name ? "" : this._name;
              n3 = await e2.open(t4);
            }
            if (!n3) return;
            const t3 = await n3.readdir(-1);
            this.fis = this.merge(this.fis, t3);
          } catch (e3) {
          } finally {
            n3 && !t2 && await n3.close();
          }
        }
        async stat() {
          if (this.isClosed()) throw ErrFileClosed;
          if (this.info) return await this.info();
          if (this.fss.length > 0) return await this.fss[0].stat(this._name);
          throw new OverlayFsError("no filesystem available for stat", "NO_FILESYSTEM");
        }
        async close() {
          this.closed = true, this.fss = [], this.dirOpeners = [], this.fis = [], delete this.info, this.offset = 0, delete this.err;
        }
        notSupported(e2) {
          throw new OverlayFsError(`operation ${e2} not supported on directory "${this._name}"`, "OPERATION_NOT_SUPPORTED");
        }
        async read(e2) {
          this.notSupported("read");
        }
        async readAt(e2, t2) {
          this.notSupported("readAt");
        }
        async seek(e2, t2) {
          this.notSupported("seek");
        }
        async write(e2) {
          this.notSupported("write");
        }
        async writeAt(e2, t2) {
          this.notSupported("writeAt");
        }
        async sync() {
          this.notSupported("sync");
        }
        async truncate(e2) {
          this.notSupported("truncate");
        }
        async writeString(e2) {
          this.notSupported("writeString");
        }
      }, dirPool = new class {
        constructor() {
          __publicField(this, "pool", []);
        }
        get() {
          return this.pool.length > 0 ? this.pool.pop() : new OverlayDir();
        }
        release(e2) {
          e2.fss = [], e2.dirOpeners = [], e2.fis = [], delete e2.info, e2.offset = 0, e2._name = "", delete e2.err, e2.closed = false, this.pool.push(e2);
        }
      }();
    } });
    function newOverlayFs(e2) {
      return new OverlayFs(e2);
    }
    var VirtualFileInfo;
    var VirtualFile;
    var globalVirtualFile;
    var init_overlayfs = __esm2({ "internal/domain/fs/entity/overlayfs.ts"() {
      init_type3(), init_overlayoptions(), init_overlaydir(), init_log(), getDomainLogger("fs", { component: "overlayfs" }), OverlayFs = class e2 {
        constructor(e3) {
          __publicField(this, "fss");
          __publicField(this, "mergeDirs");
          __publicField(this, "firstWritable");
          this.fss = [...e3.fss], this.mergeDirs = e3.dirsMerger, this.firstWritable = e3.firstWritable;
        }
        name() {
          return "overlayfs";
        }
        filesystem(e3) {
          return e3 < 0 || e3 >= this.fss.length ? null : this.fss[e3];
        }
        numFilesystems() {
          return this.fss.length;
        }
        append(...t2) {
          const n3 = new OverlayOptions({ fss: [...this.fss, ...t2], firstWritable: this.firstWritable, dirsMerger: this.mergeDirs });
          return new e2(n3);
        }
        withDirsMerger(t2) {
          const n3 = new OverlayOptions({ fss: this.fss, firstWritable: this.firstWritable, dirsMerger: t2 });
          return new e2(n3);
        }
        writeFs() {
          if (0 === this.fss.length) throw ErrNoFilesystems;
          return this.fss[0];
        }
        async collectDirs(e3, t2) {
          for (const n3 of this.fss) await this.collectDirsRecursive(n3, e3, t2);
        }
        async collectDirsRecursive(e3, t2, n3) {
          try {
            (await e3.stat(t2)).isDir() && n3(e3);
          } catch (e4) {
          }
          const r = e3;
          if (r.filesystem && r.numFilesystems) for (let e4 = 0; e4 < r.numFilesystems(); e4++) {
            const i = r.filesystem(e4);
            i && await this.collectDirsRecursive(i, t2, n3);
          }
        }
        async statInternal(e3, t2) {
          for (let n3 = 0; n3 < this.fss.length; n3++) {
            const r = this.fss[n3], [i, s2, a, o] = await this.statRecursive(r, e3, t2);
            if (null === o || !this.isNotExistError(o)) return [i, s2, a, o];
          }
          return [null, null, false, ErrFileNotFound];
        }
        async statRecursive(e3, t2, n3) {
          try {
            const n4 = await e3.stat(t2);
            return [e3, n4, false, null];
          } catch (t3) {
            if (!this.isNotExistError(t3)) return [e3, null, false, t3];
          }
          const r = e3;
          if (r.filesystem && r.numFilesystems) for (let e4 = 0; e4 < r.numFilesystems(); e4++) {
            const i = r.filesystem(e4);
            if (i) {
              const [e5, r3, s2, a] = await this.statRecursive(i, t2, n3);
              if (null === a || !this.isNotExistError(a)) return [e5, r3, s2, a];
            }
          }
          return [null, null, false, ErrFileNotFound];
        }
        isNotExistError(e3) {
          return e3.message.includes("ENOENT") || e3.message.includes("no such file") || e3 === ErrFileNotFound;
        }
        async create(e3) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().create(e3);
        }
        async mkdir(e3, t2) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().mkdir(e3, t2);
        }
        async mkdirAll(e3, t2) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().mkdirAll(e3, t2);
        }
        async open(e3) {
          if (0 === this.fss.length) throw ErrFileNotFound;
          const [t2, n3, , r] = await this.statInternal(e3, false);
          if (r) throw r;
          if (n3.isDir()) {
            const t3 = [];
            if (await this.collectDirs(e3, (e4) => {
              t3.push(e4);
            }), 0 === t3.length) throw ErrFileNotFound;
            return 1 === t3.length ? await t3[0].open(e3) : await async function(e4, t4, n4, r3) {
              if (!n4) throw new OverlayFsError("info function must not be null", "INFO_REQUIRED");
              const i = dirPool.get(), s2 = { name: e4, fss: [...r3], info: n4, merge: t4 || defaultDirMerger };
              return Object.assign(i, new OverlayDir(s2)), i;
            }(e3, this.mergeDirs, async () => n3, t3);
          }
          return await t2.open(e3);
        }
        async openFile(e3, t2, n3) {
          const r = !!(1 & t2) || !!(2 & t2);
          if (r && !this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return r ? await this.writeFs().openFile(e3, t2, n3) : await this.open(e3);
        }
        async remove(e3) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().remove(e3);
        }
        async removeAll(e3) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().removeAll(e3);
        }
        async rename(e3, t2) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().rename(e3, t2);
        }
        async stat(e3) {
          const t2 = "/" === e3 ? "" : e3, [, n3, , r] = await this.statInternal(t2, false);
          if (r) throw r;
          return n3;
        }
        async chmod(e3, t2) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().chmod(e3, t2);
        }
        async chown(e3, t2, n3) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().chown(e3, t2, n3);
        }
        async chtimes(e3, t2, n3) {
          if (!this.firstWritable) throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
          return await this.writeFs().chtimes(e3, t2, n3);
        }
      };
    } });
    var Service3;
    var Factory;
    var init_filevitural = __esm2({ "internal/domain/fs/vo/filevitural.ts"() {
      init_fs3(), init_fileinfo(), VirtualFileInfo = class {
        constructor(e2, t2 = "This is a virtual file.") {
          __publicField(this, "_name");
          __publicField(this, "_content");
          __publicField(this, "_modTime");
          this._name = e2, this._content = t2, this._modTime = /* @__PURE__ */ new Date();
        }
        name() {
          return this._name;
        }
        size() {
          return Buffer.byteLength(this._content, "utf8");
        }
        mode() {
          return 420;
        }
        modTime() {
          return this._modTime;
        }
        isDir() {
          return false;
        }
        sys() {
          return null;
        }
        getContent() {
          return this._content;
        }
      }, VirtualFile = class {
        constructor(e2, t2) {
          __publicField(this, "_fileName");
          __publicField(this, "_fileContent");
          __publicField(this, "_fileInfo", null);
          this._fileName = e2, this._fileContent = t2;
        }
        fullName() {
          return this._fileName;
        }
        async open() {
          return { name: () => this._fileName, close: async () => {
          }, read: async (e2) => {
            const t2 = Buffer.from(this._fileContent, "utf8"), n3 = Math.min(e2.length, t2.length);
            return t2.copy(e2, 0, 0, n3), { bytesRead: n3, buffer: e2 };
          }, readAt: async (e2, t2) => {
            const n3 = Buffer.from(this._fileContent, "utf8"), r = Math.min(t2, n3.length), i = Math.min(e2.length, n3.length - r);
            return i > 0 && n3.copy(e2, 0, r, r + i), { bytesRead: i, buffer: e2 };
          }, seek: async (e2, t2) => e2, write: async (e2) => ({ bytesWritten: e2.length, buffer: e2 }), writeAt: async (e2, t2) => ({ bytesWritten: e2.length, buffer: e2 }), readdir: async (e2) => [], readdirnames: async (e2) => [], stat: async () => this.getFileInfo(), sync: async () => {
          }, truncate: async (e2) => {
          }, writeString: async (e2) => ({ bytesWritten: Buffer.byteLength(e2, "utf8") }) };
        }
        getFileInfo() {
          return this._fileInfo || (this._fileInfo = new VirtualFileInfo(this._fileName, this._fileContent)), this._fileInfo;
        }
      }, globalVirtualFile = null;
    } });
    var init_service4 = __esm2({ "internal/domain/fs/entity/service.ts"() {
      init_filevitural(), Service3 = class {
        newFileMetaInfo(e2) {
          return function(e3) {
            const t2 = (globalVirtualFile || (globalVirtualFile = new VirtualFile("/content/file.txt", "This is a virtual file.")), globalVirtualFile.getFileInfo()), n3 = newFileMeta(e3);
            return new FileInfo(t2, n3);
          }(e2);
        }
        newFileMetaInfoWithContent(e2) {
          return function(e3) {
            const t2 = function(e4) {
              const t3 = Math.floor(1e6 * Math.random()).toString().padStart(6, "0");
              return new VirtualFile(`/content/file_${t3}.md`, e4);
            }(e3), n3 = t2.getFileInfo(), r = newFileMeta(t2.fullName(), () => t2.open());
            return r.setComponentRoot("content"), r.setComponentDir("content"), new FileInfo(n3, r);
          }(e2);
        }
      };
    } });
    function createReadOnlyOverlayFs(e2) {
      return new Factory().createReadOnly(e2);
    }
    var path14;
    var RootMapping;
    var FilesystemsCollector;
    var fs7;
    var path15;
    var log13;
    var OsFileInfo;
    var OsFile;
    var OsFs;
    var init_overlayfs_factory = __esm2({ "internal/domain/fs/vo/overlayfs-factory.ts"() {
      init_overlayoptions(), init_overlayfs(), Factory = class {
        create(e2) {
          return newOverlayFs(createDefaultOverlayOptions(e2));
        }
        createWithOptions(e2) {
          return function(e3) {
            const t2 = new OverlayOptions(e3);
            return new OverlayFs(t2);
          }(e2);
        }
        createReadOnly(e2) {
          return newOverlayFs(createDefaultOverlayOptions(e2));
        }
        createWritable(e2) {
          const t2 = function(e3) {
            return newOverlayOptions(e3, true, void 0);
          }(e2);
          return newOverlayFs(t2);
        }
        createWithMerger(e2, t2) {
          return newOverlayFs(createDefaultOverlayOptions(e2).withDirsMerger(t2));
        }
      };
    } });
    var init_filesystemscollector = __esm2({ "internal/domain/fs/vo/filesystemscollector.ts"() {
      init_overlayfs_factory(), init_basefs(), path14 = __toESM3(require("path")), init_log(), getDomainLogger("fs", { component: "filesystemscollector" }), RootMapping = class {
        constructor(e2, t2, n3 = "") {
          __publicField(this, "from");
          __publicField(this, "to");
          __publicField(this, "toBase");
          this.from = e2, this.to = t2, this.toBase = n3;
        }
        fs(e2) {
          return newBaseFs(e2, [this.to]);
        }
      }, FilesystemsCollector = class {
        constructor(e2) {
          __publicField(this, "sourceProject");
          __publicField(this, "overlayMountsPrompt");
          __publicField(this, "overlayMountsWorkflow");
          __publicField(this, "overlayMountsContent");
          __publicField(this, "overlayMountsLayouts");
          __publicField(this, "overlayMountsStatics");
          __publicField(this, "overlayMountsAssets");
          __publicField(this, "overlayMountsI18n");
          this.sourceProject = e2, this.overlayMountsPrompt = createReadOnlyOverlayFs([]), this.overlayMountsWorkflow = createReadOnlyOverlayFs([]), this.overlayMountsContent = [], this.overlayMountsLayouts = createReadOnlyOverlayFs([]), this.overlayMountsStatics = createReadOnlyOverlayFs([]), this.overlayMountsAssets = createReadOnlyOverlayFs([]), this.overlayMountsI18n = createReadOnlyOverlayFs([]);
        }
        async collect(e2) {
          const t2 = e2.all();
          for (const e3 of t2) {
            const t3 = [], n3 = [], r = [], i = [], s2 = [], a = [], o = [], l = (t4) => path14.isAbsolute(t4) ? ["", t4] : [e3.dir(), this.absPathify(e3.dir(), t4)], c = e3.mounts();
            for (const e4 of c) {
              const [c3, h3] = l(e4.source()), u = new RootMapping(e4.target(), h3, c3).fs(this.sourceProject);
              this.isPrompts(e4.target()) ? n3.push(u) : this.isWorkflows(e4.target()) ? t3.push(u) : this.isContent(e4.target()) ? r.push(u) : this.isLayouts(e4.target()) ? i.push(u) : this.isStatics(e4.target()) ? s2.push(u) : this.isAssets(e4.target()) ? a.push(u) : this.isI18n(e4.target()) && o.push(u);
            }
            if (t3.length > 0 && (this.overlayMountsWorkflow = this.overlayMountsWorkflow.append(...t3)), n3.length > 0 && (this.overlayMountsPrompt = this.overlayMountsPrompt.append(...n3)), e3.isProjectModule()) for (const e4 of r) {
              let t4 = createReadOnlyOverlayFs([]);
              t4 = t4.append(e4), this.overlayMountsContent.push(t4);
            }
            i.length > 0 && (this.overlayMountsLayouts = this.overlayMountsLayouts.append(...i)), s2.length > 0 && (this.overlayMountsStatics = this.overlayMountsStatics.append(...s2)), a.length > 0 && (this.overlayMountsAssets = this.overlayMountsAssets.append(...a)), o.length > 0 && (this.overlayMountsI18n = this.overlayMountsI18n.append(...o));
          }
        }
        isPrompts(e2) {
          return "prompts" === e2 || e2.startsWith("prompts/") || e2.startsWith("/prompts/");
        }
        isWorkflows(e2) {
          return "workflows" === e2 || e2.startsWith("workflows/") || e2.startsWith("/workflows/");
        }
        isContent(e2) {
          return "content" === e2 || e2.startsWith("content/") || e2.startsWith("/content/");
        }
        isLayouts(e2) {
          return "layouts" === e2 || e2.startsWith("layouts/") || e2.startsWith("/layouts/");
        }
        isStatics(e2) {
          return "static" === e2 || e2.startsWith("static/") || e2.startsWith("/static/");
        }
        isAssets(e2) {
          return "assets" === e2 || e2.startsWith("assets/") || e2.startsWith("/assets/");
        }
        isI18n(e2) {
          return "i18n" === e2 || e2.startsWith("i18n/") || e2.startsWith("/i18n/");
        }
        absPathify(e2, t2) {
          return path14.resolve(e2, t2);
        }
      };
    } });
    var init_osfs = __esm2({ "internal/domain/fs/vo/osfs.ts"() {
      fs7 = __toESM3(require("fs/promises")), path15 = __toESM3(require("path")), init_log(), log13 = getDomainLogger("fs", { component: "osfs" }), OsFileInfo = class {
        constructor(e2, t2) {
          this.stats = e2, this._name = t2;
        }
        name() {
          return this._name;
        }
        size() {
          return this.stats.size;
        }
        mode() {
          return this.stats.mode;
        }
        modTime() {
          return this.stats.mtime;
        }
        isDir() {
          return this.stats.isDirectory();
        }
        sys() {
          return this.stats;
        }
      }, OsFile = class {
        constructor(e2, t2 = "r") {
          __publicField(this, "handle", null);
          __publicField(this, "closed", false);
          __publicField(this, "position", 0);
          this.filePath = e2, this.flags = t2;
        }
        async ensureOpen() {
          this.handle || this.closed || (this.handle = await fs7.open(this.filePath, this.flags));
        }
        async close() {
          if (this.handle) {
            try {
              await this.handle.close();
            } catch (e2) {
              throw log13.error(`\u274C Error closing file handle for ${this.filePath}:`, e2), e2;
            }
            this.handle = null;
          }
          this.closed = true;
        }
        async read(e2) {
          if (this.closed) throw new Error("File is closed");
          if (await this.ensureOpen(), !this.handle) throw new Error("Failed to open file");
          const t2 = await this.handle.read(e2, 0, e2.length, this.position);
          return this.position += t2.bytesRead, { bytesRead: t2.bytesRead, buffer: e2 };
        }
        async readAt(e2, t2) {
          if (this.closed) throw new Error("File is closed");
          if (await this.ensureOpen(), !this.handle) throw new Error("Failed to open file");
          return { bytesRead: (await this.handle.read(e2, 0, e2.length, t2)).bytesRead, buffer: e2 };
        }
        async seek(e2, t2) {
          if (this.closed) throw new Error("File is closed");
          switch (t2) {
            case 0:
            default:
              this.position = e2;
              break;
            case 1:
              this.position += e2;
              break;
            case 2:
              if (await this.ensureOpen(), this.handle) {
                const t3 = await this.handle.stat();
                this.position = t3.size + e2;
              }
          }
          return this.position;
        }
        async write(e2) {
          if (this.closed) throw new Error("File is closed");
          if (await this.ensureOpen(), !this.handle) throw new Error("Failed to open file");
          const t2 = await this.handle.write(e2, 0, e2.length, this.position);
          return this.position += t2.bytesWritten, { bytesWritten: t2.bytesWritten, buffer: e2 };
        }
        async writeAt(e2, t2) {
          if (this.closed) throw new Error("File is closed");
          if (await this.ensureOpen(), !this.handle) throw new Error("Failed to open file");
          return { bytesWritten: (await this.handle.write(e2, 0, e2.length, t2)).bytesWritten, buffer: e2 };
        }
        name() {
          return this.filePath;
        }
        async readdir(e2) {
          if (this.closed) throw new Error("File is closed");
          const t2 = await fs7.readdir(this.filePath, { withFileTypes: true }), n3 = [], r = e2 > 0 ? Math.min(e2, t2.length) : t2.length;
          for (let e3 = 0; e3 < r; e3++) {
            const r3 = t2[e3], i = path15.join(this.filePath, r3.name), s2 = await fs7.stat(i);
            n3.push(new OsFileInfo(s2, r3.name));
          }
          return n3;
        }
        async readdirnames(e2) {
          if (this.closed) throw new Error("File is closed");
          const t2 = await fs7.readdir(this.filePath);
          return e2 > 0 ? t2.slice(0, e2) : t2;
        }
        async stat() {
          if (this.closed) throw new Error("File is closed");
          const e2 = await fs7.stat(this.filePath);
          return new OsFileInfo(e2, path15.basename(this.filePath));
        }
        async sync() {
          if (this.closed) throw new Error("File is closed");
          await this.ensureOpen(), this.handle && await this.handle.sync();
        }
        async truncate(e2) {
          if (this.closed) throw new Error("File is closed");
          await this.ensureOpen(), this.handle && (await this.handle.truncate(e2), this.position > e2 && (this.position = e2));
        }
        async writeString(e2) {
          const t2 = Buffer.from(e2, "utf8");
          return { bytesWritten: (await this.write(t2)).bytesWritten };
        }
      }, OsFs = class {
        async create(e2) {
          return await fs7.writeFile(e2, ""), new OsFile(e2, "w+");
        }
        async mkdir(e2, t2) {
          await fs7.mkdir(e2, { mode: t2 });
        }
        async mkdirAll(e2, t2) {
          await fs7.mkdir(e2, { mode: t2, recursive: true });
        }
        async open(e2) {
          return await fs7.access(e2), (await fs7.stat(e2)).isDirectory(), new OsFile(e2, "r");
        }
        async openFile(e2, t2, n3) {
          let r = "r";
          return 1 & t2 && (r = "w"), 2 & t2 && (r = "r+"), 64 & t2 && (r = "w"), 512 & t2 && (r = "w"), 1024 & t2 && (r = "a"), new OsFile(e2, r);
        }
        async remove(e2) {
          (await fs7.stat(e2)).isDirectory() ? await fs7.rmdir(e2) : await fs7.unlink(e2);
        }
        async removeAll(e2) {
          await fs7.rm(e2, { recursive: true, force: true });
        }
        async rename(e2, t2) {
          await fs7.rename(e2, t2);
        }
        async stat(e2) {
          const t2 = await fs7.stat(e2);
          return new OsFileInfo(t2, path15.basename(e2));
        }
        name() {
          return "OsFs";
        }
        async chmod(e2, t2) {
          await fs7.chmod(e2, t2);
        }
        async chown(e2, t2, n3) {
          await fs7.chown(e2, t2, n3);
        }
        async chtimes(e2, t2, n3) {
          await fs7.utimes(e2, t2, n3);
        }
      };
    } });
    var init_overlay_factory = __esm2({ "internal/domain/fs/vo/overlay-factory.ts"() {
      init_originfs(), init_fs3(), init_basefs();
    } });
    async function createFs(e2, t2) {
      const n3 = function(e3) {
        const t3 = e3.osFs, n4 = e3.osFs, r3 = newBaseFs(e3.osFs, [e3.publish]);
        return new OriginFs(t3, n4, r3);
      }(e2), r = await async function(e3, t3) {
        const n4 = (r3 = e3.getSource(), new FilesystemsCollector(r3));
        var r3;
        return await n4.collect(t3), n4;
      }(n3, t2), i = newBaseFs(e2.osFs, [e2.path]);
      return new Fs2(n3, r.overlayMountsPrompt, r.overlayMountsWorkflow, r.overlayMountsContent, r.overlayMountsLayouts, r.overlayMountsStatics, r.overlayMountsAssets, r.overlayMountsI18n, i);
    }
    var PageKind;
    var BufWriter;
    var TableOfContentsImpl;
    var HeaderImpl;
    var TOCBuilder;
    var AutoIDGenerator2;
    var HighlightResultImpl;
    var DefaultHighlighter;
    var Item;
    var boolRe;
    var intRe;
    var floatRe;
    var _ItemType_name;
    var _ItemType_index;
    var eof;
    var summaryDivider;
    var summaryDividerOrg;
    var delimTOML;
    var delimYAML;
    var delimOrg;
    var leftDelimSc;
    var leftDelimScNoMarkup;
    var rightDelimScNoMarkup;
    var leftDelimScWithMarkup;
    var rightDelimScWithMarkup;
    var leftComment2;
    var rightComment2;
    var inlineIdentifier;
    var sectionHandlers;
    var sectionHandler;
    var Iterator;
    var pageLexer;
    var init_fs2 = __esm2({ "internal/domain/fs/factory/fs.ts"() {
      init_fs(), init_overlay_factory(), init_basefs();
    } });
    var init_fs3 = __esm2({ "internal/domain/fs/index.ts"() {
      init_type3(), init_type3(), init_originfs(), init_fs(), init_basefs(), init_overlayfs(), init_overlaydir(), init_service4(), init_filemeta(), init_fileinfo(), init_filevitural(), init_file(), init_dir2(), init_walkway(), init_filesystemscollector(), init_static_copier(), init_overlayoptions(), init_overlayfs_factory(), init_osfs(), init_fs2(), init_overlay_factory();
    } });
    var init_type4 = __esm2({ "internal/domain/content/type.ts"() {
      PageKind = { PAGE: "page", HOME: "home", SECTION: "section", TAXONOMY: "taxonomy", TERM: "term", RSS: "rss", SITEMAP: "sitemap", SITEMAP_INDEX: "sitemapindex", ROBOTS_TXT: "robotstxt", STATUS_404: "404" };
    } });
    var init_type5 = __esm2({ "internal/domain/markdown/type.ts"() {
    } });
    var init_config4 = __esm2({ "internal/domain/markdown/vo/config.ts"() {
    } });
    var init_context2 = __esm2({ "internal/domain/markdown/vo/context.ts"() {
      BufWriter = class {
        constructor(e2 = 1024) {
          __publicField(this, "buffer");
          __publicField(this, "position");
          __publicField(this, "capacity");
          this.capacity = e2, this.buffer = new Uint8Array(this.capacity), this.position = 0;
        }
        async write(e2) {
          this.ensureCapacity(e2.length), this.buffer.set(e2, this.position), this.position += e2.length;
        }
        async writeString(e2) {
          const t2 = new TextEncoder().encode(e2);
          await this.write(t2);
        }
        async writeByte(e2) {
          this.ensureCapacity(1), this.buffer[this.position] = e2, this.position++;
        }
        bytes() {
          return this.buffer.slice(0, this.position);
        }
        length() {
          return this.position;
        }
        truncate(e2) {
          if (e2 < 0 || e2 > this.position) throw new Error("Invalid truncate size");
          this.position = e2;
        }
        ensureCapacity(e2) {
          const t2 = this.position + e2;
          if (t2 <= this.capacity) return;
          const n3 = Math.max(2 * this.capacity, t2), r = new Uint8Array(n3);
          r.set(this.buffer), this.buffer = r, this.capacity = n3;
        }
      };
    } });
    var init_tableofcontents = __esm2({ "internal/domain/markdown/vo/tableofcontents.ts"() {
      TableOfContentsImpl = class {
        constructor(e2 = []) {
          this.fragments = e2;
        }
        toHTML(e2, t2, n3) {
          if (0 === this.fragments.length) return "";
          const r = this.filterByLevel(this.fragments, e2, t2);
          if (0 === r.length) return "";
          const i = n3 ? "ol" : "ul";
          return `<${i}>
${this.renderFragments(r, n3)}</${i}>
`;
        }
        filterByLevel(e2, t2, n3) {
          return e2.filter((e3) => e3.level >= t2 && e3.level <= n3).map((e3) => {
            const r = { id: e3.id, text: e3.text, level: e3.level };
            return e3.children && (r.children = this.filterByLevel(e3.children, t2, n3)), r;
          });
        }
        renderFragments(e2, t2) {
          const n3 = t2 ? "ol" : "ul";
          return e2.map((e3) => {
            let r = `  <li><a href="#${e3.id}">${this.escapeHTML(e3.text)}</a>`;
            return e3.children && e3.children.length > 0 && (r += `
    <${n3}>
${this.renderFragments(e3.children, t2)}    </${n3}>`), r += "</li>", r;
          }).join("\n");
        }
        escapeHTML(e2) {
          return e2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
        }
        addFragment(e2) {
          this.fragments.push(e2);
        }
        getFragments() {
          return [...this.fragments];
        }
      }, HeaderImpl = class {
        constructor(e2, t2, n3 = [], r = [], i = []) {
          this._name = e2, this._level = t2, this._links = n3, this._paragraphs = r, this._listParagraphs = i;
        }
        name() {
          return this._name;
        }
        level() {
          return this._level;
        }
        links() {
          return [...this._links];
        }
        paragraphs() {
          return [...this._paragraphs];
        }
        listParagraphs() {
          return [...this._listParagraphs];
        }
        addLink(e2) {
          this._links.push(e2);
        }
        addParagraph(e2) {
          this._paragraphs.push(e2);
        }
        addListParagraph(e2) {
          this._listParagraphs.push(e2);
        }
      }, TOCBuilder = class {
        constructor() {
          __publicField(this, "fragments", []);
          __publicField(this, "stack", []);
        }
        addHeading(e2, t2, n3) {
          for (; this.stack.length > 0 && this.stack[this.stack.length - 1].level >= t2; ) this.stack.pop();
          const r = { id: n3, text: e2, level: t2, children: [] };
          if (0 === this.stack.length) this.fragments.push(r);
          else {
            const e3 = this.stack[this.stack.length - 1];
            e3.children || (e3.children = []), e3.children.push(r);
          }
          this.stack.push(r);
        }
        build() {
          return new TableOfContentsImpl(this.fragments);
        }
        reset() {
          this.fragments = [], this.stack = [];
        }
      }, AutoIDGenerator2 = class {
        constructor() {
          __publicField(this, "usedIds", /* @__PURE__ */ new Set());
        }
        generateID(e2, t2 = "github") {
          let n3;
          switch (t2) {
            case "github":
            default:
              n3 = this.githubStyle(e2);
              break;
            case "github-ascii":
              n3 = this.githubAsciiStyle(e2);
              break;
            case "blackfriday":
              n3 = this.blackfridayStyle(e2);
          }
          if (this.usedIds.has(n3)) {
            let e3 = 1, t3 = `${n3}-${e3}`;
            for (; this.usedIds.has(t3); ) e3++, t3 = `${n3}-${e3}`;
            n3 = t3;
          }
          return this.usedIds.add(n3), n3;
        }
        githubStyle(e2) {
          return e2.toLowerCase().replace(/[^\w\u4e00-\u9fff\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
        }
        githubAsciiStyle(e2) {
          return e2.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
        }
        blackfridayStyle(e2) {
          return e2.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
        }
        reset() {
          this.usedIds.clear();
        }
      };
    } });
    var init_highlight = __esm2({ "internal/domain/markdown/vo/highlight.ts"() {
      HighlightResultImpl = class {
        constructor(e2, t2) {
          this.wrappedContent = e2, this.innerContent = t2;
        }
        wrapped() {
          return this.wrappedContent;
        }
        inner() {
          return this.innerContent;
        }
      }, DefaultHighlighter = class {
        constructor(e2) {
          this.config = e2;
        }
        async highlight(e2, t2, n3) {
          if (!t2 || "text" === t2 || "plain" === t2) return this.escapeHTML(e2);
          const r = this.escapeHTML(e2), i = `language-${t2}`;
          return this.config.lineNos ? this.addLineNumbers(r, i) : `<code class="${i}">${r}</code>`;
        }
        async highlightCodeBlock(e2, t2) {
          const n3 = e2.type(), r = e2.inner(), i = await this.highlight(r, n3, t2);
          return new HighlightResultImpl(`<pre>${i}</pre>`, i);
        }
        async renderCodeblock(e2, t2, n3) {
          const r = await this.highlightCodeBlock(n3);
          await t2.writeString(r.wrapped());
        }
        isDefaultCodeBlockRenderer() {
          return true;
        }
        escapeHTML(e2) {
          return e2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
        }
        addLineNumbers(e2, t2) {
          const n3 = e2.split("\n").map((e3, n4) => {
            const r = n4 + this.config.lineNoStart;
            return this.config.lineNumbersInTable ? `<tr><td class="line-number">${r}</td><td class="line-code"><code class="${t2}">${e3}</code></td></tr>` : `<span class="line-number">${r}</span><code class="${t2}">${e3}</code>`;
          });
          return this.config.lineNumbersInTable ? `<table class="code-table"><tbody>${n3.join("")}</tbody></table>` : n3.join("\n");
        }
      };
    } });
    var init_item = __esm2({ "pkg/md/parser/item.ts"() {
      Item = class {
        constructor() {
          __publicField(this, "Type");
          __publicField(this, "Err");
          __publicField(this, "low");
          __publicField(this, "high");
          __publicField(this, "segments");
          __publicField(this, "firstByte");
          __publicField(this, "isString");
          __publicField(this, "content");
          __publicField(this, "bytes");
          this.Type = 0, this.Err = null, this.low = 0, this.high = 0, this.segments = [], this.firstByte = 0, this.isString = false, this.content = "", this.bytes = [];
        }
        Pos() {
          return this.segments.length > 0 ? this.segments[0].Low : this.low;
        }
        Val(e2) {
          if (0 === this.segments.length) return e2.slice(this.low, this.high);
          if (1 === this.segments.length) return e2.slice(this.segments[0].Low, this.segments[0].High);
          const t2 = [];
          for (const n4 of this.segments) t2.push(e2.slice(n4.Low, n4.High));
          const n3 = t2.reduce((e3, t3) => e3 + t3.length, 0), r = new Uint8Array(n3);
          let i = 0;
          for (const e3 of t2) r.set(e3, i), i += e3.length;
          return r;
        }
        ValStr(e2) {
          return new TextDecoder().decode(this.Val(e2));
        }
        ValTyped(e2) {
          const t2 = this.ValStr(e2);
          if (this.isString) return t2;
          if (boolRe.test(t2)) return "true" === t2;
          if (intRe.test(t2)) {
            const e3 = parseInt(t2, 10);
            return isNaN(e3) ? t2 : e3;
          }
          if (floatRe.test(t2)) {
            const e3 = parseFloat(t2);
            return isNaN(e3) ? t2 : e3;
          }
          return t2;
        }
        IsText() {
          return 18 === this.Type || 17 === this.Type;
        }
        IsIndentation() {
          return 17 === this.Type;
        }
        IsNonWhitespace(e2) {
          return this.ValStr(e2).trim().length > 0;
        }
        IsShortcodeName() {
          return 13 === this.Type;
        }
        IsInlineShortcodeName() {
          return 14 === this.Type;
        }
        IsLeftShortcodeDelim() {
          return 10 === this.Type || 8 === this.Type;
        }
        IsRightShortcodeDelim() {
          return 11 === this.Type || 9 === this.Type;
        }
        IsShortcodeClose() {
          return 12 === this.Type;
        }
        IsShortcodeParam() {
          return 15 === this.Type;
        }
        IsShortcodeParamVal() {
          return 16 === this.Type;
        }
        IsShortcodeMarkupDelimiter() {
          return 10 === this.Type || 11 === this.Type;
        }
        IsFrontMatter() {
          return this.Type >= 3 && this.Type <= 6;
        }
        IsDone() {
          return 0 === this.Type || 1 === this.Type;
        }
        IsEOF() {
          return 1 === this.Type;
        }
        IsError() {
          return 0 === this.Type;
        }
        ToString(e2) {
          const t2 = this.Val(e2), n3 = this.ValStr(e2), r = function(e3) {
            const t3 = e3;
            return t3 < 0 || t3 >= _ItemType_index.length - 1 ? `ItemType(${t3})` : _ItemType_name.slice(_ItemType_index[t3], _ItemType_index[t3 + 1]);
          }(this.Type);
          switch (true) {
            case 1 === this.Type:
              return "EOF";
            case 0 === this.Type:
              return n3;
            case 17 === this.Type:
              return `${r}:[${i = n3, i.replace(/ /g, "\u2423").replace(/\t/g, "\u2192")}]`;
            case this.Type > 19:
              return `<${n3}>`;
            case t2.length > 50:
              return `${r}:${n3.substring(0, 20)}...`;
            default:
              return `${r}:[${n3}]`;
          }
          var i;
        }
      }, boolRe = /^(true|false)$/, intRe = /^[-+]?\d+$/, floatRe = /^[-+]?\d*\.\d+$/, _ItemType_name = "tErrortEOFTypeLeadSummaryDividerTypeFrontMatterYAMLTypeFrontMatterTOMLTypeFrontMatterJSONTypeFrontMatterORGTypeIgnoretLeftDelimScNoMarkuptRightDelimScNoMarkuptLeftDelimScWithMarkuptRightDelimScWithMarkuptScClosetScNametScNameInlinetScParamtScParamValtIndentationtTexttKeywordMarker", _ItemType_index = [0, 6, 10, 32, 51, 70, 89, 107, 117, 137, 158, 180, 203, 211, 218, 231, 239, 250, 262, 267, 281];
    } });
    function isSpace2(e2) {
      return 32 === e2 || 9 === e2;
    }
    function isAlphaNumericOrHyphen(e2) {
      return isAlphaNumeric2(e2) || 45 === e2;
    }
    function isEndOfLine(e2) {
      return 13 === e2 || 10 === e2;
    }
    function isAlphaNumeric2(e2) {
      return 95 === e2 || e2 >= 65 && e2 <= 90 || e2 >= 97 && e2 <= 122 || e2 >= 48 && e2 <= 57;
    }
    function lexFrontMatterJSON(e2) {
      e2.backup();
      let t2 = false, n3 = 0;
      for (; ; ) {
        const r = e2.next();
        switch (true) {
          case r === eof:
            return e2.errorf("unexpected EOF parsing JSON front matter");
          case 123 === r:
            t2 || n3++;
            break;
          case 125 === r:
            t2 || n3--;
            break;
          case 34 === r:
            t2 = !t2;
            break;
          case 92 === r:
            e2.next();
        }
        if (0 === n3) break;
      }
      return e2.consumeCRLF(), e2.emit(5), () => e2.lexMainSection();
    }
    function lexFrontMatterOrgMode(e2) {
      if (e2.summaryDivider = summaryDividerOrg, e2.backup(), !e2.hasPrefix(delimOrg)) return () => e2.lexMainSection();
      e: for (; ; ) {
        const t2 = e2.next();
        switch (true) {
          case 10 === t2:
            if (!e2.hasPrefix(delimOrg)) break e;
            break;
          case t2 === eof:
            break e;
        }
      }
      return e2.emit(6), () => e2.lexMainSection();
    }
    function lexIntroSection(e2) {
      return e2.lexIntroSection();
    }
    var init_pagelexer = __esm2({ "pkg/md/parser/pagelexer.ts"() {
      init_item(), eof = -1, new Uint8Array([239, 187, 191]), summaryDivider = new TextEncoder().encode("<!--more-->"), summaryDividerOrg = new TextEncoder().encode("# more"), delimTOML = new TextEncoder().encode("+++"), delimYAML = new TextEncoder().encode("---"), delimOrg = new TextEncoder().encode("#+"), leftDelimSc = new TextEncoder().encode("{{"), leftDelimScNoMarkup = new TextEncoder().encode("{{<"), rightDelimScNoMarkup = new TextEncoder().encode(">}}"), leftDelimScWithMarkup = new TextEncoder().encode("{{%"), rightDelimScWithMarkup = new TextEncoder().encode("%}}"), leftComment2 = new TextEncoder().encode("/*"), rightComment2 = new TextEncoder().encode("*/"), inlineIdentifier = new TextEncoder().encode("inline "), sectionHandlers = class {
        constructor(e2) {
          __publicField(this, "l");
          __publicField(this, "skipAll");
          __publicField(this, "handlers");
          __publicField(this, "skipIndexes");
          this.l = e2, this.skipAll = false, this.handlers = [], this.skipIndexes = [];
        }
        skip() {
          if (this.skipAll) return -1;
          this.skipIndexes = [];
          let e2 = false;
          for (const t2 of this.handlers) {
            if (t2.skipAll) continue;
            const n3 = t2.skip();
            -1 !== n3 && (e2 = true, this.skipIndexes.push(n3));
          }
          return e2 ? function(...e3) {
            let t2 = -1;
            for (const n3 of e3) n3 < 0 || (-1 === t2 || n3 < t2) && (t2 = n3);
            return t2;
          }(...this.skipIndexes) : (this.skipAll = true, -1);
        }
        lex(e2) {
          if (this.skipAll) return null;
          this.l.pos > this.l.start && this.l.emit(18);
          for (const t2 of this.handlers) {
            if (t2.skipAll) continue;
            const [n3, r] = t2.lexFunc(e2, t2.l);
            if (null === n3 || r) return n3;
          }
          return this.l.pos++, e2;
        }
      }, sectionHandler = class {
        constructor(e2, t2, n3) {
          __publicField(this, "l");
          __publicField(this, "skipAll");
          __publicField(this, "skipFunc");
          __publicField(this, "lexFunc");
          this.l = e2, this.skipAll = false, this.skipFunc = t2, this.lexFunc = n3;
        }
        skip() {
          if (this.skipAll) return -1;
          const e2 = this.skipFunc(this.l);
          return -1 === e2 && (this.skipAll = true), e2;
        }
      }, Iterator = class {
        constructor(e2) {
          __publicField(this, "items");
          __publicField(this, "lastPos");
          this.items = e2, this.lastPos = -1;
        }
        Next() {
          return this.lastPos++, this.Current();
        }
        Current() {
          if (this.lastPos >= this.items.length) {
            const e2 = new Item();
            return e2.Type = 0, e2.Err = new Error("no more tokens"), e2;
          }
          return this.items[this.lastPos];
        }
        Backup() {
          if (this.lastPos < 0) throw new Error("need to go forward before going back");
          this.lastPos--;
        }
        Pos() {
          return this.lastPos;
        }
        IsValueNext() {
          const e2 = this.Peek();
          return 0 !== e2.Type && 1 !== e2.Type;
        }
        Peek() {
          return this.items[this.lastPos + 1];
        }
        PeekWalk(e2) {
          for (let t2 = this.lastPos + 1; t2 < this.items.length && e2(this.items[t2]); t2++) ;
        }
        Consume(e2) {
          for (let t2 = 0; t2 < e2; t2++) {
            const e3 = this.Next();
            if (0 === e3.Type || 1 === e3.Type) {
              this.Backup();
              break;
            }
          }
        }
        LineNumber(e2) {
          const t2 = new Uint8Array([10]), n3 = e2.slice(0, this.Current().low);
          let r = 0;
          for (let e3 = 0; e3 < n3.length; e3++) n3[e3] === t2[0] && r++;
          return r + 1;
        }
      }, pageLexer = class {
        constructor(e2, t2, n3) {
          __publicField(this, "input");
          __publicField(this, "stateStart");
          __publicField(this, "state");
          __publicField(this, "pos");
          __publicField(this, "start");
          __publicField(this, "width");
          __publicField(this, "sectionHandlers");
          __publicField(this, "cfg");
          __publicField(this, "summaryDivider");
          __publicField(this, "summaryDividerChecked");
          __publicField(this, "lexerShortcodeState");
          __publicField(this, "items");
          __publicField(this, "err");
          __publicField(this, "inFrontMatter");
          __publicField(this, "parenDepth");
          this.input = e2, this.stateStart = t2, this.state = null, this.pos = 0, this.start = 0, this.width = 0, this.cfg = n3, this.summaryDivider = null, this.summaryDividerChecked = false, this.err = null, this.items = [], this.inFrontMatter = false, this.parenDepth = 0, this.lexerShortcodeState = { currLeftDelimItem: 8, currRightDelimItem: 9, isInline: false, currShortcodeName: "", closingState: 0, elementStepNum: 0, paramElements: 0, paramState: 0, openShortcodes: {} }, this.lexSummaryDivider = this.lexSummaryDivider.bind(this), this.lexMainSection = this.lexMainSection.bind(this), this.lexIdentifierInShortcode = this.lexIdentifierInShortcode.bind(this), this.lexEndOfShortcode = this.lexEndOfShortcode.bind(this), this.lexShortcodeLeftDelim = this.lexShortcodeLeftDelim.bind(this), this.lexShortcodeRightDelim = this.lexShortcodeRightDelim.bind(this), this.lexShortcodeParam = this.lexShortcodeParam.bind(this), this.lexShortcodeValue = this.lexShortcodeValue.bind(this), this.lexShortcodeValueQuoted = this.lexShortcodeValueQuoted.bind(this), this.lexShortcodeValueUnquoted = this.lexShortcodeValueUnquoted.bind(this), this.lexInsideShortcode = this.lexInsideShortcode.bind(this), this.lexDone = this.lexDone.bind(this), this.sectionHandlers = function(e3) {
            const t3 = new sectionHandlers(e3), n4 = new sectionHandler(e3, (e4) => e4.index(leftDelimSc), (e4, t4) => {
              if (!t4.isShortCodeStart()) return [e4, false];
              if (t4.lexerShortcodeState.isInline) {
                const e5 = t4.input.slice(t4.pos + 3), n5 = function(e6) {
                  for (let t5 = 0; t5 < e6.length; t5++) if (!isSpace2(e6[t5])) {
                    if (47 === e6[t5]) return t5;
                    break;
                  }
                  return -1;
                }(e5);
                if (n5 !== t4.input.length - 1) {
                  const r3 = new TextDecoder().decode(e5.slice(n5 + 1)).trim();
                  if (-1 === n5 || !r3.startsWith(t4.lexerShortcodeState.currShortcodeName + " ")) return [t4.errorf("inline shortcodes do not support nesting"), true];
                }
              }
              return t4.hasPrefix(leftDelimScWithMarkup) ? (t4.lexerShortcodeState.currLeftDelimItem = 10, t4.lexerShortcodeState.currRightDelimItem = 11) : (t4.lexerShortcodeState.currLeftDelimItem = 8, t4.lexerShortcodeState.currRightDelimItem = 9), [t4.lexShortcodeLeftDelim, true];
            }), r = new sectionHandler(e3, (e4) => e4.summaryDividerChecked || !e4.summaryDivider ? -1 : e4.index(e4.summaryDivider), (e4, t4) => t4.summaryDivider && t4.hasPrefix(t4.summaryDivider) ? (t4.summaryDividerChecked = true, t4.pos += t4.summaryDivider.length, t4.consumeSpace(), t4.emit(2), [e4, true]) : [e4, false]);
            return t3.handlers = [n4, r], t3.skipIndexes = new Array(t3.handlers.length), t3;
          }(this);
        }
        Iterator() {
          return e2 = this.items, new Iterator(e2);
          var e2;
        }
        Input() {
          return this.input;
        }
        run() {
          for (this.state = this.stateStart; null !== this.state; ) this.state = this.state(this);
          return this;
        }
        next() {
          if (this.pos >= this.input.length) return this.width = 0, eof;
          const e2 = this.input[this.pos];
          return this.width = 1, this.pos += this.width, e2;
        }
        peek() {
          const e2 = this.next();
          return this.backup(), e2;
        }
        backup() {
          this.pos -= this.width;
        }
        append(e2) {
          e2.Pos() < this.input.length && (7 === e2.Type && 239 === this.input[e2.Pos()] ? e2.firstByte = 239 : e2.firstByte = this.input[e2.Pos()]), this.items.push(e2);
        }
        emit(e2) {
          const t2 = () => {
            this.start = this.pos;
          };
          if (18 === e2) for (let n4 = this.pos - 1; n4 >= this.start; n4--) {
            const r = this.input[n4];
            if (32 !== r && 9 !== r && 13 !== r && 10 !== r) break;
            if (n4 === this.start && 10 !== r) {
              const e3 = new Item();
              return e3.Type = 17, e3.low = this.start, e3.high = this.pos, this.append(e3), void t2();
            }
            if (10 === r && n4 < this.pos - 1) {
              const r3 = new Item();
              r3.Type = e2, r3.low = this.start, r3.high = n4 + 1, this.append(r3);
              const i = new Item();
              return i.Type = 17, i.low = n4 + 1, i.high = this.pos, this.append(i), void t2();
            }
            if (10 === r && n4 === this.pos - 1) break;
          }
          const n3 = new Item();
          n3.Type = e2, n3.low = this.start, n3.high = this.pos, n3.low < this.input.length && (7 === e2 && 239 === this.input[n3.low] ? n3.firstByte = 239 : n3.firstByte = this.input[n3.low]), this.append(n3), t2();
        }
        emitString(e2) {
          const t2 = new Item();
          t2.Type = e2, t2.low = this.start, t2.high = this.pos, t2.isString = true, this.pos > this.start && (t2.firstByte = this.input[this.start]), this.items.push(t2), this.start = this.pos;
        }
        isEOF() {
          return this.pos >= this.input.length;
        }
        ignoreEscapesAndEmit(e2, t2) {
          let n3 = this.start, r = n3;
          const i = [];
          for (; n3 < this.pos; ) {
            const e3 = 1;
            92 === this.input[n3] && (n3 > r && i.push({ Low: r, High: n3 }), r = n3 + e3), n3 += e3;
          }
          if (r < this.pos && i.push({ Low: r, High: this.pos }), i.length > 0) {
            const t3 = new Item();
            t3.Type = e2, t3.segments = i, i[0].High > i[0].Low && (t3.firstByte = this.input[i[0].Low]), this.items.push(t3), this.start = this.pos;
          }
          this.start = this.pos;
        }
        current() {
          return this.input.slice(this.start, this.pos);
        }
        ignore() {
          this.start = this.pos;
        }
        errorf(e2, ...t2) {
          const n3 = new Error(e2.replace(/%[a-z]/g, () => String(t2.shift()))), r = new Item();
          return r.Type = 0, r.Err = n3, r.low = this.start, r.high = this.pos, this.append(r), null;
        }
        consumeCRLF() {
          let e2 = false;
          const t2 = this.peek();
          return 13 === t2 ? (this.next(), 10 === this.peek() && (this.next(), e2 = true)) : 10 === t2 && (this.next(), e2 = true), e2;
        }
        consumeToSpace() {
          for (; ; ) {
            const e2 = this.next();
            if (e2 === eof || isSpace2(e2)) return void this.backup();
          }
        }
        consumeSpace() {
          for (; ; ) {
            const e2 = this.next();
            if (e2 === eof || !this.isUnicodeSpace(e2)) return void this.backup();
          }
        }
        isUnicodeSpace(e2) {
          return 32 === e2 || 9 === e2 || 10 === e2 || 12 === e2 || 13 === e2 || 133 === e2 || 160 === e2 || 8192 === e2 || 8193 === e2 || 8194 === e2 || 8195 === e2 || 8196 === e2 || 8197 === e2 || 8198 === e2 || 8199 === e2 || 8200 === e2 || 8201 === e2 || 8202 === e2 || 8232 === e2 || 8233 === e2 || 8239 === e2 || 8287 === e2 || 12288 === e2;
        }
        index(e2) {
          const t2 = this.input.slice(this.pos), n3 = e2.length, r = t2.length;
          if (n3 > r) return -1;
          e: for (let i = 0; i <= r - n3; i++) {
            for (let r3 = 0; r3 < n3; r3++) if (t2[i + r3] !== e2[r3]) continue e;
            return i;
          }
          return -1;
        }
        hasPrefix(e2) {
          if (this.pos + e2.length > this.input.length) return false;
          for (let t2 = 0; t2 < e2.length; t2++) if (this.input[this.pos + t2] !== e2[t2]) return false;
          return true;
        }
        isShortCodeStart() {
          return this.hasPrefix(leftDelimScWithMarkup) || this.hasPrefix(leftDelimScNoMarkup);
        }
        lexFrontMatterSection(e2, t2, n3, r) {
          for (let e3 = 0; e3 < 2; e3++) if (this.next() !== t2) return this.errorf(`invalid ${n3} delimiter`);
          let i, s2 = this.consumeCRLF();
          for (this.ignore(); ; ) {
            if (!s2 && (i = this.next(), i === eof)) return this.errorf(`EOF looking for end ${n3} front matter delimiter`);
            if ((s2 || isEndOfLine(i)) && this.hasPrefix(r)) {
              this.emit(e2), this.pos += 3, this.consumeCRLF(), this.ignore();
              break;
            }
            s2 = false;
          }
          return () => this.lexMainSection();
        }
        currentLeftShortcodeDelimItem() {
          return this.lexerShortcodeState.currLeftDelimItem;
        }
        currentRightShortcodeDelimItem() {
          return this.lexerShortcodeState.currRightDelimItem;
        }
        currentLeftShortcodeDelim() {
          return 10 === this.lexerShortcodeState.currLeftDelimItem ? leftDelimScWithMarkup : leftDelimScNoMarkup;
        }
        currentRightShortcodeDelim() {
          return 11 === this.lexerShortcodeState.currRightDelimItem ? rightDelimScWithMarkup : rightDelimScNoMarkup;
        }
        lexIdentifier() {
          for (; ; ) if (!isAlphaNumericOrHyphen(this.next())) return this.backup(), 0 === new TextDecoder().decode(this.input.slice(this.start, this.pos)).length || this.emit(15), null;
        }
        lexMainSection() {
          if (this.isEOF()) return () => this.lexDone();
          const e2 = this.sectionHandlers.skip();
          if (-1 === e2) return this.pos = this.input.length, () => this.lexDone();
          e2 > 0 && (this.pos += e2);
          const t2 = this.sectionHandlers.lex(this.lexMainSection);
          return null !== t2 ? t2 : (this.pos = this.input.length, this.lexDone);
        }
        lexInlineShortcodeContent() {
          for (; ; ) {
            if (this.pos >= this.input.length) return this.errorf("unclosed inline shortcode");
            if (this.hasPrefix(leftDelimScWithMarkup) || this.hasPrefix(leftDelimScNoMarkup)) return this.errorf("inline shortcodes do not support nesting");
            if (this.hasPrefix(this.currentRightShortcodeDelim())) return this.backup(), this.pos > this.start && this.emit(18), () => this.lexShortcodeRightDelim();
            this.next();
          }
        }
        lexIdentifierInShortcode() {
          let e2 = false;
          for (; ; ) {
            const t2 = this.next();
            switch (true) {
              case isAlphaNumericOrHyphen(t2):
              case 47 === t2:
                break;
              case 46 === t2:
                if (this.lexerShortcodeState.isInline = this.hasPrefix(inlineIdentifier), !this.lexerShortcodeState.isInline) return this.errorf("period in shortcode name only allowed for inline identifiers");
                break;
              default:
                this.backup();
                const n3 = new TextDecoder().decode(this.input.slice(this.start, this.pos));
                return this.lexerShortcodeState.closingState > 0 && !this.lexerShortcodeState.openShortcodes[n3] ? this.errorf(`closing tag for shortcode '${n3}' does not match start tag`) : (this.lexerShortcodeState.closingState > 0 && (this.lexerShortcodeState.openShortcodes[n3] = false, e2 = true), this.lexerShortcodeState.closingState = 0, this.lexerShortcodeState.currShortcodeName = n3, this.lexerShortcodeState.openShortcodes[n3] = true, this.lexerShortcodeState.elementStepNum++, this.lexerShortcodeState.isInline ? this.emit(14) : this.emit(13), e2 ? () => this.lexEndOfShortcode() : this.lexInsideShortcode);
            }
          }
        }
        lexEndOfShortcode() {
          return this.lexerShortcodeState.isInline = false, this.hasPrefix(this.currentRightShortcodeDelim()) ? () => this.lexShortcodeRightDelim() : true !== isSpace2(this.next()) ? this.errorf("unclosed shortcode") : (this.ignore(), () => this.lexEndOfShortcode());
        }
        lexShortcodeLeftDelim() {
          return this.pos += this.currentLeftShortcodeDelim().length, this.isComment() ? () => this.lexComment() : (this.emit(this.lexerShortcodeState.currLeftDelimItem), this.lexerShortcodeState.elementStepNum = 0, this.lexerShortcodeState.paramElements = 0, this.lexerShortcodeState.paramState = 0, this.start = this.pos, this.lexInsideShortcode);
        }
        peekString(e2) {
          const t2 = (Uint8Array, e2.length);
          if (this.pos + t2 > this.input.length) return null;
          const n3 = this.input.slice(this.pos, this.pos + t2);
          if (e2 instanceof Uint8Array) {
            for (let r = 0; r < t2; r++) if (n3[r] !== e2[r]) return null;
            return new TextDecoder().decode(n3);
          }
          {
            const t3 = new TextDecoder().decode(n3);
            return t3 === e2 ? t3 : null;
          }
        }
        lexSummaryDivider() {
          if (!this.hasPrefix(summaryDivider)) return null;
          if (this.start < this.pos) {
            const e3 = new Item();
            e3.Type = 18, e3.low = this.start, e3.high = this.pos, e3.low < this.input.length && (e3.firstByte = this.input[e3.low]), this.append(e3);
          }
          const e2 = new Item();
          return e2.Type = 2, e2.low = this.pos, e2.high = this.pos + summaryDivider.length, e2.low < this.input.length && (e2.firstByte = this.input[e2.low]), this.append(e2), this.pos += summaryDivider.length, this.start = this.pos, () => this.lexMainSection();
        }
        handleBOM() {
          if (this.pos + 3 <= this.input.length) {
            const e2 = this.input.slice(this.pos, this.pos + 3);
            if (239 === e2[0] && 187 === e2[1] && 191 === e2[2]) {
              const e3 = new Item();
              return e3.Type = 7, e3.low = this.pos, e3.high = this.pos + 3, e3.firstByte = 239, this.append(e3), this.pos += 3, this.start = this.pos, true;
            }
          }
          return false;
        }
        lexIntroSection() {
          this.summaryDivider = summaryDivider, 0 === this.pos && this.handleBOM();
          e: for (; ; ) {
            const e2 = this.next();
            if (e2 === eof) break;
            switch (true) {
              case 43 === e2:
                if (this.hasPrefix(delimTOML.slice(1))) return () => this.lexFrontMatterSection(4, e2, "TOML", delimTOML);
                this.backup();
                break e;
              case 45 === e2:
                if (this.hasPrefix(delimYAML.slice(1))) return () => this.lexFrontMatterSection(3, e2, "YAML", delimYAML);
                this.backup();
                break e;
              case 123 === e2:
                return lexFrontMatterJSON;
              case 35 === e2:
                return lexFrontMatterOrgMode;
              case 65279 === e2:
                this.emit(7);
                break;
              case (!isSpace2(e2) && !isEndOfLine(e2)):
                break e;
            }
          }
          return () => this.lexMainSection();
        }
        lexInsideShortcode() {
          if (this.hasPrefix(this.currentRightShortcodeDelim())) return this.lexShortcodeRightDelim;
          const e2 = this.next();
          if (e2 === eof) return this.errorf("unclosed shortcode action");
          if (isSpace2(e2) || isEndOfLine(e2)) this.ignore();
          else {
            if (61 === e2) {
              this.consumeSpace(), this.ignore();
              const e3 = this.peek();
              return 34 === e3 || 92 === e3 ? this.lexShortcodeQuotedParamVal(92 !== e3, 16) : 96 === e3 ? this.lexShortCodeParamRawStringVal(16) : this.lexShortcodeParamVal;
            }
            if (47 === e2) {
              if ("" === this.lexerShortcodeState.currShortcodeName) return this.errorf("got closing shortcode, but none is open");
              this.lexerShortcodeState.closingState++, this.lexerShortcodeState.isInline = false, this.emit(12);
            } else {
              if (92 !== e2) return this.lexerShortcodeState.elementStepNum > 0 && (isAlphaNumericOrHyphen(e2) || 34 === e2 || 96 === e2) ? (this.backup(), this.lexShortcodeParam(false)) : isAlphaNumeric2(e2) ? (this.backup(), this.lexIdentifierInShortcode) : this.errorf(`unrecognized character in shortcode action: U+${e2.toString(16).toUpperCase()} '${String.fromCharCode(e2)}'. Note: Parameters with non-alphanumeric args must be quoted`);
              if (this.ignore(), 34 === this.peek() || 96 === this.peek()) return this.lexShortcodeParam(true);
            }
          }
          return this.lexInsideShortcode;
        }
        lexShortcodeParam(e2) {
          let t2, n3 = true, r = false;
          for (; ; ) {
            if (t2 = this.next(), n3) {
              if (34 === t2 || 96 === t2 && !e2) return 2 === this.lexerShortcodeState.paramElements ? this.errorf("got quoted positional parameter. Cannot mix named and positional parameters") : (this.lexerShortcodeState.paramElements = 1, this.backup(), 34 === t2 ? () => this.lexShortcodeQuotedParamVal(!e2, 15) : () => this.lexShortCodeParamRawStringVal(15));
              if (96 === t2 && e2) return this.errorf("unrecognized escape character");
              n3 = false;
            } else if (61 === t2) {
              this.backup(), r = true;
              break;
            }
            if (!isAlphaNumericOrHyphen(t2) && 46 !== t2) {
              this.backup();
              break;
            }
          }
          if (0 === this.lexerShortcodeState.paramElements) this.lexerShortcodeState.paramElements++, r && this.lexerShortcodeState.paramElements++;
          else {
            if (r && 1 === this.lexerShortcodeState.paramElements) return this.errorf(`got named parameter '${new TextDecoder().decode(this.current())}'. Cannot mix named and positional parameters`);
            if (!r && 2 === this.lexerShortcodeState.paramElements) return this.errorf(`got positional parameter '${new TextDecoder().decode(this.current())}'. Cannot mix named and positional parameters`);
          }
          return this.emit(15), this.lexInsideShortcode;
        }
        lexShortcodeParamVal() {
          const e2 = this.next();
          if (isSpace2(e2)) return this.ignore(), () => this.lexShortcodeParamVal();
          switch (this.backup(), e2) {
            case 34:
              return this.next(), this.ignore(), () => this.lexShortcodeQuotedParamVal(false, 16);
            case 96:
              return this.next(), this.ignore(), () => this.lexShortCodeParamRawStringVal(16);
            default:
              return () => this.lexShortcodeValueUnquoted();
          }
        }
        lexShortcodeValueUnquoted() {
          for (; ; ) {
            const e2 = this.next();
            if (e2 === eof || isSpace2(e2) || this.isRightShortcodeDelim()) return this.backup(), this.pos > this.start && this.emit(16), this.lexInsideShortcode;
          }
        }
        lexShortcodeQuotedParamVal(e2, t2) {
          let n3 = false, r = false, i = 0;
          e: for (; ; ) {
            const t3 = this.next();
            switch (true) {
              case 92 === t3:
                if (34 === this.peek()) {
                  if (n3 && !e2) {
                    this.backup();
                    break e;
                  }
                  n3 && (r = true, i = 1);
                } else if (96 === this.peek()) return this.errorf("unrecognized escape character");
                break;
              case t3 === eof:
              case 10 === t3:
                return this.errorf(`unterminated quoted string in shortcode parameter-argument: '${new TextDecoder().decode(this.current())}'`);
              case 34 === t3:
                if (0 === i) {
                  if (n3) {
                    this.backup();
                    break e;
                  }
                  n3 = true, this.ignore();
                } else i = 0;
            }
          }
          r ? this.ignoreEscapesAndEmit(t2, true) : this.emitString(t2);
          const s2 = this.next();
          return 92 === s2 ? 34 === this.peek() && (this.ignore(), this.next(), this.ignore()) : 34 === s2 ? this.ignore() : this.backup(), this.lexInsideShortcode;
        }
        lexShortCodeParamRawStringVal(e2) {
          let t2 = false;
          e: for (; ; ) switch (this.next()) {
            case 96:
              if (t2) {
                this.backup();
                break e;
              }
              t2 = true, this.ignore();
              break;
            case eof:
              return this.errorf(`unterminated raw string in shortcode parameter-argument: '${new TextDecoder().decode(this.input.slice(this.start, this.pos))}'`);
          }
          return this.emitString(e2), this.next(), this.ignore(), this.lexInsideShortcode;
        }
        lexDone() {
          return this.pos > this.start && this.emit(18), this.emit(1), null;
        }
        lexShortcodeRightDelim() {
          return this.pos += this.currentRightShortcodeDelim().length, this.emit(this.lexerShortcodeState.currRightDelimItem), this.lexerShortcodeState.closingState = 0, () => this.lexMainSection();
        }
        lexShortcodeValue() {
          switch (this.next()) {
            case eof:
              return this.errorf("unterminated quoted string in shortcode parameter");
            case 32:
            case 9:
              return this.ignore(), () => this.lexShortcodeValue();
            case 34:
              return this.ignore(), () => this.lexShortcodeValueQuoted();
            default:
              return this.backup(), () => this.lexShortcodeValueUnquoted();
          }
        }
        lexShortcodeValueQuoted() {
          for (; ; ) switch (this.next()) {
            case eof:
              return this.errorf("unterminated quoted string in shortcode parameter");
            case 92:
              34 === this.peek() && this.next();
              break;
            case 34:
              return this.backup(), this.emitString(16), this.next(), this.ignore(), this.lexInsideShortcode;
          }
        }
        isRightShortcodeDelim() {
          return this.hasPrefix(this.currentRightShortcodeDelim());
        }
        lexComment() {
          const e2 = this.index(new Uint8Array([...rightComment2, ...this.currentRightShortcodeDelim()]));
          return e2 <= 1 ? this.errorf("comment must be closed") : (this.emit(18), this.pos += leftComment2.length, this.ignore(), this.pos += e2 - leftComment2.length, this.emit(18), this.pos += rightComment2.length, this.ignore(), this.pos += this.currentRightShortcodeDelim().length, this.emit(18), this.lexMainSection);
        }
        isComment() {
          return !(this.pos + 2 > this.input.length) && 47 === this.input[this.pos] && 42 === this.input[this.pos + 1];
        }
      };
    } });
    var log14;
    var init_pageparser = __esm2({ "pkg/md/parser/pageparser.ts"() {
      init_item(), init_pagelexer(), init_pagelexer();
    } });
    var log15;
    var SourceParseInfo;
    var log16;
    var ShortcodeImpl;
    var ShortcodeParser;
    var SHORTCODE_PLACEHOLDER_PREFIX;
    var init_pageparser2 = __esm2({ "internal/domain/markdown/vo/pageparser.ts"() {
      init_log(), init_pageparser(), log14 = getDomainLogger("markdown", { component: "pageparser" });
    } });
    var init_parseinfo = __esm2({ "internal/domain/markdown/vo/parseinfo.ts"() {
      init_pageparser2(), init_item(), init_pagelexer(), init_log(), log15 = getDomainLogger("markdown", { component: "parseinfo" }), SourceParseInfo = class {
        constructor(e2, t2) {
          __publicField(this, "source");
          __publicField(this, "posMainContent", -1);
          __publicField(this, "itemsStep1", []);
          __publicField(this, "handlers");
          this.source = e2, this.handlers = t2, this.validateHandlers();
        }
        validateHandlers() {
          if (!this.handlers.frontMatterHandler()) throw new Error("no front matter handler");
          if (!this.handlers.summaryHandler()) throw new Error("no summary handler");
          if (!this.handlers.shortcodeHandler()) throw new Error("no shortcode handler");
          if (!this.handlers.bytesHandler()) throw new Error("no bytes handler");
        }
        isEmpty() {
          return 0 === this.itemsStep1.length;
        }
        async parse() {
          const e2 = function(e3, t2 = {}) {
            const [n3, r] = function(e4, t3) {
              const [n4, r3] = function(e5, t4) {
                const n5 = function(e6, t5, n6) {
                  return new pageLexer(e6, lexIntroSection, n6);
                }(e5, 0, t4);
                return n5.run(), [n5, null];
              }(e4, t3);
              return r3 ? [[], r3] : [n4.items, n4.err];
            }(e3, t2);
            if (r) throw log14.error("Error parsing bytes:", r), r;
            return n3;
          }(this.source, {});
          this.itemsStep1 = e2;
        }
        async handle() {
          if (this.isEmpty()) return;
          const e2 = new Iterator(this.itemsStep1);
          for (; ; ) {
            const t2 = e2.Next();
            try {
              if (7 === t2.Type) log15.info(`Ignoring item at position ${t2.Pos()}: ${t2.ValStr(this.source)}`);
              else if (t2.IsFrontMatter()) {
                await this.handlers.frontMatterHandler()(t2);
                const n3 = e2.Peek();
                n3.IsDone() || (this.posMainContent = n3.Pos());
              } else if (2 === t2.Type) await this.handlers.summaryHandler()(t2, e2);
              else if (t2.IsLeftShortcodeDelim()) {
                e2.Backup();
                const t3 = e2.Current();
                await this.handlers.shortcodeHandler()(t3, e2);
              } else {
                if (t2.IsEOF()) break;
                if (t2.IsError()) throw log15.error(`Error parsing item at position ${t2.Pos()}: ${t2.Err}`), this.createError(t2.Err || new Error("Unknown parsing error"), t2);
                await this.handlers.bytesHandler()(t2);
              }
            } catch (e3) {
              throw this.createError(e3, t2);
            }
          }
        }
        getMainContentPosition() {
          return this.posMainContent;
        }
        getItems() {
          return this.itemsStep1;
        }
        getSource() {
          return this.source;
        }
        createError(e2, t2) {
          const n3 = function(e3, t3, n4) {
            const r3 = "string" == typeof t3 ? (i = t3, new TextEncoder().encode(i)) : t3;
            var i;
            if (n4 < 0) return { filename: e3, line: 1, column: 1, offset: 0 };
            let s2 = 1, a = 1;
            for (let e4 = 0; e4 < Math.min(n4, r3.length); e4++) 10 === r3[e4] ? (s2++, a = 1) : a++;
            return { filename: e3, line: s2, column: a, offset: n4 };
          }("", this.source, t2.Pos()), r = new Error(`${e2.message} at line ${n3.line}, column ${n3.column}`);
          return r.position = n3, r;
        }
      };
    } });
    function createShortcodePlaceholder(e2, t2, n3) {
      return `${SHORTCODE_PLACEHOLDER_PREFIX}${e2}${t2}${n3}HBHB`;
    }
    function indexNonWhiteSpace2(e2, t2) {
      const n3 = t2.charCodeAt(0);
      for (let t3 = 0; t3 < e2.length; t3++) if (!isSpace22(e2[t3]) && e2[t3] === n3) return t3;
      return -1;
    }
    function isSpace22(e2) {
      return 32 === e2 || 9 === e2 || 13 === e2 || 10 === e2;
    }
    var MediaType;
    var INTERNAL_SUMMARY_DIVIDER_PRE;
    var Content;
    var RenderingResultImpl;
    var ResultImpl;
    var yaml;
    var import_smol_toml2;
    var log18;
    var MarkdownImpl;
    var ParserResult;
    var init_shortcode = __esm2({ "internal/domain/markdown/vo/shortcode.ts"() {
      init_log(), log16 = getDomainLogger("markdown", { component: "vo/shortcode" }), ShortcodeImpl = class {
        constructor(e2 = 0, t2 = "", n3 = null, r = 0, i = 0, s2 = false, a = false) {
          __publicField(this, "name");
          __publicField(this, "params");
          __publicField(this, "pos");
          __publicField(this, "length");
          __publicField(this, "rawContent");
          __publicField(this, "placeholder");
          __publicField(this, "inline");
          __publicField(this, "closed");
          __publicField(this, "inner");
          __publicField(this, "ordinal");
          __publicField(this, "indentation");
          __publicField(this, "doMarkup");
          __publicField(this, "isClosing");
          __publicField(this, "info");
          __publicField(this, "templs");
          this.ordinal = e2, this.name = t2, this.params = n3, this.pos = r, this.length = i, this.rawContent = "", this.inline = s2, this.closed = a, this.doMarkup = false, this.isClosing = false, this.placeholder = "", this.inner = [];
        }
        needsInner() {
          return !this.inline;
        }
      }, ShortcodeParser = class {
        constructor(e2, t2 = Date.now()) {
          __publicField(this, "shortcodes", []);
          __publicField(this, "nameSet", /* @__PURE__ */ new Set());
          __publicField(this, "source");
          __publicField(this, "ordinal", 0);
          __publicField(this, "pid");
          __publicField(this, "openShortcodes", /* @__PURE__ */ new Map());
          __publicField(this, "paramElements", 0);
          this.source = e2, this.pid = t2;
        }
        parseItem(e2, t2) {
          var _a6;
          const n3 = this.extractShortcode(this.ordinal, 0, t2);
          if (!n3) throw new Error("Failed to extract shortcode");
          n3.pos = e2.Pos() + e2.ValStr(this.source).length, n3.length = t2.Current().Pos() + t2.Current().ValStr(this.source).length - n3.pos;
          const r = this.source.slice(n3.pos, n3.pos + n3.length);
          return n3.rawContent = new TextDecoder().decode(r), n3.name && this.nameSet.add(n3.name), (_a6 = n3.params) != null ? _a6 : n3.params = [], n3.placeholder = createShortcodePlaceholder("s", this.pid, this.ordinal), this.ordinal++, this.shortcodes.push(n3), n3;
        }
        extractShortcode(e2, t2, n3) {
          const r = new ShortcodeImpl(e2);
          if (n3.Pos() > 0) {
            n3.Backup();
            const e3 = n3.Next();
            e3.IsIndentation() && (r.indentation = e3.ValStr(this.source));
          }
          let i = 0, s2 = 0;
          const a = t2 + 1;
          let o = false;
          const l = "failed to extract shortcode";
          let c = 0;
          for (; ; ) {
            const e3 = n3.Next();
            if (e3.IsLeftShortcodeDelim()) {
              const t3 = n3.Peek();
              if (t3.IsRightShortcodeDelim()) throw new Error("shortcode has no name");
              if (t3.IsShortcodeClose()) continue;
              if (i > 0) {
                n3.Backup();
                const e4 = this.extractShortcode(s2, a, n3);
                s2++, e4 && e4.name && (this.nameSet.add(e4.name), Array.isArray(r.inner) || (r.inner = []), r.inner.push(e4));
              } else r.doMarkup = e3.IsShortcodeMarkupDelimiter();
              i++;
            } else if (e3.IsRightShortcodeDelim()) {
              if (!r.inline && !r.needsInner()) return this.openShortcodes.set(r.name, false), r;
            } else {
              if (e3.IsShortcodeClose()) {
                o = true;
                const e4 = n3.Peek();
                if (!r.inline && !r.needsInner()) {
                  if (e4.IsError()) continue;
                  throw new Error(`${l}: shortcode "${r.name}" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`);
                }
                return e4.IsRightShortcodeDelim() ? n3.Consume(1) : (r.isClosing = true, n3.Consume(2)), r.inline || this.openShortcodes.set(r.name, false), r;
              }
              if (e3.IsText()) {
                Array.isArray(r.inner) || (r.inner = []);
                const t3 = e3.ValStr(this.source);
                r.inner.push(t3);
              } else if (e3.IsShortcodeName() || e3.IsInlineShortcodeName()) {
                if (r.name = e3.ValStr(this.source).trim(), r.inline = e3.IsInlineShortcodeName(), this.openShortcodes.has(r.name) && this.openShortcodes.get(r.name)) throw new Error(`shortcode ${r.name} nested in itself`);
                if (r.inline || this.openShortcodes.set(r.name, true), r.inline) {
                  const e4 = this.source.slice(n3.Pos() + 3), t3 = indexNonWhiteSpace2(e4, "/");
                  if (t3 !== this.source.length - 1) {
                    const n4 = new TextDecoder().decode(e4.slice(t3 + 1));
                    if (-1 === t3 || !n4.startsWith(r.name + " ")) throw new Error("inline shortcodes do not support nesting");
                  }
                }
              } else if (e3.IsShortcodeParam()) {
                if (!n3.IsValueNext()) {
                  log16.warn(`${l}: shortcode "${r.name}" has a parameter without a value`);
                  continue;
                }
                if (n3.Peek().IsShortcodeParamVal()) if (null === r.params || void 0 === r.params) {
                  const t3 = {}, i2 = e3.ValStr(this.source);
                  n3.Next(), t3[i2] = n3.Current().ValTyped(this.source), r.params = t3;
                } else {
                  if (Array.isArray(r.params)) throw new Error(`${l}: invalid state: invalid param type Array for shortcode "${r.name}", expected a map`);
                  {
                    const t3 = e3.ValStr(this.source);
                    n3.Next(), r.params[t3] = n3.Current().ValTyped(this.source);
                  }
                }
                else if (null === r.params || void 0 === r.params) {
                  const t3 = [];
                  t3.push(e3.ValTyped(this.source)), r.params = t3;
                } else {
                  if (!Array.isArray(r.params)) throw new Error(`${l}: invalid state: invalid param type Object for shortcode "${r.name}", expected an array`);
                  r.params.push(e3.ValTyped(this.source));
                }
              } else if (e3.IsShortcodeParamVal()) {
                if (0 === c && (c = 1), Array.isArray(r.params)) r.params.push(e3.ValTyped(this.source));
                else if (null === r.params || void 0 === r.params) {
                  const t3 = [];
                  t3.push(e3.ValTyped(this.source)), r.params = t3;
                }
              } else if (e3.IsDone()) {
                if (!e3.IsError() && !o && r.needsInner()) throw new Error(`${l}: shortcode "${r.name}" must be closed or self-closed`);
                n3.Backup();
                break;
              }
            }
          }
          return r.inline || this.openShortcodes.set(r.name, false), r;
        }
        getShortcodes() {
          return this.shortcodes;
        }
        getNames() {
          return Array.from(this.nameSet);
        }
      }, createShortcodePlaceholder("TOC", 0, 0), SHORTCODE_PLACEHOLDER_PREFIX = "HAHAHUGOSHORTCODE";
    } });
    var init_type6 = __esm2({ "pkg/media/type.ts"() {
      MediaType = class {
        constructor(e2) {
          __publicField(this, "type");
          __publicField(this, "mainType");
          __publicField(this, "subType");
          __publicField(this, "delimiter");
          __publicField(this, "firstSuffix");
          __publicField(this, "mimeSuffix");
          __publicField(this, "suffixesCSV");
          this.type = e2.type, this.mainType = e2.mainType, this.subType = e2.subType, this.delimiter = e2.delimiter, this.firstSuffix = e2.firstSuffix, this.mimeSuffix = e2.mimeSuffix, this.suffixesCSV = e2.suffixesCSV;
        }
        sub() {
          if (this.subType) return this.subType;
          const e2 = this.type.split("/");
          return 2 === e2.length ? e2[1].split("+")[0] : "";
        }
        getMimeSuffix() {
          if (this.mimeSuffix) return this.mimeSuffix;
          const e2 = this.type.indexOf("+");
          return -1 !== e2 ? this.type.substring(e2 + 1) : void 0;
        }
        getSuffixList() {
          return this.suffixesCSV ? this.suffixesCSV.split(",") : [];
        }
      };
    } });
    var init_content = __esm2({ "internal/domain/markdown/vo/content.ts"() {
      init_type6(), init_log(), getDomainLogger("markdown", { component: "content" }), INTERNAL_SUMMARY_DIVIDER_PRE = new TextEncoder().encode("\n\nHUGOMORE42\n\n"), Content = class {
        constructor(e2, t2) {
          __publicField(this, "hasSummaryDivider", false);
          __publicField(this, "summaryTruncated", false);
          __publicField(this, "rawSource");
          __publicField(this, "items", []);
          __publicField(this, "renderer");
          this.rawSource = e2, this.renderer = t2;
        }
        isEmpty() {
          return !this.rawSource || 0 === this.rawSource.length;
        }
        setSummaryDivider() {
          this.hasSummaryDivider = true;
        }
        getHasSummaryDivider() {
          return this.hasSummaryDivider;
        }
        setSummaryTruncated() {
          this.summaryTruncated = true;
        }
        getTruncated() {
          return this.summaryTruncated;
        }
        addReplacement(e2, t2) {
          const n3 = { val: e2, source: t2 };
          this.items.push(n3);
        }
        addShortcode(e2) {
          this.items.push(e2);
        }
        addItem(e2) {
          this.items.push(e2);
        }
        addItems(...e2) {
          this.items.push(...e2);
        }
        rawContent() {
          return new TextDecoder().decode(this.rawSource);
        }
        pureContent() {
          const e2 = [], t2 = new TextDecoder(), n3 = new TextEncoder();
          for (const t3 of this.items) if (this.isItem(t3)) {
            const n4 = this.rawSource.slice(t3.Pos(), t3.Pos() + t3.Val(this.rawSource).length);
            e2.push(n4);
          } else this.isContentReplacement(t3) ? e2.push(t3.val) : this.isShortcode(t3) && e2.push(n3.encode(t3.placeholder));
          const r = e2.reduce((e3, t3) => e3 + t3.length, 0), i = new Uint8Array(r);
          let s2 = 0;
          for (const t3 of e2) i.set(t3, s2), s2 += t3.length;
          return t2.decode(i);
        }
        pureContentWithoutPlaceholder() {
          const e2 = [], t2 = new TextDecoder();
          for (const t3 of this.items) if (this.isItem(t3)) {
            const n4 = this.rawSource.slice(t3.Pos(), t3.Pos() + t3.Val(this.rawSource).length);
            e2.push(n4);
          } else this.isContentReplacement(t3) ? e2.push(t3.val) : this.isShortcode(t3);
          const n3 = e2.reduce((e3, t3) => e3 + t3.length, 0), r = new Uint8Array(n3);
          let i = 0;
          for (const t3 of e2) r.set(t3, i), i += t3.length;
          return t2.decode(r);
        }
        renderedContent(e2) {
          let t2 = this.pureContent();
          if (e2) {
            for (const n3 of this.items) if (this.isShortcode(n3)) {
              const r = e2(n3);
              t2 = t2.replace(n3.placeholder, r);
            }
          }
          return t2;
        }
        async renderedContentAsync(e2) {
          let t2 = await this.renderer.render(this.pureContent());
          if (e2) {
            for (const n3 of this.items) if (this.isShortcode(n3)) try {
              const r = await e2(n3);
              t2 = t2.replace(n3.placeholder, r);
            } catch (e3) {
            }
          }
          return t2;
        }
        getItems() {
          return [...this.items];
        }
        getShortcodes() {
          return this.items.filter(this.isShortcode);
        }
        getTextItems() {
          return this.items.filter(this.isItem);
        }
        getReplacements() {
          return this.items.filter(this.isContentReplacement);
        }
        extractSummary(e2, t2) {
          const n3 = new TextDecoder().decode(e2), r = this.extractSummaryFromHTML(t2, n3, 70, this.containsCJK(n3)), i = r.summaryLowHigh.high > r.summaryLowHigh.low ? n3.substring(r.summaryLowHigh.low, r.summaryLowHigh.high).trim() : "";
          if (i) return this.summaryTruncated = r.truncated, { summary: i, truncated: r.truncated };
          const s2 = this.trimShortHTML(e2);
          return this.summaryTruncated = s2.length < e2.length, { summary: new TextDecoder().decode(e2), truncated: this.summaryTruncated };
        }
        extractSummaryFromHTML(e2, t2, n3, r) {
          const i = { source: t2, summaryLowHigh: { low: 0, high: t2.length }, truncated: false };
          if (n3 <= 0) return i;
          let s2 = 0;
          const a = t2.split(/\s+/);
          for (let e3 = 0; e3 < a.length && s2 < n3; e3++) {
            const o = a[e3].trim();
            if (0 !== o.length && !this.isProbablyHTMLToken(o)) {
              if (r) {
                const e4 = this.stripHTML(o), t3 = [...e4].length;
                s2 += e4.length === e4.replace(/[^\u0000-\u007F]/g, "").length ? 1 : t3;
              } else s2 += 1;
              if (s2 >= n3) {
                const n4 = a.slice(0, e3 + 1).join(" "), r3 = t2.indexOf(n4) + n4.length;
                i.summaryLowHigh = { low: 0, high: Math.min(r3, t2.length) }, i.truncated = true;
                break;
              }
            }
          }
          return i;
        }
        containsCJK(e2) {
          return /[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e2);
        }
        isProbablyHTMLToken(e2) {
          return ">" === e2 || /^<\/?[A-Za-z]+>?$/.test(e2) || /^[A-Za-z]+=["']/.test(e2);
        }
        stripHTML(e2) {
          return e2.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
        }
        trimShortHTML(e2) {
          const t2 = new TextDecoder(), n3 = new TextEncoder();
          let r = t2.decode(e2);
          return 1 === (r.match(/<p>/g) || []).length && (r = r.trim(), r.startsWith("<p>") && r.endsWith("</p>") && (r = r.slice(3, -4).trim())), n3.encode(r);
        }
        cleanDividerPlaceholders(e2) {
          return this.hasSummaryDivider ? e2.replace(new RegExp("HUGOMORE42", "g"), "") : e2;
        }
        getDividedSummary(e2) {
          const t2 = e2;
          if (this.hasSummaryDivider) {
            const e3 = t2.indexOf("HUGOMORE42");
            if (-1 !== e3) return t2.substring(0, e3).trim();
          }
          return "";
        }
        async getRenderedSummary(e2, t2) {
          if (this.hasSummaryDivider && e2) return this.getDividedSummary(e2);
          const n3 = this.pureContentWithoutPlaceholder(), r = new TextEncoder().encode(n3), i = new MediaType({ type: "text/html", mainType: "text", subType: "html", delimiter: ".", firstSuffix: { suffix: "html", fullSuffix: ".html" }, mimeSuffix: "", suffixesCSV: "html" }), s2 = this.extractSummary(r, i);
          let a = s2.summary;
          return s2.truncated && (a += "..."), t2 && a.length > t2 && (a = a.substring(0, t2).trim() + "..."), await this.renderer.render(a);
        }
        getWordCount() {
          return this.pureContent().trim().split(/\s+/).filter((e2) => e2.length > 0).length;
        }
        getReadingTime(e2 = 200) {
          const t2 = this.getWordCount();
          return Math.ceil(t2 / e2);
        }
        isItem(e2) {
          return "Type" in e2 && "firstByte" in e2 && "low" in e2 && "high" in e2;
        }
        isShortcode(e2) {
          return "name" in e2 && "placeholder" in e2 && "params" in e2;
        }
        isContentReplacement(e2) {
          return "val" in e2 && "source" in e2;
        }
      };
    } });
    var init_parserresult = __esm2({ "internal/domain/markdown/vo/parserresult.ts"() {
      RenderingResultImpl = class {
        constructor(e2) {
          this.buffer = e2;
        }
        bytes() {
          return this.buffer.bytes();
        }
        toString() {
          return new TextDecoder().decode(this.bytes());
        }
      }, ResultImpl = class {
        constructor(e2, t2) {
          this.parsingResult = e2, this.renderingResult = t2;
        }
        headers() {
          return this.parsingResult.headers();
        }
        tableOfContents() {
          return this.parsingResult.tableOfContents();
        }
        bytes() {
          return this.renderingResult.bytes();
        }
      };
    } });
    var init_markdown3 = __esm2({ "internal/domain/markdown/entity/markdown.ts"() {
      yaml = __toESM3(require_js_yaml()), import_smol_toml2 = require_dist(), init_parserresult(), init_context2(), init_parseinfo(), init_item(), init_shortcode(), init_content(), init_log(), log18 = getDomainLogger("markdown", { component: "MarkdownImpl" }), MarkdownImpl = class {
        constructor(e2, t2) {
          this.renderer = e2, this.highlighter = t2;
        }
        async render(e2, t2) {
          const n3 = await this.parse(e2), r = await this.renderToBytes(e2, t2, n3);
          return new ResultImpl(n3, r);
        }
        async highlight(e2, t2, n3) {
          return this.highlighter.highlight(e2, t2, n3);
        }
        async highlightCodeBlock(e2, t2) {
          return this.highlighter.highlightCodeBlock(e2, t2);
        }
        async renderCodeblock(e2, t2, n3) {
          return this.highlighter.renderCodeblock(e2, t2, n3);
        }
        isDefaultCodeBlockRenderer() {
          return this.highlighter.isDefaultCodeBlockRenderer();
        }
        async prepareRender(e2) {
          var _a6;
          const t2 = await this.parseContent(e2), n3 = (_a6 = t2.frontMatter) == null ? void 0 : _a6.params, r = await this.renderer.parse(t2.content.pureContent());
          return { frontMatter: () => n3 || {}, toc: () => r.tableOfContents(), render: async (e3) => {
            const r3 = await t2.content.renderedContentAsync(e3.shortcodeRenderer), i = await t2.content.getRenderedSummary(r3, e3.maxSummaryLength), s2 = t2.content.getWordCount(), a = t2.content.getReadingTime(e3.wordsPerMinute), o = { renderedContent: t2.content.cleanDividerPlaceholders(r3), wordCount: s2, readingTime: a };
            return n3 && (o.frontMatter = n3), i && (o.summary = i), o;
          } };
        }
        async parseAndRenderContent(e2, t2 = {}) {
          var _a6;
          const n3 = await this.parseContent(e2), r = (_a6 = n3.frontMatter) == null ? void 0 : _a6.params;
          let i;
          i = t2.shortcodeRenderer && n3.shortcodes.length > 0 ? await n3.content.renderedContentAsync(t2.shortcodeRenderer) : n3.content.pureContent();
          const s2 = await this.renderer.render(i);
          if (this.hasCollectedTagsSupport()) {
            const e3 = this.getCollectedTags();
            if (e3.length > 0) {
              const t3 = r || {}, i2 = Array.isArray(t3.tags) ? t3.tags : t3.tags ? [t3.tags] : [], s3 = [.../* @__PURE__ */ new Set([...i2, ...e3])];
              t3.tags = s3, n3.frontMatter && (n3.frontMatter.params = t3), log18.debug(`Merged tags: YAML [${i2.join(", ")}] + inline [${e3.join(", ")}] = [${s3.join(", ")}]`);
            }
          }
          const a = n3.content.getDividedSummary(s2), o = { renderedContent: s2, wordCount: n3.content.getWordCount(), readingTime: n3.content.getReadingTime(t2.wordsPerMinute) };
          return r && (o.frontMatter = r), a && (o.summary = a), o;
        }
        hasCollectedTagsSupport() {
          return "function" == typeof this.renderer.getCollectedTags;
        }
        getCollectedTags() {
          return this.hasCollectedTagsSupport() ? this.renderer.getCollectedTags() : [];
        }
        async parseContent(e2) {
          let t2;
          const n3 = new Content(e2, this.renderer), r = new ShortcodeParser(e2), i = [], s2 = function(e3, t3) {
            return new SourceParseInfo(e3, t3);
          }(e2, { frontMatterHandler: () => (n4) => {
            t2 = this.parseFrontMatter(n4, e2);
          }, summaryHandler: () => (t3, r3) => {
            let i2 = -1;
            r3.PeekWalk((t4) => (-1 !== i2 || t4.IsDone() || (i2 = t4.Pos()), !t4.IsNonWhitespace(e2) || (n3.setSummaryTruncated(), false))), n3.setSummaryDivider(), n3.addReplacement(INTERNAL_SUMMARY_DIVIDER_PRE, t3);
          }, shortcodeHandler: () => (e3, t3) => {
            const s3 = r.parseItem(e3, t3);
            i.push(s3), n3.addShortcode(s3);
          }, bytesHandler: () => (e3) => {
            n3.addItem(e3);
          } });
          return await s2.parse(), await s2.handle(), { frontMatter: t2, content: n3, shortcodes: i, summary: await n3.getRenderedSummary(), wordCount: n3.getWordCount(), readingTime: n3.getReadingTime() };
        }
        parseFrontMatter(e2, t2) {
          const n3 = e2.ValStr(t2);
          let r, i = {};
          switch (e2.Type) {
            case 3:
              r = "yaml", i = this.parseYAML(n3);
              break;
            case 4:
              r = "toml", i = this.parseTOML(n3);
              break;
            case 5:
              r = "json", i = this.parseJSON(n3);
              break;
            case 6:
              r = "org", i = this.parseOrg(n3);
              break;
            default:
              r = "yaml";
          }
          return { params: i, format: r };
        }
        parseYAML(e2) {
          try {
            const t2 = yaml.load(e2);
            return t2 && "object" == typeof t2 && !Array.isArray(t2) ? t2 : {};
          } catch (e3) {
            return {};
          }
        }
        parseTOML(e2) {
          try {
            const t2 = (0, import_smol_toml2.parse)(e2);
            return t2 && "object" == typeof t2 && !Array.isArray(t2) ? t2 : {};
          } catch (e3) {
            return {};
          }
        }
        parseJSON(e2) {
          try {
            return JSON.parse(e2);
          } catch (e3) {
            return {};
          }
        }
        parseOrg(e2) {
          const t2 = {}, n3 = e2.split("\n");
          for (const e3 of n3) {
            const n4 = e3.trim();
            if (!n4.startsWith("#+")) continue;
            const r = n4.match(/^#\+([^:]+):\s*(.*)$/);
            if (r) {
              const e4 = r[1].trim().toLowerCase(), n5 = r[2].trim();
              t2[e4] = this.parseValue(n5);
            }
          }
          return t2;
        }
        parseValue(e2) {
          if (e2.startsWith('"') && e2.endsWith('"') || e2.startsWith("'") && e2.endsWith("'")) return e2.slice(1, -1);
          if ("true" === e2) return true;
          if ("false" === e2) return false;
          if (/^-?\d+$/.test(e2)) return parseInt(e2, 10);
          if (/^-?\d*\.\d+$/.test(e2)) return parseFloat(e2);
          if (e2.startsWith("[") && e2.endsWith("]")) {
            const t2 = e2.slice(1, -1).trim();
            return t2 ? t2.split(",").map((e3) => this.parseValue(e3.trim())) : [];
          }
          return e2;
        }
        async parse(e2) {
          const t2 = new TextDecoder().decode(e2.src);
          return await this.renderer.parse(t2);
        }
        async renderToBytes(e2, t2, n3) {
          const r = new TextDecoder().decode(e2.src), i = await this.renderer.render(r), s2 = new BufWriter();
          return await s2.writeString(i), new RenderingResultImpl(s2);
        }
      };
    } });
    var init_parserresult2 = __esm2({ "internal/domain/markdown/factory/it/parserresult.ts"() {
      init_tableofcontents(), ParserResult = class {
        constructor(e2, t2, n3) {
          __publicField(this, "_headers", []);
          __publicField(this, "_toc");
          __publicField(this, "tokens");
          __publicField(this, "source");
          __publicField(this, "idGenerator");
          this.tokens = e2, this.source = t2, this.idGenerator = n3 || new AutoIDGenerator2(), this._toc = this.buildTableOfContents(), this._headers = this.extractHeaders();
        }
        headers() {
          return [...this._headers];
        }
        tableOfContents() {
          return this._toc;
        }
        getTokens() {
          return [...this.tokens];
        }
        getSource() {
          return this.source;
        }
        buildTableOfContents() {
          const e2 = new TOCBuilder();
          for (const t2 of this.tokens) if ("heading_open" === t2.type) {
            const n3 = parseInt(t2.tag.substring(1)), r = this.findNextTextToken(t2);
            if (r) {
              const t3 = r.content, i = this.idGenerator.generateID(t3);
              e2.addHeading(t3, n3, i);
            }
          }
          return e2.build();
        }
        extractHeaders() {
          const e2 = [];
          for (let t2 = 0; t2 < this.tokens.length; t2++) {
            const n3 = this.tokens[t2];
            if ("heading_open" === n3.type) {
              const r = parseInt(n3.tag.substring(1)), i = this.findNextTextToken(n3, t2);
              if (i) {
                const t3 = new HeaderImpl(i.content, r);
                e2.push(t3);
              }
            }
          }
          return e2;
        }
        findNextTextToken(e2, t2) {
          for (let n3 = void 0 !== t2 ? t2 + 1 : this.tokens.indexOf(e2) + 1; n3 < this.tokens.length; n3++) {
            const e3 = this.tokens[n3];
            if ("inline" === e3.type) return e3;
            if ("heading_close" === e3.type) break;
          }
          return null;
        }
      };
    } });
    var init_slugger_fallback = __esm2({ "internal/domain/markdown/factory/it/util/slugger-fallback.ts"() {
    } });
    function slugifyFilePath(e2, t2) {
      var _a6;
      e2 = function(e3) {
        return e3.startsWith("/") && (e3 = e3.substring(1)), e3.endsWith("/") && (e3 = e3.slice(0, -1)), e3;
      }(e2);
      let n3 = (r = e2, (_a6 = r.match(/\.[A-Za-z0-9]+$/)) == null ? void 0 : _a6[0]);
      var r;
      const i = e2.replace(new RegExp(n3 + "$"), "");
      (t2 || [".md", ".html", void 0].includes(n3)) && (n3 = "");
      let s2 = function(e3) {
        return e3.split("/").map((e4) => e4.replace(/\s/g, "-").replace(/&/g, "-and-").replace(/%/g, "-percent").replace(/\?/g, "").replace(/#/g, "")).join("/").replace(/\/$/, "");
      }(i);
      return function(e3, t3) {
        return e3 === t3 || e3.endsWith("/" + t3);
      }(s2, "_index") && (s2 = s2.replace(/_index$/, "index")), s2 + n3;
    }
    function splitAnchor(e2) {
      let [t2, n3] = e2.split("#", 2);
      return t2.endsWith(".pdf") ? [t2, void 0 === n3 ? "" : `#${n3}`] : (n3 = void 0 === n3 ? "" : "#" + n3.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w\u4e00-\u9fa5\-]+/g, "").replace(/\-+/g, "-").replace(/^-+|-+$/g, ""), [t2, n3]);
    }
    var externalLinkRegex;
    var wikilinkRegex;
    var tableRegex;
    var tableWikilinkRegex;
    var wikilinkImageEmbedRegex;
    var init_path2 = __esm2({ "internal/domain/markdown/factory/it/util/path.ts"() {
      init_slugger_fallback();
    } });
    var init_wikilink = __esm2({ "internal/domain/markdown/factory/it/plugins/wikilink.ts"() {
      init_path2(), externalLinkRegex = /^https?:\/\//i, wikilinkRegex = new RegExp(/!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]*)?\]\]/g), tableRegex = new RegExp(/^\|([^\n])+\|\n(\|)( ?:?-{3,}:? ?\|)+\n(\|([^\n])+\|\n?)+/gm), tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/g);
    } });
    function wikilinkInlineRule(e2, t2) {
      const n3 = e2.pos, r = e2.posMax;
      if (n3 + 5 > r) return false;
      const i = 33 === e2.src.charCodeAt(n3), s2 = i ? 1 : 0;
      if (91 !== e2.src.charCodeAt(n3 + s2) || 91 !== e2.src.charCodeAt(n3 + s2 + 1)) return false;
      let a = n3 + s2 + 2, o = false;
      for (; a < r - 1; ) {
        if (93 === e2.src.charCodeAt(a) && 93 === e2.src.charCodeAt(a + 1)) {
          o = true;
          break;
        }
        a++;
      }
      if (!o) return false;
      const l = e2.src.slice(n3 + s2 + 2, a);
      if (0 === l.trim().length) return false;
      const c = l.indexOf("|"), h3 = l.indexOf("#");
      let u, d = "", p2 = "";
      if (-1 !== c) {
        const e3 = l.slice(0, c);
        u = l.slice(c + 1).trim();
        const t3 = e3.indexOf("#");
        -1 !== t3 ? (d = e3.slice(0, t3).trim(), p2 = e3.slice(t3).trim()) : d = e3.trim();
      } else -1 !== h3 ? (d = l.slice(0, h3).trim(), p2 = l.slice(h3).trim()) : d = l.trim();
      if (!t2) {
        const t3 = i ? "wikilink_embed" : "wikilink_link", n4 = e2.push(t3, "", 0), r3 = { isEmbed: i, filepath: d, anchor: p2, alias: u, url: d + p2 };
        n4.meta = r3, n4.content = u || d;
      }
      return e2.pos = a + 2, true;
    }
    function renderWikilinkLink(e2, t2) {
      var _a6;
      const n3 = e2[t2].meta, [r, i] = splitAnchor(n3.url), s2 = slugifyFilePath(r), a = escapeHtml((_a6 = n3.alias) != null ? _a6 : n3.filepath);
      return `<a class="internal" data-slug="${s2}" data-wikilink="${escapeHtml(n3.url)}">${a}</a>`;
    }
    function renderWikilinkEmbed(e2, t2) {
      const n3 = e2[t2].meta, { filepath: r, anchor: i, alias: s2 } = n3, a = slugifyFilePath(r), o = function(e3) {
        const t3 = e3.toLowerCase().match(/\.[a-z0-9]+$/);
        return t3 ? t3[0] : "";
      }(r);
      if ([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg", ".webp"].includes(o)) {
        const { alt: e3, width: t3, height: n4 } = function(e4) {
          if (!e4) return { alt: "", width: "auto", height: "auto" };
          const t4 = wikilinkImageEmbedRegex.exec(e4);
          return t4 && t4.groups ? { alt: t4.groups.alt || "", width: t4.groups.width || "auto", height: t4.groups.height || "auto" } : { alt: e4, width: "auto", height: "auto" };
        }(s2);
        return `<img src="${a}" alt="${escapeHtml(e3)}" width="${t3}" height="${n4}" />`;
      }
      return [".mp4", ".webm", ".ogv", ".mov", ".mkv"].includes(o) ? `<video src="${a}" controls></video>` : [".mp3", ".webm", ".wav", ".m4a", ".ogg", ".3gp", ".flac"].includes(o) ? `<audio src="${a}" controls></audio>` : [".pdf"].includes(o) ? `<iframe src="${a}" class="pdf"></iframe>` : `<blockquote class="transclude" data-url="${a}" data-block="${i}"><a href="${a + i}" class="transclude-inner">Transclude of ${a}</a></blockquote>`;
    }
    function escapeHtml(e2) {
      return e2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
    }
    function wikilinkPlugin(e2, t2) {
      false !== (t2 == null ? void 0 : t2.enable) && (e2.inline.ruler.before("link", "wikilink", wikilinkInlineRule), e2.renderer.rules.wikilink_link = renderWikilinkLink, e2.renderer.rules.wikilink_embed = renderWikilinkEmbed);
    }
    var init_wikilink_plugin = __esm2({ "internal/domain/markdown/factory/it/plugins/wikilink-plugin.ts"() {
      init_path2(), wikilinkImageEmbedRegex = new RegExp(/^(?<alt>(?!^\d*x?\d*$).*?)?(\|?\s*?(?<width>\d+)(x(?<height>\d+))?)?$/);
    } });
    function tagInlineRule(e2, t2) {
      const n3 = e2.pos;
      if (n3 + 2 > e2.posMax) return false;
      if (35 !== e2.src.charCodeAt(n3)) return false;
      if (n3 > 0) {
        const t3 = e2.src.charCodeAt(n3 - 1);
        if (32 !== t3 && 10 !== t3 && 9 !== t3) return false;
      }
      const r = e2.src.slice(n3), i = /^#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/u.exec(r);
      if (!i) return false;
      const s2 = i[0], a = i[1];
      if (/^[\/\d]+$/.test(a)) return false;
      if (!t2) {
        const t3 = e2.push("tag", "", 0), n4 = a.split("/").map((e3) => e3.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^\p{L}\p{Emoji}\p{M}\d\-_]/gu, "")).join("/"), r3 = e2.md.__tagPluginState, i2 = { rawTag: a, slugTag: n4, url: `${(r3 == null ? void 0 : r3.tagBaseURL) || "tags/"}${n4}` };
        t3.meta = i2, t3.content = a, (r3 == null ? void 0 : r3.onTagFound) && r3.onTagFound(n4);
      }
      return e2.pos = n3 + s2.length, true;
    }
    function renderTag(e2, t2) {
      const n3 = e2[t2].meta, r = n3.rawTag.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
      return `<a href="${n3.url}" class="internal tag-link">${r}</a>`;
    }
    function tagPlugin(e2, t2) {
      const n3 = { enable: true, tagBaseURL: "tags/", ...t2 };
      false !== n3.enable && (e2.__tagPluginState = { tagBaseURL: n3.tagBaseURL, onTagFound: n3.onTagFound }, e2.inline.ruler.before("emphasis", "tag", tagInlineRule), e2.renderer.rules.tag = renderTag);
    }
    var import_token;
    var calloutMapping;
    var calloutRegex;
    var init_tag_plugin = __esm2({ "internal/domain/markdown/factory/it/plugins/tag-plugin.ts"() {
      new RegExp(/(?<=^| )#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/gu);
    } });
    function parseCallout(e2, t2) {
      if ("blockquote_open" !== e2[t2].type) return null;
      let n3 = t2 + 1;
      for (; n3 < e2.length && "paragraph_open" !== e2[n3].type; ) {
        if ("blockquote_close" === e2[n3].type) return null;
        n3++;
      }
      if (n3 >= e2.length) return null;
      const r = n3 + 1;
      if ("inline" !== e2[r].type) return null;
      const i = e2[r].content, s2 = i.match(calloutRegex);
      if (!s2) return null;
      const [a, o, l = "", c] = s2;
      var h3;
      return { type: function(e3) {
        var _a6;
        const t3 = e3.toLowerCase();
        return (_a6 = calloutMapping[t3]) != null ? _a6 : e3;
      }(o.toLowerCase()), title: i.split("\n")[0].slice(a.length).trim() || (h3 = o.replace(/-/g, " ")).charAt(0).toUpperCase() + h3.slice(1), collapse: c, metadata: l, firstLineIdx: r };
    }
    function transformCalloutTokens(e2, t2, n3) {
      const r = parseCallout(e2, t2);
      if (!r) return t2;
      const { type: i, title: s2, collapse: a, metadata: o, firstLineIdx: l } = r;
      let c = t2 + 1, h3 = 1;
      for (; c < e2.length && h3 > 0; ) "blockquote_open" === e2[c].type && h3++, "blockquote_close" === e2[c].type && h3--, c++;
      c--, e2[t2].type = "callout_open", e2[t2].tag = "div", e2[t2].attrSet("class", `callout ${i}${a ? " is-collapsible" : ""}${"-" === a ? " is-collapsed" : ""}`), e2[t2].attrSet("data-callout", i), a && e2[t2].attrSet("data-callout-fold", a), o && e2[t2].attrSet("data-callout-metadata", o);
      const u = e2[l], d = u.content.split("\n"), p2 = d[0], g = p2.match(calloutRegex);
      if (g) {
        const t3 = g[0], n4 = p2.slice(t3.length).trim(), r3 = d.slice(1);
        if (u.content = n4, r3.length > 0 && r3.join("\n").trim()) {
          const t4 = l + 1, n5 = new import_token.default("paragraph_open", "p", 1), i2 = new import_token.default("inline", "", 0);
          i2.content = r3.join("\n").trim(), i2.children = [];
          const s3 = new import_token.default("paragraph_close", "p", -1);
          e2.splice(t4 + 1, 0, n5, i2, s3), c += 3;
        }
      }
      let m2 = t2 + 1;
      for (; m2 < c && "paragraph_open" !== e2[m2].type; ) m2++;
      let f3 = m2 + 1;
      for (; f3 < c && "paragraph_close" !== e2[f3].type; ) f3++;
      const _ = [], T = new import_token.default("callout_title_open", "div", 1);
      T.attrSet("class", "callout-title"), _.push(T);
      const E = new import_token.default("callout_icon", "div", 0);
      E.attrSet("class", "callout-icon"), _.push(E);
      const S = new import_token.default("callout_title_inner_open", "div", 1);
      S.attrSet("class", "callout-title-inner"), _.push(S);
      const A = new import_token.default("inline", "", 0);
      A.content = s2, A.children = [], _.push(A);
      const I = new import_token.default("callout_title_inner_close", "div", -1);
      if (_.push(I), a) {
        const e3 = new import_token.default("callout_fold_icon", "div", 0);
        e3.attrSet("class", "fold-callout-icon"), _.push(e3);
      }
      const y = new import_token.default("callout_title_close", "div", -1);
      _.push(y), e2.splice(m2, f3 - m2 + 1), c -= f3 - m2 + 1, e2.splice(t2 + 1, 0, ..._), c += _.length;
      const w2 = t2 + 1 + _.length;
      if (w2 < c) {
        const t3 = new import_token.default("callout_content_open", "div", 1);
        t3.attrSet("class", "callout-content"), e2.splice(w2, 0, t3), c++;
        const n4 = new import_token.default("callout_content_close", "div", -1);
        e2.splice(c, 0, n4), c++;
      }
      return e2[c].type = "callout_close", e2[c].tag = "div", c;
    }
    function calloutRule(e2) {
      let t2 = 0, n3 = 0;
      for (; t2 < e2.tokens.length; ) "blockquote_open" === e2.tokens[t2].type && parseCallout(e2.tokens, t2) ? (transformCalloutTokens(e2.tokens, t2, e2.md), n3++, t2++) : t2++;
      return n3 > 0;
    }
    function calloutPlugin(e2, t2) {
      false !== { enable: true, ...t2 }.enable && (e2.core.ruler.after("block", "callout", calloutRule), function(e3) {
        e3.renderer.rules.callout_open = (e4, t3) => {
          const n3 = e4[t3];
          return `<div${n3.attrs ? n3.attrs.map((e5) => {
            return ` ${e5[0]}="${t4 = e5[1], t4.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")}"`;
            var t4;
          }).join("") : ""}>`;
        }, e3.renderer.rules.callout_close = () => "</div>\n", e3.renderer.rules.callout_title_open = (e4, t3) => '<div class="callout-title">', e3.renderer.rules.callout_title_close = () => "</div>", e3.renderer.rules.callout_title_inner_open = () => '<div class="callout-title-inner">', e3.renderer.rules.callout_title_inner_close = () => "</div>", e3.renderer.rules.callout_icon = () => '<div class="callout-icon"></div>', e3.renderer.rules.callout_fold_icon = () => '<div class="fold-callout-icon"></div>', e3.renderer.rules.callout_content_open = () => '<div class="callout-content">', e3.renderer.rules.callout_content_close = () => "</div>";
      }(e2));
    }
    var init_callout_plugin = __esm2({ "internal/domain/markdown/factory/it/plugins/callout-plugin.ts"() {
      import_token = __toESM3((init_token(), __toCommonJS2(token_exports))), calloutMapping = { note: "note", abstract: "abstract", summary: "abstract", tldr: "abstract", info: "info", todo: "todo", tip: "tip", hint: "tip", important: "tip", success: "success", check: "success", done: "success", question: "question", help: "question", faq: "question", warning: "warning", caution: "warning", attention: "warning", failure: "failure", fail: "failure", missing: "failure", danger: "danger", error: "danger", bug: "bug", example: "example", quote: "quote", cite: "quote" }, calloutRegex = /^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/;
    } });
    function escapeHtml4(e2) {
      return e2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
    }
    function mathInlineRule(e2, t2) {
      const n3 = e2.pos, r = e2.posMax;
      if (36 !== e2.src.charCodeAt(n3)) return false;
      if (n3 > 0 && 92 === e2.src.charCodeAt(n3 - 1)) return false;
      if (36 === e2.src.charCodeAt(n3 + 1)) return false;
      let i = n3 + 1, s2 = false;
      for (; i < r; ) {
        const t3 = e2.src.charCodeAt(i);
        if (10 === t3) return false;
        if (36 === t3 && 92 !== e2.src.charCodeAt(i - 1)) {
          s2 = true;
          break;
        }
        i++;
      }
      if (!s2) return false;
      const a = e2.src.slice(n3 + 1, i);
      if (0 === a.trim().length) return false;
      if (!t2) {
        const t3 = e2.push("math_inline", "math", 0);
        t3.content = a, t3.markup = "$";
      }
      return e2.pos = i + 1, true;
    }
    function mathBlockRule(e2, t2, n3, r) {
      let i = e2.bMarks[t2] + e2.tShift[t2], s2 = e2.eMarks[t2];
      if (i + 2 > s2) return false;
      if (36 !== e2.src.charCodeAt(i) || 36 !== e2.src.charCodeAt(i + 1)) return false;
      if ("$$" !== e2.src.slice(i, s2).trim()) return false;
      let a = t2 + 1, o = false;
      for (; a < n3; ) {
        if (i = e2.bMarks[a] + e2.tShift[a], s2 = e2.eMarks[a], "$$" === e2.src.slice(i, s2).trim()) {
          o = true;
          break;
        }
        a++;
      }
      if (!o) return false;
      const l = [];
      for (let n4 = t2 + 1; n4 < a; n4++) {
        const t3 = e2.bMarks[n4] + e2.tShift[n4], r3 = e2.eMarks[n4];
        l.push(e2.src.slice(t3, r3));
      }
      const c = l.join("\n");
      if (!r) {
        const n4 = e2.push("math_block", "math", 0);
        n4.content = c, n4.markup = "$$", n4.block = true, n4.map = [t2, a + 1];
      }
      return e2.line = a + 1, true;
    }
    function renderMathInline(e2, t2) {
      return `<span class="math math-inline" data-math="inline">${escapeHtml4(e2[t2].content)}</span>`;
    }
    function renderMathBlock(e2, t2) {
      return `<div class="math math-display" data-math="block">${escapeHtml4(e2[t2].content)}</div>
`;
    }
    function latexPlugin(e2, t2) {
      false !== (t2 == null ? void 0 : t2.enable) && (e2.inline.ruler.before("escape", "math_inline", mathInlineRule), e2.block.ruler.before("fence", "math_block", mathBlockRule, { alt: ["paragraph", "reference", "blockquote", "list"] }), e2.renderer.rules.math_inline = renderMathInline, e2.renderer.rules.math_block = renderMathBlock);
    }
    var init_latex_plugin = __esm2({ "internal/domain/markdown/factory/it/plugins/latex-plugin.ts"() {
    } });
    function mermaidPlugin(e2, t2) {
      if (false === (t2 == null ? void 0 : t2.enable)) return;
      const n3 = e2.renderer.rules.fence || function(e3, t3, n4, r, i) {
        return i.renderToken(e3, t3, n4);
      };
      e2.renderer.rules.fence = function(t3, r, i, s2, a) {
        const o = t3[r], l = o.info ? e2.utils.unescapeAll(o.info).trim() : "";
        if ("mermaid" === (l ? l.split(/\s+/g)[0] : "")) {
          const t4 = o.content;
          return `<pre class="mermaid-wrapper"><code class="language-mermaid mermaid">${e2.utils.escapeHtml(t4)}</code><button class="expand-button" aria-label="Expand diagram"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg></button><div id="mermaid-container"><div id="mermaid-space"><div class="mermaid-content"></div></div></div></pre>
`;
        }
        return n3(t3, r, i, s2, a);
      };
    }
    var import_markdown_it;
    var MarkdownItRenderer;
    var init_mermaid_plugin = __esm2({ "internal/domain/markdown/factory/it/plugins/mermaid-plugin.ts"() {
    } });
    var init_config5 = __esm2({ "internal/domain/markdown/factory/it/config.ts"() {
    } });
    var init_tableofcontents2 = __esm2({ "internal/domain/markdown/factory/it/tableofcontents.ts"() {
    } });
    var init_it = __esm2({ "internal/domain/markdown/factory/it/index.ts"() {
      import_markdown_it = __toESM3(require_index_cjs4()), init_markdown5(), init_parserresult2(), init_wikilink(), init_wikilink_plugin(), init_tag_plugin(), init_callout_plugin(), init_latex_plugin(), init_mermaid_plugin(), init_config5(), init_parserresult2(), init_tableofcontents2(), init_wikilink_plugin(), init_tag_plugin(), init_callout_plugin(), init_latex_plugin(), init_mermaid_plugin(), init_wikilink(), init_path2(), init_slugger_fallback(), MarkdownItRenderer = class {
        constructor(e2, t2) {
          __publicField(this, "md");
          __publicField(this, "config");
          __publicField(this, "idGenerator");
          __publicField(this, "collectedTags", /* @__PURE__ */ new Set());
          var _a6, _b4, _c2;
          this.config = e2, this.idGenerator = new AutoIDGenerator2(), t2 ? (this.md = t2, ((_a6 = this.config.extensions.wikilink) == null ? void 0 : _a6.enable) && this.md.use(wikilinkPlugin, { enable: true }), this.config.extensions.parseTags && this.md.use(tagPlugin, { enable: true, tagBaseURL: "tags/", onTagFound: (e3) => this.collectedTags.add(e3) }), this.config.extensions.callouts && this.md.use(calloutPlugin, { enable: true }), ((_b4 = this.config.extensions.latex) == null ? void 0 : _b4.enable) && this.md.use(latexPlugin, { enable: true }), ((_c2 = this.config.extensions.mermaid) == null ? void 0 : _c2.enable) && this.md.use(mermaidPlugin, { enable: true })) : this.md = this.createMarkdownItInstance(), this.setupRendererRules();
        }
        setupRendererRules() {
          const e2 = this.idGenerator;
          this.md.renderer.rules.heading_open = function(t2, n3) {
            const r = t2[n3 + 1].content, i = e2.generateID(r);
            return t2[n3].attrPush(["id", i]), `<${t2[n3].tag} id="${i}">`;
          };
        }
        async render(e2) {
          var _a6;
          return this.idGenerator.reset(), this.collectedTags.clear(), ((_a6 = this.config.extensions.wikilink) == null ? void 0 : _a6.enable) && (e2 = e2.replace(tableRegex, (e3) => e3.replace(tableWikilinkRegex, (e4, t2) => {
            let n3 = t2 != null ? t2 : "";
            return n3 = n3.replace("#", "\\#"), n3 = n3.replace(/((^|[^\\])(\\\\)*)\|/g, "$1\\|"), n3;
          })).replace(wikilinkRegex, (e3, ...t2) => {
            var _a7;
            const [n3, r, i] = t2, [s2, a] = splitAnchor(`${n3 != null ? n3 : ""}${r != null ? r : ""}`), o = Boolean(r == null ? void 0 : r.startsWith("#^")) ? "^" : "", l = a ? `#${o}${a.trim().replace(/^#+/, "")}` : "", c = (_a7 = i != null ? i : r == null ? void 0 : r.replace("#", "|")) != null ? _a7 : "", h3 = e3.startsWith("!") ? "!" : "";
            return (n3 == null ? void 0 : n3.match(externalLinkRegex)) ? `${h3}[${c.replace(/^\|/, "")}](${n3})` : `${h3}[[${s2}${l}${c}]]`;
          })), this.md.render(e2);
        }
        getCollectedTags() {
          return Array.from(this.collectedTags);
        }
        async parse(e2) {
          this.idGenerator.reset();
          const t2 = await this._parse(e2);
          return new ParserResult(t2, new TextEncoder().encode(e2), this.idGenerator);
        }
        async _parse(e2) {
          return this.md.parse(e2, {});
        }
        getMarkdownIt() {
          return this.md;
        }
        addPlugin(e2, t2) {
          this.md.use(e2, t2);
        }
        createMarkdownItInstance() {
          var _a6, _b4, _c2;
          const e2 = new import_markdown_it.default({ html: this.config.renderer.unsafe, breaks: false, linkify: this.config.extensions.linkify, typographer: !this.config.extensions.typographer.disable });
          return this.config.extensions.typographer.disable || (e2.options.quotes = [this.config.extensions.typographer.leftDoubleQuote, this.config.extensions.typographer.rightDoubleQuote, this.config.extensions.typographer.leftSingleQuote, this.config.extensions.typographer.rightSingleQuote]), this.configureBasicPlugins(e2), ((_a6 = this.config.extensions.wikilink) == null ? void 0 : _a6.enable) && e2.use(wikilinkPlugin, { enable: true }), this.config.extensions.parseTags && e2.use(tagPlugin, { enable: true, tagBaseURL: "tags/", onTagFound: (e3) => this.collectedTags.add(e3) }), this.config.extensions.callouts && e2.use(calloutPlugin, { enable: true }), ((_b4 = this.config.extensions.latex) == null ? void 0 : _b4.enable) && e2.use(latexPlugin, { enable: true }), ((_c2 = this.config.extensions.mermaid) == null ? void 0 : _c2.enable) && e2.use(mermaidPlugin, { enable: true }), e2;
        }
        configureBasicPlugins(e2) {
          this.config.extensions.table && e2.enable(["table"]), this.config.extensions.strikethrough && e2.enable(["strikethrough"]);
        }
      };
    } });
    var PathType;
    var PATH_CONSTANTS;
    var PathComponentsImpl;
    var PathPositionsImpl;
    var LowHighImpl;
    var PathComponentsFactory;
    var Path;
    var PathUtils;
    var PathProcessorImpl;
    var PathParsingNormalizer;
    var BasicPathNormalizer;
    var DefaultFileExtensionChecker;
    var PathParserUtils;
    var PathFactoryImpl;
    var DefaultPathFactory;
    var SimplePathPool;
    var PathBuilder;
    var PathFactoryUtils;
    var PathDomain;
    var yaml2;
    var log19;
    var Translator;
    var log20;
    var init_markdown4 = __esm2({ "internal/domain/markdown/factory/markdown.ts"() {
      init_markdown3(), init_highlight(), init_it();
    } });
    var init_markdown5 = __esm2({ "internal/domain/markdown/index.ts"() {
      init_type5(), init_config4(), init_context2(), init_tableofcontents(), init_highlight(), init_pageparser2(), init_parseinfo(), init_shortcode(), init_content(), init_markdown3(), init_markdown4();
    } });
    var init_type7 = __esm2({ "internal/domain/paths/type.ts"() {
      PathType = ((e2) => (e2[e2.File = 0] = "File", e2[e2.ContentResource = 1] = "ContentResource", e2[e2.ContentSingle = 2] = "ContentSingle", e2[e2.Leaf = 3] = "Leaf", e2[e2.Branch = 4] = "Branch", e2))(PathType || {}), PATH_CONSTANTS = { CONTENT_EXTENSIONS: [".md", ".markdown", ".mdown", ".mkd", ".mkdn", ".html", ".htm", ".xml"], HTML_EXTENSIONS: [".html", ".htm"], INDEX_NAMES: ["index", "_index"], PATH_SEPARATOR: "/", EXTENSION_SEPARATOR: ".", LANGUAGE_SEPARATOR: ".", SYSTEM_PATH_SEPARATOR: (() => {
        try {
          return require("path").sep;
        } catch (e2) {
          return "/";
        }
      })(), COMPONENT_FOLDER_CONTENT: "content", COMPONENT_FOLDER_STATIC: "static", COMPONENT_FOLDER_LAYOUTS: "layouts", COMPONENT_FOLDER_ARCHETYPES: "archetypes", COMPONENT_FOLDER_DATA: "data", COMPONENT_FOLDER_ASSETS: "assets", COMPONENT_FOLDER_I18N: "i18n", normalizePath: (e2) => {
        let t2 = e2.replace(/\\/g, "/");
        return t2.startsWith("//") && (t2 = t2.substring(1)), t2;
      } };
    } });
    var init_pathcomponents = __esm2({ "internal/domain/paths/vo/pathcomponents.ts"() {
      init_type7(), PathComponentsImpl = class e2 {
        constructor(e3, t2, n3, r, i, s2 = false, a) {
          this.original = e3, this.normalized = t2, this.positions = n3, this.identifiers = r, this.bundleType = i, this.disabled = s2, this.component = a;
        }
        withBundleType(t2) {
          return new e2(this.original, this.normalized, this.positions, this.identifiers, t2, this.disabled);
        }
        withDisabled(t2) {
          return new e2(this.original, this.normalized, this.positions, this.identifiers, this.bundleType, t2);
        }
        hasIdentifiers() {
          return this.identifiers.length > 0;
        }
        firstIdentifier() {
          return this.identifiers.length > 0 ? this.identifiers[0] : null;
        }
        lastIdentifier() {
          return this.identifiers.length > 0 ? this.identifiers[this.identifiers.length - 1] : null;
        }
        getIdentifier(e3) {
          return e3 >= 0 && e3 < this.identifiers.length ? this.identifiers[e3] : null;
        }
        isContentComponent(e3) {
          return "content" === e3 || "archetypes" === e3;
        }
        clone() {
          return new e2(this.original, this.normalized, { ...this.positions }, [...this.identifiers], this.bundleType, this.disabled, this.component);
        }
        toString() {
          return `PathComponents{original="${this.original}", normalized="${this.normalized}", bundleType=${PathType[this.bundleType]}, identifiers=${this.identifiers.length}}`;
        }
      }, PathPositionsImpl = class e2 {
        constructor(e3 = -1, t2 = -1, n3 = -1, r = -1) {
          this.containerLow = e3, this.containerHigh = t2, this.sectionHigh = n3, this.identifierLanguage = r;
        }
        reset() {
          this.containerLow = -1, this.containerHigh = -1, this.sectionHigh = -1, this.identifierLanguage = -1;
        }
        hasContainer() {
          return -1 !== this.containerLow && -1 !== this.containerHigh;
        }
        hasSection() {
          return this.sectionHigh > 0;
        }
        hasLanguageIdentifier() {
          return -1 !== this.identifierLanguage;
        }
        clone() {
          return new e2(this.containerLow, this.containerHigh, this.sectionHigh, this.identifierLanguage);
        }
      }, LowHighImpl = class {
        constructor(e2, t2) {
          if (this.low = e2, this.high = t2, e2 > t2) throw new Error(`Invalid range: low (${e2}) must be <= high (${t2})`);
        }
        length() {
          return this.high - this.low;
        }
        isEmpty() {
          return this.low === this.high;
        }
        contains(e2) {
          return e2 >= this.low && e2 < this.high;
        }
        substring(e2) {
          return e2.substring(this.low, this.high);
        }
        toString() {
          return `[${this.low}, ${this.high})`;
        }
      }, PathComponentsFactory = class {
        static createEmpty(e2 = "", t2 = 0) {
          return new PathComponentsImpl(e2, e2, new PathPositionsImpl(), [], t2, false);
        }
        static create(e2, t2, n3 = 0) {
          return new PathComponentsImpl(e2, t2 || e2, new PathPositionsImpl(), [], n3, false);
        }
        static createFull(e2, t2, n3, r, i, s2 = false) {
          return new PathComponentsImpl(e2, t2, n3, r, i, s2);
        }
      };
    } });
    var init_path22 = __esm2({ "internal/domain/paths/entity/path.ts"() {
      init_type7(), init_pathcomponents(), Path = class e2 {
        constructor(e3) {
          __publicField(this, "_unnormalized");
          __publicField(this, "shouldTrimLeadingSlash", false);
          this.components = e3;
        }
        component() {
          if (this.components.component) return this.components.component;
          const e3 = this.components.normalized.split("/").filter((e4) => e4.length > 0);
          return 0 === e3.length ? "content" : { static: "static", layouts: "layouts", themes: "themes", archetypes: "archetypes", data: "data", i18n: "i18n", assets: "assets" }[e3[0]] || "content";
        }
        path() {
          return this.norm(this.components.normalized);
        }
        name() {
          return this.components.positions.containerHigh > 0 ? this.components.normalized.substring(this.components.positions.containerHigh) : this.components.normalized;
        }
        originalNameNoExt() {
          const e3 = this.components.firstIdentifier();
          return e3 ? this.components.original.substring(this.components.positions.containerHigh, e3.low - 1) : this.components.original.substring(this.components.positions.containerHigh);
        }
        nameNoExt() {
          const e3 = this.components.firstIdentifier();
          return e3 ? this.components.normalized.substring(this.components.positions.containerHigh, e3.low - 1) : this.components.normalized.substring(this.components.positions.containerHigh);
        }
        nameNoLang() {
          return this.name();
        }
        dir() {
          let e3 = "";
          return this.components.positions.containerHigh > 0 && (e3 = this.components.normalized.substring(0, this.components.positions.containerHigh - 1)), "" === e3 && (e3 = "/"), this.norm(e3);
        }
        ext() {
          if (0 === this.components.identifiers.length) return "";
          const e3 = this.components.identifiers[this.components.identifiers.length - 1], t2 = this.components.normalized.substring(e3.low, e3.high);
          return t2 ? "." + t2 : "";
        }
        lang() {
          return "";
        }
        section() {
          if (this.components.positions.sectionHigh <= 0) return "";
          const e3 = this.components.normalized.substring(1, this.components.positions.sectionHigh);
          return "_index.md" === e3 || "index.md" === e3 || e3.endsWith("/_index.md") || e3.endsWith("/index.md") ? "" : this.norm(e3);
        }
        sections() {
          const e3 = this.dir();
          if ("/" === e3 || "" === e3) return [];
          const t2 = [], n3 = (e3.startsWith("/") ? e3.substring(1) : e3).split("/").filter((e4) => e4.length > 0);
          let r = "";
          for (const e4 of n3) "" === r ? r = e4 : r += "/" + e4, t2.push(this.norm(r));
          return t2;
        }
        container() {
          return -1 === this.components.positions.containerLow ? "" : this.norm(this.components.normalized.substring(this.components.positions.containerLow, this.components.positions.containerHigh - 1));
        }
        containerDir() {
          return this.isLeafBundle() || this.isBranchBundle(), this.dir();
        }
        base() {
          return this.isBranchBundle() && "/_index.md" === this.components.normalized ? "/" : this.isLeafBundle() ? this.baseInternal(false, true) : this.isContent() && !this.isBundle() ? this.pathNoIdentifier() : this.isContent() ? this.isBundle() ? this.baseInternal(false, true) : this.baseInternal(!this.isContentPage(), this.isBundle()) : this.path();
        }
        baseNoLeadingSlash() {
          return this.base().substring(1);
        }
        baseNameNoIdentifier() {
          return this.isBundle() ? this.container() : this.nameNoIdentifier();
        }
        nameNoIdentifier() {
          if (0 === this.components.identifiers.length) return this.name();
          const e3 = this.components.identifiers[0], t2 = this.components.positions.containerHigh;
          return this.components.normalized.substring(t2, e3.low - 1);
        }
        pathNoLang() {
          return this.baseInternal(true, false);
        }
        pathNoIdentifier() {
          if (0 === this.components.identifiers.length) return this.path();
          const e3 = this.components.identifiers[0], t2 = this.components.normalized.substring(0, e3.low - 1);
          return this.norm(t2);
        }
        pathRel(e3) {
          let t2 = e3.base();
          return t2.endsWith("/") || (t2 += "/"), this.path().replace(new RegExp("^" + this.escapeRegExp(t2)), "");
        }
        baseRel(e3) {
          let t2 = e3.base();
          return "/" === t2 && (t2 = ""), this.base().substring(t2.length + 1);
        }
        trimLeadingSlash() {
          const t2 = this.components.clone(), n3 = new e2(t2);
          return n3.setShouldTrimLeadingSlash(true), n3;
        }
        identifier(e3) {
          const t2 = this.components.identifiers.length;
          if (0 === t2 || e3 < 0 || e3 >= t2) return "";
          let n3;
          n3 = 1 === t2 ? 0 : 0 === e3 ? t2 - 1 : t2 - 1 - e3;
          const r = this.identifierAsString(n3);
          return r ? "." + r : "";
        }
        identifiers() {
          const e3 = [], t2 = this.components.identifiers.length;
          for (let n3 = 0; n3 < t2; n3++) {
            const t3 = this.identifier(n3);
            t3 && e3.push(t3);
          }
          return e3;
        }
        bundleType() {
          return this.components.bundleType;
        }
        isContent() {
          return this.bundleType() >= 1;
        }
        isBundle() {
          return this.bundleType() > 3;
        }
        isBranchBundle() {
          return 4 === this.bundleType();
        }
        isLeafBundle() {
          return 3 === this.bundleType();
        }
        isHTML() {
          const e3 = this.ext().toLowerCase();
          return PATH_CONSTANTS.HTML_EXTENSIONS.some((t2) => t2 === e3);
        }
        disabled() {
          return this.components.disabled;
        }
        forBundleType(t2) {
          const n3 = this.components.withBundleType(t2);
          return new e2(n3);
        }
        unnormalized() {
          if (!this._unnormalized) if (this.components.original === this.components.normalized) this._unnormalized = this;
          else {
            const t2 = new PathComponentsImpl(this.components.original, this.components.original, this.components.positions, this.components.identifiers, this.components.bundleType, this.components.disabled);
            this._unnormalized = new e2(t2);
          }
          return this._unnormalized;
        }
        setShouldTrimLeadingSlash(e3) {
          this.shouldTrimLeadingSlash = e3;
        }
        norm(e3) {
          return this.shouldTrimLeadingSlash && e3.startsWith("/") ? e3.substring(1) : e3;
        }
        isContentPage() {
          return this.bundleType() >= 2;
        }
        baseInternal(e3, t2) {
          if (0 === this.components.identifiers.length) return this.norm(this.components.normalized);
          if (e3 && 1 === this.components.identifiers.length) return this.norm(this.components.normalized);
          let n3 = this.components.identifiers[this.components.identifiers.length - 1].low - 1;
          if (t2 && (n3 = this.components.positions.containerHigh - 1), 0 === n3 && n3++, !e3) return this.norm(this.components.normalized.substring(0, n3));
          const r = this.components.identifiers[0];
          return this.norm(this.components.normalized.substring(0, n3) + this.components.normalized.substring(r.low - 1, r.high));
        }
        identifierAsString(e3) {
          const t2 = this.identifierIndex(e3);
          if (-1 === t2) return "";
          const n3 = this.components.identifiers[t2];
          return this.components.normalized.substring(n3.low, n3.high);
        }
        identifierIndex(e3) {
          return e3 < 0 || e3 >= this.components.identifiers.length ? -1 : e3;
        }
        escapeRegExp(e3) {
          return e3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
        }
        toString() {
          return `Path{path="${this.path()}", component="${this.component()}", bundleType=${PathType[this.bundleType()]}}`;
        }
        equals(e3) {
          return this.path() === e3.path() && this.component() === e3.component() && this.bundleType() === e3.bundleType();
        }
        hashCode() {
          return `${this.component()}:${this.path()}:${this.bundleType()}`;
        }
      }, PathUtils = class {
        static fromString(e2, t2) {
          const n3 = new PathComponentsImpl(t2, t2, { containerLow: -1, containerHigh: -1, sectionHigh: -1, identifierLanguage: -1 }, [], 0, false);
          return new Path(n3);
        }
        static hasExtension(e2, t2) {
          const n3 = e2.ext(), r = t2.startsWith(".") ? t2 : "." + t2;
          return n3.toLowerCase() === r.toLowerCase();
        }
        static isUnder(e2, t2) {
          const n3 = e2.path();
          let r;
          r = t2.isBranchBundle() ? t2.dir() : t2.path();
          const i = "/" === r ? "/" : r + "/";
          return n3 !== r && n3.startsWith(i);
        }
        static relativeTo(e2, t2) {
          return t2.pathRel(e2);
        }
        static compare(e2, t2) {
          const n3 = e2.path().localeCompare(t2.path());
          if (0 !== n3) return n3;
          const r = e2.component().localeCompare(t2.component());
          return 0 !== r ? r : e2.bundleType() - t2.bundleType();
        }
      };
    } });
    var init_pathparser = __esm2({ "internal/domain/paths/vo/pathparser.ts"() {
      init_type7(), init_pathcomponents(), init_path22(), PathProcessorImpl = class {
        constructor(e2, t2) {
          __publicField(this, "normalizer");
          __publicField(this, "extChecker");
          this.normalizer = e2 || new PathParsingNormalizer(), this.extChecker = t2 || new DefaultFileExtensionChecker();
        }
        parse(e2, t2) {
          let n3 = t2;
          n3 && "" !== n3 || (n3 = "/");
          const r = this.normalizer.normalize(n3), i = this.createPathComponents(e2, r, t2);
          return new Path(i);
        }
        parseIdentity(e2, t2) {
          const n3 = this.parse(e2, t2);
          return { identifierBase: () => n3.base() };
        }
        parseBaseAndBaseNameNoIdentifier(e2, t2) {
          const n3 = this.parse(e2, t2);
          return [n3.base(), n3.baseNameNoIdentifier()];
        }
        createPathComponents(e2, t2, n3) {
          let r = e2, i = t2;
          if (t2.startsWith("/")) {
            const n4 = t2.split("/").filter((e3) => e3.length > 0);
            if (n4.length > 0) {
              const t3 = n4[0];
              ["static", "layouts", "themes", "archetypes", "data", "i18n", "assets"].includes(t3) && "content" === e2 && (r = t3), ["images", "assets", "static", "css", "js", "fonts"].includes(t3) && "content" === e2 && (r = "static");
            }
          }
          const s2 = i.lastIndexOf("/"), a = s2 >= 0 ? i.substring(s2 + 1) : i;
          s2 >= 0 && i.substring(0, s2);
          let o = this.detectBundleType(a, r);
          const l = this.calculatePathPositions(i), c = this.extractIdentifiers(i, a);
          return new PathComponentsImpl(n3, i, l, c, o, false, r);
        }
        detectBundleType(e2, t2) {
          if ("content" !== t2 && "archetypes" !== t2) return 0;
          let n3 = e2.split(".")[0];
          return "index" === n3 && this.isContentFile(e2) ? 3 : "_index" === n3 && this.isContentFile(e2) ? 4 : this.isContentFile(e2) ? 2 : 0;
        }
        isContentFile(e2) {
          const t2 = this.getFileExtension(e2);
          return ["md", "html", "markdown", "mdown", "mkd", "mkdn", "htm"].includes(t2.toLowerCase());
        }
        getFileExtension(e2) {
          const t2 = e2.lastIndexOf(".");
          return t2 > 0 && t2 < e2.length - 1 ? e2.substring(t2 + 1) : "";
        }
        calculatePathPositions(e2) {
          let t2 = -1, n3 = -1, r = -1;
          for (let i = e2.length - 1; i >= 0; i--) "/" === e2[i] && (-1 === r ? r = i + 1 : -1 === n3 && (n3 = i + 1), i > 0 && (t2 = i));
          return new PathPositionsImpl(n3, r, t2, -1);
        }
        extractIdentifiers(e2, t2) {
          const n3 = [], r = e2.substring(0, e2.length - t2.length).length, i = t2.split(".");
          if (i.length <= 1) return n3;
          let s2 = r;
          for (let e3 = 0; e3 < i.length - 1; e3++) s2 += i[e3].length + 1;
          const a = s2, o = a + i[i.length - 1].length;
          return n3.push(new LowHighImpl(a, o)), n3;
        }
      }, PathParsingNormalizer = class {
        constructor(e2 = true, t2 = true) {
          this.toLowerCase = e2, this.replaceSpaces = t2;
        }
        normalize(e2) {
          let t2 = e2;
          return t2 = t2.replace(/\\/g, "/"), this.toLowerCase && (t2 = t2.toLowerCase()), this.replaceSpaces && (t2 = t2.replace(/\s/g, "-")), t2;
        }
      }, BasicPathNormalizer = class {
        constructor(e2 = true, t2 = true) {
          this.toLowerCase = e2, this.replaceSpaces = t2;
        }
        normalize(e2) {
          let t2 = e2;
          return t2 = t2.replace(/\\/g, "/"), this.toLowerCase && (t2 = t2.toLowerCase()), this.replaceSpaces && (t2 = t2.replace(/\s+/g, "-")), t2;
        }
      }, DefaultFileExtensionChecker = class {
        isContentExt(e2) {
          return PATH_CONSTANTS.CONTENT_EXTENSIONS.includes(e2.toLowerCase());
        }
        isHTML(e2) {
          return PATH_CONSTANTS.HTML_EXTENSIONS.includes(e2.toLowerCase());
        }
        hasExt(e2) {
          for (let t2 = e2.length - 1; t2 >= 0; t2--) {
            if ("." === e2[t2]) return true;
            if ("/" === e2[t2]) return false;
          }
          return false;
        }
      }, PathParserUtils = class e2 {
        static parseBasic(e3) {
          const t2 = e3.lastIndexOf("/"), n3 = t2 >= 0 ? e3.substring(0, t2) : "", r = t2 >= 0 ? e3.substring(t2 + 1) : e3, i = r.lastIndexOf("."), s2 = i >= 0 ? r.substring(i) : "", a = i >= 0 ? r.substring(0, i) : r;
          return { dir: n3, name: r, ext: s2, nameWithoutExt: a };
        }
        static join(...e3) {
          return e3.filter((e4) => e4.length > 0).map((e4) => e4.replace(/^\/+|\/+$/g, "")).join("/").replace(/\/+/g, "/");
        }
        static normalizeBasic(e3) {
          return new BasicPathNormalizer().normalize(e3);
        }
        static isBundle(t2) {
          const n3 = e2.parseBasic(t2);
          return PATH_CONSTANTS.INDEX_NAMES.includes(n3.nameWithoutExt);
        }
        static extractSection(e3) {
          const t2 = e3.startsWith("/") ? e3.substring(1) : e3, n3 = t2.indexOf("/");
          return n3 >= 0 ? t2.substring(0, n3) : t2;
        }
        static removeExtension(e3) {
          const t2 = e3.lastIndexOf(".");
          return t2 > e3.lastIndexOf("/") ? e3.substring(0, t2) : e3;
        }
        static hasExtension(e3) {
          return new DefaultFileExtensionChecker().hasExt(e3);
        }
      };
    } });
    var init_pathfactory = __esm2({ "internal/domain/paths/factory/pathfactory.ts"() {
      var _a6;
      init_pathparser(), init_pathcomponents(), init_path22(), PathFactoryImpl = class {
        constructor(e2, t2) {
          __publicField(this, "processor");
          __publicField(this, "pool");
          const n3 = (e2 == null ? void 0 : e2.normalizer) ? { normalize: e2.normalizer } : new BasicPathNormalizer(false !== (e2 == null ? void 0 : e2.normalize), false !== (e2 == null ? void 0 : e2.replaceSpaces)), r = new DefaultFileExtensionChecker();
          this.processor = new PathProcessorImpl(n3, r), t2 && (this.pool = t2);
        }
        create(e2, t2, n3) {
          return this.pool && this.pool.get(), this.processor.parse(e2, t2);
        }
        createFromComponents(e2) {
          return new Path(e2);
        }
        createMany(e2, t2, n3) {
          return t2.map((t3) => this.create(e2, t3, n3));
        }
        createWithConfig(e2, t2, n3) {
          const r = {};
          return void 0 !== (n3 == null ? void 0 : n3.toLowerCase) && (r.normalize = n3.toLowerCase), void 0 !== (n3 == null ? void 0 : n3.replaceSpaces) && (r.replaceSpaces = n3.replaceSpaces), void 0 !== (n3 == null ? void 0 : n3.customNormalizer) && (r.normalizer = n3.customNormalizer), this.create(e2, t2, r);
        }
      }, DefaultPathFactory = class extends PathFactoryImpl {
        constructor() {
          super({ normalize: true, replaceSpaces: true });
        }
      }, SimplePathPool = class {
        constructor(e2 = 100) {
          __publicField(this, "pool", []);
          __publicField(this, "maxSize");
          this.maxSize = e2;
        }
        get() {
          if (this.pool.length > 0) return this.pool.pop();
          const e2 = PathComponentsFactory.createEmpty();
          return new Path(e2);
        }
        put(e2) {
          this.pool.length < this.maxSize && this.pool.push(e2);
        }
        clear() {
          this.pool = [];
        }
        size() {
          return this.pool.length;
        }
      }, PathBuilder = class {
        constructor(e2) {
          __publicField(this, "component", "");
          __publicField(this, "path", "");
          __publicField(this, "config", {});
          __publicField(this, "factory");
          this.factory = e2 || new DefaultPathFactory();
        }
        withComponent(e2) {
          return this.component = e2, this;
        }
        withPath(e2) {
          return this.path = e2, this;
        }
        withNormalization(e2) {
          return this.config.normalize = e2, this;
        }
        withSpaceReplacement(e2) {
          return this.config.replaceSpaces = e2, this;
        }
        withNormalizer(e2) {
          return this.config.normalizer = e2, this;
        }
        build() {
          if (!this.component || !this.path) throw new Error("Component and path must be set");
          return this.factory.create(this.component, this.path, this.config);
        }
        reset() {
          return this.component = "", this.path = "", this.config = {}, this;
        }
      }, PathFactoryUtils = (_a6 = class {
        static createContentPath(t2) {
          return _a6.defaultFactory.create("content", t2);
        }
        static createStaticPath(t2) {
          return _a6.defaultFactory.create("static", t2);
        }
        static createLayoutPath(t2) {
          return _a6.defaultFactory.create("layouts", t2);
        }
        static createArchetypePath(t2) {
          return _a6.defaultFactory.create("archetypes", t2);
        }
        static createDataPath(t2) {
          return _a6.defaultFactory.create("data", t2);
        }
        static createThemePath(t2) {
          return _a6.defaultFactory.create("themes", t2);
        }
        static createFromConfig(e2) {
          const t2 = {};
          void 0 !== e2.normalize && (t2.normalize = e2.normalize), void 0 !== e2.replaceSpaces && (t2.replaceSpaces = e2.replaceSpaces);
          const n3 = new PathFactoryImpl(t2);
          return e2.paths.map((t3) => n3.create(e2.component, t3));
        }
        static builder() {
          return new PathBuilder();
        }
        static createWithPool(e2, t2, n3) {
          return new PathFactoryImpl(void 0, n3).create(e2, t2);
        }
      }, __publicField(_a6, "defaultFactory", new DefaultPathFactory()), _a6);
    } });
    var init_paths = __esm2({ "internal/domain/paths/index.ts"() {
      init_type7(), init_pathcomponents(), init_pathparser(), init_path22(), init_pathfactory(), init_type7(), init_type7(), init_type7(), init_pathfactory(), init_pathparser(), init_path22(), init_pathparser(), init_pathfactory(), init_pathfactory(), init_pathparser(), PathDomain = { createContentPath: PathFactoryUtils.createContentPath, createStaticPath: PathFactoryUtils.createStaticPath, createLayoutPath: PathFactoryUtils.createLayoutPath, createArchetypePath: PathFactoryUtils.createArchetypePath, createDataPath: PathFactoryUtils.createDataPath, createThemePath: PathFactoryUtils.createThemePath, builder: PathFactoryUtils.builder, parseBasic: PathParserUtils.parseBasic, join: PathParserUtils.join, normalizeBasic: PathParserUtils.normalizeBasic, isBundle: PathParserUtils.isBundle, extractSection: PathParserUtils.extractSection, removeExtension: PathParserUtils.removeExtension, checkExtension: PathParserUtils.hasExtension, hasSpecificExtension: PathUtils.hasExtension, isUnder: PathUtils.isUnder, relativeTo: PathUtils.relativeTo, compare: PathUtils.compare, createProcessor: () => new PathProcessorImpl(), createFactory: () => new DefaultPathFactory(), createPool: (e2) => new SimplePathPool(e2), createNormalizer: (e2) => new BasicPathNormalizer(e2 == null ? void 0 : e2.toLowerCase, e2 == null ? void 0 : e2.replaceSpaces) };
    } });
    var init_translator = __esm2({ "internal/domain/content/entity/translator.ts"() {
      init_log(), yaml2 = __toESM3(require_js_yaml()), init_paths(), log19 = getDomainLogger("content", { component: "translator" }), Translator = class {
        constructor(e2) {
          __publicField(this, "contentLanguage");
          __publicField(this, "translateFuncs", /* @__PURE__ */ new Map());
          this.contentLanguage = e2;
        }
        translate(e2, t2) {
          const n3 = e2.toLowerCase(), r = this.translateFuncs.get(n3);
          if (r) {
            const e3 = r(t2);
            if (e3) return e3;
          }
          log19.info(`Translation func for language ${e2} not found, use default.`);
          const i = this.translateFuncs.get(this.contentLanguage.toLowerCase());
          if (i) {
            const e3 = i(t2);
            if (e3) return e3;
          }
          return log19.info("i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language."), `[i18n] ${t2}`;
        }
        async setupTranslateFuncs(e2) {
          try {
            await e2.walkI18n("", { walkFn: async (e3, t2) => {
              if (e3.endsWith(".yaml") || e3.endsWith(".yml")) try {
                const n3 = (PATH_CONSTANTS.normalizePath(e3).split("/").pop() || "").replace(/\.(yaml|yml)$/, "").toLowerCase(), r = await this.readI18nFile(t2), i = this.parseI18nContent(r), s2 = /* @__PURE__ */ new Map();
                i.forEach((e4) => {
                  s2.set(e4.id, e4.translation);
                });
                const a = (e4) => s2.get(e4) || (log19.warn(`i18n|MISSING_TRANSLATION|${n3}|${e4}`), "");
                this.translateFuncs.set(n3, a), log19.info(`\u2705 Loaded i18n translations for language: ${n3} (${i.length} items)`);
              } catch (t3) {
                log19.error(`\u274C Failed to load i18n file ${e3}:`, t3);
              }
            } }, {}), log19.info(`\u{1F30D} Translation setup complete. Loaded ${this.translateFuncs.size} languages: [${Array.from(this.translateFuncs.keys()).join(", ")}]`);
          } catch (e3) {
            throw e3;
          }
        }
        async readI18nFile(e2) {
          let t2 = null;
          try {
            t2 = await e2.open();
            const n3 = await t2.stat(), r = new Uint8Array(n3.size()), i = await t2.read(r), s2 = new TextDecoder("utf-8").decode(i.buffer);
            return 65279 === s2.charCodeAt(0) ? s2.slice(1) : s2;
          } catch (e3) {
            throw log19.error("\u274C Failed to read i18n file:", e3), e3;
          } finally {
            if (t2) try {
              await t2.close();
            } catch (e3) {
              log19.warn(`Failed to close i18n file: ${e3}`);
            }
          }
        }
        parseI18nContent(e2) {
          try {
            const t2 = yaml2.load(e2);
            return Array.isArray(t2) ? t2.filter((e3) => e3 && "object" == typeof e3 && e3.id && e3.translation).map((e3) => ({ id: String(e3.id), translation: String(e3.translation) })) : (log19.warn("i18n YAML content is not an array"), []);
          } catch (e3) {
            return log19.error("\u274C Failed to parse i18n YAML content:", e3), [];
          }
        }
        getAvailableLanguages() {
          return Array.from(this.translateFuncs.keys());
        }
        hasLanguage(e2) {
          return this.translateFuncs.has(e2.toLowerCase());
        }
      };
    } });
    async function createContent(e2) {
      const t2 = new MDConverter(function(e3, t3) {
        const n4 = new DefaultHighlighter({ style: "github", lineNos: false, lineNoStart: 1, anchorLineNos: false, lineAnchors: "", lineNumbersInTable: true, noClasses: true, codeFences: true, guessSyntax: false, tabWidth: 4 });
        return new MarkdownImpl(t3 || !e3 ? new MarkdownItRenderer({ extensions: { typographer: { disable: false, leftSingleQuote: "&lsquo;", rightSingleQuote: "&rsquo;", leftDoubleQuote: "&ldquo;", rightDoubleQuote: "&rdquo;", enDash: "&ndash;", emDash: "&mdash;", ellipsis: "&hellip;", leftAngleQuote: "&laquo;", rightAngleQuote: "&raquo;", apostrophe: "&rsquo;" }, footnote: true, definitionList: true, table: true, strikethrough: true, linkify: true, linkifyProtocol: "https", taskList: true, cjk: { enable: false, eastAsianLineBreaks: false, eastAsianLineBreaksStyle: "simple", escapedSpace: false }, passthrough: { enable: false, delimiters: { inline: [], block: [] } }, highlight: { style: "github", lineNos: false, lineNoStart: 1, anchorLineNos: false, lineAnchors: "", lineNumbersInTable: true, noClasses: true, codeFences: true, guessSyntax: false, tabWidth: 4 }, wikilink: { enable: true, disableBrokenWikilinks: false, markdownLinkResolution: "shortest", prettyLinks: true }, parseTags: true, callouts: true, latex: { enable: true }, mermaid: { enable: true } }, renderer: { unsafe: true }, parser: { autoHeadingID: true, autoHeadingIDType: "github", wrapStandAloneImageWithinParagraph: true, attribute: { title: true, block: false } }, duplicateResourceFiles: false, renderHooks: { image: { enableDefault: true }, link: { enableDefault: true } } }, void 0) : e3, n4);
      }(e2.markdown(), e2.useInternalRenderer())), n3 = await async function(e3) {
        const t3 = new Translator(e3.defaultLanguage());
        try {
          await t3.setupTranslateFuncs(e3);
        } catch (e4) {
          log20.warn("Failed to setup translator, continuing without i18n support:", e4);
        }
        return t3;
      }(e2), r = new PageBuilder(e2, e2, e2, null, null, new Taxonomy2(e2.views(), e2), new Term(e2), new Section(e2), new Standalone(e2), t2, null), i = new PageMap(r);
      r.pageMapper = i, i.setupReverseIndex();
      const s2 = new Content2(e2, t2, i, n3);
      return r.contentHub = s2, s2;
    }
    var kindMapMain;
    var init_hub2 = __esm2({ "internal/domain/content/factory/hub.ts"() {
      init_content3(), init_markdown5(), init_translator(), init_log(), log20 = getDomainLogger("content", { component: "content" });
    } });
    function getKindMain(e2) {
      return kindMapMain[e2.toLowerCase()] || "";
    }
    var Identity;
    var crypto3;
    var path16;
    var contentFileExtensionsSet;
    var FileInfo7;
    var init_kind = __esm2({ "internal/domain/content/vo/kind.ts"() {
      init_type4(), kindMapMain = { [PageKind.PAGE]: PageKind.PAGE, [PageKind.HOME]: PageKind.HOME, [PageKind.SECTION]: PageKind.SECTION, [PageKind.TAXONOMY]: PageKind.TAXONOMY, [PageKind.TERM]: PageKind.TERM, [PageKind.STATUS_404]: PageKind.STATUS_404, [PageKind.SITEMAP]: PageKind.SITEMAP, taxonomyterm: PageKind.TAXONOMY };
    } });
    var init_identity = __esm2({ "internal/domain/content/vo/identity.ts"() {
      init_log(), getDomainLogger("content", { component: "identity" }), Identity = class {
        constructor(e2, t2 = "", n3 = 0) {
          __publicField(this, "id");
          __publicField(this, "lang");
          __publicField(this, "langIdx");
          __publicField(this, "stale", true);
          this.id = e2, this.lang = t2, this.langIdx = n3;
        }
        ID() {
          return this.id;
        }
        identifierBase() {
          return `${this.id}-${this.lang}`;
        }
        pageLanguage() {
          return this.lang;
        }
        pageLanguageIndex() {
          return this.langIdx;
        }
        pageIdentity() {
          return this;
        }
        markStale() {
          this.stale || (this.stale = true);
        }
        isStale() {
          return this.stale;
        }
        clearStale() {
          this.stale && (this.stale = false);
        }
      };
    } });
    function newFileInfo2(e2) {
      return FileInfo7.newFileInfo(e2);
    }
    var PageByWrapper;
    var lessPageTitle;
    var language;
    var weight;
    var collatorStringCompare;
    var PageSorterImpl;
    var init_fileinfo2 = __esm2({ "internal/domain/content/vo/fileinfo.ts"() {
      init_paths(), crypto3 = __toESM3(require("crypto")), path16 = __toESM3(require("path")), init_log(), getDomainLogger("content", { component: "FileInfo" }), contentFileExtensionsSet = /* @__PURE__ */ new Set([".md"]), FileInfo7 = class e2 {
        constructor(e3, t2) {
          __publicField(this, "fileMetaInfo");
          __publicField(this, "pathInfo");
          __publicField(this, "bundleType");
          __publicField(this, "uniqueIDCache");
          __publicField(this, "lazyInitDone", false);
          this.fileMetaInfo = e3;
          const n3 = PathDomain.createProcessor();
          this.pathInfo = n3.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT, t2), this.bundleType = 0, this.determineBundleType();
        }
        static newFileInfo(t2) {
          const n3 = PATH_CONSTANTS.normalizePath(t2.relativeFilename());
          return new e2(t2, n3);
        }
        pageFile() {
          return this;
        }
        shiftToResource() {
          this.isContent() && (this.bundleType = 1);
        }
        relPath() {
          const e3 = this.pathInfo.dir(), t2 = e3.startsWith("/") ? e3.substring(1) : e3;
          return path16.join(t2, this.pathInfo.name());
        }
        section() {
          return this.pathInfo.section();
        }
        isZero() {
          return null == this.fileMetaInfo;
        }
        filename() {
          return this.fileMetaInfo.fileName();
        }
        dir() {
          return this.pathToDir(this.pathInfo.dir());
        }
        ext() {
          return this.pathInfo.ext();
        }
        logicalName() {
          return this.pathInfo.name();
        }
        originalBaseFileName() {
          return this.pathInfo.originalNameNoExt();
        }
        baseFileName() {
          return this.pathInfo.nameNoExt();
        }
        translationBaseName() {
          return this.pathInfo.nameNoIdentifier();
        }
        contentBaseName() {
          return this.pathInfo.baseNameNoIdentifier();
        }
        baseNameNoIdentifier() {
          return this.pathInfo.baseNameNoIdentifier();
        }
        root() {
          return this.pathInfo.dir() || "/";
        }
        uniqueID() {
          return this.init(), this.uniqueIDCache;
        }
        fileInfo() {
          return this.fileMetaInfo;
        }
        type() {
          const e3 = this.section();
          return "" !== e3 ? e3 : "page";
        }
        async open() {
          return await this.fileMetaInfo.open();
        }
        paths() {
          return this.pathInfo;
        }
        path() {
          return this.pathInfo.path();
        }
        toString() {
          return this.baseFileName();
        }
        getBundleType() {
          return this.bundleType;
        }
        isBundle() {
          return this.bundleType >= 3;
        }
        isLeafBundle() {
          return 3 === this.bundleType;
        }
        isBranchBundle() {
          return 4 === this.bundleType;
        }
        isContentResource() {
          return 1 === this.bundleType;
        }
        isContent() {
          return this.bundleType >= 1;
        }
        init() {
          if (!this.lazyInitDone) {
            this.lazyInitDone = true;
            const e3 = this.relPath().replace(/\\/g, "/");
            this.uniqueIDCache = crypto3.createHash("md5").update(e3).digest("hex");
          }
        }
        pathToDir(e3) {
          return "" === e3 ? e3 : path16.normalize(e3.substring(1) + "/");
        }
        determineBundleType() {
          var e3;
          if (e3 = this.pathInfo.ext(), contentFileExtensionsSet.has(e3)) switch (this.pathInfo.nameNoIdentifier()) {
            case "index":
              this.bundleType = 3;
              break;
            case "_index":
              this.bundleType = 4;
              break;
            default:
              this.bundleType = 2;
          }
        }
      };
    } });
    function sortByTitle(e2) {
      pageBy(lessPageTitle).sort(e2);
    }
    function pageBy(e2) {
      return new PageByWrapper(e2);
    }
    var Cast;
    var Strings;
    var Types;
    var import_path92;
    var FrontMatterParserImpl;
    var init_sort = __esm2({ "internal/domain/content/vo/sort.ts"() {
      PageByWrapper = class {
        constructor(e2) {
          this.by = e2;
        }
        sort(e2) {
          !function(e3, t2) {
            const n3 = Array.from({ length: t2.len() }, (e4, t3) => t3);
            n3.sort((e4, n4) => t2.less(e4, n4) ? -1 : t2.less(n4, e4) ? 1 : e4 - n4);
            const r = [...e3];
            for (let t3 = 0; t3 < n3.length; t3++) e3[t3] = r[n3[t3]];
          }(e2, new PageSorterImpl(e2, this.by));
        }
      }, lessPageTitle = (e2, t2) => collatorStringCompare((e3) => e3.title(), e2, t2) < 0, language = (e2, t2) => collatorStringCompare((e3) => e3.pageIdentity().pageLanguage(), e2, t2) < 0, weight = (e2, t2) => e2.pageWeight() < t2.pageWeight(), collatorStringCompare = (e2, t2, n3) => {
        const r = e2(t2), i = e2(n3);
        return r < i ? -1 : r > i ? 1 : 0;
      }, PageSorterImpl = class {
        constructor(e2, t2) {
          this.pages = e2, this.by = t2;
        }
        len() {
          return this.pages.length;
        }
        swap(e2, t2) {
          [this.pages[e2], this.pages[t2]] = [this.pages[t2], this.pages[e2]];
        }
        less(e2, t2) {
          return this.by(this.pages[e2], this.pages[t2]);
        }
      };
    } });
    var init_cast = __esm2({ "pkg/cast/cast.ts"() {
      Cast = class {
        static toString(e2) {
          return null == e2 ? "" : "string" == typeof e2 ? e2 : "number" == typeof e2 || "boolean" == typeof e2 ? e2.toString() : String(e2);
        }
        static toInt(e2) {
          if (null == e2) return 0;
          if ("number" == typeof e2) return Math.floor(e2);
          if ("string" == typeof e2) {
            const t2 = parseInt(e2, 10);
            return isNaN(t2) ? 0 : t2;
          }
          return 0;
        }
        static toTime(e2) {
          if (null == e2) return /* @__PURE__ */ new Date();
          if (e2 instanceof Date) return e2;
          if ("string" == typeof e2) {
            const t2 = new Date(e2);
            return isNaN(t2.getTime()) ? /* @__PURE__ */ new Date() : t2;
          }
          return "number" == typeof e2 ? new Date(e2) : /* @__PURE__ */ new Date();
        }
      };
    } });
    var init_cast2 = __esm2({ "pkg/cast/index.ts"() {
      init_cast();
    } });
    var init_string2 = __esm2({ "pkg/string/string.ts"() {
      Strings = class {
        static sliceToLower(e2) {
          return e2.map((e3) => e3.toLowerCase());
        }
      };
    } });
    var init_string22 = __esm2({ "pkg/string/index.ts"() {
      init_string2();
    } });
    var init_types22 = __esm2({ "pkg/types/types.ts"() {
      init_cast2(), Types = class {
        static toStringSlicePreserveString(e2) {
          return null == e2 ? null : Array.isArray(e2) ? e2.map((e3) => Cast.toString(e3)) : "string" == typeof e2 ? [e2] : [Cast.toString(e2)];
        }
      };
    } });
    var init_types32 = __esm2({ "pkg/types/index.ts"() {
      init_types22();
    } });
    function getParamToLower(e2, t2) {
      return getParam(e2, t2, true);
    }
    function getParam(e2, t2, n3) {
      const r = e2[t2.toLowerCase()];
      if (null == r) return null;
      switch (typeof r) {
        case "boolean":
          return r;
        case "string":
          return n3 ? r.toLowerCase() : r;
        case "number":
          return Number.isInteger(r) ? Cast.toInt(r) : r;
        default:
          return r instanceof Date ? r : Array.isArray(r) && r.every((e3) => "string" == typeof e3) && n3 ? Strings.sliceToLower(r) : r;
      }
    }
    var dimensionFlag;
    var LeafNode;
    var Edge;
    var Node2;
    var Tree;
    var init_frontmatter = __esm2({ "internal/domain/content/vo/frontmatter.ts"() {
      init_kind(), init_cast2(), init_string22(), init_types32(), import_path92 = __toESM3(require("path")), FrontMatterParserImpl = class {
        constructor(e2, t2, n3) {
          __publicField(this, "params");
          __publicField(this, "langSvc");
          __publicField(this, "taxonomySvc");
          this.params = e2, this.langSvc = t2, this.taxonomySvc = n3;
        }
        async parse(e2) {
          const t2 = { terms: {}, params: this.params, path: "", lang: "", kind: "", title: "", description: "", weight: 999 };
          try {
            await this.parseCustomized(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseTerms(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseTitle(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseDescription(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseWeight(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseDate(t2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseOrganization(t2, e2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseAuthor(t2, e2);
          } catch (e3) {
            throw e3;
          }
          try {
            await this.parseMenu(t2);
          } catch (e3) {
            throw e3;
          }
          return t2;
        }
        async parseDate(e2) {
          if (this.params) {
            const t2 = this.params.date;
            null != t2 && (e2.date = Cast.toTime(t2));
          }
        }
        async parseWeight(e2) {
          if (e2.weight = 999, this.params) {
            const t2 = this.params.weight;
            null != t2 && (e2.weight = Cast.toInt(t2));
          }
        }
        async parseTitle(e2) {
          if (this.params) {
            const t2 = this.params.title;
            null != t2 && (e2.title = Cast.toString(t2));
          }
        }
        async parseDescription(e2) {
          if (this.params) {
            const t2 = this.params.description;
            null != t2 && (e2.description = Cast.toString(t2));
          }
        }
        async parseCustomized(e2) {
          if (!this.params) return;
          const t2 = this.params.path;
          null != t2 && (e2.path = this.toSlashPreserveLeading(Cast.toString(t2)));
          const n3 = this.params.lang;
          if (null != n3) {
            const t3 = Cast.toString(n3).toLowerCase();
            this.langSvc.isLanguageValid(t3) && (e2.lang = t3);
          }
          const r = this.params.kind;
          if (null != r) {
            const t3 = Cast.toString(r);
            if ("" !== t3) {
              const n4 = getKindMain(t3);
              if ("" === n4) throw new Error(`unknown kind "${t3}" in front matter`);
              e2.kind = n4;
            }
          }
        }
        async parseTerms(e2) {
          const t2 = this.taxonomySvc.views();
          for (const n3 of t2) {
            const t3 = Types.toStringSlicePreserveString(getParam(this.params || {}, n3.plural(), false));
            null !== t3 && (e2.terms[n3.plural()] = t3);
          }
        }
        async parseOrganization(e2, t2) {
          if (!this.params) return;
          const n3 = this.params.organization;
          if (!n3 || "object" != typeof n3) return;
          const r = {};
          void 0 !== n3.name && null !== n3.name && (r.name = Cast.toString(n3.name)), void 0 !== n3.description && null !== n3.description && (r.description = Cast.toString(n3.description)), void 0 !== n3.vision && null !== n3.vision && (r.vision = Cast.toString(n3.vision)), void 0 !== n3.website && null !== n3.website && (r.website = Cast.toString(n3.website)), void 0 !== n3.logo && null !== n3.logo && (r.logo = import_path92.default.join(t2, Cast.toString(n3.logo)));
          const i = this.parseContact(n3.contact);
          i && (r.contact = i);
          const s2 = this.parseSocial(n3.social);
          s2 && (r.social = s2), Object.keys(r).length > 0 && (e2.organization = r);
        }
        async parseMenu(e2) {
          if (!this.params) return;
          const t2 = this.params.menu;
          if (!t2 || "object" != typeof t2) return;
          const n3 = {};
          for (const [e3, r] of Object.entries(t2)) if (false !== r) {
            if (Array.isArray(r)) {
              const t3 = this.parseMenuItems(r);
              t3.length > 0 && (n3[e3] = t3);
            } else if (r && "object" == typeof r) {
              const t3 = {};
              for (const [e4, n4] of Object.entries(r)) if (false === n4) t3[e4] = false;
              else if (Array.isArray(n4)) {
                const r3 = this.parseMenuItems(n4);
                r3.length > 0 && (t3[e4] = r3);
              }
              Object.keys(t3).length > 0 && (n3[e3] = t3);
            }
          } else n3[e3] = false;
          Object.keys(n3).length > 0 && (e2.menu = n3);
        }
        parseMenuItems(e2) {
          const t2 = [];
          for (const n3 of e2) {
            if (!n3 || "object" != typeof n3) continue;
            const e3 = { title: "", url: "" };
            if (void 0 !== n3.title && null !== n3.title && (e3.title = Cast.toString(n3.title), void 0 !== n3.url && null !== n3.url)) {
              {
                const t3 = Cast.toString(n3.url);
                e3.url = "" === t3 ? "" : t3;
              }
              if (void 0 !== n3.weight && null !== n3.weight && (e3.weight = Cast.toInt(n3.weight)), Array.isArray(n3.children)) {
                const t3 = this.parseMenuItems(n3.children);
                t3.length > 0 && (e3.children = t3);
              }
              t2.push(e3);
            }
          }
          return t2;
        }
        async parseAuthor(e2, t2) {
          if (!this.params) return;
          const n3 = this.params.author;
          if (!n3 || "object" != typeof n3) return;
          const r = {};
          void 0 !== n3.name && null !== n3.name && (r.name = Cast.toString(n3.name)), void 0 !== n3.description && null !== n3.description && (r.description = Cast.toString(n3.description)), void 0 !== n3.website && null !== n3.website && (r.website = Cast.toString(n3.website)), void 0 !== n3.avatar && null !== n3.avatar && (r.avatar = import_path92.default.join(t2, Cast.toString(n3.avatar)));
          const i = this.parseContact(n3.contact);
          i && (r.contact = i);
          const s2 = this.parseSocial(n3.social);
          s2 && (r.social = s2), Object.keys(r).length > 0 && (e2.author = r);
        }
        parseContact(e2) {
          if (!e2 || "object" != typeof e2) return null;
          const t2 = {};
          return void 0 !== e2.email && null !== e2.email && (t2.email = Cast.toString(e2.email)), void 0 !== e2.address && null !== e2.address && (t2.address = Cast.toString(e2.address)), void 0 !== e2.phone && null !== e2.phone && (t2.phone = Cast.toString(e2.phone)), Object.keys(t2).length > 0 ? t2 : null;
        }
        parseSocial(e2) {
          if (!e2 || "object" != typeof e2) return null;
          const t2 = {}, n3 = ["github", "twitter", "linkedin"];
          for (const r of n3) void 0 !== e2[r] && null !== e2[r] && (t2[r] = Cast.toString(e2[r]));
          for (const [r, i] of Object.entries(e2)) n3.includes(r) || null == i || (t2[r] = Cast.toString(i));
          return Object.keys(t2).length > 0 ? t2 : null;
        }
        toSlashPreserveLeading(e2) {
          return e2.replace(/\\/g, "/");
        }
      };
    } });
    var init_classifier = __esm2({ "internal/domain/content/vo/classifier.ts"() {
      init_fileinfo2();
    } });
    var init_dimensions = __esm2({ "pkg/doctree/dimensions.ts"() {
      dimensionFlag = { has: (e2, t2) => (e2 & t2) === t2, set: (e2, t2) => e2 | t2, index: (e2) => {
        if (0 === e2) throw new Error("dimension flag not set");
        return e2 - 1;
      } };
    } });
    function longestPrefix(e2, t2) {
      const n3 = Math.min(e2.length, t2.length);
      let r = 0;
      for (r = 0; r < n3 && e2[r] === t2[r]; r++) ;
      return r;
    }
    async function recursiveWalk(e2, t2) {
      if (null !== e2.leaf && await t2(e2.leaf.key, e2.leaf.val)) return true;
      let n3 = 0, r = e2.edges.length;
      for (; n3 < r; ) {
        const i = e2.edges[n3];
        if (await recursiveWalk(i.node, t2)) return true;
        if (0 === e2.edges.length) return recursiveWalk(e2, t2);
        e2.edges.length >= r && n3++, r = e2.edges.length;
      }
      return false;
    }
    var WalkableTrees;
    var MutableTrees;
    var init_radix = __esm2({ "pkg/radix/radix.ts"() {
      LeafNode = class {
        constructor(e2, t2) {
          __publicField(this, "key");
          __publicField(this, "val");
          this.key = e2, this.val = t2;
        }
      }, Edge = class {
        constructor(e2, t2) {
          __publicField(this, "label");
          __publicField(this, "node");
          this.label = e2, this.node = t2;
        }
      }, Node2 = class {
        constructor() {
          __publicField(this, "leaf", null);
          __publicField(this, "prefix", "");
          __publicField(this, "edges", []);
        }
        isLeaf() {
          return null !== this.leaf;
        }
        addEdge(e2) {
          const t2 = this.edges.length;
          let n3 = 0;
          for (; n3 < t2 && this.edges[n3].label < e2.label; ) n3++;
          this.edges.splice(n3, 0, e2);
        }
        updateEdge(e2, t2) {
          const n3 = this.edges.length;
          let r = 0;
          for (; r < n3 && this.edges[r].label < e2; ) r++;
          if (!(r < n3 && this.edges[r].label === e2)) throw new Error("replacing missing edge");
          this.edges[r].node = t2;
        }
        getEdge(e2) {
          const t2 = this.edges.length;
          let n3 = 0;
          for (; n3 < t2 && this.edges[n3].label < e2; ) n3++;
          return n3 < t2 && this.edges[n3].label === e2 ? this.edges[n3].node : null;
        }
        delEdge(e2) {
          const t2 = this.edges.length;
          let n3 = 0;
          for (; n3 < t2 && this.edges[n3].label < e2; ) n3++;
          n3 < t2 && this.edges[n3].label === e2 && this.edges.splice(n3, 1);
        }
        mergeChild() {
          const e2 = this.edges[0].node;
          this.prefix = this.prefix + e2.prefix, this.leaf = e2.leaf, this.edges = e2.edges;
        }
      }, Tree = class e2 {
        constructor() {
          __publicField(this, "root");
          __publicField(this, "size");
          this.root = new Node2(), this.size = 0;
        }
        static newFromMap(t2) {
          const n3 = new e2();
          if (t2) if (t2 instanceof Map) t2.forEach((e3, t3) => {
            n3.insert(t3, e3);
          });
          else for (const [e3, r] of Object.entries(t2)) n3.insert(e3, r);
          return n3;
        }
        len() {
          return this.size;
        }
        insert(e3, t2) {
          let n3 = null, r = this.root, i = e3;
          for (; ; ) {
            if (0 === i.length) {
              if (r.isLeaf()) {
                const e4 = r.leaf.val;
                return r.leaf.val = t2, [e4, true];
              }
              return r.leaf = new LeafNode(e3, t2), this.size++, [void 0, false];
            }
            if (n3 = r, r = r.getEdge(i.charCodeAt(0)), null === r) {
              const r3 = new Edge(i.charCodeAt(0), new Node2());
              return r3.node.leaf = new LeafNode(e3, t2), r3.node.prefix = i, n3.addEdge(r3), this.size++, [void 0, false];
            }
            const s2 = longestPrefix(i, r.prefix);
            if (s2 === r.prefix.length) {
              i = i.substring(s2);
              continue;
            }
            this.size++;
            const a = new Node2();
            a.prefix = i.substring(0, s2), n3.updateEdge(i.charCodeAt(0), a), a.addEdge(new Edge(r.prefix.charCodeAt(s2), r)), r.prefix = r.prefix.substring(s2);
            const o = new LeafNode(e3, t2);
            if (i = i.substring(s2), 0 === i.length) return a.leaf = o, [void 0, false];
            const l = new Node2();
            return l.leaf = o, l.prefix = i, a.addEdge(new Edge(i.charCodeAt(0), l)), [void 0, false];
          }
        }
        delete(e3) {
          let t2 = null, n3 = 0, r = this.root, i = e3;
          for (; ; ) {
            if (0 === i.length) {
              if (!r.isLeaf()) break;
              const e4 = r.leaf;
              return r.leaf = null, this.size--, null !== t2 && 0 === r.edges.length && t2.delEdge(n3), r !== this.root && 1 === r.edges.length && r.mergeChild(), null === t2 || t2 === this.root || 1 !== t2.edges.length || t2.isLeaf() || t2.mergeChild(), [e4.val, true];
            }
            if (t2 = r, n3 = i.charCodeAt(0), r = r.getEdge(n3), null === r) break;
            if (!i.startsWith(r.prefix)) break;
            i = i.substring(r.prefix.length);
          }
          return [void 0, false];
        }
        async deletePrefix(e3) {
          return await this._deletePrefix(null, this.root, e3);
        }
        async _deletePrefix(e3, t2, n3) {
          if (0 === n3.length) {
            let n4 = 0;
            return await recursiveWalk(t2, (e4, t3) => (n4++, Promise.resolve(false))), t2.isLeaf() && (t2.leaf = null), t2.edges = [], null === e3 || e3 === this.root || 1 !== e3.edges.length || e3.isLeaf() || e3.mergeChild(), this.size -= n4, n4;
          }
          const r = n3.charCodeAt(0), i = t2.getEdge(r);
          return null === i || !i.prefix.startsWith(n3) && !n3.startsWith(i.prefix) ? 0 : (n3 = i.prefix.length > n3.length ? n3.substring(n3.length) : n3.substring(i.prefix.length), this._deletePrefix(t2, i, n3));
        }
        get(e3) {
          let t2 = this.root, n3 = e3;
          for (; ; ) {
            if (0 === n3.length) {
              if (t2.isLeaf()) return [t2.leaf.val, true];
              break;
            }
            if (t2 = t2.getEdge(n3.charCodeAt(0)), null === t2) break;
            if (!n3.startsWith(t2.prefix)) break;
            n3 = n3.substring(t2.prefix.length);
          }
          return [void 0, false];
        }
        longestPrefix(e3) {
          let t2 = null, n3 = this.root, r = e3;
          for (; n3.isLeaf() && (t2 = n3.leaf), 0 !== r.length && (n3 = n3.getEdge(r.charCodeAt(0)), null !== n3) && r.startsWith(n3.prefix); ) r = r.substring(n3.prefix.length);
          return null !== t2 ? [t2.key, t2.val, true] : ["", void 0, false];
        }
        minimum() {
          let e3 = this.root;
          for (; ; ) {
            if (e3.isLeaf()) return [e3.leaf.key, e3.leaf.val, true];
            if (!(e3.edges.length > 0)) break;
            e3 = e3.edges[0].node;
          }
          return ["", void 0, false];
        }
        maximum() {
          let e3 = this.root;
          for (; ; ) {
            const t2 = e3.edges.length;
            if (!(t2 > 0)) {
              if (e3.isLeaf()) return [e3.leaf.key, e3.leaf.val, true];
              break;
            }
            e3 = e3.edges[t2 - 1].node;
          }
          return ["", void 0, false];
        }
        async walk(e3) {
          await recursiveWalk(this.root, e3);
        }
        async walkPrefix(e3, t2) {
          let n3 = this.root, r = e3;
          for (; ; ) {
            if (0 === r.length) return void await recursiveWalk(n3, t2);
            if (n3 = n3.getEdge(r.charCodeAt(0)), null === n3) return;
            if (!r.startsWith(n3.prefix)) return void (n3.prefix.startsWith(r) && await recursiveWalk(n3, t2));
            r = r.substring(n3.prefix.length);
          }
        }
        async walkPath(e3, t2) {
          let n3 = this.root, r = e3;
          for (; ; ) {
            if (null !== n3.leaf && await t2(n3.leaf.key, n3.leaf.val)) return;
            if (0 === r.length) return;
            if (n3 = n3.getEdge(r.charCodeAt(0)), null === n3) return;
            if (!r.startsWith(n3.prefix)) break;
            r = r.substring(n3.prefix.length);
          }
        }
        async toMap() {
          const e3 = {};
          return await this.walk((t2, n3) => (e3[t2] = n3, Promise.resolve(false))), e3;
        }
      };
    } });
    var init_radix2 = __esm2({ "pkg/radix/index.ts"() {
      init_radix();
    } });
    function cleanKey(e2) {
      return "/" === e2 ? "" : e2;
    }
    function mustValidateKey(e2) {
      const t2 = function(e3) {
        return "" === e3 ? null : e3.length < 2 ? new Error(`too short key: "${e3}"`) : "/" !== e3[0] ? new Error(`key must start with '/': "${e3}"`) : "/" === e3[e3.length - 1] ? new Error(`key must not end with '/': "${e3}"`) : null;
      }(e2);
      if (t2) throw t2;
      return e2;
    }
    var SimpleTree;
    var init_support = __esm2({ "pkg/doctree/support.ts"() {
      init_radix2(), WalkableTrees = class {
        constructor(e2) {
          __publicField(this, "trees");
          this.trees = e2;
        }
        walkPrefixRaw(e2, t2) {
          for (const n3 of this.trees) n3.walkPrefixRaw(e2, t2);
        }
      }, MutableTrees = class {
        constructor(e2) {
          __publicField(this, "trees");
          this.trees = e2;
        }
        delete(e2) {
          for (const t2 of this.trees) t2.delete(e2);
        }
        deleteAll(e2) {
          for (const t2 of this.trees) t2.deleteAll(e2);
        }
        async deletePrefix(e2) {
          let t2 = 0;
          for (const n3 of this.trees) t2 += await n3.deletePrefix(e2);
          return Promise.resolve(t2);
        }
        async deletePrefixAll(e2) {
          let t2 = 0;
          for (const n3 of this.trees) t2 += await n3.deletePrefixAll(e2);
          return t2;
        }
        lock(e2) {
          const t2 = this.trees.map((t3) => t3.lock(e2));
          return () => {
            for (const e3 of t2) e3();
          };
        }
        canLock() {
          for (const e2 of this.trees) if (!e2.canLock()) return false;
          return true;
        }
      };
    } });
    function newSimpleTree() {
      return new SimpleTree();
    }
    var TreeShiftTree;
    var NodeShiftTree;
    var NodeShiftTreeWalker;
    var Shifter2;
    var PageShifter;
    var SourceShifter;
    var WeightedTermTreeNode;
    var PageTreesNode;
    var PageTrees;
    var init_simpletree = __esm2({ "pkg/doctree/simpletree.ts"() {
      init_radix2(), init_support(), SimpleTree = class {
        constructor() {
          __publicField(this, "mu");
          __publicField(this, "tree");
          __publicField(this, "zero");
          this.tree = new Tree(), this.zero = void 0;
          let e2 = false, t2 = 0;
          this.mu = { lock: () => {
            for (; e2 || t2 > 0; ) ;
            e2 = true;
          }, unlock: () => {
            e2 = false;
          }, rLock: () => {
            for (; e2; ) ;
            t2++;
          }, rUnlock: () => {
            t2--;
          } };
        }
        get(e2) {
          this.mu.rLock();
          try {
            const [t2, n3] = this.tree.get(e2);
            return n3 ? t2 : this.zero;
          } finally {
            this.mu.rUnlock();
          }
        }
        longestPrefix(e2) {
          this.mu.rLock();
          try {
            const [t2, n3, r] = this.tree.longestPrefix(e2);
            return r ? [t2, n3] : ["", this.zero];
          } finally {
            this.mu.rUnlock();
          }
        }
        insert(e2, t2) {
          this.mu.lock();
          try {
            return this.tree.insert(e2, t2), t2;
          } finally {
            this.mu.unlock();
          }
        }
        async walkPrefix(e2, t2, n3) {
          switch (e2) {
            case 0:
              break;
            case 1:
              this.mu.rLock();
              break;
            case 2:
              this.mu.lock();
          }
          try {
            let e3 = null;
            return await this.tree.walkPrefix(t2, async (t3, r) => {
              const [i, s2] = n3(t3, r);
              return s2 ? (e3 = s2, Promise.resolve(true)) : i;
            }), e3;
          } finally {
            switch (e2) {
              case 0:
                break;
              case 1:
                this.mu.rUnlock();
                break;
              case 2:
                this.mu.unlock();
            }
          }
        }
      };
    } });
    var init_treeshifttree = __esm2({ "pkg/doctree/treeshifttree.ts"() {
      init_simpletree(), TreeShiftTree = class e2 {
        constructor(e3, t2) {
          __publicField(this, "d");
          __publicField(this, "v");
          __publicField(this, "trees");
          if (t2 <= 0) throw new Error("length must be > 0");
          this.d = e3, this.v = 0, this.trees = [];
          for (let e4 = 0; e4 < t2; e4++) this.trees.push(newSimpleTree());
        }
        static newTreeShiftTree(t2, n3) {
          return new e2(t2, n3);
        }
        shape(t2, n3) {
          if (t2 !== this.d) throw new Error("dimension mismatch");
          if (n3 >= this.trees.length) throw new Error("value out of range");
          const r = Object.create(e2.prototype);
          return Object.assign(r, this), r.v = n3, r;
        }
        get(e3) {
          return this.trees[this.v].get(e3);
        }
        longestPrefix(e3) {
          return this.trees[this.v].longestPrefix(e3);
        }
        insert(e3, t2) {
          return this.trees[this.v].insert(e3, t2);
        }
        async walkPrefix(e3, t2, n3) {
          return await this.trees[this.v].walkPrefix(e3, t2, n3);
        }
        delete(e3) {
          for (const t2 of this.trees) t2.tree.delete(e3);
        }
        async deletePrefix(e3) {
          let t2 = 0;
          for (const n3 of this.trees) t2 += await n3.tree.deletePrefix(e3);
          return t2;
        }
        lock(e3) {
          if (e3) {
            for (const e4 of this.trees) e4.mu.lock();
            return () => {
              for (const e4 of this.trees) e4.mu.unlock();
            };
          }
          for (const e4 of this.trees) e4.mu.rLock();
          return () => {
            for (const e4 of this.trees) e4.mu.rUnlock();
          };
        }
      };
    } });
    var init_nodeshifttree = __esm2({ "pkg/doctree/nodeshifttree.ts"() {
      init_radix2(), init_dimensions(), init_support(), NodeShiftTree = class e2 {
        constructor(e3) {
          __publicField(this, "tree");
          __publicField(this, "dims");
          __publicField(this, "shifter");
          __publicField(this, "mu");
          if (!e3.shifter) throw new Error("Shifter is required");
          this.shifter = e3.shifter, this.tree = new Tree(), this.dims = [0];
          let t2 = false, n3 = 0;
          this.mu = { lock: () => {
            for (; t2 || n3 > 0; ) ;
            t2 = true;
          }, unlock: () => {
            t2 = false;
          }, rLock: () => {
            for (; t2; ) ;
            n3++;
          }, rUnlock: () => {
            n3--;
          }, tryLock: () => !(t2 || n3 > 0 || (t2 = true, 0)) };
        }
        static new(t2) {
          return new e2(t2);
        }
        delete(e3) {
          this.deleteInternal(e3);
        }
        async deleteAll(e3) {
          await this.tree.walkPrefix(e3, (e4, t2) => {
            const [n3, r] = this.tree.delete(e4);
            return Promise.resolve(false);
          });
        }
        async deletePrefix(e3) {
          let t2 = 0;
          const n3 = [];
          await this.tree.walkPrefix(e3, (e4, t3) => (n3.push(e4), Promise.resolve(false)));
          for (const e4 of n3) this.deleteInternal(e4) && t2++;
          return t2;
        }
        deleteInternal(e3) {
          let t2 = false;
          const [n3, r] = this.tree.get(e3);
          if (r) {
            const [r3, i] = this.shifter.delete(n3, this.dims);
            t2 = r3, i && this.tree.delete(e3);
          }
          return t2;
        }
        async deletePrefixAll(e3) {
          let t2 = 0;
          return await this.tree.walkPrefix(e3, (e4, n3) => {
            const [r, i] = this.tree.delete(e4);
            return i && t2++, Promise.resolve(false);
          }), t2;
        }
        increment(e3) {
          return this.shape(e3, this.dims[e3] + 1);
        }
        insertIntoCurrentDimension(e3, t2) {
          e3 = mustValidateKey(cleanKey(e3));
          const [n3, r] = this.tree.get(e3);
          return r && (t2 = this.shifter.insertInto(n3, t2, this.dims)), this.tree.insert(e3, t2), [t2, true];
        }
        insertIntoValuesDimension(e3, t2) {
          e3 = mustValidateKey(cleanKey(e3));
          const [n3, r] = this.tree.get(e3);
          return r && (t2 = this.shifter.insert(n3, t2)), this.tree.insert(e3, t2), [t2, true];
        }
        insertRawWithLock(e3, t2) {
          this.mu.lock();
          try {
            return this.tree.insert(e3, t2);
          } finally {
            this.mu.unlock();
          }
        }
        insertWithLock(e3, t2) {
          this.mu.lock();
          try {
            return this.insertIntoValuesDimension(e3, t2);
          } finally {
            this.mu.unlock();
          }
        }
        len() {
          return this.tree.len();
        }
        canLock() {
          const e3 = this.mu.tryLock();
          return e3 && this.mu.unlock(), e3;
        }
        lock(e3) {
          return e3 ? this.mu.lock() : this.mu.rLock(), () => {
            e3 ? this.mu.unlock() : this.mu.rUnlock();
          };
        }
        longestPrefix(e3, t2, n3) {
          let r = e3;
          for (; ; ) {
            const [e4, i, s2] = this.tree.longestPrefix(r);
            if (s2) {
              const [r3, s3] = this.shift(i, t2);
              if (s3 && (!n3 || n3(r3))) return [e4, r3];
            }
            if ("" === r || "/" === r) return ["", void 0];
            const a = r.lastIndexOf("/");
            if (0 === a) r = "";
            else {
              if (!(a > 0)) break;
              r = r.substring(0, a);
            }
          }
          return ["", void 0];
        }
        longestPrefixAll(e3) {
          const [t2, , n3] = this.tree.longestPrefix(e3);
          return [t2, n3];
        }
        getRaw(e3) {
          const [t2, n3] = this.tree.get(e3);
          return n3 ? [t2, true] : [void 0, false];
        }
        async walkPrefixRaw(e3, t2) {
          await this.tree.walkPrefix(e3, (e4, n3) => t2(e4, n3));
        }
        shape(e3, t2) {
          const n3 = this.clone();
          return n3.dims[e3] = t2, n3;
        }
        toString() {
          return `Root{${this.dims}}`;
        }
        get(e3) {
          const [t2] = this.getInternal(e3);
          return t2;
        }
        forEachInDimension(e3, t2, n3) {
          e3 = cleanKey(e3);
          const [r, i] = this.tree.get(e3);
          i && this.shifter.forEachInDimension(r, t2, n3);
        }
        has(e3) {
          const [, t2] = this.getInternal(e3);
          return t2;
        }
        clone() {
          const t2 = Object.create(e2.prototype);
          return Object.assign(t2, this), t2.dims = [...this.dims], t2;
        }
        shift(e3, t2) {
          const [n3, r] = this.shifter.shift(e3, this.dims, t2);
          return [n3, r];
        }
        getInternal(e3) {
          e3 = cleanKey(e3);
          const [t2, n3] = this.tree.get(e3);
          if (!n3) return [void 0, false];
          const [r, i] = this.shift(t2, true);
          return [r, i];
        }
      }, NodeShiftTreeWalker = class e2 {
        constructor(e3) {
          __publicField(this, "tree");
          __publicField(this, "handle");
          __publicField(this, "prefix");
          __publicField(this, "lockType");
          __publicField(this, "noShift");
          __publicField(this, "exact");
          __publicField(this, "debug");
          __publicField(this, "walkContext");
          __publicField(this, "skipPrefixes", []);
          if (!e3.tree) throw new Error("Tree is required");
          this.tree = e3.tree, this.handle = e3.handle, this.prefix = e3.prefix || "", this.lockType = e3.lockType || 0, this.noShift = e3.noShift || false, this.exact = e3.exact || false, this.debug = e3.debug || false, this.walkContext = e3.walkContext;
        }
        extend() {
          const t2 = new e2({ tree: this.tree, handle: this.handle, prefix: this.prefix, lockType: this.lockType, noShift: this.noShift, exact: this.exact, debug: this.debug, walkContext: this.walkContext });
          return t2.resetLocalState(), t2;
        }
        skipPrefix(...e3) {
          this.skipPrefixes.push(...e3);
        }
        shouldSkip(e3) {
          for (const t2 of this.skipPrefixes) if (e3.startsWith(t2)) return true;
          return false;
        }
        async walk() {
          this.resetLocalState();
          let e3 = null;
          this.lockType > 0 && (e3 = this.tree.lock(2 === this.lockType));
          try {
            let e4 = null;
            const t2 = async (t3, n3) => {
              if (this.shouldSkip(t3)) return false;
              const [r, i, s2] = this.toT(this.tree, n3);
              if (!i) return false;
              const [a, o] = await this.handle(t3, r, s2);
              return !(!a && !o || (e4 = o, 0));
            };
            return "" !== this.prefix ? await this.tree.tree.walkPrefix(this.prefix, t2) : await this.tree.tree.walk(t2), e4;
          } finally {
            e3 && e3();
          }
        }
        resetLocalState() {
          this.skipPrefixes = [];
        }
        toT(e3, t2) {
          if (this.noShift) return [t2, true, 2];
          {
            const [n3, r, i] = e3.shifter.shift(t2, e3.dims, this.exact);
            return [n3, r, i];
          }
        }
      };
    } });
    var init_doctree = __esm2({ "pkg/doctree/index.ts"() {
      init_dimensions(), init_support(), init_simpletree(), init_treeshifttree(), init_nodeshifttree();
    } });
    var init_shifter = __esm2({ "internal/domain/content/entity/shifter.ts"() {
      init_pagetrees(), init_doctree(), Shifter2 = class {
        delete(e2, t2) {
          return [e2.delete(t2[dimensionFlag.index(1)]), e2.isEmpty()];
        }
        shift(e2, t2, n3) {
          const [r, i] = e2.shift(t2[dimensionFlag.index(1)], n3);
          return null !== r ? i ? [r, true, 1] : [r, true, 2] : [new PageTreesNode(), false, 2];
        }
        forEachInDimension(e2, t2, n3) {
          if (t2 !== dimensionFlag.index(1)) throw new Error("only language dimension supported");
          n3(e2);
        }
        insertInto(e2, t2, n3) {
          return e2.mergeWithLang(t2, n3[dimensionFlag.index(1)]);
        }
        insert(e2, t2) {
          return e2.merge(t2);
        }
      };
    } });
    var init_shifterpage = __esm2({ "internal/domain/content/entity/shifterpage.ts"() {
      init_pagetrees(), init_doctree(), init_shifter(), PageShifter = class extends Shifter2 {
        shift(e2, t2, n3) {
          const [r, i] = e2.shift(t2[dimensionFlag.index(1)], n3);
          return null !== r && i ? [r, true, 1] : [new PageTreesNode(), false, 2];
        }
      };
    } });
    var init_shifterpagesource = __esm2({ "internal/domain/content/entity/shifterpagesource.ts"() {
      init_pagetrees(), init_doctree(), init_shifter(), SourceShifter = class extends Shifter2 {
        shift(e2, t2, n3) {
          const [r, i] = e2.shift(t2[dimensionFlag.index(1)], n3);
          return null !== r ? i ? [r, true, 1] : [r, true, 2] : [new PageTreesNode(), false, 2];
        }
      };
    } });
    function newPageTreesNode2(e2) {
      const t2 = new PageTreesNode();
      return e2 && t2.setNode(e2.pageIdentity(), e2), t2;
    }
    var pageIDCounter;
    var log23;
    var Source;
    var init_pagetrees = __esm2({ "internal/domain/content/entity/pagetrees.ts"() {
      init_doctree(), init_shifterpage(), init_shifterpagesource(), WeightedTermTreeNode = class {
        constructor(e2, t2) {
          __publicField(this, "pageTreesNodeInstance");
          __publicField(this, "term");
          this.pageTreesNodeInstance = e2, this.term = t2;
        }
        getPage() {
          return this.pageTreesNodeInstance.getPage();
        }
        getPages() {
          return this.pageTreesNodeInstance.getPages();
        }
        getResource() {
          return this.pageTreesNodeInstance.getResource();
        }
        isEmpty() {
          return this.pageTreesNodeInstance.isEmpty();
        }
        shift(e2, t2) {
          return this.pageTreesNodeInstance.shift(e2, t2);
        }
      }, PageTreesNode = class {
        constructor() {
          __publicField(this, "nodes");
          this.nodes = /* @__PURE__ */ new Map();
        }
        setNode(e2, t2) {
          this.nodes.set(e2, t2);
        }
        merge(e2) {
          const t2 = /* @__PURE__ */ new Map();
          for (const e3 of this.nodes.keys()) t2.set(e3.pageLanguage(), e3);
          for (const [n3, r] of e2.nodes.entries()) {
            const e3 = t2.get(n3.pageLanguage());
            e3 ? this.nodes.set(e3, r) : this.nodes.set(n3, r);
          }
          return this;
        }
        mergeWithLang(e2, t2) {
          const n3 = /* @__PURE__ */ new Map();
          for (const e3 of this.nodes.keys()) n3.set(e3.pageLanguage(), e3);
          for (const [r, i] of e2.nodes.entries()) {
            const e3 = n3.get(r.pageLanguage());
            if (e3) {
              const n4 = this.nodes.get(e3);
              n4 && n4.pageIdentity().pageLanguageIndex() === t2 && this.remove(e3);
            }
            this.nodes.set(r, i);
          }
          return this;
        }
        remove(e2) {
          const t2 = this.nodes.get(e2);
          return !!t2 && (this.markStale(t2), this.nodes.delete(e2), true);
        }
        delete(e2) {
          for (const [t2, n3] of this.nodes.entries()) if (n3.pageIdentity().pageLanguageIndex() === e2) return this.remove(t2);
          return false;
        }
        isEmpty() {
          return 0 === this.nodes.size;
        }
        shift(e2, t2) {
          let n3 = null;
          for (const [t3, r] of this.nodes.entries()) if (null === n3 && (n3 = r), r.pageIdentity().pageLanguageIndex() === e2) return [newPageTreesNode2(r), true];
          return null === n3 || t2 ? [null, false] : [newPageTreesNode2(n3), false];
        }
        getPage() {
          for (const e2 of this.nodes.values()) if (e2 && "function" == typeof e2.kind) return [e2, true];
          return [null, false];
        }
        getPages() {
          const e2 = [];
          for (const t2 of this.nodes.values()) t2 && "function" == typeof t2.kind && e2.push(t2);
          return e2;
        }
        getResource() {
          for (const e2 of this.nodes.values()) return [e2, true];
          return [null, false];
        }
        markStale(e2) {
          "staleVersions" in e2 && e2.staleVersions;
        }
      }, PageTrees = class {
        constructor() {
          __publicField(this, "treePages");
          __publicField(this, "treeResources");
          __publicField(this, "treePagesResources");
          __publicField(this, "treeTaxonomyEntries");
          __publicField(this, "resourceTrees");
          this.treePages = new NodeShiftTree({ shifter: new PageShifter() }), this.treeResources = new NodeShiftTree({ shifter: new SourceShifter() }), this.treeTaxonomyEntries = TreeShiftTree.newTreeShiftTree(0, 10), this.treePagesResources = new WalkableTrees([]), this.resourceTrees = new MutableTrees([]), this.treePagesResources = new WalkableTrees([this.treePages, this.treeResources]), this.resourceTrees = new MutableTrees([this.treeResources]);
        }
        createMutableTrees() {
          this.treePagesResources = new WalkableTrees([this.treePages, this.treeResources]), this.resourceTrees = new MutableTrees([this.treeResources]);
        }
        get TreePages() {
          return this.treePages;
        }
        get TreeResources() {
          return this.treeResources;
        }
        get TreePagesResources() {
          return this.treePagesResources;
        }
        get TreeTaxonomyEntries() {
          return this.treeTaxonomyEntries;
        }
        get ResourceTrees() {
          return this.resourceTrees;
        }
      };
    } });
    function newPageSource(e2) {
      return new Source(e2);
    }
    var log24;
    var ambiguousContentNode;
    var ContentTreeReverseIndexMap;
    var ContentTreeReverseIndex;
    var pagePredicates;
    var PageMapQueryPagesBelowPathImpl;
    var PageMapQueryPagesInSectionImpl;
    var PageMap;
    var init_pagesource = __esm2({ "internal/domain/content/entity/pagesource.ts"() {
      init_log(), init_identity(), pageIDCounter = 0, log23 = getDomainLogger("content", { component: "pagesource" }), Source = class {
        constructor(e2) {
          __publicField(this, "id");
          __publicField(this, "identity");
          __publicField(this, "file");
          this.id = (++pageIDCounter).toString(), this.identity = new Identity(pageIDCounter), this.file = e2;
        }
        sourceKey() {
          return `${this.identity.lang}/${this.file.filename()}`.replace(/\\/g, "/");
        }
        async contentSource() {
          return await this.readSourceAll();
        }
        async readSourceAll() {
          try {
            const e2 = await this.file.open(), t2 = await e2.stat(), n3 = new Uint8Array(t2.size()), r = await e2.read(n3);
            return await e2.close(), r.buffer;
          } catch (e2) {
            const t2 = e2 instanceof Error ? e2.message : String(e2);
            throw new Error(`Failed to read file content: ${t2}`);
          }
        }
        async posOffset(e2) {
          try {
            const t2 = await this.contentSource();
            return function(e3, t3, n3) {
              if (n3 < 0) return { filename: e3, lineNumber: 0, columnNumber: 0, offset: 0 };
              const r = t3.slice(0, n3);
              let i = 1;
              for (let e4 = 0; e4 < r.length; e4++) 10 === r[e4] && i++;
              let s2 = -1;
              for (let e4 = r.length - 1; e4 >= 0; e4--) if (10 === r[e4]) {
                s2 = e4;
                break;
              }
              return { filename: e3, lineNumber: i, columnNumber: n3 - s2, offset: n3 };
            }(this.file.filename(), t2, e2);
          } catch (e3) {
            throw new Error(`failed to read content source for "${this.file.filename()}": ${e3}`);
          }
        }
        pageIdentity() {
          return this.identity;
        }
        pageFile() {
          return this.file;
        }
        staleVersions() {
          return [];
        }
        section() {
          return this.file.section();
        }
        paths() {
          return this.file.paths();
        }
        path() {
          return this.file.paths().path();
        }
        slug() {
          return this.pathToSlug(this.path());
        }
        pathToSlug(e2) {
          let t2 = e2.replace(/^\//, "");
          return t2 = t2.replace(/\.md$/, ""), t2.endsWith("/index") && (t2 = t2.replace(/\/index$/, "")), "index" !== t2 && "" !== t2 || (t2 = "index"), t2.endsWith("/_index") && (t2 = t2.replace(/\/_index$/, "")), t2;
        }
        opener() {
          return () => this.file.open();
        }
        openReader() {
          return { read: async () => new Uint8Array(0) };
        }
        async content() {
          try {
            return log23.error(`Reading content not implemented from: ${this.file.filename()}`), new Uint8Array(0);
          } catch (e2) {
            const t2 = `failed to read content source for "${this.file.filename()}": ${e2}`;
            throw log23.error(t2), new Error(t2);
          }
        }
      };
    } });
    function addTrailingSlash(e2) {
      return e2.endsWith("/") || (e2 += "/"), e2;
    }
    var log25;
    var PagesCollector;
    var log26;
    var Content2;
    var MDConverter;
    var Content3;
    var init_pagemap = __esm2({ "internal/domain/content/entity/pagemap.ts"() {
      init_pagetrees(), init_pagesource(), init_type7(), init_doctree(), init_sort(), init_log(), log24 = getDomainLogger("content", { component: "pagemap" }), ambiguousContentNode = new PageTreesNode(), ContentTreeReverseIndexMap = class {
        constructor() {
          __publicField(this, "initOnce", false);
          __publicField(this, "m", /* @__PURE__ */ new Map());
        }
      }, ContentTreeReverseIndex = class {
        constructor(e2) {
          __publicField(this, "initFn");
          __publicField(this, "contentTreeReverseIndexMap");
          this.initFn = e2, this.contentTreeReverseIndexMap = new ContentTreeReverseIndexMap();
        }
        reset() {
          this.contentTreeReverseIndexMap = new ContentTreeReverseIndexMap();
        }
        get(e2) {
          return this.contentTreeReverseIndexMap.initOnce || (this.contentTreeReverseIndexMap.m = /* @__PURE__ */ new Map(), this.initFn(this.contentTreeReverseIndexMap.m), this.contentTreeReverseIndexMap.initOnce = true), this.contentTreeReverseIndexMap.m.get(e2) || null;
        }
      }, pagePredicates = { kindPage: (e2) => "page" === e2.kind(), kindSection: (e2) => "section" === e2.kind(), kindHome: (e2) => "home" === e2.kind(), kindTerm: (e2) => "term" === e2.kind(), shouldListLocal: (e2) => !e2.shouldList || e2.shouldList(false), shouldListGlobal: (e2) => !e2.shouldList || e2.shouldList(true), shouldListAny: (e2) => !e2.shouldListAny || e2.shouldListAny(), shouldLink: (e2) => !e2.noLink || !e2.noLink() }, PageMapQueryPagesBelowPathImpl = class {
        constructor(e2, t2, n3 = pagePredicates.shouldListLocal) {
          __publicField(this, "path");
          __publicField(this, "keyPart");
          __publicField(this, "include");
          this.path = e2, this.keyPart = t2, this.include = n3;
        }
        key() {
          return this.path + "/" + this.keyPart;
        }
      }, PageMapQueryPagesInSectionImpl = class extends PageMapQueryPagesBelowPathImpl {
        constructor(e2, t2, n3, r, i, s2) {
          super(e2, t2, s2);
          __publicField(this, "recursive");
          __publicField(this, "includeSelf");
          __publicField(this, "index");
          this.recursive = n3, this.includeSelf = r, this.index = i;
        }
        key() {
          return "gagesInSection/" + super.key() + "/" + this.recursive.toString() + "/" + this.index.toString() + "/" + this.includeSelf.toString();
        }
      }, PageMap = class extends PageTrees {
        constructor(e2) {
          super();
          __publicField(this, "pageReverseIndex", null);
          __publicField(this, "pageBuilder");
          this.pageBuilder = e2;
        }
        setupReverseIndex() {
          this.pageReverseIndex = new ContentTreeReverseIndex(async (e2) => {
            const t2 = new NodeShiftTreeWalker({ tree: this.treePages, lockType: 1, handle: async (t3, n3, r) => {
              if (n3) {
                const [t4, r3] = n3.getPage();
                if (!r3) return [false, null];
                t4.pageFile && t4.pageFile() && ((t5, n4) => {
                  const r4 = e2.get(t5);
                  r4 && r4 !== ambiguousContentNode ? e2.set(t5, ambiguousContentNode) : r4 || e2.set(t5, n4);
                })(t4.paths().baseNameNoIdentifier(), n3);
              }
              return [false, null];
            } });
            try {
              await t2.walk();
            } catch (e3) {
              log24.error(`setupReverseIndex error: ${e3}`);
            }
          });
        }
        insertResourceNode(e2, t2) {
          const n3 = this.treeResources, r = n3.lock(true);
          try {
            n3.insertIntoValuesDimension(e2, t2);
          } finally {
            r();
          }
        }
        async addFi(e2) {
          if (e2.fileInfo().isDir()) return;
          const t2 = newPageSource(e2), n3 = t2.paths().base();
          switch (t2.file.getBundleType()) {
            case 0:
              this.insertResourceNode(n3, newPageTreesNode2(t2));
              break;
            case 1:
              const e3 = await this.pageBuilder.withSource(t2).build();
              if (!e3) return;
              this.insertResourceNode(n3, newPageTreesNode2(e3));
              break;
            default:
              const r = await this.pageBuilder.withSource(t2).build();
              this.treePages.insertWithLock(t2.paths().base(), newPageTreesNode2(r));
          }
        }
        async assemble() {
          await this.assembleStructurePages(), await this.applyAggregates(), await this.cleanPages(), await this.assembleTerms();
        }
        async assembleTerms() {
          for (const e2 of this.pageBuilder.langSvc.languageIndexes()) {
            const t2 = this.treePages.shape(0, e2), n3 = this.treeTaxonomyEntries.shape(0, e2);
            await this.pageBuilder.term.assemble(t2, n3, this.pageBuilder, e2);
          }
        }
        async cleanPages() {
        }
        async applyAggregates() {
        }
        async assembleStructurePages() {
          await this.addMissingTaxonomies();
          for (const e2 of this.pageBuilder.langSvc.languageIndexes()) {
            const t2 = this.treePages.shape(0, e2);
            await this.pageBuilder.section.assemble(t2, this.pageBuilder, e2);
          }
          await this.addMissingStandalone();
        }
        async addMissingTaxonomies() {
          const e2 = this.treePages.lock(true);
          try {
            for (const e3 of this.pageBuilder.langSvc.languageIndexes()) {
              const t2 = this.treePages.shape(0, e3);
              await this.pageBuilder.taxonomy.assemble(t2, this.pageBuilder, e3);
            }
          } finally {
            e2();
          }
        }
        async addMissingStandalone() {
          const e2 = this.treePages, t2 = e2.lock(true);
          try {
            await this.pageBuilder.standalone.assemble(e2, this.pageBuilder);
          } finally {
            t2();
          }
        }
        async getResourcesForPage(e2) {
          const t2 = [];
          return await this.forEachResourceInPage(e2, 0, false, (e3, n3, r) => {
            const [i, s2] = n3.getResource();
            return s2 && t2.push(i), [false, null];
          }), t2;
        }
        async forEachResourceInPage(e2, t2, n3, r) {
          let i = e2.paths().base();
          "/" === i && (i = "");
          const s2 = addTrailingSlash(i), a = "page" !== e2.kind(), o = new NodeShiftTreeWalker({ tree: this.treeResources.shape(0, e2.pageIdentity().pageLanguageIndex()), prefix: s2, lockType: t2, exact: n3, handle: async (e3, t3, n4) => {
            if (a) {
              const [t4] = this.treePages.longestPrefixAll(e3);
              if (t4 !== i && this.pathDir(t4) !== this.pathDir(e3)) return o.skipPrefix(t4 + "/"), [false, null];
            }
            return r(e3, t3, n4);
          } });
          try {
            await o.walk();
          } catch (e3) {
            log24.error(`forEachResourceInPage error: ${e3}`);
          }
        }
        async getPagesInSection(e2, t2) {
          const n3 = t2.key(), r = this.treePages.shape(0, e2);
          return this.getOrCreatePagesFromCacheSync(null, n3, async (e3) => {
            const n4 = addTrailingSlash(t2.path), i = [];
            let s2 = "";
            const a = t2.include, o = new NodeShiftTreeWalker({ tree: r, prefix: n4, handle: async (e4, n5, r3) => {
              if (t2.recursive) {
                const [e5, t3] = n5.getPage();
                return t3 && a(e5) && i.push(e5), [false, null];
              }
              const [l, c] = n5.getPage();
              if (c && a(l) && i.push(l), !l.isPage || !l.isPage()) {
                const t3 = e4 + "/";
                "" !== s2 && s2 === t3 || o.skipPrefix(t3), s2 = t3;
              }
              return [false, null];
            } });
            try {
              if (await o.walk(), t2.includeSelf) {
                const e5 = r.get(t2.path);
                if (e5) {
                  const [t3, n5] = e5.getPage();
                  n5 && a(t3) && i.push(t3);
                }
              }
              const e4 = i;
              return function(e5) {
                if (0 === e5.length) return;
                const t3 = e5[0].pageWeight();
                e5.every((e6) => e6.pageWeight() === t3) ? sortByTitle(e5) : function(e6) {
                  pageBy(weight).sort(e6);
                }(e5);
              }(e4), Promise.resolve(e4);
            } catch (e4) {
              log24.error(`getPagesInSection error: ${e4}`);
            }
            return Promise.resolve(i);
          });
        }
        async getOrCreatePagesFromCacheSync(e2, t2, n3) {
          return await n3(t2);
        }
        async getPagesWithTerm(e2, t2) {
          const n3 = t2.key(), r = this.treeTaxonomyEntries.shape(0, e2);
          return await this.getOrCreatePagesFromCacheSync(null, n3, async (e3) => {
            const n4 = [], i = t2.include;
            try {
              await r.walkPrefix(0, addTrailingSlash(t2.path), (e5, t3) => {
                const [r3, s2] = t3.getPage();
                return s2 && i(r3) && n4.push(r3), [false, null];
              });
              const e4 = n4;
              return sortByTitle(e4), e4;
            } catch (e4) {
              log24.error(`getPagesWithTerm error: ${e4}`);
            }
            return n4;
          });
        }
        getTermsForPageInTaxonomy(e2, t2, n3) {
          const r = ((i = n3).startsWith("/") || (i = "/" + i), i);
          var i;
          const s2 = this.treeTaxonomyEntries.shape(0, e2);
          return this.getOrCreatePagesFromCacheSync(null, r + t2, async (e3) => {
            const n4 = [];
            try {
              await s2.walkPrefix(0, addTrailingSlash(r), (e5, r3) => (e5.endsWith(t2) && n4.push(r3.term.page), [false, null]));
              const e4 = n4;
              return sortByTitle(e4), e4;
            } catch (e4) {
              log24.error(`getTermsForPageInTaxonomy error: ${e4}`);
            }
            return n4;
          });
        }
        async getSections(e2, t2) {
          const n3 = [];
          let r = "";
          const i = this.treePages.shape(0, e2), s2 = new NodeShiftTreeWalker({ tree: i, prefix: t2, handle: async (e3, t3, i2) => {
            const [a, o] = t3.getPage();
            return o ? (a.isPage && a.isPage() || ("" !== r && e3.startsWith(r) || (a.isSection && a.isSection() && a.shouldList && a.shouldList(false) && a.parent && a.parent() === a ? n3.push(a) : s2.skipPrefix(e3 + "/")), r = e3 + "/"), [false, null]) : [false, null];
          } });
          try {
            await s2.walk();
            const e3 = n3;
            return sortByTitle(e3), e3;
          } catch (e3) {
            log24.error(`getSections error: ${e3}`);
          }
          return n3;
        }
        pathDir(e2) {
          const t2 = e2.lastIndexOf("/");
          return -1 === t2 ? "" : e2.substring(0, t2);
        }
      };
    } });
    var init_pagecollector = __esm2({ "internal/domain/content/entity/pagecollector.ts"() {
      init_content3(), init_log(), log25 = getDomainLogger("content", { component: "pagecollector" }), PagesCollector = class {
        constructor(e2, t2) {
          __publicField(this, "m");
          __publicField(this, "fs");
          __publicField(this, "processedPaths", /* @__PURE__ */ new Set());
          this.m = e2, this.fs = t2;
        }
        async collect() {
          try {
            const e2 = "", t2 = this.fs.contentFs();
            for (const n3 of t2) {
              this.processedPaths.clear();
              const t3 = await n3.stat(e2);
              await this.collectDir(n3, e2, t3);
            }
          } catch (e2) {
            log25.error(`Failed to collect directory: ${e2}, continuing...`);
          }
        }
        async collectDir(e2, t2, n3) {
          try {
            await this.fs.walkContent(e2, t2, { hookPre: async (e3, t3, n4) => {
              const r = t3;
              if (this.processedPaths.has(r)) return log25.warn("Path already processed!", { path: r, dirName: e3.name(), dirIsDir: e3.isDir(), readdirLength: n4.length }), [];
              if (this.processedPaths.add(r), 0 === n4.length) return [];
              for (const e4 of n4) {
                if (e4.isDir && e4.isDir()) continue;
                const t4 = newFileInfo2(e4);
                await this.m.addFi(t4);
              }
              return n4;
            }, walkFn: async (e3, t3) => {
            } }, { info: n3 });
          } catch (e3) {
            throw log25.error(`Failed to collect directory: ${e3}`, { path: t2, rootName: n3.name(), rootIsDir: n3.isDir(), stack: e3.stack || "No stack trace available" }), new Error(`Failed to collect directory: ${e3}`);
          }
        }
        async handleBundleLeaf(e2, t2, n3, r) {
          const i = t2.paths(), s2 = async (e3, n4) => {
            if (n4.isDir()) return;
            const r3 = newFileInfo2(n4);
            n4 !== t2.fileInfo() && (r3.isLeafBundle() && r3.paths().dir() === i.dir() || r3.shiftToResource()), await this.m.addFi(r3);
          }, a = this.fs.contentFs();
          for (const t3 of a) await this.fs.walkContent(t3, n3, { walkFn: s2 }, { info: e2, dirEntries: r });
        }
      };
    } });
    var init_entity = __esm2({ "internal/domain/content/entity/index.ts"() {
      init_content2(), init_pagemap(), init_pagetrees(), init_pagecollector();
    } });
    var init_content2 = __esm2({ "internal/domain/content/entity/content.ts"() {
      init_entity(), init_doctree(), init_fileinfo2(), init_log(), init_paths(), log26 = getDomainLogger("content", { component: "content" }), Content2 = class {
        constructor(e2, t2, n3, r) {
          __publicField(this, "fs");
          __publicField(this, "converter");
          __publicField(this, "pageMap");
          __publicField(this, "translator");
          __publicField(this, "pageCollected", false);
          this.fs = e2, this.converter = t2, this.pageMap = n3, this.translator = r;
        }
        setTemplateSvc(e2) {
          this.pageMap.pageBuilder.templateSvc = e2;
        }
        async renderString(e2, ...t2) {
          if (t2.length < 1 || t2.length > 2) throw new Error("RenderString want 1 or 2 arguments");
          let n3 = 1;
          if (1 !== t2.length) {
            const e3 = t2[0];
            if ("object" != typeof e3 || null === e3) throw new Error("first argument must be a map");
            throw new Error("RenderString not implemented yet");
          }
          n3 = 0;
          const r = t2[0], i = String(r);
          return newFileInfo2(this.fs.newFileMetaInfoWithContent(i)), i;
        }
        async collectPages() {
          if (this.pageCollected) log26.info("Pages have already been collected, skipping.");
          else try {
            await this.process(), await this.assemble(), this.pageCollected = true;
          } catch (e2) {
            throw new Error(`process/assemble: ${e2}`);
          }
        }
        async process() {
          try {
            const e2 = new PagesCollector(this.pageMap, this.fs);
            await e2.collect();
          } catch (e2) {
            throw e2;
          }
        }
        async assemble() {
          try {
            await this.pageMap.assemble();
          } catch (e2) {
            throw e2;
          }
        }
        async getPageSources(e2) {
          let t2 = e2.paths().base();
          return "/" === t2 && (t2 = ""), await this.pageMap.getResourcesForPage(e2);
        }
        async globalPages(e2) {
          return await this.pageMap.getPagesInSection(e2, new PageMapQueryPagesInSectionImpl("", "global", true, true, 0, pagePredicates.shouldListGlobal));
        }
        async globalRegularPages() {
          return await this.pageMap.getPagesInSection(0, new PageMapQueryPagesInSectionImpl("", "global", true, true, 0, (e2) => pagePredicates.shouldListGlobal(e2) && pagePredicates.kindPage(e2)));
        }
        async walkPages(e2, t2) {
          const n3 = this.pageMap.treePages.shape(0, e2), r = new NodeShiftTreeWalker({ tree: n3, handle: async (e3, n4, r3) => {
            const [i, s2] = n4.getPage();
            if (!s2) return [false, null];
            try {
              await t2(i);
            } catch (e4) {
              return [false, e4 instanceof Error ? e4 : new Error(String(e4))];
            }
            return [false, null];
          } });
          try {
            await r.walk();
          } catch (t3) {
            throw log26.error(`WalkPages failed for langIndex ${e2}:`, t3), t3;
          }
        }
        async walkTaxonomies(e2, t2) {
          try {
            const n3 = this.pageMap.treePages.shape(0, e2), r = this.pageMap.pageBuilder.taxonomy;
            for (const i of r.views) {
              const s2 = r.pluralTreeKey(i.plural()), a = new NodeShiftTreeWalker({ tree: n3, prefix: addTrailingSlash(s2), lockType: 1, handle: async (n4, r3, s3) => {
                const [a2, o] = r3.getPage();
                if (!o) return [false, null];
                if ("term" === a2.kind()) {
                  const r4 = a2;
                  if (!r4.term) return [true, new Error("term is empty")];
                  const s4 = r4.term.toLowerCase();
                  try {
                    const a3 = this.pageMap.treeTaxonomyEntries.shape(0, e2);
                    return await a3.walkPrefix(1, addTrailingSlash(n4), (e3, n5) => {
                      const [a4, o2] = n5.getPage();
                      return o2 ? (t2(i.plural(), s4, { weight: () => n5.term.Weight(), ordinal: () => n5.term.Ordinal(), page: () => a4, owner: () => r4 }).catch((e4) => {
                        log26.error("Error in taxonomy walker:", e4);
                      }), [false, null]) : [false, null];
                    }), [false, null];
                  } catch (e3) {
                    return [true, e3];
                  }
                }
                return [false, null];
              } });
              await a.walk();
            }
          } catch (e3) {
            throw e3;
          }
        }
        getPageFromPath(e2, t2) {
          try {
            const n3 = PathDomain.createProcessor().parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT, t2);
            let r = this.pageMap.treePages.shape(0, e2).get(n3.base());
            if (r) {
              const [e3, t3] = r.getPage();
              if (t3) return e3;
            }
            return null;
          } catch (e3) {
            return log26.error(`\u274C Content.getPageFromPath error for path "${t2}":`, e3), null;
          }
        }
        getPageFromFile(e2, t2) {
          try {
            let n3 = this.pageMap.treePages.shape(0, e2).get(t2.paths().base());
            if (n3) {
              const [e3, t3] = n3.getPage();
              if (t3) return e3;
            }
            return null;
          } catch (e3) {
            return log26.error(`\u274C Content.getPageFromPath error for path "${t2.path()}":`, e3), null;
          }
        }
        async handleChangeFiles(e2) {
          const t2 = [];
          for (const [n3, r] of e2) try {
            await this.addOrUpdateFile(r, t2);
          } catch (e3) {
            log26.error(`Failed to process file change for ${n3}:`, e3);
          }
          return t2;
        }
        async addOrUpdateFile(e2, t2) {
          if (!e2.isDir()) try {
            const n3 = newFileInfo2(e2), r = n3.paths().base();
            r && t2.push(r), await this.pageMap.addFi(n3);
            const i = this.getPageFromFile(0, n3);
            i && i.pageIdentity && i.pageIdentity().markStale();
          } catch (t3) {
            throw log26.error(`Failed to add/update file in PageMap: ${e2.fileName()}`, t3), t3;
          }
        }
        translate(e2, t2) {
          return this.translator ? this.translator.translate(e2, t2) : (log26.warn("Translator not initialized, returning fallback translation"), `[i18n] ${t2}`);
        }
        getAvailableLanguages() {
          return this.translator ? this.translator.getAvailableLanguages() : [];
        }
        hasLanguageSupport(e2) {
          return !!this.translator && this.translator.hasLanguage(e2);
        }
      };
    } });
    var init_converter = __esm2({ "internal/domain/content/entity/converter.ts"() {
      MDConverter = class {
        constructor(e2) {
          __publicField(this, "md");
          this.md = e2;
        }
        async convert(e2, t2) {
          return this.md.render(t2, e2);
        }
        async parseContent(e2) {
          return this.md.parseContent(e2);
        }
        async parseAndRenderContent(e2, t2) {
          return this.md.parseAndRenderContent(e2, t2);
        }
        async prepareRender(e2) {
          return this.md.prepareRender(e2);
        }
      };
    } });
    function newContent(e2) {
      return new Content3(e2);
    }
    var log27;
    var PAGE_HOME_BASE;
    var Section;
    var STANDALONE_PAGE_404_BASE;
    var STANDALONE_PAGE_SITEMAP_BASE;
    var Standalone;
    var Output;
    var PaginatorImpl;
    var PagerImpl;
    var PaginatorManagerImpl;
    var Scratch;
    var init_pagecontent = __esm2({ "internal/domain/content/entity/pagecontent.ts"() {
      Content3 = class {
        constructor(e2) {
          __publicField(this, "rawSource");
          __publicField(this, "frontMatter");
          __publicField(this, "renderedContent", "");
          __publicField(this, "summary", "");
          __publicField(this, "wordCount", 0);
          __publicField(this, "readingTime", 0);
          __publicField(this, "toc");
          __publicField(this, "lazyRendered", true);
          __publicField(this, "lazyRender");
          this.rawSource = e2;
        }
        updateWithContentResult(e2) {
          e2.frontMatter && (this.frontMatter = e2.frontMatter), this.renderedContent = e2.renderedContent || "", this.summary = e2.summary, this.wordCount = e2.wordCount || 0, this.readingTime = e2.readingTime || 0;
        }
        getRawSource() {
          return this.rawSource;
        }
        async RenderedContent() {
          return await this.render(), this.renderedContent;
        }
        async Summary() {
          return await this.render(), this.summary;
        }
        async WordCount() {
          return await this.render(), this.wordCount;
        }
        async ReadingTime() {
          return await this.render(), this.readingTime;
        }
        async render() {
          return this.lazyRendered && this.lazyRender && (await this.lazyRender(), this.lazyRendered = false), Promise.resolve();
        }
        isEmpty() {
          return !this.rawSource || 0 === this.rawSource.length;
        }
      };
    } });
    var init_section = __esm2({ "internal/domain/content/entity/section.ts"() {
      init_pagetrees(), init_fileinfo2(), init_pagesource(), init_kind(), init_doctree(), init_log(), log27 = getDomainLogger("content", { component: "section" }), PAGE_HOME_BASE = "/", Section = class {
        constructor(e2) {
          __publicField(this, "home");
          __publicField(this, "seen");
          __publicField(this, "fsSvc");
          this.home = null, this.seen = {}, this.fsSvc = e2;
        }
        isHome(e2) {
          return "" === e2;
        }
        isSectionExist(e2) {
          return !("" !== e2 && !this.seen[e2] && (this.seen[e2] = true, 1));
        }
        async assemble(e2, t2, n3) {
          this.seen = {};
          const r = new NodeShiftTreeWalker({ tree: e2, lockType: 2, handle: async (e3, i, s2) => {
            if (!i) throw new Error("n is null");
            const [a, o] = i.getPage();
            if (!o) return [false, null];
            if (this.isHome(e3)) return this.home = a, [false, null];
            const l = a.kind();
            if (l !== getKindMain("page") && l !== getKindMain("section")) return [false, null];
            const c = a.paths().sections();
            for (const e4 of c) if (!this.isSectionExist(e4)) try {
              const i2 = newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/" + e4 + "/_index.md"))), s3 = i2.paths().base();
              if (!r.tree.get(s3)) {
                const e5 = await t2.withSource(i2).withLangIdx(n3).kindBuild();
                r.tree.insertIntoValuesDimension(s3, newPageTreesNode2(e5));
              }
            } catch (e5) {
              return [false, e5];
            }
            return [false, null];
          } });
          try {
            await r.walk();
          } catch (e3) {
            throw log27.error("Error walking pages:", e3), e3;
          }
          if (!this.home && (await this.createHome(t2), this.home)) {
            const t3 = this.home;
            e2.insertWithLock(t3.paths().base(), newPageTreesNode2(t3));
          }
        }
        async createHome(e2) {
          const t2 = newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/_index.md"))), n3 = await e2.withSource(t2).kindBuild();
          this.home = n3;
        }
      };
    } });
    var init_standalone = __esm2({ "internal/domain/content/entity/standalone.ts"() {
      init_pagetrees(), init_fileinfo2(), init_pagesource(), STANDALONE_PAGE_404_BASE = "404", STANDALONE_PAGE_SITEMAP_BASE = "_sitemap", Standalone = class {
        constructor(e2) {
          __publicField(this, "fsSvc");
          this.fsSvc = e2;
        }
        async assemble(e2, t2) {
          const n3 = "/" + STANDALONE_PAGE_404_BASE, r = await this.addStandalone(n3, t2);
          e2.insertIntoValuesDimension(n3, newPageTreesNode2(r));
          const i = "/" + STANDALONE_PAGE_SITEMAP_BASE, s2 = await this.addStandalone(i, t2);
          e2.insertIntoValuesDimension(i, newPageTreesNode2(s2));
        }
        async addStandalone(e2, t2) {
          const n3 = newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(e2 + ".md")));
          return await t2.withSource(n3).kindBuild();
        }
      };
    } });
    var init_pageoutput = __esm2({ "internal/domain/content/entity/pageoutput.ts"() {
      init_content3(), Output = class {
        constructor(e2, t2) {
          __publicField(this, "source");
          __publicField(this, "pageKind");
          __publicField(this, "baseName");
          __publicField(this, "target", null);
          this.source = e2, this.pageKind = t2, this.baseName = "", this.setBasename(), this.buildTarget();
        }
        setBasename() {
          switch (this.pageKind) {
            case getKindMain("404"):
              this.baseName = "404";
              break;
            case getKindMain("sitemap"):
              this.baseName = "sitemap";
              break;
            default:
              this.baseName = this.source.paths().baseNameNoIdentifier() || "index";
          }
        }
        buildTarget() {
          let e2 = "", t2 = "";
          const n3 = "index";
          switch (this.pageKind) {
            case getKindMain("home"):
              e2 = `${n3}.html`, t2 = "";
              break;
            case getKindMain("page"):
              const r = this.source.paths().containerDir();
              e2 = r && "/" !== r ? `${r}/${this.baseName}.html` : `/${this.baseName}.html`, t2 = r || "";
              break;
            case getKindMain("section"):
            case getKindMain("taxonomy"):
            case getKindMain("term"):
              const i = this.source.paths().dir();
              e2 = i ? `${i}/${n3}.html` : `${n3}.html`, t2 = i || "";
              break;
            case getKindMain("404"):
              const s2 = this.source.paths().dir();
              e2 = s2 ? `${s2}/${this.baseName}.html` : `${this.baseName}.html`, t2 = s2 || "";
              break;
            case getKindMain("sitemap"):
              const a = this.source.paths().dir();
              e2 = a ? `${a}/${this.baseName}.xml` : `${this.baseName}.xml`, t2 = a || "";
              break;
            default:
              e2 = `${n3}.html`, t2 = "";
          }
          this.target = { prefix: this.source.identity.pageLanguage(), filePath: e2, subResourceBaseTarget: t2 };
        }
        createBasicResult() {
          return { bytes: () => new Uint8Array(), headers: () => [], tableOfContents: () => ({ toHTML: (e2, t2, n3) => "" }) };
        }
        output(e2) {
          return { targetFileBase: () => {
            if (!this.target) return "index.html";
            const e3 = this.target.filePath, t2 = e3.lastIndexOf("/");
            return t2 >= 0 ? e3.substring(t2 + 1) : e3;
          }, targetFilePath: () => this.target.filePath, targetSubResourceDir: () => this.target.subResourceBaseTarget, targetPrefix: () => this.target.prefix, content: async () => e2.content ? e2.content.RenderedContent() : "", summary: async () => e2.content ? e2.content.Summary() : "", tableOfContents: () => e2.content && e2.content.toc ? e2.content.toc.toHTML(1, 6, false) : "", result: () => this.createBasicResult(), readingTime: async () => e2.content ? e2.content.ReadingTime() : 0, wordCount: async () => e2.content ? e2.content.WordCount() : 0 };
        }
      };
    } });
    var init_paginator = __esm2({ "internal/domain/content/entity/paginator.ts"() {
      init_log(), getDomainLogger("content", { component: "paginator" }), PaginatorImpl = class {
        constructor(e2, t2, n3, r) {
          __publicField(this, "paginatedElements");
          __publicField(this, "_pagers");
          __publicField(this, "base");
          __publicField(this, "total");
          __publicField(this, "size");
          if (this.paginatedElements = e2, this.base = r, this.total = t2, this.size = n3, this._pagers = [], e2.length > 0) for (let t3 = 0; t3 < e2.length; t3++) this._pagers.push(new PagerImpl(t3 + 1, this));
          else this._pagers.push(new PagerImpl(1, this));
        }
        totalPages() {
          return this.paginatedElements.length;
        }
        pagers() {
          return [...this._pagers];
        }
        getElement(e2) {
          return 0 === this.paginatedElements.length ? [] : this.paginatedElements[e2 - 1] || [];
        }
        getBase() {
          return this.base;
        }
        getPagers() {
          return this._pagers;
        }
        getAllPages() {
          const e2 = [];
          for (const t2 of this.paginatedElements) e2.push(...t2);
          return e2;
        }
      }, PagerImpl = class {
        constructor(e2, t2) {
          __publicField(this, "number");
          __publicField(this, "paginator");
          this.number = e2, this.paginator = t2;
        }
        pageNumber() {
          return this.number;
        }
        totalPages() {
          return this.paginator.totalPages();
        }
        url() {
          const e2 = this.pageNumber();
          if (e2 > 1) {
            const t2 = `/page/${e2}/`;
            return this.pathJoin(this.paginator.getBase(), t2);
          }
          return this.paginator.getBase();
        }
        pages() {
          return this.element();
        }
        allPages() {
          return this.paginator.getAllPages();
        }
        pagers() {
          return this.paginator.pagers();
        }
        first() {
          return this.paginator.getPagers()[0];
        }
        last() {
          const e2 = this.paginator.getPagers();
          return e2[e2.length - 1];
        }
        hasPrev() {
          return this.pageNumber() > 1;
        }
        prev() {
          return this.hasPrev() ? this.paginator.getPagers()[this.pageNumber() - 2] : null;
        }
        hasNext() {
          return this.pageNumber() < this.paginator.totalPages();
        }
        next() {
          return this.hasNext() ? this.paginator.getPagers()[this.pageNumber()] : null;
        }
        element() {
          return this.paginator.getElement(this.pageNumber());
        }
        pathJoin(e2, t2) {
          return e2.endsWith("/") && (e2 = e2.slice(0, -1)), t2.startsWith("/") || (t2 = "/" + t2), e2 + t2;
        }
      }, PaginatorManagerImpl = class {
        constructor(e2, t2) {
          __publicField(this, "currentPager", null);
          __publicField(this, "initialized", false);
          __publicField(this, "svc");
          __publicField(this, "page");
          this.svc = e2, this.page = t2;
        }
        async current() {
          return this.initialized || await this.initializePaginator(), this.currentPager ? this.currentPager : new PaginatorImpl([], 0, 10, this.page.paths().base()).pagers()[0];
        }
        setCurrent(e2) {
          this.currentPager = e2;
        }
        async paginate(e2) {
          if (!this.initialized) {
            const t2 = this.svc.pageSize();
            let n3;
            n3 = Array.isArray(e2) && e2.length > 0 && "key" in e2[0] ? this.newPaginatorFromPageGroups(e2, t2, this.page.paths().base()) : this.newPaginatorFromPages(e2, t2, this.page.paths().base()), this.currentPager = n3.pagers()[0], this.initialized = true;
          }
          return this.currentPager || this.current();
        }
        async paginator() {
          return this.initialized || await this.initializePaginator(), this.currentPager || this.current();
        }
        async initializePaginator() {
          try {
            const e2 = this.svc.pageSize();
            let t2 = [];
            switch (this.page.kind()) {
              case "home":
                t2 = await this.svc.globalRegularPages();
                break;
              case "term":
              case "taxonomy":
                const e3 = await this.page.pages();
                t2 = (e3 == null ? void 0 : e3.length) ? Array.from({ length: e3.length }, (t3, n5) => e3[n5]) : [];
                break;
              default:
                const n4 = await this.page.regularPages();
                t2 = n4 && n4.length > 0 ? Array.from({ length: n4.length }, (e4, t3) => n4[t3]) : await this.svc.globalRegularPages();
            }
            const n3 = this.page.paths().base(), r = this.newPaginatorFromPages(t2, e2, n3);
            this.currentPager = r.pagers()[0], this.initialized = true;
          } catch (e2) {
            const t2 = this.page.paths().base(), n3 = new PaginatorImpl([], 0, 10, t2);
            this.currentPager = n3.pagers()[0], this.initialized = true;
          }
        }
        newPaginatorFromPages(e2, t2, n3) {
          if (t2 <= 0) throw new Error("paginator size must be positive");
          const r = this.splitPages(e2, t2);
          return new PaginatorImpl(r, e2.length, t2, n3);
        }
        newPaginatorFromPageGroups(e2, t2, n3) {
          if (t2 <= 0) throw new Error("paginator size must be positive");
          const r = [];
          if (e2 && e2.length > 0) for (let t3 = 0; t3 < e2.length; t3++) {
            const n4 = e2[t3];
            if (n4 && n4.pages) {
              const e3 = n4.pages();
              if (e3) for (let t4 = 0; t4 < e3.length; t4++) r.push(e3[t4]);
            }
          }
          const i = this.splitPages(r, t2);
          return new PaginatorImpl(i, r.length, t2, n3);
        }
        splitPages(e2, t2) {
          const n3 = [];
          for (let r = 0; r < e2.length; r += t2) {
            const i = Math.min(r + t2, e2.length);
            n3.push(e2.slice(r, i));
          }
          return n3;
        }
      };
    } });
    var init_scratch = __esm2({ "pkg/maps/scratch.ts"() {
      Scratch = class {
        constructor() {
          __publicField(this, "values");
          this.values = /* @__PURE__ */ new Map();
        }
        add(e2, t2) {
          const n3 = this.values.get(e2);
          let r;
          return r = void 0 !== n3 ? Array.isArray(n3) ? [...n3, t2] : "number" == typeof n3 && "number" == typeof t2 || "string" == typeof n3 && "string" == typeof t2 ? n3 + t2 : t2 : t2, this.values.set(e2, r), "";
        }
        Add(e2, t2) {
          return this.add(e2, t2);
        }
        set(e2, t2) {
          return this.values.set(e2, t2), "";
        }
        Set(e2, t2) {
          return this.set(e2, t2);
        }
        delete(e2) {
          return this.values.delete(e2), "";
        }
        get(e2) {
          return this.values.get(e2);
        }
        Get(e2) {
          return this.get(e2);
        }
        getValues() {
          return this.values;
        }
        setInMap(e2, t2, n3) {
          let r = this.values.get(e2);
          return r && "object" == typeof r || (r = {}, this.values.set(e2, r)), r[t2] = n3, "";
        }
      };
    } });
    function dir(e2) {
      const t2 = e2.lastIndexOf("/");
      if (-1 === t2) return "";
      let n3 = e2.slice(0, t2 + 1);
      return n3.length > 1 && n3.endsWith("/") && (n3 = n3.slice(0, -1)), n3;
    }
    var import_path10;
    var PageImpl;
    var TaxonomyPageImpl;
    var TermPageImpl;
    var Meta;
    var Layout;
    var ShortcodeWithPage;
    var BASE_FILE_BASE;
    var BASE_DEFAULT;
    var PARTIALS_PREFIX;
    var TemplateError;
    var path19;
    var BaseOf;
    var TemplateInfo2;
    var init_paths2 = __esm2({ "pkg/paths/index.ts"() {
    } });
    var init_page = __esm2({ "internal/domain/content/entity/page.ts"() {
      init_content3(), init_pageoutput(), init_paginator(), init_scratch(), init_pagemap(), init_paths2(), init_doctree(), init_sort(), import_path10 = __toESM3(require("path")), init_log(), getDomainLogger("content", { component: "page" }), PageImpl = class {
        constructor(e2, t2, n3, r, i = "", s2 = "page", a = null) {
          __publicField(this, "source");
          __publicField(this, "content");
          __publicField(this, "meta");
          __publicField(this, "layout");
          __publicField(this, "pagerManager");
          __publicField(this, "title_");
          __publicField(this, "description_", "");
          __publicField(this, "kind_");
          __publicField(this, "pageMap");
          __publicField(this, "output_", null);
          __publicField(this, "store_", null);
          this.source = e2, this.content = t2, this.meta = n3, this.layout = r, this.title_ = i, this.kind_ = s2, this.pageMap = a, this.pagerManager = new PaginatorManagerImpl({ pageSize: () => 10, globalRegularPages: async () => [] }, this);
        }
        rawContent() {
          if (!this.content) return "";
          const e2 = this.content.getRawSource();
          return new TextDecoder().decode(e2);
        }
        pageIdentity() {
          return this.source.identity;
        }
        pageFile() {
          return this.source.file;
        }
        staleVersions() {
          return [];
        }
        section() {
          return this.source.file.section();
        }
        paths() {
          return this.source.file.paths();
        }
        path() {
          return this.source.file.paths().path();
        }
        slug() {
          return this.pathToSlug(this.path());
        }
        pathToSlug(e2) {
          let t2 = e2.replace(/^\//, "");
          return t2 = t2.replace(/\.md$/, ""), t2.endsWith("/index") && (t2 = t2.replace(/\/index$/, "")), "index" !== t2 && "" !== t2 || (t2 = "index"), t2.endsWith("/_index") && (t2 = t2.replace(/\/_index$/, "")), t2;
        }
        posOffset(e2) {
          return this.source.posOffset(e2);
        }
        description() {
          return this.description_;
        }
        get Description() {
          return this.description();
        }
        StaticURL(e2) {
          return /^(https?:)?\/\//.test(e2) ? e2 : ((e2 = (e2 = import_path10.default.normalize(e2)).replace(/\\/g, "/")).startsWith("/") && (e2 = e2.slice(1)), `${this.meta.pageBaseUrl().replace(/\/+$/, "")}/${e2}`);
        }
        params() {
          return this.meta.params();
        }
        get Params() {
          return this.params();
        }
        store() {
          return this.store_ || (this.store_ = new Scratch()), this.store_;
        }
        get Store() {
          return this.store();
        }
        scratch() {
          return this.store();
        }
        get Scratch() {
          return this.scratch();
        }
        pageBaseUrl() {
          return this.meta.pageBaseUrl();
        }
        pageWeight() {
          return this.meta.pageWeight();
        }
        pageDate() {
          return this.meta.pageDate();
        }
        publishDate() {
          return this.meta.publishDate();
        }
        async relatedKeywords(e2) {
          return this.meta.relatedKeywords(e2);
        }
        shouldList(e2) {
          return this.meta.shouldList(e2);
        }
        shouldListAny() {
          return this.meta.shouldListAny();
        }
        noLink() {
          return this.meta.noLink();
        }
        organization() {
          return this.meta.organization();
        }
        author() {
          return this.meta.author();
        }
        menu() {
          return this.meta.menu();
        }
        async current() {
          return await this.pagerManager.current();
        }
        setCurrent(e2) {
          this.pagerManager.setCurrent(e2);
        }
        async paginator() {
          return await this.pagerManager.paginator();
        }
        async paginate(e2) {
          return this.pagerManager.paginate(e2);
        }
        file() {
          return this.source.file;
        }
        get Type() {
          return this.file().type();
        }
        name() {
          return this.source.file.baseFileName();
        }
        title() {
          return this.title_;
        }
        get Title() {
          return this.title();
        }
        kind() {
          return this.kind_;
        }
        isHome() {
          return this.kind() === getKindMain("home");
        }
        isPage() {
          return this.kind() === getKindMain("page");
        }
        isSection() {
          return this.kind() === getKindMain("section");
        }
        isAncestor(e2) {
          return e2.path() !== this.path() && e2.paths().base().startsWith(this.paths().base());
        }
        eq(e2) {
          return this.pageIdentity().identifierBase() === e2.pageIdentity().identifierBase();
        }
        layouts() {
          switch (this.kind_) {
            case getKindMain("home"):
              return this.source.file.isBranchBundle() ? this.layout.homeList() : this.layout.home();
            case getKindMain("page"):
              return this.layout.page(this.source.file.section(), this.source.file.baseFileName());
            case getKindMain("section"):
              return this.layout.section(this.source.file.section());
            case getKindMain("taxonomy"):
              return this.layout.taxonomy();
            case getKindMain("term"):
              return this.layout.term();
            case getKindMain("404"):
              return this.layout.standalone404();
            case getKindMain("sitemap"):
              return this.layout.standaloneSitemap();
            default:
              return [];
          }
        }
        output() {
          return this.output_ || (this.output_ = new Output(this.source, this.kind())), this.output_.output(this);
        }
        get TargetPath() {
          return this.output().targetFilePath();
        }
        get Summary() {
          return this.output().summary();
        }
        truncated() {
          return true;
        }
        parent() {
          var _a6;
          if (this.isHome()) return null;
          let e2 = this.paths().containerDir();
          if ("" === e2) return null;
          for (; ; ) {
            const t2 = (_a6 = this.pageMap) == null ? void 0 : _a6.treePages.longestPrefix(e2, true);
            if (!t2) return null;
            const [n3, r] = t2;
            if (!r) return null;
            const [i, s2] = r.getPage();
            if (!i) return null;
            if (this.isBundled()) return s2 ? i : null;
            if (!i.isPage()) return s2 ? i : null;
            e2 = dir(e2);
          }
        }
        async Pages() {
          return await this.pages();
        }
        async pages() {
          const e2 = this.pageIdentity().pageLanguageIndex();
          switch (this.kind()) {
            case PageKind.PAGE:
            case PageKind.SECTION:
            case PageKind.HOME:
              return await this.pageMap.getPagesInSection(e2, new PageMapQueryPagesInSectionImpl(this.paths().base(), "page-section", false, false, e2, (e3) => pagePredicates.shouldListLocal(e3) && (pagePredicates.kindPage(e3) || pagePredicates.kindSection(e3))));
            case PageKind.TERM:
              return await this.pageMap.getPagesWithTerm(e2, new PageMapQueryPagesBelowPathImpl(this.paths().base(), "term"));
            case PageKind.TAXONOMY:
              return await this.pageMap.getPagesInSection(e2, new PageMapQueryPagesInSectionImpl(this.paths().base(), "term", true, false, e2, (e3) => pagePredicates.shouldListLocal(e3) && pagePredicates.kindTerm(e3)));
            default:
              return Promise.resolve([]);
          }
        }
        prevInSection() {
          return null;
        }
        nextInSection() {
          return null;
        }
        sections(e2) {
          return [];
        }
        async regularPages() {
          const e2 = this.pageIdentity().pageLanguageIndex();
          switch (this.kind()) {
            case PageKind.PAGE:
            case PageKind.SECTION:
            case PageKind.HOME:
            case PageKind.TAXONOMY:
              return this.pageMap ? await this.pageMap.getPagesInSection(e2, new PageMapQueryPagesInSectionImpl(this.paths().base(), "", false, false, e2, (e3) => pagePredicates.shouldListLocal(e3) && pagePredicates.kindPage(e3))) : [];
            case PageKind.TERM:
              return this.pageMap ? await this.pageMap.getPagesWithTerm(e2, new PageMapQueryPagesBelowPathImpl(this.paths().base(), "", (e3) => pagePredicates.shouldListLocal(e3) && pagePredicates.kindPage(e3))) : [];
            default:
              return [];
          }
        }
        regularPagesRecursive() {
          return [];
        }
        async terms(e2, t2) {
          var _a6;
          return this.pageMap ? (_a6 = this.pageMap) == null ? void 0 : _a6.getTermsForPageInTaxonomy(e2, this.paths().base(), t2) : null;
        }
        async isTranslated() {
          return (await this.translations()).length > 0;
        }
        async translations() {
          const e2 = this.path() + "/" + this.pageIdentity().pageLanguage() + "/translations";
          if (!this.pageMap) return [];
          try {
            return await this.pageMap.getOrCreatePagesFromCacheSync(null, e2, async (e3) => {
              const t2 = await this.allTranslations(), n3 = [];
              for (let e4 = 0; e4 < t2.length; e4++) {
                const r = t2.at(e4);
                r && !r.eq(this) && n3.push(r);
              }
              return n3;
            });
          } catch (e3) {
            throw e3;
          }
        }
        async allTranslations() {
          const e2 = this.path() + "/translations-all";
          if (!this.pageMap) return [];
          try {
            return await this.pageMap.getOrCreatePagesFromCacheSync(null, e2, async (e3) => {
              const t2 = [];
              var n3;
              return this.pageMap.treePages.forEachInDimension(this.paths().base(), dimensionFlag.index(1), (e4) => {
                if (null != e4) {
                  const n4 = e4.getPages();
                  t2.push(...n4);
                }
                return false;
              }), n3 = t2, pageBy(language).sort(n3), t2;
            });
          } catch (e3) {
            throw e3;
          }
        }
        isBundled() {
          return this.source.file.isBundle();
        }
      }, TaxonomyPageImpl = class extends PageImpl {
        constructor(e2, t2, n3, r, i, s2 = "", a = "taxonomy", o = null) {
          super(e2, t2, n3, r, s2, a, o);
          __publicField(this, "singular");
          this.singular = i;
        }
        params() {
          const e2 = super.params();
          return e2.Singular = this.singular, e2;
        }
      }, TermPageImpl = class extends TaxonomyPageImpl {
        constructor(e2, t2, n3, r, i, s2, a = "", o = "term", l = null) {
          super(e2, t2, n3, r, i, a, o, l);
          __publicField(this, "term");
          this.term = s2;
        }
        params() {
          const e2 = super.params();
          return e2.Term = this.term, e2;
        }
      };
    } });
    var init_pagemeta = __esm2({ "internal/domain/content/entity/pagemeta.ts"() {
      Meta = class {
        constructor(e2, t2 = "always", n3 = {}, r = 999, i = /* @__PURE__ */ new Date(), s2, a, o) {
          __publicField(this, "baseURL");
          __publicField(this, "list");
          __publicField(this, "parameters");
          __publicField(this, "weight");
          __publicField(this, "date");
          __publicField(this, "org");
          __publicField(this, "authorInfo");
          __publicField(this, "menuConfig");
          this.baseURL = e2, this.list = t2, this.parameters = n3, this.weight = r, this.date = i, this.org = s2, this.authorInfo = a, this.menuConfig = o;
        }
        description() {
          return "";
        }
        params() {
          return this.parameters;
        }
        pageBaseUrl() {
          return this.baseURL;
        }
        pageWeight() {
          return this.weight;
        }
        pageDate() {
          return this.date;
        }
        publishDate() {
          return this.pageDate();
        }
        async relatedKeywords(e2) {
          return [];
        }
        shouldList(e2) {
          switch (this.list) {
            case "always":
            default:
              return true;
            case "never":
              return false;
            case "local":
              return !e2;
          }
        }
        shouldListAny() {
          return this.shouldList(true) || this.shouldList(false);
        }
        noLink() {
          return false;
        }
        organization() {
          return this.org;
        }
        author() {
          return this.authorInfo;
        }
        menu() {
          return this.menuConfig;
        }
      };
    } });
    var init_pagelayout = __esm2({ "internal/domain/content/entity/pagelayout.ts"() {
      Layout = class {
        home() {
          return ["index.html", "_default/index.html", "_default/single.html"];
        }
        homeList() {
          return ["index.html", "_default/index.html", "_default/list.html"];
        }
        section(e2) {
          return [`${e2}/section.html`, `${e2}/list.html`, "_default/section.html", "_default/list.html", "_default/index.html"];
        }
        page(e2, t2) {
          const n3 = e2 ? `${e2}/${t2}` : t2, r = e2 ? `${e2}/single.html` : "single.html", i = [];
          return "index" !== n3 && i.push(`${n3}.html`), i.push(r), "index" !== t2 && i.push(`_default/${t2}.html`), i.push("_default/single.html"), i.push("index.html"), i.push("_default/index.html"), i;
        }
        taxonomy() {
          return ["taxonomy/taxonomy.html", "taxonomy/list.html", "_default/list.html", "_default/taxonomy.html"];
        }
        term() {
          return ["taxonomy/tag.html", "term/term.html", "taxonomy/list.html", "_default/list.html", "_default/term.html"];
        }
        standalone404() {
          return ["404.html"];
        }
        standaloneSitemap() {
          return ["sitemap.xml", "_default/sitemap.xml"];
        }
      };
    } });
    var init_shortcode2 = __esm2({ "internal/domain/content/entity/shortcode.ts"() {
      init_scratch(), ShortcodeWithPage = class {
        constructor(e2, t2, n3, r, i, s2, a, o = "", l = 0) {
          __publicField(this, "_params");
          __publicField(this, "_inner");
          __publicField(this, "_page");
          __publicField(this, "_parent");
          __publicField(this, "_name");
          __publicField(this, "_isNamedParams");
          __publicField(this, "_ordinal");
          __publicField(this, "_indentation");
          __publicField(this, "_innerDeindent", null);
          __publicField(this, "_posOffset");
          __publicField(this, "_pos", null);
          __publicField(this, "_scratch", null);
          this._params = e2, this._inner = t2, this._page = n3, this._parent = r, this._name = i, this._isNamedParams = s2, this._ordinal = a, this._indentation = o, this._posOffset = l;
        }
        get params() {
          return this._params;
        }
        get Params() {
          return this._params;
        }
        get IsNamedParams() {
          return this._isNamedParams;
        }
        get inner() {
          return this._inner;
        }
        get Inner() {
          return this._inner;
        }
        get page() {
          return this._page;
        }
        get Page() {
          return this._page;
        }
        get parent() {
          return this._parent;
        }
        get Parent() {
          return this._parent;
        }
        get name() {
          return this._name;
        }
        get isNamedParams() {
          return this._isNamedParams;
        }
        get ordinal() {
          return this._ordinal;
        }
        get Ordinal() {
          return this._ordinal;
        }
        innerDeindent() {
          if ("" === this._indentation) return this._inner;
          if (null === this._innerDeindent) {
            const e2 = this._inner.split("\n");
            this._innerDeindent = e2.map((e3) => e3.startsWith(this._indentation) ? e3.substring(this._indentation.length) : e3).join("\n");
          }
          return this._innerDeindent;
        }
        get InnerDeindent() {
          return this.innerDeindent();
        }
        async position() {
          return this._pos || (this._pos = await this._page.posOffset(this._posOffset)), this._pos;
        }
        scratch() {
          return this._scratch || (this._scratch = new Scratch()), this._scratch;
        }
        get(e2) {
          return this._params ? Array.isArray(this._params) ? "number" == typeof e2 ? e2 >= this._params.length ? "" : this._params[e2] : null : "object" == typeof this._params && "string" == typeof e2 ? this._params[e2] || "" : null : null;
        }
        Get(e2) {
          return this.get(e2);
        }
      };
    } });
    var init_type8 = __esm2({ "internal/domain/template/type.ts"() {
      BASE_FILE_BASE = "baseof", BASE_DEFAULT = "_default", PARTIALS_PREFIX = "partials/", new (TemplateError = class extends Error {
        constructor(e2, t2) {
          super(e2), this.code = t2, this.name = "TemplateError";
        }
      })("template not found", "TEMPLATE_NOT_FOUND"), new TemplateError("template parse failed", "PARSE_FAILED"), new TemplateError("template execute failed", "EXECUTE_FAILED"), new TemplateError("invalid template", "INVALID_TEMPLATE");
    } });
    var init_baseof = __esm2({ "internal/domain/template/vo/baseof.ts"() {
      init_type8(), path19 = __toESM3(require("path")), BaseOf = class {
        constructor() {
          __publicField(this, "baseof", /* @__PURE__ */ new Map());
          __publicField(this, "needsBaseof", /* @__PURE__ */ new Map());
        }
        getTemplateSearchOrder(e2) {
          const t2 = [];
          return t2.push(`${BASE_DEFAULT}/baseof.html`), t2;
        }
        getBaseOf(e2) {
          return this.baseof.get(e2) || null;
        }
        getNeedsBaseOf(e2) {
          return this.needsBaseof.get(e2) || null;
        }
        addBaseOf(e2, t2) {
          this.baseof.set(e2, t2);
        }
        addNeedsBaseOf(e2, t2) {
          this.needsBaseof.set(e2, t2);
        }
        isBaseTemplatePath(e2) {
          return path19.basename(e2).includes(BASE_FILE_BASE);
        }
        needsBaseOf(e2, t2) {
          return !this.noBaseNeeded(e2) && this.needsBaseTemplate(t2);
        }
        noBaseNeeded(e2) {
          return !!e2.startsWith(PARTIALS_PREFIX);
        }
        needsBaseTemplate(e2) {
          let t2 = -1, n3 = false;
          for (let r = 0; r < e2.length; ) if (!n3 && e2.substring(r).startsWith("{{/*")) n3 = true, r += 4;
          else if (!n3 && e2.substring(r).startsWith("{{- /*")) n3 = true, r += 6;
          else if (n3 && e2.substring(r).startsWith("*/}}")) n3 = false, r += 4;
          else if (n3 && e2.substring(r).startsWith("*/ -}}")) n3 = false, r += 6;
          else {
            const i = e2[r];
            if (!n3) {
              if (e2.substring(r).startsWith("{{")) {
                t2 = r;
                break;
              }
              if (!/\s/.test(i)) break;
            }
            r++;
          }
          return -1 !== t2 && /^{{-?\s*define/.test(e2.substring(t2));
        }
        getAllBaseOf() {
          return new Map(this.baseof);
        }
        getAllNeedsBaseOf() {
          return new Map(this.needsBaseof);
        }
        clear() {
          this.baseof.clear(), this.needsBaseof.clear();
        }
        getStats() {
          return { baseOfCount: this.baseof.size, needsBaseOfCount: this.needsBaseof.size };
        }
      };
    } });
    function removeLeadingBOM(e2) {
      for (let t2 = 0; t2 < e2.length; t2++) {
        const n3 = e2[t2];
        if (0 === t2 && "\uFEFF" !== n3) return e2;
        if (t2 > 0) return e2.substring(t2);
      }
      return e2;
    }
    function resolveTemplateType(e2) {
      return function(e3) {
        return e3.includes("_shortcodes/");
      }(e2) ? 1 : e2.includes("_partials/") ? 2 : 0;
    }
    var BaseNamespace;
    var RegularTemplateNamespace;
    var PartialTemplateNamespace;
    var ShortcodeTemplateNamespace;
    var Executor;
    var log31;
    var ConcurrentCache;
    var import_text_template;
    var import_text_template2;
    var log32;
    var Parser;
    var Lookup;
    var log33;
    var TemplateEngine;
    var crypto22;
    var log34;
    var engineDependentFunctions;
    var PartialFunction;
    var DefaultTemplateRegistry;
    var init_info = __esm2({ "internal/domain/template/vo/info.ts"() {
      init_type8(), TemplateInfo2 = class e2 {
        constructor(e3, t2, n3) {
          this.name = e3, this.template = t2, this.fi = n3;
        }
        identifierBase() {
          return this.name;
        }
        errWithFileContext(e3, t2) {
          const n3 = `${e3}: ${t2.message}`, r = new TemplateError(n3, "TEMPLATE_FILE_ERROR");
          return Object.defineProperty(r, "fileName", { value: this.name, enumerable: true }), Object.defineProperty(r, "fileContent", { value: this.template, enumerable: true }), r;
        }
        isZero() {
          return "" === this.name;
        }
        copy() {
          return new e2(this.name, this.template, this.fi);
        }
        getCleanContent() {
          return removeLeadingBOM(this.template);
        }
      };
    } });
    var init_namespace = __esm2({ "internal/domain/template/vo/namespace.ts"() {
      init_type8(), init_log(), getDomainLogger("template", { component: "namespace" }), BaseNamespace = class {
        constructor() {
          __publicField(this, "templates", /* @__PURE__ */ new Map());
          __publicField(this, "mutex", /* @__PURE__ */ new Set());
        }
        addTemplate(e2, t2) {
          this.withLock(() => {
            this.templates.set(e2, t2);
          });
        }
        findTemplate(e2) {
          return this.withReadLock(() => {
            if (this.templates.has(e2)) return this.templates.get(e2) || null;
            if (!e2.endsWith(".html")) {
              const t2 = e2 + ".html";
              if (this.templates.has(t2)) return this.templates.get(t2) || null;
            }
            for (const [t2, n3] of this.templates.entries()) if (t2.includes(e2)) return n3;
            return null;
          });
        }
        getTemplates() {
          return this.withReadLock(() => new Map(this.templates));
        }
        hasTemplate(e2) {
          return this.withReadLock(() => this.templates.has(e2));
        }
        getTemplateNames() {
          return this.withReadLock(() => Array.from(this.templates.keys()));
        }
        removeTemplate(e2) {
          return this.withLock(() => this.templates.delete(e2));
        }
        clear() {
          this.withLock(() => {
            this.templates.clear();
          });
        }
        size() {
          return this.withReadLock(() => this.templates.size);
        }
        getTemplatesByPattern(e2) {
          return this.withReadLock(() => {
            const t2 = [];
            for (const [n3, r] of this.templates) e2.test(n3) && t2.push(r);
            return t2;
          });
        }
        withLock(e2) {
          const t2 = "write";
          for (; this.mutex.has(t2); ) ;
          this.mutex.add(t2);
          try {
            return e2();
          } finally {
            this.mutex.delete(t2);
          }
        }
        withReadLock(e2) {
          const t2 = "read";
          this.mutex.add(t2);
          try {
            return e2();
          } finally {
            this.mutex.delete(t2);
          }
        }
      }, RegularTemplateNamespace = class extends BaseNamespace {
        lookup(e2) {
          const t2 = this.findTemplate(e2);
          return t2 ? t2.template : null;
        }
        findTemplateWithDependencies(e2) {
          return this.findTemplate(e2);
        }
        getTemplatesNeedingBase() {
          return this.withReadLock(() => Array.from(this.templates.values()).filter((e2) => e2.baseInfo));
        }
      }, PartialTemplateNamespace = class extends BaseNamespace {
        lookup(e2) {
          const t2 = this.findTemplate(e2);
          return t2 ? t2.template : null;
        }
        addPartialTemplate(e2, t2) {
          const n3 = { ...t2, type: 2 };
          this.addTemplate(e2, n3);
        }
      }, ShortcodeTemplateNamespace = class extends BaseNamespace {
        lookup(e2) {
          const t2 = this.findTemplate(e2);
          return t2 ? t2.template : null;
        }
        addShortcodeTemplate(e2, t2) {
          const n3 = { ...t2, type: 1 };
          this.addTemplate(e2, n3);
        }
        getShortcode(e2) {
          return this.lookup("_shortcodes/" + e2);
        }
        hasShortcode(e2) {
          return this.hasTemplate(e2);
        }
        getShortcodeNames() {
          return this.getTemplateNames();
        }
      };
    } });
    var init_executor = __esm2({ "internal/domain/template/entity/executor.ts"() {
      init_type8(), Executor = class {
        async execute(e2, t2) {
          try {
            const [n3, r] = await e2.Execute(t2);
            if (r) throw new TemplateError(`Template execution failed: ${r.message}`, "EXECUTION_FAILED");
            return n3;
          } catch (e3) {
            if (e3 instanceof TemplateError) throw e3;
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Template execution failed: ${t3}`, "EXECUTION_FAILED");
          }
        }
        async executeWithTimeout(e2, t2, n3) {
          return new Promise(async (r, i) => {
            const s2 = setTimeout(() => {
              i(new TemplateError("Template execution timeout", "EXECUTION_TIMEOUT"));
            }, n3);
            await this.execute(e2, t2).then((e3) => {
              clearTimeout(s2), r(e3);
            }).catch((e3) => {
              clearTimeout(s2), i(e3);
            });
          });
        }
        async executeSafely(e2, t2) {
          try {
            return { result: await this.execute(e2, t2), error: null };
          } catch (e3) {
            if (e3 instanceof TemplateError) return { result: null, error: e3 };
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            return { result: null, error: new TemplateError(`Execution failed: ${t3}`, "EXECUTION_ERROR") };
          }
        }
        async executeBatch(e2) {
          return (await Promise.allSettled(e2.map(async ({ name: e3, template: t2, data: n3 }) => {
            try {
              return { name: e3, result: await this.execute(t2, n3), error: null };
            } catch (t3) {
              return { name: e3, result: null, error: t3 instanceof TemplateError ? t3 : new TemplateError(`Batch execution failed: ${t3.message}`, "BATCH_EXECUTION_FAILED") };
            }
          }))).map((e3) => "fulfilled" === e3.status ? e3.value : { name: "unknown", result: null, error: new TemplateError(`Batch execution failed: ${e3.reason}`, "BATCH_EXECUTION_FAILED") });
        }
        async executeWithContext(e2, t2, n3) {
          var _a6;
          if ((_a6 = n3.signal) == null ? void 0 : _a6.aborted) throw new TemplateError("Template execution was cancelled", "EXECUTION_CANCELLED");
          const r = new Promise((e3, t3) => {
            n3.signal && n3.signal.addEventListener("abort", () => {
              t3(new TemplateError("Template execution was cancelled", "EXECUTION_CANCELLED"));
            });
          }), i = n3.timeout ? new Promise((e3, t3) => {
            setTimeout(() => {
              t3(new TemplateError("Template execution timeout", "EXECUTION_TIMEOUT"));
            }, n3.timeout);
          }) : new Promise(() => {
          });
          try {
            return await Promise.race([this.execute(e2, t2), r, i]);
          } catch (e3) {
            if (e3 instanceof TemplateError) throw e3;
            throw new TemplateError(`Context execution failed: ${e3.message}`, "CONTEXT_EXECUTION_FAILED");
          }
        }
      };
    } });
    var init_cache2 = __esm2({ "pkg/cahce/cache.ts"() {
      init_log(), log31 = getDomainLogger("content", { component: "cache" }), new (ConcurrentCache = class {
        constructor() {
          __publicField(this, "cache", /* @__PURE__ */ new Map());
          __publicField(this, "pendingPromises", /* @__PURE__ */ new Map());
          __publicField(this, "deletedKeys", /* @__PURE__ */ new Set());
        }
        get(e2) {
          return this.cache.get(e2);
        }
        set(e2, t2) {
          this.deletedKeys.has(e2) || this.cache.set(e2, t2), this.pendingPromises.delete(e2), this.deletedKeys.delete(e2);
        }
        has(e2) {
          return this.cache.has(e2);
        }
        isPending(e2) {
          return this.pendingPromises.has(e2);
        }
        delete(e2) {
          return this.deletedKeys.add(e2), this.pendingPromises.delete(e2), this.cache.delete(e2);
        }
        clear() {
          this.cache.clear(), this.pendingPromises.clear(), this.deletedKeys.clear();
        }
        size() {
          return this.cache.size;
        }
        pendingCount() {
          return this.pendingPromises.size;
        }
        async getOrCreate(e2, t2) {
          const n3 = this.cache.get(e2);
          if (void 0 !== n3) return n3;
          const r = this.pendingPromises.get(e2);
          return r ? await r : this.createAndCache(e2, t2);
        }
        async createAndCache(e2, t2) {
          const n3 = this.executeCreate(e2, t2);
          this.pendingPromises.set(e2, n3);
          try {
            const t3 = await n3;
            return this.deletedKeys.has(e2) ? (this.deletedKeys.delete(e2), this.pendingPromises.delete(e2), t3) : (this.set(e2, t3), t3);
          } catch (t3) {
            throw this.pendingPromises.delete(e2), log31.error(`Failed to create value for key ${String(e2)} : ${t3}`), t3;
          }
        }
        async executeCreate(e2, t2) {
          try {
            return await t2(e2);
          } catch (t3) {
            const n3 = t3 instanceof Error ? t3.message : String(t3), r = new Error(`Cache creation failed for key ${String(e2)}: ${n3}`);
            throw t3 instanceof Error && t3.stack && (r.stack = t3.stack, r.originalError = t3), r;
          }
        }
        getStats() {
          return { size: this.cache.size, pendingCount: this.pendingPromises.size, keys: Array.from(this.cache.keys()), pendingKeys: Array.from(this.pendingPromises.keys()) };
        }
        async preload(e2) {
          const t2 = e2.filter(({ key: e3 }) => !this.has(e3) && !this.isPending(e3)).map(({ key: e3, create: t3 }) => this.getOrCreate(e3, t3));
          t2.length > 0 && await Promise.allSettled(t2);
        }
      })();
    } });
    var init_parser = __esm2({ "internal/domain/template/entity/parser.ts"() {
      import_text_template = require_dist2(), import_text_template2 = require_dist2(), init_type8(), init_info(), init_log(), init_cache2(), log32 = getDomainLogger("template", { component: "parser" }), Parser = class {
        constructor(e2 = /* @__PURE__ */ new Map()) {
          __publicField(this, "prototypeText");
          __publicField(this, "prototypeTextClone");
          __publicField(this, "readyInit", false);
          __publicField(this, "funcMap");
          __publicField(this, "parseOverlapCache");
          this.funcMap = e2, this.prototypeText = (0, import_text_template.New)(""), this.parseOverlapCache = new ConcurrentCache(), this.funcMap.size > 0 && this.prototypeText.Funcs(this.funcMap);
        }
        async markReady() {
          this.readyInit || (this.prototypeTextClone = this.prototypeText, this.readyInit = true);
        }
        async parse(e2) {
          try {
            const t2 = (0, import_text_template.New)(e2.name);
            this.funcMap && this.funcMap.size > 0 && t2.Funcs(this.funcMap);
            const [n3, r] = t2.Parse(e2.template);
            if (r) throw new TemplateError(`Parse failed: ${r.message}`, "PARSE_FAILED");
            return { template: n3, info: e2, type: resolveTemplateType(e2.name) };
          } catch (e3) {
            if (e3 instanceof TemplateError) throw e3;
            const t2 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Parse failed: ${t2}`, "PARSE_FAILED");
          }
        }
        async parseWithLock(e2, t2) {
          try {
            this.prototypeTextClone || await this.markReady();
            const n3 = (0, import_text_template.New)(e2);
            this.funcMap && this.funcMap.size > 0 && n3.Funcs(this.funcMap);
            const [r, i] = n3.Parse(t2);
            if (i) throw new TemplateError(`Parse with lock failed: ${i.message}`, "PARSE_LOCK_FAILED");
            return r;
          } catch (e3) {
            if (e3 instanceof TemplateError) throw e3;
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Parse with lock failed: ${t3}`, "PARSE_LOCK_FAILED");
          }
        }
        async parseOverlap(e2, t2, n3) {
          const r = `${e2.name}::${t2.name || "empty"}`;
          return this.parseOverlapCache.getOrCreate(r, async () => {
            try {
              const r3 = { template: await this.applyBaseTemplate(e2, t2, n3), info: e2, type: resolveTemplateType(e2.name) };
              return t2.isZero && !t2.name || (r3.baseInfo = t2), [r3, true, null];
            } catch (e3) {
              const t3 = e3 instanceof TemplateError ? e3 : new TemplateError(`Parse overlap failed: ${e3.message}`, "PARSE_OVERLAP_FAILED");
              return log32.error(`Failed to parse template overlap for key: ${r}: ${t3.message}`), [null, false, t3];
            }
          });
        }
        async applyBaseTemplate(e2, t2, n3) {
          try {
            const r = (0, import_text_template.New)(e2.name);
            if (this.funcMap && this.funcMap.size > 0 && r.Funcs(this.funcMap), !t2.isZero || t2.name) {
              const [e3, n4] = r.Parse(t2.template);
              if (n4) throw new TemplateError(`Base template parse failed: ${n4.message}`, "BASE_PARSE_FAILED");
            }
            const [i, s2] = r.Clone();
            if (s2) throw new TemplateError(`Template clone failed: ${s2.message}`, "CLONE_FAILED");
            const [a, o] = i.Parse(e2.template);
            if (o) throw new TemplateError(`Overlay template parse failed: ${o.message}`, "OVERLAY_PARSE_FAILED");
            const l = await this.getDependencies(a, /* @__PURE__ */ new Map(), n3);
            for (const [t3, n4] of l) if (t3 !== e2.name) try {
              if (n4.template.Tree) {
                const [, e3] = a.AddParseTree(t3, n4.template.Tree);
                if (e3) throw log32.error(`AddParseTree failed: ${e3.message} with name ${t3}`), new TemplateError(`AddParseTree failed: ${e3.message}`, "ADD_PARSE_TREE_FAILED");
              }
            } catch (n5) {
              throw log32.error(`Error adding dependency ${t3} to template ${e2.name}:`, n5), new TemplateError(`Failed to add dependency ${t3}: ${n5.message}`, "DEPENDENCY_ADD_FAILED");
            }
            return a;
          } catch (e3) {
            if (e3 instanceof TemplateError) throw e3;
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Apply base template failed: ${t3}`, "APPLY_BASE_FAILED");
          }
        }
        async getDependencies(e2, t2, n3) {
          const r = /* @__PURE__ */ new Map();
          if (t2.has(e2.Name())) return r;
          t2.set(e2.Name(), e2);
          try {
            const i = /* @__PURE__ */ new Set(), s2 = (e3) => {
              if (!e3) return;
              const t3 = e3.Type();
              if (t3 === import_text_template2.NodeType.NodeTemplate) {
                const t4 = e3.Name;
                t4 && i.add(t4);
              } else if (t3 === import_text_template2.NodeType.NodeList) {
                const t4 = e3;
                if (t4.Nodes) for (const e4 of t4.Nodes) s2(e4);
              }
              if (t3 === import_text_template2.NodeType.NodeAction) {
                const t4 = e3;
                t4.Pipe && s2(t4.Pipe);
              } else if (t3 === import_text_template2.NodeType.NodePipe) {
                const t4 = e3;
                if (t4.Cmds) for (const e4 of t4.Cmds) s2(e4);
              } else if (t3 === import_text_template2.NodeType.NodeCommand) {
                const t4 = e3;
                if (t4.Args) for (const e4 of t4.Args) s2(e4);
              } else if (t3 === import_text_template2.NodeType.NodeIf || t3 === import_text_template2.NodeType.NodeRange || t3 === import_text_template2.NodeType.NodeWith) {
                const t4 = e3;
                t4.Pipe && s2(t4.Pipe), t4.List && s2(t4.List), t4.ElseList && s2(t4.ElseList);
              }
            };
            e2.Tree && e2.Tree.Root && s2(e2.Tree.Root);
            for (const e3 of i) {
              const i2 = n3(e3);
              if (i2 && (r.set(e3, i2), !t2.has(i2.template.Name()))) {
                const e4 = await this.getDependencies(i2.template, t2, n3);
                for (const [t3, n4] of e4) r.has(t3) || r.set(t3, n4);
              }
            }
          } catch (t3) {
            log32.error(`Error getting dependencies for template ${e2.Name()}:`, t3);
          }
          return r;
        }
        setFuncMap(e2) {
          this.funcMap = new Map([...this.funcMap, ...e2]), this.funcMap.size > 0 && this.prototypeText.Funcs(this.funcMap);
        }
        getFuncMap() {
          return new Map(this.funcMap);
        }
        async parseMultiple(e2) {
          const t2 = await Promise.allSettled(e2.map((e3) => this.parse(e3))), n3 = [], r = [];
          for (const e3 of t2) "fulfilled" === e3.status ? n3.push(e3.value) : r.push(e3.reason);
          if (r.length > 0) throw new TemplateError(`Failed to parse ${r.length} templates: ${r.map((e3) => e3.message).join(", ")}`, "MULTIPLE_PARSE_FAILED");
          return n3;
        }
        clearCache() {
          this.parseOverlapCache.clear();
        }
        getCacheStats() {
          return this.parseOverlapCache.getStats();
        }
      };
    } });
    var init_lookup = __esm2({ "internal/domain/template/entity/lookup.ts"() {
      init_baseof(), Lookup = class {
        constructor(e2, t2) {
          __publicField(this, "baseOf");
          __publicField(this, "funcsv");
          if (this.baseOf = e2 || new BaseOf(), this.funcsv = /* @__PURE__ */ new Map(), t2) for (const [e3, n3] of t2) this.funcsv.set(e3, n3);
        }
        findNoDependence(e2, t2) {
          try {
            const n3 = t2.lookup(e2);
            return n3 ? [n3, true, null] : [null, false, null];
          } catch (e3) {
            return [null, false, e3];
          }
        }
        findTemplate(e2, t2) {
          try {
            const n3 = t2.lookup(e2);
            if (n3) return [n3, true, null];
            const r = t2.findTemplateWithDependencies(e2);
            return r && r.baseInfo ? [r.template, true, null] : [null, false, null];
          } catch (e3) {
            return [null, false, e3];
          }
        }
        findPartial(e2, t2) {
          try {
            const n3 = t2.lookup(e2);
            return n3 ? [n3, true, null] : [null, false, null];
          } catch (e3) {
            return [null, false, e3];
          }
        }
        findShortcode(e2, t2) {
          try {
            const n3 = t2.getShortcode(e2);
            return n3 ? [n3, true, null] : [null, false, null];
          } catch (e3) {
            return [null, false, e3];
          }
        }
        findDependentInfo(e2) {
          const t2 = this.baseOf.getNeedsBaseOf(e2);
          if (!t2) return [null, null, false];
          let n3 = null, r = false;
          for (const t3 of this.baseOf.getTemplateSearchOrder(e2)) if (n3 = this.baseOf.getBaseOf(t3), n3) {
            r = true;
            break;
          }
          return [t2, n3, r];
        }
        getFunc(e2) {
          return this.funcsv.get(e2);
        }
        setFunc(e2, t2) {
          this.funcsv.set(e2, t2);
        }
        setFuncMap(e2) {
          this.funcsv.clear();
          for (const [t2, n3] of e2) this.funcsv.set(t2, n3);
        }
        getFuncMap() {
          return new Map(this.funcsv);
        }
        newTemplateLookup(e2) {
          return (t2) => e2.findTemplate(t2);
        }
        getBaseOf() {
          return this.baseOf;
        }
        setBaseOf(e2) {
          this.baseOf = e2;
        }
        hasDependencies(e2) {
          const [t2, n3, r] = this.findDependentInfo(e2);
          return r && (null !== t2 || null !== n3);
        }
        getAllFunctions() {
          return Array.from(this.funcsv.keys());
        }
        clearFunctions() {
          this.funcsv.clear();
        }
        getStats() {
          const e2 = this.baseOf.getStats();
          return { functionCount: this.funcsv.size, baseTemplateCount: e2.baseOfCount, dependentTemplateCount: e2.needsBaseOfCount };
        }
      };
    } });
    var init_template2 = __esm2({ "internal/domain/template/entity/template.ts"() {
      init_type8(), init_info(), init_info(), init_log(), init_paths(), log33 = getDomainLogger("template", { component: "template-engine" }), TemplateEngine = class {
        constructor(e2, t2, n3, r, i, s2, a) {
          __publicField(this, "executor");
          __publicField(this, "lookup");
          __publicField(this, "parser");
          __publicField(this, "templateNamespace");
          __publicField(this, "partialNamespace");
          __publicField(this, "shortcodeNamespace");
          __publicField(this, "fs");
          this.executor = e2, this.lookup = t2, this.parser = n3, this.templateNamespace = r, this.partialNamespace = i, this.shortcodeNamespace = s2, this.fs = a;
        }
        async markReady() {
          try {
            await this.parser.markReady();
          } catch (e2) {
            throw new TemplateError(`Failed to mark template engine ready: ${e2.message}`, "TEMPLATE_ENGINE_READY_FAILED");
          }
        }
        async getTemplate(e2) {
          const [t2, n3, r] = this.lookup.findTemplate(e2, this.templateNamespace);
          if (r) return [null, false, r];
          if (n3 && t2) return [t2, true, null];
          const [i, s2, a] = this.lookup.findDependentInfo(e2);
          if (a && i) try {
            const [e3, t3, n4] = await this.parser.parseOverlap(i, s2 || i, this.lookup.newTemplateLookup(this.templateNamespace));
            if (n4) return [null, false, n4];
            if (t3 && e3) return [e3.template, true, null];
          } catch (e3) {
            return [null, false, e3];
          }
          return [null, false, null];
        }
        async getPartial(e2) {
          let t2 = e2.startsWith(PARTIALS_PREFIX) ? e2 : `${PARTIALS_PREFIX}${e2}`;
          return t2 = e2.endsWith(".html") ? t2 : `${t2}.html`, this.lookup.findPartial(t2, this.partialNamespace);
        }
        async getShortcode(e2) {
          return this.lookup.findShortcode(e2, this.shortcodeNamespace);
        }
        async get(e2) {
          switch (resolveTemplateType(e2)) {
            case 1:
              return this.getShortcode(e2);
            case 2:
              return this.getPartial(e2);
            default:
              return this.getTemplate(e2);
          }
        }
        async findFirst(e2) {
          if (!e2 || 0 === e2.length) return [null, null, false, null];
          for (const t2 of e2) try {
            const [e3, n3, r] = await this.get(t2);
            if (r) continue;
            if (n3 && e3) return [e3, t2, true, null];
          } catch (e3) {
            log33.error("Error finding template:", e3);
          }
          return [null, null, false, null];
        }
        hasShortcode(e2) {
          return this.shortcodeNamespace.hasShortcode(e2);
        }
        getShortcodeNames() {
          return this.shortcodeNamespace.getShortcodeNames();
        }
        getShortcodeCount() {
          return this.getShortcodeNames().length;
        }
        async loadTemplates() {
          var _a6, _b4;
          const e2 = async (e3, t2) => {
            if (t2.isDir()) return;
            const n3 = e3.startsWith(PATH_CONSTANTS.SYSTEM_PATH_SEPARATOR) ? e3.substring(1) : e3, r = PATH_CONSTANTS.normalizePath(n3);
            try {
              await this.addTemplateFileInfo(r, t2);
            } catch (e4) {
              log33.error("Error adding template:", new TemplateError(`Failed to add template ${r}: ${e4.message}`, "LOAD_TEMPLATE_FAILED"));
            }
          };
          try {
            await this.fs.walk("", { walkFn: e2 }, {});
          } catch (e3) {
            if (!((_a6 = e3.message) == null ? void 0 : _a6.includes("ENOENT")) && !((_b4 = e3.message) == null ? void 0 : _b4.includes("no such file"))) throw e3;
          }
        }
        async addTemplateFileInfo(e2, t2) {
          try {
            const n3 = await async function(e3, t3) {
              let n4 = null;
              try {
                n4 = await t3.open();
                const r = await n4.stat(), i = new Uint8Array(r.size()), s2 = await n4.read(i), a = removeLeadingBOM(new TextDecoder("utf-8").decode(s2.buffer));
                return new TemplateInfo2(e3, a, t3);
              } catch (n5) {
                throw new TemplateInfo2(e3, "", t3).errWithFileContext("failed to load template", n5);
              } finally {
                if (n4) try {
                  await n4.close();
                } catch (e4) {
                  console.warn(`Failed to close template file: ${e4}`);
                }
              }
            }(e2, t2);
            await this.addTemplate(n3.name, n3);
          } catch (t3) {
            throw new TemplateError(`Failed to load template info for ${e2}: ${t3.message}`, "LOAD_TEMPLATE_INFO_FAILED");
          }
        }
        async addTemplate(e2, t2) {
          try {
            if (this.lookup.getBaseOf().isBaseTemplatePath(e2)) return void this.lookup.getBaseOf().addBaseOf(e2, t2);
            if (this.lookup.getBaseOf().needsBaseOf(e2, t2.template)) return void this.lookup.getBaseOf().addNeedsBaseOf(e2, t2);
            const n3 = resolveTemplateType(e2), r = await this.parser.parse(t2);
            switch (n3) {
              case 1:
                this.shortcodeNamespace.addShortcodeTemplate(e2, r);
                break;
              case 2:
                this.partialNamespace.addPartialTemplate(e2, r);
                break;
              default:
                this.templateNamespace.addTemplate(e2, r);
            }
          } catch (t3) {
            throw new TemplateError(`Failed to add template ${e2}: ${t3.message}`, "ADD_TEMPLATE_FAILED");
          }
        }
        async execute(e2, t2) {
          const [n3, r, i] = await this.get(e2);
          if (i) throw i;
          if (!r || !n3) throw new TemplateError(`Template not found: ${e2}`, "TEMPLATE_NOT_FOUND");
          return await this.executor.execute(n3, t2);
        }
        async executeRaw(e2, t2, n3) {
          const r = await this.parser.parseWithLock(e2, t2);
          if (!r) throw new TemplateError(`Raw Template parse error: ${e2}`, "TEMPLATE_PARSE_ERROR");
          return await this.executor.execute(r, n3);
        }
        async executeShortcode(e2, t2) {
          const n3 = this.shortcodeNamespace.getShortcode(e2);
          if (!n3) throw new TemplateError(`Shortcode template '${e2}' not found`, "SHORTCODE_NOT_FOUND");
          try {
            return await this.executor.execute(n3, t2);
          } catch (t3) {
            throw new TemplateError(`Error executing shortcode template '${e2}': ${t3.message}`, "SHORTCODE_EXECUTION_FAILED");
          }
        }
        async executeSafely(e2, t2) {
          try {
            return { result: await this.execute(e2, t2), error: null };
          } catch (e3) {
            return e3 instanceof TemplateError ? { result: null, error: e3 } : { result: null, error: new TemplateError(`Execute safely failed: ${e3.message}`, "EXECUTE_SAFELY_FAILED") };
          }
        }
        async executeShortcodeSafely(e2, t2) {
          try {
            return { result: await this.executeShortcode(e2, t2), error: null };
          } catch (e3) {
            return e3 instanceof TemplateError ? { result: null, error: e3 } : { result: null, error: new TemplateError(`Execute shortcode safely failed: ${e3.message}`, "EXECUTE_SHORTCODE_SAFELY_FAILED") };
          }
        }
        async hasTemplate(e2) {
          const [, t2] = await this.get(e2);
          return t2;
        }
        getTemplateNames() {
          return this.templateNamespace.getTemplateNames();
        }
        getPartialTemplateNames() {
          return this.partialNamespace.getTemplateNames();
        }
        getAllTemplateNames() {
          return [...this.templateNamespace.getTemplateNames(), ...this.partialNamespace.getTemplateNames(), ...this.shortcodeNamespace.getTemplateNames()];
        }
        getPartialNamespace() {
          return this.partialNamespace;
        }
        getShortcodeNamespace() {
          return this.shortcodeNamespace;
        }
        getTemplateNamespace() {
          return this.templateNamespace;
        }
        clear() {
          this.templateNamespace.clear(), this.lookup.getBaseOf().clear();
        }
        getTemplatesByPattern(e2) {
          return this.templateNamespace.getTemplatesByPattern(e2).map((e3) => e3.info.name);
        }
      };
    } });
    function newTemplateRegistry() {
      return new DefaultTemplateRegistry();
    }
    var Factory2;
    var Builder;
    var init_registry = __esm2({ "internal/domain/template/vo/registry.ts"() {
      init_log(), crypto22 = __toESM3(require("crypto")), log34 = getDomainLogger("template", { component: "registry" }), engineDependentFunctions = [], PartialFunction = class {
        constructor() {
          __publicField(this, "engine", null);
          __publicField(this, "globalPartialsCache", /* @__PURE__ */ new Map());
          __publicField(this, "execute", async (e2, t2) => {
            if (!this.engine) return log34.error(`Partial function called but engine not set: ${e2}`), `<!-- Partial function called but engine not ready: ${e2} -->`;
            try {
              const n3 = e2.startsWith("partials/") ? e2 : `partials/${e2}`, r = n3.includes("global");
              if (r && this.globalPartialsCache.has(n3)) return this.globalPartialsCache.get(n3);
              const i = await this.executePartial(n3, t2);
              return r && this.globalPartialsCache.set(n3, i), i;
            } catch (t3) {
              return log34.error(`Partial execution failed for "${e2}":`, t3), `<!-- Partial execution failed: ${e2} - ${t3.message} -->`;
            }
          });
        }
        getFunctionName() {
          return "partial";
        }
        updateEngine(e2) {
          this.engine = e2, this.globalPartialsCache.clear();
        }
        async executePartial(e2, t2) {
          if (!this.engine) return `<!-- Template engine not available: ${e2} -->`;
          try {
            const [n3, r, i] = await this.engine.getPartial(e2);
            if (i) return log34.error("Error getting partial template:", i), `<!-- Error getting partial template: ${e2} - ${i.message} -->`;
            if (!r || !n3) return log34.warn(`Template not found: ${e2}`), `<!-- Template not found: ${e2} -->`;
            const [s2, a] = await n3.Execute(t2);
            return a ? (log34.error("Template execution error:", a), `<!-- Template execution error: ${e2} - ${a.message} -->`) : s2;
          } catch (t3) {
            return log34.error("Sync partial execution failed:", t3), `<!-- Partial sync execution failed: ${e2} - ${t3.message} -->`;
          }
        }
      }, DefaultTemplateRegistry = class {
        registerCoreFunctions(e2) {
          this.registerCryptoFunctions(e2), this.registerStringFunctions(e2), this.registerMathFunctions(e2), this.registerTimeFunctions(e2), this.registerCollectionFunctions(e2), this.registerSafeFunctions(e2), this.registerReflectFunctions(e2), this.registerFmtFunctions(e2), this.registerPathFunctions(e2), this.registerTransformFunctions(e2);
        }
        registerCryptoFunctions(e2) {
          e2.set("md5", (e3) => e3 ? crypto22.createHash("md5").update(e3).digest("hex") : ""), e2.set("encryptAESGCM", (e3, t2) => {
            if (!e3 || !t2) return "";
            const n3 = crypto22.randomBytes(16), r = crypto22.randomBytes(12), i = crypto22.pbkdf2Sync(e3, n3, 1e5, 32, "sha256"), s2 = crypto22.createCipheriv("aes-256-gcm", i, r), a = Buffer.concat([s2.update(t2, "utf8"), s2.final()]), o = s2.getAuthTag();
            return Buffer.concat([n3, r, o, a]).toString("base64");
          });
        }
        registerExtendedFunctions(e2, t2) {
          this.registerURLFunctions(e2, t2), this.registerSiteFunctions(e2, t2), this.registerResourcesFunctions(e2, t2), this.registerHugoFunctions(e2, t2), this.registerLanguageFunctions(e2, t2);
        }
        registerAllFunctions(e2, t2) {
          this.registerCoreFunctions(e2), this.registerStringFunctions(e2), this.registerMathFunctions(e2), this.registerTimeFunctions(e2), this.registerCollectionFunctions(e2), this.registerEngineDependentFunctions(e2), t2 && (this.registerURLFunctions(e2, t2), this.registerExtendedFunctions(e2, t2));
        }
        registerEngineDependentFunctions(e2) {
          const t2 = new PartialFunction();
          engineDependentFunctions.push(t2), e2.set(t2.getFunctionName(), t2.execute);
        }
        registerURLFunctions(e2, t2) {
          e2.set("urls", () => ({ Parse: (e3) => {
            try {
              return { Host: new URL(e3).host };
            } catch (e4) {
              return { Host: "" };
            }
          }, JoinPath: (...e3) => e3.filter((e4) => "" !== e4).map((e4) => e4.replace(/^\/+|\/+$/g, "")).join("/"), URLize: (e3) => t2.urlize(e3), Abs: (e3) => t2.absURL(e3), Rel: (e3) => t2.relURL(e3), AbsLangURL: (e3) => t2.absURL(e3), RelLangURL: (e3) => t2.relURL(e3), Sanitize: (e3) => {
            try {
              return new URL(e3).toString();
            } catch (e4) {
              return e3.replace(/[<>"'%{}|\\^`]/g, "");
            }
          }, PathEscape: (e3) => encodeURIComponent(e3).replace(/%2F/g, "/").replace(/[!'()*]/g, (e4) => `%${e4.charCodeAt(0).toString(16).toUpperCase()}`), QueryEscape: (e3) => encodeURIComponent(e3), QueryUnescape: (e3) => {
            try {
              return decodeURIComponent(e3);
            } catch (e4) {
              return e3;
            }
          }, IsAbs: (e3) => {
            try {
              return "" !== new URL(e3).protocol;
            } catch (e4) {
              return false;
            }
          }, IsRelative: (e3) => {
            try {
              return new URL(e3), false;
            } catch (e4) {
              return true;
            }
          } })), e2.set("absURL", (e3) => t2.absURL(e3)), e2.set("relURL", (e3) => t2.relURL(e3)), e2.set("urlize", (e3) => t2.urlize(e3)), e2.set("relref", (e3, n3) => {
            if (/^https?:\/\//.test(n3)) return n3;
            let r = "";
            const i = n3.indexOf("#");
            return -1 !== i && (r = n3.slice(i), n3 = n3.slice(0, i)), (n3 = n3.replace(/^\/+|\/+$/g, "")).startsWith("./") || n3.startsWith("../") || n3.startsWith("/") ? t2.relURL(n3 + r) : t2.relURL("/" + n3 + r);
          }), e2.set("ref", (e3, n3) => {
            if (/^https?:\/\//.test(n3)) return n3;
            let r = "";
            const i = n3.indexOf("#");
            return -1 !== i && (r = n3.slice(i), n3 = n3.slice(0, i)), (n3 = n3.replace(/^\/+|\/+$/g, "")).startsWith("./") || n3.startsWith("../") || n3.startsWith("/") ? t2.absURL(n3 + r) : t2.absURL("/" + n3 + r);
          }), e2.set("absLangURL", (e3) => t2.absURL(e3)), e2.set("relLangURL", (e3) => t2.relURL(e3));
        }
        registerSiteFunctions(e2, t2) {
          e2.set("Site", () => ({ Title: t2.title(), BaseURL: t2.baseURL(), Params: t2.params(), Menus: t2.menus(), IsMultiLingual: t2.isMultiLanguage(), LanguageCode: t2.defaultLanguage() }));
        }
        registerResourcesFunctions(e2, t2) {
          e2.set("resources", () => ({ Get: async (e3) => await t2.Get(e3), GetRemote: async (e3) => await t2.GetRemote(e3), Minify: async (e3) => await t2.Minify(e3), Fingerprint: async (e3) => await t2.Fingerprint(e3), ExecuteAsTemplate: async (e3, n3, r) => await t2.ExecuteAsTemplate(e3, n3, r) }));
        }
        registerHugoFunctions(e2, t2) {
          e2.set("hugo", () => ({ Version: t2.version(), Environment: t2.environment(), Generator: t2.generator() }));
        }
        registerLanguageFunctions(e2, t2) {
          const { lang: n3 } = (init_lang(), __toCommonJS3(lang_exports));
          e2.set("lang", () => ({ getAllCodes: () => n3.getAllCodes(), getAllNames: () => n3.getAllNames(), getCodesByDirection: (e3) => n3.getCodesByDirection(e3), getNamesByDirection: (e3) => n3.getNamesByDirection(e3), getCodeNameMap: () => n3.getCodeNameMap(), getCodeNameMapByDirection: (e3) => n3.getCodeNameMapByDirection(e3), getNameByCode: (e3) => n3.getNameByCode(e3), getLanguageInfo: (e3) => n3.getLanguageInfo(e3), isSupported: (e3) => n3.isSupported(e3), getDirection: (e3) => n3.getDirection(e3), isLTR: (e3) => n3.isLTR(e3), isRTL: (e3) => n3.isRTL(e3) })), e2.set("langName", (e3) => n3.getNameByCode(e3) || e3), e2.set("langDirection", (e3) => n3.getDirection(e3) || "ltr"), e2.set("isLTR", (e3) => n3.isLTR(e3)), e2.set("isRTL", (e3) => n3.isRTL(e3)), e2.set("i18n", (e3) => t2.translate(e3));
        }
        registerStringFunctions(e2) {
          e2.set("humanize", (e3) => e3 ? (e3 = (e3 = e3.replace(/([a-z])([A-Z])/g, "$1 $2")).replace(/[_-]+/g, " "), /\.(md|html|htm|markdown|mdown|mkd|mkdn|txt)$/i.test(e3) && (e3 = e3.replace(/\.[^/.]+$/, "")), (e3 = e3.charAt(0).toUpperCase() + e3.slice(1).toLowerCase()).trim()) : ""), e2.set("upper", (e3) => e3.toUpperCase()), e2.set("lower", (e3) => e3.toLowerCase()), e2.set("title", (e3) => e3.replace(/\w\S*/g, (e4) => e4.charAt(0).toUpperCase() + e4.substr(1).toLowerCase())), e2.set("trim", (e3) => e3.trim()), e2.set("replace", (...e3) => {
            if (e3.length < 3) throw new Error("replace requires at least 3 arguments: string, old, new");
            const t2 = String(e3[0]), n3 = String(e3[1]), r = String(e3[2]);
            if (e3.length >= 4) {
              const i = Number(e3[3]);
              if (isNaN(i)) throw new Error("replace limit must be a number");
              let s2 = t2, a = 0, o = 0;
              for (; a < i && o < s2.length; ) {
                const e4 = s2.indexOf(n3, o);
                if (-1 === e4) break;
                s2 = s2.substring(0, e4) + r + s2.substring(e4 + n3.length), o = e4 + r.length, a++;
              }
              return s2;
            }
            return t2.split(n3).join(r);
          }), e2.set("replaceRE", (...t2) => {
            if (t2.length < 3) throw new Error("replaceRE requires at least 3 arguments: pattern, replacement, string");
            const n3 = t2[0], r = t2[1], i = t2[2], s2 = t2.length >= 4 ? t2[3] : void 0;
            return e2.get("strings")().ReplaceRE(n3, r, i, s2);
          }), e2.set("split", (e3, t2) => null == e3 ? (log34.warn("split function: first argument is null or undefined"), []) : "string" != typeof e3 ? (log34.warn("split function: first argument must be a string, got:", typeof e3, "value:", e3), Array.isArray(e3) ? e3 : String(e3).split(t2)) : e3.split(t2)), e2.set("splitRegex", (e3, t2) => {
            if (null == e3) return log34.warn("splitRegex function: first argument is null or undefined"), [];
            if ("string" != typeof e3) {
              if (log34.warn("splitRegex function: first argument must be a string, got:", typeof e3, "value:", e3), Array.isArray(e3)) return e3;
              const n3 = String(e3);
              try {
                const e4 = new RegExp(t2);
                return n3.split(e4);
              } catch (e4) {
                return log34.warn("splitRegex function: invalid regex pattern:", t2, "error:", e4), [n3];
              }
            }
            try {
              const n3 = new RegExp(t2);
              return e3.split(n3);
            } catch (n3) {
              return log34.warn("splitRegex function: invalid regex pattern:", t2, "error:", n3), [e3];
            }
          }), e2.set("delimit", (e3, t2) => Array.isArray(e3) ? e3.join(t2) : String(e3)), e2.set("in", (e3, t2) => (Array.isArray(e3) || "string" == typeof e3 && "string" == typeof t2) && e3.includes(t2)), e2.set("hasPrefix", (e3, t2) => e3.startsWith(t2)), e2.set("hasSuffix", (e3, t2) => e3.endsWith(t2)), e2.set("strings", () => ({ ToLower: (e3) => String(e3).toLowerCase(), ToUpper: (e3) => String(e3).toUpperCase(), Title: (e3) => String(e3).replace(/\w\S*/g, (e4) => e4.charAt(0).toUpperCase() + e4.substr(1).toLowerCase()), Trim: (e3, t2) => String(e3).split("").filter((e4) => !t2.includes(e4)).join(""), TrimSpace: (e3) => String(e3).trim(), TrimLeft: (e3, t2) => {
            const n3 = String(t2);
            let r = 0;
            for (; r < n3.length && e3.includes(n3[r]); ) r++;
            return n3.slice(r);
          }, TrimRight: (e3, t2) => {
            const n3 = String(t2);
            let r = n3.length - 1;
            for (; r >= 0 && e3.includes(n3[r]); ) r--;
            return n3.slice(0, r + 1);
          }, TrimPrefix: (e3, t2) => {
            const n3 = String(t2);
            return n3.startsWith(e3) ? n3.slice(e3.length) : n3;
          }, TrimSuffix: (e3, t2) => {
            const n3 = String(t2);
            return n3.endsWith(e3) ? n3.slice(0, -e3.length) : n3;
          }, Contains: (e3, t2) => String(e3).includes(t2), ContainsAny: (e3, t2) => {
            const n3 = String(e3);
            return t2.split("").some((e4) => n3.includes(e4));
          }, HasPrefix: (e3, t2) => String(e3).startsWith(t2), HasSuffix: (e3, t2) => String(e3).endsWith(t2), Replace: (e3, t2, n3, r) => {
            const i = String(e3);
            if (void 0 === r) return i.split(t2).join(n3);
            let s2 = i, a = 0, o = 0;
            for (; a < r && o < s2.length; ) {
              const e4 = s2.indexOf(t2, o);
              if (-1 === e4) break;
              s2 = s2.substring(0, e4) + n3 + s2.substring(e4 + t2.length), o = e4 + n3.length, a++;
            }
            return s2;
          }, ReplaceRE: (e3, t2, n3, r) => {
            const i = String(e3), s2 = String(t2), a = String(n3);
            let o, l = -1;
            if (void 0 !== r) {
              const e4 = parseInt(String(r), 10);
              if (isNaN(e4)) throw new Error("limit argument must be integer");
              l = e4;
            }
            try {
              o = new RegExp(i, "g");
            } catch (e4) {
              throw new Error(`invalid regular expression: ${i}`);
            }
            let c = 0;
            return a.replace(o, (e4) => l >= 0 && c >= l ? e4 : (c++, s2));
          }, Split: (e3, t2) => String(e3).split(t2), SliceString: (e3, t2, n3) => {
            const r = String(e3);
            return void 0 !== n3 ? r.slice(t2, n3) : r.slice(t2);
          }, Substr: (e3, t2, n3) => {
            const r = String(e3);
            return t2 < 0 && (t2 = r.length + t2), t2 < 0 && (t2 = 0), t2 >= r.length ? "" : void 0 === n3 ? r.slice(t2) : n3 <= 0 ? "" : r.slice(t2, t2 + n3);
          }, Count: (e3, t2) => {
            const n3 = String(t2);
            return e3 ? (n3.match(new RegExp(e3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length : n3.length + 1;
          }, CountWords: (e3) => {
            const t2 = String(e3).trim();
            return t2 ? t2.split(/\s+/).length : 0;
          }, CountRunes: (e3) => String(e3).replace(/\s/g, "").length, RuneCount: (e3) => String(e3).length, Repeat: (e3, t2) => {
            if (e3 < 0) throw new Error("strings: negative Repeat count");
            return String(t2).repeat(e3);
          }, FirstUpper: (e3) => {
            const t2 = String(e3);
            return t2.charAt(0).toUpperCase() + t2.slice(1);
          } })), e2.set("substr", (e3, ...t2) => {
            const n3 = String(e3), r = Array.from(n3), i = r.length;
            let s2, a;
            switch (t2.length) {
              case 0:
                throw new Error("too few arguments");
              case 1:
                const e4 = Number(t2[0]);
                if (isNaN(e4) || !Number.isInteger(e4)) throw new Error("start argument must be an integer");
                s2 = e4, a = i;
                break;
              case 2:
                const n4 = Number(t2[0]), r3 = Number(t2[1]);
                if (isNaN(n4) || !Number.isInteger(n4)) throw new Error("start argument must be an integer");
                if (isNaN(r3) || !Number.isInteger(r3)) throw new Error("length argument must be an integer");
                s2 = n4, a = r3;
                break;
              default:
                throw new Error("too many arguments");
            }
            if (0 === i) return "";
            if (s2 < 0 && (s2 += i), s2 < 0 && (s2 = 0), s2 > i - 1) return "";
            let o = i;
            return 0 === a ? "" : (a < 0 ? o += a : a > 0 && (o = s2 + a), s2 >= o || o < 0 ? "" : (o > i && (o = i), r.slice(s2, o).join("")));
          }), e2.set("truncate", (e3, ...t2) => {
            const n3 = Number(e3);
            if (isNaN(n3) || !Number.isInteger(n3)) throw new Error("truncate length must be an integer");
            let r, i = " \u2026";
            switch (t2.length) {
              case 0:
                throw new Error("truncate requires a length and a string");
              case 1:
                r = t2[0], i = " \u2026";
                break;
              case 2:
                i = String(t2[0]), r = t2[1];
                break;
              default:
                throw new Error("too many arguments passed to truncate");
            }
            const s2 = String(r), a = /<[^>]+>/.test(s2);
            return Array.from(s2).length <= n3 ? a ? s2 : this.escapeHTML(s2) : a ? this.truncateHTML(s2, n3, i) : this.truncateText(s2, n3, i);
          });
        }
        escapeHTML(e2) {
          return e2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
        }
        truncateText(e2, t2, n3) {
          const r = Array.from(e2);
          if (r.length <= t2) return this.escapeHTML(e2);
          let i = 0, s2 = 0;
          for (let e3 = 0; e3 < r.length && s2 < t2; e3++) {
            const t3 = r[e3];
            s2++, /\s/.test(t3) && (i = e3), /[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(t3) && (i = e3);
          }
          let a = s2 >= t2 ? i > 0 ? i : t2 : r.length;
          const o = r.slice(0, a).join("");
          return this.escapeHTML(o) + n3;
        }
        truncateHTML(e2, t2, n3) {
          const r = /^<(\/)?([^ ]+?)(?:(\s*\/)| .*?)?>/, i = /* @__PURE__ */ new Set(["br", "col", "link", "base", "img", "param", "area", "hr", "input"]), s2 = [];
          let a = 0, o = 0, l = 0, c = 0, h3 = 0;
          const u = Array.from(e2);
          for (; h3 < u.length; ) {
            const e3 = u[h3];
            if ("<" === e3) {
              const e4 = u.slice(h3).join("").match(r);
              if (e4) {
                const t3 = e4[0], n4 = "/" === e4[1], r3 = e4[2].toLowerCase(), l2 = "/" === e4[3];
                h3 += t3.length, a = o, i.has(r3) || l2 || s2.push({ name: r3, pos: h3 - t3.length, openTag: !n4 });
                continue;
              }
            }
            if (l++, /\s/.test(e3) ? a = o : /[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e3) ? a = h3 : o = h3 + 1, l > t2) {
              c = a > 0 ? a : h3;
              break;
            }
            h3++;
          }
          if (l <= t2) return e2;
          let d = u.slice(0, c).join("") + n3, p2 = null;
          for (let e3 = s2.length - 1; e3 >= 0; e3--) {
            const t3 = s2[e3];
            t3.pos >= c || null !== p2 ? null !== p2 && p2.name === t3.name && (p2 = null) : t3.openTag ? d += `</${t3.name}>` : p2 = t3;
          }
          return d;
        }
        registerMathFunctions(e2) {
          e2.set("add", (e3, t2) => e3 + t2), e2.set("sub", (e3, t2) => e3 - t2), e2.set("mul", (e3, t2) => e3 * t2), e2.set("div", (e3, t2) => 0 !== t2 ? e3 / t2 : 0), e2.set("mod", (e3, t2) => 0 !== t2 ? e3 % t2 : 0), e2.set("math", () => ({ Abs: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("the math.Abs function requires a numeric argument");
            return Math.abs(t2);
          }, Add: (...e3) => {
            if (e3.length < 2) throw new Error("must provide at least two numbers");
            return e3.reduce((e4, t2) => {
              const n3 = Number(t2);
              if (isNaN(n3)) throw new Error("Add operator can't be used with non-numeric values");
              return e4 + n3;
            }, 0);
          }, Ceil: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("Ceil operator can't be used with non-numeric value");
            return Math.ceil(t2);
          }, Div: (...e3) => {
            if (e3.length < 2) throw new Error("must provide at least two numbers");
            return e3.reduce((e4, t2, n3) => {
              const r = Number(t2);
              if (isNaN(r)) throw new Error("Div operator can't be used with non-numeric values");
              if (0 === n3) return r;
              if (0 === r) throw new Error("division by zero");
              return e4 / r;
            });
          }, Floor: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("Floor operator can't be used with non-numeric value");
            return Math.floor(t2);
          }, Log: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("Log operator can't be used with non-numeric value");
            return Math.log(t2);
          }, Max: (...e3) => {
            if (0 === e3.length) throw new Error("must provide at least one number");
            const t2 = e3.flat().map((e4) => {
              const t3 = Number(e4);
              if (isNaN(t3)) throw new Error("Max operator can't be used with non-numeric values");
              return t3;
            });
            return Math.max(...t2);
          }, Min: (...e3) => {
            if (0 === e3.length) throw new Error("must provide at least one number");
            const t2 = e3.flat().map((e4) => {
              const t3 = Number(e4);
              if (isNaN(t3)) throw new Error("Min operator can't be used with non-numeric values");
              return t3;
            });
            return Math.min(...t2);
          }, Mod: (e3, t2) => {
            const n3 = Number(e3), r = Number(t2);
            if (isNaN(n3) || isNaN(r)) throw new Error("modulo operator can't be used with non-numeric value");
            if (0 === r) throw new Error("the number can't be divided by zero at modulo operation");
            return n3 % r;
          }, ModBool: (e3, t2) => {
            const n3 = Number(e3), r = Number(t2);
            if (isNaN(n3) || isNaN(r)) throw new Error("modulo operator can't be used with non-numeric value");
            if (0 === r) throw new Error("the number can't be divided by zero at modulo operation");
            return n3 % r === 0;
          }, Mul: (...e3) => {
            if (e3.length < 2) throw new Error("must provide at least two numbers");
            return e3.reduce((e4, t2) => {
              const n3 = Number(t2);
              if (isNaN(n3)) throw new Error("Mul operator can't be used with non-numeric values");
              return e4 * n3;
            }, 1);
          }, Pow: (e3, t2) => {
            const n3 = Number(e3), r = Number(t2);
            if (isNaN(n3) || isNaN(r)) throw new Error("Pow operator can't be used with non-numeric value");
            return Math.pow(n3, r);
          }, Rand: () => Math.random(), Round: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("Round operator can't be used with non-numeric value");
            return Math.round(t2);
          }, Sqrt: (e3) => {
            const t2 = Number(e3);
            if (isNaN(t2)) throw new Error("Sqrt operator can't be used with non-numeric value");
            return Math.sqrt(t2);
          }, Sub: (...e3) => {
            if (e3.length < 2) throw new Error("must provide at least two numbers");
            return e3.reduce((e4, t2, n3) => {
              const r = Number(t2);
              if (isNaN(r)) throw new Error("Sub operator can't be used with non-numeric values");
              return 0 === n3 ? r : e4 - r;
            });
          }, Sum: (...e3) => {
            if (0 === e3.length) throw new Error("must provide at least one number");
            return e3.flat().map((e4) => {
              const t2 = Number(e4);
              if (isNaN(t2)) throw new Error("Sum operator can't be used with non-numeric values");
              return t2;
            }).reduce((e4, t2) => e4 + t2, 0);
          }, Product: (...e3) => {
            if (0 === e3.length) throw new Error("must provide at least one number");
            return e3.flat().map((e4) => {
              const t2 = Number(e4);
              if (isNaN(t2)) throw new Error("Product operator can't be used with non-numeric values");
              return t2;
            }).reduce((e4, t2) => e4 * t2, 1);
          } }));
        }
        registerTimeFunctions(e2) {
          e2.set("time", () => ({ AsTime: (e3) => {
            if (!e3) return null;
            if (e3 instanceof Date) return e3;
            if ("string" == typeof e3) {
              const t2 = new Date(e3);
              return isNaN(t2.getTime()) ? null : t2;
            }
            if ("number" == typeof e3) {
              const t2 = new Date(e3 < 1e10 ? 1e3 * e3 : e3);
              return isNaN(t2.getTime()) ? null : t2;
            }
            return null;
          }, Format: (e3, t2) => {
            const n3 = t2 instanceof Date ? t2 : new Date(t2);
            if (isNaN(n3.getTime())) return "";
            const r = n3.getFullYear(), i = n3.getMonth() + 1, s2 = n3.getDate(), a = n3.getHours(), o = n3.getMinutes(), l = n3.getSeconds(), c = n3.toLocaleString("en-US", { weekday: "short" }), h3 = n3.toLocaleString("en-US", { month: "short" }), u = [{ pattern: "2006", placeholder: "{{YEAR_FULL}}", value: r.toString() }, { pattern: "January", placeholder: "{{MONTH_FULL}}", value: n3.toLocaleString("en-US", { month: "long" }) }, { pattern: "Monday", placeholder: "{{WEEKDAY_FULL}}", value: n3.toLocaleString("en-US", { weekday: "long" }) }, { pattern: "MST", placeholder: "{{TIMEZONE}}", value: n3.toLocaleString("en-US", { timeZoneName: "short" }) }, { pattern: "Jan", placeholder: "{{MONTH_SHORT}}", value: h3 }, { pattern: "Mon", placeholder: "{{WEEKDAY_SHORT}}", value: c }, { pattern: "06", placeholder: "{{YEAR_SHORT}}", value: r.toString().slice(-2) }, { pattern: "15", placeholder: "{{HOUR_24}}", value: a.toString().padStart(2, "0") }, { pattern: "01", placeholder: "{{MONTH_ZERO}}", value: i.toString().padStart(2, "0") }, { pattern: "02", placeholder: "{{DAY_ZERO}}", value: s2.toString().padStart(2, "0") }, { pattern: "04", placeholder: "{{MINUTE_ZERO}}", value: o.toString().padStart(2, "0") }, { pattern: "05", placeholder: "{{SECOND_ZERO}}", value: l.toString().padStart(2, "0") }, { pattern: "PM", placeholder: "{{AMPM_UPPER}}", value: a >= 12 ? "PM" : "AM" }, { pattern: "pm", placeholder: "{{AMPM_LOWER}}", value: a >= 12 ? "pm" : "am" }, { pattern: "3", placeholder: "{{HOUR_12}}", value: ((a + 11) % 12 + 1).toString() }, { pattern: "1", placeholder: "{{MONTH_NUM}}", value: i.toString() }, { pattern: "2", placeholder: "{{DAY_NUM}}", value: s2.toString() }, { pattern: "4", placeholder: "{{MINUTE_NUM}}", value: o.toString() }, { pattern: "5", placeholder: "{{SECOND_NUM}}", value: l.toString() }];
            let d = e3;
            for (const { pattern: e4, placeholder: t3 } of u) {
              const n4 = e4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
              d = d.replace(new RegExp(n4, "g"), t3);
            }
            for (const { placeholder: e4, value: t3 } of u) d = d.replace(new RegExp(e4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), t3);
            return d;
          }, Now: () => /* @__PURE__ */ new Date(), Parse: (e3, t2) => {
            try {
              const e4 = new Date(t2);
              return isNaN(e4.getTime()) ? null : e4;
            } catch (e4) {
              return null;
            }
          }, Unix: (e3) => {
            const t2 = e3 instanceof Date ? e3 : new Date(e3);
            return Math.floor(t2.getTime() / 1e3);
          }, UnixNano: (e3) => 1e6 * (e3 instanceof Date ? e3 : new Date(e3)).getTime() })), e2.set("now", () => {
            const e3 = /* @__PURE__ */ new Date();
            return { Format: (t2) => {
              const n3 = e3.getFullYear(), r = e3.getMonth() + 1, i = e3.getDate(), s2 = e3.getHours(), a = e3.getMinutes(), o = e3.getSeconds(), l = [{ pattern: "2006", value: n3.toString() }, { pattern: "06", value: n3.toString().slice(-2) }, { pattern: "01", value: r.toString().padStart(2, "0") }, { pattern: "1", value: r.toString() }, { pattern: "02", value: i.toString().padStart(2, "0") }, { pattern: "2", value: i.toString() }, { pattern: "15", value: s2.toString().padStart(2, "0") }, { pattern: "3", value: (s2 % 12 || 12).toString() }, { pattern: "04", value: a.toString().padStart(2, "0") }, { pattern: "4", value: a.toString() }, { pattern: "05", value: o.toString().padStart(2, "0") }, { pattern: "5", value: o.toString() }];
              let c = t2;
              for (const { pattern: e4, value: t3 } of l) {
                const n4 = new RegExp(`\\b${e4}\\b`, "g");
                c = c.replace(n4, t3);
              }
              return "2006" === t2 ? n3.toString() : "06" === t2 ? n3.toString().slice(-2) : "01" === t2 ? r.toString().padStart(2, "0") : "02" === t2 ? i.toString().padStart(2, "0") : "15" === t2 ? s2.toString().padStart(2, "0") : "04" === t2 ? a.toString().padStart(2, "0") : "05" === t2 ? o.toString().padStart(2, "0") : c;
            }, getTime: () => e3.getTime(), toString: () => e3.toString(), toISOString: () => e3.toISOString() };
          }), e2.set("dateFormat", (e3, t2) => t2.toLocaleDateString());
        }
        registerCollectionFunctions(e2) {
          e2.set("len", (e3) => Array.isArray(e3) || "string" == typeof e3 ? e3.length : e3 && "object" == typeof e3 ? Object.keys(e3).length : 0), e2.set("first", (e3, t2) => Array.isArray(e3) ? e3.slice(0, 1) : Array.isArray(t2) ? t2.slice(0, e3) : []), e2.set("last", (e3, t2) => Array.isArray(e3) ? e3.slice(-1) : Array.isArray(t2) ? t2.slice(-e3) : []), e2.set("merge", (...e3) => {
            const t2 = {};
            for (const n3 of e3) n3 && "object" == typeof n3 && !Array.isArray(n3) && Object.assign(t2, n3);
            return t2;
          }), e2.set("index", (e3, ...t2) => {
            try {
              return this.doIndex(e3, t2);
            } catch (n3) {
              return log34.error(`Index of type ${typeof e3} with args [${t2.join(", ")}] failed:`, n3), null;
            }
          }), e2.set("reverse", (e3) => Array.isArray(e3) ? [...e3].reverse() : e3), e2.set("append", (...e3) => {
            if (e3.length < 2) return e3[0] || [];
            const t2 = Array.isArray(e3[0]) ? [...e3[0]] : [e3[0]];
            for (let n3 = 1; n3 < e3.length; n3++) Array.isArray(e3[n3]) ? t2.push(...e3[n3]) : t2.push(e3[n3]);
            return t2;
          }), e2.set("prepend", (e3, ...t2) => Array.isArray(e3) ? [...t2, ...e3] : [...t2, e3]), e2.set("seq", (...e3) => {
            if (e3.length < 1 || e3.length > 3) throw new Error("invalid number of arguments to Seq");
            const t2 = e3.map((e4) => {
              const t3 = Number(e4);
              if (isNaN(t3)) throw new Error("invalid arguments to Seq");
              return Math.floor(t3);
            });
            let n3, r = 1, i = t2[0];
            if (1 === t2.length) {
              if (n3 = i, 0 === n3) return [];
              n3 > 0 ? i = 1 : (i = -1, r = -1);
            } else if (2 === t2.length) n3 = t2[1], n3 < i && (r = -1);
            else {
              if (r = t2[1], n3 = t2[2], 0 === r) throw new Error("'increment' must not be 0");
              if (i < n3 && r < 0) throw new Error("'increment' must be > 0");
              if (i > n3 && r > 0) throw new Error("'increment' must be < 0");
            }
            if (n3 < -1e5) throw new Error("size of result exceeds limit");
            const s2 = Math.floor((n3 - i) / r) + 1;
            if (s2 <= 0 || s2 > 2e3) throw new Error("size of result exceeds limit");
            const a = new Array(s2);
            let o = i;
            for (let e4 = 0; e4 < s2 && (a[e4] = o, o += r, !(r < 0 && o < n3 || r > 0 && o > n3)); e4++) ;
            return a;
          }), e2.set("sort", (e3, ...t2) => {
            if (null == e3) throw new Error("sequence must be provided");
            let n3;
            if (Array.isArray(e3)) n3 = [...e3];
            else {
              if ("object" != typeof e3 || null === e3) throw new Error("can't sort " + typeof e3);
              n3 = Object.values(e3);
            }
            if (0 === n3.length) return n3;
            let r = "", i = true;
            for (let e4 = 0; e4 < t2.length; e4++) {
              const n4 = t2[e4];
              0 === e4 ? "string" == typeof n4 && (r = n4) : 1 === e4 && "string" == typeof n4 && "desc" === n4.toLowerCase() && (i = false);
            }
            const s2 = (e4, t3) => {
              if (!t3 || "value" === t3) return e4;
              const n4 = t3.split(".");
              let r3 = e4;
              for (const e5 of n4) {
                if (null == r3) return;
                if ("object" != typeof r3) return;
                r3 = r3[e5];
              }
              return r3;
            };
            return n3.sort((e4, t3) => {
              let n4 = r ? s2(e4, r) : e4, a = r ? s2(t3, r) : t3;
              if (null == n4) return null == a ? 0 : i ? -1 : 1;
              if (null == a) return i ? 1 : -1;
              if ("string" == typeof n4 && "string" == typeof a) {
                const e5 = n4.localeCompare(a);
                return i ? e5 : -e5;
              }
              if ("number" == typeof n4 && "number" == typeof a) {
                const e5 = n4 - a;
                return i ? e5 : -e5;
              }
              const o = String(n4), l = String(a), c = o.localeCompare(l);
              return i ? c : -c;
            });
          }), e2.set("where", /* @__PURE__ */ (() => (e3, t2, ...n3) => {
            if (!e3) return [];
            let r, i = "==";
            if (1 === n3.length) r = n3[0];
            else {
              if (2 !== n3.length) throw new Error("where function requires 2-4 arguments");
              i = n3[0], r = n3[1];
            }
            const s2 = [];
            if (Array.isArray(e3)) for (let n4 = 0; n4 < e3.length; n4++) {
              const a = e3[n4], o = this.getNestedValue(a, t2);
              this.checkCondition(o, r, i) && s2.push(a);
            }
            else if ("object" == typeof e3) {
              for (const [n4, a] of Object.entries(e3)) if (Array.isArray(a)) {
                const e4 = a.filter((e5) => {
                  const n5 = this.getNestedValue(e5, t2);
                  return this.checkCondition(n5, r, i);
                });
                e4.length > 0 && s2.push({ [n4]: e4 });
              }
            }
            return s2;
          })()), e2.set("intersect", (e3, t2) => Array.isArray(e3) && Array.isArray(t2) ? e3.filter((e4) => t2.includes(e4)) : []), e2.set("querify", (...e3) => {
            let t2 = [];
            if (t2 = 1 === e3.length && Array.isArray(e3[0]) ? e3[0] : e3, t2.length % 2 != 0) throw new Error("querify requires an even number of arguments (key-value pairs)");
            const n3 = [];
            for (let e4 = 0; e4 < t2.length; e4 += 2) {
              const r = String(t2[e4]), i = String(t2[e4 + 1]);
              n3.push([r, i]);
            }
            return n3.sort((e4, t3) => e4[0].localeCompare(t3[0])), n3.map(([e4, t3]) => `${encodeURIComponent(e4).replace(/%20/g, "+")}=${encodeURIComponent(t3).replace(/%20/g, "+")}`).join("&");
          }), e2.set("isset", (e3, t2) => {
            var _a6;
            if (null == e3) return false;
            if (Array.isArray(e3)) {
              const n3 = Number(t2);
              return isNaN(n3) || !Number.isInteger(n3) ? (console.warn(`isset unable to use key of type ${typeof t2} as index`), false) : e3.length > n3 && n3 >= 0;
            }
            if ("object" == typeof e3) return t2 in e3;
            if ("string" == typeof e3) {
              const n3 = Number(t2);
              return isNaN(n3) || !Number.isInteger(n3) ? (console.warn(`isset unable to use key of type ${typeof t2} as index`), false) : e3.length > n3 && n3 >= 0;
            }
            return console.warn(`calling isset with unsupported type "${typeof e3}" (${((_a6 = e3.constructor) == null ? void 0 : _a6.name) || typeof e3}) will always return false.`), false;
          });
        }
        doIndex(e2, t2) {
          if (null == e2) return null;
          if (0 === t2.length) return e2;
          let n3 = e2;
          for (const e3 of t2) {
            if (null == n3) return null;
            if (Array.isArray(n3)) n3 = this.indexArray(n3, e3);
            else if ("string" == typeof n3) n3 = this.indexString(n3, e3);
            else {
              if ("object" != typeof n3) throw new Error("can't index item of type " + typeof n3);
              n3 = this.indexObject(n3, e3);
            }
          }
          return n3;
        }
        indexArray(e2, t2) {
          const n3 = this.toInteger(t2);
          if (null === n3) throw new Error("cannot index slice/array with type " + typeof t2);
          return n3 < 0 || n3 >= e2.length ? null : e2[n3];
        }
        indexString(e2, t2) {
          const n3 = this.toInteger(t2);
          if (null === n3) throw new Error("cannot index string with type " + typeof t2);
          return n3 < 0 || n3 >= e2.length ? null : e2.charAt(n3);
        }
        indexObject(e2, t2) {
          const n3 = String(t2);
          if (e2.hasOwnProperty(n3)) return e2[n3];
          const r = Object.keys(e2).find((e3) => e3.toLowerCase() === n3.toLowerCase());
          if (r) return e2[r];
          if (e2 instanceof Map) {
            if (e2.has(n3)) return e2.get(n3);
            for (const t3 of e2.keys()) if (String(t3).toLowerCase() === n3.toLowerCase()) return e2.get(t3);
          }
          return null;
        }
        toInteger(e2) {
          if ("number" == typeof e2) return Number.isInteger(e2) ? e2 : Math.floor(e2);
          if ("string" == typeof e2) {
            const t2 = parseInt(e2, 10);
            if (!isNaN(t2)) return t2;
          }
          return null;
        }
        checkCondition(e2, t2, n3) {
          const r = n3.toLowerCase().trim();
          if (null == e2 && null == t2) return ["==", "=", "eq", ""].includes(r);
          if (null == e2 || null == t2) return ["!=", "<>", "ne"].includes(r);
          if ("in" === r) return (Array.isArray(t2) || "string" == typeof t2 && "string" == typeof e2) && t2.includes(e2);
          if ("intersect" === r) return !(!Array.isArray(e2) || !Array.isArray(t2)) && e2.some((e3) => t2.includes(e3));
          const [i, s2] = this.normalizeForComparison(e2, t2);
          switch (r) {
            case "":
            case "=":
            case "==":
            case "eq":
              return i === s2;
            case "!=":
            case "<>":
            case "ne":
              return i !== s2;
            case "<":
            case "lt":
              return i < s2;
            case "<=":
            case "le":
              return i <= s2;
            case ">":
            case "gt":
              return i > s2;
            case ">=":
            case "ge":
              return i >= s2;
            default:
              return false;
          }
        }
        normalizeForComparison(e2, t2) {
          if ("number" == typeof e2 && "number" == typeof t2) return [e2, t2];
          if ("number" == typeof e2 && "string" == typeof t2) {
            const n3 = parseFloat(t2);
            if (!isNaN(n3)) return [e2, n3];
          }
          if ("string" == typeof e2 && "number" == typeof t2) {
            const n3 = parseFloat(e2);
            if (!isNaN(n3)) return [n3, t2];
          }
          return "string" == typeof e2 && "string" == typeof t2 || "boolean" == typeof e2 && "boolean" == typeof t2 ? [e2, t2] : [String(e2), String(t2)];
        }
        registerSafeFunctions(e2) {
          e2.set("return", (...e3) => 0 === e3.length ? "" : 1 === e3.length ? e3[0] : e3), e2.set("cond", (...e3) => {
            if (e3.length < 2) throw new Error("cond requires at least 2 arguments");
            const t2 = e3[0], n3 = e3[1], r = e3.length > 2 ? e3[2] : "";
            let i = false;
            return true === t2 || 1 === t2 ? i = true : "string" == typeof t2 ? i = t2.length > 0 && "false" !== t2 && "0" !== t2 : "number" == typeof t2 ? i = 0 !== t2 : Array.isArray(t2) ? i = t2.length > 0 : t2 && "object" == typeof t2 && (i = Object.keys(t2).length > 0), i ? n3 : r;
          }), e2.set("safeHTML", (e3) => e3), e2.set("safeCSS", (e3) => e3), e2.set("safeJS", (e3) => e3), e2.set("safeURL", (e3) => e3), e2.set("dict", (...e3) => {
            if (e3.length % 2 != 0) throw new Error("dict requires an even number of arguments");
            const t2 = {};
            for (let n3 = 0; n3 < e3.length; n3 += 2) t2[String(e3[n3])] = e3[n3 + 1];
            return t2;
          }), e2.set("slice", (...e3) => e3), e2.set("default", (e3, t2) => null != t2 && "" !== t2 && 0 !== t2 ? t2 : e3), e2.set("jsonify", (...e3) => {
            if (0 === e3.length) return "";
            let t2, n3 = {};
            if (1 === e3.length) t2 = e3[0];
            else {
              if (2 !== e3.length) throw new Error("too many arguments to jsonify");
              {
                const r = e3[0];
                t2 = e3[1], r && "object" == typeof r && (n3.prefix = r.prefix || "", n3.indent = r.indent || "", n3.noHTMLEscape = r.noHTMLEscape || false);
              }
            }
            try {
              let e4;
              return n3.indent ? (e4 = JSON.stringify(t2, null, n3.indent), n3.prefix && (e4 = e4.split("\n").map((e5) => n3.prefix + e5).join("\n"))) : e4 = JSON.stringify(t2), n3.noHTMLEscape || (e4 = e4.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e")), e4;
            } catch (e4) {
              throw new Error(`failed to jsonify object: ${e4.message}`);
            }
          });
        }
        registerFmtFunctions(e2) {
          e2.set("printf", (e3, ...t2) => {
            let n3 = e3, r = 0;
            return n3 = n3.replace(/%[vsdft%]/g, (e4) => {
              if ("%%" === e4) return "%";
              if (r >= t2.length) return e4;
              const n4 = t2[r++];
              switch (e4) {
                case "%v":
                case "%s":
                default:
                  return String(n4);
                case "%d":
                  return String(Math.floor(Number(n4) || 0));
                case "%f":
                  return String(Number(n4) || 0);
                case "%t":
                  return String(Boolean(n4));
              }
            }), n3;
          }), e2.set("print", (...e3) => e3.map((e4) => String(e4)).join(" ")), e2.set("println", (...e3) => e3.map((e4) => String(e4)).join(" ") + "\n"), e2.set("errorf", (e3, ...t2) => {
            let n3 = e3;
            for (let e4 = 0; e4 < t2.length; e4++) n3 = n3.replace(/%[sd%]/, String(t2[e4]));
            return log34.error("Template Error:", n3), "";
          }), e2.set("warnf", (e3, ...t2) => {
            let n3 = e3;
            for (let e4 = 0; e4 < t2.length; e4++) n3 = n3.replace(/%[sd%]/, String(t2[e4]));
            return log34.warn("Template Warning:", n3), "";
          }), e2.set("fmt", () => ({ Print: (...e3) => e3.map((e4) => String(e4)).join(" "), Printf: (e3, ...t2) => {
            let n3 = e3;
            for (let e4 = 0; e4 < t2.length; e4++) n3 = n3.replace(/%[sd%]/, String(t2[e4]));
            return n3;
          }, Println: (...e3) => e3.map((e4) => String(e4)).join(" ") + "\n", Errorf: (e3, ...t2) => {
            let n3 = e3;
            for (let e4 = 0; e4 < t2.length; e4++) n3 = n3.replace(/%[sd%]/, String(t2[e4]));
            return log34.error("Template Error:", n3), "";
          }, Erroridf: (e3, t2, ...n3) => {
            let r = t2;
            for (let e4 = 0; e4 < n3.length; e4++) r = r.replace(/%[sd%]/, String(n3[e4]));
            return log34.error("Template Error:", r), "";
          }, Warnf: (e3, ...t2) => {
            let n3 = e3;
            for (let e4 = 0; e4 < t2.length; e4++) n3 = n3.replace(/%[sd%]/, String(t2[e4]));
            return log34.error("Template Warning:", n3), "";
          }, Warnidf: (e3, t2, ...n3) => {
            let r = t2;
            for (let e4 = 0; e4 < n3.length; e4++) r = r.replace(/%[sd%]/, String(n3[e4]));
            return log34.error("Template Warning:", r), "";
          } }));
        }
        registerReflectFunctions(e2) {
          e2.set("reflect", () => ({ IsMap: (e3) => {
            if (null == e3) return false;
            if ("object" != typeof e3 || Array.isArray(e3)) return false;
            if (e3 instanceof Map) return true;
            if (e3.constructor === Object) return true;
            const t2 = Object.getPrototypeOf(e3);
            return t2 === Object.prototype || null === t2;
          }, IsSlice: (e3) => Array.isArray(e3) }));
        }
        registerPathFunctions(e2) {
          e2.set("path", () => ({ Base: (e3) => {
            if (!e3) return ".";
            if (!(e3 = (e3 = e3.replace(/\\/g, "/")).replace(/\/+$/, ""))) return "/";
            const t2 = e3.split("/");
            return t2[t2.length - 1] || "/";
          }, Clean: (e3) => {
            if (!e3) return ".";
            const t2 = (e3 = e3.replace(/\\/g, "/")).startsWith("/"), n3 = e3.split("/").filter((e4) => e4 && "." !== e4), r = [];
            for (const e4 of n3) ".." === e4 ? r.length > 0 && ".." !== r[r.length - 1] ? r.pop() : t2 || r.push("..") : r.push(e4);
            return e3 = r.join("/"), t2 && (e3 = "/" + e3), e3 || (t2 ? "/" : ".");
          }, Dir: (e3) => {
            if (!e3) return ".";
            if (!(e3 = e3.replace(/\/+$/, ""))) return "/";
            const t2 = e3.split("/");
            return t2.pop(), t2.join("/") || ".";
          }, Ext: (e3) => {
            const t2 = e3.split("/").pop() || "", n3 = t2.lastIndexOf(".");
            return -1 === n3 || 0 === n3 ? "" : t2.substring(n3);
          }, IsAbs: (e3) => e3.startsWith("/"), Join: (...e3) => {
            if (0 === e3.length) return ".";
            let t2 = e3.filter((e4) => e4).map((e4) => e4.replace(/^\/+|\/+$/g, "")).join("/");
            return e3[0] && e3[0].startsWith("/") && (t2 = "/" + t2), t2 || ".";
          }, Split: (e3) => {
            if (!e3) return [".", ""];
            const t2 = e3.lastIndexOf("/");
            return -1 === t2 ? ["", e3] : [e3.substring(0, t2), e3.substring(t2 + 1)];
          } }));
        }
        registerTransformFunctions(e2) {
          e2.set("transform", () => ({ Unmarshal: (...e3) => {
            if (e3.length < 1 || e3.length > 2) throw new Error("unmarshal takes 1 or 2 arguments");
            let t2, n3, r = {};
            if (1 === e3.length) t2 = e3[0];
            else {
              const n4 = e3[0];
              if (!n4 || "object" != typeof n4) throw new Error("first argument must be a map");
              r = n4, t2 = e3[1];
            }
            if (t2 && "object" == typeof t2 && "function" == typeof t2.Content) try {
              const e4 = t2.Content();
              return this.unmarshalContent(e4, r);
            } catch (e4) {
              throw new Error(`failed to get content from resource: ${e4.message}`);
            }
            if ("string" == typeof t2) n3 = t2;
            else {
              if (!t2 || "function" != typeof t2.toString) throw new Error(`type ${typeof t2} not supported`);
              n3 = t2.toString();
            }
            return n3 && "" !== n3.trim() ? this.unmarshalContent(n3, r) : null;
          }, Plainify: (e3) => {
            const t2 = String(e3);
            return this.stripHTML(t2);
          } })), e2.set("unmarshal", (...t2) => e2.get("transform")().Unmarshal(...t2)), e2.set("plainify", (e3) => {
            const t2 = String(e3);
            return this.stripHTML(t2);
          });
        }
        stripHTML(e2) {
          if (!e2.includes("<") && !e2.includes(">")) return e2;
          let t2 = e2.replace(/\n/g, " ").replace(/<\/p>/gi, "\n").replace(/<br\s*\/?>/gi, "\n").replace(/<\/div>/gi, "\n").replace(/<\/h[1-6]>/gi, "\n").replace(/<\/li>/gi, "\n").replace(/<\/tr>/gi, "\n").replace(/<\/blockquote>/gi, "\n");
          t2 = t2.replace(/<[^>]*>/g, "");
          const n3 = t2.split("\n");
          return t2 = n3.map((e3) => e3.trim().replace(/\s+/g, " ")).filter((e3) => e3.length > 0).join("\n").trim(), t2 = t2.replace(/\n\s*\n/g, "\n"), t2;
        }
        unmarshalContent(e2, t2 = {}) {
          const n3 = e2.trim();
          if (!n3) return null;
          let r = t2.format;
          r || (r = this.detectFormat(n3));
          try {
            switch (r.toLowerCase()) {
              case "json":
                return JSON.parse(n3);
              case "yaml":
              case "yml":
                return this.parseYAML(n3);
              case "toml":
                return this.parseTOML(n3);
              case "csv":
                return this.parseCSV(n3);
              default:
                throw new Error(`format "${r}" not supported`);
            }
          } catch (e3) {
            throw new Error(`failed to unmarshal ${r}: ${e3.message}`);
          }
        }
        detectFormat(e2) {
          const t2 = e2.trim();
          if (t2.startsWith("{") && t2.endsWith("}") || t2.startsWith("[") && t2.endsWith("]")) try {
            return JSON.parse(t2), "json";
          } catch (e3) {
          }
          return t2.startsWith("---") || /^[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*.+/m.test(t2) ? "yaml" : /^\[.*\]$/m.test(t2) || /^[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*.+/m.test(t2) ? "toml" : /^[^,\n]*,[^,\n]*/.test(t2) ? "csv" : "json";
        }
        parseYAML(e2) {
          const t2 = e2.split("\n"), n3 = {};
          for (const e3 of t2) {
            const t3 = e3.trim();
            if (!t3 || t3.startsWith("#") || "---" === t3) continue;
            const r = t3.indexOf(":");
            if (r > 0) {
              const e4 = t3.substring(0, r).trim();
              let i = t3.substring(r + 1).trim();
              (i.startsWith('"') && i.endsWith('"') || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), "true" === i ? n3[e4] = true : "false" === i ? n3[e4] = false : /^\d+$/.test(i) ? n3[e4] = parseInt(i, 10) : /^\d*\.\d+$/.test(i) ? n3[e4] = parseFloat(i) : n3[e4] = i;
            }
          }
          return n3;
        }
        parseTOML(e2) {
          const t2 = e2.split("\n"), n3 = {};
          let r = "";
          for (const e3 of t2) {
            const t3 = e3.trim();
            if (!t3 || t3.startsWith("#")) continue;
            if (t3.startsWith("[") && t3.endsWith("]")) {
              r = t3.slice(1, -1), n3[r] || (n3[r] = {});
              continue;
            }
            const i = t3.indexOf("=");
            if (i > 0) {
              const e4 = t3.substring(0, i).trim();
              let s2, a = t3.substring(i + 1).trim();
              (a.startsWith('"') && a.endsWith('"') || a.startsWith("'") && a.endsWith("'")) && (a = a.slice(1, -1)), s2 = "true" === a || "false" !== a && (/^\d+$/.test(a) ? parseInt(a, 10) : /^\d*\.\d+$/.test(a) ? parseFloat(a) : a), r ? n3[r][e4] = s2 : n3[e4] = s2;
            }
          }
          return n3;
        }
        parseCSV(e2) {
          const t2 = e2.trim().split("\n");
          if (0 === t2.length) return [];
          const n3 = this.parseCSVLine(t2[0]), r = [];
          for (let e3 = 1; e3 < t2.length; e3++) {
            const i = this.parseCSVLine(t2[e3]), s2 = {};
            for (let e4 = 0; e4 < n3.length; e4++) {
              const t3 = n3[e4], r3 = e4 < i.length ? i[e4] : "";
              /^\d+$/.test(r3) ? s2[t3] = parseInt(r3, 10) : /^\d*\.\d+$/.test(r3) ? s2[t3] = parseFloat(r3) : s2[t3] = "true" === r3 || "false" !== r3 && r3;
            }
            r.push(s2);
          }
          return r;
        }
        parseCSVLine(e2) {
          const t2 = [];
          let n3 = "", r = false;
          for (let i = 0; i < e2.length; i++) {
            const s2 = e2[i];
            '"' === s2 ? r && '"' === e2[i + 1] ? (n3 += '"', i++) : r = !r : "," !== s2 || r ? n3 += s2 : (t2.push(n3.trim()), n3 = "");
          }
          return t2.push(n3.trim()), t2;
        }
        getNestedValue(e2, t2) {
          if (!e2 || !t2) return;
          const n3 = t2.replace(/^\\.+/, "").split(".");
          let r = e2;
          for (let e3 = 0; e3 < n3.length; e3++) {
            const t3 = n3[e3];
            if (null == r) return;
            if ("object" == typeof r) {
              if (r.hasOwnProperty(t3)) {
                r = r[t3];
                continue;
              }
              const e4 = Object.keys(r).find((e5) => e5.toLowerCase() === t3.toLowerCase());
              if (e4) {
                r = r[e4];
                continue;
              }
              const n4 = t3.toLowerCase();
              if ("function" == typeof r[n4]) try {
                r = r[n4]();
                continue;
              } catch (e5) {
                return;
              }
              return;
            }
            return;
          }
          return r;
        }
      };
    } });
    var log35;
    var PageBuilder;
    var path20;
    var filepath;
    var Taxonomy2;
    var log36;
    var Term;
    var init_template22 = __esm2({ "internal/domain/template/factory/template.ts"() {
      init_type8(), init_template2(), init_executor(), init_parser(), init_lookup(), init_namespace(), init_baseof(), init_registry(), Factory2 = class {
        async create(e2) {
          return this.createWithConfig(e2, {});
        }
        async createWithConfig(e2, t2) {
          try {
            const n3 = new Builder().withFs(e2).withNamespaces(new RegularTemplateNamespace(), new PartialTemplateNamespace(), new ShortcodeTemplateNamespace());
            t2.services ? n3.withServices(t2.services) : t2.funcMap ? n3.withFuncMap(t2.funcMap) : n3.withFuncMap(function() {
              const e3 = /* @__PURE__ */ new Map();
              return newTemplateRegistry().registerCoreFunctions(e3), e3;
            }());
            const r = await n3.buildLookup().buildParser().buildExecutor().build();
            return await r.markReady(), r;
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Failed to create template engine: ${t3}`, "FACTORY_CREATE_FAILED");
          }
        }
        async createWithServices(e2, t2) {
          return this.createWithConfig(e2, { services: t2 });
        }
      }, Builder = class {
        constructor() {
          __publicField(this, "funcMap", /* @__PURE__ */ new Map());
          __publicField(this, "services");
          __publicField(this, "fs");
          __publicField(this, "templateNamespace");
          __publicField(this, "partialNamespace");
          __publicField(this, "shortcodeNamespace");
          __publicField(this, "lookup");
          __publicField(this, "parser");
          __publicField(this, "executor");
        }
        withFs(e2) {
          return this.fs = e2, this;
        }
        withNamespaces(e2, t2, n3) {
          return this.templateNamespace = e2, this.partialNamespace = t2, this.shortcodeNamespace = n3, this;
        }
        withFuncMap(e2) {
          return this.funcMap = new Map([...this.funcMap, ...e2]), this;
        }
        withServices(e2) {
          return this.services = e2, this.funcMap = function(e3) {
            const t2 = /* @__PURE__ */ new Map();
            return newTemplateRegistry().registerAllFunctions(t2, e3), t2;
          }(e2), this;
        }
        buildLookup() {
          const e2 = new BaseOf();
          return this.lookup = function(e3, t2) {
            return new Lookup(e3, t2);
          }(e2, this.funcMap), this;
        }
        buildParser() {
          return this.parser = function(e2 = /* @__PURE__ */ new Map()) {
            return new Parser(e2);
          }(this.funcMap), this;
        }
        buildExecutor() {
          return this.executor = new Executor(), this;
        }
        async build() {
          if (!this.fs) throw new TemplateError("File system is required", "BUILDER_FS_REQUIRED");
          if (!this.templateNamespace) throw new TemplateError("Template namespace is required", "BUILDER_TEMPLATE_NAMESPACE_REQUIRED");
          if (!this.partialNamespace) throw new TemplateError("Partial namespace is required", "BUILDER_PARTIAL_NAMESPACE_REQUIRED");
          if (!this.shortcodeNamespace) throw new TemplateError("Shortcode namespace is required", "BUILDER_SHORTCODE_NAMESPACE_REQUIRED");
          if (!this.lookup) throw new TemplateError("Lookup is required", "BUILDER_LOOKUP_REQUIRED");
          if (!this.parser) throw new TemplateError("Parser is required", "BUILDER_PARSER_REQUIRED");
          if (!this.executor) throw new TemplateError("Executor is required", "BUILDER_EXECUTOR_REQUIRED");
          const e2 = (t2 = this.executor, n3 = this.lookup, r = this.parser, i = this.templateNamespace, s2 = this.partialNamespace, a = this.shortcodeNamespace, o = this.fs, new TemplateEngine(t2, n3, r, i, s2, a, o));
          var t2, n3, r, i, s2, a, o;
          !function(e3) {
            for (const t3 of engineDependentFunctions) try {
              t3.updateEngine(e3);
            } catch (e4) {
              log34.error(`\u274C Failed to update function ${t3.getFunctionName()}:`, e4);
            }
          }(e2);
          try {
            await e2.loadTemplates();
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw new TemplateError(`Failed to load templates: ${t3}`, "BUILDER_LOAD_TEMPLATES_FAILED");
          }
          return e2;
        }
      };
    } });
    var init_template3 = __esm2({ "internal/domain/template/index.ts"() {
      init_type8(), init_type8(), init_baseof(), init_info(), init_namespace(), init_executor(), init_parser(), init_lookup(), init_template2(), init_template22();
    } });
    var init_pagebuilder = __esm2({ "internal/domain/content/entity/pagebuilder.ts"() {
      init_pagecontent(), init_frontmatter(), init_kind(), init_section(), init_standalone(), init_log(), init_page(), init_pagemeta(), init_pagelayout(), init_paginator(), init_shortcode2(), init_template3(), log35 = getDomainLogger("content", { component: "pagebuilder" }), PageBuilder = class {
        constructor(e2, t2, n3, r, i, s2, a, o, l, c, h3) {
          __publicField(this, "urlSvc");
          __publicField(this, "langSvc");
          __publicField(this, "taxonomySvc");
          __publicField(this, "templateSvc");
          __publicField(this, "pageMapper");
          __publicField(this, "taxonomy");
          __publicField(this, "term");
          __publicField(this, "section");
          __publicField(this, "standalone");
          __publicField(this, "converter");
          __publicField(this, "contentHub");
          __publicField(this, "source");
          __publicField(this, "sourceByte");
          __publicField(this, "kind");
          __publicField(this, "singular");
          __publicField(this, "term_");
          __publicField(this, "langIdx");
          __publicField(this, "fm");
          __publicField(this, "fmParser");
          __publicField(this, "c");
          __publicField(this, "renderableDocument", null);
          this.urlSvc = e2, this.langSvc = t2, this.taxonomySvc = n3, this.templateSvc = r, this.pageMapper = null, this.taxonomy = s2, this.term = a, this.section = o, this.standalone = l, this.converter = c, this.contentHub = h3, this.source = null, this.sourceByte = new Uint8Array(), this.kind = "", this.singular = "", this.term_ = "", this.langIdx = -1, this.fm = null, this.fmParser = null, this.c = null;
        }
        withSource(e2) {
          const t2 = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
          return t2.reset(), t2.source = e2, t2;
        }
        withLangIdx(e2) {
          return this.langIdx = e2, this;
        }
        reset() {
          this.c = null, this.kind = "", this.langIdx = -1;
        }
        async build() {
          if (!this.source) throw new Error("source for page builder is nil");
          const e2 = await this.source.contentSource();
          this.sourceByte = e2, await this.parse(e2);
          const t2 = await this.buildInternal();
          return await this.render(t2), t2;
        }
        async kindBuild() {
          if (!this.source) throw new Error("source for page builder is nil");
          return await this.parseKind(), -1 === this.langIdx ? await this.parseLanguageByDefault() : await this.parseLanguageByIdx(this.langIdx), this.fm = { path: "", lang: "", kind: "", title: "", description: "", weight: 999, terms: {}, params: {} }, this.c = newContent(new Uint8Array()), await this.buildInternal();
        }
        async buildInternal() {
          switch (this.kind) {
            case getKindMain("home"):
              return await this.buildHome();
            case getKindMain("section"):
              return await this.buildSection();
            case getKindMain("page"):
              return await this.buildPage();
            case getKindMain("taxonomy"):
              return await this.buildTaxonomy();
            case getKindMain("term"):
              return await this.buildTerm();
            case getKindMain("404"):
              return await this.build404();
            case getKindMain("sitemap"):
              return await this.buildSitemap();
            default:
              throw new Error(`unknown kind "${this.kind}"`);
          }
        }
        async buildPage() {
          const e2 = await this.newPage(this.source, this.c);
          return await this.applyFrontMatter(e2), e2.pageMap = this.pageMapper, await this.buildOutput(e2), await this.adaptPagination(e2), e2;
        }
        async buildPageWithKind(e2) {
          const t2 = await this.newPage(this.source, this.c);
          if (await this.applyFrontMatter(t2), t2.pageMap = this.pageMapper, t2.kind_ = e2, e2 === getKindMain("sitemap") || e2 === getKindMain("404")) {
            const e3 = t2.meta;
            e3 && (e3.list = "never");
          }
          return await this.buildOutput(t2), t2;
        }
        async applyFrontMatter(e2) {
          if (this.fm) {
            e2.title_ = this.fm.title, e2.description_ = this.fm.description;
            const t2 = e2.meta;
            t2 && (t2.weight = this.fm.weight, t2.parameters = this.fm.params || {}, this.fm.date && (t2.date = this.fm.date), void 0 !== this.fm.organization && (t2.org = this.fm.organization), void 0 !== this.fm.author && (t2.authorInfo = this.fm.author), void 0 !== this.fm.menu && (t2.menuConfig = this.fm.menu));
          }
        }
        async buildHome() {
          const e2 = await this.buildPageWithKind(getKindMain("home"));
          return await this.buildPagination(e2), e2;
        }
        async buildSection() {
          const e2 = await this.buildPageWithKind(getKindMain("section"));
          return await this.buildPagination(e2), e2;
        }
        async build404() {
          const e2 = await this.buildPageWithKind(getKindMain("404"));
          return await this.adaptPagination(e2), e2;
        }
        async buildSitemap() {
          const e2 = await this.buildPageWithKind(getKindMain("sitemap"));
          return await this.adaptPagination(e2), e2;
        }
        async buildTaxonomy() {
          const e2 = this.taxonomy.getTaxonomy(this.source.file.paths().path()), t2 = e2 ? e2.singular() : "", n3 = await this.newTaxonomy(this.source, this.c, t2);
          return n3.pageMap = this.pageMapper, await this.buildOutput(n3), await this.buildPagination(n3), n3;
        }
        async buildTerm() {
          const e2 = this.source.file.paths(), t2 = this.taxonomy.getTaxonomy(e2.path()), n3 = t2 ? t2.singular() : "", r = e2.unnormalized().baseNameNoIdentifier(), i = await this.newTerm(this.source, this.c, n3, r);
          return i.pageMap = this.pageMapper, await this.buildOutput(i), await this.buildPagination(i), i;
        }
        async render(e2) {
          var _a6, _b4, _c2;
          if ((_a6 = this.c) == null ? void 0 : _a6.lazyRendered) return void (this.c.lazyRender = async () => {
            var _a7, _b5;
            const t3 = await ((_a7 = this.renderableDocument) == null ? void 0 : _a7.render({ maxSummaryLength: 300, wordsPerMinute: 200, shortcodeRenderer: this.createShortcodeRenderer(e2) }));
            (_b5 = this.c) == null ? void 0 : _b5.updateWithContentResult(t3);
          });
          log35.info(`Lazy rendering not enabled, rendering immediately for page: ${e2.path()}`);
          const t2 = await ((_b4 = this.renderableDocument) == null ? void 0 : _b4.render({ maxSummaryLength: 300, wordsPerMinute: 200, shortcodeRenderer: this.createShortcodeRenderer(e2) }));
          (_c2 = this.c) == null ? void 0 : _c2.updateWithContentResult(t2);
        }
        async parse(e2) {
          this.renderableDocument = await this.converter.prepareRender(e2), this.c = newContent(e2), this.c.toc = this.renderableDocument.toc(), this.fmParser = new FrontMatterParserImpl(this.renderableDocument.frontMatter(), this.langSvc, this.taxonomySvc), await this.parseFrontMatter(), await this.parseLanguage(), await this.parseKind(), await this.parseTerms();
        }
        async parseTerms() {
          this.fm && this.fm.terms && (this.term.terms = this.fm.terms);
        }
        async parseKind() {
          const e2 = this.source.file.paths();
          let t2 = "";
          if (this.fm && (t2 = this.fm.kind || ""), "" === t2) switch (t2 = getKindMain("page"), e2.baseNoLeadingSlash()) {
            case PAGE_HOME_BASE:
            case "":
              t2 = getKindMain("home");
              break;
            case STANDALONE_PAGE_404_BASE:
              t2 = getKindMain("404");
              break;
            case STANDALONE_PAGE_SITEMAP_BASE:
              t2 = getKindMain("sitemap");
              break;
            default:
              if (this.source.file.isBranchBundle()) {
                t2 = getKindMain("section");
                const n3 = this.taxonomy.getTaxonomy(e2.path());
                this.taxonomy.isZero(n3) || (t2 = this.taxonomy.isTaxonomyPath(e2.path()) ? getKindMain("taxonomy") : getKindMain("term"));
              }
          }
          this.kind = t2;
        }
        async parseLanguageByDefault() {
          const e2 = this.langSvc.defaultLanguage(), t2 = await this.langSvc.getLanguageIndex(e2);
          this.source.identity.lang = e2, this.source.identity.langIdx = t2;
        }
        async parseLanguageByIdx(e2) {
          const t2 = this.langSvc.getLanguageByIndex(e2);
          this.source.identity.lang = t2, this.source.identity.langIdx = e2;
        }
        async parseLanguage() {
          const [e2, t2] = this.langSvc.getSourceLang(this.source.file.fileInfo().root());
          if (t2) {
            const t3 = this.langSvc.getLanguageIndex(e2);
            return this.source.identity.lang = e2, void (this.source.identity.langIdx = t3);
          }
          await this.parseLanguageByDefault();
        }
        async parseFrontMatter() {
          this.fmParser ? this.fm = await this.fmParser.parse(this.urlSvc.baseUrl()) : this.fm = { path: "", lang: "", kind: "", title: "", description: "", weight: 999, terms: {}, params: {} };
        }
        createShortcodeRenderer(e2) {
          return async (t2) => {
            if (!this.templateSvc) return log35.warn(`Template service not available for shortcode: ${t2.name}`), "";
            try {
              return t2.name ? await this.doRenderShortcode(t2, null, 0, e2) : (log35.warn("Shortcode missing name"), "");
            } catch (e3) {
              return log35.error(`Error rendering shortcode "${t2.name}":`, e3), "";
            }
          };
        }
        async doRenderShortcode(e2, t2, n3, r) {
          var _a6, _b4;
          if (e2.inline) return log35.warn("Inline shortcodes are not supported yet."), "";
          let i = new ShortcodeWithPage(e2.params || {}, "", r, t2, e2.name, "object" == typeof e2.params && !Array.isArray(e2.params), e2.ordinal || 0, e2.indentation || "", e2.pos || 0);
          if (e2.inner && e2.inner.length > 0) {
            let s2 = "";
            for (const t3 of e2.inner) if ("string" == typeof t3) s2 += t3;
            else {
              if ("object" != typeof t3 || !("name" in t3)) return log35.error(`Illegal state on shortcode rendering of "${e2.name}". Illegal type in inner data: ${typeof t3}`), "";
              s2 += await this.doRenderShortcode(t3, i, n3 + 1, r);
            }
            if (e2.doMarkup) try {
              const n4 = await this.renderShortcodeMarkdown(r, s2);
              i = new ShortcodeWithPage(e2.params || {}, n4, r, t2, e2.name, "object" == typeof e2.params && !Array.isArray(e2.params), e2.ordinal || 0, e2.indentation || "", e2.pos || 0);
            } catch (e3) {
              throw new Error(`Failed to process inner content: ${e3}`);
            }
            else i = new ShortcodeWithPage(e2.params || {}, s2, r, t2, e2.name, "object" == typeof e2.params && !Array.isArray(e2.params), e2.ordinal || 0, e2.indentation || "", e2.pos || 0);
          }
          try {
            let t3 = await ((_a6 = this.templateSvc) == null ? void 0 : _a6.execute(e2.name, i));
            if (!((_b4 = e2.inner) == null ? void 0 : _b4.length) && e2.indentation) {
              const n4 = t3 == null ? void 0 : t3.split("\n");
              t3 = n4 == null ? void 0 : n4.map((t4, n5) => 0 === n5 ? t4 : e2.indentation + t4).join("\n");
            }
            return t3 || "";
          } catch (t3) {
            if (t3 instanceof TemplateError && "SHORTCODE_NOT_FOUND" === t3.code) return e2.rawContent;
            throw new Error(`Failed to process shortcode: ${t3 instanceof Error ? t3.message : String(t3)}`);
          }
        }
        async renderShortcodeMarkdown(e2, t2) {
          try {
            const n3 = { document: e2, documentID: e2.path(), documentName: e2.name(), filename: e2.pageFile().filename() }, r = { ctx: {}, src: new TextEncoder().encode(t2), renderTOC: false, getRenderer: () => null }, i = await this.converter.convert(n3, r);
            let s2 = new TextDecoder().decode(i.bytes());
            return s2.includes("\n") || (s2 = s2.replace(/^<p>(.*)<\/p>\n$/, "$1")), s2;
          } catch (e3) {
            return log35.error("Error rendering shortcode markdown:", e3), "";
          }
        }
        async buildPagination(e2) {
          const t2 = new PaginatorManagerImpl({ pageSize: () => 10, globalRegularPages: async () => this.contentHub ? await this.contentHub.globalRegularPages() : [] }, e2);
          e2.pagerManager = t2;
        }
        async adaptPagination(e2) {
          const t2 = { current: () => new PaginatorImpl([], 0, 10, e2.path()).pagers()[0], setCurrent: (t3) => {
            throw new Error(`pagination not supported for this page: ${e2.path()}`);
          }, paginator: async () => {
            throw new Error(`pagination not supported for this page: ${e2.path()}`);
          }, paginate: async (t3) => {
            throw new Error(`pagination not supported for this page: ${e2.path()}`);
          } };
          e2.pagerManager = t2;
        }
        async buildOutput(e2) {
        }
        async newPage(e2, t2) {
          const n3 = new Meta(this.urlSvc.baseUrl(), "always", {}, 999, e2.file.fileInfo().modTime()), r = new Layout();
          return new PageImpl(e2, t2, n3, r, "", getKindMain("page"), this.pageMapper);
        }
        async newTaxonomy(e2, t2, n3) {
          const r = new Meta(this.urlSvc.baseUrl(), "always", {}, 999, e2.file.fileInfo().modTime()), i = new Layout();
          return new TaxonomyPageImpl(e2, t2, r, i, n3, n3, getKindMain("taxonomy"), this.pageMapper);
        }
        async newTerm(e2, t2, n3, r) {
          const i = new Meta(this.urlSvc.baseUrl(), "always", {}, 999, e2.file.fileInfo().modTime()), s2 = new Layout();
          return new TermPageImpl(e2, t2, i, s2, n3, r, r, getKindMain("term"), this.pageMapper);
        }
      };
    } });
    var init_taxonomy3 = __esm2({ "internal/domain/content/entity/taxonomy.ts"() {
      init_pagetrees(), init_fileinfo2(), init_pagesource(), path20 = __toESM3(require("path")), filepath = __toESM3(require("path")), Taxonomy2 = class {
        constructor(e2, t2) {
          __publicField(this, "views");
          __publicField(this, "fsSvc");
          this.views = e2, this.fsSvc = t2;
        }
        async assemble(e2, t2, n3) {
          for (const r of this.views) {
            const i = this.pluralTreeKey(r.plural()), s2 = (e2.get(i), newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(i + "/_index.md")))), a = await t2.withSource(s2).withLangIdx(n3).kindBuild();
            e2.insertIntoValuesDimension(i, newPageTreesNode2(a));
          }
        }
        isTaxonomyPath(e2) {
          const t2 = this.getTaxonomy(e2);
          return !!t2 && e2 === path20.join(this.pluralTreeKey(t2.plural()), "_index.md");
        }
        pluralTreeKey(e2) {
          return function(...e3) {
            let t2 = "";
            return e3.length > 0 && (t2 = e3[0], e3.length > 1 && (t2 = path20.join(...e3))), t2 = t2.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g, ""), t2 = filepath.posix.normalize(t2.toLowerCase().replace(/[^\w\-_\/]/g, "")), "" === t2 || "/" === t2 ? "" : ("/" !== t2[0] && (t2 = "/" + t2), t2);
          }(e2);
        }
        getTaxonomy(e2) {
          for (const t2 of this.views) if (e2.startsWith(this.pluralTreeKey(t2.plural()))) return t2;
          return null;
        }
        isZero(e2) {
          return !e2 || "" === e2.singular();
        }
      };
    } });
    function toStringSlicePreserveString(e2) {
      return e2 ? Array.isArray(e2) ? e2.map((e3) => String(e3)) : "string" == typeof e2 ? [e2] : [String(e2)] : null;
    }
    function toInt(e2) {
      if ("number" == typeof e2) return Math.floor(e2);
      if ("string" == typeof e2) {
        const t2 = parseInt(e2, 10);
        if (isNaN(t2)) throw new Error(`cannot convert "${e2}" to int`);
        return t2;
      }
      throw new Error(`cannot convert ${typeof e2} to int`);
    }
    var SitePager;
    var import_path11;
    var log38;
    var Page2;
    var BaseURL;
    var URL2;
    var log39;
    var WeightedPage;
    var WeightedPages;
    var Taxonomy3;
    var OrderedTaxonomyEntry;
    var OrderedTaxonomy;
    var TaxonomyList;
    var TaxonomiesBuilder;
    var init_term = __esm2({ "internal/domain/content/entity/term.ts"() {
      init_pagetrees(), init_fileinfo2(), init_pagesource(), init_frontmatter(), init_doctree(), init_log(), log36 = getDomainLogger("content", { component: "term" }), Term = class {
        constructor(e2) {
          __publicField(this, "terms");
          __publicField(this, "fsSvc");
          this.terms = {}, this.fsSvc = e2;
        }
        async assemble(e2, t2, n3, r) {
          const i = new NodeShiftTreeWalker({ tree: e2, lockType: 2, handle: async (i2, s2, a) => {
            const [o, l] = s2.getPage();
            if (!l) return [false, null];
            for (const s3 of n3.taxonomy.views) {
              const a2 = toStringSlicePreserveString(getParam(o.params(), s3.plural(), false));
              if (!a2) continue;
              const l2 = getParamToLower(o.params(), s3.plural() + "_weight");
              let c = 0;
              if (null == l2 || "" === l2) c = 0;
              else try {
                c = toInt(l2);
              } catch (e3) {
                log36.warn(`Unable to convert taxonomy weight ${l2} to int for "${o.paths().path()}"`);
              }
              for (let l3 = 0; l3 < a2.length; l3++) {
                const h3 = a2[l3];
                if ("" === h3) continue;
                const u = "/" + s3.plural() + "/" + h3;
                try {
                  const a3 = newFileInfo2(this.fsSvc.newFileMetaInfo(u + "/_index.md")), d = a3.paths(), p2 = newPageSource(a3), g = await n3.withSource(p2).withLangIdx(r).kindBuild();
                  e2.insertIntoValuesDimension(d.base(), newPageTreesNode2(g));
                  const m2 = e2.get(d.base());
                  if (m2) {
                    const [e3, t3] = m2.getPage();
                    if (!t3) return [false, null];
                    const n4 = e3;
                    n4.term = h3, n4.singular = s3.singular();
                  }
                  let f3 = i2;
                  "" === f3 && (f3 = "/");
                  const _ = d.base() + f3, [T, E] = m2.getPage();
                  if (!E) return [false, null];
                  t2.insert(_, new WeightedTermTreeNode(newPageTreesNode2(o), { page: T, ordinal: l3, weight: c, Weight: () => c, Ordinal: () => l3 }));
                } catch (e3) {
                  return [false, e3];
                }
              }
            }
            return [false, null];
          } });
          try {
            return await i.walk(), null;
          } catch (e3) {
            return e3;
          }
        }
      };
    } });
    var init_content3 = __esm2({ "internal/domain/content/index.ts"() {
      init_type4(), init_hub2(), init_kind(), init_identity(), init_fileinfo2(), init_sort(), init_frontmatter(), init_classifier(), init_content2(), init_converter(), init_pagebuilder(), init_pagetrees(), init_pagemap(), init_taxonomy3(), init_term(), init_section(), init_standalone(), init_translator();
    } });
    var init_pager = __esm2({ "internal/domain/site/entity/pager.ts"() {
      init_log(), getDomainLogger("site", { component: "pager" }), SitePager = class e2 {
        constructor(e3, t2) {
          __publicField(this, "page");
          __publicField(this, "pager");
          this.page = e3, this.pager = t2;
        }
        pageNumber() {
          return this.pager.pageNumber();
        }
        totalPages() {
          return this.pager.totalPages();
        }
        url() {
          return this.pager.url();
        }
        pages() {
          return this.pager.pages();
        }
        allPages() {
          return this.pager.allPages();
        }
        pagers() {
          return this.pager.pagers();
        }
        first() {
          return this.pager.first();
        }
        last() {
          return this.pager.last();
        }
        hasPrev() {
          return this.pager.hasPrev();
        }
        prev() {
          return this.pager.prev();
        }
        hasNext() {
          return this.pager.hasNext();
        }
        next() {
          return this.pager.next();
        }
        get PageNumber() {
          return this.pageNumber();
        }
        get TotalPages() {
          return this.totalPages();
        }
        get URL() {
          let e3 = this.url();
          return e3.startsWith("/") && (e3 = e3.slice(1)), this.page.Site.getURL().relURL(e3);
        }
        get HasPrev() {
          return this.hasPrev();
        }
        get HasNext() {
          return this.hasNext();
        }
        get First() {
          const t2 = this.first();
          return t2 ? new e2(this.page, t2) : null;
        }
        get Last() {
          const t2 = this.last();
          return t2 ? new e2(this.page, t2) : null;
        }
        get Prev() {
          const t2 = this.prev();
          return t2 ? new e2(this.page, t2) : null;
        }
        get Next() {
          const t2 = this.next();
          return t2 ? new e2(this.page, t2) : null;
        }
        get Pagers() {
          return this.pagers().map((t2) => new e2(this.page, t2));
        }
        get Pages() {
          const e3 = this.pages();
          return this.page.sitePages(e3);
        }
        get AllPages() {
          const e3 = this.pager.allPages();
          return this.page.sitePages(e3);
        }
      };
    } });
    var init_page2 = __esm2({ "internal/domain/site/entity/page.ts"() {
      import_path11 = __toESM3(require("path")), init_log(), init_pager(), log38 = getDomainLogger("site", { component: "page" }), Page2 = class e2 {
        constructor(e3, t2, n3, r, i) {
          __publicField(this, "tmplSvc");
          __publicField(this, "langSvc");
          __publicField(this, "publisher");
          __publicField(this, "contentPage");
          __publicField(this, "pageOutput", null);
          __publicField(this, "site");
          __publicField(this, "resources", []);
          __publicField(this, "_paginator", null);
          __publicField(this, "_processedContent", null);
          __publicField(this, "_precomputedData", { backlinks: null, tableOfContents: null, summary: null });
          this.tmplSvc = e3, this.langSvc = t2, this.publisher = n3, this.contentPage = r, this.site = i;
        }
        async precomputeTemplateData() {
          try {
            await Promise.all([this.precomputeBacklinks(), this.precomputeTableOfContents(), this.precomputeSummary()]);
          } catch (e3) {
            log38.warn(`Failed to precompute data for ${this.paths().path()}: ${e3}`);
          }
        }
        async precomputeBacklinks() {
          try {
            this._precomputedData.backlinks = await this.Backlinks();
          } catch (e3) {
            log38.debug(`Failed to precompute backlinks: ${e3}`);
          }
        }
        async precomputeTableOfContents() {
          try {
            this._precomputedData.tableOfContents = this.TableOfContents;
          } catch (e3) {
            log38.debug(`Failed to precompute TOC: ${e3}`);
          }
        }
        async precomputeSummary() {
          try {
            this._precomputedData.summary = await this.Summary();
          } catch (e3) {
            log38.debug(`Failed to precompute summary: ${e3}`);
          }
        }
        async processResources(e3) {
          this.resources = e3;
        }
        async render() {
          try {
            await this.renderResources(), await this.renderPage();
          } catch (e3) {
            log38.error(`Failed to render page ${this.paths().path()}: ${e3}`);
          }
        }
        getPageOutput() {
          return this.pageOutput || (this.pageOutput = this.output()), this.pageOutput;
        }
        async renderPage() {
          const e3 = this.layouts(), { preparer: t2, found: n3 } = await this.tmplSvc.lookupLayout(e3);
          if (!n3) return void log38.warn(`Failed to find layout: ${e3.join(",")} for page ${this.paths().path()}`);
          const r = [];
          let i = this.getPageOutput().targetPrefix();
          i = this.site.getLanguage().getCurrentLanguage() === i && i === this.langSvc.defaultLanguage() ? "" : this.site.getLanguage().getCurrentLanguage(), r.push(import_path11.default.join(i, this.getPageOutput().targetFilePath())), await this.renderAndWritePage(t2, r);
          const s2 = await this.current();
          if (s2) {
            let e4 = s2.next();
            for (; e4; ) {
              this.setCurrent(e4);
              const n4 = [import_path11.default.join(i, e4.url(), this.getPageOutput().targetFileBase())];
              await this.renderAndWritePage(t2, n4), e4 = e4.next();
            }
          }
        }
        async renderAndWritePage(e3, t2) {
          try {
            const n3 = await this.tmplSvc.executeWithContext(e3, this);
            await this.publisher.publishSource(n3, ...t2);
          } catch (e4) {
            throw this.errorf(e4, "failed to publish page");
          }
        }
        async renderResources() {
          for (const e3 of this.resources) {
            const t2 = [];
            let n3 = this.getPageOutput().targetPrefix();
            n3 = this.site.getLanguage().getCurrentLanguage() === n3 && n3 === this.langSvc.defaultLanguage() ? "" : this.site.getLanguage().getCurrentLanguage();
            let r = e3.path();
            t2.push(import_path11.default.join(n3, r));
            let i = null;
            try {
              const n4 = () => e3.pageFile().open();
              if (i = await n4(), !i) throw new Error("Failed to open resource stream");
              let r3;
              r3 = "function" == typeof i.read ? new ReadableStream({ async start(e4) {
                try {
                  const t3 = new Uint8Array(8192);
                  for (; ; ) {
                    const n5 = await i.read(t3);
                    if (0 === n5.bytesRead) break;
                    e4.enqueue(t3.slice(0, n5.bytesRead));
                  }
                  e4.close();
                } catch (t3) {
                  e4.error(t3);
                }
              } }) : new ReadableStream({ start(e4) {
                e4.close();
              } }), await this.publisher.publishFiles(r3, ...t2);
            } catch (e4) {
              throw this.errorf(e4, "failed to publish page resources");
            } finally {
              if (i) try {
                await i.close();
              } catch (e4) {
                log38.warn(`Failed to close resource stream: ${e4}`);
              }
            }
          }
        }
        errorf(e3, t2, ...n3) {
          const r = [this.pageIdentity().pageLanguage(), this.paths().path(), ...n3], i = `[%s] page "%s": ${t2}: %s`, s2 = this.sprintf(i, ...r, e3.message || e3);
          return new Error(s2);
        }
        sprintf(e3, ...t2) {
          let n3 = 0;
          return e3.replace(/%s/g, () => t2[n3++] || "");
        }
        clone() {
          const t2 = new e2(this.tmplSvc, this.langSvc, this.publisher, this.contentPage, this.site);
          return t2.resources = [...this.resources], t2.pageOutput = this.pageOutput, t2;
        }
        pageIdentity() {
          return this.contentPage.pageIdentity();
        }
        pageFile() {
          return this.contentPage.pageFile();
        }
        staleVersions() {
          return this.contentPage.staleVersions();
        }
        section() {
          return this.contentPage.section();
        }
        paths() {
          return this.contentPage.paths();
        }
        path() {
          return this.contentPage.path();
        }
        slug() {
          return this.contentPage.slug();
        }
        file() {
          return this.contentPage.file();
        }
        name() {
          return this.contentPage.name();
        }
        title() {
          return this.contentPage.title();
        }
        kind() {
          return this.contentPage.kind();
        }
        scratch() {
          return this.contentPage.scratch();
        }
        get Scratch() {
          return this.contentPage.scratch();
        }
        IsAncestor(e3) {
          return this.contentPage.isAncestor(e3.contentPage);
        }
        get Title() {
          return this.title();
        }
        get Section() {
          return this.contentPage.section();
        }
        get LinkTitle() {
          return this.title();
        }
        get IsSection() {
          return this.contentPage.isSection();
        }
        get IsPage() {
          return this.contentPage.isPage();
        }
        get Content() {
          return this.getPageOutput().content();
        }
        async WikilinkContent() {
          if (null !== this._processedContent) return this._processedContent;
          const e3 = await this.getPageOutput().content();
          return e3 ? (this._processedContent = await this.site.ProcessWikilinks(this.slug(), e3), this._processedContent) : e3;
        }
        async Summary() {
          if (null !== this._precomputedData.summary) return this._precomputedData.summary;
          const e3 = await this.contentPage.output().summary();
          return this._precomputedData.summary = e3, e3;
        }
        async ReadingTime() {
          return await this.getPageOutput().readingTime();
        }
        async WordCount() {
          return await this.getPageOutput().wordCount();
        }
        async Backlinks() {
          if (null !== this._precomputedData.backlinks) return this._precomputedData.backlinks;
          const e3 = this.site.GetBacklinks(this.slug()), t2 = [], n3 = await this.site.RegularPages();
          for (const r of e3) {
            const e4 = n3.find((e5) => e5.slug() === r);
            e4 && t2.push(e4);
          }
          return this._precomputedData.backlinks = t2, t2;
        }
        OutgoingLinks() {
          const e3 = this.site.getPageGraph();
          return e3 ? e3.getOutgoingLinks(this.slug()) : [];
        }
        get Description() {
          return this.description();
        }
        get Date() {
          return this.pageDate();
        }
        get LocalDate() {
          return this.pageDate().toLocaleDateString();
        }
        get RelPermalink() {
          let e3;
          if (this.pageIdentity().pageLanguage() === this.langSvc.defaultLanguage()) e3 = this.getPageOutput().targetFilePath();
          else {
            const t2 = this.getPageOutput().targetPrefix(), n3 = this.getPageOutput().targetFilePath();
            e3 = this.pathJoin(t2, n3);
          }
          return e3.startsWith("/") && (e3 = e3.slice(1)), this.site.getURL().relURL(e3);
        }
        get GitInfo() {
          return {};
        }
        get File() {
          return { BaseFileName: this.contentPage.file().baseFileName(), OriginalBaseName: this.contentPage.file().originalBaseFileName(), Dir: this.contentPage.file().dir() };
        }
        isHome() {
          return this.contentPage.isHome();
        }
        get IsHome() {
          return this.isHome();
        }
        isPage() {
          return this.contentPage.isPage();
        }
        isSection() {
          return this.contentPage.isSection();
        }
        isAncestor(e3) {
          return this.contentPage.isAncestor(e3);
        }
        eq(e3) {
          return this.contentPage.eq(e3);
        }
        isBundled() {
          return this.contentPage.isBundled();
        }
        layouts() {
          return this.contentPage.layouts();
        }
        output() {
          return this.contentPage.output();
        }
        pageOutputs() {
          return [this.contentPage.output()];
        }
        truncated() {
          return this.contentPage.truncated();
        }
        get Truncated() {
          return this.contentPage.truncated();
        }
        parent() {
          return this.contentPage.parent();
        }
        pages() {
          return this.contentPage.pages();
        }
        isStale() {
          return this.contentPage.pageIdentity().isStale();
        }
        clearStale() {
          this.contentPage.pageIdentity().clearStale();
        }
        prevInSection() {
          return this.contentPage.prevInSection();
        }
        nextInSection() {
          return this.contentPage.nextInSection();
        }
        sections(e3) {
          return this.contentPage.sections(e3);
        }
        regularPages() {
          return this.contentPage.regularPages();
        }
        regularPagesRecursive() {
          return this.contentPage.regularPagesRecursive();
        }
        terms(e3, t2) {
          return this.contentPage.terms(e3, t2);
        }
        isTranslated() {
          return this.contentPage.isTranslated();
        }
        translations() {
          return this.contentPage.translations();
        }
        rawContent() {
          return this.contentPage.rawContent();
        }
        description() {
          return this.contentPage.description ? this.contentPage.description() : "";
        }
        params() {
          return this.contentPage.params ? this.contentPage.params() : {};
        }
        pageBaseUrl() {
          return this.contentPage.pageBaseUrl() ? this.contentPage.pageBaseUrl() : "";
        }
        pageWeight() {
          return this.contentPage.pageWeight ? this.contentPage.pageWeight() : 0;
        }
        pageDate() {
          return this.contentPage.pageDate ? this.contentPage.pageDate() : /* @__PURE__ */ new Date();
        }
        publishDate() {
          return this.contentPage.publishDate ? this.contentPage.publishDate() : /* @__PURE__ */ new Date();
        }
        get PublishDate() {
          return this.publishDate();
        }
        async relatedKeywords(e3) {
          return this.contentPage.relatedKeywords ? await this.contentPage.relatedKeywords(e3) : [];
        }
        shouldList(e3) {
          return !this.contentPage.shouldList || this.contentPage.shouldList(e3);
        }
        shouldListAny() {
          return !this.contentPage.shouldListAny || this.contentPage.shouldListAny();
        }
        noLink() {
          return !!this.contentPage.noLink && this.contentPage.noLink();
        }
        organization() {
          return this.contentPage.organization ? this.contentPage.organization() : void 0;
        }
        author() {
          return this.contentPage.author ? this.contentPage.author() : void 0;
        }
        menu() {
          return this.contentPage.menu ? this.contentPage.menu() : void 0;
        }
        current() {
          return this.contentPage.current();
        }
        setCurrent(e3) {
          this.contentPage.setCurrent(e3);
        }
        posOffset(e3) {
          return this.contentPage.posOffset(e3);
        }
        paginator() {
          return this.contentPage.paginator();
        }
        async paginate(e3) {
          return this.contentPage.paginate(e3);
        }
        get Plain() {
          return this.rawContent();
        }
        get TableOfContents() {
          if (null !== this._precomputedData.tableOfContents) return this._precomputedData.tableOfContents;
          const e3 = this.getPageOutput().tableOfContents();
          return this._precomputedData.tableOfContents = e3, e3;
        }
        get Params() {
          return this.params();
        }
        get Site() {
          return this.site;
        }
        get Sites() {
          return { First: this.site, Default: this.site };
        }
        get Lastmod() {
          return this.contentPage.pageDate ? this.contentPage.pageDate() : null;
        }
        get Sitemap() {
          return { ChangeFreq: "weekly", Priority: 0.5, Filename: "sitemap.xml" };
        }
        get IsTranslated() {
          return this.isTranslated();
        }
        async Paginator() {
          return this._paginator || await this.setupCurrentPaginator(), this._paginator;
        }
        async Paginate(e3) {
          try {
            const t2 = e3.map((e4) => e4.contentPage), n3 = await this.contentPage.paginate(t2);
            return n3 && (this._paginator = new SitePager(this, n3)), this._paginator;
          } catch (e4) {
            return log38.error("Error during pagination:", e4), null;
          }
        }
        async setupCurrentPaginator() {
          try {
            const e3 = await this.contentPage.paginator();
            this._paginator = e3 ? new SitePager(this, e3) : null;
          } catch (e3) {
            log38.error("Error initializing Paginator:", e3), this._paginator = null;
          }
        }
        get Language() {
          return { Lang: this.pageIdentity().pageLanguage(), LanguageName: this.langSvc.getLanguageName(this.pageIdentity().pageLanguage()), Title: this.title(), Weight: this.pageWeight() };
        }
        get Permalink() {
          return this.RelPermalink;
        }
        sitePages(e3) {
          const t2 = [];
          for (const n3 of e3) {
            const e4 = this.sitePage(n3);
            e4 && t2.push(e4);
          }
          return t2;
        }
        sitePage(t2) {
          try {
            return null === t2 ? (log38.warn(`Invalid content page provided: ${t2}`), null) : new e2(this.tmplSvc, this.langSvc, this.publisher, t2, this.site);
          } catch (e3) {
            return log38.error(`Error creating site page: ${e3}`), null;
          }
        }
        pathJoin(...e3) {
          return e3.filter((e4) => e4 && e4.length > 0).map((e4) => e4.replace(/^\/+|\/+$/g, "")).filter((e4) => e4.length > 0).join("/");
        }
        joinURL(e3, t2) {
          return e3 ? t2 ? (e3.endsWith("/") && (e3 = e3.slice(0, -1)), t2.startsWith("/") || (t2 = "/" + t2), e3 + t2) : e3 : t2;
        }
        async Translations() {
          const e3 = await this.translations();
          return Array.isArray(e3) ? e3.map((e4) => this.sitePage(e4)).filter((e4) => null !== e4) : [];
        }
        async GetTerms(e3) {
          const t2 = await this.terms(this.site.getLanguage().currentLanguageIndex(), e3);
          return Array.isArray(t2) ? t2.map((e4) => this.sitePage(e4)).filter((e4) => null !== e4) : [];
        }
        async Pages() {
          return await this.getSitePages();
        }
        get Page() {
          return this.contentPage;
        }
        get Kind() {
          return this.kind();
        }
        get Type() {
          if ("home" === this.kind()) return "page";
          if ("page" === this.kind()) {
            const e3 = this.section();
            if (e3 && e3.length > 0) return e3;
          }
          return "page";
        }
        get Parent() {
          return this.sitePage(this.contentPage.parent());
        }
        async getSitePages() {
          const e3 = await this.contentPage.pages();
          return !e3 || Array.isArray(e3) && 0 === e3.length ? [] : this.sitePages(e3);
        }
      };
    } });
    var init_baseurl = __esm2({ "internal/domain/site/valueobject/baseurl.ts"() {
      BaseURL = class e2 {
        constructor(e3, t2 = false) {
          __publicField(this, "url");
          __publicField(this, "withPath");
          __publicField(this, "withPathNoTrailingSlash");
          __publicField(this, "withoutPath");
          __publicField(this, "basePath");
          __publicField(this, "basePathNoTrailingSlash");
          __publicField(this, "isRelative");
          if (this.url = e3, this.isRelative = t2, this.withPath = e3.toString(), this.withPathNoTrailingSlash = this.withPath.replace(/\/$/, ""), t2) this.withoutPath = "/";
          else {
            const t3 = new URL(e3.toString());
            t3.pathname = "", this.withoutPath = t3.toString().replace(/\/$/, "");
          }
          this.basePath = e3.pathname, this.basePathNoTrailingSlash = this.basePath.replace(/\/$/, "");
        }
        static fromString(t2) {
          try {
            t2 && "/" !== t2 || (t2 = "/");
            const n3 = t2.trim();
            if (n3.startsWith("/") && !n3.startsWith("//")) {
              const t3 = new URL(n3, "http://localhost");
              return t3.pathname.endsWith("/") || (t3.pathname += "/"), new e2(t3, true);
            }
            if (n3.startsWith("//")) {
              const t3 = new URL("https:" + n3);
              return t3.pathname.endsWith("/") || (t3.pathname += "/"), new e2(t3);
            }
            if (n3.includes("://")) {
              const t3 = new URL(n3);
              if (!["http:", "https:"].includes(t3.protocol)) throw new Error(`Unsupported protocol: ${t3.protocol}. Only http and https are supported.`);
              return t3.pathname.endsWith("/") || (t3.pathname += "/"), new e2(t3);
            }
            if (n3.includes(":") && !n3.includes("/")) {
              const e3 = n3.indexOf(":"), t3 = n3.substring(0, e3 + 1);
              throw new Error(`Unsupported protocol: ${t3}. Only http and https are supported.`);
            }
            const r = new URL("https://" + n3);
            return r.pathname.endsWith("/") || (r.pathname += "/"), new e2(r);
          } catch (e3) {
            throw new Error(`Invalid URL: ${(e3 == null ? void 0 : e3.message) || "Unknown error"}`);
          }
        }
        getRoot(e3) {
          return this.isRelative ? this.basePath : e3.startsWith("/") ? this.withoutPath : this.withPath;
        }
        toString() {
          return this.isRelative ? this.basePath : this.withPath;
        }
        path() {
          return this.url.pathname;
        }
        port() {
          return this.url.port ? parseInt(this.url.port) : 0;
        }
        hostURL() {
          return this.isRelative ? "/" : this.toString().replace(this.path(), "");
        }
        protocol() {
          return this.url.protocol;
        }
        host() {
          return this.url.host;
        }
        hostname() {
          return this.url.hostname;
        }
        getURL() {
          return new URL(this.url.toString());
        }
        withProtocol(t2) {
          if (this.isRelative) throw new Error("Cannot change protocol of relative URL");
          const n3 = this.getURL();
          let r = t2;
          const i = r.endsWith("://"), s2 = r.endsWith(":");
          if (i ? r = r.slice(0, -3) : s2 && (r = r.slice(0, -1)), s2 && !n3.pathname) throw new Error(`cannot determine BaseURL for protocol ${t2}`);
          return n3.protocol = r, e2.fromString(n3.toString());
        }
        withPort(t2) {
          if (this.isRelative) throw new Error("Cannot set port on relative URL");
          const n3 = this.getURL();
          return n3.port = t2.toString(), e2.fromString(n3.toString());
        }
        isRelativeURL() {
          return this.isRelative;
        }
        isAbsoluteURL() {
          return !this.isRelative;
        }
      };
    } });
    var init_text = __esm2({ "pkg/text/index.ts"() {
    } });
    var init_url = __esm2({ "internal/domain/site/entity/url.ts"() {
      init_baseurl(), init_paths2(), init_text(), URL2 = class e2 {
        constructor(e3, t2 = false) {
          __publicField(this, "base");
          __publicField(this, "canonical");
          __publicField(this, "baseURL", null);
          this.base = e3, this.canonical = t2, this.setup();
        }
        setup() {
          try {
            this.baseURL = BaseURL.fromString(this.base);
          } catch (e3) {
            throw new Error((e3 == null ? void 0 : e3.message) || "Failed to setup URL");
          }
        }
        isAbsURL(e3) {
          return e3.startsWith("http://") || e3.startsWith("https://") ? [true, null] : [/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e3), null];
        }
        startWithBaseUrlRoot(e3) {
          return !!this.baseURL && e3.startsWith(this.baseURL.getRoot(e3));
        }
        isProtocolRelPath(e3) {
          return e3.startsWith("//");
        }
        trimBaseUrlRoot(e3) {
          if (!this.baseURL) return e3;
          const t2 = this.baseURL.getRoot(e3);
          return e3.endsWith(t2) ? e3.slice(0, -t2.length) : e3;
        }
        addContextRoot(e3) {
          if (!this.baseURL) return e3;
          let t2 = e3;
          return this.canonical || (n3 = this.baseURL.getRoot(e3), r = e3, t2 = !n3 || r.startsWith(n3) ? r : function(...e4) {
            return e4.filter(Boolean).join("/").replace(/\/+/g, "/").replace(/\/$/, "");
          }(n3, r)), t2;
          var n3, r;
        }
        handleRootSuffix(e3, t2) {
          return this.baseURL ? ("" === e3 && this.baseURL.getRoot(e3).endsWith("/") && (t2 += "/"), t2) : t2;
        }
        handlePrefix(e3) {
          return e3.startsWith("/") || (e3 = "/" + e3), e3;
        }
        relURL(e3) {
          if (!e3) return this.baseURL ? this.baseURL.basePath : "";
          const [t2, n3] = this.isAbsURL(e3);
          if (n3) return e3;
          if (t2 || this.isProtocolRelPath(e3)) return e3;
          if (!this.baseURL) return e3;
          let r = e3;
          if (e3.startsWith("/")) return this.baseURL.isRelativeURL() ? e3 : this.baseURL.withoutPath + e3;
          if (r = this.baseURL.isRelativeURL() ? (this.baseURL.basePath.endsWith("/") ? this.baseURL.basePath : this.baseURL.basePath + "/") + e3 : (this.baseURL.withPath.endsWith("/") ? this.baseURL.withPath : this.baseURL.withPath + "/") + e3, r.includes("://")) {
            const e4 = r.indexOf("://"), t3 = r.substring(0, e4 + 3), n4 = r.substring(e4 + 3);
            r = t3 + n4.replace(/\/+/g, "/");
          } else r = r.replace(/\/+/g, "/");
          return r;
        }
        absURL(e3, t2 = false, n3 = "") {
          const [r, i] = this.isAbsURL(e3);
          if (i) return e3;
          if (r || this.isProtocolRelPath(e3)) return e3;
          if (!this.baseURL) return e3;
          const s2 = this.baseURL.getRoot(e3);
          if (t2 && n3) {
            let t3 = false, r3 = e3;
            if (e3.startsWith("/") && (r3 = e3.slice(1)), t3 = r3 === n3 || r3.startsWith(n3 + "/"), !t3) {
              const t4 = "" === e3 || e3.endsWith("/");
              e3 = this.joinPaths(n3, e3), t4 && (e3 += "/");
            }
          }
          return function(e4, t3) {
            const n4 = `${e4.replace(/\/$/, "")}/${t3.replace(/^\//, "")}`;
            try {
              return new URL(n4);
            } catch (e5) {
              return new URL("http://" + n4);
            }
          }(s2, e3).toString();
        }
        urlize(e3) {
          return this.urlEscape(this.makePathSanitized(e3));
        }
        makePathSanitized(e3) {
          return this.makePath(e3).toLowerCase();
        }
        urlEscape(t2) {
          try {
            if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t2)) return new e2(t2).toString();
            const n3 = t2.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);
            if (!n3) return encodeURI(t2);
            const [, r = "", i = "", s2 = ""] = n3;
            return encodeURI(r) + (i || "") + (s2 || "");
          } catch (e3) {
            return encodeURI(t2);
          }
        }
        makePath(e3) {
          let t2 = function(e4) {
            return e4.replace(/[\s\t\n\r]+/g, "-").replace(/[^\w\-_]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
          }(e3);
          return t2 = t2.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), t2;
        }
        basePathNoSlash() {
          return this.baseURL ? this.baseURL.basePathNoTrailingSlash : "";
        }
        joinPaths(...e3) {
          return e3.filter(Boolean).join("/").replace(/\/+/g, "/").replace(/\/$/, "");
        }
      };
    } });
    var taxonomies_builder_exports = {};
    __export3(taxonomies_builder_exports, { OrderedTaxonomy: () => OrderedTaxonomy, OrderedTaxonomyEntry: () => OrderedTaxonomyEntry, TaxonomiesBuilder: () => TaxonomiesBuilder, Taxonomy: () => Taxonomy3, TaxonomyList: () => TaxonomyList, WeightedPage: () => WeightedPage, WeightedPages: () => WeightedPages });
    var Menu2;
    var Menus;
    var init_taxonomies_builder = __esm2({ "internal/domain/site/entity/taxonomies-builder.ts"() {
      init_log(), log39 = getDomainLogger("site", { component: "taxonomies-builder" }), WeightedPage = class {
        constructor(e2, t2) {
          __publicField(this, "page");
          __publicField(this, "ordinalWeightPage");
          this.page = e2, this.ordinalWeightPage = t2;
        }
        get Page() {
          return this.page;
        }
        weight() {
          return this.ordinalWeightPage.weight();
        }
        ordinal() {
          return this.ordinalWeightPage.ordinal();
        }
        owner() {
          return this.ordinalWeightPage.owner();
        }
        get Permalink() {
          return this.page.Permalink;
        }
        get RelPermalink() {
          return this.page.RelPermalink;
        }
        get Title() {
          return this.page.Title;
        }
      }, WeightedPages = class extends Array {
        page() {
          return 0 === this.length ? (log39.error("Page called on empty WeightedPages"), null) : this[0];
        }
        get Page() {
          return this.page();
        }
        pages() {
          return Array.from(this);
        }
        sortByWeight() {
          this.stableSort((e2, t2) => e2.weight() - t2.weight());
        }
        count() {
          return this.length;
        }
        get Count() {
          return this.count();
        }
        stableSort(e2) {
          const t2 = this.map((e3, t3) => ({ item: e3, index: t3 }));
          t2.sort((t3, n3) => {
            const r = e2(t3.item, n3.item);
            return 0 !== r ? r : t3.index - n3.index;
          }), this.splice(0, this.length, ...t2.map((e3) => e3.item));
        }
      }, Taxonomy3 = class {
        constructor() {
          __publicField(this, "terms", /* @__PURE__ */ new Map());
        }
        get(e2) {
          return this.terms.get(e2);
        }
        set(e2, t2) {
          this.terms.set(e2, t2);
        }
        has(e2) {
          return this.terms.has(e2);
        }
        keys() {
          return Array.from(this.terms.keys());
        }
        values() {
          return Array.from(this.terms.values());
        }
        get Values() {
          return this.terms;
        }
        entries() {
          return Array.from(this.terms.entries());
        }
        size() {
          return this.terms.size;
        }
        byCount() {
          const e2 = this.taxonomyArray();
          return e2.sort((e3, t2) => {
            const n3 = e3.weightedPages.length, r = t2.weightedPages.length;
            return n3 === r ? e3.name.localeCompare(t2.name) : r - n3;
          }), new OrderedTaxonomy(e2);
        }
        taxonomyArray() {
          const e2 = [];
          for (const [t2, n3] of this.terms.entries()) e2.push(new OrderedTaxonomyEntry(t2, n3));
          return e2;
        }
      }, OrderedTaxonomyEntry = class {
        constructor(e2, t2) {
          __publicField(this, "name");
          __publicField(this, "weightedPages");
          this.name = e2, this.weightedPages = t2;
        }
        count() {
          return this.weightedPages.count();
        }
        term() {
          return this.name;
        }
      }, OrderedTaxonomy = class extends Array {
        constructor(e2) {
          super(), e2 && this.push(...e2);
        }
        getOneOPage() {
          return 0 === this.length ? null : this[0].weightedPages.page();
        }
      }, TaxonomyList = class {
        constructor() {
          __publicField(this, "taxonomies", /* @__PURE__ */ new Map());
        }
        get(e2) {
          return this.taxonomies.get(e2);
        }
        set(e2, t2) {
          this.taxonomies.set(e2, t2);
        }
        has(e2) {
          return this.taxonomies.has(e2);
        }
        keys() {
          return Array.from(this.taxonomies.keys());
        }
        values() {
          return Array.from(this.taxonomies.values());
        }
        get Values() {
          return this.taxonomies;
        }
        entries() {
          return Array.from(this.taxonomies.entries());
        }
        size() {
          return this.taxonomies.size;
        }
      }, TaxonomiesBuilder = class {
        constructor(e2) {
          __publicField(this, "contentService");
          this.contentService = e2;
        }
        async buildTaxonomiesForLanguage(e2, t2) {
          const n3 = new TaxonomyList();
          try {
            return await this.contentService.walkTaxonomies(e2, async (e3, r, i) => {
              n3.has(e3) || n3.set(e3, new Taxonomy3());
              const s2 = n3.get(e3);
              s2.has(r) || s2.set(r, new WeightedPages());
              const a = await t2.siteWeightedPage(i);
              s2.get(r).push(a);
            }), n3;
          } catch (e3) {
            throw log39.error(`Failed to create taxonomies: ${e3}`), e3;
          }
        }
      };
    } });
    function newEmptyMenus() {
      return new Menus({});
    }
    var import_github_slugger;
    var init_menu = __esm2({ "internal/domain/site/valueobject/menu.ts"() {
      init_log(), getDomainLogger("site", { component: "menu" }), Menu2 = class e2 {
        constructor(e3) {
          __publicField(this, "_title");
          __publicField(this, "_url");
          __publicField(this, "_children");
          __publicField(this, "_weight");
          __publicField(this, "_identifier");
          this._title = e3.title, this._url = e3.url, this._children = e3.children || [], this._weight = e3.weight || 0, this._identifier = e3.identifier || this._url;
        }
        title() {
          return this._title;
        }
        get Title() {
          return this.title();
        }
        url() {
          return this._url;
        }
        get URL() {
          return this.url();
        }
        children() {
          return [...this._children];
        }
        get Children() {
          return this.children();
        }
        weight() {
          return this._weight;
        }
        identifier() {
          return this._identifier;
        }
        hasChildren() {
          return this._children.length > 0;
        }
        get HasChildren() {
          return this.hasChildren();
        }
        addChild(t2) {
          const n3 = [...this._children, t2];
          return new e2({ title: this._title, url: this._url, children: n3, weight: this._weight, identifier: this._identifier });
        }
        toJSON() {
          return { title: this._title, url: this._url, weight: this._weight, children: this._children.map((e3) => e3.toJSON()) };
        }
        withChildren(t2) {
          return new e2({ title: this._title, url: this._url, children: t2, weight: this._weight, identifier: this._identifier });
        }
      }, Menus = class {
        constructor(e2 = {}) {
          __publicField(this, "_nav");
          __publicField(this, "_footer");
          this._nav = e2.nav ? this.sortMenus([...e2.nav]) : [], this._footer = e2.footer ? this.sortMenus([...e2.footer]) : [];
        }
        nav() {
          return [...this._nav];
        }
        get Nav() {
          return this.nav();
        }
        footer() {
          return [...this._footer];
        }
        get Footer() {
          return this.footer();
        }
        sortMenus(e2) {
          return e2.sort((e3, t2) => {
            if (e3.weight() !== t2.weight()) return 0 === t2.weight() ? -1 : 0 === e3.weight() ? 1 : e3.weight() - t2.weight();
            const n3 = e3.title().localeCompare(t2.title());
            return 0 !== n3 ? n3 : e3.identifier().localeCompare(t2.identifier());
          });
        }
        toJSON() {
          return { nav: this._nav.map((e2) => e2.toJSON()), footer: this._footer.map((e2) => e2.toJSON()) };
        }
      };
    } });
    function splitAnchor2(e2) {
      let [t2, n3] = e2.split("#", 2);
      return t2.endsWith(".pdf") ? [t2, void 0 === n3 ? "" : `#${n3}`] : (n3 = void 0 === n3 ? "" : "#" + (0, import_github_slugger.slug)(n3), [t2, n3]);
    }
    function simplifySlug(e2) {
      const t2 = stripSlashes2((endsWith2(n3 = e2, "index") && (n3 = n3.slice(0, -5)), n3), true);
      var n3;
      return 0 === t2.length ? "/" : t2;
    }
    function pathToRoot(e2) {
      let t2 = e2.split("/").filter((e3) => "" !== e3).slice(0, -1).map((e3) => "..").join("/");
      return 0 === t2.length && (t2 = "."), t2;
    }
    function joinSegments(...e2) {
      if (0 === e2.length) return "";
      let t2 = e2.filter((e3) => "" !== e3 && "/" !== e3).map((e3) => stripSlashes2(e3)).join("/");
      return e2[0].startsWith("/") && (t2 = "/" + t2), e2[e2.length - 1].endsWith("/") && (t2 += "/"), t2;
    }
    function transformLink(e2, t2, n3) {
      let r = function(e3) {
        let [t3, n4] = splitAnchor2(decodeURI(e3));
        const r3 = isFolderPath(t3);
        let i = t3.split("/").filter((e4) => e4.length > 0), s2 = i.filter(isRelativeSegment).join("/");
        const a = simplifySlug(function(e4) {
          var _a6;
          let t4 = (n5 = e4 = stripSlashes2(e4), (_a6 = n5.match(/\.[A-Za-z0-9]+$/)) == null ? void 0 : _a6[0]);
          var n5;
          const r4 = e4.replace(new RegExp(t4 + "$"), "");
          [".md", ".html", void 0].includes(t4) && (t4 = "");
          let i2 = function(e5) {
            return e5.split("/").map((e6) => e6.replace(/\s/g, "-").replace(/&/g, "-and-").replace(/%/g, "-percent").replace(/\?/g, "").replace(/#/g, "")).join("/").replace(/\/$/, "");
          }(r4);
          return endsWith2(i2, "_index") && (i2 = i2.replace(/_index$/, "index")), i2 + t4;
        }(i.filter((e4) => !isRelativeSegment(e4) && "" !== e4).join("/"))), o = r3 ? "/" : "";
        return "" === (l = joinSegments(stripSlashes2(s2), stripSlashes2(a))) && (l = "."), l.startsWith(".") || (l = joinSegments(".", l)), l + o + n4;
        var l;
      }(t2);
      if ("relative" === n3.strategy) return r;
      {
        const t3 = isFolderPath(r) ? "/" : "", i = stripSlashes2(r.slice(1));
        let [s2, a] = splitAnchor2(i);
        if ("shortest" === n3.strategy) {
          const t4 = n3.allSlugs.filter((e3) => {
            const t5 = e3.split("/").at(-1);
            return s2.toLowerCase() === (t5 == null ? void 0 : t5.toLowerCase());
          });
          if (1 === t4.length) return function(e3, t5) {
            return joinSegments(pathToRoot(e3), simplifySlug(t5));
          }(e2, t4[0]) + a;
        }
        return joinSegments(pathToRoot(e2), i) + t3;
      }
    }
    function isFolderPath(e2) {
      return e2.endsWith("/") || endsWith2(e2, "index") || endsWith2(e2, "index.md") || endsWith2(e2, "index.html");
    }
    function endsWith2(e2, t2) {
      return e2 === t2 || e2.endsWith("/" + t2);
    }
    function isRelativeSegment(e2) {
      return /^\.{0,2}$/.test(e2);
    }
    function stripSlashes2(e2, t2) {
      return e2.startsWith("/") && (e2 = e2.substring(1)), !t2 && e2.endsWith("/") && (e2 = e2.slice(0, -1)), e2;
    }
    var log41;
    var PageGraph;
    var init_path3 = __esm2({ "internal/domain/site/valueobject/path.ts"() {
      import_github_slugger = (init_github_slugger(), __toCommonJS2(github_slugger_exports));
    } });
    var init_pagegraph = __esm2({ "internal/domain/site/entity/pagegraph.ts"() {
      init_path3(), init_log(), log41 = getDomainLogger("site", { component: "PageGraph" }), PageGraph = class {
        constructor(e2) {
          __publicField(this, "allSlugs");
          __publicField(this, "outgoingLinks", /* @__PURE__ */ new Map());
          this.allSlugs = [...e2], log41.info(`PageGraph initialized with ${e2.length} items (pages + resources)`);
        }
        registerOutgoingLinks(e2, t2) {
          const n3 = simplifySlug(e2);
          this.outgoingLinks.set(n3, t2);
        }
        getBacklinks(e2) {
          const t2 = simplifySlug(e2), n3 = [];
          for (const [e3, r] of this.outgoingLinks.entries()) r.includes(t2) && n3.push(e3);
          return n3;
        }
        getAllSlugs() {
          return [...this.allSlugs];
        }
        hasSlug(e2) {
          return this.allSlugs.includes(e2);
        }
        resolveLink(e2, t2, n3) {
          return transformLink(e2, t2, { strategy: n3, allSlugs: this.allSlugs });
        }
        getOutgoingLinks(e2) {
          const t2 = simplifySlug(e2);
          return this.outgoingLinks.get(t2) || [];
        }
        getAllOutgoingLinks() {
          return new Map(this.outgoingLinks);
        }
        getStats() {
          return { totalPages: this.allSlugs.length, slugs: [...this.allSlugs] };
        }
      };
    } });
    function bail(e2) {
      if (e2) throw e2;
    }
    var cb;
    var mod;
    var init_bail = __esm2({ "node_modules/bail/index.js"() {
    } });
    var require_extend = (cb = { "node_modules/extend/index.js"(e2, t2) {
      var n3 = Object.prototype.hasOwnProperty, r = Object.prototype.toString, i = Object.defineProperty, s2 = Object.getOwnPropertyDescriptor, a = function(e3) {
        return "function" == typeof Array.isArray ? Array.isArray(e3) : "[object Array]" === r.call(e3);
      }, o = function(e3) {
        if (!e3 || "[object Object]" !== r.call(e3)) return false;
        var t3, i2 = n3.call(e3, "constructor"), s3 = e3.constructor && e3.constructor.prototype && n3.call(e3.constructor.prototype, "isPrototypeOf");
        if (e3.constructor && !i2 && !s3) return false;
        for (t3 in e3) ;
        return void 0 === t3 || n3.call(e3, t3);
      }, l = function(e3, t3) {
        i && "__proto__" === t3.name ? i(e3, t3.name, { enumerable: true, configurable: true, value: t3.newValue, writable: true }) : e3[t3.name] = t3.newValue;
      }, c = function(e3, t3) {
        if ("__proto__" === t3) {
          if (!n3.call(e3, t3)) return;
          if (s2) return s2(e3, t3).value;
        }
        return e3[t3];
      };
      t2.exports = function e3() {
        var t3, n4, r3, i2, s3, h3, u = arguments[0], d = 1, p2 = arguments.length, g = false;
        for ("boolean" == typeof u && (g = u, u = arguments[1] || {}, d = 2), (null == u || "object" != typeof u && "function" != typeof u) && (u = {}); d < p2; ++d) if (null != (t3 = arguments[d])) for (n4 in t3) r3 = c(u, n4), u !== (i2 = c(t3, n4)) && (g && i2 && (o(i2) || (s3 = a(i2))) ? (s3 ? (s3 = false, h3 = r3 && a(r3) ? r3 : []) : h3 = r3 && o(r3) ? r3 : {}, l(u, { name: n4, newValue: e3(g, h3, i2) })) : void 0 !== i2 && l(u, { name: n4, newValue: i2 }));
        return u;
      };
    } }, function() {
      return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
    });
    var init_default = __esm2({ "node_modules/devlop/lib/default.js"() {
    } });
    function isPlainObject2(e2) {
      if ("object" != typeof e2 || null === e2) return false;
      const t2 = Object.getPrototypeOf(e2);
      return !(null !== t2 && t2 !== Object.prototype && null !== Object.getPrototypeOf(t2) || Symbol.toStringTag in e2 || Symbol.iterator in e2);
    }
    var init_is_plain_obj = __esm2({ "node_modules/is-plain-obj/index.js"() {
    } });
    var init_lib = __esm2({ "node_modules/trough/lib/index.js"() {
    } });
    var init_trough = __esm2({ "node_modules/trough/index.js"() {
      init_lib();
    } });
    function point(e2) {
      return index6(e2 && e2.line) + ":" + index6(e2 && e2.column);
    }
    function position(e2) {
      return point(e2 && e2.start) + "-" + point(e2 && e2.end);
    }
    function index6(e2) {
      return e2 && "number" == typeof e2 ? e2 : 1;
    }
    var VFileMessage;
    var import_node_path;
    var import_node_process;
    var init_lib2 = __esm2({ "node_modules/unist-util-stringify-position/lib/index.js"() {
    } });
    var init_unist_util_stringify_position = __esm2({ "node_modules/unist-util-stringify-position/index.js"() {
      init_lib2();
    } });
    var init_lib3 = __esm2({ "node_modules/vfile-message/lib/index.js"() {
      init_unist_util_stringify_position(), (VFileMessage = class extends Error {
        constructor(e2, t2, n3) {
          super(), "string" == typeof t2 && (n3 = t2, t2 = void 0);
          let r = "", i = {}, s2 = false;
          if (t2 && (i = "line" in t2 && "column" in t2 || "start" in t2 && "end" in t2 ? { place: t2 } : "type" in t2 ? { ancestors: [t2], place: t2.position } : { ...t2 }), "string" == typeof e2 ? r = e2 : !i.cause && e2 && (s2 = true, r = e2.message, i.cause = e2), !i.ruleId && !i.source && "string" == typeof n3) {
            const e3 = n3.indexOf(":");
            -1 === e3 ? i.ruleId = n3 : (i.source = n3.slice(0, e3), i.ruleId = n3.slice(e3 + 1));
          }
          if (!i.place && i.ancestors && i.ancestors) {
            const e3 = i.ancestors[i.ancestors.length - 1];
            e3 && (i.place = e3.position);
          }
          const a = i.place && "start" in i.place ? i.place.start : i.place;
          var o;
          this.ancestors = i.ancestors || void 0, this.cause = i.cause || void 0, this.column = a ? a.column : void 0, this.fatal = void 0, this.file = "", this.message = r, this.line = a ? a.line : void 0, this.name = ((o = i.place) && "object" == typeof o ? "position" in o || "type" in o ? position(o.position) : "start" in o || "end" in o ? position(o) : "line" in o || "column" in o ? point(o) : "" : "") || "1:1", this.place = i.place || void 0, this.reason = this.message, this.ruleId = i.ruleId || void 0, this.source = i.source || void 0, this.stack = s2 && i.cause && "string" == typeof i.cause.stack ? i.cause.stack : "", this.actual = void 0, this.expected = void 0, this.note = void 0, this.url = void 0;
        }
      }).prototype.file = "", VFileMessage.prototype.name = "", VFileMessage.prototype.reason = "", VFileMessage.prototype.message = "", VFileMessage.prototype.stack = "", VFileMessage.prototype.column = void 0, VFileMessage.prototype.line = void 0, VFileMessage.prototype.ancestors = void 0, VFileMessage.prototype.cause = void 0, VFileMessage.prototype.fatal = void 0, VFileMessage.prototype.place = void 0, VFileMessage.prototype.ruleId = void 0, VFileMessage.prototype.source = void 0;
    } });
    var init_vfile_message = __esm2({ "node_modules/vfile-message/index.js"() {
      init_lib3();
    } });
    var init_minpath = __esm2({ "node_modules/vfile/lib/minpath.js"() {
      import_node_path = __toESM3(require("path"), 1);
    } });
    var init_minproc = __esm2({ "node_modules/vfile/lib/minproc.js"() {
      import_node_process = __toESM3(require("process"), 1);
    } });
    function isUrl(e2) {
      return Boolean(null !== e2 && "object" == typeof e2 && "href" in e2 && e2.href && "protocol" in e2 && e2.protocol && void 0 === e2.auth);
    }
    var import_node_url;
    var order;
    var VFile;
    var init_minurl_shared = __esm2({ "node_modules/vfile/lib/minurl.shared.js"() {
    } });
    var init_minurl = __esm2({ "node_modules/vfile/lib/minurl.js"() {
      import_node_url = require("url"), init_minurl_shared();
    } });
    function assertPart(e2, t2) {
      if (e2 && e2.includes(import_node_path.default.sep)) throw new Error("`" + t2 + "` cannot be a path: did not expect `" + import_node_path.default.sep + "`");
    }
    function assertNonEmpty(e2, t2) {
      if (!e2) throw new Error("`" + t2 + "` cannot be empty");
    }
    function assertPath(e2, t2) {
      if (!e2) throw new Error("Setting `" + t2 + "` requires `path` to be set too");
    }
    var CallableInstance;
    var import_extend;
    var own2;
    var Processor;
    var unified;
    var init_lib4 = __esm2({ "node_modules/vfile/lib/index.js"() {
      init_vfile_message(), init_minpath(), init_minproc(), init_minurl(), order = ["history", "path", "basename", "stem", "extname", "dirname"], VFile = class {
        constructor(e2) {
          let t2;
          t2 = e2 ? isUrl(e2) ? { path: e2 } : "string" == typeof e2 || function(e3) {
            return Boolean(e3 && "object" == typeof e3 && "byteLength" in e3 && "byteOffset" in e3);
          }(e2) ? { value: e2 } : e2 : {}, this.cwd = "cwd" in t2 ? "" : import_node_process.default.cwd(), this.data = {}, this.history = [], this.messages = [], this.value, this.map, this.result, this.stored;
          let n3, r = -1;
          for (; ++r < order.length; ) {
            const e3 = order[r];
            e3 in t2 && void 0 !== t2[e3] && null !== t2[e3] && (this[e3] = "history" === e3 ? [...t2[e3]] : t2[e3]);
          }
          for (n3 in t2) order.includes(n3) || (this[n3] = t2[n3]);
        }
        get basename() {
          return "string" == typeof this.path ? import_node_path.default.basename(this.path) : void 0;
        }
        set basename(e2) {
          assertNonEmpty(e2, "basename"), assertPart(e2, "basename"), this.path = import_node_path.default.join(this.dirname || "", e2);
        }
        get dirname() {
          return "string" == typeof this.path ? import_node_path.default.dirname(this.path) : void 0;
        }
        set dirname(e2) {
          assertPath(this.basename, "dirname"), this.path = import_node_path.default.join(e2 || "", this.basename);
        }
        get extname() {
          return "string" == typeof this.path ? import_node_path.default.extname(this.path) : void 0;
        }
        set extname(e2) {
          if (assertPart(e2, "extname"), assertPath(this.dirname, "extname"), e2) {
            if (46 !== e2.codePointAt(0)) throw new Error("`extname` must start with `.`");
            if (e2.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots");
          }
          this.path = import_node_path.default.join(this.dirname, this.stem + (e2 || ""));
        }
        get path() {
          return this.history[this.history.length - 1];
        }
        set path(e2) {
          isUrl(e2) && (e2 = (0, import_node_url.fileURLToPath)(e2)), assertNonEmpty(e2, "path"), this.path !== e2 && this.history.push(e2);
        }
        get stem() {
          return "string" == typeof this.path ? import_node_path.default.basename(this.path, this.extname) : void 0;
        }
        set stem(e2) {
          assertNonEmpty(e2, "stem"), assertPart(e2, "stem"), this.path = import_node_path.default.join(this.dirname || "", e2 + (this.extname || ""));
        }
        fail(e2, t2, n3) {
          const r = this.message(e2, t2, n3);
          throw r.fatal = true, r;
        }
        info(e2, t2, n3) {
          const r = this.message(e2, t2, n3);
          return r.fatal = void 0, r;
        }
        message(e2, t2, n3) {
          const r = new VFileMessage(e2, t2, n3);
          return this.path && (r.name = this.path + ":" + r.name, r.file = this.path), r.fatal = false, this.messages.push(r), r;
        }
        toString(e2) {
          return void 0 === this.value ? "" : "string" == typeof this.value ? this.value : new TextDecoder(e2 || void 0).decode(this.value);
        }
      };
    } });
    var init_vfile = __esm2({ "node_modules/vfile/index.js"() {
      init_lib4();
    } });
    var init_callable_instance = __esm2({ "node_modules/unified/lib/callable-instance.js"() {
      CallableInstance = function(e2) {
        const t2 = this.constructor.prototype, n3 = t2[e2], r = function() {
          return n3.apply(r, arguments);
        };
        return Object.setPrototypeOf(r, t2), r;
      };
    } });
    function assertParser(e2, t2) {
      if ("function" != typeof t2) throw new TypeError("Cannot `" + e2 + "` without `parser`");
    }
    function assertCompiler(e2, t2) {
      if ("function" != typeof t2) throw new TypeError("Cannot `" + e2 + "` without `compiler`");
    }
    function assertUnfrozen(e2, t2) {
      if (t2) throw new Error("Cannot call `" + e2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.");
    }
    function assertNode(e2) {
      if (!isPlainObject2(e2) || "string" != typeof e2.type) throw new TypeError("Expected node, got `" + e2 + "`");
    }
    function assertDone(e2, t2, n3) {
      if (!n3) throw new Error("`" + e2 + "` finished async. Use `" + t2 + "` instead");
    }
    function vfile(e2) {
      return function(e3) {
        return Boolean(e3 && "object" == typeof e3 && "message" in e3 && "messages" in e3);
      }(e2) ? e2 : new VFile(e2);
    }
    var Schema;
    var init_lib5 = __esm2({ "node_modules/unified/lib/index.js"() {
      init_bail(), import_extend = __toESM3(require_extend(), 1), init_default(), init_is_plain_obj(), init_trough(), init_vfile(), init_callable_instance(), own2 = {}.hasOwnProperty, Processor = class e2 extends CallableInstance {
        constructor() {
          super("copy"), this.Compiler = void 0, this.Parser = void 0, this.attachers = [], this.compiler = void 0, this.freezeIndex = -1, this.frozen = void 0, this.namespace = {}, this.parser = void 0, this.transformers = /* @__PURE__ */ function() {
            const e3 = [], t2 = { run: function(...t3) {
              let n3 = -1;
              const r = t3.pop();
              if ("function" != typeof r) throw new TypeError("Expected function as last argument, not " + r);
              !function i(s2, ...a) {
                const o = e3[++n3];
                let l = -1;
                if (s2) r(s2);
                else {
                  for (; ++l < t3.length; ) null !== a[l] && void 0 !== a[l] || (a[l] = t3[l]);
                  t3 = a, o ? (/* @__PURE__ */ function(e4, t4) {
                    let n4;
                    return function(...t5) {
                      const s3 = e4.length > t5.length;
                      let a2;
                      s3 && t5.push(r3);
                      try {
                        a2 = e4.apply(this, t5);
                      } catch (e5) {
                        if (s3 && n4) throw e5;
                        return r3(e5);
                      }
                      s3 || (a2 && a2.then && "function" == typeof a2.then ? a2.then(i2, r3) : a2 instanceof Error ? r3(a2) : i2(a2));
                    };
                    function r3(e5, ...r4) {
                      n4 || (n4 = true, t4(e5, ...r4));
                    }
                    function i2(e5) {
                      r3(null, e5);
                    }
                  }(o, i))(...a) : r(null, ...a);
                }
              }(null, ...t3);
            }, use: function(n3) {
              if ("function" != typeof n3) throw new TypeError("Expected `middelware` to be a function, not " + n3);
              return e3.push(n3), t2;
            } };
            return t2;
          }();
        }
        copy() {
          const t2 = new e2();
          let n3 = -1;
          for (; ++n3 < this.attachers.length; ) {
            const e3 = this.attachers[n3];
            t2.use(...e3);
          }
          return t2.data((0, import_extend.default)(true, {}, this.namespace)), t2;
        }
        data(e3, t2) {
          return "string" == typeof e3 ? 2 === arguments.length ? (assertUnfrozen("data", this.frozen), this.namespace[e3] = t2, this) : own2.call(this.namespace, e3) && this.namespace[e3] || void 0 : e3 ? (assertUnfrozen("data", this.frozen), this.namespace = e3, this) : this.namespace;
        }
        freeze() {
          if (this.frozen) return this;
          const e3 = this;
          for (; ++this.freezeIndex < this.attachers.length; ) {
            const [t2, ...n3] = this.attachers[this.freezeIndex];
            if (false === n3[0]) continue;
            true === n3[0] && (n3[0] = void 0);
            const r = t2.call(e3, ...n3);
            "function" == typeof r && this.transformers.use(r);
          }
          return this.frozen = true, this.freezeIndex = Number.POSITIVE_INFINITY, this;
        }
        parse(e3) {
          this.freeze();
          const t2 = vfile(e3), n3 = this.parser || this.Parser;
          return assertParser("parse", n3), n3(String(t2), t2);
        }
        process(e3, t2) {
          const n3 = this;
          return this.freeze(), assertParser("process", this.parser || this.Parser), assertCompiler("process", this.compiler || this.Compiler), t2 ? r(void 0, t2) : new Promise(r);
          function r(r3, i) {
            const s2 = vfile(e3), a = n3.parse(s2);
            function o(e4, n4) {
              e4 || !n4 ? i(e4) : r3 ? r3(n4) : t2(void 0, n4);
            }
            n3.run(a, s2, function(e4, t3, r4) {
              if (e4 || !t3 || !r4) return o(e4);
              const i2 = t3, s3 = n3.stringify(i2, r4);
              var a2;
              "string" == typeof (a2 = s3) || function(e5) {
                return Boolean(e5 && "object" == typeof e5 && "byteLength" in e5 && "byteOffset" in e5);
              }(a2) ? r4.value = s3 : r4.result = s3, o(e4, r4);
            });
          }
        }
        processSync(e3) {
          let t2, n3 = false;
          return this.freeze(), assertParser("processSync", this.parser || this.Parser), assertCompiler("processSync", this.compiler || this.Compiler), this.process(e3, function(e4, r) {
            n3 = true, bail(e4), t2 = r;
          }), assertDone("processSync", "process", n3), t2;
        }
        run(e3, t2, n3) {
          assertNode(e3), this.freeze();
          const r = this.transformers;
          return n3 || "function" != typeof t2 || (n3 = t2, t2 = void 0), n3 ? i(void 0, n3) : new Promise(i);
          function i(i2, s2) {
            const a = vfile(t2);
            r.run(e3, a, function(t3, r3, a2) {
              const o = r3 || e3;
              t3 ? s2(t3) : i2 ? i2(o) : n3(void 0, o, a2);
            });
          }
        }
        runSync(e3, t2) {
          let n3, r = false;
          return this.run(e3, t2, function(e4, t3) {
            bail(e4), n3 = t3, r = true;
          }), assertDone("runSync", "run", r), n3;
        }
        stringify(e3, t2) {
          this.freeze();
          const n3 = vfile(t2), r = this.compiler || this.Compiler;
          return assertCompiler("stringify", r), assertNode(e3), r(e3, n3);
        }
        use(e3, ...t2) {
          const n3 = this.attachers, r = this.namespace;
          if (assertUnfrozen("use", this.frozen), null == e3) ;
          else if ("function" == typeof e3) o(e3, t2);
          else {
            if ("object" != typeof e3) throw new TypeError("Expected usable value, not `" + e3 + "`");
            Array.isArray(e3) ? a(e3) : s2(e3);
          }
          return this;
          function i(e4) {
            if ("function" == typeof e4) o(e4, []);
            else {
              if ("object" != typeof e4) throw new TypeError("Expected usable value, not `" + e4 + "`");
              if (Array.isArray(e4)) {
                const [t3, ...n4] = e4;
                o(t3, n4);
              } else s2(e4);
            }
          }
          function s2(e4) {
            if (!("plugins" in e4) && !("settings" in e4)) throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");
            a(e4.plugins), e4.settings && (r.settings = (0, import_extend.default)(true, r.settings, e4.settings));
          }
          function a(e4) {
            let t3 = -1;
            if (null == e4) ;
            else {
              if (!Array.isArray(e4)) throw new TypeError("Expected a list of plugins, not `" + e4 + "`");
              for (; ++t3 < e4.length; ) i(e4[t3]);
            }
          }
          function o(e4, t3) {
            let r3 = -1, i2 = -1;
            for (; ++r3 < n3.length; ) if (n3[r3][0] === e4) {
              i2 = r3;
              break;
            }
            if (-1 === i2) n3.push([e4, ...t3]);
            else if (t3.length > 0) {
              let [r4, ...s3] = t3;
              const a2 = n3[i2][1];
              isPlainObject2(a2) && isPlainObject2(r4) && (r4 = (0, import_extend.default)(true, a2, r4)), n3[i2] = [e4, r4, ...s3];
            }
          }
        }
      }, unified = new Processor().freeze();
    } });
    var init_unified = __esm2({ "node_modules/unified/index.js"() {
      init_lib5();
    } });
    var init_schema = __esm2({ "node_modules/property-information/lib/util/schema.js"() {
      (Schema = class {
        constructor(e2, t2, n3) {
          this.normal = t2, this.property = e2, n3 && (this.space = n3);
        }
      }).prototype.normal = {}, Schema.prototype.property = {}, Schema.prototype.space = void 0;
    } });
    function merge2(e2, t2) {
      const n3 = {}, r = {};
      for (const t3 of e2) Object.assign(n3, t3.property), Object.assign(r, t3.normal);
      return new Schema(n3, r, t2);
    }
    var init_merge = __esm2({ "node_modules/property-information/lib/util/merge.js"() {
      init_schema();
    } });
    function normalize22(e2) {
      return e2.toLowerCase();
    }
    var Info4;
    var powers;
    var boolean;
    var booleanish;
    var overloadedBoolean;
    var number;
    var spaceSeparated;
    var commaSeparated;
    var commaOrSpaceSeparated;
    var init_normalize = __esm2({ "node_modules/property-information/lib/normalize.js"() {
    } });
    var init_info2 = __esm2({ "node_modules/property-information/lib/util/info.js"() {
      (Info4 = class {
        constructor(e2, t2) {
          this.attribute = t2, this.property = e2;
        }
      }).prototype.attribute = "", Info4.prototype.booleanish = false, Info4.prototype.boolean = false, Info4.prototype.commaOrSpaceSeparated = false, Info4.prototype.commaSeparated = false, Info4.prototype.defined = false, Info4.prototype.mustUseProperty = false, Info4.prototype.number = false, Info4.prototype.overloadedBoolean = false, Info4.prototype.property = "", Info4.prototype.spaceSeparated = false, Info4.prototype.space = void 0;
    } });
    var types_exports = {};
    function increment2() {
      return 2 ** ++powers;
    }
    __export3(types_exports, { boolean: () => boolean, booleanish: () => booleanish, commaOrSpaceSeparated: () => commaOrSpaceSeparated, commaSeparated: () => commaSeparated, number: () => number, overloadedBoolean: () => overloadedBoolean, spaceSeparated: () => spaceSeparated });
    var checks;
    var DefinedInfo;
    var init_types4 = __esm2({ "node_modules/property-information/lib/util/types.js"() {
      powers = 0, boolean = increment2(), booleanish = increment2(), overloadedBoolean = increment2(), number = increment2(), spaceSeparated = increment2(), commaSeparated = increment2(), commaOrSpaceSeparated = increment2();
    } });
    function mark(e2, t2, n3) {
      n3 && (e2[t2] = n3);
    }
    var init_defined_info = __esm2({ "node_modules/property-information/lib/util/defined-info.js"() {
      init_info2(), init_types4(), checks = Object.keys(types_exports), (DefinedInfo = class extends Info4 {
        constructor(e2, t2, n3, r) {
          let i = -1;
          if (super(e2, t2), mark(this, "space", r), "number" == typeof n3) for (; ++i < checks.length; ) {
            const e3 = checks[i];
            mark(this, checks[i], (n3 & types_exports[e3]) === types_exports[e3]);
          }
        }
      }).prototype.defined = true;
    } });
    function create(e2) {
      const t2 = {}, n3 = {};
      for (const [r, i] of Object.entries(e2.properties)) {
        const s2 = new DefinedInfo(r, e2.transform(e2.attributes || {}, r), i, e2.space);
        e2.mustUseProperty && e2.mustUseProperty.includes(r) && (s2.mustUseProperty = true), t2[r] = s2, n3[normalize22(r)] = r, n3[normalize22(s2.attribute)] = r;
      }
      return new Schema(t2, n3, e2.space);
    }
    var aria;
    var init_create = __esm2({ "node_modules/property-information/lib/util/create.js"() {
      init_normalize(), init_defined_info(), init_schema();
    } });
    var init_aria = __esm2({ "node_modules/property-information/lib/aria.js"() {
      init_create(), init_types4(), aria = create({ properties: { ariaActiveDescendant: null, ariaAtomic: booleanish, ariaAutoComplete: null, ariaBusy: booleanish, ariaChecked: booleanish, ariaColCount: number, ariaColIndex: number, ariaColSpan: number, ariaControls: spaceSeparated, ariaCurrent: null, ariaDescribedBy: spaceSeparated, ariaDetails: null, ariaDisabled: booleanish, ariaDropEffect: spaceSeparated, ariaErrorMessage: null, ariaExpanded: booleanish, ariaFlowTo: spaceSeparated, ariaGrabbed: booleanish, ariaHasPopup: null, ariaHidden: booleanish, ariaInvalid: null, ariaKeyShortcuts: null, ariaLabel: null, ariaLabelledBy: spaceSeparated, ariaLevel: number, ariaLive: null, ariaModal: booleanish, ariaMultiLine: booleanish, ariaMultiSelectable: booleanish, ariaOrientation: null, ariaOwns: spaceSeparated, ariaPlaceholder: null, ariaPosInSet: number, ariaPressed: booleanish, ariaReadOnly: booleanish, ariaRelevant: null, ariaRequired: booleanish, ariaRoleDescription: spaceSeparated, ariaRowCount: number, ariaRowIndex: number, ariaRowSpan: number, ariaSelected: booleanish, ariaSetSize: number, ariaSort: null, ariaValueMax: number, ariaValueMin: number, ariaValueNow: number, ariaValueText: null, role: null }, transform: (e2, t2) => "role" === t2 ? t2 : "aria-" + t2.slice(4).toLowerCase() });
    } });
    function caseSensitiveTransform(e2, t2) {
      return t2 in e2 ? e2[t2] : t2;
    }
    var init_case_sensitive_transform = __esm2({ "node_modules/property-information/lib/util/case-sensitive-transform.js"() {
    } });
    function caseInsensitiveTransform(e2, t2) {
      return caseSensitiveTransform(e2, t2.toLowerCase());
    }
    var html2;
    var svg;
    var xlink;
    var xmlns;
    var xml;
    var cap;
    var dash;
    var valid;
    var init_case_insensitive_transform = __esm2({ "node_modules/property-information/lib/util/case-insensitive-transform.js"() {
      init_case_sensitive_transform();
    } });
    var init_html2 = __esm2({ "node_modules/property-information/lib/html.js"() {
      init_case_insensitive_transform(), init_create(), init_types4(), html2 = create({ attributes: { acceptcharset: "accept-charset", classname: "class", htmlfor: "for", httpequiv: "http-equiv" }, mustUseProperty: ["checked", "multiple", "muted", "selected"], properties: { abbr: null, accept: commaSeparated, acceptCharset: spaceSeparated, accessKey: spaceSeparated, action: null, allow: null, allowFullScreen: boolean, allowPaymentRequest: boolean, allowUserMedia: boolean, alt: null, as: null, async: boolean, autoCapitalize: null, autoComplete: spaceSeparated, autoFocus: boolean, autoPlay: boolean, blocking: spaceSeparated, capture: null, charSet: null, checked: boolean, cite: null, className: spaceSeparated, cols: number, colSpan: null, content: null, contentEditable: booleanish, controls: boolean, controlsList: spaceSeparated, coords: number | commaSeparated, crossOrigin: null, data: null, dateTime: null, decoding: null, default: boolean, defer: boolean, dir: null, dirName: null, disabled: boolean, download: overloadedBoolean, draggable: booleanish, encType: null, enterKeyHint: null, fetchPriority: null, form: null, formAction: null, formEncType: null, formMethod: null, formNoValidate: boolean, formTarget: null, headers: spaceSeparated, height: number, hidden: overloadedBoolean, high: number, href: null, hrefLang: null, htmlFor: spaceSeparated, httpEquiv: spaceSeparated, id: null, imageSizes: null, imageSrcSet: null, inert: boolean, inputMode: null, integrity: null, is: null, isMap: boolean, itemId: null, itemProp: spaceSeparated, itemRef: spaceSeparated, itemScope: boolean, itemType: spaceSeparated, kind: null, label: null, lang: null, language: null, list: null, loading: null, loop: boolean, low: number, manifest: null, max: null, maxLength: number, media: null, method: null, min: null, minLength: number, multiple: boolean, muted: boolean, name: null, nonce: null, noModule: boolean, noValidate: boolean, onAbort: null, onAfterPrint: null, onAuxClick: null, onBeforeMatch: null, onBeforePrint: null, onBeforeToggle: null, onBeforeUnload: null, onBlur: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onContextLost: null, onContextMenu: null, onContextRestored: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnded: null, onError: null, onFocus: null, onFormData: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLanguageChange: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadEnd: null, onLoadStart: null, onMessage: null, onMessageError: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRejectionHandled: null, onReset: null, onResize: null, onScroll: null, onScrollEnd: null, onSecurityPolicyViolation: null, onSeeked: null, onSeeking: null, onSelect: null, onSlotChange: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnhandledRejection: null, onUnload: null, onVolumeChange: null, onWaiting: null, onWheel: null, open: boolean, optimum: number, pattern: null, ping: spaceSeparated, placeholder: null, playsInline: boolean, popover: null, popoverTarget: null, popoverTargetAction: null, poster: null, preload: null, readOnly: boolean, referrerPolicy: null, rel: spaceSeparated, required: boolean, reversed: boolean, rows: number, rowSpan: number, sandbox: spaceSeparated, scope: null, scoped: boolean, seamless: boolean, selected: boolean, shadowRootClonable: boolean, shadowRootDelegatesFocus: boolean, shadowRootMode: null, shape: null, size: number, sizes: null, slot: null, span: number, spellCheck: booleanish, src: null, srcDoc: null, srcLang: null, srcSet: null, start: number, step: null, style: null, tabIndex: number, target: null, title: null, translate: null, type: null, typeMustMatch: boolean, useMap: null, value: booleanish, width: number, wrap: null, writingSuggestions: null, align: null, aLink: null, archive: spaceSeparated, axis: null, background: null, bgColor: null, border: number, borderColor: null, bottomMargin: number, cellPadding: null, cellSpacing: null, char: null, charOff: null, classId: null, clear: null, code: null, codeBase: null, codeType: null, color: null, compact: boolean, declare: boolean, event: null, face: null, frame: null, frameBorder: null, hSpace: number, leftMargin: number, link: null, longDesc: null, lowSrc: null, marginHeight: number, marginWidth: number, noResize: boolean, noHref: boolean, noShade: boolean, noWrap: boolean, object: null, profile: null, prompt: null, rev: null, rightMargin: number, rules: null, scheme: null, scrolling: booleanish, standby: null, summary: null, text: null, topMargin: number, valueType: null, version: null, vAlign: null, vLink: null, vSpace: number, allowTransparency: null, autoCorrect: null, autoSave: null, disablePictureInPicture: boolean, disableRemotePlayback: boolean, prefix: null, property: null, results: number, security: null, unselectable: null }, space: "html", transform: caseInsensitiveTransform });
    } });
    var init_svg = __esm2({ "node_modules/property-information/lib/svg.js"() {
      init_case_sensitive_transform(), init_create(), init_types4(), svg = create({ attributes: { accentHeight: "accent-height", alignmentBaseline: "alignment-baseline", arabicForm: "arabic-form", baselineShift: "baseline-shift", capHeight: "cap-height", className: "class", clipPath: "clip-path", clipRule: "clip-rule", colorInterpolation: "color-interpolation", colorInterpolationFilters: "color-interpolation-filters", colorProfile: "color-profile", colorRendering: "color-rendering", crossOrigin: "crossorigin", dataType: "datatype", dominantBaseline: "dominant-baseline", enableBackground: "enable-background", fillOpacity: "fill-opacity", fillRule: "fill-rule", floodColor: "flood-color", floodOpacity: "flood-opacity", fontFamily: "font-family", fontSize: "font-size", fontSizeAdjust: "font-size-adjust", fontStretch: "font-stretch", fontStyle: "font-style", fontVariant: "font-variant", fontWeight: "font-weight", glyphName: "glyph-name", glyphOrientationHorizontal: "glyph-orientation-horizontal", glyphOrientationVertical: "glyph-orientation-vertical", hrefLang: "hreflang", horizAdvX: "horiz-adv-x", horizOriginX: "horiz-origin-x", horizOriginY: "horiz-origin-y", imageRendering: "image-rendering", letterSpacing: "letter-spacing", lightingColor: "lighting-color", markerEnd: "marker-end", markerMid: "marker-mid", markerStart: "marker-start", navDown: "nav-down", navDownLeft: "nav-down-left", navDownRight: "nav-down-right", navLeft: "nav-left", navNext: "nav-next", navPrev: "nav-prev", navRight: "nav-right", navUp: "nav-up", navUpLeft: "nav-up-left", navUpRight: "nav-up-right", onAbort: "onabort", onActivate: "onactivate", onAfterPrint: "onafterprint", onBeforePrint: "onbeforeprint", onBegin: "onbegin", onCancel: "oncancel", onCanPlay: "oncanplay", onCanPlayThrough: "oncanplaythrough", onChange: "onchange", onClick: "onclick", onClose: "onclose", onCopy: "oncopy", onCueChange: "oncuechange", onCut: "oncut", onDblClick: "ondblclick", onDrag: "ondrag", onDragEnd: "ondragend", onDragEnter: "ondragenter", onDragExit: "ondragexit", onDragLeave: "ondragleave", onDragOver: "ondragover", onDragStart: "ondragstart", onDrop: "ondrop", onDurationChange: "ondurationchange", onEmptied: "onemptied", onEnd: "onend", onEnded: "onended", onError: "onerror", onFocus: "onfocus", onFocusIn: "onfocusin", onFocusOut: "onfocusout", onHashChange: "onhashchange", onInput: "oninput", onInvalid: "oninvalid", onKeyDown: "onkeydown", onKeyPress: "onkeypress", onKeyUp: "onkeyup", onLoad: "onload", onLoadedData: "onloadeddata", onLoadedMetadata: "onloadedmetadata", onLoadStart: "onloadstart", onMessage: "onmessage", onMouseDown: "onmousedown", onMouseEnter: "onmouseenter", onMouseLeave: "onmouseleave", onMouseMove: "onmousemove", onMouseOut: "onmouseout", onMouseOver: "onmouseover", onMouseUp: "onmouseup", onMouseWheel: "onmousewheel", onOffline: "onoffline", onOnline: "ononline", onPageHide: "onpagehide", onPageShow: "onpageshow", onPaste: "onpaste", onPause: "onpause", onPlay: "onplay", onPlaying: "onplaying", onPopState: "onpopstate", onProgress: "onprogress", onRateChange: "onratechange", onRepeat: "onrepeat", onReset: "onreset", onResize: "onresize", onScroll: "onscroll", onSeeked: "onseeked", onSeeking: "onseeking", onSelect: "onselect", onShow: "onshow", onStalled: "onstalled", onStorage: "onstorage", onSubmit: "onsubmit", onSuspend: "onsuspend", onTimeUpdate: "ontimeupdate", onToggle: "ontoggle", onUnload: "onunload", onVolumeChange: "onvolumechange", onWaiting: "onwaiting", onZoom: "onzoom", overlinePosition: "overline-position", overlineThickness: "overline-thickness", paintOrder: "paint-order", panose1: "panose-1", pointerEvents: "pointer-events", referrerPolicy: "referrerpolicy", renderingIntent: "rendering-intent", shapeRendering: "shape-rendering", stopColor: "stop-color", stopOpacity: "stop-opacity", strikethroughPosition: "strikethrough-position", strikethroughThickness: "strikethrough-thickness", strokeDashArray: "stroke-dasharray", strokeDashOffset: "stroke-dashoffset", strokeLineCap: "stroke-linecap", strokeLineJoin: "stroke-linejoin", strokeMiterLimit: "stroke-miterlimit", strokeOpacity: "stroke-opacity", strokeWidth: "stroke-width", tabIndex: "tabindex", textAnchor: "text-anchor", textDecoration: "text-decoration", textRendering: "text-rendering", transformOrigin: "transform-origin", typeOf: "typeof", underlinePosition: "underline-position", underlineThickness: "underline-thickness", unicodeBidi: "unicode-bidi", unicodeRange: "unicode-range", unitsPerEm: "units-per-em", vAlphabetic: "v-alphabetic", vHanging: "v-hanging", vIdeographic: "v-ideographic", vMathematical: "v-mathematical", vectorEffect: "vector-effect", vertAdvY: "vert-adv-y", vertOriginX: "vert-origin-x", vertOriginY: "vert-origin-y", wordSpacing: "word-spacing", writingMode: "writing-mode", xHeight: "x-height", playbackOrder: "playbackorder", timelineBegin: "timelinebegin" }, properties: { about: commaOrSpaceSeparated, accentHeight: number, accumulate: null, additive: null, alignmentBaseline: null, alphabetic: number, amplitude: number, arabicForm: null, ascent: number, attributeName: null, attributeType: null, azimuth: number, bandwidth: null, baselineShift: null, baseFrequency: null, baseProfile: null, bbox: null, begin: null, bias: number, by: null, calcMode: null, capHeight: number, className: spaceSeparated, clip: null, clipPath: null, clipPathUnits: null, clipRule: null, color: null, colorInterpolation: null, colorInterpolationFilters: null, colorProfile: null, colorRendering: null, content: null, contentScriptType: null, contentStyleType: null, crossOrigin: null, cursor: null, cx: null, cy: null, d: null, dataType: null, defaultAction: null, descent: number, diffuseConstant: number, direction: null, display: null, dur: null, divisor: number, dominantBaseline: null, download: boolean, dx: null, dy: null, edgeMode: null, editable: null, elevation: number, enableBackground: null, end: null, event: null, exponent: number, externalResourcesRequired: null, fill: null, fillOpacity: number, fillRule: null, filter: null, filterRes: null, filterUnits: null, floodColor: null, floodOpacity: null, focusable: null, focusHighlight: null, fontFamily: null, fontSize: null, fontSizeAdjust: null, fontStretch: null, fontStyle: null, fontVariant: null, fontWeight: null, format: null, fr: null, from: null, fx: null, fy: null, g1: commaSeparated, g2: commaSeparated, glyphName: commaSeparated, glyphOrientationHorizontal: null, glyphOrientationVertical: null, glyphRef: null, gradientTransform: null, gradientUnits: null, handler: null, hanging: number, hatchContentUnits: null, hatchUnits: null, height: null, href: null, hrefLang: null, horizAdvX: number, horizOriginX: number, horizOriginY: number, id: null, ideographic: number, imageRendering: null, initialVisibility: null, in: null, in2: null, intercept: number, k: number, k1: number, k2: number, k3: number, k4: number, kernelMatrix: commaOrSpaceSeparated, kernelUnitLength: null, keyPoints: null, keySplines: null, keyTimes: null, kerning: null, lang: null, lengthAdjust: null, letterSpacing: null, lightingColor: null, limitingConeAngle: number, local: null, markerEnd: null, markerMid: null, markerStart: null, markerHeight: null, markerUnits: null, markerWidth: null, mask: null, maskContentUnits: null, maskUnits: null, mathematical: null, max: null, media: null, mediaCharacterEncoding: null, mediaContentEncodings: null, mediaSize: number, mediaTime: null, method: null, min: null, mode: null, name: null, navDown: null, navDownLeft: null, navDownRight: null, navLeft: null, navNext: null, navPrev: null, navRight: null, navUp: null, navUpLeft: null, navUpRight: null, numOctaves: null, observer: null, offset: null, onAbort: null, onActivate: null, onAfterPrint: null, onBeforePrint: null, onBegin: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnd: null, onEnded: null, onError: null, onFocus: null, onFocusIn: null, onFocusOut: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadStart: null, onMessage: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onMouseWheel: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRepeat: null, onReset: null, onResize: null, onScroll: null, onSeeked: null, onSeeking: null, onSelect: null, onShow: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnload: null, onVolumeChange: null, onWaiting: null, onZoom: null, opacity: null, operator: null, order: null, orient: null, orientation: null, origin: null, overflow: null, overlay: null, overlinePosition: number, overlineThickness: number, paintOrder: null, panose1: null, path: null, pathLength: number, patternContentUnits: null, patternTransform: null, patternUnits: null, phase: null, ping: spaceSeparated, pitch: null, playbackOrder: null, pointerEvents: null, points: null, pointsAtX: number, pointsAtY: number, pointsAtZ: number, preserveAlpha: null, preserveAspectRatio: null, primitiveUnits: null, propagate: null, property: commaOrSpaceSeparated, r: null, radius: null, referrerPolicy: null, refX: null, refY: null, rel: commaOrSpaceSeparated, rev: commaOrSpaceSeparated, renderingIntent: null, repeatCount: null, repeatDur: null, requiredExtensions: commaOrSpaceSeparated, requiredFeatures: commaOrSpaceSeparated, requiredFonts: commaOrSpaceSeparated, requiredFormats: commaOrSpaceSeparated, resource: null, restart: null, result: null, rotate: null, rx: null, ry: null, scale: null, seed: null, shapeRendering: null, side: null, slope: null, snapshotTime: null, specularConstant: number, specularExponent: number, spreadMethod: null, spacing: null, startOffset: null, stdDeviation: null, stemh: null, stemv: null, stitchTiles: null, stopColor: null, stopOpacity: null, strikethroughPosition: number, strikethroughThickness: number, string: null, stroke: null, strokeDashArray: commaOrSpaceSeparated, strokeDashOffset: null, strokeLineCap: null, strokeLineJoin: null, strokeMiterLimit: number, strokeOpacity: number, strokeWidth: null, style: null, surfaceScale: number, syncBehavior: null, syncBehaviorDefault: null, syncMaster: null, syncTolerance: null, syncToleranceDefault: null, systemLanguage: commaOrSpaceSeparated, tabIndex: number, tableValues: null, target: null, targetX: number, targetY: number, textAnchor: null, textDecoration: null, textRendering: null, textLength: null, timelineBegin: null, title: null, transformBehavior: null, type: null, typeOf: commaOrSpaceSeparated, to: null, transform: null, transformOrigin: null, u1: null, u2: null, underlinePosition: number, underlineThickness: number, unicode: null, unicodeBidi: null, unicodeRange: null, unitsPerEm: number, values: null, vAlphabetic: number, vMathematical: number, vectorEffect: null, vHanging: number, vIdeographic: number, version: null, vertAdvY: number, vertOriginX: number, vertOriginY: number, viewBox: null, viewTarget: null, visibility: null, width: null, widths: null, wordSpacing: null, writingMode: null, x: null, x1: null, x2: null, xChannelSelector: null, xHeight: number, y: null, y1: null, y2: null, yChannelSelector: null, z: null, zoomAndPan: null }, space: "svg", transform: caseSensitiveTransform });
    } });
    var init_xlink = __esm2({ "node_modules/property-information/lib/xlink.js"() {
      init_create(), xlink = create({ properties: { xLinkActuate: null, xLinkArcRole: null, xLinkHref: null, xLinkRole: null, xLinkShow: null, xLinkTitle: null, xLinkType: null }, space: "xlink", transform: (e2, t2) => "xlink:" + t2.slice(5).toLowerCase() });
    } });
    var init_xmlns = __esm2({ "node_modules/property-information/lib/xmlns.js"() {
      init_create(), init_case_insensitive_transform(), xmlns = create({ attributes: { xmlnsxlink: "xmlns:xlink" }, properties: { xmlnsXLink: null, xmlns: null }, space: "xmlns", transform: caseInsensitiveTransform });
    } });
    var init_xml = __esm2({ "node_modules/property-information/lib/xml.js"() {
      init_create(), xml = create({ properties: { xmlBase: null, xmlLang: null, xmlSpace: null }, space: "xml", transform: (e2, t2) => "xml:" + t2.slice(3).toLowerCase() });
    } });
    function find2(e2, t2) {
      const n3 = normalize22(t2);
      let r = t2, i = Info4;
      if (n3 in e2.normal) return e2.property[e2.normal[n3]];
      if (n3.length > 4 && "data" === n3.slice(0, 4) && valid.test(t2)) {
        if ("-" === t2.charAt(4)) {
          const e3 = t2.slice(5).replace(dash, camelcase);
          r = "data" + e3.charAt(0).toUpperCase() + e3.slice(1);
        } else {
          const e3 = t2.slice(4);
          if (!dash.test(e3)) {
            let n4 = e3.replace(cap, kebab);
            "-" !== n4.charAt(0) && (n4 = "-" + n4), t2 = "data" + n4;
          }
        }
        i = DefinedInfo;
      }
      return new i(r, t2);
    }
    function kebab(e2) {
      return "-" + e2.toLowerCase();
    }
    function camelcase(e2) {
      return e2.charAt(1).toUpperCase();
    }
    var html22;
    var svg2;
    var init_find = __esm2({ "node_modules/property-information/lib/find.js"() {
      init_defined_info(), init_info2(), init_normalize(), cap = /[A-Z]/g, dash = /-[a-z]/g, valid = /^data[-\w.:]+$/i;
    } });
    var init_property_information = __esm2({ "node_modules/property-information/index.js"() {
      init_merge(), init_aria(), init_html2(), init_svg(), init_xlink(), init_xmlns(), init_xml(), init_find(), init_normalize(), html22 = merge2([aria, html2, xlink, xmlns, xml], "html"), svg2 = merge2([aria, svg, xlink, xmlns, xml], "svg");
    } });
    function parse2(e2) {
      const t2 = [], n3 = String(e2 || "");
      let r = n3.indexOf(","), i = 0, s2 = false;
      for (; !s2; ) {
        -1 === r && (r = n3.length, s2 = true);
        const e3 = n3.slice(i, r).trim();
        !e3 && s2 || t2.push(e3), i = r + 1, r = n3.indexOf(",", i);
      }
      return t2;
    }
    function stringify3(e2, t2) {
      const n3 = t2 || {};
      return ("" === e2[e2.length - 1] ? [...e2, ""] : e2).join((n3.padRight ? " " : "") + "," + (false === n3.padLeft ? "" : " ")).trim();
    }
    var search;
    var init_comma_separated_tokens = __esm2({ "node_modules/comma-separated-tokens/index.js"() {
    } });
    var init_lib6 = __esm2({ "node_modules/hast-util-parse-selector/lib/index.js"() {
      search = /[#.]/g;
    } });
    var init_hast_util_parse_selector = __esm2({ "node_modules/hast-util-parse-selector/index.js"() {
      init_lib6();
    } });
    function parse22(e2) {
      const t2 = String(e2 || "").trim();
      return t2 ? t2.split(/[ \t\n\r\f]+/g) : [];
    }
    function stringify22(e2) {
      return e2.join(" ").trim();
    }
    var init_space_separated_tokens = __esm2({ "node_modules/space-separated-tokens/index.js"() {
    } });
    function createH(e2, t2, n3) {
      const r = n3 ? function(e3) {
        const t3 = /* @__PURE__ */ new Map();
        for (const n4 of e3) t3.set(n4.toLowerCase(), n4);
        return t3;
      }(n3) : void 0;
      return function(n4, i, ...s2) {
        let a;
        if (null == n4) {
          a = { type: "root", children: [] };
          const e3 = i;
          s2.unshift(e3);
        } else {
          a = function(e3, t3) {
            const n5 = e3 || "", r3 = {};
            let i2, s3, a2 = 0;
            for (; a2 < n5.length; ) {
              search.lastIndex = a2;
              const e4 = search.exec(n5), t4 = n5.slice(a2, e4 ? e4.index : n5.length);
              t4 && (i2 ? "#" === i2 ? r3.id = t4 : Array.isArray(r3.className) ? r3.className.push(t4) : r3.className = [t4] : s3 = t4, a2 += t4.length), e4 && (i2 = e4[0], a2++);
            }
            return { type: "element", tagName: s3 || t3 || "div", properties: r3, children: [] };
          }(n4, t2);
          const o = a.tagName.toLowerCase(), l = r ? r.get(o) : void 0;
          if (a.tagName = l || o, function(e3) {
            if (null === e3 || "object" != typeof e3 || Array.isArray(e3)) return true;
            if ("string" != typeof e3.type) return false;
            const t3 = e3, n5 = Object.keys(e3);
            for (const e4 of n5) {
              const n6 = t3[e4];
              if (n6 && "object" == typeof n6) {
                if (!Array.isArray(n6)) return true;
                const e5 = n6;
                for (const t4 of e5) if ("number" != typeof t4 && "string" != typeof t4) return true;
              }
            }
            return !(!("children" in e3) || !Array.isArray(e3.children));
          }(i)) s2.unshift(i);
          else for (const [t3, n5] of Object.entries(i)) addProperty(e2, a.properties, t3, n5);
        }
        for (const e3 of s2) addChild(a.children, e3);
        return "element" === a.type && "template" === a.tagName && (a.content = { type: "root", children: a.children }, a.children = []), a;
      };
    }
    function addProperty(e2, t2, n3, r) {
      const i = find2(e2, n3);
      let s2;
      if (null != r) {
        if ("number" == typeof r) {
          if (Number.isNaN(r)) return;
          s2 = r;
        } else s2 = "boolean" == typeof r ? r : "string" == typeof r ? i.spaceSeparated ? parse22(r) : i.commaSeparated ? parse2(r) : i.commaOrSpaceSeparated ? parse22(parse2(r).join(" ")) : parsePrimitive(i, i.property, r) : Array.isArray(r) ? [...r] : "style" === i.property ? function(e3) {
          const t3 = [];
          for (const [n4, r3] of Object.entries(e3)) t3.push([n4, r3].join(": "));
          return t3.join("; ");
        }(r) : String(r);
        if (Array.isArray(s2)) {
          const e3 = [];
          for (const t3 of s2) e3.push(parsePrimitive(i, i.property, t3));
          s2 = e3;
        }
        "className" === i.property && Array.isArray(t2.className) && (s2 = t2.className.concat(s2)), t2[i.property] = s2;
      }
    }
    function addChild(e2, t2) {
      if (null == t2) ;
      else if ("number" == typeof t2 || "string" == typeof t2) e2.push({ type: "text", value: String(t2) });
      else if (Array.isArray(t2)) for (const n3 of t2) addChild(e2, n3);
      else {
        if ("object" != typeof t2 || !("type" in t2)) throw new Error("Expected node, nodes, or string, got `" + t2 + "`");
        "root" === t2.type ? addChild(e2, t2.children) : e2.push(t2);
      }
    }
    function parsePrimitive(e2, t2, n3) {
      if ("string" == typeof n3) {
        if (e2.number && n3 && !Number.isNaN(Number(n3))) return Number(n3);
        if ((e2.boolean || e2.overloadedBoolean) && ("" === n3 || normalize22(n3) === normalize22(t2))) return true;
      }
      return n3;
    }
    var svgCaseSensitiveTagNames;
    var h2;
    var s;
    var init_create_h = __esm2({ "node_modules/hastscript/lib/create-h.js"() {
      init_comma_separated_tokens(), init_hast_util_parse_selector(), init_property_information(), init_space_separated_tokens();
    } });
    var init_svg_case_sensitive_tag_names = __esm2({ "node_modules/hastscript/lib/svg-case-sensitive-tag-names.js"() {
      svgCaseSensitiveTagNames = ["altGlyph", "altGlyphDef", "altGlyphItem", "animateColor", "animateMotion", "animateTransform", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "glyphRef", "linearGradient", "radialGradient", "solidColor", "textArea", "textPath"];
    } });
    var init_lib7 = __esm2({ "node_modules/hastscript/lib/index.js"() {
      init_property_information(), init_create_h(), init_svg_case_sensitive_tag_names(), h2 = createH(html22, "div"), s = createH(svg2, "g", svgCaseSensitiveTagNames);
    } });
    var init_hastscript = __esm2({ "node_modules/hastscript/index.js"() {
      init_lib7();
    } });
    function next2(e2, t2) {
      const n3 = e2.indexOf("\r", t2), r = e2.indexOf("\n", t2);
      return -1 === r ? n3 : -1 === n3 || n3 + 1 === r ? r : n3 < r ? n3 : r;
    }
    var webNamespaces;
    var own22;
    var proto;
    var init_lib8 = __esm2({ "node_modules/vfile-location/lib/index.js"() {
    } });
    var init_vfile_location = __esm2({ "node_modules/vfile-location/index.js"() {
      init_lib8();
    } });
    var init_web_namespaces = __esm2({ "node_modules/web-namespaces/index.js"() {
      webNamespaces = { html: "http://www.w3.org/1999/xhtml", mathml: "http://www.w3.org/1998/Math/MathML", svg: "http://www.w3.org/2000/svg", xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" };
    } });
    function one(e2, t2) {
      let n3;
      switch (t2.nodeName) {
        case "#comment": {
          const r = t2;
          return n3 = { type: "comment", value: r.data }, patch(e2, r, n3), n3;
        }
        case "#document":
        case "#document-fragment": {
          const r = t2, i = "mode" in r && ("quirks" === r.mode || "limited-quirks" === r.mode);
          if (n3 = { type: "root", children: all(e2, t2.childNodes), data: { quirksMode: i } }, e2.file && e2.location) {
            const t3 = String(e2.file), r3 = function(e3) {
              const t4 = String(e3), n4 = [];
              return { toOffset: function(e4) {
                if (e4 && "number" == typeof e4.line && "number" == typeof e4.column && !Number.isNaN(e4.line) && !Number.isNaN(e4.column)) {
                  for (; n4.length < e4.line; ) {
                    const e5 = n4[n4.length - 1], r5 = next2(t4, e5), i3 = -1 === r5 ? t4.length + 1 : r5 + 1;
                    if (e5 === i3) break;
                    n4.push(i3);
                  }
                  const r4 = (e4.line > 1 ? n4[e4.line - 2] : 0) + e4.column - 1;
                  if (r4 < n4[e4.line - 1]) return r4;
                }
              }, toPoint: function(e4) {
                if ("number" == typeof e4 && e4 > -1 && e4 <= t4.length) {
                  let r4 = 0;
                  for (; ; ) {
                    let i3 = n4[r4];
                    if (void 0 === i3) {
                      const e5 = next2(t4, n4[r4 - 1]);
                      i3 = -1 === e5 ? t4.length + 1 : e5 + 1, n4[r4] = i3;
                    }
                    if (i3 > e4) return { line: r4 + 1, column: e4 - (r4 > 0 ? n4[r4 - 1] : 0) + 1, offset: e4 };
                    r4++;
                  }
                }
              } };
            }(t3), i2 = r3.toPoint(0), s2 = r3.toPoint(t3.length);
            n3.position = { start: i2, end: s2 };
          }
          return n3;
        }
        case "#documentType":
          return n3 = { type: "doctype" }, patch(e2, t2, n3), n3;
        case "#text": {
          const r = t2;
          return n3 = { type: "text", value: r.value }, patch(e2, r, n3), n3;
        }
        default:
          return n3 = function(e3, t3) {
            const n4 = e3.schema;
            e3.schema = t3.namespaceURI === webNamespaces.svg ? svg2 : html22;
            let r = -1;
            const i = {};
            for (; ++r < t3.attrs.length; ) {
              const e4 = t3.attrs[r], n5 = (e4.prefix ? e4.prefix + ":" : "") + e4.name;
              own22.call(proto, n5) || (i[n5] = e4.value);
            }
            const a = ("svg" === e3.schema.space ? s : h2)(t3.tagName, i, all(e3, t3.childNodes));
            if (patch(e3, t3, a), "template" === a.tagName) {
              const n5 = t3, r3 = n5.sourceCodeLocation, i2 = r3 && r3.startTag && position2(r3.startTag), s2 = r3 && r3.endTag && position2(r3.endTag), o = one(e3, n5.content);
              i2 && s2 && e3.file && (o.position = { start: i2.end, end: s2.start }), a.content = o;
            }
            return e3.schema = n4, a;
          }(e2, t2), n3;
      }
    }
    function all(e2, t2) {
      let n3 = -1;
      const r = [];
      for (; ++n3 < t2.length; ) {
        const i = one(e2, t2[n3]);
        r.push(i);
      }
      return r;
    }
    function patch(e2, t2, n3) {
      if ("sourceCodeLocation" in t2 && t2.sourceCodeLocation && e2.file) {
        const r = function(e3, t3, n4) {
          const r3 = position2(n4);
          if ("element" === t3.type) {
            const i = t3.children[t3.children.length - 1];
            if (r3 && !n4.endTag && i && i.position && i.position.end && (r3.end = Object.assign({}, i.position.end)), e3.verbose) {
              const r4 = {};
              let i2;
              if (n4.attrs) for (i2 in n4.attrs) own22.call(n4.attrs, i2) && (r4[find2(e3.schema, i2).property] = position2(n4.attrs[i2]));
              n4.startTag;
              const s2 = position2(n4.startTag), a = n4.endTag ? position2(n4.endTag) : void 0, o = { opening: s2 };
              a && (o.closing = a), o.properties = r4, t3.data = { position: o };
            }
          }
          return r3;
        }(e2, n3, t2.sourceCodeLocation);
        r && (e2.location = true, n3.position = r);
      }
    }
    function position2(e2) {
      const t2 = point2({ line: e2.startLine, column: e2.startCol, offset: e2.startOffset }), n3 = point2({ line: e2.endLine, column: e2.endCol, offset: e2.endOffset });
      return t2 || n3 ? { start: t2, end: n3 } : void 0;
    }
    function point2(e2) {
      return e2.line && e2.column ? e2 : void 0;
    }
    var UNDEFINED_CODE_POINTS;
    var REPLACEMENT_CHARACTER;
    var CODE_POINTS;
    var SEQUENCES;
    var init_lib9 = __esm2({ "node_modules/hast-util-from-parse5/lib/index.js"() {
      init_default(), init_hastscript(), init_property_information(), init_vfile_location(), init_web_namespaces(), own22 = {}.hasOwnProperty, proto = Object.prototype;
    } });
    var init_hast_util_from_parse5 = __esm2({ "node_modules/hast-util-from-parse5/index.js"() {
      init_lib9();
    } });
    function isSurrogate(e2) {
      return e2 >= 55296 && e2 <= 57343;
    }
    function isControlCodePoint(e2) {
      return 32 !== e2 && 10 !== e2 && 13 !== e2 && 9 !== e2 && 12 !== e2 && e2 >= 1 && e2 <= 31 || e2 >= 127 && e2 <= 159;
    }
    function isUndefinedCodePoint(e2) {
      return e2 >= 64976 && e2 <= 65007 || UNDEFINED_CODE_POINTS.has(e2);
    }
    var ERR;
    var Preprocessor;
    var TokenType;
    var init_unicode = __esm2({ "node_modules/parse5/dist/common/unicode.js"() {
      var e2;
      UNDEFINED_CODE_POINTS = /* @__PURE__ */ new Set([65534, 65535, 131070, 131071, 196606, 196607, 262142, 262143, 327678, 327679, 393214, 393215, 458750, 458751, 524286, 524287, 589822, 589823, 655358, 655359, 720894, 720895, 786430, 786431, 851966, 851967, 917502, 917503, 983038, 983039, 1048574, 1048575, 1114110, 1114111]), REPLACEMENT_CHARACTER = "\uFFFD", (e2 = CODE_POINTS || (CODE_POINTS = {}))[e2.EOF = -1] = "EOF", e2[e2.NULL = 0] = "NULL", e2[e2.TABULATION = 9] = "TABULATION", e2[e2.CARRIAGE_RETURN = 13] = "CARRIAGE_RETURN", e2[e2.LINE_FEED = 10] = "LINE_FEED", e2[e2.FORM_FEED = 12] = "FORM_FEED", e2[e2.SPACE = 32] = "SPACE", e2[e2.EXCLAMATION_MARK = 33] = "EXCLAMATION_MARK", e2[e2.QUOTATION_MARK = 34] = "QUOTATION_MARK", e2[e2.AMPERSAND = 38] = "AMPERSAND", e2[e2.APOSTROPHE = 39] = "APOSTROPHE", e2[e2.HYPHEN_MINUS = 45] = "HYPHEN_MINUS", e2[e2.SOLIDUS = 47] = "SOLIDUS", e2[e2.DIGIT_0 = 48] = "DIGIT_0", e2[e2.DIGIT_9 = 57] = "DIGIT_9", e2[e2.SEMICOLON = 59] = "SEMICOLON", e2[e2.LESS_THAN_SIGN = 60] = "LESS_THAN_SIGN", e2[e2.EQUALS_SIGN = 61] = "EQUALS_SIGN", e2[e2.GREATER_THAN_SIGN = 62] = "GREATER_THAN_SIGN", e2[e2.QUESTION_MARK = 63] = "QUESTION_MARK", e2[e2.LATIN_CAPITAL_A = 65] = "LATIN_CAPITAL_A", e2[e2.LATIN_CAPITAL_Z = 90] = "LATIN_CAPITAL_Z", e2[e2.RIGHT_SQUARE_BRACKET = 93] = "RIGHT_SQUARE_BRACKET", e2[e2.GRAVE_ACCENT = 96] = "GRAVE_ACCENT", e2[e2.LATIN_SMALL_A = 97] = "LATIN_SMALL_A", e2[e2.LATIN_SMALL_Z = 122] = "LATIN_SMALL_Z", SEQUENCES = { DASH_DASH: "--", CDATA_START: "[CDATA[", DOCTYPE: "doctype", SCRIPT: "script", PUBLIC: "public", SYSTEM: "system" };
    } });
    var init_error_codes = __esm2({ "node_modules/parse5/dist/common/error-codes.js"() {
      var e2;
      (e2 = ERR || (ERR = {})).controlCharacterInInputStream = "control-character-in-input-stream", e2.noncharacterInInputStream = "noncharacter-in-input-stream", e2.surrogateInInputStream = "surrogate-in-input-stream", e2.nonVoidHtmlElementStartTagWithTrailingSolidus = "non-void-html-element-start-tag-with-trailing-solidus", e2.endTagWithAttributes = "end-tag-with-attributes", e2.endTagWithTrailingSolidus = "end-tag-with-trailing-solidus", e2.unexpectedSolidusInTag = "unexpected-solidus-in-tag", e2.unexpectedNullCharacter = "unexpected-null-character", e2.unexpectedQuestionMarkInsteadOfTagName = "unexpected-question-mark-instead-of-tag-name", e2.invalidFirstCharacterOfTagName = "invalid-first-character-of-tag-name", e2.unexpectedEqualsSignBeforeAttributeName = "unexpected-equals-sign-before-attribute-name", e2.missingEndTagName = "missing-end-tag-name", e2.unexpectedCharacterInAttributeName = "unexpected-character-in-attribute-name", e2.unknownNamedCharacterReference = "unknown-named-character-reference", e2.missingSemicolonAfterCharacterReference = "missing-semicolon-after-character-reference", e2.unexpectedCharacterAfterDoctypeSystemIdentifier = "unexpected-character-after-doctype-system-identifier", e2.unexpectedCharacterInUnquotedAttributeValue = "unexpected-character-in-unquoted-attribute-value", e2.eofBeforeTagName = "eof-before-tag-name", e2.eofInTag = "eof-in-tag", e2.missingAttributeValue = "missing-attribute-value", e2.missingWhitespaceBetweenAttributes = "missing-whitespace-between-attributes", e2.missingWhitespaceAfterDoctypePublicKeyword = "missing-whitespace-after-doctype-public-keyword", e2.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers = "missing-whitespace-between-doctype-public-and-system-identifiers", e2.missingWhitespaceAfterDoctypeSystemKeyword = "missing-whitespace-after-doctype-system-keyword", e2.missingQuoteBeforeDoctypePublicIdentifier = "missing-quote-before-doctype-public-identifier", e2.missingQuoteBeforeDoctypeSystemIdentifier = "missing-quote-before-doctype-system-identifier", e2.missingDoctypePublicIdentifier = "missing-doctype-public-identifier", e2.missingDoctypeSystemIdentifier = "missing-doctype-system-identifier", e2.abruptDoctypePublicIdentifier = "abrupt-doctype-public-identifier", e2.abruptDoctypeSystemIdentifier = "abrupt-doctype-system-identifier", e2.cdataInHtmlContent = "cdata-in-html-content", e2.incorrectlyOpenedComment = "incorrectly-opened-comment", e2.eofInScriptHtmlCommentLikeText = "eof-in-script-html-comment-like-text", e2.eofInDoctype = "eof-in-doctype", e2.nestedComment = "nested-comment", e2.abruptClosingOfEmptyComment = "abrupt-closing-of-empty-comment", e2.eofInComment = "eof-in-comment", e2.incorrectlyClosedComment = "incorrectly-closed-comment", e2.eofInCdata = "eof-in-cdata", e2.absenceOfDigitsInNumericCharacterReference = "absence-of-digits-in-numeric-character-reference", e2.nullCharacterReference = "null-character-reference", e2.surrogateCharacterReference = "surrogate-character-reference", e2.characterReferenceOutsideUnicodeRange = "character-reference-outside-unicode-range", e2.controlCharacterReference = "control-character-reference", e2.noncharacterCharacterReference = "noncharacter-character-reference", e2.missingWhitespaceBeforeDoctypeName = "missing-whitespace-before-doctype-name", e2.missingDoctypeName = "missing-doctype-name", e2.invalidCharacterSequenceAfterDoctypeName = "invalid-character-sequence-after-doctype-name", e2.duplicateAttribute = "duplicate-attribute", e2.nonConformingDoctype = "non-conforming-doctype", e2.missingDoctype = "missing-doctype", e2.misplacedDoctype = "misplaced-doctype", e2.endTagWithoutMatchingOpenElement = "end-tag-without-matching-open-element", e2.closingOfElementWithOpenChildElements = "closing-of-element-with-open-child-elements", e2.disallowedContentInNoscriptInHead = "disallowed-content-in-noscript-in-head", e2.openElementsLeftAfterEof = "open-elements-left-after-eof", e2.abandonedHeadElementChild = "abandoned-head-element-child", e2.misplacedStartTagForHeadElement = "misplaced-start-tag-for-head-element", e2.nestedNoscriptInHead = "nested-noscript-in-head", e2.eofInElementThatCanContainOnlyText = "eof-in-element-that-can-contain-only-text";
    } });
    var init_preprocessor = __esm2({ "node_modules/parse5/dist/tokenizer/preprocessor.js"() {
      init_unicode(), init_error_codes(), Preprocessor = class {
        constructor(e2) {
          this.handler = e2, this.html = "", this.pos = -1, this.lastGapPos = -2, this.gapStack = [], this.skipNextNewLine = false, this.lastChunkWritten = false, this.endOfChunkHit = false, this.bufferWaterline = 65536, this.isEol = false, this.lineStartPos = 0, this.droppedBufferSize = 0, this.line = 1, this.lastErrOffset = -1;
        }
        get col() {
          return this.pos - this.lineStartPos + Number(this.lastGapPos !== this.pos);
        }
        get offset() {
          return this.droppedBufferSize + this.pos;
        }
        getError(e2, t2) {
          const { line: n3, col: r, offset: i } = this, s2 = r + t2, a = i + t2;
          return { code: e2, startLine: n3, endLine: n3, startCol: s2, endCol: s2, startOffset: a, endOffset: a };
        }
        _err(e2) {
          this.handler.onParseError && this.lastErrOffset !== this.offset && (this.lastErrOffset = this.offset, this.handler.onParseError(this.getError(e2, 0)));
        }
        _addGap() {
          this.gapStack.push(this.lastGapPos), this.lastGapPos = this.pos;
        }
        _processSurrogate(e2) {
          if (this.pos !== this.html.length - 1) {
            const t2 = this.html.charCodeAt(this.pos + 1);
            if (function(e3) {
              return e3 >= 56320 && e3 <= 57343;
            }(t2)) return this.pos++, this._addGap(), 1024 * (e2 - 55296) + 9216 + t2;
          } else if (!this.lastChunkWritten) return this.endOfChunkHit = true, CODE_POINTS.EOF;
          return this._err(ERR.surrogateInInputStream), e2;
        }
        willDropParsedChunk() {
          return this.pos > this.bufferWaterline;
        }
        dropParsedChunk() {
          this.willDropParsedChunk() && (this.html = this.html.substring(this.pos), this.lineStartPos -= this.pos, this.droppedBufferSize += this.pos, this.pos = 0, this.lastGapPos = -2, this.gapStack.length = 0);
        }
        write(e2, t2) {
          this.html.length > 0 ? this.html += e2 : this.html = e2, this.endOfChunkHit = false, this.lastChunkWritten = t2;
        }
        insertHtmlAtCurrentPos(e2) {
          this.html = this.html.substring(0, this.pos + 1) + e2 + this.html.substring(this.pos + 1), this.endOfChunkHit = false;
        }
        startsWith(e2, t2) {
          if (this.pos + e2.length > this.html.length) return this.endOfChunkHit = !this.lastChunkWritten, false;
          if (t2) return this.html.startsWith(e2, this.pos);
          for (let t3 = 0; t3 < e2.length; t3++) if ((32 | this.html.charCodeAt(this.pos + t3)) !== e2.charCodeAt(t3)) return false;
          return true;
        }
        peek(e2) {
          const t2 = this.pos + e2;
          if (t2 >= this.html.length) return this.endOfChunkHit = !this.lastChunkWritten, CODE_POINTS.EOF;
          const n3 = this.html.charCodeAt(t2);
          return n3 === CODE_POINTS.CARRIAGE_RETURN ? CODE_POINTS.LINE_FEED : n3;
        }
        advance() {
          if (this.pos++, this.isEol && (this.isEol = false, this.line++, this.lineStartPos = this.pos), this.pos >= this.html.length) return this.endOfChunkHit = !this.lastChunkWritten, CODE_POINTS.EOF;
          let e2 = this.html.charCodeAt(this.pos);
          return e2 === CODE_POINTS.CARRIAGE_RETURN ? (this.isEol = true, this.skipNextNewLine = true, CODE_POINTS.LINE_FEED) : e2 === CODE_POINTS.LINE_FEED && (this.isEol = true, this.skipNextNewLine) ? (this.line--, this.skipNextNewLine = false, this._addGap(), this.advance()) : (this.skipNextNewLine = false, isSurrogate(e2) && (e2 = this._processSurrogate(e2)), null === this.handler.onParseError || e2 > 31 && e2 < 127 || e2 === CODE_POINTS.LINE_FEED || e2 === CODE_POINTS.CARRIAGE_RETURN || e2 > 159 && e2 < 64976 || this._checkForProblematicCharacters(e2), e2);
        }
        _checkForProblematicCharacters(e2) {
          isControlCodePoint(e2) ? this._err(ERR.controlCharacterInInputStream) : isUndefinedCodePoint(e2) && this._err(ERR.noncharacterInInputStream);
        }
        retreat(e2) {
          for (this.pos -= e2; this.pos < this.lastGapPos; ) this.lastGapPos = this.gapStack.pop(), this.pos--;
          this.isEol = false;
        }
      };
    } });
    function getTokenAttr(e2, t2) {
      for (let n3 = e2.attrs.length - 1; n3 >= 0; n3--) if (e2.attrs[n3].name === t2) return e2.attrs[n3].value;
      return null;
    }
    var htmlDecodeTree;
    var decodeMap;
    var CharCodes;
    var BinTrieFlags;
    var EntityDecoderState;
    var DecodingMode;
    var EntityDecoder;
    var init_token2 = __esm2({ "node_modules/parse5/dist/common/token.js"() {
      var e2;
      (e2 = TokenType || (TokenType = {}))[e2.CHARACTER = 0] = "CHARACTER", e2[e2.NULL_CHARACTER = 1] = "NULL_CHARACTER", e2[e2.WHITESPACE_CHARACTER = 2] = "WHITESPACE_CHARACTER", e2[e2.START_TAG = 3] = "START_TAG", e2[e2.END_TAG = 4] = "END_TAG", e2[e2.COMMENT = 5] = "COMMENT", e2[e2.DOCTYPE = 6] = "DOCTYPE", e2[e2.EOF = 7] = "EOF", e2[e2.HIBERNATION = 8] = "HIBERNATION";
    } });
    var init_decode_data_html = __esm2({ "node_modules/parse5/node_modules/entities/dist/esm/generated/decode-data-html.js"() {
      htmlDecodeTree = new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map((e2) => e2.charCodeAt(0)));
    } });
    var init_decode_data_xml = __esm2({ "node_modules/parse5/node_modules/entities/dist/esm/generated/decode-data-xml.js"() {
    } });
    var init_decode_codepoint = __esm2({ "node_modules/parse5/node_modules/entities/dist/esm/decode-codepoint.js"() {
      decodeMap = /* @__PURE__ */ new Map([[0, 65533], [128, 8364], [130, 8218], [131, 402], [132, 8222], [133, 8230], [134, 8224], [135, 8225], [136, 710], [137, 8240], [138, 352], [139, 8249], [140, 338], [142, 381], [145, 8216], [146, 8217], [147, 8220], [148, 8221], [149, 8226], [150, 8211], [151, 8212], [152, 732], [153, 8482], [154, 353], [155, 8250], [156, 339], [158, 382], [159, 376]]), String.fromCodePoint;
    } });
    function isNumber(e2) {
      return e2 >= CharCodes.ZERO && e2 <= CharCodes.NINE;
    }
    function isHexadecimalCharacter(e2) {
      return e2 >= CharCodes.UPPER_A && e2 <= CharCodes.UPPER_F || e2 >= CharCodes.LOWER_A && e2 <= CharCodes.LOWER_F;
    }
    function isEntityInAttributeInvalidEnd(e2) {
      return e2 === CharCodes.EQUALS || function(e3) {
        return e3 >= CharCodes.UPPER_A && e3 <= CharCodes.UPPER_Z || e3 >= CharCodes.LOWER_A && e3 <= CharCodes.LOWER_Z || isNumber(e3);
      }(e2);
    }
    function determineBranch(e2, t2, n3, r) {
      const i = (t2 & BinTrieFlags.BRANCH_LENGTH) >> 7, s2 = t2 & BinTrieFlags.JUMP_TABLE;
      if (0 === i) return 0 !== s2 && r === s2 ? n3 : -1;
      if (s2) {
        const t3 = r - s2;
        return t3 < 0 || t3 >= i ? -1 : e2[n3 + t3] - 1;
      }
      let a = n3, o = a + i - 1;
      for (; a <= o; ) {
        const t3 = a + o >>> 1, n4 = e2[t3];
        if (n4 < r) a = t3 + 1;
        else {
          if (!(n4 > r)) return e2[t3 + i];
          o = t3 - 1;
        }
      }
      return -1;
    }
    var NS;
    var ATTRS;
    var DOCUMENT_MODE;
    var TAG_NAMES;
    var TAG_ID;
    var TAG_NAME_TO_ID;
    var $;
    var SPECIAL_ELEMENTS;
    var NUMBERED_HEADERS;
    var init_decode = __esm2({ "node_modules/parse5/node_modules/entities/dist/esm/decode.js"() {
      var e2, t2, n3, r;
      init_decode_data_html(), init_decode_data_xml(), init_decode_codepoint(), init_decode_data_html(), init_decode_data_xml(), init_decode_codepoint(), (e2 = CharCodes || (CharCodes = {}))[e2.NUM = 35] = "NUM", e2[e2.SEMI = 59] = "SEMI", e2[e2.EQUALS = 61] = "EQUALS", e2[e2.ZERO = 48] = "ZERO", e2[e2.NINE = 57] = "NINE", e2[e2.LOWER_A = 97] = "LOWER_A", e2[e2.LOWER_F = 102] = "LOWER_F", e2[e2.LOWER_X = 120] = "LOWER_X", e2[e2.LOWER_Z = 122] = "LOWER_Z", e2[e2.UPPER_A = 65] = "UPPER_A", e2[e2.UPPER_F = 70] = "UPPER_F", e2[e2.UPPER_Z = 90] = "UPPER_Z", (t2 = BinTrieFlags || (BinTrieFlags = {}))[t2.VALUE_LENGTH = 49152] = "VALUE_LENGTH", t2[t2.BRANCH_LENGTH = 16256] = "BRANCH_LENGTH", t2[t2.JUMP_TABLE = 127] = "JUMP_TABLE", (n3 = EntityDecoderState || (EntityDecoderState = {}))[n3.EntityStart = 0] = "EntityStart", n3[n3.NumericStart = 1] = "NumericStart", n3[n3.NumericDecimal = 2] = "NumericDecimal", n3[n3.NumericHex = 3] = "NumericHex", n3[n3.NamedEntity = 4] = "NamedEntity", (r = DecodingMode || (DecodingMode = {}))[r.Legacy = 0] = "Legacy", r[r.Strict = 1] = "Strict", r[r.Attribute = 2] = "Attribute", EntityDecoder = class {
        constructor(e3, t3, n4) {
          this.decodeTree = e3, this.emitCodePoint = t3, this.errors = n4, this.state = EntityDecoderState.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = DecodingMode.Strict;
        }
        startEntity(e3) {
          this.decodeMode = e3, this.state = EntityDecoderState.EntityStart, this.result = 0, this.treeIndex = 0, this.excess = 1, this.consumed = 1;
        }
        write(e3, t3) {
          switch (this.state) {
            case EntityDecoderState.EntityStart:
              return e3.charCodeAt(t3) === CharCodes.NUM ? (this.state = EntityDecoderState.NumericStart, this.consumed += 1, this.stateNumericStart(e3, t3 + 1)) : (this.state = EntityDecoderState.NamedEntity, this.stateNamedEntity(e3, t3));
            case EntityDecoderState.NumericStart:
              return this.stateNumericStart(e3, t3);
            case EntityDecoderState.NumericDecimal:
              return this.stateNumericDecimal(e3, t3);
            case EntityDecoderState.NumericHex:
              return this.stateNumericHex(e3, t3);
            case EntityDecoderState.NamedEntity:
              return this.stateNamedEntity(e3, t3);
          }
        }
        stateNumericStart(e3, t3) {
          return t3 >= e3.length ? -1 : (32 | e3.charCodeAt(t3)) === CharCodes.LOWER_X ? (this.state = EntityDecoderState.NumericHex, this.consumed += 1, this.stateNumericHex(e3, t3 + 1)) : (this.state = EntityDecoderState.NumericDecimal, this.stateNumericDecimal(e3, t3));
        }
        addToNumericResult(e3, t3, n4, r3) {
          if (t3 !== n4) {
            const i = n4 - t3;
            this.result = this.result * Math.pow(r3, i) + Number.parseInt(e3.substr(t3, i), r3), this.consumed += i;
          }
        }
        stateNumericHex(e3, t3) {
          const n4 = t3;
          for (; t3 < e3.length; ) {
            const r3 = e3.charCodeAt(t3);
            if (!isNumber(r3) && !isHexadecimalCharacter(r3)) return this.addToNumericResult(e3, n4, t3, 16), this.emitNumericEntity(r3, 3);
            t3 += 1;
          }
          return this.addToNumericResult(e3, n4, t3, 16), -1;
        }
        stateNumericDecimal(e3, t3) {
          const n4 = t3;
          for (; t3 < e3.length; ) {
            const r3 = e3.charCodeAt(t3);
            if (!isNumber(r3)) return this.addToNumericResult(e3, n4, t3, 10), this.emitNumericEntity(r3, 2);
            t3 += 1;
          }
          return this.addToNumericResult(e3, n4, t3, 10), -1;
        }
        emitNumericEntity(e3, t3) {
          var n4;
          if (this.consumed <= t3) return null === (n4 = this.errors) || void 0 === n4 || n4.absenceOfDigitsInNumericCharacterReference(this.consumed), 0;
          if (e3 === CharCodes.SEMI) this.consumed += 1;
          else if (this.decodeMode === DecodingMode.Strict) return 0;
          return this.emitCodePoint(function(e4) {
            var t4;
            return e4 >= 55296 && e4 <= 57343 || e4 > 1114111 ? 65533 : null !== (t4 = decodeMap.get(e4)) && void 0 !== t4 ? t4 : e4;
          }(this.result), this.consumed), this.errors && (e3 !== CharCodes.SEMI && this.errors.missingSemicolonAfterCharacterReference(), this.errors.validateNumericCharacterReference(this.result)), this.consumed;
        }
        stateNamedEntity(e3, t3) {
          const { decodeTree: n4 } = this;
          let r3 = n4[this.treeIndex], i = (r3 & BinTrieFlags.VALUE_LENGTH) >> 14;
          for (; t3 < e3.length; t3++, this.excess++) {
            const s2 = e3.charCodeAt(t3);
            if (this.treeIndex = determineBranch(n4, r3, this.treeIndex + Math.max(1, i), s2), this.treeIndex < 0) return 0 === this.result || this.decodeMode === DecodingMode.Attribute && (0 === i || isEntityInAttributeInvalidEnd(s2)) ? 0 : this.emitNotTerminatedNamedEntity();
            if (r3 = n4[this.treeIndex], i = (r3 & BinTrieFlags.VALUE_LENGTH) >> 14, 0 !== i) {
              if (s2 === CharCodes.SEMI) return this.emitNamedEntityData(this.treeIndex, i, this.consumed + this.excess);
              this.decodeMode !== DecodingMode.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0);
            }
          }
          return -1;
        }
        emitNotTerminatedNamedEntity() {
          var e3;
          const { result: t3, decodeTree: n4 } = this, r3 = (n4[t3] & BinTrieFlags.VALUE_LENGTH) >> 14;
          return this.emitNamedEntityData(t3, r3, this.consumed), null === (e3 = this.errors) || void 0 === e3 || e3.missingSemicolonAfterCharacterReference(), this.consumed;
        }
        emitNamedEntityData(e3, t3, n4) {
          const { decodeTree: r3 } = this;
          return this.emitCodePoint(1 === t3 ? r3[e3] & ~BinTrieFlags.VALUE_LENGTH : r3[e3 + 1], n4), 3 === t3 && this.emitCodePoint(r3[e3 + 2], n4), n4;
        }
        end() {
          var e3;
          switch (this.state) {
            case EntityDecoderState.NamedEntity:
              return 0 === this.result || this.decodeMode === DecodingMode.Attribute && this.result !== this.treeIndex ? 0 : this.emitNotTerminatedNamedEntity();
            case EntityDecoderState.NumericDecimal:
              return this.emitNumericEntity(0, 2);
            case EntityDecoderState.NumericHex:
              return this.emitNumericEntity(0, 3);
            case EntityDecoderState.NumericStart:
              return null === (e3 = this.errors) || void 0 === e3 || e3.absenceOfDigitsInNumericCharacterReference(this.consumed), 0;
            case EntityDecoderState.EntityStart:
              return 0;
          }
        }
      };
    } });
    function getTagID(e2) {
      var t2;
      return null !== (t2 = TAG_NAME_TO_ID.get(e2)) && void 0 !== t2 ? t2 : TAG_ID.UNKNOWN;
    }
    var State;
    var TokenizerMode;
    var Tokenizer;
    var init_html22 = __esm2({ "node_modules/parse5/dist/common/html.js"() {
      var e2, t2, n3, r, i;
      (e2 = NS || (NS = {})).HTML = "http://www.w3.org/1999/xhtml", e2.MATHML = "http://www.w3.org/1998/Math/MathML", e2.SVG = "http://www.w3.org/2000/svg", e2.XLINK = "http://www.w3.org/1999/xlink", e2.XML = "http://www.w3.org/XML/1998/namespace", e2.XMLNS = "http://www.w3.org/2000/xmlns/", (t2 = ATTRS || (ATTRS = {})).TYPE = "type", t2.ACTION = "action", t2.ENCODING = "encoding", t2.PROMPT = "prompt", t2.NAME = "name", t2.COLOR = "color", t2.FACE = "face", t2.SIZE = "size", (n3 = DOCUMENT_MODE || (DOCUMENT_MODE = {})).NO_QUIRKS = "no-quirks", n3.QUIRKS = "quirks", n3.LIMITED_QUIRKS = "limited-quirks", (r = TAG_NAMES || (TAG_NAMES = {})).A = "a", r.ADDRESS = "address", r.ANNOTATION_XML = "annotation-xml", r.APPLET = "applet", r.AREA = "area", r.ARTICLE = "article", r.ASIDE = "aside", r.B = "b", r.BASE = "base", r.BASEFONT = "basefont", r.BGSOUND = "bgsound", r.BIG = "big", r.BLOCKQUOTE = "blockquote", r.BODY = "body", r.BR = "br", r.BUTTON = "button", r.CAPTION = "caption", r.CENTER = "center", r.CODE = "code", r.COL = "col", r.COLGROUP = "colgroup", r.DD = "dd", r.DESC = "desc", r.DETAILS = "details", r.DIALOG = "dialog", r.DIR = "dir", r.DIV = "div", r.DL = "dl", r.DT = "dt", r.EM = "em", r.EMBED = "embed", r.FIELDSET = "fieldset", r.FIGCAPTION = "figcaption", r.FIGURE = "figure", r.FONT = "font", r.FOOTER = "footer", r.FOREIGN_OBJECT = "foreignObject", r.FORM = "form", r.FRAME = "frame", r.FRAMESET = "frameset", r.H1 = "h1", r.H2 = "h2", r.H3 = "h3", r.H4 = "h4", r.H5 = "h5", r.H6 = "h6", r.HEAD = "head", r.HEADER = "header", r.HGROUP = "hgroup", r.HR = "hr", r.HTML = "html", r.I = "i", r.IMG = "img", r.IMAGE = "image", r.INPUT = "input", r.IFRAME = "iframe", r.KEYGEN = "keygen", r.LABEL = "label", r.LI = "li", r.LINK = "link", r.LISTING = "listing", r.MAIN = "main", r.MALIGNMARK = "malignmark", r.MARQUEE = "marquee", r.MATH = "math", r.MENU = "menu", r.META = "meta", r.MGLYPH = "mglyph", r.MI = "mi", r.MO = "mo", r.MN = "mn", r.MS = "ms", r.MTEXT = "mtext", r.NAV = "nav", r.NOBR = "nobr", r.NOFRAMES = "noframes", r.NOEMBED = "noembed", r.NOSCRIPT = "noscript", r.OBJECT = "object", r.OL = "ol", r.OPTGROUP = "optgroup", r.OPTION = "option", r.P = "p", r.PARAM = "param", r.PLAINTEXT = "plaintext", r.PRE = "pre", r.RB = "rb", r.RP = "rp", r.RT = "rt", r.RTC = "rtc", r.RUBY = "ruby", r.S = "s", r.SCRIPT = "script", r.SEARCH = "search", r.SECTION = "section", r.SELECT = "select", r.SOURCE = "source", r.SMALL = "small", r.SPAN = "span", r.STRIKE = "strike", r.STRONG = "strong", r.STYLE = "style", r.SUB = "sub", r.SUMMARY = "summary", r.SUP = "sup", r.TABLE = "table", r.TBODY = "tbody", r.TEMPLATE = "template", r.TEXTAREA = "textarea", r.TFOOT = "tfoot", r.TD = "td", r.TH = "th", r.THEAD = "thead", r.TITLE = "title", r.TR = "tr", r.TRACK = "track", r.TT = "tt", r.U = "u", r.UL = "ul", r.SVG = "svg", r.VAR = "var", r.WBR = "wbr", r.XMP = "xmp", (i = TAG_ID || (TAG_ID = {}))[i.UNKNOWN = 0] = "UNKNOWN", i[i.A = 1] = "A", i[i.ADDRESS = 2] = "ADDRESS", i[i.ANNOTATION_XML = 3] = "ANNOTATION_XML", i[i.APPLET = 4] = "APPLET", i[i.AREA = 5] = "AREA", i[i.ARTICLE = 6] = "ARTICLE", i[i.ASIDE = 7] = "ASIDE", i[i.B = 8] = "B", i[i.BASE = 9] = "BASE", i[i.BASEFONT = 10] = "BASEFONT", i[i.BGSOUND = 11] = "BGSOUND", i[i.BIG = 12] = "BIG", i[i.BLOCKQUOTE = 13] = "BLOCKQUOTE", i[i.BODY = 14] = "BODY", i[i.BR = 15] = "BR", i[i.BUTTON = 16] = "BUTTON", i[i.CAPTION = 17] = "CAPTION", i[i.CENTER = 18] = "CENTER", i[i.CODE = 19] = "CODE", i[i.COL = 20] = "COL", i[i.COLGROUP = 21] = "COLGROUP", i[i.DD = 22] = "DD", i[i.DESC = 23] = "DESC", i[i.DETAILS = 24] = "DETAILS", i[i.DIALOG = 25] = "DIALOG", i[i.DIR = 26] = "DIR", i[i.DIV = 27] = "DIV", i[i.DL = 28] = "DL", i[i.DT = 29] = "DT", i[i.EM = 30] = "EM", i[i.EMBED = 31] = "EMBED", i[i.FIELDSET = 32] = "FIELDSET", i[i.FIGCAPTION = 33] = "FIGCAPTION", i[i.FIGURE = 34] = "FIGURE", i[i.FONT = 35] = "FONT", i[i.FOOTER = 36] = "FOOTER", i[i.FOREIGN_OBJECT = 37] = "FOREIGN_OBJECT", i[i.FORM = 38] = "FORM", i[i.FRAME = 39] = "FRAME", i[i.FRAMESET = 40] = "FRAMESET", i[i.H1 = 41] = "H1", i[i.H2 = 42] = "H2", i[i.H3 = 43] = "H3", i[i.H4 = 44] = "H4", i[i.H5 = 45] = "H5", i[i.H6 = 46] = "H6", i[i.HEAD = 47] = "HEAD", i[i.HEADER = 48] = "HEADER", i[i.HGROUP = 49] = "HGROUP", i[i.HR = 50] = "HR", i[i.HTML = 51] = "HTML", i[i.I = 52] = "I", i[i.IMG = 53] = "IMG", i[i.IMAGE = 54] = "IMAGE", i[i.INPUT = 55] = "INPUT", i[i.IFRAME = 56] = "IFRAME", i[i.KEYGEN = 57] = "KEYGEN", i[i.LABEL = 58] = "LABEL", i[i.LI = 59] = "LI", i[i.LINK = 60] = "LINK", i[i.LISTING = 61] = "LISTING", i[i.MAIN = 62] = "MAIN", i[i.MALIGNMARK = 63] = "MALIGNMARK", i[i.MARQUEE = 64] = "MARQUEE", i[i.MATH = 65] = "MATH", i[i.MENU = 66] = "MENU", i[i.META = 67] = "META", i[i.MGLYPH = 68] = "MGLYPH", i[i.MI = 69] = "MI", i[i.MO = 70] = "MO", i[i.MN = 71] = "MN", i[i.MS = 72] = "MS", i[i.MTEXT = 73] = "MTEXT", i[i.NAV = 74] = "NAV", i[i.NOBR = 75] = "NOBR", i[i.NOFRAMES = 76] = "NOFRAMES", i[i.NOEMBED = 77] = "NOEMBED", i[i.NOSCRIPT = 78] = "NOSCRIPT", i[i.OBJECT = 79] = "OBJECT", i[i.OL = 80] = "OL", i[i.OPTGROUP = 81] = "OPTGROUP", i[i.OPTION = 82] = "OPTION", i[i.P = 83] = "P", i[i.PARAM = 84] = "PARAM", i[i.PLAINTEXT = 85] = "PLAINTEXT", i[i.PRE = 86] = "PRE", i[i.RB = 87] = "RB", i[i.RP = 88] = "RP", i[i.RT = 89] = "RT", i[i.RTC = 90] = "RTC", i[i.RUBY = 91] = "RUBY", i[i.S = 92] = "S", i[i.SCRIPT = 93] = "SCRIPT", i[i.SEARCH = 94] = "SEARCH", i[i.SECTION = 95] = "SECTION", i[i.SELECT = 96] = "SELECT", i[i.SOURCE = 97] = "SOURCE", i[i.SMALL = 98] = "SMALL", i[i.SPAN = 99] = "SPAN", i[i.STRIKE = 100] = "STRIKE", i[i.STRONG = 101] = "STRONG", i[i.STYLE = 102] = "STYLE", i[i.SUB = 103] = "SUB", i[i.SUMMARY = 104] = "SUMMARY", i[i.SUP = 105] = "SUP", i[i.TABLE = 106] = "TABLE", i[i.TBODY = 107] = "TBODY", i[i.TEMPLATE = 108] = "TEMPLATE", i[i.TEXTAREA = 109] = "TEXTAREA", i[i.TFOOT = 110] = "TFOOT", i[i.TD = 111] = "TD", i[i.TH = 112] = "TH", i[i.THEAD = 113] = "THEAD", i[i.TITLE = 114] = "TITLE", i[i.TR = 115] = "TR", i[i.TRACK = 116] = "TRACK", i[i.TT = 117] = "TT", i[i.U = 118] = "U", i[i.UL = 119] = "UL", i[i.SVG = 120] = "SVG", i[i.VAR = 121] = "VAR", i[i.WBR = 122] = "WBR", i[i.XMP = 123] = "XMP", TAG_NAME_TO_ID = /* @__PURE__ */ new Map([[TAG_NAMES.A, TAG_ID.A], [TAG_NAMES.ADDRESS, TAG_ID.ADDRESS], [TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML], [TAG_NAMES.APPLET, TAG_ID.APPLET], [TAG_NAMES.AREA, TAG_ID.AREA], [TAG_NAMES.ARTICLE, TAG_ID.ARTICLE], [TAG_NAMES.ASIDE, TAG_ID.ASIDE], [TAG_NAMES.B, TAG_ID.B], [TAG_NAMES.BASE, TAG_ID.BASE], [TAG_NAMES.BASEFONT, TAG_ID.BASEFONT], [TAG_NAMES.BGSOUND, TAG_ID.BGSOUND], [TAG_NAMES.BIG, TAG_ID.BIG], [TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE], [TAG_NAMES.BODY, TAG_ID.BODY], [TAG_NAMES.BR, TAG_ID.BR], [TAG_NAMES.BUTTON, TAG_ID.BUTTON], [TAG_NAMES.CAPTION, TAG_ID.CAPTION], [TAG_NAMES.CENTER, TAG_ID.CENTER], [TAG_NAMES.CODE, TAG_ID.CODE], [TAG_NAMES.COL, TAG_ID.COL], [TAG_NAMES.COLGROUP, TAG_ID.COLGROUP], [TAG_NAMES.DD, TAG_ID.DD], [TAG_NAMES.DESC, TAG_ID.DESC], [TAG_NAMES.DETAILS, TAG_ID.DETAILS], [TAG_NAMES.DIALOG, TAG_ID.DIALOG], [TAG_NAMES.DIR, TAG_ID.DIR], [TAG_NAMES.DIV, TAG_ID.DIV], [TAG_NAMES.DL, TAG_ID.DL], [TAG_NAMES.DT, TAG_ID.DT], [TAG_NAMES.EM, TAG_ID.EM], [TAG_NAMES.EMBED, TAG_ID.EMBED], [TAG_NAMES.FIELDSET, TAG_ID.FIELDSET], [TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION], [TAG_NAMES.FIGURE, TAG_ID.FIGURE], [TAG_NAMES.FONT, TAG_ID.FONT], [TAG_NAMES.FOOTER, TAG_ID.FOOTER], [TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT], [TAG_NAMES.FORM, TAG_ID.FORM], [TAG_NAMES.FRAME, TAG_ID.FRAME], [TAG_NAMES.FRAMESET, TAG_ID.FRAMESET], [TAG_NAMES.H1, TAG_ID.H1], [TAG_NAMES.H2, TAG_ID.H2], [TAG_NAMES.H3, TAG_ID.H3], [TAG_NAMES.H4, TAG_ID.H4], [TAG_NAMES.H5, TAG_ID.H5], [TAG_NAMES.H6, TAG_ID.H6], [TAG_NAMES.HEAD, TAG_ID.HEAD], [TAG_NAMES.HEADER, TAG_ID.HEADER], [TAG_NAMES.HGROUP, TAG_ID.HGROUP], [TAG_NAMES.HR, TAG_ID.HR], [TAG_NAMES.HTML, TAG_ID.HTML], [TAG_NAMES.I, TAG_ID.I], [TAG_NAMES.IMG, TAG_ID.IMG], [TAG_NAMES.IMAGE, TAG_ID.IMAGE], [TAG_NAMES.INPUT, TAG_ID.INPUT], [TAG_NAMES.IFRAME, TAG_ID.IFRAME], [TAG_NAMES.KEYGEN, TAG_ID.KEYGEN], [TAG_NAMES.LABEL, TAG_ID.LABEL], [TAG_NAMES.LI, TAG_ID.LI], [TAG_NAMES.LINK, TAG_ID.LINK], [TAG_NAMES.LISTING, TAG_ID.LISTING], [TAG_NAMES.MAIN, TAG_ID.MAIN], [TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK], [TAG_NAMES.MARQUEE, TAG_ID.MARQUEE], [TAG_NAMES.MATH, TAG_ID.MATH], [TAG_NAMES.MENU, TAG_ID.MENU], [TAG_NAMES.META, TAG_ID.META], [TAG_NAMES.MGLYPH, TAG_ID.MGLYPH], [TAG_NAMES.MI, TAG_ID.MI], [TAG_NAMES.MO, TAG_ID.MO], [TAG_NAMES.MN, TAG_ID.MN], [TAG_NAMES.MS, TAG_ID.MS], [TAG_NAMES.MTEXT, TAG_ID.MTEXT], [TAG_NAMES.NAV, TAG_ID.NAV], [TAG_NAMES.NOBR, TAG_ID.NOBR], [TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES], [TAG_NAMES.NOEMBED, TAG_ID.NOEMBED], [TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT], [TAG_NAMES.OBJECT, TAG_ID.OBJECT], [TAG_NAMES.OL, TAG_ID.OL], [TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP], [TAG_NAMES.OPTION, TAG_ID.OPTION], [TAG_NAMES.P, TAG_ID.P], [TAG_NAMES.PARAM, TAG_ID.PARAM], [TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT], [TAG_NAMES.PRE, TAG_ID.PRE], [TAG_NAMES.RB, TAG_ID.RB], [TAG_NAMES.RP, TAG_ID.RP], [TAG_NAMES.RT, TAG_ID.RT], [TAG_NAMES.RTC, TAG_ID.RTC], [TAG_NAMES.RUBY, TAG_ID.RUBY], [TAG_NAMES.S, TAG_ID.S], [TAG_NAMES.SCRIPT, TAG_ID.SCRIPT], [TAG_NAMES.SEARCH, TAG_ID.SEARCH], [TAG_NAMES.SECTION, TAG_ID.SECTION], [TAG_NAMES.SELECT, TAG_ID.SELECT], [TAG_NAMES.SOURCE, TAG_ID.SOURCE], [TAG_NAMES.SMALL, TAG_ID.SMALL], [TAG_NAMES.SPAN, TAG_ID.SPAN], [TAG_NAMES.STRIKE, TAG_ID.STRIKE], [TAG_NAMES.STRONG, TAG_ID.STRONG], [TAG_NAMES.STYLE, TAG_ID.STYLE], [TAG_NAMES.SUB, TAG_ID.SUB], [TAG_NAMES.SUMMARY, TAG_ID.SUMMARY], [TAG_NAMES.SUP, TAG_ID.SUP], [TAG_NAMES.TABLE, TAG_ID.TABLE], [TAG_NAMES.TBODY, TAG_ID.TBODY], [TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE], [TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA], [TAG_NAMES.TFOOT, TAG_ID.TFOOT], [TAG_NAMES.TD, TAG_ID.TD], [TAG_NAMES.TH, TAG_ID.TH], [TAG_NAMES.THEAD, TAG_ID.THEAD], [TAG_NAMES.TITLE, TAG_ID.TITLE], [TAG_NAMES.TR, TAG_ID.TR], [TAG_NAMES.TRACK, TAG_ID.TRACK], [TAG_NAMES.TT, TAG_ID.TT], [TAG_NAMES.U, TAG_ID.U], [TAG_NAMES.UL, TAG_ID.UL], [TAG_NAMES.SVG, TAG_ID.SVG], [TAG_NAMES.VAR, TAG_ID.VAR], [TAG_NAMES.WBR, TAG_ID.WBR], [TAG_NAMES.XMP, TAG_ID.XMP]]), $ = TAG_ID, SPECIAL_ELEMENTS = { [NS.HTML]: /* @__PURE__ */ new Set([$.ADDRESS, $.APPLET, $.AREA, $.ARTICLE, $.ASIDE, $.BASE, $.BASEFONT, $.BGSOUND, $.BLOCKQUOTE, $.BODY, $.BR, $.BUTTON, $.CAPTION, $.CENTER, $.COL, $.COLGROUP, $.DD, $.DETAILS, $.DIR, $.DIV, $.DL, $.DT, $.EMBED, $.FIELDSET, $.FIGCAPTION, $.FIGURE, $.FOOTER, $.FORM, $.FRAME, $.FRAMESET, $.H1, $.H2, $.H3, $.H4, $.H5, $.H6, $.HEAD, $.HEADER, $.HGROUP, $.HR, $.HTML, $.IFRAME, $.IMG, $.INPUT, $.LI, $.LINK, $.LISTING, $.MAIN, $.MARQUEE, $.MENU, $.META, $.NAV, $.NOEMBED, $.NOFRAMES, $.NOSCRIPT, $.OBJECT, $.OL, $.P, $.PARAM, $.PLAINTEXT, $.PRE, $.SCRIPT, $.SECTION, $.SELECT, $.SOURCE, $.STYLE, $.SUMMARY, $.TABLE, $.TBODY, $.TD, $.TEMPLATE, $.TEXTAREA, $.TFOOT, $.TH, $.THEAD, $.TITLE, $.TR, $.TRACK, $.UL, $.WBR, $.XMP]), [NS.MATHML]: /* @__PURE__ */ new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]), [NS.SVG]: /* @__PURE__ */ new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]), [NS.XLINK]: /* @__PURE__ */ new Set(), [NS.XML]: /* @__PURE__ */ new Set(), [NS.XMLNS]: /* @__PURE__ */ new Set() }, NUMBERED_HEADERS = /* @__PURE__ */ new Set([$.H1, $.H2, $.H3, $.H4, $.H5, $.H6]), TAG_NAMES.STYLE, TAG_NAMES.SCRIPT, TAG_NAMES.XMP, TAG_NAMES.IFRAME, TAG_NAMES.NOEMBED, TAG_NAMES.NOFRAMES, TAG_NAMES.PLAINTEXT;
    } });
    function isAsciiUpper(e2) {
      return e2 >= CODE_POINTS.LATIN_CAPITAL_A && e2 <= CODE_POINTS.LATIN_CAPITAL_Z;
    }
    function isAsciiLetter(e2) {
      return function(e3) {
        return e3 >= CODE_POINTS.LATIN_SMALL_A && e3 <= CODE_POINTS.LATIN_SMALL_Z;
      }(e2) || isAsciiUpper(e2);
    }
    function isAsciiAlphaNumeric2(e2) {
      return isAsciiLetter(e2) || function(e3) {
        return e3 >= CODE_POINTS.DIGIT_0 && e3 <= CODE_POINTS.DIGIT_9;
      }(e2);
    }
    function toAsciiLower(e2) {
      return e2 + 32;
    }
    function isWhitespace(e2) {
      return e2 === CODE_POINTS.SPACE || e2 === CODE_POINTS.LINE_FEED || e2 === CODE_POINTS.TABULATION || e2 === CODE_POINTS.FORM_FEED;
    }
    function isScriptDataDoubleEscapeSequenceEnd(e2) {
      return isWhitespace(e2) || e2 === CODE_POINTS.SOLIDUS || e2 === CODE_POINTS.GREATER_THAN_SIGN;
    }
    var IMPLICIT_END_TAG_REQUIRED;
    var IMPLICIT_END_TAG_REQUIRED_THOROUGHLY;
    var SCOPING_ELEMENTS_HTML;
    var SCOPING_ELEMENTS_HTML_LIST;
    var SCOPING_ELEMENTS_HTML_BUTTON;
    var SCOPING_ELEMENTS_MATHML;
    var SCOPING_ELEMENTS_SVG;
    var TABLE_ROW_CONTEXT;
    var TABLE_BODY_CONTEXT;
    var TABLE_CONTEXT;
    var TABLE_CELLS;
    var OpenElementStack;
    var EntryType;
    var MARKER;
    var FormattingElementList;
    var defaultTreeAdapter;
    var VALID_DOCTYPE_NAME;
    var VALID_SYSTEM_ID;
    var QUIRKS_MODE_SYSTEM_ID;
    var QUIRKS_MODE_PUBLIC_ID_PREFIXES;
    var QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES;
    var QUIRKS_MODE_PUBLIC_IDS;
    var LIMITED_QUIRKS_PUBLIC_ID_PREFIXES;
    var LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
    var init_tokenizer = __esm2({ "node_modules/parse5/dist/tokenizer/index.js"() {
      var e2;
      init_preprocessor(), init_unicode(), init_token2(), init_decode(), init_error_codes(), init_html22(), (e2 = State || (State = {}))[e2.DATA = 0] = "DATA", e2[e2.RCDATA = 1] = "RCDATA", e2[e2.RAWTEXT = 2] = "RAWTEXT", e2[e2.SCRIPT_DATA = 3] = "SCRIPT_DATA", e2[e2.PLAINTEXT = 4] = "PLAINTEXT", e2[e2.TAG_OPEN = 5] = "TAG_OPEN", e2[e2.END_TAG_OPEN = 6] = "END_TAG_OPEN", e2[e2.TAG_NAME = 7] = "TAG_NAME", e2[e2.RCDATA_LESS_THAN_SIGN = 8] = "RCDATA_LESS_THAN_SIGN", e2[e2.RCDATA_END_TAG_OPEN = 9] = "RCDATA_END_TAG_OPEN", e2[e2.RCDATA_END_TAG_NAME = 10] = "RCDATA_END_TAG_NAME", e2[e2.RAWTEXT_LESS_THAN_SIGN = 11] = "RAWTEXT_LESS_THAN_SIGN", e2[e2.RAWTEXT_END_TAG_OPEN = 12] = "RAWTEXT_END_TAG_OPEN", e2[e2.RAWTEXT_END_TAG_NAME = 13] = "RAWTEXT_END_TAG_NAME", e2[e2.SCRIPT_DATA_LESS_THAN_SIGN = 14] = "SCRIPT_DATA_LESS_THAN_SIGN", e2[e2.SCRIPT_DATA_END_TAG_OPEN = 15] = "SCRIPT_DATA_END_TAG_OPEN", e2[e2.SCRIPT_DATA_END_TAG_NAME = 16] = "SCRIPT_DATA_END_TAG_NAME", e2[e2.SCRIPT_DATA_ESCAPE_START = 17] = "SCRIPT_DATA_ESCAPE_START", e2[e2.SCRIPT_DATA_ESCAPE_START_DASH = 18] = "SCRIPT_DATA_ESCAPE_START_DASH", e2[e2.SCRIPT_DATA_ESCAPED = 19] = "SCRIPT_DATA_ESCAPED", e2[e2.SCRIPT_DATA_ESCAPED_DASH = 20] = "SCRIPT_DATA_ESCAPED_DASH", e2[e2.SCRIPT_DATA_ESCAPED_DASH_DASH = 21] = "SCRIPT_DATA_ESCAPED_DASH_DASH", e2[e2.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 22] = "SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN", e2[e2.SCRIPT_DATA_ESCAPED_END_TAG_OPEN = 23] = "SCRIPT_DATA_ESCAPED_END_TAG_OPEN", e2[e2.SCRIPT_DATA_ESCAPED_END_TAG_NAME = 24] = "SCRIPT_DATA_ESCAPED_END_TAG_NAME", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPE_START = 25] = "SCRIPT_DATA_DOUBLE_ESCAPE_START", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPED = 26] = "SCRIPT_DATA_DOUBLE_ESCAPED", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 27] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 28] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 29] = "SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN", e2[e2.SCRIPT_DATA_DOUBLE_ESCAPE_END = 30] = "SCRIPT_DATA_DOUBLE_ESCAPE_END", e2[e2.BEFORE_ATTRIBUTE_NAME = 31] = "BEFORE_ATTRIBUTE_NAME", e2[e2.ATTRIBUTE_NAME = 32] = "ATTRIBUTE_NAME", e2[e2.AFTER_ATTRIBUTE_NAME = 33] = "AFTER_ATTRIBUTE_NAME", e2[e2.BEFORE_ATTRIBUTE_VALUE = 34] = "BEFORE_ATTRIBUTE_VALUE", e2[e2.ATTRIBUTE_VALUE_DOUBLE_QUOTED = 35] = "ATTRIBUTE_VALUE_DOUBLE_QUOTED", e2[e2.ATTRIBUTE_VALUE_SINGLE_QUOTED = 36] = "ATTRIBUTE_VALUE_SINGLE_QUOTED", e2[e2.ATTRIBUTE_VALUE_UNQUOTED = 37] = "ATTRIBUTE_VALUE_UNQUOTED", e2[e2.AFTER_ATTRIBUTE_VALUE_QUOTED = 38] = "AFTER_ATTRIBUTE_VALUE_QUOTED", e2[e2.SELF_CLOSING_START_TAG = 39] = "SELF_CLOSING_START_TAG", e2[e2.BOGUS_COMMENT = 40] = "BOGUS_COMMENT", e2[e2.MARKUP_DECLARATION_OPEN = 41] = "MARKUP_DECLARATION_OPEN", e2[e2.COMMENT_START = 42] = "COMMENT_START", e2[e2.COMMENT_START_DASH = 43] = "COMMENT_START_DASH", e2[e2.COMMENT = 44] = "COMMENT", e2[e2.COMMENT_LESS_THAN_SIGN = 45] = "COMMENT_LESS_THAN_SIGN", e2[e2.COMMENT_LESS_THAN_SIGN_BANG = 46] = "COMMENT_LESS_THAN_SIGN_BANG", e2[e2.COMMENT_LESS_THAN_SIGN_BANG_DASH = 47] = "COMMENT_LESS_THAN_SIGN_BANG_DASH", e2[e2.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH = 48] = "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH", e2[e2.COMMENT_END_DASH = 49] = "COMMENT_END_DASH", e2[e2.COMMENT_END = 50] = "COMMENT_END", e2[e2.COMMENT_END_BANG = 51] = "COMMENT_END_BANG", e2[e2.DOCTYPE = 52] = "DOCTYPE", e2[e2.BEFORE_DOCTYPE_NAME = 53] = "BEFORE_DOCTYPE_NAME", e2[e2.DOCTYPE_NAME = 54] = "DOCTYPE_NAME", e2[e2.AFTER_DOCTYPE_NAME = 55] = "AFTER_DOCTYPE_NAME", e2[e2.AFTER_DOCTYPE_PUBLIC_KEYWORD = 56] = "AFTER_DOCTYPE_PUBLIC_KEYWORD", e2[e2.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 57] = "BEFORE_DOCTYPE_PUBLIC_IDENTIFIER", e2[e2.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 58] = "DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED", e2[e2.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 59] = "DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED", e2[e2.AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 60] = "AFTER_DOCTYPE_PUBLIC_IDENTIFIER", e2[e2.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 61] = "BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS", e2[e2.AFTER_DOCTYPE_SYSTEM_KEYWORD = 62] = "AFTER_DOCTYPE_SYSTEM_KEYWORD", e2[e2.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 63] = "BEFORE_DOCTYPE_SYSTEM_IDENTIFIER", e2[e2.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 64] = "DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED", e2[e2.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 65] = "DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED", e2[e2.AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 66] = "AFTER_DOCTYPE_SYSTEM_IDENTIFIER", e2[e2.BOGUS_DOCTYPE = 67] = "BOGUS_DOCTYPE", e2[e2.CDATA_SECTION = 68] = "CDATA_SECTION", e2[e2.CDATA_SECTION_BRACKET = 69] = "CDATA_SECTION_BRACKET", e2[e2.CDATA_SECTION_END = 70] = "CDATA_SECTION_END", e2[e2.CHARACTER_REFERENCE = 71] = "CHARACTER_REFERENCE", e2[e2.AMBIGUOUS_AMPERSAND = 72] = "AMBIGUOUS_AMPERSAND", TokenizerMode = { DATA: State.DATA, RCDATA: State.RCDATA, RAWTEXT: State.RAWTEXT, SCRIPT_DATA: State.SCRIPT_DATA, PLAINTEXT: State.PLAINTEXT, CDATA_SECTION: State.CDATA_SECTION }, Tokenizer = class {
        constructor(e3, t2) {
          this.options = e3, this.handler = t2, this.paused = false, this.inLoop = false, this.inForeignNode = false, this.lastStartTagName = "", this.active = false, this.state = State.DATA, this.returnState = State.DATA, this.entityStartPos = 0, this.consumedAfterSnapshot = -1, this.currentCharacterToken = null, this.currentToken = null, this.currentAttr = { name: "", value: "" }, this.preprocessor = new Preprocessor(t2), this.currentLocation = this.getCurrentLocation(-1), this.entityDecoder = new EntityDecoder(htmlDecodeTree, (e4, t3) => {
            this.preprocessor.pos = this.entityStartPos + t3 - 1, this._flushCodePointConsumedAsCharacterReference(e4);
          }, t2.onParseError ? { missingSemicolonAfterCharacterReference: () => {
            this._err(ERR.missingSemicolonAfterCharacterReference, 1);
          }, absenceOfDigitsInNumericCharacterReference: (e4) => {
            this._err(ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + e4);
          }, validateNumericCharacterReference: (e4) => {
            const t3 = function(e5) {
              return e5 === CODE_POINTS.NULL ? ERR.nullCharacterReference : e5 > 1114111 ? ERR.characterReferenceOutsideUnicodeRange : isSurrogate(e5) ? ERR.surrogateCharacterReference : isUndefinedCodePoint(e5) ? ERR.noncharacterCharacterReference : isControlCodePoint(e5) || e5 === CODE_POINTS.CARRIAGE_RETURN ? ERR.controlCharacterReference : null;
            }(e4);
            t3 && this._err(t3, 1);
          } } : void 0);
        }
        _err(e3, t2 = 0) {
          var n3, r;
          null === (r = (n3 = this.handler).onParseError) || void 0 === r || r.call(n3, this.preprocessor.getError(e3, t2));
        }
        getCurrentLocation(e3) {
          return this.options.sourceCodeLocationInfo ? { startLine: this.preprocessor.line, startCol: this.preprocessor.col - e3, startOffset: this.preprocessor.offset - e3, endLine: -1, endCol: -1, endOffset: -1 } : null;
        }
        _runParsingLoop() {
          if (!this.inLoop) {
            for (this.inLoop = true; this.active && !this.paused; ) {
              this.consumedAfterSnapshot = 0;
              const e3 = this._consume();
              this._ensureHibernation() || this._callState(e3);
            }
            this.inLoop = false;
          }
        }
        pause() {
          this.paused = true;
        }
        resume(e3) {
          if (!this.paused) throw new Error("Parser was already resumed");
          this.paused = false, this.inLoop || (this._runParsingLoop(), this.paused || null == e3 || e3());
        }
        write(e3, t2, n3) {
          this.active = true, this.preprocessor.write(e3, t2), this._runParsingLoop(), this.paused || null == n3 || n3();
        }
        insertHtmlAtCurrentPos(e3) {
          this.active = true, this.preprocessor.insertHtmlAtCurrentPos(e3), this._runParsingLoop();
        }
        _ensureHibernation() {
          return !!this.preprocessor.endOfChunkHit && (this.preprocessor.retreat(this.consumedAfterSnapshot), this.consumedAfterSnapshot = 0, this.active = false, true);
        }
        _consume() {
          return this.consumedAfterSnapshot++, this.preprocessor.advance();
        }
        _advanceBy(e3) {
          this.consumedAfterSnapshot += e3;
          for (let t2 = 0; t2 < e3; t2++) this.preprocessor.advance();
        }
        _consumeSequenceIfMatch(e3, t2) {
          return !!this.preprocessor.startsWith(e3, t2) && (this._advanceBy(e3.length - 1), true);
        }
        _createStartTagToken() {
          this.currentToken = { type: TokenType.START_TAG, tagName: "", tagID: TAG_ID.UNKNOWN, selfClosing: false, ackSelfClosing: false, attrs: [], location: this.getCurrentLocation(1) };
        }
        _createEndTagToken() {
          this.currentToken = { type: TokenType.END_TAG, tagName: "", tagID: TAG_ID.UNKNOWN, selfClosing: false, ackSelfClosing: false, attrs: [], location: this.getCurrentLocation(2) };
        }
        _createCommentToken(e3) {
          this.currentToken = { type: TokenType.COMMENT, data: "", location: this.getCurrentLocation(e3) };
        }
        _createDoctypeToken(e3) {
          this.currentToken = { type: TokenType.DOCTYPE, name: e3, forceQuirks: false, publicId: null, systemId: null, location: this.currentLocation };
        }
        _createCharacterToken(e3, t2) {
          this.currentCharacterToken = { type: e3, chars: t2, location: this.currentLocation };
        }
        _createAttr(e3) {
          this.currentAttr = { name: e3, value: "" }, this.currentLocation = this.getCurrentLocation(0);
        }
        _leaveAttrName() {
          var e3, t2;
          const n3 = this.currentToken;
          null === getTokenAttr(n3, this.currentAttr.name) ? (n3.attrs.push(this.currentAttr), n3.location && this.currentLocation && ((null !== (e3 = (t2 = n3.location).attrs) && void 0 !== e3 ? e3 : t2.attrs = /* @__PURE__ */ Object.create(null))[this.currentAttr.name] = this.currentLocation, this._leaveAttrValue())) : this._err(ERR.duplicateAttribute);
        }
        _leaveAttrValue() {
          this.currentLocation && (this.currentLocation.endLine = this.preprocessor.line, this.currentLocation.endCol = this.preprocessor.col, this.currentLocation.endOffset = this.preprocessor.offset);
        }
        prepareToken(e3) {
          this._emitCurrentCharacterToken(e3.location), this.currentToken = null, e3.location && (e3.location.endLine = this.preprocessor.line, e3.location.endCol = this.preprocessor.col + 1, e3.location.endOffset = this.preprocessor.offset + 1), this.currentLocation = this.getCurrentLocation(-1);
        }
        emitCurrentTagToken() {
          const e3 = this.currentToken;
          this.prepareToken(e3), e3.tagID = getTagID(e3.tagName), e3.type === TokenType.START_TAG ? (this.lastStartTagName = e3.tagName, this.handler.onStartTag(e3)) : (e3.attrs.length > 0 && this._err(ERR.endTagWithAttributes), e3.selfClosing && this._err(ERR.endTagWithTrailingSolidus), this.handler.onEndTag(e3)), this.preprocessor.dropParsedChunk();
        }
        emitCurrentComment(e3) {
          this.prepareToken(e3), this.handler.onComment(e3), this.preprocessor.dropParsedChunk();
        }
        emitCurrentDoctype(e3) {
          this.prepareToken(e3), this.handler.onDoctype(e3), this.preprocessor.dropParsedChunk();
        }
        _emitCurrentCharacterToken(e3) {
          if (this.currentCharacterToken) {
            switch (e3 && this.currentCharacterToken.location && (this.currentCharacterToken.location.endLine = e3.startLine, this.currentCharacterToken.location.endCol = e3.startCol, this.currentCharacterToken.location.endOffset = e3.startOffset), this.currentCharacterToken.type) {
              case TokenType.CHARACTER:
                this.handler.onCharacter(this.currentCharacterToken);
                break;
              case TokenType.NULL_CHARACTER:
                this.handler.onNullCharacter(this.currentCharacterToken);
                break;
              case TokenType.WHITESPACE_CHARACTER:
                this.handler.onWhitespaceCharacter(this.currentCharacterToken);
            }
            this.currentCharacterToken = null;
          }
        }
        _emitEOFToken() {
          const e3 = this.getCurrentLocation(0);
          e3 && (e3.endLine = e3.startLine, e3.endCol = e3.startCol, e3.endOffset = e3.startOffset), this._emitCurrentCharacterToken(e3), this.handler.onEof({ type: TokenType.EOF, location: e3 }), this.active = false;
        }
        _appendCharToCurrentCharacterToken(e3, t2) {
          if (this.currentCharacterToken) {
            if (this.currentCharacterToken.type === e3) return void (this.currentCharacterToken.chars += t2);
            this.currentLocation = this.getCurrentLocation(0), this._emitCurrentCharacterToken(this.currentLocation), this.preprocessor.dropParsedChunk();
          }
          this._createCharacterToken(e3, t2);
        }
        _emitCodePoint(e3) {
          const t2 = isWhitespace(e3) ? TokenType.WHITESPACE_CHARACTER : e3 === CODE_POINTS.NULL ? TokenType.NULL_CHARACTER : TokenType.CHARACTER;
          this._appendCharToCurrentCharacterToken(t2, String.fromCodePoint(e3));
        }
        _emitChars(e3) {
          this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, e3);
        }
        _startCharacterReference() {
          this.returnState = this.state, this.state = State.CHARACTER_REFERENCE, this.entityStartPos = this.preprocessor.pos, this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute() ? DecodingMode.Attribute : DecodingMode.Legacy);
        }
        _isCharacterReferenceInAttribute() {
          return this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED;
        }
        _flushCodePointConsumedAsCharacterReference(e3) {
          this._isCharacterReferenceInAttribute() ? this.currentAttr.value += String.fromCodePoint(e3) : this._emitCodePoint(e3);
        }
        _callState(e3) {
          switch (this.state) {
            case State.DATA:
              this._stateData(e3);
              break;
            case State.RCDATA:
              this._stateRcdata(e3);
              break;
            case State.RAWTEXT:
              this._stateRawtext(e3);
              break;
            case State.SCRIPT_DATA:
              this._stateScriptData(e3);
              break;
            case State.PLAINTEXT:
              this._statePlaintext(e3);
              break;
            case State.TAG_OPEN:
              this._stateTagOpen(e3);
              break;
            case State.END_TAG_OPEN:
              this._stateEndTagOpen(e3);
              break;
            case State.TAG_NAME:
              this._stateTagName(e3);
              break;
            case State.RCDATA_LESS_THAN_SIGN:
              this._stateRcdataLessThanSign(e3);
              break;
            case State.RCDATA_END_TAG_OPEN:
              this._stateRcdataEndTagOpen(e3);
              break;
            case State.RCDATA_END_TAG_NAME:
              this._stateRcdataEndTagName(e3);
              break;
            case State.RAWTEXT_LESS_THAN_SIGN:
              this._stateRawtextLessThanSign(e3);
              break;
            case State.RAWTEXT_END_TAG_OPEN:
              this._stateRawtextEndTagOpen(e3);
              break;
            case State.RAWTEXT_END_TAG_NAME:
              this._stateRawtextEndTagName(e3);
              break;
            case State.SCRIPT_DATA_LESS_THAN_SIGN:
              this._stateScriptDataLessThanSign(e3);
              break;
            case State.SCRIPT_DATA_END_TAG_OPEN:
              this._stateScriptDataEndTagOpen(e3);
              break;
            case State.SCRIPT_DATA_END_TAG_NAME:
              this._stateScriptDataEndTagName(e3);
              break;
            case State.SCRIPT_DATA_ESCAPE_START:
              this._stateScriptDataEscapeStart(e3);
              break;
            case State.SCRIPT_DATA_ESCAPE_START_DASH:
              this._stateScriptDataEscapeStartDash(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED:
              this._stateScriptDataEscaped(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED_DASH:
              this._stateScriptDataEscapedDash(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED_DASH_DASH:
              this._stateScriptDataEscapedDashDash(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
              this._stateScriptDataEscapedLessThanSign(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:
              this._stateScriptDataEscapedEndTagOpen(e3);
              break;
            case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME:
              this._stateScriptDataEscapedEndTagName(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPE_START:
              this._stateScriptDataDoubleEscapeStart(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPED:
              this._stateScriptDataDoubleEscaped(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
              this._stateScriptDataDoubleEscapedDash(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
              this._stateScriptDataDoubleEscapedDashDash(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
              this._stateScriptDataDoubleEscapedLessThanSign(e3);
              break;
            case State.SCRIPT_DATA_DOUBLE_ESCAPE_END:
              this._stateScriptDataDoubleEscapeEnd(e3);
              break;
            case State.BEFORE_ATTRIBUTE_NAME:
              this._stateBeforeAttributeName(e3);
              break;
            case State.ATTRIBUTE_NAME:
              this._stateAttributeName(e3);
              break;
            case State.AFTER_ATTRIBUTE_NAME:
              this._stateAfterAttributeName(e3);
              break;
            case State.BEFORE_ATTRIBUTE_VALUE:
              this._stateBeforeAttributeValue(e3);
              break;
            case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED:
              this._stateAttributeValueDoubleQuoted(e3);
              break;
            case State.ATTRIBUTE_VALUE_SINGLE_QUOTED:
              this._stateAttributeValueSingleQuoted(e3);
              break;
            case State.ATTRIBUTE_VALUE_UNQUOTED:
              this._stateAttributeValueUnquoted(e3);
              break;
            case State.AFTER_ATTRIBUTE_VALUE_QUOTED:
              this._stateAfterAttributeValueQuoted(e3);
              break;
            case State.SELF_CLOSING_START_TAG:
              this._stateSelfClosingStartTag(e3);
              break;
            case State.BOGUS_COMMENT:
              this._stateBogusComment(e3);
              break;
            case State.MARKUP_DECLARATION_OPEN:
              this._stateMarkupDeclarationOpen(e3);
              break;
            case State.COMMENT_START:
              this._stateCommentStart(e3);
              break;
            case State.COMMENT_START_DASH:
              this._stateCommentStartDash(e3);
              break;
            case State.COMMENT:
              this._stateComment(e3);
              break;
            case State.COMMENT_LESS_THAN_SIGN:
              this._stateCommentLessThanSign(e3);
              break;
            case State.COMMENT_LESS_THAN_SIGN_BANG:
              this._stateCommentLessThanSignBang(e3);
              break;
            case State.COMMENT_LESS_THAN_SIGN_BANG_DASH:
              this._stateCommentLessThanSignBangDash(e3);
              break;
            case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:
              this._stateCommentLessThanSignBangDashDash(e3);
              break;
            case State.COMMENT_END_DASH:
              this._stateCommentEndDash(e3);
              break;
            case State.COMMENT_END:
              this._stateCommentEnd(e3);
              break;
            case State.COMMENT_END_BANG:
              this._stateCommentEndBang(e3);
              break;
            case State.DOCTYPE:
              this._stateDoctype(e3);
              break;
            case State.BEFORE_DOCTYPE_NAME:
              this._stateBeforeDoctypeName(e3);
              break;
            case State.DOCTYPE_NAME:
              this._stateDoctypeName(e3);
              break;
            case State.AFTER_DOCTYPE_NAME:
              this._stateAfterDoctypeName(e3);
              break;
            case State.AFTER_DOCTYPE_PUBLIC_KEYWORD:
              this._stateAfterDoctypePublicKeyword(e3);
              break;
            case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
              this._stateBeforeDoctypePublicIdentifier(e3);
              break;
            case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
              this._stateDoctypePublicIdentifierDoubleQuoted(e3);
              break;
            case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
              this._stateDoctypePublicIdentifierSingleQuoted(e3);
              break;
            case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
              this._stateAfterDoctypePublicIdentifier(e3);
              break;
            case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
              this._stateBetweenDoctypePublicAndSystemIdentifiers(e3);
              break;
            case State.AFTER_DOCTYPE_SYSTEM_KEYWORD:
              this._stateAfterDoctypeSystemKeyword(e3);
              break;
            case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
              this._stateBeforeDoctypeSystemIdentifier(e3);
              break;
            case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
              this._stateDoctypeSystemIdentifierDoubleQuoted(e3);
              break;
            case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
              this._stateDoctypeSystemIdentifierSingleQuoted(e3);
              break;
            case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
              this._stateAfterDoctypeSystemIdentifier(e3);
              break;
            case State.BOGUS_DOCTYPE:
              this._stateBogusDoctype(e3);
              break;
            case State.CDATA_SECTION:
              this._stateCdataSection(e3);
              break;
            case State.CDATA_SECTION_BRACKET:
              this._stateCdataSectionBracket(e3);
              break;
            case State.CDATA_SECTION_END:
              this._stateCdataSectionEnd(e3);
              break;
            case State.CHARACTER_REFERENCE:
              this._stateCharacterReference();
              break;
            case State.AMBIGUOUS_AMPERSAND:
              this._stateAmbiguousAmpersand(e3);
              break;
            default:
              throw new Error("Unknown state");
          }
        }
        _stateData(e3) {
          switch (e3) {
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.TAG_OPEN;
              break;
            case CODE_POINTS.AMPERSAND:
              this._startCharacterReference();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitCodePoint(e3);
              break;
            case CODE_POINTS.EOF:
              this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateRcdata(e3) {
          switch (e3) {
            case CODE_POINTS.AMPERSAND:
              this._startCharacterReference();
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.RCDATA_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateRawtext(e3) {
          switch (e3) {
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.RAWTEXT_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateScriptData(e3) {
          switch (e3) {
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _statePlaintext(e3) {
          switch (e3) {
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateTagOpen(e3) {
          if (isAsciiLetter(e3)) this._createStartTagToken(), this.state = State.TAG_NAME, this._stateTagName(e3);
          else switch (e3) {
            case CODE_POINTS.EXCLAMATION_MARK:
              this.state = State.MARKUP_DECLARATION_OPEN;
              break;
            case CODE_POINTS.SOLIDUS:
              this.state = State.END_TAG_OPEN;
              break;
            case CODE_POINTS.QUESTION_MARK:
              this._err(ERR.unexpectedQuestionMarkInsteadOfTagName), this._createCommentToken(1), this.state = State.BOGUS_COMMENT, this._stateBogusComment(e3);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofBeforeTagName), this._emitChars("<"), this._emitEOFToken();
              break;
            default:
              this._err(ERR.invalidFirstCharacterOfTagName), this._emitChars("<"), this.state = State.DATA, this._stateData(e3);
          }
        }
        _stateEndTagOpen(e3) {
          if (isAsciiLetter(e3)) this._createEndTagToken(), this.state = State.TAG_NAME, this._stateTagName(e3);
          else switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingEndTagName), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofBeforeTagName), this._emitChars("</"), this._emitEOFToken();
              break;
            default:
              this._err(ERR.invalidFirstCharacterOfTagName), this._createCommentToken(2), this.state = State.BOGUS_COMMENT, this._stateBogusComment(e3);
          }
        }
        _stateTagName(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.BEFORE_ATTRIBUTE_NAME;
              break;
            case CODE_POINTS.SOLIDUS:
              this.state = State.SELF_CLOSING_START_TAG;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentTagToken();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.tagName += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              t2.tagName += String.fromCodePoint(isAsciiUpper(e3) ? toAsciiLower(e3) : e3);
          }
        }
        _stateRcdataLessThanSign(e3) {
          e3 === CODE_POINTS.SOLIDUS ? this.state = State.RCDATA_END_TAG_OPEN : (this._emitChars("<"), this.state = State.RCDATA, this._stateRcdata(e3));
        }
        _stateRcdataEndTagOpen(e3) {
          isAsciiLetter(e3) ? (this.state = State.RCDATA_END_TAG_NAME, this._stateRcdataEndTagName(e3)) : (this._emitChars("</"), this.state = State.RCDATA, this._stateRcdata(e3));
        }
        handleSpecialEndTag(e3) {
          if (!this.preprocessor.startsWith(this.lastStartTagName, false)) return !this._ensureHibernation();
          switch (this._createEndTagToken(), this.currentToken.tagName = this.lastStartTagName, this.preprocessor.peek(this.lastStartTagName.length)) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              return this._advanceBy(this.lastStartTagName.length), this.state = State.BEFORE_ATTRIBUTE_NAME, false;
            case CODE_POINTS.SOLIDUS:
              return this._advanceBy(this.lastStartTagName.length), this.state = State.SELF_CLOSING_START_TAG, false;
            case CODE_POINTS.GREATER_THAN_SIGN:
              return this._advanceBy(this.lastStartTagName.length), this.emitCurrentTagToken(), this.state = State.DATA, false;
            default:
              return !this._ensureHibernation();
          }
        }
        _stateRcdataEndTagName(e3) {
          this.handleSpecialEndTag(e3) && (this._emitChars("</"), this.state = State.RCDATA, this._stateRcdata(e3));
        }
        _stateRawtextLessThanSign(e3) {
          e3 === CODE_POINTS.SOLIDUS ? this.state = State.RAWTEXT_END_TAG_OPEN : (this._emitChars("<"), this.state = State.RAWTEXT, this._stateRawtext(e3));
        }
        _stateRawtextEndTagOpen(e3) {
          isAsciiLetter(e3) ? (this.state = State.RAWTEXT_END_TAG_NAME, this._stateRawtextEndTagName(e3)) : (this._emitChars("</"), this.state = State.RAWTEXT, this._stateRawtext(e3));
        }
        _stateRawtextEndTagName(e3) {
          this.handleSpecialEndTag(e3) && (this._emitChars("</"), this.state = State.RAWTEXT, this._stateRawtext(e3));
        }
        _stateScriptDataLessThanSign(e3) {
          switch (e3) {
            case CODE_POINTS.SOLIDUS:
              this.state = State.SCRIPT_DATA_END_TAG_OPEN;
              break;
            case CODE_POINTS.EXCLAMATION_MARK:
              this.state = State.SCRIPT_DATA_ESCAPE_START, this._emitChars("<!");
              break;
            default:
              this._emitChars("<"), this.state = State.SCRIPT_DATA, this._stateScriptData(e3);
          }
        }
        _stateScriptDataEndTagOpen(e3) {
          isAsciiLetter(e3) ? (this.state = State.SCRIPT_DATA_END_TAG_NAME, this._stateScriptDataEndTagName(e3)) : (this._emitChars("</"), this.state = State.SCRIPT_DATA, this._stateScriptData(e3));
        }
        _stateScriptDataEndTagName(e3) {
          this.handleSpecialEndTag(e3) && (this._emitChars("</"), this.state = State.SCRIPT_DATA, this._stateScriptData(e3));
        }
        _stateScriptDataEscapeStart(e3) {
          e3 === CODE_POINTS.HYPHEN_MINUS ? (this.state = State.SCRIPT_DATA_ESCAPE_START_DASH, this._emitChars("-")) : (this.state = State.SCRIPT_DATA, this._stateScriptData(e3));
        }
        _stateScriptDataEscapeStartDash(e3) {
          e3 === CODE_POINTS.HYPHEN_MINUS ? (this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH, this._emitChars("-")) : (this.state = State.SCRIPT_DATA, this._stateScriptData(e3));
        }
        _stateScriptDataEscaped(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.SCRIPT_DATA_ESCAPED_DASH, this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateScriptDataEscapedDash(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH, this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.state = State.SCRIPT_DATA_ESCAPED, this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this.state = State.SCRIPT_DATA_ESCAPED, this._emitCodePoint(e3);
          }
        }
        _stateScriptDataEscapedDashDash(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.SCRIPT_DATA, this._emitChars(">");
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.state = State.SCRIPT_DATA_ESCAPED, this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this.state = State.SCRIPT_DATA_ESCAPED, this._emitCodePoint(e3);
          }
        }
        _stateScriptDataEscapedLessThanSign(e3) {
          e3 === CODE_POINTS.SOLIDUS ? this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN : isAsciiLetter(e3) ? (this._emitChars("<"), this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START, this._stateScriptDataDoubleEscapeStart(e3)) : (this._emitChars("<"), this.state = State.SCRIPT_DATA_ESCAPED, this._stateScriptDataEscaped(e3));
        }
        _stateScriptDataEscapedEndTagOpen(e3) {
          isAsciiLetter(e3) ? (this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME, this._stateScriptDataEscapedEndTagName(e3)) : (this._emitChars("</"), this.state = State.SCRIPT_DATA_ESCAPED, this._stateScriptDataEscaped(e3));
        }
        _stateScriptDataEscapedEndTagName(e3) {
          this.handleSpecialEndTag(e3) && (this._emitChars("</"), this.state = State.SCRIPT_DATA_ESCAPED, this._stateScriptDataEscaped(e3));
        }
        _stateScriptDataDoubleEscapeStart(e3) {
          if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
            this._emitCodePoint(e3);
            for (let e4 = 0; e4 < SEQUENCES.SCRIPT.length; e4++) this._emitCodePoint(this._consume());
            this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
          } else this._ensureHibernation() || (this.state = State.SCRIPT_DATA_ESCAPED, this._stateScriptDataEscaped(e3));
        }
        _stateScriptDataDoubleEscaped(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH, this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, this._emitChars("<");
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateScriptDataDoubleEscapedDash(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH, this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, this._emitChars("<");
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._emitCodePoint(e3);
          }
        }
        _stateScriptDataDoubleEscapedDashDash(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this._emitChars("-");
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, this._emitChars("<");
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.SCRIPT_DATA, this._emitChars(">");
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._emitChars(REPLACEMENT_CHARACTER);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInScriptHtmlCommentLikeText), this._emitEOFToken();
              break;
            default:
              this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._emitCodePoint(e3);
          }
        }
        _stateScriptDataDoubleEscapedLessThanSign(e3) {
          e3 === CODE_POINTS.SOLIDUS ? (this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END, this._emitChars("/")) : (this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._stateScriptDataDoubleEscaped(e3));
        }
        _stateScriptDataDoubleEscapeEnd(e3) {
          if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
            this._emitCodePoint(e3);
            for (let e4 = 0; e4 < SEQUENCES.SCRIPT.length; e4++) this._emitCodePoint(this._consume());
            this.state = State.SCRIPT_DATA_ESCAPED;
          } else this._ensureHibernation() || (this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED, this._stateScriptDataDoubleEscaped(e3));
        }
        _stateBeforeAttributeName(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.SOLIDUS:
            case CODE_POINTS.GREATER_THAN_SIGN:
            case CODE_POINTS.EOF:
              this.state = State.AFTER_ATTRIBUTE_NAME, this._stateAfterAttributeName(e3);
              break;
            case CODE_POINTS.EQUALS_SIGN:
              this._err(ERR.unexpectedEqualsSignBeforeAttributeName), this._createAttr("="), this.state = State.ATTRIBUTE_NAME;
              break;
            default:
              this._createAttr(""), this.state = State.ATTRIBUTE_NAME, this._stateAttributeName(e3);
          }
        }
        _stateAttributeName(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
            case CODE_POINTS.SOLIDUS:
            case CODE_POINTS.GREATER_THAN_SIGN:
            case CODE_POINTS.EOF:
              this._leaveAttrName(), this.state = State.AFTER_ATTRIBUTE_NAME, this._stateAfterAttributeName(e3);
              break;
            case CODE_POINTS.EQUALS_SIGN:
              this._leaveAttrName(), this.state = State.BEFORE_ATTRIBUTE_VALUE;
              break;
            case CODE_POINTS.QUOTATION_MARK:
            case CODE_POINTS.APOSTROPHE:
            case CODE_POINTS.LESS_THAN_SIGN:
              this._err(ERR.unexpectedCharacterInAttributeName), this.currentAttr.name += String.fromCodePoint(e3);
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.currentAttr.name += REPLACEMENT_CHARACTER;
              break;
            default:
              this.currentAttr.name += String.fromCodePoint(isAsciiUpper(e3) ? toAsciiLower(e3) : e3);
          }
        }
        _stateAfterAttributeName(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.SOLIDUS:
              this.state = State.SELF_CLOSING_START_TAG;
              break;
            case CODE_POINTS.EQUALS_SIGN:
              this.state = State.BEFORE_ATTRIBUTE_VALUE;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentTagToken();
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this._createAttr(""), this.state = State.ATTRIBUTE_NAME, this._stateAttributeName(e3);
          }
        }
        _stateBeforeAttributeValue(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.QUOTATION_MARK:
              this.state = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              this.state = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingAttributeValue), this.state = State.DATA, this.emitCurrentTagToken();
              break;
            default:
              this.state = State.ATTRIBUTE_VALUE_UNQUOTED, this._stateAttributeValueUnquoted(e3);
          }
        }
        _stateAttributeValueDoubleQuoted(e3) {
          switch (e3) {
            case CODE_POINTS.QUOTATION_MARK:
              this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
              break;
            case CODE_POINTS.AMPERSAND:
              this._startCharacterReference();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.currentAttr.value += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this.currentAttr.value += String.fromCodePoint(e3);
          }
        }
        _stateAttributeValueSingleQuoted(e3) {
          switch (e3) {
            case CODE_POINTS.APOSTROPHE:
              this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
              break;
            case CODE_POINTS.AMPERSAND:
              this._startCharacterReference();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.currentAttr.value += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this.currentAttr.value += String.fromCodePoint(e3);
          }
        }
        _stateAttributeValueUnquoted(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this._leaveAttrValue(), this.state = State.BEFORE_ATTRIBUTE_NAME;
              break;
            case CODE_POINTS.AMPERSAND:
              this._startCharacterReference();
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._leaveAttrValue(), this.state = State.DATA, this.emitCurrentTagToken();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this.currentAttr.value += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.QUOTATION_MARK:
            case CODE_POINTS.APOSTROPHE:
            case CODE_POINTS.LESS_THAN_SIGN:
            case CODE_POINTS.EQUALS_SIGN:
            case CODE_POINTS.GRAVE_ACCENT:
              this._err(ERR.unexpectedCharacterInUnquotedAttributeValue), this.currentAttr.value += String.fromCodePoint(e3);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this.currentAttr.value += String.fromCodePoint(e3);
          }
        }
        _stateAfterAttributeValueQuoted(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this._leaveAttrValue(), this.state = State.BEFORE_ATTRIBUTE_NAME;
              break;
            case CODE_POINTS.SOLIDUS:
              this._leaveAttrValue(), this.state = State.SELF_CLOSING_START_TAG;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._leaveAttrValue(), this.state = State.DATA, this.emitCurrentTagToken();
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingWhitespaceBetweenAttributes), this.state = State.BEFORE_ATTRIBUTE_NAME, this._stateBeforeAttributeName(e3);
          }
        }
        _stateSelfClosingStartTag(e3) {
          switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.currentToken.selfClosing = true, this.state = State.DATA, this.emitCurrentTagToken();
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInTag), this._emitEOFToken();
              break;
            default:
              this._err(ERR.unexpectedSolidusInTag), this.state = State.BEFORE_ATTRIBUTE_NAME, this._stateBeforeAttributeName(e3);
          }
        }
        _stateBogusComment(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentComment(t2);
              break;
            case CODE_POINTS.EOF:
              this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.data += REPLACEMENT_CHARACTER;
              break;
            default:
              t2.data += String.fromCodePoint(e3);
          }
        }
        _stateMarkupDeclarationOpen(e3) {
          this._consumeSequenceIfMatch(SEQUENCES.DASH_DASH, true) ? (this._createCommentToken(SEQUENCES.DASH_DASH.length + 1), this.state = State.COMMENT_START) : this._consumeSequenceIfMatch(SEQUENCES.DOCTYPE, false) ? (this.currentLocation = this.getCurrentLocation(SEQUENCES.DOCTYPE.length + 1), this.state = State.DOCTYPE) : this._consumeSequenceIfMatch(SEQUENCES.CDATA_START, true) ? this.inForeignNode ? this.state = State.CDATA_SECTION : (this._err(ERR.cdataInHtmlContent), this._createCommentToken(SEQUENCES.CDATA_START.length + 1), this.currentToken.data = "[CDATA[", this.state = State.BOGUS_COMMENT) : this._ensureHibernation() || (this._err(ERR.incorrectlyOpenedComment), this._createCommentToken(2), this.state = State.BOGUS_COMMENT, this._stateBogusComment(e3));
        }
        _stateCommentStart(e3) {
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.COMMENT_START_DASH;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN: {
              this._err(ERR.abruptClosingOfEmptyComment), this.state = State.DATA;
              const e4 = this.currentToken;
              this.emitCurrentComment(e4);
              break;
            }
            default:
              this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateCommentStartDash(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.COMMENT_END;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.abruptClosingOfEmptyComment), this.state = State.DATA, this.emitCurrentComment(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInComment), this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            default:
              t2.data += "-", this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateComment(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.COMMENT_END_DASH;
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              t2.data += "<", this.state = State.COMMENT_LESS_THAN_SIGN;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.data += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInComment), this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            default:
              t2.data += String.fromCodePoint(e3);
          }
        }
        _stateCommentLessThanSign(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.EXCLAMATION_MARK:
              t2.data += "!", this.state = State.COMMENT_LESS_THAN_SIGN_BANG;
              break;
            case CODE_POINTS.LESS_THAN_SIGN:
              t2.data += "<";
              break;
            default:
              this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateCommentLessThanSignBang(e3) {
          e3 === CODE_POINTS.HYPHEN_MINUS ? this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH : (this.state = State.COMMENT, this._stateComment(e3));
        }
        _stateCommentLessThanSignBangDash(e3) {
          e3 === CODE_POINTS.HYPHEN_MINUS ? this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH : (this.state = State.COMMENT_END_DASH, this._stateCommentEndDash(e3));
        }
        _stateCommentLessThanSignBangDashDash(e3) {
          e3 !== CODE_POINTS.GREATER_THAN_SIGN && e3 !== CODE_POINTS.EOF && this._err(ERR.nestedComment), this.state = State.COMMENT_END, this._stateCommentEnd(e3);
        }
        _stateCommentEndDash(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              this.state = State.COMMENT_END;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInComment), this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            default:
              t2.data += "-", this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateCommentEnd(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentComment(t2);
              break;
            case CODE_POINTS.EXCLAMATION_MARK:
              this.state = State.COMMENT_END_BANG;
              break;
            case CODE_POINTS.HYPHEN_MINUS:
              t2.data += "-";
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInComment), this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            default:
              t2.data += "--", this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateCommentEndBang(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.HYPHEN_MINUS:
              t2.data += "--!", this.state = State.COMMENT_END_DASH;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.incorrectlyClosedComment), this.state = State.DATA, this.emitCurrentComment(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInComment), this.emitCurrentComment(t2), this._emitEOFToken();
              break;
            default:
              t2.data += "--!", this.state = State.COMMENT, this._stateComment(e3);
          }
        }
        _stateDoctype(e3) {
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.BEFORE_DOCTYPE_NAME;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.BEFORE_DOCTYPE_NAME, this._stateBeforeDoctypeName(e3);
              break;
            case CODE_POINTS.EOF: {
              this._err(ERR.eofInDoctype), this._createDoctypeToken(null);
              const e4 = this.currentToken;
              e4.forceQuirks = true, this.emitCurrentDoctype(e4), this._emitEOFToken();
              break;
            }
            default:
              this._err(ERR.missingWhitespaceBeforeDoctypeName), this.state = State.BEFORE_DOCTYPE_NAME, this._stateBeforeDoctypeName(e3);
          }
        }
        _stateBeforeDoctypeName(e3) {
          if (isAsciiUpper(e3)) this._createDoctypeToken(String.fromCharCode(toAsciiLower(e3))), this.state = State.DOCTYPE_NAME;
          else switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), this._createDoctypeToken(REPLACEMENT_CHARACTER), this.state = State.DOCTYPE_NAME;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN: {
              this._err(ERR.missingDoctypeName), this._createDoctypeToken(null);
              const e4 = this.currentToken;
              e4.forceQuirks = true, this.emitCurrentDoctype(e4), this.state = State.DATA;
              break;
            }
            case CODE_POINTS.EOF: {
              this._err(ERR.eofInDoctype), this._createDoctypeToken(null);
              const e4 = this.currentToken;
              e4.forceQuirks = true, this.emitCurrentDoctype(e4), this._emitEOFToken();
              break;
            }
            default:
              this._createDoctypeToken(String.fromCodePoint(e3)), this.state = State.DOCTYPE_NAME;
          }
        }
        _stateDoctypeName(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.AFTER_DOCTYPE_NAME;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.name += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              t2.name += String.fromCodePoint(isAsciiUpper(e3) ? toAsciiLower(e3) : e3);
          }
        }
        _stateAfterDoctypeName(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._consumeSequenceIfMatch(SEQUENCES.PUBLIC, false) ? this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD : this._consumeSequenceIfMatch(SEQUENCES.SYSTEM, false) ? this.state = State.AFTER_DOCTYPE_SYSTEM_KEYWORD : this._ensureHibernation() || (this._err(ERR.invalidCharacterSequenceAfterDoctypeName), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3));
          }
        }
        _stateAfterDoctypePublicKeyword(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;
              break;
            case CODE_POINTS.QUOTATION_MARK:
              this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword), t2.publicId = "", this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword), t2.publicId = "", this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingDoctypePublicIdentifier), t2.forceQuirks = true, this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateBeforeDoctypePublicIdentifier(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.QUOTATION_MARK:
              t2.publicId = "", this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              t2.publicId = "", this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingDoctypePublicIdentifier), t2.forceQuirks = true, this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateDoctypePublicIdentifierDoubleQuoted(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.QUOTATION_MARK:
              this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.publicId += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.abruptDoctypePublicIdentifier), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              t2.publicId += String.fromCodePoint(e3);
          }
        }
        _stateDoctypePublicIdentifierSingleQuoted(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.APOSTROPHE:
              this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.publicId += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.abruptDoctypePublicIdentifier), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              t2.publicId += String.fromCodePoint(e3);
          }
        }
        _stateAfterDoctypePublicIdentifier(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.QUOTATION_MARK:
              this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers), t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers), t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateBetweenDoctypePublicAndSystemIdentifiers(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.QUOTATION_MARK:
              t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateAfterDoctypeSystemKeyword(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              this.state = State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;
              break;
            case CODE_POINTS.QUOTATION_MARK:
              this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword), t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword), t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateBeforeDoctypeSystemIdentifier(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.QUOTATION_MARK:
              t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
              break;
            case CODE_POINTS.APOSTROPHE:
              t2.systemId = "", this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.missingDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.DATA, this.emitCurrentDoctype(t2);
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier), t2.forceQuirks = true, this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateDoctypeSystemIdentifierDoubleQuoted(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.QUOTATION_MARK:
              this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.systemId += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.abruptDoctypeSystemIdentifier), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              t2.systemId += String.fromCodePoint(e3);
          }
        }
        _stateDoctypeSystemIdentifierSingleQuoted(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.APOSTROPHE:
              this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter), t2.systemId += REPLACEMENT_CHARACTER;
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this._err(ERR.abruptDoctypeSystemIdentifier), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              t2.systemId += String.fromCodePoint(e3);
          }
        }
        _stateAfterDoctypeSystemIdentifier(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.SPACE:
            case CODE_POINTS.LINE_FEED:
            case CODE_POINTS.TABULATION:
            case CODE_POINTS.FORM_FEED:
              break;
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInDoctype), t2.forceQuirks = true, this.emitCurrentDoctype(t2), this._emitEOFToken();
              break;
            default:
              this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier), this.state = State.BOGUS_DOCTYPE, this._stateBogusDoctype(e3);
          }
        }
        _stateBogusDoctype(e3) {
          const t2 = this.currentToken;
          switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.emitCurrentDoctype(t2), this.state = State.DATA;
              break;
            case CODE_POINTS.NULL:
              this._err(ERR.unexpectedNullCharacter);
              break;
            case CODE_POINTS.EOF:
              this.emitCurrentDoctype(t2), this._emitEOFToken();
          }
        }
        _stateCdataSection(e3) {
          switch (e3) {
            case CODE_POINTS.RIGHT_SQUARE_BRACKET:
              this.state = State.CDATA_SECTION_BRACKET;
              break;
            case CODE_POINTS.EOF:
              this._err(ERR.eofInCdata), this._emitEOFToken();
              break;
            default:
              this._emitCodePoint(e3);
          }
        }
        _stateCdataSectionBracket(e3) {
          e3 === CODE_POINTS.RIGHT_SQUARE_BRACKET ? this.state = State.CDATA_SECTION_END : (this._emitChars("]"), this.state = State.CDATA_SECTION, this._stateCdataSection(e3));
        }
        _stateCdataSectionEnd(e3) {
          switch (e3) {
            case CODE_POINTS.GREATER_THAN_SIGN:
              this.state = State.DATA;
              break;
            case CODE_POINTS.RIGHT_SQUARE_BRACKET:
              this._emitChars("]");
              break;
            default:
              this._emitChars("]]"), this.state = State.CDATA_SECTION, this._stateCdataSection(e3);
          }
        }
        _stateCharacterReference() {
          let e3 = this.entityDecoder.write(this.preprocessor.html, this.preprocessor.pos);
          if (e3 < 0) {
            if (!this.preprocessor.lastChunkWritten) return this.active = false, this.preprocessor.pos = this.preprocessor.html.length - 1, this.consumedAfterSnapshot = 0, void (this.preprocessor.endOfChunkHit = true);
            e3 = this.entityDecoder.end();
          }
          0 === e3 ? (this.preprocessor.pos = this.entityStartPos, this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND), this.state = !this._isCharacterReferenceInAttribute() && isAsciiAlphaNumeric2(this.preprocessor.peek(1)) ? State.AMBIGUOUS_AMPERSAND : this.returnState) : this.state = this.returnState;
        }
        _stateAmbiguousAmpersand(e3) {
          isAsciiAlphaNumeric2(e3) ? this._flushCodePointConsumedAsCharacterReference(e3) : (e3 === CODE_POINTS.SEMICOLON && this._err(ERR.unknownNamedCharacterReference), this.state = this.returnState, this._callState(e3));
        }
      };
    } });
    var init_open_element_stack = __esm2({ "node_modules/parse5/dist/parser/open-element-stack.js"() {
      init_html22(), IMPLICIT_END_TAG_REQUIRED = /* @__PURE__ */ new Set([TAG_ID.DD, TAG_ID.DT, TAG_ID.LI, TAG_ID.OPTGROUP, TAG_ID.OPTION, TAG_ID.P, TAG_ID.RB, TAG_ID.RP, TAG_ID.RT, TAG_ID.RTC]), IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = /* @__PURE__ */ new Set([...IMPLICIT_END_TAG_REQUIRED, TAG_ID.CAPTION, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]), SCOPING_ELEMENTS_HTML = /* @__PURE__ */ new Set([TAG_ID.APPLET, TAG_ID.CAPTION, TAG_ID.HTML, TAG_ID.MARQUEE, TAG_ID.OBJECT, TAG_ID.TABLE, TAG_ID.TD, TAG_ID.TEMPLATE, TAG_ID.TH]), SCOPING_ELEMENTS_HTML_LIST = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.OL, TAG_ID.UL]), SCOPING_ELEMENTS_HTML_BUTTON = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.BUTTON]), SCOPING_ELEMENTS_MATHML = /* @__PURE__ */ new Set([TAG_ID.ANNOTATION_XML, TAG_ID.MI, TAG_ID.MN, TAG_ID.MO, TAG_ID.MS, TAG_ID.MTEXT]), SCOPING_ELEMENTS_SVG = /* @__PURE__ */ new Set([TAG_ID.DESC, TAG_ID.FOREIGN_OBJECT, TAG_ID.TITLE]), TABLE_ROW_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML]), TABLE_BODY_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML]), TABLE_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML]), TABLE_CELLS = /* @__PURE__ */ new Set([TAG_ID.TD, TAG_ID.TH]), OpenElementStack = class {
        get currentTmplContentOrNode() {
          return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
        }
        constructor(e2, t2, n3) {
          this.treeAdapter = t2, this.handler = n3, this.items = [], this.tagIDs = [], this.stackTop = -1, this.tmplCount = 0, this.currentTagId = TAG_ID.UNKNOWN, this.current = e2;
        }
        _indexOf(e2) {
          return this.items.lastIndexOf(e2, this.stackTop);
        }
        _isInTemplate() {
          return this.currentTagId === TAG_ID.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
        }
        _updateCurrentElement() {
          this.current = this.items[this.stackTop], this.currentTagId = this.tagIDs[this.stackTop];
        }
        push(e2, t2) {
          this.stackTop++, this.items[this.stackTop] = e2, this.current = e2, this.tagIDs[this.stackTop] = t2, this.currentTagId = t2, this._isInTemplate() && this.tmplCount++, this.handler.onItemPush(e2, t2, true);
        }
        pop() {
          const e2 = this.current;
          this.tmplCount > 0 && this._isInTemplate() && this.tmplCount--, this.stackTop--, this._updateCurrentElement(), this.handler.onItemPop(e2, true);
        }
        replace(e2, t2) {
          const n3 = this._indexOf(e2);
          this.items[n3] = t2, n3 === this.stackTop && (this.current = t2);
        }
        insertAfter(e2, t2, n3) {
          const r = this._indexOf(e2) + 1;
          this.items.splice(r, 0, t2), this.tagIDs.splice(r, 0, n3), this.stackTop++, r === this.stackTop && this._updateCurrentElement(), this.current && void 0 !== this.currentTagId && this.handler.onItemPush(this.current, this.currentTagId, r === this.stackTop);
        }
        popUntilTagNamePopped(e2) {
          let t2 = this.stackTop + 1;
          do {
            t2 = this.tagIDs.lastIndexOf(e2, t2 - 1);
          } while (t2 > 0 && this.treeAdapter.getNamespaceURI(this.items[t2]) !== NS.HTML);
          this.shortenToLength(Math.max(t2, 0));
        }
        shortenToLength(e2) {
          for (; this.stackTop >= e2; ) {
            const t2 = this.current;
            this.tmplCount > 0 && this._isInTemplate() && (this.tmplCount -= 1), this.stackTop--, this._updateCurrentElement(), this.handler.onItemPop(t2, this.stackTop < e2);
          }
        }
        popUntilElementPopped(e2) {
          const t2 = this._indexOf(e2);
          this.shortenToLength(Math.max(t2, 0));
        }
        popUntilPopped(e2, t2) {
          const n3 = this._indexOfTagNames(e2, t2);
          this.shortenToLength(Math.max(n3, 0));
        }
        popUntilNumberedHeaderPopped() {
          this.popUntilPopped(NUMBERED_HEADERS, NS.HTML);
        }
        popUntilTableCellPopped() {
          this.popUntilPopped(TABLE_CELLS, NS.HTML);
        }
        popAllUpToHtmlElement() {
          this.tmplCount = 0, this.shortenToLength(1);
        }
        _indexOfTagNames(e2, t2) {
          for (let n3 = this.stackTop; n3 >= 0; n3--) if (e2.has(this.tagIDs[n3]) && this.treeAdapter.getNamespaceURI(this.items[n3]) === t2) return n3;
          return -1;
        }
        clearBackTo(e2, t2) {
          const n3 = this._indexOfTagNames(e2, t2);
          this.shortenToLength(n3 + 1);
        }
        clearBackToTableContext() {
          this.clearBackTo(TABLE_CONTEXT, NS.HTML);
        }
        clearBackToTableBodyContext() {
          this.clearBackTo(TABLE_BODY_CONTEXT, NS.HTML);
        }
        clearBackToTableRowContext() {
          this.clearBackTo(TABLE_ROW_CONTEXT, NS.HTML);
        }
        remove(e2) {
          const t2 = this._indexOf(e2);
          t2 >= 0 && (t2 === this.stackTop ? this.pop() : (this.items.splice(t2, 1), this.tagIDs.splice(t2, 1), this.stackTop--, this._updateCurrentElement(), this.handler.onItemPop(e2, false)));
        }
        tryPeekProperlyNestedBodyElement() {
          return this.stackTop >= 1 && this.tagIDs[1] === TAG_ID.BODY ? this.items[1] : null;
        }
        contains(e2) {
          return this._indexOf(e2) > -1;
        }
        getCommonAncestor(e2) {
          const t2 = this._indexOf(e2) - 1;
          return t2 >= 0 ? this.items[t2] : null;
        }
        isRootHtmlElementCurrent() {
          return 0 === this.stackTop && this.tagIDs[0] === TAG_ID.HTML;
        }
        hasInDynamicScope(e2, t2) {
          for (let n3 = this.stackTop; n3 >= 0; n3--) {
            const r = this.tagIDs[n3];
            switch (this.treeAdapter.getNamespaceURI(this.items[n3])) {
              case NS.HTML:
                if (r === e2) return true;
                if (t2.has(r)) return false;
                break;
              case NS.SVG:
                if (SCOPING_ELEMENTS_SVG.has(r)) return false;
                break;
              case NS.MATHML:
                if (SCOPING_ELEMENTS_MATHML.has(r)) return false;
            }
          }
          return true;
        }
        hasInScope(e2) {
          return this.hasInDynamicScope(e2, SCOPING_ELEMENTS_HTML);
        }
        hasInListItemScope(e2) {
          return this.hasInDynamicScope(e2, SCOPING_ELEMENTS_HTML_LIST);
        }
        hasInButtonScope(e2) {
          return this.hasInDynamicScope(e2, SCOPING_ELEMENTS_HTML_BUTTON);
        }
        hasNumberedHeaderInScope() {
          for (let e2 = this.stackTop; e2 >= 0; e2--) {
            const t2 = this.tagIDs[e2];
            switch (this.treeAdapter.getNamespaceURI(this.items[e2])) {
              case NS.HTML:
                if (NUMBERED_HEADERS.has(t2)) return true;
                if (SCOPING_ELEMENTS_HTML.has(t2)) return false;
                break;
              case NS.SVG:
                if (SCOPING_ELEMENTS_SVG.has(t2)) return false;
                break;
              case NS.MATHML:
                if (SCOPING_ELEMENTS_MATHML.has(t2)) return false;
            }
          }
          return true;
        }
        hasInTableScope(e2) {
          for (let t2 = this.stackTop; t2 >= 0; t2--) if (this.treeAdapter.getNamespaceURI(this.items[t2]) === NS.HTML) switch (this.tagIDs[t2]) {
            case e2:
              return true;
            case TAG_ID.TABLE:
            case TAG_ID.HTML:
              return false;
          }
          return true;
        }
        hasTableBodyContextInTableScope() {
          for (let e2 = this.stackTop; e2 >= 0; e2--) if (this.treeAdapter.getNamespaceURI(this.items[e2]) === NS.HTML) switch (this.tagIDs[e2]) {
            case TAG_ID.TBODY:
            case TAG_ID.THEAD:
            case TAG_ID.TFOOT:
              return true;
            case TAG_ID.TABLE:
            case TAG_ID.HTML:
              return false;
          }
          return true;
        }
        hasInSelectScope(e2) {
          for (let t2 = this.stackTop; t2 >= 0; t2--) if (this.treeAdapter.getNamespaceURI(this.items[t2]) === NS.HTML) switch (this.tagIDs[t2]) {
            case e2:
              return true;
            case TAG_ID.OPTION:
            case TAG_ID.OPTGROUP:
              break;
            default:
              return false;
          }
          return true;
        }
        generateImpliedEndTags() {
          for (; void 0 !== this.currentTagId && IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId); ) this.pop();
        }
        generateImpliedEndTagsThoroughly() {
          for (; void 0 !== this.currentTagId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId); ) this.pop();
        }
        generateImpliedEndTagsWithExclusion(e2) {
          for (; void 0 !== this.currentTagId && this.currentTagId !== e2 && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId); ) this.pop();
        }
      };
    } });
    var init_formatting_element_list = __esm2({ "node_modules/parse5/dist/parser/formatting-element-list.js"() {
      var e2;
      (e2 = EntryType || (EntryType = {}))[e2.Marker = 0] = "Marker", e2[e2.Element = 1] = "Element", MARKER = { type: EntryType.Marker }, FormattingElementList = class {
        constructor(e3) {
          this.treeAdapter = e3, this.entries = [], this.bookmark = null;
        }
        _getNoahArkConditionCandidates(e3, t2) {
          const n3 = [], r = t2.length, i = this.treeAdapter.getTagName(e3), s2 = this.treeAdapter.getNamespaceURI(e3);
          for (let e4 = 0; e4 < this.entries.length; e4++) {
            const t3 = this.entries[e4];
            if (t3.type === EntryType.Marker) break;
            const { element: a } = t3;
            if (this.treeAdapter.getTagName(a) === i && this.treeAdapter.getNamespaceURI(a) === s2) {
              const t4 = this.treeAdapter.getAttrList(a);
              t4.length === r && n3.push({ idx: e4, attrs: t4 });
            }
          }
          return n3;
        }
        _ensureNoahArkCondition(e3) {
          if (this.entries.length < 3) return;
          const t2 = this.treeAdapter.getAttrList(e3), n3 = this._getNoahArkConditionCandidates(e3, t2);
          if (n3.length < 3) return;
          const r = new Map(t2.map((e4) => [e4.name, e4.value]));
          let i = 0;
          for (let e4 = 0; e4 < n3.length; e4++) {
            const t3 = n3[e4];
            t3.attrs.every((e5) => r.get(e5.name) === e5.value) && (i += 1, i >= 3 && this.entries.splice(t3.idx, 1));
          }
        }
        insertMarker() {
          this.entries.unshift(MARKER);
        }
        pushElement(e3, t2) {
          this._ensureNoahArkCondition(e3), this.entries.unshift({ type: EntryType.Element, element: e3, token: t2 });
        }
        insertElementAfterBookmark(e3, t2) {
          const n3 = this.entries.indexOf(this.bookmark);
          this.entries.splice(n3, 0, { type: EntryType.Element, element: e3, token: t2 });
        }
        removeEntry(e3) {
          const t2 = this.entries.indexOf(e3);
          -1 !== t2 && this.entries.splice(t2, 1);
        }
        clearToLastMarker() {
          const e3 = this.entries.indexOf(MARKER);
          -1 === e3 ? this.entries.length = 0 : this.entries.splice(0, e3 + 1);
        }
        getElementEntryInScopeWithTagName(e3) {
          const t2 = this.entries.find((t3) => t3.type === EntryType.Marker || this.treeAdapter.getTagName(t3.element) === e3);
          return t2 && t2.type === EntryType.Element ? t2 : null;
        }
        getElementEntry(e3) {
          return this.entries.find((t2) => t2.type === EntryType.Element && t2.element === e3);
        }
      };
    } });
    var init_default2 = __esm2({ "node_modules/parse5/dist/tree-adapters/default.js"() {
      init_html22(), defaultTreeAdapter = { createDocument: () => ({ nodeName: "#document", mode: DOCUMENT_MODE.NO_QUIRKS, childNodes: [] }), createDocumentFragment: () => ({ nodeName: "#document-fragment", childNodes: [] }), createElement: (e2, t2, n3) => ({ nodeName: e2, tagName: e2, attrs: n3, namespaceURI: t2, childNodes: [], parentNode: null }), createCommentNode: (e2) => ({ nodeName: "#comment", data: e2, parentNode: null }), createTextNode: (e2) => ({ nodeName: "#text", value: e2, parentNode: null }), appendChild(e2, t2) {
        e2.childNodes.push(t2), t2.parentNode = e2;
      }, insertBefore(e2, t2, n3) {
        const r = e2.childNodes.indexOf(n3);
        e2.childNodes.splice(r, 0, t2), t2.parentNode = e2;
      }, setTemplateContent(e2, t2) {
        e2.content = t2;
      }, getTemplateContent: (e2) => e2.content, setDocumentType(e2, t2, n3, r) {
        const i = e2.childNodes.find((e3) => "#documentType" === e3.nodeName);
        if (i) i.name = t2, i.publicId = n3, i.systemId = r;
        else {
          const i2 = { nodeName: "#documentType", name: t2, publicId: n3, systemId: r, parentNode: null };
          defaultTreeAdapter.appendChild(e2, i2);
        }
      }, setDocumentMode(e2, t2) {
        e2.mode = t2;
      }, getDocumentMode: (e2) => e2.mode, detachNode(e2) {
        if (e2.parentNode) {
          const t2 = e2.parentNode.childNodes.indexOf(e2);
          e2.parentNode.childNodes.splice(t2, 1), e2.parentNode = null;
        }
      }, insertText(e2, t2) {
        if (e2.childNodes.length > 0) {
          const n3 = e2.childNodes[e2.childNodes.length - 1];
          if (defaultTreeAdapter.isTextNode(n3)) return void (n3.value += t2);
        }
        defaultTreeAdapter.appendChild(e2, defaultTreeAdapter.createTextNode(t2));
      }, insertTextBefore(e2, t2, n3) {
        const r = e2.childNodes[e2.childNodes.indexOf(n3) - 1];
        r && defaultTreeAdapter.isTextNode(r) ? r.value += t2 : defaultTreeAdapter.insertBefore(e2, defaultTreeAdapter.createTextNode(t2), n3);
      }, adoptAttributes(e2, t2) {
        const n3 = new Set(e2.attrs.map((e3) => e3.name));
        for (let r = 0; r < t2.length; r++) n3.has(t2[r].name) || e2.attrs.push(t2[r]);
      }, getFirstChild: (e2) => e2.childNodes[0], getChildNodes: (e2) => e2.childNodes, getParentNode: (e2) => e2.parentNode, getAttrList: (e2) => e2.attrs, getTagName: (e2) => e2.tagName, getNamespaceURI: (e2) => e2.namespaceURI, getTextNodeContent: (e2) => e2.value, getCommentNodeContent: (e2) => e2.data, getDocumentTypeNodeName: (e2) => e2.name, getDocumentTypeNodePublicId: (e2) => e2.publicId, getDocumentTypeNodeSystemId: (e2) => e2.systemId, isTextNode: (e2) => "#text" === e2.nodeName, isCommentNode: (e2) => "#comment" === e2.nodeName, isDocumentTypeNode: (e2) => "#documentType" === e2.nodeName, isElementNode: (e2) => Object.prototype.hasOwnProperty.call(e2, "tagName"), setNodeSourceCodeLocation(e2, t2) {
        e2.sourceCodeLocation = t2;
      }, getNodeSourceCodeLocation: (e2) => e2.sourceCodeLocation, updateNodeSourceCodeLocation(e2, t2) {
        e2.sourceCodeLocation = { ...e2.sourceCodeLocation, ...t2 };
      } };
    } });
    function hasPrefix(e2, t2) {
      return t2.some((t3) => e2.startsWith(t3));
    }
    var MIME_TYPES;
    var DEFINITION_URL_ATTR;
    var ADJUSTED_DEFINITION_URL_ATTR;
    var SVG_ATTRS_ADJUSTMENT_MAP;
    var XML_ATTRS_ADJUSTMENT_MAP;
    var SVG_TAG_NAMES_ADJUSTMENT_MAP;
    var EXITS_FOREIGN_CONTENT;
    var init_doctype = __esm2({ "node_modules/parse5/dist/common/doctype.js"() {
      init_html22(), VALID_DOCTYPE_NAME = "html", VALID_SYSTEM_ID = "about:legacy-compat", QUIRKS_MODE_SYSTEM_ID = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd", QUIRKS_MODE_PUBLIC_ID_PREFIXES = ["+//silmaril//dtd html pro v0r11 19970101//", "-//as//dtd html 3.0 aswedit + extensions//", "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", "-//ietf//dtd html 2.0 level 1//", "-//ietf//dtd html 2.0 level 2//", "-//ietf//dtd html 2.0 strict level 1//", "-//ietf//dtd html 2.0 strict level 2//", "-//ietf//dtd html 2.0 strict//", "-//ietf//dtd html 2.0//", "-//ietf//dtd html 2.1e//", "-//ietf//dtd html 3.0//", "-//ietf//dtd html 3.2 final//", "-//ietf//dtd html 3.2//", "-//ietf//dtd html 3//", "-//ietf//dtd html level 0//", "-//ietf//dtd html level 1//", "-//ietf//dtd html level 2//", "-//ietf//dtd html level 3//", "-//ietf//dtd html strict level 0//", "-//ietf//dtd html strict level 1//", "-//ietf//dtd html strict level 2//", "-//ietf//dtd html strict level 3//", "-//ietf//dtd html strict//", "-//ietf//dtd html//", "-//metrius//dtd metrius presentational//", "-//microsoft//dtd internet explorer 2.0 html strict//", "-//microsoft//dtd internet explorer 2.0 html//", "-//microsoft//dtd internet explorer 2.0 tables//", "-//microsoft//dtd internet explorer 3.0 html strict//", "-//microsoft//dtd internet explorer 3.0 html//", "-//microsoft//dtd internet explorer 3.0 tables//", "-//netscape comm. corp.//dtd html//", "-//netscape comm. corp.//dtd strict html//", "-//o'reilly and associates//dtd html 2.0//", "-//o'reilly and associates//dtd html extended 1.0//", "-//o'reilly and associates//dtd html extended relaxed 1.0//", "-//sq//dtd html 2.0 hotmetal + extensions//", "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", "-//spyglass//dtd html 2.0 extended//", "-//sun microsystems corp.//dtd hotjava html//", "-//sun microsystems corp.//dtd hotjava strict html//", "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//", "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//", "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//", "-//w3c//dtd html 4.0 transitional//", "-//w3c//dtd html experimental 19960712//", "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//", "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//", "-//webtechs//dtd mozilla html//"], QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [...QUIRKS_MODE_PUBLIC_ID_PREFIXES, "-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//"], QUIRKS_MODE_PUBLIC_IDS = /* @__PURE__ */ new Set(["-//w3o//dtd w3 html strict 3.0//en//", "-/w3c/dtd html 4.0 transitional/en", "html"]), LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ["-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//"], LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES, "-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//"];
    } });
    function adjustTokenMathMLAttrs(e2) {
      for (let t2 = 0; t2 < e2.attrs.length; t2++) if (e2.attrs[t2].name === DEFINITION_URL_ATTR) {
        e2.attrs[t2].name = ADJUSTED_DEFINITION_URL_ATTR;
        break;
      }
    }
    function adjustTokenSVGAttrs(e2) {
      for (let t2 = 0; t2 < e2.attrs.length; t2++) {
        const n3 = SVG_ATTRS_ADJUSTMENT_MAP.get(e2.attrs[t2].name);
        null != n3 && (e2.attrs[t2].name = n3);
      }
    }
    function adjustTokenXMLAttrs(e2) {
      for (let t2 = 0; t2 < e2.attrs.length; t2++) {
        const n3 = XML_ATTRS_ADJUSTMENT_MAP.get(e2.attrs[t2].name);
        n3 && (e2.attrs[t2].prefix = n3.prefix, e2.attrs[t2].name = n3.name, e2.attrs[t2].namespace = n3.namespace);
      }
    }
    var HIDDEN_INPUT_TYPE;
    var AA_OUTER_LOOP_ITER;
    var AA_INNER_LOOP_ITER;
    var InsertionMode;
    var BASE_LOC;
    var TABLE_STRUCTURE_TAGS;
    var defaultParserOptions;
    var Parser3;
    var TABLE_VOID_ELEMENTS;
    var init_foreign_content = __esm2({ "node_modules/parse5/dist/common/foreign-content.js"() {
      init_html22(), MIME_TYPES = { TEXT_HTML: "text/html", APPLICATION_XML: "application/xhtml+xml" }, DEFINITION_URL_ATTR = "definitionurl", ADJUSTED_DEFINITION_URL_ATTR = "definitionURL", SVG_ATTRS_ADJUSTMENT_MAP = new Map(["attributeName", "attributeType", "baseFrequency", "baseProfile", "calcMode", "clipPathUnits", "diffuseConstant", "edgeMode", "filterUnits", "glyphRef", "gradientTransform", "gradientUnits", "kernelMatrix", "kernelUnitLength", "keyPoints", "keySplines", "keyTimes", "lengthAdjust", "limitingConeAngle", "markerHeight", "markerUnits", "markerWidth", "maskContentUnits", "maskUnits", "numOctaves", "pathLength", "patternContentUnits", "patternTransform", "patternUnits", "pointsAtX", "pointsAtY", "pointsAtZ", "preserveAlpha", "preserveAspectRatio", "primitiveUnits", "refX", "refY", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "specularConstant", "specularExponent", "spreadMethod", "startOffset", "stdDeviation", "stitchTiles", "surfaceScale", "systemLanguage", "tableValues", "targetX", "targetY", "textLength", "viewBox", "viewTarget", "xChannelSelector", "yChannelSelector", "zoomAndPan"].map((e2) => [e2.toLowerCase(), e2])), XML_ATTRS_ADJUSTMENT_MAP = /* @__PURE__ */ new Map([["xlink:actuate", { prefix: "xlink", name: "actuate", namespace: NS.XLINK }], ["xlink:arcrole", { prefix: "xlink", name: "arcrole", namespace: NS.XLINK }], ["xlink:href", { prefix: "xlink", name: "href", namespace: NS.XLINK }], ["xlink:role", { prefix: "xlink", name: "role", namespace: NS.XLINK }], ["xlink:show", { prefix: "xlink", name: "show", namespace: NS.XLINK }], ["xlink:title", { prefix: "xlink", name: "title", namespace: NS.XLINK }], ["xlink:type", { prefix: "xlink", name: "type", namespace: NS.XLINK }], ["xml:lang", { prefix: "xml", name: "lang", namespace: NS.XML }], ["xml:space", { prefix: "xml", name: "space", namespace: NS.XML }], ["xmlns", { prefix: "", name: "xmlns", namespace: NS.XMLNS }], ["xmlns:xlink", { prefix: "xmlns", name: "xlink", namespace: NS.XMLNS }]]), SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map(["altGlyph", "altGlyphDef", "altGlyphItem", "animateColor", "animateMotion", "animateTransform", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "glyphRef", "linearGradient", "radialGradient", "textPath"].map((e2) => [e2.toLowerCase(), e2])), EXITS_FOREIGN_CONTENT = /* @__PURE__ */ new Set([TAG_ID.B, TAG_ID.BIG, TAG_ID.BLOCKQUOTE, TAG_ID.BODY, TAG_ID.BR, TAG_ID.CENTER, TAG_ID.CODE, TAG_ID.DD, TAG_ID.DIV, TAG_ID.DL, TAG_ID.DT, TAG_ID.EM, TAG_ID.EMBED, TAG_ID.H1, TAG_ID.H2, TAG_ID.H3, TAG_ID.H4, TAG_ID.H5, TAG_ID.H6, TAG_ID.HEAD, TAG_ID.HR, TAG_ID.I, TAG_ID.IMG, TAG_ID.LI, TAG_ID.LISTING, TAG_ID.MENU, TAG_ID.META, TAG_ID.NOBR, TAG_ID.OL, TAG_ID.P, TAG_ID.PRE, TAG_ID.RUBY, TAG_ID.S, TAG_ID.SMALL, TAG_ID.SPAN, TAG_ID.STRONG, TAG_ID.STRIKE, TAG_ID.SUB, TAG_ID.SUP, TAG_ID.TABLE, TAG_ID.TT, TAG_ID.U, TAG_ID.UL, TAG_ID.VAR]);
    } });
    function aaObtainFormattingElementEntry(e2, t2) {
      let n3 = e2.activeFormattingElements.getElementEntryInScopeWithTagName(t2.tagName);
      return n3 ? e2.openElements.contains(n3.element) ? e2.openElements.hasInScope(t2.tagID) || (n3 = null) : (e2.activeFormattingElements.removeEntry(n3), n3 = null) : genericEndTagInBody(e2, t2), n3;
    }
    function aaObtainFurthestBlock(e2, t2) {
      let n3 = null, r = e2.openElements.stackTop;
      for (; r >= 0; r--) {
        const i = e2.openElements.items[r];
        if (i === t2.element) break;
        e2._isSpecialElement(i, e2.openElements.tagIDs[r]) && (n3 = i);
      }
      return n3 || (e2.openElements.shortenToLength(Math.max(r, 0)), e2.activeFormattingElements.removeEntry(t2)), n3;
    }
    function aaInnerLoop(e2, t2, n3) {
      let r = t2, i = e2.openElements.getCommonAncestor(t2);
      for (let s2 = 0, a = i; a !== n3; s2++, a = i) {
        i = e2.openElements.getCommonAncestor(a);
        const n4 = e2.activeFormattingElements.getElementEntry(a), o = n4 && s2 >= AA_INNER_LOOP_ITER;
        !n4 || o ? (o && e2.activeFormattingElements.removeEntry(n4), e2.openElements.remove(a)) : (a = aaRecreateElementFromEntry(e2, n4), r === t2 && (e2.activeFormattingElements.bookmark = n4), e2.treeAdapter.detachNode(r), e2.treeAdapter.appendChild(a, r), r = a);
      }
      return r;
    }
    function aaRecreateElementFromEntry(e2, t2) {
      const n3 = e2.treeAdapter.getNamespaceURI(t2.element), r = e2.treeAdapter.createElement(t2.token.tagName, n3, t2.token.attrs);
      return e2.openElements.replace(t2.element, r), t2.element = r, r;
    }
    function aaInsertLastNodeInCommonAncestor(e2, t2, n3) {
      const r = getTagID(e2.treeAdapter.getTagName(t2));
      if (e2._isElementCausesFosterParenting(r)) e2._fosterParentElement(n3);
      else {
        const i = e2.treeAdapter.getNamespaceURI(t2);
        r === TAG_ID.TEMPLATE && i === NS.HTML && (t2 = e2.treeAdapter.getTemplateContent(t2)), e2.treeAdapter.appendChild(t2, n3);
      }
    }
    function aaReplaceFormattingElement(e2, t2, n3) {
      const r = e2.treeAdapter.getNamespaceURI(n3.element), { token: i } = n3, s2 = e2.treeAdapter.createElement(i.tagName, r, i.attrs);
      e2._adoptNodes(t2, s2), e2.treeAdapter.appendChild(t2, s2), e2.activeFormattingElements.insertElementAfterBookmark(s2, i), e2.activeFormattingElements.removeEntry(n3), e2.openElements.remove(n3.element), e2.openElements.insertAfter(t2, s2, i.tagID);
    }
    function callAdoptionAgency(e2, t2) {
      for (let n3 = 0; n3 < AA_OUTER_LOOP_ITER; n3++) {
        const n4 = aaObtainFormattingElementEntry(e2, t2);
        if (!n4) break;
        const r = aaObtainFurthestBlock(e2, n4);
        if (!r) break;
        e2.activeFormattingElements.bookmark = n4;
        const i = aaInnerLoop(e2, r, n4.element), s2 = e2.openElements.getCommonAncestor(n4.element);
        e2.treeAdapter.detachNode(i), s2 && aaInsertLastNodeInCommonAncestor(e2, s2, i), aaReplaceFormattingElement(e2, r, n4);
      }
    }
    function appendComment(e2, t2) {
      e2._appendCommentNode(t2, e2.openElements.currentTmplContentOrNode);
    }
    function stopParsing(e2, t2) {
      if (e2.stopped = true, t2.location) {
        const n3 = e2.fragmentContext ? 0 : 2;
        for (let r = e2.openElements.stackTop; r >= n3; r--) e2._setEndLocation(e2.openElements.items[r], t2);
        if (!e2.fragmentContext && e2.openElements.stackTop >= 0) {
          const n4 = e2.openElements.items[0], r = e2.treeAdapter.getNodeSourceCodeLocation(n4);
          if (r && !r.endTag && (e2._setEndLocation(n4, t2), e2.openElements.stackTop >= 1)) {
            const n5 = e2.openElements.items[1], r3 = e2.treeAdapter.getNodeSourceCodeLocation(n5);
            r3 && !r3.endTag && e2._setEndLocation(n5, t2);
          }
        }
      }
    }
    function tokenInInitialMode(e2, t2) {
      e2._err(t2, ERR.missingDoctype, true), e2.treeAdapter.setDocumentMode(e2.document, DOCUMENT_MODE.QUIRKS), e2.insertionMode = InsertionMode.BEFORE_HTML, e2._processToken(t2);
    }
    function tokenBeforeHtml(e2, t2) {
      e2._insertFakeRootElement(), e2.insertionMode = InsertionMode.BEFORE_HEAD, e2._processToken(t2);
    }
    function tokenBeforeHead(e2, t2) {
      e2._insertFakeElement(TAG_NAMES.HEAD, TAG_ID.HEAD), e2.headElement = e2.openElements.current, e2.insertionMode = InsertionMode.IN_HEAD, e2._processToken(t2);
    }
    function startTagInHead(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.HTML:
          startTagInBody(e2, t2);
          break;
        case TAG_ID.BASE:
        case TAG_ID.BASEFONT:
        case TAG_ID.BGSOUND:
        case TAG_ID.LINK:
        case TAG_ID.META:
          e2._appendElement(t2, NS.HTML), t2.ackSelfClosing = true;
          break;
        case TAG_ID.TITLE:
          e2._switchToTextParsing(t2, TokenizerMode.RCDATA);
          break;
        case TAG_ID.NOSCRIPT:
          e2.options.scriptingEnabled ? e2._switchToTextParsing(t2, TokenizerMode.RAWTEXT) : (e2._insertElement(t2, NS.HTML), e2.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT);
          break;
        case TAG_ID.NOFRAMES:
        case TAG_ID.STYLE:
          e2._switchToTextParsing(t2, TokenizerMode.RAWTEXT);
          break;
        case TAG_ID.SCRIPT:
          e2._switchToTextParsing(t2, TokenizerMode.SCRIPT_DATA);
          break;
        case TAG_ID.TEMPLATE:
          e2._insertTemplate(t2), e2.activeFormattingElements.insertMarker(), e2.framesetOk = false, e2.insertionMode = InsertionMode.IN_TEMPLATE, e2.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
          break;
        case TAG_ID.HEAD:
          e2._err(t2, ERR.misplacedStartTagForHeadElement);
          break;
        default:
          tokenInHead(e2, t2);
      }
    }
    function templateEndTagInHead(e2, t2) {
      e2.openElements.tmplCount > 0 ? (e2.openElements.generateImpliedEndTagsThoroughly(), e2.openElements.currentTagId !== TAG_ID.TEMPLATE && e2._err(t2, ERR.closingOfElementWithOpenChildElements), e2.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE), e2.activeFormattingElements.clearToLastMarker(), e2.tmplInsertionModeStack.shift(), e2._resetInsertionMode()) : e2._err(t2, ERR.endTagWithoutMatchingOpenElement);
    }
    function tokenInHead(e2, t2) {
      e2.openElements.pop(), e2.insertionMode = InsertionMode.AFTER_HEAD, e2._processToken(t2);
    }
    function tokenInHeadNoScript(e2, t2) {
      const n3 = t2.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
      e2._err(t2, n3), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_HEAD, e2._processToken(t2);
    }
    function tokenAfterHead(e2, t2) {
      e2._insertFakeElement(TAG_NAMES.BODY, TAG_ID.BODY), e2.insertionMode = InsertionMode.IN_BODY, modeInBody(e2, t2);
    }
    function modeInBody(e2, t2) {
      switch (t2.type) {
        case TokenType.CHARACTER:
          characterInBody(e2, t2);
          break;
        case TokenType.WHITESPACE_CHARACTER:
          whitespaceCharacterInBody(e2, t2);
          break;
        case TokenType.COMMENT:
          appendComment(e2, t2);
          break;
        case TokenType.START_TAG:
          startTagInBody(e2, t2);
          break;
        case TokenType.END_TAG:
          endTagInBody(e2, t2);
          break;
        case TokenType.EOF:
          eofInBody(e2, t2);
      }
    }
    function whitespaceCharacterInBody(e2, t2) {
      e2._reconstructActiveFormattingElements(), e2._insertCharacters(t2);
    }
    function characterInBody(e2, t2) {
      e2._reconstructActiveFormattingElements(), e2._insertCharacters(t2), e2.framesetOk = false;
    }
    function areaStartTagInBody(e2, t2) {
      e2._reconstructActiveFormattingElements(), e2._appendElement(t2, NS.HTML), e2.framesetOk = false, t2.ackSelfClosing = true;
    }
    function isHiddenInput(e2) {
      const t2 = getTokenAttr(e2, ATTRS.TYPE);
      return null != t2 && t2.toLowerCase() === HIDDEN_INPUT_TYPE;
    }
    function rawTextStartTagInBody(e2, t2) {
      e2._switchToTextParsing(t2, TokenizerMode.RAWTEXT);
    }
    function genericStartTagInBody(e2, t2) {
      e2._reconstructActiveFormattingElements(), e2._insertElement(t2, NS.HTML);
    }
    function startTagInBody(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.I:
        case TAG_ID.S:
        case TAG_ID.B:
        case TAG_ID.U:
        case TAG_ID.EM:
        case TAG_ID.TT:
        case TAG_ID.BIG:
        case TAG_ID.CODE:
        case TAG_ID.FONT:
        case TAG_ID.SMALL:
        case TAG_ID.STRIKE:
        case TAG_ID.STRONG:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML), e3.activeFormattingElements.pushElement(e3.openElements.current, t3);
          }(e2, t2);
          break;
        case TAG_ID.A:
          !function(e3, t3) {
            const n3 = e3.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);
            n3 && (callAdoptionAgency(e3, t3), e3.openElements.remove(n3.element), e3.activeFormattingElements.removeEntry(n3)), e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML), e3.activeFormattingElements.pushElement(e3.openElements.current, t3);
          }(e2, t2);
          break;
        case TAG_ID.H1:
        case TAG_ID.H2:
        case TAG_ID.H3:
        case TAG_ID.H4:
        case TAG_ID.H5:
        case TAG_ID.H6:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), void 0 !== e3.openElements.currentTagId && NUMBERED_HEADERS.has(e3.openElements.currentTagId) && e3.openElements.pop(), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.P:
        case TAG_ID.DL:
        case TAG_ID.OL:
        case TAG_ID.UL:
        case TAG_ID.DIV:
        case TAG_ID.DIR:
        case TAG_ID.NAV:
        case TAG_ID.MAIN:
        case TAG_ID.MENU:
        case TAG_ID.ASIDE:
        case TAG_ID.CENTER:
        case TAG_ID.FIGURE:
        case TAG_ID.FOOTER:
        case TAG_ID.HEADER:
        case TAG_ID.HGROUP:
        case TAG_ID.DIALOG:
        case TAG_ID.DETAILS:
        case TAG_ID.ADDRESS:
        case TAG_ID.ARTICLE:
        case TAG_ID.SEARCH:
        case TAG_ID.SECTION:
        case TAG_ID.SUMMARY:
        case TAG_ID.FIELDSET:
        case TAG_ID.BLOCKQUOTE:
        case TAG_ID.FIGCAPTION:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.LI:
        case TAG_ID.DD:
        case TAG_ID.DT:
          !function(e3, t3) {
            e3.framesetOk = false;
            const n3 = t3.tagID;
            for (let t4 = e3.openElements.stackTop; t4 >= 0; t4--) {
              const r = e3.openElements.tagIDs[t4];
              if (n3 === TAG_ID.LI && r === TAG_ID.LI || (n3 === TAG_ID.DD || n3 === TAG_ID.DT) && (r === TAG_ID.DD || r === TAG_ID.DT)) {
                e3.openElements.generateImpliedEndTagsWithExclusion(r), e3.openElements.popUntilTagNamePopped(r);
                break;
              }
              if (r !== TAG_ID.ADDRESS && r !== TAG_ID.DIV && r !== TAG_ID.P && e3._isSpecialElement(e3.openElements.items[t4], r)) break;
            }
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.BR:
        case TAG_ID.IMG:
        case TAG_ID.WBR:
        case TAG_ID.AREA:
        case TAG_ID.EMBED:
        case TAG_ID.KEYGEN:
          areaStartTagInBody(e2, t2);
          break;
        case TAG_ID.HR:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._appendElement(t3, NS.HTML), e3.framesetOk = false, t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.RB:
        case TAG_ID.RTC:
          !function(e3, t3) {
            e3.openElements.hasInScope(TAG_ID.RUBY) && e3.openElements.generateImpliedEndTags(), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.RT:
        case TAG_ID.RP:
          !function(e3, t3) {
            e3.openElements.hasInScope(TAG_ID.RUBY) && e3.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.PRE:
        case TAG_ID.LISTING:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML), e3.skipNextNewLine = true, e3.framesetOk = false;
          }(e2, t2);
          break;
        case TAG_ID.XMP:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._reconstructActiveFormattingElements(), e3.framesetOk = false, e3._switchToTextParsing(t3, TokenizerMode.RAWTEXT);
          }(e2, t2);
          break;
        case TAG_ID.SVG:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), adjustTokenSVGAttrs(t3), adjustTokenXMLAttrs(t3), t3.selfClosing ? e3._appendElement(t3, NS.SVG) : e3._insertElement(t3, NS.SVG), t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.HTML:
          !function(e3, t3) {
            0 === e3.openElements.tmplCount && e3.treeAdapter.adoptAttributes(e3.openElements.items[0], t3.attrs);
          }(e2, t2);
          break;
        case TAG_ID.BASE:
        case TAG_ID.LINK:
        case TAG_ID.META:
        case TAG_ID.STYLE:
        case TAG_ID.TITLE:
        case TAG_ID.SCRIPT:
        case TAG_ID.BGSOUND:
        case TAG_ID.BASEFONT:
        case TAG_ID.TEMPLATE:
          startTagInHead(e2, t2);
          break;
        case TAG_ID.BODY:
          !function(e3, t3) {
            const n3 = e3.openElements.tryPeekProperlyNestedBodyElement();
            n3 && 0 === e3.openElements.tmplCount && (e3.framesetOk = false, e3.treeAdapter.adoptAttributes(n3, t3.attrs));
          }(e2, t2);
          break;
        case TAG_ID.FORM:
          !function(e3, t3) {
            const n3 = e3.openElements.tmplCount > 0;
            e3.formElement && !n3 || (e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML), n3 || (e3.formElement = e3.openElements.current));
          }(e2, t2);
          break;
        case TAG_ID.NOBR:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), e3.openElements.hasInScope(TAG_ID.NOBR) && (callAdoptionAgency(e3, t3), e3._reconstructActiveFormattingElements()), e3._insertElement(t3, NS.HTML), e3.activeFormattingElements.pushElement(e3.openElements.current, t3);
          }(e2, t2);
          break;
        case TAG_ID.MATH:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), adjustTokenMathMLAttrs(t3), adjustTokenXMLAttrs(t3), t3.selfClosing ? e3._appendElement(t3, NS.MATHML) : e3._insertElement(t3, NS.MATHML), t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.TABLE:
          !function(e3, t3) {
            e3.treeAdapter.getDocumentMode(e3.document) !== DOCUMENT_MODE.QUIRKS && e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML), e3.framesetOk = false, e3.insertionMode = InsertionMode.IN_TABLE;
          }(e2, t2);
          break;
        case TAG_ID.INPUT:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), e3._appendElement(t3, NS.HTML), isHiddenInput(t3) || (e3.framesetOk = false), t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.PARAM:
        case TAG_ID.TRACK:
        case TAG_ID.SOURCE:
          !function(e3, t3) {
            e3._appendElement(t3, NS.HTML), t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.IMAGE:
          !function(e3, t3) {
            t3.tagName = TAG_NAMES.IMG, t3.tagID = TAG_ID.IMG, areaStartTagInBody(e3, t3);
          }(e2, t2);
          break;
        case TAG_ID.BUTTON:
          !function(e3, t3) {
            e3.openElements.hasInScope(TAG_ID.BUTTON) && (e3.openElements.generateImpliedEndTags(), e3.openElements.popUntilTagNamePopped(TAG_ID.BUTTON)), e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML), e3.framesetOk = false;
          }(e2, t2);
          break;
        case TAG_ID.APPLET:
        case TAG_ID.OBJECT:
        case TAG_ID.MARQUEE:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML), e3.activeFormattingElements.insertMarker(), e3.framesetOk = false;
          }(e2, t2);
          break;
        case TAG_ID.IFRAME:
          !function(e3, t3) {
            e3.framesetOk = false, e3._switchToTextParsing(t3, TokenizerMode.RAWTEXT);
          }(e2, t2);
          break;
        case TAG_ID.SELECT:
          !function(e3, t3) {
            e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML), e3.framesetOk = false, e3.insertionMode = e3.insertionMode === InsertionMode.IN_TABLE || e3.insertionMode === InsertionMode.IN_CAPTION || e3.insertionMode === InsertionMode.IN_TABLE_BODY || e3.insertionMode === InsertionMode.IN_ROW || e3.insertionMode === InsertionMode.IN_CELL ? InsertionMode.IN_SELECT_IN_TABLE : InsertionMode.IN_SELECT;
          }(e2, t2);
          break;
        case TAG_ID.OPTION:
        case TAG_ID.OPTGROUP:
          !function(e3, t3) {
            e3.openElements.currentTagId === TAG_ID.OPTION && e3.openElements.pop(), e3._reconstructActiveFormattingElements(), e3._insertElement(t3, NS.HTML);
          }(e2, t2);
          break;
        case TAG_ID.NOEMBED:
        case TAG_ID.NOFRAMES:
          rawTextStartTagInBody(e2, t2);
          break;
        case TAG_ID.FRAMESET:
          !function(e3, t3) {
            const n3 = e3.openElements.tryPeekProperlyNestedBodyElement();
            e3.framesetOk && n3 && (e3.treeAdapter.detachNode(n3), e3.openElements.popAllUpToHtmlElement(), e3._insertElement(t3, NS.HTML), e3.insertionMode = InsertionMode.IN_FRAMESET);
          }(e2, t2);
          break;
        case TAG_ID.TEXTAREA:
          !function(e3, t3) {
            e3._insertElement(t3, NS.HTML), e3.skipNextNewLine = true, e3.tokenizer.state = TokenizerMode.RCDATA, e3.originalInsertionMode = e3.insertionMode, e3.framesetOk = false, e3.insertionMode = InsertionMode.TEXT;
          }(e2, t2);
          break;
        case TAG_ID.NOSCRIPT:
          e2.options.scriptingEnabled ? rawTextStartTagInBody(e2, t2) : genericStartTagInBody(e2, t2);
          break;
        case TAG_ID.PLAINTEXT:
          !function(e3, t3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) && e3._closePElement(), e3._insertElement(t3, NS.HTML), e3.tokenizer.state = TokenizerMode.PLAINTEXT;
          }(e2, t2);
          break;
        case TAG_ID.COL:
        case TAG_ID.TH:
        case TAG_ID.TD:
        case TAG_ID.TR:
        case TAG_ID.HEAD:
        case TAG_ID.FRAME:
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
        case TAG_ID.CAPTION:
        case TAG_ID.COLGROUP:
          break;
        default:
          genericStartTagInBody(e2, t2);
      }
    }
    function genericEndTagInBody(e2, t2) {
      const n3 = t2.tagName, r = t2.tagID;
      for (let t3 = e2.openElements.stackTop; t3 > 0; t3--) {
        const i = e2.openElements.items[t3], s2 = e2.openElements.tagIDs[t3];
        if (r === s2 && (r !== TAG_ID.UNKNOWN || e2.treeAdapter.getTagName(i) === n3)) {
          e2.openElements.generateImpliedEndTagsWithExclusion(r), e2.openElements.stackTop >= t3 && e2.openElements.shortenToLength(t3);
          break;
        }
        if (e2._isSpecialElement(i, s2)) break;
      }
    }
    function endTagInBody(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.A:
        case TAG_ID.B:
        case TAG_ID.I:
        case TAG_ID.S:
        case TAG_ID.U:
        case TAG_ID.EM:
        case TAG_ID.TT:
        case TAG_ID.BIG:
        case TAG_ID.CODE:
        case TAG_ID.FONT:
        case TAG_ID.NOBR:
        case TAG_ID.SMALL:
        case TAG_ID.STRIKE:
        case TAG_ID.STRONG:
          callAdoptionAgency(e2, t2);
          break;
        case TAG_ID.P:
          !function(e3) {
            e3.openElements.hasInButtonScope(TAG_ID.P) || e3._insertFakeElement(TAG_NAMES.P, TAG_ID.P), e3._closePElement();
          }(e2);
          break;
        case TAG_ID.DL:
        case TAG_ID.UL:
        case TAG_ID.OL:
        case TAG_ID.DIR:
        case TAG_ID.DIV:
        case TAG_ID.NAV:
        case TAG_ID.PRE:
        case TAG_ID.MAIN:
        case TAG_ID.MENU:
        case TAG_ID.ASIDE:
        case TAG_ID.BUTTON:
        case TAG_ID.CENTER:
        case TAG_ID.FIGURE:
        case TAG_ID.FOOTER:
        case TAG_ID.HEADER:
        case TAG_ID.HGROUP:
        case TAG_ID.DIALOG:
        case TAG_ID.ADDRESS:
        case TAG_ID.ARTICLE:
        case TAG_ID.DETAILS:
        case TAG_ID.SEARCH:
        case TAG_ID.SECTION:
        case TAG_ID.SUMMARY:
        case TAG_ID.LISTING:
        case TAG_ID.FIELDSET:
        case TAG_ID.BLOCKQUOTE:
        case TAG_ID.FIGCAPTION:
          !function(e3, t3) {
            const n3 = t3.tagID;
            e3.openElements.hasInScope(n3) && (e3.openElements.generateImpliedEndTags(), e3.openElements.popUntilTagNamePopped(n3));
          }(e2, t2);
          break;
        case TAG_ID.LI:
          !function(e3) {
            e3.openElements.hasInListItemScope(TAG_ID.LI) && (e3.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI), e3.openElements.popUntilTagNamePopped(TAG_ID.LI));
          }(e2);
          break;
        case TAG_ID.DD:
        case TAG_ID.DT:
          !function(e3, t3) {
            const n3 = t3.tagID;
            e3.openElements.hasInScope(n3) && (e3.openElements.generateImpliedEndTagsWithExclusion(n3), e3.openElements.popUntilTagNamePopped(n3));
          }(e2, t2);
          break;
        case TAG_ID.H1:
        case TAG_ID.H2:
        case TAG_ID.H3:
        case TAG_ID.H4:
        case TAG_ID.H5:
        case TAG_ID.H6:
          !function(e3) {
            e3.openElements.hasNumberedHeaderInScope() && (e3.openElements.generateImpliedEndTags(), e3.openElements.popUntilNumberedHeaderPopped());
          }(e2);
          break;
        case TAG_ID.BR:
          !function(e3) {
            e3._reconstructActiveFormattingElements(), e3._insertFakeElement(TAG_NAMES.BR, TAG_ID.BR), e3.openElements.pop(), e3.framesetOk = false;
          }(e2);
          break;
        case TAG_ID.BODY:
          !function(e3, t3) {
            if (e3.openElements.hasInScope(TAG_ID.BODY) && (e3.insertionMode = InsertionMode.AFTER_BODY, e3.options.sourceCodeLocationInfo)) {
              const n3 = e3.openElements.tryPeekProperlyNestedBodyElement();
              n3 && e3._setEndLocation(n3, t3);
            }
          }(e2, t2);
          break;
        case TAG_ID.HTML:
          !function(e3, t3) {
            e3.openElements.hasInScope(TAG_ID.BODY) && (e3.insertionMode = InsertionMode.AFTER_BODY, endTagAfterBody(e3, t3));
          }(e2, t2);
          break;
        case TAG_ID.FORM:
          !function(e3) {
            const t3 = e3.openElements.tmplCount > 0, { formElement: n3 } = e3;
            t3 || (e3.formElement = null), (n3 || t3) && e3.openElements.hasInScope(TAG_ID.FORM) && (e3.openElements.generateImpliedEndTags(), t3 ? e3.openElements.popUntilTagNamePopped(TAG_ID.FORM) : n3 && e3.openElements.remove(n3));
          }(e2);
          break;
        case TAG_ID.APPLET:
        case TAG_ID.OBJECT:
        case TAG_ID.MARQUEE:
          !function(e3, t3) {
            const n3 = t3.tagID;
            e3.openElements.hasInScope(n3) && (e3.openElements.generateImpliedEndTags(), e3.openElements.popUntilTagNamePopped(n3), e3.activeFormattingElements.clearToLastMarker());
          }(e2, t2);
          break;
        case TAG_ID.TEMPLATE:
          templateEndTagInHead(e2, t2);
          break;
        default:
          genericEndTagInBody(e2, t2);
      }
    }
    function eofInBody(e2, t2) {
      e2.tmplInsertionModeStack.length > 0 ? eofInTemplate(e2, t2) : stopParsing(e2, t2);
    }
    function characterInTable(e2, t2) {
      if (void 0 !== e2.openElements.currentTagId && TABLE_STRUCTURE_TAGS.has(e2.openElements.currentTagId)) switch (e2.pendingCharacterTokens.length = 0, e2.hasNonWhitespacePendingCharacterToken = false, e2.originalInsertionMode = e2.insertionMode, e2.insertionMode = InsertionMode.IN_TABLE_TEXT, t2.type) {
        case TokenType.CHARACTER:
          characterInTableText(e2, t2);
          break;
        case TokenType.WHITESPACE_CHARACTER:
          whitespaceCharacterInTableText(e2, t2);
      }
      else tokenInTable(e2, t2);
    }
    function startTagInTable(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.TD:
        case TAG_ID.TH:
        case TAG_ID.TR:
          !function(e3, t3) {
            e3.openElements.clearBackToTableContext(), e3._insertFakeElement(TAG_NAMES.TBODY, TAG_ID.TBODY), e3.insertionMode = InsertionMode.IN_TABLE_BODY, startTagInTableBody(e3, t3);
          }(e2, t2);
          break;
        case TAG_ID.STYLE:
        case TAG_ID.SCRIPT:
        case TAG_ID.TEMPLATE:
          startTagInHead(e2, t2);
          break;
        case TAG_ID.COL:
          !function(e3, t3) {
            e3.openElements.clearBackToTableContext(), e3._insertFakeElement(TAG_NAMES.COLGROUP, TAG_ID.COLGROUP), e3.insertionMode = InsertionMode.IN_COLUMN_GROUP, startTagInColumnGroup(e3, t3);
          }(e2, t2);
          break;
        case TAG_ID.FORM:
          !function(e3, t3) {
            e3.formElement || 0 !== e3.openElements.tmplCount || (e3._insertElement(t3, NS.HTML), e3.formElement = e3.openElements.current, e3.openElements.pop());
          }(e2, t2);
          break;
        case TAG_ID.TABLE:
          !function(e3, t3) {
            e3.openElements.hasInTableScope(TAG_ID.TABLE) && (e3.openElements.popUntilTagNamePopped(TAG_ID.TABLE), e3._resetInsertionMode(), e3._processStartTag(t3));
          }(e2, t2);
          break;
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
          !function(e3, t3) {
            e3.openElements.clearBackToTableContext(), e3._insertElement(t3, NS.HTML), e3.insertionMode = InsertionMode.IN_TABLE_BODY;
          }(e2, t2);
          break;
        case TAG_ID.INPUT:
          !function(e3, t3) {
            isHiddenInput(t3) ? e3._appendElement(t3, NS.HTML) : tokenInTable(e3, t3), t3.ackSelfClosing = true;
          }(e2, t2);
          break;
        case TAG_ID.CAPTION:
          !function(e3, t3) {
            e3.openElements.clearBackToTableContext(), e3.activeFormattingElements.insertMarker(), e3._insertElement(t3, NS.HTML), e3.insertionMode = InsertionMode.IN_CAPTION;
          }(e2, t2);
          break;
        case TAG_ID.COLGROUP:
          !function(e3, t3) {
            e3.openElements.clearBackToTableContext(), e3._insertElement(t3, NS.HTML), e3.insertionMode = InsertionMode.IN_COLUMN_GROUP;
          }(e2, t2);
          break;
        default:
          tokenInTable(e2, t2);
      }
    }
    function endTagInTable(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.TABLE:
          e2.openElements.hasInTableScope(TAG_ID.TABLE) && (e2.openElements.popUntilTagNamePopped(TAG_ID.TABLE), e2._resetInsertionMode());
          break;
        case TAG_ID.TEMPLATE:
          templateEndTagInHead(e2, t2);
          break;
        case TAG_ID.BODY:
        case TAG_ID.CAPTION:
        case TAG_ID.COL:
        case TAG_ID.COLGROUP:
        case TAG_ID.HTML:
        case TAG_ID.TBODY:
        case TAG_ID.TD:
        case TAG_ID.TFOOT:
        case TAG_ID.TH:
        case TAG_ID.THEAD:
        case TAG_ID.TR:
          break;
        default:
          tokenInTable(e2, t2);
      }
    }
    function tokenInTable(e2, t2) {
      const n3 = e2.fosterParentingEnabled;
      e2.fosterParentingEnabled = true, modeInBody(e2, t2), e2.fosterParentingEnabled = n3;
    }
    function whitespaceCharacterInTableText(e2, t2) {
      e2.pendingCharacterTokens.push(t2);
    }
    function characterInTableText(e2, t2) {
      e2.pendingCharacterTokens.push(t2), e2.hasNonWhitespacePendingCharacterToken = true;
    }
    function tokenInTableText(e2, t2) {
      let n3 = 0;
      if (e2.hasNonWhitespacePendingCharacterToken) for (; n3 < e2.pendingCharacterTokens.length; n3++) tokenInTable(e2, e2.pendingCharacterTokens[n3]);
      else for (; n3 < e2.pendingCharacterTokens.length; n3++) e2._insertCharacters(e2.pendingCharacterTokens[n3]);
      e2.insertionMode = e2.originalInsertionMode, e2._processToken(t2);
    }
    function startTagInColumnGroup(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.HTML:
          startTagInBody(e2, t2);
          break;
        case TAG_ID.COL:
          e2._appendElement(t2, NS.HTML), t2.ackSelfClosing = true;
          break;
        case TAG_ID.TEMPLATE:
          startTagInHead(e2, t2);
          break;
        default:
          tokenInColumnGroup(e2, t2);
      }
    }
    function tokenInColumnGroup(e2, t2) {
      e2.openElements.currentTagId === TAG_ID.COLGROUP && (e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE, e2._processToken(t2));
    }
    function startTagInTableBody(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.TR:
          e2.openElements.clearBackToTableBodyContext(), e2._insertElement(t2, NS.HTML), e2.insertionMode = InsertionMode.IN_ROW;
          break;
        case TAG_ID.TH:
        case TAG_ID.TD:
          e2.openElements.clearBackToTableBodyContext(), e2._insertFakeElement(TAG_NAMES.TR, TAG_ID.TR), e2.insertionMode = InsertionMode.IN_ROW, startTagInRow(e2, t2);
          break;
        case TAG_ID.CAPTION:
        case TAG_ID.COL:
        case TAG_ID.COLGROUP:
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
          e2.openElements.hasTableBodyContextInTableScope() && (e2.openElements.clearBackToTableBodyContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE, startTagInTable(e2, t2));
          break;
        default:
          startTagInTable(e2, t2);
      }
    }
    function endTagInTableBody(e2, t2) {
      const n3 = t2.tagID;
      switch (t2.tagID) {
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
          e2.openElements.hasInTableScope(n3) && (e2.openElements.clearBackToTableBodyContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE);
          break;
        case TAG_ID.TABLE:
          e2.openElements.hasTableBodyContextInTableScope() && (e2.openElements.clearBackToTableBodyContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE, endTagInTable(e2, t2));
          break;
        case TAG_ID.BODY:
        case TAG_ID.CAPTION:
        case TAG_ID.COL:
        case TAG_ID.COLGROUP:
        case TAG_ID.HTML:
        case TAG_ID.TD:
        case TAG_ID.TH:
        case TAG_ID.TR:
          break;
        default:
          endTagInTable(e2, t2);
      }
    }
    function startTagInRow(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.TH:
        case TAG_ID.TD:
          e2.openElements.clearBackToTableRowContext(), e2._insertElement(t2, NS.HTML), e2.insertionMode = InsertionMode.IN_CELL, e2.activeFormattingElements.insertMarker();
          break;
        case TAG_ID.CAPTION:
        case TAG_ID.COL:
        case TAG_ID.COLGROUP:
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
        case TAG_ID.TR:
          e2.openElements.hasInTableScope(TAG_ID.TR) && (e2.openElements.clearBackToTableRowContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE_BODY, startTagInTableBody(e2, t2));
          break;
        default:
          startTagInTable(e2, t2);
      }
    }
    function endTagInRow(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.TR:
          e2.openElements.hasInTableScope(TAG_ID.TR) && (e2.openElements.clearBackToTableRowContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE_BODY);
          break;
        case TAG_ID.TABLE:
          e2.openElements.hasInTableScope(TAG_ID.TR) && (e2.openElements.clearBackToTableRowContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE_BODY, endTagInTableBody(e2, t2));
          break;
        case TAG_ID.TBODY:
        case TAG_ID.TFOOT:
        case TAG_ID.THEAD:
          (e2.openElements.hasInTableScope(t2.tagID) || e2.openElements.hasInTableScope(TAG_ID.TR)) && (e2.openElements.clearBackToTableRowContext(), e2.openElements.pop(), e2.insertionMode = InsertionMode.IN_TABLE_BODY, endTagInTableBody(e2, t2));
          break;
        case TAG_ID.BODY:
        case TAG_ID.CAPTION:
        case TAG_ID.COL:
        case TAG_ID.COLGROUP:
        case TAG_ID.HTML:
        case TAG_ID.TD:
        case TAG_ID.TH:
          break;
        default:
          endTagInTable(e2, t2);
      }
    }
    function startTagInSelect(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.HTML:
          startTagInBody(e2, t2);
          break;
        case TAG_ID.OPTION:
          e2.openElements.currentTagId === TAG_ID.OPTION && e2.openElements.pop(), e2._insertElement(t2, NS.HTML);
          break;
        case TAG_ID.OPTGROUP:
          e2.openElements.currentTagId === TAG_ID.OPTION && e2.openElements.pop(), e2.openElements.currentTagId === TAG_ID.OPTGROUP && e2.openElements.pop(), e2._insertElement(t2, NS.HTML);
          break;
        case TAG_ID.HR:
          e2.openElements.currentTagId === TAG_ID.OPTION && e2.openElements.pop(), e2.openElements.currentTagId === TAG_ID.OPTGROUP && e2.openElements.pop(), e2._appendElement(t2, NS.HTML), t2.ackSelfClosing = true;
          break;
        case TAG_ID.INPUT:
        case TAG_ID.KEYGEN:
        case TAG_ID.TEXTAREA:
        case TAG_ID.SELECT:
          e2.openElements.hasInSelectScope(TAG_ID.SELECT) && (e2.openElements.popUntilTagNamePopped(TAG_ID.SELECT), e2._resetInsertionMode(), t2.tagID !== TAG_ID.SELECT && e2._processStartTag(t2));
          break;
        case TAG_ID.SCRIPT:
        case TAG_ID.TEMPLATE:
          startTagInHead(e2, t2);
      }
    }
    function endTagInSelect(e2, t2) {
      switch (t2.tagID) {
        case TAG_ID.OPTGROUP:
          e2.openElements.stackTop > 0 && e2.openElements.currentTagId === TAG_ID.OPTION && e2.openElements.tagIDs[e2.openElements.stackTop - 1] === TAG_ID.OPTGROUP && e2.openElements.pop(), e2.openElements.currentTagId === TAG_ID.OPTGROUP && e2.openElements.pop();
          break;
        case TAG_ID.OPTION:
          e2.openElements.currentTagId === TAG_ID.OPTION && e2.openElements.pop();
          break;
        case TAG_ID.SELECT:
          e2.openElements.hasInSelectScope(TAG_ID.SELECT) && (e2.openElements.popUntilTagNamePopped(TAG_ID.SELECT), e2._resetInsertionMode());
          break;
        case TAG_ID.TEMPLATE:
          templateEndTagInHead(e2, t2);
      }
    }
    function eofInTemplate(e2, t2) {
      e2.openElements.tmplCount > 0 ? (e2.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE), e2.activeFormattingElements.clearToLastMarker(), e2.tmplInsertionModeStack.shift(), e2._resetInsertionMode(), e2.onEof(t2)) : stopParsing(e2, t2);
    }
    function endTagAfterBody(e2, t2) {
      var n3;
      if (t2.tagID === TAG_ID.HTML) {
        if (e2.fragmentContext || (e2.insertionMode = InsertionMode.AFTER_AFTER_BODY), e2.options.sourceCodeLocationInfo && e2.openElements.tagIDs[0] === TAG_ID.HTML) {
          e2._setEndLocation(e2.openElements.items[0], t2);
          const r = e2.openElements.items[1];
          r && !(null === (n3 = e2.treeAdapter.getNodeSourceCodeLocation(r)) || void 0 === n3 ? void 0 : n3.endTag) && e2._setEndLocation(r, t2);
        }
      } else tokenAfterBody(e2, t2);
    }
    function tokenAfterBody(e2, t2) {
      e2.insertionMode = InsertionMode.IN_BODY, modeInBody(e2, t2);
    }
    function tokenAfterAfterBody(e2, t2) {
      e2.insertionMode = InsertionMode.IN_BODY, modeInBody(e2, t2);
    }
    function popUntilHtmlOrIntegrationPoint(e2) {
      for (; e2.treeAdapter.getNamespaceURI(e2.openElements.current) !== NS.HTML && void 0 !== e2.openElements.currentTagId && !e2._isIntegrationPoint(e2.openElements.currentTagId, e2.openElements.current); ) e2.openElements.pop();
    }
    var init_parser2 = __esm2({ "node_modules/parse5/dist/parser/index.js"() {
      var e2;
      init_tokenizer(), init_open_element_stack(), init_formatting_element_list(), init_default2(), init_doctype(), init_foreign_content(), init_error_codes(), init_unicode(), init_html22(), init_token2(), HIDDEN_INPUT_TYPE = "hidden", AA_OUTER_LOOP_ITER = 8, AA_INNER_LOOP_ITER = 3, (e2 = InsertionMode || (InsertionMode = {}))[e2.INITIAL = 0] = "INITIAL", e2[e2.BEFORE_HTML = 1] = "BEFORE_HTML", e2[e2.BEFORE_HEAD = 2] = "BEFORE_HEAD", e2[e2.IN_HEAD = 3] = "IN_HEAD", e2[e2.IN_HEAD_NO_SCRIPT = 4] = "IN_HEAD_NO_SCRIPT", e2[e2.AFTER_HEAD = 5] = "AFTER_HEAD", e2[e2.IN_BODY = 6] = "IN_BODY", e2[e2.TEXT = 7] = "TEXT", e2[e2.IN_TABLE = 8] = "IN_TABLE", e2[e2.IN_TABLE_TEXT = 9] = "IN_TABLE_TEXT", e2[e2.IN_CAPTION = 10] = "IN_CAPTION", e2[e2.IN_COLUMN_GROUP = 11] = "IN_COLUMN_GROUP", e2[e2.IN_TABLE_BODY = 12] = "IN_TABLE_BODY", e2[e2.IN_ROW = 13] = "IN_ROW", e2[e2.IN_CELL = 14] = "IN_CELL", e2[e2.IN_SELECT = 15] = "IN_SELECT", e2[e2.IN_SELECT_IN_TABLE = 16] = "IN_SELECT_IN_TABLE", e2[e2.IN_TEMPLATE = 17] = "IN_TEMPLATE", e2[e2.AFTER_BODY = 18] = "AFTER_BODY", e2[e2.IN_FRAMESET = 19] = "IN_FRAMESET", e2[e2.AFTER_FRAMESET = 20] = "AFTER_FRAMESET", e2[e2.AFTER_AFTER_BODY = 21] = "AFTER_AFTER_BODY", e2[e2.AFTER_AFTER_FRAMESET = 22] = "AFTER_AFTER_FRAMESET", BASE_LOC = { startLine: -1, startCol: -1, startOffset: -1, endLine: -1, endCol: -1, endOffset: -1 }, TABLE_STRUCTURE_TAGS = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TR]), defaultParserOptions = { scriptingEnabled: true, sourceCodeLocationInfo: false, treeAdapter: defaultTreeAdapter, onParseError: null }, Parser3 = class {
        constructor(e3, t2, n3 = null, r = null) {
          this.fragmentContext = n3, this.scriptHandler = r, this.currentToken = null, this.stopped = false, this.insertionMode = InsertionMode.INITIAL, this.originalInsertionMode = InsertionMode.INITIAL, this.headElement = null, this.formElement = null, this.currentNotInHTML = false, this.tmplInsertionModeStack = [], this.pendingCharacterTokens = [], this.hasNonWhitespacePendingCharacterToken = false, this.framesetOk = true, this.skipNextNewLine = false, this.fosterParentingEnabled = false, this.options = { ...defaultParserOptions, ...e3 }, this.treeAdapter = this.options.treeAdapter, this.onParseError = this.options.onParseError, this.onParseError && (this.options.sourceCodeLocationInfo = true), this.document = null != t2 ? t2 : this.treeAdapter.createDocument(), this.tokenizer = new Tokenizer(this.options, this), this.activeFormattingElements = new FormattingElementList(this.treeAdapter), this.fragmentContextID = n3 ? getTagID(this.treeAdapter.getTagName(n3)) : TAG_ID.UNKNOWN, this._setContextModes(null != n3 ? n3 : this.document, this.fragmentContextID), this.openElements = new OpenElementStack(this.document, this.treeAdapter, this);
        }
        static parse(e3, t2) {
          const n3 = new this(t2);
          return n3.tokenizer.write(e3, true), n3.document;
        }
        static getFragmentParser(e3, t2) {
          const n3 = { ...defaultParserOptions, ...t2 };
          null != e3 || (e3 = n3.treeAdapter.createElement(TAG_NAMES.TEMPLATE, NS.HTML, []));
          const r = n3.treeAdapter.createElement("documentmock", NS.HTML, []), i = new this(n3, r, e3);
          return i.fragmentContextID === TAG_ID.TEMPLATE && i.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE), i._initTokenizerForFragmentParsing(), i._insertFakeRootElement(), i._resetInsertionMode(), i._findFormInFragmentContext(), i;
        }
        getFragment() {
          const e3 = this.treeAdapter.getFirstChild(this.document), t2 = this.treeAdapter.createDocumentFragment();
          return this._adoptNodes(e3, t2), t2;
        }
        _err(e3, t2, n3) {
          var r;
          if (!this.onParseError) return;
          const i = null !== (r = e3.location) && void 0 !== r ? r : BASE_LOC, s2 = { code: t2, startLine: i.startLine, startCol: i.startCol, startOffset: i.startOffset, endLine: n3 ? i.startLine : i.endLine, endCol: n3 ? i.startCol : i.endCol, endOffset: n3 ? i.startOffset : i.endOffset };
          this.onParseError(s2);
        }
        onItemPush(e3, t2, n3) {
          var r, i;
          null === (i = (r = this.treeAdapter).onItemPush) || void 0 === i || i.call(r, e3), n3 && this.openElements.stackTop > 0 && this._setContextModes(e3, t2);
        }
        onItemPop(e3, t2) {
          var n3, r;
          if (this.options.sourceCodeLocationInfo && this._setEndLocation(e3, this.currentToken), null === (r = (n3 = this.treeAdapter).onItemPop) || void 0 === r || r.call(n3, e3, this.openElements.current), t2) {
            let e4, t3;
            0 === this.openElements.stackTop && this.fragmentContext ? (e4 = this.fragmentContext, t3 = this.fragmentContextID) : { current: e4, currentTagId: t3 } = this.openElements, this._setContextModes(e4, t3);
          }
        }
        _setContextModes(e3, t2) {
          const n3 = e3 === this.document || e3 && this.treeAdapter.getNamespaceURI(e3) === NS.HTML;
          this.currentNotInHTML = !n3, this.tokenizer.inForeignNode = !n3 && void 0 !== e3 && void 0 !== t2 && !this._isIntegrationPoint(t2, e3);
        }
        _switchToTextParsing(e3, t2) {
          this._insertElement(e3, NS.HTML), this.tokenizer.state = t2, this.originalInsertionMode = this.insertionMode, this.insertionMode = InsertionMode.TEXT;
        }
        switchToPlaintextParsing() {
          this.insertionMode = InsertionMode.TEXT, this.originalInsertionMode = InsertionMode.IN_BODY, this.tokenizer.state = TokenizerMode.PLAINTEXT;
        }
        _getAdjustedCurrentElement() {
          return 0 === this.openElements.stackTop && this.fragmentContext ? this.fragmentContext : this.openElements.current;
        }
        _findFormInFragmentContext() {
          let e3 = this.fragmentContext;
          for (; e3; ) {
            if (this.treeAdapter.getTagName(e3) === TAG_NAMES.FORM) {
              this.formElement = e3;
              break;
            }
            e3 = this.treeAdapter.getParentNode(e3);
          }
        }
        _initTokenizerForFragmentParsing() {
          if (this.fragmentContext && this.treeAdapter.getNamespaceURI(this.fragmentContext) === NS.HTML) switch (this.fragmentContextID) {
            case TAG_ID.TITLE:
            case TAG_ID.TEXTAREA:
              this.tokenizer.state = TokenizerMode.RCDATA;
              break;
            case TAG_ID.STYLE:
            case TAG_ID.XMP:
            case TAG_ID.IFRAME:
            case TAG_ID.NOEMBED:
            case TAG_ID.NOFRAMES:
            case TAG_ID.NOSCRIPT:
              this.tokenizer.state = TokenizerMode.RAWTEXT;
              break;
            case TAG_ID.SCRIPT:
              this.tokenizer.state = TokenizerMode.SCRIPT_DATA;
              break;
            case TAG_ID.PLAINTEXT:
              this.tokenizer.state = TokenizerMode.PLAINTEXT;
          }
        }
        _setDocumentType(e3) {
          const t2 = e3.name || "", n3 = e3.publicId || "", r = e3.systemId || "";
          if (this.treeAdapter.setDocumentType(this.document, t2, n3, r), e3.location) {
            const t3 = this.treeAdapter.getChildNodes(this.document).find((e4) => this.treeAdapter.isDocumentTypeNode(e4));
            t3 && this.treeAdapter.setNodeSourceCodeLocation(t3, e3.location);
          }
        }
        _attachElementToTree(e3, t2) {
          if (this.options.sourceCodeLocationInfo) {
            const n3 = t2 && { ...t2, startTag: t2 };
            this.treeAdapter.setNodeSourceCodeLocation(e3, n3);
          }
          if (this._shouldFosterParentOnInsertion()) this._fosterParentElement(e3);
          else {
            const t3 = this.openElements.currentTmplContentOrNode;
            this.treeAdapter.appendChild(null != t3 ? t3 : this.document, e3);
          }
        }
        _appendElement(e3, t2) {
          const n3 = this.treeAdapter.createElement(e3.tagName, t2, e3.attrs);
          this._attachElementToTree(n3, e3.location);
        }
        _insertElement(e3, t2) {
          const n3 = this.treeAdapter.createElement(e3.tagName, t2, e3.attrs);
          this._attachElementToTree(n3, e3.location), this.openElements.push(n3, e3.tagID);
        }
        _insertFakeElement(e3, t2) {
          const n3 = this.treeAdapter.createElement(e3, NS.HTML, []);
          this._attachElementToTree(n3, null), this.openElements.push(n3, t2);
        }
        _insertTemplate(e3) {
          const t2 = this.treeAdapter.createElement(e3.tagName, NS.HTML, e3.attrs), n3 = this.treeAdapter.createDocumentFragment();
          this.treeAdapter.setTemplateContent(t2, n3), this._attachElementToTree(t2, e3.location), this.openElements.push(t2, e3.tagID), this.options.sourceCodeLocationInfo && this.treeAdapter.setNodeSourceCodeLocation(n3, null);
        }
        _insertFakeRootElement() {
          const e3 = this.treeAdapter.createElement(TAG_NAMES.HTML, NS.HTML, []);
          this.options.sourceCodeLocationInfo && this.treeAdapter.setNodeSourceCodeLocation(e3, null), this.treeAdapter.appendChild(this.openElements.current, e3), this.openElements.push(e3, TAG_ID.HTML);
        }
        _appendCommentNode(e3, t2) {
          const n3 = this.treeAdapter.createCommentNode(e3.data);
          this.treeAdapter.appendChild(t2, n3), this.options.sourceCodeLocationInfo && this.treeAdapter.setNodeSourceCodeLocation(n3, e3.location);
        }
        _insertCharacters(e3) {
          let t2, n3;
          if (this._shouldFosterParentOnInsertion() ? ({ parent: t2, beforeElement: n3 } = this._findFosterParentingLocation(), n3 ? this.treeAdapter.insertTextBefore(t2, e3.chars, n3) : this.treeAdapter.insertText(t2, e3.chars)) : (t2 = this.openElements.currentTmplContentOrNode, this.treeAdapter.insertText(t2, e3.chars)), !e3.location) return;
          const r = this.treeAdapter.getChildNodes(t2), i = n3 ? r.lastIndexOf(n3) : r.length, s2 = r[i - 1];
          if (this.treeAdapter.getNodeSourceCodeLocation(s2)) {
            const { endLine: t3, endCol: n4, endOffset: r3 } = e3.location;
            this.treeAdapter.updateNodeSourceCodeLocation(s2, { endLine: t3, endCol: n4, endOffset: r3 });
          } else this.options.sourceCodeLocationInfo && this.treeAdapter.setNodeSourceCodeLocation(s2, e3.location);
        }
        _adoptNodes(e3, t2) {
          for (let n3 = this.treeAdapter.getFirstChild(e3); n3; n3 = this.treeAdapter.getFirstChild(e3)) this.treeAdapter.detachNode(n3), this.treeAdapter.appendChild(t2, n3);
        }
        _setEndLocation(e3, t2) {
          if (this.treeAdapter.getNodeSourceCodeLocation(e3) && t2.location) {
            const n3 = t2.location, r = this.treeAdapter.getTagName(e3), i = t2.type === TokenType.END_TAG && r === t2.tagName ? { endTag: { ...n3 }, endLine: n3.endLine, endCol: n3.endCol, endOffset: n3.endOffset } : { endLine: n3.startLine, endCol: n3.startCol, endOffset: n3.startOffset };
            this.treeAdapter.updateNodeSourceCodeLocation(e3, i);
          }
        }
        shouldProcessStartTagTokenInForeignContent(e3) {
          if (!this.currentNotInHTML) return false;
          let t2, n3;
          return 0 === this.openElements.stackTop && this.fragmentContext ? (t2 = this.fragmentContext, n3 = this.fragmentContextID) : { current: t2, currentTagId: n3 } = this.openElements, (e3.tagID !== TAG_ID.SVG || this.treeAdapter.getTagName(t2) !== TAG_NAMES.ANNOTATION_XML || this.treeAdapter.getNamespaceURI(t2) !== NS.MATHML) && (this.tokenizer.inForeignNode || (e3.tagID === TAG_ID.MGLYPH || e3.tagID === TAG_ID.MALIGNMARK) && void 0 !== n3 && !this._isIntegrationPoint(n3, t2, NS.HTML));
        }
        _processToken(e3) {
          switch (e3.type) {
            case TokenType.CHARACTER:
              this.onCharacter(e3);
              break;
            case TokenType.NULL_CHARACTER:
              this.onNullCharacter(e3);
              break;
            case TokenType.COMMENT:
              this.onComment(e3);
              break;
            case TokenType.DOCTYPE:
              this.onDoctype(e3);
              break;
            case TokenType.START_TAG:
              this._processStartTag(e3);
              break;
            case TokenType.END_TAG:
              this.onEndTag(e3);
              break;
            case TokenType.EOF:
              this.onEof(e3);
              break;
            case TokenType.WHITESPACE_CHARACTER:
              this.onWhitespaceCharacter(e3);
          }
        }
        _isIntegrationPoint(e3, t2, n3) {
          return function(e4, t3, n4, r) {
            return (!r || r === NS.HTML) && function(e5, t4, n5) {
              if (t4 === NS.MATHML && e5 === TAG_ID.ANNOTATION_XML) {
                for (let e6 = 0; e6 < n5.length; e6++) if (n5[e6].name === ATTRS.ENCODING) {
                  const t5 = n5[e6].value.toLowerCase();
                  return t5 === MIME_TYPES.TEXT_HTML || t5 === MIME_TYPES.APPLICATION_XML;
                }
              }
              return t4 === NS.SVG && (e5 === TAG_ID.FOREIGN_OBJECT || e5 === TAG_ID.DESC || e5 === TAG_ID.TITLE);
            }(e4, t3, n4) || (!r || r === NS.MATHML) && function(e5, t4) {
              return t4 === NS.MATHML && (e5 === TAG_ID.MI || e5 === TAG_ID.MO || e5 === TAG_ID.MN || e5 === TAG_ID.MS || e5 === TAG_ID.MTEXT);
            }(e4, t3);
          }(e3, this.treeAdapter.getNamespaceURI(t2), this.treeAdapter.getAttrList(t2), n3);
        }
        _reconstructActiveFormattingElements() {
          const e3 = this.activeFormattingElements.entries.length;
          if (e3) {
            const t2 = this.activeFormattingElements.entries.findIndex((e4) => e4.type === EntryType.Marker || this.openElements.contains(e4.element));
            for (let n3 = -1 === t2 ? e3 - 1 : t2 - 1; n3 >= 0; n3--) {
              const e4 = this.activeFormattingElements.entries[n3];
              this._insertElement(e4.token, this.treeAdapter.getNamespaceURI(e4.element)), e4.element = this.openElements.current;
            }
          }
        }
        _closeTableCell() {
          this.openElements.generateImpliedEndTags(), this.openElements.popUntilTableCellPopped(), this.activeFormattingElements.clearToLastMarker(), this.insertionMode = InsertionMode.IN_ROW;
        }
        _closePElement() {
          this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P), this.openElements.popUntilTagNamePopped(TAG_ID.P);
        }
        _resetInsertionMode() {
          for (let e3 = this.openElements.stackTop; e3 >= 0; e3--) switch (0 === e3 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[e3]) {
            case TAG_ID.TR:
              return void (this.insertionMode = InsertionMode.IN_ROW);
            case TAG_ID.TBODY:
            case TAG_ID.THEAD:
            case TAG_ID.TFOOT:
              return void (this.insertionMode = InsertionMode.IN_TABLE_BODY);
            case TAG_ID.CAPTION:
              return void (this.insertionMode = InsertionMode.IN_CAPTION);
            case TAG_ID.COLGROUP:
              return void (this.insertionMode = InsertionMode.IN_COLUMN_GROUP);
            case TAG_ID.TABLE:
              return void (this.insertionMode = InsertionMode.IN_TABLE);
            case TAG_ID.BODY:
              return void (this.insertionMode = InsertionMode.IN_BODY);
            case TAG_ID.FRAMESET:
              return void (this.insertionMode = InsertionMode.IN_FRAMESET);
            case TAG_ID.SELECT:
              return void this._resetInsertionModeForSelect(e3);
            case TAG_ID.TEMPLATE:
              return void (this.insertionMode = this.tmplInsertionModeStack[0]);
            case TAG_ID.HTML:
              return void (this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD);
            case TAG_ID.TD:
            case TAG_ID.TH:
              if (e3 > 0) return void (this.insertionMode = InsertionMode.IN_CELL);
              break;
            case TAG_ID.HEAD:
              if (e3 > 0) return void (this.insertionMode = InsertionMode.IN_HEAD);
          }
          this.insertionMode = InsertionMode.IN_BODY;
        }
        _resetInsertionModeForSelect(e3) {
          if (e3 > 0) for (let t2 = e3 - 1; t2 > 0; t2--) {
            const e4 = this.openElements.tagIDs[t2];
            if (e4 === TAG_ID.TEMPLATE) break;
            if (e4 === TAG_ID.TABLE) return void (this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE);
          }
          this.insertionMode = InsertionMode.IN_SELECT;
        }
        _isElementCausesFosterParenting(e3) {
          return TABLE_STRUCTURE_TAGS.has(e3);
        }
        _shouldFosterParentOnInsertion() {
          return this.fosterParentingEnabled && void 0 !== this.openElements.currentTagId && this._isElementCausesFosterParenting(this.openElements.currentTagId);
        }
        _findFosterParentingLocation() {
          for (let e3 = this.openElements.stackTop; e3 >= 0; e3--) {
            const t2 = this.openElements.items[e3];
            switch (this.openElements.tagIDs[e3]) {
              case TAG_ID.TEMPLATE:
                if (this.treeAdapter.getNamespaceURI(t2) === NS.HTML) return { parent: this.treeAdapter.getTemplateContent(t2), beforeElement: null };
                break;
              case TAG_ID.TABLE: {
                const n3 = this.treeAdapter.getParentNode(t2);
                return n3 ? { parent: n3, beforeElement: t2 } : { parent: this.openElements.items[e3 - 1], beforeElement: null };
              }
            }
          }
          return { parent: this.openElements.items[0], beforeElement: null };
        }
        _fosterParentElement(e3) {
          const t2 = this._findFosterParentingLocation();
          t2.beforeElement ? this.treeAdapter.insertBefore(t2.parent, e3, t2.beforeElement) : this.treeAdapter.appendChild(t2.parent, e3);
        }
        _isSpecialElement(e3, t2) {
          const n3 = this.treeAdapter.getNamespaceURI(e3);
          return SPECIAL_ELEMENTS[n3].has(t2);
        }
        onCharacter(e3) {
          if (this.skipNextNewLine = false, this.tokenizer.inForeignNode) !function(e4, t2) {
            e4._insertCharacters(t2), e4.framesetOk = false;
          }(this, e3);
          else switch (this.insertionMode) {
            case InsertionMode.INITIAL:
              tokenInInitialMode(this, e3);
              break;
            case InsertionMode.BEFORE_HTML:
              tokenBeforeHtml(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
              tokenBeforeHead(this, e3);
              break;
            case InsertionMode.IN_HEAD:
              tokenInHead(this, e3);
              break;
            case InsertionMode.IN_HEAD_NO_SCRIPT:
              tokenInHeadNoScript(this, e3);
              break;
            case InsertionMode.AFTER_HEAD:
              tokenAfterHead(this, e3);
              break;
            case InsertionMode.IN_BODY:
            case InsertionMode.IN_CAPTION:
            case InsertionMode.IN_CELL:
            case InsertionMode.IN_TEMPLATE:
              characterInBody(this, e3);
              break;
            case InsertionMode.TEXT:
            case InsertionMode.IN_SELECT:
            case InsertionMode.IN_SELECT_IN_TABLE:
              this._insertCharacters(e3);
              break;
            case InsertionMode.IN_TABLE:
            case InsertionMode.IN_TABLE_BODY:
            case InsertionMode.IN_ROW:
              characterInTable(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              characterInTableText(this, e3);
              break;
            case InsertionMode.IN_COLUMN_GROUP:
              tokenInColumnGroup(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
              tokenAfterBody(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_BODY:
              tokenAfterAfterBody(this, e3);
          }
        }
        onNullCharacter(e3) {
          if (this.skipNextNewLine = false, this.tokenizer.inForeignNode) !function(e4, t2) {
            t2.chars = REPLACEMENT_CHARACTER, e4._insertCharacters(t2);
          }(this, e3);
          else switch (this.insertionMode) {
            case InsertionMode.INITIAL:
              tokenInInitialMode(this, e3);
              break;
            case InsertionMode.BEFORE_HTML:
              tokenBeforeHtml(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
              tokenBeforeHead(this, e3);
              break;
            case InsertionMode.IN_HEAD:
              tokenInHead(this, e3);
              break;
            case InsertionMode.IN_HEAD_NO_SCRIPT:
              tokenInHeadNoScript(this, e3);
              break;
            case InsertionMode.AFTER_HEAD:
              tokenAfterHead(this, e3);
              break;
            case InsertionMode.TEXT:
              this._insertCharacters(e3);
              break;
            case InsertionMode.IN_TABLE:
            case InsertionMode.IN_TABLE_BODY:
            case InsertionMode.IN_ROW:
              characterInTable(this, e3);
              break;
            case InsertionMode.IN_COLUMN_GROUP:
              tokenInColumnGroup(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
              tokenAfterBody(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_BODY:
              tokenAfterAfterBody(this, e3);
          }
        }
        onComment(e3) {
          if (this.skipNextNewLine = false, this.currentNotInHTML) appendComment(this, e3);
          else switch (this.insertionMode) {
            case InsertionMode.INITIAL:
            case InsertionMode.BEFORE_HTML:
            case InsertionMode.BEFORE_HEAD:
            case InsertionMode.IN_HEAD:
            case InsertionMode.IN_HEAD_NO_SCRIPT:
            case InsertionMode.AFTER_HEAD:
            case InsertionMode.IN_BODY:
            case InsertionMode.IN_TABLE:
            case InsertionMode.IN_CAPTION:
            case InsertionMode.IN_COLUMN_GROUP:
            case InsertionMode.IN_TABLE_BODY:
            case InsertionMode.IN_ROW:
            case InsertionMode.IN_CELL:
            case InsertionMode.IN_SELECT:
            case InsertionMode.IN_SELECT_IN_TABLE:
            case InsertionMode.IN_TEMPLATE:
            case InsertionMode.IN_FRAMESET:
            case InsertionMode.AFTER_FRAMESET:
              appendComment(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              tokenInTableText(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
              !function(e4, t2) {
                e4._appendCommentNode(t2, e4.openElements.items[0]);
              }(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_BODY:
            case InsertionMode.AFTER_AFTER_FRAMESET:
              !function(e4, t2) {
                e4._appendCommentNode(t2, e4.document);
              }(this, e3);
          }
        }
        onDoctype(e3) {
          switch (this.skipNextNewLine = false, this.insertionMode) {
            case InsertionMode.INITIAL:
              !function(e4, t2) {
                e4._setDocumentType(t2);
                const n3 = t2.forceQuirks ? DOCUMENT_MODE.QUIRKS : function(e5) {
                  if (e5.name !== VALID_DOCTYPE_NAME) return DOCUMENT_MODE.QUIRKS;
                  const { systemId: t3 } = e5;
                  if (t3 && t3.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) return DOCUMENT_MODE.QUIRKS;
                  let { publicId: n4 } = e5;
                  if (null !== n4) {
                    if (n4 = n4.toLowerCase(), QUIRKS_MODE_PUBLIC_IDS.has(n4)) return DOCUMENT_MODE.QUIRKS;
                    let e6 = null === t3 ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
                    if (hasPrefix(n4, e6)) return DOCUMENT_MODE.QUIRKS;
                    if (e6 = null === t3 ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES, hasPrefix(n4, e6)) return DOCUMENT_MODE.LIMITED_QUIRKS;
                  }
                  return DOCUMENT_MODE.NO_QUIRKS;
                }(t2);
                (function(e5) {
                  return e5.name === VALID_DOCTYPE_NAME && null === e5.publicId && (null === e5.systemId || e5.systemId === VALID_SYSTEM_ID);
                })(t2) || e4._err(t2, ERR.nonConformingDoctype), e4.treeAdapter.setDocumentMode(e4.document, n3), e4.insertionMode = InsertionMode.BEFORE_HTML;
              }(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
            case InsertionMode.IN_HEAD:
            case InsertionMode.IN_HEAD_NO_SCRIPT:
            case InsertionMode.AFTER_HEAD:
              this._err(e3, ERR.misplacedDoctype);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              tokenInTableText(this, e3);
          }
        }
        onStartTag(e3) {
          this.skipNextNewLine = false, this.currentToken = e3, this._processStartTag(e3), e3.selfClosing && !e3.ackSelfClosing && this._err(e3, ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
        }
        _processStartTag(e3) {
          this.shouldProcessStartTagTokenInForeignContent(e3) ? function(e4, t2) {
            if (function(e5) {
              const t3 = e5.tagID;
              return t3 === TAG_ID.FONT && e5.attrs.some(({ name: e6 }) => e6 === ATTRS.COLOR || e6 === ATTRS.SIZE || e6 === ATTRS.FACE) || EXITS_FOREIGN_CONTENT.has(t3);
            }(t2)) popUntilHtmlOrIntegrationPoint(e4), e4._startTagOutsideForeignContent(t2);
            else {
              const n3 = e4._getAdjustedCurrentElement(), r = e4.treeAdapter.getNamespaceURI(n3);
              r === NS.MATHML ? adjustTokenMathMLAttrs(t2) : r === NS.SVG && (function(e5) {
                const t3 = SVG_TAG_NAMES_ADJUSTMENT_MAP.get(e5.tagName);
                null != t3 && (e5.tagName = t3, e5.tagID = getTagID(e5.tagName));
              }(t2), adjustTokenSVGAttrs(t2)), adjustTokenXMLAttrs(t2), t2.selfClosing ? e4._appendElement(t2, r) : e4._insertElement(t2, r), t2.ackSelfClosing = true;
            }
          }(this, e3) : this._startTagOutsideForeignContent(e3);
        }
        _startTagOutsideForeignContent(e3) {
          switch (this.insertionMode) {
            case InsertionMode.INITIAL:
              tokenInInitialMode(this, e3);
              break;
            case InsertionMode.BEFORE_HTML:
              !function(e4, t2) {
                t2.tagID === TAG_ID.HTML ? (e4._insertElement(t2, NS.HTML), e4.insertionMode = InsertionMode.BEFORE_HEAD) : tokenBeforeHtml(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.HEAD:
                    e4._insertElement(t2, NS.HTML), e4.headElement = e4.openElements.current, e4.insertionMode = InsertionMode.IN_HEAD;
                    break;
                  default:
                    tokenBeforeHead(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_HEAD:
              startTagInHead(this, e3);
              break;
            case InsertionMode.IN_HEAD_NO_SCRIPT:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.BASEFONT:
                  case TAG_ID.BGSOUND:
                  case TAG_ID.HEAD:
                  case TAG_ID.LINK:
                  case TAG_ID.META:
                  case TAG_ID.NOFRAMES:
                  case TAG_ID.STYLE:
                    startTagInHead(e4, t2);
                    break;
                  case TAG_ID.NOSCRIPT:
                    e4._err(t2, ERR.nestedNoscriptInHead);
                    break;
                  default:
                    tokenInHeadNoScript(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.AFTER_HEAD:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.BODY:
                    e4._insertElement(t2, NS.HTML), e4.framesetOk = false, e4.insertionMode = InsertionMode.IN_BODY;
                    break;
                  case TAG_ID.FRAMESET:
                    e4._insertElement(t2, NS.HTML), e4.insertionMode = InsertionMode.IN_FRAMESET;
                    break;
                  case TAG_ID.BASE:
                  case TAG_ID.BASEFONT:
                  case TAG_ID.BGSOUND:
                  case TAG_ID.LINK:
                  case TAG_ID.META:
                  case TAG_ID.NOFRAMES:
                  case TAG_ID.SCRIPT:
                  case TAG_ID.STYLE:
                  case TAG_ID.TEMPLATE:
                  case TAG_ID.TITLE:
                    e4._err(t2, ERR.abandonedHeadElementChild), e4.openElements.push(e4.headElement, TAG_ID.HEAD), startTagInHead(e4, t2), e4.openElements.remove(e4.headElement);
                    break;
                  case TAG_ID.HEAD:
                    e4._err(t2, ERR.misplacedStartTagForHeadElement);
                    break;
                  default:
                    tokenAfterHead(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_BODY:
              startTagInBody(this, e3);
              break;
            case InsertionMode.IN_TABLE:
              startTagInTable(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              tokenInTableText(this, e3);
              break;
            case InsertionMode.IN_CAPTION:
              !function(e4, t2) {
                const n3 = t2.tagID;
                TABLE_VOID_ELEMENTS.has(n3) ? e4.openElements.hasInTableScope(TAG_ID.CAPTION) && (e4.openElements.generateImpliedEndTags(), e4.openElements.popUntilTagNamePopped(TAG_ID.CAPTION), e4.activeFormattingElements.clearToLastMarker(), e4.insertionMode = InsertionMode.IN_TABLE, startTagInTable(e4, t2)) : startTagInBody(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.IN_COLUMN_GROUP:
              startTagInColumnGroup(this, e3);
              break;
            case InsertionMode.IN_TABLE_BODY:
              startTagInTableBody(this, e3);
              break;
            case InsertionMode.IN_ROW:
              startTagInRow(this, e3);
              break;
            case InsertionMode.IN_CELL:
              !function(e4, t2) {
                const n3 = t2.tagID;
                TABLE_VOID_ELEMENTS.has(n3) ? (e4.openElements.hasInTableScope(TAG_ID.TD) || e4.openElements.hasInTableScope(TAG_ID.TH)) && (e4._closeTableCell(), startTagInRow(e4, t2)) : startTagInBody(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.IN_SELECT:
              startTagInSelect(this, e3);
              break;
            case InsertionMode.IN_SELECT_IN_TABLE:
              !function(e4, t2) {
                const n3 = t2.tagID;
                n3 === TAG_ID.CAPTION || n3 === TAG_ID.TABLE || n3 === TAG_ID.TBODY || n3 === TAG_ID.TFOOT || n3 === TAG_ID.THEAD || n3 === TAG_ID.TR || n3 === TAG_ID.TD || n3 === TAG_ID.TH ? (e4.openElements.popUntilTagNamePopped(TAG_ID.SELECT), e4._resetInsertionMode(), e4._processStartTag(t2)) : startTagInSelect(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.IN_TEMPLATE:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.BASE:
                  case TAG_ID.BASEFONT:
                  case TAG_ID.BGSOUND:
                  case TAG_ID.LINK:
                  case TAG_ID.META:
                  case TAG_ID.NOFRAMES:
                  case TAG_ID.SCRIPT:
                  case TAG_ID.STYLE:
                  case TAG_ID.TEMPLATE:
                  case TAG_ID.TITLE:
                    startTagInHead(e4, t2);
                    break;
                  case TAG_ID.CAPTION:
                  case TAG_ID.COLGROUP:
                  case TAG_ID.TBODY:
                  case TAG_ID.TFOOT:
                  case TAG_ID.THEAD:
                    e4.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE, e4.insertionMode = InsertionMode.IN_TABLE, startTagInTable(e4, t2);
                    break;
                  case TAG_ID.COL:
                    e4.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP, e4.insertionMode = InsertionMode.IN_COLUMN_GROUP, startTagInColumnGroup(e4, t2);
                    break;
                  case TAG_ID.TR:
                    e4.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY, e4.insertionMode = InsertionMode.IN_TABLE_BODY, startTagInTableBody(e4, t2);
                    break;
                  case TAG_ID.TD:
                  case TAG_ID.TH:
                    e4.tmplInsertionModeStack[0] = InsertionMode.IN_ROW, e4.insertionMode = InsertionMode.IN_ROW, startTagInRow(e4, t2);
                    break;
                  default:
                    e4.tmplInsertionModeStack[0] = InsertionMode.IN_BODY, e4.insertionMode = InsertionMode.IN_BODY, startTagInBody(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
              !function(e4, t2) {
                t2.tagID === TAG_ID.HTML ? startTagInBody(e4, t2) : tokenAfterBody(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.IN_FRAMESET:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.FRAMESET:
                    e4._insertElement(t2, NS.HTML);
                    break;
                  case TAG_ID.FRAME:
                    e4._appendElement(t2, NS.HTML), t2.ackSelfClosing = true;
                    break;
                  case TAG_ID.NOFRAMES:
                    startTagInHead(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.AFTER_FRAMESET:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.NOFRAMES:
                    startTagInHead(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_BODY:
              !function(e4, t2) {
                t2.tagID === TAG_ID.HTML ? startTagInBody(e4, t2) : tokenAfterAfterBody(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_FRAMESET:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HTML:
                    startTagInBody(e4, t2);
                    break;
                  case TAG_ID.NOFRAMES:
                    startTagInHead(e4, t2);
                }
              }(this, e3);
          }
        }
        onEndTag(e3) {
          this.skipNextNewLine = false, this.currentToken = e3, this.currentNotInHTML ? function(e4, t2) {
            if (t2.tagID === TAG_ID.P || t2.tagID === TAG_ID.BR) return popUntilHtmlOrIntegrationPoint(e4), void e4._endTagOutsideForeignContent(t2);
            for (let n3 = e4.openElements.stackTop; n3 > 0; n3--) {
              const r = e4.openElements.items[n3];
              if (e4.treeAdapter.getNamespaceURI(r) === NS.HTML) {
                e4._endTagOutsideForeignContent(t2);
                break;
              }
              const i = e4.treeAdapter.getTagName(r);
              if (i.toLowerCase() === t2.tagName) {
                t2.tagName = i, e4.openElements.shortenToLength(n3);
                break;
              }
            }
          }(this, e3) : this._endTagOutsideForeignContent(e3);
        }
        _endTagOutsideForeignContent(e3) {
          switch (this.insertionMode) {
            case InsertionMode.INITIAL:
              tokenInInitialMode(this, e3);
              break;
            case InsertionMode.BEFORE_HTML:
              !function(e4, t2) {
                const n3 = t2.tagID;
                n3 !== TAG_ID.HTML && n3 !== TAG_ID.HEAD && n3 !== TAG_ID.BODY && n3 !== TAG_ID.BR || tokenBeforeHtml(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
              !function(e4, t2) {
                const n3 = t2.tagID;
                n3 === TAG_ID.HEAD || n3 === TAG_ID.BODY || n3 === TAG_ID.HTML || n3 === TAG_ID.BR ? tokenBeforeHead(e4, t2) : e4._err(t2, ERR.endTagWithoutMatchingOpenElement);
              }(this, e3);
              break;
            case InsertionMode.IN_HEAD:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.HEAD:
                    e4.openElements.pop(), e4.insertionMode = InsertionMode.AFTER_HEAD;
                    break;
                  case TAG_ID.BODY:
                  case TAG_ID.BR:
                  case TAG_ID.HTML:
                    tokenInHead(e4, t2);
                    break;
                  case TAG_ID.TEMPLATE:
                    templateEndTagInHead(e4, t2);
                    break;
                  default:
                    e4._err(t2, ERR.endTagWithoutMatchingOpenElement);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_HEAD_NO_SCRIPT:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.NOSCRIPT:
                    e4.openElements.pop(), e4.insertionMode = InsertionMode.IN_HEAD;
                    break;
                  case TAG_ID.BR:
                    tokenInHeadNoScript(e4, t2);
                    break;
                  default:
                    e4._err(t2, ERR.endTagWithoutMatchingOpenElement);
                }
              }(this, e3);
              break;
            case InsertionMode.AFTER_HEAD:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.BODY:
                  case TAG_ID.HTML:
                  case TAG_ID.BR:
                    tokenAfterHead(e4, t2);
                    break;
                  case TAG_ID.TEMPLATE:
                    templateEndTagInHead(e4, t2);
                    break;
                  default:
                    e4._err(t2, ERR.endTagWithoutMatchingOpenElement);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_BODY:
              endTagInBody(this, e3);
              break;
            case InsertionMode.TEXT:
              !function(e4, t2) {
                var n3;
                t2.tagID === TAG_ID.SCRIPT && (null === (n3 = e4.scriptHandler) || void 0 === n3 || n3.call(e4, e4.openElements.current)), e4.openElements.pop(), e4.insertionMode = e4.originalInsertionMode;
              }(this, e3);
              break;
            case InsertionMode.IN_TABLE:
              endTagInTable(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              tokenInTableText(this, e3);
              break;
            case InsertionMode.IN_CAPTION:
              !function(e4, t2) {
                const n3 = t2.tagID;
                switch (n3) {
                  case TAG_ID.CAPTION:
                  case TAG_ID.TABLE:
                    e4.openElements.hasInTableScope(TAG_ID.CAPTION) && (e4.openElements.generateImpliedEndTags(), e4.openElements.popUntilTagNamePopped(TAG_ID.CAPTION), e4.activeFormattingElements.clearToLastMarker(), e4.insertionMode = InsertionMode.IN_TABLE, n3 === TAG_ID.TABLE && endTagInTable(e4, t2));
                    break;
                  case TAG_ID.BODY:
                  case TAG_ID.COL:
                  case TAG_ID.COLGROUP:
                  case TAG_ID.HTML:
                  case TAG_ID.TBODY:
                  case TAG_ID.TD:
                  case TAG_ID.TFOOT:
                  case TAG_ID.TH:
                  case TAG_ID.THEAD:
                  case TAG_ID.TR:
                    break;
                  default:
                    endTagInBody(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_COLUMN_GROUP:
              !function(e4, t2) {
                switch (t2.tagID) {
                  case TAG_ID.COLGROUP:
                    e4.openElements.currentTagId === TAG_ID.COLGROUP && (e4.openElements.pop(), e4.insertionMode = InsertionMode.IN_TABLE);
                    break;
                  case TAG_ID.TEMPLATE:
                    templateEndTagInHead(e4, t2);
                    break;
                  case TAG_ID.COL:
                    break;
                  default:
                    tokenInColumnGroup(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_TABLE_BODY:
              endTagInTableBody(this, e3);
              break;
            case InsertionMode.IN_ROW:
              endTagInRow(this, e3);
              break;
            case InsertionMode.IN_CELL:
              !function(e4, t2) {
                const n3 = t2.tagID;
                switch (n3) {
                  case TAG_ID.TD:
                  case TAG_ID.TH:
                    e4.openElements.hasInTableScope(n3) && (e4.openElements.generateImpliedEndTags(), e4.openElements.popUntilTagNamePopped(n3), e4.activeFormattingElements.clearToLastMarker(), e4.insertionMode = InsertionMode.IN_ROW);
                    break;
                  case TAG_ID.TABLE:
                  case TAG_ID.TBODY:
                  case TAG_ID.TFOOT:
                  case TAG_ID.THEAD:
                  case TAG_ID.TR:
                    e4.openElements.hasInTableScope(n3) && (e4._closeTableCell(), endTagInRow(e4, t2));
                    break;
                  case TAG_ID.BODY:
                  case TAG_ID.CAPTION:
                  case TAG_ID.COL:
                  case TAG_ID.COLGROUP:
                  case TAG_ID.HTML:
                    break;
                  default:
                    endTagInBody(e4, t2);
                }
              }(this, e3);
              break;
            case InsertionMode.IN_SELECT:
              endTagInSelect(this, e3);
              break;
            case InsertionMode.IN_SELECT_IN_TABLE:
              !function(e4, t2) {
                const n3 = t2.tagID;
                n3 === TAG_ID.CAPTION || n3 === TAG_ID.TABLE || n3 === TAG_ID.TBODY || n3 === TAG_ID.TFOOT || n3 === TAG_ID.THEAD || n3 === TAG_ID.TR || n3 === TAG_ID.TD || n3 === TAG_ID.TH ? e4.openElements.hasInTableScope(n3) && (e4.openElements.popUntilTagNamePopped(TAG_ID.SELECT), e4._resetInsertionMode(), e4.onEndTag(t2)) : endTagInSelect(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.IN_TEMPLATE:
              !function(e4, t2) {
                t2.tagID === TAG_ID.TEMPLATE && templateEndTagInHead(e4, t2);
              }(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
              endTagAfterBody(this, e3);
              break;
            case InsertionMode.IN_FRAMESET:
              !function(e4, t2) {
                t2.tagID !== TAG_ID.FRAMESET || e4.openElements.isRootHtmlElementCurrent() || (e4.openElements.pop(), e4.fragmentContext || e4.openElements.currentTagId === TAG_ID.FRAMESET || (e4.insertionMode = InsertionMode.AFTER_FRAMESET));
              }(this, e3);
              break;
            case InsertionMode.AFTER_FRAMESET:
              !function(e4, t2) {
                t2.tagID === TAG_ID.HTML && (e4.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET);
              }(this, e3);
              break;
            case InsertionMode.AFTER_AFTER_BODY:
              tokenAfterAfterBody(this, e3);
          }
        }
        onEof(e3) {
          switch (this.insertionMode) {
            case InsertionMode.INITIAL:
              tokenInInitialMode(this, e3);
              break;
            case InsertionMode.BEFORE_HTML:
              tokenBeforeHtml(this, e3);
              break;
            case InsertionMode.BEFORE_HEAD:
              tokenBeforeHead(this, e3);
              break;
            case InsertionMode.IN_HEAD:
              tokenInHead(this, e3);
              break;
            case InsertionMode.IN_HEAD_NO_SCRIPT:
              tokenInHeadNoScript(this, e3);
              break;
            case InsertionMode.AFTER_HEAD:
              tokenAfterHead(this, e3);
              break;
            case InsertionMode.IN_BODY:
            case InsertionMode.IN_TABLE:
            case InsertionMode.IN_CAPTION:
            case InsertionMode.IN_COLUMN_GROUP:
            case InsertionMode.IN_TABLE_BODY:
            case InsertionMode.IN_ROW:
            case InsertionMode.IN_CELL:
            case InsertionMode.IN_SELECT:
            case InsertionMode.IN_SELECT_IN_TABLE:
              eofInBody(this, e3);
              break;
            case InsertionMode.TEXT:
              !function(e4, t2) {
                e4._err(t2, ERR.eofInElementThatCanContainOnlyText), e4.openElements.pop(), e4.insertionMode = e4.originalInsertionMode, e4.onEof(t2);
              }(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              tokenInTableText(this, e3);
              break;
            case InsertionMode.IN_TEMPLATE:
              eofInTemplate(this, e3);
              break;
            case InsertionMode.AFTER_BODY:
            case InsertionMode.IN_FRAMESET:
            case InsertionMode.AFTER_FRAMESET:
            case InsertionMode.AFTER_AFTER_BODY:
            case InsertionMode.AFTER_AFTER_FRAMESET:
              stopParsing(this, e3);
          }
        }
        onWhitespaceCharacter(e3) {
          if (this.skipNextNewLine && (this.skipNextNewLine = false, e3.chars.charCodeAt(0) === CODE_POINTS.LINE_FEED)) {
            if (1 === e3.chars.length) return;
            e3.chars = e3.chars.substr(1);
          }
          if (this.tokenizer.inForeignNode) this._insertCharacters(e3);
          else switch (this.insertionMode) {
            case InsertionMode.IN_HEAD:
            case InsertionMode.IN_HEAD_NO_SCRIPT:
            case InsertionMode.AFTER_HEAD:
            case InsertionMode.TEXT:
            case InsertionMode.IN_COLUMN_GROUP:
            case InsertionMode.IN_SELECT:
            case InsertionMode.IN_SELECT_IN_TABLE:
            case InsertionMode.IN_FRAMESET:
            case InsertionMode.AFTER_FRAMESET:
              this._insertCharacters(e3);
              break;
            case InsertionMode.IN_BODY:
            case InsertionMode.IN_CAPTION:
            case InsertionMode.IN_CELL:
            case InsertionMode.IN_TEMPLATE:
            case InsertionMode.AFTER_BODY:
            case InsertionMode.AFTER_AFTER_BODY:
            case InsertionMode.AFTER_AFTER_FRAMESET:
              whitespaceCharacterInBody(this, e3);
              break;
            case InsertionMode.IN_TABLE:
            case InsertionMode.IN_TABLE_BODY:
            case InsertionMode.IN_ROW:
              characterInTable(this, e3);
              break;
            case InsertionMode.IN_TABLE_TEXT:
              whitespaceCharacterInTableText(this, e3);
          }
        }
      }, TABLE_VOID_ELEMENTS = /* @__PURE__ */ new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
    } });
    var init_escape2 = __esm2({ "node_modules/parse5/node_modules/entities/dist/esm/escape.js"() {
      String.prototype.codePointAt;
    } });
    var init_serializer = __esm2({ "node_modules/parse5/dist/serializer/index.js"() {
      init_html22(), init_escape2(), init_default2(), TAG_NAMES.AREA, TAG_NAMES.BASE, TAG_NAMES.BASEFONT, TAG_NAMES.BGSOUND, TAG_NAMES.BR, TAG_NAMES.COL, TAG_NAMES.EMBED, TAG_NAMES.FRAME, TAG_NAMES.HR, TAG_NAMES.IMG, TAG_NAMES.INPUT, TAG_NAMES.KEYGEN, TAG_NAMES.LINK, TAG_NAMES.META, TAG_NAMES.PARAM, TAG_NAMES.SOURCE, TAG_NAMES.TRACK, TAG_NAMES.WBR;
    } });
    function parse3(e2, t2) {
      return Parser3.parse(e2, t2);
    }
    function parseFragment(e2, t2, n3) {
      "string" == typeof e2 && (n3 = t2, t2 = e2, e2 = null);
      const r = Parser3.getFragmentParser(e2, n3);
      return r.tokenizer.write(t2, true), r.getFragment();
    }
    var errors2;
    var base2;
    var dashToCamelRe;
    var formatCRe;
    var formatXRe;
    var fatalities;
    var emptyOptions;
    var init_dist = __esm2({ "node_modules/parse5/dist/index.js"() {
      init_parser2(), init_default2(), init_parser2(), init_serializer(), init_error_codes(), init_foreign_content(), init_html22(), init_token2(), init_tokenizer();
    } });
    var init_errors3 = __esm2({ "node_modules/hast-util-from-html/lib/errors.js"() {
      errors2 = { abandonedHeadElementChild: { reason: "Unexpected metadata element after head", description: "Unexpected element after head. Expected the element before `</head>`", url: false }, abruptClosingOfEmptyComment: { reason: "Unexpected abruptly closed empty comment", description: "Unexpected `>` or `->`. Expected `-->` to close comments" }, abruptDoctypePublicIdentifier: { reason: "Unexpected abruptly closed public identifier", description: "Unexpected `>`. Expected a closing `\"` or `'` after the public identifier" }, abruptDoctypeSystemIdentifier: { reason: "Unexpected abruptly closed system identifier", description: "Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier" }, absenceOfDigitsInNumericCharacterReference: { reason: "Unexpected non-digit at start of numeric character reference", description: "Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references" }, cdataInHtmlContent: { reason: "Unexpected CDATA section in HTML", description: "Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead" }, characterReferenceOutsideUnicodeRange: { reason: "Unexpected too big numeric character reference", description: "Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)" }, closingOfElementWithOpenChildElements: { reason: "Unexpected closing tag with open child elements", description: "Unexpectedly closing tag. Expected other tags to be closed first", url: false }, controlCharacterInInputStream: { reason: "Unexpected control character", description: "Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace" }, controlCharacterReference: { reason: "Unexpected control character reference", description: "Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace" }, disallowedContentInNoscriptInHead: { reason: "Disallowed content inside `<noscript>` in `<head>`", description: "Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`", url: false }, duplicateAttribute: { reason: "Unexpected duplicate attribute", description: "Unexpectedly double attribute. Expected attributes to occur only once" }, endTagWithAttributes: { reason: "Unexpected attribute on closing tag", description: "Unexpected attribute. Expected `>` instead" }, endTagWithTrailingSolidus: { reason: "Unexpected slash at end of closing tag", description: "Unexpected `%c-1`. Expected `>` instead" }, endTagWithoutMatchingOpenElement: { reason: "Unexpected unopened end tag", description: "Unexpected end tag. Expected no end tag or another end tag", url: false }, eofBeforeTagName: { reason: "Unexpected end of file", description: "Unexpected end of file. Expected tag name instead" }, eofInCdata: { reason: "Unexpected end of file in CDATA", description: "Unexpected end of file. Expected `]]>` to close the CDATA" }, eofInComment: { reason: "Unexpected end of file in comment", description: "Unexpected end of file. Expected `-->` to close the comment" }, eofInDoctype: { reason: "Unexpected end of file in doctype", description: "Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)" }, eofInElementThatCanContainOnlyText: { reason: "Unexpected end of file in element that can only contain text", description: "Unexpected end of file. Expected text or a closing tag", url: false }, eofInScriptHtmlCommentLikeText: { reason: "Unexpected end of file in comment inside script", description: "Unexpected end of file. Expected `-->` to close the comment" }, eofInTag: { reason: "Unexpected end of file in tag", description: "Unexpected end of file. Expected `>` to close the tag" }, incorrectlyClosedComment: { reason: "Incorrectly closed comment", description: "Unexpected `%c-1`. Expected `-->` to close the comment" }, incorrectlyOpenedComment: { reason: "Incorrectly opened comment", description: "Unexpected `%c`. Expected `<!--` to open the comment" }, invalidCharacterSequenceAfterDoctypeName: { reason: "Invalid sequence after doctype name", description: "Unexpected sequence at `%c`. Expected `public` or `system`" }, invalidFirstCharacterOfTagName: { reason: "Invalid first character in tag name", description: "Unexpected `%c`. Expected an ASCII letter instead" }, misplacedDoctype: { reason: "Misplaced doctype", description: "Unexpected doctype. Expected doctype before head", url: false }, misplacedStartTagForHeadElement: { reason: "Misplaced `<head>` start tag", description: "Unexpected start tag `<head>`. Expected `<head>` directly after doctype", url: false }, missingAttributeValue: { reason: "Missing attribute value", description: "Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead" }, missingDoctype: { reason: "Missing doctype before other content", description: "Expected a `<!doctype html>` before anything else", url: false }, missingDoctypeName: { reason: "Missing doctype name", description: "Unexpected doctype end at `%c`. Expected `html` instead" }, missingDoctypePublicIdentifier: { reason: "Missing public identifier in doctype", description: "Unexpected `%c`. Expected identifier for `public` instead" }, missingDoctypeSystemIdentifier: { reason: "Missing system identifier in doctype", description: 'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)' }, missingEndTagName: { reason: "Missing name in end tag", description: "Unexpected `%c`. Expected an ASCII letter instead" }, missingQuoteBeforeDoctypePublicIdentifier: { reason: "Missing quote before public identifier in doctype", description: "Unexpected `%c`. Expected `\"` or `'` instead" }, missingQuoteBeforeDoctypeSystemIdentifier: { reason: "Missing quote before system identifier in doctype", description: "Unexpected `%c`. Expected `\"` or `'` instead" }, missingSemicolonAfterCharacterReference: { reason: "Missing semicolon after character reference", description: "Unexpected `%c`. Expected `;` instead" }, missingWhitespaceAfterDoctypePublicKeyword: { reason: "Missing whitespace after public identifier in doctype", description: "Unexpected `%c`. Expected ASCII whitespace instead" }, missingWhitespaceAfterDoctypeSystemKeyword: { reason: "Missing whitespace after system identifier in doctype", description: "Unexpected `%c`. Expected ASCII whitespace instead" }, missingWhitespaceBeforeDoctypeName: { reason: "Missing whitespace before doctype name", description: "Unexpected `%c`. Expected ASCII whitespace instead" }, missingWhitespaceBetweenAttributes: { reason: "Missing whitespace between attributes", description: "Unexpected `%c`. Expected ASCII whitespace instead" }, missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: { reason: "Missing whitespace between public and system identifiers in doctype", description: "Unexpected `%c`. Expected ASCII whitespace instead" }, nestedComment: { reason: "Unexpected nested comment", description: "Unexpected `<!--`. Expected `-->`" }, nestedNoscriptInHead: { reason: "Unexpected nested `<noscript>` in `<head>`", description: "Unexpected `<noscript>`. Expected a closing tag or a meta element", url: false }, nonConformingDoctype: { reason: "Unexpected non-conforming doctype declaration", description: 'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`', url: false }, nonVoidHtmlElementStartTagWithTrailingSolidus: { reason: "Unexpected trailing slash on start tag of non-void element", description: "Unexpected `/`. Expected `>` instead" }, noncharacterCharacterReference: { reason: "Unexpected noncharacter code point referenced by character reference", description: "Unexpected code point. Do not use noncharacters in HTML" }, noncharacterInInputStream: { reason: "Unexpected noncharacter character", description: "Unexpected code point `%x`. Do not use noncharacters in HTML" }, nullCharacterReference: { reason: "Unexpected NULL character referenced by character reference", description: "Unexpected code point. Do not use NULL characters in HTML" }, openElementsLeftAfterEof: { reason: "Unexpected end of file", description: "Unexpected end of file. Expected closing tag instead", url: false }, surrogateCharacterReference: { reason: "Unexpected surrogate character referenced by character reference", description: "Unexpected code point. Do not use lone surrogate characters in HTML" }, surrogateInInputStream: { reason: "Unexpected surrogate character", description: "Unexpected code point `%x`. Do not use lone surrogate characters in HTML" }, unexpectedCharacterAfterDoctypeSystemIdentifier: { reason: "Invalid character after system identifier in doctype", description: "Unexpected character at `%c`. Expected `>`" }, unexpectedCharacterInAttributeName: { reason: "Unexpected character in attribute name", description: "Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter" }, unexpectedCharacterInUnquotedAttributeValue: { reason: "Unexpected character in unquoted attribute value", description: "Unexpected `%c`. Quote the attribute value to include it" }, unexpectedEqualsSignBeforeAttributeName: { reason: "Unexpected equals sign before attribute name", description: "Unexpected `%c`. Add an attribute name before it" }, unexpectedNullCharacter: { reason: "Unexpected NULL character", description: "Unexpected code point `%x`. Do not use NULL characters in HTML" }, unexpectedQuestionMarkInsteadOfTagName: { reason: "Unexpected question mark instead of tag name", description: "Unexpected `%c`. Expected an ASCII letter instead" }, unexpectedSolidusInTag: { reason: "Unexpected slash in tag", description: "Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value" }, unknownNamedCharacterReference: { reason: "Unexpected unknown named character reference", description: "Unexpected character reference. Expected known named character references" } };
    } });
    function dashToCamel(e2) {
      return e2.charAt(1).toUpperCase();
    }
    var init_lib10 = __esm2({ "node_modules/hast-util-from-html/lib/index.js"() {
      init_default(), init_hast_util_from_parse5(), init_dist(), init_vfile(), init_vfile_message(), init_errors3(), base2 = "https://html.spec.whatwg.org/multipage/parsing.html#parse-error-", dashToCamelRe = /-[a-z]/g, formatCRe = /%c(?:([-+])(\d+))?/g, formatXRe = /%x/g, fatalities = { 2: true, 1: false, 0: null }, emptyOptions = {};
    } });
    var init_hast_util_from_html = __esm2({ "node_modules/hast-util-from-html/index.js"() {
      init_lib10();
    } });
    function rehypeParse(e2) {
      const { emitParseErrors: t2, ...n3 } = { ...this.data("settings"), ...e2 };
      this.parser = function(e3, r) {
        return function(e4, t3) {
          const n4 = t3 || emptyOptions, r3 = n4.onerror, i = e4 instanceof VFile ? e4 : new VFile(e4), s2 = n4.fragment ? parseFragment : parse3, a = String(i), o = s2(a, { sourceCodeLocationInfo: true, onParseError: n4.onerror ? function(e5) {
            const t4 = e5.code, s3 = function(e6) {
              return e6.replace(dashToCamelRe, dashToCamel);
            }(t4), o2 = n4[s3], l = null == o2 || o2, c = "number" == typeof l ? l : l ? 1 : 0;
            if (c) {
              const n5 = errors2[s3], a2 = new VFileMessage(h3(n5.reason), { place: { start: { line: e5.startLine, column: e5.startCol, offset: e5.startOffset }, end: { line: e5.endLine, column: e5.endCol, offset: e5.endOffset } }, ruleId: t4, source: "hast-util-from-html" });
              i.path && (a2.file = i.path, a2.name = i.path + ":" + a2.name), a2.fatal = fatalities[c], a2.note = h3(n5.description), a2.url = false === n5.url ? void 0 : base2 + t4, r3(a2);
            }
            function h3(t5) {
              return t5.replace(formatCRe, function(t6, n5, r4) {
                const i2 = (r4 ? Number.parseInt(r4, 10) : 0) * ("-" === n5 ? -1 : 1);
                return "`" === (s4 = a.charAt(e5.startOffset + i2)) ? "` ` `" : s4;
                var s4;
              }).replace(formatXRe, function() {
                return "0x" + a.charCodeAt(e5.startOffset).toString(16).toUpperCase();
              });
            }
          } : null, scriptingEnabled: false });
          return function(e5, t4) {
            const n5 = t4 || {};
            return one({ file: n5.file || void 0, location: false, schema: "svg" === n5.space ? svg2 : html22, verbose: n5.verbose || false }, e5);
          }(o, { file: i, space: n4.space, verbose: n4.verbose });
        }(e3, { ...n3, onerror: t2 ? function(e4) {
          r.path && (e4.name = r.path + ":" + e4.name, e4.file = r.path), r.messages.push(e4);
        } : void 0 });
      };
    }
    var htmlVoidElements;
    var own3;
    var defaultSubsetRegex;
    var surrogatePairsRegex;
    var controlCharactersRegex;
    var regexEscapeRegex;
    var subsetToRegexCache;
    var init_lib11 = __esm2({ "node_modules/rehype-parse/lib/index.js"() {
      init_hast_util_from_html();
    } });
    var init_rehype_parse = __esm2({ "node_modules/rehype-parse/index.js"() {
      init_lib11();
    } });
    var init_html_void_elements = __esm2({ "node_modules/html-void-elements/index.js"() {
      htmlVoidElements = ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
    } });
    var init_zwitch = __esm2({ "node_modules/zwitch/index.js"() {
      own3 = {}.hasOwnProperty;
    } });
    var hexadecimalRegex;
    var decimalRegex;
    var characterEntitiesLegacy;
    var characterEntitiesHtml4;
    var dangerous;
    var own4;
    var characters;
    var key4;
    var notAlphanumericRegex;
    var init_core = __esm2({ "node_modules/stringify-entities/lib/core.js"() {
      defaultSubsetRegex = /["&'<>`]/g, surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, controlCharactersRegex = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g, subsetToRegexCache = /* @__PURE__ */ new WeakMap();
    } });
    var init_to_hexadecimal = __esm2({ "node_modules/stringify-entities/lib/util/to-hexadecimal.js"() {
      hexadecimalRegex = /[\dA-Fa-f]/;
    } });
    var init_to_decimal = __esm2({ "node_modules/stringify-entities/lib/util/to-decimal.js"() {
      decimalRegex = /\d/;
    } });
    var init_character_entities_legacy = __esm2({ "node_modules/character-entities-legacy/index.js"() {
      characterEntitiesLegacy = ["AElig", "AMP", "Aacute", "Acirc", "Agrave", "Aring", "Atilde", "Auml", "COPY", "Ccedil", "ETH", "Eacute", "Ecirc", "Egrave", "Euml", "GT", "Iacute", "Icirc", "Igrave", "Iuml", "LT", "Ntilde", "Oacute", "Ocirc", "Ograve", "Oslash", "Otilde", "Ouml", "QUOT", "REG", "THORN", "Uacute", "Ucirc", "Ugrave", "Uuml", "Yacute", "aacute", "acirc", "acute", "aelig", "agrave", "amp", "aring", "atilde", "auml", "brvbar", "ccedil", "cedil", "cent", "copy", "curren", "deg", "divide", "eacute", "ecirc", "egrave", "eth", "euml", "frac12", "frac14", "frac34", "gt", "iacute", "icirc", "iexcl", "igrave", "iquest", "iuml", "laquo", "lt", "macr", "micro", "middot", "nbsp", "not", "ntilde", "oacute", "ocirc", "ograve", "ordf", "ordm", "oslash", "otilde", "ouml", "para", "plusmn", "pound", "quot", "raquo", "reg", "sect", "shy", "sup1", "sup2", "sup3", "szlig", "thorn", "times", "uacute", "ucirc", "ugrave", "uml", "uuml", "yacute", "yen", "yuml"];
    } });
    var init_character_entities_html4 = __esm2({ "node_modules/character-entities-html4/index.js"() {
      characterEntitiesHtml4 = { nbsp: "\xA0", iexcl: "\xA1", cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", brvbar: "\xA6", sect: "\xA7", uml: "\xA8", copy: "\xA9", ordf: "\xAA", laquo: "\xAB", not: "\xAC", shy: "\xAD", reg: "\xAE", macr: "\xAF", deg: "\xB0", plusmn: "\xB1", sup2: "\xB2", sup3: "\xB3", acute: "\xB4", micro: "\xB5", para: "\xB6", middot: "\xB7", cedil: "\xB8", sup1: "\xB9", ordm: "\xBA", raquo: "\xBB", frac14: "\xBC", frac12: "\xBD", frac34: "\xBE", iquest: "\xBF", Agrave: "\xC0", Aacute: "\xC1", Acirc: "\xC2", Atilde: "\xC3", Auml: "\xC4", Aring: "\xC5", AElig: "\xC6", Ccedil: "\xC7", Egrave: "\xC8", Eacute: "\xC9", Ecirc: "\xCA", Euml: "\xCB", Igrave: "\xCC", Iacute: "\xCD", Icirc: "\xCE", Iuml: "\xCF", ETH: "\xD0", Ntilde: "\xD1", Ograve: "\xD2", Oacute: "\xD3", Ocirc: "\xD4", Otilde: "\xD5", Ouml: "\xD6", times: "\xD7", Oslash: "\xD8", Ugrave: "\xD9", Uacute: "\xDA", Ucirc: "\xDB", Uuml: "\xDC", Yacute: "\xDD", THORN: "\xDE", szlig: "\xDF", agrave: "\xE0", aacute: "\xE1", acirc: "\xE2", atilde: "\xE3", auml: "\xE4", aring: "\xE5", aelig: "\xE6", ccedil: "\xE7", egrave: "\xE8", eacute: "\xE9", ecirc: "\xEA", euml: "\xEB", igrave: "\xEC", iacute: "\xED", icirc: "\xEE", iuml: "\xEF", eth: "\xF0", ntilde: "\xF1", ograve: "\xF2", oacute: "\xF3", ocirc: "\xF4", otilde: "\xF5", ouml: "\xF6", divide: "\xF7", oslash: "\xF8", ugrave: "\xF9", uacute: "\xFA", ucirc: "\xFB", uuml: "\xFC", yacute: "\xFD", thorn: "\xFE", yuml: "\xFF", fnof: "\u0192", Alpha: "\u0391", Beta: "\u0392", Gamma: "\u0393", Delta: "\u0394", Epsilon: "\u0395", Zeta: "\u0396", Eta: "\u0397", Theta: "\u0398", Iota: "\u0399", Kappa: "\u039A", Lambda: "\u039B", Mu: "\u039C", Nu: "\u039D", Xi: "\u039E", Omicron: "\u039F", Pi: "\u03A0", Rho: "\u03A1", Sigma: "\u03A3", Tau: "\u03A4", Upsilon: "\u03A5", Phi: "\u03A6", Chi: "\u03A7", Psi: "\u03A8", Omega: "\u03A9", alpha: "\u03B1", beta: "\u03B2", gamma: "\u03B3", delta: "\u03B4", epsilon: "\u03B5", zeta: "\u03B6", eta: "\u03B7", theta: "\u03B8", iota: "\u03B9", kappa: "\u03BA", lambda: "\u03BB", mu: "\u03BC", nu: "\u03BD", xi: "\u03BE", omicron: "\u03BF", pi: "\u03C0", rho: "\u03C1", sigmaf: "\u03C2", sigma: "\u03C3", tau: "\u03C4", upsilon: "\u03C5", phi: "\u03C6", chi: "\u03C7", psi: "\u03C8", omega: "\u03C9", thetasym: "\u03D1", upsih: "\u03D2", piv: "\u03D6", bull: "\u2022", hellip: "\u2026", prime: "\u2032", Prime: "\u2033", oline: "\u203E", frasl: "\u2044", weierp: "\u2118", image: "\u2111", real: "\u211C", trade: "\u2122", alefsym: "\u2135", larr: "\u2190", uarr: "\u2191", rarr: "\u2192", darr: "\u2193", harr: "\u2194", crarr: "\u21B5", lArr: "\u21D0", uArr: "\u21D1", rArr: "\u21D2", dArr: "\u21D3", hArr: "\u21D4", forall: "\u2200", part: "\u2202", exist: "\u2203", empty: "\u2205", nabla: "\u2207", isin: "\u2208", notin: "\u2209", ni: "\u220B", prod: "\u220F", sum: "\u2211", minus: "\u2212", lowast: "\u2217", radic: "\u221A", prop: "\u221D", infin: "\u221E", ang: "\u2220", and: "\u2227", or: "\u2228", cap: "\u2229", cup: "\u222A", int: "\u222B", there4: "\u2234", sim: "\u223C", cong: "\u2245", asymp: "\u2248", ne: "\u2260", equiv: "\u2261", le: "\u2264", ge: "\u2265", sub: "\u2282", sup: "\u2283", nsub: "\u2284", sube: "\u2286", supe: "\u2287", oplus: "\u2295", otimes: "\u2297", perp: "\u22A5", sdot: "\u22C5", lceil: "\u2308", rceil: "\u2309", lfloor: "\u230A", rfloor: "\u230B", lang: "\u2329", rang: "\u232A", loz: "\u25CA", spades: "\u2660", clubs: "\u2663", hearts: "\u2665", diams: "\u2666", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "\u0152", oelig: "\u0153", Scaron: "\u0160", scaron: "\u0161", Yuml: "\u0178", circ: "\u02C6", tilde: "\u02DC", ensp: "\u2002", emsp: "\u2003", thinsp: "\u2009", zwnj: "\u200C", zwj: "\u200D", lrm: "\u200E", rlm: "\u200F", ndash: "\u2013", mdash: "\u2014", lsquo: "\u2018", rsquo: "\u2019", sbquo: "\u201A", ldquo: "\u201C", rdquo: "\u201D", bdquo: "\u201E", dagger: "\u2020", Dagger: "\u2021", permil: "\u2030", lsaquo: "\u2039", rsaquo: "\u203A", euro: "\u20AC" };
    } });
    var init_dangerous = __esm2({ "node_modules/stringify-entities/lib/constant/dangerous.js"() {
      dangerous = ["cent", "copy", "divide", "gt", "lt", "not", "para", "times"];
    } });
    var init_to_named = __esm2({ "node_modules/stringify-entities/lib/util/to-named.js"() {
      for (key4 in init_character_entities_legacy(), init_character_entities_html4(), init_dangerous(), own4 = {}.hasOwnProperty, characters = {}, characterEntitiesHtml4) own4.call(characterEntitiesHtml4, key4) && (characters[characterEntitiesHtml4[key4]] = key4);
      notAlphanumericRegex = /[^\dA-Za-z]/;
    } });
    function formatSmart(e2, t2, n3) {
      let r, i = function(e3, t3, n4) {
        const r3 = "&#x" + e3.toString(16).toUpperCase();
        return n4 && t3 && !hexadecimalRegex.test(String.fromCharCode(t3)) ? r3 : r3 + ";";
      }(e2, t2, n3.omitOptionalSemicolons);
      if ((n3.useNamedReferences || n3.useShortestReferences) && (r = function(e3, t3, n4, r3) {
        const i2 = String.fromCharCode(e3);
        if (own4.call(characters, i2)) {
          const e4 = characters[i2], s2 = "&" + e4;
          return n4 && characterEntitiesLegacy.includes(e4) && !dangerous.includes(e4) && (!r3 || t3 && 61 !== t3 && notAlphanumericRegex.test(String.fromCharCode(t3))) ? s2 : s2 + ";";
        }
        return "";
      }(e2, t2, n3.omitOptionalSemicolons, n3.attribute)), (n3.useShortestReferences || !r) && n3.useShortestReferences) {
        const r3 = function(e3, t3, n4) {
          const r4 = "&#" + String(e3);
          return n4 && t3 && !decimalRegex.test(String.fromCharCode(t3)) ? r4 : r4 + ";";
        }(e2, t2, n3.omitOptionalSemicolons);
        r3.length < i.length && (i = r3);
      }
      return r && (!n3.useShortestReferences || r.length < i.length) ? r : i;
    }
    var init_format_smart = __esm2({ "node_modules/stringify-entities/lib/util/format-smart.js"() {
      init_to_hexadecimal(), init_to_decimal(), init_to_named();
    } });
    function stringifyEntities(e2, t2) {
      return function(e3, t3) {
        return e3 = e3.replace(t3.subset ? function(e4) {
          let t4 = subsetToRegexCache.get(e4);
          return t4 || (t4 = function(e5) {
            const t5 = [];
            let n4 = -1;
            for (; ++n4 < e5.length; ) t5.push(e5[n4].replace(regexEscapeRegex, "\\$&"));
            return new RegExp("(?:" + t5.join("|") + ")", "g");
          }(e4), subsetToRegexCache.set(e4, t4)), t4;
        }(t3.subset) : defaultSubsetRegex, n3), t3.subset || t3.escapeOnly ? e3 : e3.replace(surrogatePairsRegex, function(e4, n4, r) {
          return t3.format(1024 * (e4.charCodeAt(0) - 55296) + e4.charCodeAt(1) - 56320 + 65536, r.charCodeAt(n4 + 2), t3);
        }).replace(controlCharactersRegex, n3);
        function n3(e4, n4, r) {
          return t3.format(e4.charCodeAt(0), r.charCodeAt(n4 + 1), t3);
        }
      }(e2, Object.assign({ format: formatSmart }, t2));
    }
    var htmlCommentRegex;
    var bogusCommentEntitySubset;
    var commentEntitySubset;
    var init_lib12 = __esm2({ "node_modules/stringify-entities/lib/index.js"() {
      init_core(), init_format_smart();
    } });
    var init_stringify_entities = __esm2({ "node_modules/stringify-entities/index.js"() {
      init_lib12();
    } });
    function comment2(e2, t2, n3, r) {
      return r.settings.bogusComments ? "<?" + stringifyEntities(e2.value, Object.assign({}, r.settings.characterReferences, { subset: bogusCommentEntitySubset })) + ">" : "<!--" + e2.value.replace(htmlCommentRegex, function(e3) {
        return stringifyEntities(e3, Object.assign({}, r.settings.characterReferences, { subset: commentEntitySubset }));
      }) + "-->";
    }
    var init_comment = __esm2({ "node_modules/hast-util-to-html/lib/handle/comment.js"() {
      init_stringify_entities(), htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g, bogusCommentEntitySubset = [">"], commentEntitySubset = ["<", ">"];
    } });
    function doctype(e2, t2, n3, r) {
      return "<!" + (r.settings.upperDoctype ? "DOCTYPE" : "doctype") + (r.settings.tightDoctype ? "" : " ") + "html>";
    }
    var init_doctype2 = __esm2({ "node_modules/hast-util-to-html/lib/handle/doctype.js"() {
    } });
    function ccount(e2, t2) {
      const n3 = String(e2);
      if ("string" != typeof t2) throw new TypeError("Expected character");
      let r = 0, i = n3.indexOf(t2);
      for (; -1 !== i; ) r++, i = n3.indexOf(t2, i + t2.length);
      return r;
    }
    var re;
    var init_ccount = __esm2({ "node_modules/ccount/index.js"() {
    } });
    function whitespace2(e2) {
      return "object" == typeof e2 ? "text" === e2.type && empty(e2.value) : empty(e2);
    }
    function empty(e2) {
      return "" === e2.replace(re, "");
    }
    var siblingAfter;
    var siblingBefore;
    var emptyChildren;
    var init_lib13 = __esm2({ "node_modules/hast-util-whitespace/lib/index.js"() {
      re = /[ \t\n\f\r]/g;
    } });
    var init_hast_util_whitespace = __esm2({ "node_modules/hast-util-whitespace/index.js"() {
      init_lib13();
    } });
    function siblings(e2) {
      return function(t2, n3, r) {
        const i = t2 ? t2.children : emptyChildren;
        let s2 = (n3 || 0) + e2, a = i[s2];
        if (!r) for (; a && whitespace2(a); ) s2 += e2, a = i[s2];
        return a;
      };
    }
    var own5;
    var init_siblings = __esm2({ "node_modules/hast-util-to-html/lib/omission/util/siblings.js"() {
      init_hast_util_whitespace(), siblingAfter = siblings(1), siblingBefore = siblings(-1), emptyChildren = [];
    } });
    function omission(e2) {
      return function(t2, n3, r) {
        return own5.call(e2, t2.tagName) && e2[t2.tagName](t2, n3, r);
      };
    }
    var closing;
    var init_omission = __esm2({ "node_modules/hast-util-to-html/lib/omission/omission.js"() {
      own5 = {}.hasOwnProperty;
    } });
    function headOrColgroupOrCaption(e2, t2, n3) {
      const r = siblingAfter(n3, t2, true);
      return !r || "comment" !== r.type && !("text" === r.type && whitespace2(r.value.charAt(0)));
    }
    function html3(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "comment" !== r.type;
    }
    function body(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "comment" !== r.type;
    }
    function p(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return r ? "element" === r.type && ("address" === r.tagName || "article" === r.tagName || "aside" === r.tagName || "blockquote" === r.tagName || "details" === r.tagName || "div" === r.tagName || "dl" === r.tagName || "fieldset" === r.tagName || "figcaption" === r.tagName || "figure" === r.tagName || "footer" === r.tagName || "form" === r.tagName || "h1" === r.tagName || "h2" === r.tagName || "h3" === r.tagName || "h4" === r.tagName || "h5" === r.tagName || "h6" === r.tagName || "header" === r.tagName || "hgroup" === r.tagName || "hr" === r.tagName || "main" === r.tagName || "menu" === r.tagName || "nav" === r.tagName || "ol" === r.tagName || "p" === r.tagName || "pre" === r.tagName || "section" === r.tagName || "table" === r.tagName || "ul" === r.tagName) : !n3 || !("element" === n3.type && ("a" === n3.tagName || "audio" === n3.tagName || "del" === n3.tagName || "ins" === n3.tagName || "map" === n3.tagName || "noscript" === n3.tagName || "video" === n3.tagName));
    }
    function li(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && "li" === r.tagName;
    }
    function dt(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return Boolean(r && "element" === r.type && ("dt" === r.tagName || "dd" === r.tagName));
    }
    function dd(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && ("dt" === r.tagName || "dd" === r.tagName);
    }
    function rubyElement(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && ("rp" === r.tagName || "rt" === r.tagName);
    }
    function optgroup(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && "optgroup" === r.tagName;
    }
    function option(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && ("option" === r.tagName || "optgroup" === r.tagName);
    }
    function thead(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return Boolean(r && "element" === r.type && ("tbody" === r.tagName || "tfoot" === r.tagName));
    }
    function tbody(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && ("tbody" === r.tagName || "tfoot" === r.tagName);
    }
    function tfoot(e2, t2, n3) {
      return !siblingAfter(n3, t2);
    }
    function tr(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && "tr" === r.tagName;
    }
    function cells(e2, t2, n3) {
      const r = siblingAfter(n3, t2);
      return !r || "element" === r.type && ("td" === r.tagName || "th" === r.tagName);
    }
    var opening;
    var init_closing = __esm2({ "node_modules/hast-util-to-html/lib/omission/closing.js"() {
      init_hast_util_whitespace(), init_siblings(), init_omission(), closing = omission({ body, caption: headOrColgroupOrCaption, colgroup: headOrColgroupOrCaption, dd, dt, head: headOrColgroupOrCaption, html: html3, li, optgroup, option, p, rp: rubyElement, rt: rubyElement, tbody, td: cells, tfoot, th: cells, thead, tr });
    } });
    function html4(e2) {
      const t2 = siblingAfter(e2, -1);
      return !t2 || "comment" !== t2.type;
    }
    function head2(e2) {
      const t2 = /* @__PURE__ */ new Set();
      for (const n4 of e2.children) if ("element" === n4.type && ("base" === n4.tagName || "title" === n4.tagName)) {
        if (t2.has(n4.tagName)) return false;
        t2.add(n4.tagName);
      }
      const n3 = e2.children[0];
      return !n3 || "element" === n3.type;
    }
    function body2(e2) {
      const t2 = siblingAfter(e2, -1, true);
      return !(t2 && ("comment" === t2.type || "text" === t2.type && whitespace2(t2.value.charAt(0)) || "element" === t2.type && ("meta" === t2.tagName || "link" === t2.tagName || "script" === t2.tagName || "style" === t2.tagName || "template" === t2.tagName)));
    }
    function colgroup(e2, t2, n3) {
      const r = siblingBefore(n3, t2), i = siblingAfter(e2, -1, true);
      return !(n3 && r && "element" === r.type && "colgroup" === r.tagName && closing(r, n3.children.indexOf(r), n3)) && Boolean(i && "element" === i.type && "col" === i.tagName);
    }
    function tbody2(e2, t2, n3) {
      const r = siblingBefore(n3, t2), i = siblingAfter(e2, -1);
      return (!n3 || !r || "element" !== r.type || "thead" !== r.tagName && "tbody" !== r.tagName || !closing(r, n3.children.indexOf(r), n3)) && Boolean(i && "element" === i.type && "tr" === i.tagName);
    }
    var constants;
    var init_opening = __esm2({ "node_modules/hast-util-to-html/lib/omission/opening.js"() {
      init_hast_util_whitespace(), init_siblings(), init_closing(), init_omission(), opening = omission({ body: body2, colgroup, head: head2, html: html4, tbody: tbody2 });
    } });
    function element2(e2, t2, n3, r) {
      const i = r.schema, s2 = "svg" !== i.space && r.settings.omitOptionalTags;
      let a = "svg" === i.space ? r.settings.closeEmptyElements : r.settings.voids.includes(e2.tagName.toLowerCase());
      const o = [];
      let l;
      "html" === i.space && "svg" === e2.tagName && (r.schema = svg2);
      const c = function(e3, t3) {
        const n4 = [];
        let r3, i2 = -1;
        if (t3) {
          for (r3 in t3) if (null !== t3[r3] && void 0 !== t3[r3]) {
            const i3 = serializeAttribute(e3, r3, t3[r3]);
            i3 && n4.push(i3);
          }
        }
        for (; ++i2 < n4.length; ) {
          const t4 = e3.settings.tightAttributes ? n4[i2].charAt(n4[i2].length - 1) : void 0;
          i2 !== n4.length - 1 && '"' !== t4 && "'" !== t4 && (n4[i2] += " ");
        }
        return n4.join("");
      }(r, e2.properties), h3 = r.all("html" === i.space && "template" === e2.tagName ? e2.content : e2);
      return r.schema = i, h3 && (a = false), !c && s2 && opening(e2, t2, n3) || (o.push("<", e2.tagName, c ? " " + c : ""), a && ("svg" === i.space || r.settings.closeSelfClosing) && (l = c.charAt(c.length - 1), (!r.settings.tightSelfClosing || "/" === l || l && '"' !== l && "'" !== l) && o.push(" "), o.push("/")), o.push(">")), o.push(h3), a || s2 && closing(e2, t2, n3) || o.push("</" + e2.tagName + ">"), o.join("");
    }
    function serializeAttribute(e2, t2, n3) {
      const r = find2(e2.schema, t2), i = e2.settings.allowParseErrors && "html" === e2.schema.space ? 0 : 1, s2 = e2.settings.allowDangerousCharacters ? 0 : 1;
      let a, o = e2.quote;
      if (!r.overloadedBoolean || n3 !== r.attribute && "" !== n3 ? !r.boolean && !r.overloadedBoolean || "string" == typeof n3 && n3 !== r.attribute && "" !== n3 || (n3 = Boolean(n3)) : n3 = true, null == n3 || false === n3 || "number" == typeof n3 && Number.isNaN(n3)) return "";
      const l = stringifyEntities(r.attribute, Object.assign({}, e2.settings.characterReferences, { subset: constants.name[i][s2] }));
      return true === n3 ? l : (n3 = Array.isArray(n3) ? (r.commaSeparated ? stringify3 : stringify22)(n3, { padLeft: !e2.settings.tightCommaSeparatedLists }) : String(n3), e2.settings.collapseEmptyAttributes && !n3 ? l : (e2.settings.preferUnquoted && (a = stringifyEntities(n3, Object.assign({}, e2.settings.characterReferences, { attribute: true, subset: constants.unquoted[i][s2] }))), a !== n3 && (e2.settings.quoteSmart && ccount(n3, o) > ccount(n3, e2.alternative) && (o = e2.alternative), a = o + stringifyEntities(n3, Object.assign({}, e2.settings.characterReferences, { subset: ("'" === o ? constants.single : constants.double)[i][s2], attribute: true })) + o), l + (a ? "=" + a : a)));
    }
    var textEntitySubset;
    var init_element = __esm2({ "node_modules/hast-util-to-html/lib/handle/element.js"() {
      init_ccount(), init_comma_separated_tokens(), init_property_information(), init_space_separated_tokens(), init_stringify_entities(), init_closing(), init_opening(), constants = { name: [["	\n\f\r &/=>".split(""), "	\n\f\r \"&'/=>`".split("")], [`\0	
\f\r "&'/<=>`.split(""), "\0	\n\f\r \"&'/<=>`".split("")]], unquoted: [["	\n\f\r &>".split(""), "\0	\n\f\r \"&'<=>`".split("")], ["\0	\n\f\r \"&'<=>`".split(""), "\0	\n\f\r \"&'<=>`".split("")]], single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]], double: [['"&'.split(""), "\"&'`".split("")], ['\0"&'.split(""), "\0\"&'`".split("")]] };
    } });
    function text3(e2, t2, n3, r) {
      return !n3 || "element" !== n3.type || "script" !== n3.tagName && "style" !== n3.tagName ? stringifyEntities(e2.value, Object.assign({}, r.settings.characterReferences, { subset: textEntitySubset })) : e2.value;
    }
    var init_text2 = __esm2({ "node_modules/hast-util-to-html/lib/handle/text.js"() {
      init_stringify_entities(), textEntitySubset = ["<", "&"];
    } });
    function raw(e2, t2, n3, r) {
      return r.settings.allowDangerousHtml ? e2.value : text3(e2, 0, n3, r);
    }
    var init_raw = __esm2({ "node_modules/hast-util-to-html/lib/handle/raw.js"() {
      init_text2();
    } });
    function root5(e2, t2, n3, r) {
      return r.all(e2);
    }
    var handle;
    var init_root3 = __esm2({ "node_modules/hast-util-to-html/lib/handle/root.js"() {
    } });
    function invalid(e2) {
      throw new Error("Expected node, not `" + e2 + "`");
    }
    function unknown(e2) {
      throw new Error("Cannot compile unknown node `" + e2.type + "`");
    }
    var emptyOptions2;
    var emptyCharacterReferences;
    var emptyChildren2;
    var init_handle = __esm2({ "node_modules/hast-util-to-html/lib/handle/index.js"() {
      init_zwitch(), init_comment(), init_doctype2(), init_element(), init_raw(), init_root3(), init_text2(), handle = function(e2) {
        const t2 = { invalid, unknown, handlers: { comment: comment2, doctype, element: element2, raw, root: root5, text: text3 } };
        function n3(t3, ...r) {
          let i = n3.invalid;
          const s2 = n3.handlers;
          if (t3 && own3.call(t3, e2)) {
            const r3 = String(t3[e2]);
            i = own3.call(s2, r3) ? s2[r3] : n3.unknown;
          }
          if (i) return i.call(this, t3, ...r);
        }
        return n3.handlers = t2.handlers || {}, n3.invalid = t2.invalid, n3.unknown = t2.unknown, n3;
      }("type");
    } });
    function one2(e2, t2, n3) {
      return handle(e2, t2, n3, this);
    }
    function all2(e2) {
      const t2 = [], n3 = e2 && e2.children || emptyChildren2;
      let r = -1;
      for (; ++r < n3.length; ) t2[r] = this.one(n3[r], r, e2);
      return t2.join("");
    }
    var init_lib14 = __esm2({ "node_modules/hast-util-to-html/lib/index.js"() {
      init_html_void_elements(), init_property_information(), init_handle(), emptyOptions2 = {}, emptyCharacterReferences = {}, emptyChildren2 = [];
    } });
    var init_hast_util_to_html = __esm2({ "node_modules/hast-util-to-html/index.js"() {
      init_lib14();
    } });
    function rehypeStringify(e2) {
      const t2 = { ...this.data("settings"), ...e2 };
      this.compiler = function(e3) {
        return function(e4, t3) {
          const n3 = t3 || emptyOptions2, r = n3.quote || '"', i = '"' === r ? "'" : '"';
          if ('"' !== r && "'" !== r) throw new Error("Invalid quote `" + r + "`, expected `'` or `\"`");
          return { one: one2, all: all2, settings: { omitOptionalTags: n3.omitOptionalTags || false, allowParseErrors: n3.allowParseErrors || false, allowDangerousCharacters: n3.allowDangerousCharacters || false, quoteSmart: n3.quoteSmart || false, preferUnquoted: n3.preferUnquoted || false, tightAttributes: n3.tightAttributes || false, upperDoctype: n3.upperDoctype || false, tightDoctype: n3.tightDoctype || false, bogusComments: n3.bogusComments || false, tightCommaSeparatedLists: n3.tightCommaSeparatedLists || false, tightSelfClosing: n3.tightSelfClosing || false, collapseEmptyAttributes: n3.collapseEmptyAttributes || false, allowDangerousHtml: n3.allowDangerousHtml || false, voids: n3.voids || htmlVoidElements, characterReferences: n3.characterReferences || emptyCharacterReferences, closeSelfClosing: n3.closeSelfClosing || false, closeEmptyElements: n3.closeEmptyElements || false }, schema: "svg" === n3.space ? svg2 : html22, quote: r, alternative: i }.one(Array.isArray(e4) ? { type: "root", children: e4 } : e4, void 0, void 0);
        }(e3, t2);
      };
    }
    var convert;
    var init_lib15 = __esm2({ "node_modules/rehype-stringify/lib/index.js"() {
      init_hast_util_to_html();
    } });
    var init_rehype_stringify = __esm2({ "node_modules/rehype-stringify/index.js"() {
      init_lib15();
    } });
    function castFactory(e2) {
      return function(t2, n3, r) {
        return Boolean(function(e3) {
          return null !== e3 && "object" == typeof e3 && "type" in e3;
        }(t2) && e2.call(this, t2, "number" == typeof n3 ? n3 : void 0, r || void 0));
      };
    }
    function ok2() {
      return true;
    }
    var empty2;
    var CONTINUE;
    var EXIT;
    var SKIP;
    var init_lib16 = __esm2({ "node_modules/unist-util-is/lib/index.js"() {
      convert = function(e2) {
        if (null == e2) return ok2;
        if ("function" == typeof e2) return castFactory(e2);
        if ("object" == typeof e2) return Array.isArray(e2) ? function(e3) {
          const t3 = [];
          let n3 = -1;
          for (; ++n3 < e3.length; ) t3[n3] = convert(e3[n3]);
          return castFactory(function(...e4) {
            let n4 = -1;
            for (; ++n4 < t3.length; ) if (t3[n4].apply(this, e4)) return true;
            return false;
          });
        }(e2) : function(e3) {
          const t3 = e3;
          return castFactory(function(n3) {
            const r = n3;
            let i;
            for (i in e3) if (r[i] !== t3[i]) return false;
            return true;
          });
        }(e2);
        if ("string" == typeof e2) return t2 = e2, castFactory(function(e3) {
          return e3 && e3.type === t2;
        });
        var t2;
        throw new Error("Expected function, string, or object as test");
      };
    } });
    var init_unist_util_is = __esm2({ "node_modules/unist-util-is/index.js"() {
      init_lib16();
    } });
    var init_color_node = __esm2({ "node_modules/unist-util-visit-parents/lib/color.node.js"() {
    } });
    var ABSOLUTE_URL_REGEX;
    var WINDOWS_PATH_REGEX;
    var HTTP_PROTOCOLS_REGEX;
    var init_lib17 = __esm2({ "node_modules/unist-util-visit-parents/lib/index.js"() {
      init_unist_util_is(), init_color_node(), empty2 = [], CONTINUE = true, EXIT = false, SKIP = "skip";
    } });
    var init_unist_util_visit_parents = __esm2({ "node_modules/unist-util-visit-parents/index.js"() {
      init_lib17();
    } });
    var init_lib18 = __esm2({ "node_modules/unist-util-visit/lib/index.js"() {
      init_unist_util_visit_parents();
    } });
    var init_unist_util_visit = __esm2({ "node_modules/unist-util-visit/index.js"() {
      init_lib18();
    } });
    function isAbsoluteUrl(e2, t2 = {}) {
      if ("string" != typeof e2) throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
      if (WINDOWS_PATH_REGEX.test(e2)) return false;
      if (!ABSOLUTE_URL_REGEX.test(e2)) return false;
      const { httpOnly: n3 = true } = t2;
      return !n3 || HTTP_PROTOCOLS_REGEX.test(e2);
    }
    var import_path13;
    var log42;
    var defaultOptions;
    var HtmlLinkProcessor;
    var log43;
    var pageFilter;
    var init_is_absolute_url = __esm2({ "node_modules/is-absolute-url/index.js"() {
      ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/, WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\/, HTTP_PROTOCOLS_REGEX = /^https?:/i;
    } });
    var init_html_link_processor = __esm2({ "internal/domain/site/service/html-link-processor.ts"() {
      init_unified(), init_rehype_parse(), init_rehype_stringify(), init_unist_util_visit(), init_is_absolute_url(), import_path13 = __toESM3(require("path")), init_path3(), init_log(), log42 = getDomainLogger("site", { component: "HtmlLinkProcessor" }), defaultOptions = { markdownLinkResolution: "shortest", prettyLinks: true, openLinksInNewTab: false, lazyLoad: false, externalLinkIcon: true }, HtmlLinkProcessor = class {
        constructor(e2, t2 = {}) {
          __publicField(this, "options");
          this.graph = e2, this.options = { ...defaultOptions, ...t2 };
        }
        async processLinks(e2, t2) {
          if (!t2 || "string" != typeof t2) return log42.error("[HtmlLinkProcessor] Invalid HTML input: " + typeof t2), { html: t2 || "", outgoingLinks: [] };
          const n3 = this.options, r = simplifySlug(e2), i = /* @__PURE__ */ new Set(), s2 = unified().use(rehypeParse, { fragment: true }).use(() => (t3) => {
            !function(e3, t4, n4) {
              let r3, i2, s3;
              i2 = t4, s3 = n4, r3 = void 0, function(e4, t5, n5, r4) {
                let i3;
                "function" == typeof t5 && "function" != typeof n5 ? (r4 = n5, n5 = t5) : i3 = t5;
                const s4 = convert(i3), a2 = r4 ? -1 : 1;
                !function e5(i4, o, l) {
                  const c = i4 && "object" == typeof i4 ? i4 : {};
                  if ("string" == typeof c.type) {
                    const e6 = "string" == typeof c.tagName ? c.tagName : "string" == typeof c.name ? c.name : void 0;
                    Object.defineProperty(u, "name", { value: "node (" + (h3 = i4.type + (e6 ? "<" + e6 + ">" : ""), "\x1B[33m" + h3 + "\x1B[39m)") });
                  }
                  var h3;
                  return u;
                  function u() {
                    let c3, h4, u2, d = empty2;
                    if ((!t5 || s4(i4, o, l[l.length - 1] || void 0)) && (d = function(e6) {
                      return Array.isArray(e6) ? e6 : "number" == typeof e6 ? [CONTINUE, e6] : null == e6 ? empty2 : [e6];
                    }(n5(i4, l)), d[0] === EXIT)) return d;
                    if ("children" in i4 && i4.children) {
                      const t6 = i4;
                      if (t6.children && d[0] !== SKIP) for (h4 = (r4 ? t6.children.length : -1) + a2, u2 = l.concat(t6); h4 > -1 && h4 < t6.children.length; ) {
                        const n6 = t6.children[h4];
                        if (c3 = e5(n6, h4, u2)(), c3[0] === EXIT) return c3;
                        h4 = "number" == typeof c3[1] ? c3[1] : h4 + a2;
                      }
                    }
                    return d;
                  }
                }(e4, void 0, [])();
              }(e3, i2, function(e4, t5) {
                const n5 = t5[t5.length - 1], r4 = n5 ? n5.children.indexOf(e4) : void 0;
                return s3(e4, r4, n5);
              }, r3);
            }(t3, "element", (t4) => {
              var _a6;
              if ("a" === t4.tagName && t4.properties) {
                const s3 = t4.properties.dataWikilink || t4.properties.dataSlug, a2 = "string" == typeof t4.properties.href;
                if (!a2 && !s3) return;
                let o;
                o = !a2 && s3 ? t4.properties.dataWikilink || t4.properties.dataSlug : t4.properties.href;
                const l = (_a6 = t4.properties.className) != null ? _a6 : [], c = isAbsoluteUrl(o, { httpOnly: false });
                l.includes("external") || l.includes("internal") || l.push(c ? "external" : "internal"), c && n3.externalLinkIcon && t4.children.push({ type: "element", tagName: "svg", properties: { "aria-hidden": "true", class: "external-icon", style: "max-width:0.8em;max-height:0.8em", viewBox: "0 0 512 512" }, children: [{ type: "element", tagName: "path", properties: { d: "M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z" }, children: [] }] }), 1 === t4.children.length && "text" === t4.children[0].type && t4.children[0].value !== o && l.push("alias"), t4.properties.className = l, c && n3.openLinksInNewTab && (t4.properties.target = "_blank");
                const h3 = !(isAbsoluteUrl(o, { httpOnly: false }) || o.startsWith("#"));
                if (h3) {
                  const s4 = transformLink(e2, o, { strategy: n3.markdownLinkResolution, allSlugs: this.graph.getAllSlugs() }), a3 = new URL(s4, "https://base.com/" + stripSlashes2(r, true)).pathname;
                  let [l2, c3] = splitAnchor2(a3);
                  l2.endsWith("/") && (l2 += "index");
                  const h4 = decodeURIComponent(stripSlashes2(l2, true)), u = simplifySlug(h4);
                  i.add(u);
                  let d = s4;
                  if (d.startsWith("./") && (d = d.slice(2)), d.startsWith("../")) {
                    const t5 = (d.match(/\.\.\//g) || []).length, n4 = e2.split("/").filter((e3) => e3).slice(0, -1), r3 = d.replace(/\.\.\//g, ""), i2 = n4.slice(0, n4.length - t5);
                    r3 && i2.push(r3), d = i2.join("/");
                  }
                  d = n3.baseURL ? `${n3.baseURL}/${d}` : `/${d}`;
                  const [p2, g] = splitAnchor2(d);
                  let m2 = p2;
                  m2.endsWith(".html") || m2.endsWith("/") || (m2 += ".html"), d = m2 + g, o = t4.properties.href = d, t4.properties["data-slug"] = h4;
                }
                n3.prettyLinks && h3 && 1 === t4.children.length && "text" === t4.children[0].type && !t4.children[0].value.startsWith("#") && (t4.children[0].value = import_path13.default.basename(t4.children[0].value));
              }
              if (["img", "video", "audio", "iframe"].includes(t4.tagName) && t4.properties && "string" == typeof t4.properties.src && (n3.lazyLoad && (t4.properties.loading = "lazy"), !isAbsoluteUrl(t4.properties.src, { httpOnly: false }))) {
                let r3 = t4.properties.src;
                r3 = t4.properties.src = transformLink(e2, r3, { strategy: n3.markdownLinkResolution, allSlugs: this.graph.getAllSlugs() }), t4.properties.src = r3;
              }
            });
          }).use(rehypeStringify), a = await s2.process(t2);
          return { html: String(a), outgoingLinks: Array.from(i) };
        }
      };
    } });
    function shouldProcessPage(e2, t2) {
      return pageFilter.shouldProcess(e2, t2);
    }
    var log44;
    var Site3;
    var import_path15;
    var Publisher;
    var MultiWriter;
    var init_page_filter = __esm2({ "pkg/page-filter/index.ts"() {
      init_log(), log43 = getDomainLogger("pkg", { component: "page-filter" }), pageFilter = new class {
        constructor() {
          __publicField(this, "filterSet", null);
          __publicField(this, "currentLanguage", null);
        }
        setFilter(e2) {
          this.filterSet = /* @__PURE__ */ new Set();
          for (const t2 of e2) {
            const e3 = `${t2.language}:${t2.pagePath}`;
            this.filterSet.add(e3);
          }
          log43.debug(`Page filter set: ${e2.length} tasks`);
        }
        setCurrentLanguage(e2) {
          this.currentLanguage = e2;
        }
        clearFilter() {
          this.filterSet = null, this.currentLanguage = null, log43.debug("Page filter cleared");
        }
        shouldProcess(e2, t2) {
          if (!this.filterSet) return true;
          const n3 = `${e2}:${t2}`;
          return this.filterSet.has(n3);
        }
        getFilterSize() {
          var _a6, _b4;
          return (_b4 = (_a6 = this.filterSet) == null ? void 0 : _a6.size) != null ? _b4 : 0;
        }
      }();
    } });
    var init_site2 = __esm2({ "internal/domain/site/entity/site.ts"() {
      init_page2(), init_url(), init_log(), init_taxonomies_builder(), init_menu(), init_pagegraph(), init_html_link_processor(), init_page_filter(), log44 = getDomainLogger("site", { component: "site" }), Site3 = class {
        constructor(e2, t2, n3, r, i, s2, a, o, l, c, h3, u, d, p2, g) {
          __publicField(this, "configSvc");
          __publicField(this, "contentSvc");
          __publicField(this, "translationSvc");
          __publicField(this, "languageSvc");
          __publicField(this, "sitemap");
          __publicField(this, "staticCopySvc");
          __publicField(this, "publisher");
          __publicField(this, "template", null);
          __publicField(this, "author");
          __publicField(this, "organization");
          __publicField(this, "compiler");
          __publicField(this, "url");
          __publicField(this, "ref", null);
          __publicField(this, "language");
          __publicField(this, "navigation", null);
          __publicField(this, "title");
          __publicField(this, "home", null);
          __publicField(this, "pageGraph", null);
          __publicField(this, "backlinksCache", null);
          this.configSvc = e2, this.contentSvc = t2, this.translationSvc = n3, this.languageSvc = r, this.sitemap = i, this.staticCopySvc = s2, this.publisher = a, this.author = o, this.organization = l, this.compiler = c, this.url = h3, this.ref = u, this.language = d, this.navigation = p2, this.title = g;
        }
        get Title() {
          return this.title;
        }
        get Description() {
          var _a6;
          return ((_a6 = this.home) == null ? void 0 : _a6.description()) || "";
        }
        get Compiler() {
          return this.compiler;
        }
        get IsGoogleAnalyticsEnabled() {
          return this.configSvc.isGoogleAnalyticsEnabled();
        }
        get GoogleAnalyticsID() {
          return this.configSvc.googleAnalyticsID();
        }
        get IsGoogleAnalyticsRespectDoNotTrack() {
          return this.configSvc.isGoogleAnalyticsRespectDoNotTrack();
        }
        get IsDisqusEnabled() {
          return this.configSvc.isDisqusEnabled();
        }
        get DisqusShortname() {
          return this.configSvc.disqusShortname();
        }
        get IsXRespectDoNotTrack() {
          return this.configSvc.isXRespectDoNotTrack();
        }
        get IsXDisableInlineCSS() {
          return this.configSvc.isXDisableInlineCSS();
        }
        get ConfiguredSocialPlatforms() {
          return this.configSvc.getConfiguredSocialPlatforms();
        }
        GetSocialLink(e2) {
          return this.configSvc.getSocialLink(e2);
        }
        GetSocialTitle(e2) {
          return this.configSvc.getSocialTitle(e2);
        }
        async Pages() {
          const e2 = this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()), t2 = await this.contentSvc.globalPages(e2);
          return this.sitePages(t2);
        }
        async RegularPages() {
          const e2 = await this.contentSvc.globalRegularPages();
          return this.sitePages(e2);
        }
        async build(e2) {
          try {
            this.template = e2, await this.setup(), await this.copyStaticFiles();
            const t2 = this.languageSvc.languageKeys();
            for (const e3 of t2) this.language.setCurrentLanguage(e3), await this.generateNavigations(), await this.render();
          } catch (e3) {
            const t2 = e3 instanceof Error ? e3.message : String(e3);
            throw log44.error(`\u274C Site build failed: ${t2}`), e3;
          }
        }
        async renderAllLanguages() {
          const e2 = this.languageSvc.languageKeys();
          for (const t2 of e2) this.language.setCurrentLanguage(t2), await this.generateNavigations(), await this.render();
        }
        async buildWithProgress(e2, t2) {
          try {
            this.template = e2, await this.setup(), await this.copyStaticFiles();
            const n3 = this.languageSvc.languageKeys();
            for (const e3 of n3) this.language.setCurrentLanguage(e3), await this.generateNavigations(), await this.renderWithProgress(t2);
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            throw log44.error(`\u274C Site build failed: ${t3}`), e3;
          }
        }
        async setup() {
          try {
            await this.buildPageGraph();
          } catch (e2) {
            const t2 = e2 instanceof Error ? e2.message : String(e2);
            throw log44.error(`\u274C Setup failed: ${t2}`), e2;
          }
        }
        async render() {
          try {
            await this.renderPages();
          } catch (e2) {
            throw e2;
          }
        }
        async renderWithProgress(e2) {
          try {
            await this.renderPagesWithProgress(e2);
          } catch (e3) {
            throw e3;
          }
        }
        async renderPages() {
          const e2 = this.language.getCurrentLanguage(), t2 = this.languageSvc.getLanguageIndex(e2), n3 = [];
          await this.contentSvc.walkPages(t2, async (e3) => {
            const t3 = await this.sitePage(e3);
            n3.push(t3);
            const r3 = await this.contentSvc.getPageSources(e3);
            await t3.processResources(r3), e3.isHome() && (this.home = t3);
          }), log44.info(`\u{1F4CA} Processing wikilinks for ${n3.length} pages...`);
          for (const e3 of n3) try {
            await e3.WikilinkContent();
          } catch (t3) {
            const n4 = t3 instanceof Error ? t3.message : String(t3);
            log44.warn(`\u26A0\uFE0F  Failed to process wikilinks for ${e3.slug()}: ${n4}`);
          }
          log44.info("\u2705 Wikilink processing complete");
          const r = n3.filter((t3) => {
            const n4 = t3.file().paths().base();
            return !!shouldProcessPage(e2, n4) && t3.isStale();
          }), i = r.filter((e3) => e3.isHome()), s2 = r.filter((e3) => !e3.isHome());
          log44.info(`\u{1F4C4} Rendering ${i.length} home page(s) first...`);
          for (const e3 of i) await e3.render(), e3.clearStale();
          log44.info(`\u2705 Home page(s) rendered, now rendering ${s2.length} other pages in parallel...`);
          for (let e3 = 0; e3 < s2.length; e3 += 10) {
            const t3 = s2.slice(e3, e3 + 10);
            await Promise.all(t3.map(async (e4) => {
              try {
                await e4.render(), e4.clearStale();
              } catch (t4) {
                const n4 = t4 instanceof Error ? t4.message : String(t4);
                log44.error(`\u274C Failed to render page ${e4.slug()}: ${n4}`);
              }
            }));
          }
        }
        async renderPagesWithProgress(e2) {
          const t2 = this.language.getCurrentLanguage(), n3 = this.languageSvc.getLanguageIndex(t2), r = [];
          await this.contentSvc.walkPages(n3, async (e3) => {
            const t3 = await this.sitePage(e3);
            r.push(t3);
            const n4 = await this.contentSvc.getPageSources(e3);
            await t3.processResources(n4), e3.isHome() && (this.home = t3);
          }), log44.info(`\u{1F4CA} Processing wikilinks for ${r.length} pages...`);
          for (const e3 of r) try {
            await e3.WikilinkContent();
          } catch (t3) {
            const n4 = t3 instanceof Error ? t3.message : String(t3);
            log44.warn(`\u26A0\uFE0F  Failed to process wikilinks for ${e3.slug()}: ${n4}`);
          }
          log44.info("\u2705 Wikilink processing complete");
          const i = r.filter((e3) => {
            const n4 = e3.file().paths().base();
            return !!shouldProcessPage(t2, n4) && e3.isStale();
          }), s2 = i.filter((e3) => e3.isHome()), a = i.filter((e3) => !e3.isHome()), o = r.length;
          let l = 0;
          log44.info(`\u{1F4C4} Rendering ${s2.length} home page(s) first...`);
          for (const t3 of s2) await t3.render(), l++, e2 == null ? void 0 : e2({ currentPage: l, totalPages: o });
          log44.info(`\u2705 Home page(s) rendered, now rendering ${a.length} other pages in parallel...`);
          for (let t3 = 0; t3 < a.length; t3 += 10) {
            const n4 = a.slice(t3, t3 + 10);
            await Promise.all(n4.map(async (e3) => {
              try {
                await e3.render();
              } catch (t4) {
                const n5 = t4 instanceof Error ? t4.message : String(t4);
                log44.error(`\u274C Failed to render page ${e3.slug()}: ${n5}`);
              }
            })), l += n4.length, e2 == null ? void 0 : e2({ currentPage: l, totalPages: o });
          }
          log44.info("\u2705 All pages rendered successfully");
        }
        async pageOutput(e2) {
          return e2.output();
        }
        clearSiteCache() {
        }
        translate(e2) {
          return this.translationSvc.translate(this.language.getCurrentLanguage(), e2);
        }
        get Home() {
          return this.home;
        }
        get Params() {
          return this.configSvc.configParams();
        }
        get Taxonomies() {
          return this.navigation && this.navigation.getTaxonomies(this.language.getCurrentLanguage()) || new TaxonomyList();
        }
        get Menus() {
          return this.navigation ? this.navigation.getMenus(this.language.getCurrentLanguage()) : new Menus();
        }
        getTitle() {
          return this.title;
        }
        setTitle(e2) {
          this.title = e2;
        }
        getConfigService() {
          return this.configSvc;
        }
        getContentService() {
          return this.contentSvc;
        }
        getLanguageService() {
          return this.languageSvc;
        }
        baseURL() {
          return this.url.base;
        }
        get BaseURL() {
          return this.baseURL();
        }
        getURL() {
          return this.url;
        }
        getRef() {
          return this.ref ? this.ref : {};
        }
        getLanguage() {
          return this.language;
        }
        get Language() {
          return this.getLanguage();
        }
        get LanguageCode() {
          return this.language.lang();
        }
        get Languages() {
          return this.language.languages();
        }
        getNavigation() {
          return this.navigation ? this.navigation : {};
        }
        getPublisher() {
          return this.publisher;
        }
        getTemplate() {
          return this.template;
        }
        get Author() {
          var _a6;
          return this.author.author((_a6 = this.home) == null ? void 0 : _a6.author());
        }
        get Organization() {
          var _a6;
          return this.organization.organization((_a6 = this.home) == null ? void 0 : _a6.organization());
        }
        getCompiler() {
          return this.compiler;
        }
        getSitemap() {
          return this.sitemap;
        }
        isMultipleLanguage() {
          return this.language.isMultipleLanguage();
        }
        get IsMultilingual() {
          return this.isMultipleLanguage();
        }
        getCurrentLanguage() {
          return this.language.lang();
        }
        languagePrefix() {
          return this.language.languagePrefix();
        }
        async sitePage(e2) {
          return new Page2(this.template, this.languageSvc, this.publisher, e2, this);
        }
        sitePages(e2) {
          const t2 = [];
          for (let n3 = 0; n3 < e2.length; n3++) {
            const r = e2[n3];
            try {
              const e3 = this.sitePageSync(r);
              t2.push(e3);
            } catch (e3) {
              log44.error(`\u274C [Site.sitePages] Failed to convert page ${n3}:`, e3);
            }
          }
          return t2;
        }
        sitePageSync(e2) {
          return new Page2(this.template, this.languageSvc, this.publisher, e2, this);
        }
        async generateNavigations() {
          const e2 = this.language.getCurrentLanguage(), t2 = this.languageSvc.getLanguageIndex(e2);
          this.navigation && (await this.navigation.generateMenusForLanguage(e2, t2), await this.navigation.generateTaxonomiesForLanguage(e2, t2, this));
        }
        GetPage(...e2) {
          if (e2.length > 1) throw new Error(`too many arguments to .Site.GetPage: ${e2}. Use lookups on the form {{ .Site.GetPage "/posts/mypage-md" }}`);
          let t2 = e2[0];
          t2 = t2.replace(/\\/g, "/"), t2.startsWith("/") || (t2 = "/" + t2);
          try {
            const e3 = this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()), n3 = this.contentSvc.getPageFromPathSync(e3, t2);
            return n3 ? this.sitePageSync(n3) : (log44.warn(`\u26A0\uFE0F  GetPage: No page found for key "${t2}"`), null);
          } catch (e3) {
            return log44.error(`\u274C Error getting page "${t2}": ${e3}`), null;
          }
        }
        async copyStaticFiles() {
          try {
            await this.staticCopySvc.copyStaticFiles(this.staticCopySvc.staticFs(), this.staticCopySvc.publishFs());
          } catch (e2) {
            throw log44.error("\u274C Static file copy failed:", e2), e2;
          }
        }
        async siteWeightedPage(e2) {
          const t2 = await this.sitePage(e2.page()), { WeightedPage: n3 } = await Promise.resolve().then(() => (init_taxonomies_builder(), taxonomies_builder_exports));
          return new n3(t2, e2);
        }
        async buildPageGraph() {
          if (!this.pageGraph) try {
            const e2 = [], t2 = this.languageSvc.languageKeys();
            for (const n4 of t2) {
              const t3 = this.languageSvc.getLanguageIndex(n4);
              await this.contentSvc.walkPages(t3, async (t4) => {
                e2.push(t4);
              });
            }
            const n3 = e2.map((e3) => e3.slug());
            log44.info(`\u{1F4C4} Collected ${n3.length} page slugs`);
            const r = await this.collectResourceSlugs(e2);
            log44.info(`\u{1F5BC}\uFE0F  Collected ${r.length} resource slugs`);
            const i = [...n3, ...r];
            this.pageGraph = new PageGraph(i), log44.info(`\u2705 PageGraph built: ${n3.length} pages + ${r.length} resources = ${i.length} total`), this.buildBacklinksCache(e2);
          } catch (e2) {
            const t2 = e2 instanceof Error ? e2.message : String(e2);
            throw log44.error(`\u274C Failed to build PageGraph: ${t2}`), e2;
          }
        }
        async collectResourceSlugs(e2) {
          const t2 = [], n3 = /* @__PURE__ */ new Set();
          try {
            for (const r of e2) try {
              const e3 = await this.contentSvc.getPageSources(r);
              for (const r3 of e3) {
                const e4 = r3.slug();
                n3.has(e4) || (n3.add(e4), t2.push(e4));
              }
            } catch (e3) {
              const t3 = e3 instanceof Error ? e3.message : String(e3);
              log44.error(`\u26A0\uFE0F  Failed to get resources for page ${r.slug()}: ${t3}`);
            }
          } catch (e3) {
            const t3 = e3 instanceof Error ? e3.message : String(e3);
            log44.warn(`\u26A0\uFE0F  Failed to collect resource slugs: ${t3}`);
          }
          return t2;
        }
        async ProcessWikilinks(e2, t2) {
          if (!this.pageGraph) return log44.warn("\u26A0\uFE0F  PageGraph not built yet, returning original HTML"), t2;
          try {
            let r = "";
            if (this.url && this.url.base) {
              if (r = this.url.base.replace(/\/$/, ""), r.startsWith("/")) ;
              else if (r) try {
                r = new URL2(r).pathname.replace(/\/$/, "");
              } catch (e3) {
                log44.warn(`Failed to parse baseURL as URL: ${r}, treating as path`);
              }
              "/" === r && (r = "");
            }
            const i = (n3 = this.pageGraph, new HtmlLinkProcessor(n3, { markdownLinkResolution: "shortest", prettyLinks: true, openLinksInNewTab: false, lazyLoad: true, externalLinkIcon: true, baseURL: r })), s2 = await i.processLinks(e2, t2);
            return this.pageGraph.registerOutgoingLinks(e2, s2.outgoingLinks), s2.html;
          } catch (n4) {
            const r = n4 instanceof Error ? n4.message : String(n4);
            return log44.error(`\u274C Failed to process wikilinks for ${e2}: ${r}`), t2;
          }
          var n3;
        }
        getPageGraph() {
          return this.pageGraph;
        }
        GetBacklinks(e2) {
          if (this.backlinksCache && this.backlinksCache.has(e2)) return this.backlinksCache.get(e2);
          if (!this.pageGraph) return log44.warn(`\u26A0\uFE0F  PageGraph not built yet, cannot get backlinks for ${e2}`), [];
          const t2 = this.pageGraph.getBacklinks(e2);
          return this.backlinksCache && this.backlinksCache.set(e2, t2), t2;
        }
        async buildBacklinksCache(e2) {
          this.pageGraph ? this.backlinksCache = /* @__PURE__ */ new Map() : log44.warn("\u26A0\uFE0F  PageGraph not built, skipping backlinks cache");
        }
        async GetContentIndex() {
          var _a6;
          if (!this.pageGraph) return log44.warn("\u26A0\uFE0F  PageGraph not built yet, cannot generate content index"), /* @__PURE__ */ new Map();
          const e2 = /* @__PURE__ */ new Map(), t2 = await this.RegularPages();
          for (const n3 of t2) {
            const t3 = n3.slug(), r = this.pageGraph.getOutgoingLinks(t3), i = (n3.Plain || "").substring(0, 1e3);
            e2.set(t3, { slug: t3, title: n3.Title || n3.File.OriginalBaseName, links: r, tags: ((_a6 = n3.Params) == null ? void 0 : _a6.tags) || [], content: i });
          }
          return e2;
        }
      };
    } });
    async function openFileForWriting(e2, t2) {
      const n3 = import_path15.default.normalize(t2);
      try {
        return await e2.create(n3);
      } catch (t3) {
        if (!function(e3) {
          var _a6, _b4;
          return e3 && ("ENOENT" === e3.code || "FILE_NOT_FOUND" === e3.code || ((_a6 = e3.message) == null ? void 0 : _a6.includes("not found")) || ((_b4 = e3.message) == null ? void 0 : _b4.includes("no such file")));
        }(t3)) throw t3;
        const r = import_path15.default.dirname(n3);
        return await e2.mkdirAll(r, 511), await e2.create(n3);
      }
    }
    var log46;
    var Ref;
    var CollatorWrapper;
    var Language2;
    var Author2;
    var Organization2;
    var Compiler;
    var log49;
    var Navigation;
    var log50;
    var MenuBuilder;
    var log51;
    var NavigationFactory;
    var init_publisher = __esm2({ "internal/domain/site/entity/publisher.ts"() {
      import_path15 = __toESM3(require("path")), init_log(), getDomainLogger("site", { component: "publisher" }), Publisher = class {
        constructor(e2) {
          __publicField(this, "fs");
          this.fs = e2;
        }
        async publishSource(e2, ...t2) {
          const n3 = await this.openFilesForWriting(...t2);
          try {
            const t3 = "string" == typeof e2 ? new TextEncoder().encode(e2) : e2;
            await this.copyToWriter(n3, t3);
          } finally {
            await n3.close();
          }
        }
        async publishFiles(e2, ...t2) {
          const n3 = await this.openFilesForWriting(...t2);
          try {
            await this.copyStreamToWriter(n3, e2);
          } finally {
            await n3.close();
          }
        }
        async openFilesForWriting(...e2) {
          const t2 = [];
          for (const n3 of e2) {
            const e3 = await openFileForWriting(this.fs, n3);
            t2.push(e3);
          }
          return new MultiWriter(t2);
        }
        async copyToWriter(e2, t2) {
          await e2.write(t2);
        }
        async copyStreamToWriter(e2, t2) {
          const n3 = t2.getReader();
          try {
            for (; ; ) {
              const { done: t3, value: r } = await n3.read();
              if (t3) break;
              await e2.write(r);
            }
          } finally {
            n3.releaseLock();
          }
        }
      }, MultiWriter = class {
        constructor(e2) {
          __publicField(this, "files");
          this.files = e2;
        }
        async write(e2) {
          const t2 = this.files.map((t3) => t3.write(e2));
          await Promise.all(t2);
        }
        async close() {
          const e2 = this.files.map((e3) => e3.close());
          await Promise.all(e2);
        }
      };
    } });
    var init_ref = __esm2({ "internal/domain/site/entity/ref.ts"() {
      init_log(), log46 = getDomainLogger("site", { component: "ref" }), Ref = class {
        constructor(e2, t2, n3 = "#ZgotmplZ") {
          __publicField(this, "site");
          __publicField(this, "contentSvc");
          __publicField(this, "notFoundURL");
          this.site = e2, this.contentSvc = t2, this.notFoundURL = n3;
        }
        async relRefFrom(e2, t2) {
          return this.relRef(e2, t2);
        }
        async relRef(e2, t2) {
          try {
            const n3 = this.decodeRefArgs(e2);
            return n3.path ? this.refLink(n3.path, t2, true, n3.outputFormat) : "";
          } catch (e3) {
            throw new Error(`Invalid arguments to Ref: ${e3}`);
          }
        }
        decodeRefArgs(e2) {
          return { path: e2.path || "", outputFormat: e2.outputFormat || "" };
        }
        async refLink(e2, t2, n3, r) {
          const i = t2;
          if (!i || "function" != typeof i.unwrapPage) throw new Error("source is not a PageWrapper");
          const s2 = i.unwrapPage();
          let a;
          const o = e2.replace(/\\/g, "/");
          try {
            a = new globalThis.URL(o, "http://example.com");
          } catch (e3) {
            return log46.error(`Failed to parse ref URL: ${e3}`), this.notFoundURL;
          }
          let l = null, c = "";
          if ("" !== a.pathname) try {
            l = await this.contentSvc.getPageRef(s2, a.pathname, this.site.home.page);
            let e3 = null;
            if (l || this.isPositioner(t2) && (e3 = t2.position()), !l) return this.logNotFound(a.pathname, "page not found", s2, e3), this.notFoundURL;
            const r3 = await this.site.sitePage(l);
            c = n3 ? r3.relPermalink() : r3.permalink();
          } catch (t3) {
            return log46.error(`[${s2.pageIdentity().pageLanguage()}] REF_NOT_FOUND: Ref "${e2}": ${t3}`), this.notFoundURL;
          }
          return a.hash && (c = c + "#" + a.hash), c;
        }
        isPositioner(e2) {
          return e2 && "function" == typeof e2.position;
        }
        logNotFound(e2, t2, n3, r) {
          const i = n3.pageIdentity().pageLanguage();
          r && r.isValid() ? log46.error(`[${i}] REF_NOT_FOUND: Ref "${e2}": ${r.toString()}: ${t2}`) : n3 ? log46.error(`[${i}] REF_NOT_FOUND: Ref "${e2}" from page "${n3.path()}": ${t2}`) : log46.error(`[${i}] REF_NOT_FOUND: Ref "${e2}": ${t2}`);
        }
      };
    } });
    var init_language3 = __esm2({ "internal/domain/site/entity/language.ts"() {
      init_log(), getDomainLogger("site", { component: "language" }), CollatorWrapper = class {
        constructor(e2) {
          __publicField(this, "collator");
          this.collator = e2;
        }
        compare(e2, t2) {
          return this.collator.compare(e2, t2);
        }
      }, Language2 = class e2 {
        constructor(e3) {
          __publicField(this, "langSvc");
          __publicField(this, "currentLocation");
          __publicField(this, "currentLanguage");
          __publicField(this, "collator", null);
          this.langSvc = e3, this.currentLocation = "UTC", this.currentLanguage = "";
        }
        currentLanguageIndex() {
          try {
            return this.langSvc.getLanguageIndex(this.currentLanguage);
          } catch (e3) {
            throw new Error(`language "${this.currentLanguage}" not found`);
          }
        }
        async setup() {
          this.currentLocation = "UTC";
        }
        languages() {
          const t2 = [];
          for (const n3 of this.langSvc.languageKeys()) {
            const r = new e2(this.langSvc);
            r.currentLocation = this.currentLocation, r.currentLanguage = n3, r.collator = this.collator, t2.push(r);
          }
          return t2;
        }
        getCollator() {
          if (!this.collator) try {
            const e3 = new Intl.Collator(this.currentLanguage || "en");
            this.collator = new CollatorWrapper({ compare: (t2, n3) => e3.compare(t2, n3) });
          } catch (e3) {
            const t2 = new Intl.Collator("en");
            this.collator = new CollatorWrapper({ compare: (e4, n3) => t2.compare(e4, n3) });
          }
          return this.collator;
        }
        location() {
          return this.currentLocation;
        }
        isMultipleLanguage() {
          return this.langSvc.languageKeys().length > 1;
        }
        languagePrefix() {
          return this.currentLanguage === this.langSvc.defaultLanguage() ? "" : this.currentLanguage;
        }
        lang() {
          return this.currentLanguage;
        }
        get Lang() {
          return this.lang();
        }
        languageName() {
          return this.langSvc.getLanguageName(this.currentLanguage);
        }
        get LanguageName() {
          return this.languageName();
        }
        defaultLanguageName() {
          return this.langSvc.getLanguageName(this.langSvc.defaultLanguage());
        }
        languageCode() {
          return this.currentLanguage;
        }
        get LanguageCode() {
          return this.languageCode();
        }
        get LanguageDirection() {
          return "ltr";
        }
        languageDirection() {
          return "ltr";
        }
        setCurrentLanguage(e3) {
          this.currentLanguage = e3;
        }
        getCurrentLanguage() {
          return this.currentLanguage;
        }
        setCurrentLocation(e3) {
          this.currentLocation = e3;
        }
      };
    } });
    var init_author = __esm2({ "internal/domain/site/valueobject/author.ts"() {
      Author2 = class {
        constructor(e2, t2) {
          __publicField(this, "_name");
          __publicField(this, "_email");
          __publicField(this, "_homeAuthor");
          this._name = e2, this._email = t2;
        }
        name() {
          return this._name;
        }
        email() {
          return this._email;
        }
        author(e2) {
          return this._homeAuthor = e2, this;
        }
        get Name() {
          var _a6;
          return ((_a6 = this._homeAuthor) == null ? void 0 : _a6.name) || this.name();
        }
        get Description() {
          var _a6;
          return ((_a6 = this._homeAuthor) == null ? void 0 : _a6.description) || "";
        }
        get Avatar() {
          var _a6;
          return ((_a6 = this._homeAuthor) == null ? void 0 : _a6.avatar) || "";
        }
        get Twitter() {
          var _a6, _b4;
          return ((_b4 = (_a6 = this._homeAuthor) == null ? void 0 : _a6.social) == null ? void 0 : _b4.twitter) || "";
        }
        get Socials() {
          var _a6;
          const e2 = [];
          if (!((_a6 = this._homeAuthor) == null ? void 0 : _a6.social)) return e2;
          for (const [t2, n3] of Object.entries(this._homeAuthor.social)) n3 && e2.push({ ID: t2, Link: n3 });
          return e2;
        }
      };
    } });
    var init_organization = __esm2({ "internal/domain/site/valueobject/organization.ts"() {
      init_log(), getDomainLogger("site", { component: "organization" }), Organization2 = class {
        constructor() {
          __publicField(this, "_name");
          __publicField(this, "_description");
          __publicField(this, "_website");
          __publicField(this, "_logo");
          __publicField(this, "_email");
          __publicField(this, "_address");
          __publicField(this, "_vision");
          __publicField(this, "_homeOrganization");
          this._name = "MDFriday", this._description = "Turn markdown to website, in minutes.", this._website = "https://mdfriday.com", this._logo = "https://gohugo.net/mdfriday.svg", this._email = "support@mdfriday.com", this._address = "Cang long Street, Wuhan, China", this._vision = "Make site generation easy and accessible for everyone.";
        }
        name() {
          return this._name;
        }
        description() {
          return this._description;
        }
        website() {
          return this._website;
        }
        organization(e2) {
          return this._homeOrganization = e2, this;
        }
        get Name() {
          var _a6;
          return ((_a6 = this._homeOrganization) == null ? void 0 : _a6.name) || this.name();
        }
        get Description() {
          var _a6;
          return ((_a6 = this._homeOrganization) == null ? void 0 : _a6.description) || this.description();
        }
        get Website() {
          var _a6;
          return ((_a6 = this._homeOrganization) == null ? void 0 : _a6.website) || this.website();
        }
        get Vision() {
          var _a6;
          return ((_a6 = this._homeOrganization) == null ? void 0 : _a6.vision) || this._vision;
        }
        get Logo() {
          var _a6;
          return ((_a6 = this._homeOrganization) == null ? void 0 : _a6.logo) || this._logo;
        }
        get Address() {
          var _a6, _b4;
          return ((_b4 = (_a6 = this._homeOrganization) == null ? void 0 : _a6.contact) == null ? void 0 : _b4.address) || this._address;
        }
        get Email() {
          var _a6, _b4;
          return ((_b4 = (_a6 = this._homeOrganization) == null ? void 0 : _a6.contact) == null ? void 0 : _b4.email) || this._email;
        }
        get Social() {
          var _a6;
          return (_a6 = this._homeOrganization) == null ? void 0 : _a6.social;
        }
        SocialById(e2) {
          var _a6, _b4;
          return ((_b4 = (_a6 = this._homeOrganization) == null ? void 0 : _a6.social) == null ? void 0 : _b4[e2]) || "";
        }
        get Socials() {
          var _a6;
          const e2 = [];
          if (!((_a6 = this._homeOrganization) == null ? void 0 : _a6.social)) return e2;
          for (const [t2, n3] of Object.entries(this._homeOrganization.social)) n3 && e2.push({ ID: t2, Link: n3 });
          return e2;
        }
      };
    } });
    var init_version2 = __esm2({ "internal/domain/site/valueobject/version.ts"() {
      Compiler = class {
        constructor(e2) {
          __publicField(this, "ver");
          this.ver = e2;
        }
        version() {
          return this.ver;
        }
        environment() {
          return "production";
        }
      };
    } });
    var init_navigation = __esm2({ "internal/domain/site/entity/navigation.ts"() {
      init_log(), init_menu(), log49 = getDomainLogger("site", { component: "navigation" }), Navigation = class {
        constructor(e2) {
          __publicField(this, "taxonomies");
          __publicField(this, "taxonomiesBuilder", null);
          __publicField(this, "taxonomiesCache", /* @__PURE__ */ new Map());
          __publicField(this, "menus");
          __publicField(this, "menuBuilder", null);
          __publicField(this, "menuCache", /* @__PURE__ */ new Map());
          this.taxonomies = /* @__PURE__ */ new Map(), this.menus = /* @__PURE__ */ new Map();
          for (const t2 of e2.languageKeys()) this.menus.set(t2, newEmptyMenus()), this.menuCache.set(t2, false);
        }
        setMenuBuilder(e2) {
          this.menuBuilder = e2;
        }
        setTaxonomiesBuilder(e2) {
          this.taxonomiesBuilder = e2;
        }
        async generateMenusForLanguage(e2, t2) {
          if (this.menuBuilder) {
            if (true !== this.menuCache.get(e2)) try {
              const n3 = await this.menuBuilder.buildMenusForLanguage(t2);
              this.menus.set(e2, n3), this.menuCache.set(e2, true);
            } catch (t3) {
              log49.error(`Failed to generate menus for language ${e2}: ${t3}`);
            }
          } else log49.error("Menu builder not set, cannot generate menus");
        }
        async generateTaxonomiesForLanguage(e2, t2, n3) {
          if (this.taxonomiesBuilder) {
            if (true !== this.taxonomiesCache.get(e2)) try {
              const r = await this.taxonomiesBuilder.buildTaxonomiesForLanguage(t2, n3);
              this.taxonomies.set(e2, r), this.taxonomiesCache.set(e2, true);
            } catch (t3) {
              log49.error(`Failed to generate taxonomies for language ${e2}: ${t3}`);
            }
          } else log49.error("Taxonomies builder not set, cannot generate taxonomies");
        }
        getMenus(e2) {
          let t2 = this.menus.get(e2);
          return void 0 === t2 && (t2 = newEmptyMenus()), t2;
        }
        getTaxonomies(e2) {
          return this.taxonomies.get(e2);
        }
      };
    } });
    var init_menu_builder = __esm2({ "internal/domain/site/entity/menu-builder.ts"() {
      init_log(), init_menu(), log50 = getDomainLogger("site", { component: "menu-builder" }), MenuBuilder = class {
        constructor(e2, t2) {
          __publicField(this, "contentService");
          __publicField(this, "site");
          this.contentService = e2, this.site = t2;
        }
        async buildMenusForLanguage(e2) {
          const t2 = /* @__PURE__ */ new Map();
          return await this.contentService.walkPages(e2, async (e3) => {
            await this.processPage(e3, t2);
          }), this.convertToMenus(t2);
        }
        async processPage(e2, t2) {
          try {
            const n3 = e2.menu();
            if (!n3) return;
            const r = await this.generatePageUrl(e2);
            for (const [i, s2] of Object.entries(n3)) await this.processMenuSection(i, s2, r, e2, t2);
          } catch (e3) {
            log50.error(`Error processing page for menu: ${e3}`);
          }
        }
        async processMenuSection(e2, t2, n3, r, i) {
          if (!(false === t2 || Array.isArray(t2) && 0 === t2.length)) {
            if (Array.isArray(t2)) await this.processMenuItems(e2, t2, n3, r, i);
            else if (t2 && "object" == typeof t2) {
              let s2 = 0;
              for (const [a, o] of Object.entries(t2)) if (!(false === o || Array.isArray(o) && 0 === o.length) && Array.isArray(o)) {
                const t3 = `${e2}.${a}`;
                if (await this.processMenuItems(t3, o, n3, r, i), "footer" === e2) {
                  const e3 = `${t3}::__subsection__`;
                  i.has(e3) || i.set(e3, { title: a, url: "", children: /* @__PURE__ */ new Map(), weight: 1e3, level: 0, menuName: t3, order: s2 });
                }
                s2++;
              }
            }
          }
        }
        async processMenuItems(e2, t2, n3, r, i) {
          for (let s2 = 0; s2 < t2.length; s2++) {
            const a = t2[s2];
            if (!a || "object" != typeof a) continue;
            if (!a.title || "string" != typeof a.title) continue;
            let o = a.url || "";
            o = "" === o ? n3 : await this.processMenuItemUrl(o);
            const l = "number" == typeof a.weight ? a.weight : 1e3, c = `${e2}::${a.title}`;
            let h3 = i.get(c);
            h3 ? l < h3.weight && (h3.weight = l, h3.url = o) : (h3 = { title: a.title, url: o, children: /* @__PURE__ */ new Map(), weight: l, level: 0, menuName: e2 || void 0, order: s2 }, i.set(c, h3)), Array.isArray(a.children) && await this.processChildrenItems(c, a.children, n3, r, i, h3);
          }
        }
        async processChildrenItems(e2, t2, n3, r, i, s2) {
          for (let a = 0; a < t2.length; a++) {
            const o = t2[a];
            if (!o || "object" != typeof o) continue;
            if (!o.title || "string" != typeof o.title) continue;
            let l = o.url || "";
            l = "" === l ? n3 : await this.processMenuItemUrl(l);
            const c = "number" == typeof o.weight ? o.weight : 1e3, h3 = `${e2}::${o.title}`, u = { title: o.title, url: l, children: /* @__PURE__ */ new Map(), weight: c, level: s2.level + 1, menuName: s2.menuName || void 0, order: a };
            i.set(h3, u), s2.children.set(h3, u), Array.isArray(o.children) && await this.processChildrenItems(h3, o.children, n3, r, i, u);
          }
        }
        async generatePageUrl(e2) {
          try {
            return (await this.site.sitePage(e2)).RelPermalink;
          } catch (t2) {
            return log50.error(`Error generating page URL for ${e2.path()}: ${t2}`), this.fallbackUrlFromPath(e2.path());
          }
        }
        async processMenuItemUrl(e2) {
          try {
            return this.site.getURL().relURL(e2);
          } catch (t2) {
            return log50.error(`Error processing menu item URL ${e2}: ${t2}`), e2;
          }
        }
        fallbackUrlFromPath(e2) {
          let t2 = e2.replace(/\.md$/, "");
          return t2.startsWith("/") || (t2 = "/" + t2), t2.endsWith("/") || t2.includes(".") || (t2 += "/"), t2;
        }
        convertToMenus(e2) {
          const t2 = /* @__PURE__ */ new Map();
          for (const [n4, r3] of e2.entries()) if (!n4.includes("::__subsection__") && 0 === r3.level) {
            const e3 = r3.menuName || "main";
            t2.has(e3) || t2.set(e3, []), t2.get(e3).push(r3);
          }
          const n3 = this.buildMenuItems(t2.get("nav") || [], e2), r = [], i = /* @__PURE__ */ new Map(), s2 = /* @__PURE__ */ new Map();
          for (const [n4, r3] of t2.entries()) if (n4.startsWith("footer.")) {
            const t3 = n4.substring(7), a2 = this.buildMenuItems(r3, e2, false);
            i.set(t3, a2);
            const o2 = `${n4}::__subsection__`, l = e2.get(o2);
            l && s2.set(t3, l.order);
          }
          const a = Array.from(i.entries()).sort((e3, t3) => (s2.get(e3[0]) || 0) - (s2.get(t3[0]) || 0));
          for (let e3 = 0; e3 < a.length; e3++) {
            const [t3, n4] = a[e3];
            if (n4.length > 0) {
              const i2 = new Menu2({ title: this.capitalizeFirstLetter(t3), url: "", children: n4, weight: e3 + 1, identifier: `footer-${t3}` });
              r.push(i2);
            }
          }
          const o = {};
          return n3.length > 0 && (o.nav = n3), r.length > 0 && (o.footer = r), new Menus(o);
        }
        capitalizeFirstLetter(e2) {
          return e2.charAt(0).toUpperCase() + e2.slice(1);
        }
        buildMenuItems(e2, t2, n3 = true) {
          const r = [];
          for (const i of e2) {
            const e3 = Array.from(i.children.values()), s2 = e3.length > 0 ? this.buildMenuItems(e3, t2, n3) : [], a = new Menu2({ title: i.title, url: i.url, children: s2, weight: i.weight, identifier: i.url });
            r.push(a);
          }
          return n3 ? r.sort((e3, t3) => e3.weight() !== t3.weight() ? e3.weight() - t3.weight() : e3.title().localeCompare(t3.title())) : r.sort((t3, n4) => {
            const r3 = e2.find((e3) => e3.title === t3.title()), i = e2.find((e3) => e3.title === n4.title());
            return ((r3 == null ? void 0 : r3.order) || 0) - ((i == null ? void 0 : i.order) || 0);
          });
        }
      };
    } });
    var init_navigation_factory = __esm2({ "internal/domain/site/factory/navigation-factory.ts"() {
      init_navigation(), init_menu_builder(), init_taxonomies_builder(), init_log(), log51 = getDomainLogger("site", { component: "navigation-factory" }), NavigationFactory = class {
        constructor(e2, t2, n3) {
          __publicField(this, "langService");
          __publicField(this, "contentService");
          __publicField(this, "site");
          this.langService = e2, this.contentService = t2, this.site = n3;
        }
        createNavigation() {
          try {
            const t2 = (e2 = this.langService, new Navigation(e2)), n3 = new MenuBuilder(this.contentService, this.site);
            t2.setMenuBuilder(n3);
            const r = new TaxonomiesBuilder(this.contentService);
            return t2.setTaxonomiesBuilder(r), t2;
          } catch (e3) {
            throw log51.error(`Failed to create Navigation entity: ${e3}`), e3;
          }
          var e2;
        }
      };
    } });
    var import_crypto;
    var import_stream;
    var import_promises14;
    var log53;
    var ResourceHash;
    var PublishOnce;
    var ResourceImpl;
    var import_terser;
    var MinifierClient;
    var MinifyTransformation;
    var import_crypto2;
    var IntegrityClient;
    var FingerprintTransformation;
    var ExecuteAsTemplateTransform;
    var TemplateClient;
    var path24;
    var import_stream2;
    var log54;
    var Publisher2;
    var FileWritable;
    var http2;
    var https2;
    var log55;
    var HttpClient4;
    var path25;
    var import_crypto3;
    var log56;
    var Resources;
    var path26;
    var ResourcePaths;
    var import_crypto4;
    var ResourceTransformationKey;
    var ResourceMetadataImpl;
    var import_path16;
    var log57;
    var configCache;
    var modulesCache;
    var fsCache;
    var contentCache;
    var resourcesCache;
    var siteCache;
    var createDomainInstances;
    var tasks3;
    var init_site22 = __esm2({ "internal/domain/site/factory/site.ts"() {
      init_site2(), init_publisher(), init_url(), init_ref(), init_language3(), init_author(), init_organization(), init_version2(), init_navigation_factory(), init_log(), getDomainLogger("site", { component: "factory" });
    } });
    var init_type9 = __esm2({ "internal/domain/resources/type.ts"() {
    } });
    var init_resource = __esm2({ "internal/domain/resources/entity/resource.ts"() {
      init_resources2(), import_crypto = require("crypto"), import_stream = require("stream"), init_paths(), import_promises14 = require("stream/promises"), init_log(), log53 = getDomainLogger("resources", { component: "publisher" }), ResourceHash = class {
        constructor() {
          __publicField(this, "value", "");
          __publicField(this, "size", 0);
          __publicField(this, "resource", null);
        }
        async setup(e2) {
          if (this.value) return;
          this.resource = e2;
          const t2 = await e2.readSeekCloser(), n3 = (0, import_crypto.createHash)("sha256");
          let r = 0;
          const i = [];
          t2.on("data", (e3) => {
            n3.update(e3), r += e3.length, i.push(e3);
          }), await new Promise((e3, i2) => {
            t2.on("end", () => {
              this.value = n3.digest("hex"), this.size = r, e3();
            }), t2.on("error", i2);
          }), await t2.close();
        }
      }, PublishOnce = class {
        constructor() {
          __publicField(this, "hasPublished", false);
          __publicField(this, "publishPromise", null);
        }
        async do(e2) {
          if (!this.hasPublished) return this.publishPromise || (this.publishPromise = e2().then(() => {
            this.hasPublished = true;
          })), this.publishPromise;
        }
      }, ResourceImpl = class e2 {
        constructor(e3, t2, n3, r = {}, i) {
          __publicField(this, "h");
          __publicField(this, "openReadSeekCloser");
          __publicField(this, "_mediaType");
          __publicField(this, "paths");
          __publicField(this, "_data");
          __publicField(this, "publisher");
          __publicField(this, "publishOnce");
          this.h = new ResourceHash(), this.openReadSeekCloser = e3, this._mediaType = t2, this.paths = n3, this._data = r, this.publisher = i, this.publishOnce = new PublishOnce();
        }
        name() {
          return this.paths.pathFile();
        }
        nameNormalized() {
          return this.paths.targetPath().replace(/\\/g, "/");
        }
        mediaType() {
          return this._mediaType;
        }
        resourceType() {
          return this._mediaType.mainType;
        }
        relPermalink() {
          return this.publish(), this.paths.targetLink();
        }
        permalink() {
          return this.publish(), this.paths.targetPath();
        }
        async publish() {
          const e3 = this.targetPath();
          this.publisher ? await this.publishOnce.do(async () => {
            let t2 = null, n3 = null;
            try {
              t2 = await this.publisher.openPublishFileForWriting(this.paths.targetPath()), n3 = await this.readSeekCloser(), await this.copyStreamToFile(n3, t2);
            } catch (t3) {
              throw log53.errorf("\u274C [Resource.publish] Error publishing %s: %s", e3, t3), t3;
            } finally {
              if (n3) try {
                await n3.close();
              } catch (t3) {
                log53.errorf("\u274C [Resource.publish] Failed to close ReadSeekCloser %s: %s", e3, t3);
              }
              if (t2) try {
                await t2.file.close();
              } catch (t3) {
                log53.errorf("\u274C [Resource.publish] Failed to close public writer %s: %s", e3, t3);
              }
            }
          }) : log53.error("\u26A0\uFE0F [Resource.publish] No publisher for: %s", e3);
        }
        async copyStreamToFile(e3, t2) {
          const n3 = this.targetPath();
          try {
            await (0, import_promises14.pipeline)(e3, t2);
          } catch (e4) {
            throw log53.errorf("\u274C [copyStreamToFile] Error during pipeline for %s: %s", n3, e4), e4;
          }
        }
        targetPath() {
          return this.paths.targetPath();
        }
        data() {
          return this._data;
        }
        async readSeekCloser() {
          const e3 = await this.openReadSeekCloser();
          if (e3 && "function" == typeof e3.read) {
            const t2 = e3.read();
            if (t2) {
              const n3 = new (0, require("stream").Readable)();
              let r;
              for (n3.push(t2); null !== (r = e3.read()); ) r && n3.push(r);
              return n3.push(null), Object.assign(n3, { seek: async (e4, t3) => 0, close: async () => Promise.resolve() });
            }
          }
          return e3;
        }
        async content(e3) {
          const t2 = await this.readSeekCloser();
          return new Promise((e4, n3) => {
            let r = "";
            t2.on("data", (e5) => {
              r += e5.toString();
            }), t2.on("end", () => {
              e4(r);
            }), t2.on("error", n3);
          });
        }
        async hash() {
          return await this.h.setup(this), this.h.value;
        }
        async size() {
          return await this.h.setup(this), this.h.size;
        }
        cloneTo(e3) {
          const t2 = this.clone();
          return t2.paths = t2.paths.fromTargetPath(e3), t2;
        }
        clone() {
          const t2 = new e2(this.openReadSeekCloser, this._mediaType, this.paths, { ...this._data }, this.publisher);
          return t2.h = this.h, t2;
        }
        key() {
          return this.paths.targetLink();
        }
        get RelPermalink() {
          return this.relPermalink();
        }
        get Permalink() {
          return this.permalink();
        }
        get Name() {
          return this.name();
        }
        get MediaType() {
          return this.mediaType();
        }
        get ResourceType() {
          return this.resourceType();
        }
        get TargetPath() {
          return this.targetPath();
        }
        get Data() {
          return this.data();
        }
        get Content() {
          return this.content();
        }
        get Hash() {
          return () => this.hash();
        }
        get Size() {
          return () => this.size();
        }
        meta() {
          return new ResourceMetadataImpl(this.paths.targetPath(), this._mediaType.type, this._data);
        }
        mergeData(e3) {
          if (e3 && 0 !== Object.keys(e3).length) for (const [t2, n3] of Object.entries(e3)) t2 in this._data || (this._data[t2] = n3);
        }
        async transform(...e3) {
          let t2 = this;
          for (let n3 = 0; n3 < e3.length; n3++) {
            const r = e3[n3];
            try {
              const e4 = await t2.readSeekCloser(), n4 = new import_stream.PassThrough();
              let i = "";
              const s2 = [], a = { source: { from: e4, inPath: t2.targetPath(), inMediaType: t2.mediaType() }, target: { to: n4 }, data: { ...t2.data() }, addOutPathIdentifier: (e5) => {
                const n5 = t2.targetPath(), r3 = PathDomain.parseBasic(n5);
                let i2 = r3.dir;
                i2 = i2.replace(/\/+$/, "");
                let s3 = "";
                i2 && (s3 = i2 + "/"), s3 += r3.nameWithoutExt + e5 + r3.ext, a.data.targetPath = s3;
              }, updateBuffer: () => {
              }, updateSource: () => {
              }, close: () => {
                e4.close();
              } };
              n4.on("data", (e5) => {
                s2.push(e5);
              });
              const o = new Promise((e5, t3) => {
                n4.on("end", () => {
                  i = Buffer.concat(s2).toString(), e5();
                }), n4.on("error", (e6) => {
                  t3(e6);
                });
              });
              await r.transform(a), await o;
              const l = a.data.targetPath || t2.targetPath(), c = this.createTransformedResource(i, l, t2.mediaType(), a.data);
              t2 = c, a.close();
            } catch (e4) {
              throw e4;
            }
          }
          return t2;
        }
        createTransformedResource(t2, n3, r, i) {
          const s2 = this.paths.fromTargetPath(n3);
          return new e2(async () => {
            const e3 = new import_stream.PassThrough();
            return e3.end(t2), Object.assign(e3, { seek: async (e4, t3) => 0, close: async () => Promise.resolve() });
          }, r, s2, i, this.publisher);
        }
      };
    } });
    var init_minifier = __esm2({ "internal/domain/resources/entity/minifier.ts"() {
      init_resources2(), import_terser = require_bundle_min(), MinifierClient = class {
        constructor(e2 = false) {
          __publicField(this, "minifiers", /* @__PURE__ */ new Map());
          __publicField(this, "minifyOutput");
          this.minifyOutput = e2, this.setupMinifiers();
        }
        setupMinifiers() {
          this.minifiers.set("text/css", this.minifyCSS.bind(this)), this.minifiers.set("text/javascript", this.minifyJS.bind(this)), this.minifiers.set("application/javascript", this.minifyJS.bind(this)), this.minifiers.set("application/json", this.minifyJSON.bind(this)), this.minifiers.set("text/html", this.minifyHTML.bind(this)), this.minifiers.set("image/svg+xml", this.minifySVG.bind(this)), this.minifiers.set("application/xml", this.minifyXML.bind(this)), this.minifiers.set("text/xml", this.minifyXML.bind(this));
        }
        async minify(e2) {
          const t2 = new MinifyTransformation(this);
          return e2.transform(t2);
        }
        getMinifier(e2) {
          return this.minifiers.get(e2) || null;
        }
        async minifyCSS(e2) {
          return e2;
        }
        async minifyJS(e2) {
          try {
            return (await (0, import_terser.minify)(e2, { compress: { drop_console: false, drop_debugger: true, passes: 2 }, mangle: { toplevel: false }, format: { comments: false } })).code || e2;
          } catch (t2) {
            return e2;
          }
        }
        async minifyJSON(e2) {
          try {
            return JSON.stringify(JSON.parse(e2));
          } catch (e3) {
            return e2;
          }
        }
        async minifyHTML(e2) {
          return e2;
        }
        async minifySVG(e2) {
          return e2;
        }
        async minifyXML(e2) {
          return e2;
        }
      }, MinifyTransformation = class {
        constructor(e2) {
          this.minifierClient = e2;
        }
        key() {
          return ResourceTransformationKey.newResourceTransformationKey("minify");
        }
        async transform(e2) {
          e2.addOutPathIdentifier(".min");
          const t2 = e2.source.inMediaType.type, n3 = this.minifierClient.getMinifier(t2);
          if (!n3) return void e2.source.from.pipe(e2.target.to);
          let r = "";
          e2.source.from.on("data", (e3) => {
            r += e3.toString();
          }), await new Promise((t3, i) => {
            e2.source.from.on("end", async () => {
              try {
                const i2 = await n3(r);
                e2.target.to.write(i2), e2.target.to.end(), t3();
              } catch (e3) {
                i(e3);
              }
            }), e2.source.from.on("error", i);
          });
        }
      };
    } });
    var init_integrity = __esm2({ "internal/domain/resources/entity/integrity.ts"() {
      import_crypto2 = require("crypto"), init_resources2(), IntegrityClient = class {
        async fingerprint(e2, t2 = "sha256") {
          const n3 = new FingerprintTransformation(t2);
          return e2.transform(n3);
        }
        generateIntegrity(e2) {
          return `sha256-${(0, import_crypto2.createHash)("sha256").update(e2, "utf8").digest("base64")}`;
        }
        generateSHA384(e2) {
          return `sha384-${(0, import_crypto2.createHash)("sha384").update(e2, "utf8").digest("base64")}`;
        }
        generateSHA512(e2) {
          return `sha512-${(0, import_crypto2.createHash)("sha512").update(e2, "utf8").digest("base64")}`;
        }
        verifyIntegrity(e2, t2) {
          const [n3, r] = t2.split("-", 2);
          let i;
          switch (n3) {
            case "sha256":
              i = (0, import_crypto2.createHash)("sha256").update(e2, "utf8").digest("base64");
              break;
            case "sha384":
              i = (0, import_crypto2.createHash)("sha384").update(e2, "utf8").digest("base64");
              break;
            case "sha512":
              i = (0, import_crypto2.createHash)("sha512").update(e2, "utf8").digest("base64");
              break;
            default:
              return false;
          }
          return i === r;
        }
      }, FingerprintTransformation = class {
        constructor(e2) {
          this.algo = e2;
        }
        key() {
          return ResourceTransformationKey.newResourceTransformationKey("fingerprint", this.algo);
        }
        async transform(e2) {
          const t2 = this.newHash(this.algo);
          let n3 = "";
          const r = [];
          e2.source.from.on("data", (e3) => {
            t2.update(e3), r.push(e3), n3 += e3.toString();
          }), await new Promise((n4, i) => {
            e2.source.from.on("end", () => {
              try {
                const i2 = t2.digest(), s2 = i2.toString("hex");
                e2.data.Integrity = this.integrity(this.algo, i2);
                const a = s2.substring(0, 12);
                e2.addOutPathIdentifier("." + a);
                for (const t3 of r) e2.target.to.write(t3);
                e2.target.to.end(), n4();
              } catch (e3) {
                i(e3);
              }
            }), e2.source.from.on("error", i);
          });
        }
        newHash(e2) {
          switch (e2) {
            case "md5":
              return (0, import_crypto2.createHash)("md5");
            case "sha256":
              return (0, import_crypto2.createHash)("sha256");
            case "sha384":
              return (0, import_crypto2.createHash)("sha384");
            case "sha512":
              return (0, import_crypto2.createHash)("sha512");
            default:
              throw new Error(`Unsupported hash algorithm: "${e2}", use either md5, sha256, sha384 or sha512`);
          }
        }
        integrity(e2, t2) {
          return `${e2}-${t2.toString("base64")}`;
        }
      };
    } });
    var init_template4 = __esm2({ "internal/domain/resources/entity/template.ts"() {
      init_resources2(), ExecuteAsTemplateTransform = class {
        constructor(e2, t2, n3) {
          __publicField(this, "templateExecutor");
          __publicField(this, "_targetPath");
          __publicField(this, "data");
          this.templateExecutor = e2, this._targetPath = t2, this.data = n3;
        }
        key() {
          return ResourceTransformationKey.newResourceTransformationKey("execute-as-template", this._targetPath);
        }
        async transform(e2) {
          try {
            e2.data.targetPath = this._targetPath;
            let t2 = "";
            if ("function" == typeof e2.source.from.read) {
              let n3;
              const r = [];
              for (; null !== (n3 = e2.source.from.read()); ) n3 && r.push(n3);
              if (r.length > 0) t2 = Buffer.concat(r).toString();
              else if (e2.source.from._readableState && e2.source.from._readableState.buffer) {
                const n4 = e2.source.from._readableState.buffer, r3 = [];
                for (const e3 of n4) e3 && e3.chunk && r3.push(e3.chunk);
                r3.length > 0 && (t2 = Buffer.concat(r3).toString());
              }
            }
            if (!t2) return new Promise((t3, n3) => {
              const r = [];
              e2.source.from.on("data", (e3) => {
                r.push(e3);
              }), e2.source.from.on("end", async () => {
                try {
                  const i = Buffer.concat(r).toString();
                  await this.executeTemplate(i, e2, t3, n3);
                } catch (t4) {
                  n3(new Error(`failed to parse Resource "${e2.source.inPath}" as Template: ${t4}`));
                }
              }), e2.source.from.on("error", (e3) => {
                n3(e3);
              }), "function" == typeof e2.source.from.resume && e2.source.from.resume();
            });
            await this.executeTemplateSync(t2, e2);
          } catch (t2) {
            throw new Error(`failed to parse Resource "${e2.source.inPath}" as Template: ${t2}`);
          }
        }
        async executeTemplateSync(e2, t2) {
          const n3 = await this.templateExecutor.executeTemplate(t2.source.inPath, e2, this.data);
          t2.target.to.write(n3), t2.target.to.end();
        }
        async executeTemplate(e2, t2, n3, r) {
          try {
            await this.executeTemplateSync(e2, t2), n3();
          } catch (e3) {
            r(e3 instanceof Error ? e3 : new Error(String(e3)));
          }
        }
      }, TemplateClient = class {
        constructor(e2) {
          __publicField(this, "templateExecutor");
          this.templateExecutor = e2;
        }
        async executeAsTemplate(e2, t2, n3) {
          try {
            if (!e2) throw new Error("Resource is null or undefined");
            if ("function" != typeof e2.transform) throw new Error("Resource does not implement Transformer interface. Resource type: " + typeof e2);
            const r = new ExecuteAsTemplateTransform(this.templateExecutor, t2.replace(/\\/g, "/").replace(/^\/+/, ""), n3);
            return await e2.transform(r);
          } catch (e3) {
            throw e3;
          }
        }
      };
    } });
    var init_publisher2 = __esm2({ "internal/domain/resources/entity/publisher.ts"() {
      path24 = __toESM3(require("path")), init_log(), import_stream2 = require("stream"), log54 = getDomainLogger("resources", { component: "publisher" }), Publisher2 = class {
        constructor(e2, t2) {
          __publicField(this, "pubFs");
          __publicField(this, "urlSvc");
          this.pubFs = e2, this.urlSvc = t2;
        }
        async openPublishFileForWriting(e2) {
          const t2 = e2.replace(/^\/+/, "");
          try {
            const e3 = await this.pubFs.create(t2);
            return new FileWritable(e3);
          } catch (e3) {
            if ("ENOENT" === e3.code || e3.message.includes("ENOENT")) {
              const e4 = path24.dirname(t2);
              await this.pubFs.mkdirAll(e4, 511);
              const n3 = await this.pubFs.create(t2), r = n3.close.bind(n3);
              return n3.close = async () => {
                try {
                  await r();
                } catch (e5) {
                  throw log54.errorf("\u274C [Publisher.File.close] Error closing publish file (retry) %s, $s", t2, e5), e5;
                }
              }, new FileWritable(n3);
            }
            throw e3;
          }
        }
        async openFilesForWriting(...e2) {
          if (0 === e2.length) throw new Error("No filenames provided");
          const t2 = e2[0];
          return await this.openFileForWriting(t2);
        }
        async openFileForWriting(e2) {
          const t2 = path24.normalize(e2);
          try {
            return await this.pubFs.create(t2);
          } catch (e3) {
            if (!this.isFileNotFoundError(e3)) throw e3;
            const n3 = path24.dirname(t2);
            return await this.pubFs.mkdirAll(n3, 511), await this.pubFs.create(t2);
          }
        }
        isFileNotFoundError(e2) {
          var _a6, _b4;
          return e2 && ("ENOENT" === e2.code || ((_a6 = e2.message) == null ? void 0 : _a6.includes("no such file or directory")) || ((_b4 = e2.message) == null ? void 0 : _b4.includes("not found")));
        }
      }, FileWritable = class extends import_stream2.Writable {
        constructor(e2) {
          super();
          __publicField(this, "file");
          this.file = e2;
        }
        _write(e2, t2, n3) {
          this.file.write(e2).then(() => n3()).catch(n3);
        }
        _final(e2) {
          var _a6, _b4;
          (_b4 = (_a6 = this.file).sync) == null ? void 0 : _b4.call(_a6).then(() => this.file.close()).then(() => e2()).catch(e2);
        }
      };
    } });
    var init_http2 = __esm2({ "internal/domain/resources/entity/http.ts"() {
      init_log(), http2 = __toESM3(require("http")), https2 = __toESM3(require("https")), log55 = getDomainLogger("resources", { component: "http-client" }), HttpClient4 = class {
        constructor() {
          __publicField(this, "defaultTimeout", 3e4);
          __publicField(this, "defaultHeaders", { "User-Agent": "MDFriday-Resources/1.0.0" });
        }
        async fromRemote(e2, t2) {
          return new Promise((n3) => {
            try {
              const r = new URL(e2), i = "https:" === r.protocol, s2 = i ? https2 : http2, a = { ...this.defaultHeaders, ...t2 == null ? void 0 : t2.headers }, o = { hostname: r.hostname, port: r.port || (i ? 443 : 80), path: r.pathname + r.search, method: "GET", headers: a, timeout: (t2 == null ? void 0 : t2.timeout) || this.defaultTimeout }, l = s2.request(o, (r3) => {
                if (r3.statusCode && r3.statusCode >= 300 && r3.statusCode < 400 && r3.headers.location) return log55.infof("\u{1F504} [HttpClient.fromRemote] Redirecting from %s to %s", e2, r3.headers.location), void this.fromRemote(r3.headers.location, t2).then(n3);
                if (!r3.statusCode || r3.statusCode < 200 || r3.statusCode >= 300) return log55.errorf("\u274C [HttpClient.fromRemote] HTTP error %d when fetching %s: %s", r3.statusCode || 0, e2, r3.statusMessage || "Unknown error"), void n3(null);
                const i2 = [];
                r3.on("data", (e3) => {
                  i2.push(e3);
                }), r3.on("end", () => {
                  try {
                    const t3 = Buffer.concat(i2).toString("utf8");
                    log55.infof("\u2705 [HttpClient.fromRemote] Successfully fetched %d bytes from %s", t3.length, e2), n3(t3);
                  } catch (t3) {
                    log55.errorf("\u274C [HttpClient.fromRemote] Error converting response to string from %s: %s", e2, t3), n3(null);
                  }
                }), r3.on("error", (t3) => {
                  log55.errorf("\u274C [HttpClient.fromRemote] Response error when fetching %s: %s", e2, t3.message), n3(null);
                });
              });
              l.on("error", (t3) => {
                log55.errorf("\u274C [HttpClient.fromRemote] Request error when fetching %s: %s", e2, t3.message), n3(null);
              }), l.on("timeout", () => {
                l.destroy(), log55.errorf("\u274C [HttpClient.fromRemote] Request timeout when fetching %s", e2), n3(null);
              }), l.end();
            } catch (t3) {
              log55.errorf("\u274C [HttpClient.fromRemote] Error fetching content from %s: %s", e2, t3), n3(null);
            }
          });
        }
      };
    } });
    var init_resources = __esm2({ "internal/domain/resources/entity/resources.ts"() {
      init_resource(), init_resources2(), init_minifier(), init_integrity(), init_template4(), init_publisher2(), init_http2(), init_type6(), path25 = __toESM3(require("path")), import_crypto3 = require("crypto"), init_log(), log56 = getDomainLogger("resources", { component: "resources" }), Resources = class {
        constructor(e2) {
          __publicField(this, "cache", /* @__PURE__ */ new Map());
          __publicField(this, "workspace");
          __publicField(this, "fsSvc");
          __publicField(this, "urlSvc");
          __publicField(this, "templateSvc");
          __publicField(this, "publisher");
          __publicField(this, "minifierClient");
          __publicField(this, "integrityClient");
          __publicField(this, "templateClient", null);
          __publicField(this, "httpClient");
          this.workspace = e2, this.fsSvc = e2, this.urlSvc = e2, this.templateSvc = e2, this.publisher = new Publisher2(e2.publishFs(), e2), this.minifierClient = new MinifierClient(), this.integrityClient = new IntegrityClient(), this.templateClient = new TemplateClient(this.templateSvc), this.httpClient = new HttpClient4();
        }
        setTemplateSvc(e2) {
          this.templateSvc = e2, this.templateClient = new TemplateClient(e2);
        }
        async getResource(e2) {
          const t2 = path25.posix.normalize(e2), n3 = `${t2}__get`;
          if (this.cache.has(n3)) return this.cache.get(n3) || null;
          try {
            const e3 = this.workspace.assetsFs();
            if (!await e3.stat(t2)) return null;
            const r = async () => {
              const n4 = await e3.open(t2);
              return await this.createReadSeekCloser(n4);
            }, i = await this.buildResource(t2, r);
            return i && this.cache.set(n3, i), i;
          } catch (e3) {
            return log56.errorf("\u274C [Resources.getResource] Error getting resource %s, %s", t2, e3), null;
          }
        }
        async getResourceWithOpener(e2, t2) {
          const n3 = path25.posix.normalize(e2), r = `${n3}__get_with_opener`;
          if (this.cache.has(r)) return this.cache.get(r) || null;
          try {
            const e3 = await this.buildResource(n3, t2);
            return e3 && this.cache.set(r, e3), e3;
          } catch (e3) {
            return log56.errorf("\u274C [Resources.getResourceWithOpener] Error getting resource with opener %s, %s", n3, e3), null;
          }
        }
        async executeAsTemplate(e2, t2, n3) {
          if (!this.templateClient) throw new Error("Template client not available. Please set template client first.");
          const r = e2.key() + "-template-" + t2, i = this.cacheKey(r);
          if (this.cache.has(i)) return this.cache.get(i);
          try {
            const r3 = await this.templateClient.executeAsTemplate(e2, t2, n3);
            return r3 ? this.cache.set(i, r3) : log56.warnf("\u26A0\uFE0F [Resources.executeAsTemplate] Template execution returned null for resource %s", e2.key()), r3;
          } catch (t3) {
            throw log56.errorf("\u274C [Resources.executeAsTemplate] Error executing template %s, %s", e2.key(), t3), t3;
          }
        }
        async minify(e2) {
          if (!this.minifierClient) throw new Error("Minifier client not available. Please set minifier client first.");
          const t2 = e2.key() + "-minify", n3 = this.cacheKey(t2);
          if (this.cache.has(n3)) return this.cache.get(n3);
          try {
            const t3 = await this.minifierClient.minify(e2);
            return t3 ? this.cache.set(n3, t3) : log56.warnf("\u26A0\uFE0F [Resources.minify] Minification returned null for resource %s", e2.key()), t3;
          } catch (t3) {
            throw log56.errorf("\u274C [Resources.minify] Error minifying resource %s, %s", e2.key(), t3), t3;
          }
        }
        async fingerprint(e2) {
          const t2 = e2.key() + "-fingerprint", n3 = this.cacheKey(t2);
          if (this.cache.has(n3)) return this.cache.get(n3);
          try {
            const t3 = await this.integrityClient.fingerprint(e2);
            return t3 ? this.cache.set(n3, t3) : log56.warnf("\u26A0\uFE0F [Resources.fingerprint] Fingerprint operation returned null for resource %s", e2.key()), t3;
          } catch (t3) {
            throw log56.errorf("\u274C [Resources.fingerprint] Error fingerprinting resource %s, %s", e2.key(), t3), t3;
          }
        }
        async getRemote(e2) {
          const t2 = `${e2}__remote`;
          if (this.cache.has(t2)) return this.cache.get(t2) || null;
          try {
            const n3 = await this.httpClient.fromRemote(e2);
            if (!n3) return null;
            const r = async () => this.newReadSeekerNoOpCloserFromString(n3), i = await this.buildResource(e2, r);
            return i && this.cache.set(t2, i), i;
          } catch (t3) {
            return log56.errorf("\u274C [Resources.fromRemote] Error getting remote resource %s, %s", e2, t3), null;
          }
        }
        cacheKey(e2) {
          return (0, import_crypto3.createHash)("sha256").update(e2).digest("hex").substring(0, 16);
        }
        getMinifierClient() {
          return this.minifierClient;
        }
        getIntegrityClient() {
          return this.integrityClient;
        }
        setTemplateClient(e2) {
          this.templateClient = e2;
        }
        async buildResource(e2, t2) {
          try {
            const n3 = path25.extname(e2), r = this.getMediaTypeFromExtension(n3), i = ResourcePaths.newResourcePaths(e2, this.workspace);
            return new ResourceImpl(t2, r, i, {}, this.publisher);
          } catch (t3) {
            return log56.errorf("\u274C [Resources.buildResource] Error building resource for %s, %s", e2, t3), null;
          }
        }
        getMediaTypeFromExtension(e2) {
          const t2 = { ".js": { type: "text/javascript", mainType: "text", subType: "javascript" }, ".css": { type: "text/css", mainType: "text", subType: "css" }, ".html": { type: "text/html", mainType: "text", subType: "html" }, ".json": { type: "application/json", mainType: "application", subType: "json" }, ".svg": { type: "image/svg+xml", mainType: "image", subType: "svg+xml" }, ".xml": { type: "application/xml", mainType: "application", subType: "xml" }, ".txt": { type: "text/plain", mainType: "text", subType: "plain" } }, n3 = e2 ? t2[e2] || t2[".txt"] : t2[".html"], r = e2 ? e2.substring(1) : "html", i = e2 || ".html";
          return new MediaType({ type: n3.type, mainType: n3.mainType, subType: n3.subType, delimiter: ".", firstSuffix: { suffix: r, fullSuffix: i }, mimeSuffix: "", suffixesCSV: r });
        }
        async createReadSeekCloser(e2) {
          try {
            const t2 = [];
            let n3 = 0;
            try {
              for (; ; ) {
                const r3 = new Uint8Array(8192), i = await e2.read(r3);
                if (0 === i.bytesRead) break;
                n3 += i.bytesRead, t2.push(r3.slice(0, i.bytesRead));
              }
            } finally {
              await e2.close();
            }
            let r = "";
            if (t2.length > 0) {
              const e3 = new Uint8Array(n3);
              let i = 0;
              for (const n4 of t2) e3.set(n4, i), i += n4.length;
              r = new TextDecoder().decode(e3);
            }
            return this.newReadSeekerNoOpCloserFromString(r);
          } catch (t2) {
            try {
              await e2.close();
            } catch (t3) {
              log56.warnf("\u274C [Resources.createReadSeekCloser] Error closing file after read error %s, %s", e2.path, t3);
            }
            return this.newReadSeekerNoOpCloserFromString("");
          }
        }
        newReadSeekerNoOpCloserFromString(e2) {
          const { Readable: t2 } = require("stream"), n3 = new t2({ read() {
          } });
          return n3.push(e2), n3.push(null), Object.assign(n3, { seek: async (e3, t3) => 0, close: async () => Promise.resolve() });
        }
      };
    } });
    var init_resourcepaths = __esm2({ "internal/domain/resources/valueobject/resourcepaths.ts"() {
      path26 = __toESM3(require("path")), ResourcePaths = class e2 {
        constructor(e3 = "", t2 = "", n3 = "", r = "", i = [], s2 = "") {
          __publicField(this, "dir");
          __publicField(this, "baseDirTarget");
          __publicField(this, "baseDirLink");
          __publicField(this, "targetBasePaths");
          __publicField(this, "file");
          __publicField(this, "baseUrl", "");
          this.dir = e3, this.file = t2, this.baseDirTarget = n3, this.baseDirLink = r, this.targetBasePaths = i, this.baseUrl = s2;
        }
        static newResourcePaths(t2, n3) {
          const r = t2.replace(/\\/g, "/"), i = path26.posix.parse(r);
          let s2 = i.dir;
          return "/" === s2 && (s2 = ""), new e2(s2, i.base, n3.baseUrl(), n3.baseUrl(), [], n3.baseUrl());
        }
        join(...e3) {
          let t2 = "";
          for (let n3 = 0; n3 < e3.length; n3++) {
            const r = e3[n3];
            if (r) if ("" === t2) t2 = r;
            else {
              const e4 = !t2.endsWith("/") && !r.startsWith("/"), n4 = t2.endsWith("/") && r.startsWith("/");
              t2 += n4 ? r.substring(1) : e4 ? "/" + r : r;
            }
          }
          return t2.startsWith("/") && (t2 = t2.substring(1)), t2.endsWith("/") && t2.length > 1 && (t2 = t2.substring(0, t2.length - 1)), t2;
        }
        targetLink() {
          let e3 = this.join(this.baseDirLink, this.dir, this.file);
          return e3.startsWith("http://") || e3.startsWith("https://") || e3.startsWith("/") || (e3 = "/" + e3), e3;
        }
        targetPath() {
          return this.join(this.dir, this.file);
        }
        fromTargetPath(t2) {
          const n3 = t2.replace(/\\/g, "/"), r = path26.posix.parse(n3);
          let i = r.dir;
          return "/" === i && (i = ""), new e2(i, r.base, this.baseUrl, this.baseUrl, this.targetBasePaths, this.baseUrl);
        }
        pathDir() {
          return this.dir;
        }
        pathBaseDirTarget() {
          return this.baseDirTarget;
        }
        pathBaseDirLink() {
          return this.baseDirLink;
        }
        pathTargetBasePaths() {
          return this.targetBasePaths;
        }
        pathFile() {
          return this.file;
        }
      };
    } });
    var init_transformation = __esm2({ "internal/domain/resources/valueobject/transformation.ts"() {
      import_crypto4 = require("crypto"), ResourceTransformationKey = class e2 {
        constructor(e3, t2 = []) {
          this.name = e3, this.elements = t2;
        }
        static newResourceTransformationKey(t2, ...n3) {
          return new e2(t2, n3);
        }
        value() {
          if (0 === this.elements.length) return this.name;
          const e3 = this.hashElements(...this.elements);
          return `${this.name}_${e3}`;
        }
        hashElements(...e3) {
          const t2 = e3.map((e4) => String(e4)).join("|");
          return (0, import_crypto4.createHash)("sha256").update(t2).digest("hex").substring(0, 16);
        }
      };
    } });
    var init_resourcemetadata = __esm2({ "internal/domain/resources/valueobject/resourcemetadata.ts"() {
      ResourceMetadataImpl = class e2 {
        constructor(e3, t2, n3) {
          this.target = e3, this.mediaType = t2, this.metaData = n3;
        }
        marshal() {
          return JSON.stringify({ Target: this.target, MediaType: this.mediaType, Data: this.metaData });
        }
        static unmarshal(t2) {
          const n3 = JSON.parse(t2);
          return new e2(n3.Target, n3.MediaType, n3.Data || {});
        }
      };
    } });
    var init_resource2 = __esm2({ "internal/domain/resources/factory/resource.ts"() {
      init_resources();
    } });
    var init_resources2 = __esm2({ "internal/domain/resources/index.ts"() {
      init_type9(), init_resources(), init_resource(), init_minifier(), init_integrity(), init_template4(), init_resourcepaths(), init_transformation(), init_resourcemetadata(), init_resource2();
    } });
    var ssg_exports = {};
    function setDomainInstances(e2, t2, n3, r, i, s2, a) {
      siteCache = e2, contentCache = t2, fsCache = n3, configCache = r, modulesCache = i, resourcesCache = s2;
    }
    async function loadConfiguration(e2, t2) {
      const n3 = new OsFs(), r = import_path16.default.join(e2, "config.json");
      return await loadConfigWithParams(n3, r, e2, t2);
    }
    async function createFileSystem(e2, t2) {
      const n3 = { path: e2.getDir().getWorkingDir(), publish: e2.getDir().getPublishDir(), osFs: e2.fs() };
      return await createFs(n3, t2);
    }
    async function createContentEngine(e2, t2, n3, r) {
      const i = { baseUrl: () => t2.getRoot().baseUrl(), markdown: () => r, useInternalRenderer: () => t2.getMarkdown().useInternalRenderer(), isWikilinkEnabled: () => t2.getMarkdown().isWikilinkEnabled(), isTagEnabled: () => t2.getMarkdown().isTagEnabled(), isCalloutEnabled: () => t2.getMarkdown().isCalloutEnabled(), isLatexEnabled: () => t2.getMarkdown().isLatexEnabled(), isMermaidEnabled: () => t2.getMarkdown().isMermaidEnabled(), newFileMetaInfo: (t3) => e2.newFileMetaInfo(t3), newFileMetaInfoWithContent: (t3) => e2.newFileMetaInfoWithContent(t3), contentFs: () => e2.contentFs(), walkContent: (t3, n4, r3, i2) => e2.walkContent(t3, n4, r3, i2), walkI18n: (t3, n4, r3) => e2.walkI18n(t3, n4, r3), isLanguageValid: (e3) => t2.getLanguage().isLanguageValid(e3), getSourceLang: (e3) => n3.getSourceLang(e3), getLanguageIndex: (e3) => t2.getLanguage().getLanguageIndex(e3), getLanguageByIndex: (e3) => t2.getLanguage().getLanguageByIndex(e3), defaultLanguage: () => t2.getLanguage().defaultLanguage(), languageIndexes: () => t2.getLanguage().languageIndexes(), views: () => t2.getTaxonomy().getViews().map((e3) => {
        const t3 = e3.singular, n4 = e3.plural;
        return { singular: () => t3 || "", plural: () => n4 || "" };
      }) };
      return await createContent(i);
    }
    function createResourcesEngine(e2, t2) {
      return new Resources({ assetsFs: () => t2.assetsFs(), publishFs: () => t2.publishFs(), baseUrl: () => e2.getProvider().getString("baseURL") || "http://localhost", executeTemplate: async (e3, t3, n3) => {
        throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.");
      } });
    }
    async function createTemplateEngineFromFs(e2, t2, n3, r) {
      const i = function(e3, t3, n4) {
        const r3 = e3.getProvider().getString("baseURL") || "http://localhost";
        return { relURL: (e4) => t3.getURL().relURL(e4), absURL: (e4) => t3.getURL().absURL(e4, t3.isMultipleLanguage(), t3.languagePrefix()), urlize: (e4) => t3.getURL().urlize(e4), translate: (e4) => t3.translate(e4), relRefFrom: async (e4, t4) => [e4.path || "", null], title: () => e3.getProvider().getString("title") || "My Site", baseURL: () => r3, params: () => e3.getProvider().getParams("params"), menus: () => ({}), isMultiLanguage: () => e3.getLanguage().languageKeys().length > 1, version: () => "0.1.0", environment: () => "development", generator: () => "AuPro Static Site Generator", defaultLanguage: () => e3.getLanguage().defaultLanguage(), languageKeys: () => e3.getLanguage().languageKeys(), Get: async function(e4) {
          try {
            return await n4.getResource(e4);
          } catch (t4) {
            return log57.warn(`Resource not found: ${e4}`, t4), Promise.resolve(null);
          }
        }, GetRemote: async function(e4) {
          return await n4.getRemote(e4);
        }, Minify: async function(e4) {
          return await n4.minify(e4);
        }, Fingerprint: async function(e4) {
          return await n4.fingerprint(e4);
        }, ExecuteAsTemplate: async function(e4, t4, r4) {
          return await n4.executeAsTemplate(r4, e4, t4);
        } };
      }(t2, n3, r), s2 = { walk: e2.walkLayouts.bind(e2) };
      return await async function(e3, t3) {
        return new Factory2().createWithServices(e3, t3);
      }(s2, i);
    }
    async function createTemplateAdapter(e2, t2) {
      return { async lookupLayout(t3) {
        const [n3, r, i, s2] = await e2.findFirst(t3);
        return s2 ? { preparer: null, found: false } : i && n3 && r ? { preparer: { name: () => r, execute: async (e3) => {
          const [t4, r3] = await n3.Execute(e3);
          if (r3) throw log57.errorf("template exec error: %s", r3), r3;
          return t4;
        } }, found: true } : { preparer: null, found: false };
      }, async executeWithContext(e3, t3) {
        if (!e3) return "<html><body>Default template - no preparer</body></html>";
        try {
          return await e3.execute(t3);
        } catch (e4) {
          return log57.error(`\u274C Template execution error: ${e4}`), `<html><body>Template execution error: ${e4}</body></html>`;
        }
      } };
    }
    function createSiteForSSG(e2, t2, n3) {
      return function(e3) {
        const t3 = new Publisher(e3.publishFs()), n4 = new URL2(e3.baseUrl(), true), r = new Language2(e3), i = new Author2("MDFriday", "support@mdfriday.com"), s2 = new Organization2(), a = new Compiler("0.1.0"), o = new Site3(e3, e3, e3, e3, e3, e3, t3, i, s2, a, n4, null, r, null, e3.siteTitle()), l = function(e4, t4, n5) {
          return new NavigationFactory(e4, t4, n5);
        }(e3, e3, o);
        return o.navigation = l.createNavigation(), o.ref = new Ref({ home: { page: null }, sitePage: async (e4) => {
          const t4 = await o.sitePage(e4);
          return { relPermalink: () => t4.path ? t4.path() : "", permalink: () => t4.path ? t4.path() : "" };
        } }, e3, "/404.html"), o;
      }({ configParams: () => e2.getProvider().getParams("params"), siteTitle: () => e2.getProvider().getString("title") || "My Site", menus: () => ({}), isGoogleAnalyticsEnabled: () => e2.getService().isGoogleAnalyticsEnabled(), googleAnalyticsID: () => e2.getService().googleAnalyticsID(), isGoogleAnalyticsRespectDoNotTrack: () => e2.getService().isGoogleAnalyticsRespectDoNotTrack(), isDisqusEnabled: () => e2.getService().isDisqusEnabled(), disqusShortname: () => e2.getService().disqusShortname(), isXRespectDoNotTrack: () => e2.getService().isXRespectDoNotTrack(), isXDisableInlineCSS: () => e2.getService().isXDisableInlineCSS(), getConfiguredSocialPlatforms: () => e2.getSocial().getConfiguredPlatforms(), getSocialLink: (t3) => {
        const n4 = e2.getSocial().getSocialLink(t3);
        return n4 ? n4.url : "";
      }, getSocialTitle: (t3) => {
        const n4 = e2.getSocial().getSocialLink(t3);
        return n4 ? n4.title : "";
      }, globalPages: async (e3) => await n3.globalPages(e3), globalRegularPages: async () => await n3.globalRegularPages(), walkPages: async (e3, t3) => {
        await n3.walkPages(e3, t3);
      }, getPageSources: async (e3) => n3.getPageSources(e3), walkTaxonomies: async (e3, t3) => {
        await n3.walkTaxonomies(e3, t3);
      }, searchPage: async (e3, t3) => [], getPageFromPath: async (e3, t3) => {
        try {
          const r = n3.getPageFromPath(e3, t3);
          return r || log57.error(`\u26A0\uFE0F  Application.getPageFromPath: content domain returned null for path: "${t3}"`), r;
        } catch (e4) {
          return log57.error("\u274C Application.getPageFromPath error delegating to content domain:", e4), null;
        }
      }, getPageFromPathSync: (e3, t3) => {
        try {
          const r = n3.getPageFromPath(e3, t3);
          return r || log57.warn(`\u26A0\uFE0F  Application.getPageFromPathSync: content domain returned null for path: ${t3}`), r;
        } catch (e4) {
          return log57.error("\u274C Application.getPageFromPathSync error delegating to content domain:", e4), null;
        }
      }, getPageRef: async (e3, t3, n4) => null, translate: (e3, t3) => n3.translate(e3, t3), defaultLanguage: () => e2.getLanguage().defaultLanguage(), languageKeys: () => e2.getLanguage().languageKeys(), getLanguageIndex: (t3) => e2.getLanguage().getLanguageIndex(t3), getLanguageName: (t3) => e2.getLanguage().getLanguageName(t3), changeFreq: () => "weekly", priority: () => 0.5, generateSitemap: async () => ({ urls: [] }), publishFs: () => t2.publishFs(), staticFs: () => t2.staticFs(), copyStaticFiles: (e3, n4) => t2.copyStatic([e3], n4), workingDir: () => e2.getProvider().getString("workingDir") || process.cwd(), getResource: async (e3) => null, getResourceWithOpener: async (e3, t3) => ({ name: () => e3, readSeekCloser: t3, targetPath: () => e3 }), baseUrl: () => e2.getProvider().getString("baseURL") || "http://localhost" });
    }
    async function generateStaticSite(e2, t2, n3) {
      try {
        let r = performance.now();
        const i = await loadConfiguration(e2, t2);
        let s2 = performance.now();
        log57.info(`\u2705 Configuration loaded in ${(s2 - r).toFixed(2)} ms`);
        const a = n3;
        r = performance.now();
        const o = await async function(e3) {
          const t3 = { osFs: () => e3.fs(), projDir: () => e3.getDir().getWorkingDir(), moduleDir: () => e3.getDir().getThemesDir(), moduleCacheDir: () => e3.getDir().getThemesCacheDir(), importPaths: () => e3.getModule().importPaths(), defaultLanguageKey: () => e3.getLanguage().defaultLanguage(), otherLanguageKeys: () => e3.getLanguage().otherLanguageKeys(), getRelDir: (t4, n4) => e3.getLanguage().getRelDir(t4, n4) };
          return await async function(e4) {
            var _a6;
            try {
              const t4 = (_a6 = e4.httpClient) == null ? void 0 : _a6.call(e4), n4 = newHttpClient(e4.osFs(), void 0, void 0, t4), r3 = newZipExtractor(e4.osFs()), i2 = newModuleCache(e4.osFs(), e4.moduleCacheDir()), s3 = newModules(e4, n4, r3, i2);
              return await s3.load(), s3;
            } catch (e5) {
              const t4 = e5 instanceof Error ? e5.message : String(e5);
              throw log5.error(`Failed to create modules: ${t4}`), new ModuleError(`Failed to create modules: ${t4}`, "FACTORY_FAILED");
            }
          }(t3);
        }(i);
        s2 = performance.now(), log57.info(`\u2705 Modules created in ${(s2 - r).toFixed(2)} ms`), r = performance.now();
        const l = await createFileSystem(i, o);
        s2 = performance.now(), log57.info(`\u2705 Filesystem created in ${(s2 - r).toFixed(2)} ms`);
        const c = await createContentEngine(l, i, o, a), h3 = createSiteForSSG(i, l, c), u = createResourcesEngine(i, l), d = await createTemplateEngineFromFs(l, i, h3, u);
        u.setTemplateSvc({ executeTemplate: async (e3, t3, n4) => await d.executeRaw(e3, t3, n4) }), c.setTemplateSvc({ execute: async (e3, t3) => await d.executeShortcode(e3, t3) }), r = performance.now(), await c.collectPages(), s2 = performance.now(), log57.info(`\u2705 Pages collected in ${(s2 - r).toFixed(2)} ms`);
        const p2 = await createTemplateAdapter(d);
        r = performance.now(), await h3.build(p2), s2 = performance.now(), setDomainInstances(h3, c, l, i, o, u), log57.info(`\u2705 Site built in ${(s2 - r).toFixed(2)} ms`);
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C Static site generation failed: ${t3}`), new Error(`Failed to generate static site: ${t3}`);
      }
    }
    async function processSSG(e2, t2, n3) {
      try {
        const r = process.cwd();
        process.chdir(e2);
        try {
          await generateStaticSite(e2, t2, n3);
        } finally {
          process.chdir(r);
        }
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C SSG processing failed: ${t3}`), new Error(`Failed to process SSG: ${t3}`);
      }
    }
    async function generateStaticSiteWithProgress(e2, t2, n3, r, i) {
      try {
        r == null ? void 0 : r({ stage: "config", message: "Loading configuration...", percentage: 5 });
        const s2 = await loadConfiguration(e2, t2), a = n3;
        r == null ? void 0 : r({ stage: "modules", message: "Creating and downloading modules...", percentage: 10 });
        const o = await createModuleWithProgress(s2, r, i);
        r == null ? void 0 : r({ stage: "filesystem", message: "Creating filesystem...", percentage: 30 });
        const l = await createFileSystem(s2, o);
        r == null ? void 0 : r({ stage: "content", message: "Creating content engine...", percentage: 40 });
        const c = await createContentEngine(l, s2, o, a);
        r == null ? void 0 : r({ stage: "site", message: "Creating site...", percentage: 50 });
        const h3 = createSiteForSSG(s2, l, c), u = createResourcesEngine(s2, l);
        r == null ? void 0 : r({ stage: "template", message: "Creating template engine...", percentage: 60 });
        const d = await createTemplateEngineFromFs(l, s2, h3, u);
        u.setTemplateSvc({ executeTemplate: async (e3, t3, n4) => await d.executeRaw(e3, t3, n4) }), c.setTemplateSvc({ execute: async (e3, t3) => await d.executeShortcode(e3, t3) }), r == null ? void 0 : r({ stage: "pages", message: "Collecting pages...", percentage: 65 }), await c.collectPages(), r == null ? void 0 : r({ stage: "build", message: "Building site...", percentage: 70 });
        const p2 = await createTemplateAdapter(d);
        return await async function(e3, t3, n4) {
          const r3 = n4 ? (e4) => {
            const t4 = 70 + Math.floor(e4.currentPage / e4.totalPages * 29);
            n4({ stage: "build", message: `Rendering pages (${e4.currentPage}/${e4.totalPages})...`, percentage: t4, pageRender: e4 });
          } : void 0;
          await e3.buildWithProgress(t3, r3);
        }(h3, p2, r), r == null ? void 0 : r({ stage: "completion", message: "SSG generation completed", percentage: 100 }), setDomainInstances(h3, c, l, s2, o, u), createDomainInstances(siteCache, contentCache, fsCache, configCache, modulesCache, resourcesCache);
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C Static site generation failed: ${t3}`), new Error(`Failed to generate static site: ${t3}`);
      }
    }
    async function createModuleWithProgress(e2, t2, n3) {
      const r = { osFs: () => e2.fs(), projDir: () => e2.getDir().getWorkingDir(), moduleDir: () => e2.getDir().getThemesDir(), moduleCacheDir: () => e2.getDir().getThemesCacheDir(), importPaths: () => e2.getModule().importPaths(), defaultLanguageKey: () => e2.getLanguage().defaultLanguage(), otherLanguageKeys: () => e2.getLanguage().otherLanguageKeys(), getRelDir: (t3, n4) => e2.getLanguage().getRelDir(t3, n4), httpClient: n3 ? () => n3 : void 0 };
      return await async function(e3, t3) {
        const n4 = t3 ? (e4) => {
          t3({ stage: "modules", message: `Downloading module: ${e4.modulePath}`, percentage: 10 + Math.floor(0.2 * e4.downloadPercentage), moduleDownload: { modulePath: e4.modulePath, downloadPercentage: e4.downloadPercentage } });
        } : void 0;
        return await async function(e4, t4) {
          var _a6;
          try {
            const n5 = (_a6 = e4.httpClient) == null ? void 0 : _a6.call(e4), r3 = newHttpClient(e4.osFs(), void 0, void 0, n5), i = newZipExtractor(e4.osFs()), s2 = newModuleCache(e4.osFs(), e4.moduleCacheDir()), a = newModules(e4, r3, i, s2);
            return await a.load(t4), a;
          } catch (e5) {
            const t5 = e5 instanceof Error ? e5.message : String(e5);
            throw log5.error(`Failed to create modules: ${t5}`), new ModuleError(`Failed to create modules: ${t5}`, "FACTORY_FAILED");
          }
        }(e3, n4);
      }(r, t2);
    }
    async function processSSGWithProgress(e2, t2, n3, r, i) {
      try {
        const s2 = process.cwd();
        process.chdir(e2);
        try {
          await generateStaticSiteWithProgress(e2, t2, n3, r, i);
        } finally {
          process.chdir(s2);
        }
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C SSG processing failed: ${t3}`), new Error(`Failed to process SSG: ${t3}`);
      }
    }
    async function serveSSG(e2, t2, n3, r, i) {
      try {
        return process.chdir(e2), await generateStaticSiteWithProgress(e2, t2, n3, r, i);
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C SSG processing failed: ${t3}`), new Error(`Failed to process SSG: ${t3}`);
      }
    }
    async function collectAllPageTasks(e2, t2, n3, r, i) {
      if (tasks3.length > 0) return log57.info("Page tasks already collected, returning cached tasks"), tasks3;
      try {
        let s2 = performance.now();
        const a = await loadConfiguration(e2, t2);
        let o = performance.now();
        log57.info(`\u2705 Configuration loaded in ${(o - s2).toFixed(2)} ms`);
        const l = n3;
        s2 = performance.now();
        const c = await createModuleWithProgress(a, r, i);
        o = performance.now(), log57.info(`\u2705 Modules created in ${(o - s2).toFixed(2)} ms`), s2 = performance.now();
        const h3 = await createFileSystem(a, c);
        o = performance.now(), log57.info(`\u2705 Filesystem created in ${(o - s2).toFixed(2)} ms`);
        const u = await createContentEngine(h3, a, c, l), d = createSiteForSSG(a, h3, u), p2 = createResourcesEngine(a, h3), g = await createTemplateEngineFromFs(h3, a, d, p2);
        p2.setTemplateSvc({ executeTemplate: async (e3, t3, n4) => await g.executeRaw(e3, t3, n4) }), u.setTemplateSvc({ execute: async (e3, t3) => await g.executeShortcode(e3, t3) }), s2 = performance.now(), await u.collectPages(), o = performance.now(), log57.info(`\u2705 Pages collected in ${(o - s2).toFixed(2)} ms`), s2 = performance.now();
        const m2 = a.getLanguage().languageKeys();
        for (const e3 of m2) {
          const t3 = a.getLanguage().getLanguageIndex(e3);
          await u.walkPages(t3, async (t4) => {
            const n4 = t4.file().paths().base();
            tasks3.push({ language: e3, pagePath: n4 }), t4 && t4.pageIdentity && t4.pageIdentity().clearStale();
          }), log57.debug(`Collected pages for language: ${e3}`);
        }
        o = performance.now(), log57.info(`\u2705 Page tasks collected in ${(o - s2).toFixed(2)} ms`);
        const f3 = await createTemplateAdapter(g);
        return s2 = performance.now(), await d.build(f3), o = performance.now(), log57.info(`\u2705 Site built in ${(o - s2).toFixed(2)} ms`), setDomainInstances(d, u, h3, a, c, p2), tasks3;
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log57.error(`\u274C Static site generation failed: ${t3}`), new Error(`Failed to generate static site: ${t3}`);
      }
    }
    __export3(ssg_exports, { collectAllPageTasks: () => collectAllPageTasks, generateStaticSite: () => generateStaticSite, generateStaticSiteWithProgress: () => generateStaticSiteWithProgress, processSSG: () => processSSG, processSSGWithProgress: () => processSSGWithProgress, serveSSG: () => serveSSG });
    var init_ssg = __esm2({ "internal/application/ssg.ts"() {
      init_config3(), init_module6(), init_fs3(), init_content3(), init_template3(), init_site22(), init_log(), import_path16 = __toESM3(require("path")), init_resources2(), log57 = getDomainLogger("ssg", { component: "application" }), createDomainInstances = (e2, t2, n3, r, i, s2) => ({ site: e2, content: t2, fs: n3, config: r, modules: i, resources: s2 }), tasks3 = [];
    } });
    var foundry_exports = {};
    __export3(foundry_exports, { AutoIDGenerator: () => AutoIDGenerator2, IncrementalBuildCoordinator: () => IncrementalBuildCoordinator2, generateStaticSite: () => generateStaticSite, processSSG: () => processSSG, processSSGParallel: () => processSSGParallel, processSSGWithProgress: () => processSSGWithProgress, startIncrementalBuild: () => startIncrementalBuild2 }), module2.exports = __toCommonJS3(foundry_exports), init_ssg(), init_log(), init_log();
    var workerpool = __toESM3(require_workerpool());
    init_log(), init_page_filter();
    var log58 = getDomainLogger("application", { component: "worker-state" });
    var WorkerState = class {
      constructor(e2, t2) {
        __publicField(this, "initialized", false);
        this.projDir = e2, this.moduleDir = t2;
      }
      async initialize() {
        if (this.initialized) return void log58.warn("Worker already initialized, skipping...");
        const e2 = performance.now();
        log58.info("\u{1F680} Initializing worker environment...", { projDir: this.projDir, moduleDir: this.moduleDir }), this.initialized = true;
        const t2 = performance.now() - e2;
        log58.info(`\u2705 Worker environment initialized in ${t2.toFixed(2)}ms`);
      }
      async processBatch(e2) {
        if (!this.initialized) throw new Error("Worker not initialized. Call initialize() first.");
        const t2 = performance.now(), n3 = [];
        log58.info(`\u{1F4E6} Processing batch: ${e2.length} tasks`);
        try {
          r = e2, pageFilter.setFilter(r), log58.debug(`Filter set for ${e2.length} tasks`);
          const { generateStaticSite: i } = await Promise.resolve().then(() => (init_ssg(), ssg_exports));
          await i(this.projDir, this.moduleDir), log58.debug("\u2705 Tasks processed (filtered)");
          const s2 = performance.now() - t2, a = { success: true, processedCount: e2.length, totalCount: e2.length, duration: s2, errors: n3 };
          return log58.info(`\u2705 Batch processed: ${e2.length} tasks in ${s2.toFixed(2)}ms`), a;
        } catch (r3) {
          const i = `Batch processing failed: ${r3 instanceof Error ? r3.message : String(r3)}`;
          log58.error(`\u274C ${i}`), n3.push(i);
          const s2 = performance.now() - t2;
          return { success: false, processedCount: 0, totalCount: e2.length, duration: s2, errors: n3 };
        } finally {
          pageFilter.clearFilter();
        }
        var r;
      }
      async cleanup() {
        log58.info("\u{1F9F9} Cleaning up worker resources..."), this.initialized = false;
      }
      getStats() {
        return { initialized: this.initialized, projDir: this.projDir, moduleDir: this.moduleDir };
      }
    };
    init_log();
    var log59 = getDomainLogger("application", { component: "worker-main" });
    var workerState = null;
    async function handleWorkerTask(e2) {
      try {
        switch (e2.type) {
          case "init":
            return await async function(e3) {
              return e3.projDir && e3.moduleDir ? (log59.info("\u{1F527} Initializing worker..."), workerState = new WorkerState(e3.projDir, e3.moduleDir), await workerState.initialize(), { success: true, data: { message: "Worker initialized successfully" } }) : { success: false, error: "Missing projDir or moduleDir for init task" };
            }(e2);
          case "process-batch":
            return await async function(e3) {
              if (!workerState) return { success: false, error: "Worker not initialized. Call init task first." };
              if (!e3.pageTasks || 0 === e3.pageTasks.length) return { success: false, error: "Missing pageTasks for process-batch task" };
              const t2 = await workerState.processBatch(e3.pageTasks);
              return { success: t2.success, data: t2, error: t2.errors.length > 0 ? t2.errors.join("; ") : void 0 };
            }(e2);
          case "stats":
            return await async function() {
              return workerState ? { success: true, data: workerState.getStats() } : { success: false, error: "Worker not initialized" };
            }();
          case "cleanup":
            return await async function() {
              return workerState ? (await workerState.cleanup(), workerState = null, { success: true, data: { message: "Worker cleaned up successfully" } }) : { success: true, data: { message: "Worker already cleaned up" } };
            }();
          default:
            return { success: false, error: `Unknown task type: ${e2.type}` };
        }
      } catch (e3) {
        const t2 = e3 instanceof Error ? e3.message : String(e3);
        return log59.error(`Worker task failed: ${t2}`), { success: false, error: t2 };
      }
    }
    var os = __toESM3(require("os"));
    var log60 = getDomainLogger("application", { component: "pool-manager" });
    var WorkerPoolManager = class {
      constructor(e2 = {}) {
        __publicField(this, "pool", null);
        __publicField(this, "environment");
        __publicField(this, "workerCount");
        this.environment = this.detectEnvironment(), this.workerCount = e2.workerCount || this.calculateOptimalWorkerCount(), log60.info("Worker pool manager created", { environment: this.environment, workerCount: this.workerCount });
      }
      detectEnvironment() {
        if ("undefined" != typeof Worker && void 0 !== globalThis.window) return log60.debug("Detected Web Worker support (browser/Electron environment)"), "browser";
        if ("undefined" != typeof process && process.versions && process.versions.node) try {
          return require.resolve("worker_threads"), log60.debug("Detected Node.js Worker Threads support"), "node";
        } catch (e2) {
          return log60.debug("Node.js detected but worker_threads unavailable, falling back to browser mode"), "browser";
        }
        return log60.debug("Using browser mode as default"), "browser";
      }
      calculateOptimalWorkerCount() {
        if ("node" === this.environment) {
          const e2 = os.cpus().length;
          return Math.max(1, e2 - 1);
        }
        {
          const e2 = "undefined" != typeof navigator && navigator.hardwareConcurrency || 4;
          return Math.max(2, Math.min(e2 - 1, 4));
        }
      }
      async initialize() {
        if (this.pool) return void log60.warn("Worker pool already initialized");
        const e2 = performance.now();
        log60.info(`\u{1F680} Initializing ${this.environment} worker pool with ${this.workerCount} workers...`);
        try {
          "node" === this.environment ? await this.initializeNodePool() : await this.initializeBrowserPool();
          const t2 = performance.now() - e2;
          log60.info(`\u2705 Worker pool initialized in ${t2.toFixed(2)}ms`);
        } catch (t2) {
          const n3 = t2 instanceof Error ? t2.message : String(t2);
          if ("node" === this.environment) {
            log60.warn(`\u274C Node worker pool initialization failed: ${n3}`), log60.warn("\u{1F504} Attempting fallback to browser workers...");
            try {
              this.environment = "browser", await this.initializeBrowserPool();
              const t3 = performance.now() - e2;
              return void log60.info(`\u2705 Successfully initialized browser worker pool as fallback in ${t3.toFixed(2)}ms`);
            } catch (e3) {
              const t3 = e3 instanceof Error ? e3.message : String(e3);
              throw log60.error(`\u274C Fallback to browser workers also failed: ${t3}`), new Error(`Worker pool initialization failed. Node: ${n3}, Browser: ${t3}`);
            }
          }
          throw log60.error(`\u274C Failed to initialize worker pool: ${n3}`), t2;
        }
      }
      async initializeNodePool() {
        const e2 = require("path").join(__dirname, "worker", "worker-node.js");
        log60.debug(`Initializing Node.js worker pool with path: ${e2}`), this.pool = workerpool.pool(e2, { minWorkers: this.workerCount, maxWorkers: this.workerCount, workerType: "thread" }), log60.debug(`Node.js worker pool created with ${this.workerCount} workers`, { workerPath: e2 });
      }
      async initializeBrowserPool() {
        this.pool = workerpool.pool({ minWorkers: this.workerCount, maxWorkers: this.workerCount, workerType: "web" }), this.pool.proxy().then((e2) => {
          log60.debug(`Browser worker pool created with ${this.workerCount} workers`);
        });
      }
      async exec(e2) {
        if (!this.pool) throw new Error("Worker pool not initialized. Call initialize() first.");
        try {
          return "node" === this.environment ? await this.pool.exec("processTask", [e2]) : await this.pool.exec(handleWorkerTask, [e2]);
        } catch (e3) {
          const t2 = e3 instanceof Error ? e3.message : String(e3);
          return log60.error(`Worker task execution failed: ${t2}`), { success: false, error: t2 };
        }
      }
      getStats() {
        return this.pool ? { environment: this.environment, workerCount: this.workerCount, poolStats: this.pool.stats() } : null;
      }
      async terminate() {
        this.pool ? (log60.info("\u{1F9F9} Terminating worker pool..."), await this.pool.terminate(), this.pool = null, log60.info("\u2705 Worker pool terminated")) : log60.warn("Worker pool already terminated");
      }
    };
    init_log();
    var log61 = getDomainLogger("application", { component: "batch-task-queue" });
    var BatchTaskQueue = class {
      constructor(e2) {
        __publicField(this, "queue", []);
        __publicField(this, "currentIndex", 0);
        __publicField(this, "totalBatches");
        this.queue = e2, this.totalBatches = e2.length, log61.info(`Task queue initialized with ${this.totalBatches} batches`);
      }
      nextBatch() {
        if (this.currentIndex >= this.queue.length) return null;
        const e2 = this.queue[this.currentIndex];
        return this.currentIndex++, e2;
      }
      getProgress() {
        const e2 = this.currentIndex, t2 = this.totalBatches;
        return { completed: e2, total: t2, percentage: 0 === t2 ? 100 : Math.round(e2 / t2 * 100) };
      }
      hasMore() {
        return this.currentIndex < this.queue.length;
      }
      getRemainingCount() {
        return Math.max(0, this.queue.length - this.currentIndex);
      }
    };
    init_ssg();
    var os2 = __toESM3(require("os"));
    var log62 = getDomainLogger("ssg", { component: "parallel" });
    async function runWorkerLoop(e2, t2, n3, r, i, s2) {
      const a = [];
      for (; ; ) {
        const o = t2.nextBatch();
        if (!o) {
          log62.debug(`Worker ${n3} finished - no more tasks`);
          break;
        }
        const l = t2.getProgress();
        log62.info(`\u{1F504} Worker ${n3} processing batch ${l.completed}/${l.total} (${o.length} tasks)`);
        const c = { type: "process-batch", pageTasks: o }, h3 = await e2.exec(c);
        if (h3.success && h3.data) {
          const e3 = h3.data;
          a.push(e3), i.count += e3.processedCount;
          const t3 = 70 + Math.floor(i.count / r * 29);
          s2 == null ? void 0 : s2({ stage: "build", message: `Rendering pages (${i.count}/${r})...`, percentage: t3, pageRender: { currentPage: i.count, totalPages: r } }), log62.info(`\u2705 Worker ${n3} completed batch: ${e3.processedCount} tasks in ${e3.duration.toFixed(2)}ms`);
        } else log62.error(`\u274C Worker ${n3} failed: ${h3.error}`), a.push({ success: false, processedCount: 0, totalCount: o.length, duration: 0, errors: [h3.error || "Unknown error"] });
      }
      return a;
    }
    async function processSSGParallel(e2, t2, n3, r, i) {
      const s2 = performance.now(), a = process.cwd();
      process.chdir(e2);
      try {
        r == null ? void 0 : r({ stage: "config", message: "Initializing parallel SSG...", percentage: 5 }), r == null ? void 0 : r({ stage: "pages", message: "Collecting all page tasks...", percentage: 10 });
        const n4 = await collectAllPageTasks(e2, t2);
        if (0 === n4.length) return log62.warn("\u26A0\uFE0F  No page tasks found to process"), r == null ? void 0 : r({ stage: "completion", message: "No pages to process", percentage: 100 }), { totalPages: 0, totalBatches: 0, workerCount: 0, batchSize: 0, totalDuration: 0, parallelSpeedup: 0, pagesPerSecond: 0 };
        r == null ? void 0 : r({ stage: "config", message: `Found ${n4.length} pages, calculating optimal worker configuration...`, percentage: 20 });
        const i2 = os2.cpus().length, a2 = Math.max(2, Math.floor(0.6 * i2)), o = function(e3, t3) {
          const n5 = 4 * t3, r3 = Math.ceil(e3 / n5);
          return Math.max(5, Math.min(50, r3));
        }(n4.length, a2);
        log62.info(`\u2699\uFE0F  Using ${a2} workers with batch size ${o}`), r == null ? void 0 : r({ stage: "config", message: `Creating worker pool with ${a2} workers...`, percentage: 30 });
        const l = new WorkerPoolManager({ workerCount: a2 });
        await l.initialize(), r == null ? void 0 : r({ stage: "config", message: "Initializing workers...", percentage: 50 }), log62.info("\u{1F527} Initializing workers...");
        const c = performance.now(), h3 = [];
        for (let n5 = 0; n5 < a2; n5++) {
          const n6 = { type: "init", projDir: e2, moduleDir: t2 };
          h3.push(l.exec(n6));
        }
        await Promise.all(h3);
        const u = performance.now() - c;
        log62.info(`\u2705 All workers initialized in ${u.toFixed(2)}ms`), r == null ? void 0 : r({ stage: "build", message: `Creating ${Math.ceil(n4.length / o)} task batches...`, percentage: 65 });
        const d = function(e3, t3) {
          const n5 = [];
          for (let r3 = 0; r3 < e3.length; r3 += t3) n5.push(e3.slice(r3, r3 + t3));
          return log62.info(`\u{1F4E6} Created ${n5.length} batches (${t3} tasks per batch)`), n5;
        }(n4, o), p2 = new BatchTaskQueue(d);
        r == null ? void 0 : r({ stage: "build", message: "Starting parallel page rendering...", percentage: 70 }), log62.info("\u{1F3C3} Starting worker loops...");
        const g = performance.now(), m2 = { count: 0 }, f3 = [];
        for (let e3 = 0; e3 < a2; e3++) f3.push(runWorkerLoop(l, p2, e3, n4.length, m2, r));
        const _ = await Promise.all(f3), T = performance.now() - g, E = _.flat(), S = E.filter((e3) => e3.success).length, A = E.reduce((e3, t3) => e3 + t3.processedCount, 0), I = E.reduce((e3, t3) => e3 + t3.errors.length, 0);
        await l.terminate();
        const y = performance.now() - s2, w2 = A / y * 1e3, D = T / A * A / T;
        return r == null ? void 0 : r({ stage: "completion", message: `Parallel SSG completed! Processed ${A} pages with ${a2} workers`, percentage: 100 }), log62.info("\u2728 Parallel SSG completed!"), log62.info("\u{1F4CA} Statistics:", { totalTasks: n4.length, processedTasks: A, successfulBatches: S, failedBatches: E.length - S, totalErrors: I, totalDuration: `${y.toFixed(2)}ms`, processingDuration: `${T.toFixed(2)}ms`, pagesPerSecond: w2.toFixed(2), parallelSpeedup: `${D.toFixed(2)}x` }), { totalPages: n4.length, totalBatches: d.length, workerCount: a2, batchSize: o, totalDuration: y, parallelSpeedup: D, pagesPerSecond: w2 };
      } catch (e3) {
        const t3 = e3 instanceof Error ? e3.message : String(e3);
        throw log62.error(`\u274C Parallel SSG failed: ${t3}`), e3;
      } finally {
        process.chdir(a);
      }
    }
    init_ssg(), init_log();
    var chokidar = __toESM3(require_chokidar());
    var path28 = __toESM3(require("path"));
    init_log();
    var log63 = getDomainLogger("web", { component: "content-file-watcher" });
    var ContentFileWatcher = class {
      constructor(e2) {
        __publicField(this, "watcher", null);
        __publicField(this, "eventQueue", []);
        __publicField(this, "batchTimer", null);
        __publicField(this, "batchDelay");
        __publicField(this, "callbacks", []);
        this.config = e2, this.batchDelay = e2.batchDelay || 500;
      }
      async startWatching() {
        this.watcher && await this.stopWatching(), this.watcher = chokidar.watch(this.config.contentDirs, { ignored: [/(^|[\/\\])\../, /\.tmp$/, /\.swp$/, /~$/, /\.DS_Store$/, ...this.config.ignorePatterns || []], persistent: true, ignoreInitial: true, followSymlinks: true, awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 } }), this.watcher.on("add", (e2) => this.queueEvent(e2, "created")).on("change", (e2) => this.queueEvent(e2, "modified")).on("unlink", (e2) => this.queueEvent(e2, "deleted")).on("error", (e2) => {
          log63.error("File watcher error:", e2);
        });
      }
      onFileChange(e2) {
        this.callbacks.push(e2);
      }
      queueEvent(e2, t2) {
        let n3 = e2;
        const { projContentDirs: r, contentDirs: i } = this.config;
        for (let e3 = 0; e3 < r.length; e3++) {
          const t3 = r[e3];
          for (let e4 = 0; e4 < i.length; e4++) {
            const r3 = i[e4];
            if (t3 !== r3 && n3.startsWith(r3)) {
              n3 = t3 + n3.slice(r3.length);
              break;
            }
          }
        }
        const s2 = path28.normalize(n3);
        if (!this.isRelevantFile(s2)) return;
        const a = { filePath: s2, eventType: t2, timestamp: Date.now(), isMarkdown: this.isMarkdownFile(s2), isImage: this.isImageFile(s2) };
        this.eventQueue.push(a), this.scheduleBatch();
      }
      isRelevantFile(e2) {
        return this.isMarkdownFile(e2) || this.isImageFile(e2);
      }
      isMarkdownFile(e2) {
        const t2 = path28.extname(e2).toLowerCase();
        return ".md" === t2 || ".markdown" === t2;
      }
      isImageFile(e2) {
        const t2 = path28.extname(e2).toLowerCase();
        return [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".bmp"].includes(t2);
      }
      scheduleBatch() {
        this.batchTimer && clearTimeout(this.batchTimer), this.batchTimer = setTimeout(async () => {
          if (this.eventQueue.length > 0) {
            const e2 = this.deduplicateEvents(this.eventQueue);
            this.eventQueue = [];
            for (const t2 of this.callbacks) try {
              await t2(e2);
            } catch (e3) {
              log63.error("Error processing file change events:", e3);
            }
          }
        }, this.batchDelay);
      }
      deduplicateEvents(e2) {
        const t2 = /* @__PURE__ */ new Map();
        for (const n3 of e2) {
          const e3 = t2.get(n3.filePath);
          (!e3 || n3.timestamp > e3.timestamp) && t2.set(n3.filePath, n3);
        }
        return Array.from(t2.values());
      }
      async stopWatching() {
        this.batchTimer && (clearTimeout(this.batchTimer), this.batchTimer = null), this.watcher && (await this.watcher.close(), this.watcher = null), this.eventQueue = [], this.callbacks = [];
      }
    };
    var http3 = __toESM3(require("http"));
    var path29 = __toESM3(require("path"));
    var fs22 = __toESM3(require("fs/promises"));
    var import_ws = require_browser();
    init_log();
    var log64 = getDomainLogger("web", { component: "livereload-server" });
    var FoundryLiveReloadServer = class {
      constructor(e2) {
        __publicField(this, "httpServer", null);
        __publicField(this, "wsServer", null);
        __publicField(this, "clients", /* @__PURE__ */ new Set());
        __publicField(this, "running", false);
        __publicField(this, "config");
        this.config = { port: e2.port || 8091, host: e2.host || "localhost", livereloadPort: e2.livereloadPort || 35729, enableLiveReload: false !== e2.enableLiveReload, publicDir: e2.publicDir };
      }
      async start() {
        if (this.running) log64.warn("LiveReloadServer already running");
        else try {
          await this.startHttpServer(), this.config.enableLiveReload && await this.startLiveReloadServer(), this.running = true;
        } catch (e2) {
          throw log64.error("Failed to start LiveReloadServer:", e2), e2;
        }
      }
      async stop() {
        if (this.running) try {
          for (const e2 of this.clients) e2.close();
          this.clients.clear(), this.wsServer && (this.wsServer.close(), this.wsServer = null), this.httpServer && (await new Promise((e2) => {
            this.httpServer.close(() => e2());
          }), this.httpServer = null), this.running = false;
        } catch (e2) {
          log64.error("Error stopping LiveReloadServer:", e2);
        }
      }
      notifyReload(e2) {
        if (!this.config.enableLiveReload || 0 === this.clients.size) return;
        const t2 = { command: "reload", liveCSS: this.shouldLiveReloadCSS(e2), liveImg: this.shouldLiveReloadImages(e2) };
        if (e2 && 1 === e2.length) {
          const n4 = e2[0], r = path29.extname(n4).toLowerCase();
          ".css" === r ? (t2.path = n4, t2.liveCSS = true) : [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"].includes(r) && (t2.path = n4, t2.liveImg = true);
        }
        const n3 = JSON.stringify(t2);
        for (const e3 of this.clients) e3.readyState === import_ws.WebSocket.OPEN && e3.send(n3);
      }
      getUrl() {
        return `http://${this.config.host}:${this.config.port}`;
      }
      isServerRunning() {
        return this.running;
      }
      async startHttpServer() {
        this.httpServer = http3.createServer(async (e2, t2) => {
          try {
            await this.handleHttpRequest(e2, t2);
          } catch (e3) {
            log64.error("HTTP request error:", e3), t2.statusCode = 500, t2.end("Internal Server Error");
          }
        }), await new Promise((e2, t2) => {
          this.httpServer.listen(this.config.port, this.config.host, () => {
            e2();
          }), this.httpServer.on("error", (e3) => {
            "EADDRINUSE" === e3.code ? (this.config.port++, this.config.port < 8099 ? this.httpServer.listen(this.config.port, this.config.host) : t2(new Error("No available ports"))) : t2(e3);
          });
        });
      }
      async startLiveReloadServer() {
        this.wsServer = new import_ws.WebSocketServer({ port: this.config.livereloadPort, host: this.config.host }), this.wsServer.on("connection", (e2) => {
          this.clients.add(e2), e2.send(JSON.stringify({ command: "hello", protocols: ["http://livereload.com/protocols/official-7"], serverName: "foundry-livereload" })), e2.on("close", () => {
            this.clients.delete(e2);
          }), e2.on("message", (e3) => {
            try {
              JSON.parse(e3.toString());
            } catch (t2) {
              log64.error("Invalid LiveReload message:", e3.toString());
            }
          });
        }), this.wsServer.on("error", (e2) => {
          log64.error("LiveReload WebSocket server error:", e2);
        });
      }
      async handleHttpRequest(e2, t2) {
        const n3 = e2.url || "/";
        let r = this.resolveFilePath(n3);
        try {
          if ((await fs22.stat(r)).isDirectory()) {
            const e4 = path29.join(r, "index.html");
            try {
              await fs22.stat(e4), r = e4;
            } catch (e5) {
              return t2.statusCode = 404, void t2.end("Not Found");
            }
          }
          let e3 = await fs22.readFile(r);
          const n4 = this.getContentType(r);
          if (t2.setHeader("Content-Type", n4), n4.includes("text/html") && this.config.enableLiveReload) {
            const t3 = e3.toString(), n5 = this.getLiveReloadScript(), r3 = t3.replace(/<\/body>/i, `${n5}
</body>`);
            e3 = Buffer.from(r3, "utf8");
          }
          t2.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"), t2.setHeader("Pragma", "no-cache"), t2.setHeader("Expires", "0"), t2.statusCode = 200, t2.end(e3);
        } catch (e3) {
          if ("ENOENT" !== e3.code) throw e3;
          t2.statusCode = 404, t2.end("Not Found");
        }
      }
      resolveFilePath(e2) {
        const t2 = e2.split("?")[0].split("#")[0];
        let n3;
        try {
          n3 = decodeURIComponent(t2);
        } catch (e3) {
          log64.warn("Failed to decode URL:", t2, e3), n3 = t2;
        }
        const r = path29.normalize(n3).replace(/^(\.\.[\/\\])+/, ""), i = r.startsWith("/") ? r.slice(1) : r, s2 = path29.join(this.config.publicDir, i);
        return "win32" === process.platform && s2.length > 260 && log64.warn("Path too long for Windows filesystem:", s2), "win32" === process.platform && /[<>:"|?*\x00-\x1f]/.test(i) && log64.warn("Path contains invalid characters for Windows:", i), s2;
      }
      getContentType(e2) {
        return { ".html": "text/html; charset=utf-8", ".css": "text/css; charset=utf-8", ".js": "application/javascript; charset=utf-8", ".json": "application/json; charset=utf-8", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".svg": "image/svg+xml", ".webp": "image/webp", ".ico": "image/x-icon", ".woff": "font/woff", ".woff2": "font/woff2", ".ttf": "font/ttf", ".eot": "application/vnd.ms-fontobject", ".xml": "application/xml; charset=utf-8", ".txt": "text/plain; charset=utf-8" }[path29.extname(e2).toLowerCase()] || "application/octet-stream";
      }
      getLiveReloadScript() {
        return `
<script>
(function() {
  'use strict';
  
  var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
  var address = protocol + '//${this.config.host}:${this.config.livereloadPort}/livereload';
  var socket = new WebSocket(address);
  
  socket.onmessage = function(event) {
    var data = JSON.parse(event.data);
    
    if (data.command === 'reload') {
      if (data.liveCSS) {
        // \u70ED\u66F4\u65B0 CSS
        reloadCSS();
      } else if (data.liveImg) {
        // \u70ED\u66F4\u65B0\u56FE\u7247
        reloadImages();
      } else {
        // \u5B8C\u6574\u9875\u9762\u5237\u65B0
        window.location.reload();
      }
    }
  };
  
  socket.onopen = function() {
    console.log('LiveReload connected');
  };
  
  socket.onclose = function() {
    console.log('LiveReload disconnected');
    // \u5C1D\u8BD5\u91CD\u8FDE
    setTimeout(function() {
      window.location.reload();
    }, 1000);
  };
  
  function reloadCSS() {
    var links = document.querySelectorAll('link[rel="stylesheet"]');
    for (var i = 0; i < links.length; i++) {
      var link = links[i];
      var href = link.href;
      if (href) {
        var url = new URL(href);
        url.searchParams.set('_t', Date.now().toString());
        link.href = url.toString();
      }
    }
    console.log('CSS reloaded');
  }
  
  function reloadImages() {
    var images = document.querySelectorAll('img');
    for (var i = 0; i < images.length; i++) {
      var img = images[i];
      var src = img.src;
      if (src) {
        var url = new URL(src);
        url.searchParams.set('_t', Date.now().toString());
        img.src = url.toString();
      }
    }
    console.log('Images reloaded');
  }
})();
<\/script>`;
      }
      shouldLiveReloadCSS(e2) {
        return !!e2 && e2.some((e3) => ".css" === path29.extname(e3).toLowerCase());
      }
      shouldLiveReloadImages(e2) {
        if (!e2) return false;
        const t2 = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
        return e2.some((e3) => t2.includes(path29.extname(e3).toLowerCase()));
      }
    };
    var http4 = __toESM3(require("http"));
    var path30 = __toESM3(require("path"));
    var fs32 = __toESM3(require("fs/promises"));
    init_log();
    var log65 = getDomainLogger("web", { component: "electron-livereload-server" });
    var ElectronLiveReloadServer = class {
      constructor(e2) {
        __publicField(this, "httpServer", null);
        __publicField(this, "running", false);
        __publicField(this, "config");
        __publicField(this, "stateFilePath");
        this.config = { port: e2.port || 8091, host: e2.host || "localhost", livereloadPort: e2.livereloadPort || 35729, enableLiveReload: false !== e2.enableLiveReload, publicDir: e2.publicDir }, this.stateFilePath = path30.join(this.config.publicDir, ".foundry-livereload-state.json");
      }
      async start() {
        if (this.running) log65.warn("ElectronLiveReloadServer already running");
        else try {
          await this.startHttpServer(), this.config.enableLiveReload && await this.initStateFile(), this.running = true, log65.info(`ElectronLiveReloadServer started at ${this.getUrl()}`);
        } catch (e2) {
          throw log65.error("Failed to start ElectronLiveReloadServer:", e2), e2;
        }
      }
      async stop() {
        if (this.running) try {
          this.httpServer && (await new Promise((e2) => {
            this.httpServer.close(() => e2());
          }), this.httpServer = null);
          try {
            await fs32.unlink(this.stateFilePath);
          } catch (e2) {
          }
          this.running = false, log65.info("ElectronLiveReloadServer stopped");
        } catch (e2) {
          log65.error("Error stopping ElectronLiveReloadServer:", e2);
        }
      }
      notifyReload(e2) {
        if (!this.config.enableLiveReload) return;
        const t2 = { timestamp: Date.now(), command: "reload", liveCSS: this.shouldLiveReloadCSS(e2), liveImg: this.shouldLiveReloadImages(e2), ...e2 && { changedFiles: e2 } };
        if (e2 && 1 === e2.length) {
          const n3 = e2[0], r = path30.extname(n3).toLowerCase();
          (".css" === r || [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"].includes(r)) && (t2.path = n3);
        }
        this.writeStateFile(t2).catch((e3) => {
          log65.error("Failed to write state file:", e3);
        });
      }
      getUrl() {
        return `http://${this.config.host}:${this.config.port}`;
      }
      isServerRunning() {
        return this.running;
      }
      async initStateFile() {
        const e2 = { timestamp: Date.now(), command: "hello" };
        await this.writeStateFile(e2);
      }
      async writeStateFile(e2) {
        try {
          await fs32.writeFile(this.stateFilePath, JSON.stringify(e2), "utf8");
        } catch (e3) {
          log65.error("Failed to write LiveReload state file:", e3);
        }
      }
      async startHttpServer() {
        this.httpServer = http4.createServer(async (e2, t2) => {
          try {
            await this.handleHttpRequest(e2, t2);
          } catch (e3) {
            log65.error("HTTP request error:", e3), t2.statusCode = 500, t2.end("Internal Server Error");
          }
        }), await new Promise((e2, t2) => {
          this.httpServer.listen(this.config.port, this.config.host, () => {
            e2();
          }), this.httpServer.on("error", (e3) => {
            "EADDRINUSE" === e3.code ? (this.config.port++, this.config.port < 8099 ? this.httpServer.listen(this.config.port, this.config.host) : t2(new Error("No available ports"))) : t2(e3);
          });
        });
      }
      async handleHttpRequest(e2, t2) {
        const n3 = e2.url || "/";
        if (n3.startsWith("/.foundry-livereload-state.json")) try {
          const e3 = await fs32.readFile(this.stateFilePath, "utf8");
          return t2.setHeader("Content-Type", "application/json; charset=utf-8"), t2.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"), t2.setHeader("Pragma", "no-cache"), t2.setHeader("Expires", "0"), t2.statusCode = 200, void t2.end(e3);
        } catch (e3) {
          return void ("ENOENT" === e3.code ? (t2.statusCode = 404, t2.end("State file not found")) : (t2.statusCode = 500, t2.end("Internal Server Error")));
        }
        let r = this.resolveFilePath(n3);
        try {
          if ((await fs32.stat(r)).isDirectory()) {
            const e4 = path30.join(r, "index.html");
            try {
              await fs32.stat(e4), r = e4;
            } catch (e5) {
              return t2.statusCode = 404, void t2.end("Not Found");
            }
          }
          let e3 = await fs32.readFile(r);
          const n4 = this.getContentType(r);
          if (t2.setHeader("Content-Type", n4), n4.includes("text/html") && this.config.enableLiveReload) {
            const t3 = e3.toString(), n5 = this.getLiveReloadScript(), r3 = t3.replace(/<\/body>/i, `${n5}
</body>`);
            e3 = Buffer.from(r3, "utf8");
          }
          t2.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"), t2.setHeader("Pragma", "no-cache"), t2.setHeader("Expires", "0"), t2.statusCode = 200, t2.end(e3);
        } catch (e3) {
          if ("ENOENT" !== e3.code) throw e3;
          t2.statusCode = 404, t2.end("Not Found");
        }
      }
      resolveFilePath(e2) {
        const t2 = e2.split("?")[0].split("#")[0];
        let n3;
        try {
          n3 = decodeURIComponent(t2);
        } catch (e3) {
          log65.warn("Failed to decode URL:", t2, e3), n3 = t2;
        }
        const r = path30.normalize(n3).replace(/^(\.\.[\/\\])+/, ""), i = r.startsWith("/") ? r.slice(1) : r;
        return path30.join(this.config.publicDir, i);
      }
      getContentType(e2) {
        return { ".html": "text/html; charset=utf-8", ".css": "text/css; charset=utf-8", ".js": "application/javascript; charset=utf-8", ".json": "application/json; charset=utf-8", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".svg": "image/svg+xml", ".webp": "image/webp", ".ico": "image/x-icon", ".woff": "font/woff", ".woff2": "font/woff2", ".ttf": "font/ttf", ".eot": "application/vnd.ms-fontobject", ".xml": "application/xml; charset=utf-8", ".txt": "text/plain; charset=utf-8" }[path30.extname(e2).toLowerCase()] || "application/octet-stream";
      }
      getLiveReloadScript() {
        return `
<script>
(function() {
  'use strict';
  
  var stateFilePath = '/.foundry-livereload-state.json';
  var storageKey = 'foundry-livereload-last-timestamp';
  var lastTimestamp = 0;
  var pollInterval = 500; // 500ms \u8F6E\u8BE2\u95F4\u9694
  
  // \u4ECE localStorage \u6062\u590D\u4E0A\u6B21\u7684\u65F6\u95F4\u6233\uFF0C\u907F\u514D\u9875\u9762\u5237\u65B0\u540E\u91CD\u590D\u89E6\u53D1
  try {
    var stored = localStorage.getItem(storageKey);
    if (stored) {
      lastTimestamp = parseInt(stored, 10) || 0;
    }
  } catch (error) {
    // localStorage \u53EF\u80FD\u4E0D\u53EF\u7528\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u503C
    console.warn('LiveReload: localStorage not available, may cause duplicate reloads');
  }
  
  function checkForReload() {
    fetch(stateFilePath + '?_t=' + Date.now(), { cache: 'no-cache' })
      .then(function(response) {
        if (!response.ok) {
          throw new Error('Failed to fetch state file');
        }
        return response.json();
      })
      .then(function(state) {
        if (state.timestamp > lastTimestamp) {
          // \u66F4\u65B0\u65F6\u95F4\u6233\u5E76\u4FDD\u5B58\u5230 localStorage
          lastTimestamp = state.timestamp;
          try {
            localStorage.setItem(storageKey, lastTimestamp.toString());
          } catch (error) {
            // localStorage \u5199\u5165\u5931\u8D25\uFF0C\u5FFD\u7565
          }
          
          if (state.command === 'reload') {
            if (state.liveCSS) {
              // \u70ED\u66F4\u65B0 CSS
              reloadCSS();
            } else if (state.liveImg) {
              // \u70ED\u66F4\u65B0\u56FE\u7247
              reloadImages();
            } else {
              // \u5B8C\u6574\u9875\u9762\u5237\u65B0
              window.location.reload();
            }
          }
        }
      })
      .catch(function(error) {
        // \u9759\u9ED8\u5904\u7406\u9519\u8BEF\uFF0C\u907F\u514D\u63A7\u5236\u53F0\u566A\u97F3
      });
  }
  
  function reloadCSS() {
    var links = document.querySelectorAll('link[rel="stylesheet"]');
    for (var i = 0; i < links.length; i++) {
      var link = links[i];
      var href = link.href;
      if (href) {
        var url = new URL(href);
        url.searchParams.set('_t', Date.now().toString());
        link.href = url.toString();
      }
    }
    console.log('CSS reloaded');
  }
  
  function reloadImages() {
    var images = document.querySelectorAll('img');
    for (var i = 0; i < images.length; i++) {
      var img = images[i];
      var src = img.src;
      if (src) {
        var url = new URL(src);
        url.searchParams.set('_t', Date.now().toString());
        img.src = url.toString();
      }
    }
    console.log('Images reloaded');
  }
  
  // \u5F00\u59CB\u8F6E\u8BE2
  setInterval(checkForReload, pollInterval);
  
  // \u521D\u59CB\u68C0\u67E5
  checkForReload();
})();
<\/script>`;
      }
      shouldLiveReloadCSS(e2) {
        return !!e2 && e2.some((e3) => ".css" === path30.extname(e3).toLowerCase());
      }
      shouldLiveReloadImages(e2) {
        if (!e2) return false;
        const t2 = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
        return e2.some((e3) => t2.includes(path30.extname(e3).toLowerCase()));
      }
    };
    var log66 = getDomainLogger("build", { component: "incremental-coordinator" });
    var IncrementalBuildCoordinator2 = class {
      constructor(e2) {
        __publicField(this, "fileWatcher");
        __publicField(this, "liveReloadServer");
        __publicField(this, "buildInProgress", false);
        __publicField(this, "initialized", false);
        __publicField(this, "domainInstances");
        var _a6, _b4, _c2, _d;
        if (this.config = e2, e2.enableWatching) {
          const t2 = { contentDirs: e2.contentDirs, projContentDirs: e2.projContentDirs || e2.contentDirs, batchDelay: e2.batchDelay || 500 };
          this.fileWatcher = new ContentFileWatcher(t2), this.fileWatcher.onFileChange((e3) => this.handleFileChanges(e3));
        }
        if (false !== ((_a6 = e2.liveReload) == null ? void 0 : _a6.enabled)) {
          const t2 = { port: ((_b4 = e2.liveReload) == null ? void 0 : _b4.port) || 8091, host: ((_c2 = e2.liveReload) == null ? void 0 : _c2.host) || "localhost", livereloadPort: ((_d = e2.liveReload) == null ? void 0 : _d.livereloadPort) || 35729, publicDir: e2.publicDir, enableLiveReload: true };
          this.liveReloadServer = function(e3) {
            return function() {
              if ("undefined" != typeof globalThis && globalThis.window && globalThis.window.process && globalThis.window.process.type) return true;
              try {
                return require("electron"), true;
              } catch (e4) {
              }
              return !!(process.env.ELECTRON_RUN_AS_NODE || process.env.ELECTRON_NO_ATTACH_CONSOLE || process.versions && process.versions.electron);
            }() ? new ElectronLiveReloadServer(e3) : new FoundryLiveReloadServer(e3);
          }(t2);
        }
      }
      async initialize() {
        this.initialized ? log66.warn("IncrementalBuildCoordinator already initialized") : (await this.performFullBuildAndCacheDomains(), this.initialized = true);
      }
      async performFullBuildAndCacheDomains() {
        try {
          this.domainInstances = await serveSSG(this.config.projDir, this.config.modulesDir, this.config.markdown, this.config.progressCallback, this.config.httpClient);
        } catch (e2) {
          throw log66.error("Failed to perform full build and cache domains:", e2), e2;
        }
      }
      async startWatching() {
        if (!this.initialized) throw new Error("Must call initialize() before startWatching()");
        this.config.enableWatching && this.fileWatcher && await this.fileWatcher.startWatching(), this.liveReloadServer && await this.liveReloadServer.start();
      }
      async stopWatching() {
        this.fileWatcher && await this.fileWatcher.stopWatching(), this.liveReloadServer && await this.liveReloadServer.stop();
      }
      async handleFileChanges(e2) {
        if (this.buildInProgress) setTimeout(() => this.handleFileChanges(e2), 1e3);
        else try {
          if (this.buildInProgress = true, this.needFullRebuild(e2)) return void await this.performFullRebuild(e2);
          await this.performIncrementalBuild(e2);
        } finally {
          this.buildInProgress = false;
        }
      }
      needFullRebuild(e2) {
        return e2.some((e3) => "deleted" === e3.eventType || "created" === e3.eventType);
      }
      async performIncrementalBuild(e2) {
        if (!this.domainInstances) return log66.error("Domain instances not available, falling back to full rebuild"), void await this.performFullRebuild(e2);
        try {
          const t2 = await this.domainInstances.fs.getFileMetaInfos(this.getEventsFilePaths(e2));
          if (await this.domainInstances.content.handleChangeFiles(t2), await this.domainInstances.site.renderAllLanguages(), this.liveReloadServer) {
            const t3 = e2.map((e3) => e3.filePath);
            this.liveReloadServer.notifyReload(t3);
          }
        } catch (t2) {
          log66.error("Incremental build failed, falling back to full rebuild:", t2), await this.performFullRebuild(e2);
        }
      }
      getEventsFilePaths(e2) {
        return e2.map((e3) => e3.filePath);
      }
      async performFullRebuild(e2) {
        if (await processSSGWithProgress(this.config.projDir, this.config.modulesDir, this.config.markdown, (e3) => {
          log66.info(`Rebuild progress: ${e3.stage} - ${e3.percentage}%`);
        }, this.config.httpClient), this.liveReloadServer) {
          const t2 = e2.map((e3) => e3.filePath);
          this.liveReloadServer.notifyReload(t2);
        }
      }
      isInitialized() {
        return this.initialized;
      }
      isBuildInProgress() {
        return this.buildInProgress;
      }
      getConfig() {
        return { ...this.config };
      }
      getServerUrl() {
        return this.liveReloadServer ? this.liveReloadServer.getUrl() : "";
      }
      getLiveReloadStatus() {
        if (!this.liveReloadServer) return { running: false };
        const e2 = this.liveReloadServer.isServerRunning();
        return { running: e2, ...e2 && { url: this.liveReloadServer.getUrl() } };
      }
    };
    async function startIncrementalBuild2(e2) {
      const t2 = new IncrementalBuildCoordinator2(e2);
      return await t2.initialize(), e2.enableWatching && await t2.startWatching(), t2;
    }
    init_log(), getDomainLogger("build", { component: "incremental-ssg" }), init_markdown5(), init_page_filter();
  }
});

// src/markdown/obsidian-parser-result.ts
var ObsidianHeader, ObsidianTocFragments, ObsidianParsingResult;
var init_obsidian_parser_result = __esm({
  "src/markdown/obsidian-parser-result.ts"() {
    "use strict";
    ObsidianHeader = class {
      constructor(_text, _level, _id, _position) {
        this._text = _text;
        this._level = _level;
        this._id = _id;
        this._position = _position;
      }
      // Header interface methods
      name() {
        return this._text;
      }
      level() {
        return this._level;
      }
      links() {
        return [];
      }
      paragraphs() {
        return [];
      }
      listParagraphs() {
        return [];
      }
      // Additional methods for compatibility
      text() {
        return this._text;
      }
      id() {
        return this._id || this.generateId();
      }
      generateId() {
        return this._text.toLowerCase().replace(/[^\w\s\u4e00-\u9fff]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
      }
    };
    ObsidianTocFragments = class {
      constructor(items) {
        this.items = items;
      }
      toHTML() {
        if (this.items.length === 0) {
          return "";
        }
        return `<nav class="table-of-contents">
${this.renderItems(this.items)}
</nav>`;
      }
      toMarkdown() {
        if (this.items.length === 0) {
          return "";
        }
        return this.renderMarkdownItems(this.items, 0);
      }
      isEmpty() {
        return this.items.length === 0;
      }
      getItems() {
        return [...this.items];
      }
      renderItems(items, level = 0) {
        if (items.length === 0) return "";
        const indent = "  ".repeat(level);
        let html2 = `${indent}<ul>
`;
        for (const item of items) {
          html2 += `${indent}  <li>
`;
          html2 += `${indent}    <a href="#${item.anchor}">${this.escapeHtml(item.text)}</a>
`;
          if (item.children.length > 0) {
            html2 += this.renderItems(item.children, level + 2);
          }
          html2 += `${indent}  </li>
`;
        }
        html2 += `${indent}</ul>
`;
        return html2;
      }
      renderMarkdownItems(items, level) {
        let markdown = "";
        for (const item of items) {
          const indent = "  ".repeat(level);
          markdown += `${indent}- [${item.text}](#${item.anchor})
`;
          if (item.children.length > 0) {
            markdown += this.renderMarkdownItems(item.children, level + 1);
          }
        }
        return markdown;
      }
      escapeHtml(text3) {
        return text3.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
      }
    };
    ObsidianParsingResult = class {
      constructor(plugin2, file, source2) {
        this.plugin = plugin2;
        this.file = file;
        this.source = source2;
        this._headers = [];
        this.buildFromMetadata();
      }
      headers() {
        return [...this._headers];
      }
      tableOfContents() {
        return this._toc;
      }
      /**
       * 从 Obsidian 的 MetadataCache 构建解析结果
       */
      buildFromMetadata() {
        const metadata = this.plugin.app.metadataCache.getFileCache(this.file);
        if (metadata == null ? void 0 : metadata.headings) {
          this._headers = this.buildHeaders(metadata.headings);
          this._toc = this.buildTableOfContents(metadata.headings);
        } else {
          this.parseFromSource();
        }
      }
      /**
       * 从标题缓存构建标题列表
       */
      buildHeaders(headings) {
        return headings.map((heading) => {
          var _a6;
          return new ObsidianHeader(
            heading.heading,
            heading.level,
            void 0,
            // Obsidian 的标题缓存没有直接的 ID
            ((_a6 = heading.position) == null ? void 0 : _a6.start) ? {
              line: heading.position.start.line,
              ch: heading.position.start.col
            } : void 0
          );
        });
      }
      /**
       * 从标题缓存构建目录
       */
      buildTableOfContents(headings) {
        const tocItems = this.buildTocItems(headings);
        return new ObsidianTocFragments(tocItems);
      }
      /**
       * 构建嵌套的目录结构
       */
      buildTocItems(headings) {
        const items = [];
        const stack2 = [];
        for (const heading of headings) {
          const tocItem = {
            text: heading.heading,
            level: heading.level,
            anchor: this.generateAnchor(heading.heading),
            children: []
          };
          while (stack2.length > 0 && stack2[stack2.length - 1].level >= heading.level) {
            stack2.pop();
          }
          if (stack2.length === 0) {
            items.push(tocItem);
          } else {
            stack2[stack2.length - 1].item.children.push(tocItem);
          }
          stack2.push({ item: tocItem, level: heading.level });
        }
        return items;
      }
      /**
       * 生成锚点 ID
       */
      generateAnchor(text3) {
        return text3.toLowerCase().replace(/[^\w\s\u4e00-\u9fff]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
      }
      /**
       * 从源码解析（备用方案）
       */
      parseFromSource() {
        const lines = this.source.split("\n");
        const headings = [];
        for (let i = 0; i < lines.length; i++) {
          const line = lines[i];
          const match3 = line.match(/^(#{1,6})\s+(.+)$/);
          if (match3) {
            const level = match3[1].length;
            const text3 = match3[2].trim();
            headings.push({
              text: text3,
              level,
              position: {
                start: { line: i, ch: 0 },
                end: { line: i, ch: line.length }
              }
            });
          }
        }
        this._headers = headings.map(
          (heading) => {
            var _a6;
            return new ObsidianHeader(heading.text, heading.level, void 0, (_a6 = heading.position) == null ? void 0 : _a6.start);
          }
        );
        const tocItems = this.buildTocItemsFromHeaders(headings);
        this._toc = new ObsidianTocFragments(tocItems);
      }
      /**
       * 从解析的标题构建目录项
       */
      buildTocItemsFromHeaders(headings) {
        const items = [];
        const stack2 = [];
        for (const heading of headings) {
          const tocItem = {
            text: heading.text,
            level: heading.level,
            anchor: heading.id || this.generateAnchor(heading.text),
            children: []
          };
          while (stack2.length > 0 && stack2[stack2.length - 1].level >= heading.level) {
            stack2.pop();
          }
          if (stack2.length === 0) {
            items.push(tocItem);
          } else {
            stack2[stack2.length - 1].item.children.push(tocItem);
          }
          stack2.push({ item: tocItem, level: heading.level });
        }
        return items;
      }
      /**
       * 获取文件信息
       */
      getFile() {
        return this.file;
      }
      /**
       * 获取源码
       */
      getSource() {
        return this.source;
      }
      /**
       * 获取元数据
       */
      getMetadata() {
        return this.plugin.app.metadataCache.getFileCache(this.file);
      }
      /**
       * 获取所有标题的扁平列表
       */
      getFlatHeaders() {
        return this._headers.map((header) => {
          const obsHeader = header;
          return {
            text: obsHeader.text(),
            level: header.level(),
            id: obsHeader.id()
          };
        });
      }
      /**
       * 按级别过滤标题
       */
      getHeadersByLevel(level) {
        return this._headers.filter((header) => header.level() === level);
      }
      /**
       * 获取指定范围的标题
       */
      getHeadersInRange(minLevel, maxLevel) {
        return this._headers.filter((header) => {
          const headerLevel = header.level();
          return headerLevel >= minLevel && headerLevel <= maxLevel;
        });
      }
    };
  }
});

// src/markdown/resource-processor.ts
var path3, fs2, ObsidianResourceProcessor;
var init_resource_processor = __esm({
  "src/markdown/resource-processor.ts"() {
    "use strict";
    path3 = __toESM2(require("path"), 1);
    fs2 = __toESM2(require("fs"), 1);
    ObsidianResourceProcessor = class {
      constructor(plugin2) {
        this.plugin = plugin2;
      }
      /**
       * 配置 ob-images 目录和 sitePath
       * @param obImagesDir ob-images 目录的绝对路径
       * @param sitePath 站点路径
       * @param selectedFolderName 用户选中的文件夹名称（用于内部链接转换）
       */
      configureImageOutput(obImagesDir, sitePath, selectedFolderName) {
        this.obImagesDir = obImagesDir;
        this.sitePath = sitePath;
        this.selectedFolderName = selectedFolderName;
      }
      /**
       * 处理相对路径资源（图片、附件等）
       * @param html HTML 内容
       * @param basePath 基准路径
       * @param options 处理选项
       */
      async processRelativeResources(html2, basePath, options = {}) {
        const {
          processInternalLinks = true,
          processRelativePaths = true
        } = options;
        let processedHtml = html2;
        if (processInternalLinks) {
          processedHtml = await this.processObsidianLinks(processedHtml, basePath);
        }
        if (processRelativePaths) {
          processedHtml = await this.processRelativePaths(processedHtml, basePath);
        }
        processedHtml = await this.processAppUrls(processedHtml);
        processedHtml = await this.processInternalLinks(processedHtml);
        return processedHtml;
      }
      /**
       * 处理 app:// 格式的图片 URL
       * @param html HTML 内容
       */
      async processAppUrls(html2) {
        if (!this.obImagesDir || !this.sitePath) {
          return html2;
        }
        const appUrlPattern = /<img([^>]*?)src=["'](app:\/\/[^"']+)["']([^>]*?)>/g;
        const matches = Array.from(html2.matchAll(appUrlPattern));
        let processedHtml = html2;
        for (const match3 of matches) {
          try {
            const [fullMatch, before, appUrl, after] = match3;
            const urlParts = appUrl.match(/^app:\/\/[^\/]+(.+?)(?:\?.*)?$/);
            if (!urlParts || !urlParts[1]) {
              continue;
            }
            const imagePath = this.normalizeAppUrlPath(urlParts[1]);
            const imageName = path3.basename(imagePath);
            try {
              await fs2.promises.access(imagePath);
            } catch (error2) {
              console.warn(`Image file not found: ${imagePath}`, error2);
              continue;
            }
            const targetPath = path3.join(this.obImagesDir, imageName);
            try {
              await fs2.promises.copyFile(imagePath, targetPath);
            } catch (copyError) {
              console.error(`Failed to copy image: ${imagePath}`, copyError);
              continue;
            }
            const newSrc = path3.posix.join(this.sitePath, "ob-images", imageName);
            const newImgTag = `<img${before}src="${newSrc}"${after}>`;
            processedHtml = processedHtml.replace(fullMatch, newImgTag);
          } catch (error2) {
            console.error(`Error processing app:// URL:`, error2);
          }
        }
        return processedHtml;
      }
      /**
       * 处理内部链接（指向 markdown 文件的链接）
       * 只处理带有 data-href 且以 app:// 开头的链接
       * 例如：<a data-href="app://xxx/path/to/file.md" href="file1" class="internal-link">file1</a>
       * @param html HTML 内容
       */
      async processInternalLinks(html2) {
        if (!this.sitePath || !this.selectedFolderName) {
          return html2;
        }
        let processedHtml = html2;
        const aTagPattern = /<a[^>]*data-href=["'](app:\/\/[^"']+)["'][^>]*>.*?<\/a>/g;
        const replacements = [];
        let match3;
        while ((match3 = aTagPattern.exec(html2)) !== null) {
          try {
            const fullATag = match3[0];
            const dataHref = match3[1];
            const urlParts = dataHref.match(/^app:\/\/[^\/]+(.+?)(?:\?.*)?$/);
            if (!urlParts || !urlParts[1]) {
              continue;
            }
            const fullPath = this.normalizeAppUrlPath(urlParts[1]);
            const folderPattern = path3.sep + this.selectedFolderName + path3.sep;
            const folderIndex = fullPath.indexOf(folderPattern);
            if (folderIndex === -1) {
              continue;
            }
            const relativePath = fullPath.substring(folderIndex + this.selectedFolderName.length + 2);
            const htmlPath = relativePath.replace(/\.md$/, ".html");
            const newHref = path3.posix.join(this.sitePath, htmlPath);
            const openTagMatch = fullATag.match(/^<a[^>]*>/);
            if (!openTagMatch) {
              continue;
            }
            const openTag = openTagMatch[0];
            const hrefMatch = openTag.match(/(?<!data-)href=["']([^"']+)["']/);
            if (hrefMatch) {
              const currentHref = hrefMatch[1];
              const newOpenTag = openTag.replace(
                /(?<!data-)href=["'][^"']*["']/,
                `href="${newHref}"`
              );
              const newFullATag = fullATag.replace(openTag, newOpenTag);
              replacements.push({
                original: fullATag,
                replacement: newFullATag
              });
            }
          } catch (error2) {
            console.error("Error processing internal link:", error2);
          }
        }
        for (const replacement of replacements) {
          processedHtml = processedHtml.replace(replacement.original, replacement.replacement);
        }
        return processedHtml;
      }
      /**
       * 处理 Obsidian 内部链接
       * @param html HTML 内容
       * @param basePath 基准路径
       */
      async processObsidianLinks(html2, basePath) {
        html2 = html2.replace(/!\[\[([^\]]+)\]\]/g, (match3, filename) => {
          const linkedFile = this.findLinkedFile(filename, basePath);
          if (linkedFile) {
            const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
            return `<img src="${resourcePath}" alt="${filename}">`;
          }
          return match3;
        });
        html2 = html2.replace(/(?<!!)\[\[([^\]]+)\]\]/g, (match3, filename) => {
          const linkedFile = this.findLinkedFile(filename, basePath);
          if (linkedFile) {
            const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
            return `<a href="${resourcePath}">${filename}</a>`;
          }
          return match3;
        });
        return html2;
      }
      /**
       * 处理相对路径
       * @param html HTML 内容
       * @param basePath 基准路径
       */
      async processRelativePaths(html2, basePath) {
        html2 = html2.replace(/<img([^>]*?)src=["']([^"']+)["']([^>]*?)>/g, (match3, before, src, after) => {
          if (!this.isAbsoluteOrDataUrl(src)) {
            const linkedFile = this.findLinkedFile(src, basePath);
            if (linkedFile) {
              const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
              return `<img${before}src="${resourcePath}"${after}>`;
            }
          }
          return match3;
        });
        html2 = html2.replace(/<a([^>]*?)href=["']([^"']+)["']([^>]*?)>/g, (match3, before, href, after) => {
          if (!this.isAbsoluteOrDataUrl(href)) {
            const linkedFile = this.findLinkedFile(href, basePath);
            if (linkedFile) {
              const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
              return `<a${before}href="${resourcePath}"${after}>`;
            }
          }
          return match3;
        });
        return html2;
      }
      /**
       * 查找链接的文件
       * @param filename 文件名或路径
       * @param basePath 基准路径
       */
      findLinkedFile(filename, basePath) {
        if (basePath) {
          const linkedFile = this.plugin.app.metadataCache.getFirstLinkpathDest(filename, basePath);
          if (linkedFile) {
            return linkedFile;
          }
        }
        const files = this.plugin.app.vault.getFiles();
        let foundFile = files.find((file) => file.name === filename);
        if (foundFile) {
          return foundFile;
        }
        const nameWithoutExt = filename.replace(/\.[^/.]+$/, "");
        foundFile = files.find((file) => {
          const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, "");
          return fileNameWithoutExt === nameWithoutExt;
        });
        if (foundFile) {
          return foundFile;
        }
        foundFile = files.find((file) => file.path.includes(filename));
        if (foundFile) {
          return foundFile;
        }
        return null;
      }
      /**
       * 规范化 app:// URL 中的文件路径，处理跨平台兼容性
       * @param rawPath 从 app:// URL 中提取的原始路径
       */
      normalizeAppUrlPath(rawPath) {
        let normalizedPath = decodeURIComponent(rawPath);
        if (process.platform === "win32") {
          if (/^\/[A-Za-z]:/.test(normalizedPath)) {
            normalizedPath = normalizedPath.substring(1);
          } else if (/^\\[A-Za-z]:/.test(normalizedPath)) {
            normalizedPath = normalizedPath.substring(1);
          } else if (/^[\/\\]+[A-Za-z]:/.test(normalizedPath)) {
            normalizedPath = normalizedPath.replace(/^[\/\\]+/, "");
          }
        }
        normalizedPath = path3.normalize(normalizedPath);
        return normalizedPath;
      }
      /**
       * 检查是否为绝对 URL 或 data URL
       * @param url URL 字符串
       */
      isAbsoluteOrDataUrl(url) {
        return url.startsWith("http") || url.startsWith("https") || url.startsWith("data:") || url.startsWith("app://") || url.startsWith("file://") || url.startsWith("//");
      }
      /**
       * 处理 HTML 中的所有资源引用
       * @param html HTML 内容
       * @param baseFile 基准文件
       */
      async processAllResources(html2, baseFile) {
        const basePath = baseFile == null ? void 0 : baseFile.path;
        let processedHtml = await this.processRelativeResources(html2, basePath, {
          processInternalLinks: true,
          processRelativePaths: true
        });
        processedHtml = await this.processMediaElements(processedHtml, basePath);
        return processedHtml;
      }
      /**
       * 处理媒体元素（音频、视频等）
       * @param html HTML 内容
       * @param basePath 基准路径
       */
      async processMediaElements(html2, basePath) {
        html2 = html2.replace(/<audio([^>]*?)src=["']([^"']+)["']([^>]*?)>/g, (match3, before, src, after) => {
          if (!this.isAbsoluteOrDataUrl(src)) {
            const linkedFile = this.findLinkedFile(src, basePath);
            if (linkedFile) {
              const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
              return `<audio${before}src="${resourcePath}"${after}>`;
            }
          }
          return match3;
        });
        html2 = html2.replace(/<video([^>]*?)src=["']([^"']+)["']([^>]*?)>/g, (match3, before, src, after) => {
          if (!this.isAbsoluteOrDataUrl(src)) {
            const linkedFile = this.findLinkedFile(src, basePath);
            if (linkedFile) {
              const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
              return `<video${before}src="${resourcePath}"${after}>`;
            }
          }
          return match3;
        });
        html2 = html2.replace(/<source([^>]*?)src=["']([^"']+)["']([^>]*?)>/g, (match3, before, src, after) => {
          if (!this.isAbsoluteOrDataUrl(src)) {
            const linkedFile = this.findLinkedFile(src, basePath);
            if (linkedFile) {
              const resourcePath = this.plugin.app.vault.adapter.getResourcePath(linkedFile.path);
              return `<source${before}src="${resourcePath}"${after}>`;
            }
          }
          return match3;
        });
        return html2;
      }
      /**
       * 获取文件的资源路径
       * @param file 文件对象
       */
      getResourcePath(file) {
        return this.plugin.app.vault.adapter.getResourcePath(file.path);
      }
      /**
       * 检查文件是否为媒体文件
       * @param file 文件对象
       */
      isMediaFile(file) {
        const mediaExtensions = [
          "jpg",
          "jpeg",
          "png",
          "gif",
          "svg",
          "webp",
          "bmp",
          "ico",
          "mp3",
          "wav",
          "ogg",
          "flac",
          "m4a",
          "aac",
          "mp4",
          "webm",
          "ogv",
          "mov",
          "avi",
          "mkv"
        ];
        const extension = file.extension.toLowerCase();
        return mediaExtensions.includes(extension);
      }
      /**
       * 获取所有媒体文件
       */
      getAllMediaFiles() {
        return this.plugin.app.vault.getFiles().filter((file) => this.isMediaFile(file));
      }
    };
  }
});

// src/markdown/dom-utils.ts
function analyzeRenderingComplexity(source2) {
  const detectedPatterns = [];
  let complexity = "simple" /* SIMPLE */;
  let suggestedTimeout = 50;
  const simplePatterns = [
    { pattern: /^[^$\[\]`%<]*$/, name: "\u7EAF\u6587\u672C", timeout: 0 }
  ];
  const basicPatterns = [
    { pattern: /\*\*.*?\*\*/, name: "\u7C97\u4F53", timeout: 50 },
    { pattern: /\*.*?\*/, name: "\u659C\u4F53", timeout: 50 },
    { pattern: /`.*?`/, name: "\u884C\u5185\u4EE3\u7801", timeout: 50 },
    { pattern: /^#+\s/, name: "\u6807\u9898", timeout: 50 },
    { pattern: /^\s*[-*+]\s/, name: "\u5217\u8868", timeout: 100 }
  ];
  const complexPatterns = [
    { pattern: /```[\s\S]*?```/, name: "\u4EE3\u7801\u5757", timeout: 200 },
    { pattern: /!\[.*?\]\(.*?\)/, name: "\u56FE\u7247\u94FE\u63A5", timeout: 300 },
    { pattern: /\[.*?\]\(.*?\)/, name: "\u94FE\u63A5", timeout: 150 },
    { pattern: /\|.*\|/, name: "\u8868\u683C", timeout: 200 },
    { pattern: /\[\[.*?\]\]/, name: "\u5185\u90E8\u94FE\u63A5", timeout: 300 }
  ];
  const heavyPatterns = [
    { pattern: /\$\$[\s\S]*?\$\$/, name: "\u6570\u5B66\u516C\u5F0F\u5757", timeout: 800 },
    { pattern: /\$[^$\n]+\$/, name: "\u884C\u5185\u6570\u5B66\u516C\u5F0F", timeout: 400 },
    { pattern: /```mermaid[\s\S]*?```/, name: "Mermaid\u56FE\u8868", timeout: 1e3 },
    { pattern: /```dataview[\s\S]*?```/, name: "Dataview\u67E5\u8BE2", timeout: 1200 },
    { pattern: /```chart[\s\S]*?```/, name: "\u56FE\u8868\u63D2\u4EF6", timeout: 800 },
    { pattern: /%%.+%%/, name: "\u63D2\u4EF6\u6CE8\u91CA", timeout: 300 },
    { pattern: /<canvas/, name: "Canvas\u5143\u7D20", timeout: 600 },
    { pattern: /class=".*plugin.*"/, name: "\u63D2\u4EF6\u7C7B\u540D", timeout: 500 },
    { pattern: /data-.*plugin/, name: "\u63D2\u4EF6\u6570\u636E\u5C5E\u6027", timeout: 500 }
  ];
  for (const { pattern, name, timeout } of heavyPatterns) {
    if (pattern.test(source2)) {
      detectedPatterns.push(name);
      complexity = "heavy" /* HEAVY */;
      suggestedTimeout = Math.max(suggestedTimeout, timeout);
    }
  }
  if (complexity === "simple" /* SIMPLE */) {
    for (const { pattern, name, timeout } of complexPatterns) {
      if (pattern.test(source2)) {
        detectedPatterns.push(name);
        complexity = "complex" /* COMPLEX */;
        suggestedTimeout = Math.max(suggestedTimeout, timeout);
      }
    }
  }
  if (complexity === "simple" /* SIMPLE */) {
    for (const { pattern, name, timeout } of basicPatterns) {
      if (pattern.test(source2)) {
        detectedPatterns.push(name);
        complexity = "basic" /* BASIC */;
        suggestedTimeout = Math.max(suggestedTimeout, timeout);
      }
    }
  }
  if (complexity === "simple" /* SIMPLE */) {
    for (const { pattern, name, timeout } of simplePatterns) {
      if (pattern.test(source2)) {
        detectedPatterns.push(name);
        suggestedTimeout = timeout;
        break;
      }
    }
  }
  return { complexity, suggestedTimeout, patterns: detectedPatterns };
}
function hasAsyncElements(container) {
  const asyncSelectors = [
    ".math",
    // 数学公式
    ".mermaid",
    // Mermaid 图表
    ".dataview",
    // Dataview
    ".chart",
    // 图表
    "canvas",
    // Canvas 元素
    "[data-plugin]",
    // 插件元素
    ".cm-editor",
    // CodeMirror 编辑器
    ".obsidian-search-match-highlight",
    // 搜索高亮
    ".internal-link"
    // 内部链接
  ];
  return asyncSelectors.some((selector) => container.querySelector(selector) !== null);
}
function waitForDomStable(container, timeout = 300, source2) {
  return new Promise((resolve) => {
    let timer = null;
    let changeCount = 0;
    const startTime = Date.now();
    if (source2) {
      const analysis = analyzeRenderingComplexity(source2);
      if (analysis.complexity === "simple" /* SIMPLE */) {
        resolve();
        return;
      }
      if (analysis.complexity === "basic" /* BASIC */) {
        timeout = Math.min(timeout, 100);
      } else {
        timeout = Math.min(analysis.suggestedTimeout, timeout);
      }
    }
    if (!hasAsyncElements(container)) {
      resolve();
      return;
    }
    let maxWaitTime = 2e3;
    if (source2) {
      const analysis = analyzeRenderingComplexity(source2);
      switch (analysis.complexity) {
        case "basic" /* BASIC */:
          maxWaitTime = 500;
          break;
        case "complex" /* COMPLEX */:
          maxWaitTime = 1500;
          break;
        case "heavy" /* HEAVY */:
          maxWaitTime = 3e3;
          break;
      }
    }
    const observer = new MutationObserver((mutations) => {
      changeCount++;
      const hasSignificantChange = mutations.some(
        (mutation) => {
          var _a6;
          return mutation.type === "childList" || mutation.type === "characterData" && ((_a6 = mutation.target.textContent) == null ? void 0 : _a6.trim()) || mutation.type === "attributes" && ["class", "style", "data-plugin", "data-rendered"].includes(mutation.attributeName || "");
        }
      );
      if (!hasSignificantChange) {
        return;
      }
      if (timer) clearTimeout(timer);
      timer = setTimeout(() => {
        observer.disconnect();
        resolve();
      }, timeout);
    });
    observer.observe(container, {
      childList: true,
      subtree: true,
      characterData: true,
      attributes: true,
      attributeFilter: ["class", "style", "data-plugin", "data-rendered"]
      // 只监听重要属性
    });
    const maxTimer = setTimeout(() => {
      observer.disconnect();
      if (timer) clearTimeout(timer);
      resolve();
    }, maxWaitTime);
    timer = setTimeout(() => {
      observer.disconnect();
      clearTimeout(maxTimer);
      resolve();
    }, timeout);
  });
}
function createRenderContainer(theme, width = "1000px") {
  const container = document.createElement("div");
  container.addClass("markdown-preview-view", "markdown-rendered");
  const bodyClasses = document.body.className;
  if (bodyClasses.includes("theme-light") || bodyClasses.includes("theme-dark")) {
    container.className += " " + bodyClasses;
  }
  if (theme) {
    container.addClass(theme);
  }
  container.style.position = "absolute";
  container.style.top = "-9999px";
  container.style.left = "-9999px";
  container.style.width = width;
  container.style.visibility = "hidden";
  document.body.appendChild(container);
  return container;
}
function cleanupContainer(container) {
  try {
    if (container && container.parentNode) {
      container.parentNode.removeChild(container);
    }
  } catch (error2) {
    console.warn("\u6E05\u7406\u5BB9\u5668\u65F6\u51FA\u9519:", error2);
  }
}
function getCurrentTheme() {
  return document.body.classList.contains("theme-dark") ? "theme-dark" : "theme-light";
}
function waitForResourcesLoaded(container, timeout = 3e3) {
  return new Promise((resolve) => {
    const images = container.querySelectorAll("img");
    const videos = container.querySelectorAll("video");
    const iframes = container.querySelectorAll("iframe");
    const allElements = [...Array.from(images), ...Array.from(videos), ...Array.from(iframes)];
    if (allElements.length === 0) {
      resolve();
      return;
    }
    let loadedCount = 0;
    const totalCount = allElements.length;
    const checkComplete = () => {
      loadedCount++;
      if (loadedCount >= totalCount) {
        resolve();
      }
    };
    const timeoutId = setTimeout(() => {
      resolve();
    }, timeout);
    allElements.forEach((element2) => {
      if (element2 instanceof HTMLImageElement) {
        if (element2.complete) {
          checkComplete();
        } else {
          element2.addEventListener("load", () => {
            checkComplete();
          });
          element2.addEventListener("error", () => {
            checkComplete();
          });
        }
      } else if (element2 instanceof HTMLVideoElement) {
        if (element2.readyState >= 2) {
          checkComplete();
        } else {
          element2.addEventListener("loadeddata", () => {
            checkComplete();
          });
          element2.addEventListener("error", () => {
            checkComplete();
          });
        }
      } else if (element2 instanceof HTMLIFrameElement) {
        element2.addEventListener("load", () => {
          checkComplete();
        });
        element2.addEventListener("error", () => {
          checkComplete();
        });
      }
    });
    if (loadedCount >= totalCount) {
      clearTimeout(timeoutId);
    }
  });
}
var init_dom_utils = __esm({
  "src/markdown/dom-utils.ts"() {
    "use strict";
  }
});

// src/markdown/base-renderer.ts
var import_obsidian11, import_foundry, BaseRenderer;
var init_base_renderer = __esm({
  "src/markdown/base-renderer.ts"() {
    "use strict";
    import_obsidian11 = require("obsidian");
    import_foundry = __toESM2(require_dist3(), 1);
    init_obsidian_parser_result();
    init_resource_processor();
    init_dom_utils();
    BaseRenderer = class {
      constructor(plugin2, options = {}) {
        this.plugin = plugin2;
        this.options = {
          autoHeadingID: true,
          containerWidth: "800px",
          waitForStable: false,
          timeout: 100,
          baseFile: void 0,
          ...options
        };
        this.resourceProcessor = new ObsidianResourceProcessor(plugin2);
      }
      /**
       * 解析Markdown结构
       */
      async parse(source2) {
        try {
          const virtualFile = this.createVirtualFile(source2);
          return new ObsidianParsingResult(this.plugin, virtualFile, source2);
        } catch (error2) {
          console.error("BaseRenderer\u89E3\u6790\u5931\u8D25:", error2);
          throw new Error(`\u89E3\u6790\u5931\u8D25: ${error2.message}`);
        }
      }
      /**
       * 使用Obsidian渲染引擎进行基础渲染
       */
      async renderWithObsidian(source2, includeTheme, customContainerWidth, waitForResources) {
        const virtualFile = this.createVirtualFile(source2);
        const theme = includeTheme ? getCurrentTheme() : void 0;
        const containerWidth = customContainerWidth || this.options.containerWidth;
        const container = createRenderContainer(theme, containerWidth);
        try {
          await import_obsidian11.MarkdownRenderer.render(
            this.plugin.app,
            source2,
            container,
            virtualFile.path,
            this.plugin
          );
          if (this.options.waitForStable) {
            await waitForDomStable(container, this.options.timeout, source2);
          }
          if (waitForResources) {
            await waitForResourcesLoaded(container, 3e3);
          }
          return container.innerHTML;
        } finally {
          cleanupContainer(container);
        }
      }
      /**
       * 确保标题有ID（如果需要）
       */
      ensureHeadingIDs(html2) {
        if (!this.options.autoHeadingID) {
          return html2;
        }
        const idGenerator = new import_foundry.AutoIDGenerator();
        return html2.replace(/<h([1-6])(?![^>]*\sid=)([^>]*)>([^<]+)<\/h[1-6]>/g, (match3, level, attrs, text3) => {
          const id = idGenerator.generateID(text3.trim());
          return `<h${level}${attrs} id="${id}">${text3}</h${level}>`;
        });
      }
      /**
       * 处理资源路径
       */
      async processResources(html2, baseFile) {
        return await this.resourceProcessor.processAllResources(
          html2,
          this.options.baseFile || baseFile
        );
      }
      /**
       * 创建虚拟文件
       */
      createVirtualFile(source2, customName) {
        const timestamp = Date.now();
        const randomId = Math.random().toString(36).substring(2, 8);
        const fileName = customName || `virtual_${timestamp}_${randomId}.md`;
        const baseName = fileName.replace(/\.md$/, "");
        return {
          path: fileName,
          name: fileName,
          basename: baseName,
          extension: "md",
          parent: null,
          vault: this.plugin.app.vault,
          stat: {
            ctime: timestamp,
            mtime: timestamp,
            size: source2.length
          }
        };
      }
      /**
       * 获取配置
       */
      getOptions() {
        return { ...this.options };
      }
      /**
       * 设置基准文件
       */
      setBaseFile(file) {
        this.options.baseFile = file;
      }
      /**
       * 获取资源处理器实例
       */
      getResourceProcessor() {
        return this.resourceProcessor;
      }
      /**
       * 更新配置
       */
      updateOptions(options) {
        this.options = {
          ...this.options,
          ...options
        };
      }
    };
  }
});

// src/markdown/style-renderer.ts
var StyleRenderer;
var init_style_renderer = __esm({
  "src/markdown/style-renderer.ts"() {
    "use strict";
    init_base_renderer();
    StyleRenderer = class extends BaseRenderer {
      constructor(plugin2, options = {}) {
        const defaultOptions = {
          autoHeadingID: true,
          containerWidth: "800px",
          waitForStable: false,
          timeout: 100,
          ...options
        };
        super(plugin2, defaultOptions);
      }
      /**
       * 渲染Markdown为HTML
       * @param source Markdown源码
       */
      async render(source2) {
        try {
          let html2 = await this.renderWithObsidian(source2, false);
          html2 = this.ensureHeadingIDs(html2);
          html2 = await this.processResources(html2);
          return html2;
        } catch (error2) {
          console.error("StyleRenderer\u6E32\u67D3\u5931\u8D25:", error2);
          throw new Error(`\u6E32\u67D3\u5931\u8D25: ${error2.message}`);
        }
      }
      /**
       * 获取配置（重写基类方法以返回正确的类型）
       */
      getOptions() {
        return super.getOptions();
      }
    };
  }
});

// src/markdown/css-collector.ts
var ObsidianCSSCollector;
var init_css_collector = __esm({
  "src/markdown/css-collector.ts"() {
    "use strict";
    ObsidianCSSCollector = class {
      constructor(plugin2) {
        this.plugin = plugin2;
        this.options = {};
      }
      /**
       * 直接从 Obsidian 内部获取 app.css 内容
       */
      async getObsidianAppCSS() {
        if (!this.options.includeAppCSS) {
          return "";
        }
        try {
          const appCssUrl = "app://obsidian.md/app.css";
          try {
            const response = await fetch(appCssUrl);
            if (response.ok) {
              return await response.text();
            }
          } catch (e2) {
            console.error("fetch app.css \u5931\u8D25\uFF0C\u5C1D\u8BD5\u5176\u4ED6\u65B9\u6CD5:", e2.message);
          }
          return "";
        } catch (error2) {
          console.error("\u83B7\u53D6 app.css \u65F6\u51FA\u9519:", error2);
          return "";
        }
      }
      /**
       * 获取当前 Obsidian 已加载的全部 CSS 规则
       */
      async getAllLoadedCSS() {
        let additionalCSS = "";
        let skippedSheets = [];
        const appCSS = await this.getObsidianAppCSS();
        for (const sheet of Array.from(document.styleSheets)) {
          try {
            const rules = sheet.cssRules || sheet.rules;
            if (!rules) continue;
            if (sheet.href && sheet.href.includes("app.css")) {
              continue;
            }
            for (const rule of Array.from(rules)) {
              additionalCSS += rule.cssText + "\n";
            }
          } catch (e2) {
            if (sheet.href) {
              skippedSheets.push(sheet.href);
              console.warn("\u65E0\u6CD5\u8BFB\u53D6\u6837\u5F0F\u8868:", sheet.href, e2);
            }
          }
        }
        const baseStyles = "";
        return {
          appCSS,
          additionalCSS,
          baseStyles,
          skippedSheets
        };
      }
      /**
       * 获取基础的 Obsidian 样式规则（类似 export-html.ts）
       * 这些是一些关键的样式，确保基本的显示效果
       */
      getObsidianBaseStyles() {
        return "";
      }
      /**
       * 收集所有 CSS 并组装成完整样式
       */
      async collectAllCSS(options = {}) {
        const {
          includeAppCSS = true,
          includeBaseStyles = true
        } = options;
        this.options = options;
        const result = await this.getAllLoadedCSS();
        let fullCSS = "";
        if (includeBaseStyles) {
          fullCSS += "/* Obsidian Base Styles (fallback styles with defaults) */\n";
          fullCSS += this.getObsidianBaseStyles() + "\n\n";
        }
        if (includeAppCSS && result.appCSS) {
          fullCSS += "/* Obsidian Core Styles (app.css) */\n";
          fullCSS += result.appCSS + "\n\n";
        }
        if (result.additionalCSS) {
          fullCSS += "/* Obsidian Plugin and Theme Styles */\n";
          fullCSS += result.additionalCSS + "\n\n";
        }
        return fullCSS;
      }
    };
  }
});

// src/markdown/obsidian-renderer.ts
var _OBStyleRenderer, OBStyleRenderer;
var init_obsidian_renderer = __esm({
  "src/markdown/obsidian-renderer.ts"() {
    "use strict";
    init_css_collector();
    init_base_renderer();
    init_dom_utils();
    _OBStyleRenderer = class _OBStyleRenderer extends BaseRenderer {
      constructor(plugin2, options = {}) {
        const defaultOptions = {
          autoHeadingID: true,
          // 默认启用自动标题ID
          includeCSS: true,
          waitForPlugins: true,
          waitForStable: true,
          // OB渲染器需要等待插件
          timeout: 500,
          containerWidth: "1000px",
          includeTheme: true,
          ...options
        };
        super(plugin2, defaultOptions);
        this.context = {
          plugin: plugin2,
          options: defaultOptions
        };
        this.cssCollector = new ObsidianCSSCollector(plugin2);
      }
      /**
       * 渲染 Markdown 源码为 HTML
       * @param source Markdown 源码
       */
      async render(source2) {
        try {
          const tempFile = this.createVirtualFile(source2);
          let html2 = await this.renderWithObsidian(
            source2,
            this.context.options.includeTheme,
            this.context.options.containerWidth,
            this.context.options.waitForPlugins
            // 传递是否等待插件加载
          );
          html2 = this.ensureHeadingIDs(html2);
          html2 = await this.processResources(html2, tempFile);
          if (this.context.options.includeCSS) {
            html2 = await this.wrapWithCSS(html2, tempFile.basename || "Document");
          }
          return html2;
        } catch (error2) {
          console.error("\u6E32\u67D3 Markdown \u65F6\u51FA\u9519:", error2);
          throw new Error(`\u6E32\u67D3\u5931\u8D25: ${error2.message}`);
        }
      }
      /**
       * 将 HTML 内容包装成完整的文档（包含 CSS）
       * @param html HTML 内容
       * @param title 文档标题
       */
      async wrapWithCSS(html2, title) {
        const css = await this.cssCollector.collectAllCSS({
          includeAppCSS: false,
          // 主题已包含 app.css，不再重复包含
          includeBaseStyles: true
        });
        const currentTheme = getCurrentTheme();
        return `<style>
${css}

</style>

<div class="obsidian-content-wrapper ${currentTheme}">
  <div class="markdown-preview-view markdown-rendered">
    ${html2}
  </div>
</div>`;
      }
      /**
       * 转义 HTML 字符
       * @param text 要转义的文本
       */
      escapeHtml(text3) {
        return text3.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
      }
      /**
       * 设置基准文件（重写基类方法以同时更新context）
       */
      setBaseFile(file) {
        super.setBaseFile(file);
        this.context.options.baseFile = file;
        this.context.file = file;
      }
      /**
       * 获取当前配置（重写基类方法以返回正确的类型）
       */
      getOptions() {
        return { ...this.context.options };
      }
      /**
       * 更新配置（重写基类方法以同时更新context）
       */
      updateOptions(options) {
        super.updateOptions(options);
        this.context.options = {
          ...this.context.options,
          ...options
        };
      }
      /**
       * 获取 CSS 收集器
       */
      getCSSCollector() {
        return this.cssCollector;
      }
      /**
       * 获取资源处理器（重写基类方法以保持接口一致性）
       */
      getResourceProcessor() {
        return super.getResourceProcessor();
      }
      /**
       * 渲染纯 HTML（不包含 CSS）
       * @param source Markdown 源码
       */
      async renderHTML(source2) {
        const originalIncludeCSS = this.context.options.includeCSS;
        try {
          this.context.options.includeCSS = false;
          return await this.render(source2);
        } finally {
          this.context.options.includeCSS = originalIncludeCSS;
        }
      }
    };
    // 保持向后兼容的别名
    _OBStyleRenderer.ObsidianRenderer = _OBStyleRenderer;
    OBStyleRenderer = _OBStyleRenderer;
  }
});

// src/markdown/index.ts
function createStyleRenderer(plugin2, options = {}) {
  const defaultOptions = {
    autoHeadingID: true,
    containerWidth: "800px",
    waitForStable: false,
    timeout: 100,
    ...options
  };
  return new StyleRenderer(plugin2, defaultOptions);
}
var init_markdown = __esm({
  "src/markdown/index.ts"() {
    "use strict";
    init_base_renderer();
    init_style_renderer();
    init_obsidian_renderer();
    init_css_collector();
    init_resource_processor();
    init_obsidian_parser_result();
    init_obsidian_renderer();
    init_dom_utils();
    init_style_renderer();
    init_obsidian_renderer();
  }
});

// src/theme/themeApiService.ts
var themeApiService_exports = {};
__export2(themeApiService_exports, {
  themeApiService: () => themeApiService
});
function mapRawThemeToThemeItem(rawTheme) {
  return {
    // Direct fields from JSON
    id: String(rawTheme.id),
    name: rawTheme.name,
    author: rawTheme.author,
    version: rawTheme.version,
    screenshot: rawTheme.screenshot,
    download_url: rawTheme.download_url,
    demo_url: rawTheme.demo_url,
    demo_notes_url: rawTheme.demo_notes_url,
    tags: Array.isArray(rawTheme.tags) ? rawTheme.tags : [],
    kind: Array.isArray(rawTheme.kind) ? rawTheme.kind : void 0,
    // Computed fields for UI
    title: rawTheme.name || `Theme ${rawTheme.id}`,
    description: `${rawTheme.name} theme by ${rawTheme.author || "Unknown"}`,
    thumbnail: rawTheme.screenshot,
    demo: rawTheme.demo_url,
    asset: rawTheme.screenshot
  };
}
async function fetchAllThemes(themesUrl) {
  try {
    const timestamp = Date.now();
    const urlWithTimestamp = `${themesUrl}?_t=${timestamp}`;
    const response = await (0, import_obsidian12.requestUrl)({
      url: urlWithTimestamp,
      method: "GET",
      headers: {
        "Content-Type": "application/json"
      }
    });
    if (response.status !== 200) {
      throw new Error(`Failed to fetch themes: ${response.status}`);
    }
    const rawThemes = response.json;
    if (!Array.isArray(rawThemes)) {
      throw new Error("Invalid themes data format");
    }
    return rawThemes.map(mapRawThemeToThemeItem).filter((theme) => theme.name !== "Base");
  } catch (error2) {
    console.error("Error fetching themes:", error2);
    throw error2;
  }
}
function extractAllTags(themes) {
  const allTags = themes.flatMap((theme) => theme.tags);
  const uniqueTags = [...new Set(allTags)];
  return uniqueTags.sort((a, b) => a.localeCompare(b));
}
function filterThemes(themes, searchTerm = "", selectedTags = []) {
  let filteredThemes = themes;
  if (searchTerm.trim()) {
    const term = searchTerm.trim().toLowerCase();
    filteredThemes = filteredThemes.filter(
      (theme) => theme.name.toLowerCase().includes(term) || theme.author.toLowerCase().includes(term) || theme.tags.some((tag2) => tag2.toLowerCase().includes(term))
    );
  }
  if (selectedTags.length > 0) {
    filteredThemes = filteredThemes.filter(
      (theme) => selectedTags.every(
        (selectedTag) => theme.tags.some((tag2) => tag2 === selectedTag)
      )
    );
  }
  return filteredThemes;
}
function getThemesUrl(plugin2) {
  if (!plugin2) {
    return THEMES_JSON_URLS.global;
  }
  const downloadServer = plugin2.settings.downloadServer || "global";
  return THEMES_JSON_URLS[downloadServer];
}
var import_obsidian12, THEMES_JSON_URLS, themesCache, allTagsCache, cacheTimestamp, CACHE_EXPIRY_MS, themeApiService;
var init_themeApiService = __esm({
  "src/theme/themeApiService.ts"() {
    "use strict";
    import_obsidian12 = require("obsidian");
    THEMES_JSON_URLS = {
      global: "https://gohugo.net/themes.json",
      east: "https://mdfriday.com/mdf/themes-zh.json"
    };
    themesCache = {};
    allTagsCache = {};
    cacheTimestamp = {};
    CACHE_EXPIRY_MS = 2 * 60 * 60 * 1e3;
    themeApiService = {
      /**
       * Initialize and cache all themes data
       */
      async initializeThemes(plugin2) {
        const themesUrl = getThemesUrl(plugin2);
        const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
        const now = Date.now();
        const isCacheExpired = !cacheTimestamp[serverKey] || now - cacheTimestamp[serverKey] > CACHE_EXPIRY_MS;
        if (!themesCache[serverKey] || isCacheExpired) {
          themesCache[serverKey] = await fetchAllThemes(themesUrl);
          allTagsCache[serverKey] = extractAllTags(themesCache[serverKey]);
          cacheTimestamp[serverKey] = now;
        }
      },
      /**
       * Get all themes, initializing cache if needed
       */
      async getAllThemes(plugin2) {
        await this.initializeThemes(plugin2);
        const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
        return themesCache[serverKey] || [];
      },
      /**
       * Fetch themes with pagination and filtering (for backward compatibility)
       */
      async fetchThemes(page = 1, limit = 20, selectedTags = [], searchTerm = "", plugin2) {
        return this.searchThemes(page, limit, searchTerm, selectedTags, plugin2);
      },
      /**
       * Search themes with pagination, text search and tag filtering
       */
      async searchThemes(page = 1, limit = 20, searchTerm = "", selectedTags = [], plugin2) {
        try {
          await this.initializeThemes(plugin2);
          const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
          const allThemes = themesCache[serverKey] || [];
          const filteredThemes = filterThemes(allThemes, searchTerm, selectedTags);
          const startIndex = (page - 1) * limit;
          const endIndex = startIndex + limit;
          const paginatedThemes = filteredThemes.slice(startIndex, endIndex);
          const hasMore = endIndex < filteredThemes.length;
          return { themes: paginatedThemes, hasMore };
        } catch (error2) {
          console.error("Error searching themes:", error2);
          return { themes: [], hasMore: false };
        }
      },
      /**
       * Fetch all theme tags
       */
      async fetchAllTags(plugin2) {
        try {
          await this.initializeThemes(plugin2);
          const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
          return allTagsCache[serverKey] || [];
        } catch (error2) {
          console.error("Error fetching theme tags:", error2);
          return [];
        }
      },
      /**
       * Create theme metadata object for registration
       */
      createThemeMetadata(theme) {
        return {
          id: parseInt(theme.id, 10),
          name: theme.title,
          template: "",
          // No template field in simplified data
          uuid: theme.id,
          tags: theme.tags
        };
      },
      /**
       * Get theme by ID
       * @param themeId The ID of the theme to fetch
       * @returns The theme item, or null if not found
       */
      async getThemeById(themeId, plugin2) {
        try {
          await this.initializeThemes(plugin2);
          const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
          const themes = themesCache[serverKey] || [];
          return themes.find((theme) => theme.id === themeId) || null;
        } catch (error2) {
          console.error("Error getting theme by ID:", error2);
          return null;
        }
      },
      /**
       * Fetch a theme by its name
       * @param name The name of the theme to fetch
       * @returns The theme item, or null if not found
       */
      async fetchThemeByName(name, plugin2) {
        try {
          await this.initializeThemes(plugin2);
          const serverKey = (plugin2 == null ? void 0 : plugin2.settings.downloadServer) || "global";
          const allThemes = themesCache[serverKey] || [];
          const theme = allThemes.find(
            (t2) => t2.name.toLowerCase() === name.toLowerCase()
          );
          return theme || null;
        } catch (error2) {
          console.error(`Error fetching theme by name '${name}':`, error2);
          return null;
        }
      },
      /**
       * Clear the themes cache (useful for testing or refreshing data)
       */
      clearCache(serverKey) {
        if (serverKey) {
          delete themesCache[serverKey];
          delete allTagsCache[serverKey];
          delete cacheTimestamp[serverKey];
        } else {
          themesCache = {};
          allTagsCache = {};
          cacheTimestamp = {};
        }
      }
    };
  }
});

// src/svelte/Site.svelte
function Site($$anchor, $$props) {
  if (new.target) return createClassComponent({ component: Site, ...$$anchor });
  push($$props, false);
  append_styles($$anchor, $$css3);
  const $languageContents = () => store_get(get2(languageContents), "$languageContents", $$stores);
  const $siteAssets = () => store_get(get2(siteAssets), "$siteAssets", $$stores);
  const [$$stores, $$cleanup] = setup_stores();
  const site = mutable_source();
  const languageContents = mutable_source();
  const siteAssets = mutable_source();
  const t2 = mutable_source();
  const currentContents = mutable_source();
  const currentAssets = mutable_source();
  const isForSingleFile = mutable_source();
  const defaultContentLanguage = mutable_source();
  const requiresPublishPermission = mutable_source();
  const requiresSubdomainPermission = mutable_source();
  const requiresCustomDomainPermission = mutable_source();
  const requiresEnterprisePermission = mutable_source();
  const isPublishDisabled = mutable_source();
  const displayThemeName = mutable_source();
  const isFTPConfigured = mutable_source();
  var _a6 = mutable_source(), _b4 = mutable_source(), _c2 = mutable_source(), _d = mutable_source(), _e = mutable_source(), _f = mutable_source(), _g = mutable_source(), _h = mutable_source();
  let app = prop($$props, "app", 12);
  let plugin2 = prop($$props, "plugin", 12);
  const BOOK_THEME_URL = "https://gohugo.net/book-ob.zip?version=1.1";
  const BOOK_THEME_ID = "3";
  const BOOK_THEME_NAME = "Obsidian Book";
  const NOTE_THEME_URL = "https://gohugo.net/note.zip?version=1.2";
  const NOTE_THEME_ID = "2";
  const NOTE_THEME_NAME = "Note";
  const isWindows = process.platform === "win32";
  const FRIDAY_ROOT_FOLDER = "MDFriday";
  let basePath = plugin2().pluginDir;
  let absSelectedFolderPath = [];
  let absProjContentPath = [];
  let contentPath = mutable_source("");
  let siteName = mutable_source("");
  let previousContentLength = mutable_source(0);
  let sitePath = mutable_source("/");
  let selectedThemeDownloadUrl = mutable_source(BOOK_THEME_URL);
  let selectedThemeName = mutable_source(BOOK_THEME_NAME);
  let selectedThemeId = mutable_source(BOOK_THEME_ID);
  let userHasSelectedTheme = mutable_source(false);
  let showAdvancedSettings = mutable_source(false);
  let googleAnalyticsId = mutable_source("");
  let disqusShortname = mutable_source("");
  let sitePassword = mutable_source("");
  let themesDir = "";
  let isBuilding = mutable_source(false);
  let buildProgress = mutable_source(0);
  let previewUrl = mutable_source("");
  let previewId = mutable_source("");
  let hasPreview = mutable_source(false);
  let absPreviewDir = "";
  let isPublishing = mutable_source(false);
  let publishProgress = mutable_source(0);
  let publishSuccess = mutable_source(false);
  let publishUrl = mutable_source("");
  let selectedPublishOption = mutable_source((plugin2().settings.publishMethod === "mdfriday" ? "netlify" : plugin2().settings.publishMethod) || "netlify");
  let netlifyAccessToken = mutable_source("");
  let netlifyProjectId = mutable_source("");
  let ftpServer = mutable_source("");
  let ftpUsername = mutable_source("");
  let ftpPassword = mutable_source("");
  let ftpRemoteDir = mutable_source("");
  let ftpIgnoreCert = mutable_source(true);
  let ftpPreferredSecure = mutable_source(
    void 0
    // Remember last successful connection type
  );
  let ftpTestState = mutable_source("idle");
  let ftpTestMessage = mutable_source("");
  let isExporting = mutable_source(false);
  let isDownloadingSample = mutable_source(false);
  let sampleDownloadProgress = mutable_source(0);
  let currentThemeWithSample = mutable_source(null);
  let hasOBTag = false;
  let userDir = mutable_source("");
  let isLicenseActivated = mutable_source(false);
  let hasPublishPermission = mutable_source(false);
  let hasSubdomainPermission = mutable_source(false);
  let hasCustomDomainPermission = mutable_source(false);
  let hasEnterprisePermission = mutable_source(false);
  let publishOptions = mutable_source([]);
  let httpServer;
  let serverRunning = false;
  let serverHost = "localhost";
  let serverPort = 8090;
  onMount(async () => {
    themesDir = path4.join(plugin2().pluginDir, "themes");
    await createThemesDirectory();
    const adapter = app().vault.adapter;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      basePath = adapter.getBasePath();
    }
    plugin2(plugin2().applyProjectConfigurationToPanel = applyProjectConfiguration, true);
    plugin2(plugin2().exportHistoryBuild = exportHistoryBuild, true);
    plugin2(plugin2().clearPreviewHistory = clearPreviewHistory, true);
    plugin2(plugin2().setSitePath = setSitePathExternal, true);
    plugin2(plugin2().startPreviewAndWait = startPreviewAndWait, true);
    plugin2(plugin2().selectMDFShare = selectMDFShare, true);
    plugin2(plugin2().refreshLicenseState = refreshLicenseState, true);
  });
  function setSitePathExternal(newPath) {
    set(sitePath, newPath);
  }
  async function startPreviewAndWait() {
    try {
      await startPreview();
      return get2(hasPreview);
    } catch (error2) {
      console.error("Preview failed:", error2);
      return false;
    }
  }
  function selectMDFShare() {
    set(selectedPublishOption, "mdf-share");
  }
  function refreshLicenseState() {
    var _a7;
    set(userDir, ((_a7 = plugin2().settings.licenseUser) === null || _a7 === void 0 ? void 0 : _a7.userDir) || "");
    set(isLicenseActivated, !!(plugin2().settings.license && get2(userDir)));
    set(publishOptions, [
      {
        value: "netlify",
        label: get2(t2)("ui.publish_option_netlify")
      },
      { value: "ftp", label: get2(t2)("ui.publish_option_ftp") },
      {
        value: "mdf-share",
        label: get2(t2)("ui.publish_option_mdfriday_share")
      },
      {
        value: "mdf-app",
        label: get2(t2)("ui.publish_option_mdfriday_app")
      }
    ]);
  }
  onDestroy(() => {
    if (serverRunning) {
      httpServer.stopWatching();
      serverRunning = false;
    }
  });
  const SUPPORTED_LANGUAGES = [
    {
      code: "en",
      name: "English",
      direction: "ltr",
      englishName: "English"
    },
    {
      code: "zh",
      name: "\u4E2D\u6587",
      direction: "ltr",
      englishName: "Chinese"
    },
    {
      code: "es",
      name: "Espa\xF1ol",
      direction: "ltr",
      englishName: "Spanish"
    },
    {
      code: "fr",
      name: "Fran\xE7ais",
      direction: "ltr",
      englishName: "French"
    },
    {
      code: "de",
      name: "Deutsch",
      direction: "ltr",
      englishName: "German"
    },
    {
      code: "ja",
      name: "\u65E5\u672C\u8A9E",
      direction: "ltr",
      englishName: "Japanese"
    },
    {
      code: "ko",
      name: "\uD55C\uAD6D\uC5B4",
      direction: "ltr",
      englishName: "Korean"
    },
    {
      code: "pt",
      name: "Portugu\xEAs",
      direction: "ltr",
      englishName: "Portuguese"
    }
  ];
  function updateLanguageCode(contentId, newLanguageCode) {
    get2(site).updateLanguageCode(contentId, newLanguageCode);
  }
  function removeLanguageContent(contentId) {
    get2(site).removeLanguageContent(contentId);
  }
  function clearAllContent() {
    get2(site).clearAllContent();
  }
  function clearSiteAssets() {
    get2(site).clearSiteAssets();
  }
  function getLanguageName(code) {
    const lang = SUPPORTED_LANGUAGES.find((l) => l.code === code);
    return lang ? lang.name : code;
  }
  function showAddLanguageDialog() {
    new import_obsidian13.Notice(get2(t2)("messages.add_language_instruction"), 5e3);
  }
  function loadDefaultPublishConfigIfNeeded() {
    var _a7, _b5, _c3, _d2, _e2, _f2, _g2, _h2;
    const projectId = getProjectId();
    if (!projectId) {
      return;
    }
    const existingProject = plugin2().projectService.getProject(projectId);
    if (existingProject && existingProject.publishConfig) {
      set(selectedPublishOption, existingProject.publishConfig.method || "netlify");
      set(netlifyAccessToken, ((_a7 = existingProject.publishConfig.netlify) === null || _a7 === void 0 ? void 0 : _a7.accessToken) || "");
      set(netlifyProjectId, ((_b5 = existingProject.publishConfig.netlify) === null || _b5 === void 0 ? void 0 : _b5.projectId) || "");
      set(ftpServer, ((_c3 = existingProject.publishConfig.ftp) === null || _c3 === void 0 ? void 0 : _c3.server) || "");
      set(ftpUsername, ((_d2 = existingProject.publishConfig.ftp) === null || _d2 === void 0 ? void 0 : _d2.username) || "");
      set(ftpPassword, ((_e2 = existingProject.publishConfig.ftp) === null || _e2 === void 0 ? void 0 : _e2.password) || "");
      set(ftpRemoteDir, ((_f2 = existingProject.publishConfig.ftp) === null || _f2 === void 0 ? void 0 : _f2.remoteDir) || "");
      set(ftpIgnoreCert, ((_g2 = existingProject.publishConfig.ftp) === null || _g2 === void 0 ? void 0 : _g2.ignoreCert) !== void 0 ? existingProject.publishConfig.ftp.ignoreCert : true);
      set(ftpPreferredSecure, (_h2 = existingProject.publishConfig.ftp) === null || _h2 === void 0 ? void 0 : _h2.preferredSecure);
    } else {
      const settingsMethod = plugin2().settings.publishMethod;
      set(selectedPublishOption, (settingsMethod === "mdfriday" ? "netlify" : settingsMethod) || "netlify");
      set(netlifyAccessToken, plugin2().settings.netlifyAccessToken || "");
      set(netlifyProjectId, plugin2().settings.netlifyProjectId || "");
      set(ftpServer, plugin2().settings.ftpServer || "");
      set(ftpUsername, plugin2().settings.ftpUsername || "");
      set(ftpPassword, plugin2().settings.ftpPassword || "");
      set(ftpRemoteDir, plugin2().settings.ftpRemoteDir || "");
      set(ftpIgnoreCert, plugin2().settings.ftpIgnoreCert !== void 0 ? plugin2().settings.ftpIgnoreCert : true);
      set(
        ftpPreferredSecure,
        void 0
        // Default to plain FTP
      );
    }
    set(ftpTestState, "idle");
    set(ftpTestMessage, "");
  }
  function openThemeModal() {
    plugin2().showThemeSelectionModal(
      get2(selectedThemeId),
      async (themeUrl, themeName, themeId) => {
        set(selectedThemeDownloadUrl, themeUrl);
        set(selectedThemeName, themeName || (get2(isForSingleFile) ? "Note" : "Book"));
        set(selectedThemeId, themeId || get2(selectedThemeId));
        set(userHasSelectedTheme, true);
        if (themeId) {
          try {
            set(currentThemeWithSample, await themeApiService.getThemeById(themeId, plugin2()));
          } catch (error2) {
            console.warn("Failed to get theme info:", error2);
            set(currentThemeWithSample, null);
          }
        }
      },
      get2(isForSingleFile)
    );
  }
  async function exportHistoryBuild(previewId2) {
    try {
      const previewDir = path4.join(plugin2().pluginDir, "preview", previewId2);
      const publicDir = path4.join(previewDir, "public");
      const adapter = app().vault.adapter;
      if (!await adapter.exists(publicDir)) {
        new import_obsidian13.Notice(get2(t2)("projects.preview_not_found"), 5e3);
        return;
      }
      const absPublicDir = path4.join(basePath, publicDir);
      const zipContent = await createZipFromDirectory(absPublicDir);
      const { dialog } = require("@electron/remote") || require("electron").remote;
      const { canceled, filePath } = await dialog.showSaveDialog({
        title: get2(t2)("ui.export_site_dialog_title"),
        defaultPath: `mdfriday-site-${previewId2}.zip`,
        filters: [
          { name: "ZIP Files", extensions: ["zip"] },
          { name: "All Files", extensions: ["*"] }
        ]
      });
      if (!canceled && filePath) {
        await fs3.promises.writeFile(filePath, zipContent);
        new import_obsidian13.Notice(get2(t2)("messages.site_exported_successfully", { path: filePath }), 3e3);
      }
    } catch (error2) {
      console.error("Export history build failed:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.export_failed", { error: error2.message }), 5e3);
    }
  }
  async function clearPreviewHistory(projectId) {
    try {
      const confirmed = confirm(get2(t2)("projects.confirm_clear_history"));
      if (!confirmed) {
        return;
      }
      const buildHistory = plugin2().projectService.getBuildHistory(projectId, 1e3);
      const previewIds = buildHistory.filter((h2) => h2.previewId).map((h2) => h2.previewId);
      if (previewIds.length === 0) {
        new import_obsidian13.Notice(get2(t2)("projects.no_preview_files"), 3e3);
        return;
      }
      const previewRoot = path4.join(plugin2().pluginDir, "preview");
      const adapter = app().vault.adapter;
      if (!await adapter.exists(previewRoot)) {
        new import_obsidian13.Notice(get2(t2)("projects.no_preview_files"), 3e3);
        return;
      }
      const absPreviewRoot = path4.join(basePath, previewRoot);
      let deletedCount = 0;
      for (const previewId2 of previewIds) {
        const previewDirPath = path4.join(absPreviewRoot, previewId2);
        try {
          if (await fs3.promises.access(previewDirPath).then(() => true).catch(() => false)) {
            await fs3.promises.rm(previewDirPath, { recursive: true, force: true });
            deletedCount++;
          }
        } catch (error2) {
          console.warn(`Failed to delete preview directory ${previewId2}:`, error2);
        }
      }
      await plugin2().projectService.clearProjectBuildHistory(projectId);
      if (deletedCount > 0) {
        new import_obsidian13.Notice(get2(t2)("projects.preview_history_cleared", { count: deletedCount }), 3e3);
      } else {
        new import_obsidian13.Notice(get2(t2)("projects.no_preview_files"), 3e3);
      }
    } catch (error2) {
      console.error("Clear preview history failed:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.export_failed", { error: error2.message }), 5e3);
    }
  }
  async function applyProjectConfiguration(project) {
    var _a7, _b5, _c3, _d2, _e2, _f2, _g2, _h2;
    try {
      get2(site).clearAllContent();
      set(siteName, project.name);
      set(selectedThemeDownloadUrl, project.themeUrl);
      set(selectedThemeName, project.themeName);
      set(selectedThemeId, project.themeId);
      set(userHasSelectedTheme, true);
      set(sitePath, project.sitePath);
      set(googleAnalyticsId, project.googleAnalyticsId || "");
      set(disqusShortname, project.disqusShortname || "");
      set(sitePassword, project.sitePassword || "");
      if (project.publishConfig) {
        set(selectedPublishOption, project.publishConfig.method || "netlify");
        set(netlifyAccessToken, ((_a7 = project.publishConfig.netlify) === null || _a7 === void 0 ? void 0 : _a7.accessToken) || "");
        set(netlifyProjectId, ((_b5 = project.publishConfig.netlify) === null || _b5 === void 0 ? void 0 : _b5.projectId) || "");
        set(ftpServer, ((_c3 = project.publishConfig.ftp) === null || _c3 === void 0 ? void 0 : _c3.server) || "");
        set(ftpUsername, ((_d2 = project.publishConfig.ftp) === null || _d2 === void 0 ? void 0 : _d2.username) || "");
        set(ftpPassword, ((_e2 = project.publishConfig.ftp) === null || _e2 === void 0 ? void 0 : _e2.password) || "");
        set(ftpRemoteDir, ((_f2 = project.publishConfig.ftp) === null || _f2 === void 0 ? void 0 : _f2.remoteDir) || "");
        set(ftpIgnoreCert, ((_g2 = project.publishConfig.ftp) === null || _g2 === void 0 ? void 0 : _g2.ignoreCert) !== void 0 ? project.publishConfig.ftp.ignoreCert : true);
        set(ftpPreferredSecure, (_h2 = project.publishConfig.ftp) === null || _h2 === void 0 ? void 0 : _h2.preferredSecure);
      } else {
        const settingsMethod = plugin2().settings.publishMethod;
        set(selectedPublishOption, (settingsMethod === "mdfriday" ? "netlify" : settingsMethod) || "netlify");
        set(netlifyAccessToken, plugin2().settings.netlifyAccessToken || "");
        set(netlifyProjectId, plugin2().settings.netlifyProjectId || "");
        set(ftpServer, plugin2().settings.ftpServer || "");
        set(ftpUsername, plugin2().settings.ftpUsername || "");
        set(ftpPassword, plugin2().settings.ftpPassword || "");
        set(ftpRemoteDir, plugin2().settings.ftpRemoteDir || "");
        set(ftpIgnoreCert, plugin2().settings.ftpIgnoreCert !== void 0 ? plugin2().settings.ftpIgnoreCert : true);
        set(
          ftpPreferredSecure,
          void 0
          // Default to plain FTP for new projects
        );
      }
      set(ftpTestState, "idle");
      set(ftpTestMessage, "");
      let contentLoadedCount = 0;
      if (project.contents && project.contents.length > 0) {
        for (let i = 0; i < project.contents.length; i++) {
          const contentConfig = project.contents[i];
          const abstractFile = app().vault.getAbstractFileByPath(contentConfig.contentPath);
          if (abstractFile) {
            if (abstractFile instanceof import_obsidian13.TFolder) {
              if (i === 0) {
                get2(site).initializeContentWithLanguage(abstractFile, null, contentConfig.languageCode);
              } else {
                get2(site).addLanguageContentWithCode(abstractFile, null, contentConfig.languageCode);
              }
              contentLoadedCount++;
            } else if (abstractFile instanceof import_obsidian13.TFile && abstractFile.extension === "md") {
              if (i === 0) {
                get2(site).initializeContentWithLanguage(null, abstractFile, contentConfig.languageCode);
              } else {
                get2(site).addLanguageContentWithCode(null, abstractFile, contentConfig.languageCode);
              }
              contentLoadedCount++;
            }
          } else {
            console.warn(`Content path not found: ${contentConfig.contentPath}`);
          }
        }
      }
      if (project.assetsPath) {
        const assetsFile = app().vault.getAbstractFileByPath(project.assetsPath);
        if (assetsFile instanceof import_obsidian13.TFolder) {
          get2(site).setSiteAssets(assetsFile);
        } else {
          console.warn(`Assets path not found: ${project.assetsPath}`);
        }
      }
      if (contentLoadedCount > 0) {
        const contentText = contentLoadedCount === 1 ? "content" : "contents";
        new import_obsidian13.Notice(get2(t2)("projects.project_applied") + `
\u2705 ${contentLoadedCount} ${contentText} loaded`, 3e3);
      } else {
        new import_obsidian13.Notice(get2(t2)("projects.project_applied_no_content"), 5e3);
      }
    } catch (error2) {
      console.error("Failed to apply project configuration:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.export_failed", { error: error2.message }), 5e3);
    }
  }
  function getProjectId() {
    var _a7, _b5;
    if (get2(currentContents).length === 0) {
      return "";
    }
    const firstContent = get2(currentContents)[0];
    let projectId = ((_a7 = firstContent.folder) === null || _a7 === void 0 ? void 0 : _a7.path) || ((_b5 = firstContent.file) === null || _b5 === void 0 ? void 0 : _b5.path) || "";
    const contentFolder = firstContent.folder || (firstContent.file ? firstContent.file.parent : null);
    if (contentFolder && contentFolder.parent) {
      const folderName = contentFolder.name.toLowerCase();
      if (folderName === "content" || folderName.startsWith("content.")) {
        projectId = contentFolder.parent.path;
      }
    }
    return projectId;
  }
  async function saveCurrentProjectConfiguration() {
    var _a7;
    if (get2(currentContents).length === 0 || !get2(siteName)) {
      return;
    }
    try {
      const projectId = getProjectId();
      if (!projectId) {
        return;
      }
      const projectName = get2(siteName);
      const existingProject = plugin2().projectService.getProject(projectId);
      const now = Date.now();
      const hasNetlifyConfig = !!(get2(netlifyAccessToken) || get2(netlifyProjectId));
      const hasFtpConfig = !!(get2(ftpServer) || get2(ftpUsername) || get2(ftpPassword) || get2(ftpRemoteDir));
      const hasPublishConfig = hasNetlifyConfig || hasFtpConfig;
      const projectConfig = {
        id: projectId,
        name: projectName,
        contents: get2(currentContents).map((content) => {
          var _a8, _b5;
          return {
            languageCode: content.languageCode,
            contentPath: ((_a8 = content.folder) === null || _a8 === void 0 ? void 0 : _a8.path) || ((_b5 = content.file) === null || _b5 === void 0 ? void 0 : _b5.path) || "",
            weight: content.weight
          };
        }),
        defaultContentLanguage: get2(defaultContentLanguage),
        assetsPath: ((_a7 = get2(currentAssets) === null || get2(currentAssets) === void 0 ? void 0 : get2(currentAssets).folder) === null || _a7 === void 0 ? void 0 : _a7.path) || void 0,
        sitePath: get2(sitePath),
        themeUrl: get2(selectedThemeDownloadUrl),
        themeName: get2(selectedThemeName),
        themeId: get2(selectedThemeId),
        googleAnalyticsId: get2(googleAnalyticsId) || void 0,
        disqusShortname: get2(disqusShortname) || void 0,
        sitePassword: get2(sitePassword) || void 0,
        publishConfig: hasPublishConfig ? {
          method: get2(selectedPublishOption),
          netlify: hasNetlifyConfig ? {
            accessToken: get2(netlifyAccessToken) || void 0,
            projectId: get2(netlifyProjectId) || void 0
          } : void 0,
          ftp: hasFtpConfig ? {
            server: get2(ftpServer) || void 0,
            username: get2(ftpUsername) || void 0,
            password: get2(ftpPassword) || void 0,
            remoteDir: get2(ftpRemoteDir) || void 0,
            ignoreCert: get2(ftpIgnoreCert),
            preferredSecure: get2(ftpPreferredSecure)
          } : void 0
        } : void 0,
        createdAt: (existingProject === null || existingProject === void 0 ? void 0 : existingProject.createdAt) || now,
        updatedAt: now
      };
      await plugin2().projectService.saveProject(projectConfig);
    } catch (error2) {
      console.error("Failed to save project configuration:", error2);
    }
  }
  async function downloadThemeSample() {
    if (!get2(currentThemeWithSample) || !get2(currentThemeWithSample).demo_notes_url) {
      return;
    }
    set(isDownloadingSample, true);
    set(sampleDownloadProgress, 0);
    try {
      await ensureRootFolderExists();
      const baseName = get2(currentThemeWithSample).name.toLowerCase().replace(/\s+/g, "-");
      const targetFolderName = await generateUniqueFolderName(baseName);
      const adapter = app().vault.adapter;
      let targetFolderPath;
      if (adapter instanceof import_obsidian13.FileSystemAdapter) {
        const vaultBasePath = adapter.getBasePath();
        targetFolderPath = path4.join(vaultBasePath, FRIDAY_ROOT_FOLDER, targetFolderName);
      } else {
        targetFolderPath = path4.join(FRIDAY_ROOT_FOLDER, targetFolderName);
      }
      if (isWindows) {
        targetFolderPath = path4.normalize(targetFolderPath);
      }
      await downloadAndUnzipSample(get2(currentThemeWithSample).demo_notes_url, targetFolderPath, (progress) => {
        set(sampleDownloadProgress, progress);
      });
      new import_obsidian13.Notice(
        get2(t2)("messages.sample_downloaded_successfully", {
          themeName: get2(currentThemeWithSample).name,
          folderName: targetFolderName
        }),
        5e3
      );
    } catch (error2) {
      console.error("Sample download failed:", error2);
      console.error("Error details:", {
        themeName: get2(currentThemeWithSample) === null || get2(currentThemeWithSample) === void 0 ? void 0 : get2(currentThemeWithSample).name,
        downloadUrl: get2(currentThemeWithSample) === null || get2(currentThemeWithSample) === void 0 ? void 0 : get2(currentThemeWithSample).demo_notes_url,
        platform: process.platform,
        error: error2.message
      });
      new import_obsidian13.Notice(get2(t2)("messages.sample_download_failed", { error: error2.message }), 5e3);
    } finally {
      set(isDownloadingSample, false);
      set(sampleDownloadProgress, 0);
    }
  }
  function toggleAdvancedSettings() {
    set(showAdvancedSettings, !get2(showAdvancedSettings));
  }
  function normalizeSitePath(path8) {
    if (!path8.startsWith("/")) {
      path8 = "/" + path8;
    }
    if (path8.length > 1 && path8.endsWith("/")) {
      path8 = path8.slice(0, -1);
    }
    return path8;
  }
  function handleSitePathChange() {
    set(sitePath, normalizeSitePath(get2(sitePath)));
  }
  async function createRendererBasedOnTheme() {
    var _a7, _b5, _c3, _d2, _e2, _f2;
    try {
      const obImagesDir = path4.join(absPreviewDir, "public", "ob-images");
      if (hasOBTag) {
        const renderer = new OBStyleRenderer(plugin2(), {
          includeCSS: true,
          // Include CSS in HTML for complete styling
          waitForPlugins: true,
          // Wait for plugin rendering callbacks
          timeout: 200,
          // Shorter timeout with smart detection
          containerWidth: "1000px",
          includeTheme: true
          // Include theme styles
        });
        renderer.getResourceProcessor().configureImageOutput(obImagesDir, get2(sitePath), (_b5 = (_a7 = get2(currentContents)[0]) === null || _a7 === void 0 ? void 0 : _a7.folder) === null || _b5 === void 0 ? void 0 : _b5.name);
        return renderer;
      } else {
        const renderer = createStyleRenderer(plugin2(), {
          autoHeadingID: true,
          waitForStable: false
          // Don't wait for DOM stable for better performance
        });
        if (renderer.getResourceProcessor) {
          renderer.getResourceProcessor().configureImageOutput(obImagesDir, get2(sitePath), (_d2 = (_c3 = get2(currentContents)[0]) === null || _c3 === void 0 ? void 0 : _c3.folder) === null || _d2 === void 0 ? void 0 : _d2.name);
        }
        return renderer;
      }
    } catch (error2) {
      console.warn("Failed to get theme info, falling back to lightweight renderer:", error2);
      const obImagesDir = path4.join(absPreviewDir, "public", "ob-images");
      const renderer = createStyleRenderer(plugin2(), { autoHeadingID: true, waitForStable: false });
      if (renderer.getResourceProcessor) {
        renderer.getResourceProcessor().configureImageOutput(obImagesDir, get2(sitePath), (_f2 = (_e2 = get2(currentContents)[0]) === null || _e2 === void 0 ? void 0 : _e2.folder) === null || _f2 === void 0 ? void 0 : _f2.name);
      }
      return renderer;
    }
  }
  async function createSitePathStructure(previewDir) {
    if (get2(sitePath) === "/") {
      return path4.join(previewDir, "public");
    }
    const pathParts = get2(sitePath).split("/").filter((part) => part !== "");
    if (pathParts.length === 0) {
      return path4.join(previewDir, "public");
    }
    let currentDir = previewDir;
    for (let i = 0; i < pathParts.length - 1; i++) {
      currentDir = path4.join(currentDir, pathParts[i]);
      if (!await app().vault.adapter.exists(currentDir)) {
        await app().vault.adapter.mkdir(currentDir);
      }
    }
    const finalDirName = pathParts[pathParts.length - 1];
    const finalDirPath = path4.join(currentDir, finalDirName);
    const publicDir = path4.join(previewDir, "public");
    if (await app().vault.adapter.exists(finalDirPath)) {
      await app().vault.adapter.rmdir(finalDirPath, true);
    }
    const adapter = app().vault.adapter;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      const absFinalDirPath = path4.join(adapter.getBasePath(), finalDirPath);
      const absPublicDir = path4.join(adapter.getBasePath(), publicDir);
      try {
        if (isWindows) {
          await fs3.promises.symlink(absPublicDir, absFinalDirPath, "junction");
        } else {
          await fs3.promises.symlink(absPublicDir, absFinalDirPath, "dir");
        }
      } catch (error2) {
        console.error("Failed to create symlink for site path:", error2);
        await fs3.promises.cp(absPublicDir, absFinalDirPath, { recursive: true });
      }
    }
    return previewDir;
  }
  async function startPreview() {
    var _a7;
    if (get2(currentContents).length === 0) {
      new import_obsidian13.Notice(get2(t2)("messages.no_folder_or_file_selected"), 3e3);
      return;
    }
    set(isBuilding, true);
    set(buildProgress, 0);
    set(hasPreview, false);
    try {
      if (serverRunning) {
        await httpServer.stopWatching();
        serverRunning = false;
      }
      absSelectedFolderPath = [];
      absProjContentPath = [];
      set(previewId, generateRandomId());
      const previewDir = path4.join(plugin2().pluginDir, "preview", get2(previewId));
      await createPreviewDirectory(previewDir);
      set(buildProgress, 5);
      const themeInfo = await themeApiService.getThemeById(get2(selectedThemeId), plugin2());
      hasOBTag = ((_a7 = themeInfo === null || themeInfo === void 0 ? void 0 : themeInfo.tags) === null || _a7 === void 0 ? void 0 : _a7.some((tag2) => tag2.toLowerCase() === "obsidian")) || false;
      if (get2(selectedPublishOption) === "mdf-share" && plugin2().settings.license && get2(userDir)) {
        if (get2(sitePath).startsWith(`/s/${get2(userDir)}`) || !get2(sitePath).startsWith("/s")) {
          set(sitePath, `/s/${get2(userDir)}/${get2(previewId)}`);
        }
      }
      await createConfigFile(previewDir);
      set(buildProgress, 10);
      await linkMultiLanguageContents(previewDir);
      set(buildProgress, 15);
      if (get2(currentAssets) && get2(currentAssets).folder) {
        await copySiteAssetsToPreview(previewDir);
        set(buildProgress, 18);
      }
      absPreviewDir = path4.join(basePath, previewDir);
      const absThemesDir = path4.join(basePath, themesDir);
      const serverRootDir = await createSitePathStructure(previewDir);
      const obImagesDir = path4.join(absPreviewDir, "public", "ob-images");
      const styleRenderer = await createRendererBasedOnTheme();
      const httpClient = {
        async download(url, targetPath, options) {
          try {
            if (options === null || options === void 0 ? void 0 : options.onProgress) {
              options.onProgress({ percentage: 0, loaded: 0 });
            }
            const response = await (0, import_obsidian13.requestUrl)({
              url,
              method: "GET",
              headers: options === null || options === void 0 ? void 0 : options.headers
            });
            if (response.status !== 200) {
              throw new Error(`Download failed with status: ${response.status}`);
            }
            if (options === null || options === void 0 ? void 0 : options.onProgress) {
              const arrayBuffer = response.arrayBuffer;
              const total = arrayBuffer.byteLength;
              options.onProgress({ percentage: 50, loaded: total / 2, total });
            }
            const targetDir = path4.dirname(targetPath);
            if (!await checkFolderExists(targetDir)) {
              if (path4.isAbsolute(targetDir)) {
                await fs3.promises.mkdir(targetDir, { recursive: true });
              } else {
                await app().vault.adapter.mkdir(targetDir);
              }
            }
            const fileContent = new Uint8Array(response.arrayBuffer);
            if (path4.isAbsolute(targetPath)) {
              await fs3.promises.writeFile(targetPath, fileContent);
            } else {
              await app().vault.adapter.writeBinary(targetPath, fileContent.buffer);
            }
            if (options === null || options === void 0 ? void 0 : options.onProgress) {
              const total = fileContent.length;
              options.onProgress({ percentage: 100, loaded: total, total });
            }
          } catch (error2) {
            console.error("HTTP download failed:", error2);
            throw error2;
          }
        },
        async get(url, options) {
          try {
            const response = await (0, import_obsidian13.requestUrl)({
              url,
              method: "GET",
              headers: options === null || options === void 0 ? void 0 : options.headers
            });
            return {
              data: response.arrayBuffer,
              headers: response.headers || {},
              status: response.status
            };
          } catch (error2) {
            console.error("HTTP get failed:", error2);
            throw error2;
          }
        }
      };
      httpServer = await (0, import_foundry2.startIncrementalBuild)({
        projDir: absPreviewDir,
        modulesDir: absThemesDir,
        contentDirs: absSelectedFolderPath,
        projContentDirs: absProjContentPath,
        publicDir: path4.join(basePath, serverRootDir),
        enableWatching: true,
        // 启用完整的文件监控和增量构建
        batchDelay: 500,
        progressCallback: (progress) => {
          set(
            buildProgress,
            15 + progress.percentage / 100 * 85
            // Start from 15%, up to 100%
          );
        },
        markdown: styleRenderer,
        httpClient,
        // Live Reload 配置
        liveReload: {
          enabled: true,
          port: serverPort,
          host: serverHost,
          livereloadPort: 35729
        }
      });
      serverRunning = true;
      set(buildProgress, 100);
      if (get2(sitePath) === "/") {
        if (get2(isForSingleFile)) {
          set(previewUrl, `${httpServer.getServerUrl()}/`);
        } else {
          set(previewUrl, httpServer.getServerUrl());
        }
      } else {
        set(previewUrl, `${httpServer.getServerUrl()}${get2(sitePath)}/`);
      }
      set(hasPreview, true);
      window.open(get2(previewUrl), "_blank");
      new import_obsidian13.Notice(get2(t2)("messages.preview_generated_successfully"), 3e3);
      await saveCurrentProjectConfiguration();
      if (get2(currentContents).length > 0 && get2(siteName)) {
        const projectId = getProjectId();
        if (projectId) {
          await plugin2().projectService.addBuildHistory({
            projectId,
            timestamp: Date.now(),
            success: true,
            type: "preview",
            url: get2(previewUrl),
            previewId: get2(
              previewId
              // Save preview ID for export functionality
            )
          });
        }
      }
      plugin2().hugoverse.sendCounter("preview").catch((error2) => {
        console.warn("Counter request failed (non-critical):", error2);
      });
    } catch (error2) {
      console.error("Preview generation failed:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.preview_failed", { error: error2.message }), 5e3);
    } finally {
      set(isBuilding, false);
    }
  }
  async function startPublish() {
    var _a7, _b5, _c3, _d2;
    if (!get2(hasPreview)) {
      new import_obsidian13.Notice(get2(t2)("messages.please_generate_preview_first"), 3e3);
      return;
    }
    if (!get2(previewId) || !absPreviewDir) {
      new import_obsidian13.Notice(get2(t2)("messages.preview_data_missing"), 3e3);
      return;
    }
    if (get2(selectedPublishOption) === "netlify") {
      if (!get2(netlifyAccessToken) || !get2(netlifyProjectId)) {
        new import_obsidian13.Notice(get2(t2)("messages.netlify_settings_missing"), 5e3);
        return;
      }
    } else if (get2(selectedPublishOption) === "ftp") {
      if (!get2(ftpServer) || !get2(ftpUsername) || !get2(ftpPassword)) {
        new import_obsidian13.Notice(get2(t2)("messages.ftp_settings_missing"), 5e3);
        return;
      }
    }
    set(isPublishing, true);
    set(publishProgress, 0);
    set(publishSuccess, false);
    try {
      set(publishProgress, 5);
      const publicDir = path4.join(absPreviewDir, "public");
      if (get2(selectedPublishOption) === "netlify") {
        await publishToNetlify(publicDir);
      } else if (get2(selectedPublishOption) === "ftp") {
        await publishToFTP(publicDir);
      } else if (get2(selectedPublishOption) === "mdf-share") {
        const zipContent = await createZipFromDirectory(publicDir);
        set(publishProgress, 50);
        const previewApiId = await plugin2().hugoverse.createMDFPreview(get2(previewId), zipContent, "share");
        if (!previewApiId) {
          throw new Error("Failed to create MDFriday preview");
        }
        set(publishProgress, 80);
        const licenseKey = ((_a7 = plugin2().settings.license) === null || _a7 === void 0 ? void 0 : _a7.key) || "";
        const deployPath = await plugin2().hugoverse.deployMDFridayPreview(previewApiId, licenseKey);
        if (!deployPath) {
          throw new Error("Failed to deploy MDFriday preview");
        }
        set(publishProgress, 100);
        set(publishUrl, deployPath);
        set(publishSuccess, true);
        new import_obsidian13.Notice(get2(t2)("messages.site_published_successfully"), 3e3);
        await saveCurrentProjectConfiguration();
        if (get2(currentContents).length > 0 && get2(siteName)) {
          const projectId = getProjectId();
          if (projectId) {
            await plugin2().projectService.addBuildHistory({
              projectId,
              timestamp: Date.now(),
              success: true,
              type: "publish",
              publishMethod: "mdf-share",
              url: get2(publishUrl)
            });
          }
        }
        plugin2().hugoverse.sendCounter("mdf-share").catch((error2) => {
          console.warn("Counter request failed (non-critical):", error2);
        });
      } else if (get2(selectedPublishOption) === "mdf-app") {
        const zipContent = await createZipFromDirectory(publicDir);
        set(publishProgress, 50);
        const previewApiId = await plugin2().hugoverse.createMDFPreview(get2(previewId), zipContent, "sub", get2(sitePath));
        if (!previewApiId) {
          throw new Error("Failed to create MDFriday Subdomain preview");
        }
        set(publishProgress, 80);
        const licenseKey = ((_b5 = plugin2().settings.license) === null || _b5 === void 0 ? void 0 : _b5.key) || "";
        const deployPath = await plugin2().hugoverse.deployMDFridayPreview(previewApiId, licenseKey);
        if (!deployPath) {
          throw new Error("Failed to deploy MDFriday Subdomain");
        }
        set(publishProgress, 100);
        const subdomain = plugin2().getEffectiveSubdomain();
        const basePath2 = deployPath.startsWith("/") ? deployPath : `/${deployPath}`;
        const normalizedPath = basePath2 === "/" ? "" : basePath2;
        set(publishUrl, `https://${subdomain}.mdfriday.com${normalizedPath}`);
        set(publishSuccess, true);
        new import_obsidian13.Notice(get2(t2)("messages.site_published_successfully"), 3e3);
        await saveCurrentProjectConfiguration();
        if (get2(currentContents).length > 0 && get2(siteName)) {
          const projectId = getProjectId();
          if (projectId) {
            await plugin2().projectService.addBuildHistory({
              projectId,
              timestamp: Date.now(),
              success: true,
              type: "publish",
              publishMethod: "mdf-app",
              url: get2(publishUrl)
            });
          }
        }
        plugin2().hugoverse.sendCounter("mdf-app").catch((error2) => {
          console.warn("Counter request failed (non-critical):", error2);
        });
      } else if (get2(selectedPublishOption) === "mdf-custom") {
        const zipContent = await createZipFromDirectory(publicDir);
        set(publishProgress, 50);
        const previewApiId = await plugin2().hugoverse.createMDFPreview(get2(previewId), zipContent, "custom", get2(sitePath));
        if (!previewApiId) {
          throw new Error("Failed to create MDFriday Custom Domain preview");
        }
        set(publishProgress, 80);
        const licenseKey = ((_c3 = plugin2().settings.license) === null || _c3 === void 0 ? void 0 : _c3.key) || "";
        const deployPath = await plugin2().hugoverse.deployMDFridayPreview(previewApiId, licenseKey);
        if (!deployPath) {
          throw new Error("Failed to deploy MDFriday Custom Domain");
        }
        set(publishProgress, 100);
        const customDomain = plugin2().settings.customDomain;
        if (!customDomain) {
          throw new Error("Custom domain not configured");
        }
        const basePath2 = deployPath.startsWith("/") ? deployPath : `/${deployPath}`;
        const normalizedPath = basePath2 === "/" ? "" : basePath2;
        set(publishUrl, `https://${customDomain}${normalizedPath}`);
        set(publishSuccess, true);
        new import_obsidian13.Notice(get2(t2)("messages.site_published_successfully"), 3e3);
        await saveCurrentProjectConfiguration();
        if (get2(currentContents).length > 0 && get2(siteName)) {
          const projectId = getProjectId();
          if (projectId) {
            await plugin2().projectService.addBuildHistory({
              projectId,
              timestamp: Date.now(),
              success: true,
              type: "publish",
              publishMethod: "mdf-custom",
              url: get2(publishUrl)
            });
          }
        }
        plugin2().hugoverse.sendCounter("mdf-custom").catch((error2) => {
          console.warn("Counter request failed (non-critical):", error2);
        });
      } else if (get2(selectedPublishOption) === "mdf-enterprise") {
        const zipContent = await createZipFromDirectory(publicDir);
        set(publishProgress, 50);
        const previewApiId = await plugin2().hugoverse.createMDFPreview(get2(previewId), zipContent, "enterprise", get2(sitePath));
        if (!previewApiId) {
          throw new Error("Failed to create MDFriday Enterprise preview");
        }
        set(publishProgress, 80);
        const licenseKey = ((_d2 = plugin2().settings.license) === null || _d2 === void 0 ? void 0 : _d2.key) || "";
        const deployPath = await plugin2().hugoverse.deployMDFridayPreview(previewApiId, licenseKey);
        if (!deployPath) {
          throw new Error("Failed to deploy MDFriday Enterprise");
        }
        set(publishProgress, 100);
        const enterpriseServerUrl = plugin2().settings.enterpriseServerUrl;
        if (!enterpriseServerUrl) {
          throw new Error("Enterprise server URL not configured");
        }
        const fullHost = enterpriseServerUrl.replace(/^https?:\/\//, "").replace(/\/$/, "");
        const hostParts = fullHost.split(".");
        const host = hostParts.length >= 2 ? hostParts.slice(-2).join(".") : fullHost;
        const basePath2 = deployPath.startsWith("/") ? deployPath : `/${deployPath}`;
        const normalizedPath = basePath2 === "/" ? "" : basePath2;
        set(publishUrl, `https://${host}${normalizedPath}`);
        set(publishSuccess, true);
        new import_obsidian13.Notice(get2(t2)("messages.site_published_successfully"), 3e3);
        await saveCurrentProjectConfiguration();
        if (get2(currentContents).length > 0 && get2(siteName)) {
          const projectId = getProjectId();
          if (projectId) {
            await plugin2().projectService.addBuildHistory({
              projectId,
              timestamp: Date.now(),
              success: true,
              type: "publish",
              publishMethod: "mdf-enterprise",
              url: get2(publishUrl)
            });
          }
        }
        plugin2().hugoverse.sendCounter("mdf-enterprise").catch((error2) => {
          console.warn("Counter request failed (non-critical):", error2);
        });
      }
    } catch (error2) {
      console.error("Publishing failed:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.publishing_failed", { error: error2.message }), 5e3);
    } finally {
      set(isPublishing, false);
    }
  }
  async function publishToNetlify(publicDir) {
    try {
      const originalToken = plugin2().settings.netlifyAccessToken;
      const originalProjectId = plugin2().settings.netlifyProjectId;
      plugin2(plugin2().settings.netlifyAccessToken = get2(netlifyAccessToken), true);
      plugin2(plugin2().settings.netlifyProjectId = get2(netlifyProjectId), true);
      try {
        set(publishUrl, await plugin2().netlify.deployToNetlify(publicDir, (progress) => {
          set(publishProgress, Math.round(progress));
        }));
      } finally {
        plugin2(plugin2().settings.netlifyAccessToken = originalToken, true);
        plugin2(plugin2().settings.netlifyProjectId = originalProjectId, true);
      }
      set(publishSuccess, true);
      new import_obsidian13.Notice(get2(t2)("messages.netlify_deploy_success"), 3e3);
      await saveCurrentProjectConfiguration();
      if (get2(currentContents).length > 0 && get2(siteName)) {
        const projectId = getProjectId();
        if (projectId) {
          await plugin2().projectService.addBuildHistory({
            projectId,
            timestamp: Date.now(),
            success: true,
            type: "publish",
            publishMethod: "netlify",
            url: get2(publishUrl)
          });
        }
      }
      plugin2().hugoverse.sendCounter("netlify").catch((error2) => {
        console.warn("Counter request failed (non-critical):", error2);
      });
    } catch (error2) {
      console.error("Netlify deployment failed:", error2);
      throw new Error(get2(t2)("messages.netlify_deploy_failed", { error: error2.message }));
    }
  }
  async function publishToFTP(publicDir) {
    try {
      const originalServer = plugin2().settings.ftpServer;
      const originalUsername = plugin2().settings.ftpUsername;
      const originalPassword = plugin2().settings.ftpPassword;
      const originalRemoteDir = plugin2().settings.ftpRemoteDir;
      const originalIgnoreCert = plugin2().settings.ftpIgnoreCert;
      plugin2(plugin2().settings.ftpServer = get2(ftpServer), true);
      plugin2(plugin2().settings.ftpUsername = get2(ftpUsername), true);
      plugin2(plugin2().settings.ftpPassword = get2(ftpPassword), true);
      plugin2(plugin2().settings.ftpRemoteDir = get2(ftpRemoteDir), true);
      plugin2(plugin2().settings.ftpIgnoreCert = get2(ftpIgnoreCert), true);
      plugin2().initializeFTP(get2(ftpPreferredSecure));
      if (!plugin2().ftp) {
        throw new Error("FTP uploader not initialized - please check FTP settings");
      }
      plugin2().ftp.setConnectionTypeCallback((usedSecure) => {
        set(ftpPreferredSecure, usedSecure);
      });
      plugin2().ftp.setProgressCallback((progress) => {
        set(publishProgress, Math.round(progress.percentage));
      });
      let result;
      try {
        const projectId = getProjectId();
        if (projectId) {
          const oldManifest = await plugin2().projectService.loadManifest(projectId, "ftp");
          let incrementalResult;
          let shouldFallbackToFull = false;
          try {
            incrementalResult = await plugin2().ftp.uploadDirectoryIncremental(publicDir, projectId, oldManifest);
            if (!incrementalResult.success) {
              shouldFallbackToFull = true;
              console.warn("[FTP] Incremental upload failed, will fallback to full upload");
              new import_obsidian13.Notice(get2(t2)("messages.ftp_fallback_to_full") || "\u26A0\uFE0F Incremental upload failed, trying full upload as fallback...", 4e3);
            }
          } catch (err2) {
            shouldFallbackToFull = true;
            console.error("[FTP] Incremental upload error, will fallback to full upload:", err2);
            new import_obsidian13.Notice(get2(t2)("messages.ftp_fallback_to_full") || "\u26A0\uFE0F Incremental upload failed, trying full upload as fallback...", 4e3);
          }
          if (shouldFallbackToFull) {
            console.log("[FTP] Starting full upload as fallback...");
            set(publishProgress, 0);
            result = await plugin2().ftp.uploadDirectory(publicDir);
            if (result.success) {
              console.log("[FTP] Full upload succeeded, generating manifest for next incremental upload");
              const newManifest = await plugin2().ftp.generateManifest(publicDir, projectId);
              newManifest.uploadMethod = "ftp";
              newManifest.remoteDir = plugin2().settings.ftpRemoteDir;
              await plugin2().projectService.saveManifest(newManifest);
            }
          } else {
            result = {
              success: incrementalResult.success,
              usedSecure: incrementalResult.usedSecure,
              error: incrementalResult.error
            };
            if (incrementalResult.success && incrementalResult.newManifest) {
              await plugin2().projectService.saveManifest(incrementalResult.newManifest);
              if (incrementalResult.stats) {
                const { uploaded, deleted, unchanged } = incrementalResult.stats;
                const totalFiles = uploaded + unchanged;
                const savedTime = totalFiles > 0 ? Math.round(unchanged / totalFiles * 100) : 0;
                new import_obsidian13.Notice(get2(t2)("messages.incremental_upload_stats", { uploaded, deleted, unchanged, saved: savedTime }) || `\u2705 Incremental upload: ${uploaded} uploaded, ${deleted} deleted, ${unchanged} unchanged (${savedTime}% time saved)`, 4e3);
              }
            }
          }
        } else {
          result = await plugin2().ftp.uploadDirectory(publicDir);
        }
      } finally {
        plugin2(plugin2().settings.ftpServer = originalServer, true);
        plugin2(plugin2().settings.ftpUsername = originalUsername, true);
        plugin2(plugin2().settings.ftpPassword = originalPassword, true);
        plugin2(plugin2().settings.ftpRemoteDir = originalRemoteDir, true);
        plugin2(plugin2().settings.ftpIgnoreCert = originalIgnoreCert, true);
        plugin2().initializeFTP();
      }
      if (result.success) {
        set(publishSuccess, true);
        set(
          publishUrl,
          ""
          // FTP doesn't return a URL
        );
        if (!result.usedSecure) {
          new import_obsidian13.Notice(get2(t2)("messages.ftp_fallback_to_plain"), 4e3);
        }
        new import_obsidian13.Notice(get2(t2)("messages.ftp_upload_success"), 3e3);
        await saveCurrentProjectConfiguration();
        if (get2(currentContents).length > 0 && get2(siteName)) {
          const projectId = getProjectId();
          if (projectId) {
            await plugin2().projectService.addBuildHistory({
              projectId,
              timestamp: Date.now(),
              success: true,
              type: "publish",
              publishMethod: "ftp"
            });
          }
        }
        plugin2().hugoverse.sendCounter("ftp").catch((error2) => {
          console.warn("Counter request failed (non-critical):", error2);
        });
      } else {
        throw new Error(result.error || "Unknown FTP error");
      }
    } catch (error2) {
      console.error("FTP upload failed:", error2);
      throw new Error(get2(t2)("messages.ftp_upload_failed", { error: error2.message }));
    }
  }
  async function testFTPConnection() {
    set(ftpTestState, "testing");
    set(ftpTestMessage, "");
    try {
      const originalServer = plugin2().settings.ftpServer;
      const originalUsername = plugin2().settings.ftpUsername;
      const originalPassword = plugin2().settings.ftpPassword;
      const originalRemoteDir = plugin2().settings.ftpRemoteDir;
      const originalIgnoreCert = plugin2().settings.ftpIgnoreCert;
      plugin2(plugin2().settings.ftpServer = get2(ftpServer), true);
      plugin2(plugin2().settings.ftpUsername = get2(ftpUsername), true);
      plugin2(plugin2().settings.ftpPassword = get2(ftpPassword), true);
      plugin2(plugin2().settings.ftpRemoteDir = get2(ftpRemoteDir), true);
      plugin2(plugin2().settings.ftpIgnoreCert = get2(ftpIgnoreCert), true);
      plugin2().initializeFTP(get2(ftpPreferredSecure));
      if (plugin2().ftp) {
        plugin2().ftp.setConnectionTypeCallback((usedSecure) => {
          set(ftpPreferredSecure, usedSecure);
        });
      }
      let result;
      try {
        result = await plugin2().testFTPConnection();
      } finally {
        plugin2(plugin2().settings.ftpServer = originalServer, true);
        plugin2(plugin2().settings.ftpUsername = originalUsername, true);
        plugin2(plugin2().settings.ftpPassword = originalPassword, true);
        plugin2(plugin2().settings.ftpRemoteDir = originalRemoteDir, true);
        plugin2(plugin2().settings.ftpIgnoreCert = originalIgnoreCert, true);
        plugin2().initializeFTP();
      }
      if (result.success) {
        set(ftpTestState, "success");
        set(ftpTestMessage, result.message || get2(t2)("settings.ftp_test_connection_success"));
      } else {
        set(ftpTestState, "error");
        set(ftpTestMessage, result.message || get2(t2)("settings.ftp_test_connection_failed"));
      }
    } catch (error2) {
      console.error("FTP test error:", error2);
      set(ftpTestState, "error");
      set(ftpTestMessage, error2.message || get2(t2)("settings.ftp_test_connection_failed"));
    }
  }
  let previousFtpConfig = mutable_source("");
  function generateRandomId() {
    return Math.random().toString(36).substring(2, 8);
  }
  async function createPreviewDirectory(previewDir) {
    const previewRoot = path4.join(plugin2().pluginDir, "preview");
    if (!await app().vault.adapter.exists(previewRoot)) {
      await app().vault.adapter.mkdir(previewRoot);
    }
    if (!await app().vault.adapter.exists(previewDir)) {
      await app().vault.adapter.mkdir(previewDir);
    }
    const contentDir = path4.join(previewDir, "content");
    if (!await app().vault.adapter.exists(contentDir)) {
      await app().vault.adapter.mkdir(contentDir);
    }
    const publicDir = path4.join(previewDir, "public");
    if (!await app().vault.adapter.exists(publicDir)) {
      await app().vault.adapter.mkdir(publicDir);
    }
    const obImagesDir = path4.join(publicDir, "ob-images");
    if (!await app().vault.adapter.exists(obImagesDir)) {
      await app().vault.adapter.mkdir(obImagesDir);
    }
    if (get2(currentAssets) && get2(currentAssets).folder) {
      const staticDir = path4.join(previewDir, "static");
      if (!await app().vault.adapter.exists(staticDir)) {
        await app().vault.adapter.mkdir(staticDir);
      }
    }
  }
  async function createThemesDirectory() {
    if (!await app().vault.adapter.exists(themesDir)) {
      await app().vault.adapter.mkdir(themesDir);
    }
  }
  async function createConfigFile(previewDir) {
    const config = {
      baseURL: get2(
        sitePath
        // Use site path as base URL
      ),
      title: get2(siteName),
      contentDir: "content",
      publishDir: "public",
      defaultContentLanguage: get2(defaultContentLanguage),
      taxonomies: { tag: "tags", category: "categories" },
      module: { imports: [{ path: get2(selectedThemeDownloadUrl) }] },
      markdown: { useInternalRenderer: !hasOBTag },
      params: {
        branding: !get2(
          hasPublishPermission
          // Hide branding if user has publish permission
        ),
        ...get2(sitePassword) && get2(sitePassword).trim() ? { password: get2(sitePassword).trim() } : {}
      }
    };
    const services = {};
    if (get2(googleAnalyticsId) && get2(googleAnalyticsId).trim()) {
      services.googleAnalytics = { id: get2(googleAnalyticsId).trim() };
    }
    if (get2(disqusShortname) && get2(disqusShortname).trim()) {
      services.disqus = { shortname: get2(disqusShortname).trim() };
    }
    if (Object.keys(services).length > 0) {
      config.services = services;
    }
    if (get2(currentContents).length > 0) {
      const languages = {};
      get2(currentContents).forEach((content, index6) => {
        const contentDir = index6 === 0 ? "content" : `content.${content.languageCode}`;
        languages[content.languageCode] = { contentDir, weight: content.weight };
      });
      config.languages = languages;
    }
    const configPath = path4.join(previewDir, "config.json");
    await app().vault.adapter.write(configPath, JSON.stringify(config, null, 2));
  }
  async function exportSite() {
    if (!get2(hasPreview) || !absPreviewDir) {
      new import_obsidian13.Notice(get2(t2)("messages.please_generate_preview_first"), 3e3);
      return;
    }
    set(isExporting, true);
    try {
      const publicDir = path4.join(absPreviewDir, "public");
      const zipContent = await createZipFromDirectory(publicDir);
      const { dialog } = require("@electron/remote") || require("electron").remote;
      const { canceled, filePath } = await dialog.showSaveDialog({
        title: get2(t2)("ui.export_site_dialog_title"),
        defaultPath: "mdfriday-site.zip",
        filters: [
          { name: "ZIP Files", extensions: ["zip"] },
          { name: "All Files", extensions: ["*"] }
        ]
      });
      if (!canceled && filePath) {
        await fs3.promises.writeFile(filePath, zipContent);
        new import_obsidian13.Notice(get2(t2)("messages.site_exported_successfully", { path: filePath }), 3e3);
      }
    } catch (error2) {
      console.error("Export failed:", error2);
      new import_obsidian13.Notice(get2(t2)("messages.export_failed", { error: error2.message }), 5e3);
    } finally {
      set(isExporting, false);
    }
  }
  async function linkMultiLanguageContents(previewDir) {
    for (let i = 0; i < get2(currentContents).length; i++) {
      const content = get2(currentContents)[i];
      const contentDir = i === 0 ? "content" : `content.${content.languageCode}`;
      const targetPath = path4.join(previewDir, contentDir);
      if (content.folder) {
        await linkFolderContents(content.folder, targetPath);
      } else if (content.file) {
        await linkSingleFileContent(content.file, targetPath);
      }
    }
  }
  async function linkFolderContents(folder, targetPath) {
    const adapter = app().vault.adapter;
    let sourcePath;
    let absTargetPath;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      sourcePath = path4.join(adapter.getBasePath(), folder.path);
      absTargetPath = path4.join(adapter.getBasePath(), targetPath);
      absSelectedFolderPath.push(sourcePath);
      absProjContentPath.push(absTargetPath);
    } else {
      console.warn("Not using FileSystemAdapter, falling back to copying files");
      await copyFolderContents(folder, targetPath);
      return;
    }
    try {
      if (await app().vault.adapter.exists(targetPath)) {
        await app().vault.adapter.rmdir(targetPath, true);
      }
      if (isWindows) {
        await fs3.promises.symlink(sourcePath, absTargetPath, "junction");
        return;
      }
      await fs3.promises.symlink(sourcePath, absTargetPath, "dir");
    } catch (error2) {
      console.error("Failed to create symbolic link, falling back to copying:", error2);
      await copyFolderContents(folder, targetPath);
    }
  }
  async function copyFolderContents(folder, targetPath) {
    const copyRecursive = async (sourceFolder, destPath) => {
      for (const child2 of sourceFolder.children) {
        if (child2 instanceof import_obsidian13.TFolder) {
          const childDestPath = path4.join(destPath, child2.name);
          if (!await app().vault.adapter.exists(childDestPath)) {
            await app().vault.adapter.mkdir(childDestPath);
          }
          await copyRecursive(child2, childDestPath);
        } else if (child2 instanceof import_obsidian13.TFile) {
          const childDestPath = path4.join(destPath, child2.name);
          try {
            const content = await app().vault.read(child2);
            await app().vault.adapter.write(childDestPath, content);
          } catch (error2) {
            console.warn(`Failed to copy file ${child2.path}:`, error2);
          }
        }
      }
    };
    await copyRecursive(folder, targetPath);
  }
  async function linkSingleFileContent(file, targetPath) {
    const adapter = app().vault.adapter;
    let sourcePath;
    let absTargetPath;
    let absContentDir;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      sourcePath = path4.join(adapter.getBasePath(), file.path);
      absContentDir = path4.join(adapter.getBasePath(), targetPath);
      absTargetPath = path4.join(absContentDir, "index.md");
      absSelectedFolderPath.push(path4.dirname(sourcePath));
      absProjContentPath.push(absContentDir);
    } else {
      console.warn("Not using FileSystemAdapter, falling back to copying file");
      await copySingleFileContent(file, targetPath);
      return;
    }
    try {
      if (!await app().vault.adapter.exists(targetPath)) {
        await app().vault.adapter.mkdir(targetPath);
      }
      if (await app().vault.adapter.exists(path4.join(targetPath, "index.md"))) {
        await app().vault.adapter.remove(path4.join(targetPath, "index.md"));
      }
      if (isWindows) {
        await fs3.promises.symlink(sourcePath, absTargetPath, "file");
      } else {
        await fs3.promises.symlink(sourcePath, absTargetPath);
      }
    } catch (error2) {
      console.error("Failed to create symbolic link for file, falling back to copying:", error2);
      await copySingleFileContent(file, targetPath);
    }
  }
  async function copySingleFileContent(file, targetPath) {
    if (!await app().vault.adapter.exists(targetPath)) {
      await app().vault.adapter.mkdir(targetPath);
    }
    const indexPath = path4.join(targetPath, "index.md");
    try {
      const fileContent = await app().vault.read(file);
      await app().vault.adapter.write(indexPath, fileContent);
    } catch (error2) {
      console.error("Failed to copy file content:", error2);
      throw error2;
    }
  }
  async function copySiteAssetsToPreview(previewDir) {
    if (!get2(currentAssets) || !get2(currentAssets).folder) {
      return;
    }
    const assetsSourceFolder = get2(currentAssets).folder;
    const staticTargetDir = path4.join(previewDir, "static");
    try {
      const adapter = app().vault.adapter;
      if (adapter instanceof import_obsidian13.FileSystemAdapter) {
        const absSourcePath = path4.join(adapter.getBasePath(), assetsSourceFolder.path);
        const absTargetPath = path4.join(adapter.getBasePath(), staticTargetDir);
        await fs3.promises.cp(absSourcePath, absTargetPath, {
          recursive: true,
          force: true
          // Overwrite existing files
        });
      } else {
        await copyAssetsUsingObsidianAPI(assetsSourceFolder, staticTargetDir);
      }
    } catch (error2) {
      console.error("Failed to copy site assets:", error2);
    }
  }
  async function copyAssetsUsingObsidianAPI(sourceFolder, targetDir) {
    const copyRecursive = async (sourceFolder2, destPath) => {
      for (const child2 of sourceFolder2.children) {
        if (child2 instanceof import_obsidian13.TFolder) {
          const childDestPath = path4.join(destPath, child2.name);
          if (!await app().vault.adapter.exists(childDestPath)) {
            await app().vault.adapter.mkdir(childDestPath);
          }
          await copyRecursive(child2, childDestPath);
        } else if (child2 instanceof import_obsidian13.TFile) {
          const childDestPath = path4.join(destPath, child2.name);
          try {
            const content = await app().vault.readBinary(child2);
            await app().vault.adapter.writeBinary(childDestPath, content);
          } catch (error2) {
            console.warn(`Failed to copy asset file ${child2.path}:`, error2);
          }
        }
      }
    };
    await copyRecursive(sourceFolder, targetDir);
  }
  async function ensureRootFolderExists() {
    const adapter = app().vault.adapter;
    let rootFolderPath;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      const vaultBasePath = adapter.getBasePath();
      rootFolderPath = path4.join(vaultBasePath, FRIDAY_ROOT_FOLDER);
    } else {
      rootFolderPath = FRIDAY_ROOT_FOLDER;
    }
    if (isWindows) {
      rootFolderPath = path4.normalize(rootFolderPath);
    }
    if (!await adapter.exists(rootFolderPath)) {
      if (adapter instanceof import_obsidian13.FileSystemAdapter && path4.isAbsolute(rootFolderPath)) {
        await fs3.promises.mkdir(rootFolderPath, { recursive: true });
      } else {
        await adapter.mkdir(rootFolderPath);
      }
    }
  }
  async function generateUniqueFolderName(baseName) {
    let folderName = baseName;
    let counter = 0;
    const adapter = app().vault.adapter;
    let rootFolderPath;
    if (adapter instanceof import_obsidian13.FileSystemAdapter) {
      const vaultBasePath = adapter.getBasePath();
      rootFolderPath = path4.join(vaultBasePath, FRIDAY_ROOT_FOLDER);
    } else {
      rootFolderPath = FRIDAY_ROOT_FOLDER;
    }
    if (isWindows) {
      rootFolderPath = path4.normalize(rootFolderPath);
    }
    while (await checkFolderExists(path4.join(rootFolderPath, folderName))) {
      counter++;
      folderName = `${baseName} ${counter}`;
    }
    return folderName;
  }
  async function checkFolderExists(folderPath) {
    const adapter = app().vault.adapter;
    if (adapter instanceof import_obsidian13.FileSystemAdapter && path4.isAbsolute(folderPath)) {
      try {
        await fs3.promises.access(folderPath);
        return true;
      } catch (_a7) {
        return false;
      }
    } else {
      return await adapter.exists(folderPath);
    }
  }
  async function downloadAndUnzipSample(downloadUrl, targetFolderPath, progressCallback) {
    try {
      progressCallback(10);
      const response = await (0, import_obsidian13.requestUrl)({ url: downloadUrl, method: "GET" });
      if (response.status !== 200) {
        throw new Error(`Download failed with status: ${response.status}`);
      }
      progressCallback(50);
      const zip = new import_jszip.default();
      const zipData = await zip.loadAsync(response.arrayBuffer);
      progressCallback(70);
      if (!await checkFolderExists(targetFolderPath)) {
        if (path4.isAbsolute(targetFolderPath)) {
          await fs3.promises.mkdir(targetFolderPath, { recursive: true });
        } else {
          await app().vault.adapter.mkdir(targetFolderPath);
        }
      }
      const files = Object.keys(zipData.files);
      let processedFiles = 0;
      for (const fileName of files) {
        const file = zipData.files[fileName];
        let normalizedFileName = fileName;
        if (isWindows) {
          normalizedFileName = fileName.replace(/\//g, path4.sep);
        }
        normalizedFileName = path4.normalize(normalizedFileName);
        if (file.dir) {
          const dirPath = path4.join(targetFolderPath, normalizedFileName);
          if (!await checkFolderExists(dirPath)) {
            if (path4.isAbsolute(dirPath)) {
              await fs3.promises.mkdir(dirPath, { recursive: true });
            } else {
              await app().vault.adapter.mkdir(dirPath);
            }
          }
        } else {
          const filePath = path4.join(targetFolderPath, normalizedFileName);
          const parentDir = path4.dirname(filePath);
          if (parentDir !== targetFolderPath && !await checkFolderExists(parentDir)) {
            if (path4.isAbsolute(parentDir)) {
              await fs3.promises.mkdir(parentDir, { recursive: true });
            } else {
              await app().vault.adapter.mkdir(parentDir);
            }
          }
          const fileContent = await file.async("uint8array");
          if (path4.isAbsolute(filePath)) {
            await fs3.promises.writeFile(filePath, fileContent);
          } else {
            await app().vault.adapter.writeBinary(filePath, fileContent.buffer);
          }
        }
        processedFiles++;
        const extractProgress = 70 + processedFiles / files.length * 30;
        progressCallback(Math.round(extractProgress));
      }
      progressCallback(100);
    } catch (error2) {
      console.error("Download and unzip failed:", error2);
      throw error2;
    }
  }
  async function createZipFromDirectory(sourceDir) {
    const zip = new import_jszip.default();
    const addDirectoryToZip = async (dirPath, zipFolder) => {
      const items = await fs3.promises.readdir(dirPath, { withFileTypes: true });
      for (const item of items) {
        const itemPath = path4.join(dirPath, item.name);
        if (item.isDirectory()) {
          const subFolder = zipFolder.folder(item.name);
          if (subFolder) {
            await addDirectoryToZip(itemPath, subFolder);
          }
        } else if (item.isFile()) {
          const fileContent = await fs3.promises.readFile(itemPath);
          zipFolder.file(item.name, fileContent);
        }
      }
    };
    await addDirectoryToZip(sourceDir, zip);
    return await zip.generateAsync({ type: "uint8array" });
  }
  legacy_pre_effect(() => deep_read_state(plugin2()), () => {
    set(site, plugin2().site);
  });
  legacy_pre_effect(() => get2(site), () => {
    store_unsub(set(languageContents, get2(site) ? get2(site).languageContents : null), "$languageContents", $$stores);
  });
  legacy_pre_effect(() => get2(site), () => {
    store_unsub(set(siteAssets, get2(site) ? get2(site).siteAssets : null), "$siteAssets", $$stores);
  });
  legacy_pre_effect(() => (safe_get(_a6), deep_read_state(plugin2())), () => {
    set(t2, (set(_a6, plugin2().i18n) === null || safe_get(_a6) === void 0 ? void 0 : safe_get(_a6).t) || ((key4) => key4));
  });
  legacy_pre_effect(() => $languageContents(), () => {
    set(currentContents, $languageContents() || []);
  });
  legacy_pre_effect(() => $siteAssets(), () => {
    set(currentAssets, $siteAssets() || null);
  });
  legacy_pre_effect(() => get2(site), () => {
    set(isForSingleFile, get2(site) ? get2(site).isForSingleFile() : false);
  });
  legacy_pre_effect(() => get2(site), () => {
    set(defaultContentLanguage, get2(site) ? get2(site).getDefaultContentLanguage() : "en");
  });
  legacy_pre_effect(() => get2(currentContents), () => {
    if (get2(currentContents).length === 0) {
      set(hasPreview, false);
      set(previewUrl, "");
      set(previewId, "");
      set(
        siteName,
        ""
        // 清空内容时也清空站点名称
      );
      set(
        userHasSelectedTheme,
        false
        // 重置主题选择标志，允许重新自动选择
      );
      set(
        previousContentLength,
        0
        // 重置内容长度跟踪，允许下次首次添加时设置站点名称
      );
      set(netlifyAccessToken, "");
      set(netlifyProjectId, "");
      set(ftpServer, "");
      set(ftpUsername, "");
      set(ftpPassword, "");
      set(ftpRemoteDir, "");
      set(ftpIgnoreCert, true);
      set(ftpPreferredSecure, void 0);
      set(ftpTestState, "idle");
      set(ftpTestMessage, "");
    }
  });
  legacy_pre_effect(
    () => (get2(currentContents), get2(userHasSelectedTheme), get2(selectedThemeDownloadUrl)),
    () => {
      if (get2(currentContents).length > 0 && !get2(userHasSelectedTheme)) {
        const firstContent = get2(currentContents)[0];
        if (firstContent.file && !get2(selectedThemeDownloadUrl).includes("note")) {
          set(selectedThemeDownloadUrl, NOTE_THEME_URL);
          set(selectedThemeName, NOTE_THEME_NAME);
          set(selectedThemeId, NOTE_THEME_ID);
        } else if (firstContent.folder && !get2(selectedThemeDownloadUrl).includes("book")) {
          set(selectedThemeDownloadUrl, BOOK_THEME_URL);
          set(selectedThemeName, BOOK_THEME_NAME);
          set(selectedThemeId, BOOK_THEME_ID);
        }
      }
    }
  );
  legacy_pre_effect(
    () => (get2(userDir), safe_get(_b4), deep_read_state(plugin2()), get2(isLicenseActivated), safe_get(_c2), safe_get(_d), get2(t2)),
    () => {
      set(userDir, (set(_b4, plugin2().settings.licenseUser) === null || safe_get(_b4) === void 0 ? void 0 : safe_get(_b4).userDir) || "");
      set(isLicenseActivated, !!(plugin2().settings.license && get2(userDir)));
      const features = set(_c2, plugin2().settings.license) === null || safe_get(_c2) === void 0 ? void 0 : safe_get(_c2).features;
      const licenseplan = set(_d, plugin2().settings.license) === null || safe_get(_d) === void 0 ? void 0 : safe_get(_d).plan;
      set(hasPublishPermission, get2(isLicenseActivated) && (features === null || features === void 0 ? void 0 : features.publish_enabled) === true);
      set(hasSubdomainPermission, get2(isLicenseActivated) && (features === null || features === void 0 ? void 0 : features.custom_sub_domain) === true);
      set(hasCustomDomainPermission, get2(isLicenseActivated) && (features === null || features === void 0 ? void 0 : features.custom_domain) === true);
      set(hasEnterprisePermission, get2(isLicenseActivated) && licenseplan === "enterprise" && !!plugin2().settings.enterpriseServerUrl);
      set(publishOptions, [
        {
          value: "netlify",
          label: get2(t2)("ui.publish_option_netlify")
        },
        { value: "ftp", label: get2(t2)("ui.publish_option_ftp") },
        {
          value: "mdf-share",
          label: get2(t2)("ui.publish_option_mdfriday_share")
        },
        {
          value: "mdf-app",
          label: get2(t2)("ui.publish_option_mdfriday_app")
        },
        {
          value: "mdf-custom",
          label: get2(t2)("ui.publish_option_mdfriday_custom")
        },
        {
          value: "mdf-enterprise",
          label: get2(t2)("ui.publish_option_mdfriday_enterprise")
        }
      ]);
    }
  );
  legacy_pre_effect(() => get2(selectedPublishOption), () => {
    set(requiresPublishPermission, get2(selectedPublishOption) === "mdf-share");
  });
  legacy_pre_effect(() => get2(selectedPublishOption), () => {
    set(requiresSubdomainPermission, get2(selectedPublishOption) === "mdf-app");
  });
  legacy_pre_effect(() => get2(selectedPublishOption), () => {
    set(requiresCustomDomainPermission, get2(selectedPublishOption) === "mdf-custom");
  });
  legacy_pre_effect(() => get2(selectedPublishOption), () => {
    set(requiresEnterprisePermission, get2(selectedPublishOption) === "mdf-enterprise");
  });
  legacy_pre_effect(
    () => (get2(requiresPublishPermission), get2(hasPublishPermission), get2(requiresSubdomainPermission), get2(hasSubdomainPermission), get2(requiresCustomDomainPermission), get2(hasCustomDomainPermission), get2(requiresEnterprisePermission), get2(hasEnterprisePermission)),
    () => {
      set(isPublishDisabled, get2(requiresPublishPermission) && !get2(hasPublishPermission) || get2(requiresSubdomainPermission) && !get2(hasSubdomainPermission) || get2(requiresCustomDomainPermission) && !get2(hasCustomDomainPermission) || get2(requiresEnterprisePermission) && !get2(hasEnterprisePermission));
    }
  );
  legacy_pre_effect(() => (get2(currentContents), safe_get(_e), safe_get(_f)), () => {
    set(contentPath, get2(currentContents).length > 0 ? (set(_e, get2(currentContents)[0].folder) === null || safe_get(_e) === void 0 ? void 0 : safe_get(_e).name) || (set(_f, get2(currentContents)[0].file) === null || safe_get(_f) === void 0 ? void 0 : safe_get(_f).name) || "" : "");
  });
  legacy_pre_effect(
    () => (get2(previousContentLength), get2(currentContents), get2(siteName), safe_get(_g), safe_get(_h)),
    () => {
      if (get2(previousContentLength) === 0 && get2(currentContents).length > 0 && !get2(siteName)) {
        const firstContent = get2(currentContents)[0];
        let defaultName = (set(_g, firstContent.folder) === null || safe_get(_g) === void 0 ? void 0 : safe_get(_g).name) || (set(_h, firstContent.file) === null || safe_get(_h) === void 0 ? void 0 : safe_get(_h).basename) || "";
        if (firstContent.folder) {
          const folderName = firstContent.folder.name.toLowerCase();
          if ((folderName === "content" || folderName.startsWith("content.")) && firstContent.folder.parent) {
            defaultName = firstContent.folder.parent.name;
          }
        }
        set(siteName, defaultName);
        loadDefaultPublishConfigIfNeeded();
      }
      set(previousContentLength, get2(currentContents).length);
    }
  );
  legacy_pre_effect(() => get2(selectedThemeName), () => {
    set(displayThemeName, get2(selectedThemeName) || BOOK_THEME_NAME);
  });
  legacy_pre_effect(() => (get2(ftpServer), get2(ftpUsername), get2(ftpPassword)), () => {
    set(isFTPConfigured, !!(get2(ftpServer).trim() && get2(ftpUsername).trim() && get2(ftpPassword).trim()));
  });
  legacy_pre_effect(
    () => (get2(ftpServer), get2(ftpUsername), get2(ftpPassword), get2(ftpRemoteDir), get2(ftpIgnoreCert), get2(previousFtpConfig), get2(ftpTestState)),
    () => {
      const currentFtpConfig = `${get2(ftpServer)}|${get2(ftpUsername)}|${get2(ftpPassword)}|${get2(ftpRemoteDir)}|${get2(ftpIgnoreCert)}`;
      if (get2(previousFtpConfig) && get2(previousFtpConfig) !== currentFtpConfig && get2(ftpTestState) !== "idle") {
        set(ftpTestState, "idle");
        set(ftpTestMessage, "");
      }
      set(previousFtpConfig, currentFtpConfig);
    }
  );
  legacy_pre_effect_reset();
  var $$exports = {
    get app() {
      return app();
    },
    set app($$value) {
      app($$value);
      flushSync();
    },
    get plugin() {
      return plugin2();
    },
    set plugin($$value) {
      plugin2($$value);
      flushSync();
    },
    $set: update_legacy_props,
    $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb)
  };
  init2();
  var div = root3();
  var div_1 = child(div);
  var div_2 = child(div_1);
  var text3 = child(div_2, true);
  reset(div_2);
  var div_3 = sibling(div_2, 2);
  var div_4 = child(div_3);
  var div_5 = child(div_4);
  var text_1 = child(div_5, true);
  reset(div_5);
  var div_6 = sibling(div_5, 2);
  var span = child(div_6);
  var text_2 = child(span, true);
  reset(span);
  var node = sibling(span, 2);
  {
    var consequent = ($$anchor2) => {
      var button = root_1();
      var text_3 = child(button, true);
      reset(button);
      template_effect(
        ($0, $1) => {
          set_attribute2(button, "title", $0);
          set_text(text_3, $1);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("ui.clear_all_content"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.clear")))
        ]
      );
      event("click", button, clearAllContent);
      append($$anchor2, button);
    };
    if_block(node, ($$render) => {
      if (get2(currentContents), untrack(() => get2(currentContents).length > 0)) $$render(consequent);
    });
  }
  reset(div_6);
  reset(div_4);
  var node_1 = sibling(div_4, 2);
  each(node_1, 1, () => get2(currentContents), (content) => content.id, ($$anchor2, content) => {
    var div_7 = root_2();
    let classes;
    var div_8 = child(div_7);
    var span_1 = child(div_8);
    var text_4 = child(span_1, true);
    reset(span_1);
    var node_2 = sibling(span_1, 2);
    {
      var consequent_1 = ($$anchor3) => {
        var span_2 = root_3();
        var text_5 = child(span_2, true);
        reset(span_2);
        template_effect(($0) => set_text(text_5, $0), [() => (get2(t2), untrack(() => get2(t2)("ui.default")))]);
        append($$anchor3, span_2);
      };
      if_block(node_2, ($$render) => {
        if (get2(content), untrack(() => get2(content).weight === 1)) $$render(consequent_1);
      });
    }
    reset(div_8);
    var div_9 = sibling(div_8, 2);
    var select = child(div_9);
    each(select, 5, () => SUPPORTED_LANGUAGES, index5, ($$anchor3, lang) => {
      var option_1 = root_4();
      var text_6 = child(option_1);
      reset(option_1);
      var option_1_value = {};
      template_effect(() => {
        var _a7, _b5, _c3;
        set_text(text_6, `${(_a7 = (get2(lang), untrack(() => get2(lang).name))) != null ? _a7 : ""} (${(_b5 = (get2(lang), untrack(() => get2(lang).englishName))) != null ? _b5 : ""})`);
        if (option_1_value !== (option_1_value = (get2(lang), untrack(() => get2(lang).code)))) {
          option_1.value = (_c3 = option_1.__value = (get2(lang), untrack(() => get2(lang).code))) != null ? _c3 : "";
        }
      });
      append($$anchor3, option_1);
    });
    reset(select);
    var select_value;
    init_select2(select);
    var node_3 = sibling(select, 2);
    {
      var consequent_2 = ($$anchor3) => {
        var button_1 = root_5();
        template_effect(($0) => set_attribute2(button_1, "title", $0), [
          () => (get2(t2), untrack(() => get2(t2)("ui.remove_language")))
        ]);
        event("click", button_1, () => removeLanguageContent(get2(content).id));
        append($$anchor3, button_1);
      };
      if_block(node_3, ($$render) => {
        if (get2(currentContents), untrack(() => get2(currentContents).length > 1)) $$render(consequent_2);
      });
    }
    reset(div_9);
    reset(div_7);
    template_effect(
      ($0, $1) => {
        var _a7;
        classes = set_class(div_7, 1, "multilang-row svelte-1nad34y", null, classes, $0);
        set_text(text_4, $1);
        if (select_value !== (select_value = (get2(content), untrack(() => get2(content).languageCode)))) {
          select.value = (_a7 = select.__value = (get2(content), untrack(() => get2(content).languageCode))) != null ? _a7 : "", select_option(select, (get2(content), untrack(() => get2(content).languageCode)));
        }
      },
      [
        () => ({ removable: get2(currentContents).length > 1 }),
        () => (get2(content), get2(t2), untrack(() => get2(content).folder ? get2(content).folder.name : get2(content).file ? get2(content).file.name : get2(t2)("ui.no_content_selected")))
      ]
    );
    event("change", select, (e2) => updateLanguageCode(get2(content).id, e2.currentTarget.value));
    append($$anchor2, div_7);
  });
  var node_4 = sibling(node_1, 2);
  {
    var consequent_3 = ($$anchor2) => {
      var div_10 = root_6();
      var span_3 = child(div_10);
      var text_7 = child(span_3, true);
      reset(span_3);
      reset(div_10);
      template_effect(($0) => set_text(text_7, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.no_content_selected_hint")))
      ]);
      append($$anchor2, div_10);
    };
    if_block(node_4, ($$render) => {
      if (get2(currentContents), untrack(() => get2(currentContents).length === 0)) $$render(consequent_3);
    });
  }
  reset(div_3);
  reset(div_1);
  var div_11 = sibling(div_1, 2);
  var label = child(div_11);
  var text_8 = child(label, true);
  reset(label);
  var input = sibling(label, 2);
  remove_input_defaults(input);
  reset(div_11);
  var div_12 = sibling(div_11, 2);
  var div_13 = child(div_12);
  var text_9 = child(div_13, true);
  reset(div_13);
  var div_14 = sibling(div_13, 2);
  var div_15 = child(div_14);
  var node_5 = child(div_15);
  {
    var consequent_4 = ($$anchor2) => {
      var fragment = root_7();
      var span_4 = first_child(fragment);
      var text_10 = child(span_4, true);
      reset(span_4);
      var button_2 = sibling(span_4, 2);
      var text_11 = child(button_2, true);
      reset(button_2);
      template_effect(
        ($0, $1) => {
          set_text(text_10, (get2(currentAssets), untrack(() => {
            var _a7;
            return ((_a7 = get2(currentAssets).folder) == null ? void 0 : _a7.name) || get2(currentAssets).path;
          })));
          set_attribute2(button_2, "title", $0);
          set_text(text_11, $1);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("ui.clear_assets"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.clear_assets")))
        ]
      );
      event("click", button_2, clearSiteAssets);
      append($$anchor2, fragment);
    };
    var alternate = ($$anchor2) => {
      var span_5 = root_8();
      var text_12 = child(span_5, true);
      reset(span_5);
      template_effect(($0) => set_text(text_12, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.site_assets_placeholder")))
      ]);
      append($$anchor2, span_5);
    };
    if_block(node_5, ($$render) => {
      if (get2(currentAssets)) $$render(consequent_4);
      else $$render(alternate, false);
    });
  }
  reset(div_15);
  var div_16 = sibling(div_15, 2);
  var text_13 = child(div_16, true);
  reset(div_16);
  reset(div_14);
  reset(div_12);
  var div_17 = sibling(div_12, 2);
  var div_18 = child(div_17);
  var button_3 = child(div_18);
  var span_6 = child(button_3);
  let classes_1;
  var text_14 = sibling(span_6);
  reset(button_3);
  var node_6 = sibling(button_3, 2);
  {
    var consequent_5 = ($$anchor2) => {
      var div_19 = root_9();
      var div_20 = child(div_19);
      var label_1 = child(div_20);
      var text_15 = child(label_1, true);
      reset(label_1);
      var input_1 = sibling(label_1, 2);
      remove_input_defaults(input_1);
      var div_21 = sibling(input_1, 2);
      var text_16 = child(div_21, true);
      reset(div_21);
      reset(div_20);
      var div_22 = sibling(div_20, 2);
      var label_2 = child(div_22);
      var text_17 = child(label_2, true);
      reset(label_2);
      var input_2 = sibling(label_2, 2);
      remove_input_defaults(input_2);
      var div_23 = sibling(input_2, 2);
      var text_18 = child(div_23, true);
      reset(div_23);
      reset(div_22);
      var div_24 = sibling(div_22, 2);
      var label_3 = child(div_24);
      var text_19 = child(label_3, true);
      reset(label_3);
      var input_3 = sibling(label_3, 2);
      remove_input_defaults(input_3);
      var div_25 = sibling(input_3, 2);
      var text_20 = child(div_25, true);
      reset(div_25);
      reset(div_24);
      var div_26 = sibling(div_24, 2);
      var label_4 = child(div_26);
      var text_21 = child(label_4, true);
      reset(label_4);
      var input_4 = sibling(label_4, 2);
      remove_input_defaults(input_4);
      var div_27 = sibling(input_4, 2);
      var text_22 = child(div_27, true);
      reset(div_27);
      reset(div_26);
      reset(div_19);
      template_effect(
        ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) => {
          set_text(text_15, $0);
          set_attribute2(input_1, "placeholder", $1);
          set_attribute2(input_1, "title", $2);
          set_text(text_16, $3);
          set_text(text_17, $4);
          set_attribute2(input_2, "placeholder", $5);
          set_attribute2(input_2, "title", $6);
          set_text(text_18, $7);
          set_text(text_19, $8);
          set_attribute2(input_3, "placeholder", $9);
          set_attribute2(input_3, "title", $10);
          set_text(text_20, $11);
          set_text(text_21, $12);
          set_attribute2(input_4, "placeholder", $13);
          set_attribute2(input_4, "title", $14);
          set_text(text_22, $15);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("ui.site_path"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_path_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_path_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_path_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_password"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_password_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_password_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.site_password_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.google_analytics_id"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.google_analytics_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.google_analytics_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.google_analytics_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.disqus_shortname"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.disqus_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.disqus_hint"))),
          () => (get2(t2), untrack(() => get2(t2)("ui.disqus_hint")))
        ]
      );
      bind_value(input_1, () => get2(sitePath), ($$value) => set(sitePath, $$value));
      event("blur", input_1, handleSitePathChange);
      bind_value(input_2, () => get2(sitePassword), ($$value) => set(sitePassword, $$value));
      bind_value(input_3, () => get2(googleAnalyticsId), ($$value) => set(googleAnalyticsId, $$value));
      bind_value(input_4, () => get2(disqusShortname), ($$value) => set(disqusShortname, $$value));
      append($$anchor2, div_19);
    };
    if_block(node_6, ($$render) => {
      if (get2(showAdvancedSettings)) $$render(consequent_5);
    });
  }
  reset(div_18);
  reset(div_17);
  var div_28 = sibling(div_17, 2);
  var label_5 = child(div_28);
  var text_23 = child(label_5, true);
  reset(label_5);
  var div_29 = sibling(label_5, 2);
  var div_30 = child(div_29);
  var span_7 = child(div_30);
  var text_24 = child(span_7, true);
  reset(span_7);
  var div_31 = sibling(span_7, 2);
  var button_4 = child(div_31);
  var text_25 = child(button_4, true);
  reset(button_4);
  var node_7 = sibling(button_4, 2);
  {
    var consequent_7 = ($$anchor2) => {
      var fragment_1 = comment();
      var node_8 = first_child(fragment_1);
      {
        var consequent_6 = ($$anchor3) => {
          var div_32 = root_11();
          var span_8 = child(div_32);
          var text_26 = child(span_8, true);
          reset(span_8);
          var node_9 = sibling(span_8, 2);
          ProgressBar(node_9, {
            get progress() {
              return get2(sampleDownloadProgress);
            }
          });
          reset(div_32);
          template_effect(($0) => set_text(text_26, $0), [
            () => (get2(t2), untrack(() => get2(t2)("ui.downloading_sample")))
          ]);
          append($$anchor3, div_32);
        };
        var alternate_1 = ($$anchor3) => {
          var button_5 = root_12();
          var text_27 = child(button_5, true);
          reset(button_5);
          template_effect(($0) => set_text(text_27, $0), [
            () => (get2(t2), untrack(() => get2(t2)("ui.download_sample")))
          ]);
          event("click", button_5, downloadThemeSample);
          append($$anchor3, button_5);
        };
        if_block(node_8, ($$render) => {
          if (get2(isDownloadingSample)) $$render(consequent_6);
          else $$render(alternate_1, false);
        });
      }
      append($$anchor2, fragment_1);
    };
    if_block(node_7, ($$render) => {
      if (get2(currentThemeWithSample), untrack(() => get2(currentThemeWithSample) && get2(currentThemeWithSample).demo_notes_url)) $$render(consequent_7);
    });
  }
  reset(div_31);
  reset(div_30);
  reset(div_29);
  reset(div_28);
  var div_33 = sibling(div_28, 2);
  var h3 = child(div_33);
  var text_28 = child(h3, true);
  reset(h3);
  var div_34 = sibling(h3, 2);
  var node_10 = child(div_34);
  {
    var consequent_8 = ($$anchor2) => {
      var div_35 = root_13();
      var p = child(div_35);
      var text_29 = child(p, true);
      reset(p);
      var node_11 = sibling(p, 2);
      ProgressBar(node_11, {
        get progress() {
          return get2(buildProgress);
        }
      });
      reset(div_35);
      template_effect(($0) => set_text(text_29, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.preview_building")))
      ]);
      append($$anchor2, div_35);
    };
    var alternate_2 = ($$anchor2) => {
      var button_6 = root_14();
      var text_30 = child(button_6, true);
      reset(button_6);
      template_effect(
        ($0) => {
          button_6.disabled = (get2(currentContents), untrack(() => get2(currentContents).length === 0));
          set_text(text_30, $0);
        },
        [
          () => (get2(hasPreview), get2(t2), untrack(() => get2(hasPreview) ? get2(t2)("ui.regenerate_preview") : get2(t2)("ui.generate_preview")))
        ]
      );
      event("click", button_6, startPreview);
      append($$anchor2, button_6);
    };
    if_block(node_10, ($$render) => {
      if (get2(isBuilding)) $$render(consequent_8);
      else $$render(alternate_2, false);
    });
  }
  var node_12 = sibling(node_10, 2);
  {
    var consequent_9 = ($$anchor2) => {
      var div_36 = root_15();
      var p_1 = child(div_36);
      var text_31 = child(p_1, true);
      reset(p_1);
      var a = sibling(p_1, 2);
      var text_32 = child(a, true);
      reset(a);
      var div_37 = sibling(a, 2);
      var button_7 = child(div_37);
      var text_33 = child(button_7, true);
      reset(button_7);
      reset(div_37);
      reset(div_36);
      template_effect(
        ($0, $1) => {
          set_text(text_31, $0);
          set_attribute2(a, "href", get2(previewUrl));
          set_text(text_32, get2(previewUrl));
          button_7.disabled = get2(isExporting);
          set_text(text_33, $1);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("ui.preview_link"))),
          () => (get2(isExporting), get2(t2), untrack(() => get2(isExporting) ? get2(t2)("ui.exporting") : get2(t2)("ui.export_site")))
        ]
      );
      event("click", button_7, exportSite);
      append($$anchor2, div_36);
    };
    if_block(node_12, ($$render) => {
      if (get2(hasPreview) && get2(previewUrl)) $$render(consequent_9);
    });
  }
  reset(div_34);
  reset(div_33);
  var div_38 = sibling(div_33, 2);
  var h3_1 = child(div_38);
  var text_34 = child(h3_1, true);
  reset(h3_1);
  var div_39 = sibling(h3_1, 2);
  var div_40 = child(div_39);
  var label_6 = child(div_40);
  var text_35 = child(label_6, true);
  reset(label_6);
  var select_1 = sibling(label_6, 2);
  template_effect(() => {
    get2(selectedPublishOption);
    invalidate_inner_signals(() => {
      get2(publishOptions);
    });
  });
  each(select_1, 5, () => get2(publishOptions), index5, ($$anchor2, option) => {
    var option_2 = root_16();
    var text_36 = child(option_2, true);
    reset(option_2);
    var option_2_value = {};
    template_effect(() => {
      var _a7;
      set_text(text_36, (get2(option), untrack(() => get2(option).label)));
      if (option_2_value !== (option_2_value = (get2(option), untrack(() => get2(option).value)))) {
        option_2.value = (_a7 = option_2.__value = (get2(option), untrack(() => get2(option).value))) != null ? _a7 : "";
      }
    });
    append($$anchor2, option_2);
  });
  reset(select_1);
  reset(div_40);
  var node_13 = sibling(div_40, 2);
  {
    var consequent_10 = ($$anchor2) => {
      var div_41 = root_17();
      var div_42 = child(div_41);
      var label_7 = child(div_42);
      var text_37 = child(label_7, true);
      reset(label_7);
      var input_5 = sibling(label_7, 2);
      remove_input_defaults(input_5);
      var div_43 = sibling(input_5, 2);
      var text_38 = child(div_43, true);
      reset(div_43);
      reset(div_42);
      var div_44 = sibling(div_42, 2);
      var label_8 = child(div_44);
      var text_39 = child(label_8, true);
      reset(label_8);
      var input_6 = sibling(label_8, 2);
      remove_input_defaults(input_6);
      var div_45 = sibling(input_6, 2);
      var text_40 = child(div_45, true);
      reset(div_45);
      reset(div_44);
      reset(div_41);
      template_effect(
        ($0, $1, $2, $3, $4, $5) => {
          set_text(text_37, $0);
          set_attribute2(input_5, "placeholder", $1);
          set_text(text_38, $2);
          set_text(text_39, $3);
          set_attribute2(input_6, "placeholder", $4);
          set_text(text_40, $5);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_access_token"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_access_token_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_access_token_desc"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_project_id"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_project_id_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.netlify_project_id_desc")))
        ]
      );
      bind_value(input_5, () => get2(netlifyAccessToken), ($$value) => set(netlifyAccessToken, $$value));
      bind_value(input_6, () => get2(netlifyProjectId), ($$value) => set(netlifyProjectId, $$value));
      append($$anchor2, div_41);
    };
    if_block(node_13, ($$render) => {
      if (get2(selectedPublishOption) === "netlify") $$render(consequent_10);
    });
  }
  var node_14 = sibling(node_13, 2);
  {
    var consequent_15 = ($$anchor2) => {
      var div_46 = root_18();
      var div_47 = child(div_46);
      var label_9 = child(div_47);
      var text_41 = child(label_9, true);
      reset(label_9);
      var input_7 = sibling(label_9, 2);
      remove_input_defaults(input_7);
      reset(div_47);
      var div_48 = sibling(div_47, 2);
      var label_10 = child(div_48);
      var text_42 = child(label_10, true);
      reset(label_10);
      var input_8 = sibling(label_10, 2);
      remove_input_defaults(input_8);
      reset(div_48);
      var div_49 = sibling(div_48, 2);
      var label_11 = child(div_49);
      var text_43 = child(label_11, true);
      reset(label_11);
      var input_9 = sibling(label_11, 2);
      remove_input_defaults(input_9);
      reset(div_49);
      var div_50 = sibling(div_49, 2);
      var label_12 = child(div_50);
      var text_44 = child(label_12, true);
      reset(label_12);
      var input_10 = sibling(label_12, 2);
      remove_input_defaults(input_10);
      var div_51 = sibling(input_10, 2);
      var text_45 = child(div_51, true);
      reset(div_51);
      reset(div_50);
      var div_52 = sibling(div_50, 2);
      var label_13 = child(div_52);
      var input_11 = child(label_13);
      remove_input_defaults(input_11);
      var span_9 = sibling(input_11, 2);
      var text_46 = child(span_9, true);
      reset(span_9);
      reset(label_13);
      var div_53 = sibling(label_13, 2);
      var text_47 = child(div_53, true);
      reset(div_53);
      reset(div_52);
      var div_54 = sibling(div_52, 2);
      var button_8 = child(div_54);
      let classes_2;
      var node_15 = child(button_8);
      {
        var consequent_11 = ($$anchor3) => {
          var text_48 = text2();
          template_effect(($0) => set_text(text_48, $0), [
            () => (get2(t2), untrack(() => get2(t2)("settings.ftp_test_connection_testing")))
          ]);
          append($$anchor3, text_48);
        };
        var alternate_5 = ($$anchor3) => {
          var fragment_3 = comment();
          var node_16 = first_child(fragment_3);
          {
            var consequent_12 = ($$anchor4) => {
              var text_49 = text2();
              template_effect(($0) => set_text(text_49, $0), [
                () => (get2(t2), untrack(() => get2(t2)("settings.ftp_test_connection_success")))
              ]);
              append($$anchor4, text_49);
            };
            var alternate_4 = ($$anchor4) => {
              var fragment_5 = comment();
              var node_17 = first_child(fragment_5);
              {
                var consequent_13 = ($$anchor5) => {
                  var text_50 = text2();
                  template_effect(($0) => set_text(text_50, $0), [
                    () => (get2(t2), untrack(() => get2(t2)("settings.ftp_test_connection_failed")))
                  ]);
                  append($$anchor5, text_50);
                };
                var alternate_3 = ($$anchor5) => {
                  var text_51 = text2();
                  template_effect(($0) => set_text(text_51, $0), [
                    () => (get2(t2), untrack(() => get2(t2)("settings.ftp_test_connection")))
                  ]);
                  append($$anchor5, text_51);
                };
                if_block(
                  node_17,
                  ($$render) => {
                    if (get2(ftpTestState) === "error") $$render(consequent_13);
                    else $$render(alternate_3, false);
                  },
                  true
                );
              }
              append($$anchor4, fragment_5);
            };
            if_block(
              node_16,
              ($$render) => {
                if (get2(ftpTestState) === "success") $$render(consequent_12);
                else $$render(alternate_4, false);
              },
              true
            );
          }
          append($$anchor3, fragment_3);
        };
        if_block(node_15, ($$render) => {
          if (get2(ftpTestState) === "testing") $$render(consequent_11);
          else $$render(alternate_5, false);
        });
      }
      reset(button_8);
      var div_55 = sibling(button_8, 2);
      var text_52 = child(div_55, true);
      reset(div_55);
      var node_18 = sibling(div_55, 2);
      {
        var consequent_14 = ($$anchor3) => {
          var div_56 = root_25();
          let classes_3;
          var text_53 = child(div_56);
          reset(div_56);
          template_effect(
            ($0) => {
              var _a7;
              classes_3 = set_class(div_56, 1, "ftp-test-result svelte-1nad34y", null, classes_3, $0);
              set_text(text_53, `${get2(ftpTestState) === "success" ? "\u2705" : "\u274C"} ${(_a7 = get2(ftpTestMessage)) != null ? _a7 : ""}`);
            },
            [
              () => ({
                "ftp-test-result-success": get2(ftpTestState) === "success",
                "ftp-test-result-error": get2(ftpTestState) === "error"
              })
            ]
          );
          append($$anchor3, div_56);
        };
        if_block(node_18, ($$render) => {
          if (get2(ftpTestMessage)) $$render(consequent_14);
        });
      }
      reset(div_54);
      reset(div_46);
      template_effect(
        ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) => {
          set_text(text_41, $0);
          set_attribute2(input_7, "placeholder", $1);
          set_text(text_42, $2);
          set_attribute2(input_8, "placeholder", $3);
          set_text(text_43, $4);
          set_attribute2(input_9, "placeholder", $5);
          set_text(text_44, $6);
          set_attribute2(input_10, "placeholder", $7);
          set_text(text_45, $8);
          set_text(text_46, $9);
          set_text(text_47, $10);
          classes_2 = set_class(button_8, 1, "ftp-test-btn svelte-1nad34y", null, classes_2, $11);
          button_8.disabled = !get2(isFTPConfigured) || get2(ftpTestState) === "testing";
          set_text(text_52, $12);
        },
        [
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_server"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_server_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_username"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_username_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_password"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_password_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_remote_dir"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_remote_dir_placeholder"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_remote_dir_desc"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_ignore_cert"))),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_ignore_cert_desc"))),
          () => ({
            "ftp-test-success": get2(ftpTestState) === "success",
            "ftp-test-error": get2(ftpTestState) === "error"
          }),
          () => (get2(t2), untrack(() => get2(t2)("settings.ftp_test_connection_desc")))
        ]
      );
      bind_value(input_7, () => get2(ftpServer), ($$value) => set(ftpServer, $$value));
      bind_value(input_8, () => get2(ftpUsername), ($$value) => set(ftpUsername, $$value));
      bind_value(input_9, () => get2(ftpPassword), ($$value) => set(ftpPassword, $$value));
      bind_value(input_10, () => get2(ftpRemoteDir), ($$value) => set(ftpRemoteDir, $$value));
      bind_checked(input_11, () => get2(ftpIgnoreCert), ($$value) => set(ftpIgnoreCert, $$value));
      event("click", button_8, testFTPConnection);
      append($$anchor2, div_46);
    };
    if_block(node_14, ($$render) => {
      if (get2(selectedPublishOption) === "ftp") $$render(consequent_15);
    });
  }
  var node_19 = sibling(node_14, 2);
  {
    var consequent_17 = ($$anchor2) => {
      var div_57 = root_26();
      var div_58 = child(div_57);
      var text_54 = child(div_58, true);
      reset(div_58);
      var node_20 = sibling(div_58, 2);
      {
        var consequent_16 = ($$anchor3) => {
          var div_59 = root_27();
          var text_55 = child(div_59);
          reset(div_59);
          template_effect(($0) => set_text(text_55, `\u26A0\uFE0F ${$0 != null ? $0 : ""}`), [
            () => (get2(t2), untrack(() => get2(t2)("settings.upgrade_for_mdfshare")))
          ]);
          append($$anchor3, div_59);
        };
        if_block(node_20, ($$render) => {
          if (!get2(hasPublishPermission)) $$render(consequent_16);
        });
      }
      reset(div_57);
      template_effect(($0) => set_text(text_54, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.mdfriday_share_hint")))
      ]);
      append($$anchor2, div_57);
    };
    if_block(node_19, ($$render) => {
      if (get2(selectedPublishOption) === "mdf-share") $$render(consequent_17);
    });
  }
  var node_21 = sibling(node_19, 2);
  {
    var consequent_19 = ($$anchor2) => {
      var div_60 = root_28();
      var div_61 = child(div_60);
      var text_56 = child(div_61, true);
      reset(div_61);
      var node_22 = sibling(div_61, 2);
      {
        var consequent_18 = ($$anchor3) => {
          var div_62 = root_29();
          var text_57 = child(div_62);
          reset(div_62);
          template_effect(($0) => set_text(text_57, `\u26A0\uFE0F ${$0 != null ? $0 : ""}`), [
            () => (get2(t2), untrack(() => get2(t2)("settings.upgrade_for_subdomain")))
          ]);
          append($$anchor3, div_62);
        };
        if_block(node_22, ($$render) => {
          if (!get2(hasSubdomainPermission)) $$render(consequent_18);
        });
      }
      reset(div_60);
      template_effect(($0) => set_text(text_56, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.mdfriday_app_hint")))
      ]);
      append($$anchor2, div_60);
    };
    if_block(node_21, ($$render) => {
      if (get2(selectedPublishOption) === "mdf-app") $$render(consequent_19);
    });
  }
  var node_23 = sibling(node_21, 2);
  {
    var consequent_21 = ($$anchor2) => {
      var div_63 = root_30();
      var div_64 = child(div_63);
      var text_58 = child(div_64, true);
      reset(div_64);
      var node_24 = sibling(div_64, 2);
      {
        var consequent_20 = ($$anchor3) => {
          var div_65 = root_31();
          var text_59 = child(div_65);
          reset(div_65);
          template_effect(($0) => set_text(text_59, `\u26A0\uFE0F ${$0 != null ? $0 : ""}`), [
            () => (get2(t2), untrack(() => get2(t2)("settings.upgrade_for_custom_domain")))
          ]);
          append($$anchor3, div_65);
        };
        if_block(node_24, ($$render) => {
          if (!get2(hasCustomDomainPermission)) $$render(consequent_20);
        });
      }
      reset(div_63);
      template_effect(($0) => set_text(text_58, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.mdfriday_custom_hint")))
      ]);
      append($$anchor2, div_63);
    };
    if_block(node_23, ($$render) => {
      if (get2(selectedPublishOption) === "mdf-custom") $$render(consequent_21);
    });
  }
  var node_25 = sibling(node_23, 2);
  {
    var consequent_23 = ($$anchor2) => {
      var div_66 = root_32();
      var div_67 = child(div_66);
      var text_60 = child(div_67, true);
      reset(div_67);
      var node_26 = sibling(div_67, 2);
      {
        var consequent_22 = ($$anchor3) => {
          var div_68 = root_33();
          var text_61 = child(div_68);
          reset(div_68);
          template_effect(($0) => set_text(text_61, `\u26A0\uFE0F ${$0 != null ? $0 : ""}`), [
            () => (get2(t2), untrack(() => get2(t2)("settings.upgrade_for_enterprise")))
          ]);
          append($$anchor3, div_68);
        };
        if_block(node_26, ($$render) => {
          if (!get2(hasEnterprisePermission)) $$render(consequent_22);
        });
      }
      reset(div_66);
      template_effect(($0) => set_text(text_60, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.mdfriday_enterprise_hint")))
      ]);
      append($$anchor2, div_66);
    };
    if_block(node_25, ($$render) => {
      if (get2(selectedPublishOption) === "mdf-enterprise") $$render(consequent_23);
    });
  }
  var div_69 = sibling(node_25, 2);
  var node_27 = child(div_69);
  {
    var consequent_24 = ($$anchor2) => {
      var div_70 = root_34();
      var p_2 = child(div_70);
      var text_62 = child(p_2, true);
      reset(p_2);
      var node_28 = sibling(p_2, 2);
      ProgressBar(node_28, {
        get progress() {
          return get2(publishProgress);
        }
      });
      reset(div_70);
      template_effect(($0) => set_text(text_62, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.publish_building")))
      ]);
      append($$anchor2, div_70);
    };
    var alternate_6 = ($$anchor2) => {
      var button_9 = root_35();
      var text_63 = child(button_9, true);
      reset(button_9);
      template_effect(
        ($0) => {
          button_9.disabled = !get2(hasPreview) || get2(isPublishDisabled);
          set_text(text_63, $0);
        },
        [() => (get2(t2), untrack(() => get2(t2)("ui.publish")))]
      );
      event("click", button_9, startPublish);
      append($$anchor2, button_9);
    };
    if_block(node_27, ($$render) => {
      if (get2(isPublishing)) $$render(consequent_24);
      else $$render(alternate_6, false);
    });
  }
  reset(div_69);
  var node_29 = sibling(div_69, 2);
  {
    var consequent_27 = ($$anchor2) => {
      var div_71 = root_36();
      var p_3 = child(div_71);
      var text_64 = child(p_3, true);
      reset(p_3);
      var node_30 = sibling(p_3, 2);
      {
        var consequent_25 = ($$anchor3) => {
          var a_1 = root_37();
          var text_65 = child(a_1, true);
          reset(a_1);
          template_effect(() => {
            set_attribute2(a_1, "href", get2(publishUrl));
            set_text(text_65, get2(publishUrl));
          });
          append($$anchor3, a_1);
        };
        var alternate_7 = ($$anchor3) => {
          var fragment_8 = comment();
          var node_31 = first_child(fragment_8);
          {
            var consequent_26 = ($$anchor4) => {
              var p_4 = root_39();
              var text_66 = child(p_4, true);
              reset(p_4);
              template_effect(($0) => set_text(text_66, $0), [
                () => (get2(t2), untrack(() => get2(t2)("messages.ftp_upload_success")))
              ]);
              append($$anchor4, p_4);
            };
            if_block(
              node_31,
              ($$render) => {
                if (get2(selectedPublishOption) === "ftp") $$render(consequent_26);
              },
              true
            );
          }
          append($$anchor3, fragment_8);
        };
        if_block(node_30, ($$render) => {
          if (get2(publishUrl)) $$render(consequent_25);
          else $$render(alternate_7, false);
        });
      }
      reset(div_71);
      template_effect(($0) => set_text(text_64, $0), [
        () => (get2(t2), untrack(() => get2(t2)("ui.published_successfully")))
      ]);
      append($$anchor2, div_71);
    };
    if_block(node_29, ($$render) => {
      if (get2(publishSuccess)) $$render(consequent_27);
    });
  }
  reset(div_39);
  reset(div_38);
  reset(div);
  template_effect(
    ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) => {
      set_text(text3, $0);
      set_text(text_1, $1);
      set_text(text_2, $2);
      set_text(text_8, $3);
      set_attribute2(input, "placeholder", $4);
      set_text(text_9, $5);
      set_text(text_13, $6);
      set_attribute2(button_3, "aria-expanded", get2(showAdvancedSettings));
      classes_1 = set_class(span_6, 1, "toggle-icon svelte-1nad34y", null, classes_1, $7);
      set_text(text_14, ` ${$8 != null ? $8 : ""}`);
      set_text(text_23, $9);
      set_text(text_24, get2(displayThemeName));
      set_text(text_25, $10);
      set_text(text_28, $11);
      set_text(text_34, $12);
      set_text(text_35, $13);
    },
    [
      () => (get2(t2), untrack(() => get2(t2)("ui.multilingual_content"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.content_path"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.language"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.site_name"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.site_name_placeholder"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.site_assets"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.site_assets_hint"))),
      () => ({ expanded: get2(showAdvancedSettings) }),
      () => (get2(t2), untrack(() => get2(t2)("ui.advanced_settings"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.theme"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.change_theme"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.preview"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.publish"))),
      () => (get2(t2), untrack(() => get2(t2)("ui.publish_method")))
    ]
  );
  bind_value(input, () => get2(siteName), ($$value) => set(siteName, $$value));
  event("click", button_3, toggleAdvancedSettings);
  event("click", button_4, openThemeModal);
  bind_select_value(select_1, () => get2(selectedPublishOption), ($$value) => set(selectedPublishOption, $$value));
  append($$anchor, div);
  var $$pop = pop2($$exports);
  $$cleanup();
  return $$pop;
}
var import_obsidian13, path4, fs3, import_foundry2, import_jszip, root_1, root_3, root_4, root_5, root_2, root_6, root_7, root_8, root_9, root_11, root_12, root_13, root_14, root_15, root_16, root_17, root_25, root_18, root_27, root_26, root_29, root_28, root_31, root_30, root_33, root_32, root_34, root_35, root_37, root_39, root_36, root3, $$css3;
var init_Site = __esm({
  "src/svelte/Site.svelte"() {
    "use strict";
    init_legacy_client();
    init_disclose_version();
    init_legacy2();
    init_client();
    import_obsidian13 = require("obsidian");
    init_main();
    init_ProgressBar();
    init_index_client();
    path4 = __toESM2(require("path"));
    fs3 = __toESM2(require("fs"));
    import_foundry2 = __toESM2(require_dist3());
    import_jszip = __toESM2(require_jszip_min());
    init_main();
    init_markdown();
    init_themeApiService();
    root_1 = from_html(`<button class="add-language-btn svelte-1nad34y"> </button>`);
    root_3 = from_html(`<span class="default-badge svelte-1nad34y"> </span>`);
    root_4 = from_html(`<option> </option>`);
    root_5 = from_html(`<button class="remove-btn svelte-1nad34y"><span class="remove-icon svelte-1nad34y">\xD7</span></button>`);
    root_2 = from_html(`<div><div class="multilang-cell content-path-cell svelte-1nad34y"><span class="content-path svelte-1nad34y"> </span> <!></div> <div class="multilang-cell language-cell svelte-1nad34y"><select class="language-select svelte-1nad34y"></select> <!></div></div>`);
    root_6 = from_html(`<div class="multilang-empty svelte-1nad34y"><span class="empty-message svelte-1nad34y"> </span></div>`);
    root_7 = from_html(`<span class="assets-path svelte-1nad34y"> </span> <button class="clear-assets-btn svelte-1nad34y"> </button>`, 1);
    root_8 = from_html(`<span class="assets-placeholder svelte-1nad34y"> </span>`);
    root_9 = from_html(`<div class="advanced-content svelte-1nad34y"><div class="advanced-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="site-path"> </label> <input type="text" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div> <div class="advanced-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="site-password"> </label> <input type="password" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div> <div class="advanced-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="google-analytics"> </label> <input type="text" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div> <div class="advanced-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="disqus-shortname"> </label> <input type="text" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div></div>`);
    root_11 = from_html(`<div class="sample-download-progress svelte-1nad34y"><span class="progress-text svelte-1nad34y"> </span> <!></div>`);
    root_12 = from_html(`<button class="download-sample-btn svelte-1nad34y"> </button>`);
    root_13 = from_html(`<div class="progress-container svelte-1nad34y"><p class="svelte-1nad34y"> </p> <!></div>`);
    root_14 = from_html(`<button class="action-button preview-button svelte-1nad34y"> </button>`);
    root_15 = from_html(`<div class="preview-link svelte-1nad34y"><p> </p> <a target="_blank" class="preview-url svelte-1nad34y"> </a> <div class="preview-actions svelte-1nad34y"><button class="action-button export-button svelte-1nad34y"> </button></div></div>`);
    root_16 = from_html(`<option> </option>`);
    root_17 = from_html(`<div class="publish-config svelte-1nad34y"><div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="netlify-token"> </label> <input type="password" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div> <div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="netlify-project"> </label> <input type="text" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div></div>`);
    root_25 = from_html(`<div> </div>`);
    root_18 = from_html(`<div class="publish-config svelte-1nad34y"><div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="ftp-server"> </label> <input type="text" class="form-input svelte-1nad34y"/></div> <div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="ftp-username"> </label> <input type="text" class="form-input svelte-1nad34y"/></div> <div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="ftp-password"> </label> <input type="password" class="form-input svelte-1nad34y"/></div> <div class="config-field svelte-1nad34y"><label class="section-label svelte-1nad34y" for="ftp-remote-dir"> </label> <input type="text" class="form-input svelte-1nad34y"/> <div class="field-hint svelte-1nad34y"> </div></div> <div class="config-field svelte-1nad34y"><label class="checkbox-label svelte-1nad34y"><input type="checkbox" class="svelte-1nad34y"/> <span> </span></label> <div class="field-hint svelte-1nad34y"> </div></div> <div class="config-field svelte-1nad34y"><button><!></button> <div class="field-hint svelte-1nad34y"> </div> <!></div></div>`);
    root_27 = from_html(`<div class="license-warning svelte-1nad34y"> </div>`);
    root_26 = from_html(`<div class="publish-config svelte-1nad34y"><div class="field-hint svelte-1nad34y"> </div> <!></div>`);
    root_29 = from_html(`<div class="license-warning svelte-1nad34y"> </div>`);
    root_28 = from_html(`<div class="publish-config svelte-1nad34y"><div class="field-hint svelte-1nad34y"> </div> <!></div>`);
    root_31 = from_html(`<div class="license-warning svelte-1nad34y"> </div>`);
    root_30 = from_html(`<div class="publish-config svelte-1nad34y"><div class="field-hint svelte-1nad34y"> </div> <!></div>`);
    root_33 = from_html(`<div class="license-warning svelte-1nad34y"> </div>`);
    root_32 = from_html(`<div class="publish-config svelte-1nad34y"><div class="field-hint svelte-1nad34y"> </div> <!></div>`);
    root_34 = from_html(`<div class="progress-container svelte-1nad34y"><p class="svelte-1nad34y"> </p> <!></div>`);
    root_35 = from_html(`<button class="action-button publish-button svelte-1nad34y"> </button>`);
    root_37 = from_html(`<a target="_blank" class="publish-url svelte-1nad34y"> </a>`);
    root_39 = from_html(`<p class="ftp-success-info svelte-1nad34y"> </p>`);
    root_36 = from_html(`<div class="publish-success svelte-1nad34y"><p class="success-message svelte-1nad34y"> </p> <!></div>`);
    root3 = from_html(`<div class="site-builder svelte-1nad34y"><div class="section svelte-1nad34y"><div class="section-label svelte-1nad34y"> </div> <div class="multilang-table svelte-1nad34y"><div class="multilang-header svelte-1nad34y"><div class="multilang-header-cell svelte-1nad34y"> </div> <div class="multilang-header-cell svelte-1nad34y"><span> </span> <!></div></div> <!> <!></div></div> <div class="section svelte-1nad34y"><label class="section-label svelte-1nad34y" for="site-name"> </label> <input type="text" class="form-input svelte-1nad34y"/></div> <div class="section svelte-1nad34y"><div class="section-label svelte-1nad34y"> </div> <div class="site-assets-container svelte-1nad34y"><div class="assets-display svelte-1nad34y"><!></div> <div class="assets-hint svelte-1nad34y"> </div></div></div> <div class="section svelte-1nad34y"><div class="advanced-settings svelte-1nad34y"><button class="advanced-toggle svelte-1nad34y"><span>\u25B6</span> </button> <!></div></div> <div class="section svelte-1nad34y"><label class="section-label svelte-1nad34y" for="themes"> </label> <div class="theme-selector svelte-1nad34y"><div class="current-theme svelte-1nad34y"><span class="theme-name svelte-1nad34y"> </span> <div class="theme-actions svelte-1nad34y"><button class="change-theme-btn svelte-1nad34y"> </button> <!></div></div></div></div> <div class="section svelte-1nad34y"><h3 class="section-title svelte-1nad34y"> </h3> <div class="preview-section svelte-1nad34y"><!> <!></div></div> <div class="section svelte-1nad34y"><h3 class="section-title svelte-1nad34y"> </h3> <div class="publish-section svelte-1nad34y"><div class="publish-select-wrapper svelte-1nad34y"><label class="section-label svelte-1nad34y" for="publish-method"> </label> <select id="publish-method" class="form-select svelte-1nad34y"></select></div> <!> <!> <!> <!> <!> <!> <div class="publish-actions svelte-1nad34y"><!></div> <!></div></div></div>`);
    $$css3 = {
      hash: "svelte-1nad34y",
      code: `.site-builder.svelte-1nad34y {padding:20px;max-width:100%;}.section.svelte-1nad34y {margin-bottom:20px;}.section-label.svelte-1nad34y {display:block;margin-bottom:8px;font-weight:500;color:var(--text-normal);font-size:14px;}.form-input.svelte-1nad34y {width:100%;padding:10px 12px;border:1px solid var(--background-modifier-border);border-radius:4px;background:var(--background-primary);color:var(--text-normal);font-size:14px;line-height:1.4;box-sizing:border-box;min-height:38px;}.form-select.svelte-1nad34y {width:100%;border:1px solid var(--background-modifier-border);border-radius:4px;background:var(--background-primary);color:var(--text-normal);font-size:14px;line-height:1.4;box-sizing:border-box;min-height:38px;appearance:none;background-image:url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right 12px center;background-size:16px;padding-right:40px;}.theme-selector.svelte-1nad34y {width:100%;}.current-theme.svelte-1nad34y {display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border:1px solid var(--background-modifier-border);border-radius:4px;background:var(--background-primary);min-height:38px;box-sizing:border-box;}.theme-name.svelte-1nad34y {color:var(--text-normal);font-size:14px;flex:1;}.theme-actions.svelte-1nad34y {display:flex;align-items:center;gap:8px;}.change-theme-btn.svelte-1nad34y {padding:6px 12px;border:1px solid var(--interactive-accent);border-radius:3px;background:transparent;color:var(--interactive-accent);font-size:12px;cursor:pointer;transition:all 0.2s;white-space:nowrap;}.change-theme-btn.svelte-1nad34y:hover {background:var(--interactive-accent);color:var(--text-on-accent);}.download-sample-btn.svelte-1nad34y {padding:6px 12px;border:1px solid var(--text-accent);border-radius:3px;background:transparent;color:var(--text-accent);font-size:12px;cursor:pointer;transition:all 0.2s;white-space:nowrap;}.download-sample-btn.svelte-1nad34y:hover {background:var(--text-accent);color:var(--text-on-accent);}.sample-download-progress.svelte-1nad34y {display:flex;flex-direction:column;gap:4px;min-width:120px;}.progress-text.svelte-1nad34y {font-size:11px;color:var(--text-muted);text-align:center;}.section-title.svelte-1nad34y {margin:0 0 10px 0;font-size:16px;font-weight:600;color:var(--text-normal);}.preview-section.svelte-1nad34y, .publish-section.svelte-1nad34y {padding:15px;border:1px solid var(--background-modifier-border);border-radius:6px;background:var(--background-secondary);}.action-button.svelte-1nad34y {padding:10px 20px;border:none;border-radius:4px;background:var(--interactive-accent);color:var(--text-on-accent);font-size:14px;font-weight:500;cursor:pointer;transition:background-color 0.2s;min-height:38px;}.action-button.svelte-1nad34y:hover:not(:disabled) {background:var(--interactive-accent-hover);}.action-button.svelte-1nad34y:disabled {background:var(--background-modifier-border);color:var(--text-muted);cursor:not-allowed;}.preview-button.svelte-1nad34y {margin-bottom:10px;}.publish-button.svelte-1nad34y {margin-left:10px;}.preview-link.svelte-1nad34y, .publish-success.svelte-1nad34y {margin-top:15px;padding:10px;background:var(--background-primary);border-radius:4px;border:1px solid var(--background-modifier-border);}.preview-url.svelte-1nad34y, .publish-url.svelte-1nad34y {display:block;color:var(--interactive-accent);text-decoration:none;word-break:break-all;margin-top:5px;}.preview-url.svelte-1nad34y:hover, .publish-url.svelte-1nad34y:hover {text-decoration:underline;}.progress-container.svelte-1nad34y {margin:10px 0;}.progress-container.svelte-1nad34y p:where(.svelte-1nad34y) {margin:0 0 10px 0;color:var(--text-muted);font-size:14px;}.publish-select-wrapper.svelte-1nad34y {margin-bottom:16px;}.publish-config.svelte-1nad34y {background:var(--background-secondary);border:1px solid var(--background-modifier-border);border-radius:4px;padding:16px;margin-bottom:16px;}.config-field.svelte-1nad34y {margin-bottom:16px;}.config-field.svelte-1nad34y:last-child {margin-bottom:0;}.checkbox-label.svelte-1nad34y {display:flex;align-items:center;gap:8px;cursor:pointer;font-size:14px;color:var(--text-normal);}.checkbox-label.svelte-1nad34y input[type="checkbox"]:where(.svelte-1nad34y) {width:16px;height:16px;cursor:pointer;}.publish-actions.svelte-1nad34y {margin-top:16px;}.success-message.svelte-1nad34y {margin:0 0 5px 0;color:var(--text-success);font-weight:500;}.ftp-success-info.svelte-1nad34y {margin:5px 0 0 0;color:var(--text-muted);font-size:14px;}.preview-actions.svelte-1nad34y {margin-top:10px;display:flex;gap:10px;}.export-button.svelte-1nad34y {background:var(--interactive-normal);color:var(--text-normal);border:1px solid var(--background-modifier-border);}.export-button.svelte-1nad34y:hover:not(:disabled) {background:var(--interactive-hover);}.export-button.svelte-1nad34y:disabled {opacity:0.6;}.advanced-settings.svelte-1nad34y {border:1px solid var(--background-modifier-border);border-radius:4px;overflow:hidden;}.advanced-toggle.svelte-1nad34y {width:100%;padding:12px 16px;border:none;background:transparent;color:var(--text-normal);font-size:14px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:8px;transition:background-color 0.2s;box-shadow:none;}.advanced-toggle.svelte-1nad34y:hover {background:var(--background-modifier-hover);}.toggle-icon.svelte-1nad34y {transition:transform 0.2s;font-size:12px;color:var(--text-muted);}.toggle-icon.expanded.svelte-1nad34y {transform:rotate(90deg);}.advanced-content.svelte-1nad34y {background:var(--background-secondary);padding:16px;border-top:1px solid var(--background-modifier-border);}.advanced-field.svelte-1nad34y {margin-bottom:16px;}.advanced-field.svelte-1nad34y:last-child {margin-bottom:0;}.field-hint.svelte-1nad34y {font-size:12px;color:var(--text-muted);margin-top:4px;line-height:1.4;}.license-warning.svelte-1nad34y {font-size:12px;color:var(--text-accent);background:var(--background-secondary);border:1px solid var(--background-modifier-border);padding:8px 12px;border-radius:4px;margin-top:8px;line-height:1.4;}

	/* Multi-language table styles */.multilang-table.svelte-1nad34y {border:1px solid var(--background-modifier-border);border-radius:4px;overflow:hidden;background:var(--background-primary);}.multilang-header.svelte-1nad34y {display:grid;grid-template-columns:1fr 2fr;background:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border);}.multilang-header-cell.svelte-1nad34y {padding:10px 12px;font-weight:500;font-size:14px;color:var(--text-normal);border-right:1px solid var(--background-modifier-border);display:flex;align-items:center;justify-content:space-between;overflow:hidden;min-width:0;}.add-language-btn.svelte-1nad34y {padding:4px 8px;border:1px solid var(--interactive-accent);border-radius:3px;background:transparent;color:var(--interactive-accent);font-size:11px;cursor:pointer;transition:all 0.2s;white-space:nowrap;margin-left:8px;}.add-language-btn.svelte-1nad34y:hover {background:var(--interactive-accent);color:var(--text-on-accent);}.multilang-header-cell.svelte-1nad34y:last-child {border-right:none;}.multilang-row.svelte-1nad34y {display:grid;grid-template-columns:1fr 2fr;border-bottom:1px solid var(--background-modifier-border);transition:background-color 0.2s;}.multilang-row.svelte-1nad34y:last-child {border-bottom:none;}.multilang-row.svelte-1nad34y:hover {background:var(--background-modifier-hover);}.multilang-cell.svelte-1nad34y {padding:10px 12px;display:flex;align-items:center;border-right:1px solid var(--background-modifier-border);min-height:38px;box-sizing:border-box;overflow:hidden;min-width:0;}.multilang-cell.svelte-1nad34y:last-child {border-right:none;}.content-path-cell.svelte-1nad34y {gap:8px;}.content-path.svelte-1nad34y {color:var(--text-normal);font-size:14px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}.default-badge.svelte-1nad34y {background:var(--interactive-accent);color:var(--text-on-accent);padding:2px 6px;border-radius:3px;font-size:11px;font-weight:500;white-space:nowrap;}.language-cell.svelte-1nad34y {display:flex;align-items:center;gap:8px;}.language-select.svelte-1nad34y {flex:1;max-width:180px;padding:4px 8px;border:1px solid var(--background-modifier-border);border-radius:3px;background:var(--background-primary);color:var(--text-normal);font-size:13px;appearance:none;background-image:url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right 6px center;background-size:12px;padding-right:24px;}.remove-btn.svelte-1nad34y {width:20px;height:20px;border:none;border-radius:50%;background:transparent;color:var(--text-muted);font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all 0.2s;opacity:0;margin-left:4px;}.multilang-row.svelte-1nad34y:hover .remove-btn:where(.svelte-1nad34y) {opacity:1;}.remove-btn.svelte-1nad34y:hover {background:var(--background-modifier-error);color:var(--text-on-accent);transform:scale(1.1);}.remove-icon.svelte-1nad34y {line-height:1;font-weight:bold;}.multilang-empty.svelte-1nad34y {padding:20px;text-align:center;color:var(--text-muted);font-style:italic;}.empty-message.svelte-1nad34y {font-size:14px;}

	/* Site Assets styles */.site-assets-container.svelte-1nad34y {border:1px solid var(--background-modifier-border);border-radius:4px;background:var(--background-primary);}.assets-display.svelte-1nad34y {padding:10px 12px;display:flex;align-items:center;justify-content:space-between;min-height:38px;box-sizing:border-box;}.assets-path.svelte-1nad34y {color:var(--text-normal);font-size:14px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}.assets-placeholder.svelte-1nad34y {color:var(--text-muted);font-size:14px;font-style:italic;flex:1;}.clear-assets-btn.svelte-1nad34y {padding:4px 8px;border:1px solid var(--interactive-accent);border-radius:3px;background:transparent;color:var(--interactive-accent);font-size:11px;cursor:pointer;transition:all 0.2s;white-space:nowrap;margin-left:8px;}.clear-assets-btn.svelte-1nad34y:hover {background:var(--interactive-accent);color:var(--text-on-accent);}.assets-hint.svelte-1nad34y {padding:8px 12px;background:var(--background-secondary);border-top:1px solid var(--background-modifier-border);font-size:12px;color:var(--text-muted);line-height:1.4;}

	/* FTP Test Connection Styles */.ftp-test-btn.svelte-1nad34y {padding:10px 20px;border:1px solid var(--interactive-accent);border-radius:4px;background:transparent;color:var(--interactive-accent);font-size:14px;font-weight:500;cursor:pointer;transition:all 0.2s;min-height:38px;}.ftp-test-btn.svelte-1nad34y:hover:not(:disabled) {background:var(--interactive-accent);color:var(--text-on-accent);}.ftp-test-btn.svelte-1nad34y:disabled {opacity:0.6;cursor:not-allowed;}.ftp-test-btn.ftp-test-success.svelte-1nad34y {background-color:var(--color-green) !important;color:white !important;border-color:var(--color-green) !important;}.ftp-test-btn.ftp-test-error.svelte-1nad34y {background-color:var(--color-red) !important;color:white !important;border-color:var(--color-red) !important;}.ftp-test-result.svelte-1nad34y {margin-top:8px;padding:8px 12px;border-radius:4px;font-size:13px;line-height:1.4;display:block;width:100%;box-sizing:border-box;}.ftp-test-result-success.svelte-1nad34y {background-color:rgba(var(--color-green-rgb), 0.1);color:var(--color-green);border:1px solid rgba(var(--color-green-rgb), 0.3);}.ftp-test-result-error.svelte-1nad34y {background-color:rgba(var(--color-red-rgb), 0.1);color:var(--color-red);border:1px solid rgba(var(--color-red-rgb), 0.3);}`
    };
  }
});

// src/svelte/Server.svelte
function Server($$anchor, $$props) {
  if (new.target) return createClassComponent({ component: Server, ...$$anchor });
  push($$props, false);
  append_styles($$anchor, $$css4);
  const t2 = mutable_source();
  var _a6 = mutable_source();
  let app = prop($$props, "app", 12);
  let plugin2 = prop($$props, "plugin", 12);
  onMount(async () => {
  });
  onDestroy(() => {
  });
  legacy_pre_effect(() => (safe_get(_a6), deep_read_state(plugin2())), () => {
    set(t2, (set(_a6, plugin2().i18n) === null || safe_get(_a6) === void 0 ? void 0 : safe_get(_a6).t) || ((key4) => key4));
  });
  legacy_pre_effect_reset();
  var $$exports = {
    get app() {
      return app();
    },
    set app($$value) {
      app($$value);
      flushSync();
    },
    get plugin() {
      return plugin2();
    },
    set plugin($$value) {
      plugin2($$value);
      flushSync();
    },
    $set: update_legacy_props,
    $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb)
  };
  init2();
  var div = root4();
  var section = child(div);
  var div_1 = child(section);
  var div_2 = child(div_1);
  var node = child(div_2);
  Site(node, {
    get app() {
      return app();
    },
    get plugin() {
      return plugin2();
    }
  });
  var node_1 = sibling(node, 4);
  Info(node_1, {
    get plugin() {
      return plugin2();
    }
  });
  reset(div_2);
  reset(div_1);
  reset(section);
  reset(div);
  append($$anchor, div);
  return pop2($$exports);
}
var import_obsidian14, root4, $$css4;
var init_Server = __esm({
  "src/svelte/Server.svelte"() {
    "use strict";
    init_legacy_client();
    init_disclose_version();
    init_legacy2();
    init_client();
    import_obsidian14 = require("obsidian");
    init_Info();
    init_Site();
    init_index_client();
    init_main();
    root4 = from_html(`<div class="friday-plugin-main svelte-1xjllom"><section id="friday-plugin-main"><div class="friday-tab-content svelte-1xjllom"><div role="tabpanel" id="panel-site" aria-labelledby="tab-site" tabindex="0"><!> <hr class="centered-line svelte-1xjllom"/> <!></div></div></section></div>`);
    $$css4 = {
      hash: "svelte-1xjllom",
      code: ".friday-plugin-main.svelte-1xjllom {padding:initial;width:initial;height:initial;position:initial;overflow-y:initial;overflow-wrap:initial;}.centered-line.svelte-1xjllom {width:80%; /* \u5206\u9694\u7EBF\u5BBD\u5EA6\u5360\u7236\u5BB9\u5668\u7684 80% */margin:20px auto; /* \u6C34\u5E73\u5C45\u4E2D\u5BF9\u9F50 */border:none; /* \u53BB\u6389\u9ED8\u8BA4\u7684\u8FB9\u6846\u6837\u5F0F */border-top:1px solid rgb(64 64 64); /* \u9876\u90E8\u8FB9\u6846\u4F5C\u4E3A\u5206\u9694\u7EBF */height:1px; /* \u5206\u9694\u7EBF\u9AD8\u5EA6 */background-color:transparent; /* \u786E\u4FDD\u80CC\u666F\u900F\u660E */}.friday-tab-content.svelte-1xjllom {padding:10px 0;}"
    };
  }
});

// src/server.ts
var server_exports = {};
__export2(server_exports, {
  default: () => ServerView
});
var import_obsidian15, ServerView;
var init_server = __esm({
  "src/server.ts"() {
    "use strict";
    import_obsidian15 = require("obsidian");
    init_main();
    init_Server();
    ServerView = class extends import_obsidian15.ItemView {
      constructor(leaf, plugin2) {
        super(leaf);
        this._app = null;
        this.plugin = plugin2;
      }
      // 关闭时销毁 Svelte 实例
      async onClose() {
        if (this._app) {
          this._app.$destroy();
          this._app = null;
        }
      }
      // 打开时初始化 Svelte 实例并传入 props
      async onOpen() {
        this._app = new Server({
          target: this.contentEl,
          props: {
            app: this.app,
            plugin: this.plugin
          }
        });
      }
      getDisplayText() {
        return "Friday Service";
      }
      getViewType() {
        return FRIDAY_SERVER_VIEW_TYPE;
      }
      getIcon() {
        return FRIDAY_ICON;
      }
    };
  }
});

// src/theme/modal.ts
var modal_exports = {};
__export2(modal_exports, {
  ThemeSelectionModal: () => ThemeSelectionModal
});
var import_obsidian16, ThemeSelectionModal;
var init_modal = __esm({
  "src/theme/modal.ts"() {
    "use strict";
    import_obsidian16 = require("obsidian");
    init_themeApiService();
    ThemeSelectionModal = class extends import_obsidian16.Modal {
      constructor(app, selectedTheme, onSelect, plugin2, isForSingleFile = false) {
        super(app);
        this.themes = [];
        this.allThemes = [];
        // Store all themes for filtering
        this.allTags = [];
        this.selectedTags = [];
        this.searchTerm = "";
        this.loading = false;
        this.loadingTags = false;
        this.loadingError = null;
        this.loadingState = "idle";
        this.searchTimeout = null;
        this.isForSingleFile = false;
        this.selectedTheme = selectedTheme;
        this.onSelect = onSelect;
        this.plugin = plugin2;
        this.isForSingleFile = isForSingleFile;
        this.setTitle(plugin2.i18n.t("theme.choose_theme"));
      }
      // Helper function for translations
      t(key4, params) {
        return this.plugin.i18n.t(key4, params);
      }
      async onOpen() {
        const { contentEl, modalEl } = this;
        modalEl.addClass("friday-theme-modal");
        contentEl.empty();
        this.loadingState = "initial";
        this.renderModal();
        try {
          await this.loadTags();
          await this.loadThemes();
          this.renderModal();
        } catch (error2) {
          console.error("Failed to load initial data:", error2);
          this.loadingState = "error";
          this.loadingError = error2 instanceof Error ? error2.message : "Unknown error";
          this.renderModal();
        }
      }
      async loadTags() {
        this.loadingTags = true;
        this.loadingState = "tags";
        try {
          this.allThemes = await themeApiService.getAllThemes(this.plugin);
          if (this.isForSingleFile) {
            this.allThemes = this.allThemes.filter(
              (theme) => theme.tags.some((tag2) => tag2.toLowerCase() === "page")
            );
          }
          this.allTags = this.extractTagsFromThemes(this.allThemes);
        } catch (error2) {
          console.error("Failed to load tags:", error2);
          throw error2;
        } finally {
          this.loadingTags = false;
        }
      }
      extractTagsFromThemes(themes) {
        const allTags = themes.flatMap((theme) => theme.tags);
        const uniqueTags = [...new Set(allTags)];
        return uniqueTags.sort((a, b) => a.localeCompare(b));
      }
      async loadThemes() {
        this.loading = true;
        this.loadingState = this.searchTerm || this.selectedTags.length > 0 ? "search" : "themes";
        this.loadingError = null;
        try {
          let filteredThemes = [...this.allThemes];
          if (this.searchTerm.trim()) {
            const term = this.searchTerm.trim().toLowerCase();
            filteredThemes = filteredThemes.filter(
              (theme) => theme.name.toLowerCase().includes(term) || theme.author.toLowerCase().includes(term) || theme.tags.some((tag2) => tag2.toLowerCase().includes(term))
            );
          }
          if (this.selectedTags.length > 0) {
            filteredThemes = filteredThemes.filter(
              (theme) => this.selectedTags.every(
                (selectedTag) => theme.tags.some((tag2) => tag2 === selectedTag)
              )
            );
          }
          this.themes = filteredThemes.slice(0, 20);
          this.loadingState = "idle";
        } catch (error2) {
          console.error("Failed to load themes:", error2);
          this.themes = [];
          this.loadingState = "error";
          this.loadingError = error2 instanceof Error ? error2.message : "Unknown error";
        } finally {
          this.loading = false;
        }
      }
      renderModal() {
        const { contentEl } = this;
        contentEl.empty();
        if (this.loadingState === "initial" || this.loadingState === "tags") {
          const themesSection2 = contentEl.createDiv("themes-section");
          this.renderLoadingState(themesSection2);
          return;
        }
        const searchSection = contentEl.createDiv("search-section");
        const searchWrapper = searchSection.createDiv("search-input-wrapper");
        const searchInput = searchWrapper.createEl("input", {
          type: "text",
          placeholder: this.t("theme.search_themes"),
          cls: "search-input"
        });
        searchWrapper.createDiv("search-icon").setText("\u{1F50D}");
        searchInput.addEventListener("input", async (e2) => {
          this.searchTerm = e2.target.value;
          if (this.searchTimeout) {
            clearTimeout(this.searchTimeout);
          }
          this.searchTimeout = setTimeout(async () => {
            await this.loadThemes();
            this.renderThemes();
          }, 300);
        });
        const tagsSection = searchSection.createDiv("tags-section");
        const tagsHeader = tagsSection.createDiv("tags-header");
        tagsHeader.createEl("span", { text: this.t("theme.filter_by_tags"), cls: "tags-label" });
        if (this.selectedTags.length > 0) {
          const clearBtn = tagsHeader.createEl("button", { text: this.t("theme.clear_filters"), cls: "clear-filters-btn" });
          clearBtn.addEventListener("click", async () => {
            this.selectedTags = [];
            this.searchTerm = "";
            searchInput.value = "";
            await this.loadThemes();
            this.renderModal();
          });
        }
        const tagsGrid = tagsSection.createDiv("tags-grid");
        this.allTags.forEach((tag2) => {
          const tagBtn = tagsGrid.createEl("button", {
            text: tag2,
            cls: `tag-btn ${this.selectedTags.includes(tag2) ? "selected" : ""}`
          });
          tagBtn.addEventListener("click", async () => {
            if (this.selectedTags.includes(tag2)) {
              this.selectedTags = this.selectedTags.filter((t2) => t2 !== tag2);
            } else {
              this.selectedTags.push(tag2);
            }
            await this.loadThemes();
            this.renderModal();
          });
        });
        const themesSection = contentEl.createDiv("themes-section");
        this.renderThemes(themesSection);
      }
      renderThemes(container) {
        const themesSection = container || this.contentEl.querySelector(".themes-section");
        if (!themesSection) return;
        themesSection.empty();
        if (this.loadingState === "error") {
          this.renderErrorState(themesSection);
          return;
        }
        if (this.loading || this.loadingState !== "idle") {
          this.renderLoadingState(themesSection);
          return;
        }
        if (this.themes.length === 0) {
          const noResults = themesSection.createDiv("no-results");
          noResults.createEl("p", { text: this.t("theme.no_themes_found") });
          return;
        }
        const themesGrid = themesSection.createDiv("themes-grid");
        this.themes.forEach((theme) => {
          const themeCard = themesGrid.createDiv(`theme-card ${theme.id === this.selectedTheme ? "selected" : ""}`);
          const imageSection = themeCard.createDiv("theme-image-section");
          if (theme.thumbnail) {
            imageSection.style.backgroundImage = `url("${theme.thumbnail}")`;
          } else {
            const gradients = [
              "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
              "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",
              "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",
              "linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)",
              "linear-gradient(135deg, #fa709a 0%, #fee140 100%)",
              "linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)",
              "linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%)",
              "linear-gradient(135deg, #ff8a80 0%, #ea80fc 100%)"
            ];
            const hash2 = theme.name.split("").reduce((a, b) => {
              a = (a << 5) - a + b.charCodeAt(0);
              return a & a;
            }, 0);
            const gradientIndex = Math.abs(hash2) % gradients.length;
            imageSection.style.background = gradients[gradientIndex];
          }
          if (theme.demo) {
            const liveDemoBtn = imageSection.createEl("a", {
              text: this.t("theme.live_demo"),
              cls: "live-demo-btn"
            });
            liveDemoBtn.href = theme.demo;
            liveDemoBtn.target = "_blank";
            liveDemoBtn.addEventListener("click", (e2) => {
              e2.stopPropagation();
            });
          }
          const infoSection = themeCard.createDiv("theme-info-section");
          const leftInfo = infoSection.createDiv("theme-info-left");
          leftInfo.createEl("h3", { text: theme.name, cls: "theme-title" });
          if (theme.author || theme.version) {
            const metaInfo = leftInfo.createDiv("theme-meta-info");
            if (theme.author) {
              metaInfo.createEl("span", { text: this.t("theme.by_author", { author: theme.author }), cls: "theme-author" });
            }
            if (theme.version) {
              if (theme.author) {
                metaInfo.createEl("span", { text: " \u2022 ", cls: "separator" });
              }
              metaInfo.createEl("span", { text: `v${theme.version}`, cls: "theme-version" });
            }
          }
          leftInfo.createEl("p", { text: theme.description || "", cls: "theme-description" });
          const rightInfo = infoSection.createDiv("theme-info-right");
          const planKind = theme.kind && theme.kind.length > 0 ? theme.kind[0].toLowerCase() : "free";
          const planTranslationKey = `theme.${planKind}`;
          const planText = this.t(planTranslationKey);
          const planBadge = rightInfo.createDiv({
            text: planText,
            cls: `theme-price ${planKind}`
          });
          const bottomSection = themeCard.createDiv("theme-bottom-section");
          if (theme.tags && theme.tags.length > 0) {
            const tags = bottomSection.createDiv("theme-tags");
            theme.tags.forEach((tag2) => {
              tags.createEl("span", { text: tag2, cls: "tag" });
            });
          }
          const useBtn = bottomSection.createEl("button", {
            text: theme.id === this.selectedTheme ? this.t("theme.current") : this.t("theme.use_it"),
            cls: `use-theme-btn ${theme.id === this.selectedTheme ? "current" : ""}`
          });
          useBtn.addEventListener("click", (e2) => {
            e2.stopPropagation();
            this.onSelect(theme.download_url, theme.name, theme.id);
            this.close();
          });
          themeCard.addEventListener("click", () => {
            this.onSelect(theme.download_url, theme.name, theme.id);
            this.close();
          });
        });
      }
      renderLoadingState(container) {
        if (this.loadingState === "initial" || this.loadingState === "tags") {
          const loadingContainer = container.createDiv("loading-container");
          let loadingText = this.t("theme.loading_initial");
          if (this.loadingState === "tags") {
            loadingText = this.t("theme.loading_tags");
          }
          loadingContainer.createDiv("loading-spinner");
          loadingContainer.createDiv("loading-text").setText(loadingText);
          return;
        }
        if (this.loading) {
          let loadingText = this.t("theme.loading_themes");
          if (this.loadingState === "search") {
            loadingText = this.t("theme.loading_search");
          }
          container.createDiv("loading-message").setText(loadingText);
        }
      }
      renderErrorState(container) {
        const errorContainer = container.createDiv("error-container");
        errorContainer.createDiv("error-icon").setText("\u26A0\uFE0F");
        const errorMessage = this.loadingError || this.t("theme.loading_error");
        errorContainer.createDiv("error-message").setText(errorMessage);
        const retryButton = errorContainer.createEl("button", {
          text: this.t("theme.retry"),
          cls: "retry-button"
        });
        retryButton.addEventListener("click", async () => {
          try {
            await this.loadThemes();
          } catch (error2) {
            console.error("Retry failed:", error2);
          }
        });
      }
      onClose() {
        const { contentEl } = this;
        contentEl.empty();
        if (this.searchTimeout) {
          clearTimeout(this.searchTimeout);
          this.searchTimeout = null;
        }
      }
    };
  }
});

// src/projects/modal.ts
var modal_exports2 = {};
__export2(modal_exports2, {
  ProjectManagementModal: () => ProjectManagementModal
});
var import_obsidian17, ProjectManagementModal;
var init_modal2 = __esm({
  "src/projects/modal.ts"() {
    "use strict";
    import_obsidian17 = require("obsidian");
    ProjectManagementModal = class extends import_obsidian17.Modal {
      constructor(app, plugin2, projectService, onApply, onExport, onClearHistory) {
        super(app);
        this.selectedProjectId = null;
        this.projects = [];
        this.currentProject = null;
        this.buildHistory = [];
        this.plugin = plugin2;
        this.projectService = projectService;
        this.onApply = onApply;
        this.onExport = onExport;
        this.onClearHistory = onClearHistory;
        this.setTitle(plugin2.i18n.t("projects.manage_projects"));
      }
      t(key4, params) {
        return this.plugin.i18n.t(key4, params);
      }
      async onOpen() {
        const { contentEl, modalEl } = this;
        modalEl.addClass("friday-projects-modal");
        contentEl.empty();
        await this.loadProjects();
        this.renderModal();
      }
      async loadProjects() {
        this.projects = this.projectService.getProjects();
        if (!this.selectedProjectId && this.projects.length > 0) {
          this.selectedProjectId = this.projects[0].id;
        }
        if (this.selectedProjectId) {
          this.currentProject = this.projectService.getProject(this.selectedProjectId) || null;
          this.buildHistory = this.projectService.getBuildHistory(this.selectedProjectId, 10);
        } else {
          this.currentProject = null;
          this.buildHistory = [];
        }
      }
      renderModal() {
        const { contentEl } = this;
        contentEl.empty();
        const mainContainer = contentEl.createDiv("projects-main-container");
        const leftSidebar = mainContainer.createDiv("projects-left-sidebar");
        this.renderProjectsList(leftSidebar);
        const rightContent = mainContainer.createDiv("projects-right-content");
        this.renderProjectDetails(rightContent);
      }
      renderProjectsList(container) {
        container.empty();
        const header = container.createDiv("projects-list-header");
        header.createEl("h3", { text: this.t("projects.project_list"), cls: "projects-list-title" });
        const listContainer = container.createDiv("projects-list-container");
        if (this.projects.length === 0) {
          const emptyState = listContainer.createDiv("projects-empty-state");
          emptyState.createEl("p", { text: this.t("projects.no_projects"), cls: "empty-message" });
          return;
        }
        this.projects.forEach((project) => {
          const projectItem = listContainer.createDiv(
            `project-item ${this.selectedProjectId === project.id ? "selected" : ""}`
          );
          projectItem.createEl("div", { text: project.name, cls: "project-name" });
          projectItem.createEl("div", { text: project.id, cls: "project-path" });
          projectItem.addEventListener("click", async () => {
            this.selectedProjectId = project.id;
            await this.loadProjects();
            this.renderModal();
          });
        });
      }
      renderProjectDetails(container) {
        container.empty();
        if (!this.currentProject) {
          const emptyState = container.createDiv("project-details-empty");
          emptyState.createEl("p", {
            text: this.t("projects.select_project_to_view"),
            cls: "empty-message"
          });
          return;
        }
        const header = container.createDiv("project-details-header");
        const titleSection = header.createDiv("project-details-title-section");
        titleSection.createEl("h2", { text: this.currentProject.name, cls: "project-details-title" });
        const actionsSection = header.createDiv("project-details-actions");
        const applyBtn = actionsSection.createEl("button", {
          text: this.t("projects.apply_to_panel"),
          cls: "apply-project-btn"
        });
        applyBtn.addEventListener("click", () => {
          if (this.currentProject) {
            this.onApply(this.currentProject);
            new import_obsidian17.Notice(this.t("projects.project_applied"));
            this.close();
          }
        });
        const detailsContent = container.createDiv("project-details-content");
        const configSection = detailsContent.createDiv("project-config-section");
        configSection.createEl("h3", { text: this.t("projects.configuration"), cls: "section-title" });
        const configGrid = configSection.createDiv("config-grid");
        this.renderConfigItem(configGrid, this.t("ui.site_name"), this.currentProject.name);
        const contentLabel = this.t("ui.multilingual_content");
        const contentValue = this.currentProject.contents.map((c) => {
          const folderName = c.contentPath.split("/").pop() || c.contentPath;
          return `${folderName} (${c.languageCode})`;
        }).join(", ");
        this.renderConfigItem(configGrid, contentLabel, contentValue);
        this.renderConfigItem(
          configGrid,
          this.t("ui.default_language"),
          this.currentProject.defaultContentLanguage
        );
        if (this.currentProject.assetsPath) {
          const assetsFolderName = this.currentProject.assetsPath.split("/").pop() || this.currentProject.assetsPath;
          this.renderConfigItem(configGrid, this.t("ui.site_assets"), assetsFolderName);
        }
        this.renderConfigItem(configGrid, this.t("ui.theme"), this.currentProject.themeName);
        const advancedSection = configSection.createDiv("advanced-config-section");
        advancedSection.createEl("h4", { text: this.t("ui.advanced_settings"), cls: "subsection-title" });
        const advancedGrid = advancedSection.createDiv("config-grid");
        this.renderConfigItem(advancedGrid, this.t("ui.site_path"), this.currentProject.sitePath);
        if (this.currentProject.googleAnalyticsId) {
          this.renderConfigItem(
            advancedGrid,
            this.t("ui.google_analytics_id"),
            this.currentProject.googleAnalyticsId
          );
        }
        if (this.currentProject.disqusShortname) {
          this.renderConfigItem(
            advancedGrid,
            this.t("ui.disqus_shortname"),
            this.currentProject.disqusShortname
          );
        }
        if (this.currentProject.sitePassword) {
          this.renderConfigItem(
            advancedGrid,
            this.t("ui.site_password"),
            this.currentProject.sitePassword
          );
        }
        if (this.currentProject.publishConfig) {
          const publishSection = configSection.createDiv("publish-config-section");
          publishSection.createEl("h4", { text: this.t("ui.publish"), cls: "subsection-title" });
          const publishGrid = publishSection.createDiv("config-grid");
          const methodLabel = this.currentProject.publishConfig.method === "netlify" ? this.t("ui.publish_option_netlify") : this.currentProject.publishConfig.method === "ftp" ? this.t("ui.publish_option_ftp") : this.t("ui.publish_option_mdfriday");
          this.renderConfigItem(publishGrid, this.t("ui.publish_method"), methodLabel);
          if (this.currentProject.publishConfig.netlify && (this.currentProject.publishConfig.netlify.accessToken || this.currentProject.publishConfig.netlify.projectId)) {
            if (this.currentProject.publishConfig.netlify.accessToken) {
              this.renderConfigItem(
                publishGrid,
                this.t("settings.netlify_access_token"),
                "\u2022\u2022\u2022\u2022\u2022\u2022" + this.currentProject.publishConfig.netlify.accessToken.slice(-4)
              );
            }
            if (this.currentProject.publishConfig.netlify.projectId) {
              this.renderConfigItem(
                publishGrid,
                this.t("settings.netlify_project_id"),
                this.currentProject.publishConfig.netlify.projectId
              );
            }
          }
          if (this.currentProject.publishConfig.ftp && (this.currentProject.publishConfig.ftp.server || this.currentProject.publishConfig.ftp.username)) {
            if (this.currentProject.publishConfig.ftp.server) {
              this.renderConfigItem(
                publishGrid,
                this.t("settings.ftp_server"),
                this.currentProject.publishConfig.ftp.server
              );
            }
            if (this.currentProject.publishConfig.ftp.username) {
              this.renderConfigItem(
                publishGrid,
                this.t("settings.ftp_username"),
                this.currentProject.publishConfig.ftp.username
              );
            }
            if (this.currentProject.publishConfig.ftp.remoteDir) {
              this.renderConfigItem(
                publishGrid,
                this.t("settings.ftp_remote_dir"),
                this.currentProject.publishConfig.ftp.remoteDir
              );
            }
          }
        }
        const historySection = detailsContent.createDiv("project-history-section");
        historySection.createEl("h3", { text: this.t("projects.build_history"), cls: "section-title" });
        const historyList = historySection.createDiv("history-list");
        if (this.buildHistory.length === 0) {
          historyList.createEl("p", { text: this.t("projects.no_build_history"), cls: "empty-message" });
        } else {
          this.buildHistory.forEach((history) => {
            const historyItem = historyList.createDiv("history-item");
            const typeIcon = history.type === "preview" ? "\u{1F441}\uFE0F" : "\u{1F680}";
            const statusIcon = history.success ? "\u2705" : "\u274C";
            const typeText = history.type === "preview" ? this.t("ui.preview") : this.t("ui.publish");
            const typeStatus = historyItem.createDiv("history-type-status");
            typeStatus.createEl("span", { text: `${typeIcon} ${typeText} ${statusIcon}`, cls: "history-type" });
            const timeAgo = this.formatTimeAgo(history.timestamp);
            historyItem.createEl("span", { text: timeAgo, cls: "history-time" });
            if (history.type === "publish" && history.publishMethod) {
              const methodText = history.publishMethod === "netlify" ? "Netlify" : history.publishMethod === "ftp" ? "FTP" : "MDFriday";
              historyItem.createEl("span", { text: methodText, cls: "history-method" });
            }
            if (history.url && history.type === "publish") {
              const urlLink = historyItem.createEl("a", {
                text: this.t("projects.view_site"),
                cls: "history-url",
                href: history.url
              });
              urlLink.target = "_blank";
            }
            if (history.previewId && history.success) {
              const exportBtn = historyItem.createEl("button", {
                text: this.t("projects.export_build"),
                cls: "history-export-btn"
              });
              exportBtn.addEventListener("click", async () => {
                try {
                  await this.onExport(history.previewId);
                } catch (error2) {
                  console.error("Export failed:", error2);
                  new import_obsidian17.Notice(this.t("messages.export_failed", { error: error2.message }), 5e3);
                }
              });
            }
            if (!history.success && history.error) {
              historyItem.createEl("div", { text: history.error, cls: "history-error" });
            }
          });
        }
        const dangerZone = detailsContent.createDiv("project-danger-zone");
        dangerZone.createEl("h3", { text: this.t("projects.danger_zone"), cls: "danger-zone-title" });
        const clearHistoryContent = dangerZone.createDiv("danger-zone-content");
        const clearHistoryWarning = clearHistoryContent.createDiv("danger-zone-warning");
        clearHistoryWarning.createEl("strong", { text: this.t("projects.clear_history_title") });
        clearHistoryWarning.createEl("p", { text: this.t("projects.clear_history_message") });
        const clearHistoryBtn = clearHistoryContent.createEl("button", {
          text: this.t("projects.clear_preview_history"),
          cls: "danger-zone-action-btn"
        });
        clearHistoryBtn.addEventListener("click", async () => {
          if (this.currentProject) {
            try {
              await this.onClearHistory(this.currentProject.id);
              await this.loadProjects();
              this.renderModal();
            } catch (error2) {
              console.error("Clear history failed:", error2);
            }
          }
        });
        dangerZone.createDiv("danger-zone-separator");
        const deleteContent = dangerZone.createDiv("danger-zone-content");
        const deleteWarning = deleteContent.createDiv("danger-zone-warning");
        deleteWarning.createEl("strong", { text: this.t("projects.delete_warning_title") });
        deleteWarning.createEl("p", { text: this.t("projects.delete_warning_message") });
        const deleteBtn = deleteContent.createEl("button", {
          text: this.t("projects.delete_project_permanent"),
          cls: "danger-zone-delete-btn"
        });
        deleteBtn.addEventListener("click", async () => {
          if (this.currentProject && confirm(this.t("projects.confirm_delete", { name: this.currentProject.name }))) {
            await this.projectService.deleteProject(this.currentProject.id);
            this.selectedProjectId = null;
            await this.loadProjects();
            this.renderModal();
            new import_obsidian17.Notice(this.t("projects.project_deleted"));
          }
        });
      }
      renderConfigItem(container, label, value2) {
        const item = container.createDiv("config-item");
        item.createEl("div", { text: label, cls: "config-label" });
        item.createEl("div", { text: value2, cls: "config-value" });
      }
      formatTimeAgo(timestamp) {
        const now = Date.now();
        const diff = now - timestamp;
        const minutes = Math.floor(diff / 6e4);
        const hours = Math.floor(diff / 36e5);
        const days = Math.floor(diff / 864e5);
        if (minutes < 1) {
          return this.t("projects.just_now");
        } else if (minutes < 60) {
          return this.t("projects.minutes_ago", { count: minutes });
        } else if (hours < 24) {
          return this.t("projects.hours_ago", { count: hours });
        } else {
          return this.t("projects.days_ago", { count: days });
        }
      }
      onClose() {
        const { contentEl } = this;
        contentEl.empty();
      }
    };
  }
});

// src/projects/service.ts
var service_exports = {};
__export2(service_exports, {
  ProjectService: () => ProjectService
});
var path5, fs4, ProjectService;
var init_service2 = __esm({
  "src/projects/service.ts"() {
    "use strict";
    path5 = __toESM2(require("path"), 1);
    fs4 = __toESM2(require("fs"), 1);
    ProjectService = class {
      constructor(plugin2) {
        this.dataFilePath = "";
        this.plugin = plugin2;
        this.data = {
          projects: [],
          buildHistory: []
        };
      }
      /**
       * Initialize service and load data
       */
      async initialize() {
        this.dataFilePath = `${this.plugin.pluginDir}/projects-data.json`;
        await this.loadData();
      }
      /**
       * Load projects data from file
       */
      async loadData() {
        try {
          const adapter = this.plugin.app.vault.adapter;
          if (await adapter.exists(this.dataFilePath)) {
            const content = await adapter.read(this.dataFilePath);
            this.data = JSON.parse(content);
          }
        } catch (error2) {
          console.error("Failed to load projects data:", error2);
          this.data = {
            projects: [],
            buildHistory: []
          };
        }
      }
      /**
       * Save projects data to file
       */
      async saveData() {
        try {
          const adapter = this.plugin.app.vault.adapter;
          await adapter.write(this.dataFilePath, JSON.stringify(this.data, null, 2));
        } catch (error2) {
          console.error("Failed to save projects data:", error2);
          console.error("Data file path:", this.dataFilePath);
          throw error2;
        }
      }
      /**
       * Get all projects
       */
      getProjects() {
        return this.data.projects;
      }
      /**
       * Get project by ID
       */
      getProject(id) {
        return this.data.projects.find((p) => p.id === id);
      }
      /**
       * Save or update a project
       */
      async saveProject(project) {
        const existingIndex = this.data.projects.findIndex((p) => p.id === project.id);
        if (existingIndex >= 0) {
          const existingProject = this.data.projects[existingIndex];
          project.createdAt = existingProject.createdAt;
          project.updatedAt = Date.now();
          this.data.projects[existingIndex] = project;
        } else {
          if (!project.createdAt) {
            project.createdAt = Date.now();
          }
          project.updatedAt = Date.now();
          this.data.projects.push(project);
        }
        await this.saveData();
      }
      /**
       * Delete a project
       */
      async deleteProject(id) {
        this.data.projects = this.data.projects.filter((p) => p.id !== id);
        this.data.buildHistory = this.data.buildHistory.filter((h2) => h2.projectId !== id);
        await this.saveData();
      }
      /**
       * Add build history entry
       */
      async addBuildHistory(history) {
        this.data.buildHistory.unshift(history);
        const projectHistories = this.data.buildHistory.filter((h2) => h2.projectId === history.projectId);
        if (projectHistories.length > 50) {
          const toRemove = projectHistories.slice(50);
          this.data.buildHistory = this.data.buildHistory.filter((h2) => !toRemove.includes(h2));
        }
        await this.saveData();
      }
      /**
       * Get build history for a project
       */
      getBuildHistory(projectId, limit = 10) {
        return this.data.buildHistory.filter((h2) => h2.projectId === projectId).slice(0, limit);
      }
      /**
       * Get all build history
       */
      getAllBuildHistory(limit = 20) {
        return this.data.buildHistory.slice(0, limit);
      }
      /**
       * Clear all build history for a project
       */
      async clearProjectBuildHistory(projectId) {
        this.data.buildHistory = this.data.buildHistory.filter((h2) => h2.projectId !== projectId);
        await this.saveData();
      }
      /**
       * Get manifest file path for a project
       */
      getManifestFilePath(projectId, uploadMethod = "ftp") {
        const sanitizedId = projectId.replace(/[^a-zA-Z0-9-_]/g, "_");
        const filename = `manifest-${uploadMethod}-${sanitizedId}.json`;
        return path5.join(this.plugin.pluginDir, filename);
      }
      /**
       * Load manifest for a project
       */
      async loadManifest(projectId, uploadMethod = "ftp") {
        try {
          const filePath = this.getManifestFilePath(projectId, uploadMethod);
          const adapter = this.plugin.app.vault.adapter;
          if (!await adapter.exists(filePath)) {
            return null;
          }
          const content = await adapter.read(filePath);
          const manifest = JSON.parse(content);
          return manifest;
        } catch (error2) {
          console.error(`[ProjectService] Failed to load manifest for ${projectId}:`, error2);
          return null;
        }
      }
      /**
       * Save manifest for a project
       */
      async saveManifest(manifest) {
        try {
          const filePath = this.getManifestFilePath(manifest.projectId, manifest.uploadMethod);
          const adapter = this.plugin.app.vault.adapter;
          const dirPath = path5.dirname(filePath);
          if (!await adapter.exists(dirPath)) {
            await fs4.promises.mkdir(dirPath, { recursive: true });
          }
          const content = JSON.stringify(manifest, null, 2);
          await adapter.write(filePath, content);
        } catch (error2) {
          console.error(`[ProjectService] Failed to save manifest for ${manifest.projectId}:`, error2);
          throw error2;
        }
      }
      /**
       * Delete manifest for a project
       */
      async deleteManifest(projectId, uploadMethod = "ftp") {
        try {
          const filePath = this.getManifestFilePath(projectId, uploadMethod);
          const adapter = this.plugin.app.vault.adapter;
          if (await adapter.exists(filePath)) {
            await adapter.remove(filePath);
          }
        } catch (error2) {
          console.error(`[ProjectService] Failed to delete manifest for ${projectId}:`, error2);
        }
      }
    };
  }
});

// node_modules/svelte/src/store/index-client.js
var init_index_client2 = __esm({
  "node_modules/svelte/src/store/index-client.js"() {
    init_effects();
    init_shared2();
    init_create_subscriber();
    init_runtime();
    init_shared2();
  }
});

// src/site.ts
var site_exports = {};
__export2(site_exports, {
  Site: () => Site2
});
var import_obsidian18, Site2;
var init_site = __esm({
  "src/site.ts"() {
    "use strict";
    import_obsidian18 = require("obsidian");
    init_index_client2();
    Site2 = class {
      constructor(plugin2) {
        this.plugin = plugin2;
        this.app = this.plugin.app;
        this.languageContents = writable([]);
        this.siteAssets = writable(null);
      }
      /**
       * 生成随机ID
       */
      generateRandomId() {
        return Math.random().toString(36).substr(2, 9);
      }
      /**
       * 初始化内容 - 当用户首次选择文件夹或文件时调用
       */
      initializeContent(folder, file) {
        this.languageContents.update((contents) => {
          if (contents.length > 0) {
            return contents;
          }
          const initialContent = {
            id: this.generateRandomId(),
            folder,
            file,
            languageCode: "en",
            // 默认英语
            weight: 1
          };
          return [initialContent];
        });
      }
      /**
       * 使用指定语言代码初始化内容
       */
      initializeContentWithLanguage(folder, file, languageCode) {
        this.languageContents.update((contents) => {
          if (contents.length > 0) {
            return contents;
          }
          const initialContent = {
            id: this.generateRandomId(),
            folder,
            file,
            languageCode,
            weight: 1
          };
          return [initialContent];
        });
      }
      /**
       * 添加多语言内容
       */
      addLanguageContent(folder, file) {
        let canAdd = false;
        let currentContents = [];
        this.languageContents.subscribe((contents) => {
          currentContents = contents;
        })();
        if (currentContents.length === 0) {
          new import_obsidian18.Notice(this.plugin.i18n.t("messages.please_use_publish_first"), 5e3);
          return false;
        }
        const firstContent = currentContents[0];
        const isFirstFolder = !!firstContent.folder;
        const isNewFolder = !!folder;
        if (isFirstFolder !== isNewFolder) {
          const errorMessage = isFirstFolder ? this.plugin.i18n.t("messages.must_select_folder_type") : this.plugin.i18n.t("messages.must_select_file_type");
          new import_obsidian18.Notice(errorMessage, 5e3);
          return false;
        }
        this.languageContents.update((contents) => {
          const newContent = {
            id: this.generateRandomId(),
            folder,
            file,
            languageCode: "en",
            // 默认英语，用户可以后续修改
            weight: contents.length + 1
          };
          canAdd = true;
          return [...contents, newContent];
        });
        if (canAdd) {
          new import_obsidian18.Notice(this.plugin.i18n.t("messages.language_added_successfully"), 3e3);
        }
        return canAdd;
      }
      /**
       * 添加带指定语言代码的多语言内容
       */
      addLanguageContentWithCode(folder, file, languageCode) {
        let canAdd = false;
        let currentContents = [];
        this.languageContents.subscribe((contents) => {
          currentContents = contents;
        })();
        if (currentContents.length === 0) {
          new import_obsidian18.Notice(this.plugin.i18n.t("messages.please_use_publish_first"), 5e3);
          return false;
        }
        const firstContent = currentContents[0];
        const isFirstFolder = !!firstContent.folder;
        const isNewFolder = !!folder;
        if (isFirstFolder !== isNewFolder) {
          const errorMessage = isFirstFolder ? this.plugin.i18n.t("messages.must_select_folder_type") : this.plugin.i18n.t("messages.must_select_file_type");
          new import_obsidian18.Notice(errorMessage, 5e3);
          return false;
        }
        this.languageContents.update((contents) => {
          const newContent = {
            id: this.generateRandomId(),
            folder,
            file,
            languageCode,
            weight: contents.length + 1
          };
          canAdd = true;
          return [...contents, newContent];
        });
        return canAdd;
      }
      /**
       * 更新语言代码
       */
      updateLanguageCode(contentId, newLanguageCode) {
        this.languageContents.update((contents) => {
          return contents.map(
            (content) => content.id === contentId ? { ...content, languageCode: newLanguageCode } : content
          );
        });
      }
      /**
       * 移除语言内容
       */
      removeLanguageContent(contentId) {
        this.languageContents.update((contents) => {
          const filteredContents = contents.filter((content) => content.id !== contentId);
          return filteredContents.map((content, index6) => ({
            ...content,
            weight: index6 + 1
          }));
        });
      }
      /**
       * 清空所有内容
       */
      clearAllContent() {
        this.languageContents.set([]);
        new import_obsidian18.Notice(this.plugin.i18n.t("messages.all_content_cleared"), 3e3);
      }
      /**
       * 检查是否有内容
       */
      hasContent() {
        let hasContent = false;
        this.languageContents.subscribe((contents) => {
          hasContent = contents.length > 0;
        })();
        return hasContent;
      }
      /**
       * 获取当前内容（同步方式）
       */
      getCurrentContents() {
        let currentContents = [];
        this.languageContents.subscribe((contents) => {
          currentContents = contents;
        })();
        return currentContents;
      }
      /**
       * 获取默认内容语言
       */
      getDefaultContentLanguage() {
        const contents = this.getCurrentContents();
        return contents.length > 0 ? contents[0].languageCode : "en";
      }
      /**
       * 检查是否为单文件模式
       */
      isForSingleFile() {
        const contents = this.getCurrentContents();
        return contents.length > 0 && !!contents[0].file;
      }
      /**
       * 设置站点资源文件夹
       */
      setSiteAssets(folder) {
        if (!folder) {
          new import_obsidian18.Notice(this.plugin.i18n.t("messages.invalid_assets_folder"), 3e3);
          return false;
        }
        this.siteAssets.set({
          folder,
          path: folder.path
        });
        new import_obsidian18.Notice(this.plugin.i18n.t("messages.site_assets_set_successfully"), 3e3);
        return true;
      }
      /**
       * 清除站点资源
       */
      clearSiteAssets() {
        this.siteAssets.set(null);
        new import_obsidian18.Notice(this.plugin.i18n.t("messages.site_assets_cleared"), 3e3);
      }
      /**
       * 获取当前站点资源（同步方式）
       */
      getCurrentAssets() {
        let currentAssets = null;
        this.siteAssets.subscribe((assets) => {
          currentAssets = assets;
        })();
        return currentAssets;
      }
      /**
       * 检查是否有站点资源
       */
      hasAssets() {
        const assets = this.getCurrentAssets();
        return assets !== null;
      }
    };
  }
});

// src/netlify.ts
var netlify_exports = {};
__export2(netlify_exports, {
  NetlifyAPI: () => NetlifyAPI
});
var import_obsidian19, path6, fs5, import_jszip2, NetlifyAPI;
var init_netlify = __esm({
  "src/netlify.ts"() {
    "use strict";
    import_obsidian19 = require("obsidian");
    path6 = __toESM2(require("path"), 1);
    fs5 = __toESM2(require("fs"), 1);
    import_jszip2 = __toESM2(require_jszip_min(), 1);
    NetlifyAPI = class {
      constructor(plugin2) {
        this.plugin = plugin2;
        this.app = this.plugin.app;
        const adapter = this.app.vault.adapter;
        if (adapter instanceof import_obsidian19.FileSystemAdapter) {
          this.basePath = adapter.getBasePath();
        }
      }
      /**
       * Deploy a directory to Netlify
       * @param publicDir - The directory containing the site files
       * @param progressCallback - Callback to report progress (0-100)
       * @returns Promise<string> - The deployed site URL
       */
      async deployToNetlify(publicDir, progressCallback) {
        const { netlifyAccessToken, netlifyProjectId } = this.plugin.settings;
        if (!netlifyAccessToken || !netlifyProjectId) {
          throw new Error("Netlify access token and project ID are required");
        }
        try {
          progressCallback == null ? void 0 : progressCallback(5);
          const zipContent = await this.createZipFromDirectory(publicDir);
          progressCallback == null ? void 0 : progressCallback(30);
          const deployId = await this.uploadToNetlify(zipContent, netlifyAccessToken, netlifyProjectId, (uploadProgress) => {
            progressCallback == null ? void 0 : progressCallback(30 + uploadProgress * 0.6);
          });
          progressCallback == null ? void 0 : progressCallback(90);
          try {
            await this.waitForDeployment(deployId, netlifyAccessToken);
          } catch (error2) {
            console.warn("Failed to confirm deployment status via API, but deployment may still be successful:", error2.message);
          }
          progressCallback == null ? void 0 : progressCallback(100);
          return await this.getSiteUrl(netlifyProjectId, netlifyAccessToken);
        } catch (error2) {
          console.error("Netlify deployment failed:", error2);
          if (error2.message.includes("401") || error2.message.includes("Unauthorized")) {
            throw new Error("Invalid Netlify access token. Please check your settings.");
          } else if (error2.message.includes("404") || error2.message.includes("Not Found")) {
            throw new Error("Netlify site not found. Please check your project ID.");
          } else if (error2.message.includes("network") || error2.message.includes("CORS")) {
            throw new Error("Network error. Please check your internet connection.");
          }
          throw error2;
        }
      }
      /**
       * Create a ZIP file from a directory
       */
      async createZipFromDirectory(sourceDir) {
        const zip = new import_jszip2.default();
        const addDirectoryToZip = async (dirPath, zipFolder) => {
          const items = await fs5.promises.readdir(dirPath, { withFileTypes: true });
          for (const item of items) {
            const itemPath = path6.join(dirPath, item.name);
            if (item.isDirectory()) {
              const subFolder = zipFolder.folder(item.name);
              if (subFolder) {
                await addDirectoryToZip(itemPath, subFolder);
              }
            } else if (item.isFile()) {
              const fileContent = await fs5.promises.readFile(itemPath);
              zipFolder.file(item.name, new Uint8Array(fileContent));
            }
          }
        };
        await addDirectoryToZip(sourceDir, zip);
        return await zip.generateAsync({ type: "uint8array" });
      }
      /**
       * Upload ZIP file to Netlify using Obsidian's requestUrl to avoid CORS issues
       * Simulates progress tracking with time-based updates
       */
      async uploadToNetlify(zipContent, accessToken, siteId, progressCallback) {
        try {
          const progressInterval = this.simulateUploadProgress(zipContent.length, progressCallback);
          const response = await (0, import_obsidian19.requestUrl)({
            url: `https://api.netlify.com/api/v1/sites/${siteId}/deploys`,
            method: "POST",
            headers: {
              "Authorization": `Bearer ${accessToken}`,
              "Content-Type": "application/zip"
            },
            body: zipContent.buffer
          });
          clearInterval(progressInterval);
          progressCallback == null ? void 0 : progressCallback(100);
          if (response.status === 200) {
            return response.json.id;
          } else {
            throw new Error(`Upload failed with status: ${response.status} - ${response.text}`);
          }
        } catch (error2) {
          console.error("Netlify upload error:", error2);
          throw new Error(`Upload failed: ${error2.message}`);
        }
      }
      /**
       * Simulate upload progress based on file size and time
       */
      simulateUploadProgress(fileSize, progressCallback) {
        let progress = 0;
        const totalTime = Math.min(Math.max(fileSize / 1024 / 1024 * 2e3, 3e3), 3e4);
        const interval = 500;
        const increment2 = interval / totalTime * 100;
        return setInterval(() => {
          progress = Math.min(progress + increment2, 95);
          progressCallback == null ? void 0 : progressCallback(progress);
        }, interval);
      }
      /**
       * Wait for deployment to be ready
       */
      async waitForDeployment(deployId, accessToken, maxAttempts = 30) {
        for (let i = 0; i < maxAttempts; i++) {
          try {
            const checkUrl = `https://api.netlify.com/api/v1/deploys/${deployId}`;
            const response = await (0, import_obsidian19.requestUrl)({
              url: checkUrl,
              method: "GET",
              headers: {
                "Authorization": `Bearer ${accessToken}`
              }
            });
            if (response.status === 200) {
              const deploy = response.json;
              if (deploy.state === "ready") {
                return;
              } else if (deploy.state === "error") {
                throw new Error(`Deployment failed: ${deploy.error_message || "Unknown error"}`);
              }
            } else {
              console.warn(`Unexpected status code: ${response.status}, response: ${response.text}`);
            }
            await new Promise((resolve) => setTimeout(resolve, 2e3));
          } catch (error2) {
            console.error(`Error checking deployment status (attempt ${i + 1}):`, error2);
            if (i === maxAttempts - 1) {
              throw error2;
            }
            await new Promise((resolve) => setTimeout(resolve, 2e3));
          }
        }
        throw new Error("Deployment timed out");
      }
      /**
       * Get the site URL
       */
      async getSiteUrl(siteId, accessToken) {
        try {
          const response = await (0, import_obsidian19.requestUrl)({
            url: `https://api.netlify.com/api/v1/sites/${siteId}`,
            method: "GET",
            headers: {
              "Authorization": `Bearer ${accessToken}`
            }
          });
          if (response.status === 200) {
            const site = response.json;
            return site.ssl_url || site.url;
          }
          throw new Error(`Failed to get site URL: ${response.status}`);
        } catch (error2) {
          console.error("Failed to get site URL:", error2);
          throw error2;
        }
      }
    };
  }
});

// node_modules/basic-ftp/dist/parseControlResponse.js
var require_parseControlResponse = __commonJS({
  "node_modules/basic-ftp/dist/parseControlResponse.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.parseControlResponse = parseControlResponse;
    exports2.isSingleLine = isSingleLine;
    exports2.isMultiline = isMultiline;
    exports2.positiveCompletion = positiveCompletion;
    exports2.positiveIntermediate = positiveIntermediate;
    var LF = "\n";
    function parseControlResponse(text3) {
      const lines = text3.split(/\r?\n/).filter(isNotBlank);
      const messages2 = [];
      let startAt = 0;
      let tokenRegex;
      for (let i = 0; i < lines.length; i++) {
        const line = lines[i];
        if (!tokenRegex) {
          if (isMultiline(line)) {
            const token = line.substr(0, 3);
            tokenRegex = new RegExp(`^${token}(?:$| )`);
            startAt = i;
          } else if (isSingleLine(line)) {
            messages2.push(line);
          }
        } else if (tokenRegex.test(line)) {
          tokenRegex = void 0;
          messages2.push(lines.slice(startAt, i + 1).join(LF));
        }
      }
      const rest = tokenRegex ? lines.slice(startAt).join(LF) + LF : "";
      return { messages: messages2, rest };
    }
    function isSingleLine(line) {
      return /^\d\d\d(?:$| )/.test(line);
    }
    function isMultiline(line) {
      return /^\d\d\d-/.test(line);
    }
    function positiveCompletion(code) {
      return code >= 200 && code < 300;
    }
    function positiveIntermediate(code) {
      return code >= 300 && code < 400;
    }
    function isNotBlank(str) {
      return str.trim() !== "";
    }
  }
});

// node_modules/basic-ftp/dist/FtpContext.js
var require_FtpContext = __commonJS({
  "node_modules/basic-ftp/dist/FtpContext.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.FTPContext = exports2.FTPError = void 0;
    var net_1 = require("net");
    var parseControlResponse_1 = require_parseControlResponse();
    var FTPError = class extends Error {
      constructor(res2) {
        super(res2.message);
        this.name = this.constructor.name;
        this.code = res2.code;
      }
    };
    exports2.FTPError = FTPError;
    function doNothing() {
    }
    var FTPContext = class {
      /**
       * Instantiate an FTP context.
       *
       * @param timeout - Timeout in milliseconds to apply to control and data connections. Use 0 for no timeout.
       * @param encoding - Encoding to use for control connection. UTF-8 by default. Use "latin1" for older servers.
       */
      constructor(timeout = 0, encoding = "utf8") {
        this.timeout = timeout;
        this.verbose = false;
        this.ipFamily = void 0;
        this.tlsOptions = {};
        this._partialResponse = "";
        this._encoding = encoding;
        this._socket = this.socket = this._newSocket();
        this._dataSocket = void 0;
      }
      /**
       * Close the context.
       */
      close() {
        const message = this._task ? "User closed client during task" : "User closed client";
        const err2 = new Error(message);
        this.closeWithError(err2);
      }
      /**
       * Close the context with an error.
       */
      closeWithError(err2) {
        if (this._closingError) {
          return;
        }
        this._closingError = err2;
        this._closeControlSocket();
        this._closeSocket(this._dataSocket);
        this._passToHandler(err2);
        this._stopTrackingTask();
      }
      /**
       * Returns true if this context has been closed or hasn't been connected yet. You can reopen it with `access`.
       */
      get closed() {
        return this.socket.remoteAddress === void 0 || this._closingError !== void 0;
      }
      /**
       * Reset this contex and all of its state.
       */
      reset() {
        this.socket = this._newSocket();
      }
      /**
       * Get the FTP control socket.
       */
      get socket() {
        return this._socket;
      }
      /**
       * Set the socket for the control connection. This will only close the current control socket
       * if the new one is not an upgrade to the current one.
       */
      set socket(socket) {
        this.dataSocket = void 0;
        this.tlsOptions = {};
        this._partialResponse = "";
        if (this._socket) {
          const newSocketUpgradesExisting = socket.localPort === this._socket.localPort;
          if (newSocketUpgradesExisting) {
            this._removeSocketListeners(this.socket);
          } else {
            this._closeControlSocket();
          }
        }
        if (socket) {
          this._closingError = void 0;
          socket.setTimeout(0);
          socket.setEncoding(this._encoding);
          socket.setKeepAlive(true);
          socket.on("data", (data) => this._onControlSocketData(data));
          socket.on("end", () => this.closeWithError(new Error("Server sent FIN packet unexpectedly, closing connection.")));
          socket.on("close", (hadError) => {
            if (!hadError)
              this.closeWithError(new Error("Server closed connection unexpectedly."));
          });
          this._setupDefaultErrorHandlers(socket, "control socket");
        }
        this._socket = socket;
      }
      /**
       * Get the current FTP data connection if present.
       */
      get dataSocket() {
        return this._dataSocket;
      }
      /**
       * Set the socket for the data connection. This will automatically close the former data socket.
       */
      set dataSocket(socket) {
        this._closeSocket(this._dataSocket);
        if (socket) {
          socket.setTimeout(0);
          this._setupDefaultErrorHandlers(socket, "data socket");
        }
        this._dataSocket = socket;
      }
      /**
       * Get the currently used encoding.
       */
      get encoding() {
        return this._encoding;
      }
      /**
       * Set the encoding used for the control socket.
       *
       * See https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings for what encodings
       * are supported by Node.
       */
      set encoding(encoding) {
        this._encoding = encoding;
        if (this.socket) {
          this.socket.setEncoding(encoding);
        }
      }
      /**
       * Send an FTP command without waiting for or handling the result.
       */
      send(command) {
        const containsPassword = command.startsWith("PASS");
        const message = containsPassword ? "> PASS ###" : `> ${command}`;
        this.log(message);
        this._socket.write(command + "\r\n", this.encoding);
      }
      /**
       * Send an FTP command and handle the first response. Use this if you have a simple
       * request-response situation.
       */
      request(command) {
        return this.handle(command, (res2, task) => {
          if (res2 instanceof Error) {
            task.reject(res2);
          } else {
            task.resolve(res2);
          }
        });
      }
      /**
       * Send an FTP command and handle any response until you resolve/reject. Use this if you expect multiple responses
       * to a request. This returns a Promise that will hold whatever the response handler passed on when resolving/rejecting its task.
       */
      handle(command, responseHandler) {
        if (this._task) {
          const err2 = new Error("User launched a task while another one is still running. Forgot to use 'await' or '.then()'?");
          err2.stack += `
Running task launched at: ${this._task.stack}`;
          this.closeWithError(err2);
        }
        return new Promise((resolveTask, rejectTask) => {
          this._task = {
            stack: new Error().stack || "Unknown call stack",
            responseHandler,
            resolver: {
              resolve: (arg) => {
                this._stopTrackingTask();
                resolveTask(arg);
              },
              reject: (err2) => {
                this._stopTrackingTask();
                rejectTask(err2);
              }
            }
          };
          if (this._closingError) {
            const err2 = new Error(`Client is closed because ${this._closingError.message}`);
            err2.stack += `
Closing reason: ${this._closingError.stack}`;
            err2.code = this._closingError.code !== void 0 ? this._closingError.code : "0";
            this._passToHandler(err2);
            return;
          }
          this.socket.setTimeout(this.timeout);
          if (command) {
            this.send(command);
          }
        });
      }
      /**
       * Log message if set to be verbose.
       */
      log(message) {
        if (this.verbose) {
          console.log(message);
        }
      }
      /**
       * Return true if the control socket is using TLS. This does not mean that a session
       * has already been negotiated.
       */
      get hasTLS() {
        return "encrypted" in this._socket;
      }
      /**
       * Removes reference to current task and handler. This won't resolve or reject the task.
       * @protected
       */
      _stopTrackingTask() {
        this.socket.setTimeout(0);
        this._task = void 0;
      }
      /**
       * Handle incoming data on the control socket. The chunk is going to be of type `string`
       * because we let `socket` handle encoding with `setEncoding`.
       * @protected
       */
      _onControlSocketData(chunk) {
        this.log(`< ${chunk}`);
        const completeResponse = this._partialResponse + chunk;
        const parsed = (0, parseControlResponse_1.parseControlResponse)(completeResponse);
        this._partialResponse = parsed.rest;
        for (const message of parsed.messages) {
          const code = parseInt(message.substr(0, 3), 10);
          const response = { code, message };
          const err2 = code >= 400 ? new FTPError(response) : void 0;
          this._passToHandler(err2 ? err2 : response);
        }
      }
      /**
       * Send the current handler a response. This is usually a control socket response
       * or a socket event, like an error or timeout.
       * @protected
       */
      _passToHandler(response) {
        if (this._task) {
          this._task.responseHandler(response, this._task.resolver);
        }
      }
      /**
       * Setup all error handlers for a socket.
       * @protected
       */
      _setupDefaultErrorHandlers(socket, identifier) {
        socket.once("error", (error2) => {
          error2.message += ` (${identifier})`;
          this.closeWithError(error2);
        });
        socket.once("close", (hadError) => {
          if (hadError) {
            this.closeWithError(new Error(`Socket closed due to transmission error (${identifier})`));
          }
        });
        socket.once("timeout", () => {
          socket.destroy();
          this.closeWithError(new Error(`Timeout (${identifier})`));
        });
      }
      /**
       * Close the control socket. Sends QUIT, then FIN, and ignores any response or error.
       */
      _closeControlSocket() {
        this._removeSocketListeners(this._socket);
        this._socket.on("error", doNothing);
        this.send("QUIT");
        this._closeSocket(this._socket);
      }
      /**
       * Close a socket, ignores any error.
       * @protected
       */
      _closeSocket(socket) {
        if (socket) {
          this._removeSocketListeners(socket);
          socket.on("error", doNothing);
          socket.destroy();
        }
      }
      /**
       * Remove all default listeners for socket.
       * @protected
       */
      _removeSocketListeners(socket) {
        socket.removeAllListeners();
        socket.removeAllListeners("timeout");
        socket.removeAllListeners("data");
        socket.removeAllListeners("end");
        socket.removeAllListeners("error");
        socket.removeAllListeners("close");
        socket.removeAllListeners("connect");
      }
      /**
       * Provide a new socket instance.
       *
       * Internal use only, replaced for unit tests.
       */
      _newSocket() {
        return new net_1.Socket();
      }
    };
    exports2.FTPContext = FTPContext;
  }
});

// node_modules/basic-ftp/dist/FileInfo.js
var require_FileInfo = __commonJS({
  "node_modules/basic-ftp/dist/FileInfo.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.FileInfo = exports2.FileType = void 0;
    var FileType;
    (function(FileType2) {
      FileType2[FileType2["Unknown"] = 0] = "Unknown";
      FileType2[FileType2["File"] = 1] = "File";
      FileType2[FileType2["Directory"] = 2] = "Directory";
      FileType2[FileType2["SymbolicLink"] = 3] = "SymbolicLink";
    })(FileType || (exports2.FileType = FileType = {}));
    var FileInfo = class {
      constructor(name) {
        this.name = name;
        this.type = FileType.Unknown;
        this.size = 0;
        this.rawModifiedAt = "";
        this.modifiedAt = void 0;
        this.permissions = void 0;
        this.hardLinkCount = void 0;
        this.link = void 0;
        this.group = void 0;
        this.user = void 0;
        this.uniqueID = void 0;
        this.name = name;
      }
      get isDirectory() {
        return this.type === FileType.Directory;
      }
      get isSymbolicLink() {
        return this.type === FileType.SymbolicLink;
      }
      get isFile() {
        return this.type === FileType.File;
      }
      /**
       * Deprecated, legacy API. Use `rawModifiedAt` instead.
       * @deprecated
       */
      get date() {
        return this.rawModifiedAt;
      }
      set date(rawModifiedAt) {
        this.rawModifiedAt = rawModifiedAt;
      }
    };
    exports2.FileInfo = FileInfo;
    FileInfo.UnixPermission = {
      Read: 4,
      Write: 2,
      Execute: 1
    };
  }
});

// node_modules/basic-ftp/dist/parseListDOS.js
var require_parseListDOS = __commonJS({
  "node_modules/basic-ftp/dist/parseListDOS.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.testLine = testLine;
    exports2.parseLine = parseLine;
    exports2.transformList = transformList;
    var FileInfo_1 = require_FileInfo();
    var RE_LINE = new RegExp(
      "(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)"
      // First non-space followed by rest of line (name)
    );
    function testLine(line) {
      return /^\d{2}/.test(line) && RE_LINE.test(line);
    }
    function parseLine(line) {
      const groups = line.match(RE_LINE);
      if (groups === null) {
        return void 0;
      }
      const name = groups[5];
      if (name === "." || name === "..") {
        return void 0;
      }
      const file = new FileInfo_1.FileInfo(name);
      const fileType = groups[3];
      if (fileType === "<DIR>") {
        file.type = FileInfo_1.FileType.Directory;
        file.size = 0;
      } else {
        file.type = FileInfo_1.FileType.File;
        file.size = parseInt(groups[4], 10);
      }
      file.rawModifiedAt = groups[1] + " " + groups[2];
      return file;
    }
    function transformList(files) {
      return files;
    }
  }
});

// node_modules/basic-ftp/dist/parseListUnix.js
var require_parseListUnix = __commonJS({
  "node_modules/basic-ftp/dist/parseListUnix.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.testLine = testLine;
    exports2.parseLine = parseLine;
    exports2.transformList = transformList;
    var FileInfo_1 = require_FileInfo();
    var JA_MONTH = "\u6708";
    var JA_DAY = "\u65E5";
    var JA_YEAR = "\u5E74";
    var RE_LINE = new RegExp("([bcdelfmpSs-])(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]?)))\\+?\\s*(\\d+)\\s+(?:(\\S+(?:\\s\\S+)*?)\\s+)?(?:(\\S+(?:\\s\\S+)*)\\s+)?(\\d+(?:,\\s*\\d+)?)\\s+((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S{3}\\s+\\d{1,2})|(?:\\d{1,2}\\s+\\S{3})|(?:\\d{1,2}" + JA_MONTH + "\\s+\\d{1,2}" + JA_DAY + "))\\s+((?:\\d+(?::\\d+)?)|(?:\\d{4}" + JA_YEAR + "))\\s(.*)");
    function testLine(line) {
      return RE_LINE.test(line);
    }
    function parseLine(line) {
      const groups = line.match(RE_LINE);
      if (groups === null) {
        return void 0;
      }
      const name = groups[21];
      if (name === "." || name === "..") {
        return void 0;
      }
      const file = new FileInfo_1.FileInfo(name);
      file.size = parseInt(groups[18], 10);
      file.user = groups[16];
      file.group = groups[17];
      file.hardLinkCount = parseInt(groups[15], 10);
      file.rawModifiedAt = groups[19] + " " + groups[20];
      file.permissions = {
        user: parseMode(groups[4], groups[5], groups[6]),
        group: parseMode(groups[8], groups[9], groups[10]),
        world: parseMode(groups[12], groups[13], groups[14])
      };
      switch (groups[1].charAt(0)) {
        case "d":
          file.type = FileInfo_1.FileType.Directory;
          break;
        case "e":
          file.type = FileInfo_1.FileType.SymbolicLink;
          break;
        case "l":
          file.type = FileInfo_1.FileType.SymbolicLink;
          break;
        case "b":
        case "c":
          file.type = FileInfo_1.FileType.File;
          break;
        case "f":
        case "-":
          file.type = FileInfo_1.FileType.File;
          break;
        default:
          file.type = FileInfo_1.FileType.Unknown;
      }
      if (file.isSymbolicLink) {
        const end = name.indexOf(" -> ");
        if (end !== -1) {
          file.name = name.substring(0, end);
          file.link = name.substring(end + 4);
        }
      }
      return file;
    }
    function transformList(files) {
      return files;
    }
    function parseMode(r, w2, x) {
      let value2 = 0;
      if (r !== "-") {
        value2 += FileInfo_1.FileInfo.UnixPermission.Read;
      }
      if (w2 !== "-") {
        value2 += FileInfo_1.FileInfo.UnixPermission.Write;
      }
      const execToken = x.charAt(0);
      if (execToken !== "-" && execToken.toUpperCase() !== execToken) {
        value2 += FileInfo_1.FileInfo.UnixPermission.Execute;
      }
      return value2;
    }
  }
});

// node_modules/basic-ftp/dist/parseListMLSD.js
var require_parseListMLSD = __commonJS({
  "node_modules/basic-ftp/dist/parseListMLSD.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.testLine = testLine;
    exports2.parseLine = parseLine;
    exports2.transformList = transformList;
    exports2.parseMLSxDate = parseMLSxDate;
    var FileInfo_1 = require_FileInfo();
    function parseSize(value2, info3) {
      info3.size = parseInt(value2, 10);
    }
    var factHandlersByName = {
      "size": parseSize,
      // File size
      "sizd": parseSize,
      // Directory size
      "unique": (value2, info3) => {
        info3.uniqueID = value2;
      },
      "modify": (value2, info3) => {
        info3.modifiedAt = parseMLSxDate(value2);
        info3.rawModifiedAt = info3.modifiedAt.toISOString();
      },
      "type": (value2, info3) => {
        if (value2.startsWith("OS.unix=slink")) {
          info3.type = FileInfo_1.FileType.SymbolicLink;
          info3.link = value2.substr(value2.indexOf(":") + 1);
          return 1;
        }
        switch (value2) {
          case "file":
            info3.type = FileInfo_1.FileType.File;
            break;
          case "dir":
            info3.type = FileInfo_1.FileType.Directory;
            break;
          case "OS.unix=symlink":
            info3.type = FileInfo_1.FileType.SymbolicLink;
            break;
          case "cdir":
          // Current directory being listed
          case "pdir":
            return 2;
          // Don't include these entries in the listing
          default:
            info3.type = FileInfo_1.FileType.Unknown;
        }
        return 1;
      },
      "unix.mode": (value2, info3) => {
        const digits = value2.substr(-3);
        info3.permissions = {
          user: parseInt(digits[0], 10),
          group: parseInt(digits[1], 10),
          world: parseInt(digits[2], 10)
        };
      },
      "unix.ownername": (value2, info3) => {
        info3.user = value2;
      },
      "unix.owner": (value2, info3) => {
        if (info3.user === void 0)
          info3.user = value2;
      },
      get "unix.uid"() {
        return this["unix.owner"];
      },
      "unix.groupname": (value2, info3) => {
        info3.group = value2;
      },
      "unix.group": (value2, info3) => {
        if (info3.group === void 0)
          info3.group = value2;
      },
      get "unix.gid"() {
        return this["unix.group"];
      }
      // Regarding the fact "perm":
      // We don't handle permission information stored in "perm" because its information is conceptually
      // different from what users of FTP clients usually associate with "permissions". Those that have
      // some expectations (and probably want to edit them with a SITE command) often unknowingly expect
      // the Unix permission system. The information passed by "perm" describes what FTP commands can be
      // executed with a file/directory. But even this can be either incomplete or just meant as a "guide"
      // as the spec mentions. From https://tools.ietf.org/html/rfc3659#section-7.5.5: "The permissions are
      // described here as they apply to FTP commands. They may not map easily into particular permissions
      // available on the server's operating system." The parser by Apache Commons tries to translate these
      // to Unix permissions – this is misleading users and might not even be correct.
    };
    function splitStringOnce(str, delimiter2) {
      const pos2 = str.indexOf(delimiter2);
      const a = str.substr(0, pos2);
      const b = str.substr(pos2 + delimiter2.length);
      return [a, b];
    }
    function testLine(line) {
      return /^\S+=\S+;/.test(line) || line.startsWith(" ");
    }
    function parseLine(line) {
      const [packedFacts, name] = splitStringOnce(line, " ");
      if (name === "" || name === "." || name === "..") {
        return void 0;
      }
      const info3 = new FileInfo_1.FileInfo(name);
      const facts = packedFacts.split(";");
      for (const fact of facts) {
        const [factName, factValue] = splitStringOnce(fact, "=");
        if (!factValue) {
          continue;
        }
        const factHandler = factHandlersByName[factName.toLowerCase()];
        if (!factHandler) {
          continue;
        }
        const result = factHandler(factValue, info3);
        if (result === 2) {
          return void 0;
        }
      }
      return info3;
    }
    function transformList(files) {
      const nonLinksByID = /* @__PURE__ */ new Map();
      for (const file of files) {
        if (!file.isSymbolicLink && file.uniqueID !== void 0) {
          nonLinksByID.set(file.uniqueID, file);
        }
      }
      const resolvedFiles = [];
      for (const file of files) {
        if (file.isSymbolicLink && file.uniqueID !== void 0 && file.link === void 0) {
          const target = nonLinksByID.get(file.uniqueID);
          if (target !== void 0) {
            file.link = target.name;
          }
        }
        const isPartOfDirectory = !file.name.includes("/");
        if (isPartOfDirectory) {
          resolvedFiles.push(file);
        }
      }
      return resolvedFiles;
    }
    function parseMLSxDate(fact) {
      return new Date(Date.UTC(
        +fact.slice(0, 4),
        // Year
        +fact.slice(4, 6) - 1,
        // Month
        +fact.slice(6, 8),
        // Date
        +fact.slice(8, 10),
        // Hours
        +fact.slice(10, 12),
        // Minutes
        +fact.slice(12, 14),
        // Seconds
        +fact.slice(15, 18)
        // Milliseconds
      ));
    }
  }
});

// node_modules/basic-ftp/dist/parseList.js
var require_parseList = __commonJS({
  "node_modules/basic-ftp/dist/parseList.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m2, k);
      if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m2[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    } : function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m2[k];
    });
    var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.parseList = parseList;
    var dosParser = __importStar(require_parseListDOS());
    var unixParser = __importStar(require_parseListUnix());
    var mlsdParser = __importStar(require_parseListMLSD());
    var availableParsers = [
      dosParser,
      unixParser,
      mlsdParser
      // Keep MLSD last, may accept filename only
    ];
    function firstCompatibleParser(line, parsers) {
      return parsers.find((parser2) => parser2.testLine(line) === true);
    }
    function isNotBlank(str) {
      return str.trim() !== "";
    }
    function isNotMeta(str) {
      return !str.startsWith("total");
    }
    var REGEX_NEWLINE = /\r?\n/;
    function parseList(rawList) {
      const lines = rawList.split(REGEX_NEWLINE).filter(isNotBlank).filter(isNotMeta);
      if (lines.length === 0) {
        return [];
      }
      const testLine = lines[lines.length - 1];
      const parser2 = firstCompatibleParser(testLine, availableParsers);
      if (!parser2) {
        throw new Error("This library only supports MLSD, Unix- or DOS-style directory listing. Your FTP server seems to be using another format. You can see the transmitted listing when setting `client.ftp.verbose = true`. You can then provide a custom parser to `client.parseList`, see the documentation for details.");
      }
      const files = lines.map(parser2.parseLine).filter((info3) => info3 !== void 0);
      return parser2.transformList(files);
    }
  }
});

// node_modules/basic-ftp/dist/ProgressTracker.js
var require_ProgressTracker = __commonJS({
  "node_modules/basic-ftp/dist/ProgressTracker.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ProgressTracker = void 0;
    var ProgressTracker = class {
      constructor() {
        this.bytesOverall = 0;
        this.intervalMs = 500;
        this.onStop = noop3;
        this.onHandle = noop3;
      }
      /**
       * Register a new handler for progress info. Use `undefined` to disable reporting.
       */
      reportTo(onHandle = noop3) {
        this.onHandle = onHandle;
      }
      /**
       * Start tracking transfer progress of a socket.
       *
       * @param socket  The socket to observe.
       * @param name  A name associated with this progress tracking, e.g. a filename.
       * @param type  The type of the transfer, typically "upload" or "download".
       */
      start(socket, name, type) {
        let lastBytes = 0;
        this.onStop = poll(this.intervalMs, () => {
          const bytes = socket.bytesRead + socket.bytesWritten;
          this.bytesOverall += bytes - lastBytes;
          lastBytes = bytes;
          this.onHandle({
            name,
            type,
            bytes,
            bytesOverall: this.bytesOverall
          });
        });
      }
      /**
       * Stop tracking transfer progress.
       */
      stop() {
        this.onStop(false);
      }
      /**
       * Call the progress handler one more time, then stop tracking.
       */
      updateAndStop() {
        this.onStop(true);
      }
    };
    exports2.ProgressTracker = ProgressTracker;
    function poll(intervalMs, updateFunc) {
      const id = setInterval(updateFunc, intervalMs);
      const stopFunc = (stopWithUpdate) => {
        clearInterval(id);
        if (stopWithUpdate) {
          updateFunc();
        }
        updateFunc = noop3;
      };
      updateFunc();
      return stopFunc;
    }
    function noop3() {
    }
  }
});

// node_modules/basic-ftp/dist/StringWriter.js
var require_StringWriter = __commonJS({
  "node_modules/basic-ftp/dist/StringWriter.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.StringWriter = void 0;
    var stream_1 = require("stream");
    var StringWriter = class extends stream_1.Writable {
      constructor() {
        super(...arguments);
        this.buf = Buffer.alloc(0);
      }
      _write(chunk, _, callback) {
        if (chunk instanceof Buffer) {
          this.buf = Buffer.concat([this.buf, chunk]);
          callback(null);
        } else {
          callback(new Error("StringWriter expects chunks of type 'Buffer'."));
        }
      }
      getText(encoding) {
        return this.buf.toString(encoding);
      }
    };
    exports2.StringWriter = StringWriter;
  }
});

// node_modules/basic-ftp/dist/netUtils.js
var require_netUtils = __commonJS({
  "node_modules/basic-ftp/dist/netUtils.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.describeTLS = describeTLS;
    exports2.describeAddress = describeAddress;
    exports2.upgradeSocket = upgradeSocket;
    exports2.ipIsPrivateV4Address = ipIsPrivateV4Address;
    var tls_1 = require("tls");
    function describeTLS(socket) {
      if (socket instanceof tls_1.TLSSocket) {
        const protocol = socket.getProtocol();
        return protocol ? protocol : "Server socket or disconnected client socket";
      }
      return "No encryption";
    }
    function describeAddress(socket) {
      if (socket.remoteFamily === "IPv6") {
        return `[${socket.remoteAddress}]:${socket.remotePort}`;
      }
      return `${socket.remoteAddress}:${socket.remotePort}`;
    }
    function upgradeSocket(socket, options) {
      return new Promise((resolve, reject) => {
        const tlsOptions = Object.assign({}, options, {
          socket
        });
        const tlsSocket = (0, tls_1.connect)(tlsOptions, () => {
          const expectCertificate = tlsOptions.rejectUnauthorized !== false;
          if (expectCertificate && !tlsSocket.authorized) {
            reject(tlsSocket.authorizationError);
          } else {
            tlsSocket.removeAllListeners("error");
            resolve(tlsSocket);
          }
        }).once("error", (error2) => {
          reject(error2);
        });
      });
    }
    function ipIsPrivateV4Address(ip = "") {
      if (ip.startsWith("::ffff:")) {
        ip = ip.substr(7);
      }
      const octets = ip.split(".").map((o) => parseInt(o, 10));
      return octets[0] === 10 || octets[0] === 172 && octets[1] >= 16 && octets[1] <= 31 || octets[0] === 192 && octets[1] === 168 || ip === "127.0.0.1";
    }
  }
});

// node_modules/basic-ftp/dist/transfer.js
var require_transfer = __commonJS({
  "node_modules/basic-ftp/dist/transfer.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.enterPassiveModeIPv6 = enterPassiveModeIPv6;
    exports2.parseEpsvResponse = parseEpsvResponse;
    exports2.enterPassiveModeIPv4 = enterPassiveModeIPv4;
    exports2.enterPassiveModeIPv4_forceControlHostIP = enterPassiveModeIPv4_forceControlHostIP;
    exports2.parsePasvResponse = parsePasvResponse;
    exports2.connectForPassiveTransfer = connectForPassiveTransfer;
    exports2.uploadFrom = uploadFrom;
    exports2.downloadTo = downloadTo;
    var netUtils_1 = require_netUtils();
    var stream_1 = require("stream");
    var tls_1 = require("tls");
    var parseControlResponse_1 = require_parseControlResponse();
    async function enterPassiveModeIPv6(ftp2) {
      const res2 = await ftp2.request("EPSV");
      const port = parseEpsvResponse(res2.message);
      if (!port) {
        throw new Error("Can't parse EPSV response: " + res2.message);
      }
      const controlHost = ftp2.socket.remoteAddress;
      if (controlHost === void 0) {
        throw new Error("Control socket is disconnected, can't get remote address.");
      }
      await connectForPassiveTransfer(controlHost, port, ftp2);
      return res2;
    }
    function parseEpsvResponse(message) {
      const groups = message.match(/[|!]{3}(.+)[|!]/);
      if (groups === null || groups[1] === void 0) {
        throw new Error(`Can't parse response to 'EPSV': ${message}`);
      }
      const port = parseInt(groups[1], 10);
      if (Number.isNaN(port)) {
        throw new Error(`Can't parse response to 'EPSV', port is not a number: ${message}`);
      }
      return port;
    }
    async function enterPassiveModeIPv4(ftp2) {
      const res2 = await ftp2.request("PASV");
      const target = parsePasvResponse(res2.message);
      if (!target) {
        throw new Error("Can't parse PASV response: " + res2.message);
      }
      const controlHost = ftp2.socket.remoteAddress;
      if ((0, netUtils_1.ipIsPrivateV4Address)(target.host) && controlHost && !(0, netUtils_1.ipIsPrivateV4Address)(controlHost)) {
        target.host = controlHost;
      }
      await connectForPassiveTransfer(target.host, target.port, ftp2);
      return res2;
    }
    async function enterPassiveModeIPv4_forceControlHostIP(ftp2) {
      const res2 = await ftp2.request("PASV");
      const target = parsePasvResponse(res2.message);
      if (!target) {
        throw new Error("Can't parse PASV response: " + res2.message);
      }
      const controlHost = ftp2.socket.remoteAddress;
      if (controlHost === void 0) {
        throw new Error("Control socket is disconnected, can't get remote address.");
      }
      await connectForPassiveTransfer(controlHost, target.port, ftp2);
      return res2;
    }
    function parsePasvResponse(message) {
      const groups = message.match(/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
      if (groups === null || groups.length !== 4) {
        throw new Error(`Can't parse response to 'PASV': ${message}`);
      }
      return {
        host: groups[1].replace(/,/g, "."),
        port: (parseInt(groups[2], 10) & 255) * 256 + (parseInt(groups[3], 10) & 255)
      };
    }
    function connectForPassiveTransfer(host, port, ftp2) {
      return new Promise((resolve, reject) => {
        let socket = ftp2._newSocket();
        const handleConnErr = function(err2) {
          err2.message = "Can't open data connection in passive mode: " + err2.message;
          reject(err2);
        };
        const handleTimeout = function() {
          socket.destroy();
          reject(new Error(`Timeout when trying to open data connection to ${host}:${port}`));
        };
        socket.setTimeout(ftp2.timeout);
        socket.on("error", handleConnErr);
        socket.on("timeout", handleTimeout);
        socket.connect({ port, host, family: ftp2.ipFamily }, () => {
          if (ftp2.socket instanceof tls_1.TLSSocket) {
            socket = (0, tls_1.connect)(Object.assign({}, ftp2.tlsOptions, {
              socket,
              // Reuse the TLS session negotiated earlier when the control connection
              // was upgraded. Servers expect this because it provides additional
              // security: If a completely new session would be negotiated, a hacker
              // could guess the port and connect to the new data connection before we do
              // by just starting his/her own TLS session.
              session: ftp2.socket.getSession()
            }));
          }
          socket.removeListener("error", handleConnErr);
          socket.removeListener("timeout", handleTimeout);
          ftp2.dataSocket = socket;
          resolve();
        });
      });
    }
    var TransferResolver = class {
      /**
       * Instantiate a TransferResolver
       */
      constructor(ftp2, progress) {
        this.ftp = ftp2;
        this.progress = progress;
        this.response = void 0;
        this.dataTransferDone = false;
      }
      /**
       * Mark the beginning of a transfer.
       *
       * @param name - Name of the transfer, usually the filename.
       * @param type - Type of transfer, usually "upload" or "download".
       */
      onDataStart(name, type) {
        if (this.ftp.dataSocket === void 0) {
          throw new Error("Data transfer should start but there is no data connection.");
        }
        this.ftp.socket.setTimeout(0);
        this.ftp.dataSocket.setTimeout(this.ftp.timeout);
        this.progress.start(this.ftp.dataSocket, name, type);
      }
      /**
       * The data connection has finished the transfer.
       */
      onDataDone(task) {
        this.progress.updateAndStop();
        this.ftp.socket.setTimeout(this.ftp.timeout);
        if (this.ftp.dataSocket) {
          this.ftp.dataSocket.setTimeout(0);
        }
        this.dataTransferDone = true;
        this.tryResolve(task);
      }
      /**
       * The control connection reports the transfer as finished.
       */
      onControlDone(task, response) {
        this.response = response;
        this.tryResolve(task);
      }
      /**
       * An error has been reported and the task should be rejected.
       */
      onError(task, err2) {
        this.progress.updateAndStop();
        this.ftp.socket.setTimeout(this.ftp.timeout);
        this.ftp.dataSocket = void 0;
        task.reject(err2);
      }
      /**
       * Control connection sent an unexpected request requiring a response from our part. We
       * can't provide that (because unknown) and have to close the contrext with an error because
       * the FTP server is now caught up in a state we can't resolve.
       */
      onUnexpectedRequest(response) {
        const err2 = new Error(`Unexpected FTP response is requesting an answer: ${response.message}`);
        this.ftp.closeWithError(err2);
      }
      tryResolve(task) {
        const canResolve = this.dataTransferDone && this.response !== void 0;
        if (canResolve) {
          this.ftp.dataSocket = void 0;
          task.resolve(this.response);
        }
      }
    };
    function uploadFrom(source2, config) {
      const resolver = new TransferResolver(config.ftp, config.tracker);
      const fullCommand = `${config.command} ${config.remotePath}`;
      return config.ftp.handle(fullCommand, (res2, task) => {
        if (res2 instanceof Error) {
          resolver.onError(task, res2);
        } else if (res2.code === 150 || res2.code === 125) {
          const dataSocket = config.ftp.dataSocket;
          if (!dataSocket) {
            resolver.onError(task, new Error("Upload should begin but no data connection is available."));
            return;
          }
          const canUpload = "getCipher" in dataSocket ? dataSocket.getCipher() !== void 0 : true;
          onConditionOrEvent(canUpload, dataSocket, "secureConnect", () => {
            config.ftp.log(`Uploading to ${(0, netUtils_1.describeAddress)(dataSocket)} (${(0, netUtils_1.describeTLS)(dataSocket)})`);
            resolver.onDataStart(config.remotePath, config.type);
            (0, stream_1.pipeline)(source2, dataSocket, (err2) => {
              if (err2) {
                resolver.onError(task, err2);
              } else {
                resolver.onDataDone(task);
              }
            });
          });
        } else if ((0, parseControlResponse_1.positiveCompletion)(res2.code)) {
          resolver.onControlDone(task, res2);
        } else if ((0, parseControlResponse_1.positiveIntermediate)(res2.code)) {
          resolver.onUnexpectedRequest(res2);
        }
      });
    }
    function downloadTo(destination, config) {
      if (!config.ftp.dataSocket) {
        throw new Error("Download will be initiated but no data connection is available.");
      }
      const resolver = new TransferResolver(config.ftp, config.tracker);
      return config.ftp.handle(config.command, (res2, task) => {
        if (res2 instanceof Error) {
          resolver.onError(task, res2);
        } else if (res2.code === 150 || res2.code === 125) {
          const dataSocket = config.ftp.dataSocket;
          if (!dataSocket) {
            resolver.onError(task, new Error("Download should begin but no data connection is available."));
            return;
          }
          config.ftp.log(`Downloading from ${(0, netUtils_1.describeAddress)(dataSocket)} (${(0, netUtils_1.describeTLS)(dataSocket)})`);
          resolver.onDataStart(config.remotePath, config.type);
          (0, stream_1.pipeline)(dataSocket, destination, (err2) => {
            if (err2) {
              resolver.onError(task, err2);
            } else {
              resolver.onDataDone(task);
            }
          });
        } else if (res2.code === 350) {
          config.ftp.send("RETR " + config.remotePath);
        } else if ((0, parseControlResponse_1.positiveCompletion)(res2.code)) {
          resolver.onControlDone(task, res2);
        } else if ((0, parseControlResponse_1.positiveIntermediate)(res2.code)) {
          resolver.onUnexpectedRequest(res2);
        }
      });
    }
    function onConditionOrEvent(condition, emitter, eventName, action2) {
      if (condition === true) {
        action2();
      } else {
        emitter.once(eventName, () => action2());
      }
    }
  }
});

// node_modules/basic-ftp/dist/Client.js
var require_Client = __commonJS({
  "node_modules/basic-ftp/dist/Client.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.Client = void 0;
    var fs_1 = require("fs");
    var path_1 = require("path");
    var tls_1 = require("tls");
    var util_1 = require("util");
    var FtpContext_1 = require_FtpContext();
    var parseList_1 = require_parseList();
    var ProgressTracker_1 = require_ProgressTracker();
    var StringWriter_1 = require_StringWriter();
    var parseListMLSD_1 = require_parseListMLSD();
    var netUtils_1 = require_netUtils();
    var transfer_1 = require_transfer();
    var parseControlResponse_1 = require_parseControlResponse();
    var fsReadDir = (0, util_1.promisify)(fs_1.readdir);
    var fsMkDir = (0, util_1.promisify)(fs_1.mkdir);
    var fsStat = (0, util_1.promisify)(fs_1.stat);
    var fsOpen = (0, util_1.promisify)(fs_1.open);
    var fsClose = (0, util_1.promisify)(fs_1.close);
    var fsUnlink = (0, util_1.promisify)(fs_1.unlink);
    var defaultClientOptions = {
      allowSeparateTransferHost: true
    };
    var LIST_COMMANDS_DEFAULT = () => ["LIST -a", "LIST"];
    var LIST_COMMANDS_MLSD = () => ["MLSD", "LIST -a", "LIST"];
    var Client2 = class {
      /**
       * Instantiate an FTP client.
       *
       * @param timeout  Timeout in milliseconds, use 0 for no timeout. Optional, default is 30 seconds.
       */
      constructor(timeout = 3e4, options = defaultClientOptions) {
        this.availableListCommands = LIST_COMMANDS_DEFAULT();
        this.ftp = new FtpContext_1.FTPContext(timeout);
        this.prepareTransfer = this._enterFirstCompatibleMode([
          transfer_1.enterPassiveModeIPv6,
          options.allowSeparateTransferHost ? transfer_1.enterPassiveModeIPv4 : transfer_1.enterPassiveModeIPv4_forceControlHostIP
        ]);
        this.parseList = parseList_1.parseList;
        this._progressTracker = new ProgressTracker_1.ProgressTracker();
      }
      /**
       * Close the client and all open socket connections.
       *
       * Close the client and all open socket connections. The client can’t be used anymore after calling this method,
       * you have to either reconnect with `access` or `connect` or instantiate a new instance to continue any work.
       * A client is also closed automatically if any timeout or connection error occurs.
       */
      close() {
        this.ftp.close();
        this._progressTracker.stop();
      }
      /**
       * Returns true if the client is closed and can't be used anymore.
       */
      get closed() {
        return this.ftp.closed;
      }
      /**
       * Connect (or reconnect) to an FTP server.
       *
       * This is an instance method and thus can be called multiple times during the lifecycle of a `Client`
       * instance. Whenever you do, the client is reset with a new control connection. This also implies that
       * you can reopen a `Client` instance that has been closed due to an error when reconnecting with this
       * method. In fact, reconnecting is the only way to continue using a closed `Client`.
       *
       * @param host  Host the client should connect to. Optional, default is "localhost".
       * @param port  Port the client should connect to. Optional, default is 21.
       */
      connect(host = "localhost", port = 21) {
        this.ftp.reset();
        this.ftp.socket.connect({
          host,
          port,
          family: this.ftp.ipFamily
        }, () => this.ftp.log(`Connected to ${(0, netUtils_1.describeAddress)(this.ftp.socket)} (${(0, netUtils_1.describeTLS)(this.ftp.socket)})`));
        return this._handleConnectResponse();
      }
      /**
       * As `connect` but using implicit TLS. Implicit TLS is not an FTP standard and has been replaced by
       * explicit TLS. There are still FTP servers that support only implicit TLS, though.
       */
      connectImplicitTLS(host = "localhost", port = 21, tlsOptions = {}) {
        this.ftp.reset();
        this.ftp.socket = (0, tls_1.connect)(port, host, tlsOptions, () => this.ftp.log(`Connected to ${(0, netUtils_1.describeAddress)(this.ftp.socket)} (${(0, netUtils_1.describeTLS)(this.ftp.socket)})`));
        this.ftp.tlsOptions = tlsOptions;
        return this._handleConnectResponse();
      }
      /**
       * Handles the first reponse by an FTP server after the socket connection has been established.
       */
      _handleConnectResponse() {
        return this.ftp.handle(void 0, (res2, task) => {
          if (res2 instanceof Error) {
            task.reject(res2);
          } else if ((0, parseControlResponse_1.positiveCompletion)(res2.code)) {
            task.resolve(res2);
          } else {
            task.reject(new FtpContext_1.FTPError(res2));
          }
        });
      }
      /**
       * Send an FTP command and handle the first response.
       */
      send(command, ignoreErrorCodesDEPRECATED = false) {
        if (ignoreErrorCodesDEPRECATED) {
          this.ftp.log("Deprecated call using send(command, flag) with boolean flag to ignore errors. Use sendIgnoringError(command).");
          return this.sendIgnoringError(command);
        }
        return this.ftp.request(command);
      }
      /**
       * Send an FTP command and ignore an FTP error response. Any other kind of error or timeout will still reject the Promise.
       *
       * @param command
       */
      sendIgnoringError(command) {
        return this.ftp.handle(command, (res2, task) => {
          if (res2 instanceof FtpContext_1.FTPError) {
            task.resolve({ code: res2.code, message: res2.message });
          } else if (res2 instanceof Error) {
            task.reject(res2);
          } else {
            task.resolve(res2);
          }
        });
      }
      /**
       * Upgrade the current socket connection to TLS.
       *
       * @param options  TLS options as in `tls.connect(options)`, optional.
       * @param command  Set the authentication command. Optional, default is "AUTH TLS".
       */
      async useTLS(options = {}, command = "AUTH TLS") {
        const ret = await this.send(command);
        this.ftp.socket = await (0, netUtils_1.upgradeSocket)(this.ftp.socket, options);
        this.ftp.tlsOptions = options;
        this.ftp.log(`Control socket is using: ${(0, netUtils_1.describeTLS)(this.ftp.socket)}`);
        return ret;
      }
      /**
       * Login a user with a password.
       *
       * @param user  Username to use for login. Optional, default is "anonymous".
       * @param password  Password to use for login. Optional, default is "guest".
       */
      login(user = "anonymous", password = "guest") {
        this.ftp.log(`Login security: ${(0, netUtils_1.describeTLS)(this.ftp.socket)}`);
        return this.ftp.handle("USER " + user, (res2, task) => {
          if (res2 instanceof Error) {
            task.reject(res2);
          } else if ((0, parseControlResponse_1.positiveCompletion)(res2.code)) {
            task.resolve(res2);
          } else if (res2.code === 331) {
            this.ftp.send("PASS " + password);
          } else {
            task.reject(new FtpContext_1.FTPError(res2));
          }
        });
      }
      /**
       * Set the usual default settings.
       *
       * Settings used:
       * * Binary mode (TYPE I)
       * * File structure (STRU F)
       * * Additional settings for FTPS (PBSZ 0, PROT P)
       */
      async useDefaultSettings() {
        const features = await this.features();
        const supportsMLSD = features.has("MLST");
        this.availableListCommands = supportsMLSD ? LIST_COMMANDS_MLSD() : LIST_COMMANDS_DEFAULT();
        await this.send("TYPE I");
        await this.sendIgnoringError("STRU F");
        await this.sendIgnoringError("OPTS UTF8 ON");
        if (supportsMLSD) {
          await this.sendIgnoringError("OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;");
        }
        if (this.ftp.hasTLS) {
          await this.sendIgnoringError("PBSZ 0");
          await this.sendIgnoringError("PROT P");
        }
      }
      /**
       * Convenience method that calls `connect`, `useTLS`, `login` and `useDefaultSettings`.
       *
       * This is an instance method and thus can be called multiple times during the lifecycle of a `Client`
       * instance. Whenever you do, the client is reset with a new control connection. This also implies that
       * you can reopen a `Client` instance that has been closed due to an error when reconnecting with this
       * method. In fact, reconnecting is the only way to continue using a closed `Client`.
       */
      async access(options = {}) {
        var _a6, _b4;
        const useExplicitTLS = options.secure === true;
        const useImplicitTLS = options.secure === "implicit";
        let welcome;
        if (useImplicitTLS) {
          welcome = await this.connectImplicitTLS(options.host, options.port, options.secureOptions);
        } else {
          welcome = await this.connect(options.host, options.port);
        }
        if (useExplicitTLS) {
          const secureOptions = (_a6 = options.secureOptions) !== null && _a6 !== void 0 ? _a6 : {};
          secureOptions.host = (_b4 = secureOptions.host) !== null && _b4 !== void 0 ? _b4 : options.host;
          await this.useTLS(secureOptions);
        }
        await this.sendIgnoringError("OPTS UTF8 ON");
        await this.login(options.user, options.password);
        await this.useDefaultSettings();
        return welcome;
      }
      /**
       * Get the current working directory.
       */
      async pwd() {
        const res2 = await this.send("PWD");
        const parsed = res2.message.match(/"(.+)"/);
        if (parsed === null || parsed[1] === void 0) {
          throw new Error(`Can't parse response to command 'PWD': ${res2.message}`);
        }
        return parsed[1];
      }
      /**
       * Get a description of supported features.
       *
       * This sends the FEAT command and parses the result into a Map where keys correspond to available commands
       * and values hold further information. Be aware that your FTP servers might not support this
       * command in which case this method will not throw an exception but just return an empty Map.
       */
      async features() {
        const res2 = await this.sendIgnoringError("FEAT");
        const features = /* @__PURE__ */ new Map();
        if (res2.code < 400 && (0, parseControlResponse_1.isMultiline)(res2.message)) {
          res2.message.split("\n").slice(1, -1).forEach((line) => {
            const entry = line.trim().split(" ");
            features.set(entry[0], entry[1] || "");
          });
        }
        return features;
      }
      /**
       * Set the working directory.
       */
      async cd(path8) {
        const validPath = await this.protectWhitespace(path8);
        return this.send("CWD " + validPath);
      }
      /**
       * Switch to the parent directory of the working directory.
       */
      async cdup() {
        return this.send("CDUP");
      }
      /**
       * Get the last modified time of a file. This is not supported by every FTP server, in which case
       * calling this method will throw an exception.
       */
      async lastMod(path8) {
        const validPath = await this.protectWhitespace(path8);
        const res2 = await this.send(`MDTM ${validPath}`);
        const date = res2.message.slice(4);
        return (0, parseListMLSD_1.parseMLSxDate)(date);
      }
      /**
       * Get the size of a file.
       */
      async size(path8) {
        const validPath = await this.protectWhitespace(path8);
        const command = `SIZE ${validPath}`;
        const res2 = await this.send(command);
        const size = parseInt(res2.message.slice(4), 10);
        if (Number.isNaN(size)) {
          throw new Error(`Can't parse response to command '${command}' as a numerical value: ${res2.message}`);
        }
        return size;
      }
      /**
       * Rename a file.
       *
       * Depending on the FTP server this might also be used to move a file from one
       * directory to another by providing full paths.
       */
      async rename(srcPath, destPath) {
        const validSrc = await this.protectWhitespace(srcPath);
        const validDest = await this.protectWhitespace(destPath);
        await this.send("RNFR " + validSrc);
        return this.send("RNTO " + validDest);
      }
      /**
       * Remove a file from the current working directory.
       *
       * You can ignore FTP error return codes which won't throw an exception if e.g.
       * the file doesn't exist.
       */
      async remove(path8, ignoreErrorCodes = false) {
        const validPath = await this.protectWhitespace(path8);
        if (ignoreErrorCodes) {
          return this.sendIgnoringError(`DELE ${validPath}`);
        }
        return this.send(`DELE ${validPath}`);
      }
      /**
       * Report transfer progress for any upload or download to a given handler.
       *
       * This will also reset the overall transfer counter that can be used for multiple transfers. You can
       * also call the function without a handler to stop reporting to an earlier one.
       *
       * @param handler  Handler function to call on transfer progress.
       */
      trackProgress(handler) {
        this._progressTracker.bytesOverall = 0;
        this._progressTracker.reportTo(handler);
      }
      /**
       * Upload data from a readable stream or a local file to a remote file.
       *
       * @param source  Readable stream or path to a local file.
       * @param toRemotePath  Path to a remote file to write to.
       */
      async uploadFrom(source2, toRemotePath, options = {}) {
        return this._uploadWithCommand(source2, toRemotePath, "STOR", options);
      }
      /**
       * Upload data from a readable stream or a local file by appending it to an existing file. If the file doesn't
       * exist the FTP server should create it.
       *
       * @param source  Readable stream or path to a local file.
       * @param toRemotePath  Path to a remote file to write to.
       */
      async appendFrom(source2, toRemotePath, options = {}) {
        return this._uploadWithCommand(source2, toRemotePath, "APPE", options);
      }
      /**
       * @protected
       */
      async _uploadWithCommand(source2, remotePath, command, options) {
        if (typeof source2 === "string") {
          return this._uploadLocalFile(source2, remotePath, command, options);
        }
        return this._uploadFromStream(source2, remotePath, command);
      }
      /**
       * @protected
       */
      async _uploadLocalFile(localPath, remotePath, command, options) {
        const fd2 = await fsOpen(localPath, "r");
        const source2 = (0, fs_1.createReadStream)("", {
          fd: fd2,
          start: options.localStart,
          end: options.localEndInclusive,
          autoClose: false
        });
        try {
          return await this._uploadFromStream(source2, remotePath, command);
        } finally {
          await ignoreError(() => fsClose(fd2));
        }
      }
      /**
       * @protected
       */
      async _uploadFromStream(source2, remotePath, command) {
        const onError = (err2) => this.ftp.closeWithError(err2);
        source2.once("error", onError);
        try {
          const validPath = await this.protectWhitespace(remotePath);
          await this.prepareTransfer(this.ftp);
          return await (0, transfer_1.uploadFrom)(source2, {
            ftp: this.ftp,
            tracker: this._progressTracker,
            command,
            remotePath: validPath,
            type: "upload"
          });
        } finally {
          source2.removeListener("error", onError);
        }
      }
      /**
       * Download a remote file and pipe its data to a writable stream or to a local file.
       *
       * You can optionally define at which position of the remote file you'd like to start
       * downloading. If the destination you provide is a file, the offset will be applied
       * to it as well. For example: To resume a failed download, you'd request the size of
       * the local, partially downloaded file and use that as the offset. Assuming the size
       * is 23, you'd download the rest using `downloadTo("local.txt", "remote.txt", 23)`.
       *
       * @param destination  Stream or path for a local file to write to.
       * @param fromRemotePath  Path of the remote file to read from.
       * @param startAt  Position within the remote file to start downloading at. If the destination is a file, this offset is also applied to it.
       */
      async downloadTo(destination, fromRemotePath, startAt = 0) {
        if (typeof destination === "string") {
          return this._downloadToFile(destination, fromRemotePath, startAt);
        }
        return this._downloadToStream(destination, fromRemotePath, startAt);
      }
      /**
       * @protected
       */
      async _downloadToFile(localPath, remotePath, startAt) {
        const appendingToLocalFile = startAt > 0;
        const fileSystemFlags = appendingToLocalFile ? "r+" : "w";
        const fd2 = await fsOpen(localPath, fileSystemFlags);
        const destination = (0, fs_1.createWriteStream)("", {
          fd: fd2,
          start: startAt,
          autoClose: false
        });
        try {
          return await this._downloadToStream(destination, remotePath, startAt);
        } catch (err2) {
          const localFileStats = await ignoreError(() => fsStat(localPath));
          const hasDownloadedData = localFileStats && localFileStats.size > 0;
          const shouldRemoveLocalFile = !appendingToLocalFile && !hasDownloadedData;
          if (shouldRemoveLocalFile) {
            await ignoreError(() => fsUnlink(localPath));
          }
          throw err2;
        } finally {
          await ignoreError(() => fsClose(fd2));
        }
      }
      /**
       * @protected
       */
      async _downloadToStream(destination, remotePath, startAt) {
        const onError = (err2) => this.ftp.closeWithError(err2);
        destination.once("error", onError);
        try {
          const validPath = await this.protectWhitespace(remotePath);
          await this.prepareTransfer(this.ftp);
          return await (0, transfer_1.downloadTo)(destination, {
            ftp: this.ftp,
            tracker: this._progressTracker,
            command: startAt > 0 ? `REST ${startAt}` : `RETR ${validPath}`,
            remotePath: validPath,
            type: "download"
          });
        } finally {
          destination.removeListener("error", onError);
          destination.end();
        }
      }
      /**
       * List files and directories in the current working directory, or from `path` if specified.
       *
       * @param [path]  Path to remote file or directory.
       */
      async list(path8 = "") {
        const validPath = await this.protectWhitespace(path8);
        let lastError;
        for (const candidate of this.availableListCommands) {
          const command = validPath === "" ? candidate : `${candidate} ${validPath}`;
          await this.prepareTransfer(this.ftp);
          try {
            const parsedList = await this._requestListWithCommand(command);
            this.availableListCommands = [candidate];
            return parsedList;
          } catch (err2) {
            const shouldTryNext = err2 instanceof FtpContext_1.FTPError;
            if (!shouldTryNext) {
              throw err2;
            }
            lastError = err2;
          }
        }
        throw lastError;
      }
      /**
       * @protected
       */
      async _requestListWithCommand(command) {
        const buffer = new StringWriter_1.StringWriter();
        await (0, transfer_1.downloadTo)(buffer, {
          ftp: this.ftp,
          tracker: this._progressTracker,
          command,
          remotePath: "",
          type: "list"
        });
        const text3 = buffer.getText(this.ftp.encoding);
        this.ftp.log(text3);
        return this.parseList(text3);
      }
      /**
       * Remove a directory and all of its content.
       *
       * @param remoteDirPath  The path of the remote directory to delete.
       * @example client.removeDir("foo") // Remove directory 'foo' using a relative path.
       * @example client.removeDir("foo/bar") // Remove directory 'bar' using a relative path.
       * @example client.removeDir("/foo/bar") // Remove directory 'bar' using an absolute path.
       * @example client.removeDir("/") // Remove everything.
       */
      async removeDir(remoteDirPath) {
        return this._exitAtCurrentDirectory(async () => {
          await this.cd(remoteDirPath);
          const absoluteDirPath = await this.pwd();
          await this.clearWorkingDir();
          const dirIsRoot = absoluteDirPath === "/";
          if (!dirIsRoot) {
            await this.cdup();
            await this.removeEmptyDir(absoluteDirPath);
          }
        });
      }
      /**
       * Remove all files and directories in the working directory without removing
       * the working directory itself.
       */
      async clearWorkingDir() {
        for (const file of await this.list()) {
          if (file.isDirectory) {
            await this.cd(file.name);
            await this.clearWorkingDir();
            await this.cdup();
            await this.removeEmptyDir(file.name);
          } else {
            await this.remove(file.name);
          }
        }
      }
      /**
       * Upload the contents of a local directory to the remote working directory.
       *
       * This will overwrite existing files with the same names and reuse existing directories.
       * Unrelated files and directories will remain untouched. You can optionally provide a `remoteDirPath`
       * to put the contents inside a directory which will be created if necessary including all
       * intermediate directories. If you did provide a remoteDirPath the working directory will stay
       * the same as before calling this method.
       *
       * @param localDirPath  Local path, e.g. "foo/bar" or "../test"
       * @param [remoteDirPath]  Remote path of a directory to upload to. Working directory if undefined.
       */
      async uploadFromDir(localDirPath, remoteDirPath) {
        return this._exitAtCurrentDirectory(async () => {
          if (remoteDirPath) {
            await this.ensureDir(remoteDirPath);
          }
          return await this._uploadToWorkingDir(localDirPath);
        });
      }
      /**
       * @protected
       */
      async _uploadToWorkingDir(localDirPath) {
        const files = await fsReadDir(localDirPath);
        for (const file of files) {
          const fullPath = (0, path_1.join)(localDirPath, file);
          const stats = await fsStat(fullPath);
          if (stats.isFile()) {
            await this.uploadFrom(fullPath, file);
          } else if (stats.isDirectory()) {
            await this._openDir(file);
            await this._uploadToWorkingDir(fullPath);
            await this.cdup();
          }
        }
      }
      /**
       * Download all files and directories of the working directory to a local directory.
       *
       * @param localDirPath  The local directory to download to.
       * @param remoteDirPath  Remote directory to download. Current working directory if not specified.
       */
      async downloadToDir(localDirPath, remoteDirPath) {
        return this._exitAtCurrentDirectory(async () => {
          if (remoteDirPath) {
            await this.cd(remoteDirPath);
          }
          return await this._downloadFromWorkingDir(localDirPath);
        });
      }
      /**
       * @protected
       */
      async _downloadFromWorkingDir(localDirPath) {
        await ensureLocalDirectory(localDirPath);
        for (const file of await this.list()) {
          const localPath = (0, path_1.join)(localDirPath, file.name);
          if (file.isDirectory) {
            await this.cd(file.name);
            await this._downloadFromWorkingDir(localPath);
            await this.cdup();
          } else if (file.isFile) {
            await this.downloadTo(localPath, file.name);
          }
        }
      }
      /**
       * Make sure a given remote path exists, creating all directories as necessary.
       * This function also changes the current working directory to the given path.
       */
      async ensureDir(remoteDirPath) {
        if (remoteDirPath.startsWith("/")) {
          await this.cd("/");
        }
        const names = remoteDirPath.split("/").filter((name) => name !== "");
        for (const name of names) {
          await this._openDir(name);
        }
      }
      /**
       * Try to create a directory and enter it. This will not raise an exception if the directory
       * couldn't be created if for example it already exists.
       * @protected
       */
      async _openDir(dirName) {
        await this.sendIgnoringError("MKD " + dirName);
        await this.cd(dirName);
      }
      /**
       * Remove an empty directory, will fail if not empty.
       */
      async removeEmptyDir(path8) {
        const validPath = await this.protectWhitespace(path8);
        return this.send(`RMD ${validPath}`);
      }
      /**
       * FTP servers can't handle filenames that have leading whitespace. This method transforms
       * a given path to fix that issue for most cases.
       */
      async protectWhitespace(path8) {
        if (!path8.startsWith(" ")) {
          return path8;
        }
        const pwd = await this.pwd();
        const absolutePathPrefix = pwd.endsWith("/") ? pwd : pwd + "/";
        return absolutePathPrefix + path8;
      }
      async _exitAtCurrentDirectory(func) {
        const userDir = await this.pwd();
        try {
          return await func();
        } finally {
          if (!this.closed) {
            await ignoreError(() => this.cd(userDir));
          }
        }
      }
      /**
       * Try all available transfer strategies and pick the first one that works. Update `client` to
       * use the working strategy for all successive transfer requests.
       *
       * @returns a function that will try the provided strategies.
       */
      _enterFirstCompatibleMode(strategies) {
        return async (ftp2) => {
          ftp2.log("Trying to find optimal transfer strategy...");
          let lastError = void 0;
          for (const strategy of strategies) {
            try {
              const res2 = await strategy(ftp2);
              ftp2.log("Optimal transfer strategy found.");
              this.prepareTransfer = strategy;
              return res2;
            } catch (err2) {
              lastError = err2;
            }
          }
          throw new Error(`None of the available transfer strategies work. Last error response was '${lastError}'.`);
        };
      }
      /**
       * DEPRECATED, use `uploadFrom`.
       * @deprecated
       */
      async upload(source2, toRemotePath, options = {}) {
        this.ftp.log("Warning: upload() has been deprecated, use uploadFrom().");
        return this.uploadFrom(source2, toRemotePath, options);
      }
      /**
       * DEPRECATED, use `appendFrom`.
       * @deprecated
       */
      async append(source2, toRemotePath, options = {}) {
        this.ftp.log("Warning: append() has been deprecated, use appendFrom().");
        return this.appendFrom(source2, toRemotePath, options);
      }
      /**
       * DEPRECATED, use `downloadTo`.
       * @deprecated
       */
      async download(destination, fromRemotePath, startAt = 0) {
        this.ftp.log("Warning: download() has been deprecated, use downloadTo().");
        return this.downloadTo(destination, fromRemotePath, startAt);
      }
      /**
       * DEPRECATED, use `uploadFromDir`.
       * @deprecated
       */
      async uploadDir(localDirPath, remoteDirPath) {
        this.ftp.log("Warning: uploadDir() has been deprecated, use uploadFromDir().");
        return this.uploadFromDir(localDirPath, remoteDirPath);
      }
      /**
       * DEPRECATED, use `downloadToDir`.
       * @deprecated
       */
      async downloadDir(localDirPath) {
        this.ftp.log("Warning: downloadDir() has been deprecated, use downloadToDir().");
        return this.downloadToDir(localDirPath);
      }
    };
    exports2.Client = Client2;
    async function ensureLocalDirectory(path8) {
      try {
        await fsStat(path8);
      } catch (_a6) {
        await fsMkDir(path8, { recursive: true });
      }
    }
    async function ignoreError(func) {
      try {
        return await func();
      } catch (_a6) {
        return void 0;
      }
    }
  }
});

// node_modules/basic-ftp/dist/StringEncoding.js
var require_StringEncoding = __commonJS({
  "node_modules/basic-ftp/dist/StringEncoding.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
  }
});

// node_modules/basic-ftp/dist/index.js
var require_dist4 = __commonJS({
  "node_modules/basic-ftp/dist/index.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m2, k);
      if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m2[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    } : function(o, m2, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m2[k];
    });
    var __exportStar = exports2 && exports2.__exportStar || function(m2, exports3) {
      for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m2, p);
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.enterPassiveModeIPv6 = exports2.enterPassiveModeIPv4 = void 0;
    __exportStar(require_Client(), exports2);
    __exportStar(require_FtpContext(), exports2);
    __exportStar(require_FileInfo(), exports2);
    __exportStar(require_parseList(), exports2);
    __exportStar(require_StringEncoding(), exports2);
    var transfer_1 = require_transfer();
    Object.defineProperty(exports2, "enterPassiveModeIPv4", { enumerable: true, get: function() {
      return transfer_1.enterPassiveModeIPv4;
    } });
    Object.defineProperty(exports2, "enterPassiveModeIPv6", { enumerable: true, get: function() {
      return transfer_1.enterPassiveModeIPv6;
    } });
  }
});

// src/ftp.ts
var ftp_exports = {};
__export2(ftp_exports, {
  FTPUploader: () => FTPUploader,
  validateFTPConfig: () => validateFTPConfig
});
function validateFTPConfig(config) {
  var _a6, _b4, _c2;
  const errors2 = [];
  if (!((_a6 = config.server) == null ? void 0 : _a6.trim())) {
    errors2.push("Server address is required");
  }
  if (!((_b4 = config.username) == null ? void 0 : _b4.trim())) {
    errors2.push("Username is required");
  }
  if (!((_c2 = config.password) == null ? void 0 : _c2.trim())) {
    errors2.push("Password is required");
  }
  if (config.remoteDir && !config.remoteDir.startsWith("/")) {
    errors2.push("Remote directory should start with /");
  }
  return {
    valid: errors2.length === 0,
    errors: errors2
  };
}
var ftp, path7, fs6, crypto2, FTPUploader;
var init_ftp = __esm({
  "src/ftp.ts"() {
    "use strict";
    ftp = __toESM2(require_dist4(), 1);
    path7 = __toESM2(require("path"), 1);
    fs6 = __toESM2(require("fs"), 1);
    crypto2 = __toESM2(require("crypto"), 1);
    FTPUploader = class {
      constructor(config) {
        this.totalSize = 0;
        this.transferredSize = 0;
        this.lastProgressUpdate = 0;
        this.client = new ftp.Client();
        this.config = config;
      }
      /**
       * Set callback for when connection type is discovered
       */
      setConnectionTypeCallback(callback) {
        this.onConnectionTypeDiscovered = callback;
      }
      /**
       * Set progress callback
       */
      setProgressCallback(callback) {
        this.onProgress = callback;
      }
      /**
       * Calculate MD5 hash of a file
       */
      async calculateFileHash(filePath) {
        return new Promise((resolve, reject) => {
          const hash2 = crypto2.createHash("md5");
          const stream = fs6.createReadStream(filePath);
          stream.on("data", (data) => hash2.update(data));
          stream.on("end", () => resolve(hash2.digest("hex")));
          stream.on("error", reject);
        });
      }
      /**
       * Generate file manifest for a directory
       */
      async generateManifest(localDir, projectId) {
        const files = {};
        const scanRecursive = async (currentPath, relativePath = "") => {
          const items = await fs6.promises.readdir(currentPath, { withFileTypes: true });
          for (const item of items) {
            const itemPath = path7.join(currentPath, item.name);
            const itemRelativePath = relativePath ? path7.join(relativePath, item.name) : item.name;
            if (item.isDirectory()) {
              await scanRecursive(itemPath, itemRelativePath);
            } else if (item.isFile()) {
              const stats = await fs6.promises.stat(itemPath);
              const hash2 = await this.calculateFileHash(itemPath);
              const normalizedPath = itemRelativePath.replace(/\\/g, "/");
              files[normalizedPath] = {
                hash: hash2,
                size: stats.size,
                mtime: stats.mtimeMs,
                relativePath: normalizedPath
              };
            }
          }
        };
        await scanRecursive(localDir);
        return {
          projectId,
          lastUploadTime: Date.now(),
          uploadMethod: "ftp",
          remoteDir: this.config.remoteDir,
          files
        };
      }
      /**
       * Compare two manifests and determine which files need to be uploaded/deleted
       */
      compareManifests(oldManifest, newManifest) {
        const toUpload = [];
        const toDelete = [];
        const unchanged = [];
        if (!oldManifest) {
          return {
            toUpload: Object.keys(newManifest.files),
            toDelete: [],
            unchanged: []
          };
        }
        for (const [filePath, newEntry] of Object.entries(newManifest.files)) {
          const oldEntry = oldManifest.files[filePath];
          if (!oldEntry) {
            toUpload.push(filePath);
          } else if (oldEntry.hash !== newEntry.hash) {
            toUpload.push(filePath);
          } else {
            unchanged.push(filePath);
          }
        }
        for (const filePath of Object.keys(oldManifest.files)) {
          if (!newManifest.files[filePath]) {
            toDelete.push(filePath);
          }
        }
        return { toUpload, toDelete, unchanged };
      }
      async calculateDirectorySize(dirPath) {
        let totalSize = 0;
        const calculateRecursive = async (currentPath) => {
          const items = await fs6.promises.readdir(currentPath, { withFileTypes: true });
          for (const item of items) {
            const itemPath = path7.join(currentPath, item.name);
            if (item.isDirectory()) {
              await calculateRecursive(itemPath);
            } else if (item.isFile()) {
              const stats = await fs6.promises.stat(itemPath);
              totalSize += stats.size;
            }
          }
        };
        await calculateRecursive(dirPath);
        return totalSize;
      }
      /**
       * Connect to FTP server with automatic fallback
       * Now defaults to plain FTP first, then tries FTPS if that fails
       */
      async connectWithFallback() {
        const isDevelopment = false;
        this.client.ftp.verbose = isDevelopment;
        this.client.ftp.ipFamily = 4;
        const trySecureFirst = this.config.preferredSecure === true;
        const tryPlainFirst = this.config.preferredSecure === false || this.config.preferredSecure === void 0;
        if (tryPlainFirst) {
          const plainStart = Date.now();
          try {
            const result = await this.tryPlainFTP();
            if (this.onConnectionTypeDiscovered) {
              this.onConnectionTypeDiscovered(false);
            }
            return result;
          } catch (err2) {
            const ftpsStart = Date.now();
            try {
              this.client.close();
              this.client = new ftp.Client();
              this.client.ftp.verbose = isDevelopment;
              this.client.ftp.ipFamily = 4;
              const result = await this.trySecureFTP();
              const ftpsDuration = Date.now() - ftpsStart;
              if (this.onConnectionTypeDiscovered) {
                this.onConnectionTypeDiscovered(true);
              }
              return result;
            } catch (secureErr) {
              const ftpsDuration = Date.now() - ftpsStart;
              console.error(`[FTP Performance] \u274C FTPS also failed: ${ftpsDuration}ms`);
              console.error("[FTP Performance] \u274C Both plain FTP and FTPS failed");
              throw err2;
            }
          }
        } else {
          try {
            const result = await this.trySecureFTP();
            if (this.onConnectionTypeDiscovered) {
              this.onConnectionTypeDiscovered(true);
            }
            return result;
          } catch (err2) {
            const plainStart = Date.now();
            try {
              this.client.close();
              this.client = new ftp.Client();
              this.client.ftp.verbose = isDevelopment;
              this.client.ftp.ipFamily = 4;
              const result = await this.tryPlainFTP();
              if (this.onConnectionTypeDiscovered) {
                this.onConnectionTypeDiscovered(false);
              }
              return result;
            } catch (plainErr) {
              const plainDuration = Date.now() - plainStart;
              console.error(`[FTP Performance] \u274C Plain FTP also failed: ${plainDuration}ms`);
              console.error("[FTP Performance] \u274C Both FTPS and plain FTP failed");
              throw err2;
            }
          }
        }
      }
      /**
       * Try plain FTP connection
       */
      async tryPlainFTP() {
        const plainConfig = {
          host: this.config.server,
          user: this.config.username,
          password: this.config.password,
          secure: false,
          timeout: 9e4
        };
        await this.client.access(plainConfig);
        return { usedSecure: false };
      }
      /**
       * Try secure FTP connection
       */
      async trySecureFTP() {
        const secureConfig = {
          host: this.config.server,
          user: this.config.username,
          password: this.config.password,
          secure: true,
          secureOptions: {
            rejectUnauthorized: !this.config.ignoreCert
          },
          timeout: 9e4
        };
        await this.client.access(secureConfig);
        return { usedSecure: true };
      }
      /**
       * Upload directory to FTP server (full upload)
       */
      async uploadDirectory(localDir) {
        const startTime = Date.now();
        try {
          this.totalSize = 0;
          this.transferredSize = 0;
          const sizeCalculationPromise = this.calculateDirectorySize(localDir).then((size) => {
            this.totalSize = size;
          });
          const connectionResult = await this.connectWithFallback();
          if (this.onProgress) {
            this.onProgress({
              fileName: "Preparing upload...",
              bytesTransferred: 0,
              totalBytes: this.totalSize,
              percentage: 40
            });
          }
          const PROGRESS_THROTTLE_MS = 200;
          this.lastProgressUpdate = 0;
          this.client.trackProgress((info3) => {
            this.transferredSize += info3.bytes;
            const now = Date.now();
            if (now - this.lastProgressUpdate < PROGRESS_THROTTLE_MS) {
              return;
            }
            this.lastProgressUpdate = now;
            const realProgress = this.totalSize > 0 ? this.transferredSize / this.totalSize : 0;
            const BASE_PROGRESS = 40;
            const PROGRESS_RANGE = 60;
            const easedProgress = Math.sqrt(realProgress);
            const percentage = Math.round(BASE_PROGRESS + easedProgress * PROGRESS_RANGE);
            if (this.onProgress) {
              this.onProgress({
                fileName: info3.name || "Unknown",
                bytesTransferred: this.transferredSize,
                totalBytes: this.totalSize,
                percentage
              });
            }
          });
          if (this.config.remoteDir && this.config.remoteDir !== "/") {
            try {
              await this.client.cd(this.config.remoteDir);
            } catch (err2) {
              await this.client.ensureDir(this.config.remoteDir);
              await this.client.cd(this.config.remoteDir);
            }
          }
          await this.client.uploadFromDir(localDir);
          await sizeCalculationPromise;
          if (this.onProgress) {
            this.onProgress({
              fileName: "Complete",
              bytesTransferred: this.totalSize || this.transferredSize,
              totalBytes: this.totalSize || this.transferredSize,
              percentage: 100
            });
          }
          return {
            success: true,
            usedSecure: connectionResult.usedSecure
          };
        } catch (error2) {
          const totalDuration = Date.now() - startTime;
          console.error(`[FTP Performance] \u274C Upload failed after ${totalDuration}ms:`, error2);
          return {
            success: false,
            usedSecure: false,
            error: error2 instanceof Error ? error2.message : String(error2)
          };
        } finally {
          this.client.close();
        }
      }
      /**
       * Upload a single file with retry mechanism
       * This handles the case where a previous upload left a 0-byte file on the server
       */
      async uploadFileWithRetry(localFilePath, remoteFilePath, displayName, maxRetries = 2) {
        let lastError = null;
        for (let attempt = 1; attempt <= maxRetries; attempt++) {
          try {
            try {
              await this.client.remove(remoteFilePath);
            } catch (removeErr) {
            }
            await this.client.uploadFrom(localFilePath, remoteFilePath);
            return;
          } catch (err2) {
            lastError = err2;
            if (attempt < maxRetries) {
              console.warn(`[FTP Incremental]   - \u26A0\uFE0F  Upload attempt ${attempt}/${maxRetries} failed for ${displayName}, retrying...`);
              console.warn(`[FTP Incremental]   - Error: ${lastError.message}`);
              const waitTime = 1e3 * attempt;
              await new Promise((resolve) => setTimeout(resolve, waitTime));
            } else {
              console.error(`[FTP Incremental]   - \u274C All upload attempts failed for ${displayName}`);
              throw lastError;
            }
          }
        }
        throw lastError || new Error("Upload failed with unknown error");
      }
      /**
       * Test FTP connection
       */
      async testConnection() {
        const startTime = Date.now();
        try {
          const connectionResult = await this.connectWithFallback();
          this.client.close();
          return {
            success: true,
            usedSecure: connectionResult.usedSecure
          };
        } catch (error2) {
          const totalDuration = Date.now() - startTime;
          console.error(`[FTP Performance] \u274C Connection test failed after ${totalDuration}ms:`, error2);
          return {
            success: false,
            usedSecure: false,
            error: error2 instanceof Error ? error2.message : String(error2)
          };
        }
      }
      /**
       * Incremental upload - only upload changed files
       */
      async uploadDirectoryIncremental(localDir, projectId, oldManifest) {
        const startTime = Date.now();
        try {
          const newManifest = await this.generateManifest(localDir, projectId);
          const { toUpload, toDelete, unchanged } = this.compareManifests(oldManifest, newManifest);
          const stats = {
            uploaded: toUpload.length,
            deleted: toDelete.length,
            unchanged: unchanged.length,
            totalFiles: Object.keys(newManifest.files).length
          };
          if (toUpload.length === 0 && toDelete.length === 0) {
            return {
              success: true,
              usedSecure: false,
              newManifest,
              stats
            };
          }
          this.totalSize = toUpload.reduce((sum2, filePath) => {
            var _a6;
            return sum2 + (((_a6 = newManifest.files[filePath]) == null ? void 0 : _a6.size) || 0);
          }, 0);
          this.transferredSize = 0;
          const connectionResult = await this.connectWithFallback();
          if (this.onProgress) {
            this.onProgress({
              fileName: "Preparing incremental upload...",
              bytesTransferred: 0,
              totalBytes: this.totalSize,
              percentage: 40
            });
          }
          const PROGRESS_THROTTLE_MS = 200;
          this.lastProgressUpdate = 0;
          this.client.trackProgress((info3) => {
            this.transferredSize += info3.bytes;
            const now = Date.now();
            if (now - this.lastProgressUpdate < PROGRESS_THROTTLE_MS) {
              return;
            }
            this.lastProgressUpdate = now;
            const realProgress = this.totalSize > 0 ? this.transferredSize / this.totalSize : 0;
            const BASE_PROGRESS = 40;
            const PROGRESS_RANGE = 60;
            const easedProgress = Math.sqrt(realProgress);
            const percentage = Math.round(BASE_PROGRESS + easedProgress * PROGRESS_RANGE);
            if (this.onProgress) {
              this.onProgress({
                fileName: info3.name || "Unknown",
                bytesTransferred: this.transferredSize,
                totalBytes: this.totalSize,
                percentage
              });
            }
          });
          if (this.config.remoteDir && this.config.remoteDir !== "/") {
            try {
              await this.client.cd(this.config.remoteDir);
            } catch (err2) {
              await this.client.ensureDir(this.config.remoteDir);
              await this.client.cd(this.config.remoteDir);
            }
          }
          if (toDelete.length > 0) {
            for (const filePath of toDelete) {
              try {
                const remoteFilePath = this.config.remoteDir && this.config.remoteDir !== "/" ? `${this.config.remoteDir}/${filePath}`.replace(/\\/g, "/") : filePath.replace(/\\/g, "/");
                await this.client.remove(remoteFilePath);
              } catch (err2) {
                console.error(`[FTP Incremental]   - \u26A0\uFE0F  Failed to delete ${filePath} (non-critical):`, err2);
              }
            }
          }
          const createdDirs = /* @__PURE__ */ new Set();
          for (const filePath of toUpload) {
            const localFilePath = path7.join(localDir, filePath);
            const remoteFilePath = this.config.remoteDir && this.config.remoteDir !== "/" ? `${this.config.remoteDir}/${filePath}`.replace(/\\/g, "/") : filePath.replace(/\\/g, "/");
            const remoteDir = path7.dirname(remoteFilePath).replace(/\\/g, "/");
            if (remoteDir && remoteDir !== "." && remoteDir !== "/") {
              if (!createdDirs.has(remoteDir)) {
                try {
                  await this.client.ensureDir(remoteDir);
                  createdDirs.add(remoteDir);
                } catch (err2) {
                  console.error(`[FTP Incremental]   - \u26A0\uFE0F  Failed to ensure directory ${remoteDir}:`, err2);
                  console.error(`[FTP Incremental]   - Will attempt upload anyway...`);
                }
              }
            }
            try {
              await this.uploadFileWithRetry(localFilePath, remoteFilePath, filePath, 2);
            } catch (err2) {
              console.error(`[FTP Incremental]   - \u274C Upload failed for ${filePath} after retries:`, err2);
              console.error(`[FTP Incremental]   - Local path: ${localFilePath}`);
              console.error(`[FTP Incremental]   - Remote path: ${remoteFilePath}`);
              throw err2;
            }
          }
          if (this.onProgress) {
            this.onProgress({
              fileName: "Complete",
              bytesTransferred: this.totalSize,
              totalBytes: this.totalSize,
              percentage: 100
            });
          }
          return {
            success: true,
            usedSecure: connectionResult.usedSecure,
            newManifest,
            stats
          };
        } catch (error2) {
          const totalDuration = Date.now() - startTime;
          console.error(`[FTP Incremental] \u274C Incremental upload failed after ${totalDuration}ms:`, error2);
          return {
            success: false,
            usedSecure: false,
            error: error2 instanceof Error ? error2.message : String(error2)
          };
        } finally {
          this.client.close();
        }
      }
    };
  }
});

// src/styles/theme-modal.css
var require_theme_modal = __commonJS({
  "src/styles/theme-modal.css"(exports2, module2) {
    module2.exports = {};
  }
});

// src/styles/publish-settings.css
var require_publish_settings = __commonJS({
  "src/styles/publish-settings.css"(exports2, module2) {
    module2.exports = {};
  }
});

// src/styles/project-modal.css
var require_project_modal = __commonJS({
  "src/styles/project-modal.css"(exports2, module2) {
    module2.exports = {};
  }
});

// src/styles/live-sync.css
var require_live_sync = __commonJS({
  "src/styles/live-sync.css"(exports2, module2) {
    module2.exports = {};
  }
});

// src/main.ts
var main_exports = {};
__export2(main_exports, {
  API_URL_DEV: () => API_URL_DEV,
  API_URL_PRO: () => API_URL_PRO,
  FRIDAY_ICON: () => FRIDAY_ICON,
  FRIDAY_SERVER_VIEW_TYPE: () => FRIDAY_SERVER_VIEW_TYPE,
  GetBaseUrl: () => GetBaseUrl,
  default: () => FridayPlugin
});
module.exports = __toCommonJS2(main_exports);
function GetBaseUrl(settings) {
  if (false) {
    return API_URL_DEV;
  }
  if ((settings == null ? void 0 : settings.enterpriseServerUrl) && settings.enterpriseServerUrl.trim()) {
    return settings.enterpriseServerUrl.trim();
  }
  return API_URL_PRO;
}
var import_obsidian20, FRIDAY_SERVER_VIEW_TYPE, DEFAULT_SETTINGS2, FRIDAY_ICON, API_URL_DEV, API_URL_PRO, FridayPlugin, FridaySettingTab;
var init_main = __esm({
  "src/main.ts"() {
    import_obsidian20 = require("obsidian");
    init_user();
    init_license_settings();
    init_i18n2();
    init_sync();
    init_license();
    init_domain();
    FRIDAY_SERVER_VIEW_TYPE = "Friday_Service";
    DEFAULT_SETTINGS2 = {
      username: "",
      password: "",
      userToken: "",
      // License Settings defaults
      license: null,
      licenseSync: null,
      licenseUser: null,
      licenseUsage: null,
      encryptionPassphrase: "",
      customSubdomain: null,
      customDomain: null,
      // General Settings defaults
      downloadServer: "global",
      // Publish Settings defaults
      publishMethod: "mdfriday",
      netlifyAccessToken: "",
      netlifyProjectId: "",
      // FTP Settings defaults
      ftpServer: "",
      ftpUsername: "",
      ftpPassword: "",
      ftpRemoteDir: "",
      ftpIgnoreCert: true,
      // Default to true for easier setup with self-signed certs
      // CouchDB Sync Settings defaults
      syncEnabled: false,
      syncConfig: SyncService.getDefaultConfig(),
      // UI Display Settings defaults
      showEditorStatusDisplay: false,
      // Enterprise Settings defaults
      enterpriseServerUrl: ""
    };
    FRIDAY_ICON = "dice-5";
    API_URL_DEV = "http://127.0.0.1:1314";
    API_URL_PRO = "https://app.mdfriday.com";
    FridayPlugin = class extends import_obsidian20.Plugin {
      constructor() {
        super(...arguments);
        this.syncStatusDisplay = null;
        // PC-only callbacks (optional)
        this.applyProjectConfigurationToPanel = null;
        this.exportHistoryBuild = null;
        this.clearPreviewHistory = null;
        // Quick share methods for internet icon (PC-only)
        this.setSitePath = null;
        this.startPreviewAndWait = null;
        this.selectMDFShare = null;
        this.refreshLicenseState = null;
        // PC-only state
        this.previousDownloadServer = "global";
      }
      async onload() {
        this.pluginDir = `${this.manifest.dir}`;
        await this.loadSettings();
        await this.initCore();
        if (import_obsidian20.Platform.isDesktop) {
          await this.initDesktopFeatures();
        } else {
          await this.initMobileFeatures();
        }
        setTimeout(() => {
          void this.initializeSyncService();
        }, 0);
        this.registerSyncCommands();
        this.statusBar = this.addStatusBarItem();
        this.addSettingTab(new FridaySettingTab(this.app, this));
      }
      /**
       * Initialize core services (common for all platforms)
       */
      async initCore() {
        this.apiUrl = GetBaseUrl(this.settings);
        this.i18n = new I18nService(this);
        await this.i18n.init();
        this.user = new User(this);
        const { Hugoverse: Hugoverse2 } = await Promise.resolve().then(() => (init_hugoverse(), hugoverse_exports));
        this.hugoverse = new Hugoverse2(this);
      }
      /**
       * Initialize desktop-only features
       */
      async initDesktopFeatures() {
        const [
          { default: ServerView2 },
          { ThemeSelectionModal: ThemeSelectionModal2 },
          { ProjectManagementModal: ProjectManagementModal2 },
          { ProjectService: ProjectService2 },
          { Site: Site3 },
          { NetlifyAPI: NetlifyAPI2 },
          { FTPUploader: FTPUploader2 },
          { themeApiService: themeApiService2 }
        ] = await Promise.all([
          Promise.resolve().then(() => (init_server(), server_exports)),
          Promise.resolve().then(() => (init_modal(), modal_exports)),
          Promise.resolve().then(() => (init_modal2(), modal_exports2)),
          Promise.resolve().then(() => (init_service2(), service_exports)),
          Promise.resolve().then(() => (init_site(), site_exports)),
          Promise.resolve().then(() => (init_netlify(), netlify_exports)),
          Promise.resolve().then(() => (init_ftp(), ftp_exports)),
          Promise.resolve().then(() => (init_themeApiService(), themeApiService_exports))
        ]);
        await Promise.all([
          Promise.resolve().then(() => __toESM2(require_theme_modal(), 1)),
          Promise.resolve().then(() => __toESM2(require_publish_settings(), 1)),
          Promise.resolve().then(() => __toESM2(require_project_modal(), 1)),
          Promise.resolve().then(() => __toESM2(require_live_sync(), 1))
        ]);
        this.ThemeSelectionModalClass = ThemeSelectionModal2;
        this.ProjectManagementModalClass = ProjectManagementModal2;
        this.themeApiService = themeApiService2;
        this.netlify = new NetlifyAPI2(this);
        this.site = new Site3(this);
        this.projectService = new ProjectService2(this);
        await this.projectService.initialize();
        this.initializeFTP();
        try {
          this.registerView(FRIDAY_SERVER_VIEW_TYPE, (leaf) => new ServerView2(leaf, this));
        } catch (e2) {
          console.error("[Friday] View already registered, skipping");
        }
        this.app.workspace.onLayoutReady(() => this.initLeaf());
        this.addRibbonIcon(FRIDAY_ICON, this.i18n.t("projects.manage_projects"), async () => {
          if (this.applyProjectConfigurationToPanel && this.exportHistoryBuild && this.clearPreviewHistory) {
            this.showProjectManagementModal(
              this.applyProjectConfigurationToPanel,
              this.exportHistoryBuild,
              this.clearPreviewHistory
            );
          }
        });
        this.registerEvent(
          this.app.workspace.on("active-leaf-change", (leaf) => {
            if ((leaf == null ? void 0 : leaf.view) instanceof import_obsidian20.MarkdownView) {
              this.addInternetIconToView(leaf.view);
            }
          })
        );
        this.app.workspace.onLayoutReady(() => {
          const activeView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
          if (activeView) {
            this.addInternetIconToView(activeView);
          }
        });
        this.addCommand({
          id: "export-current-note-with-css",
          name: this.i18n.t("menu.publish_to_web"),
          checkCallback: (checking) => {
            const file = this.app.workspace.getActiveFile();
            if (file && file.extension === "md") {
              if (!checking) {
                this.openPublishPanel(null, file);
              }
              return true;
            }
            return false;
          }
        });
        this.registerEvent(
          this.app.workspace.on("file-menu", (menu, file) => {
            if (file instanceof import_obsidian20.TFolder) {
              menu.addItem((item) => {
                item.setTitle(this.i18n.t("menu.publish_to_web")).setIcon(FRIDAY_ICON).onClick(async () => {
                  await this.openPublishPanel(file, null);
                });
              });
              menu.addItem((item) => {
                item.setTitle(this.i18n.t("menu.set_as_site_assets")).setIcon("folder-plus").onClick(async () => {
                  await this.setSiteAssets(file);
                });
              });
            } else if (file instanceof import_obsidian20.TFile && file.extension === "md") {
              menu.addItem((item) => {
                item.setTitle(this.i18n.t("menu.publish_to_web")).setIcon(FRIDAY_ICON).onClick(async () => {
                  await this.openPublishPanel(null, file);
                });
              });
            }
          })
        );
      }
      /**
       * Initialize mobile-only features
       */
      async initMobileFeatures() {
      }
      /**
       * Register sync commands (common for both platforms)
       */
      registerSyncCommands() {
        this.addCommand({
          id: "sync-pull-from-server",
          name: "Sync: Pull from Server",
          callback: async () => {
            if (!this.settings.syncEnabled) {
              new import_obsidian20.Notice(this.i18n.t("messages.sync_not_enabled"));
              return;
            }
            if (!this.syncService.isInitialized) {
              await this.syncService.initialize(this.settings.syncConfig);
            }
            await this.syncService.pullFromServer();
          }
        });
        this.addCommand({
          id: "sync-push-to-server",
          name: "Sync: Push to Server",
          callback: async () => {
            if (!this.settings.syncEnabled) {
              new import_obsidian20.Notice(this.i18n.t("messages.sync_not_enabled"));
              return;
            }
            if (!this.syncService.isInitialized) {
              await this.syncService.initialize(this.settings.syncConfig);
            }
            await this.syncService.pushToServer();
          }
        });
        this.addCommand({
          id: "sync-start-live-sync",
          name: "Sync: Start Live Sync",
          callback: async () => {
            if (!this.settings.syncEnabled) {
              new import_obsidian20.Notice(this.i18n.t("messages.sync_not_enabled"));
              return;
            }
            if (!this.syncService.isInitialized) {
              await this.syncService.initialize(this.settings.syncConfig);
            }
            await this.syncService.startSync(true);
          }
        });
        this.addCommand({
          id: "sync-stop",
          name: "Sync: Stop Synchronization",
          callback: async () => {
            if (this.syncService) {
              await this.syncService.stopSync();
            }
          }
        });
      }
      async openPublishPanel(folder, file) {
        if (!import_obsidian20.Platform.isDesktop || !this.site || !this.projectService) {
          new import_obsidian20.Notice(this.i18n.t("messages.publishing_desktop_only"));
          return;
        }
        const rightSplit = this.app.workspace.rightSplit;
        if (!rightSplit) {
          return;
        }
        if (rightSplit.collapsed) {
          rightSplit.expand();
        }
        const projectId = await this.tryGetProjectId(folder, file);
        if (projectId) {
          const existingProject = this.projectService.getProject(projectId);
          if (existingProject) {
            await this.applyExistingProjectToPanel(existingProject);
            return;
          }
        }
        if (this.site.hasContent()) {
          const success = this.site.addLanguageContent(folder, file);
          if (!success) {
            return;
          }
        } else {
          if (folder && await this.detectStructuredFolder(folder)) {
            await this.processStructuredFolder(folder);
          } else {
            this.site.initializeContent(folder, file);
          }
        }
        const leaves = this.app.workspace.getLeavesOfType(FRIDAY_SERVER_VIEW_TYPE);
        if (leaves.length > 0) {
          await this.app.workspace.revealLeaf(leaves[0]);
        } else {
          const leaf = this.app.workspace.getRightLeaf(false);
          if (leaf) {
            await leaf.setViewState({
              type: FRIDAY_SERVER_VIEW_TYPE,
              active: true
            });
          }
        }
      }
      /**
       * Try to get project ID from folder or file
       * Returns the project ID if it can be determined
       */
      async tryGetProjectId(folder, file) {
        if (!folder && !file) {
          return null;
        }
        let projectId = (folder == null ? void 0 : folder.path) || (file == null ? void 0 : file.path) || "";
        const contentFolder = folder || (file ? file.parent : null);
        if (contentFolder && contentFolder.parent) {
          const folderName = contentFolder.name.toLowerCase();
          if (folderName === "content" || folderName.startsWith("content.")) {
            projectId = contentFolder.parent.path;
          }
        }
        return projectId || null;
      }
      /**
       * Apply existing project configuration to panel
       * This mimics clicking "Apply to Panel" button
       */
      async applyExistingProjectToPanel(project) {
        try {
          if (this.applyProjectConfigurationToPanel) {
            this.applyProjectConfigurationToPanel(project);
          } else {
            console.error("applyProjectConfigurationToPanel method not registered yet");
          }
        } catch (error2) {
          console.error("Failed to apply project configuration:", error2);
        }
      }
      /**
       * Detect if a folder has structured content (content directories and static folder)
       */
      async detectStructuredFolder(folder) {
        try {
          const children = folder.children;
          const childNames = children.map((child2) => child2.name.toLowerCase());
          const hasContentDirs = childNames.some(
            (name) => name === "content" || name.startsWith("content.")
          );
          const hasStaticDir = childNames.includes("static");
          return hasContentDirs;
        } catch (error2) {
          console.warn("Error detecting structured folder:", error2);
          return false;
        }
      }
      /**
       * Process a structured folder by automatically adding content directories and static folder
       * (Desktop only)
       */
      async processStructuredFolder(folder) {
        if (!import_obsidian20.Platform.isDesktop || !this.site) {
          return;
        }
        try {
          const children = folder.children;
          const contentFolders = [];
          let staticFolder = null;
          for (const child2 of children) {
            if (!(child2 instanceof import_obsidian20.TFolder)) continue;
            const childName = child2.name.toLowerCase();
            if (childName === "content") {
              contentFolders.push({
                folder: child2,
                languageCode: "en",
                // Default language for 'content'
                weight: 0
                // Highest priority for default content
              });
            } else if (childName.startsWith("content.")) {
              const langCode = childName.split(".")[1];
              const mappedLangCode = this.mapLanguageCode(langCode);
              contentFolders.push({
                folder: child2,
                languageCode: mappedLangCode,
                weight: 1
                // Lower priority for language-specific content
              });
            }
            if (childName === "static") {
              staticFolder = child2;
            }
          }
          contentFolders.sort((a, b) => {
            if (a.weight !== b.weight) {
              return a.weight - b.weight;
            }
            return a.folder.name.localeCompare(b.folder.name);
          });
          if (contentFolders.length > 0) {
            this.site.initializeContentWithLanguage(
              contentFolders[0].folder,
              null,
              contentFolders[0].languageCode
            );
            for (let i = 1; i < contentFolders.length; i++) {
              this.site.addLanguageContentWithCode(
                contentFolders[i].folder,
                null,
                contentFolders[i].languageCode
              );
            }
          }
          if (staticFolder) {
            this.site.setSiteAssets(staticFolder);
          }
          const contentCount = contentFolders.length;
          const hasStatic = staticFolder !== null;
          let message = this.i18n.t("messages.structured_folder_processed", {
            contentCount,
            folderName: folder.name
          });
          if (hasStatic) {
            message += " " + this.i18n.t("messages.static_folder_detected");
          }
          new import_obsidian20.Notice(message, 5e3);
        } catch (error2) {
          console.error("Error processing structured folder:", error2);
          this.site.initializeContent(folder, null);
        }
      }
      /**
       * Map language codes to supported language codes
       */
      mapLanguageCode(code) {
        const languageMap = {
          "en": "en",
          "zh": "zh",
          "zh-cn": "zh",
          "zh-hans": "zh",
          "es": "es",
          "fr": "fr",
          "de": "de",
          "ja": "ja",
          "ko": "ko",
          "pt": "pt"
        };
        return languageMap[code.toLowerCase()] || "en";
      }
      async setSiteAssets(folder) {
        if (!import_obsidian20.Platform.isDesktop || !this.site) {
          new import_obsidian20.Notice(this.i18n.t("messages.site_assets_desktop_only"));
          return;
        }
        const success = this.site.setSiteAssets(folder);
        if (success) {
          const rightSplit = this.app.workspace.rightSplit;
          if (!rightSplit) {
            return;
          }
          if (rightSplit.collapsed) {
            rightSplit.expand();
          }
          const leaves = this.app.workspace.getLeavesOfType(FRIDAY_SERVER_VIEW_TYPE);
          if (leaves.length > 0) {
            await this.app.workspace.revealLeaf(leaves[0]);
          } else {
            const leaf = this.app.workspace.getRightLeaf(false);
            if (leaf) {
              await leaf.setViewState({
                type: FRIDAY_SERVER_VIEW_TYPE,
                active: true
              });
            }
          }
        }
      }
      showThemeSelectionModal(selectedTheme, onSelect, isForSingleFile = false) {
        if (!import_obsidian20.Platform.isDesktop || !this.ThemeSelectionModalClass) {
          new import_obsidian20.Notice(this.i18n.t("messages.theme_selection_desktop_only"));
          return;
        }
        const modal = new this.ThemeSelectionModalClass(this.app, selectedTheme, onSelect, this, isForSingleFile);
        modal.open();
      }
      showProjectManagementModal(onApply, onExport, onClearHistory) {
        if (!import_obsidian20.Platform.isDesktop || !this.ProjectManagementModalClass || !this.projectService) {
          new import_obsidian20.Notice(this.i18n.t("messages.project_management_desktop_only"));
          return;
        }
        const modal = new this.ProjectManagementModalClass(this.app, this, this.projectService, onApply, onExport, onClearHistory);
        modal.open();
      }
      /**
       * Add internet icon to markdown view header (left of the book icon)
       * Clicking this icon will automatically:
       * 1. Open publish panel with current file
       * 2. Set sitePath to "/s" for MDFriday Share
       * 3. Generate preview
       * 4. Select MDFriday Share publish option
       */
      addInternetIconToView(view) {
        const viewActionsEl = view.containerEl.querySelector(".view-actions");
        if (!viewActionsEl) return;
        const existingIcon = viewActionsEl.querySelector(".friday-internet-icon");
        if (existingIcon) {
          existingIcon.remove();
        }
        const iconEl = document.createElement("a");
        iconEl.className = "clickable-icon view-action friday-internet-icon";
        iconEl.setAttribute("aria-label", this.i18n.t("menu.quick_share"));
        (0, import_obsidian20.setIcon)(iconEl, "globe");
        iconEl.addEventListener("click", async (e2) => {
          e2.preventDefault();
          await this.quickShareCurrentFile(view);
        });
        viewActionsEl.insertBefore(iconEl, viewActionsEl.firstChild);
      }
      /**
       * Quick share current file - automated workflow (Desktop only)
       * 1. Open publish panel with current file
       * 2. Set sitePath to "/s"
       * 3. Generate preview
       * 4. Select MDFriday Share publish option
       */
      async quickShareCurrentFile(view) {
        var _a6, _b4;
        if (!import_obsidian20.Platform.isDesktop) {
          new import_obsidian20.Notice(this.i18n.t("messages.quick_share_desktop_only"));
          return;
        }
        const file = view.file;
        if (!file || file.extension !== "md") {
          new import_obsidian20.Notice(this.i18n.t("messages.no_markdown_file"), 3e3);
          return;
        }
        if (!this.settings.license || !((_a6 = this.settings.licenseUser) == null ? void 0 : _a6.userDir)) {
          new import_obsidian20.Notice(this.i18n.t("messages.license_required_for_share"), 5e3);
          return;
        }
        try {
          new import_obsidian20.Notice(this.i18n.t("messages.quick_share_starting"), 2e3);
          await this.openPublishPanel(null, file);
          await new Promise((resolve) => setTimeout(resolve, 500));
          if (this.selectMDFShare) {
            this.selectMDFShare();
          }
          if (this.setSitePath && ((_b4 = this.settings.licenseUser) == null ? void 0 : _b4.userDir)) {
            this.setSitePath(`/s/${this.settings.licenseUser.userDir}`);
          }
          await new Promise((resolve) => setTimeout(resolve, 100));
          if (this.startPreviewAndWait) {
            const previewSuccess = await this.startPreviewAndWait();
            if (!previewSuccess) {
              new import_obsidian20.Notice(this.i18n.t("messages.preview_failed_generic"), 5e3);
              return;
            }
          }
          new import_obsidian20.Notice(this.i18n.t("messages.quick_share_ready"), 3e3);
        } catch (error2) {
          console.error("Quick share failed:", error2);
          new import_obsidian20.Notice(this.i18n.t("messages.quick_share_failed", { error: error2.message }), 5e3);
        }
      }
      initLeaf() {
        var _a6;
        if (this.app.workspace.getLeavesOfType(FRIDAY_SERVER_VIEW_TYPE).length > 0) return;
        (_a6 = this.app.workspace.getRightLeaf(false)) == null ? void 0 : _a6.setViewState({
          type: FRIDAY_SERVER_VIEW_TYPE,
          active: true
        }).then((r) => {
        });
      }
      async onunload() {
        if (this.syncStatusDisplay) {
          this.syncStatusDisplay.onunload();
          this.syncStatusDisplay = null;
        }
        if (this.syncService) {
          await this.syncService.stopSync();
        }
      }
      async loadSettings() {
        this.settings = Object.assign({}, DEFAULT_SETTINGS2, await this.loadData());
        this.previousDownloadServer = this.settings.downloadServer;
        this.initializeDefaultIgnorePatterns();
      }
      /**
       * Initialize default sync settings
       * This ensures selectiveSync and internal patterns are properly set even if user never opened settings
       */
      initializeDefaultIgnorePatterns() {
        var _a6, _b4, _c2;
        if (!this.settings.syncConfig.selectiveSync) {
          this.settings.syncConfig.selectiveSync = {
            syncImages: false,
            syncAudio: false,
            syncVideo: false,
            syncPdf: false,
            syncThemes: false,
            syncSnippets: false,
            syncPlugins: false
          };
        }
        if (!this.settings.syncConfig.ignorePatterns) {
          this.settings.syncConfig.ignorePatterns = [];
        }
        const selectiveSync = this.settings.syncConfig.selectiveSync;
        const defaultInternalPatterns = [
          "\\.obsidian\\/workspace",
          "\\.obsidian\\/workspace\\.json",
          "\\.obsidian\\/workspace-mobile\\.json",
          "\\.obsidian\\/cache",
          "\\/node_modules\\/",
          "\\/\\.git\\/",
          "plugins\\/mdfriday\\/main\\.js",
          "plugins\\/mdfriday\\/styles\\.css",
          "plugins\\/mdfriday\\/manifest\\.json",
          "plugins\\/mdfriday\\/preview",
          "plugins\\/mdfriday\\/themes"
        ];
        let internalPatterns = [...defaultInternalPatterns];
        if (!((_a6 = selectiveSync.syncThemes) != null ? _a6 : true)) {
          internalPatterns.push("\\.obsidian\\/themes");
        }
        if (!((_b4 = selectiveSync.syncSnippets) != null ? _b4 : true)) {
          internalPatterns.push("\\.obsidian\\/snippets");
        }
        if (!((_c2 = selectiveSync.syncPlugins) != null ? _c2 : true)) {
          internalPatterns.push("\\.obsidian\\/plugins");
        }
        if (!this.settings.syncConfig.syncInternalFilesIgnorePatterns) {
          this.settings.syncConfig.syncInternalFilesIgnorePatterns = internalPatterns.join(", ");
        }
      }
      /**
       * Refresh license usage information from API
       * Automatically re-login with license key if token is expired
       */
      async refreshLicenseUsage() {
        if (!this.user || !this.hugoverse) {
          return;
        }
        const hugoverse = this.hugoverse;
        const { license, userToken } = this.settings;
        if (!license || isLicenseExpired(license.expiresAt)) {
          return;
        }
        let currentToken = userToken;
        try {
          const usageResponse = await hugoverse.getLicenseUsage(currentToken, license.key);
          if (usageResponse && usageResponse.disks) {
            const totalDiskUsage = parseFloat(usageResponse.disks.total_disk_usage) || 0;
            const maxStorage = license.features.max_storage || 1024;
            this.settings.licenseUsage = {
              totalDiskUsage,
              maxStorage,
              unit: usageResponse.disks.unit || "MB",
              lastUpdated: Date.now()
            };
            await this.saveData(this.settings);
          }
        } catch (error2) {
          console.error("[Friday] Failed to fetch usage, attempting to refresh token...");
          try {
            const email = licenseKeyToEmail(license.key);
            const password = licenseKeyToPassword(license.key);
            const newToken = await this.user.loginWithCredentials(email, password);
            if (newToken) {
              const usageResponse = await hugoverse.getLicenseUsage(newToken, license.key);
              if (usageResponse && usageResponse.disks) {
                const totalDiskUsage = parseFloat(usageResponse.disks.total_disk_usage) || 0;
                const maxStorage = license.features.max_storage || 1024;
                this.settings.licenseUsage = {
                  totalDiskUsage,
                  maxStorage,
                  unit: usageResponse.disks.unit || "MB",
                  lastUpdated: Date.now()
                };
                await this.saveData(this.settings);
              }
            } else {
              console.warn("[Friday] Failed to refresh token, usage fetch skipped");
            }
          } catch (retryError) {
            console.warn("[Friday] Failed to fetch license usage after token refresh:", retryError);
          }
        }
      }
      /**
       * Get effective subdomain (custom or default from userDir)
       */
      getEffectiveSubdomain() {
        var _a6, _b4, _c2;
        return (_c2 = (_b4 = this.settings.customSubdomain) != null ? _b4 : (_a6 = this.settings.licenseUser) == null ? void 0 : _a6.userDir) != null ? _c2 : "";
      }
      /**
       * Refresh license information from API
       * Called when user clicks on plan badge in settings
       */
      async refreshLicenseInfo() {
        var _a6, _b4, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
        if (!this.hugoverse) {
          return;
        }
        const { license, userToken } = this.settings;
        if (!license || isLicenseExpired(license.expiresAt)) {
          return;
        }
        try {
          const licenseInfo = await this.hugoverse.getLicenseInfo(userToken, license.key);
          if (licenseInfo) {
            this.settings.license = {
              ...license,
              expiresAt: licenseInfo.expires_at || license.expiresAt,
              plan: licenseInfo.plan || license.plan,
              features: {
                max_devices: (_b4 = (_a6 = licenseInfo.features) == null ? void 0 : _a6.max_devices) != null ? _b4 : license.features.max_devices,
                max_ips: (_d = (_c2 = licenseInfo.features) == null ? void 0 : _c2.max_ips) != null ? _d : license.features.max_ips,
                sync_enabled: (_f = (_e = licenseInfo.features) == null ? void 0 : _e.sync_enabled) != null ? _f : license.features.sync_enabled,
                sync_quota: (_h = (_g = licenseInfo.features) == null ? void 0 : _g.sync_quota) != null ? _h : license.features.sync_quota,
                publish_enabled: (_j = (_i = licenseInfo.features) == null ? void 0 : _i.publish_enabled) != null ? _j : license.features.publish_enabled,
                max_sites: (_l = (_k = licenseInfo.features) == null ? void 0 : _k.max_sites) != null ? _l : license.features.max_sites,
                max_storage: (_n = (_m = licenseInfo.features) == null ? void 0 : _m.max_storage) != null ? _n : license.features.max_storage,
                custom_domain: (_p = (_o = licenseInfo.features) == null ? void 0 : _o.custom_domain) != null ? _p : license.features.custom_domain,
                custom_sub_domain: (_r = (_q = licenseInfo.features) == null ? void 0 : _q.custom_sub_domain) != null ? _r : license.features.custom_sub_domain,
                validity_days: (_t = (_s = licenseInfo.features) == null ? void 0 : _s.validity_days) != null ? _t : license.features.validity_days
              }
            };
            await this.saveData(this.settings);
          }
        } catch (error2) {
          console.warn("[Friday] Failed to refresh license info:", error2);
          throw error2;
        }
      }
      /**
       * Refresh subdomain information from API
       * Called when user clicks refresh in settings
       */
      async refreshSubdomainInfo() {
        var _a6;
        if (!this.hugoverse) {
          return;
        }
        const { license, userToken } = this.settings;
        if (!license || isLicenseExpired(license.expiresAt)) {
          return;
        }
        try {
          const domainInfo = await this.hugoverse.getDomains(userToken, license.key);
          if (domainInfo) {
            var updated = false;
            if (domainInfo.subdomain) {
              if (domainInfo.subdomain !== ((_a6 = this.settings.licenseUser) == null ? void 0 : _a6.userDir)) {
                this.settings.customSubdomain = domainInfo.subdomain;
                updated = true;
              }
            }
            if (domainInfo.cus_domain) {
              this.settings.customDomain = domainInfo.cus_domain;
              updated = true;
            }
            if (updated) {
              await this.saveData(this.settings);
            }
          }
        } catch (error2) {
          console.warn("[Friday] Failed to refresh subdomain info:", error2);
        }
      }
      async saveSettings() {
        const downloadServerChanged = this.previousDownloadServer !== this.settings.downloadServer;
        const newApiUrl = GetBaseUrl(this.settings);
        if (this.apiUrl !== newApiUrl) {
          this.apiUrl = newApiUrl;
          if (this.hugoverse) {
            const { Hugoverse: Hugoverse2 } = await Promise.resolve().then(() => (init_hugoverse(), hugoverse_exports));
            this.hugoverse = new Hugoverse2(this);
          }
        }
        await this.saveData(this.settings);
        if (downloadServerChanged && import_obsidian20.Platform.isDesktop && this.themeApiService) {
          this.themeApiService.clearCache();
          this.previousDownloadServer = this.settings.downloadServer;
        }
        if (import_obsidian20.Platform.isDesktop) {
          this.initializeFTP();
        }
      }
      /**
       * Initialize FTP uploader with current settings (desktop only)
       */
      async initializeFTP(preferredSecure) {
        if (!import_obsidian20.Platform.isDesktop) {
          return;
        }
        const { ftpServer, ftpUsername, ftpPassword, ftpRemoteDir, ftpIgnoreCert } = this.settings;
        if (ftpServer && ftpUsername && ftpPassword) {
          const { FTPUploader: FTPUploader2 } = await Promise.resolve().then(() => (init_ftp(), ftp_exports));
          this.ftp = new FTPUploader2({
            server: ftpServer,
            username: ftpUsername,
            password: ftpPassword,
            remoteDir: ftpRemoteDir || "/",
            ignoreCert: ftpIgnoreCert,
            preferredSecure
          });
        } else {
          this.ftp = null;
        }
      }
      /**
       * Initialize Sync Service with current settings
       * 
       * Network monitoring will be started based on the scenario:
       * - First-time upload/download: Started after successful operation
       * - Normal scenarios: Started automatically during initialization
       */
      async initializeSyncService() {
        try {
          if (this.syncStatusDisplay) {
            this.syncStatusDisplay.onunload();
            this.syncStatusDisplay = null;
          }
          this.syncService = new SyncService(this);
          this.syncStatusDisplay = new SyncStatusDisplay(this);
          if (this.settings.syncEnabled && this.settings.syncConfig) {
            const initialized = await this.syncService.initialize(this.settings.syncConfig);
            if (initialized && this.syncService.syncCore && this.syncStatusDisplay) {
              this.syncStatusDisplay.setCore(this.syncService.syncCore);
              this.syncStatusDisplay.initialize();
              this.syncService.syncCore.setStatusDisplay(this.syncStatusDisplay);
              this.syncService.syncCore.setLogCallback((message, level, key4) => {
                var _a6;
                (_a6 = this.syncStatusDisplay) == null ? void 0 : _a6.addLog(message, level, key4);
              });
              if (this.settings.syncConfig.syncOnStart) {
                await this.syncService.startSync(true);
              }
            }
          } else if (this.syncStatusDisplay) {
            this.syncStatusDisplay.initialize();
          }
        } catch (error2) {
          console.error("[Friday] Error initializing sync service:", error2);
        }
      }
      /**
       * Clear sync database (IndexedDB) and related localStorage data to start fresh
       * This is useful when switching to a new vault or re-downloading from cloud
       */
      async clearSyncDatabase() {
        try {
          const vaultName = this.app.vault.getName() || "friday-vault";
          const SuffixDatabaseName2 = "-livesync-v2";
          const indexedDBName = `_pouch_${vaultName}${SuffixDatabaseName2}`;
          this.clearSyncLocalStorage();
          return new Promise((resolve, reject) => {
            const deleteRequest = indexedDB.deleteDatabase(indexedDBName);
            deleteRequest.onsuccess = () => {
              resolve();
            };
            deleteRequest.onerror = (event2) => {
              console.error(`[Friday] Error deleting IndexedDB: ${indexedDBName}`, event2);
              reject(new Error(`Failed to delete database: ${indexedDBName}`));
            };
            deleteRequest.onblocked = () => {
              console.warn(`[Friday] Delete blocked for IndexedDB: ${indexedDBName}`);
              resolve();
            };
          });
        } catch (error2) {
          console.error("[Friday] Error in clearSyncDatabase:", error2);
          throw error2;
        }
      }
      /**
       * Clear sync-related localStorage items
       * This removes cached encryption data like PBKDF2 salt
       */
      clearSyncLocalStorage() {
        try {
          const keysToRemove = [];
          for (let i = 0; i < localStorage.length; i++) {
            const key4 = localStorage.key(i);
            if (key4 && (key4.startsWith("friday-kv-") || key4.startsWith("friday-friday-sync-salt-"))) {
              keysToRemove.push(key4);
            }
          }
          keysToRemove.forEach((key4) => {
            localStorage.removeItem(key4);
          });
        } catch (error2) {
          console.warn("[Friday] Error clearing sync localStorage:", error2);
        }
      }
      /**
       * Test CouchDB Sync connection
       */
      async testSyncConnection() {
        if (!this.syncService || !this.syncService.isInitialized) {
          this.syncService = new SyncService(this);
          await this.syncService.initialize(this.settings.syncConfig);
        }
        return await this.syncService.testConnection();
      }
      /**
       * Test FTP connection (Desktop only)
       */
      async testFTPConnection() {
        if (!import_obsidian20.Platform.isDesktop) {
          return {
            success: false,
            message: "FTP is only available on desktop"
          };
        }
        if (!this.ftp) {
          return {
            success: false,
            message: "FTP not configured"
          };
        }
        try {
          const result = await this.ftp.testConnection();
          if (result.success) {
            const secureInfo = result.usedSecure ? "FTPS" : "FTP (Plain)";
            return {
              success: true,
              message: `Connection successful using ${secureInfo}`
            };
          } else {
            return {
              success: false,
              message: result.error || "Connection failed"
            };
          }
        } catch (error2) {
          return {
            success: false,
            message: error2 instanceof Error ? error2.message : String(error2)
          };
        }
      }
      async status(text3) {
        this.statusBar.setText(text3);
      }
    };
    FridaySettingTab = class extends import_obsidian20.PluginSettingTab {
      constructor(app, plugin2) {
        super(app, plugin2);
        this.isActivating = false;
        this.activationError = "";
        this.firstTimeSync = false;
        this.isRefreshingLicenseInfo = false;
        this.lastLicenseInfoRefresh = 0;
        this.plugin = plugin2;
      }
      /**
       * Format storage size for display
       * @param sizeMB Size in MB
       * @returns Formatted string (e.g. "6.16 MB", "1.5 GB")
       */
      formatStorageSize(sizeMB) {
        if (sizeMB >= 1024) {
          return `${(sizeMB / 1024).toFixed(2)} GB`;
        }
        return `${sizeMB.toFixed(2)} MB`;
      }
      display() {
        const { containerEl } = this;
        containerEl.empty();
        const { license, licenseSync } = this.plugin.settings;
        this.renderLicenseSection(containerEl);
        if (license && (licenseSync == null ? void 0 : licenseSync.enabled)) {
          this.renderSyncSection(containerEl);
          this.renderSecuritySection(containerEl);
        }
        if (import_obsidian20.Platform.isDesktop) {
          this.renderPublishSettings(containerEl);
          this.renderGeneralSettings(containerEl);
        }
        this.renderEnterpriseSettings(containerEl);
      }
      /**
       * Render Publish Settings Section (Desktop only)
       */
      renderPublishSettings(containerEl) {
        var _a6, _b4, _c2;
        const { publishMethod, netlifyAccessToken, netlifyProjectId, ftpServer, ftpUsername, ftpPassword, ftpRemoteDir, ftpIgnoreCert, license, licenseUser, customSubdomain, userToken } = this.plugin.settings;
        containerEl.createEl("h2", { text: this.plugin.i18n.t("settings.publish_settings") });
        let mdfridaySettingsContainer;
        let mdfridayCustomDomainContainer;
        let netlifySettingsContainer;
        let ftpSettingsContainer;
        new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.publish_method")).setDesc(this.plugin.i18n.t("settings.publish_method_desc")).addDropdown((dropdown) => {
          dropdown.addOption("mdfriday", this.plugin.i18n.t("settings.publish_method_mdfriday")).addOption("mdf-custom", this.plugin.i18n.t("settings.publish_method_mdfriday_custom")).addOption("netlify", this.plugin.i18n.t("settings.publish_method_netlify")).addOption("ftp", this.plugin.i18n.t("settings.publish_method_ftp")).setValue(publishMethod || "mdfriday").onChange(async (value2) => {
            this.plugin.settings.publishMethod = value2;
            await this.plugin.saveSettings();
            showPublishSettings(value2);
          });
        });
        mdfridaySettingsContainer = containerEl.createDiv("mdfriday-settings-container");
        mdfridayCustomDomainContainer = containerEl.createDiv("mdfriday-custom-domain-container");
        netlifySettingsContainer = containerEl.createDiv("netlify-settings-container");
        ftpSettingsContainer = containerEl.createDiv("ftp-settings-container");
        const showPublishSettings = (method) => {
          const isMdfriday = method === "mdfriday" || method === "mdf-share" || method === "mdf-app";
          const isMdfridayCustom = method === "mdf-custom";
          mdfridaySettingsContainer.style.display = isMdfriday ? "block" : "none";
          mdfridayCustomDomainContainer.style.display = isMdfridayCustom ? "block" : "none";
          netlifySettingsContainer.style.display = method === "netlify" ? "block" : "none";
          ftpSettingsContainer.style.display = method === "ftp" ? "block" : "none";
        };
        mdfridaySettingsContainer.createEl("h3", { text: this.plugin.i18n.t("settings.mdfriday_app") });
        const hasSubdomainPermission = license && !isLicenseExpired(license.expiresAt) && ((_a6 = license.features) == null ? void 0 : _a6.custom_sub_domain) === true;
        if (hasSubdomainPermission) {
          const effectiveSubdomain = (_b4 = customSubdomain != null ? customSubdomain : licenseUser == null ? void 0 : licenseUser.userDir) != null ? _b4 : "";
          let currentSubdomain = effectiveSubdomain;
          let inputSubdomain = effectiveSubdomain;
          let isChecking = false;
          let isUpdating = false;
          let availabilityStatus = null;
          let statusMessage = "";
          let subdomainInput;
          let checkButton;
          let updateButton;
          let statusEl = null;
          const updateStatusDisplay = () => {
            if (statusEl) {
              statusEl.remove();
              statusEl = null;
            }
            if (availabilityStatus && statusMessage) {
              statusEl = mdfridaySettingsContainer.createDiv({
                cls: `subdomain-status ${availabilityStatus}`,
                text: statusMessage
              });
            }
          };
          const updateButtonStates = () => {
            checkButton.disabled = isChecking || isUpdating || !inputSubdomain.trim() || inputSubdomain === currentSubdomain;
            checkButton.textContent = isChecking ? this.plugin.i18n.t("settings.subdomain_checking") : this.plugin.i18n.t("settings.subdomain_check");
            updateButton.disabled = isUpdating || isChecking || availabilityStatus !== "available" || !inputSubdomain.trim();
            updateButton.textContent = isUpdating ? this.plugin.i18n.t("settings.subdomain_updating") : this.plugin.i18n.t("settings.subdomain_update");
          };
          const validateSubdomain = (subdomain) => {
            var _a7, _b5;
            if (subdomain === currentSubdomain) {
              return { valid: false, message: this.plugin.i18n.t("settings.subdomain_same") };
            }
            const formatResult = validateSubdomainFormat(subdomain);
            if (!formatResult.valid) {
              if ((_a7 = formatResult.error) == null ? void 0 : _a7.includes("at least 4")) {
                return { valid: false, message: this.plugin.i18n.t("settings.subdomain_too_short") };
              }
              if ((_b5 = formatResult.error) == null ? void 0 : _b5.includes("at most 32")) {
                return { valid: false, message: this.plugin.i18n.t("settings.subdomain_too_long") };
              }
              return { valid: false, message: this.plugin.i18n.t("settings.subdomain_invalid_format") };
            }
            if (isReservedSubdomain(subdomain)) {
              return { valid: false, message: this.plugin.i18n.t("settings.subdomain_reserved") };
            }
            return { valid: true };
          };
          const subdomainSetting = new import_obsidian20.Setting(mdfridaySettingsContainer).setName(this.plugin.i18n.t("settings.subdomain_desc")).setDesc(currentSubdomain ? `${currentSubdomain}.mdfriday.com` : "");
          subdomainSetting.addText((text3) => {
            subdomainInput = text3.inputEl;
            text3.setPlaceholder(this.plugin.i18n.t("settings.subdomain_placeholder"));
            text3.setValue(currentSubdomain);
            text3.onChange((value2) => {
              inputSubdomain = value2.toLowerCase().trim();
              text3.setValue(inputSubdomain);
              availabilityStatus = null;
              statusMessage = "";
              updateStatusDisplay();
              updateButtonStates();
              subdomainSetting.setDesc(inputSubdomain ? `${inputSubdomain}.mdfriday.com` : "");
            });
          });
          subdomainSetting.addButton((button) => {
            checkButton = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.subdomain_check")).onClick(async () => {
              var _a7;
              const validation = validateSubdomain(inputSubdomain);
              if (!validation.valid) {
                availabilityStatus = "error";
                statusMessage = validation.message;
                updateStatusDisplay();
                return;
              }
              isChecking = true;
              updateButtonStates();
              try {
                const result = await ((_a7 = this.plugin.hugoverse) == null ? void 0 : _a7.checkSubdomainAvailability(
                  userToken,
                  license.key,
                  inputSubdomain
                ));
                if (result) {
                  availabilityStatus = result.available ? "available" : "unavailable";
                  statusMessage = result.available ? this.plugin.i18n.t("settings.subdomain_available") : this.plugin.i18n.t("settings.subdomain_unavailable");
                } else {
                  availabilityStatus = "error";
                  statusMessage = this.plugin.i18n.t("settings.subdomain_check_failed");
                }
              } catch (error2) {
                availabilityStatus = "error";
                statusMessage = this.plugin.i18n.t("settings.subdomain_check_failed");
              } finally {
                isChecking = false;
                updateStatusDisplay();
                updateButtonStates();
              }
            });
          });
          subdomainSetting.addButton((button) => {
            updateButton = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.subdomain_update")).setCta().onClick(async () => {
              var _a7;
              if (availabilityStatus !== "available") return;
              isUpdating = true;
              updateButtonStates();
              try {
                const result = await ((_a7 = this.plugin.hugoverse) == null ? void 0 : _a7.updateSubdomain(
                  userToken,
                  license.key,
                  inputSubdomain
                ));
                if (result && result.new_subdomain) {
                  currentSubdomain = result.new_subdomain;
                  inputSubdomain = currentSubdomain;
                  subdomainInput.value = currentSubdomain;
                  subdomainSetting.setDesc(`${currentSubdomain}.mdfriday.com`);
                  this.plugin.settings.customSubdomain = result.new_subdomain;
                  await this.plugin.saveSettings();
                  availabilityStatus = null;
                  statusMessage = "";
                  new import_obsidian20.Notice(this.plugin.i18n.t("settings.subdomain_updated"));
                } else {
                  availabilityStatus = "error";
                  statusMessage = this.plugin.i18n.t("settings.subdomain_update_failed", { error: "Unknown error" });
                }
              } catch (error2) {
                availabilityStatus = "error";
                statusMessage = this.plugin.i18n.t("settings.subdomain_update_failed", {
                  error: error2 instanceof Error ? error2.message : String(error2)
                });
              } finally {
                isUpdating = false;
                updateStatusDisplay();
                updateButtonStates();
              }
            });
          });
          updateButtonStates();
        } else {
          new import_obsidian20.Setting(mdfridaySettingsContainer).setName(this.plugin.i18n.t("settings.subdomain_desc")).setDesc(this.plugin.i18n.t("settings.license_required"));
        }
        mdfridayCustomDomainContainer.createEl("h3", { text: this.plugin.i18n.t("settings.mdfriday_custom_domain") });
        const hasCustomDomainPermission = license && !isLicenseExpired(license.expiresAt) && ((_c2 = license.features) == null ? void 0 : _c2.custom_domain) === true;
        if (hasCustomDomainPermission) {
          const { customDomain } = this.plugin.settings;
          let currentDomain = customDomain || "";
          let inputDomain = currentDomain;
          let isChecking = false;
          let isSaving = false;
          let isCheckingHttps = false;
          let checkStatus = null;
          let httpsStatus = null;
          let statusMessage = "";
          let domainInput;
          let checkButton;
          let saveButton;
          let httpsButton;
          let statusEl = null;
          const updateStatusDisplay = () => {
            if (statusEl) {
              statusEl.remove();
              statusEl = null;
            }
            if (statusMessage) {
              const statusClass = checkStatus === "success" ? "subdomain-status available" : checkStatus === "error" ? "subdomain-status error" : httpsStatus === "active" ? "subdomain-status available" : httpsStatus === "pending" ? "subdomain-status unavailable" : httpsStatus === "error" ? "subdomain-status error" : "subdomain-status";
              statusEl = mdfridayCustomDomainContainer.createDiv({
                cls: statusClass,
                text: statusMessage
              });
            }
          };
          const updateButtonStates = () => {
            checkButton.disabled = isChecking || isSaving || !inputDomain.trim();
            checkButton.textContent = isChecking ? this.plugin.i18n.t("settings.domain_checking") : this.plugin.i18n.t("settings.domain_check");
            saveButton.disabled = isSaving || isChecking || checkStatus !== "success";
            saveButton.textContent = isSaving ? this.plugin.i18n.t("settings.domain_saving") : this.plugin.i18n.t("settings.domain_save");
            httpsButton.disabled = isCheckingHttps || !currentDomain.trim();
            httpsButton.textContent = isCheckingHttps ? this.plugin.i18n.t("settings.domain_https_checking") : this.plugin.i18n.t("settings.domain_https_check");
          };
          const domainSetting = new import_obsidian20.Setting(mdfridayCustomDomainContainer).setName(this.plugin.i18n.t("settings.custom_domain_desc")).setDesc(currentDomain ? currentDomain : this.plugin.i18n.t("settings.custom_domain_placeholder"));
          domainSetting.addText((text3) => {
            domainInput = text3.inputEl;
            text3.setPlaceholder("example.com").setValue(currentDomain).onChange((value2) => {
              inputDomain = value2.trim();
              if (inputDomain !== currentDomain) {
                checkStatus = null;
                statusMessage = "";
                updateStatusDisplay();
                updateButtonStates();
              }
            });
            text3.inputEl.style.width = "200px";
          });
          domainSetting.addButton((button) => {
            checkButton = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.domain_check")).onClick(async () => {
              var _a7;
              if (!inputDomain.trim()) return;
              isChecking = true;
              checkStatus = null;
              statusMessage = "";
              updateStatusDisplay();
              updateButtonStates();
              try {
                const result = await ((_a7 = this.plugin.hugoverse) == null ? void 0 : _a7.checkCustomDomain(
                  userToken,
                  license.key,
                  inputDomain
                ));
                if (result && result.dns_valid && result.ready) {
                  checkStatus = "success";
                  statusMessage = result.message || this.plugin.i18n.t("settings.domain_check_success");
                } else {
                  checkStatus = "error";
                  statusMessage = (result == null ? void 0 : result.message) || this.plugin.i18n.t("settings.domain_check_failed");
                }
              } catch (error2) {
                checkStatus = "error";
                statusMessage = this.plugin.i18n.t("settings.domain_check_failed");
              } finally {
                isChecking = false;
                updateStatusDisplay();
                updateButtonStates();
              }
            });
          });
          domainSetting.addButton((button) => {
            saveButton = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.domain_save")).setCta().onClick(async () => {
              var _a7;
              if (checkStatus !== "success") return;
              isSaving = true;
              updateButtonStates();
              try {
                const result = await ((_a7 = this.plugin.hugoverse) == null ? void 0 : _a7.addCustomDomain(
                  userToken,
                  license.key,
                  inputDomain
                ));
                if (result && result.domain) {
                  currentDomain = result.domain;
                  domainSetting.setDesc(currentDomain);
                  this.plugin.settings.customDomain = result.domain;
                  await this.plugin.saveSettings();
                  checkStatus = null;
                  httpsStatus = result.status === "active" ? "active" : "pending";
                  statusMessage = result.message || this.plugin.i18n.t("settings.domain_saved");
                  new import_obsidian20.Notice(this.plugin.i18n.t("settings.domain_saved"));
                } else {
                  statusMessage = this.plugin.i18n.t("settings.domain_save_failed");
                }
              } catch (error2) {
                statusMessage = this.plugin.i18n.t("settings.domain_save_failed");
              } finally {
                isSaving = false;
                updateStatusDisplay();
                updateButtonStates();
              }
            });
          });
          domainSetting.addButton((button) => {
            httpsButton = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.domain_https_check")).onClick(async () => {
              var _a7;
              if (!currentDomain.trim()) return;
              isCheckingHttps = true;
              httpsStatus = null;
              statusMessage = "";
              updateStatusDisplay();
              updateButtonStates();
              try {
                const result = await ((_a7 = this.plugin.hugoverse) == null ? void 0 : _a7.checkCustomDomainHttpsStatus(
                  userToken,
                  license.key,
                  currentDomain
                ));
                if (result) {
                  if (result.status === "active" && result.tls_ready) {
                    httpsStatus = "active";
                    statusMessage = result.message || this.plugin.i18n.t("settings.domain_https_ready");
                  } else if (result.status === "cert_pending") {
                    httpsStatus = "pending";
                    statusMessage = result.message || this.plugin.i18n.t("settings.domain_https_pending");
                  } else {
                    httpsStatus = "error";
                    statusMessage = result.message || this.plugin.i18n.t("settings.domain_https_error");
                  }
                } else {
                  httpsStatus = "error";
                  statusMessage = this.plugin.i18n.t("settings.domain_https_check_failed");
                }
              } catch (error2) {
                httpsStatus = "error";
                statusMessage = this.plugin.i18n.t("settings.domain_https_check_failed");
              } finally {
                isCheckingHttps = false;
                updateStatusDisplay();
                updateButtonStates();
              }
            });
          });
          updateButtonStates();
        } else {
          new import_obsidian20.Setting(mdfridayCustomDomainContainer).setName(this.plugin.i18n.t("settings.custom_domain_desc")).setDesc(this.plugin.i18n.t("settings.upgrade_for_custom_domain"));
        }
        netlifySettingsContainer.createEl("h3", { text: this.plugin.i18n.t("settings.netlify_settings") });
        new import_obsidian20.Setting(netlifySettingsContainer).setName(this.plugin.i18n.t("settings.netlify_access_token")).setDesc(this.plugin.i18n.t("settings.netlify_access_token_desc")).addText((text3) => {
          text3.setPlaceholder(this.plugin.i18n.t("settings.netlify_access_token_placeholder")).setValue(netlifyAccessToken || "").onChange(async (value2) => {
            this.plugin.settings.netlifyAccessToken = value2;
            await this.plugin.saveSettings();
          });
          text3.inputEl.type = "password";
        });
        new import_obsidian20.Setting(netlifySettingsContainer).setName(this.plugin.i18n.t("settings.netlify_project_id")).setDesc(this.plugin.i18n.t("settings.netlify_project_id_desc")).addText(
          (text3) => text3.setPlaceholder(this.plugin.i18n.t("settings.netlify_project_id_placeholder")).setValue(netlifyProjectId || "").onChange(async (value2) => {
            this.plugin.settings.netlifyProjectId = value2;
            await this.plugin.saveSettings();
          })
        );
        ftpSettingsContainer.createEl("h3", { text: this.plugin.i18n.t("settings.ftp_settings") });
        let resetButtonState;
        new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_server")).setDesc(this.plugin.i18n.t("settings.ftp_server_desc")).addText(
          (text3) => text3.setPlaceholder(this.plugin.i18n.t("settings.ftp_server_placeholder")).setValue(ftpServer || "").onChange(async (value2) => {
            this.plugin.settings.ftpServer = value2;
            await this.plugin.saveSettings();
            if (resetButtonState) resetButtonState();
          })
        );
        new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_username")).setDesc(this.plugin.i18n.t("settings.ftp_username_desc")).addText(
          (text3) => text3.setPlaceholder(this.plugin.i18n.t("settings.ftp_username_placeholder")).setValue(ftpUsername || "").onChange(async (value2) => {
            this.plugin.settings.ftpUsername = value2;
            await this.plugin.saveSettings();
            if (resetButtonState) resetButtonState();
          })
        );
        new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_password")).setDesc(this.plugin.i18n.t("settings.ftp_password_desc")).addText((text3) => {
          text3.setPlaceholder(this.plugin.i18n.t("settings.ftp_password_placeholder")).setValue(ftpPassword || "").onChange(async (value2) => {
            this.plugin.settings.ftpPassword = value2;
            await this.plugin.saveSettings();
            if (resetButtonState) resetButtonState();
          });
          text3.inputEl.type = "password";
        });
        new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_remote_dir")).setDesc(this.plugin.i18n.t("settings.ftp_remote_dir_desc")).addText(
          (text3) => text3.setPlaceholder(this.plugin.i18n.t("settings.ftp_remote_dir_placeholder")).setValue(ftpRemoteDir || "").onChange(async (value2) => {
            this.plugin.settings.ftpRemoteDir = value2;
            await this.plugin.saveSettings();
            if (resetButtonState) resetButtonState();
          })
        );
        new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_ignore_cert")).setDesc(this.plugin.i18n.t("settings.ftp_ignore_cert_desc")).addToggle(
          (toggle) => toggle.setValue(ftpIgnoreCert).onChange(async (value2) => {
            this.plugin.settings.ftpIgnoreCert = value2;
            await this.plugin.saveSettings();
            if (resetButtonState) resetButtonState();
          })
        );
        const testConnectionSetting = new import_obsidian20.Setting(ftpSettingsContainer).setName(this.plugin.i18n.t("settings.ftp_test_connection")).setDesc(this.plugin.i18n.t("settings.ftp_test_connection_desc"));
        let testButton;
        let testResultEl = null;
        const isFTPConfigured = () => {
          var _a7, _b5, _c3;
          return !!(((_a7 = this.plugin.settings.ftpServer) == null ? void 0 : _a7.trim()) && ((_b5 = this.plugin.settings.ftpUsername) == null ? void 0 : _b5.trim()) && ((_c3 = this.plugin.settings.ftpPassword) == null ? void 0 : _c3.trim()));
        };
        const updateButtonState = (state2, message) => {
          if (testResultEl) {
            testResultEl.remove();
            testResultEl = null;
          }
          switch (state2) {
            case "idle":
              testButton.textContent = this.plugin.i18n.t("settings.ftp_test_connection");
              testButton.disabled = !isFTPConfigured();
              testButton.removeClass("ftp-test-success", "ftp-test-error");
              break;
            case "testing":
              testButton.textContent = this.plugin.i18n.t("settings.ftp_test_connection_testing");
              testButton.disabled = true;
              testButton.removeClass("ftp-test-success", "ftp-test-error");
              break;
            case "success":
              testButton.textContent = this.plugin.i18n.t("settings.ftp_test_connection_success");
              testButton.disabled = false;
              testButton.removeClass("ftp-test-error");
              testButton.addClass("ftp-test-success");
              if (message) {
                testResultEl = ftpSettingsContainer.createEl("div", {
                  text: `\u2705 ${message}`,
                  cls: "ftp-test-result ftp-test-result-success"
                });
                testConnectionSetting.settingEl.insertAdjacentElement("afterend", testResultEl);
              }
              break;
            case "error":
              testButton.textContent = this.plugin.i18n.t("settings.ftp_test_connection_failed");
              testButton.disabled = false;
              testButton.removeClass("ftp-test-success");
              testButton.addClass("ftp-test-error");
              if (message) {
                testResultEl = ftpSettingsContainer.createEl("div", {
                  text: `\u274C ${message}`,
                  cls: "ftp-test-result ftp-test-result-error"
                });
                testConnectionSetting.settingEl.insertAdjacentElement("afterend", testResultEl);
              }
              break;
          }
        };
        resetButtonState = () => {
          updateButtonState("idle");
        };
        testConnectionSetting.addButton((button) => {
          testButton = button.buttonEl;
          updateButtonState("idle");
          button.onClick(async () => {
            updateButtonState("testing");
            try {
              this.plugin.initializeFTP();
              const result = await this.plugin.testFTPConnection();
              if (result.success) {
                updateButtonState("success", result.message);
              } else {
                updateButtonState("error", result.message);
              }
            } catch (error2) {
              const errorMessage = error2 instanceof Error ? error2.message : String(error2);
              updateButtonState("error", errorMessage);
            }
          });
        });
        showPublishSettings(publishMethod || "mdfriday");
      }
      /**
       * Render General Settings Section (Desktop only)
       */
      renderGeneralSettings(containerEl) {
        const { downloadServer } = this.plugin.settings;
        containerEl.createEl("h2", { text: this.plugin.i18n.t("settings.general_settings") });
        new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.download_server")).setDesc(this.plugin.i18n.t("settings.download_server_desc")).addDropdown((dropdown) => {
          dropdown.addOption("global", this.plugin.i18n.t("settings.download_server_global")).addOption("east", this.plugin.i18n.t("settings.download_server_east")).setValue(downloadServer || "global").onChange(async (value2) => {
            this.plugin.settings.downloadServer = value2;
            await this.plugin.saveSettings();
          });
        });
      }
      /**
       * Render Enterprise Settings Section (All platforms)
       * For enterprise users to configure custom server URL
       */
      renderEnterpriseSettings(containerEl) {
        const { enterpriseServerUrl } = this.plugin.settings;
        containerEl.createEl("h2", { text: this.plugin.i18n.t("settings.enterprise_settings") });
        new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.enterprise_server_url")).setDesc(this.plugin.i18n.t("settings.enterprise_server_url_desc")).addText((text3) => {
          text3.setPlaceholder("https://your-enterprise-server.com").setValue(enterpriseServerUrl || "").onChange(async (value2) => {
            this.plugin.settings.enterpriseServerUrl = value2.trim();
            await this.plugin.saveSettings();
          });
          text3.inputEl.style.width = "100%";
        });
      }
      /**
       * Render License Section
       * Shows license key input when not activated, or license status when activated
       */
      renderLicenseSection(containerEl) {
        const license = this.plugin.settings.license;
        containerEl.createEl("h2", { text: this.plugin.i18n.t("settings.license") });
        if (license && !isLicenseExpired(license.expiresAt)) {
          const licenseKeySetting = new import_obsidian20.Setting(containerEl).setName(maskLicenseKey(license.key)).setDesc(this.plugin.i18n.t("settings.valid_until") + ": " + formatExpirationDate(license.expiresAt));
          const planBadge = licenseKeySetting.controlEl.createSpan({
            cls: `friday-plan-badge ${license.plan.toLowerCase()} clickable`,
            text: formatPlanName(license.plan)
          });
          planBadge.style.cursor = "pointer";
          planBadge.title = this.plugin.i18n.t("settings.click_to_refresh_license_info") || "Click to refresh license info";
          planBadge.addEventListener("click", async () => {
            const now = Date.now();
            if (this.isRefreshingLicenseInfo || now - this.lastLicenseInfoRefresh < 5e3) {
              return;
            }
            this.isRefreshingLicenseInfo = true;
            this.lastLicenseInfoRefresh = now;
            const originalText = planBadge.textContent || "";
            planBadge.textContent = this.plugin.i18n.t("settings.refreshing") || "Refreshing...";
            planBadge.addClass("refreshing");
            try {
              await this.plugin.refreshLicenseInfo();
              await this.plugin.refreshLicenseUsage();
              await this.plugin.refreshSubdomainInfo();
              new import_obsidian20.Notice(this.plugin.i18n.t("settings.license_info_refreshed") || "License info updated");
              this.display();
            } catch (error2) {
              new import_obsidian20.Notice(this.plugin.i18n.t("settings.refresh_failed") || "Failed to refresh license info");
              console.error("Failed to refresh license info:", error2);
              planBadge.textContent = originalText;
              planBadge.removeClass("refreshing");
            } finally {
              this.isRefreshingLicenseInfo = false;
            }
          });
          if (license.plan.toLowerCase() === "free") {
            const pricingBtn = licenseKeySetting.controlEl.createEl("button", {
              cls: "friday-premium-btn",
              text: this.plugin.i18n.t("settings.pricing_details") || "\u5957\u9910\u8BE6\u60C5"
            });
            pricingBtn.addEventListener("click", () => {
              window.open("https://mdfriday.com/pricing.html", "_blank");
            });
          }
          const usage = this.plugin.settings.licenseUsage;
          const usedStorage = (usage == null ? void 0 : usage.totalDiskUsage) || 0;
          const maxStorage = license.features.max_storage || 1024;
          const usagePercentage = maxStorage > 0 ? usedStorage / maxStorage * 100 : 0;
          const storageSetting = new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.storage_usage")).setDesc(this.plugin.i18n.t("settings.storage_usage_desc"));
          const progressContainer = storageSetting.controlEl.createDiv({ cls: "friday-storage-progress-container" });
          const usageText = progressContainer.createDiv({ cls: "friday-storage-usage-text" });
          usageText.setText(this.formatStorageSize(usedStorage) + " / " + this.formatStorageSize(maxStorage));
          const progressBarOuter = progressContainer.createDiv({ cls: "friday-storage-progress-bar" });
          const progressBarInner = progressBarOuter.createDiv({ cls: "friday-storage-progress-fill" });
          progressBarInner.style.width = `${Math.min(usagePercentage, 100).toFixed(1)}%`;
        } else {
          let inputEl;
          let activateBtn;
          let statusEl;
          const licenseSetting = new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.license_key")).setDesc(this.plugin.i18n.t("settings.license_key_placeholder")).addText((text3) => {
            inputEl = text3.inputEl;
            text3.setPlaceholder(this.plugin.i18n.t("settings.license_key_placeholder")).onChange((value2) => {
              text3.setValue(value2.toUpperCase());
            });
          }).addButton((button) => {
            activateBtn = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.activate")).setCta().onClick(async () => {
              const licenseKey = inputEl.value.trim().toUpperCase();
              if (statusEl) {
                statusEl.setText("");
                statusEl.removeClass("friday-license-error", "friday-license-success");
              }
              if (!isValidLicenseKeyFormat(licenseKey)) {
                statusEl.setText(this.plugin.i18n.t("settings.license_invalid_format"));
                statusEl.addClass("friday-license-error");
                return;
              }
              activateBtn.setText(this.plugin.i18n.t("settings.activating"));
              activateBtn.disabled = true;
              inputEl.disabled = true;
              try {
                await this.activateLicense(licenseKey);
                new import_obsidian20.Notice(this.plugin.i18n.t("settings.license_activated_success"));
                this.display();
              } catch (error2) {
                statusEl.setText(this.plugin.i18n.t("settings.license_activation_failed"));
                statusEl.addClass("friday-license-error");
                console.error("License activation error:", error2);
              } finally {
                activateBtn.setText(this.plugin.i18n.t("settings.activate"));
                activateBtn.disabled = false;
                inputEl.disabled = false;
              }
            });
          });
          const pricingBtn = licenseSetting.controlEl.createEl("button", {
            cls: "friday-premium-btn",
            text: this.plugin.i18n.t("settings.pricing_details") || "\u5957\u9910\u8BE6\u60C5"
          });
          pricingBtn.addEventListener("click", () => {
            window.open("https://mdfriday.com/pricing.html", "_blank");
          });
          statusEl = licenseSetting.descEl.createSpan({ cls: "friday-license-status-text" });
          let trialEmailEl;
          let trialRequestBtn;
          let trialStatusEl;
          const trialSetting = new import_obsidian20.Setting(containerEl).setName(this.plugin.i18n.t("settings.trial_license")).setDesc(this.plugin.i18n.t("settings.trial_email")).addText((text3) => {
            trialEmailEl = text3.inputEl;
            text3.setPlaceholder(this.plugin.i18n.t("settings.trial_email_placeholder")).setValue("");
          }).addButton((button) => {
            trialRequestBtn = button.buttonEl;
            button.setButtonText(this.plugin.i18n.t("settings.trial_request")).onClick(async () => {
              const email = trialEmailEl.value.trim();
              if (trialStatusEl) {
                trialStatusEl.setText("");
                trialStatusEl.removeClass("friday-license-error", "friday-license-success");
              }
              const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
              if (!email || !emailRegex.test(email)) {
                trialStatusEl.setText(this.plugin.i18n.t("settings.trial_invalid_email"));
                trialStatusEl.addClass("friday-license-error");
                return;
              }
              trialRequestBtn.setText(this.plugin.i18n.t("settings.trial_requesting"));
              trialRequestBtn.disabled = true;
              trialEmailEl.disabled = true;
              try {
                const result = await this.plugin.hugoverse.requestTrialLicense(email);
                if (result && result.success && result.license_key) {
                  inputEl.value = result.license_key;
                  trialStatusEl.setText(this.plugin.i18n.t("settings.trial_request_success"));
                  trialStatusEl.addClass("friday-license-success");
                  new import_obsidian20.Notice(this.plugin.i18n.t("settings.trial_request_success"));
                  trialEmailEl.value = "";
                } else {
                  throw new Error("Invalid trial response");
                }
              } catch (error2) {
                trialStatusEl.setText(this.plugin.i18n.t("settings.trial_request_failed"));
                trialStatusEl.addClass("friday-license-error");
                console.error("Trial license request error:", error2);
              } finally {
                trialRequestBtn.setText(this.plugin.i18n.t("settings.trial_request"));
                trialRequestBtn.disabled = false;
                trialEmailEl.disabled = false;
              }
            });
          });
          trialStatusEl = trialSetting.descEl.createSpan({ cls: "friday-license-status-text" });
        }
      }
      /**
       * Render Sync Section (only shown when license is activated)
       * Includes Security subsection and Selective Sync subsection
       */
      renderSyncSection(containerEl) {
        var _a6;
        const license = this.plugin.settings.license;
        const licenseSync = this.plugin.settings.licenseSync;
        if (!license || !(licenseSync == null ? void 0 : licenseSync.enabled)) return;
        containerEl.createEl("h2", { text: this.plugin.i18n.t("settings.sync") });
        const securityContainer = containerEl.createDiv("friday-security-container");
        securityContainer.createEl("h3", { text: this.plugin.i18n.t("settings.security") });
        let passwordVisible = false;
        const encryptionPassphrase = this.plugin.settings.encryptionPassphrase;
        if (this.firstTimeSync && encryptionPassphrase) {
          new import_obsidian20.Setting(securityContainer).setName(this.plugin.i18n.t("settings.encryption_password")).setDesc(this.plugin.i18n.t("settings.encryption_enabled")).addText((text3) => {
            text3.inputEl.type = "password";
            text3.inputEl.readOnly = true;
            text3.setValue(encryptionPassphrase);
          }).addButton((button) => {
            button.setButtonText(this.plugin.i18n.t("settings.show_password")).onClick(() => {
              var _a7;
              passwordVisible = !passwordVisible;
              const inputEl = (_a7 = button.buttonEl.parentElement) == null ? void 0 : _a7.querySelector("input");
              if (inputEl) {
                inputEl.type = passwordVisible ? "text" : "password";
              }
              button.setButtonText(
                passwordVisible ? this.plugin.i18n.t("settings.hide_password") : this.plugin.i18n.t("settings.show_password")
              );
            });
          });
        } else {
          new import_obsidian20.Setting(securityContainer).setName(this.plugin.i18n.t("settings.encryption_password")).setDesc(this.plugin.i18n.t("settings.encryption_password_desc")).addText((text3) => {
            text3.inputEl.type = "password";
            text3.inputEl.placeholder = this.plugin.i18n.t("settings.encryption_password_placeholder");
            text3.setValue(encryptionPassphrase || "");
            text3.onChange(async (value2) => {
              this.plugin.settings.encryptionPassphrase = value2;
              this.plugin.settings.syncConfig.passphrase = value2;
              await this.plugin.saveSettings();
            });
          }).addButton((button) => {
            button.setButtonText(this.plugin.i18n.t("settings.show_password")).onClick(() => {
              var _a7;
              passwordVisible = !passwordVisible;
              const inputEl = (_a7 = button.buttonEl.parentElement) == null ? void 0 : _a7.querySelector("input");
              if (inputEl) {
                inputEl.type = passwordVisible ? "text" : "password";
              }
              button.setButtonText(
                passwordVisible ? this.plugin.i18n.t("settings.hide_password") : this.plugin.i18n.t("settings.show_password")
              );
            });
          });
        }
        if (this.firstTimeSync) {
          new import_obsidian20.Setting(securityContainer).setName(this.plugin.i18n.t("settings.sync_first_time_title")).setDesc(this.plugin.i18n.t("settings.sync_description")).addButton((button) => {
            button.setButtonText(this.plugin.i18n.t("settings.upload_local_to_cloud")).setCta().onClick(async () => {
              var _a7;
              button.setButtonText(this.plugin.i18n.t("settings.sync_uploading"));
              button.setDisabled(true);
              try {
                if (!this.plugin.syncService.isInitialized) {
                  await this.plugin.syncService.initialize(this.plugin.settings.syncConfig);
                }
                await this.plugin.syncService.rebuildRemote();
                if ((_a7 = this.plugin.settings.syncConfig) == null ? void 0 : _a7.syncOnStart) {
                  await this.plugin.syncService.startSync(true);
                }
                new import_obsidian20.Notice(this.plugin.i18n.t("settings.sync_upload_success"));
                this.firstTimeSync = false;
                this.display();
              } catch (error2) {
                new import_obsidian20.Notice(this.plugin.i18n.t("settings.sync_operation_failed"));
                button.setButtonText(this.plugin.i18n.t("settings.upload_local_to_cloud"));
                button.setDisabled(false);
              }
            });
          });
        } else {
          new import_obsidian20.Setting(securityContainer).setName(this.plugin.i18n.t("settings.sync_data_available")).setDesc(this.plugin.i18n.t("settings.sync_description")).addButton((button) => {
            button.setButtonText(this.plugin.i18n.t("settings.download_from_cloud")).setCta().onClick(async () => {
              var _a7;
              if (!this.plugin.settings.encryptionPassphrase) {
                new import_obsidian20.Notice(this.plugin.i18n.t("settings.encryption_password_required"));
                return;
              }
              button.setButtonText(this.plugin.i18n.t("settings.sync_downloading"));
              button.setDisabled(true);
              try {
                if ((_a7 = this.plugin.syncService) == null ? void 0 : _a7.isInitialized) {
                  await this.plugin.syncService.close();
                }
                await this.plugin.clearSyncDatabase();
                await this.plugin.initializeSyncService();
                if (this.plugin.syncService.isInitialized) {
                  await this.plugin.syncService.fetchFromServer();
                  new import_obsidian20.Notice(this.plugin.i18n.t("settings.sync_download_success"));
                  this.display();
                } else {
                  throw new Error("Sync service initialization failed");
                }
              } catch (error2) {
                console.error("Download failed:", error2);
                new import_obsidian20.Notice(`${this.plugin.i18n.t("settings.sync_operation_failed")}: ${error2.message || error2}`);
                button.setButtonText(this.plugin.i18n.t("settings.download_from_cloud"));
                button.setDisabled(false);
              }
            });
          });
        }
        const selectiveSyncContainer = containerEl.createDiv("friday-security-container");
        selectiveSyncContainer.createEl("h3", { text: this.plugin.i18n.t("settings.selective_sync") });
        if (!this.plugin.settings.syncConfig.selectiveSync) {
          this.plugin.settings.syncConfig.selectiveSync = {
            syncImages: false,
            syncAudio: false,
            syncVideo: false,
            syncPdf: false,
            syncThemes: false,
            syncSnippets: false,
            syncPlugins: false
          };
        }
        const selectiveSync = this.plugin.settings.syncConfig.selectiveSync;
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_images")).setDesc(this.plugin.i18n.t("settings.sync_images_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncImages) != null ? _a7 : true);
          toggle.onChange(async (value2) => {
            selectiveSync.syncImages = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_audio")).setDesc(this.plugin.i18n.t("settings.sync_audio_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncAudio) != null ? _a7 : false);
          toggle.onChange(async (value2) => {
            selectiveSync.syncAudio = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_video")).setDesc(this.plugin.i18n.t("settings.sync_video_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncVideo) != null ? _a7 : false);
          toggle.onChange(async (value2) => {
            selectiveSync.syncVideo = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_pdf")).setDesc(this.plugin.i18n.t("settings.sync_pdf_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncPdf) != null ? _a7 : false);
          toggle.onChange(async (value2) => {
            selectiveSync.syncPdf = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_themes")).setDesc(this.plugin.i18n.t("settings.sync_themes_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncThemes) != null ? _a7 : true);
          toggle.onChange(async (value2) => {
            selectiveSync.syncThemes = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_snippets")).setDesc(this.plugin.i18n.t("settings.sync_snippets_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncSnippets) != null ? _a7 : true);
          toggle.onChange(async (value2) => {
            selectiveSync.syncSnippets = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.sync_plugins")).setDesc(this.plugin.i18n.t("settings.sync_plugins_desc")).addToggle((toggle) => {
          var _a7;
          toggle.setValue((_a7 = selectiveSync.syncPlugins) != null ? _a7 : true);
          toggle.onChange(async (value2) => {
            selectiveSync.syncPlugins = value2;
            await this.plugin.saveSettings();
            await this.updateSelectiveSyncSettings();
          });
        });
        const currentPatterns = ((_a6 = this.plugin.settings.syncConfig) == null ? void 0 : _a6.ignorePatterns) || [];
        const patternsListContainer = selectiveSyncContainer.createDiv();
        const savePatterns = async () => {
          var _a7;
          const patterns = [];
          const inputs = patternsListContainer.querySelectorAll('input[type="text"]');
          inputs.forEach((input) => {
            const value2 = input.value.trim();
            if (value2) {
              patterns.push(value2);
            }
          });
          this.plugin.settings.syncConfig.ignorePatterns = patterns;
          await this.plugin.saveSettings();
          if ((_a7 = this.plugin.syncService) == null ? void 0 : _a7.isInitialized) {
            this.plugin.syncService.updateIgnorePatterns(patterns);
          }
        };
        const createPatternRow = (pattern = "") => {
          const setting = new import_obsidian20.Setting(patternsListContainer).setDesc(this.plugin.i18n.t("settings.ignore_patterns_custom_rule")).addText((text3) => {
            text3.setPlaceholder(this.plugin.i18n.t("settings.ignore_patterns_placeholder"));
            text3.setValue(pattern);
            text3.onChange(() => savePatterns());
          }).addExtraButton((button) => {
            button.setIcon("trash-2").setTooltip(this.plugin.i18n.t("settings.ignore_patterns_delete")).onClick(() => {
              setting.settingEl.remove();
              savePatterns();
            });
          });
        };
        new import_obsidian20.Setting(selectiveSyncContainer).setName(this.plugin.i18n.t("settings.ignore_patterns")).setDesc(this.plugin.i18n.t("settings.ignore_patterns_desc")).addButton((button) => {
          button.setButtonText(this.plugin.i18n.t("settings.ignore_patterns_add")).onClick(() => {
            createPatternRow("");
          });
        });
        selectiveSyncContainer.appendChild(patternsListContainer);
        currentPatterns.forEach((pattern) => {
          createPatternRow(pattern);
        });
        if (import_obsidian20.Platform.isDesktop) {
          const uiDisplayContainer = containerEl.createDiv("friday-ui-display-container");
          uiDisplayContainer.createEl("h3", { text: "\u663E\u793A\u8BBE\u7F6E" });
          new import_obsidian20.Setting(uiDisplayContainer).setName(this.plugin.i18n.t("settings.show_editor_status")).setDesc(this.plugin.i18n.t("settings.show_editor_status_desc")).addToggle((toggle) => {
            var _a7;
            toggle.setValue((_a7 = this.plugin.settings.showEditorStatusDisplay) != null ? _a7 : false);
            toggle.onChange(async (value2) => {
              this.plugin.settings.showEditorStatusDisplay = value2;
              await this.plugin.saveSettings();
              if (this.plugin.syncStatusDisplay) {
                this.plugin.syncStatusDisplay.applyEditorStatusVisibility();
              }
            });
          });
        }
        this.renderDangerZone(containerEl);
      }
      /**
       * Update selective sync settings
       * 
       * This method handles:
       * 1. selectiveSync: Controls file type sync (images, audio, video, PDF) - directly via settings
       * 2. syncInternalFilesIgnorePatterns: Controls .obsidian folder sync (themes, plugins)
       * 
       * Note: ignorePatterns is separate and only for user-defined patterns (folders, custom rules)
       */
      async updateSelectiveSyncSettings() {
        var _a6, _b4, _c2, _d;
        const selectiveSync = this.plugin.settings.syncConfig.selectiveSync;
        if (!selectiveSync) return;
        const defaultInternalPatterns = [
          "\\.obsidian\\/workspace",
          "\\.obsidian\\/workspace\\.json",
          "\\.obsidian\\/workspace-mobile\\.json",
          "\\.obsidian\\/cache",
          "\\/node_modules\\/",
          "\\/\\.git\\/",
          "plugins\\/mdfriday\\/main\\.js",
          "plugins\\/mdfriday\\/styles\\.css",
          "plugins\\/mdfriday\\/manifest\\.json",
          "plugins\\/mdfriday\\/preview",
          "plugins\\/mdfriday\\/themes"
        ];
        let internalPatterns = [...defaultInternalPatterns];
        if (!((_a6 = selectiveSync.syncThemes) != null ? _a6 : true)) {
          internalPatterns.push("\\.obsidian\\/themes");
        }
        if (!((_b4 = selectiveSync.syncSnippets) != null ? _b4 : true)) {
          internalPatterns.push("\\.obsidian\\/snippets");
        }
        if (!((_c2 = selectiveSync.syncPlugins) != null ? _c2 : true)) {
          internalPatterns.push("\\.obsidian\\/plugins");
        }
        this.plugin.settings.syncConfig.syncInternalFilesIgnorePatterns = internalPatterns.join(", ");
        await this.plugin.saveSettings();
        if ((_d = this.plugin.syncService) == null ? void 0 : _d.isInitialized) {
          this.plugin.syncService.updateSelectiveSync({
            syncImages: selectiveSync.syncImages,
            syncAudio: selectiveSync.syncAudio,
            syncVideo: selectiveSync.syncVideo,
            syncPdf: selectiveSync.syncPdf
          });
          this.plugin.syncService.updateInternalFilesIgnorePatterns(internalPatterns.join(", "));
        }
      }
      /**
       * Render Danger Zone section with reset functionality
       */
      renderDangerZone(containerEl) {
        const dangerZone = containerEl.createDiv("friday-danger-zone");
        dangerZone.createEl("h3", {
          text: this.plugin.i18n.t("settings.danger_zone"),
          cls: "friday-danger-zone-title"
        });
        let resetInput = "";
        let resetButton;
        new import_obsidian20.Setting(dangerZone).setName(this.plugin.i18n.t("settings.reset_sync_title")).setDesc(this.plugin.i18n.t("settings.reset_sync_message")).addText((text3) => {
          text3.inputEl.placeholder = this.plugin.i18n.t("settings.reset_input_placeholder");
          text3.onChange((value2) => {
            resetInput = value2;
            if (resetButton) {
              resetButton.disabled = value2 !== "RESET";
            }
          });
        }).addButton((button) => {
          button.setButtonText(this.plugin.i18n.t("settings.reset_sync_button")).setWarning();
          resetButton = button.buttonEl;
          resetButton.disabled = true;
          resetButton.addEventListener("click", async () => {
            if (resetInput === "RESET" && !resetButton.disabled) {
              resetButton.disabled = true;
              resetButton.textContent = this.plugin.i18n.t("settings.sync_resetting");
              try {
                await this.performReset();
              } catch (error2) {
                resetButton.disabled = false;
                resetButton.textContent = this.plugin.i18n.t("settings.reset_sync_button");
              }
            }
          });
        });
      }
      /**
       * Perform the actual reset operation
       */
      async performReset() {
        var _a6;
        try {
          const { license, userToken } = this.plugin.settings;
          if (!license) {
            throw new Error("No license found");
          }
          await this.plugin.hugoverse.resetUsage(userToken, license.key);
          if ((_a6 = this.plugin.syncService) == null ? void 0 : _a6.isInitialized) {
            await this.plugin.syncService.close();
          }
          clearHandlers();
          await this.plugin.clearSyncDatabase();
          this.plugin.settings.encryptionPassphrase = generateEncryptionPassphrase();
          this.plugin.settings.syncConfig.passphrase = this.plugin.settings.encryptionPassphrase;
          await this.plugin.saveSettings();
          await this.plugin.initializeSyncService();
          this.firstTimeSync = true;
          new import_obsidian20.Notice(this.plugin.i18n.t("settings.reset_sync_success"));
          this.display();
        } catch (error2) {
          console.error("Reset failed:", error2);
          new import_obsidian20.Notice(this.plugin.i18n.t("settings.reset_sync_failed", {
            error: error2 instanceof Error ? error2.message : String(error2)
          }));
        }
      }
      /**
       * Render Security Section - Now integrated into Sync Section
       * This method is kept for backwards compatibility but does nothing
       */
      renderSecuritySection(containerEl) {
      }
      /**
       * Activate license key
       * This is the main license activation flow:
       * 1. Convert license key to email/password
       * 2. Login with credentials
       * 3. Activate license with device info
       * 4. Store license data and configure sync
       */
      async activateLicense(licenseKey) {
        const { getDeviceId: getDeviceId2, getDeviceName: getDeviceName2, getDeviceType: getDeviceType2 } = await Promise.resolve().then(() => (init_license(), license_exports));
        const email = licenseKeyToEmail(licenseKey);
        const password = licenseKeyToPassword(licenseKey);
        const token = await this.plugin.user.loginWithCredentials(email, password);
        if (!token) {
          throw new Error("Login failed");
        }
        const deviceId = await getDeviceId2();
        const deviceName = getDeviceName2();
        const deviceType = getDeviceType2();
        const response = await this.plugin.hugoverse.activateLicense(
          token,
          licenseKey,
          deviceId,
          deviceName,
          deviceType
        );
        if (!response || !response.success) {
          throw new Error("License activation failed");
        }
        this.plugin.settings.license = {
          key: licenseKey,
          plan: response.plan,
          expiresAt: response.expires_at,
          features: response.features,
          activatedAt: Date.now()
        };
        if (response.sync && response.features.sync_enabled) {
          this.plugin.settings.licenseSync = {
            enabled: true,
            endpoint: response.sync.db_endpoint,
            dbName: response.sync.db_name,
            email: response.sync.email,
            dbPassword: response.sync.db_password
          };
          this.plugin.settings.syncEnabled = true;
          this.plugin.settings.syncConfig = {
            ...this.plugin.settings.syncConfig,
            couchDB_URI: response.sync.db_endpoint.replace(`/${response.sync.db_name}`, ""),
            couchDB_DBNAME: response.sync.db_name,
            couchDB_USER: response.sync.email,
            couchDB_PASSWORD: response.sync.db_password,
            encrypt: true,
            syncOnStart: true,
            syncOnSave: true,
            liveSync: true
          };
        }
        if (response.user) {
          this.plugin.settings.licenseUser = {
            email: response.user.email,
            userDir: response.user.user_dir
          };
        }
        if (!this.plugin.settings.encryptionPassphrase && response.first_time) {
          this.plugin.settings.encryptionPassphrase = generateEncryptionPassphrase();
          this.plugin.settings.syncConfig.passphrase = this.plugin.settings.encryptionPassphrase;
        }
        await this.plugin.saveSettings();
        await this.plugin.refreshLicenseUsage();
        this.firstTimeSync = response.first_time;
        if (this.plugin.settings.syncEnabled && response.first_time) {
          await this.plugin.initializeSyncService();
        }
        if (this.plugin.refreshLicenseState) {
          this.plugin.refreshLicenseState();
        }
      }
    };
  }
});
init_main();
/*! Bundled license information:

jszip/dist/jszip.min.js:
  (*!
  
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
  <http://stuartk.com/jszip>
  
  (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
  
  JSZip uses the library pako released under the MIT license :
  https://github.com/nodeca/pako/blob/main/LICENSE
  *)

smol-toml/dist/index.cjs:
  (*!
   * Copyright (c) Squirrel Chat et al., All rights reserved.
   * SPDX-License-Identifier: BSD-3-Clause
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice, this
   *    list of conditions and the following disclaimer.
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the
   *    documentation and/or other materials provided with the distribution.
   * 3. Neither the name of the copyright holder nor the names of its contributors
   *    may be used to endorse or promote products derived from this software without
   *    specific prior written permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *)

workerpool/dist/workerpool.js:
  (**
   * workerpool.js
   * https://github.com/josdejong/workerpool
   *
   * Offload tasks to a pool of workers on node.js and in the browser.
   *
   * @version 10.0.1
   * @date    2025-11-19
   *
   * @license
   * Copyright (C) 2014-2022 Jos de Jong <wjosdejong@gmail.com>
   *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy
   * of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   * License for the specific language governing permissions and limitations under
   * the License.
   *)

chokidar/index.js:
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
*/
