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

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // 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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
var __accessCheck = (obj, member, msg) => {
  if (!member.has(obj))
    throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
  __accessCheck(obj, member, "read from private field");
  return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
  if (member.has(obj))
    throw TypeError("Cannot add the same private member more than once");
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
  __accessCheck(obj, member, "write to private field");
  setter ? setter.call(obj, value) : member.set(obj, value);
  return value;
};
var __privateWrapper = (obj, member, setter, getter) => ({
  set _(value) {
    __privateSet(obj, member, value, setter);
  },
  get _() {
    return __privateGet(obj, member, getter);
  }
});
var __privateMethod = (obj, member, method) => {
  __accessCheck(obj, member, "access private method");
  return method;
};

// node_modules/@obsidian-ai-providers/sdk/dist/index.js
var require_dist = __commonJS({
  "node_modules/@obsidian-ai-providers/sdk/dist/index.js"(exports, module2) {
    var __defProp2 = Object.defineProperty;
    var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
    var __getOwnPropNames2 = Object.getOwnPropertyNames;
    var __hasOwnProp2 = Object.prototype.hasOwnProperty;
    var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
    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 key of __getOwnPropNames2(from))
          if (!__hasOwnProp2.call(to, key) && key !== except)
            __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
      }
      return to;
    };
    var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
    var sdk_exports = {};
    __export2(sdk_exports, {
      initAI: () => initAI2,
      waitForAI: () => waitForAI3
    });
    module2.exports = __toCommonJS2(sdk_exports);
    var import_obsidian4 = require("obsidian");
    var FALLBACK_TIMEOUT = 100;
    var REQUIRED_AI_PROVIDERS_VERSION = 3;
    var AI_PROVIDERS_READY_EVENT = "ai-providers-ready";
    var aiProvidersReadyAiResolver = null;
    async function waitForAIProviders(app, plugin) {
      if (aiProvidersReadyAiResolver) {
        return aiProvidersReadyAiResolver;
      }
      const abortController = new AbortController();
      let aiProvidersReady = /* @__PURE__ */ __name(() => {
      }, "aiProvidersReady");
      const result = {
        promise: new Promise((resolve, reject) => {
          aiProvidersReady = /* @__PURE__ */ __name(() => {
            app.workspace.off(AI_PROVIDERS_READY_EVENT, aiProvidersReady);
            aiProvidersReadyAiResolver = null;
            resolve(app.aiProviders);
          }, "aiProvidersReady");
          if (app.aiProviders) {
            aiProvidersReady();
          } else {
            const eventRef = app.workspace.on(
              AI_PROVIDERS_READY_EVENT,
              aiProvidersReady
            );
            plugin.registerEvent(eventRef);
          }
          abortController.signal.addEventListener("abort", () => {
            app.workspace.off(AI_PROVIDERS_READY_EVENT, aiProvidersReady);
            aiProvidersReadyAiResolver = null;
            reject(new Error("Waiting for AI Providers was cancelled"));
          });
        }),
        cancel: () => abortController.abort()
      };
      if (!app.aiProviders) {
        aiProvidersReadyAiResolver = result;
      }
      return result;
    }
    __name(waitForAIProviders, "waitForAIProviders");
    var _AIProvidersManager = class {
      constructor(app, plugin) {
        this.app = app;
        this.plugin = plugin;
      }
      static getInstance(app, plugin) {
        if (!this.instance) {
          if (!app || !plugin) {
            throw new Error(
              "AIProvidersManager not initialized. Call initialize() first"
            );
          }
          this.instance = new _AIProvidersManager(app, plugin);
        }
        return this.instance;
      }
      static reset() {
        this.instance = null;
      }
      getApp() {
        return this.app;
      }
      getPlugin() {
        return this.plugin;
      }
    };
    var AIProvidersManager = _AIProvidersManager;
    __name(AIProvidersManager, "AIProvidersManager");
    AIProvidersManager.instance = null;
    async function initAI2(app, plugin, onDone, options) {
      AIProvidersManager.getInstance(app, plugin);
      let isFallbackShown = false;
      if (options == null ? void 0 : options.disableFallback) {
        await onDone();
        return;
      }
      try {
        const timeout = setTimeout(async () => {
          plugin.addSettingTab(
            new AIProvidersFallbackSettingsTab(app, plugin)
          );
          isFallbackShown = true;
        }, FALLBACK_TIMEOUT);
        const aiProvidersAiResolver = await waitForAIProviders(app, plugin);
        const aiProviders = await aiProvidersAiResolver.promise;
        clearTimeout(timeout);
        try {
          aiProviders.checkCompatibility(REQUIRED_AI_PROVIDERS_VERSION);
        } catch (error) {
          console.error(`AI Providers compatibility check failed: ${error}`);
          if (error.code === "version_mismatch") {
            plugin.addSettingTab(
              new AIProvidersFallbackSettingsTab(app, plugin)
            );
            throw new Error(
              `AI Providers version ${REQUIRED_AI_PROVIDERS_VERSION} is required`
            );
          }
          throw error;
        }
        await onDone();
      } finally {
        if (isFallbackShown && app.plugins) {
          await app.plugins.disablePlugin(plugin.manifest.id);
          await app.plugins.enablePlugin(plugin.manifest.id);
        }
      }
    }
    __name(initAI2, "initAI");
    async function waitForAI3() {
      const manager = AIProvidersManager.getInstance();
      return waitForAIProviders(manager.getApp(), manager.getPlugin());
    }
    __name(waitForAI3, "waitForAI");
    var AIProvidersFallbackSettingsTab = class extends import_obsidian4.PluginSettingTab {
      constructor(app, plugin) {
        super(app, plugin);
        this.plugin = plugin;
      }
      async display() {
        const { containerEl } = this;
        containerEl.empty();
        const aiProvidersNotice = containerEl.createEl("div");
        aiProvidersNotice.addClass("ai-providers-notice");
        aiProvidersNotice.appendChild(
          (0, import_obsidian4.sanitizeHTMLToDom)(`
            <p>\u26A0\uFE0F This plugin requires <a href="obsidian://show-plugin?id=ai-providers">AI Providers</a> plugin to be installed.</p>
            <p>Please install and configure AI Providers plugin first.</p>
        `)
        );
      }
    };
    __name(AIProvidersFallbackSettingsTab, "AIProvidersFallbackSettingsTab");
  }
});

// src/main.ts
var main_exports = {};
__export(main_exports, {
  default: () => LocalGPT
});
module.exports = __toCommonJS(main_exports);
var import_obsidian3 = require("obsidian");

// src/LocalGPTSettingTab.ts
var import_obsidian = require("obsidian");

// src/defaultSettings.ts
var DEFAULT_SETTINGS = {
  aiProviders: {
    main: null,
    embedding: null,
    vision: null
  },
  defaults: {
    creativity: "low",
    contextLimit: "local"
  },
  actions: [
    {
      name: "\u{1FA84} General help",
      prompt: "",
      system: "You are an assistant helping a user write more content in a document based on a prompt. Output in markdown format. Do not use links. Do not include literal content from the original document."
    },
    {
      name: "\u270D\uFE0F Continue writing",
      prompt: "Act as a professional editor with many years of experience as a writer. Carefully finalize the following text, add details, use facts and make sure that the meaning and original style are preserved. Purposely write in detail, with examples, so that your reader is comfortable, even if they don't understand the specifics. Don't use clericalisms, evaluations without proof with facts, passive voice. Use Markdown markup language for formatting. Answer only content and nothing else, no introductory words, only substance.",
      system: "You are an AI assistant that follows instruction extremely well. Help as much as you can."
    },
    {
      name: "\u{1F36D} Summarize",
      prompt: "Make a concise summary of the key points of the following text.",
      system: "You are an AI assistant that follows instruction extremely well. Help as much as you can."
    },
    {
      name: "\u{1F4D6} Fix spelling and grammar",
      prompt: "Proofread the below for spelling and grammar.",
      system: "You are an AI assistant that follows instruction extremely well. Help as much as you can.",
      replace: true
    },
    {
      name: "\u2705 Find action items",
      prompt: 'Act as an assistant helping find action items inside a document. An action item is an extracted task or to-do found inside of an unstructured document. Use Markdown checkbox format: each line starts with "- [ ] "',
      system: "You are an AI assistant that follows instruction extremely well. Help as much as you can."
    },
    {
      name: "\u{1F9E0} New System Prompt",
      prompt: "",
      system: `You are a highly skilled AI prompt engineer with expertise in creating tailored prompts for a wide range of professional roles. You have a deep knowledge of how to craft prompts that effectively guide the language model to produce high-quality, contextually appropriate responses.

Your task is to generate a custom system prompt for different roles based on user input. This involves understanding the specific requirements of each role, the context in which the prompt will be used, and the desired output format. You are skilled in structuring prompts that ensure clarity, relevance, and utility.

Create a custom system prompt for an LLM to assist users in generating contextually appropriate and highly effective responses for various roles. The prompt should provide clear instructions to the LLM on how to handle specific scenarios related to the role, including the tone and format of the response.

Start by providing a role "You are..." and context as a summary of the situation or background information relevant to the prompt. Define the main objective, outlining what the LLM needs to accomplish.

Include instructions on the appropriate style and tone (e.g., formal, casual, technical, empathetic) based on the role and audience. Identify the target audience to tailor the LLM's output effectively. Specify the format of the response, whether it should be a narrative, bullet points, step-by-step guide, code, or another format. Avoid using headings or examples; the prompt should read as a continuous, cohesive set of instructions.
ANSWER PROMPT AND NOTHING ELSE!`
    }
  ],
  _version: 8
};
var CREATIVITY = {
  "": {
    temperature: 0
  },
  low: {
    temperature: 0.2
  },
  medium: {
    temperature: 0.5
  },
  high: {
    temperature: 1
  }
};
var SELECTION_KEYWORD = "{{=SELECTION=}}";
var CONTEXT_KEYWORD = "{{=CONTEXT=}}";
var CONTEXT_CONDITION_START = "{{=CONTEXT_START=}}";
var CONTEXT_CONDITION_END = "{{=CONTEXT_END=}}";

// src/LocalGPTSettingTab.ts
var import_sdk = __toESM(require_dist());

// src/i18n/de.json
var de_default = {
  commands: {
    showContextMenu: "Kontextmen\xFC anzeigen",
    actionPalette: {
      name: "Aktionspalette",
      placeholder: "Ihr Prompt... | Enter: senden, Esc: abbrechen",
      changeProvider: "KI\u2011Provider wechseln",
      changeModel: "Modell wechseln",
      changeCreativity: "Kreativit\xE4t \xE4ndern",
      changeSystemPrompt: "System-Prompt wechseln",
      unknownModel: "Unbekanntes Modell"
    }
  },
  statusBar: {
    enhancing: "\u2728 Verbessern",
    enhancingWithProgress: "\u2728 Verbessern {{percent}}%"
  },
  notices: {
    errorGenerating: "Fehler bei der Texterzeugung: {{message}}",
    errorProcessingRag: "Fehler bei der Verarbeitung verkn\xFCpfter Dokumente: {{message}}. Fahre mit dem Originaltext fort.",
    importantUpdate: "\uFE0F\u{1F6A8} WICHTIG! Aktualisiere die Local GPT Einstellungen!",
    newVersion: "\u2B06\uFE0F Local GPT: Eine neue Version ist verf\xFCgbar",
    actionNameRequired: "Bitte gib einen Namen f\xFCr die Aktion ein.",
    actionNameExists: 'Eine Aktion mit dem Namen "{{name}}" existiert bereits.',
    actionRewritten: 'Aktion "{{name}}" \xFCberschrieben',
    actionAdded: 'Aktion "{{name}}" hinzugef\xFCgt',
    copied: "Kopiert"
  },
  settings: {
    mainProvider: "Haupt-AI-Provider",
    embeddingProvider: "Embedding AI Provider",
    embeddingProviderDesc: "Optional. Wird f\xFCr \u2728\xA0Erweiterte\xA0Aktionen.",
    visionProvider: "Vision AI Provider",
    visionProviderDesc: "Optional. Dies wird f\xFCr Bilder verwendet. Wenn nicht festgelegt, wird der Haupt-AI-Provider verwendet.",
    creativity: "Kreativit\xE4t",
    creativityNone: "\u26AA Keine",
    creativityLow: "\uFE0F\u{1F4A1} Niedrig",
    creativityMedium: "\u{1F3A8} Mittel",
    creativityHigh: "\u{1F680} Hoch",
    actions: "Aktionen",
    quickAdd: "Schnell hinzuf\xFCgen",
    quickAddPlaceholder: "Aktion einf\xFCgen",
    quickAddDesc: 'Sie k\xF6nnen die besten S\xE4tze von Prompts teilen oder einen <a href="https://github.com/pfrankov/obsidian-local-gpt/discussions/2">aus der Community</a> erhalten.<br/><strong>Wichtig:</strong> Wenn Sie bereits eine Aktion mit demselben Namen haben, wird sie \xFCberschrieben.',
    addNewManually: "Manuell hinzuf\xFCgen",
    actionName: "Aktionsname",
    actionNamePlaceholder: "Auswahl zusammenfassen",
    systemPrompt: "System-Prompt",
    systemPromptDesc: "Optional",
    systemPromptPlaceholder: "Du bist ein hilfreicher Assistent.",
    prompt: "Prompt",
    promptDesc: 'Bitte lesen Sie \xFCber<br/><a href="https://github.com/pfrankov/obsidian-local-gpt/blob/master/docs/prompt-templating.md">Prompt-Vorlagen</a><br/>, wenn Sie Ihre<br/>resultierenden Prompts anpassen m\xF6chten',
    replaceSelected: "Ausgew\xE4hlten Text ersetzen",
    replaceSelectedDesc: "Wenn diese Option aktiviert ist, wird der hervorgehobene Text durch eine Antwort des Modells ersetzt.",
    remove: "Entfernen",
    close: "Schlie\xDFen",
    save: "Speichern",
    actionsList: "Aktionsliste",
    changeOrder: "Reihenfolge \xE4ndern",
    done: "Fertig",
    advancedSettings: "Erweiterte Einstellungen",
    advancedSettingsDesc: "\u2728 Erweiterte Aktionen (RAG), Alle Aktionen zur\xFCcksetzen",
    enhancedActions: "Erweiterte Aktionen",
    enhancedActionsLabel: "RAG\u2011Kontext",
    enhancedActionsDesc: "Mehr Kontext kann die Antwortqualit\xE4t bei leistungsstarken Modellen verbessern, bei schw\xE4cheren jedoch verschlechtern. Gr\xF6\xDFerer Kontext verbraucht au\xDFerdem mehr Tokens und erh\xF6ht die Kosten pro Anfrage (bei kostenpflichtigen Modellen).",
    contextLimitLocal: "Lokale Modelle",
    contextLimitCloud: "Cloud\u2011Modelle",
    contextLimitAdvanced: "Top: GPT, Claude, Gemini",
    contextLimitMax: "Keine Limits (Achtung)",
    dangerZone: "Gefahrenzone",
    resetActions: "Aktionen zur\xFCcksetzen",
    resetActionsDesc: "\u{1F6A8} Setzt alle Aktionen auf die Standardeinstellungen zur\xFCck. Dies kann nicht r\xFCckg\xE4ngig gemacht werden und l\xF6scht alle Ihre benutzerdefinierten Aktionen.",
    reset: "Zur\xFCcksetzen",
    confirmReset: "Zur\xFCcksetzen best\xE4tigen"
  }
};

// src/i18n/en.json
var en_default = {
  commands: {
    showContextMenu: "Show context menu",
    actionPalette: {
      name: "Action Palette",
      placeholder: "Your prompt... | Enter: send, Esc: cancel",
      changeProvider: "Change the AI provider",
      changeModel: "Change the model",
      changeCreativity: "Change creativity",
      changeSystemPrompt: "Change system prompt",
      unknownModel: "Unknown model"
    }
  },
  statusBar: {
    enhancing: "\u2728 Enhancing",
    enhancingWithProgress: "\u2728 Enhancing {{percent}}%"
  },
  notices: {
    errorGenerating: "Error while generating text: {{message}}",
    errorProcessingRag: "Error processing related documents: {{message}}. Continuing with original text.",
    importantUpdate: "\uFE0F\u{1F6A8} IMPORTANT! Update Local GPT settings!",
    newVersion: "\u2B06\uFE0F Local GPT: a new version is available",
    actionNameRequired: "Please enter a name for the action.",
    actionNameExists: 'An action with the name "{{name}}" already exists.',
    actionRewritten: 'Rewritten "{{name}}" action',
    actionAdded: 'Added "{{name}}" action',
    copied: "Copied"
  },
  settings: {
    mainProvider: "Main AI Provider",
    embeddingProvider: "Embedding AI Provider",
    embeddingProviderDesc: "Optional. Used for \u2728\xA0Enhanced\xA0Actions.",
    visionProvider: "Vision AI Provider",
    visionProviderDesc: "Optional. This is used for images. If not set, the main AI provider will be used.",
    creativity: "Creativity",
    creativityNone: "\u26AA None",
    creativityLow: "\uFE0F\u{1F4A1} Low",
    creativityMedium: "\u{1F3A8} Medium",
    creativityHigh: "\u{1F680} High",
    actions: "Actions",
    quickAdd: "Quick add",
    quickAddPlaceholder: "Paste action",
    quickAddDesc: 'You can share the best sets prompts or get one <a href="https://github.com/pfrankov/obsidian-local-gpt/discussions/2">from the community</a>.<br/><strong>Important:</strong> if you already have an action with the same name it will be overwritten.',
    addNewManually: "Add new manually",
    actionName: "Action name",
    actionNamePlaceholder: "Summarize selection",
    systemPrompt: "System prompt",
    systemPromptDesc: "Optional",
    systemPromptPlaceholder: "You are a helpful assistant.",
    prompt: "Prompt",
    promptDesc: 'Please read about<br/><a href="https://github.com/pfrankov/obsidian-local-gpt/blob/master/docs/prompt-templating.md">Prompt templating</a><br/>if you want to customize<br/>your resulting prompts',
    replaceSelected: "Replace selected text",
    replaceSelectedDesc: "If checked, the highlighted text will be replaced with a response from the model.",
    remove: "Remove",
    close: "Close",
    save: "Save",
    actionsList: "Actions list",
    changeOrder: "Change order",
    done: "Done",
    advancedSettings: "Advanced settings",
    advancedSettingsDesc: "\u2728 Enhanced Actions (RAG), Reset all actions",
    enhancedActions: "Enhanced Actions",
    enhancedActionsLabel: "RAG context",
    enhancedActionsDesc: "More context can improve answer quality for powerful models, but may reduce quality for weaker ones. Larger context also consumes more tokens and increases request cost for paid models.",
    contextLimitLocal: "Local models",
    contextLimitCloud: "Cloud models",
    contextLimitAdvanced: "Top: GPT, Claude, Gemini",
    contextLimitMax: "No limits (danger)",
    dangerZone: "Danger zone",
    resetActions: "Reset actions",
    resetActionsDesc: "\u{1F6A8} Reset all actions to the default. This cannot be undone and will delete all your custom actions.",
    reset: "Reset",
    confirmReset: "Confirm reset"
  }
};

// src/i18n/ru.json
var ru_default = {
  commands: {
    showContextMenu: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043D\u043E\u0435 \u043C\u0435\u043D\u044E",
    actionPalette: {
      name: "\u041F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439",
      placeholder: "\u0412\u0430\u0448 \u043F\u0440\u043E\u043C\u043F\u0442... | Enter: \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C, Esc: \u043E\u0442\u043C\u0435\u043D\u0430",
      changeProvider: "\u0421\u043C\u0435\u043D\u0438\u0442\u044C AI\u2011\u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430",
      changeModel: "\u0421\u043C\u0435\u043D\u0438\u0442\u044C \u043C\u043E\u0434\u0435\u043B\u044C",
      changeCreativity: "\u0421\u043C\u0435\u043D\u0438\u0442\u044C \u043A\u0440\u0435\u0430\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C",
      changeSystemPrompt: "\u0421\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u0443\u044E \u0438\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u044E",
      unknownModel: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043C\u043E\u0434\u0435\u043B\u044C"
    }
  },
  statusBar: {
    enhancing: "\u2728 \u0423\u043B\u0443\u0447\u0448\u0435\u043D\u0438\u0435",
    enhancingWithProgress: "\u2728 \u0423\u043B\u0443\u0447\u0448\u0435\u043D\u0438\u0435 {{percent}}%"
  },
  notices: {
    errorGenerating: "\u041E\u0448\u0438\u0431\u043A\u0430 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043A\u0441\u0442\u0430: {{message}}",
    errorProcessingRag: "\u041E\u0448\u0438\u0431\u043A\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0445 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432: {{message}}. \u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u044E \u0441 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u043C \u0442\u0435\u043A\u0441\u0442\u043E\u043C.",
    importantUpdate: "\uFE0F\u{1F6A8} \u0412\u0410\u0416\u041D\u041E! \u041E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 Local GPT!",
    newVersion: "\u2B06\uFE0F Local GPT: \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043D\u043E\u0432\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",
    actionNameRequired: "\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u043B\u044F \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F.",
    actionNameExists: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\u043C \xAB{{name}}\xBB \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.",
    actionRewritten: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \xAB{{name}}\xBB \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E",
    actionAdded: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \xAB{{name}}\xBB \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E",
    copied: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E"
  },
  settings: {
    mainProvider: "\u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 AI-\u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440",
    embeddingProvider: "\u041F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u043B\u044F \u044D\u043C\u0431\u0435\u0434\u0434\u0438\u043D\u0433\u043E\u0432",
    embeddingProviderDesc: "\u041E\u043F\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u2728\xA0\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0445\xA0\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.",
    visionProvider: "\u041F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u043B\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439",
    visionProviderDesc: "\u041E\u043F\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E. \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u0440\u0430\u0431\u043E\u0442\u044B \u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u043C\u0438. \u0415\u0441\u043B\u0438 \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 AI-\u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440.",
    creativity: "\u041A\u0440\u0435\u0430\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C",
    creativityNone: "\u26AA \u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442",
    creativityLow: "\uFE0F\u{1F4A1} \u041D\u0438\u0437\u043A\u0430\u044F",
    creativityMedium: "\u{1F3A8} \u0421\u0440\u0435\u0434\u043D\u044F\u044F",
    creativityHigh: "\u{1F680} \u0412\u044B\u0441\u043E\u043A\u0430\u044F",
    actions: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
    quickAdd: "\u0411\u044B\u0441\u0442\u0440\u043E\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
    quickAddPlaceholder: "\u0412\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0433\u043E\u0442\u043E\u0432\u043E\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435",
    quickAddDesc: '\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F \u0441\u0432\u043E\u0438\u043C\u0438 \u043D\u0430\u0431\u043E\u0440\u0430\u043C\u0438 \u043F\u0440\u043E\u043C\u043F\u0442\u043E\u0432 \u0438\u043B\u0438 \u043D\u0430\u0439\u0442\u0438 \u043D\u043E\u0432\u044B\u0435 \u0432 <a href="https://github.com/pfrankov/obsidian-local-gpt/discussions/2">\u0441\u043E\u043E\u0431\u0449\u0435\u0441\u0442\u0432\u0435</a>.<br/><strong>\u0412\u0430\u0436\u043D\u043E:</strong> \u0435\u0441\u043B\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0442\u0430\u043A\u0438\u043C \u0436\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\u043C, \u043E\u043D\u043E \u0431\u0443\u0434\u0435\u0442 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.',
    addNewManually: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432\u0440\u0443\u0447\u043D\u0443\u044E",
    actionName: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
    actionNamePlaceholder: "\u041A\u0440\u0430\u0442\u043A\u043E \u043F\u0435\u0440\u0435\u0441\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u043E\u0435",
    systemPrompt: "\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u0430\u044F \u0438\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u044F",
    systemPromptDesc: "\u041E\u043F\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E",
    systemPromptPlaceholder: "\u0412\u044B \u2014 \u043F\u043E\u043B\u0435\u0437\u043D\u044B\u0439 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442.",
    prompt: "\u041F\u0440\u043E\u043C\u043F\u0442",
    promptDesc: '\u0423\u0437\u043D\u0430\u0439\u0442\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u043E <a href="https://github.com/pfrankov/obsidian-local-gpt/blob/master/docs/prompt-templating.md">\u0448\u0430\u0431\u043B\u043E\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u0440\u043E\u043C\u043F\u0442\u043E\u0432</a>, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C \u0438\u0445 \u043F\u043E\u0434 \u0441\u0435\u0431\u044F.',
    replaceSelected: "\u0417\u0430\u043C\u0435\u043D\u044F\u0442\u044C \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442",
    replaceSelectedDesc: "\u0415\u0441\u043B\u0438 \u043E\u043F\u0446\u0438\u044F \u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0430, \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043C\u0435\u043D\u0451\u043D \u043E\u0442\u0432\u0435\u0442\u043E\u043C \u043E\u0442 \u043C\u043E\u0434\u0435\u043B\u0438.",
    remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
    close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
    save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
    actionsList: "\u0421\u043F\u0438\u0441\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439",
    changeOrder: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0440\u044F\u0434\u043E\u043A",
    done: "\u0413\u043E\u0442\u043E\u0432\u043E",
    advancedSettings: "\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438",
    advancedSettingsDesc: "\u2728 \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F (RAG), \u0421\u0431\u0440\u043E\u0441 \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439",
    enhancedActions: "\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
    enhancedActionsLabel: "RAG\u2011\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442",
    enhancedActionsDesc: "\u0427\u0435\u043C \u0431\u043E\u043B\u044C\u0448\u0435 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u2014 \u0442\u0435\u043C \u0432\u044B\u0448\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0442\u0432\u0435\u0442\u0430 \u0443 \u043C\u043E\u0449\u043D\u044B\u0445 \u043C\u043E\u0434\u0435\u043B\u0435\u0439, \u043D\u043E \u043D\u0438\u0436\u0435 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u043E \u0443 \u0441\u043B\u0430\u0431\u044B\u0445. \u0411\u043E\u043B\u044C\u0448\u043E\u0439 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u0442\u0430\u043A\u0436\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u0443\u0435\u0442 \u0431\u043E\u043B\u044C\u0448\u0435 \u0442\u043E\u043A\u0435\u043D\u043E\u0432 \u0438 \u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0434\u043B\u044F \u043F\u043B\u0430\u0442\u043D\u044B\u0445 \u043C\u043E\u0434\u0435\u043B\u0435\u0439.",
    contextLimitLocal: "\u041B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",
    contextLimitCloud: "\u041E\u0431\u043B\u0430\u0447\u043D\u044B\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",
    contextLimitAdvanced: "\u0422\u043E\u043F: GPT, Claude, Gemini",
    contextLimitMax: "\u0411\u0435\u0437 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u0439 (\u043E\u043F\u0430\u0441\u043D\u043E)",
    dangerZone: "\u041E\u043F\u0430\u0441\u043D\u0430\u044F \u0437\u043E\u043D\u0430",
    resetActions: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
    resetActionsDesc: "\u{1F6A8} \u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0434\u043E \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0445. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E \u0438 \u0443\u0434\u0430\u043B\u0438\u0442 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u043A\u0430\u0441\u0442\u043E\u043C\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F.",
    reset: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C",
    confirmReset: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0441\u0431\u0440\u043E\u0441"
  }
};

// src/i18n/zh.json
var zh_default = {
  commands: {
    showContextMenu: "\u663E\u793A\u4E0A\u4E0B\u6587\u83DC\u5355",
    actionPalette: {
      name: "\u52A8\u4F5C\u9762\u677F",
      placeholder: "\u60A8\u7684\u63D0\u793A... | Enter: \u53D1\u9001, Esc: \u53D6\u6D88",
      changeProvider: "\u5207\u6362 AI \u63D0\u4F9B\u5546",
      changeModel: "\u5207\u6362\u6A21\u578B",
      changeCreativity: "\u66F4\u6539\u521B\u9020\u529B",
      changeSystemPrompt: "\u66F4\u6539\u7CFB\u7EDF\u63D0\u793A",
      unknownModel: "\u672A\u77E5\u6A21\u578B"
    }
  },
  statusBar: {
    enhancing: "\u2728 \u589E\u5F3A\u4E2D",
    enhancingWithProgress: "\u2728 \u589E\u5F3A\u4E2D {{percent}}%"
  },
  notices: {
    errorGenerating: "\u751F\u6210\u6587\u672C\u65F6\u51FA\u9519: {{message}}",
    errorProcessingRag: "\u5904\u7406\u76F8\u5173\u6587\u6863\u65F6\u51FA\u9519: {{message}}\u3002\u5C06\u7EE7\u7EED\u4F7F\u7528\u539F\u59CB\u6587\u672C\u3002",
    importantUpdate: "\uFE0F\u{1F6A8} \u91CD\u8981\u63D0\u793A\uFF01\u8BF7\u66F4\u65B0 Local GPT \u8BBE\u7F6E\uFF01",
    newVersion: "\u2B06\uFE0F Local GPT: \u65B0\u7248\u672C\u53EF\u7528",
    actionNameRequired: "\u8BF7\u8F93\u5165\u64CD\u4F5C\u540D\u79F0\u3002",
    actionNameExists: '\u540D\u4E3A"{{name}}"\u7684\u64CD\u4F5C\u5DF2\u5B58\u5728\u3002',
    actionRewritten: '\u5DF2\u91CD\u5199\u64CD\u4F5C"{{name}}"',
    actionAdded: '\u5DF2\u6DFB\u52A0\u64CD\u4F5C"{{name}}"',
    copied: "\u5DF2\u590D\u5236"
  },
  settings: {
    mainProvider: "\u4E3B\u8981AI\u63D0\u4F9B\u5546",
    embeddingProvider: "\u5D4C\u5165AI\u63D0\u4F9B\u5546",
    embeddingProviderDesc: "\u53EF\u9009\u3002\u7528\u4E8E\u2728\u589E\u5F3A\u64CD\u4F5C\u3002",
    visionProvider: "\u89C6\u89C9AI\u63D0\u4F9B\u5546",
    visionProviderDesc: "\u53EF\u9009\u3002\u6B64\u9009\u9879\u7528\u4E8E\u56FE\u7247\u3002\u5982\u679C\u672A\u8BBE\u7F6E\uFF0C\u5C06\u4F7F\u7528\u4E3B\u8981\u7684AI\u63D0\u4F9B\u5546\u3002",
    creativity: "\u521B\u9020\u529B",
    creativityNone: "\u26AA \u65E0",
    creativityLow: "\uFE0F\u{1F4A1} \u4F4E",
    creativityMedium: "\u{1F3A8} \u4E2D",
    creativityHigh: "\u{1F680} \u9AD8",
    actions: "\u64CD\u4F5C",
    quickAdd: "\u5FEB\u901F\u6DFB\u52A0",
    quickAddPlaceholder: "\u7C98\u8D34\u64CD\u4F5C",
    quickAddDesc: '\u60A8\u53EF\u4EE5\u5206\u4EAB\u6700\u4F73\u7684\u63D0\u793A\u96C6\uFF0C\u6216\u4ECE<a href="https://github.com/pfrankov/obsidian-local-gpt/discussions/2">\u793E\u533A</a>\u83B7\u53D6\u4E00\u4E2A\u3002<br/><strong>\u91CD\u8981\u63D0\u793A:</strong> \u5982\u679C\u60A8\u5DF2\u7ECF\u6709\u4E00\u4E2A\u540C\u540D\u64CD\u4F5C\uFF0C\u5B83\u5C06\u88AB\u8986\u76D6\u3002',
    addNewManually: "\u624B\u52A8\u6DFB\u52A0",
    actionName: "\u64CD\u4F5C\u540D\u79F0",
    actionNamePlaceholder: "\u603B\u7ED3\u9009\u62E9",
    systemPrompt: "\u7CFB\u7EDF\u63D0\u793A",
    systemPromptDesc: "\u53EF\u9009",
    systemPromptPlaceholder: "\u4F60\u662F\u4E00\u4E2A\u4E50\u4E8E\u52A9\u4EBA\u7684\u52A9\u624B\u3002",
    prompt: "\u63D0\u793A",
    promptDesc: '\u5982\u679C\u60A8\u60F3\u81EA\u5B9A\u4E49<br/>\u60A8\u7684\u7ED3\u679C\u63D0\u793A\uFF0C<br/>\u8BF7\u9605\u8BFB<a href="https://github.com/pfrankov/obsidian-local-gpt/blob/master/docs/prompt-templating.md">\u63D0\u793A\u6A21\u677F</a>',
    replaceSelected: "\u66FF\u6362\u9009\u5B9A\u7684\u6587\u672C",
    replaceSelectedDesc: "\u5982\u679C\u9009\u4E2D\uFF0C\u7A81\u51FA\u663E\u793A\u7684\u6587\u672C\u5C06\u88AB\u6A21\u578B\u7684\u54CD\u5E94\u66FF\u6362\u3002",
    remove: "\u5220\u9664",
    close: "\u5173\u95ED",
    save: "\u4FDD\u5B58",
    actionsList: "\u64CD\u4F5C\u5217\u8868",
    changeOrder: "\u66F4\u6539\u987A\u5E8F",
    done: "\u5B8C\u6210",
    advancedSettings: "\u9AD8\u7EA7\u8BBE\u7F6E",
    advancedSettingsDesc: "\u2728 \u589E\u5F3A\u64CD\u4F5C\uFF08RAG\uFF09\u3001\u91CD\u7F6E\u6240\u6709\u64CD\u4F5C",
    enhancedActions: "\u589E\u5F3A\u64CD\u4F5C",
    enhancedActionsLabel: "RAG \u4E0A\u4E0B\u6587",
    enhancedActionsDesc: "\u66F4\u591A\u4E0A\u4E0B\u6587\u53EF\u63D0\u5347\u5F3A\u5927\u6A21\u578B\u7684\u7B54\u6848\u8D28\u91CF\uFF0C\u4F46\u53EF\u80FD\u964D\u4F4E\u8F83\u5F31\u6A21\u578B\u7684\u8D28\u91CF\u3002\u66F4\u5927\u7684\u4E0A\u4E0B\u6587\u4E5F\u4F1A\u6D88\u8017\u66F4\u591A Token\uFF0C\u5E76\u63D0\u9AD8\u6BCF\u6B21\u8BF7\u6C42\u6210\u672C\uFF08\u5BF9\u4ED8\u8D39\u6A21\u578B\u800C\u8A00\uFF09\u3002",
    contextLimitLocal: "\u672C\u5730\u6A21\u578B",
    contextLimitCloud: "\u4E91\u7AEF\u6A21\u578B",
    contextLimitAdvanced: "\u9876\u7EA7\uFF1AGPT\u3001Claude\u3001Gemini",
    contextLimitMax: "\u65E0\u9650\u5236\uFF08\u6CE8\u610F\uFF09",
    dangerZone: "\u5371\u9669\u533A\u57DF",
    resetActions: "\u91CD\u7F6E\u64CD\u4F5C",
    resetActionsDesc: "\u{1F6A8} \u5C06\u6240\u6709\u64CD\u4F5C\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\uFF0C\u5E76\u5C06\u5220\u9664\u6240\u6709\u60A8\u7684\u81EA\u5B9A\u4E49\u64CD\u4F5C\u3002",
    reset: "\u91CD\u7F6E",
    confirmReset: "\u786E\u8BA4\u91CD\u7F6E"
  }
};

// src/logger.ts
var Logger = class {
  constructor() {
    this.logLevel = 0 /* DEBUG */;
    this.timers = /* @__PURE__ */ new Map();
    this.colorIndex = 0;
    this.colors = [
      "#FFB3BA",
      "#BAFFC9",
      "#BAE1FF",
      "#FFFFBA",
      "#FFDFBA",
      "#E0BBE4"
    ];
    this.isDevMode = false;
  }
  static getInstance() {
    if (!Logger.instance) {
      Logger.instance = new Logger();
    }
    return Logger.instance;
  }
  setLogLevel(level) {
    this.logLevel = level;
  }
  logWithEmoji(level, message, ...args) {
    if (this.isDevMode && level >= this.logLevel) {
      const emoji = this.getEmojiForLevel(level);
      if (args.length === 0) {
        console.log(`${emoji} %c${message}`, "font-weight: bold;");
      } else {
        console.group(`${emoji} %c${message}`, "font-weight: bold;");
        this.logArgs(args);
        console.groupEnd();
      }
    }
  }
  logArgs(args) {
    args.forEach((arg) => {
      console.log(arg);
    });
  }
  getEmojiForLevel(level) {
    switch (level) {
      case 0 /* DEBUG */:
        return "\u{1F41B}";
      case 1 /* INFO */:
        return "\u2139\uFE0F";
      case 2 /* WARN */:
        return "\u26A0\uFE0F";
      case 3 /* ERROR */:
        return "\u{1F6AB}";
      case 4 /* SUCCESS */:
        return "\u2705";
      default:
        return "";
    }
  }
  debug(message, ...args) {
    this.logWithEmoji(0 /* DEBUG */, message, ...args);
  }
  info(message, ...args) {
    this.logWithEmoji(1 /* INFO */, message, ...args);
  }
  warn(message, ...args) {
    this.logWithEmoji(2 /* WARN */, message, ...args);
  }
  error(message, ...args) {
    this.logWithEmoji(3 /* ERROR */, message, ...args);
  }
  success(message, ...args) {
    this.logWithEmoji(4 /* SUCCESS */, message, ...args);
  }
  table(message, ...args) {
    if (this.isDevMode && this.logLevel <= 0 /* DEBUG */) {
      console.group(`\u{1F4CA} %c${message}`, "font-weight: bold;");
      this.logNestedGroups(args);
      console.groupEnd();
    }
  }
  logNestedGroups(args) {
    args.forEach((arg) => {
      if (typeof arg === "object" && arg !== null) {
        this.logObjectAsGroups(arg);
      } else {
        console.log(arg);
      }
    });
  }
  logObjectAsGroups(obj) {
    Object.entries(obj).forEach(([key, value]) => {
      if (typeof value === "object" && value !== null) {
        console.group(`${key}:`);
        this.logObjectAsGroups(value);
        console.groupEnd();
      } else {
        console.log(`${key}: ${value}`);
      }
    });
  }
  time(label) {
    if (this.isDevMode && this.logLevel <= 0 /* DEBUG */) {
      const color = this.getNextColor();
      this.timers.set(label, { startTime: performance.now(), color });
      console.log(
        `\u23F1\uFE0F %c${label}: timer started`,
        `color: black; font-weight: bold; background-color: ${color}; padding: 2px 5px; border-radius: 3px;`
      );
    }
  }
  timeEnd(label) {
    if (this.isDevMode && this.logLevel <= 0 /* DEBUG */) {
      const timerData = this.timers.get(label);
      if (timerData) {
        const duration = performance.now() - timerData.startTime;
        console.log(
          `\u23F1\uFE0F %c${label}: ${duration.toFixed(2)}ms`,
          `color: black; font-weight: bold; background-color: ${timerData.color}; padding: 2px 5px; border-radius: 3px;`
        );
        this.timers.delete(label);
      } else {
        console.warn(`Timer '${label}' does not exist`);
      }
    }
  }
  getNextColor() {
    const color = this.colors[this.colorIndex];
    this.colorIndex = (this.colorIndex + 1) % this.colors.length;
    return color;
  }
  // Добавляем новый метод для создания разделителя
  separator(message = "") {
    if (this.isDevMode) {
      const lineLength = 20;
      const line = "\u2501".repeat(lineLength);
      const paddedMessage = message ? ` ${message} ` : "";
      const leftPadding = Math.floor(
        (lineLength - paddedMessage.length) / 2
      );
      const rightPadding = lineLength - paddedMessage.length - leftPadding;
      const separatorLine = message ? line.slice(0, leftPadding) + paddedMessage + line.slice(lineLength - rightPadding) : line;
      console.log(
        "\n%c" + separatorLine,
        "color: #FF4500; font-weight: bold; font-size: 1.2em;"
      );
    }
  }
};
var logger = Logger.getInstance();

// src/i18n/index.ts
var locales = {
  en: en_default,
  ru: ru_default,
  de: de_default,
  zh: zh_default
};
var I18n = class {
  static t(key, params) {
    const locale = window.localStorage.getItem("language") || "en";
    const keys = key.split(".");
    let translations = locales[locale] || locales["en"];
    for (const k of keys) {
      if ((translations == null ? void 0 : translations[k]) === void 0) {
        logger.warn(`Translation missing: ${key}`);
        translations = locales["en"];
        let engValue = translations;
        for (const ek of keys) {
          engValue = engValue == null ? void 0 : engValue[ek];
        }
        return engValue || key;
      }
      translations = translations[k];
    }
    let result = translations;
    if (params) {
      Object.entries(params).forEach(([key2, value]) => {
        result = result.replace(`{{${key2}}}`, value);
      });
    }
    return result;
  }
};

// node_modules/sortablejs/modular/sortable.esm.js
function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
    }
    keys.push.apply(keys, symbols);
  }
  return keys;
}
function _objectSpread2(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    if (i % 2) {
      ownKeys(Object(source), true).forEach(function(key) {
        _defineProperty(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }
  return target;
}
function _typeof(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof = function(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof(obj);
}
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function _extends() {
  _extends = Object.assign || function(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source);
  var key, i;
  for (i = 0; i < sourceKeys.length; i++) {
    key = sourceKeys[i];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source[key];
  }
  return target;
}
function _objectWithoutProperties(source, excluded) {
  if (source == null)
    return {};
  var target = _objectWithoutPropertiesLoose(source, excluded);
  var key, i;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
    for (i = 0; i < sourceSymbolKeys.length; i++) {
      key = sourceSymbolKeys[i];
      if (excluded.indexOf(key) >= 0)
        continue;
      if (!Object.prototype.propertyIsEnumerable.call(source, key))
        continue;
      target[key] = source[key];
    }
  }
  return target;
}
var version = "1.15.6";
function userAgent(pattern) {
  if (typeof window !== "undefined" && window.navigator) {
    return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
  }
}
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
var Edge = userAgent(/Edge/i);
var FireFox = userAgent(/firefox/i);
var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
var IOS = userAgent(/iP(ad|od|hone)/i);
var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
var captureMode = {
  capture: false,
  passive: false
};
function on(el, event, fn) {
  el.addEventListener(event, fn, !IE11OrLess && captureMode);
}
function off(el, event, fn) {
  el.removeEventListener(event, fn, !IE11OrLess && captureMode);
}
function matches(el, selector) {
  if (!selector)
    return;
  selector[0] === ">" && (selector = selector.substring(1));
  if (el) {
    try {
      if (el.matches) {
        return el.matches(selector);
      } else if (el.msMatchesSelector) {
        return el.msMatchesSelector(selector);
      } else if (el.webkitMatchesSelector) {
        return el.webkitMatchesSelector(selector);
      }
    } catch (_) {
      return false;
    }
  }
  return false;
}
function getParentOrHost(el) {
  return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
}
function closest(el, selector, ctx, includeCTX) {
  if (el) {
    ctx = ctx || document;
    do {
      if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
        return el;
      }
      if (el === ctx)
        break;
    } while (el = getParentOrHost(el));
  }
  return null;
}
var R_SPACE = /\s+/g;
function toggleClass(el, name, state) {
  if (el && name) {
    if (el.classList) {
      el.classList[state ? "add" : "remove"](name);
    } else {
      var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " ");
      el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " ");
    }
  }
}
function css(el, prop, val) {
  var style = el && el.style;
  if (style) {
    if (val === void 0) {
      if (document.defaultView && document.defaultView.getComputedStyle) {
        val = document.defaultView.getComputedStyle(el, "");
      } else if (el.currentStyle) {
        val = el.currentStyle;
      }
      return prop === void 0 ? val : val[prop];
    } else {
      if (!(prop in style) && prop.indexOf("webkit") === -1) {
        prop = "-webkit-" + prop;
      }
      style[prop] = val + (typeof val === "string" ? "" : "px");
    }
  }
}
function matrix(el, selfOnly) {
  var appliedTransforms = "";
  if (typeof el === "string") {
    appliedTransforms = el;
  } else {
    do {
      var transform = css(el, "transform");
      if (transform && transform !== "none") {
        appliedTransforms = transform + " " + appliedTransforms;
      }
    } while (!selfOnly && (el = el.parentNode));
  }
  var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  return matrixFn && new matrixFn(appliedTransforms);
}
function find(ctx, tagName, iterator) {
  if (ctx) {
    var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
    if (iterator) {
      for (; i < n; i++) {
        iterator(list[i], i);
      }
    }
    return list;
  }
  return [];
}
function getWindowScrollingElement() {
  var scrollingElement = document.scrollingElement;
  if (scrollingElement) {
    return scrollingElement;
  } else {
    return document.documentElement;
  }
}
function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
  if (!el.getBoundingClientRect && el !== window)
    return;
  var elRect, top, left, bottom, right, height, width;
  if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
    elRect = el.getBoundingClientRect();
    top = elRect.top;
    left = elRect.left;
    bottom = elRect.bottom;
    right = elRect.right;
    height = elRect.height;
    width = elRect.width;
  } else {
    top = 0;
    left = 0;
    bottom = window.innerHeight;
    right = window.innerWidth;
    height = window.innerHeight;
    width = window.innerWidth;
  }
  if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
    container = container || el.parentNode;
    if (!IE11OrLess) {
      do {
        if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) {
          var containerRect = container.getBoundingClientRect();
          top -= containerRect.top + parseInt(css(container, "border-top-width"));
          left -= containerRect.left + parseInt(css(container, "border-left-width"));
          bottom = top + elRect.height;
          right = left + elRect.width;
          break;
        }
      } while (container = container.parentNode);
    }
  }
  if (undoScale && el !== window) {
    var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d;
    if (elMatrix) {
      top /= scaleY;
      left /= scaleX;
      width /= scaleX;
      height /= scaleY;
      bottom = top + height;
      right = left + width;
    }
  }
  return {
    top,
    left,
    bottom,
    right,
    width,
    height
  };
}
function isScrolledPast(el, elSide, parentSide) {
  var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
  while (parent) {
    var parentSideVal = getRect(parent)[parentSide], visible = void 0;
    if (parentSide === "top" || parentSide === "left") {
      visible = elSideVal >= parentSideVal;
    } else {
      visible = elSideVal <= parentSideVal;
    }
    if (!visible)
      return parent;
    if (parent === getWindowScrollingElement())
      break;
    parent = getParentAutoScrollElement(parent, false);
  }
  return false;
}
function getChild(el, childNum, options, includeDragEl) {
  var currentChild = 0, i = 0, children2 = el.children;
  while (i < children2.length) {
    if (children2[i].style.display !== "none" && children2[i] !== Sortable.ghost && (includeDragEl || children2[i] !== Sortable.dragged) && closest(children2[i], options.draggable, el, false)) {
      if (currentChild === childNum) {
        return children2[i];
      }
      currentChild++;
    }
    i++;
  }
  return null;
}
function lastChild(el, selector) {
  var last = el.lastElementChild;
  while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches(last, selector))) {
    last = last.previousElementSibling;
  }
  return last || null;
}
function index(el, selector) {
  var index2 = 0;
  if (!el || !el.parentNode) {
    return -1;
  }
  while (el = el.previousElementSibling) {
    if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches(el, selector))) {
      index2++;
    }
  }
  return index2;
}
function getRelativeScrollOffset(el) {
  var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement();
  if (el) {
    do {
      var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d;
      offsetLeft += el.scrollLeft * scaleX;
      offsetTop += el.scrollTop * scaleY;
    } while (el !== winScroller && (el = el.parentNode));
  }
  return [offsetLeft, offsetTop];
}
function indexOfObject(arr, obj) {
  for (var i in arr) {
    if (!arr.hasOwnProperty(i))
      continue;
    for (var key in obj) {
      if (obj.hasOwnProperty(key) && obj[key] === arr[i][key])
        return Number(i);
    }
  }
  return -1;
}
function getParentAutoScrollElement(el, includeSelf) {
  if (!el || !el.getBoundingClientRect)
    return getWindowScrollingElement();
  var elem = el;
  var gotSelf = false;
  do {
    if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
      var elemCSS = css(elem);
      if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) {
        if (!elem.getBoundingClientRect || elem === document.body)
          return getWindowScrollingElement();
        if (gotSelf || includeSelf)
          return elem;
        gotSelf = true;
      }
    }
  } while (elem = elem.parentNode);
  return getWindowScrollingElement();
}
function extend(dst, src) {
  if (dst && src) {
    for (var key in src) {
      if (src.hasOwnProperty(key)) {
        dst[key] = src[key];
      }
    }
  }
  return dst;
}
function isRectEqual(rect1, rect2) {
  return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
}
var _throttleTimeout;
function throttle(callback, ms) {
  return function() {
    if (!_throttleTimeout) {
      var args = arguments, _this = this;
      if (args.length === 1) {
        callback.call(_this, args[0]);
      } else {
        callback.apply(_this, args);
      }
      _throttleTimeout = setTimeout(function() {
        _throttleTimeout = void 0;
      }, ms);
    }
  };
}
function cancelThrottle() {
  clearTimeout(_throttleTimeout);
  _throttleTimeout = void 0;
}
function scrollBy(el, x, y) {
  el.scrollLeft += x;
  el.scrollTop += y;
}
function clone(el) {
  var Polymer = window.Polymer;
  var $ = window.jQuery || window.Zepto;
  if (Polymer && Polymer.dom) {
    return Polymer.dom(el).cloneNode(true);
  } else if ($) {
    return $(el).clone(true)[0];
  } else {
    return el.cloneNode(true);
  }
}
function getChildContainingRectFromElement(container, options, ghostEl2) {
  var rect = {};
  Array.from(container.children).forEach(function(child) {
    var _rect$left, _rect$top, _rect$right, _rect$bottom;
    if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2)
      return;
    var childRect = getRect(child);
    rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
    rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
    rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
    rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
  });
  rect.width = rect.right - rect.left;
  rect.height = rect.bottom - rect.top;
  rect.x = rect.left;
  rect.y = rect.top;
  return rect;
}
var expando = "Sortable" + new Date().getTime();
function AnimationStateManager() {
  var animationStates = [], animationCallbackId;
  return {
    captureAnimationState: function captureAnimationState() {
      animationStates = [];
      if (!this.options.animation)
        return;
      var children2 = [].slice.call(this.el.children);
      children2.forEach(function(child) {
        if (css(child, "display") === "none" || child === Sortable.ghost)
          return;
        animationStates.push({
          target: child,
          rect: getRect(child)
        });
        var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
        if (child.thisAnimationDuration) {
          var childMatrix = matrix(child, true);
          if (childMatrix) {
            fromRect.top -= childMatrix.f;
            fromRect.left -= childMatrix.e;
          }
        }
        child.fromRect = fromRect;
      });
    },
    addAnimationState: function addAnimationState(state) {
      animationStates.push(state);
    },
    removeAnimationState: function removeAnimationState(target) {
      animationStates.splice(indexOfObject(animationStates, {
        target
      }), 1);
    },
    animateAll: function animateAll(callback) {
      var _this = this;
      if (!this.options.animation) {
        clearTimeout(animationCallbackId);
        if (typeof callback === "function")
          callback();
        return;
      }
      var animating = false, animationTime = 0;
      animationStates.forEach(function(state) {
        var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true);
        if (targetMatrix) {
          toRect.top -= targetMatrix.f;
          toRect.left -= targetMatrix.e;
        }
        target.toRect = toRect;
        if (target.thisAnimationDuration) {
          if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
          (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
            time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
          }
        }
        if (!isRectEqual(toRect, fromRect)) {
          target.prevFromRect = fromRect;
          target.prevToRect = toRect;
          if (!time) {
            time = _this.options.animation;
          }
          _this.animate(target, animatingRect, toRect, time);
        }
        if (time) {
          animating = true;
          animationTime = Math.max(animationTime, time);
          clearTimeout(target.animationResetTimer);
          target.animationResetTimer = setTimeout(function() {
            target.animationTime = 0;
            target.prevFromRect = null;
            target.fromRect = null;
            target.prevToRect = null;
            target.thisAnimationDuration = null;
          }, time);
          target.thisAnimationDuration = time;
        }
      });
      clearTimeout(animationCallbackId);
      if (!animating) {
        if (typeof callback === "function")
          callback();
      } else {
        animationCallbackId = setTimeout(function() {
          if (typeof callback === "function")
            callback();
        }, animationTime);
      }
      animationStates = [];
    },
    animate: function animate(target, currentRect, toRect, duration) {
      if (duration) {
        css(target, "transition", "");
        css(target, "transform", "");
        var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1);
        target.animatingX = !!translateX;
        target.animatingY = !!translateY;
        css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)");
        this.forRepaintDummy = repaint(target);
        css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : ""));
        css(target, "transform", "translate3d(0,0,0)");
        typeof target.animated === "number" && clearTimeout(target.animated);
        target.animated = setTimeout(function() {
          css(target, "transition", "");
          css(target, "transform", "");
          target.animated = false;
          target.animatingX = false;
          target.animatingY = false;
        }, duration);
      }
    }
  };
}
function repaint(target) {
  return target.offsetWidth;
}
function calculateRealTime(animatingRect, fromRect, toRect, options) {
  return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
}
var plugins = [];
var defaults = {
  initializeByDefault: true
};
var PluginManager = {
  mount: function mount(plugin) {
    for (var option2 in defaults) {
      if (defaults.hasOwnProperty(option2) && !(option2 in plugin)) {
        plugin[option2] = defaults[option2];
      }
    }
    plugins.forEach(function(p) {
      if (p.pluginName === plugin.pluginName) {
        throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
      }
    });
    plugins.push(plugin);
  },
  pluginEvent: function pluginEvent(eventName, sortable, evt) {
    var _this = this;
    this.eventCanceled = false;
    evt.cancel = function() {
      _this.eventCanceled = true;
    };
    var eventNameGlobal = eventName + "Global";
    plugins.forEach(function(plugin) {
      if (!sortable[plugin.pluginName])
        return;
      if (sortable[plugin.pluginName][eventNameGlobal]) {
        sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
          sortable
        }, evt));
      }
      if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
        sortable[plugin.pluginName][eventName](_objectSpread2({
          sortable
        }, evt));
      }
    });
  },
  initializePlugins: function initializePlugins(sortable, el, defaults2, options) {
    plugins.forEach(function(plugin) {
      var pluginName = plugin.pluginName;
      if (!sortable.options[pluginName] && !plugin.initializeByDefault)
        return;
      var initialized = new plugin(sortable, el, sortable.options);
      initialized.sortable = sortable;
      initialized.options = sortable.options;
      sortable[pluginName] = initialized;
      _extends(defaults2, initialized.defaults);
    });
    for (var option2 in sortable.options) {
      if (!sortable.options.hasOwnProperty(option2))
        continue;
      var modified = this.modifyOption(sortable, option2, sortable.options[option2]);
      if (typeof modified !== "undefined") {
        sortable.options[option2] = modified;
      }
    }
  },
  getEventProperties: function getEventProperties(name, sortable) {
    var eventProperties = {};
    plugins.forEach(function(plugin) {
      if (typeof plugin.eventProperties !== "function")
        return;
      _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
    });
    return eventProperties;
  },
  modifyOption: function modifyOption(sortable, name, value) {
    var modifiedValue;
    plugins.forEach(function(plugin) {
      if (!sortable[plugin.pluginName])
        return;
      if (plugin.optionListeners && typeof plugin.optionListeners[name] === "function") {
        modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
      }
    });
    return modifiedValue;
  }
};
function dispatchEvent(_ref) {
  var sortable = _ref.sortable, rootEl2 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl2 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex2 = _ref.oldIndex, newIndex2 = _ref.newIndex, oldDraggableIndex2 = _ref.oldDraggableIndex, newDraggableIndex2 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties;
  sortable = sortable || rootEl2 && rootEl2[expando];
  if (!sortable)
    return;
  var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1);
  if (window.CustomEvent && !IE11OrLess && !Edge) {
    evt = new CustomEvent(name, {
      bubbles: true,
      cancelable: true
    });
  } else {
    evt = document.createEvent("Event");
    evt.initEvent(name, true, true);
  }
  evt.to = toEl || rootEl2;
  evt.from = fromEl || rootEl2;
  evt.item = targetEl || rootEl2;
  evt.clone = cloneEl2;
  evt.oldIndex = oldIndex2;
  evt.newIndex = newIndex2;
  evt.oldDraggableIndex = oldDraggableIndex2;
  evt.newDraggableIndex = newDraggableIndex2;
  evt.originalEvent = originalEvent;
  evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0;
  var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
  for (var option2 in allEventProperties) {
    evt[option2] = allEventProperties[option2];
  }
  if (rootEl2) {
    rootEl2.dispatchEvent(evt);
  }
  if (options[onName]) {
    options[onName].call(sortable, evt);
  }
}
var _excluded = ["evt"];
var pluginEvent2 = function pluginEvent3(eventName, sortable) {
  var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, _excluded);
  PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
    dragEl,
    parentEl,
    ghostEl,
    rootEl,
    nextEl,
    lastDownEl,
    cloneEl,
    cloneHidden,
    dragStarted: moved,
    putSortable,
    activeSortable: Sortable.active,
    originalEvent,
    oldIndex,
    oldDraggableIndex,
    newIndex,
    newDraggableIndex,
    hideGhostForTarget: _hideGhostForTarget,
    unhideGhostForTarget: _unhideGhostForTarget,
    cloneNowHidden: function cloneNowHidden() {
      cloneHidden = true;
    },
    cloneNowShown: function cloneNowShown() {
      cloneHidden = false;
    },
    dispatchSortableEvent: function dispatchSortableEvent(name) {
      _dispatchEvent({
        sortable,
        name,
        originalEvent
      });
    }
  }, data));
};
function _dispatchEvent(info2) {
  dispatchEvent(_objectSpread2({
    putSortable,
    cloneEl,
    targetEl: dragEl,
    rootEl,
    oldIndex,
    oldDraggableIndex,
    newIndex,
    newDraggableIndex
  }, info2));
}
var dragEl;
var parentEl;
var ghostEl;
var rootEl;
var nextEl;
var lastDownEl;
var cloneEl;
var cloneHidden;
var oldIndex;
var newIndex;
var oldDraggableIndex;
var newDraggableIndex;
var activeGroup;
var putSortable;
var awaitingDragStarted = false;
var ignoreNextClick = false;
var sortables = [];
var tapEvt;
var touchEvt;
var lastDx;
var lastDy;
var tapDistanceLeft;
var tapDistanceTop;
var moved;
var lastTarget;
var lastDirection;
var pastFirstInvertThresh = false;
var isCircumstantialInvert = false;
var targetMoveDistance;
var ghostRelativeParent;
var ghostRelativeParentInitialScroll = [];
var _silent = false;
var savedInputChecked = [];
var documentExists = typeof document !== "undefined";
var PositionGhostAbsolutely = IOS;
var CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float";
var supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div");
var supportCssPointerEvents = function() {
  if (!documentExists)
    return;
  if (IE11OrLess) {
    return false;
  }
  var el = document.createElement("x");
  el.style.cssText = "pointer-events:auto";
  return el.style.pointerEvents === "auto";
}();
var _detectDirection = function _detectDirection2(el, options) {
  var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
  if (elCSS.display === "flex") {
    return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal";
  }
  if (elCSS.display === "grid") {
    return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
  }
  if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") {
    var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right";
    return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal";
  }
  return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal";
};
var _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) {
  var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height;
  return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
};
var _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) {
  var ret;
  sortables.some(function(sortable) {
    var threshold = sortable[expando].options.emptyInsertThreshold;
    if (!threshold || lastChild(sortable))
      return;
    var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
    if (insideHorizontally && insideVertically) {
      return ret = sortable;
    }
  });
  return ret;
};
var _prepareGroup = function _prepareGroup2(options) {
  function toFn(value, pull) {
    return function(to, from, dragEl2, evt) {
      var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
      if (value == null && (pull || sameGroup)) {
        return true;
      } else if (value == null || value === false) {
        return false;
      } else if (pull && value === "clone") {
        return value;
      } else if (typeof value === "function") {
        return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt);
      } else {
        var otherGroup = (pull ? to : from).options.group.name;
        return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
      }
    };
  }
  var group = {};
  var originalGroup = options.group;
  if (!originalGroup || _typeof(originalGroup) != "object") {
    originalGroup = {
      name: originalGroup
    };
  }
  group.name = originalGroup.name;
  group.checkPull = toFn(originalGroup.pull, true);
  group.checkPut = toFn(originalGroup.put);
  group.revertClone = originalGroup.revertClone;
  options.group = group;
};
var _hideGhostForTarget = function _hideGhostForTarget2() {
  if (!supportCssPointerEvents && ghostEl) {
    css(ghostEl, "display", "none");
  }
};
var _unhideGhostForTarget = function _unhideGhostForTarget2() {
  if (!supportCssPointerEvents && ghostEl) {
    css(ghostEl, "display", "");
  }
};
if (documentExists && !ChromeForAndroid) {
  document.addEventListener("click", function(evt) {
    if (ignoreNextClick) {
      evt.preventDefault();
      evt.stopPropagation && evt.stopPropagation();
      evt.stopImmediatePropagation && evt.stopImmediatePropagation();
      ignoreNextClick = false;
      return false;
    }
  }, true);
}
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) {
  if (dragEl) {
    evt = evt.touches ? evt.touches[0] : evt;
    var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
    if (nearest) {
      var event = {};
      for (var i in evt) {
        if (evt.hasOwnProperty(i)) {
          event[i] = evt[i];
        }
      }
      event.target = event.rootEl = nearest;
      event.preventDefault = void 0;
      event.stopPropagation = void 0;
      nearest[expando]._onDragOver(event);
    }
  }
};
var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) {
  if (dragEl) {
    dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
  }
};
function Sortable(el, options) {
  if (!(el && el.nodeType && el.nodeType === 1)) {
    throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
  }
  this.el = el;
  this.options = options = _extends({}, options);
  el[expando] = this;
  var defaults2 = {
    group: null,
    sort: true,
    disabled: false,
    store: null,
    handle: null,
    draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*",
    swapThreshold: 1,
    // percentage; 0 <= x <= 1
    invertSwap: false,
    // invert always
    invertedSwapThreshold: null,
    // will be set to same as swapThreshold if default
    removeCloneOnHide: true,
    direction: function direction() {
      return _detectDirection(el, this.options);
    },
    ghostClass: "sortable-ghost",
    chosenClass: "sortable-chosen",
    dragClass: "sortable-drag",
    ignore: "a, img",
    filter: null,
    preventOnFilter: true,
    animation: 0,
    easing: null,
    setData: function setData(dataTransfer, dragEl2) {
      dataTransfer.setData("Text", dragEl2.textContent);
    },
    dropBubble: false,
    dragoverBubble: false,
    dataIdAttr: "data-id",
    delay: 0,
    delayOnTouchOnly: false,
    touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
    forceFallback: false,
    fallbackClass: "sortable-fallback",
    fallbackOnBody: false,
    fallbackTolerance: 0,
    fallbackOffset: {
      x: 0,
      y: 0
    },
    // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
    supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && (!Safari || IOS),
    emptyInsertThreshold: 5
  };
  PluginManager.initializePlugins(this, el, defaults2);
  for (var name in defaults2) {
    !(name in options) && (options[name] = defaults2[name]);
  }
  _prepareGroup(options);
  for (var fn in this) {
    if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
      this[fn] = this[fn].bind(this);
    }
  }
  this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  if (this.nativeDraggable) {
    this.options.touchStartThreshold = 1;
  }
  if (options.supportPointer) {
    on(el, "pointerdown", this._onTapStart);
  } else {
    on(el, "mousedown", this._onTapStart);
    on(el, "touchstart", this._onTapStart);
  }
  if (this.nativeDraggable) {
    on(el, "dragover", this);
    on(el, "dragenter", this);
  }
  sortables.push(this.el);
  options.store && options.store.get && this.sort(options.store.get(this) || []);
  _extends(this, AnimationStateManager());
}
Sortable.prototype = /** @lends Sortable.prototype */
{
  constructor: Sortable,
  _isOutsideThisEl: function _isOutsideThisEl(target) {
    if (!this.el.contains(target) && target !== this.el) {
      lastTarget = null;
    }
  },
  _getDirection: function _getDirection(evt, target) {
    return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
  },
  _onTapStart: function _onTapStart(evt) {
    if (!evt.cancelable)
      return;
    var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter;
    _saveInputCheckedState(el);
    if (dragEl) {
      return;
    }
    if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
      return;
    }
    if (originalTarget.isContentEditable) {
      return;
    }
    if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") {
      return;
    }
    target = closest(target, options.draggable, el, false);
    if (target && target.animated) {
      return;
    }
    if (lastDownEl === target) {
      return;
    }
    oldIndex = index(target);
    oldDraggableIndex = index(target, options.draggable);
    if (typeof filter === "function") {
      if (filter.call(this, evt, target, this)) {
        _dispatchEvent({
          sortable: _this,
          rootEl: originalTarget,
          name: "filter",
          targetEl: target,
          toEl: el,
          fromEl: el
        });
        pluginEvent2("filter", _this, {
          evt
        });
        preventOnFilter && evt.preventDefault();
        return;
      }
    } else if (filter) {
      filter = filter.split(",").some(function(criteria) {
        criteria = closest(originalTarget, criteria.trim(), el, false);
        if (criteria) {
          _dispatchEvent({
            sortable: _this,
            rootEl: criteria,
            name: "filter",
            targetEl: target,
            fromEl: el,
            toEl: el
          });
          pluginEvent2("filter", _this, {
            evt
          });
          return true;
        }
      });
      if (filter) {
        preventOnFilter && evt.preventDefault();
        return;
      }
    }
    if (options.handle && !closest(originalTarget, options.handle, el, false)) {
      return;
    }
    this._prepareDragStart(evt, touch, target);
  },
  _prepareDragStart: function _prepareDragStart(evt, touch, target) {
    var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn;
    if (target && !dragEl && target.parentNode === el) {
      var dragRect = getRect(target);
      rootEl = el;
      dragEl = target;
      parentEl = dragEl.parentNode;
      nextEl = dragEl.nextSibling;
      lastDownEl = target;
      activeGroup = options.group;
      Sortable.dragged = dragEl;
      tapEvt = {
        target: dragEl,
        clientX: (touch || evt).clientX,
        clientY: (touch || evt).clientY
      };
      tapDistanceLeft = tapEvt.clientX - dragRect.left;
      tapDistanceTop = tapEvt.clientY - dragRect.top;
      this._lastX = (touch || evt).clientX;
      this._lastY = (touch || evt).clientY;
      dragEl.style["will-change"] = "all";
      dragStartFn = function dragStartFn2() {
        pluginEvent2("delayEnded", _this, {
          evt
        });
        if (Sortable.eventCanceled) {
          _this._onDrop();
          return;
        }
        _this._disableDelayedDragEvents();
        if (!FireFox && _this.nativeDraggable) {
          dragEl.draggable = true;
        }
        _this._triggerDragStart(evt, touch);
        _dispatchEvent({
          sortable: _this,
          name: "choose",
          originalEvent: evt
        });
        toggleClass(dragEl, options.chosenClass, true);
      };
      options.ignore.split(",").forEach(function(criteria) {
        find(dragEl, criteria.trim(), _disableDraggable);
      });
      on(ownerDocument, "dragover", nearestEmptyInsertDetectEvent);
      on(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent);
      on(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent);
      if (options.supportPointer) {
        on(ownerDocument, "pointerup", _this._onDrop);
        !this.nativeDraggable && on(ownerDocument, "pointercancel", _this._onDrop);
      } else {
        on(ownerDocument, "mouseup", _this._onDrop);
        on(ownerDocument, "touchend", _this._onDrop);
        on(ownerDocument, "touchcancel", _this._onDrop);
      }
      if (FireFox && this.nativeDraggable) {
        this.options.touchStartThreshold = 4;
        dragEl.draggable = true;
      }
      pluginEvent2("delayStart", this, {
        evt
      });
      if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
        if (Sortable.eventCanceled) {
          this._onDrop();
          return;
        }
        if (options.supportPointer) {
          on(ownerDocument, "pointerup", _this._disableDelayedDrag);
          on(ownerDocument, "pointercancel", _this._disableDelayedDrag);
        } else {
          on(ownerDocument, "mouseup", _this._disableDelayedDrag);
          on(ownerDocument, "touchend", _this._disableDelayedDrag);
          on(ownerDocument, "touchcancel", _this._disableDelayedDrag);
        }
        on(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler);
        on(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler);
        options.supportPointer && on(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler);
        _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
      } else {
        dragStartFn();
      }
    }
  },
  _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) {
    var touch = e.touches ? e.touches[0] : e;
    if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
      this._disableDelayedDrag();
    }
  },
  _disableDelayedDrag: function _disableDelayedDrag() {
    dragEl && _disableDraggable(dragEl);
    clearTimeout(this._dragStartTimer);
    this._disableDelayedDragEvents();
  },
  _disableDelayedDragEvents: function _disableDelayedDragEvents() {
    var ownerDocument = this.el.ownerDocument;
    off(ownerDocument, "mouseup", this._disableDelayedDrag);
    off(ownerDocument, "touchend", this._disableDelayedDrag);
    off(ownerDocument, "touchcancel", this._disableDelayedDrag);
    off(ownerDocument, "pointerup", this._disableDelayedDrag);
    off(ownerDocument, "pointercancel", this._disableDelayedDrag);
    off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler);
    off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler);
    off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler);
  },
  _triggerDragStart: function _triggerDragStart(evt, touch) {
    touch = touch || evt.pointerType == "touch" && evt;
    if (!this.nativeDraggable || touch) {
      if (this.options.supportPointer) {
        on(document, "pointermove", this._onTouchMove);
      } else if (touch) {
        on(document, "touchmove", this._onTouchMove);
      } else {
        on(document, "mousemove", this._onTouchMove);
      }
    } else {
      on(dragEl, "dragend", this);
      on(rootEl, "dragstart", this._onDragStart);
    }
    try {
      if (document.selection) {
        _nextTick(function() {
          document.selection.empty();
        });
      } else {
        window.getSelection().removeAllRanges();
      }
    } catch (err) {
    }
  },
  _dragStarted: function _dragStarted(fallback, evt) {
    awaitingDragStarted = false;
    if (rootEl && dragEl) {
      pluginEvent2("dragStarted", this, {
        evt
      });
      if (this.nativeDraggable) {
        on(document, "dragover", _checkOutsideTargetEl);
      }
      var options = this.options;
      !fallback && toggleClass(dragEl, options.dragClass, false);
      toggleClass(dragEl, options.ghostClass, true);
      Sortable.active = this;
      fallback && this._appendGhost();
      _dispatchEvent({
        sortable: this,
        name: "start",
        originalEvent: evt
      });
    } else {
      this._nulling();
    }
  },
  _emulateDragOver: function _emulateDragOver() {
    if (touchEvt) {
      this._lastX = touchEvt.clientX;
      this._lastY = touchEvt.clientY;
      _hideGhostForTarget();
      var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
      var parent = target;
      while (target && target.shadowRoot) {
        target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
        if (target === parent)
          break;
        parent = target;
      }
      dragEl.parentNode[expando]._isOutsideThisEl(target);
      if (parent) {
        do {
          if (parent[expando]) {
            var inserted = void 0;
            inserted = parent[expando]._onDragOver({
              clientX: touchEvt.clientX,
              clientY: touchEvt.clientY,
              target,
              rootEl: parent
            });
            if (inserted && !this.options.dragoverBubble) {
              break;
            }
          }
          target = parent;
        } while (parent = getParentOrHost(parent));
      }
      _unhideGhostForTarget();
    }
  },
  _onTouchMove: function _onTouchMove(evt) {
    if (tapEvt) {
      var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
      if (!Sortable.active && !awaitingDragStarted) {
        if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
          return;
        }
        this._onDragStart(evt, true);
      }
      if (ghostEl) {
        if (ghostMatrix) {
          ghostMatrix.e += dx - (lastDx || 0);
          ghostMatrix.f += dy - (lastDy || 0);
        } else {
          ghostMatrix = {
            a: 1,
            b: 0,
            c: 0,
            d: 1,
            e: dx,
            f: dy
          };
        }
        var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
        css(ghostEl, "webkitTransform", cssMatrix);
        css(ghostEl, "mozTransform", cssMatrix);
        css(ghostEl, "msTransform", cssMatrix);
        css(ghostEl, "transform", cssMatrix);
        lastDx = dx;
        lastDy = dy;
        touchEvt = touch;
      }
      evt.cancelable && evt.preventDefault();
    }
  },
  _appendGhost: function _appendGhost() {
    if (!ghostEl) {
      var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options;
      if (PositionGhostAbsolutely) {
        ghostRelativeParent = container;
        while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) {
          ghostRelativeParent = ghostRelativeParent.parentNode;
        }
        if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
          if (ghostRelativeParent === document)
            ghostRelativeParent = getWindowScrollingElement();
          rect.top += ghostRelativeParent.scrollTop;
          rect.left += ghostRelativeParent.scrollLeft;
        } else {
          ghostRelativeParent = getWindowScrollingElement();
        }
        ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
      }
      ghostEl = dragEl.cloneNode(true);
      toggleClass(ghostEl, options.ghostClass, false);
      toggleClass(ghostEl, options.fallbackClass, true);
      toggleClass(ghostEl, options.dragClass, true);
      css(ghostEl, "transition", "");
      css(ghostEl, "transform", "");
      css(ghostEl, "box-sizing", "border-box");
      css(ghostEl, "margin", 0);
      css(ghostEl, "top", rect.top);
      css(ghostEl, "left", rect.left);
      css(ghostEl, "width", rect.width);
      css(ghostEl, "height", rect.height);
      css(ghostEl, "opacity", "0.8");
      css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed");
      css(ghostEl, "zIndex", "100000");
      css(ghostEl, "pointerEvents", "none");
      Sortable.ghost = ghostEl;
      container.appendChild(ghostEl);
      css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%");
    }
  },
  _onDragStart: function _onDragStart(evt, fallback) {
    var _this = this;
    var dataTransfer = evt.dataTransfer;
    var options = _this.options;
    pluginEvent2("dragStart", this, {
      evt
    });
    if (Sortable.eventCanceled) {
      this._onDrop();
      return;
    }
    pluginEvent2("setupClone", this);
    if (!Sortable.eventCanceled) {
      cloneEl = clone(dragEl);
      cloneEl.removeAttribute("id");
      cloneEl.draggable = false;
      cloneEl.style["will-change"] = "";
      this._hideClone();
      toggleClass(cloneEl, this.options.chosenClass, false);
      Sortable.clone = cloneEl;
    }
    _this.cloneId = _nextTick(function() {
      pluginEvent2("clone", _this);
      if (Sortable.eventCanceled)
        return;
      if (!_this.options.removeCloneOnHide) {
        rootEl.insertBefore(cloneEl, dragEl);
      }
      _this._hideClone();
      _dispatchEvent({
        sortable: _this,
        name: "clone"
      });
    });
    !fallback && toggleClass(dragEl, options.dragClass, true);
    if (fallback) {
      ignoreNextClick = true;
      _this._loopId = setInterval(_this._emulateDragOver, 50);
    } else {
      off(document, "mouseup", _this._onDrop);
      off(document, "touchend", _this._onDrop);
      off(document, "touchcancel", _this._onDrop);
      if (dataTransfer) {
        dataTransfer.effectAllowed = "move";
        options.setData && options.setData.call(_this, dataTransfer, dragEl);
      }
      on(document, "drop", _this);
      css(dragEl, "transform", "translateZ(0)");
    }
    awaitingDragStarted = true;
    _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
    on(document, "selectstart", _this);
    moved = true;
    window.getSelection().removeAllRanges();
    if (Safari) {
      css(document.body, "user-select", "none");
    }
  },
  // Returns true - if no further action is needed (either inserted or another condition)
  _onDragOver: function _onDragOver(evt) {
    var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false;
    if (_silent)
      return;
    function dragOverEvent(name, extra) {
      pluginEvent2(name, _this, _objectSpread2({
        evt,
        isOwner,
        axis: vertical ? "vertical" : "horizontal",
        revert,
        dragRect,
        targetRect,
        canSort,
        fromSortable,
        target,
        completed,
        onMove: function onMove(target2, after2) {
          return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2);
        },
        changed
      }, extra));
    }
    function capture() {
      dragOverEvent("dragOverAnimationCapture");
      _this.captureAnimationState();
      if (_this !== fromSortable) {
        fromSortable.captureAnimationState();
      }
    }
    function completed(insertion) {
      dragOverEvent("dragOverCompleted", {
        insertion
      });
      if (insertion) {
        if (isOwner) {
          activeSortable._hideClone();
        } else {
          activeSortable._showClone(_this);
        }
        if (_this !== fromSortable) {
          toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
          toggleClass(dragEl, options.ghostClass, true);
        }
        if (putSortable !== _this && _this !== Sortable.active) {
          putSortable = _this;
        } else if (_this === Sortable.active && putSortable) {
          putSortable = null;
        }
        if (fromSortable === _this) {
          _this._ignoreWhileAnimating = target;
        }
        _this.animateAll(function() {
          dragOverEvent("dragOverAnimationComplete");
          _this._ignoreWhileAnimating = null;
        });
        if (_this !== fromSortable) {
          fromSortable.animateAll();
          fromSortable._ignoreWhileAnimating = null;
        }
      }
      if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
        lastTarget = null;
      }
      if (!options.dragoverBubble && !evt.rootEl && target !== document) {
        dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
        !insertion && nearestEmptyInsertDetectEvent(evt);
      }
      !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
      return completedFired = true;
    }
    function changed() {
      newIndex = index(dragEl);
      newDraggableIndex = index(dragEl, options.draggable);
      _dispatchEvent({
        sortable: _this,
        name: "change",
        toEl: el,
        newIndex,
        newDraggableIndex,
        originalEvent: evt
      });
    }
    if (evt.preventDefault !== void 0) {
      evt.cancelable && evt.preventDefault();
    }
    target = closest(target, options.draggable, el, true);
    dragOverEvent("dragOver");
    if (Sortable.eventCanceled)
      return completedFired;
    if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
      return completed(false);
    }
    ignoreNextClick = false;
    if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
      vertical = this._getDirection(evt, target) === "vertical";
      dragRect = getRect(dragEl);
      dragOverEvent("dragOverValid");
      if (Sortable.eventCanceled)
        return completedFired;
      if (revert) {
        parentEl = rootEl;
        capture();
        this._hideClone();
        dragOverEvent("revert");
        if (!Sortable.eventCanceled) {
          if (nextEl) {
            rootEl.insertBefore(dragEl, nextEl);
          } else {
            rootEl.appendChild(dragEl);
          }
        }
        return completed(true);
      }
      var elLastChild = lastChild(el, options.draggable);
      if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
        if (elLastChild === dragEl) {
          return completed(false);
        }
        if (elLastChild && el === evt.target) {
          target = elLastChild;
        }
        if (target) {
          targetRect = getRect(target);
        }
        if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
          capture();
          if (elLastChild && elLastChild.nextSibling) {
            el.insertBefore(dragEl, elLastChild.nextSibling);
          } else {
            el.appendChild(dragEl);
          }
          parentEl = el;
          changed();
          return completed(true);
        }
      } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
        var firstChild = getChild(el, 0, options, true);
        if (firstChild === dragEl) {
          return completed(false);
        }
        target = firstChild;
        targetRect = getRect(target);
        if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
          capture();
          el.insertBefore(dragEl, firstChild);
          parentEl = el;
          changed();
          return completed(true);
        }
      } else if (target.parentNode === el) {
        targetRect = getRect(target);
        var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
        if (lastTarget !== target) {
          targetBeforeFirstSwap = targetRect[side1];
          pastFirstInvertThresh = false;
          isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
        }
        direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
        var sibling;
        if (direction !== 0) {
          var dragIndex = index(dragEl);
          do {
            dragIndex -= direction;
            sibling = parentEl.children[dragIndex];
          } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl));
        }
        if (direction === 0 || sibling === target) {
          return completed(false);
        }
        lastTarget = target;
        lastDirection = direction;
        var nextSibling = target.nextElementSibling, after = false;
        after = direction === 1;
        var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
        if (moveVector !== false) {
          if (moveVector === 1 || moveVector === -1) {
            after = moveVector === 1;
          }
          _silent = true;
          setTimeout(_unsilent, 30);
          capture();
          if (after && !nextSibling) {
            el.appendChild(dragEl);
          } else {
            target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
          }
          if (scrolledPastTop) {
            scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
          }
          parentEl = dragEl.parentNode;
          if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) {
            targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
          }
          changed();
          return completed(true);
        }
      }
      if (el.contains(dragEl)) {
        return completed(false);
      }
    }
    return false;
  },
  _ignoreWhileAnimating: null,
  _offMoveEvents: function _offMoveEvents() {
    off(document, "mousemove", this._onTouchMove);
    off(document, "touchmove", this._onTouchMove);
    off(document, "pointermove", this._onTouchMove);
    off(document, "dragover", nearestEmptyInsertDetectEvent);
    off(document, "mousemove", nearestEmptyInsertDetectEvent);
    off(document, "touchmove", nearestEmptyInsertDetectEvent);
  },
  _offUpEvents: function _offUpEvents() {
    var ownerDocument = this.el.ownerDocument;
    off(ownerDocument, "mouseup", this._onDrop);
    off(ownerDocument, "touchend", this._onDrop);
    off(ownerDocument, "pointerup", this._onDrop);
    off(ownerDocument, "pointercancel", this._onDrop);
    off(ownerDocument, "touchcancel", this._onDrop);
    off(document, "selectstart", this);
  },
  _onDrop: function _onDrop(evt) {
    var el = this.el, options = this.options;
    newIndex = index(dragEl);
    newDraggableIndex = index(dragEl, options.draggable);
    pluginEvent2("drop", this, {
      evt
    });
    parentEl = dragEl && dragEl.parentNode;
    newIndex = index(dragEl);
    newDraggableIndex = index(dragEl, options.draggable);
    if (Sortable.eventCanceled) {
      this._nulling();
      return;
    }
    awaitingDragStarted = false;
    isCircumstantialInvert = false;
    pastFirstInvertThresh = false;
    clearInterval(this._loopId);
    clearTimeout(this._dragStartTimer);
    _cancelNextTick(this.cloneId);
    _cancelNextTick(this._dragStartId);
    if (this.nativeDraggable) {
      off(document, "drop", this);
      off(el, "dragstart", this._onDragStart);
    }
    this._offMoveEvents();
    this._offUpEvents();
    if (Safari) {
      css(document.body, "user-select", "");
    }
    css(dragEl, "transform", "");
    if (evt) {
      if (moved) {
        evt.cancelable && evt.preventDefault();
        !options.dropBubble && evt.stopPropagation();
      }
      ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
      if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") {
        cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
      }
      if (dragEl) {
        if (this.nativeDraggable) {
          off(dragEl, "dragend", this);
        }
        _disableDraggable(dragEl);
        dragEl.style["will-change"] = "";
        if (moved && !awaitingDragStarted) {
          toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
        }
        toggleClass(dragEl, this.options.chosenClass, false);
        _dispatchEvent({
          sortable: this,
          name: "unchoose",
          toEl: parentEl,
          newIndex: null,
          newDraggableIndex: null,
          originalEvent: evt
        });
        if (rootEl !== parentEl) {
          if (newIndex >= 0) {
            _dispatchEvent({
              rootEl: parentEl,
              name: "add",
              toEl: parentEl,
              fromEl: rootEl,
              originalEvent: evt
            });
            _dispatchEvent({
              sortable: this,
              name: "remove",
              toEl: parentEl,
              originalEvent: evt
            });
            _dispatchEvent({
              rootEl: parentEl,
              name: "sort",
              toEl: parentEl,
              fromEl: rootEl,
              originalEvent: evt
            });
            _dispatchEvent({
              sortable: this,
              name: "sort",
              toEl: parentEl,
              originalEvent: evt
            });
          }
          putSortable && putSortable.save();
        } else {
          if (newIndex !== oldIndex) {
            if (newIndex >= 0) {
              _dispatchEvent({
                sortable: this,
                name: "update",
                toEl: parentEl,
                originalEvent: evt
              });
              _dispatchEvent({
                sortable: this,
                name: "sort",
                toEl: parentEl,
                originalEvent: evt
              });
            }
          }
        }
        if (Sortable.active) {
          if (newIndex == null || newIndex === -1) {
            newIndex = oldIndex;
            newDraggableIndex = oldDraggableIndex;
          }
          _dispatchEvent({
            sortable: this,
            name: "end",
            toEl: parentEl,
            originalEvent: evt
          });
          this.save();
        }
      }
    }
    this._nulling();
  },
  _nulling: function _nulling() {
    pluginEvent2("nulling", this);
    rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
    savedInputChecked.forEach(function(el) {
      el.checked = true;
    });
    savedInputChecked.length = lastDx = lastDy = 0;
  },
  handleEvent: function handleEvent(evt) {
    switch (evt.type) {
      case "drop":
      case "dragend":
        this._onDrop(evt);
        break;
      case "dragenter":
      case "dragover":
        if (dragEl) {
          this._onDragOver(evt);
          _globalDragOver(evt);
        }
        break;
      case "selectstart":
        evt.preventDefault();
        break;
    }
  },
  /**
   * Serializes the item into an array of string.
   * @returns {String[]}
   */
  toArray: function toArray() {
    var order = [], el, children2 = this.el.children, i = 0, n = children2.length, options = this.options;
    for (; i < n; i++) {
      el = children2[i];
      if (closest(el, options.draggable, this.el, false)) {
        order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
      }
    }
    return order;
  },
  /**
   * Sorts the elements according to the array.
   * @param  {String[]}  order  order of the items
   */
  sort: function sort(order, useAnimation) {
    var items = {}, rootEl2 = this.el;
    this.toArray().forEach(function(id, i) {
      var el = rootEl2.children[i];
      if (closest(el, this.options.draggable, rootEl2, false)) {
        items[id] = el;
      }
    }, this);
    useAnimation && this.captureAnimationState();
    order.forEach(function(id) {
      if (items[id]) {
        rootEl2.removeChild(items[id]);
        rootEl2.appendChild(items[id]);
      }
    });
    useAnimation && this.animateAll();
  },
  /**
   * Save the current sorting
   */
  save: function save() {
    var store = this.options.store;
    store && store.set && store.set(this);
  },
  /**
   * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
   * @param   {HTMLElement}  el
   * @param   {String}       [selector]  default: `options.draggable`
   * @returns {HTMLElement|null}
   */
  closest: function closest$1(el, selector) {
    return closest(el, selector || this.options.draggable, this.el, false);
  },
  /**
   * Set/get option
   * @param   {string} name
   * @param   {*}      [value]
   * @returns {*}
   */
  option: function option(name, value) {
    var options = this.options;
    if (value === void 0) {
      return options[name];
    } else {
      var modifiedValue = PluginManager.modifyOption(this, name, value);
      if (typeof modifiedValue !== "undefined") {
        options[name] = modifiedValue;
      } else {
        options[name] = value;
      }
      if (name === "group") {
        _prepareGroup(options);
      }
    }
  },
  /**
   * Destroy
   */
  destroy: function destroy() {
    pluginEvent2("destroy", this);
    var el = this.el;
    el[expando] = null;
    off(el, "mousedown", this._onTapStart);
    off(el, "touchstart", this._onTapStart);
    off(el, "pointerdown", this._onTapStart);
    if (this.nativeDraggable) {
      off(el, "dragover", this);
      off(el, "dragenter", this);
    }
    Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) {
      el2.removeAttribute("draggable");
    });
    this._onDrop();
    this._disableDelayedDragEvents();
    sortables.splice(sortables.indexOf(this.el), 1);
    this.el = el = null;
  },
  _hideClone: function _hideClone() {
    if (!cloneHidden) {
      pluginEvent2("hideClone", this);
      if (Sortable.eventCanceled)
        return;
      css(cloneEl, "display", "none");
      if (this.options.removeCloneOnHide && cloneEl.parentNode) {
        cloneEl.parentNode.removeChild(cloneEl);
      }
      cloneHidden = true;
    }
  },
  _showClone: function _showClone(putSortable2) {
    if (putSortable2.lastPutMode !== "clone") {
      this._hideClone();
      return;
    }
    if (cloneHidden) {
      pluginEvent2("showClone", this);
      if (Sortable.eventCanceled)
        return;
      if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
        rootEl.insertBefore(cloneEl, dragEl);
      } else if (nextEl) {
        rootEl.insertBefore(cloneEl, nextEl);
      } else {
        rootEl.appendChild(cloneEl);
      }
      if (this.options.group.revertClone) {
        this.animate(dragEl, cloneEl);
      }
      css(cloneEl, "display", "");
      cloneHidden = false;
    }
  }
};
function _globalDragOver(evt) {
  if (evt.dataTransfer) {
    evt.dataTransfer.dropEffect = "move";
  }
  evt.cancelable && evt.preventDefault();
}
function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
  var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal;
  if (window.CustomEvent && !IE11OrLess && !Edge) {
    evt = new CustomEvent("move", {
      bubbles: true,
      cancelable: true
    });
  } else {
    evt = document.createEvent("Event");
    evt.initEvent("move", true, true);
  }
  evt.to = toEl;
  evt.from = fromEl;
  evt.dragged = dragEl2;
  evt.draggedRect = dragRect;
  evt.related = targetEl || toEl;
  evt.relatedRect = targetRect || getRect(toEl);
  evt.willInsertAfter = willInsertAfter;
  evt.originalEvent = originalEvent;
  fromEl.dispatchEvent(evt);
  if (onMoveFn) {
    retVal = onMoveFn.call(sortable, evt, originalEvent);
  }
  return retVal;
}
function _disableDraggable(el) {
  el.draggable = false;
}
function _unsilent() {
  _silent = false;
}
function _ghostIsFirst(evt, vertical, sortable) {
  var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
  var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
  var spacer = 10;
  return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
}
function _ghostIsLast(evt, vertical, sortable) {
  var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
  var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
  var spacer = 10;
  return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
}
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
  var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false;
  if (!invertSwap) {
    if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
      if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
        pastFirstInvertThresh = true;
      }
      if (!pastFirstInvertThresh) {
        if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) {
          return -lastDirection;
        }
      } else {
        invert = true;
      }
    } else {
      if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
        return _getInsertDirection(target);
      }
    }
  }
  invert = invert || invertSwap;
  if (invert) {
    if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
      return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
    }
  }
  return 0;
}
function _getInsertDirection(target) {
  if (index(dragEl) < index(target)) {
    return 1;
  } else {
    return -1;
  }
}
function _generateId(el) {
  var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0;
  while (i--) {
    sum += str.charCodeAt(i);
  }
  return sum.toString(36);
}
function _saveInputCheckedState(root) {
  savedInputChecked.length = 0;
  var inputs = root.getElementsByTagName("input");
  var idx = inputs.length;
  while (idx--) {
    var el = inputs[idx];
    el.checked && savedInputChecked.push(el);
  }
}
function _nextTick(fn) {
  return setTimeout(fn, 0);
}
function _cancelNextTick(id) {
  return clearTimeout(id);
}
if (documentExists) {
  on(document, "touchmove", function(evt) {
    if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
      evt.preventDefault();
    }
  });
}
Sortable.utils = {
  on,
  off,
  css,
  find,
  is: function is(el, selector) {
    return !!closest(el, selector, el, false);
  },
  extend,
  throttle,
  closest,
  toggleClass,
  clone,
  index,
  nextTick: _nextTick,
  cancelNextTick: _cancelNextTick,
  detectDirection: _detectDirection,
  getChild,
  expando
};
Sortable.get = function(element2) {
  return element2[expando];
};
Sortable.mount = function() {
  for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) {
    plugins2[_key] = arguments[_key];
  }
  if (plugins2[0].constructor === Array)
    plugins2 = plugins2[0];
  plugins2.forEach(function(plugin) {
    if (!plugin.prototype || !plugin.prototype.constructor) {
      throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
    }
    if (plugin.utils)
      Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
    PluginManager.mount(plugin);
  });
};
Sortable.create = function(el, options) {
  return new Sortable(el, options);
};
Sortable.version = version;
var autoScrolls = [];
var scrollEl;
var scrollRootEl;
var scrolling = false;
var lastAutoScrollX;
var lastAutoScrollY;
var touchEvt$1;
var pointerElemChangedInterval;
function AutoScrollPlugin() {
  function AutoScroll() {
    this.defaults = {
      scroll: true,
      forceAutoScrollFallback: false,
      scrollSensitivity: 30,
      scrollSpeed: 10,
      bubbleScroll: true
    };
    for (var fn in this) {
      if (fn.charAt(0) === "_" && typeof this[fn] === "function") {
        this[fn] = this[fn].bind(this);
      }
    }
  }
  AutoScroll.prototype = {
    dragStarted: function dragStarted(_ref) {
      var originalEvent = _ref.originalEvent;
      if (this.sortable.nativeDraggable) {
        on(document, "dragover", this._handleAutoScroll);
      } else {
        if (this.options.supportPointer) {
          on(document, "pointermove", this._handleFallbackAutoScroll);
        } else if (originalEvent.touches) {
          on(document, "touchmove", this._handleFallbackAutoScroll);
        } else {
          on(document, "mousemove", this._handleFallbackAutoScroll);
        }
      }
    },
    dragOverCompleted: function dragOverCompleted(_ref2) {
      var originalEvent = _ref2.originalEvent;
      if (!this.options.dragOverBubble && !originalEvent.rootEl) {
        this._handleAutoScroll(originalEvent);
      }
    },
    drop: function drop3() {
      if (this.sortable.nativeDraggable) {
        off(document, "dragover", this._handleAutoScroll);
      } else {
        off(document, "pointermove", this._handleFallbackAutoScroll);
        off(document, "touchmove", this._handleFallbackAutoScroll);
        off(document, "mousemove", this._handleFallbackAutoScroll);
      }
      clearPointerElemChangedInterval();
      clearAutoScrolls();
      cancelThrottle();
    },
    nulling: function nulling() {
      touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
      autoScrolls.length = 0;
    },
    _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
      this._handleAutoScroll(evt, true);
    },
    _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
      var _this = this;
      var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y);
      touchEvt$1 = evt;
      if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
        autoScroll(evt, this.options, elem, fallback);
        var ogElemScroller = getParentAutoScrollElement(elem, true);
        if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
          pointerElemChangedInterval && clearPointerElemChangedInterval();
          pointerElemChangedInterval = setInterval(function() {
            var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
            if (newElem !== ogElemScroller) {
              ogElemScroller = newElem;
              clearAutoScrolls();
            }
            autoScroll(evt, _this.options, newElem, fallback);
          }, 10);
          lastAutoScrollX = x;
          lastAutoScrollY = y;
        }
      } else {
        if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
          clearAutoScrolls();
          return;
        }
        autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
      }
    }
  };
  return _extends(AutoScroll, {
    pluginName: "scroll",
    initializeByDefault: true
  });
}
function clearAutoScrolls() {
  autoScrolls.forEach(function(autoScroll2) {
    clearInterval(autoScroll2.pid);
  });
  autoScrolls = [];
}
function clearPointerElemChangedInterval() {
  clearInterval(pointerElemChangedInterval);
}
var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
  if (!options.scroll)
    return;
  var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement();
  var scrollThisInstance = false, scrollCustomFn;
  if (scrollRootEl !== rootEl2) {
    scrollRootEl = rootEl2;
    clearAutoScrolls();
    scrollEl = options.scroll;
    scrollCustomFn = options.scrollFn;
    if (scrollEl === true) {
      scrollEl = getParentAutoScrollElement(rootEl2, true);
    }
  }
  var layersOut = 0;
  var currentParent = scrollEl;
  do {
    var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop;
    if (el === winScroller) {
      canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible");
      canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible");
    } else {
      canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll");
      canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll");
    }
    var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
    var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
    if (!autoScrolls[layersOut]) {
      for (var i = 0; i <= layersOut; i++) {
        if (!autoScrolls[i]) {
          autoScrolls[i] = {};
        }
      }
    }
    if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
      autoScrolls[layersOut].el = el;
      autoScrolls[layersOut].vx = vx;
      autoScrolls[layersOut].vy = vy;
      clearInterval(autoScrolls[layersOut].pid);
      if (vx != 0 || vy != 0) {
        scrollThisInstance = true;
        autoScrolls[layersOut].pid = setInterval(function() {
          if (isFallback && this.layer === 0) {
            Sortable.active._onTouchMove(touchEvt$1);
          }
          var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
          var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
          if (typeof scrollCustomFn === "function") {
            if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") {
              return;
            }
          }
          scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
        }.bind({
          layer: layersOut
        }), 24);
      }
    }
    layersOut++;
  } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
  scrolling = scrollThisInstance;
}, 30);
var drop = function drop2(_ref) {
  var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget;
  if (!originalEvent)
    return;
  var toSortable = putSortable2 || activeSortable;
  hideGhostForTarget();
  var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
  var target = document.elementFromPoint(touch.clientX, touch.clientY);
  unhideGhostForTarget();
  if (toSortable && !toSortable.el.contains(target)) {
    dispatchSortableEvent("spill");
    this.onSpill({
      dragEl: dragEl2,
      putSortable: putSortable2
    });
  }
};
function Revert() {
}
Revert.prototype = {
  startIndex: null,
  dragStart: function dragStart(_ref2) {
    var oldDraggableIndex2 = _ref2.oldDraggableIndex;
    this.startIndex = oldDraggableIndex2;
  },
  onSpill: function onSpill(_ref3) {
    var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable;
    this.sortable.captureAnimationState();
    if (putSortable2) {
      putSortable2.captureAnimationState();
    }
    var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
    if (nextSibling) {
      this.sortable.el.insertBefore(dragEl2, nextSibling);
    } else {
      this.sortable.el.appendChild(dragEl2);
    }
    this.sortable.animateAll();
    if (putSortable2) {
      putSortable2.animateAll();
    }
  },
  drop
};
_extends(Revert, {
  pluginName: "revertOnSpill"
});
function Remove() {
}
Remove.prototype = {
  onSpill: function onSpill2(_ref4) {
    var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable;
    var parentSortable = putSortable2 || this.sortable;
    parentSortable.captureAnimationState();
    dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2);
    parentSortable.animateAll();
  },
  drop
};
_extends(Remove, {
  pluginName: "removeOnSpill"
});
Sortable.mount(new AutoScrollPlugin());
Sortable.mount(Remove, Revert);
var sortable_esm_default = Sortable;

// src/LocalGPTSettingTab.ts
var SEPARATOR = "\u2702\uFE0F";
function escapeTitle(title) {
  if (!title) {
    return "";
  }
  return title.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
}
var LocalGPTSettingTab = class extends import_obsidian.PluginSettingTab {
  constructor(app, plugin) {
    super(app, plugin);
    this.editEnabled = false;
    this.modelsOptions = {};
    this.changingOrder = false;
    // Controls visibility of the Advanced settings section
    this.isAdvancedMode = false;
    // Guard to require a second click before destructive reset
    this.isConfirmingReset = false;
    this.plugin = plugin;
  }
  async display() {
    const { containerEl } = this;
    containerEl.empty();
    try {
      const aiProvidersWaiter = await (0, import_sdk.waitForAI)();
      const aiProvidersResponse = await aiProvidersWaiter.promise;
      const providers = aiProvidersResponse.providers.reduce(
        (acc, provider) => ({
          ...acc,
          [provider.id]: provider.model ? [provider.name, provider.model].join(" ~ ") : provider.name
        }),
        {
          "": ""
        }
      );
      new import_obsidian.Setting(containerEl).setHeading().setName(I18n.t("settings.mainProvider")).setClass("ai-providers-select").addDropdown(
        (dropdown) => dropdown.addOptions(providers).setValue(String(this.plugin.settings.aiProviders.main)).onChange(async (value) => {
          this.plugin.settings.aiProviders.main = value;
          this.plugin.actionPaletteProviderId = value;
          await this.plugin.saveSettings();
          await this.display();
        })
      );
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.embeddingProvider")).setDesc(I18n.t("settings.embeddingProviderDesc")).setClass("ai-providers-select").addDropdown(
        (dropdown) => dropdown.addOptions(providers).setValue(
          String(this.plugin.settings.aiProviders.embedding)
        ).onChange(async (value) => {
          this.plugin.settings.aiProviders.embedding = value;
          await this.plugin.saveSettings();
          await this.display();
        })
      );
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.visionProvider")).setClass("ai-providers-select").setDesc(I18n.t("settings.visionProviderDesc")).addDropdown(
        (dropdown) => dropdown.addOptions(providers).setValue(
          String(this.plugin.settings.aiProviders.vision)
        ).onChange(async (value) => {
          this.plugin.settings.aiProviders.vision = value;
          await this.plugin.saveSettings();
          await this.display();
        })
      );
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.creativity")).setDesc("").addDropdown((dropdown) => {
        dropdown.addOption("", I18n.t("settings.creativityNone")).addOptions({
          low: I18n.t("settings.creativityLow"),
          medium: I18n.t("settings.creativityMedium"),
          high: I18n.t("settings.creativityHigh")
        }).setValue(
          String(this.plugin.settings.defaults.creativity) || ""
        ).onChange(async (value) => {
          this.plugin.settings.defaults.creativity = value;
          await this.plugin.saveSettings();
          await this.display();
        });
      });
    } catch (error) {
      console.error(error);
    }
    const editingAction = this.editExistingAction || {
      name: "",
      prompt: "",
      temperature: void 0,
      system: "",
      replace: false
    };
    const sharingActionsMapping = {
      name: "Name: ",
      system: "System: ",
      prompt: "Prompt: ",
      replace: "Replace: ",
      model: "Model: "
    };
    containerEl.createEl("div", { cls: "local-gpt-settings-separator" });
    containerEl.createEl("h3", { text: I18n.t("settings.actions") });
    if (!this.editEnabled) {
      const quickAdd = new import_obsidian.Setting(containerEl).setName(I18n.t("settings.quickAdd")).setDesc("").addText((text2) => {
        text2.inputEl.style.minWidth = "100%";
        text2.setPlaceholder(I18n.t("settings.quickAddPlaceholder"));
        text2.onChange(async (value) => {
          const quickAddAction = value.split(SEPARATOR).map((part) => part.trim()).reduce((acc, part) => {
            const foundMatchKey = Object.keys(
              sharingActionsMapping
            ).find((key) => {
              return part.startsWith(
                sharingActionsMapping[key]
              );
            });
            if (foundMatchKey) {
              acc[foundMatchKey] = part.substring(
                sharingActionsMapping[foundMatchKey].length,
                part.length
              );
            }
            return acc;
          }, {});
          if (quickAddAction.name) {
            await this.addNewAction(quickAddAction);
            text2.setValue("");
            this.display();
          }
        });
      });
      quickAdd.descEl.innerHTML = I18n.t("settings.quickAddDesc");
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.addNewManually")).addButton(
        (button) => button.setIcon("plus").onClick(async () => {
          this.editEnabled = true;
          this.editExistingAction = void 0;
          this.display();
        })
      );
    } else {
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.actionName")).addText((text2) => {
        (editingAction == null ? void 0 : editingAction.name) && text2.setValue(editingAction.name);
        text2.inputEl.style.minWidth = "100%";
        text2.setPlaceholder(
          I18n.t("settings.actionNamePlaceholder")
        );
        text2.onChange(async (value) => {
          editingAction.name = value;
        });
      });
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.systemPrompt")).setDesc(I18n.t("settings.systemPromptDesc")).addTextArea((text2) => {
        (editingAction == null ? void 0 : editingAction.system) && text2.setValue(editingAction.system);
        text2.inputEl.style.minWidth = "100%";
        text2.inputEl.style.minHeight = "6em";
        text2.inputEl.style.resize = "vertical";
        text2.setPlaceholder(
          I18n.t("settings.systemPromptPlaceholder")
        );
        text2.onChange(async (value) => {
          editingAction.system = value;
        });
      });
      const promptSetting = new import_obsidian.Setting(containerEl).setName(I18n.t("settings.prompt")).setDesc("").addTextArea((text2) => {
        (editingAction == null ? void 0 : editingAction.prompt) && text2.setValue(editingAction.prompt);
        text2.inputEl.style.minWidth = "100%";
        text2.inputEl.style.minHeight = "6em";
        text2.inputEl.style.resize = "vertical";
        text2.setPlaceholder("");
        text2.onChange(async (value) => {
          editingAction.prompt = value;
        });
      });
      promptSetting.descEl.innerHTML = I18n.t("settings.promptDesc");
      new import_obsidian.Setting(containerEl).setName(I18n.t("settings.replaceSelected")).setDesc(I18n.t("settings.replaceSelectedDesc")).addToggle((component) => {
        (editingAction == null ? void 0 : editingAction.replace) && component.setValue(editingAction.replace);
        component.onChange(async (value) => {
          editingAction.replace = value;
        });
      });
      const actionButtonsRow = new import_obsidian.Setting(containerEl).setName("");
      if (this.editExistingAction) {
        actionButtonsRow.addButton((button) => {
          button.buttonEl.style.marginRight = "2em";
          button.setButtonText(I18n.t("settings.remove")).onClick(async () => {
            if (!button.buttonEl.hasClass("mod-warning")) {
              button.setClass("mod-warning");
              return;
            }
            this.plugin.settings.actions = this.plugin.settings.actions.filter(
              (innerAction) => innerAction !== editingAction
            );
            await this.plugin.saveSettings();
            this.editExistingAction = void 0;
            this.editEnabled = false;
            this.display();
          });
        });
      }
      actionButtonsRow.addButton((button) => {
        button.setButtonText(I18n.t("settings.close")).onClick(async () => {
          this.editEnabled = false;
          this.editExistingAction = void 0;
          this.display();
        });
      }).addButton(
        (button) => button.setCta().setButtonText(I18n.t("settings.save")).onClick(async () => {
          if (!editingAction.name) {
            new import_obsidian.Notice(
              I18n.t("notices.actionNameRequired")
            );
            return;
          }
          if (!this.editExistingAction) {
            if (this.plugin.settings.actions.find(
              (action) => action.name === editingAction.name
            )) {
              new import_obsidian.Notice(
                I18n.t("notices.actionNameExists", {
                  name: editingAction.name
                })
              );
              return;
            }
            await this.addNewAction(editingAction);
          } else {
            if (this.plugin.settings.actions.filter(
              (action) => action.name === editingAction.name
            ).length > 1) {
              new import_obsidian.Notice(
                I18n.t("notices.actionNameExists", {
                  name: editingAction.name
                })
              );
              return;
            }
            const index2 = this.plugin.settings.actions.findIndex(
              (innerAction) => innerAction === editingAction
            );
            this.plugin.settings.actions[index2] = editingAction;
          }
          await this.plugin.saveSettings();
          this.editEnabled = false;
          this.editExistingAction = void 0;
          this.display();
        })
      );
    }
    containerEl.createEl("h4", { text: I18n.t("settings.actionsList") });
    const actionsContainer = containerEl.createDiv(
      "local-gpt-actions-container"
    );
    this.plugin.settings.actions.forEach((action, actionIndex) => {
      const sharingString = [
        action.name && `${sharingActionsMapping.name}${action.name}`,
        action.system && `${sharingActionsMapping.system}${action.system}`,
        action.prompt && `${sharingActionsMapping.prompt}${action.prompt}`,
        action.replace && `${sharingActionsMapping.replace}${action.replace}`
      ].filter(Boolean).join(` ${SEPARATOR}
`);
      if (!this.changingOrder) {
        const actionRow = new import_obsidian.Setting(actionsContainer).setName(action.name).setDesc("").addButton(
          (button) => button.setIcon("copy").onClick(async () => {
            navigator.clipboard.writeText(sharingString);
            new import_obsidian.Notice(I18n.t("notices.copied"));
          })
        ).addButton(
          (button) => button.setButtonText("Edit").onClick(async () => {
            this.editEnabled = true;
            this.editExistingAction = this.plugin.settings.actions.find(
              (innerAction) => innerAction.name == action.name
            );
            this.display();
          })
        );
        const systemTitle = escapeTitle(action.system);
        const promptTitle = escapeTitle(action.prompt);
        actionRow.descEl.innerHTML = [
          action.system && `<div title="${systemTitle}" style="text-overflow: ellipsis; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
							<b>${sharingActionsMapping.system}</b>${action.system}</div>`,
          action.prompt && `<div title="${promptTitle}" style="text-overflow: ellipsis; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
							<b>${sharingActionsMapping.prompt}</b>${action.prompt}
						</div>`
        ].filter(Boolean).join("<br/>\n");
      } else {
        const actionRow = new import_obsidian.Setting(actionsContainer).setName(action.name).setDesc("");
        actionRow.settingEl.addClass("local-gpt-action-row");
        const handle = actionRow.settingEl.createDiv(
          "local-gpt-drag-handle"
        );
        (0, import_obsidian.setIcon)(handle, "grip-vertical");
        actionRow.settingEl.prepend(handle);
      }
    });
    if (this.changingOrder) {
      const getScrollableParent = (el) => {
        let node = el.parentElement;
        while (node) {
          const style = getComputedStyle(node);
          const overflowY = style.overflowY;
          if (node.scrollHeight > node.clientHeight && (overflowY === "auto" || overflowY === "scroll")) {
            return node;
          }
          node = node.parentElement;
        }
        return document.scrollingElement || document.documentElement;
      };
      let autoScrollFrame = null;
      let autoScrollDelta = 0;
      let scrollEl2 = null;
      const stepScroll = () => {
        if (!scrollEl2)
          return;
        if (autoScrollDelta !== 0) {
          scrollEl2.scrollTop += autoScrollDelta;
          autoScrollFrame = requestAnimationFrame(stepScroll);
        } else {
          autoScrollFrame = null;
        }
      };
      const handleEdgeScroll = (evt) => {
        var _a2, _b, _c, _d;
        if (!scrollEl2)
          return;
        const clientY = (_d = (_c = evt == null ? void 0 : evt.clientY) != null ? _c : (_b = (_a2 = evt == null ? void 0 : evt.touches) == null ? void 0 : _a2[0]) == null ? void 0 : _b.clientY) != null ? _d : 0;
        const rect = scrollEl2.getBoundingClientRect();
        const threshold = 48;
        const maxStep = 18;
        if (clientY < rect.top + threshold) {
          const dist = rect.top + threshold - clientY;
          autoScrollDelta = -Math.min(maxStep, Math.ceil(dist / 4));
        } else if (clientY > rect.bottom - threshold) {
          const dist = clientY - (rect.bottom - threshold);
          autoScrollDelta = Math.min(maxStep, Math.ceil(dist / 4));
        } else {
          autoScrollDelta = 0;
        }
        if (autoScrollDelta !== 0 && autoScrollFrame === null) {
          autoScrollFrame = requestAnimationFrame(stepScroll);
        }
      };
      const addEdgeScrollListeners = () => {
        if (!scrollEl2)
          return;
        scrollEl2.addEventListener("dragover", handleEdgeScroll);
        scrollEl2.addEventListener("pointermove", handleEdgeScroll, {
          passive: true
        });
        scrollEl2.addEventListener("touchmove", handleEdgeScroll, {
          passive: true
        });
      };
      const removeEdgeScrollListeners = () => {
        if (!scrollEl2)
          return;
        scrollEl2.removeEventListener("dragover", handleEdgeScroll);
        scrollEl2.removeEventListener(
          "pointermove",
          handleEdgeScroll
        );
        scrollEl2.removeEventListener(
          "touchmove",
          handleEdgeScroll
        );
      };
      sortable_esm_default.create(actionsContainer, {
        animation: 150,
        // Allow dragging by the whole item (not just the handle)
        draggable: ".setting-item",
        // We provide manual edge autoscroll for reliability in Obsidian's settings modal
        ghostClass: "local-gpt-sortable-ghost",
        chosenClass: "local-gpt-sortable-chosen",
        dragClass: "local-gpt-sortable-drag",
        onStart: (evt) => {
          scrollEl2 = getScrollableParent(actionsContainer);
          addEdgeScrollListeners();
        },
        onEnd: async (evt) => {
          removeEdgeScrollListeners();
          if (autoScrollFrame !== null) {
            cancelAnimationFrame(autoScrollFrame);
            autoScrollFrame = null;
          }
          autoScrollDelta = 0;
          scrollEl2 = null;
          const droppedEl = evt == null ? void 0 : evt.item;
          if (droppedEl) {
            droppedEl.classList.add("local-gpt-drop-animate");
            droppedEl.addEventListener(
              "animationend",
              () => droppedEl.classList.remove(
                "local-gpt-drop-animate"
              ),
              { once: true }
            );
            const prevEl = droppedEl.previousElementSibling;
            const nextEl2 = droppedEl.nextElementSibling;
            if (prevEl && prevEl.classList.contains("setting-item")) {
              prevEl.classList.add(
                "local-gpt-drop-neighbor-prev"
              );
              prevEl.addEventListener(
                "animationend",
                () => prevEl.classList.remove(
                  "local-gpt-drop-neighbor-prev"
                ),
                { once: true }
              );
            }
            if (nextEl2 && nextEl2.classList.contains("setting-item")) {
              nextEl2.classList.add(
                "local-gpt-drop-neighbor-next"
              );
              nextEl2.addEventListener(
                "animationend",
                () => nextEl2.classList.remove(
                  "local-gpt-drop-neighbor-next"
                ),
                { once: true }
              );
            }
          }
          if (evt.oldIndex !== void 0 && evt.newIndex !== void 0 && evt.oldIndex !== evt.newIndex) {
            const [moved2] = this.plugin.settings.actions.splice(
              evt.oldIndex,
              1
            );
            this.plugin.settings.actions.splice(
              evt.newIndex,
              0,
              moved2
            );
            await this.plugin.saveSettings();
          }
        }
      });
    }
    if (this.plugin.settings.actions.length) {
      new import_obsidian.Setting(containerEl).setName("").addButton((button) => {
        this.changingOrder && button.setCta();
        button.setButtonText(
          this.changingOrder ? I18n.t("settings.done") : I18n.t("settings.changeOrder")
        ).onClick(async () => {
          this.changingOrder = !this.changingOrder;
          this.display();
        });
      });
    }
    new import_obsidian.Setting(containerEl).setHeading().setName(I18n.t("settings.advancedSettings")).setDesc(I18n.t("settings.advancedSettingsDesc")).setClass("local-gpt-advanced-toggle").addToggle(
      (toggle) => toggle.setValue(this.isAdvancedMode).onChange((value) => {
        this.isAdvancedMode = value;
        this.display();
      })
    );
    if (this.isAdvancedMode) {
      const enhancedSection = containerEl.createDiv(
        "local-gpt-advanced-group"
      );
      enhancedSection.createEl("h4", {
        text: I18n.t("settings.enhancedActions")
      });
      new import_obsidian.Setting(enhancedSection).setName(I18n.t("settings.enhancedActionsLabel")).setDesc(I18n.t("settings.enhancedActionsDesc")).setClass("ai-providers-select").addDropdown((dropdown) => {
        dropdown.addOptions({
          local: I18n.t("settings.contextLimitLocal"),
          cloud: I18n.t("settings.contextLimitCloud"),
          advanced: I18n.t("settings.contextLimitAdvanced"),
          max: I18n.t("settings.contextLimitMax")
        }).setValue(
          String(
            this.plugin.settings.defaults.contextLimit || "local"
          )
        ).onChange(async (value) => {
          this.plugin.settings.defaults.contextLimit = value;
          await this.plugin.saveSettings();
        });
      });
      const dangerSection = containerEl.createDiv(
        "local-gpt-advanced-group"
      );
      dangerSection.createEl("h4", {
        text: I18n.t("settings.dangerZone")
      });
      new import_obsidian.Setting(dangerSection).setName(I18n.t("settings.resetActions")).setDesc(I18n.t("settings.resetActionsDesc")).addButton(
        (button) => button.setClass("mod-warning").setButtonText(I18n.t("settings.reset")).onClick(async () => {
          if (!this.isConfirmingReset) {
            this.isConfirmingReset = true;
            button.setButtonText(
              I18n.t("settings.confirmReset")
            );
            return;
          }
          button.setDisabled(true);
          button.buttonEl.setAttribute("disabled", "true");
          button.buttonEl.classList.remove("mod-warning");
          this.plugin.settings.actions = DEFAULT_SETTINGS.actions;
          await this.plugin.saveSettings();
          this.isConfirmingReset = false;
          this.display();
        })
      );
    }
  }
  async addNewAction(editingAction) {
    const alreadyExistingActionIndex = this.plugin.settings.actions.findIndex(
      (action) => action.name === editingAction.name
    );
    if (alreadyExistingActionIndex >= 0) {
      this.plugin.settings.actions[alreadyExistingActionIndex] = editingAction;
      new import_obsidian.Notice(
        I18n.t("notices.actionRewritten", { name: editingAction.name })
      );
    } else {
      this.plugin.settings.actions = [
        editingAction,
        ...this.plugin.settings.actions
      ];
      new import_obsidian.Notice(
        I18n.t("notices.actionAdded", { name: editingAction.name })
      );
    }
    await this.plugin.saveSettings();
  }
};

// src/spinnerPlugin.ts
var import_state = require("@codemirror/state");
var import_view = require("@codemirror/view");
var _LoaderWidget = class extends import_view.WidgetType {
  toDOM(view) {
    return _LoaderWidget.element.cloneNode(true);
  }
};
var LoaderWidget = _LoaderWidget;
LoaderWidget.element = document.createElement("span");
(() => {
  _LoaderWidget.element.addClasses(["local-gpt-loading", "local-gpt-dots"]);
})();
var ThinkingWidget = class extends import_view.WidgetType {
  static createDOMStructure() {
    const container = document.createElement("div");
    container.addClass("local-gpt-thinking-container");
    container.appendChild(document.createElement("br"));
    const textElement = document.createElement("span");
    textElement.addClass("local-gpt-thinking");
    textElement.textContent = "Thinking";
    textElement.setAttribute("data-text", "Thinking");
    container.appendChild(textElement);
    return container;
  }
  toDOM(view) {
    return ThinkingWidget.createDOMStructure();
  }
};
var ContentWidget = class extends import_view.WidgetType {
  constructor(text2) {
    super();
    this.text = text2;
    this.dom = null;
  }
  eq(other) {
    return other.text === this.text;
  }
  updateText(newText) {
    if (this.dom && this.text !== newText) {
      const addedText = newText.slice(this.text.length);
      this.dom.textContent = newText.slice(0, -addedText.length);
      let lastSpan = this.dom.querySelector("span:last-child");
      if (!lastSpan) {
        lastSpan = document.createElement("span");
        this.dom.appendChild(lastSpan);
      }
      lastSpan.textContent = addedText;
      this.text = newText;
    }
  }
  toDOM(view) {
    if (!this.dom) {
      this.dom = document.createElement("div");
      this.dom.addClass("local-gpt-content");
      this.updateText(this.text);
    }
    return this.dom;
  }
};
var SpinnerPlugin = class {
  constructor(editorView) {
    this.editorView = editorView;
    this.positions = /* @__PURE__ */ new Map();
    this.decorations = import_view.Decoration.none;
  }
  /**
   * Process text with potential <think> tags and update UI accordingly
   *
   * @param text Raw text that may include <think> tags
   * @param processFunc Optional function to process the display text
   * @param position Optional position to update specific spinner
   * @returns void
   */
  processText(text2, processFunc, position) {
    const result = this.processThinkingTags(text2);
    this.showThinking(result.isThinking, position);
    if (result.displayText.trim()) {
      const displayText = processFunc ? processFunc(result.displayText) : result.displayText;
      this.updateContent(displayText, position);
    }
  }
  /**
   * Process text with potential <think> tags
   *
   * @param text Raw text that may contain <think> tags
   * @returns Object with parsed thinking state and display text
   */
  processThinkingTags(text2) {
    if (!text2.startsWith("<think>")) {
      return {
        isThinking: false,
        displayText: text2
      };
    }
    const thinkingMatch = text2.match(
      /^<think>([\s\S]*?)(<\/think>\s*([\s\S]*))?$/
    );
    if (!thinkingMatch) {
      return {
        isThinking: true,
        displayText: ""
        // No display text while in thinking mode
      };
    }
    if (thinkingMatch[2]) {
      const afterThinkTag = thinkingMatch[3] || "";
      return {
        isThinking: false,
        displayText: afterThinkTag
      };
    }
    return {
      isThinking: true,
      displayText: ""
      // No display text while in thinking mode
    };
  }
  show(position) {
    const isEndOfLine = this.isPositionAtEndOfLine(
      this.editorView.state,
      position
    );
    this.positions.set(position, {
      isEndOfLine,
      widget: new LoaderWidget(),
      isThinking: false
    });
    this.updateDecorations();
    return () => this.hide(position);
  }
  hide(position) {
    this.positions.delete(position);
    this.updateDecorations();
  }
  showThinking(enabled, position) {
    let updated = false;
    const updatePosition = (data) => {
      if (enabled && !data.isThinking) {
        data.widget = new ThinkingWidget();
        data.isThinking = true;
        updated = true;
      } else if (!enabled && data.isThinking) {
        data.widget = new LoaderWidget();
        data.isThinking = false;
        updated = true;
      }
    };
    if (position !== void 0) {
      const data = this.positions.get(position);
      if (data)
        updatePosition(data);
    } else {
      this.positions.forEach(updatePosition);
    }
    if (updated) {
      this.updateDecorations();
    }
  }
  updateContent(text2, position) {
    let updated = false;
    const updatePosition = (data) => {
      if (data.isThinking)
        return;
      if (data.widget instanceof LoaderWidget) {
        data.widget = new ContentWidget(text2);
        updated = true;
      } else if (data.widget instanceof ContentWidget) {
        data.widget.updateText(text2);
        updated = true;
      }
    };
    if (position !== void 0) {
      const data = this.positions.get(position);
      if (data)
        updatePosition(data);
    } else {
      this.positions.forEach(updatePosition);
    }
    if (updated) {
      this.updateDecorations();
    }
  }
  update(update2) {
    if (update2.docChanged || update2.viewportChanged) {
      this.updateDecorations();
    }
  }
  updateDecorations() {
    const builder = new import_state.RangeSetBuilder();
    this.positions.forEach((data, position) => {
      builder.add(
        position,
        position,
        import_view.Decoration.widget({
          widget: data.widget,
          side: data.isEndOfLine ? 1 : -1
        })
      );
    });
    this.decorations = builder.finish();
    this.editorView.requestMeasure();
  }
  isPositionAtEndOfLine(state, position) {
    return position === state.doc.lineAt(position).to;
  }
};
var spinnerPlugin = import_view.ViewPlugin.fromClass(SpinnerPlugin, {
  decorations: (v) => v.decorations
});

// src/ui/actionPalettePlugin.ts
var import_state2 = require("@codemirror/state");
var import_view2 = require("@codemirror/view");

// node_modules/svelte/src/runtime/internal/utils.js
function noop() {
}
function run(fn) {
  return fn();
}
function blank_object() {
  return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
  fns.forEach(run);
}
function is_function(thing) {
  return typeof thing === "function";
}
function safe_not_equal(a, b) {
  return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
}
function is_empty(obj) {
  return Object.keys(obj).length === 0;
}

// node_modules/svelte/src/runtime/internal/globals.js
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : (
  // @ts-ignore Node typings have this
  global
);

// node_modules/svelte/src/runtime/internal/ResizeObserverSingleton.js
var ResizeObserverSingleton = class {
  /** @param {ResizeObserverOptions} options */
  constructor(options) {
    /**
     * @private
     * @readonly
     * @type {WeakMap<Element, import('./private.js').Listener>}
     */
    __publicField(this, "_listeners", "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0);
    /**
     * @private
     * @type {ResizeObserver}
     */
    __publicField(this, "_observer");
    /** @type {ResizeObserverOptions} */
    __publicField(this, "options");
    this.options = options;
  }
  /**
   * @param {Element} element
   * @param {import('./private.js').Listener} listener
   * @returns {() => void}
   */
  observe(element2, listener) {
    this._listeners.set(element2, listener);
    this._getObserver().observe(element2, this.options);
    return () => {
      this._listeners.delete(element2);
      this._observer.unobserve(element2);
    };
  }
  /**
   * @private
   */
  _getObserver() {
    var _a2;
    return (_a2 = this._observer) != null ? _a2 : this._observer = new ResizeObserver((entries) => {
      var _a3;
      for (const entry of entries) {
        ResizeObserverSingleton.entries.set(entry.target, entry);
        (_a3 = this._listeners.get(entry.target)) == null ? void 0 : _a3(entry);
      }
    });
  }
};
ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;

// node_modules/svelte/src/runtime/internal/dom.js
var is_hydrating = false;
function start_hydrating() {
  is_hydrating = true;
}
function end_hydrating() {
  is_hydrating = false;
}
function append(target, node) {
  target.appendChild(node);
}
function insert(target, node, anchor) {
  target.insertBefore(node, anchor || null);
}
function detach(node) {
  if (node.parentNode) {
    node.parentNode.removeChild(node);
  }
}
function destroy_each(iterations, detaching) {
  for (let i = 0; i < iterations.length; i += 1) {
    if (iterations[i])
      iterations[i].d(detaching);
  }
}
function element(name) {
  return document.createElement(name);
}
function text(data) {
  return document.createTextNode(data);
}
function space() {
  return text(" ");
}
function empty() {
  return text("");
}
function listen(node, event, handler, options) {
  node.addEventListener(event, handler, options);
  return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
  if (value == null)
    node.removeAttribute(attribute);
  else if (node.getAttribute(attribute) !== value)
    node.setAttribute(attribute, value);
}
function children(element2) {
  return Array.from(element2.childNodes);
}
function set_data(text2, data) {
  data = "" + data;
  if (text2.data === data)
    return;
  text2.data = /** @type {string} */
  data;
}
function set_style(node, key, value, important) {
  if (value == null) {
    node.style.removeProperty(key);
  } else {
    node.style.setProperty(key, value, important ? "important" : "");
  }
}
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
  return new CustomEvent(type, { detail, bubbles, cancelable });
}
function get_custom_elements_slots(element2) {
  const result = {};
  element2.childNodes.forEach(
    /** @param {Element} node */
    (node) => {
      result[node.slot || "default"] = true;
    }
  );
  return result;
}

// node_modules/svelte/src/runtime/internal/lifecycle.js
var current_component;
function set_current_component(component) {
  current_component = component;
}
function get_current_component() {
  if (!current_component)
    throw new Error("Function called outside component initialization");
  return current_component;
}
function onMount(fn) {
  get_current_component().$$.on_mount.push(fn);
}
function createEventDispatcher() {
  const component = get_current_component();
  return (type, detail, { cancelable = false } = {}) => {
    const callbacks = component.$$.callbacks[type];
    if (callbacks) {
      const event = custom_event(
        /** @type {string} */
        type,
        detail,
        { cancelable }
      );
      callbacks.slice().forEach((fn) => {
        fn.call(component, event);
      });
      return !event.defaultPrevented;
    }
    return true;
  };
}

// node_modules/svelte/src/runtime/internal/scheduler.js
var dirty_components = [];
var binding_callbacks = [];
var render_callbacks = [];
var flush_callbacks = [];
var resolved_promise = /* @__PURE__ */ Promise.resolve();
var update_scheduled = false;
function schedule_update() {
  if (!update_scheduled) {
    update_scheduled = true;
    resolved_promise.then(flush);
  }
}
function tick() {
  schedule_update();
  return resolved_promise;
}
function add_render_callback(fn) {
  render_callbacks.push(fn);
}
var seen_callbacks = /* @__PURE__ */ new Set();
var flushidx = 0;
function flush() {
  if (flushidx !== 0) {
    return;
  }
  const saved_component = current_component;
  do {
    try {
      while (flushidx < dirty_components.length) {
        const component = dirty_components[flushidx];
        flushidx++;
        set_current_component(component);
        update(component.$$);
      }
    } catch (e) {
      dirty_components.length = 0;
      flushidx = 0;
      throw e;
    }
    set_current_component(null);
    dirty_components.length = 0;
    flushidx = 0;
    while (binding_callbacks.length)
      binding_callbacks.pop()();
    for (let i = 0; i < render_callbacks.length; i += 1) {
      const callback = render_callbacks[i];
      if (!seen_callbacks.has(callback)) {
        seen_callbacks.add(callback);
        callback();
      }
    }
    render_callbacks.length = 0;
  } while (dirty_components.length);
  while (flush_callbacks.length) {
    flush_callbacks.pop()();
  }
  update_scheduled = false;
  seen_callbacks.clear();
  set_current_component(saved_component);
}
function update($$) {
  if ($$.fragment !== null) {
    $$.update();
    run_all($$.before_update);
    const dirty = $$.dirty;
    $$.dirty = [-1];
    $$.fragment && $$.fragment.p($$.ctx, dirty);
    $$.after_update.forEach(add_render_callback);
  }
}
function flush_render_callbacks(fns) {
  const filtered = [];
  const targets = [];
  render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
  targets.forEach((c) => c());
  render_callbacks = filtered;
}

// node_modules/svelte/src/runtime/internal/transitions.js
var outroing = /* @__PURE__ */ new Set();
function transition_in(block, local) {
  if (block && block.i) {
    outroing.delete(block);
    block.i(local);
  }
}

// node_modules/svelte/src/runtime/internal/each.js
function ensure_array_like(array_like_or_iterator) {
  return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
}

// node_modules/svelte/src/shared/boolean_attributes.js
var _boolean_attributes = (
  /** @type {const} */
  [
    "allowfullscreen",
    "allowpaymentrequest",
    "async",
    "autofocus",
    "autoplay",
    "checked",
    "controls",
    "default",
    "defer",
    "disabled",
    "formnovalidate",
    "hidden",
    "inert",
    "ismap",
    "loop",
    "multiple",
    "muted",
    "nomodule",
    "novalidate",
    "open",
    "playsinline",
    "readonly",
    "required",
    "reversed",
    "selected"
  ]
);
var boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);

// node_modules/svelte/src/runtime/internal/Component.js
function mount_component(component, target, anchor) {
  const { fragment, after_update } = component.$$;
  fragment && fragment.m(target, anchor);
  add_render_callback(() => {
    const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
    if (component.$$.on_destroy) {
      component.$$.on_destroy.push(...new_on_destroy);
    } else {
      run_all(new_on_destroy);
    }
    component.$$.on_mount = [];
  });
  after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
  const $$ = component.$$;
  if ($$.fragment !== null) {
    flush_render_callbacks($$.after_update);
    run_all($$.on_destroy);
    $$.fragment && $$.fragment.d(detaching);
    $$.on_destroy = $$.fragment = null;
    $$.ctx = [];
  }
}
function make_dirty(component, i) {
  if (component.$$.dirty[0] === -1) {
    dirty_components.push(component);
    schedule_update();
    component.$$.dirty.fill(0);
  }
  component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
}
function init(component, options, instance2, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) {
  const parent_component = current_component;
  set_current_component(component);
  const $$ = component.$$ = {
    fragment: null,
    ctx: [],
    // state
    props,
    update: noop,
    not_equal,
    bound: blank_object(),
    // lifecycle
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
    // everything else
    callbacks: blank_object(),
    dirty,
    skip_bound: false,
    root: options.target || parent_component.$$.root
  };
  append_styles && append_styles($$.root);
  let ready = false;
  $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => {
    const value = rest.length ? rest[0] : ret;
    if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
      if (!$$.skip_bound && $$.bound[i])
        $$.bound[i](value);
      if (ready)
        make_dirty(component, i);
    }
    return ret;
  }) : [];
  $$.update();
  ready = true;
  run_all($$.before_update);
  $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false;
  if (options.target) {
    if (options.hydrate) {
      start_hydrating();
      const nodes = children(options.target);
      $$.fragment && $$.fragment.l(nodes);
      nodes.forEach(detach);
    } else {
      $$.fragment && $$.fragment.c();
    }
    if (options.intro)
      transition_in(component.$$.fragment);
    mount_component(component, options.target, options.anchor);
    end_hydrating();
    flush();
  }
  set_current_component(parent_component);
}
var SvelteElement;
if (typeof HTMLElement === "function") {
  SvelteElement = class extends HTMLElement {
    constructor($$componentCtor, $$slots, use_shadow_dom) {
      super();
      /** The Svelte component constructor */
      __publicField(this, "$$ctor");
      /** Slots */
      __publicField(this, "$$s");
      /** The Svelte component instance */
      __publicField(this, "$$c");
      /** Whether or not the custom element is connected */
      __publicField(this, "$$cn", false);
      /** 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, Function[]>} Event listeners */
      __publicField(this, "$$l", {});
      /** @type {Map<Function, Function>} Event listener unsubscribe functions */
      __publicField(this, "$$l_u", /* @__PURE__ */ new Map());
      this.$$ctor = $$componentCtor;
      this.$$s = $$slots;
      if (use_shadow_dom) {
        this.attachShadow({ mode: "open" });
      }
    }
    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);
    }
    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);
        }
      }
      if (this.$$l[type]) {
        const idx = this.$$l[type].indexOf(listener);
        if (idx >= 0) {
          this.$$l[type].splice(idx, 1);
        }
      }
    }
    async connectedCallback() {
      this.$$cn = true;
      if (!this.$$c) {
        let create_slot = function(name) {
          return () => {
            let node;
            const obj = {
              c: function create() {
                node = element("slot");
                if (name !== "default") {
                  attr(node, "name", name);
                }
              },
              /**
               * @param {HTMLElement} target
               * @param {HTMLElement} [anchor]
               */
              m: function mount2(target, anchor) {
                insert(target, node, anchor);
              },
              d: function destroy2(detaching) {
                if (detaching) {
                  detach(node);
                }
              }
            };
            return obj;
          };
        };
        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) {
            $$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 key in this.$$p_d) {
          if (!(key in this.$$d) && this[key] !== void 0) {
            this.$$d[key] = this[key];
            delete this[key];
          }
        }
        this.$$c = new this.$$ctor({
          target: this.shadowRoot || this,
          props: {
            ...this.$$d,
            $$slots,
            $$scope: {
              ctx: []
            }
          }
        });
        const reflect_attributes = () => {
          this.$$r = true;
          for (const key in this.$$p_d) {
            this.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];
            if (this.$$p_d[key].reflect) {
              const attribute_value = get_custom_element_value(
                key,
                this.$$d[key],
                this.$$p_d,
                "toAttribute"
              );
              if (attribute_value == null) {
                this.removeAttribute(this.$$p_d[key].attribute || key);
              } else {
                this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
              }
            }
          }
          this.$$r = false;
        };
        this.$$c.$$.after_update.push(reflect_attributes);
        reflect_attributes();
        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
    attributeChangedCallback(attr2, _oldValue, newValue) {
      var _a2;
      if (this.$$r)
        return;
      attr2 = this.$$g_p(attr2);
      this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp");
      (_a2 = this.$$c) == null ? void 0 : _a2.$set({ [attr2]: this.$$d[attr2] });
    }
    disconnectedCallback() {
      this.$$cn = false;
      Promise.resolve().then(() => {
        if (!this.$$cn && this.$$c) {
          this.$$c.$destroy();
          this.$$c = void 0;
        }
      });
    }
    $$g_p(attribute_name) {
      return Object.keys(this.$$p_d).find(
        (key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name
      ) || attribute_name;
    }
  };
}
function get_custom_element_value(prop, value, props_definition, transform) {
  var _a2;
  const type = (_a2 = props_definition[prop]) == null ? void 0 : _a2.type;
  value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
  if (!transform || !props_definition[prop]) {
    return value;
  } else if (transform === "toAttribute") {
    switch (type) {
      case "Object":
      case "Array":
        return value == null ? null : JSON.stringify(value);
      case "Boolean":
        return value ? "" : null;
      case "Number":
        return value == null ? null : value;
      default:
        return value;
    }
  } else {
    switch (type) {
      case "Object":
      case "Array":
        return value && JSON.parse(value);
      case "Boolean":
        return value;
      case "Number":
        return value != null ? +value : value;
      default:
        return value;
    }
  }
}
var SvelteComponent = class {
  constructor() {
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    __publicField(this, "$$");
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    __publicField(this, "$$set");
  }
  /** @returns {void} */
  $destroy() {
    destroy_component(this, 1);
    this.$destroy = noop;
  }
  /**
   * @template {Extract<keyof Events, string>} K
   * @param {K} type
   * @param {((e: Events[K]) => void) | null | undefined} callback
   * @returns {() => void}
   */
  $on(type, callback) {
    if (!is_function(callback)) {
      return noop;
    }
    const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
    callbacks.push(callback);
    return () => {
      const index2 = callbacks.indexOf(callback);
      if (index2 !== -1)
        callbacks.splice(index2, 1);
    };
  }
  /**
   * @param {Partial<Props>} props
   * @returns {void}
   */
  $set(props) {
    if (this.$$set && !is_empty(props)) {
      this.$$.skip_bound = true;
      this.$$set(props);
      this.$$.skip_bound = false;
    }
  }
};

// node_modules/svelte/src/shared/version.js
var PUBLIC_VERSION = "4";

// node_modules/svelte/src/runtime/internal/disclose-version/index.js
if (typeof window !== "undefined")
  (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);

// node_modules/tslib/tslib.es6.js
function __awaiter(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function(resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
}

// src/ui/actionPaletteHistory.ts
var PROMPT_HISTORY_LIMIT = 50;
var HISTORY_STORAGE_KEY = "local-gpt-action-palette-history";
var promptHistory = loadHistoryFromStorage();
function loadHistoryFromStorage() {
  if (typeof localStorage === "undefined")
    return [];
  try {
    const raw = localStorage.getItem(HISTORY_STORAGE_KEY);
    if (!raw)
      return [];
    const parsed = JSON.parse(raw);
    if (!Array.isArray(parsed))
      return [];
    return parsed.filter((item) => typeof item === "string").slice(-PROMPT_HISTORY_LIMIT);
  } catch (error) {
    console.error("Failed to read Action Palette history:", error);
    return [];
  }
}
function persistHistory() {
  if (typeof localStorage === "undefined")
    return;
  try {
    localStorage.setItem(
      HISTORY_STORAGE_KEY,
      JSON.stringify(promptHistory.slice(-PROMPT_HISTORY_LIMIT))
    );
  } catch (error) {
    console.error("Failed to save Action Palette history:", error);
  }
}
function addToPromptHistory(entry) {
  var _a2;
  const normalized = entry.trim();
  if (!normalized)
    return;
  const lastNormalized = (_a2 = promptHistory[promptHistory.length - 1]) == null ? void 0 : _a2.trim();
  if (lastNormalized === normalized)
    return;
  promptHistory.push(entry);
  if (promptHistory.length > PROMPT_HISTORY_LIMIT) {
    promptHistory.shift();
  }
  persistHistory();
}
function getPromptHistoryEntry(index2) {
  return promptHistory[index2];
}
function getPromptHistoryLength() {
  return promptHistory.length;
}

// src/ui/ActionPalette.svelte
function get_each_context(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function get_each_context_1(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function get_each_context_2(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function get_each_context_3(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function get_each_context_4(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function get_each_context_5(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[119] = list[i];
  child_ctx[121] = i;
  return child_ctx;
}
function create_if_block_1(ctx) {
  let div0;
  let t0;
  let div1;
  let t1;
  let div2;
  let t2;
  let div3;
  let t3;
  let div4;
  let t4;
  let div5;
  let each_value_5 = ensure_array_like(
    /*fileItems*/
    ctx[11]
  );
  let each_blocks_5 = [];
  for (let i = 0; i < each_value_5.length; i += 1) {
    each_blocks_5[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
  }
  let each_value_4 = ensure_array_like(
    /*commandItems*/
    ctx[12]
  );
  let each_blocks_4 = [];
  for (let i = 0; i < each_value_4.length; i += 1) {
    each_blocks_4[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
  }
  let each_value_3 = ensure_array_like(
    /*providerItems*/
    ctx[13]
  );
  let each_blocks_3 = [];
  for (let i = 0; i < each_value_3.length; i += 1) {
    each_blocks_3[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
  }
  let each_value_2 = ensure_array_like(
    /*modelItems*/
    ctx[14]
  );
  let each_blocks_2 = [];
  for (let i = 0; i < each_value_2.length; i += 1) {
    each_blocks_2[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
  }
  let each_value_1 = ensure_array_like(
    /*creativityItems*/
    ctx[15]
  );
  let each_blocks_1 = [];
  for (let i = 0; i < each_value_1.length; i += 1) {
    each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
  }
  let each_value = ensure_array_like(
    /*systemItems*/
    ctx[16]
  );
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
  }
  return {
    c() {
      div0 = element("div");
      for (let i = 0; i < each_blocks_5.length; i += 1) {
        each_blocks_5[i].c();
      }
      t0 = space();
      div1 = element("div");
      for (let i = 0; i < each_blocks_4.length; i += 1) {
        each_blocks_4[i].c();
      }
      t1 = space();
      div2 = element("div");
      for (let i = 0; i < each_blocks_3.length; i += 1) {
        each_blocks_3[i].c();
      }
      t2 = space();
      div3 = element("div");
      for (let i = 0; i < each_blocks_2.length; i += 1) {
        each_blocks_2[i].c();
      }
      t3 = space();
      div4 = element("div");
      for (let i = 0; i < each_blocks_1.length; i += 1) {
        each_blocks_1[i].c();
      }
      t4 = space();
      div5 = element("div");
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      attr(div0, "class", "local-gpt-dropdown");
      set_style(
        div0,
        "display",
        /*activeDropdown*/
        ctx[2] === "file" ? "block" : "none"
      );
      attr(div1, "class", "local-gpt-dropdown");
      set_style(
        div1,
        "display",
        /*activeDropdown*/
        ctx[2] === "command" ? "block" : "none"
      );
      attr(div2, "class", "local-gpt-dropdown");
      set_style(
        div2,
        "display",
        /*activeDropdown*/
        ctx[2] === "provider" ? "block" : "none"
      );
      attr(div3, "class", "local-gpt-dropdown");
      set_style(
        div3,
        "display",
        /*activeDropdown*/
        ctx[2] === "model" ? "block" : "none"
      );
      attr(div4, "class", "local-gpt-dropdown");
      set_style(
        div4,
        "display",
        /*activeDropdown*/
        ctx[2] === "creativity" ? "block" : "none"
      );
      attr(div5, "class", "local-gpt-dropdown");
      set_style(
        div5,
        "display",
        /*activeDropdown*/
        ctx[2] === "system" ? "block" : "none"
      );
    },
    m(target, anchor) {
      insert(target, div0, anchor);
      for (let i = 0; i < each_blocks_5.length; i += 1) {
        if (each_blocks_5[i]) {
          each_blocks_5[i].m(div0, null);
        }
      }
      ctx[36](div0);
      insert(target, t0, anchor);
      insert(target, div1, anchor);
      for (let i = 0; i < each_blocks_4.length; i += 1) {
        if (each_blocks_4[i]) {
          each_blocks_4[i].m(div1, null);
        }
      }
      ctx[39](div1);
      insert(target, t1, anchor);
      insert(target, div2, anchor);
      for (let i = 0; i < each_blocks_3.length; i += 1) {
        if (each_blocks_3[i]) {
          each_blocks_3[i].m(div2, null);
        }
      }
      ctx[42](div2);
      insert(target, t2, anchor);
      insert(target, div3, anchor);
      for (let i = 0; i < each_blocks_2.length; i += 1) {
        if (each_blocks_2[i]) {
          each_blocks_2[i].m(div3, null);
        }
      }
      ctx[45](div3);
      insert(target, t3, anchor);
      insert(target, div4, anchor);
      for (let i = 0; i < each_blocks_1.length; i += 1) {
        if (each_blocks_1[i]) {
          each_blocks_1[i].m(div4, null);
        }
      }
      ctx[48](div4);
      insert(target, t4, anchor);
      insert(target, div5, anchor);
      for (let i = 0; i < each_blocks.length; i += 1) {
        if (each_blocks[i]) {
          each_blocks[i].m(div5, null);
        }
      }
      ctx[51](div5);
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*selectedIndex, handleSelection, fileItems, activeDropdown*/
      2230276) {
        each_value_5 = ensure_array_like(
          /*fileItems*/
          ctx2[11]
        );
        let i;
        for (i = 0; i < each_value_5.length; i += 1) {
          const child_ctx = get_each_context_5(ctx2, each_value_5, i);
          if (each_blocks_5[i]) {
            each_blocks_5[i].p(child_ctx, dirty);
          } else {
            each_blocks_5[i] = create_each_block_5(child_ctx);
            each_blocks_5[i].c();
            each_blocks_5[i].m(div0, null);
          }
        }
        for (; i < each_blocks_5.length; i += 1) {
          each_blocks_5[i].d(1);
        }
        each_blocks_5.length = each_value_5.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div0,
          "display",
          /*activeDropdown*/
          ctx2[2] === "file" ? "block" : "none"
        );
      }
      if (dirty[0] & /*selectedIndex, handleSelection, commandItems, activeDropdown*/
      2232324) {
        each_value_4 = ensure_array_like(
          /*commandItems*/
          ctx2[12]
        );
        let i;
        for (i = 0; i < each_value_4.length; i += 1) {
          const child_ctx = get_each_context_4(ctx2, each_value_4, i);
          if (each_blocks_4[i]) {
            each_blocks_4[i].p(child_ctx, dirty);
          } else {
            each_blocks_4[i] = create_each_block_4(child_ctx);
            each_blocks_4[i].c();
            each_blocks_4[i].m(div1, null);
          }
        }
        for (; i < each_blocks_4.length; i += 1) {
          each_blocks_4[i].d(1);
        }
        each_blocks_4.length = each_value_4.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div1,
          "display",
          /*activeDropdown*/
          ctx2[2] === "command" ? "block" : "none"
        );
      }
      if (dirty[0] & /*selectedIndex, handleSelection, providerItems, activeDropdown*/
      2236420) {
        each_value_3 = ensure_array_like(
          /*providerItems*/
          ctx2[13]
        );
        let i;
        for (i = 0; i < each_value_3.length; i += 1) {
          const child_ctx = get_each_context_3(ctx2, each_value_3, i);
          if (each_blocks_3[i]) {
            each_blocks_3[i].p(child_ctx, dirty);
          } else {
            each_blocks_3[i] = create_each_block_3(child_ctx);
            each_blocks_3[i].c();
            each_blocks_3[i].m(div2, null);
          }
        }
        for (; i < each_blocks_3.length; i += 1) {
          each_blocks_3[i].d(1);
        }
        each_blocks_3.length = each_value_3.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div2,
          "display",
          /*activeDropdown*/
          ctx2[2] === "provider" ? "block" : "none"
        );
      }
      if (dirty[0] & /*selectedIndex, handleSelection, modelItems, activeDropdown*/
      2244612) {
        each_value_2 = ensure_array_like(
          /*modelItems*/
          ctx2[14]
        );
        let i;
        for (i = 0; i < each_value_2.length; i += 1) {
          const child_ctx = get_each_context_2(ctx2, each_value_2, i);
          if (each_blocks_2[i]) {
            each_blocks_2[i].p(child_ctx, dirty);
          } else {
            each_blocks_2[i] = create_each_block_2(child_ctx);
            each_blocks_2[i].c();
            each_blocks_2[i].m(div3, null);
          }
        }
        for (; i < each_blocks_2.length; i += 1) {
          each_blocks_2[i].d(1);
        }
        each_blocks_2.length = each_value_2.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div3,
          "display",
          /*activeDropdown*/
          ctx2[2] === "model" ? "block" : "none"
        );
      }
      if (dirty[0] & /*selectedIndex, handleSelection, creativityItems, activeDropdown*/
      2260996) {
        each_value_1 = ensure_array_like(
          /*creativityItems*/
          ctx2[15]
        );
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1(ctx2, each_value_1, i);
          if (each_blocks_1[i]) {
            each_blocks_1[i].p(child_ctx, dirty);
          } else {
            each_blocks_1[i] = create_each_block_1(child_ctx);
            each_blocks_1[i].c();
            each_blocks_1[i].m(div4, null);
          }
        }
        for (; i < each_blocks_1.length; i += 1) {
          each_blocks_1[i].d(1);
        }
        each_blocks_1.length = each_value_1.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div4,
          "display",
          /*activeDropdown*/
          ctx2[2] === "creativity" ? "block" : "none"
        );
      }
      if (dirty[0] & /*selectedIndex, handleSelection, systemItems, activeDropdown*/
      2293764) {
        each_value = ensure_array_like(
          /*systemItems*/
          ctx2[16]
        );
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(div5, null);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value.length;
      }
      if (dirty[0] & /*activeDropdown*/
      4) {
        set_style(
          div5,
          "display",
          /*activeDropdown*/
          ctx2[2] === "system" ? "block" : "none"
        );
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div0);
        detach(t0);
        detach(div1);
        detach(t1);
        detach(div2);
        detach(t2);
        detach(div3);
        detach(t3);
        detach(div4);
        detach(t4);
        detach(div5);
      }
      destroy_each(each_blocks_5, detaching);
      ctx[36](null);
      destroy_each(each_blocks_4, detaching);
      ctx[39](null);
      destroy_each(each_blocks_3, detaching);
      ctx[42](null);
      destroy_each(each_blocks_2, detaching);
      ctx[45](null);
      destroy_each(each_blocks_1, detaching);
      ctx[48](null);
      destroy_each(each_blocks, detaching);
      ctx[51](null);
    }
  };
}
function create_if_block_8(ctx) {
  let div;
  let span0;
  let t0_value = (
    /*item*/
    ctx[119].basename + ""
  );
  let t0;
  let t1;
  let t2_value = (
    /*item*/
    ctx[119].extension + ""
  );
  let t2;
  let t3;
  let span1;
  let t4_value = (
    /*item*/
    ctx[119].path + ""
  );
  let t4;
  let t5;
  let div_class_value;
  let div_aria_selected_value;
  let mounted;
  let dispose;
  function click_handler() {
    return (
      /*click_handler*/
      ctx[34](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler(...args) {
    return (
      /*keydown_handler*/
      ctx[35](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div = element("div");
      span0 = element("span");
      t0 = text(t0_value);
      t1 = text(".");
      t2 = text(t2_value);
      t3 = space();
      span1 = element("span");
      t4 = text(t4_value);
      t5 = space();
      attr(span0, "class", "local-gpt-file-name");
      attr(span1, "class", "local-gpt-file-path");
      attr(div, "class", div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div, "role", "option");
      attr(div, "tabindex", "0");
      attr(div, "aria-selected", div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span0);
      append(span0, t0);
      append(span0, t1);
      append(span0, t2);
      append(div, t3);
      append(div, span1);
      append(span1, t4);
      append(div, t5);
      if (!mounted) {
        dispose = [
          listen(div, "click", click_handler),
          listen(div, "keydown", keydown_handler)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*fileItems*/
      2048 && t0_value !== (t0_value = /*item*/
      ctx[119].basename + ""))
        set_data(t0, t0_value);
      if (dirty[0] & /*fileItems*/
      2048 && t2_value !== (t2_value = /*item*/
      ctx[119].extension + ""))
        set_data(t2, t2_value);
      if (dirty[0] & /*fileItems*/
      2048 && t4_value !== (t4_value = /*item*/
      ctx[119].path + ""))
        set_data(t4, t4_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div_class_value !== (div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div, "class", div_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div_aria_selected_value !== (div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div, "aria-selected", div_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div);
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block_5(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "file" && create_if_block_8(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "file"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_8(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block_7(ctx) {
  let div;
  let span0;
  let t0;
  let t1_value = (
    /*item*/
    ctx[119].name + ""
  );
  let t1;
  let t2;
  let span1;
  let t3_value = (
    /*item*/
    ctx[119].description + ""
  );
  let t3;
  let t4;
  let div_class_value;
  let div_aria_selected_value;
  let mounted;
  let dispose;
  function click_handler_1() {
    return (
      /*click_handler_1*/
      ctx[37](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler_1(...args) {
    return (
      /*keydown_handler_1*/
      ctx[38](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div = element("div");
      span0 = element("span");
      t0 = text("/");
      t1 = text(t1_value);
      t2 = space();
      span1 = element("span");
      t3 = text(t3_value);
      t4 = space();
      attr(span0, "class", "local-gpt-command-name");
      attr(span1, "class", "local-gpt-command-description");
      attr(div, "class", div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div, "role", "option");
      attr(div, "tabindex", "0");
      attr(div, "aria-selected", div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span0);
      append(span0, t0);
      append(span0, t1);
      append(div, t2);
      append(div, span1);
      append(span1, t3);
      append(div, t4);
      if (!mounted) {
        dispose = [
          listen(div, "click", click_handler_1),
          listen(div, "keydown", keydown_handler_1)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*commandItems*/
      4096 && t1_value !== (t1_value = /*item*/
      ctx[119].name + ""))
        set_data(t1, t1_value);
      if (dirty[0] & /*commandItems*/
      4096 && t3_value !== (t3_value = /*item*/
      ctx[119].description + ""))
        set_data(t3, t3_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div_class_value !== (div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div, "class", div_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div_aria_selected_value !== (div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div, "aria-selected", div_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div);
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block_4(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "command" && create_if_block_7(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "command"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_7(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block_5(ctx) {
  let div1;
  let div0;
  let span0;
  let t0_value = (
    /*item*/
    ctx[119].providerName + ""
  );
  let t0;
  let t1;
  let t2;
  let span1;
  let t3_value = (
    /*item*/
    ctx[119].name + ""
  );
  let t3;
  let t4;
  let div1_class_value;
  let div1_aria_selected_value;
  let mounted;
  let dispose;
  let if_block = (
    /*item*/
    ctx[119].providerUrl && create_if_block_6(ctx)
  );
  function click_handler_2() {
    return (
      /*click_handler_2*/
      ctx[40](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler_2(...args) {
    return (
      /*keydown_handler_2*/
      ctx[41](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div1 = element("div");
      div0 = element("div");
      span0 = element("span");
      t0 = text(t0_value);
      t1 = space();
      if (if_block)
        if_block.c();
      t2 = space();
      span1 = element("span");
      t3 = text(t3_value);
      t4 = space();
      attr(span0, "class", "local-gpt-provider-name");
      attr(div0, "class", "local-gpt-provider-header");
      attr(span1, "class", "local-gpt-provider-model");
      attr(div1, "class", div1_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div1, "role", "option");
      attr(div1, "tabindex", "0");
      attr(div1, "aria-selected", div1_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div1, anchor);
      append(div1, div0);
      append(div0, span0);
      append(span0, t0);
      append(div0, t1);
      if (if_block)
        if_block.m(div0, null);
      append(div1, t2);
      append(div1, span1);
      append(span1, t3);
      append(div1, t4);
      if (!mounted) {
        dispose = [
          listen(div1, "click", click_handler_2),
          listen(div1, "keydown", keydown_handler_2)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*providerItems*/
      8192 && t0_value !== (t0_value = /*item*/
      ctx[119].providerName + ""))
        set_data(t0, t0_value);
      if (
        /*item*/
        ctx[119].providerUrl
      ) {
        if (if_block) {
          if_block.p(ctx, dirty);
        } else {
          if_block = create_if_block_6(ctx);
          if_block.c();
          if_block.m(div0, null);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
      if (dirty[0] & /*providerItems*/
      8192 && t3_value !== (t3_value = /*item*/
      ctx[119].name + ""))
        set_data(t3, t3_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div1_class_value !== (div1_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div1, "class", div1_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div1_aria_selected_value !== (div1_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div1, "aria-selected", div1_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div1);
      }
      if (if_block)
        if_block.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_if_block_6(ctx) {
  let span;
  let t_value = (
    /*item*/
    ctx[119].providerUrl + ""
  );
  let t;
  return {
    c() {
      span = element("span");
      t = text(t_value);
      attr(span, "class", "local-gpt-provider-url");
    },
    m(target, anchor) {
      insert(target, span, anchor);
      append(span, t);
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*providerItems*/
      8192 && t_value !== (t_value = /*item*/
      ctx2[119].providerUrl + ""))
        set_data(t, t_value);
    },
    d(detaching) {
      if (detaching) {
        detach(span);
      }
    }
  };
}
function create_each_block_3(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "provider" && create_if_block_5(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "provider"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_5(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block_4(ctx) {
  let div;
  let span;
  let t0_value = (
    /*item*/
    ctx[119].name + ""
  );
  let t0;
  let t1;
  let div_class_value;
  let div_aria_selected_value;
  let mounted;
  let dispose;
  function click_handler_3() {
    return (
      /*click_handler_3*/
      ctx[43](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler_3(...args) {
    return (
      /*keydown_handler_3*/
      ctx[44](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div = element("div");
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
      attr(span, "class", "local-gpt-model-name");
      attr(div, "class", div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div, "role", "option");
      attr(div, "tabindex", "0");
      attr(div, "aria-selected", div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span);
      append(span, t0);
      append(div, t1);
      if (!mounted) {
        dispose = [
          listen(div, "click", click_handler_3),
          listen(div, "keydown", keydown_handler_3)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*modelItems*/
      16384 && t0_value !== (t0_value = /*item*/
      ctx[119].name + ""))
        set_data(t0, t0_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div_class_value !== (div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div, "class", div_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div_aria_selected_value !== (div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div, "aria-selected", div_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div);
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block_2(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "model" && create_if_block_4(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "model"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_4(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block_3(ctx) {
  let div;
  let span;
  let t0_value = (
    /*item*/
    ctx[119].name + ""
  );
  let t0;
  let t1;
  let div_class_value;
  let div_aria_selected_value;
  let mounted;
  let dispose;
  function click_handler_4() {
    return (
      /*click_handler_4*/
      ctx[46](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler_4(...args) {
    return (
      /*keydown_handler_4*/
      ctx[47](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div = element("div");
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
      attr(span, "class", "local-gpt-creativity-name");
      attr(div, "class", div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div, "role", "option");
      attr(div, "tabindex", "0");
      attr(div, "aria-selected", div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span);
      append(span, t0);
      append(div, t1);
      if (!mounted) {
        dispose = [
          listen(div, "click", click_handler_4),
          listen(div, "keydown", keydown_handler_4)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*creativityItems*/
      32768 && t0_value !== (t0_value = /*item*/
      ctx[119].name + ""))
        set_data(t0, t0_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div_class_value !== (div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div, "class", div_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div_aria_selected_value !== (div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div, "aria-selected", div_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div);
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block_1(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "creativity" && create_if_block_3(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "creativity"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_3(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block_2(ctx) {
  let div;
  let span0;
  let t0_value = (
    /*item*/
    ctx[119].name + ""
  );
  let t0;
  let t1;
  let span1;
  let t2_value = formatSystemPreview(
    /*item*/
    ctx[119].system
  ) + "";
  let t2;
  let t3;
  let div_class_value;
  let div_aria_selected_value;
  let mounted;
  let dispose;
  function click_handler_5() {
    return (
      /*click_handler_5*/
      ctx[49](
        /*item*/
        ctx[119]
      )
    );
  }
  function keydown_handler_5(...args) {
    return (
      /*keydown_handler_5*/
      ctx[50](
        /*item*/
        ctx[119],
        ...args
      )
    );
  }
  return {
    c() {
      div = element("div");
      span0 = element("span");
      t0 = text(t0_value);
      t1 = space();
      span1 = element("span");
      t2 = text(t2_value);
      t3 = space();
      attr(span0, "class", "local-gpt-system-name");
      attr(span1, "class", "local-gpt-system-detail");
      attr(div, "class", div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""));
      attr(div, "role", "option");
      attr(div, "tabindex", "0");
      attr(div, "aria-selected", div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17]);
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span0);
      append(span0, t0);
      append(div, t1);
      append(div, span1);
      append(span1, t2);
      append(div, t3);
      if (!mounted) {
        dispose = [
          listen(div, "click", click_handler_5),
          listen(div, "keydown", keydown_handler_5)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty[0] & /*systemItems*/
      65536 && t0_value !== (t0_value = /*item*/
      ctx[119].name + ""))
        set_data(t0, t0_value);
      if (dirty[0] & /*systemItems*/
      65536 && t2_value !== (t2_value = formatSystemPreview(
        /*item*/
        ctx[119].system
      ) + ""))
        set_data(t2, t2_value);
      if (dirty[0] & /*selectedIndex*/
      131072 && div_class_value !== (div_class_value = "local-gpt-dropdown-item " + /*index*/
      (ctx[121] === /*selectedIndex*/
      ctx[17] ? "local-gpt-selected" : ""))) {
        attr(div, "class", div_class_value);
      }
      if (dirty[0] & /*selectedIndex*/
      131072 && div_aria_selected_value !== (div_aria_selected_value = /*index*/
      ctx[121] === /*selectedIndex*/
      ctx[17])) {
        attr(div, "aria-selected", div_aria_selected_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div);
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block(ctx) {
  let if_block_anchor;
  let if_block = (
    /*activeDropdown*/
    ctx[2] === "system" && create_if_block_2(ctx)
  );
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (
        /*activeDropdown*/
        ctx2[2] === "system"
      ) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_2(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching) {
        detach(if_block_anchor);
      }
      if (if_block)
        if_block.d(detaching);
    }
  };
}
function create_if_block(ctx) {
  let div1;
  let div0;
  let t;
  let div0_class_value;
  return {
    c() {
      div1 = element("div");
      div0 = element("div");
      t = text(
        /*providerLabel*/
        ctx[0]
      );
      attr(div0, "class", div0_class_value = /*badgeHighlight*/
      ctx[18] ? "local-gpt-provider-badge-label local-gpt-badge-highlight" : "local-gpt-provider-badge-label");
      attr(div1, "class", "local-gpt-provider-badge");
      attr(div1, "aria-hidden", "true");
    },
    m(target, anchor) {
      insert(target, div1, anchor);
      append(div1, div0);
      append(div0, t);
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*providerLabel*/
      1)
        set_data(
          t,
          /*providerLabel*/
          ctx2[0]
        );
      if (dirty[0] & /*badgeHighlight*/
      262144 && div0_class_value !== (div0_class_value = /*badgeHighlight*/
      ctx2[18] ? "local-gpt-provider-badge-label local-gpt-badge-highlight" : "local-gpt-provider-badge-label")) {
        attr(div0, "class", div0_class_value);
      }
    },
    d(detaching) {
      if (detaching) {
        detach(div1);
      }
    }
  };
}
function create_fragment(ctx) {
  let div1;
  let div0;
  let t0;
  let t1;
  let mounted;
  let dispose;
  let if_block0 = (
    /*activeDropdown*/
    ctx[2] !== "none" && /*filteredItems*/
    ctx[3].length > 0 && create_if_block_1(ctx)
  );
  let if_block1 = (
    /*providerLabel*/
    ctx[0] && create_if_block(ctx)
  );
  return {
    c() {
      div1 = element("div");
      div0 = element("div");
      t0 = space();
      if (if_block0)
        if_block0.c();
      t1 = space();
      if (if_block1)
        if_block1.c();
      attr(div0, "class", "local-gpt-action-palette");
      attr(div0, "contenteditable", "true");
      attr(div0, "role", "textbox");
      attr(div0, "tabindex", "0");
      attr(
        div0,
        "aria-label",
        /*placeholder*/
        ctx[1]
      );
      attr(
        div0,
        "data-placeholder",
        /*placeholder*/
        ctx[1]
      );
      attr(div0, "spellcheck", "false");
      attr(div1, "class", "local-gpt-action-palette-shell");
    },
    m(target, anchor) {
      insert(target, div1, anchor);
      append(div1, div0);
      ctx[33](div0);
      append(div1, t0);
      if (if_block0)
        if_block0.m(div1, null);
      append(div1, t1);
      if (if_block1)
        if_block1.m(div1, null);
      if (!mounted) {
        dispose = [
          listen(
            div0,
            "keydown",
            /*handleKeydown*/
            ctx[19]
          ),
          listen(
            div0,
            "input",
            /*handleInput*/
            ctx[20]
          ),
          listen(
            div0,
            "keyup",
            /*handleKeyup*/
            ctx[23]
          ),
          listen(
            div0,
            "click",
            /*handleContentClick*/
            ctx[22]
          )
        ];
        mounted = true;
      }
    },
    p(ctx2, dirty) {
      if (dirty[0] & /*placeholder*/
      2) {
        attr(
          div0,
          "aria-label",
          /*placeholder*/
          ctx2[1]
        );
      }
      if (dirty[0] & /*placeholder*/
      2) {
        attr(
          div0,
          "data-placeholder",
          /*placeholder*/
          ctx2[1]
        );
      }
      if (
        /*activeDropdown*/
        ctx2[2] !== "none" && /*filteredItems*/
        ctx2[3].length > 0
      ) {
        if (if_block0) {
          if_block0.p(ctx2, dirty);
        } else {
          if_block0 = create_if_block_1(ctx2);
          if_block0.c();
          if_block0.m(div1, t1);
        }
      } else if (if_block0) {
        if_block0.d(1);
        if_block0 = null;
      }
      if (
        /*providerLabel*/
        ctx2[0]
      ) {
        if (if_block1) {
          if_block1.p(ctx2, dirty);
        } else {
          if_block1 = create_if_block(ctx2);
          if_block1.c();
          if_block1.m(div1, null);
        }
      } else if (if_block1) {
        if_block1.d(1);
        if_block1 = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching) {
        detach(div1);
      }
      ctx[33](null);
      if (if_block0)
        if_block0.d();
      if (if_block1)
        if_block1.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
var MAX_DROPDOWN_RESULTS = 15;
var FILE_MENTION_REGEX = /@([^@]+?\.[a-zA-Z0-9]+)(?=\s|$|@)/g;
var MENTION_PREFIX = "@";
var SPACE_AFTER_MENTION = " ";
var COMMAND_REGEX = /\/([^\/\s]+)(?=\s|$|\/)/g;
var COMMAND_PREFIX = "/";
var SPACE_AFTER_COMMAND = " ";
var SYSTEM_PREVIEW_LENGTH = 80;
function findMatchingFile(fileName, availableFiles) {
  const normalizedFileName = fileName.toLowerCase();
  return availableFiles.find((file) => {
    const fullFileName = `${file.basename}.${file.extension}`;
    return fullFileName.toLowerCase() === normalizedFileName;
  });
}
function escapeHtmlContent(text2) {
  const temporaryElement = document.createElement("div");
  temporaryElement.textContent = text2;
  return temporaryElement.innerHTML;
}
function isCharacterWhitespace(character) {
  return /\s/.test(character);
}
function scrollSelectedIntoView(container, index2) {
  if (!container || index2 < 0)
    return;
  const selectedItem = container.children[index2];
  if (!selectedItem)
    return;
  const dropdownRect = container.getBoundingClientRect();
  const itemRect = selectedItem.getBoundingClientRect();
  const isItemVisible = itemRect.top >= dropdownRect.top && itemRect.bottom <= dropdownRect.bottom;
  if (!isItemVisible) {
    selectedItem.scrollIntoView({ block: "nearest", behavior: "smooth" });
  }
}
function formatSystemPreview(text2) {
  const singleLine = text2.replace(/\r?\n/g, " ");
  if (singleLine.length <= SYSTEM_PREVIEW_LENGTH)
    return singleLine;
  return `${singleLine.slice(0, SYSTEM_PREVIEW_LENGTH - 1)}\u2026`;
}
function fuzzyMatch(target, query) {
  if (!query)
    return true;
  let ti = 0;
  const t = target.toLowerCase();
  for (const qc of query) {
    ti = t.indexOf(qc, ti);
    if (ti === -1)
      return false;
    ti++;
  }
  return true;
}
function createFileRemovalPattern(file) {
  const fullFileName = `${file.basename}.${file.extension}`;
  const escapedFileName = fullFileName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  return new RegExp(`${MENTION_PREFIX}${escapedFileName}\\s?`, "g");
}
function instance($$self, $$props, $$invalidate) {
  let { placeholder = I18n.t("commands.actionPalette.placeholder") } = $$props;
  let { value = "" } = $$props;
  let { providerLabel = "" } = $$props;
  let { providerId = void 0 } = $$props;
  let { getFiles = void 0 } = $$props;
  let { getProviders = void 0 } = $$props;
  let { onProviderChange = void 0 } = $$props;
  let { getModels = void 0 } = $$props;
  let { onModelChange = void 0 } = $$props;
  let { onCreativityChange = void 0 } = $$props;
  let { getSystemPrompts = void 0 } = $$props;
  const dispatch = createEventDispatcher();
  let contentElement = null;
  let dropdownElement = null;
  let commandDropdownElement = null;
  let providerDropdownElement = null;
  let modelDropdownElement = null;
  let creativityDropdownElement = null;
  let systemDropdownElement = null;
  let activeDropdown = "none";
  let filteredItems = [];
  let fileItems = [];
  let commandItems = [];
  let providerItems = [];
  let modelItems = [];
  let creativityItems = [];
  let systemItems = [];
  let allProviders = [];
  let allModels = [];
  let allCreativities = [];
  let allSystemPrompts = [];
  function updateFilteredDropdownItems(matches2) {
    $$invalidate(3, filteredItems = matches2);
    if (matches2.length === 0) {
      $$invalidate(17, selectedIndex = -1);
      return;
    }
    if (selectedIndex < 0 || selectedIndex >= matches2.length) {
      $$invalidate(17, selectedIndex = 0);
    }
  }
  const dropdownControllers = {
    provider: {
      kind: "provider",
      show: () => showProviderDropdown(),
      refresh: () => applyProviderFilter()
    },
    model: {
      kind: "model",
      show: () => showModelDropdown(),
      refresh: () => applyModelFilter()
    },
    creativity: {
      kind: "creativity",
      show: () => showCreativityDropdown(),
      refresh: () => applyCreativityFilter()
    },
    system: {
      kind: "system",
      show: () => showSystemDropdown(),
      refresh: () => applySystemFilter()
    }
  };
  let selectedIndex = -1;
  let badgeHighlight = false;
  let selectedSystemPromptValue = void 0;
  let historyIndex = getPromptHistoryLength();
  let draftBeforeHistory = value;
  let selectedFiles = [];
  let textContent = "";
  let cursorPosition = 0;
  let mentionStartIndex = -1;
  let commandStartIndex = -1;
  let textTokens = [];
  let providerName = providerLabel.split(" \xB7 ")[0] || "";
  let modelName = (providerLabel.split(" \xB7 ")[1] || "").trim();
  let creativityBadge = (providerLabel.split(" \xB7 ")[2] || "").trim();
  let systemPromptBadge = "";
  function getCreativityOptions() {
    return [
      {
        id: "",
        name: I18n.t("settings.creativityNone")
      },
      {
        id: "low",
        name: I18n.t("settings.creativityLow")
      },
      {
        id: "medium",
        name: I18n.t("settings.creativityMedium")
      },
      {
        id: "high",
        name: I18n.t("settings.creativityHigh")
      }
    ];
  }
  function extractMentionsFromText(text2) {
    if (!getFiles) {
      return { mentions: [], newSelectedFiles: [] };
    }
    const availableFiles = getFiles();
    const mentions = [];
    const newSelectedFiles = [];
    const mentionMatches = Array.from(text2.matchAll(FILE_MENTION_REGEX));
    for (const match of mentionMatches) {
      const fileName = (match[1] || "").trim();
      const matchedFile = findMatchingFile(fileName, availableFiles);
      if (matchedFile && !selectedFiles.includes(matchedFile.path)) {
        newSelectedFiles.push(matchedFile.path);
      }
      mentions.push(match[0]);
    }
    return { mentions, newSelectedFiles };
  }
  function getAvailableCommands() {
    return [
      {
        name: "provider",
        description: I18n.t("commands.actionPalette.changeProvider")
      },
      {
        name: "model",
        description: I18n.t("commands.actionPalette.changeModel")
      },
      {
        name: "creativity",
        description: I18n.t("commands.actionPalette.changeCreativity")
      },
      {
        name: "system",
        description: I18n.t("commands.actionPalette.changeSystemPrompt")
      }
    ];
  }
  function fetchAvailableProviders() {
    return __awaiter(this, void 0, void 0, function* () {
      if (!getProviders)
        return [];
      try {
        return yield getProviders();
      } catch (error) {
        console.error("Error fetching providers:", error);
        return [];
      }
    });
  }
  function fetchAvailableModels() {
    return __awaiter(this, void 0, void 0, function* () {
      if (!getModels || !providerId)
        return [];
      try {
        return yield getModels(providerId);
      } catch (error) {
        console.error("Error fetching models:", error);
        return [];
      }
    });
  }
  function parseTextToTokens(text2) {
    var _a2;
    const tokens = [];
    if (getFiles) {
      const availableFiles = getFiles();
      const { newSelectedFiles } = extractMentionsFromText(text2);
      if (newSelectedFiles.length > 0) {
        selectedFiles = [...selectedFiles, ...newSelectedFiles];
      }
    }
    const mentionMatches = getFiles ? Array.from(text2.matchAll(FILE_MENTION_REGEX)) : [];
    const commandMatches = Array.from(text2.matchAll(COMMAND_REGEX));
    const allMatches = [
      ...mentionMatches.map((match) => ({ type: "file", match })),
      ...commandMatches.map((match) => ({ type: "command", match }))
    ].sort((a, b) => {
      var _a3, _b;
      return ((_a3 = a.match.index) !== null && _a3 !== void 0 ? _a3 : 0) - ((_b = b.match.index) !== null && _b !== void 0 ? _b : 0);
    });
    let lastIndex = 0;
    for (const { type, match } of allMatches) {
      const matchStart = (_a2 = match.index) !== null && _a2 !== void 0 ? _a2 : 0;
      const matchEnd = matchStart + match[0].length;
      if (matchStart > lastIndex) {
        tokens.push({
          type: "text",
          content: text2.substring(lastIndex, matchStart),
          start: lastIndex,
          end: matchStart
        });
      }
      if (type === "file" && getFiles) {
        const fileName = (match[1] || "").trim();
        const availableFiles = getFiles();
        const matchedFile = findMatchingFile(fileName, availableFiles);
        if (matchedFile) {
          tokens.push({
            type: "file",
            content: match[0],
            start: matchStart,
            end: matchEnd,
            filePath: matchedFile.path
          });
        } else {
          tokens.push({
            type: "text",
            content: match[0],
            start: matchStart,
            end: matchEnd
          });
        }
      } else if (type === "command") {
        const commandName = (match[1] || "").trim();
        const availableCommands = getAvailableCommands();
        const matchedCommand = availableCommands.find((cmd) => cmd.name === commandName);
        if (matchedCommand) {
          tokens.push({
            type: "command",
            content: match[0],
            start: matchStart,
            end: matchEnd,
            commandName: matchedCommand.name
          });
        } else {
          tokens.push({
            type: "text",
            content: match[0],
            start: matchStart,
            end: matchEnd
          });
        }
      }
      lastIndex = matchEnd;
    }
    if (lastIndex < text2.length) {
      tokens.push({
        type: "text",
        content: text2.substring(lastIndex),
        start: lastIndex,
        end: text2.length
      });
    }
    return tokens;
  }
  function getCurrentCursorPosition() {
    var _a2;
    if (!contentElement)
      return 0;
    const selection = window.getSelection();
    if (!selection || selection.rangeCount === 0)
      return 0;
    const range = selection.getRangeAt(0);
    let position = 0;
    const walker = document.createTreeWalker(contentElement, NodeFilter.SHOW_TEXT, null);
    let textNode;
    while (textNode = walker.nextNode()) {
      if (textNode === range.startContainer) {
        return position + range.startOffset;
      }
      position += ((_a2 = textNode.textContent) === null || _a2 === void 0 ? void 0 : _a2.length) || 0;
    }
    return position;
  }
  function setCursorPosition(position) {
    var _a2;
    if (!contentElement)
      return;
    const selection = window.getSelection();
    const range = document.createRange();
    let currentPosition = 0;
    const walker = document.createTreeWalker(contentElement, NodeFilter.SHOW_TEXT, null);
    let textNode;
    while (textNode = walker.nextNode()) {
      const nodeLength = ((_a2 = textNode.textContent) === null || _a2 === void 0 ? void 0 : _a2.length) || 0;
      if (currentPosition + nodeLength >= position) {
        const offset = position - currentPosition;
        range.setStart(textNode, offset);
        range.setEnd(textNode, offset);
        selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
        selection === null || selection === void 0 ? void 0 : selection.addRange(range);
        return;
      }
      currentPosition += nodeLength;
    }
  }
  function renderTokensAsHtml() {
    return textTokens.map((token) => {
      if (token.type === "file") {
        return `<span class="file-mention" data-path="${token.filePath}">${escapeHtmlContent(token.content)}</span>`;
      }
      if (token.type === "command") {
        return `<span class="command-mention" data-command="${token.commandName}">${escapeHtmlContent(token.content)}</span>`;
      }
      return escapeHtmlContent(token.content);
    }).join("");
  }
  function updateContentDisplay() {
    if (!contentElement)
      return;
    const currentCursor = getCurrentCursorPosition();
    $$invalidate(4, contentElement.innerHTML = renderTokensAsHtml(), contentElement);
    tick().then(() => {
      setCursorPosition(currentCursor);
    });
  }
  function setProviderBadgeLabel(pName, mName) {
    providerName = pName;
    modelName = mName;
    const base = [providerName, modelName].filter(Boolean).join(" \xB7 ");
    const extras = [creativityBadge, systemPromptBadge].filter(Boolean).join(" \xB7 ");
    $$invalidate(0, providerLabel = extras ? `${base} \xB7 ${extras}` : base);
  }
  function highlightBadgeTemporarily() {
    $$invalidate(18, badgeHighlight = true);
    setTimeout(
      () => {
        $$invalidate(18, badgeHighlight = false);
      },
      900
    );
  }
  function applyHistoryEntry(text2) {
    textContent = text2;
    cursorPosition = textContent.length;
    selectedFiles = [];
    textTokens = parseTextToTokens(textContent);
    hideDropdown();
    updateContentDisplay();
    tick().then(() => {
      setCursorPosition(textContent.length);
    });
  }
  onMount(() => {
    queueMicrotask(() => {
      contentElement === null || contentElement === void 0 ? void 0 : contentElement.focus();
      if (value) {
        textContent = value;
        textTokens = parseTextToTokens(textContent);
        updateContentDisplay();
      }
    });
  });
  function handleDropdownNavigation(event) {
    if (activeDropdown === "none" || filteredItems.length === 0)
      return false;
    function moveSelection(delta) {
      $$invalidate(17, selectedIndex = Math.min(Math.max(selectedIndex + delta, -1), filteredItems.length - 1));
      scrollSelectedIntoView(getDropdownElementForActiveType(), selectedIndex);
    }
    switch (event.key) {
      case "ArrowDown":
        event.preventDefault();
        moveSelection(1);
        return true;
      case "ArrowUp":
        event.preventDefault();
        moveSelection(-1);
        return true;
      case "Enter":
        if (event.shiftKey)
          return false;
      case "Tab":
        event.preventDefault();
        if (selectedIndex >= 0 && filteredItems[selectedIndex]) {
          handleSelection(filteredItems[selectedIndex]);
        }
        return true;
      case "Escape":
        event.preventDefault();
        hideDropdown();
        return true;
      default:
        return false;
    }
  }
  function getDropdownElementForActiveType() {
    switch (activeDropdown) {
      case "file":
        return dropdownElement;
      case "command":
        return commandDropdownElement;
      case "provider":
        return providerDropdownElement;
      case "model":
        return modelDropdownElement;
      case "creativity":
        return creativityDropdownElement;
      case "system":
        return systemDropdownElement;
      default:
        return null;
    }
  }
  function handleGeneralNavigation(event) {
    switch (event.key) {
      case "Enter":
        if (event.shiftKey)
          return;
        event.preventDefault();
        submitAction();
        break;
      case "Escape":
        event.preventDefault();
        dispatch("cancel");
        break;
    }
  }
  function handleKeydown(event) {
    if (handleDropdownNavigation(event)) {
      return;
    }
    if (handleHistoryNavigation(event)) {
      return;
    }
    handleGeneralNavigation(event);
  }
  function handleHistoryNavigation(event) {
    const isHistoryKey = event.key === "ArrowUp" || event.key === "ArrowDown";
    if (!isHistoryKey || activeDropdown !== "none") {
      return false;
    }
    const currentPosition = getCurrentCursorPosition();
    cursorPosition = currentPosition;
    if (event.key === "ArrowUp" && !isCursorOnFirstLine(currentPosition)) {
      return false;
    }
    if (event.key === "ArrowDown" && !isCursorOnLastLine(currentPosition)) {
      return false;
    }
    const historyLength = getPromptHistoryLength();
    if (historyLength === 0)
      return false;
    if (historyIndex === historyLength) {
      draftBeforeHistory = textContent;
    }
    if (event.key === "ArrowUp") {
      if (historyIndex > 0) {
        historyIndex -= 1;
      }
    } else if (event.key === "ArrowDown") {
      if (historyIndex < historyLength) {
        historyIndex += 1;
      }
    }
    const entry = historyIndex >= 0 && historyIndex < historyLength ? getPromptHistoryEntry(historyIndex) : draftBeforeHistory;
    event.preventDefault();
    applyHistoryEntry(entry || "");
    return true;
  }
  function isCursorOnFirstLine(position) {
    const index2 = Math.max(position - 1, 0);
    return textContent.lastIndexOf("\n", index2) === -1;
  }
  function isCursorOnLastLine(position) {
    return textContent.indexOf("\n", position) === -1;
  }
  function handleInput(event) {
    const target = event.target;
    const newTextContent = target.textContent || "";
    textContent = newTextContent;
    cursorPosition = getCurrentCursorPosition();
    historyIndex = getPromptHistoryLength();
    draftBeforeHistory = textContent;
    textTokens = parseTextToTokens(textContent);
    checkForMentionTrigger();
    checkForCommandTrigger();
    if (activeDropdown === "provider") {
      applyProviderFilter();
    }
    if (activeDropdown === "model") {
      applyModelFilter();
    }
    const newHtmlContent = renderTokensAsHtml();
    if (target.innerHTML !== newHtmlContent) {
      updateContentDisplay();
    }
  }
  function isCompleteMention(mentionText) {
    if (!getFiles)
      return false;
    return selectedFiles.some((filePath) => {
      var _a2;
      const file = (_a2 = getFiles()) === null || _a2 === void 0 ? void 0 : _a2.find((f) => f.path === filePath);
      if (!file)
        return false;
      const fullFileName = `${file.basename}.${file.extension}`;
      return mentionText === `${MENTION_PREFIX}${fullFileName}`;
    });
  }
  function isCompleteCommand(commandText) {
    const availableCommands = getAvailableCommands();
    return availableCommands.some((cmd) => commandText === `${COMMAND_PREFIX}${cmd.name}`);
  }
  function getCommandQuery(commandName) {
    const beforeCursor = textContent.substring(0, cursorPosition);
    const token = `${COMMAND_PREFIX}${commandName}`;
    const foundIndex = beforeCursor.lastIndexOf(token);
    if (foundIndex === -1)
      return "";
    const charBefore = foundIndex > 0 ? beforeCursor[foundIndex - 1] : " ";
    if (foundIndex > 0 && !isCharacterWhitespace(charBefore))
      return "";
    const afterNameIndex = foundIndex + token.length;
    const afterName = textContent.substring(afterNameIndex);
    const hasSpace = afterName.startsWith(SPACE_AFTER_COMMAND);
    const queryStart = hasSpace ? afterNameIndex + SPACE_AFTER_COMMAND.length : afterNameIndex;
    return textContent.substring(queryStart, cursorPosition).trim().toLowerCase();
  }
  function filterAvailableCommands(query) {
    const availableCommands = getAvailableCommands();
    const normalizedQuery = query.toLowerCase();
    return availableCommands.filter((command) => {
      return command.name.toLowerCase().includes(normalizedQuery) || command.description.toLowerCase().includes(normalizedQuery);
    }).slice(0, MAX_DROPDOWN_RESULTS);
  }
  function filterAvailableFiles(query) {
    if (!getFiles)
      return [];
    const availableFiles = getFiles();
    const normalizedQuery = query.toLowerCase();
    return availableFiles.filter((file) => {
      const fullFileName = `${file.basename}.${file.extension}`;
      const isQueryMatch = file.basename.toLowerCase().includes(normalizedQuery) || fullFileName.toLowerCase().includes(normalizedQuery);
      const isNotAlreadySelected = !selectedFiles.includes(file.path);
      return isQueryMatch && isNotAlreadySelected;
    }).slice(0, MAX_DROPDOWN_RESULTS);
  }
  function checkForMentionTrigger() {
    if (!getFiles)
      return;
    const beforeCursor = textContent.substring(0, cursorPosition);
    const mentionIndex = beforeCursor.lastIndexOf(MENTION_PREFIX);
    if (mentionIndex === -1) {
      hideDropdown();
      return;
    }
    const characterBeforeMention = mentionIndex > 0 ? beforeCursor[mentionIndex - 1] : " ";
    if (mentionIndex > 0 && !isCharacterWhitespace(characterBeforeMention)) {
      hideDropdown();
      return;
    }
    const textAfterMention = beforeCursor.substring(mentionIndex + 1);
    const possibleMention = MENTION_PREFIX + textAfterMention;
    if (isCompleteMention(possibleMention)) {
      hideDropdown();
      return;
    }
    mentionStartIndex = mentionIndex;
    $$invalidate(3, filteredItems = filterAvailableFiles(textAfterMention));
    if (filteredItems.length > 0) {
      $$invalidate(2, activeDropdown = "file");
      $$invalidate(17, selectedIndex = 0);
    } else {
      hideDropdown();
    }
  }
  function hideDropdown() {
    $$invalidate(2, activeDropdown = "none");
    $$invalidate(3, filteredItems = []);
    $$invalidate(17, selectedIndex = -1);
    mentionStartIndex = -1;
    commandStartIndex = -1;
    allProviders = [];
    allModels = [];
    allCreativities = [];
    allSystemPrompts = [];
  }
  function insertFileAtCursor(file) {
    if (mentionStartIndex === -1)
      return;
    if (!selectedFiles.includes(file.path)) {
      selectedFiles = [...selectedFiles, file.path];
    }
    const fullFileName = `${file.basename}.${file.extension}`;
    const beforeMention = textContent.substring(0, mentionStartIndex);
    const afterCursor = textContent.substring(cursorPosition);
    const newText = beforeMention + MENTION_PREFIX + fullFileName + SPACE_AFTER_MENTION + afterCursor;
    textContent = newText;
    textTokens = parseTextToTokens(textContent);
    hideDropdown();
    if (contentElement) {
      updateContentDisplay();
      tick().then(() => {
        const newCursorPosition = beforeMention.length + fullFileName.length + 2;
        setCursorPosition(newCursorPosition);
      });
    }
  }
  function checkForCommandTrigger() {
    const beforeCursor = textContent.substring(0, cursorPosition);
    const commandIndex = beforeCursor.lastIndexOf(COMMAND_PREFIX);
    if (commandIndex === -1) {
      if (activeDropdown !== "file") {
        hideDropdown();
      }
      return;
    }
    const characterBeforeCommand = commandIndex > 0 ? beforeCursor[commandIndex - 1] : " ";
    if (commandIndex > 0 && !isCharacterWhitespace(characterBeforeCommand)) {
      if (activeDropdown !== "file") {
        hideDropdown();
      }
      return;
    }
    const textAfterCommand = beforeCursor.substring(commandIndex + 1);
    const firstTokenMatch = textAfterCommand.match(/([^\s\/]+)/);
    const typedName = firstTokenMatch ? firstTokenMatch[1] : "";
    const commandName = typedName.toLowerCase();
    commandStartIndex = commandIndex;
    const dropdownController = dropdownControllers[commandName];
    if (dropdownController) {
      if (activeDropdown !== dropdownController.kind) {
        void dropdownController.show();
      } else {
        dropdownController.refresh();
      }
      return;
    }
    if (["provider", "model", "creativity", "system"].includes(activeDropdown)) {
      hideDropdown();
    }
    $$invalidate(3, filteredItems = filterAvailableCommands(textAfterCommand));
    if (filteredItems.length > 0) {
      $$invalidate(2, activeDropdown = "command");
      $$invalidate(17, selectedIndex = 0);
    } else {
      hideDropdown();
    }
  }
  function insertCommandAtCursor(command) {
    if (commandStartIndex === -1)
      return;
    const dropdownController = dropdownControllers[command.name];
    if (dropdownController) {
      insertCommand(command.name);
      void dropdownController.show();
      return;
    }
    insertCommand(command.name);
    const commandLength = COMMAND_PREFIX.length + command.name.length + SPACE_AFTER_COMMAND.length;
    removeCommandFromText(commandStartIndex, commandLength);
  }
  function insertCommand(commandName) {
    if (commandStartIndex === -1)
      return;
    const beforeCommand = textContent.substring(0, commandStartIndex);
    const afterCursor = textContent.substring(cursorPosition);
    const newText = beforeCommand + COMMAND_PREFIX + commandName + SPACE_AFTER_COMMAND + afterCursor;
    textContent = newText;
    textTokens = parseTextToTokens(textContent);
    hideDropdown();
    if (contentElement) {
      updateContentDisplay();
      tick().then(() => {
        const newCursorPosition = beforeCommand.length + commandName.length + 2;
        setCursorPosition(newCursorPosition);
      });
    }
  }
  const selectionHandlers = {
    none: () => void 0,
    file: (item) => insertFileAtCursor(item),
    command: (item) => insertCommandAtCursor(item),
    provider: (item) => selectProvider(item),
    model: (item) => selectModel(item),
    creativity: (item) => selectCreativity(item),
    system: (item) => selectSystemPrompt(item)
  };
  function handleSelection(item) {
    var _a2;
    void ((_a2 = selectionHandlers[activeDropdown]) === null || _a2 === void 0 ? void 0 : _a2.call(selectionHandlers, item));
  }
  function selectProvider(provider) {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        if (onProviderChange) {
          yield onProviderChange(provider.id);
        }
        setProviderBadgeLabel(provider.providerName, provider.name);
        $$invalidate(24, providerId = provider.id);
        providerName = provider.providerName;
        highlightBadgeTemporarily();
        removeCommandAndQuery("provider");
        hideDropdown();
      } catch (error) {
        console.error("Error selecting provider:", error);
        hideDropdown();
      }
    });
  }
  function selectModel(model) {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        if (onModelChange) {
          yield onModelChange(model.name);
        }
        setProviderBadgeLabel(providerName, model.name);
        highlightBadgeTemporarily();
        removeCommandAndQuery("model");
        hideDropdown();
      } catch (error) {
        console.error("Error selecting model:", error);
        hideDropdown();
      }
    });
  }
  function applyCreativityFilter() {
    if (!allCreativities || allCreativities.length === 0)
      return;
    const q = getCommandQuery("creativity");
    const matches2 = allCreativities.filter((c) => fuzzyMatch(c.name, q)).slice(0, MAX_DROPDOWN_RESULTS);
    updateFilteredDropdownItems(matches2);
    if (q) {
      const norm = (s) => s.toLowerCase();
      const exact = matches2.find((c) => norm(c.name) === norm(q));
      if (exact) {
        void selectCreativity(exact);
      }
    }
  }
  function showCreativityDropdown() {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        allCreativities = getCreativityOptions();
        applyCreativityFilter();
        if (filteredItems.length > 0) {
          $$invalidate(2, activeDropdown = "creativity");
          $$invalidate(17, selectedIndex = 0);
        }
      } catch (error) {
        console.error("Error showing creativity dropdown:", error);
      }
    });
  }
  function selectCreativity(option2) {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        if (onCreativityChange) {
          yield onCreativityChange(option2.id);
        }
        creativityBadge = option2.name;
        setProviderBadgeLabel(providerName, modelName);
        highlightBadgeTemporarily();
        removeCommandAndQuery("creativity");
        hideDropdown();
      } catch (error) {
        console.error("Error selecting creativity:", error);
        hideDropdown();
      }
    });
  }
  function applySystemFilter() {
    if (!allSystemPrompts || allSystemPrompts.length === 0)
      return;
    const q = getCommandQuery("system");
    const normalizedQuery = q.toLowerCase();
    const matches2 = allSystemPrompts.filter((s) => normalizedQuery ? s.name.toLowerCase().includes(normalizedQuery) : true).sort((a, b) => a.name.localeCompare(b.name)).slice(0, MAX_DROPDOWN_RESULTS);
    updateFilteredDropdownItems(matches2);
    if (q) {
      const norm = (s) => s.toLowerCase();
      const exact = matches2.find((s) => norm(s.name) === norm(q));
      if (exact) {
        void selectSystemPrompt(exact);
      }
    }
  }
  function showSystemDropdown() {
    return __awaiter(this, void 0, void 0, function* () {
      if (!getSystemPrompts)
        return;
      try {
        allSystemPrompts = getSystemPrompts();
        applySystemFilter();
        if (filteredItems.length > 0) {
          $$invalidate(2, activeDropdown = "system");
          $$invalidate(17, selectedIndex = 0);
        }
      } catch (error) {
        console.error("Error showing system dropdown:", error);
      }
    });
  }
  function selectSystemPrompt(option2) {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        selectedSystemPromptValue = option2.system;
        systemPromptBadge = option2.name;
        setProviderBadgeLabel(providerName, modelName);
        highlightBadgeTemporarily();
        removeCommandAndQuery("system");
        hideDropdown();
      } catch (error) {
        console.error("Error selecting system prompt:", error);
        hideDropdown();
      }
    });
  }
  function applyProviderFilter() {
    if (!allProviders || allProviders.length === 0)
      return;
    const q = getCommandQuery("provider");
    const matches2 = allProviders.filter((p) => fuzzyMatch(p.name, q) || fuzzyMatch(p.providerName, q)).slice(0, MAX_DROPDOWN_RESULTS);
    updateFilteredDropdownItems(matches2);
    if (q && matches2.length === 1 && matches2[0].name.toLowerCase() === q) {
      void selectProvider(matches2[0]);
    }
  }
  function removeCommandAndQuery(commandName) {
    const token = `${COMMAND_PREFIX}${commandName}`;
    const foundIndex = textContent.lastIndexOf(token);
    if (foundIndex === -1)
      return;
    const charBefore = foundIndex > 0 ? textContent[foundIndex - 1] : " ";
    if (foundIndex > 0 && !isCharacterWhitespace(charBefore))
      return;
    let removalStart = foundIndex;
    let idx = foundIndex + token.length;
    if (textContent[idx] === SPACE_AFTER_COMMAND) {
      idx += SPACE_AFTER_COMMAND.length;
    }
    while (idx < textContent.length) {
      const ch = textContent[idx];
      if (isCharacterWhitespace(ch) || ch === "/" || ch === "@")
        break;
      idx++;
    }
    const removalEnd = idx;
    const before = textContent.substring(0, removalStart);
    const after = textContent.substring(removalEnd);
    textContent = before + after;
    textTokens = parseTextToTokens(textContent);
    if (contentElement) {
      updateContentDisplay();
      tick().then(() => {
        setCursorPosition(before.length);
      });
    }
  }
  function showProviderDropdown() {
    return __awaiter(this, void 0, void 0, function* () {
      if (!getProviders)
        return;
      try {
        const providers = yield fetchAvailableProviders();
        allProviders = providers;
        applyProviderFilter();
        if (filteredItems.length > 0) {
          $$invalidate(2, activeDropdown = "provider");
          $$invalidate(17, selectedIndex = 0);
        } else {
          console.warn("No providers available");
        }
      } catch (error) {
        console.error("Error showing provider dropdown:", error);
      }
    });
  }
  function applyModelFilter() {
    if (!allModels || allModels.length === 0)
      return;
    const q = getCommandQuery("model");
    const matches2 = allModels.filter((m) => fuzzyMatch(m.name, q)).slice(0, MAX_DROPDOWN_RESULTS);
    updateFilteredDropdownItems(matches2);
    if (q && matches2.length === 1 && matches2[0].name.toLowerCase() === q) {
      void selectModel(matches2[0]);
    }
  }
  function showModelDropdown() {
    return __awaiter(this, void 0, void 0, function* () {
      if (!getModels || !providerId)
        return;
      try {
        const models = yield fetchAvailableModels();
        allModels = models;
        applyModelFilter();
        if (filteredItems.length > 0) {
          $$invalidate(2, activeDropdown = "model");
          $$invalidate(17, selectedIndex = 0);
        } else {
          console.warn("No models available");
        }
      } catch (error) {
        console.error("Error showing model dropdown:", error);
      }
    });
  }
  function handleContentClick(event) {
    const target = event.target;
    if (target.classList.contains("file-mention")) {
      const filePath = target.dataset.path;
      if (filePath) {
        removeFileReference(filePath);
      }
    }
  }
  function removeCommandFromText(commandStartIndex2, commandLength) {
    if (commandStartIndex2 === -1)
      return;
    const beforeCommand = textContent.substring(0, commandStartIndex2);
    const afterCommand = textContent.substring(commandStartIndex2 + commandLength);
    textContent = beforeCommand + afterCommand;
    textTokens = parseTextToTokens(textContent);
    if (contentElement) {
      updateContentDisplay();
      tick().then(() => {
        setCursorPosition(beforeCommand.length);
      });
    }
  }
  function removeFileReference(filePath) {
    var _a2;
    selectedFiles = selectedFiles.filter((path) => path !== filePath);
    const file = (_a2 = getFiles === null || getFiles === void 0 ? void 0 : getFiles()) === null || _a2 === void 0 ? void 0 : _a2.find((f) => f.path === filePath);
    if (file) {
      const removalPattern = createFileRemovalPattern(file);
      textContent = textContent.replace(removalPattern, "");
      textTokens = parseTextToTokens(textContent);
      updateContentDisplay();
    }
  }
  function submitAction() {
    addToPromptHistory(textContent);
    historyIndex = getPromptHistoryLength();
    draftBeforeHistory = textContent;
    dispatch("submit", {
      text: textContent,
      selectedFiles,
      systemPrompt: selectedSystemPromptValue
    });
  }
  function handleKeyup(event) {
    if (event.key === "Backspace" || event.key === "Delete") {
      const currentlyMentionedFiles = textTokens.filter((token) => token.type === "file" && token.filePath).map((token) => token.filePath);
      const filesToRemove = selectedFiles.filter((filePath) => !currentlyMentionedFiles.includes(filePath));
      if (filesToRemove.length > 0) {
        selectedFiles = selectedFiles.filter((path) => currentlyMentionedFiles.includes(path));
      }
    }
  }
  function div0_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      contentElement = $$value;
      $$invalidate(4, contentElement);
    });
  }
  const click_handler = (item) => handleSelection(item);
  const keydown_handler = (item, event) => event.key === "Enter" && handleSelection(item);
  function div0_binding_1($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      dropdownElement = $$value;
      $$invalidate(5, dropdownElement);
    });
  }
  const click_handler_1 = (item) => handleSelection(item);
  const keydown_handler_1 = (item, event) => event.key === "Enter" && handleSelection(item);
  function div1_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      commandDropdownElement = $$value;
      $$invalidate(6, commandDropdownElement);
    });
  }
  const click_handler_2 = (item) => handleSelection(item);
  const keydown_handler_2 = (item, event) => event.key === "Enter" && handleSelection(item);
  function div2_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      providerDropdownElement = $$value;
      $$invalidate(7, providerDropdownElement);
    });
  }
  const click_handler_3 = (item) => handleSelection(item);
  const keydown_handler_3 = (item, event) => event.key === "Enter" && handleSelection(item);
  function div3_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      modelDropdownElement = $$value;
      $$invalidate(8, modelDropdownElement);
    });
  }
  const click_handler_4 = (item) => handleSelection(item);
  const keydown_handler_4 = (item, event) => event.key === "Enter" && handleSelection(item);
  function div4_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      creativityDropdownElement = $$value;
      $$invalidate(9, creativityDropdownElement);
    });
  }
  const click_handler_5 = (item) => handleSelection(item);
  const keydown_handler_5 = (item, event) => event.key === "Enter" && handleSelection(item);
  function div5_binding($$value) {
    binding_callbacks[$$value ? "unshift" : "push"](() => {
      systemDropdownElement = $$value;
      $$invalidate(10, systemDropdownElement);
    });
  }
  $$self.$$set = ($$props2) => {
    if ("placeholder" in $$props2)
      $$invalidate(1, placeholder = $$props2.placeholder);
    if ("value" in $$props2)
      $$invalidate(25, value = $$props2.value);
    if ("providerLabel" in $$props2)
      $$invalidate(0, providerLabel = $$props2.providerLabel);
    if ("providerId" in $$props2)
      $$invalidate(24, providerId = $$props2.providerId);
    if ("getFiles" in $$props2)
      $$invalidate(26, getFiles = $$props2.getFiles);
    if ("getProviders" in $$props2)
      $$invalidate(27, getProviders = $$props2.getProviders);
    if ("onProviderChange" in $$props2)
      $$invalidate(28, onProviderChange = $$props2.onProviderChange);
    if ("getModels" in $$props2)
      $$invalidate(29, getModels = $$props2.getModels);
    if ("onModelChange" in $$props2)
      $$invalidate(30, onModelChange = $$props2.onModelChange);
    if ("onCreativityChange" in $$props2)
      $$invalidate(31, onCreativityChange = $$props2.onCreativityChange);
    if ("getSystemPrompts" in $$props2)
      $$invalidate(32, getSystemPrompts = $$props2.getSystemPrompts);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(11, fileItems = activeDropdown === "file" ? filteredItems : []);
    }
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(12, commandItems = activeDropdown === "command" ? filteredItems : []);
    }
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(13, providerItems = activeDropdown === "provider" ? filteredItems : []);
    }
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(14, modelItems = activeDropdown === "model" ? filteredItems : []);
    }
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(15, creativityItems = activeDropdown === "creativity" ? filteredItems : []);
    }
    if ($$self.$$.dirty[0] & /*activeDropdown, filteredItems*/
    12) {
      $:
        $$invalidate(16, systemItems = activeDropdown === "system" ? filteredItems : []);
    }
  };
  return [
    providerLabel,
    placeholder,
    activeDropdown,
    filteredItems,
    contentElement,
    dropdownElement,
    commandDropdownElement,
    providerDropdownElement,
    modelDropdownElement,
    creativityDropdownElement,
    systemDropdownElement,
    fileItems,
    commandItems,
    providerItems,
    modelItems,
    creativityItems,
    systemItems,
    selectedIndex,
    badgeHighlight,
    handleKeydown,
    handleInput,
    handleSelection,
    handleContentClick,
    handleKeyup,
    providerId,
    value,
    getFiles,
    getProviders,
    onProviderChange,
    getModels,
    onModelChange,
    onCreativityChange,
    getSystemPrompts,
    div0_binding,
    click_handler,
    keydown_handler,
    div0_binding_1,
    click_handler_1,
    keydown_handler_1,
    div1_binding,
    click_handler_2,
    keydown_handler_2,
    div2_binding,
    click_handler_3,
    keydown_handler_3,
    div3_binding,
    click_handler_4,
    keydown_handler_4,
    div4_binding,
    click_handler_5,
    keydown_handler_5,
    div5_binding
  ];
}
var ActionPalette = class extends SvelteComponent {
  constructor(options) {
    super();
    init(
      this,
      options,
      instance,
      create_fragment,
      safe_not_equal,
      {
        placeholder: 1,
        value: 25,
        providerLabel: 0,
        providerId: 24,
        getFiles: 26,
        getProviders: 27,
        onProviderChange: 28,
        getModels: 29,
        onModelChange: 30,
        onCreativityChange: 31,
        getSystemPrompts: 32
      },
      null,
      [-1, -1, -1, -1, -1]
    );
  }
};
var ActionPalette_default = ActionPalette;

// src/ui/actionPalettePlugin.ts
var SvelteActionPaletteWidget = class extends import_view2.WidgetType {
  constructor(options) {
    super();
    this.options = options;
    this.container = null;
    this.app = null;
  }
  toDOM(view) {
    this.container = document.createElement("div");
    this.container.addClass("local-gpt-action-palette-container");
    const mountTarget = document.createElement("div");
    this.container.appendChild(mountTarget);
    this.app = new ActionPalette_default({
      target: mountTarget,
      props: {
        placeholder: this.options.placeholder || I18n.t("commands.actionPalette.placeholder"),
        providerLabel: this.options.modelLabel || "",
        providerId: this.options.providerId,
        getFiles: this.options.getFiles,
        getProviders: this.options.getProviders,
        onProviderChange: this.options.onProviderChange,
        getModels: this.options.getModels,
        onModelChange: this.options.onModelChange,
        onCreativityChange: this.options.onCreativityChange,
        getSystemPrompts: this.options.getSystemPrompts
      }
    });
    this.app.$on(
      "submit",
      (e) => {
        var _a2, _b;
        (_b = (_a2 = this.options).onSubmit) == null ? void 0 : _b.call(
          _a2,
          e.detail.text,
          e.detail.selectedFiles,
          e.detail.systemPrompt
        );
      }
    );
    this.app.$on("cancel", () => {
      var _a2, _b;
      (_b = (_a2 = this.options).onCancel) == null ? void 0 : _b.call(_a2);
    });
    return this.container;
  }
  destroy(dom) {
    var _a2;
    (_a2 = this.app) == null ? void 0 : _a2.$destroy();
    this.app = null;
    this.container = null;
  }
};
var ShowActionPaletteEffect = import_state2.StateEffect.define();
var HideActionPaletteEffect = import_state2.StateEffect.define();
function captureSelectionSnapshot(view) {
  const rangesAll = view.state.selection.ranges.map((r) => ({
    from: r.from,
    to: r.to
  }));
  const nonEmpty = rangesAll.filter((r) => r.from !== r.to);
  return {
    fakeSelections: nonEmpty.length ? nonEmpty : null,
    previousSelectionRanges: rangesAll.length ? rangesAll : null,
    previousCursor: view.state.selection.main.head
  };
}
function mapRanges(ranges, changes) {
  return ranges ? ranges.map((r) => ({
    from: changes.mapPos(r.from),
    to: changes.mapPos(r.to)
  })) : null;
}
function buildDecorations(pos, options, fakeSelections) {
  const builder = new import_state2.RangeSetBuilder();
  const widget = new SvelteActionPaletteWidget(options);
  builder.add(pos, pos, import_view2.Decoration.widget({ widget, side: -1, block: true }));
  if (fakeSelections) {
    for (const r of fakeSelections) {
      builder.add(
        r.from,
        r.to,
        import_view2.Decoration.mark({ class: "local-gpt-fake-selection" })
      );
    }
  }
  return builder.finish();
}
var actionPaletteStateField = import_state2.StateField.define({
  create() {
    return {
      deco: import_view2.Decoration.none,
      pos: null,
      fakeSelections: null,
      previousSelectionRanges: null,
      previousCursor: null
    };
  },
  update(value, tr) {
    let {
      deco,
      pos,
      fakeSelections,
      previousSelectionRanges,
      previousCursor
    } = value;
    if (tr.docChanged) {
      deco = deco.map(tr.changes);
      if (pos !== null)
        pos = tr.changes.mapPos(pos);
      fakeSelections = mapRanges(fakeSelections, tr.changes);
      previousSelectionRanges = mapRanges(
        previousSelectionRanges,
        tr.changes
      );
      if (previousCursor !== null)
        previousCursor = tr.changes.mapPos(previousCursor);
    }
    for (const e of tr.effects) {
      if (e.is(ShowActionPaletteEffect)) {
        pos = e.value.pos;
        fakeSelections = e.value.fakeSelections;
        previousSelectionRanges = e.value.previousSelectionRanges;
        previousCursor = e.value.previousCursor;
        deco = buildDecorations(pos, e.value.options, fakeSelections);
      } else if (e.is(HideActionPaletteEffect)) {
        pos = null;
        fakeSelections = null;
        previousSelectionRanges = null;
        previousCursor = null;
        deco = import_view2.Decoration.none;
      }
    }
    return {
      deco,
      pos,
      fakeSelections,
      previousSelectionRanges,
      previousCursor
    };
  },
  provide: (f) => import_view2.EditorView.decorations.from(f, (v) => v.deco)
});
var actionPalettePlugin = [actionPaletteStateField];
function showActionPalette(view, pos, options) {
  const { fakeSelections, previousSelectionRanges, previousCursor } = captureSelectionSnapshot(view);
  view.dispatch({
    effects: ShowActionPaletteEffect.of({
      pos,
      options,
      fakeSelections,
      previousSelectionRanges,
      previousCursor
    })
  });
}
function hideActionPalette(view) {
  const state = view.state.field(actionPaletteStateField, false);
  if (state) {
    if (state.previousSelectionRanges && state.previousSelectionRanges.length) {
      const selection = import_state2.EditorSelection.create(
        state.previousSelectionRanges.map(
          (r) => import_state2.EditorSelection.range(r.from, r.to)
        )
      );
      view.dispatch({ selection });
      view.focus();
    } else if (state.previousCursor !== null) {
      view.dispatch({ selection: { anchor: state.previousCursor } });
      view.focus();
    }
  }
  view.dispatch({ effects: HideActionPaletteEffect.of(null) });
}

// src/rag.ts
var import_obsidian2 = require("obsidian");

// node_modules/pdfjs-dist/build/pdf.mjs
var __webpack_require__ = {};
(() => {
  __webpack_require__.d = (exports, definition) => {
    for (var key in definition) {
      if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
        Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
      }
    }
  };
})();
(() => {
  __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
})();
var __webpack_exports__ = globalThis.pdfjsLib = {};
__webpack_require__.d(__webpack_exports__, {
  AbortException: () => (
    /* reexport */
    AbortException
  ),
  AnnotationEditorLayer: () => (
    /* reexport */
    AnnotationEditorLayer
  ),
  AnnotationEditorParamsType: () => (
    /* reexport */
    AnnotationEditorParamsType
  ),
  AnnotationEditorType: () => (
    /* reexport */
    AnnotationEditorType
  ),
  AnnotationEditorUIManager: () => (
    /* reexport */
    AnnotationEditorUIManager
  ),
  AnnotationLayer: () => (
    /* reexport */
    AnnotationLayer
  ),
  AnnotationMode: () => (
    /* reexport */
    AnnotationMode
  ),
  CMapCompressionType: () => (
    /* reexport */
    CMapCompressionType
  ),
  ColorPicker: () => (
    /* reexport */
    ColorPicker
  ),
  DOMSVGFactory: () => (
    /* reexport */
    DOMSVGFactory
  ),
  DrawLayer: () => (
    /* reexport */
    DrawLayer
  ),
  FeatureTest: () => (
    /* reexport */
    util_FeatureTest
  ),
  GlobalWorkerOptions: () => (
    /* reexport */
    GlobalWorkerOptions
  ),
  ImageKind: () => (
    /* reexport */
    util_ImageKind
  ),
  InvalidPDFException: () => (
    /* reexport */
    InvalidPDFException
  ),
  MissingPDFException: () => (
    /* reexport */
    MissingPDFException
  ),
  OPS: () => (
    /* reexport */
    OPS
  ),
  PDFDataRangeTransport: () => (
    /* reexport */
    PDFDataRangeTransport
  ),
  PDFDateString: () => (
    /* reexport */
    PDFDateString
  ),
  PDFWorker: () => (
    /* reexport */
    PDFWorker
  ),
  PasswordResponses: () => (
    /* reexport */
    PasswordResponses
  ),
  PermissionFlag: () => (
    /* reexport */
    PermissionFlag
  ),
  PixelsPerInch: () => (
    /* reexport */
    PixelsPerInch
  ),
  RenderingCancelledException: () => (
    /* reexport */
    RenderingCancelledException
  ),
  TextLayer: () => (
    /* reexport */
    TextLayer
  ),
  UnexpectedResponseException: () => (
    /* reexport */
    UnexpectedResponseException
  ),
  Util: () => (
    /* reexport */
    Util
  ),
  VerbosityLevel: () => (
    /* reexport */
    VerbosityLevel
  ),
  XfaLayer: () => (
    /* reexport */
    XfaLayer
  ),
  build: () => (
    /* reexport */
    build
  ),
  createValidAbsoluteUrl: () => (
    /* reexport */
    createValidAbsoluteUrl
  ),
  fetchData: () => (
    /* reexport */
    fetchData
  ),
  getDocument: () => (
    /* reexport */
    getDocument
  ),
  getFilenameFromUrl: () => (
    /* reexport */
    getFilenameFromUrl
  ),
  getPdfFilenameFromUrl: () => (
    /* reexport */
    getPdfFilenameFromUrl
  ),
  getXfaPageViewport: () => (
    /* reexport */
    getXfaPageViewport
  ),
  isDataScheme: () => (
    /* reexport */
    isDataScheme
  ),
  isPdfFile: () => (
    /* reexport */
    isPdfFile
  ),
  noContextMenu: () => (
    /* reexport */
    noContextMenu
  ),
  normalizeUnicode: () => (
    /* reexport */
    normalizeUnicode
  ),
  setLayerDimensions: () => (
    /* reexport */
    setLayerDimensions
  ),
  shadow: () => (
    /* reexport */
    shadow
  ),
  version: () => (
    /* reexport */
    version2
  )
});
var isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var FONT_IDENTITY_MATRIX = [1e-3, 0, 0, 1e-3, 0, 0];
var MAX_IMAGE_SIZE_TO_CACHE = 1e7;
var LINE_FACTOR = 1.35;
var LINE_DESCENT_FACTOR = 0.35;
var BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
var RenderingIntentFlag = {
  ANY: 1,
  DISPLAY: 2,
  PRINT: 4,
  SAVE: 8,
  ANNOTATIONS_FORMS: 16,
  ANNOTATIONS_STORAGE: 32,
  ANNOTATIONS_DISABLE: 64,
  IS_EDITING: 128,
  OPLIST: 256
};
var AnnotationMode = {
  DISABLE: 0,
  ENABLE: 1,
  ENABLE_FORMS: 2,
  ENABLE_STORAGE: 3
};
var AnnotationEditorPrefix = "pdfjs_internal_editor_";
var AnnotationEditorType = {
  DISABLE: -1,
  NONE: 0,
  FREETEXT: 3,
  HIGHLIGHT: 9,
  STAMP: 13,
  INK: 15
};
var AnnotationEditorParamsType = {
  RESIZE: 1,
  CREATE: 2,
  FREETEXT_SIZE: 11,
  FREETEXT_COLOR: 12,
  FREETEXT_OPACITY: 13,
  INK_COLOR: 21,
  INK_THICKNESS: 22,
  INK_OPACITY: 23,
  HIGHLIGHT_COLOR: 31,
  HIGHLIGHT_DEFAULT_COLOR: 32,
  HIGHLIGHT_THICKNESS: 33,
  HIGHLIGHT_FREE: 34,
  HIGHLIGHT_SHOW_ALL: 35
};
var PermissionFlag = {
  PRINT: 4,
  MODIFY_CONTENTS: 8,
  COPY: 16,
  MODIFY_ANNOTATIONS: 32,
  FILL_INTERACTIVE_FORMS: 256,
  COPY_FOR_ACCESSIBILITY: 512,
  ASSEMBLE: 1024,
  PRINT_HIGH_QUALITY: 2048
};
var TextRenderingMode = {
  FILL: 0,
  STROKE: 1,
  FILL_STROKE: 2,
  INVISIBLE: 3,
  FILL_ADD_TO_PATH: 4,
  STROKE_ADD_TO_PATH: 5,
  FILL_STROKE_ADD_TO_PATH: 6,
  ADD_TO_PATH: 7,
  FILL_STROKE_MASK: 3,
  ADD_TO_PATH_FLAG: 4
};
var util_ImageKind = {
  GRAYSCALE_1BPP: 1,
  RGB_24BPP: 2,
  RGBA_32BPP: 3
};
var AnnotationType = {
  TEXT: 1,
  LINK: 2,
  FREETEXT: 3,
  LINE: 4,
  SQUARE: 5,
  CIRCLE: 6,
  POLYGON: 7,
  POLYLINE: 8,
  HIGHLIGHT: 9,
  UNDERLINE: 10,
  SQUIGGLY: 11,
  STRIKEOUT: 12,
  STAMP: 13,
  CARET: 14,
  INK: 15,
  POPUP: 16,
  FILEATTACHMENT: 17,
  SOUND: 18,
  MOVIE: 19,
  WIDGET: 20,
  SCREEN: 21,
  PRINTERMARK: 22,
  TRAPNET: 23,
  WATERMARK: 24,
  THREED: 25,
  REDACT: 26
};
var AnnotationBorderStyleType = {
  SOLID: 1,
  DASHED: 2,
  BEVELED: 3,
  INSET: 4,
  UNDERLINE: 5
};
var VerbosityLevel = {
  ERRORS: 0,
  WARNINGS: 1,
  INFOS: 5
};
var CMapCompressionType = {
  NONE: 0,
  BINARY: 1
};
var OPS = {
  dependency: 1,
  setLineWidth: 2,
  setLineCap: 3,
  setLineJoin: 4,
  setMiterLimit: 5,
  setDash: 6,
  setRenderingIntent: 7,
  setFlatness: 8,
  setGState: 9,
  save: 10,
  restore: 11,
  transform: 12,
  moveTo: 13,
  lineTo: 14,
  curveTo: 15,
  curveTo2: 16,
  curveTo3: 17,
  closePath: 18,
  rectangle: 19,
  stroke: 20,
  closeStroke: 21,
  fill: 22,
  eoFill: 23,
  fillStroke: 24,
  eoFillStroke: 25,
  closeFillStroke: 26,
  closeEOFillStroke: 27,
  endPath: 28,
  clip: 29,
  eoClip: 30,
  beginText: 31,
  endText: 32,
  setCharSpacing: 33,
  setWordSpacing: 34,
  setHScale: 35,
  setLeading: 36,
  setFont: 37,
  setTextRenderingMode: 38,
  setTextRise: 39,
  moveText: 40,
  setLeadingMoveText: 41,
  setTextMatrix: 42,
  nextLine: 43,
  showText: 44,
  showSpacedText: 45,
  nextLineShowText: 46,
  nextLineSetSpacingShowText: 47,
  setCharWidth: 48,
  setCharWidthAndBounds: 49,
  setStrokeColorSpace: 50,
  setFillColorSpace: 51,
  setStrokeColor: 52,
  setStrokeColorN: 53,
  setFillColor: 54,
  setFillColorN: 55,
  setStrokeGray: 56,
  setFillGray: 57,
  setStrokeRGBColor: 58,
  setFillRGBColor: 59,
  setStrokeCMYKColor: 60,
  setFillCMYKColor: 61,
  shadingFill: 62,
  beginInlineImage: 63,
  beginImageData: 64,
  endInlineImage: 65,
  paintXObject: 66,
  markPoint: 67,
  markPointProps: 68,
  beginMarkedContent: 69,
  beginMarkedContentProps: 70,
  endMarkedContent: 71,
  beginCompat: 72,
  endCompat: 73,
  paintFormXObjectBegin: 74,
  paintFormXObjectEnd: 75,
  beginGroup: 76,
  endGroup: 77,
  beginAnnotation: 80,
  endAnnotation: 81,
  paintImageMaskXObject: 83,
  paintImageMaskXObjectGroup: 84,
  paintImageXObject: 85,
  paintInlineImageXObject: 86,
  paintInlineImageXObjectGroup: 87,
  paintImageXObjectRepeat: 88,
  paintImageMaskXObjectRepeat: 89,
  paintSolidColorImageMask: 90,
  constructPath: 91,
  setStrokeTransparent: 92,
  setFillTransparent: 93
};
var PasswordResponses = {
  NEED_PASSWORD: 1,
  INCORRECT_PASSWORD: 2
};
var verbosity = VerbosityLevel.WARNINGS;
function setVerbosityLevel(level) {
  if (Number.isInteger(level)) {
    verbosity = level;
  }
}
function getVerbosityLevel() {
  return verbosity;
}
function info(msg) {
  if (verbosity >= VerbosityLevel.INFOS) {
    console.log(`Info: ${msg}`);
  }
}
function warn(msg) {
  if (verbosity >= VerbosityLevel.WARNINGS) {
    console.log(`Warning: ${msg}`);
  }
}
function unreachable(msg) {
  throw new Error(msg);
}
function assert(cond, msg) {
  if (!cond) {
    unreachable(msg);
  }
}
function _isValidProtocol(url) {
  switch (url == null ? void 0 : url.protocol) {
    case "http:":
    case "https:":
    case "ftp:":
    case "mailto:":
    case "tel:":
      return true;
    default:
      return false;
  }
}
function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  if (!url) {
    return null;
  }
  try {
    if (options && typeof url === "string") {
      if (options.addDefaultProtocol && url.startsWith("www.")) {
        const dots = url.match(/\./g);
        if ((dots == null ? void 0 : dots.length) >= 2) {
          url = `http://${url}`;
        }
      }
      if (options.tryConvertEncoding) {
        try {
          url = stringToUTF8String(url);
        } catch (e) {
        }
      }
    }
    const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
    if (_isValidProtocol(absoluteUrl)) {
      return absoluteUrl;
    }
  } catch (e) {
  }
  return null;
}
function shadow(obj, prop, value, nonSerializable = false) {
  Object.defineProperty(obj, prop, {
    value,
    enumerable: !nonSerializable,
    configurable: true,
    writable: false
  });
  return value;
}
var BaseException = function BaseExceptionClosure() {
  function BaseException2(message, name) {
    this.message = message;
    this.name = name;
  }
  BaseException2.prototype = new Error();
  BaseException2.constructor = BaseException2;
  return BaseException2;
}();
var PasswordException = class extends BaseException {
  constructor(msg, code) {
    super(msg, "PasswordException");
    this.code = code;
  }
};
var UnknownErrorException = class extends BaseException {
  constructor(msg, details) {
    super(msg, "UnknownErrorException");
    this.details = details;
  }
};
var InvalidPDFException = class extends BaseException {
  constructor(msg) {
    super(msg, "InvalidPDFException");
  }
};
var MissingPDFException = class extends BaseException {
  constructor(msg) {
    super(msg, "MissingPDFException");
  }
};
var UnexpectedResponseException = class extends BaseException {
  constructor(msg, status) {
    super(msg, "UnexpectedResponseException");
    this.status = status;
  }
};
var FormatError = class extends BaseException {
  constructor(msg) {
    super(msg, "FormatError");
  }
};
var AbortException = class extends BaseException {
  constructor(msg) {
    super(msg, "AbortException");
  }
};
function bytesToString(bytes) {
  if (typeof bytes !== "object" || (bytes == null ? void 0 : bytes.length) === void 0) {
    unreachable("Invalid argument for bytesToString");
  }
  const length = bytes.length;
  const MAX_ARGUMENT_COUNT = 8192;
  if (length < MAX_ARGUMENT_COUNT) {
    return String.fromCharCode.apply(null, bytes);
  }
  const strBuf = [];
  for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
    const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
    const chunk = bytes.subarray(i, chunkEnd);
    strBuf.push(String.fromCharCode.apply(null, chunk));
  }
  return strBuf.join("");
}
function stringToBytes(str) {
  if (typeof str !== "string") {
    unreachable("Invalid argument for stringToBytes");
  }
  const length = str.length;
  const bytes = new Uint8Array(length);
  for (let i = 0; i < length; ++i) {
    bytes[i] = str.charCodeAt(i) & 255;
  }
  return bytes;
}
function string32(value) {
  return String.fromCharCode(value >> 24 & 255, value >> 16 & 255, value >> 8 & 255, value & 255);
}
function objectFromMap(map) {
  const obj = /* @__PURE__ */ Object.create(null);
  for (const [key, value] of map) {
    obj[key] = value;
  }
  return obj;
}
function isLittleEndian() {
  const buffer8 = new Uint8Array(4);
  buffer8[0] = 1;
  const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  return view32[0] === 1;
}
function isEvalSupported() {
  try {
    new Function("");
    return true;
  } catch (e) {
    return false;
  }
}
var util_FeatureTest = class {
  static get isLittleEndian() {
    return shadow(this, "isLittleEndian", isLittleEndian());
  }
  static get isEvalSupported() {
    return shadow(this, "isEvalSupported", isEvalSupported());
  }
  static get isOffscreenCanvasSupported() {
    return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  }
  static get platform() {
    if (typeof navigator !== "undefined" && typeof (navigator == null ? void 0 : navigator.platform) === "string") {
      return shadow(this, "platform", {
        isMac: navigator.platform.includes("Mac")
      });
    }
    return shadow(this, "platform", {
      isMac: false
    });
  }
  static get isCSSRoundSupported() {
    var _a2, _b;
    return shadow(this, "isCSSRoundSupported", (_b = (_a2 = globalThis.CSS) == null ? void 0 : _a2.supports) == null ? void 0 : _b.call(_a2, "width: round(1.5px, 1px)"));
  }
};
var hexNumbers = Array.from(Array(256).keys(), (n) => n.toString(16).padStart(2, "0"));
var _getExtremumOnCurve, getExtremumOnCurve_fn, _getExtremum, getExtremum_fn;
var Util = class {
  static makeHexColor(r, g, b) {
    return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  }
  static scaleMinMax(transform, minMax) {
    let temp;
    if (transform[0]) {
      if (transform[0] < 0) {
        temp = minMax[0];
        minMax[0] = minMax[2];
        minMax[2] = temp;
      }
      minMax[0] *= transform[0];
      minMax[2] *= transform[0];
      if (transform[3] < 0) {
        temp = minMax[1];
        minMax[1] = minMax[3];
        minMax[3] = temp;
      }
      minMax[1] *= transform[3];
      minMax[3] *= transform[3];
    } else {
      temp = minMax[0];
      minMax[0] = minMax[1];
      minMax[1] = temp;
      temp = minMax[2];
      minMax[2] = minMax[3];
      minMax[3] = temp;
      if (transform[1] < 0) {
        temp = minMax[1];
        minMax[1] = minMax[3];
        minMax[3] = temp;
      }
      minMax[1] *= transform[1];
      minMax[3] *= transform[1];
      if (transform[2] < 0) {
        temp = minMax[0];
        minMax[0] = minMax[2];
        minMax[2] = temp;
      }
      minMax[0] *= transform[2];
      minMax[2] *= transform[2];
    }
    minMax[0] += transform[4];
    minMax[1] += transform[5];
    minMax[2] += transform[4];
    minMax[3] += transform[5];
  }
  static transform(m1, m2) {
    return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  }
  static applyTransform(p, m) {
    const xt = p[0] * m[0] + p[1] * m[2] + m[4];
    const yt = p[0] * m[1] + p[1] * m[3] + m[5];
    return [xt, yt];
  }
  static applyInverseTransform(p, m) {
    const d = m[0] * m[3] - m[1] * m[2];
    const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
    const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
    return [xt, yt];
  }
  static getAxialAlignedBoundingBox(r, m) {
    const p1 = this.applyTransform(r, m);
    const p2 = this.applyTransform(r.slice(2, 4), m);
    const p3 = this.applyTransform([r[0], r[3]], m);
    const p4 = this.applyTransform([r[2], r[1]], m);
    return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  }
  static inverseTransform(m) {
    const d = m[0] * m[3] - m[1] * m[2];
    return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  }
  static singularValueDecompose2dScale(m) {
    const transpose = [m[0], m[2], m[1], m[3]];
    const a = m[0] * transpose[0] + m[1] * transpose[2];
    const b = m[0] * transpose[1] + m[1] * transpose[3];
    const c = m[2] * transpose[0] + m[3] * transpose[2];
    const d = m[2] * transpose[1] + m[3] * transpose[3];
    const first = (a + d) / 2;
    const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
    const sx = first + second || 1;
    const sy = first - second || 1;
    return [Math.sqrt(sx), Math.sqrt(sy)];
  }
  static normalizeRect(rect) {
    const r = rect.slice(0);
    if (rect[0] > rect[2]) {
      r[0] = rect[2];
      r[2] = rect[0];
    }
    if (rect[1] > rect[3]) {
      r[1] = rect[3];
      r[3] = rect[1];
    }
    return r;
  }
  static intersect(rect1, rect2) {
    const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
    const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
    if (xLow > xHigh) {
      return null;
    }
    const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
    const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
    if (yLow > yHigh) {
      return null;
    }
    return [xLow, yLow, xHigh, yHigh];
  }
  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
    if (minMax) {
      minMax[0] = Math.min(minMax[0], x0, x3);
      minMax[1] = Math.min(minMax[1], y0, y3);
      minMax[2] = Math.max(minMax[2], x0, x3);
      minMax[3] = Math.max(minMax[3], y0, y3);
    } else {
      minMax = [Math.min(x0, x3), Math.min(y0, y3), Math.max(x0, x3), Math.max(y0, y3)];
    }
    __privateMethod(this, _getExtremum, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
    __privateMethod(this, _getExtremum, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
    return minMax;
  }
};
_getExtremumOnCurve = new WeakSet();
getExtremumOnCurve_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
  if (t <= 0 || t >= 1) {
    return;
  }
  const mt = 1 - t;
  const tt = t * t;
  const ttt = tt * t;
  const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
  const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
  minMax[0] = Math.min(minMax[0], x);
  minMax[1] = Math.min(minMax[1], y);
  minMax[2] = Math.max(minMax[2], x);
  minMax[3] = Math.max(minMax[3], y);
};
_getExtremum = new WeakSet();
getExtremum_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
  if (Math.abs(a) < 1e-12) {
    if (Math.abs(b) >= 1e-12) {
      __privateMethod(this, _getExtremumOnCurve, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
    }
    return;
  }
  const delta = b ** 2 - 4 * c * a;
  if (delta < 0) {
    return;
  }
  const sqrtDelta = Math.sqrt(delta);
  const a2 = 2 * a;
  __privateMethod(this, _getExtremumOnCurve, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
  __privateMethod(this, _getExtremumOnCurve, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
};
__privateAdd(Util, _getExtremumOnCurve);
__privateAdd(Util, _getExtremum);
function stringToUTF8String(str) {
  return decodeURIComponent(escape(str));
}
var NormalizeRegex = null;
var NormalizationMap = null;
function normalizeUnicode(str) {
  if (!NormalizeRegex) {
    NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
    NormalizationMap = /* @__PURE__ */ new Map([["\uFB05", "\u017Ft"]]);
  }
  return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
}
function getUuid() {
  if (typeof crypto !== "undefined" && typeof (crypto == null ? void 0 : crypto.randomUUID) === "function") {
    return crypto.randomUUID();
  }
  const buf = new Uint8Array(32);
  if (typeof crypto !== "undefined" && typeof (crypto == null ? void 0 : crypto.getRandomValues) === "function") {
    crypto.getRandomValues(buf);
  } else {
    for (let i = 0; i < 32; i++) {
      buf[i] = Math.floor(Math.random() * 255);
    }
  }
  return bytesToString(buf);
}
var AnnotationPrefix = "pdfjs_internal_id_";
var FontRenderOps = {
  BEZIER_CURVE_TO: 0,
  MOVE_TO: 1,
  LINE_TO: 2,
  QUADRATIC_CURVE_TO: 3,
  RESTORE: 4,
  SAVE: 5,
  SCALE: 6,
  TRANSFORM: 7,
  TRANSLATE: 8
};
var BaseFilterFactory = class {
  addFilter(maps) {
    return "none";
  }
  addHCMFilter(fgColor, bgColor) {
    return "none";
  }
  addAlphaFilter(map) {
    return "none";
  }
  addLuminosityFilter(map) {
    return "none";
  }
  addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
    return "none";
  }
  destroy(keepHCM = false) {
  }
};
var _enableHWA;
var BaseCanvasFactory = class {
  constructor({
    enableHWA = false
  } = {}) {
    __privateAdd(this, _enableHWA, false);
    __privateSet(this, _enableHWA, enableHWA);
  }
  create(width, height) {
    if (width <= 0 || height <= 0) {
      throw new Error("Invalid canvas size");
    }
    const canvas = this._createCanvas(width, height);
    return {
      canvas,
      context: canvas.getContext("2d", {
        willReadFrequently: !__privateGet(this, _enableHWA)
      })
    };
  }
  reset(canvasAndContext, width, height) {
    if (!canvasAndContext.canvas) {
      throw new Error("Canvas is not specified");
    }
    if (width <= 0 || height <= 0) {
      throw new Error("Invalid canvas size");
    }
    canvasAndContext.canvas.width = width;
    canvasAndContext.canvas.height = height;
  }
  destroy(canvasAndContext) {
    if (!canvasAndContext.canvas) {
      throw new Error("Canvas is not specified");
    }
    canvasAndContext.canvas.width = 0;
    canvasAndContext.canvas.height = 0;
    canvasAndContext.canvas = null;
    canvasAndContext.context = null;
  }
  _createCanvas(width, height) {
    unreachable("Abstract method `_createCanvas` called.");
  }
};
_enableHWA = new WeakMap();
var BaseCMapReaderFactory = class {
  constructor({
    baseUrl = null,
    isCompressed = true
  }) {
    this.baseUrl = baseUrl;
    this.isCompressed = isCompressed;
  }
  async fetch({
    name
  }) {
    if (!this.baseUrl) {
      throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");
    }
    if (!name) {
      throw new Error("CMap name must be specified.");
    }
    const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
    const compressionType = this.isCompressed ? CMapCompressionType.BINARY : CMapCompressionType.NONE;
    return this._fetchData(url, compressionType).catch((reason) => {
      throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`);
    });
  }
  _fetchData(url, compressionType) {
    unreachable("Abstract method `_fetchData` called.");
  }
};
var BaseStandardFontDataFactory = class {
  constructor({
    baseUrl = null
  }) {
    this.baseUrl = baseUrl;
  }
  async fetch({
    filename
  }) {
    if (!this.baseUrl) {
      throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");
    }
    if (!filename) {
      throw new Error("Font filename must be specified.");
    }
    const url = `${this.baseUrl}${filename}`;
    return this._fetchData(url).catch((reason) => {
      throw new Error(`Unable to load font data at: ${url}`);
    });
  }
  _fetchData(url) {
    unreachable("Abstract method `_fetchData` called.");
  }
};
var BaseSVGFactory = class {
  create(width, height, skipDimensions = false) {
    if (width <= 0 || height <= 0) {
      throw new Error("Invalid SVG dimensions");
    }
    const svg = this._createSVG("svg:svg");
    svg.setAttribute("version", "1.1");
    if (!skipDimensions) {
      svg.setAttribute("width", `${width}px`);
      svg.setAttribute("height", `${height}px`);
    }
    svg.setAttribute("preserveAspectRatio", "none");
    svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
    return svg;
  }
  createElement(type) {
    if (typeof type !== "string") {
      throw new Error("Invalid SVG element type");
    }
    return this._createSVG(type);
  }
  _createSVG(type) {
    unreachable("Abstract method `_createSVG` called.");
  }
};
var SVG_NS = "http://www.w3.org/2000/svg";
var _PixelsPerInch = class {
};
var PixelsPerInch = _PixelsPerInch;
__publicField(PixelsPerInch, "CSS", 96);
__publicField(PixelsPerInch, "PDF", 72);
__publicField(PixelsPerInch, "PDF_TO_CSS_UNITS", _PixelsPerInch.CSS / _PixelsPerInch.PDF);
var _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id, _cache, cache_get, _hcmCache, hcmCache_get, _defs, defs_get, _createTables, createTables_fn, _createUrl, createUrl_fn, _addLuminosityConversion, addLuminosityConversion_fn, _addGrayConversion, addGrayConversion_fn, _createFilter, createFilter_fn, _appendFeFunc, appendFeFunc_fn, _addTransferMapConversion, addTransferMapConversion_fn, _addTransferMapAlphaConversion, addTransferMapAlphaConversion_fn, _getRGB, getRGB_fn;
var DOMFilterFactory = class extends BaseFilterFactory {
  constructor({
    docId,
    ownerDocument = globalThis.document
  } = {}) {
    super();
    __privateAdd(this, _cache);
    __privateAdd(this, _hcmCache);
    __privateAdd(this, _defs);
    __privateAdd(this, _createTables);
    __privateAdd(this, _createUrl);
    __privateAdd(this, _addLuminosityConversion);
    __privateAdd(this, _addGrayConversion);
    __privateAdd(this, _createFilter);
    __privateAdd(this, _appendFeFunc);
    __privateAdd(this, _addTransferMapConversion);
    __privateAdd(this, _addTransferMapAlphaConversion);
    __privateAdd(this, _getRGB);
    __privateAdd(this, _baseUrl, void 0);
    __privateAdd(this, __cache, void 0);
    __privateAdd(this, __defs, void 0);
    __privateAdd(this, _docId, void 0);
    __privateAdd(this, _document, void 0);
    __privateAdd(this, __hcmCache, void 0);
    __privateAdd(this, _id, 0);
    __privateSet(this, _docId, docId);
    __privateSet(this, _document, ownerDocument);
  }
  addFilter(maps) {
    if (!maps) {
      return "none";
    }
    let value = __privateGet(this, _cache, cache_get).get(maps);
    if (value) {
      return value;
    }
    const [tableR, tableG, tableB] = __privateMethod(this, _createTables, createTables_fn).call(this, maps);
    const key = maps.length === 1 ? tableR : `${tableR}${tableG}${tableB}`;
    value = __privateGet(this, _cache, cache_get).get(key);
    if (value) {
      __privateGet(this, _cache, cache_get).set(maps, value);
      return value;
    }
    const id = `g_${__privateGet(this, _docId)}_transfer_map_${__privateWrapper(this, _id)._++}`;
    const url = __privateMethod(this, _createUrl, createUrl_fn).call(this, id);
    __privateGet(this, _cache, cache_get).set(maps, url);
    __privateGet(this, _cache, cache_get).set(key, url);
    const filter = __privateMethod(this, _createFilter, createFilter_fn).call(this, id);
    __privateMethod(this, _addTransferMapConversion, addTransferMapConversion_fn).call(this, tableR, tableG, tableB, filter);
    return url;
  }
  addHCMFilter(fgColor, bgColor) {
    var _a2;
    const key = `${fgColor}-${bgColor}`;
    const filterName = "base";
    let info2 = __privateGet(this, _hcmCache, hcmCache_get).get(filterName);
    if ((info2 == null ? void 0 : info2.key) === key) {
      return info2.url;
    }
    if (info2) {
      (_a2 = info2.filter) == null ? void 0 : _a2.remove();
      info2.key = key;
      info2.url = "none";
      info2.filter = null;
    } else {
      info2 = {
        key,
        url: "none",
        filter: null
      };
      __privateGet(this, _hcmCache, hcmCache_get).set(filterName, info2);
    }
    if (!fgColor || !bgColor) {
      return info2.url;
    }
    const fgRGB = __privateMethod(this, _getRGB, getRGB_fn).call(this, fgColor);
    fgColor = Util.makeHexColor(...fgRGB);
    const bgRGB = __privateMethod(this, _getRGB, getRGB_fn).call(this, bgColor);
    bgColor = Util.makeHexColor(...bgRGB);
    __privateGet(this, _defs, defs_get).style.color = "";
    if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
      return info2.url;
    }
    const map = new Array(256);
    for (let i = 0; i <= 255; i++) {
      const x = i / 255;
      map[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
    }
    const table = map.join(",");
    const id = `g_${__privateGet(this, _docId)}_hcm_filter`;
    const filter = info2.filter = __privateMethod(this, _createFilter, createFilter_fn).call(this, id);
    __privateMethod(this, _addTransferMapConversion, addTransferMapConversion_fn).call(this, table, table, table, filter);
    __privateMethod(this, _addGrayConversion, addGrayConversion_fn).call(this, filter);
    const getSteps = (c, n) => {
      const start = fgRGB[c] / 255;
      const end = bgRGB[c] / 255;
      const arr = new Array(n + 1);
      for (let i = 0; i <= n; i++) {
        arr[i] = start + i / n * (end - start);
      }
      return arr.join(",");
    };
    __privateMethod(this, _addTransferMapConversion, addTransferMapConversion_fn).call(this, getSteps(0, 5), getSteps(1, 5), getSteps(2, 5), filter);
    info2.url = __privateMethod(this, _createUrl, createUrl_fn).call(this, id);
    return info2.url;
  }
  addAlphaFilter(map) {
    let value = __privateGet(this, _cache, cache_get).get(map);
    if (value) {
      return value;
    }
    const [tableA] = __privateMethod(this, _createTables, createTables_fn).call(this, [map]);
    const key = `alpha_${tableA}`;
    value = __privateGet(this, _cache, cache_get).get(key);
    if (value) {
      __privateGet(this, _cache, cache_get).set(map, value);
      return value;
    }
    const id = `g_${__privateGet(this, _docId)}_alpha_map_${__privateWrapper(this, _id)._++}`;
    const url = __privateMethod(this, _createUrl, createUrl_fn).call(this, id);
    __privateGet(this, _cache, cache_get).set(map, url);
    __privateGet(this, _cache, cache_get).set(key, url);
    const filter = __privateMethod(this, _createFilter, createFilter_fn).call(this, id);
    __privateMethod(this, _addTransferMapAlphaConversion, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
    return url;
  }
  addLuminosityFilter(map) {
    let value = __privateGet(this, _cache, cache_get).get(map || "luminosity");
    if (value) {
      return value;
    }
    let tableA, key;
    if (map) {
      [tableA] = __privateMethod(this, _createTables, createTables_fn).call(this, [map]);
      key = `luminosity_${tableA}`;
    } else {
      key = "luminosity";
    }
    value = __privateGet(this, _cache, cache_get).get(key);
    if (value) {
      __privateGet(this, _cache, cache_get).set(map, value);
      return value;
    }
    const id = `g_${__privateGet(this, _docId)}_luminosity_map_${__privateWrapper(this, _id)._++}`;
    const url = __privateMethod(this, _createUrl, createUrl_fn).call(this, id);
    __privateGet(this, _cache, cache_get).set(map, url);
    __privateGet(this, _cache, cache_get).set(key, url);
    const filter = __privateMethod(this, _createFilter, createFilter_fn).call(this, id);
    __privateMethod(this, _addLuminosityConversion, addLuminosityConversion_fn).call(this, filter);
    if (map) {
      __privateMethod(this, _addTransferMapAlphaConversion, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
    }
    return url;
  }
  addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
    var _a2;
    const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;
    let info2 = __privateGet(this, _hcmCache, hcmCache_get).get(filterName);
    if ((info2 == null ? void 0 : info2.key) === key) {
      return info2.url;
    }
    if (info2) {
      (_a2 = info2.filter) == null ? void 0 : _a2.remove();
      info2.key = key;
      info2.url = "none";
      info2.filter = null;
    } else {
      info2 = {
        key,
        url: "none",
        filter: null
      };
      __privateGet(this, _hcmCache, hcmCache_get).set(filterName, info2);
    }
    if (!fgColor || !bgColor) {
      return info2.url;
    }
    const [fgRGB, bgRGB] = [fgColor, bgColor].map(__privateMethod(this, _getRGB, getRGB_fn).bind(this));
    let fgGray = Math.round(0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]);
    let bgGray = Math.round(0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]);
    let [newFgRGB, newBgRGB] = [newFgColor, newBgColor].map(__privateMethod(this, _getRGB, getRGB_fn).bind(this));
    if (bgGray < fgGray) {
      [fgGray, bgGray, newFgRGB, newBgRGB] = [bgGray, fgGray, newBgRGB, newFgRGB];
    }
    __privateGet(this, _defs, defs_get).style.color = "";
    const getSteps = (fg, bg, n) => {
      const arr = new Array(256);
      const step = (bgGray - fgGray) / n;
      const newStart = fg / 255;
      const newStep = (bg - fg) / (255 * n);
      let prev = 0;
      for (let i = 0; i <= n; i++) {
        const k = Math.round(fgGray + i * step);
        const value = newStart + i * newStep;
        for (let j = prev; j <= k; j++) {
          arr[j] = value;
        }
        prev = k + 1;
      }
      for (let i = prev; i < 256; i++) {
        arr[i] = arr[prev - 1];
      }
      return arr.join(",");
    };
    const id = `g_${__privateGet(this, _docId)}_hcm_${filterName}_filter`;
    const filter = info2.filter = __privateMethod(this, _createFilter, createFilter_fn).call(this, id);
    __privateMethod(this, _addGrayConversion, addGrayConversion_fn).call(this, filter);
    __privateMethod(this, _addTransferMapConversion, addTransferMapConversion_fn).call(this, getSteps(newFgRGB[0], newBgRGB[0], 5), getSteps(newFgRGB[1], newBgRGB[1], 5), getSteps(newFgRGB[2], newBgRGB[2], 5), filter);
    info2.url = __privateMethod(this, _createUrl, createUrl_fn).call(this, id);
    return info2.url;
  }
  destroy(keepHCM = false) {
    if (keepHCM && __privateGet(this, _hcmCache, hcmCache_get).size !== 0) {
      return;
    }
    if (__privateGet(this, __defs)) {
      __privateGet(this, __defs).parentNode.parentNode.remove();
      __privateSet(this, __defs, null);
    }
    if (__privateGet(this, __cache)) {
      __privateGet(this, __cache).clear();
      __privateSet(this, __cache, null);
    }
    __privateSet(this, _id, 0);
  }
};
_baseUrl = new WeakMap();
__cache = new WeakMap();
__defs = new WeakMap();
_docId = new WeakMap();
_document = new WeakMap();
__hcmCache = new WeakMap();
_id = new WeakMap();
_cache = new WeakSet();
cache_get = function() {
  return __privateGet(this, __cache) || __privateSet(this, __cache, /* @__PURE__ */ new Map());
};
_hcmCache = new WeakSet();
hcmCache_get = function() {
  return __privateGet(this, __hcmCache) || __privateSet(this, __hcmCache, /* @__PURE__ */ new Map());
};
_defs = new WeakSet();
defs_get = function() {
  if (!__privateGet(this, __defs)) {
    const div = __privateGet(this, _document).createElement("div");
    const {
      style
    } = div;
    style.visibility = "hidden";
    style.contain = "strict";
    style.width = style.height = 0;
    style.position = "absolute";
    style.top = style.left = 0;
    style.zIndex = -1;
    const svg = __privateGet(this, _document).createElementNS(SVG_NS, "svg");
    svg.setAttribute("width", 0);
    svg.setAttribute("height", 0);
    __privateSet(this, __defs, __privateGet(this, _document).createElementNS(SVG_NS, "defs"));
    div.append(svg);
    svg.append(__privateGet(this, __defs));
    __privateGet(this, _document).body.append(div);
  }
  return __privateGet(this, __defs);
};
_createTables = new WeakSet();
createTables_fn = function(maps) {
  if (maps.length === 1) {
    const mapR2 = maps[0];
    const buffer = new Array(256);
    for (let i = 0; i < 256; i++) {
      buffer[i] = mapR2[i] / 255;
    }
    const table = buffer.join(",");
    return [table, table, table];
  }
  const [mapR, mapG, mapB] = maps;
  const bufferR = new Array(256);
  const bufferG = new Array(256);
  const bufferB = new Array(256);
  for (let i = 0; i < 256; i++) {
    bufferR[i] = mapR[i] / 255;
    bufferG[i] = mapG[i] / 255;
    bufferB[i] = mapB[i] / 255;
  }
  return [bufferR.join(","), bufferG.join(","), bufferB.join(",")];
};
_createUrl = new WeakSet();
createUrl_fn = function(id) {
  if (__privateGet(this, _baseUrl) === void 0) {
    __privateSet(this, _baseUrl, "");
    const url = __privateGet(this, _document).URL;
    if (url !== __privateGet(this, _document).baseURI) {
      if (isDataScheme(url)) {
        warn('#createUrl: ignore "data:"-URL for performance reasons.');
      } else {
        __privateSet(this, _baseUrl, url.split("#", 1)[0]);
      }
    }
  }
  return `url(${__privateGet(this, _baseUrl)}#${id})`;
};
_addLuminosityConversion = new WeakSet();
addLuminosityConversion_fn = function(filter) {
  const feColorMatrix = __privateGet(this, _document).createElementNS(SVG_NS, "feColorMatrix");
  feColorMatrix.setAttribute("type", "matrix");
  feColorMatrix.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0");
  filter.append(feColorMatrix);
};
_addGrayConversion = new WeakSet();
addGrayConversion_fn = function(filter) {
  const feColorMatrix = __privateGet(this, _document).createElementNS(SVG_NS, "feColorMatrix");
  feColorMatrix.setAttribute("type", "matrix");
  feColorMatrix.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");
  filter.append(feColorMatrix);
};
_createFilter = new WeakSet();
createFilter_fn = function(id) {
  const filter = __privateGet(this, _document).createElementNS(SVG_NS, "filter");
  filter.setAttribute("color-interpolation-filters", "sRGB");
  filter.setAttribute("id", id);
  __privateGet(this, _defs, defs_get).append(filter);
  return filter;
};
_appendFeFunc = new WeakSet();
appendFeFunc_fn = function(feComponentTransfer, func, table) {
  const feFunc = __privateGet(this, _document).createElementNS(SVG_NS, func);
  feFunc.setAttribute("type", "discrete");
  feFunc.setAttribute("tableValues", table);
  feComponentTransfer.append(feFunc);
};
_addTransferMapConversion = new WeakSet();
addTransferMapConversion_fn = function(rTable, gTable, bTable, filter) {
  const feComponentTransfer = __privateGet(this, _document).createElementNS(SVG_NS, "feComponentTransfer");
  filter.append(feComponentTransfer);
  __privateMethod(this, _appendFeFunc, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncR", rTable);
  __privateMethod(this, _appendFeFunc, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncG", gTable);
  __privateMethod(this, _appendFeFunc, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncB", bTable);
};
_addTransferMapAlphaConversion = new WeakSet();
addTransferMapAlphaConversion_fn = function(aTable, filter) {
  const feComponentTransfer = __privateGet(this, _document).createElementNS(SVG_NS, "feComponentTransfer");
  filter.append(feComponentTransfer);
  __privateMethod(this, _appendFeFunc, appendFeFunc_fn).call(this, feComponentTransfer, "feFuncA", aTable);
};
_getRGB = new WeakSet();
getRGB_fn = function(color) {
  __privateGet(this, _defs, defs_get).style.color = color;
  return getRGB(getComputedStyle(__privateGet(this, _defs, defs_get)).getPropertyValue("color"));
};
var DOMCanvasFactory = class extends BaseCanvasFactory {
  constructor({
    ownerDocument = globalThis.document,
    enableHWA = false
  } = {}) {
    super({
      enableHWA
    });
    this._document = ownerDocument;
  }
  _createCanvas(width, height) {
    const canvas = this._document.createElement("canvas");
    canvas.width = width;
    canvas.height = height;
    return canvas;
  }
};
async function fetchData(url, type = "text") {
  if (isValidFetchUrl(url, document.baseURI)) {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error(response.statusText);
    }
    switch (type) {
      case "arraybuffer":
        return response.arrayBuffer();
      case "blob":
        return response.blob();
      case "json":
        return response.json();
    }
    return response.text();
  }
  return new Promise((resolve, reject) => {
    const request = new XMLHttpRequest();
    request.open("GET", url, true);
    request.responseType = type;
    request.onreadystatechange = () => {
      if (request.readyState !== XMLHttpRequest.DONE) {
        return;
      }
      if (request.status === 200 || request.status === 0) {
        switch (type) {
          case "arraybuffer":
          case "blob":
          case "json":
            resolve(request.response);
            return;
        }
        resolve(request.responseText);
        return;
      }
      reject(new Error(request.statusText));
    };
    request.send(null);
  });
}
var DOMCMapReaderFactory = class extends BaseCMapReaderFactory {
  _fetchData(url, compressionType) {
    return fetchData(url, this.isCompressed ? "arraybuffer" : "text").then((data) => ({
      cMapData: data instanceof ArrayBuffer ? new Uint8Array(data) : stringToBytes(data),
      compressionType
    }));
  }
};
var DOMStandardFontDataFactory = class extends BaseStandardFontDataFactory {
  _fetchData(url) {
    return fetchData(url, "arraybuffer").then((data) => new Uint8Array(data));
  }
};
var DOMSVGFactory = class extends BaseSVGFactory {
  _createSVG(type) {
    return document.createElementNS(SVG_NS, type);
  }
};
var PageViewport = class {
  constructor({
    viewBox,
    scale,
    rotation,
    offsetX = 0,
    offsetY = 0,
    dontFlip = false
  }) {
    this.viewBox = viewBox;
    this.scale = scale;
    this.rotation = rotation;
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    const centerX = (viewBox[2] + viewBox[0]) / 2;
    const centerY = (viewBox[3] + viewBox[1]) / 2;
    let rotateA, rotateB, rotateC, rotateD;
    rotation %= 360;
    if (rotation < 0) {
      rotation += 360;
    }
    switch (rotation) {
      case 180:
        rotateA = -1;
        rotateB = 0;
        rotateC = 0;
        rotateD = 1;
        break;
      case 90:
        rotateA = 0;
        rotateB = 1;
        rotateC = 1;
        rotateD = 0;
        break;
      case 270:
        rotateA = 0;
        rotateB = -1;
        rotateC = -1;
        rotateD = 0;
        break;
      case 0:
        rotateA = 1;
        rotateB = 0;
        rotateC = 0;
        rotateD = -1;
        break;
      default:
        throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
    }
    if (dontFlip) {
      rotateC = -rotateC;
      rotateD = -rotateD;
    }
    let offsetCanvasX, offsetCanvasY;
    let width, height;
    if (rotateA === 0) {
      offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
      offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
      width = (viewBox[3] - viewBox[1]) * scale;
      height = (viewBox[2] - viewBox[0]) * scale;
    } else {
      offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
      offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
      width = (viewBox[2] - viewBox[0]) * scale;
      height = (viewBox[3] - viewBox[1]) * scale;
    }
    this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
    this.width = width;
    this.height = height;
  }
  get rawDims() {
    const {
      viewBox
    } = this;
    return shadow(this, "rawDims", {
      pageWidth: viewBox[2] - viewBox[0],
      pageHeight: viewBox[3] - viewBox[1],
      pageX: viewBox[0],
      pageY: viewBox[1]
    });
  }
  clone({
    scale = this.scale,
    rotation = this.rotation,
    offsetX = this.offsetX,
    offsetY = this.offsetY,
    dontFlip = false
  } = {}) {
    return new PageViewport({
      viewBox: this.viewBox.slice(),
      scale,
      rotation,
      offsetX,
      offsetY,
      dontFlip
    });
  }
  convertToViewportPoint(x, y) {
    return Util.applyTransform([x, y], this.transform);
  }
  convertToViewportRectangle(rect) {
    const topLeft = Util.applyTransform([rect[0], rect[1]], this.transform);
    const bottomRight = Util.applyTransform([rect[2], rect[3]], this.transform);
    return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
  }
  convertToPdfPoint(x, y) {
    return Util.applyInverseTransform([x, y], this.transform);
  }
};
var RenderingCancelledException = class extends BaseException {
  constructor(msg, extraDelay = 0) {
    super(msg, "RenderingCancelledException");
    this.extraDelay = extraDelay;
  }
};
function isDataScheme(url) {
  const ii = url.length;
  let i = 0;
  while (i < ii && url[i].trim() === "") {
    i++;
  }
  return url.substring(i, i + 5).toLowerCase() === "data:";
}
function isPdfFile(filename) {
  return typeof filename === "string" && /\.pdf$/i.test(filename);
}
function getFilenameFromUrl(url) {
  [url] = url.split(/[#?]/, 1);
  return url.substring(url.lastIndexOf("/") + 1);
}
function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
  if (typeof url !== "string") {
    return defaultFilename;
  }
  if (isDataScheme(url)) {
    warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');
    return defaultFilename;
  }
  const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
  const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
  const splitURI = reURI.exec(url);
  let suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
  if (suggestedFilename) {
    suggestedFilename = suggestedFilename[0];
    if (suggestedFilename.includes("%")) {
      try {
        suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
      } catch (e) {
      }
    }
  }
  return suggestedFilename || defaultFilename;
}
var StatTimer = class {
  constructor() {
    __publicField(this, "started", /* @__PURE__ */ Object.create(null));
    __publicField(this, "times", []);
  }
  time(name) {
    if (name in this.started) {
      warn(`Timer is already running for ${name}`);
    }
    this.started[name] = Date.now();
  }
  timeEnd(name) {
    if (!(name in this.started)) {
      warn(`Timer has not been started for ${name}`);
    }
    this.times.push({
      name,
      start: this.started[name],
      end: Date.now()
    });
    delete this.started[name];
  }
  toString() {
    const outBuf = [];
    let longest = 0;
    for (const {
      name
    } of this.times) {
      longest = Math.max(name.length, longest);
    }
    for (const {
      name,
      start,
      end
    } of this.times) {
      outBuf.push(`${name.padEnd(longest)} ${end - start}ms
`);
    }
    return outBuf.join("");
  }
};
function isValidFetchUrl(url, baseUrl) {
  try {
    const {
      protocol
    } = baseUrl ? new URL(url, baseUrl) : new URL(url);
    return protocol === "http:" || protocol === "https:";
  } catch (e) {
    return false;
  }
}
function noContextMenu(e) {
  e.preventDefault();
}
var pdfDateStringRegex;
var PDFDateString = class {
  static toDateObject(input) {
    if (!input || typeof input !== "string") {
      return null;
    }
    pdfDateStringRegex || (pdfDateStringRegex = new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));
    const matches2 = pdfDateStringRegex.exec(input);
    if (!matches2) {
      return null;
    }
    const year = parseInt(matches2[1], 10);
    let month = parseInt(matches2[2], 10);
    month = month >= 1 && month <= 12 ? month - 1 : 0;
    let day = parseInt(matches2[3], 10);
    day = day >= 1 && day <= 31 ? day : 1;
    let hour = parseInt(matches2[4], 10);
    hour = hour >= 0 && hour <= 23 ? hour : 0;
    let minute = parseInt(matches2[5], 10);
    minute = minute >= 0 && minute <= 59 ? minute : 0;
    let second = parseInt(matches2[6], 10);
    second = second >= 0 && second <= 59 ? second : 0;
    const universalTimeRelation = matches2[7] || "Z";
    let offsetHour = parseInt(matches2[8], 10);
    offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
    let offsetMinute = parseInt(matches2[9], 10) || 0;
    offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
    if (universalTimeRelation === "-") {
      hour += offsetHour;
      minute += offsetMinute;
    } else if (universalTimeRelation === "+") {
      hour -= offsetHour;
      minute -= offsetMinute;
    }
    return new Date(Date.UTC(year, month, day, hour, minute, second));
  }
};
function getXfaPageViewport(xfaPage, {
  scale = 1,
  rotation = 0
}) {
  const {
    width,
    height
  } = xfaPage.attributes.style;
  const viewBox = [0, 0, parseInt(width), parseInt(height)];
  return new PageViewport({
    viewBox,
    scale,
    rotation
  });
}
function getRGB(color) {
  if (color.startsWith("#")) {
    const colorRGB = parseInt(color.slice(1), 16);
    return [(colorRGB & 16711680) >> 16, (colorRGB & 65280) >> 8, colorRGB & 255];
  }
  if (color.startsWith("rgb(")) {
    return color.slice(4, -1).split(",").map((x) => parseInt(x));
  }
  if (color.startsWith("rgba(")) {
    return color.slice(5, -1).split(",").map((x) => parseInt(x)).slice(0, 3);
  }
  warn(`Not a valid color format: "${color}"`);
  return [0, 0, 0];
}
function getColorValues(colors) {
  const span = document.createElement("span");
  span.style.visibility = "hidden";
  document.body.append(span);
  for (const name of colors.keys()) {
    span.style.color = name;
    const computedColor = window.getComputedStyle(span).color;
    colors.set(name, getRGB(computedColor));
  }
  span.remove();
}
function getCurrentTransform(ctx) {
  const {
    a,
    b,
    c,
    d,
    e,
    f
  } = ctx.getTransform();
  return [a, b, c, d, e, f];
}
function getCurrentTransformInverse(ctx) {
  const {
    a,
    b,
    c,
    d,
    e,
    f
  } = ctx.getTransform().invertSelf();
  return [a, b, c, d, e, f];
}
function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true) {
  if (viewport instanceof PageViewport) {
    const {
      pageWidth,
      pageHeight
    } = viewport.rawDims;
    const {
      style
    } = div;
    const useRound = util_FeatureTest.isCSSRoundSupported;
    const w = `var(--scale-factor) * ${pageWidth}px`, h = `var(--scale-factor) * ${pageHeight}px`;
    const widthStr = useRound ? `round(${w}, 1px)` : `calc(${w})`, heightStr = useRound ? `round(${h}, 1px)` : `calc(${h})`;
    if (!mustFlip || viewport.rotation % 180 === 0) {
      style.width = widthStr;
      style.height = heightStr;
    } else {
      style.width = heightStr;
      style.height = widthStr;
    }
  }
  if (mustRotate) {
    div.setAttribute("data-main-rotation", viewport.rotation);
  }
}
var _toolbar, _colorPicker, _editor, _buttons, _altText, _l10nRemove, _pointerDown, pointerDown_fn, _focusIn, focusIn_fn, _focusOut, focusOut_fn, _addListenersToElement, addListenersToElement_fn, _addDeleteButton, addDeleteButton_fn, _divider, divider_get;
var _EditorToolbar = class {
  constructor(editor) {
    __privateAdd(this, _focusIn);
    __privateAdd(this, _focusOut);
    __privateAdd(this, _addListenersToElement);
    __privateAdd(this, _addDeleteButton);
    __privateAdd(this, _divider);
    __privateAdd(this, _toolbar, null);
    __privateAdd(this, _colorPicker, null);
    __privateAdd(this, _editor, void 0);
    __privateAdd(this, _buttons, null);
    __privateAdd(this, _altText, null);
    __privateSet(this, _editor, editor);
    __privateGet(_EditorToolbar, _l10nRemove) || __privateSet(_EditorToolbar, _l10nRemove, Object.freeze({
      freetext: "pdfjs-editor-remove-freetext-button",
      highlight: "pdfjs-editor-remove-highlight-button",
      ink: "pdfjs-editor-remove-ink-button",
      stamp: "pdfjs-editor-remove-stamp-button"
    }));
  }
  render() {
    const editToolbar = __privateSet(this, _toolbar, document.createElement("div"));
    editToolbar.className = "editToolbar";
    editToolbar.setAttribute("role", "toolbar");
    const signal = __privateGet(this, _editor)._uiManager._signal;
    editToolbar.addEventListener("contextmenu", noContextMenu, {
      signal
    });
    editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _pointerDown, pointerDown_fn), {
      signal
    });
    const buttons = __privateSet(this, _buttons, document.createElement("div"));
    buttons.className = "buttons";
    editToolbar.append(buttons);
    const position = __privateGet(this, _editor).toolbarPosition;
    if (position) {
      const {
        style
      } = editToolbar;
      const x = __privateGet(this, _editor)._uiManager.direction === "ltr" ? 1 - position[0] : position[0];
      style.insetInlineEnd = `${100 * x}%`;
      style.top = `calc(${100 * position[1]}% + var(--editor-toolbar-vert-offset))`;
    }
    __privateMethod(this, _addDeleteButton, addDeleteButton_fn).call(this);
    return editToolbar;
  }
  hide() {
    var _a2;
    __privateGet(this, _toolbar).classList.add("hidden");
    (_a2 = __privateGet(this, _colorPicker)) == null ? void 0 : _a2.hideDropdown();
  }
  show() {
    var _a2;
    __privateGet(this, _toolbar).classList.remove("hidden");
    (_a2 = __privateGet(this, _altText)) == null ? void 0 : _a2.shown();
  }
  async addAltText(altText) {
    const button = await altText.render();
    __privateMethod(this, _addListenersToElement, addListenersToElement_fn).call(this, button);
    __privateGet(this, _buttons).prepend(button, __privateGet(this, _divider, divider_get));
    __privateSet(this, _altText, altText);
  }
  addColorPicker(colorPicker) {
    __privateSet(this, _colorPicker, colorPicker);
    const button = colorPicker.renderButton();
    __privateMethod(this, _addListenersToElement, addListenersToElement_fn).call(this, button);
    __privateGet(this, _buttons).prepend(button, __privateGet(this, _divider, divider_get));
  }
  remove() {
    var _a2;
    __privateGet(this, _toolbar).remove();
    (_a2 = __privateGet(this, _colorPicker)) == null ? void 0 : _a2.destroy();
    __privateSet(this, _colorPicker, null);
  }
};
var EditorToolbar = _EditorToolbar;
_toolbar = new WeakMap();
_colorPicker = new WeakMap();
_editor = new WeakMap();
_buttons = new WeakMap();
_altText = new WeakMap();
_l10nRemove = new WeakMap();
_pointerDown = new WeakSet();
pointerDown_fn = function(e) {
  e.stopPropagation();
};
_focusIn = new WeakSet();
focusIn_fn = function(e) {
  __privateGet(this, _editor)._focusEventsAllowed = false;
  e.preventDefault();
  e.stopPropagation();
};
_focusOut = new WeakSet();
focusOut_fn = function(e) {
  __privateGet(this, _editor)._focusEventsAllowed = true;
  e.preventDefault();
  e.stopPropagation();
};
_addListenersToElement = new WeakSet();
addListenersToElement_fn = function(element2) {
  const signal = __privateGet(this, _editor)._uiManager._signal;
  element2.addEventListener("focusin", __privateMethod(this, _focusIn, focusIn_fn).bind(this), {
    capture: true,
    signal
  });
  element2.addEventListener("focusout", __privateMethod(this, _focusOut, focusOut_fn).bind(this), {
    capture: true,
    signal
  });
  element2.addEventListener("contextmenu", noContextMenu, {
    signal
  });
};
_addDeleteButton = new WeakSet();
addDeleteButton_fn = function() {
  const {
    editorType,
    _uiManager: _uiManager4
  } = __privateGet(this, _editor);
  const button = document.createElement("button");
  button.className = "delete";
  button.tabIndex = 0;
  button.setAttribute("data-l10n-id", __privateGet(_EditorToolbar, _l10nRemove)[editorType]);
  __privateMethod(this, _addListenersToElement, addListenersToElement_fn).call(this, button);
  button.addEventListener("click", (e) => {
    _uiManager4.delete();
  }, {
    signal: _uiManager4._signal
  });
  __privateGet(this, _buttons).append(button);
};
_divider = new WeakSet();
divider_get = function() {
  const divider = document.createElement("div");
  divider.className = "divider";
  return divider;
};
__privateAdd(EditorToolbar, _pointerDown);
__privateAdd(EditorToolbar, _l10nRemove, null);
var _buttons2, _toolbar2, _uiManager, _render, render_fn, _getLastPoint, getLastPoint_fn, _addHighlightButton, addHighlightButton_fn;
var HighlightToolbar = class {
  constructor(uiManager) {
    __privateAdd(this, _render);
    __privateAdd(this, _getLastPoint);
    __privateAdd(this, _addHighlightButton);
    __privateAdd(this, _buttons2, null);
    __privateAdd(this, _toolbar2, null);
    __privateAdd(this, _uiManager, void 0);
    __privateSet(this, _uiManager, uiManager);
  }
  show(parent, boxes, isLTR) {
    const [x, y] = __privateMethod(this, _getLastPoint, getLastPoint_fn).call(this, boxes, isLTR);
    const {
      style
    } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _render, render_fn).call(this));
    parent.append(__privateGet(this, _toolbar2));
    style.insetInlineEnd = `${100 * x}%`;
    style.top = `calc(${100 * y}% + var(--editor-toolbar-vert-offset))`;
  }
  hide() {
    __privateGet(this, _toolbar2).remove();
  }
};
_buttons2 = new WeakMap();
_toolbar2 = new WeakMap();
_uiManager = new WeakMap();
_render = new WeakSet();
render_fn = function() {
  const editToolbar = __privateSet(this, _toolbar2, document.createElement("div"));
  editToolbar.className = "editToolbar";
  editToolbar.setAttribute("role", "toolbar");
  editToolbar.addEventListener("contextmenu", noContextMenu, {
    signal: __privateGet(this, _uiManager)._signal
  });
  const buttons = __privateSet(this, _buttons2, document.createElement("div"));
  buttons.className = "buttons";
  editToolbar.append(buttons);
  __privateMethod(this, _addHighlightButton, addHighlightButton_fn).call(this);
  return editToolbar;
};
_getLastPoint = new WeakSet();
getLastPoint_fn = function(boxes, isLTR) {
  let lastY = 0;
  let lastX = 0;
  for (const box of boxes) {
    const y = box.y + box.height;
    if (y < lastY) {
      continue;
    }
    const x = box.x + (isLTR ? box.width : 0);
    if (y > lastY) {
      lastX = x;
      lastY = y;
      continue;
    }
    if (isLTR) {
      if (x > lastX) {
        lastX = x;
      }
    } else if (x < lastX) {
      lastX = x;
    }
  }
  return [isLTR ? 1 - lastX : lastX, lastY];
};
_addHighlightButton = new WeakSet();
addHighlightButton_fn = function() {
  const button = document.createElement("button");
  button.className = "highlightButton";
  button.tabIndex = 0;
  button.setAttribute("data-l10n-id", `pdfjs-highlight-floating-button1`);
  const span = document.createElement("span");
  button.append(span);
  span.className = "visuallyHidden";
  span.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button-label");
  const signal = __privateGet(this, _uiManager)._signal;
  button.addEventListener("contextmenu", noContextMenu, {
    signal
  });
  button.addEventListener("click", () => {
    __privateGet(this, _uiManager).highlightSelection("floating_button");
  }, {
    signal
  });
  __privateGet(this, _buttons2).append(button);
};
function bindEvents(obj, element2, names) {
  for (const name of names) {
    element2.addEventListener(name, obj[name].bind(obj));
  }
}
function opacityToHex(opacity) {
  return Math.round(Math.min(255, Math.max(1, 255 * opacity))).toString(16).padStart(2, "0");
}
var _id2;
var IdManager = class {
  constructor() {
    __privateAdd(this, _id2, 0);
  }
  get id() {
    return `${AnnotationEditorPrefix}${__privateWrapper(this, _id2)._++}`;
  }
};
_id2 = new WeakMap();
var _baseId, _id3, _cache2, _get, get_fn;
var _ImageManager = class {
  constructor() {
    __privateAdd(this, _get);
    __privateAdd(this, _baseId, getUuid());
    __privateAdd(this, _id3, 0);
    __privateAdd(this, _cache2, null);
  }
  static get _isSVGFittingCanvas() {
    const svg = `data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`;
    const canvas = new OffscreenCanvas(1, 3);
    const ctx = canvas.getContext("2d", {
      willReadFrequently: true
    });
    const image = new Image();
    image.src = svg;
    const promise = image.decode().then(() => {
      ctx.drawImage(image, 0, 0, 1, 1, 0, 0, 1, 3);
      return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
    });
    return shadow(this, "_isSVGFittingCanvas", promise);
  }
  async getFromFile(file) {
    const {
      lastModified,
      name,
      size,
      type
    } = file;
    return __privateMethod(this, _get, get_fn).call(this, `${lastModified}_${name}_${size}_${type}`, file);
  }
  async getFromUrl(url) {
    return __privateMethod(this, _get, get_fn).call(this, url, url);
  }
  async getFromId(id) {
    __privateGet(this, _cache2) || __privateSet(this, _cache2, /* @__PURE__ */ new Map());
    const data = __privateGet(this, _cache2).get(id);
    if (!data) {
      return null;
    }
    if (data.bitmap) {
      data.refCounter += 1;
      return data;
    }
    if (data.file) {
      return this.getFromFile(data.file);
    }
    return this.getFromUrl(data.url);
  }
  getSvgUrl(id) {
    const data = __privateGet(this, _cache2).get(id);
    if (!(data == null ? void 0 : data.isSvg)) {
      return null;
    }
    return data.svgUrl;
  }
  deleteId(id) {
    __privateGet(this, _cache2) || __privateSet(this, _cache2, /* @__PURE__ */ new Map());
    const data = __privateGet(this, _cache2).get(id);
    if (!data) {
      return;
    }
    data.refCounter -= 1;
    if (data.refCounter !== 0) {
      return;
    }
    data.bitmap = null;
  }
  isValidId(id) {
    return id.startsWith(`image_${__privateGet(this, _baseId)}_`);
  }
};
var ImageManager = _ImageManager;
_baseId = new WeakMap();
_id3 = new WeakMap();
_cache2 = new WeakMap();
_get = new WeakSet();
get_fn = async function(key, rawData) {
  __privateGet(this, _cache2) || __privateSet(this, _cache2, /* @__PURE__ */ new Map());
  let data = __privateGet(this, _cache2).get(key);
  if (data === null) {
    return null;
  }
  if (data == null ? void 0 : data.bitmap) {
    data.refCounter += 1;
    return data;
  }
  try {
    data || (data = {
      bitmap: null,
      id: `image_${__privateGet(this, _baseId)}_${__privateWrapper(this, _id3)._++}`,
      refCounter: 0,
      isSvg: false
    });
    let image;
    if (typeof rawData === "string") {
      data.url = rawData;
      image = await fetchData(rawData, "blob");
    } else {
      image = data.file = rawData;
    }
    if (image.type === "image/svg+xml") {
      const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
      const fileReader = new FileReader();
      const imageElement = new Image();
      const imagePromise = new Promise((resolve, reject) => {
        imageElement.onload = () => {
          data.bitmap = imageElement;
          data.isSvg = true;
          resolve();
        };
        fileReader.onload = async () => {
          const url = data.svgUrl = fileReader.result;
          imageElement.src = await mustRemoveAspectRatioPromise ? `${url}#svgView(preserveAspectRatio(none))` : url;
        };
        imageElement.onerror = fileReader.onerror = reject;
      });
      fileReader.readAsDataURL(image);
      await imagePromise;
    } else {
      data.bitmap = await createImageBitmap(image);
    }
    data.refCounter = 1;
  } catch (e) {
    console.error(e);
    data = null;
  }
  __privateGet(this, _cache2).set(key, data);
  if (data) {
    __privateGet(this, _cache2).set(data.id, data);
  }
  return data;
};
var _commands, _locked, _maxSize, _position;
var CommandManager = class {
  constructor(maxSize = 128) {
    __privateAdd(this, _commands, []);
    __privateAdd(this, _locked, false);
    __privateAdd(this, _maxSize, void 0);
    __privateAdd(this, _position, -1);
    __privateSet(this, _maxSize, maxSize);
  }
  add({
    cmd,
    undo,
    post,
    mustExec,
    type = NaN,
    overwriteIfSameType = false,
    keepUndo = false
  }) {
    if (mustExec) {
      cmd();
    }
    if (__privateGet(this, _locked)) {
      return;
    }
    const save2 = {
      cmd,
      undo,
      post,
      type
    };
    if (__privateGet(this, _position) === -1) {
      if (__privateGet(this, _commands).length > 0) {
        __privateGet(this, _commands).length = 0;
      }
      __privateSet(this, _position, 0);
      __privateGet(this, _commands).push(save2);
      return;
    }
    if (overwriteIfSameType && __privateGet(this, _commands)[__privateGet(this, _position)].type === type) {
      if (keepUndo) {
        save2.undo = __privateGet(this, _commands)[__privateGet(this, _position)].undo;
      }
      __privateGet(this, _commands)[__privateGet(this, _position)] = save2;
      return;
    }
    const next = __privateGet(this, _position) + 1;
    if (next === __privateGet(this, _maxSize)) {
      __privateGet(this, _commands).splice(0, 1);
    } else {
      __privateSet(this, _position, next);
      if (next < __privateGet(this, _commands).length) {
        __privateGet(this, _commands).splice(next);
      }
    }
    __privateGet(this, _commands).push(save2);
  }
  undo() {
    if (__privateGet(this, _position) === -1) {
      return;
    }
    __privateSet(this, _locked, true);
    const {
      undo,
      post
    } = __privateGet(this, _commands)[__privateGet(this, _position)];
    undo();
    post == null ? void 0 : post();
    __privateSet(this, _locked, false);
    __privateSet(this, _position, __privateGet(this, _position) - 1);
  }
  redo() {
    if (__privateGet(this, _position) < __privateGet(this, _commands).length - 1) {
      __privateSet(this, _position, __privateGet(this, _position) + 1);
      __privateSet(this, _locked, true);
      const {
        cmd,
        post
      } = __privateGet(this, _commands)[__privateGet(this, _position)];
      cmd();
      post == null ? void 0 : post();
      __privateSet(this, _locked, false);
    }
  }
  hasSomethingToUndo() {
    return __privateGet(this, _position) !== -1;
  }
  hasSomethingToRedo() {
    return __privateGet(this, _position) < __privateGet(this, _commands).length - 1;
  }
  destroy() {
    __privateSet(this, _commands, null);
  }
};
_commands = new WeakMap();
_locked = new WeakMap();
_maxSize = new WeakMap();
_position = new WeakMap();
var _serialize, serialize_fn;
var KeyboardManager = class {
  constructor(callbacks) {
    __privateAdd(this, _serialize);
    this.buffer = [];
    this.callbacks = /* @__PURE__ */ new Map();
    this.allKeys = /* @__PURE__ */ new Set();
    const {
      isMac
    } = util_FeatureTest.platform;
    for (const [keys, callback, options = {}] of callbacks) {
      for (const key of keys) {
        const isMacKey = key.startsWith("mac+");
        if (isMac && isMacKey) {
          this.callbacks.set(key.slice(4), {
            callback,
            options
          });
          this.allKeys.add(key.split("+").at(-1));
        } else if (!isMac && !isMacKey) {
          this.callbacks.set(key, {
            callback,
            options
          });
          this.allKeys.add(key.split("+").at(-1));
        }
      }
    }
  }
  exec(self, event) {
    if (!this.allKeys.has(event.key)) {
      return;
    }
    const info2 = this.callbacks.get(__privateMethod(this, _serialize, serialize_fn).call(this, event));
    if (!info2) {
      return;
    }
    const {
      callback,
      options: {
        bubbles = false,
        args = [],
        checker = null
      }
    } = info2;
    if (checker && !checker(self, event)) {
      return;
    }
    callback.bind(self, ...args, event)();
    if (!bubbles) {
      event.stopPropagation();
      event.preventDefault();
    }
  }
};
_serialize = new WeakSet();
serialize_fn = function(event) {
  if (event.altKey) {
    this.buffer.push("alt");
  }
  if (event.ctrlKey) {
    this.buffer.push("ctrl");
  }
  if (event.metaKey) {
    this.buffer.push("meta");
  }
  if (event.shiftKey) {
    this.buffer.push("shift");
  }
  this.buffer.push(event.key);
  const str = this.buffer.join("+");
  this.buffer.length = 0;
  return str;
};
var _ColorManager = class {
  get _colors() {
    const colors = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]);
    getColorValues(colors);
    return shadow(this, "_colors", colors);
  }
  convert(color) {
    const rgb = getRGB(color);
    if (!window.matchMedia("(forced-colors: active)").matches) {
      return rgb;
    }
    for (const [name, RGB] of this._colors) {
      if (RGB.every((x, i) => x === rgb[i])) {
        return _ColorManager._colorsMapping.get(name);
      }
    }
    return rgb;
  }
  getHexCode(name) {
    const rgb = this._colors.get(name);
    if (!rgb) {
      return name;
    }
    return Util.makeHexColor(...rgb);
  }
};
var ColorManager = _ColorManager;
__publicField(ColorManager, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]));
var _abortController, _activeEditor, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _copyPasteAC, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _highlightToolbar, _idManager, _isEnabled, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _mlManager, _mode, _selectedEditors, _selectedTextNode, _pageColors, _showAllStates, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _getAnchorElementForSelection, getAnchorElementForSelection_fn, _getLayerForTextLayer, getLayerForTextLayer_fn, _displayHighlightToolbar, displayHighlightToolbar_fn, _selectionChange, selectionChange_fn, _onSelectEnd, onSelectEnd_fn, _addSelectionListener, addSelectionListener_fn, _addFocusManager, addFocusManager_fn, _removeFocusManager, removeFocusManager_fn, _addKeyboardManager, addKeyboardManager_fn, _removeKeyboardManager, removeKeyboardManager_fn, _addCopyPasteListeners, addCopyPasteListeners_fn, _removeCopyPasteListeners, removeCopyPasteListeners_fn, _addDragAndDropListeners, addDragAndDropListeners_fn, _dispatchUpdateStates, dispatchUpdateStates_fn, _dispatchUpdateUI, dispatchUpdateUI_fn, _enableAll, enableAll_fn, _disableAll, disableAll_fn, _addEditorToLayer, addEditorToLayer_fn, _lastSelectedEditor, lastSelectedEditor_get, _isEmpty, isEmpty_fn, _selectEditors, selectEditors_fn;
var _AnnotationEditorUIManager = class {
  constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors, highlightColors, enableHighlightFloatingButton, enableUpdatedAddImage, enableNewAltTextWhenAddingImage, mlManager) {
    __privateAdd(this, _getAnchorElementForSelection);
    __privateAdd(this, _getLayerForTextLayer);
    __privateAdd(this, _displayHighlightToolbar);
    __privateAdd(this, _selectionChange);
    __privateAdd(this, _onSelectEnd);
    __privateAdd(this, _addSelectionListener);
    __privateAdd(this, _addFocusManager);
    __privateAdd(this, _removeFocusManager);
    __privateAdd(this, _addKeyboardManager);
    __privateAdd(this, _removeKeyboardManager);
    __privateAdd(this, _addCopyPasteListeners);
    __privateAdd(this, _removeCopyPasteListeners);
    __privateAdd(this, _addDragAndDropListeners);
    __privateAdd(this, _dispatchUpdateStates);
    __privateAdd(this, _dispatchUpdateUI);
    __privateAdd(this, _enableAll);
    __privateAdd(this, _disableAll);
    __privateAdd(this, _addEditorToLayer);
    __privateAdd(this, _lastSelectedEditor);
    __privateAdd(this, _isEmpty);
    __privateAdd(this, _selectEditors);
    __privateAdd(this, _abortController, new AbortController());
    __privateAdd(this, _activeEditor, null);
    __privateAdd(this, _allEditors, /* @__PURE__ */ new Map());
    __privateAdd(this, _allLayers, /* @__PURE__ */ new Map());
    __privateAdd(this, _altTextManager, null);
    __privateAdd(this, _annotationStorage, null);
    __privateAdd(this, _changedExistingAnnotations, null);
    __privateAdd(this, _commandManager, new CommandManager());
    __privateAdd(this, _copyPasteAC, null);
    __privateAdd(this, _currentPageIndex, 0);
    __privateAdd(this, _deletedAnnotationsElementIds, /* @__PURE__ */ new Set());
    __privateAdd(this, _draggingEditors, null);
    __privateAdd(this, _editorTypes, null);
    __privateAdd(this, _editorsToRescale, /* @__PURE__ */ new Set());
    __privateAdd(this, _enableHighlightFloatingButton, false);
    __privateAdd(this, _enableUpdatedAddImage, false);
    __privateAdd(this, _enableNewAltTextWhenAddingImage, false);
    __privateAdd(this, _filterFactory, null);
    __privateAdd(this, _focusMainContainerTimeoutId, null);
    __privateAdd(this, _focusManagerAC, null);
    __privateAdd(this, _highlightColors, null);
    __privateAdd(this, _highlightWhenShiftUp, false);
    __privateAdd(this, _highlightToolbar, null);
    __privateAdd(this, _idManager, new IdManager());
    __privateAdd(this, _isEnabled, false);
    __privateAdd(this, _isWaiting, false);
    __privateAdd(this, _keyboardManagerAC, null);
    __privateAdd(this, _lastActiveElement, null);
    __privateAdd(this, _mainHighlightColorPicker, null);
    __privateAdd(this, _mlManager, null);
    __privateAdd(this, _mode, AnnotationEditorType.NONE);
    __privateAdd(this, _selectedEditors, /* @__PURE__ */ new Set());
    __privateAdd(this, _selectedTextNode, null);
    __privateAdd(this, _pageColors, null);
    __privateAdd(this, _showAllStates, null);
    __privateAdd(this, _previousStates, {
      isEditing: false,
      isEmpty: true,
      hasSomethingToUndo: false,
      hasSomethingToRedo: false,
      hasSelectedEditor: false,
      hasSelectedText: false
    });
    __privateAdd(this, _translation, [0, 0]);
    __privateAdd(this, _translationTimeoutId, null);
    __privateAdd(this, _container, null);
    __privateAdd(this, _viewer, null);
    const signal = this._signal = __privateGet(this, _abortController).signal;
    __privateSet(this, _container, container);
    __privateSet(this, _viewer, viewer);
    __privateSet(this, _altTextManager, altTextManager);
    this._eventBus = eventBus;
    eventBus._on("editingaction", this.onEditingAction.bind(this), {
      signal
    });
    eventBus._on("pagechanging", this.onPageChanging.bind(this), {
      signal
    });
    eventBus._on("scalechanging", this.onScaleChanging.bind(this), {
      signal
    });
    eventBus._on("rotationchanging", this.onRotationChanging.bind(this), {
      signal
    });
    eventBus._on("setpreference", this.onSetPreference.bind(this), {
      signal
    });
    eventBus._on("switchannotationeditorparams", (evt) => this.updateParams(evt.type, evt.value), {
      signal
    });
    __privateMethod(this, _addSelectionListener, addSelectionListener_fn).call(this);
    __privateMethod(this, _addDragAndDropListeners, addDragAndDropListeners_fn).call(this);
    __privateMethod(this, _addKeyboardManager, addKeyboardManager_fn).call(this);
    __privateSet(this, _annotationStorage, pdfDocument.annotationStorage);
    __privateSet(this, _filterFactory, pdfDocument.filterFactory);
    __privateSet(this, _pageColors, pageColors);
    __privateSet(this, _highlightColors, highlightColors || null);
    __privateSet(this, _enableHighlightFloatingButton, enableHighlightFloatingButton);
    __privateSet(this, _enableUpdatedAddImage, enableUpdatedAddImage);
    __privateSet(this, _enableNewAltTextWhenAddingImage, enableNewAltTextWhenAddingImage);
    __privateSet(this, _mlManager, mlManager || null);
    this.viewParameters = {
      realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
      rotation: 0
    };
    this.isShiftKeyDown = false;
  }
  static get _keyboardManager() {
    const proto = _AnnotationEditorUIManager.prototype;
    const arrowChecker = (self) => __privateGet(self, _container).contains(document.activeElement) && document.activeElement.tagName !== "BUTTON" && self.hasSomethingToControl();
    const textInputChecker = (_self, {
      target: el
    }) => {
      if (el instanceof HTMLInputElement) {
        const {
          type
        } = el;
        return type !== "text" && type !== "number";
      }
      return true;
    };
    const small = this.TRANSLATE_SMALL;
    const big = this.TRANSLATE_BIG;
    return shadow(this, "_keyboardManager", new KeyboardManager([[["ctrl+a", "mac+meta+a"], proto.selectAll, {
      checker: textInputChecker
    }], [["ctrl+z", "mac+meta+z"], proto.undo, {
      checker: textInputChecker
    }], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], proto.redo, {
      checker: textInputChecker
    }], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], proto.delete, {
      checker: textInputChecker
    }], [["Enter", "mac+Enter"], proto.addNewEditorFromKeyboard, {
      checker: (self, {
        target: el
      }) => !(el instanceof HTMLButtonElement) && __privateGet(self, _container).contains(el) && !self.isEnterHandled
    }], [[" ", "mac+ "], proto.addNewEditorFromKeyboard, {
      checker: (self, {
        target: el
      }) => !(el instanceof HTMLButtonElement) && __privateGet(self, _container).contains(document.activeElement)
    }], [["Escape", "mac+Escape"], proto.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], proto.translateSelectedEditors, {
      args: [-small, 0],
      checker: arrowChecker
    }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto.translateSelectedEditors, {
      args: [-big, 0],
      checker: arrowChecker
    }], [["ArrowRight", "mac+ArrowRight"], proto.translateSelectedEditors, {
      args: [small, 0],
      checker: arrowChecker
    }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto.translateSelectedEditors, {
      args: [big, 0],
      checker: arrowChecker
    }], [["ArrowUp", "mac+ArrowUp"], proto.translateSelectedEditors, {
      args: [0, -small],
      checker: arrowChecker
    }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto.translateSelectedEditors, {
      args: [0, -big],
      checker: arrowChecker
    }], [["ArrowDown", "mac+ArrowDown"], proto.translateSelectedEditors, {
      args: [0, small],
      checker: arrowChecker
    }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto.translateSelectedEditors, {
      args: [0, big],
      checker: arrowChecker
    }]]));
  }
  destroy() {
    var _a2, _b, _c;
    (_a2 = __privateGet(this, _abortController)) == null ? void 0 : _a2.abort();
    __privateSet(this, _abortController, null);
    this._signal = null;
    for (const layer of __privateGet(this, _allLayers).values()) {
      layer.destroy();
    }
    __privateGet(this, _allLayers).clear();
    __privateGet(this, _allEditors).clear();
    __privateGet(this, _editorsToRescale).clear();
    __privateSet(this, _activeEditor, null);
    __privateGet(this, _selectedEditors).clear();
    __privateGet(this, _commandManager).destroy();
    (_b = __privateGet(this, _altTextManager)) == null ? void 0 : _b.destroy();
    (_c = __privateGet(this, _highlightToolbar)) == null ? void 0 : _c.hide();
    __privateSet(this, _highlightToolbar, null);
    if (__privateGet(this, _focusMainContainerTimeoutId)) {
      clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
      __privateSet(this, _focusMainContainerTimeoutId, null);
    }
    if (__privateGet(this, _translationTimeoutId)) {
      clearTimeout(__privateGet(this, _translationTimeoutId));
      __privateSet(this, _translationTimeoutId, null);
    }
  }
  combinedSignal(ac) {
    return AbortSignal.any([this._signal, ac.signal]);
  }
  get mlManager() {
    return __privateGet(this, _mlManager);
  }
  get useNewAltTextFlow() {
    return __privateGet(this, _enableUpdatedAddImage);
  }
  get useNewAltTextWhenAddingImage() {
    return __privateGet(this, _enableNewAltTextWhenAddingImage);
  }
  get hcmFilter() {
    return shadow(this, "hcmFilter", __privateGet(this, _pageColors) ? __privateGet(this, _filterFactory).addHCMFilter(__privateGet(this, _pageColors).foreground, __privateGet(this, _pageColors).background) : "none");
  }
  get direction() {
    return shadow(this, "direction", getComputedStyle(__privateGet(this, _container)).direction);
  }
  get highlightColors() {
    return shadow(this, "highlightColors", __privateGet(this, _highlightColors) ? new Map(__privateGet(this, _highlightColors).split(",").map((pair) => pair.split("=").map((x) => x.trim()))) : null);
  }
  get highlightColorNames() {
    return shadow(this, "highlightColorNames", this.highlightColors ? new Map(Array.from(this.highlightColors, (e) => e.reverse())) : null);
  }
  setMainHighlightColorPicker(colorPicker) {
    __privateSet(this, _mainHighlightColorPicker, colorPicker);
  }
  editAltText(editor, firstTime = false) {
    var _a2;
    (_a2 = __privateGet(this, _altTextManager)) == null ? void 0 : _a2.editAltText(this, editor, firstTime);
  }
  switchToMode(mode, callback) {
    this._eventBus.on("annotationeditormodechanged", callback, {
      once: true,
      signal: this._signal
    });
    this._eventBus.dispatch("showannotationeditorui", {
      source: this,
      mode
    });
  }
  setPreference(name, value) {
    this._eventBus.dispatch("setpreference", {
      source: this,
      name,
      value
    });
  }
  onSetPreference({
    name,
    value
  }) {
    switch (name) {
      case "enableNewAltTextWhenAddingImage":
        __privateSet(this, _enableNewAltTextWhenAddingImage, value);
        break;
    }
  }
  onPageChanging({
    pageNumber
  }) {
    __privateSet(this, _currentPageIndex, pageNumber - 1);
  }
  focusMainContainer() {
    __privateGet(this, _container).focus();
  }
  findParent(x, y) {
    for (const layer of __privateGet(this, _allLayers).values()) {
      const {
        x: layerX,
        y: layerY,
        width,
        height
      } = layer.div.getBoundingClientRect();
      if (x >= layerX && x <= layerX + width && y >= layerY && y <= layerY + height) {
        return layer;
      }
    }
    return null;
  }
  disableUserSelect(value = false) {
    __privateGet(this, _viewer).classList.toggle("noUserSelect", value);
  }
  addShouldRescale(editor) {
    __privateGet(this, _editorsToRescale).add(editor);
  }
  removeShouldRescale(editor) {
    __privateGet(this, _editorsToRescale).delete(editor);
  }
  onScaleChanging({
    scale
  }) {
    this.commitOrRemove();
    this.viewParameters.realScale = scale * PixelsPerInch.PDF_TO_CSS_UNITS;
    for (const editor of __privateGet(this, _editorsToRescale)) {
      editor.onScaleChanging();
    }
  }
  onRotationChanging({
    pagesRotation
  }) {
    this.commitOrRemove();
    this.viewParameters.rotation = pagesRotation;
  }
  highlightSelection(methodOfCreation = "") {
    const selection = document.getSelection();
    if (!selection || selection.isCollapsed) {
      return;
    }
    const {
      anchorNode,
      anchorOffset,
      focusNode,
      focusOffset
    } = selection;
    const text2 = selection.toString();
    const anchorElement = __privateMethod(this, _getAnchorElementForSelection, getAnchorElementForSelection_fn).call(this, selection);
    const textLayer = anchorElement.closest(".textLayer");
    const boxes = this.getSelectionBoxes(textLayer);
    if (!boxes) {
      return;
    }
    selection.empty();
    const layer = __privateMethod(this, _getLayerForTextLayer, getLayerForTextLayer_fn).call(this, textLayer);
    const isNoneMode = __privateGet(this, _mode) === AnnotationEditorType.NONE;
    const callback = () => {
      layer == null ? void 0 : layer.createAndAddNewEditor({
        x: 0,
        y: 0
      }, false, {
        methodOfCreation,
        boxes,
        anchorNode,
        anchorOffset,
        focusNode,
        focusOffset,
        text: text2
      });
      if (isNoneMode) {
        this.showAllEditors("highlight", true, true);
      }
    };
    if (isNoneMode) {
      this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);
      return;
    }
    callback();
  }
  addToAnnotationStorage(editor) {
    if (!editor.isEmpty() && __privateGet(this, _annotationStorage) && !__privateGet(this, _annotationStorage).has(editor.id)) {
      __privateGet(this, _annotationStorage).setValue(editor.id, editor);
    }
  }
  blur() {
    this.isShiftKeyDown = false;
    if (__privateGet(this, _highlightWhenShiftUp)) {
      __privateSet(this, _highlightWhenShiftUp, false);
      __privateMethod(this, _onSelectEnd, onSelectEnd_fn).call(this, "main_toolbar");
    }
    if (!this.hasSelection) {
      return;
    }
    const {
      activeElement
    } = document;
    for (const editor of __privateGet(this, _selectedEditors)) {
      if (editor.div.contains(activeElement)) {
        __privateSet(this, _lastActiveElement, [editor, activeElement]);
        editor._focusEventsAllowed = false;
        break;
      }
    }
  }
  focus() {
    if (!__privateGet(this, _lastActiveElement)) {
      return;
    }
    const [lastEditor, lastActiveElement] = __privateGet(this, _lastActiveElement);
    __privateSet(this, _lastActiveElement, null);
    lastActiveElement.addEventListener("focusin", () => {
      lastEditor._focusEventsAllowed = true;
    }, {
      once: true,
      signal: this._signal
    });
    lastActiveElement.focus();
  }
  addEditListeners() {
    __privateMethod(this, _addKeyboardManager, addKeyboardManager_fn).call(this);
    __privateMethod(this, _addCopyPasteListeners, addCopyPasteListeners_fn).call(this);
  }
  removeEditListeners() {
    __privateMethod(this, _removeKeyboardManager, removeKeyboardManager_fn).call(this);
    __privateMethod(this, _removeCopyPasteListeners, removeCopyPasteListeners_fn).call(this);
  }
  dragOver(event) {
    for (const {
      type
    } of event.dataTransfer.items) {
      for (const editorType of __privateGet(this, _editorTypes)) {
        if (editorType.isHandlingMimeForPasting(type)) {
          event.dataTransfer.dropEffect = "copy";
          event.preventDefault();
          return;
        }
      }
    }
  }
  drop(event) {
    for (const item of event.dataTransfer.items) {
      for (const editorType of __privateGet(this, _editorTypes)) {
        if (editorType.isHandlingMimeForPasting(item.type)) {
          editorType.paste(item, this.currentLayer);
          event.preventDefault();
          return;
        }
      }
    }
  }
  copy(event) {
    var _a2;
    event.preventDefault();
    (_a2 = __privateGet(this, _activeEditor)) == null ? void 0 : _a2.commitOrRemove();
    if (!this.hasSelection) {
      return;
    }
    const editors = [];
    for (const editor of __privateGet(this, _selectedEditors)) {
      const serialized = editor.serialize(true);
      if (serialized) {
        editors.push(serialized);
      }
    }
    if (editors.length === 0) {
      return;
    }
    event.clipboardData.setData("application/pdfjs", JSON.stringify(editors));
  }
  cut(event) {
    this.copy(event);
    this.delete();
  }
  paste(event) {
    event.preventDefault();
    const {
      clipboardData
    } = event;
    for (const item of clipboardData.items) {
      for (const editorType of __privateGet(this, _editorTypes)) {
        if (editorType.isHandlingMimeForPasting(item.type)) {
          editorType.paste(item, this.currentLayer);
          return;
        }
      }
    }
    let data = clipboardData.getData("application/pdfjs");
    if (!data) {
      return;
    }
    try {
      data = JSON.parse(data);
    } catch (ex) {
      warn(`paste: "${ex.message}".`);
      return;
    }
    if (!Array.isArray(data)) {
      return;
    }
    this.unselectAll();
    const layer = this.currentLayer;
    try {
      const newEditors = [];
      for (const editor of data) {
        const deserializedEditor = layer.deserialize(editor);
        if (!deserializedEditor) {
          return;
        }
        newEditors.push(deserializedEditor);
      }
      const cmd = () => {
        for (const editor of newEditors) {
          __privateMethod(this, _addEditorToLayer, addEditorToLayer_fn).call(this, editor);
        }
        __privateMethod(this, _selectEditors, selectEditors_fn).call(this, newEditors);
      };
      const undo = () => {
        for (const editor of newEditors) {
          editor.remove();
        }
      };
      this.addCommands({
        cmd,
        undo,
        mustExec: true
      });
    } catch (ex) {
      warn(`paste: "${ex.message}".`);
    }
  }
  keydown(event) {
    if (!this.isShiftKeyDown && event.key === "Shift") {
      this.isShiftKeyDown = true;
    }
    if (__privateGet(this, _mode) !== AnnotationEditorType.NONE && !this.isEditorHandlingKeyboard) {
      _AnnotationEditorUIManager._keyboardManager.exec(this, event);
    }
  }
  keyup(event) {
    if (this.isShiftKeyDown && event.key === "Shift") {
      this.isShiftKeyDown = false;
      if (__privateGet(this, _highlightWhenShiftUp)) {
        __privateSet(this, _highlightWhenShiftUp, false);
        __privateMethod(this, _onSelectEnd, onSelectEnd_fn).call(this, "main_toolbar");
      }
    }
  }
  onEditingAction({
    name
  }) {
    switch (name) {
      case "undo":
      case "redo":
      case "delete":
      case "selectAll":
        this[name]();
        break;
      case "highlightSelection":
        this.highlightSelection("context_menu");
        break;
    }
  }
  setEditingState(isEditing) {
    if (isEditing) {
      __privateMethod(this, _addFocusManager, addFocusManager_fn).call(this);
      __privateMethod(this, _addCopyPasteListeners, addCopyPasteListeners_fn).call(this);
      __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
        isEditing: __privateGet(this, _mode) !== AnnotationEditorType.NONE,
        isEmpty: __privateMethod(this, _isEmpty, isEmpty_fn).call(this),
        hasSomethingToUndo: __privateGet(this, _commandManager).hasSomethingToUndo(),
        hasSomethingToRedo: __privateGet(this, _commandManager).hasSomethingToRedo(),
        hasSelectedEditor: false
      });
    } else {
      __privateMethod(this, _removeFocusManager, removeFocusManager_fn).call(this);
      __privateMethod(this, _removeCopyPasteListeners, removeCopyPasteListeners_fn).call(this);
      __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
        isEditing: false
      });
      this.disableUserSelect(false);
    }
  }
  registerEditorTypes(types) {
    if (__privateGet(this, _editorTypes)) {
      return;
    }
    __privateSet(this, _editorTypes, types);
    for (const editorType of __privateGet(this, _editorTypes)) {
      __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, editorType.defaultPropertiesToUpdate);
    }
  }
  getId() {
    return __privateGet(this, _idManager).id;
  }
  get currentLayer() {
    return __privateGet(this, _allLayers).get(__privateGet(this, _currentPageIndex));
  }
  getLayer(pageIndex) {
    return __privateGet(this, _allLayers).get(pageIndex);
  }
  get currentPageIndex() {
    return __privateGet(this, _currentPageIndex);
  }
  addLayer(layer) {
    __privateGet(this, _allLayers).set(layer.pageIndex, layer);
    if (__privateGet(this, _isEnabled)) {
      layer.enable();
    } else {
      layer.disable();
    }
  }
  removeLayer(layer) {
    __privateGet(this, _allLayers).delete(layer.pageIndex);
  }
  updateMode(mode, editId = null, isFromKeyboard = false) {
    if (__privateGet(this, _mode) === mode) {
      return;
    }
    __privateSet(this, _mode, mode);
    if (mode === AnnotationEditorType.NONE) {
      this.setEditingState(false);
      __privateMethod(this, _disableAll, disableAll_fn).call(this);
      return;
    }
    this.setEditingState(true);
    __privateMethod(this, _enableAll, enableAll_fn).call(this);
    this.unselectAll();
    for (const layer of __privateGet(this, _allLayers).values()) {
      layer.updateMode(mode);
    }
    if (!editId && isFromKeyboard) {
      this.addNewEditorFromKeyboard();
      return;
    }
    if (!editId) {
      return;
    }
    for (const editor of __privateGet(this, _allEditors).values()) {
      if (editor.annotationElementId === editId) {
        this.setSelected(editor);
        editor.enterInEditMode();
        break;
      }
    }
  }
  addNewEditorFromKeyboard() {
    if (this.currentLayer.canCreateNewEmptyEditor()) {
      this.currentLayer.addNewEditor();
    }
  }
  updateToolbar(mode) {
    if (mode === __privateGet(this, _mode)) {
      return;
    }
    this._eventBus.dispatch("switchannotationeditormode", {
      source: this,
      mode
    });
  }
  updateParams(type, value) {
    var _a2;
    if (!__privateGet(this, _editorTypes)) {
      return;
    }
    switch (type) {
      case AnnotationEditorParamsType.CREATE:
        this.currentLayer.addNewEditor();
        return;
      case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
        (_a2 = __privateGet(this, _mainHighlightColorPicker)) == null ? void 0 : _a2.updateColor(value);
        break;
      case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
        this._eventBus.dispatch("reporttelemetry", {
          source: this,
          details: {
            type: "editing",
            data: {
              type: "highlight",
              action: "toggle_visibility"
            }
          }
        });
        (__privateGet(this, _showAllStates) || __privateSet(this, _showAllStates, /* @__PURE__ */ new Map())).set(type, value);
        this.showAllEditors("highlight", value);
        break;
    }
    for (const editor of __privateGet(this, _selectedEditors)) {
      editor.updateParams(type, value);
    }
    for (const editorType of __privateGet(this, _editorTypes)) {
      editorType.updateDefaultParams(type, value);
    }
  }
  showAllEditors(type, visible, updateButton = false) {
    var _a2, _b;
    for (const editor of __privateGet(this, _allEditors).values()) {
      if (editor.editorType === type) {
        editor.show(visible);
      }
    }
    const state = (_b = (_a2 = __privateGet(this, _showAllStates)) == null ? void 0 : _a2.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)) != null ? _b : true;
    if (state !== visible) {
      __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, [[AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL, visible]]);
    }
  }
  enableWaiting(mustWait = false) {
    if (__privateGet(this, _isWaiting) === mustWait) {
      return;
    }
    __privateSet(this, _isWaiting, mustWait);
    for (const layer of __privateGet(this, _allLayers).values()) {
      if (mustWait) {
        layer.disableClick();
      } else {
        layer.enableClick();
      }
      layer.div.classList.toggle("waiting", mustWait);
    }
  }
  getEditors(pageIndex) {
    const editors = [];
    for (const editor of __privateGet(this, _allEditors).values()) {
      if (editor.pageIndex === pageIndex) {
        editors.push(editor);
      }
    }
    return editors;
  }
  getEditor(id) {
    return __privateGet(this, _allEditors).get(id);
  }
  addEditor(editor) {
    __privateGet(this, _allEditors).set(editor.id, editor);
  }
  removeEditor(editor) {
    var _a2;
    if (editor.div.contains(document.activeElement)) {
      if (__privateGet(this, _focusMainContainerTimeoutId)) {
        clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
      }
      __privateSet(this, _focusMainContainerTimeoutId, setTimeout(() => {
        this.focusMainContainer();
        __privateSet(this, _focusMainContainerTimeoutId, null);
      }, 0));
    }
    __privateGet(this, _allEditors).delete(editor.id);
    this.unselect(editor);
    if (!editor.annotationElementId || !__privateGet(this, _deletedAnnotationsElementIds).has(editor.annotationElementId)) {
      (_a2 = __privateGet(this, _annotationStorage)) == null ? void 0 : _a2.remove(editor.id);
    }
  }
  addDeletedAnnotationElement(editor) {
    __privateGet(this, _deletedAnnotationsElementIds).add(editor.annotationElementId);
    this.addChangedExistingAnnotation(editor);
    editor.deleted = true;
  }
  isDeletedAnnotationElement(annotationElementId) {
    return __privateGet(this, _deletedAnnotationsElementIds).has(annotationElementId);
  }
  removeDeletedAnnotationElement(editor) {
    __privateGet(this, _deletedAnnotationsElementIds).delete(editor.annotationElementId);
    this.removeChangedExistingAnnotation(editor);
    editor.deleted = false;
  }
  setActiveEditor(editor) {
    if (__privateGet(this, _activeEditor) === editor) {
      return;
    }
    __privateSet(this, _activeEditor, editor);
    if (editor) {
      __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
    }
  }
  updateUI(editor) {
    if (__privateGet(this, _lastSelectedEditor, lastSelectedEditor_get) === editor) {
      __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
    }
  }
  toggleSelected(editor) {
    if (__privateGet(this, _selectedEditors).has(editor)) {
      __privateGet(this, _selectedEditors).delete(editor);
      editor.unselect();
      __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
        hasSelectedEditor: this.hasSelection
      });
      return;
    }
    __privateGet(this, _selectedEditors).add(editor);
    editor.select();
    __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSelectedEditor: true
    });
  }
  setSelected(editor) {
    for (const ed of __privateGet(this, _selectedEditors)) {
      if (ed !== editor) {
        ed.unselect();
      }
    }
    __privateGet(this, _selectedEditors).clear();
    __privateGet(this, _selectedEditors).add(editor);
    editor.select();
    __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, editor.propertiesToUpdate);
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSelectedEditor: true
    });
  }
  isSelected(editor) {
    return __privateGet(this, _selectedEditors).has(editor);
  }
  get firstSelectedEditor() {
    return __privateGet(this, _selectedEditors).values().next().value;
  }
  unselect(editor) {
    editor.unselect();
    __privateGet(this, _selectedEditors).delete(editor);
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSelectedEditor: this.hasSelection
    });
  }
  get hasSelection() {
    return __privateGet(this, _selectedEditors).size !== 0;
  }
  get isEnterHandled() {
    return __privateGet(this, _selectedEditors).size === 1 && this.firstSelectedEditor.isEnterHandled;
  }
  undo() {
    __privateGet(this, _commandManager).undo();
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSomethingToUndo: __privateGet(this, _commandManager).hasSomethingToUndo(),
      hasSomethingToRedo: true,
      isEmpty: __privateMethod(this, _isEmpty, isEmpty_fn).call(this)
    });
  }
  redo() {
    __privateGet(this, _commandManager).redo();
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSomethingToUndo: true,
      hasSomethingToRedo: __privateGet(this, _commandManager).hasSomethingToRedo(),
      isEmpty: __privateMethod(this, _isEmpty, isEmpty_fn).call(this)
    });
  }
  addCommands(params) {
    __privateGet(this, _commandManager).add(params);
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSomethingToUndo: true,
      hasSomethingToRedo: false,
      isEmpty: __privateMethod(this, _isEmpty, isEmpty_fn).call(this)
    });
  }
  delete() {
    this.commitOrRemove();
    if (!this.hasSelection) {
      return;
    }
    const editors = [...__privateGet(this, _selectedEditors)];
    const cmd = () => {
      for (const editor of editors) {
        editor.remove();
      }
    };
    const undo = () => {
      for (const editor of editors) {
        __privateMethod(this, _addEditorToLayer, addEditorToLayer_fn).call(this, editor);
      }
    };
    this.addCommands({
      cmd,
      undo,
      mustExec: true
    });
  }
  commitOrRemove() {
    var _a2;
    (_a2 = __privateGet(this, _activeEditor)) == null ? void 0 : _a2.commitOrRemove();
  }
  hasSomethingToControl() {
    return __privateGet(this, _activeEditor) || this.hasSelection;
  }
  selectAll() {
    for (const editor of __privateGet(this, _selectedEditors)) {
      editor.commit();
    }
    __privateMethod(this, _selectEditors, selectEditors_fn).call(this, __privateGet(this, _allEditors).values());
  }
  unselectAll() {
    if (__privateGet(this, _activeEditor)) {
      __privateGet(this, _activeEditor).commitOrRemove();
      if (__privateGet(this, _mode) !== AnnotationEditorType.NONE) {
        return;
      }
    }
    if (!this.hasSelection) {
      return;
    }
    for (const editor of __privateGet(this, _selectedEditors)) {
      editor.unselect();
    }
    __privateGet(this, _selectedEditors).clear();
    __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
      hasSelectedEditor: false
    });
  }
  translateSelectedEditors(x, y, noCommit = false) {
    if (!noCommit) {
      this.commitOrRemove();
    }
    if (!this.hasSelection) {
      return;
    }
    __privateGet(this, _translation)[0] += x;
    __privateGet(this, _translation)[1] += y;
    const [totalX, totalY] = __privateGet(this, _translation);
    const editors = [...__privateGet(this, _selectedEditors)];
    const TIME_TO_WAIT = 1e3;
    if (__privateGet(this, _translationTimeoutId)) {
      clearTimeout(__privateGet(this, _translationTimeoutId));
    }
    __privateSet(this, _translationTimeoutId, setTimeout(() => {
      __privateSet(this, _translationTimeoutId, null);
      __privateGet(this, _translation)[0] = __privateGet(this, _translation)[1] = 0;
      this.addCommands({
        cmd: () => {
          for (const editor of editors) {
            if (__privateGet(this, _allEditors).has(editor.id)) {
              editor.translateInPage(totalX, totalY);
            }
          }
        },
        undo: () => {
          for (const editor of editors) {
            if (__privateGet(this, _allEditors).has(editor.id)) {
              editor.translateInPage(-totalX, -totalY);
            }
          }
        },
        mustExec: false
      });
    }, TIME_TO_WAIT));
    for (const editor of editors) {
      editor.translateInPage(x, y);
    }
  }
  setUpDragSession() {
    if (!this.hasSelection) {
      return;
    }
    this.disableUserSelect(true);
    __privateSet(this, _draggingEditors, /* @__PURE__ */ new Map());
    for (const editor of __privateGet(this, _selectedEditors)) {
      __privateGet(this, _draggingEditors).set(editor, {
        savedX: editor.x,
        savedY: editor.y,
        savedPageIndex: editor.pageIndex,
        newX: 0,
        newY: 0,
        newPageIndex: -1
      });
    }
  }
  endDragSession() {
    if (!__privateGet(this, _draggingEditors)) {
      return false;
    }
    this.disableUserSelect(false);
    const map = __privateGet(this, _draggingEditors);
    __privateSet(this, _draggingEditors, null);
    let mustBeAddedInUndoStack = false;
    for (const [{
      x,
      y,
      pageIndex
    }, value] of map) {
      value.newX = x;
      value.newY = y;
      value.newPageIndex = pageIndex;
      mustBeAddedInUndoStack || (mustBeAddedInUndoStack = x !== value.savedX || y !== value.savedY || pageIndex !== value.savedPageIndex);
    }
    if (!mustBeAddedInUndoStack) {
      return false;
    }
    const move = (editor, x, y, pageIndex) => {
      if (__privateGet(this, _allEditors).has(editor.id)) {
        const parent = __privateGet(this, _allLayers).get(pageIndex);
        if (parent) {
          editor._setParentAndPosition(parent, x, y);
        } else {
          editor.pageIndex = pageIndex;
          editor.x = x;
          editor.y = y;
        }
      }
    };
    this.addCommands({
      cmd: () => {
        for (const [editor, {
          newX,
          newY,
          newPageIndex
        }] of map) {
          move(editor, newX, newY, newPageIndex);
        }
      },
      undo: () => {
        for (const [editor, {
          savedX,
          savedY,
          savedPageIndex
        }] of map) {
          move(editor, savedX, savedY, savedPageIndex);
        }
      },
      mustExec: true
    });
    return true;
  }
  dragSelectedEditors(tx, ty) {
    if (!__privateGet(this, _draggingEditors)) {
      return;
    }
    for (const editor of __privateGet(this, _draggingEditors).keys()) {
      editor.drag(tx, ty);
    }
  }
  rebuild(editor) {
    if (editor.parent === null) {
      const parent = this.getLayer(editor.pageIndex);
      if (parent) {
        parent.changeParent(editor);
        parent.addOrRebuild(editor);
      } else {
        this.addEditor(editor);
        this.addToAnnotationStorage(editor);
        editor.rebuild();
      }
    } else {
      editor.parent.addOrRebuild(editor);
    }
  }
  get isEditorHandlingKeyboard() {
    var _a2;
    return ((_a2 = this.getActive()) == null ? void 0 : _a2.shouldGetKeyboardEvents()) || __privateGet(this, _selectedEditors).size === 1 && this.firstSelectedEditor.shouldGetKeyboardEvents();
  }
  isActive(editor) {
    return __privateGet(this, _activeEditor) === editor;
  }
  getActive() {
    return __privateGet(this, _activeEditor);
  }
  getMode() {
    return __privateGet(this, _mode);
  }
  get imageManager() {
    return shadow(this, "imageManager", new ImageManager());
  }
  getSelectionBoxes(textLayer) {
    if (!textLayer) {
      return null;
    }
    const selection = document.getSelection();
    for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
      if (!textLayer.contains(selection.getRangeAt(i).commonAncestorContainer)) {
        return null;
      }
    }
    const {
      x: layerX,
      y: layerY,
      width: parentWidth,
      height: parentHeight
    } = textLayer.getBoundingClientRect();
    let rotator;
    switch (textLayer.getAttribute("data-main-rotation")) {
      case "90":
        rotator = (x, y, w, h) => ({
          x: (y - layerY) / parentHeight,
          y: 1 - (x + w - layerX) / parentWidth,
          width: h / parentHeight,
          height: w / parentWidth
        });
        break;
      case "180":
        rotator = (x, y, w, h) => ({
          x: 1 - (x + w - layerX) / parentWidth,
          y: 1 - (y + h - layerY) / parentHeight,
          width: w / parentWidth,
          height: h / parentHeight
        });
        break;
      case "270":
        rotator = (x, y, w, h) => ({
          x: 1 - (y + h - layerY) / parentHeight,
          y: (x - layerX) / parentWidth,
          width: h / parentHeight,
          height: w / parentWidth
        });
        break;
      default:
        rotator = (x, y, w, h) => ({
          x: (x - layerX) / parentWidth,
          y: (y - layerY) / parentHeight,
          width: w / parentWidth,
          height: h / parentHeight
        });
        break;
    }
    const boxes = [];
    for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
      const range = selection.getRangeAt(i);
      if (range.collapsed) {
        continue;
      }
      for (const {
        x,
        y,
        width,
        height
      } of range.getClientRects()) {
        if (width === 0 || height === 0) {
          continue;
        }
        boxes.push(rotator(x, y, width, height));
      }
    }
    return boxes.length === 0 ? null : boxes;
  }
  addChangedExistingAnnotation({
    annotationElementId,
    id
  }) {
    (__privateGet(this, _changedExistingAnnotations) || __privateSet(this, _changedExistingAnnotations, /* @__PURE__ */ new Map())).set(annotationElementId, id);
  }
  removeChangedExistingAnnotation({
    annotationElementId
  }) {
    var _a2;
    (_a2 = __privateGet(this, _changedExistingAnnotations)) == null ? void 0 : _a2.delete(annotationElementId);
  }
  renderAnnotationElement(annotation) {
    var _a2;
    const editorId = (_a2 = __privateGet(this, _changedExistingAnnotations)) == null ? void 0 : _a2.get(annotation.data.id);
    if (!editorId) {
      return;
    }
    const editor = __privateGet(this, _annotationStorage).getRawValue(editorId);
    if (!editor) {
      return;
    }
    if (__privateGet(this, _mode) === AnnotationEditorType.NONE && !editor.hasBeenModified) {
      return;
    }
    editor.renderAnnotationElement(annotation);
  }
};
var AnnotationEditorUIManager = _AnnotationEditorUIManager;
_abortController = new WeakMap();
_activeEditor = new WeakMap();
_allEditors = new WeakMap();
_allLayers = new WeakMap();
_altTextManager = new WeakMap();
_annotationStorage = new WeakMap();
_changedExistingAnnotations = new WeakMap();
_commandManager = new WeakMap();
_copyPasteAC = new WeakMap();
_currentPageIndex = new WeakMap();
_deletedAnnotationsElementIds = new WeakMap();
_draggingEditors = new WeakMap();
_editorTypes = new WeakMap();
_editorsToRescale = new WeakMap();
_enableHighlightFloatingButton = new WeakMap();
_enableUpdatedAddImage = new WeakMap();
_enableNewAltTextWhenAddingImage = new WeakMap();
_filterFactory = new WeakMap();
_focusMainContainerTimeoutId = new WeakMap();
_focusManagerAC = new WeakMap();
_highlightColors = new WeakMap();
_highlightWhenShiftUp = new WeakMap();
_highlightToolbar = new WeakMap();
_idManager = new WeakMap();
_isEnabled = new WeakMap();
_isWaiting = new WeakMap();
_keyboardManagerAC = new WeakMap();
_lastActiveElement = new WeakMap();
_mainHighlightColorPicker = new WeakMap();
_mlManager = new WeakMap();
_mode = new WeakMap();
_selectedEditors = new WeakMap();
_selectedTextNode = new WeakMap();
_pageColors = new WeakMap();
_showAllStates = new WeakMap();
_previousStates = new WeakMap();
_translation = new WeakMap();
_translationTimeoutId = new WeakMap();
_container = new WeakMap();
_viewer = new WeakMap();
_getAnchorElementForSelection = new WeakSet();
getAnchorElementForSelection_fn = function({
  anchorNode
}) {
  return anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentElement : anchorNode;
};
_getLayerForTextLayer = new WeakSet();
getLayerForTextLayer_fn = function(textLayer) {
  const {
    currentLayer
  } = this;
  if (currentLayer.hasTextLayer(textLayer)) {
    return currentLayer;
  }
  for (const layer of __privateGet(this, _allLayers).values()) {
    if (layer.hasTextLayer(textLayer)) {
      return layer;
    }
  }
  return null;
};
_displayHighlightToolbar = new WeakSet();
displayHighlightToolbar_fn = function() {
  const selection = document.getSelection();
  if (!selection || selection.isCollapsed) {
    return;
  }
  const anchorElement = __privateMethod(this, _getAnchorElementForSelection, getAnchorElementForSelection_fn).call(this, selection);
  const textLayer = anchorElement.closest(".textLayer");
  const boxes = this.getSelectionBoxes(textLayer);
  if (!boxes) {
    return;
  }
  __privateGet(this, _highlightToolbar) || __privateSet(this, _highlightToolbar, new HighlightToolbar(this));
  __privateGet(this, _highlightToolbar).show(textLayer, boxes, this.direction === "ltr");
};
_selectionChange = new WeakSet();
selectionChange_fn = function() {
  var _a2, _b, _c;
  const selection = document.getSelection();
  if (!selection || selection.isCollapsed) {
    if (__privateGet(this, _selectedTextNode)) {
      (_a2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _a2.hide();
      __privateSet(this, _selectedTextNode, null);
      __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
        hasSelectedText: false
      });
    }
    return;
  }
  const {
    anchorNode
  } = selection;
  if (anchorNode === __privateGet(this, _selectedTextNode)) {
    return;
  }
  const anchorElement = __privateMethod(this, _getAnchorElementForSelection, getAnchorElementForSelection_fn).call(this, selection);
  const textLayer = anchorElement.closest(".textLayer");
  if (!textLayer) {
    if (__privateGet(this, _selectedTextNode)) {
      (_b = __privateGet(this, _highlightToolbar)) == null ? void 0 : _b.hide();
      __privateSet(this, _selectedTextNode, null);
      __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
        hasSelectedText: false
      });
    }
    return;
  }
  (_c = __privateGet(this, _highlightToolbar)) == null ? void 0 : _c.hide();
  __privateSet(this, _selectedTextNode, anchorNode);
  __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
    hasSelectedText: true
  });
  if (__privateGet(this, _mode) !== AnnotationEditorType.HIGHLIGHT && __privateGet(this, _mode) !== AnnotationEditorType.NONE) {
    return;
  }
  if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
    this.showAllEditors("highlight", true, true);
  }
  __privateSet(this, _highlightWhenShiftUp, this.isShiftKeyDown);
  if (!this.isShiftKeyDown) {
    const activeLayer = __privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT ? __privateMethod(this, _getLayerForTextLayer, getLayerForTextLayer_fn).call(this, textLayer) : null;
    activeLayer == null ? void 0 : activeLayer.toggleDrawing();
    const ac = new AbortController();
    const signal = this.combinedSignal(ac);
    const pointerup = (e) => {
      if (e.type === "pointerup" && e.button !== 0) {
        return;
      }
      ac.abort();
      activeLayer == null ? void 0 : activeLayer.toggleDrawing(true);
      if (e.type === "pointerup") {
        __privateMethod(this, _onSelectEnd, onSelectEnd_fn).call(this, "main_toolbar");
      }
    };
    window.addEventListener("pointerup", pointerup, {
      signal
    });
    window.addEventListener("blur", pointerup, {
      signal
    });
  }
};
_onSelectEnd = new WeakSet();
onSelectEnd_fn = function(methodOfCreation = "") {
  if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
    this.highlightSelection(methodOfCreation);
  } else if (__privateGet(this, _enableHighlightFloatingButton)) {
    __privateMethod(this, _displayHighlightToolbar, displayHighlightToolbar_fn).call(this);
  }
};
_addSelectionListener = new WeakSet();
addSelectionListener_fn = function() {
  document.addEventListener("selectionchange", __privateMethod(this, _selectionChange, selectionChange_fn).bind(this), {
    signal: this._signal
  });
};
_addFocusManager = new WeakSet();
addFocusManager_fn = function() {
  if (__privateGet(this, _focusManagerAC)) {
    return;
  }
  __privateSet(this, _focusManagerAC, new AbortController());
  const signal = this.combinedSignal(__privateGet(this, _focusManagerAC));
  window.addEventListener("focus", this.focus.bind(this), {
    signal
  });
  window.addEventListener("blur", this.blur.bind(this), {
    signal
  });
};
_removeFocusManager = new WeakSet();
removeFocusManager_fn = function() {
  var _a2;
  (_a2 = __privateGet(this, _focusManagerAC)) == null ? void 0 : _a2.abort();
  __privateSet(this, _focusManagerAC, null);
};
_addKeyboardManager = new WeakSet();
addKeyboardManager_fn = function() {
  if (__privateGet(this, _keyboardManagerAC)) {
    return;
  }
  __privateSet(this, _keyboardManagerAC, new AbortController());
  const signal = this.combinedSignal(__privateGet(this, _keyboardManagerAC));
  window.addEventListener("keydown", this.keydown.bind(this), {
    signal
  });
  window.addEventListener("keyup", this.keyup.bind(this), {
    signal
  });
};
_removeKeyboardManager = new WeakSet();
removeKeyboardManager_fn = function() {
  var _a2;
  (_a2 = __privateGet(this, _keyboardManagerAC)) == null ? void 0 : _a2.abort();
  __privateSet(this, _keyboardManagerAC, null);
};
_addCopyPasteListeners = new WeakSet();
addCopyPasteListeners_fn = function() {
  if (__privateGet(this, _copyPasteAC)) {
    return;
  }
  __privateSet(this, _copyPasteAC, new AbortController());
  const signal = this.combinedSignal(__privateGet(this, _copyPasteAC));
  document.addEventListener("copy", this.copy.bind(this), {
    signal
  });
  document.addEventListener("cut", this.cut.bind(this), {
    signal
  });
  document.addEventListener("paste", this.paste.bind(this), {
    signal
  });
};
_removeCopyPasteListeners = new WeakSet();
removeCopyPasteListeners_fn = function() {
  var _a2;
  (_a2 = __privateGet(this, _copyPasteAC)) == null ? void 0 : _a2.abort();
  __privateSet(this, _copyPasteAC, null);
};
_addDragAndDropListeners = new WeakSet();
addDragAndDropListeners_fn = function() {
  const signal = this._signal;
  document.addEventListener("dragover", this.dragOver.bind(this), {
    signal
  });
  document.addEventListener("drop", this.drop.bind(this), {
    signal
  });
};
_dispatchUpdateStates = new WeakSet();
dispatchUpdateStates_fn = function(details) {
  const hasChanged = Object.entries(details).some(([key, value]) => __privateGet(this, _previousStates)[key] !== value);
  if (hasChanged) {
    this._eventBus.dispatch("annotationeditorstateschanged", {
      source: this,
      details: Object.assign(__privateGet(this, _previousStates), details)
    });
    if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT && details.hasSelectedEditor === false) {
      __privateMethod(this, _dispatchUpdateUI, dispatchUpdateUI_fn).call(this, [[AnnotationEditorParamsType.HIGHLIGHT_FREE, true]]);
    }
  }
};
_dispatchUpdateUI = new WeakSet();
dispatchUpdateUI_fn = function(details) {
  this._eventBus.dispatch("annotationeditorparamschanged", {
    source: this,
    details
  });
};
_enableAll = new WeakSet();
enableAll_fn = function() {
  if (!__privateGet(this, _isEnabled)) {
    __privateSet(this, _isEnabled, true);
    for (const layer of __privateGet(this, _allLayers).values()) {
      layer.enable();
    }
    for (const editor of __privateGet(this, _allEditors).values()) {
      editor.enable();
    }
  }
};
_disableAll = new WeakSet();
disableAll_fn = function() {
  this.unselectAll();
  if (__privateGet(this, _isEnabled)) {
    __privateSet(this, _isEnabled, false);
    for (const layer of __privateGet(this, _allLayers).values()) {
      layer.disable();
    }
    for (const editor of __privateGet(this, _allEditors).values()) {
      editor.disable();
    }
  }
};
_addEditorToLayer = new WeakSet();
addEditorToLayer_fn = function(editor) {
  const layer = __privateGet(this, _allLayers).get(editor.pageIndex);
  if (layer) {
    layer.addOrRebuild(editor);
  } else {
    this.addEditor(editor);
    this.addToAnnotationStorage(editor);
  }
};
_lastSelectedEditor = new WeakSet();
lastSelectedEditor_get = function() {
  let ed = null;
  for (ed of __privateGet(this, _selectedEditors)) {
  }
  return ed;
};
_isEmpty = new WeakSet();
isEmpty_fn = function() {
  if (__privateGet(this, _allEditors).size === 0) {
    return true;
  }
  if (__privateGet(this, _allEditors).size === 1) {
    for (const editor of __privateGet(this, _allEditors).values()) {
      return editor.isEmpty();
    }
  }
  return false;
};
_selectEditors = new WeakSet();
selectEditors_fn = function(editors) {
  for (const editor of __privateGet(this, _selectedEditors)) {
    editor.unselect();
  }
  __privateGet(this, _selectedEditors).clear();
  for (const editor of editors) {
    if (editor.isEmpty()) {
      continue;
    }
    __privateGet(this, _selectedEditors).add(editor);
    editor.select();
  }
  __privateMethod(this, _dispatchUpdateStates, dispatchUpdateStates_fn).call(this, {
    hasSelectedEditor: this.hasSelection
  });
};
__publicField(AnnotationEditorUIManager, "TRANSLATE_SMALL", 1);
__publicField(AnnotationEditorUIManager, "TRANSLATE_BIG", 10);
var _altText2, _altTextDecorative, _altTextButton, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _label, label_get, _setState, setState_fn;
var _AltText = class {
  constructor(editor) {
    __privateAdd(this, _label);
    __privateAdd(this, _setState);
    __privateAdd(this, _altText2, null);
    __privateAdd(this, _altTextDecorative, false);
    __privateAdd(this, _altTextButton, null);
    __privateAdd(this, _altTextTooltip, null);
    __privateAdd(this, _altTextTooltipTimeout, null);
    __privateAdd(this, _altTextWasFromKeyBoard, false);
    __privateAdd(this, _badge, null);
    __privateAdd(this, _editor2, null);
    __privateAdd(this, _guessedText, null);
    __privateAdd(this, _textWithDisclaimer, null);
    __privateAdd(this, _useNewAltTextFlow, false);
    __privateSet(this, _editor2, editor);
    __privateSet(this, _useNewAltTextFlow, editor._uiManager.useNewAltTextFlow);
  }
  static initialize(l10nPromise) {
    _AltText._l10nPromise || (_AltText._l10nPromise = l10nPromise);
  }
  async render() {
    const altText = __privateSet(this, _altTextButton, document.createElement("button"));
    altText.className = "altText";
    let msg;
    if (__privateGet(this, _useNewAltTextFlow)) {
      altText.classList.add("new");
      msg = await _AltText._l10nPromise.get("pdfjs-editor-new-alt-text-missing-button-label");
    } else {
      msg = await _AltText._l10nPromise.get("pdfjs-editor-alt-text-button-label");
    }
    altText.textContent = msg;
    altText.setAttribute("aria-label", msg);
    altText.tabIndex = "0";
    const signal = __privateGet(this, _editor2)._uiManager._signal;
    altText.addEventListener("contextmenu", noContextMenu, {
      signal
    });
    altText.addEventListener("pointerdown", (event) => event.stopPropagation(), {
      signal
    });
    const onClick = (event) => {
      event.preventDefault();
      __privateGet(this, _editor2)._uiManager.editAltText(__privateGet(this, _editor2));
      if (__privateGet(this, _useNewAltTextFlow)) {
        __privateGet(this, _editor2)._reportTelemetry({
          action: "pdfjs.image.alt_text.image_status_label_clicked",
          data: {
            label: __privateGet(this, _label, label_get)
          }
        });
      }
    };
    altText.addEventListener("click", onClick, {
      capture: true,
      signal
    });
    altText.addEventListener("keydown", (event) => {
      if (event.target === altText && event.key === "Enter") {
        __privateSet(this, _altTextWasFromKeyBoard, true);
        onClick(event);
      }
    }, {
      signal
    });
    await __privateMethod(this, _setState, setState_fn).call(this);
    return altText;
  }
  finish() {
    if (!__privateGet(this, _altTextButton)) {
      return;
    }
    __privateGet(this, _altTextButton).focus({
      focusVisible: __privateGet(this, _altTextWasFromKeyBoard)
    });
    __privateSet(this, _altTextWasFromKeyBoard, false);
  }
  isEmpty() {
    if (__privateGet(this, _useNewAltTextFlow)) {
      return __privateGet(this, _altText2) === null;
    }
    return !__privateGet(this, _altText2) && !__privateGet(this, _altTextDecorative);
  }
  hasData() {
    if (__privateGet(this, _useNewAltTextFlow)) {
      return __privateGet(this, _altText2) !== null || !!__privateGet(this, _guessedText);
    }
    return this.isEmpty();
  }
  get guessedText() {
    return __privateGet(this, _guessedText);
  }
  async setGuessedText(guessedText) {
    if (__privateGet(this, _altText2) !== null) {
      return;
    }
    __privateSet(this, _guessedText, guessedText);
    __privateSet(this, _textWithDisclaimer, await _AltText._l10nPromise.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer")({
      generatedAltText: guessedText
    }));
    __privateMethod(this, _setState, setState_fn).call(this);
  }
  toggleAltTextBadge(visibility = false) {
    var _a2;
    if (!__privateGet(this, _useNewAltTextFlow) || __privateGet(this, _altText2)) {
      (_a2 = __privateGet(this, _badge)) == null ? void 0 : _a2.remove();
      __privateSet(this, _badge, null);
      return;
    }
    if (!__privateGet(this, _badge)) {
      const badge = __privateSet(this, _badge, document.createElement("div"));
      badge.className = "noAltTextBadge";
      __privateGet(this, _editor2).div.append(badge);
    }
    __privateGet(this, _badge).classList.toggle("hidden", !visibility);
  }
  serialize(isForCopying) {
    let altText = __privateGet(this, _altText2);
    if (!isForCopying && __privateGet(this, _guessedText) === altText) {
      altText = __privateGet(this, _textWithDisclaimer);
    }
    return {
      altText,
      decorative: __privateGet(this, _altTextDecorative),
      guessedText: __privateGet(this, _guessedText),
      textWithDisclaimer: __privateGet(this, _textWithDisclaimer)
    };
  }
  get data() {
    return {
      altText: __privateGet(this, _altText2),
      decorative: __privateGet(this, _altTextDecorative)
    };
  }
  set data({
    altText,
    decorative,
    guessedText,
    textWithDisclaimer,
    cancel = false
  }) {
    if (guessedText) {
      __privateSet(this, _guessedText, guessedText);
      __privateSet(this, _textWithDisclaimer, textWithDisclaimer);
    }
    if (__privateGet(this, _altText2) === altText && __privateGet(this, _altTextDecorative) === decorative) {
      return;
    }
    if (!cancel) {
      __privateSet(this, _altText2, altText);
      __privateSet(this, _altTextDecorative, decorative);
    }
    __privateMethod(this, _setState, setState_fn).call(this);
  }
  toggle(enabled = false) {
    if (!__privateGet(this, _altTextButton)) {
      return;
    }
    if (!enabled && __privateGet(this, _altTextTooltipTimeout)) {
      clearTimeout(__privateGet(this, _altTextTooltipTimeout));
      __privateSet(this, _altTextTooltipTimeout, null);
    }
    __privateGet(this, _altTextButton).disabled = !enabled;
  }
  shown() {
    __privateGet(this, _editor2)._reportTelemetry({
      action: "pdfjs.image.alt_text.image_status_label_displayed",
      data: {
        label: __privateGet(this, _label, label_get)
      }
    });
  }
  destroy() {
    var _a2, _b;
    (_a2 = __privateGet(this, _altTextButton)) == null ? void 0 : _a2.remove();
    __privateSet(this, _altTextButton, null);
    __privateSet(this, _altTextTooltip, null);
    (_b = __privateGet(this, _badge)) == null ? void 0 : _b.remove();
    __privateSet(this, _badge, null);
  }
};
var AltText = _AltText;
_altText2 = new WeakMap();
_altTextDecorative = new WeakMap();
_altTextButton = new WeakMap();
_altTextTooltip = new WeakMap();
_altTextTooltipTimeout = new WeakMap();
_altTextWasFromKeyBoard = new WeakMap();
_badge = new WeakMap();
_editor2 = new WeakMap();
_guessedText = new WeakMap();
_textWithDisclaimer = new WeakMap();
_useNewAltTextFlow = new WeakMap();
_label = new WeakSet();
label_get = function() {
  return __privateGet(this, _altText2) && "added" || __privateGet(this, _altText2) === null && this.guessedText && "review" || "missing";
};
_setState = new WeakSet();
setState_fn = async function() {
  var _a2, _b;
  const button = __privateGet(this, _altTextButton);
  if (!button) {
    return;
  }
  if (__privateGet(this, _useNewAltTextFlow)) {
    const label = __privateGet(this, _label, label_get);
    const type = label === "review" ? "to-review" : label;
    button.classList.toggle("done", !!__privateGet(this, _altText2));
    _AltText._l10nPromise.get(`pdfjs-editor-new-alt-text-${type}-button-label`).then((msg) => {
      button.setAttribute("aria-label", msg);
      for (const child of button.childNodes) {
        if (child.nodeType === Node.TEXT_NODE) {
          child.textContent = msg;
          break;
        }
      }
    });
    if (!__privateGet(this, _altText2)) {
      (_a2 = __privateGet(this, _altTextTooltip)) == null ? void 0 : _a2.remove();
      return;
    }
  } else {
    if (!__privateGet(this, _altText2) && !__privateGet(this, _altTextDecorative)) {
      button.classList.remove("done");
      (_b = __privateGet(this, _altTextTooltip)) == null ? void 0 : _b.remove();
      return;
    }
    button.classList.add("done");
    _AltText._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((msg) => {
      button.setAttribute("aria-label", msg);
    });
  }
  let tooltip = __privateGet(this, _altTextTooltip);
  if (!tooltip) {
    __privateSet(this, _altTextTooltip, tooltip = document.createElement("span"));
    tooltip.className = "tooltip";
    tooltip.setAttribute("role", "tooltip");
    const id = tooltip.id = `alt-text-tooltip-${__privateGet(this, _editor2).id}`;
    button.setAttribute("aria-describedby", id);
    const DELAY_TO_SHOW_TOOLTIP = 100;
    const signal = __privateGet(this, _editor2)._uiManager._signal;
    signal.addEventListener("abort", () => {
      clearTimeout(__privateGet(this, _altTextTooltipTimeout));
      __privateSet(this, _altTextTooltipTimeout, null);
    }, {
      once: true
    });
    button.addEventListener("mouseenter", () => {
      __privateSet(this, _altTextTooltipTimeout, setTimeout(() => {
        __privateSet(this, _altTextTooltipTimeout, null);
        __privateGet(this, _altTextTooltip).classList.add("show");
        __privateGet(this, _editor2)._reportTelemetry({
          action: "alt_text_tooltip"
        });
      }, DELAY_TO_SHOW_TOOLTIP));
    }, {
      signal
    });
    button.addEventListener("mouseleave", () => {
      var _a3;
      if (__privateGet(this, _altTextTooltipTimeout)) {
        clearTimeout(__privateGet(this, _altTextTooltipTimeout));
        __privateSet(this, _altTextTooltipTimeout, null);
      }
      (_a3 = __privateGet(this, _altTextTooltip)) == null ? void 0 : _a3.classList.remove("show");
    }, {
      signal
    });
  }
  tooltip.innerText = __privateGet(this, _altTextDecorative) ? await _AltText._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip") : __privateGet(this, _altText2);
  if (!tooltip.parentNode) {
    button.append(tooltip);
  }
  const element2 = __privateGet(this, _editor2).getImageForAltText();
  element2 == null ? void 0 : element2.setAttribute("aria-describedby", tooltip.id);
};
__publicField(AltText, "_l10nPromise", null);
var _accessibilityData, _allResizerDivs, _altText3, _disabled, _keepAspectRatio, _resizersDiv, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialPosition, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _isDraggable, _zIndex, _translate, translate_fn, _rotatePoint, rotatePoint_fn, _getRotationMatrix, getRotationMatrix_fn, _createResizers, createResizers_fn, _resizerPointerdown, resizerPointerdown_fn, _addResizeToUndoStack, addResizeToUndoStack_fn, _resizerPointermove, resizerPointermove_fn, _selectOnPointerEvent, selectOnPointerEvent_fn, _setUpDragSession, setUpDragSession_fn, _addFocusListeners, addFocusListeners_fn, _resizerKeydown, resizerKeydown_fn, _resizerBlur, resizerBlur_fn, _resizerFocus, resizerFocus_fn, _setResizerTabIndex, setResizerTabIndex_fn, _stopResizing, stopResizing_fn;
var _AnnotationEditor = class {
  constructor(parameters) {
    __privateAdd(this, _translate);
    __privateAdd(this, _getRotationMatrix);
    __privateAdd(this, _createResizers);
    __privateAdd(this, _resizerPointerdown);
    __privateAdd(this, _addResizeToUndoStack);
    __privateAdd(this, _resizerPointermove);
    __privateAdd(this, _selectOnPointerEvent);
    __privateAdd(this, _setUpDragSession);
    __privateAdd(this, _addFocusListeners);
    __privateAdd(this, _resizerKeydown);
    __privateAdd(this, _resizerBlur);
    __privateAdd(this, _resizerFocus);
    __privateAdd(this, _setResizerTabIndex);
    __privateAdd(this, _stopResizing);
    __privateAdd(this, _accessibilityData, null);
    __privateAdd(this, _allResizerDivs, null);
    __privateAdd(this, _altText3, null);
    __privateAdd(this, _disabled, false);
    __privateAdd(this, _keepAspectRatio, false);
    __privateAdd(this, _resizersDiv, null);
    __privateAdd(this, _savedDimensions, null);
    __privateAdd(this, _focusAC, null);
    __privateAdd(this, _focusedResizerName, "");
    __privateAdd(this, _hasBeenClicked, false);
    __privateAdd(this, _initialPosition, null);
    __privateAdd(this, _isEditing, false);
    __privateAdd(this, _isInEditMode, false);
    __privateAdd(this, _isResizerEnabledForKeyboard, false);
    __privateAdd(this, _moveInDOMTimeout, null);
    __privateAdd(this, _prevDragX, 0);
    __privateAdd(this, _prevDragY, 0);
    __privateAdd(this, _telemetryTimeouts, null);
    __publicField(this, "_editToolbar", null);
    __publicField(this, "_initialOptions", /* @__PURE__ */ Object.create(null));
    __publicField(this, "_isVisible", true);
    __publicField(this, "_uiManager", null);
    __publicField(this, "_focusEventsAllowed", true);
    __privateAdd(this, _isDraggable, false);
    __privateAdd(this, _zIndex, _AnnotationEditor._zIndex++);
    this.parent = parameters.parent;
    this.id = parameters.id;
    this.width = this.height = null;
    this.pageIndex = parameters.parent.pageIndex;
    this.name = parameters.name;
    this.div = null;
    this._uiManager = parameters.uiManager;
    this.annotationElementId = null;
    this._willKeepAspectRatio = false;
    this._initialOptions.isCentered = parameters.isCentered;
    this._structTreeParentId = null;
    const {
      rotation,
      rawDims: {
        pageWidth,
        pageHeight,
        pageX,
        pageY
      }
    } = this.parent.viewport;
    this.rotation = rotation;
    this.pageRotation = (360 + rotation - this._uiManager.viewParameters.rotation) % 360;
    this.pageDimensions = [pageWidth, pageHeight];
    this.pageTranslation = [pageX, pageY];
    const [width, height] = this.parentDimensions;
    this.x = parameters.x / width;
    this.y = parameters.y / height;
    this.isAttachedToDOM = false;
    this.deleted = false;
  }
  static get _resizerKeyboardManager() {
    const resize = _AnnotationEditor.prototype._resizeWithKeyboard;
    const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
    const big = AnnotationEditorUIManager.TRANSLATE_BIG;
    return shadow(this, "_resizerKeyboardManager", new KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], resize, {
      args: [-small, 0]
    }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], resize, {
      args: [-big, 0]
    }], [["ArrowRight", "mac+ArrowRight"], resize, {
      args: [small, 0]
    }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], resize, {
      args: [big, 0]
    }], [["ArrowUp", "mac+ArrowUp"], resize, {
      args: [0, -small]
    }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], resize, {
      args: [0, -big]
    }], [["ArrowDown", "mac+ArrowDown"], resize, {
      args: [0, small]
    }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], resize, {
      args: [0, big]
    }], [["Escape", "mac+Escape"], _AnnotationEditor.prototype._stopResizingWithKeyboard]]));
  }
  get editorType() {
    return Object.getPrototypeOf(this).constructor._type;
  }
  static get _defaultLineColor() {
    return shadow(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
  }
  static deleteAnnotationElement(editor) {
    const fakeEditor = new FakeEditor({
      id: editor.parent.getNextId(),
      parent: editor.parent,
      uiManager: editor._uiManager
    });
    fakeEditor.annotationElementId = editor.annotationElementId;
    fakeEditor.deleted = true;
    fakeEditor._uiManager.addToAnnotationStorage(fakeEditor);
  }
  static initialize(l10n, _uiManager4, options) {
    _AnnotationEditor._l10nResizer || (_AnnotationEditor._l10nResizer = Object.freeze({
      topLeft: "pdfjs-editor-resizer-top-left",
      topMiddle: "pdfjs-editor-resizer-top-middle",
      topRight: "pdfjs-editor-resizer-top-right",
      middleRight: "pdfjs-editor-resizer-middle-right",
      bottomRight: "pdfjs-editor-resizer-bottom-right",
      bottomMiddle: "pdfjs-editor-resizer-bottom-middle",
      bottomLeft: "pdfjs-editor-resizer-bottom-left",
      middleLeft: "pdfjs-editor-resizer-middle-left"
    }));
    _AnnotationEditor._l10nPromise || (_AnnotationEditor._l10nPromise = new Map([...["pdfjs-editor-alt-text-button-label", "pdfjs-editor-alt-text-edit-button-label", "pdfjs-editor-alt-text-decorative-tooltip", "pdfjs-editor-new-alt-text-added-button-label", "pdfjs-editor-new-alt-text-missing-button-label", "pdfjs-editor-new-alt-text-to-review-button-label"].map((str) => [str, l10n.get(str)]), ...["pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer"].map((str) => [str, l10n.get.bind(l10n, str)])]));
    if (options == null ? void 0 : options.strings) {
      for (const str of options.strings) {
        _AnnotationEditor._l10nPromise.set(str, l10n.get(str));
      }
    }
    if (_AnnotationEditor._borderLineWidth !== -1) {
      return;
    }
    const style = getComputedStyle(document.documentElement);
    _AnnotationEditor._borderLineWidth = parseFloat(style.getPropertyValue("--outline-width")) || 0;
  }
  static updateDefaultParams(_type2, _value) {
  }
  static get defaultPropertiesToUpdate() {
    return [];
  }
  static isHandlingMimeForPasting(mime) {
    return false;
  }
  static paste(item, parent) {
    unreachable("Not implemented");
  }
  get propertiesToUpdate() {
    return [];
  }
  get _isDraggable() {
    return __privateGet(this, _isDraggable);
  }
  set _isDraggable(value) {
    var _a2;
    __privateSet(this, _isDraggable, value);
    (_a2 = this.div) == null ? void 0 : _a2.classList.toggle("draggable", value);
  }
  get isEnterHandled() {
    return true;
  }
  center() {
    const [pageWidth, pageHeight] = this.pageDimensions;
    switch (this.parentRotation) {
      case 90:
        this.x -= this.height * pageHeight / (pageWidth * 2);
        this.y += this.width * pageWidth / (pageHeight * 2);
        break;
      case 180:
        this.x += this.width / 2;
        this.y += this.height / 2;
        break;
      case 270:
        this.x += this.height * pageHeight / (pageWidth * 2);
        this.y -= this.width * pageWidth / (pageHeight * 2);
        break;
      default:
        this.x -= this.width / 2;
        this.y -= this.height / 2;
        break;
    }
    this.fixAndSetPosition();
  }
  addCommands(params) {
    this._uiManager.addCommands(params);
  }
  get currentLayer() {
    return this._uiManager.currentLayer;
  }
  setInBackground() {
    this.div.style.zIndex = 0;
  }
  setInForeground() {
    this.div.style.zIndex = __privateGet(this, _zIndex);
  }
  setParent(parent) {
    if (parent !== null) {
      this.pageIndex = parent.pageIndex;
      this.pageDimensions = parent.pageDimensions;
    } else {
      __privateMethod(this, _stopResizing, stopResizing_fn).call(this);
    }
    this.parent = parent;
  }
  focusin(event) {
    if (!this._focusEventsAllowed) {
      return;
    }
    if (!__privateGet(this, _hasBeenClicked)) {
      this.parent.setSelected(this);
    } else {
      __privateSet(this, _hasBeenClicked, false);
    }
  }
  focusout(event) {
    var _a2;
    if (!this._focusEventsAllowed) {
      return;
    }
    if (!this.isAttachedToDOM) {
      return;
    }
    const target = event.relatedTarget;
    if (target == null ? void 0 : target.closest(`#${this.id}`)) {
      return;
    }
    event.preventDefault();
    if (!((_a2 = this.parent) == null ? void 0 : _a2.isMultipleSelection)) {
      this.commitOrRemove();
    }
  }
  commitOrRemove() {
    if (this.isEmpty()) {
      this.remove();
    } else {
      this.commit();
    }
  }
  commit() {
    this.addToAnnotationStorage();
  }
  addToAnnotationStorage() {
    this._uiManager.addToAnnotationStorage(this);
  }
  setAt(x, y, tx, ty) {
    const [width, height] = this.parentDimensions;
    [tx, ty] = this.screenToPageTranslation(tx, ty);
    this.x = (x + tx) / width;
    this.y = (y + ty) / height;
    this.fixAndSetPosition();
  }
  translate(x, y) {
    __privateMethod(this, _translate, translate_fn).call(this, this.parentDimensions, x, y);
  }
  translateInPage(x, y) {
    __privateGet(this, _initialPosition) || __privateSet(this, _initialPosition, [this.x, this.y]);
    __privateMethod(this, _translate, translate_fn).call(this, this.pageDimensions, x, y);
    this.div.scrollIntoView({
      block: "nearest"
    });
  }
  drag(tx, ty) {
    __privateGet(this, _initialPosition) || __privateSet(this, _initialPosition, [this.x, this.y]);
    const [parentWidth, parentHeight] = this.parentDimensions;
    this.x += tx / parentWidth;
    this.y += ty / parentHeight;
    if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
      const {
        x: x2,
        y: y2
      } = this.div.getBoundingClientRect();
      if (this.parent.findNewParent(this, x2, y2)) {
        this.x -= Math.floor(this.x);
        this.y -= Math.floor(this.y);
      }
    }
    let {
      x,
      y
    } = this;
    const [bx, by] = this.getBaseTranslation();
    x += bx;
    y += by;
    this.div.style.left = `${(100 * x).toFixed(2)}%`;
    this.div.style.top = `${(100 * y).toFixed(2)}%`;
    this.div.scrollIntoView({
      block: "nearest"
    });
  }
  get _hasBeenMoved() {
    return !!__privateGet(this, _initialPosition) && (__privateGet(this, _initialPosition)[0] !== this.x || __privateGet(this, _initialPosition)[1] !== this.y);
  }
  getBaseTranslation() {
    const [parentWidth, parentHeight] = this.parentDimensions;
    const {
      _borderLineWidth
    } = _AnnotationEditor;
    const x = _borderLineWidth / parentWidth;
    const y = _borderLineWidth / parentHeight;
    switch (this.rotation) {
      case 90:
        return [-x, y];
      case 180:
        return [x, y];
      case 270:
        return [x, -y];
      default:
        return [-x, -y];
    }
  }
  get _mustFixPosition() {
    return true;
  }
  fixAndSetPosition(rotation = this.rotation) {
    const [pageWidth, pageHeight] = this.pageDimensions;
    let {
      x,
      y,
      width,
      height
    } = this;
    width *= pageWidth;
    height *= pageHeight;
    x *= pageWidth;
    y *= pageHeight;
    if (this._mustFixPosition) {
      switch (rotation) {
        case 0:
          x = Math.max(0, Math.min(pageWidth - width, x));
          y = Math.max(0, Math.min(pageHeight - height, y));
          break;
        case 90:
          x = Math.max(0, Math.min(pageWidth - height, x));
          y = Math.min(pageHeight, Math.max(width, y));
          break;
        case 180:
          x = Math.min(pageWidth, Math.max(width, x));
          y = Math.min(pageHeight, Math.max(height, y));
          break;
        case 270:
          x = Math.min(pageWidth, Math.max(height, x));
          y = Math.max(0, Math.min(pageHeight - width, y));
          break;
      }
    }
    this.x = x /= pageWidth;
    this.y = y /= pageHeight;
    const [bx, by] = this.getBaseTranslation();
    x += bx;
    y += by;
    const {
      style
    } = this.div;
    style.left = `${(100 * x).toFixed(2)}%`;
    style.top = `${(100 * y).toFixed(2)}%`;
    this.moveInDOM();
  }
  screenToPageTranslation(x, y) {
    var _a2;
    return __privateMethod(_a2 = _AnnotationEditor, _rotatePoint, rotatePoint_fn).call(_a2, x, y, this.parentRotation);
  }
  pageTranslationToScreen(x, y) {
    var _a2;
    return __privateMethod(_a2 = _AnnotationEditor, _rotatePoint, rotatePoint_fn).call(_a2, x, y, 360 - this.parentRotation);
  }
  get parentScale() {
    return this._uiManager.viewParameters.realScale;
  }
  get parentRotation() {
    return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
  }
  get parentDimensions() {
    const {
      parentScale,
      pageDimensions: [pageWidth, pageHeight]
    } = this;
    const scaledWidth = pageWidth * parentScale;
    const scaledHeight = pageHeight * parentScale;
    return util_FeatureTest.isCSSRoundSupported ? [Math.round(scaledWidth), Math.round(scaledHeight)] : [scaledWidth, scaledHeight];
  }
  setDims(width, height) {
    const [parentWidth, parentHeight] = this.parentDimensions;
    this.div.style.width = `${(100 * width / parentWidth).toFixed(2)}%`;
    if (!__privateGet(this, _keepAspectRatio)) {
      this.div.style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
    }
  }
  fixDims() {
    const {
      style
    } = this.div;
    const {
      height,
      width
    } = style;
    const widthPercent = width.endsWith("%");
    const heightPercent = !__privateGet(this, _keepAspectRatio) && height.endsWith("%");
    if (widthPercent && heightPercent) {
      return;
    }
    const [parentWidth, parentHeight] = this.parentDimensions;
    if (!widthPercent) {
      style.width = `${(100 * parseFloat(width) / parentWidth).toFixed(2)}%`;
    }
    if (!__privateGet(this, _keepAspectRatio) && !heightPercent) {
      style.height = `${(100 * parseFloat(height) / parentHeight).toFixed(2)}%`;
    }
  }
  getInitialTranslation() {
    return [0, 0];
  }
  altTextFinish() {
    var _a2;
    (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.finish();
  }
  async addEditToolbar() {
    if (this._editToolbar || __privateGet(this, _isInEditMode)) {
      return this._editToolbar;
    }
    this._editToolbar = new EditorToolbar(this);
    this.div.append(this._editToolbar.render());
    if (__privateGet(this, _altText3)) {
      await this._editToolbar.addAltText(__privateGet(this, _altText3));
    }
    return this._editToolbar;
  }
  removeEditToolbar() {
    var _a2;
    if (!this._editToolbar) {
      return;
    }
    this._editToolbar.remove();
    this._editToolbar = null;
    (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.destroy();
  }
  getClientDimensions() {
    return this.div.getBoundingClientRect();
  }
  async addAltTextButton() {
    if (__privateGet(this, _altText3)) {
      return;
    }
    AltText.initialize(_AnnotationEditor._l10nPromise);
    __privateSet(this, _altText3, new AltText(this));
    if (__privateGet(this, _accessibilityData)) {
      __privateGet(this, _altText3).data = __privateGet(this, _accessibilityData);
      __privateSet(this, _accessibilityData, null);
    }
    await this.addEditToolbar();
  }
  get altTextData() {
    var _a2;
    return (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.data;
  }
  set altTextData(data) {
    if (!__privateGet(this, _altText3)) {
      return;
    }
    __privateGet(this, _altText3).data = data;
  }
  get guessedAltText() {
    var _a2;
    return (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.guessedText;
  }
  async setGuessedAltText(text2) {
    var _a2;
    await ((_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.setGuessedText(text2));
  }
  serializeAltText(isForCopying) {
    var _a2;
    return (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.serialize(isForCopying);
  }
  hasAltText() {
    return !!__privateGet(this, _altText3) && !__privateGet(this, _altText3).isEmpty();
  }
  hasAltTextData() {
    var _a2, _b;
    return (_b = (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.hasData()) != null ? _b : false;
  }
  render() {
    this.div = document.createElement("div");
    this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
    this.div.className = this.name;
    this.div.setAttribute("id", this.id);
    this.div.tabIndex = __privateGet(this, _disabled) ? -1 : 0;
    if (!this._isVisible) {
      this.div.classList.add("hidden");
    }
    this.setInForeground();
    __privateMethod(this, _addFocusListeners, addFocusListeners_fn).call(this);
    const [parentWidth, parentHeight] = this.parentDimensions;
    if (this.parentRotation % 180 !== 0) {
      this.div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(2)}%`;
      this.div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
    }
    const [tx, ty] = this.getInitialTranslation();
    this.translate(tx, ty);
    bindEvents(this, this.div, ["pointerdown"]);
    return this.div;
  }
  pointerdown(event) {
    const {
      isMac
    } = util_FeatureTest.platform;
    if (event.button !== 0 || event.ctrlKey && isMac) {
      event.preventDefault();
      return;
    }
    __privateSet(this, _hasBeenClicked, true);
    if (this._isDraggable) {
      __privateMethod(this, _setUpDragSession, setUpDragSession_fn).call(this, event);
      return;
    }
    __privateMethod(this, _selectOnPointerEvent, selectOnPointerEvent_fn).call(this, event);
  }
  moveInDOM() {
    if (__privateGet(this, _moveInDOMTimeout)) {
      clearTimeout(__privateGet(this, _moveInDOMTimeout));
    }
    __privateSet(this, _moveInDOMTimeout, setTimeout(() => {
      var _a2;
      __privateSet(this, _moveInDOMTimeout, null);
      (_a2 = this.parent) == null ? void 0 : _a2.moveEditorInDOM(this);
    }, 0));
  }
  _setParentAndPosition(parent, x, y) {
    parent.changeParent(this);
    this.x = x;
    this.y = y;
    this.fixAndSetPosition();
  }
  getRect(tx, ty, rotation = this.rotation) {
    const scale = this.parentScale;
    const [pageWidth, pageHeight] = this.pageDimensions;
    const [pageX, pageY] = this.pageTranslation;
    const shiftX = tx / scale;
    const shiftY = ty / scale;
    const x = this.x * pageWidth;
    const y = this.y * pageHeight;
    const width = this.width * pageWidth;
    const height = this.height * pageHeight;
    switch (rotation) {
      case 0:
        return [x + shiftX + pageX, pageHeight - y - shiftY - height + pageY, x + shiftX + width + pageX, pageHeight - y - shiftY + pageY];
      case 90:
        return [x + shiftY + pageX, pageHeight - y + shiftX + pageY, x + shiftY + height + pageX, pageHeight - y + shiftX + width + pageY];
      case 180:
        return [x - shiftX - width + pageX, pageHeight - y + shiftY + pageY, x - shiftX + pageX, pageHeight - y + shiftY + height + pageY];
      case 270:
        return [x - shiftY - height + pageX, pageHeight - y - shiftX - width + pageY, x - shiftY + pageX, pageHeight - y - shiftX + pageY];
      default:
        throw new Error("Invalid rotation");
    }
  }
  getRectInCurrentCoords(rect, pageHeight) {
    const [x1, y1, x2, y2] = rect;
    const width = x2 - x1;
    const height = y2 - y1;
    switch (this.rotation) {
      case 0:
        return [x1, pageHeight - y2, width, height];
      case 90:
        return [x1, pageHeight - y1, height, width];
      case 180:
        return [x2, pageHeight - y1, width, height];
      case 270:
        return [x2, pageHeight - y2, height, width];
      default:
        throw new Error("Invalid rotation");
    }
  }
  onceAdded() {
  }
  isEmpty() {
    return false;
  }
  enableEditMode() {
    __privateSet(this, _isInEditMode, true);
  }
  disableEditMode() {
    __privateSet(this, _isInEditMode, false);
  }
  isInEditMode() {
    return __privateGet(this, _isInEditMode);
  }
  shouldGetKeyboardEvents() {
    return __privateGet(this, _isResizerEnabledForKeyboard);
  }
  needsToBeRebuilt() {
    return this.div && !this.isAttachedToDOM;
  }
  rebuild() {
    __privateMethod(this, _addFocusListeners, addFocusListeners_fn).call(this);
  }
  rotate(_angle) {
  }
  serialize(isForCopying = false, context = null) {
    unreachable("An editor must be serializable");
  }
  static deserialize(data, parent, uiManager) {
    const editor = new this.prototype.constructor({
      parent,
      id: parent.getNextId(),
      uiManager
    });
    editor.rotation = data.rotation;
    __privateSet(editor, _accessibilityData, data.accessibilityData);
    const [pageWidth, pageHeight] = editor.pageDimensions;
    const [x, y, width, height] = editor.getRectInCurrentCoords(data.rect, pageHeight);
    editor.x = x / pageWidth;
    editor.y = y / pageHeight;
    editor.width = width / pageWidth;
    editor.height = height / pageHeight;
    return editor;
  }
  get hasBeenModified() {
    return !!this.annotationElementId && (this.deleted || this.serialize() !== null);
  }
  remove() {
    var _a2;
    (_a2 = __privateGet(this, _focusAC)) == null ? void 0 : _a2.abort();
    __privateSet(this, _focusAC, null);
    if (!this.isEmpty()) {
      this.commit();
    }
    if (this.parent) {
      this.parent.remove(this);
    } else {
      this._uiManager.removeEditor(this);
    }
    if (__privateGet(this, _moveInDOMTimeout)) {
      clearTimeout(__privateGet(this, _moveInDOMTimeout));
      __privateSet(this, _moveInDOMTimeout, null);
    }
    __privateMethod(this, _stopResizing, stopResizing_fn).call(this);
    this.removeEditToolbar();
    if (__privateGet(this, _telemetryTimeouts)) {
      for (const timeout of __privateGet(this, _telemetryTimeouts).values()) {
        clearTimeout(timeout);
      }
      __privateSet(this, _telemetryTimeouts, null);
    }
    this.parent = null;
  }
  get isResizable() {
    return false;
  }
  makeResizable() {
    if (this.isResizable) {
      __privateMethod(this, _createResizers, createResizers_fn).call(this);
      __privateGet(this, _resizersDiv).classList.remove("hidden");
      bindEvents(this, this.div, ["keydown"]);
    }
  }
  get toolbarPosition() {
    return null;
  }
  keydown(event) {
    if (!this.isResizable || event.target !== this.div || event.key !== "Enter") {
      return;
    }
    this._uiManager.setSelected(this);
    __privateSet(this, _savedDimensions, {
      savedX: this.x,
      savedY: this.y,
      savedWidth: this.width,
      savedHeight: this.height
    });
    const children2 = __privateGet(this, _resizersDiv).children;
    if (!__privateGet(this, _allResizerDivs)) {
      __privateSet(this, _allResizerDivs, Array.from(children2));
      const boundResizerKeydown = __privateMethod(this, _resizerKeydown, resizerKeydown_fn).bind(this);
      const boundResizerBlur = __privateMethod(this, _resizerBlur, resizerBlur_fn).bind(this);
      const signal = this._uiManager._signal;
      for (const div of __privateGet(this, _allResizerDivs)) {
        const name = div.getAttribute("data-resizer-name");
        div.setAttribute("role", "spinbutton");
        div.addEventListener("keydown", boundResizerKeydown, {
          signal
        });
        div.addEventListener("blur", boundResizerBlur, {
          signal
        });
        div.addEventListener("focus", __privateMethod(this, _resizerFocus, resizerFocus_fn).bind(this, name), {
          signal
        });
        div.setAttribute("data-l10n-id", _AnnotationEditor._l10nResizer[name]);
      }
    }
    const first = __privateGet(this, _allResizerDivs)[0];
    let firstPosition = 0;
    for (const div of children2) {
      if (div === first) {
        break;
      }
      firstPosition++;
    }
    const nextFirstPosition = (360 - this.rotation + this.parentRotation) % 360 / 90 * (__privateGet(this, _allResizerDivs).length / 4);
    if (nextFirstPosition !== firstPosition) {
      if (nextFirstPosition < firstPosition) {
        for (let i2 = 0; i2 < firstPosition - nextFirstPosition; i2++) {
          __privateGet(this, _resizersDiv).append(__privateGet(this, _resizersDiv).firstChild);
        }
      } else if (nextFirstPosition > firstPosition) {
        for (let i2 = 0; i2 < nextFirstPosition - firstPosition; i2++) {
          __privateGet(this, _resizersDiv).firstChild.before(__privateGet(this, _resizersDiv).lastChild);
        }
      }
      let i = 0;
      for (const child of children2) {
        const div = __privateGet(this, _allResizerDivs)[i++];
        const name = div.getAttribute("data-resizer-name");
        child.setAttribute("data-l10n-id", _AnnotationEditor._l10nResizer[name]);
      }
    }
    __privateMethod(this, _setResizerTabIndex, setResizerTabIndex_fn).call(this, 0);
    __privateSet(this, _isResizerEnabledForKeyboard, true);
    __privateGet(this, _resizersDiv).firstChild.focus({
      focusVisible: true
    });
    event.preventDefault();
    event.stopImmediatePropagation();
  }
  _resizeWithKeyboard(x, y) {
    if (!__privateGet(this, _isResizerEnabledForKeyboard)) {
      return;
    }
    __privateMethod(this, _resizerPointermove, resizerPointermove_fn).call(this, __privateGet(this, _focusedResizerName), {
      movementX: x,
      movementY: y
    });
  }
  _stopResizingWithKeyboard() {
    __privateMethod(this, _stopResizing, stopResizing_fn).call(this);
    this.div.focus();
  }
  select() {
    var _a2, _b, _c;
    this.makeResizable();
    (_a2 = this.div) == null ? void 0 : _a2.classList.add("selectedEditor");
    if (!this._editToolbar) {
      this.addEditToolbar().then(() => {
        var _a3, _b2;
        if ((_a3 = this.div) == null ? void 0 : _a3.classList.contains("selectedEditor")) {
          (_b2 = this._editToolbar) == null ? void 0 : _b2.show();
        }
      });
      return;
    }
    (_b = this._editToolbar) == null ? void 0 : _b.show();
    (_c = __privateGet(this, _altText3)) == null ? void 0 : _c.toggleAltTextBadge(false);
  }
  unselect() {
    var _a2, _b, _c, _d, _e;
    (_a2 = __privateGet(this, _resizersDiv)) == null ? void 0 : _a2.classList.add("hidden");
    (_b = this.div) == null ? void 0 : _b.classList.remove("selectedEditor");
    if ((_c = this.div) == null ? void 0 : _c.contains(document.activeElement)) {
      this._uiManager.currentLayer.div.focus({
        preventScroll: true
      });
    }
    (_d = this._editToolbar) == null ? void 0 : _d.hide();
    (_e = __privateGet(this, _altText3)) == null ? void 0 : _e.toggleAltTextBadge(true);
  }
  updateParams(type, value) {
  }
  disableEditing() {
  }
  enableEditing() {
  }
  enterInEditMode() {
  }
  getImageForAltText() {
    return null;
  }
  get contentDiv() {
    return this.div;
  }
  get isEditing() {
    return __privateGet(this, _isEditing);
  }
  set isEditing(value) {
    __privateSet(this, _isEditing, value);
    if (!this.parent) {
      return;
    }
    if (value) {
      this.parent.setSelected(this);
      this.parent.setActiveEditor(this);
    } else {
      this.parent.setActiveEditor(null);
    }
  }
  setAspectRatio(width, height) {
    __privateSet(this, _keepAspectRatio, true);
    const aspectRatio = width / height;
    const {
      style
    } = this.div;
    style.aspectRatio = aspectRatio;
    style.height = "auto";
  }
  static get MIN_SIZE() {
    return 16;
  }
  static canCreateNewEmptyEditor() {
    return true;
  }
  get telemetryInitialData() {
    return {
      action: "added"
    };
  }
  get telemetryFinalData() {
    return null;
  }
  _reportTelemetry(data, mustWait = false) {
    if (mustWait) {
      __privateGet(this, _telemetryTimeouts) || __privateSet(this, _telemetryTimeouts, /* @__PURE__ */ new Map());
      const {
        action
      } = data;
      let timeout = __privateGet(this, _telemetryTimeouts).get(action);
      if (timeout) {
        clearTimeout(timeout);
      }
      timeout = setTimeout(() => {
        this._reportTelemetry(data);
        __privateGet(this, _telemetryTimeouts).delete(action);
        if (__privateGet(this, _telemetryTimeouts).size === 0) {
          __privateSet(this, _telemetryTimeouts, null);
        }
      }, _AnnotationEditor._telemetryTimeout);
      __privateGet(this, _telemetryTimeouts).set(action, timeout);
      return;
    }
    data.type || (data.type = this.editorType);
    this._uiManager._eventBus.dispatch("reporttelemetry", {
      source: this,
      details: {
        type: "editing",
        data
      }
    });
  }
  show(visible = this._isVisible) {
    this.div.classList.toggle("hidden", !visible);
    this._isVisible = visible;
  }
  enable() {
    if (this.div) {
      this.div.tabIndex = 0;
    }
    __privateSet(this, _disabled, false);
  }
  disable() {
    if (this.div) {
      this.div.tabIndex = -1;
    }
    __privateSet(this, _disabled, true);
  }
  renderAnnotationElement(annotation) {
    let content = annotation.container.querySelector(".annotationContent");
    if (!content) {
      content = document.createElement("div");
      content.classList.add("annotationContent", this.editorType);
      annotation.container.prepend(content);
    } else if (content.nodeName === "CANVAS") {
      const canvas = content;
      content = document.createElement("div");
      content.classList.add("annotationContent", this.editorType);
      canvas.before(content);
    }
    return content;
  }
  resetAnnotationElement(annotation) {
    const {
      firstChild
    } = annotation.container;
    if (firstChild.nodeName === "DIV" && firstChild.classList.contains("annotationContent")) {
      firstChild.remove();
    }
  }
};
var AnnotationEditor = _AnnotationEditor;
_accessibilityData = new WeakMap();
_allResizerDivs = new WeakMap();
_altText3 = new WeakMap();
_disabled = new WeakMap();
_keepAspectRatio = new WeakMap();
_resizersDiv = new WeakMap();
_savedDimensions = new WeakMap();
_focusAC = new WeakMap();
_focusedResizerName = new WeakMap();
_hasBeenClicked = new WeakMap();
_initialPosition = new WeakMap();
_isEditing = new WeakMap();
_isInEditMode = new WeakMap();
_isResizerEnabledForKeyboard = new WeakMap();
_moveInDOMTimeout = new WeakMap();
_prevDragX = new WeakMap();
_prevDragY = new WeakMap();
_telemetryTimeouts = new WeakMap();
_isDraggable = new WeakMap();
_zIndex = new WeakMap();
_translate = new WeakSet();
translate_fn = function([width, height], x, y) {
  [x, y] = this.screenToPageTranslation(x, y);
  this.x += x / width;
  this.y += y / height;
  this.fixAndSetPosition();
};
_rotatePoint = new WeakSet();
rotatePoint_fn = function(x, y, angle) {
  switch (angle) {
    case 90:
      return [y, -x];
    case 180:
      return [-x, -y];
    case 270:
      return [-y, x];
    default:
      return [x, y];
  }
};
_getRotationMatrix = new WeakSet();
getRotationMatrix_fn = function(rotation) {
  switch (rotation) {
    case 90: {
      const [pageWidth, pageHeight] = this.pageDimensions;
      return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];
    }
    case 180:
      return [-1, 0, 0, -1];
    case 270: {
      const [pageWidth, pageHeight] = this.pageDimensions;
      return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];
    }
    default:
      return [1, 0, 0, 1];
  }
};
_createResizers = new WeakSet();
createResizers_fn = function() {
  if (__privateGet(this, _resizersDiv)) {
    return;
  }
  __privateSet(this, _resizersDiv, document.createElement("div"));
  __privateGet(this, _resizersDiv).classList.add("resizers");
  const classes = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"];
  const signal = this._uiManager._signal;
  for (const name of classes) {
    const div = document.createElement("div");
    __privateGet(this, _resizersDiv).append(div);
    div.classList.add("resizer", name);
    div.setAttribute("data-resizer-name", name);
    div.addEventListener("pointerdown", __privateMethod(this, _resizerPointerdown, resizerPointerdown_fn).bind(this, name), {
      signal
    });
    div.addEventListener("contextmenu", noContextMenu, {
      signal
    });
    div.tabIndex = -1;
  }
  this.div.prepend(__privateGet(this, _resizersDiv));
};
_resizerPointerdown = new WeakSet();
resizerPointerdown_fn = function(name, event) {
  var _a2;
  event.preventDefault();
  const {
    isMac
  } = util_FeatureTest.platform;
  if (event.button !== 0 || event.ctrlKey && isMac) {
    return;
  }
  (_a2 = __privateGet(this, _altText3)) == null ? void 0 : _a2.toggle(false);
  const savedDraggable = this._isDraggable;
  this._isDraggable = false;
  const ac = new AbortController();
  const signal = this._uiManager.combinedSignal(ac);
  this.parent.togglePointerEvents(false);
  window.addEventListener("pointermove", __privateMethod(this, _resizerPointermove, resizerPointermove_fn).bind(this, name), {
    passive: true,
    capture: true,
    signal
  });
  window.addEventListener("contextmenu", noContextMenu, {
    signal
  });
  const savedX = this.x;
  const savedY = this.y;
  const savedWidth = this.width;
  const savedHeight = this.height;
  const savedParentCursor = this.parent.div.style.cursor;
  const savedCursor = this.div.style.cursor;
  this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
  const pointerUpCallback = () => {
    var _a3;
    ac.abort();
    this.parent.togglePointerEvents(true);
    (_a3 = __privateGet(this, _altText3)) == null ? void 0 : _a3.toggle(true);
    this._isDraggable = savedDraggable;
    this.parent.div.style.cursor = savedParentCursor;
    this.div.style.cursor = savedCursor;
    __privateMethod(this, _addResizeToUndoStack, addResizeToUndoStack_fn).call(this, savedX, savedY, savedWidth, savedHeight);
  };
  window.addEventListener("pointerup", pointerUpCallback, {
    signal
  });
  window.addEventListener("blur", pointerUpCallback, {
    signal
  });
};
_addResizeToUndoStack = new WeakSet();
addResizeToUndoStack_fn = function(savedX, savedY, savedWidth, savedHeight) {
  const newX = this.x;
  const newY = this.y;
  const newWidth = this.width;
  const newHeight = this.height;
  if (newX === savedX && newY === savedY && newWidth === savedWidth && newHeight === savedHeight) {
    return;
  }
  this.addCommands({
    cmd: () => {
      this.width = newWidth;
      this.height = newHeight;
      this.x = newX;
      this.y = newY;
      const [parentWidth, parentHeight] = this.parentDimensions;
      this.setDims(parentWidth * newWidth, parentHeight * newHeight);
      this.fixAndSetPosition();
    },
    undo: () => {
      this.width = savedWidth;
      this.height = savedHeight;
      this.x = savedX;
      this.y = savedY;
      const [parentWidth, parentHeight] = this.parentDimensions;
      this.setDims(parentWidth * savedWidth, parentHeight * savedHeight);
      this.fixAndSetPosition();
    },
    mustExec: true
  });
};
_resizerPointermove = new WeakSet();
resizerPointermove_fn = function(name, event) {
  const [parentWidth, parentHeight] = this.parentDimensions;
  const savedX = this.x;
  const savedY = this.y;
  const savedWidth = this.width;
  const savedHeight = this.height;
  const minWidth = _AnnotationEditor.MIN_SIZE / parentWidth;
  const minHeight = _AnnotationEditor.MIN_SIZE / parentHeight;
  const round = (x) => Math.round(x * 1e4) / 1e4;
  const rotationMatrix = __privateMethod(this, _getRotationMatrix, getRotationMatrix_fn).call(this, this.rotation);
  const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
  const invRotationMatrix = __privateMethod(this, _getRotationMatrix, getRotationMatrix_fn).call(this, 360 - this.rotation);
  const invTransf = (x, y) => [invRotationMatrix[0] * x + invRotationMatrix[2] * y, invRotationMatrix[1] * x + invRotationMatrix[3] * y];
  let getPoint;
  let getOpposite;
  let isDiagonal = false;
  let isHorizontal = false;
  switch (name) {
    case "topLeft":
      isDiagonal = true;
      getPoint = (w, h) => [0, 0];
      getOpposite = (w, h) => [w, h];
      break;
    case "topMiddle":
      getPoint = (w, h) => [w / 2, 0];
      getOpposite = (w, h) => [w / 2, h];
      break;
    case "topRight":
      isDiagonal = true;
      getPoint = (w, h) => [w, 0];
      getOpposite = (w, h) => [0, h];
      break;
    case "middleRight":
      isHorizontal = true;
      getPoint = (w, h) => [w, h / 2];
      getOpposite = (w, h) => [0, h / 2];
      break;
    case "bottomRight":
      isDiagonal = true;
      getPoint = (w, h) => [w, h];
      getOpposite = (w, h) => [0, 0];
      break;
    case "bottomMiddle":
      getPoint = (w, h) => [w / 2, h];
      getOpposite = (w, h) => [w / 2, 0];
      break;
    case "bottomLeft":
      isDiagonal = true;
      getPoint = (w, h) => [0, h];
      getOpposite = (w, h) => [w, 0];
      break;
    case "middleLeft":
      isHorizontal = true;
      getPoint = (w, h) => [0, h / 2];
      getOpposite = (w, h) => [w, h / 2];
      break;
  }
  const point = getPoint(savedWidth, savedHeight);
  const oppositePoint = getOpposite(savedWidth, savedHeight);
  let transfOppositePoint = transf(...oppositePoint);
  const oppositeX = round(savedX + transfOppositePoint[0]);
  const oppositeY = round(savedY + transfOppositePoint[1]);
  let ratioX = 1;
  let ratioY = 1;
  let [deltaX, deltaY] = this.screenToPageTranslation(event.movementX, event.movementY);
  [deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);
  if (isDiagonal) {
    const oldDiag = Math.hypot(savedWidth, savedHeight);
    ratioX = ratioY = Math.max(Math.min(Math.hypot(oppositePoint[0] - point[0] - deltaX, oppositePoint[1] - point[1] - deltaY) / oldDiag, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
  } else if (isHorizontal) {
    ratioX = Math.max(minWidth, Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))) / savedWidth;
  } else {
    ratioY = Math.max(minHeight, Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY))) / savedHeight;
  }
  const newWidth = round(savedWidth * ratioX);
  const newHeight = round(savedHeight * ratioY);
  transfOppositePoint = transf(...getOpposite(newWidth, newHeight));
  const newX = oppositeX - transfOppositePoint[0];
  const newY = oppositeY - transfOppositePoint[1];
  this.width = newWidth;
  this.height = newHeight;
  this.x = newX;
  this.y = newY;
  this.setDims(parentWidth * newWidth, parentHeight * newHeight);
  this.fixAndSetPosition();
};
_selectOnPointerEvent = new WeakSet();
selectOnPointerEvent_fn = function(event) {
  const {
    isMac
  } = util_FeatureTest.platform;
  if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
    this.parent.toggleSelected(this);
  } else {
    this.parent.setSelected(this);
  }
};
_setUpDragSession = new WeakSet();
setUpDragSession_fn = function(event) {
  const isSelected = this._uiManager.isSelected(this);
  this._uiManager.setUpDragSession();
  const ac = new AbortController();
  const signal = this._uiManager.combinedSignal(ac);
  if (isSelected) {
    this.div.classList.add("moving");
    __privateSet(this, _prevDragX, event.clientX);
    __privateSet(this, _prevDragY, event.clientY);
    const pointerMoveCallback = (e) => {
      const {
        clientX: x,
        clientY: y
      } = e;
      const [tx, ty] = this.screenToPageTranslation(x - __privateGet(this, _prevDragX), y - __privateGet(this, _prevDragY));
      __privateSet(this, _prevDragX, x);
      __privateSet(this, _prevDragY, y);
      this._uiManager.dragSelectedEditors(tx, ty);
    };
    window.addEventListener("pointermove", pointerMoveCallback, {
      passive: true,
      capture: true,
      signal
    });
  }
  const pointerUpCallback = () => {
    ac.abort();
    if (isSelected) {
      this.div.classList.remove("moving");
    }
    __privateSet(this, _hasBeenClicked, false);
    if (!this._uiManager.endDragSession()) {
      __privateMethod(this, _selectOnPointerEvent, selectOnPointerEvent_fn).call(this, event);
    }
  };
  window.addEventListener("pointerup", pointerUpCallback, {
    signal
  });
  window.addEventListener("blur", pointerUpCallback, {
    signal
  });
};
_addFocusListeners = new WeakSet();
addFocusListeners_fn = function() {
  if (__privateGet(this, _focusAC) || !this.div) {
    return;
  }
  __privateSet(this, _focusAC, new AbortController());
  const signal = this._uiManager.combinedSignal(__privateGet(this, _focusAC));
  this.div.addEventListener("focusin", this.focusin.bind(this), {
    signal
  });
  this.div.addEventListener("focusout", this.focusout.bind(this), {
    signal
  });
};
_resizerKeydown = new WeakSet();
resizerKeydown_fn = function(event) {
  _AnnotationEditor._resizerKeyboardManager.exec(this, event);
};
_resizerBlur = new WeakSet();
resizerBlur_fn = function(event) {
  var _a2;
  if (__privateGet(this, _isResizerEnabledForKeyboard) && ((_a2 = event.relatedTarget) == null ? void 0 : _a2.parentNode) !== __privateGet(this, _resizersDiv)) {
    __privateMethod(this, _stopResizing, stopResizing_fn).call(this);
  }
};
_resizerFocus = new WeakSet();
resizerFocus_fn = function(name) {
  __privateSet(this, _focusedResizerName, __privateGet(this, _isResizerEnabledForKeyboard) ? name : "");
};
_setResizerTabIndex = new WeakSet();
setResizerTabIndex_fn = function(value) {
  if (!__privateGet(this, _allResizerDivs)) {
    return;
  }
  for (const div of __privateGet(this, _allResizerDivs)) {
    div.tabIndex = value;
  }
};
_stopResizing = new WeakSet();
stopResizing_fn = function() {
  __privateSet(this, _isResizerEnabledForKeyboard, false);
  __privateMethod(this, _setResizerTabIndex, setResizerTabIndex_fn).call(this, -1);
  if (__privateGet(this, _savedDimensions)) {
    const {
      savedX,
      savedY,
      savedWidth,
      savedHeight
    } = __privateGet(this, _savedDimensions);
    __privateMethod(this, _addResizeToUndoStack, addResizeToUndoStack_fn).call(this, savedX, savedY, savedWidth, savedHeight);
    __privateSet(this, _savedDimensions, null);
  }
};
__privateAdd(AnnotationEditor, _rotatePoint);
__publicField(AnnotationEditor, "_l10nPromise", null);
__publicField(AnnotationEditor, "_l10nResizer", null);
__publicField(AnnotationEditor, "_borderLineWidth", -1);
__publicField(AnnotationEditor, "_colorManager", new ColorManager());
__publicField(AnnotationEditor, "_zIndex", 1);
__publicField(AnnotationEditor, "_telemetryTimeout", 1e3);
var FakeEditor = class extends AnnotationEditor {
  constructor(params) {
    super(params);
    this.annotationElementId = params.annotationElementId;
    this.deleted = true;
  }
  serialize() {
    return {
      id: this.annotationElementId,
      deleted: true,
      pageIndex: this.pageIndex
    };
  }
};
var SEED = 3285377520;
var MASK_HIGH = 4294901760;
var MASK_LOW = 65535;
var MurmurHash3_64 = class {
  constructor(seed) {
    this.h1 = seed ? seed & 4294967295 : SEED;
    this.h2 = seed ? seed & 4294967295 : SEED;
  }
  update(input) {
    let data, length;
    if (typeof input === "string") {
      data = new Uint8Array(input.length * 2);
      length = 0;
      for (let i = 0, ii = input.length; i < ii; i++) {
        const code = input.charCodeAt(i);
        if (code <= 255) {
          data[length++] = code;
        } else {
          data[length++] = code >>> 8;
          data[length++] = code & 255;
        }
      }
    } else if (ArrayBuffer.isView(input)) {
      data = input.slice();
      length = data.byteLength;
    } else {
      throw new Error("Invalid data format, must be a string or TypedArray.");
    }
    const blockCounts = length >> 2;
    const tailLength = length - blockCounts * 4;
    const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
    let k1 = 0, k2 = 0;
    let h1 = this.h1, h2 = this.h2;
    const C1 = 3432918353, C2 = 461845907;
    const C1_LOW = C1 & MASK_LOW, C2_LOW = C2 & MASK_LOW;
    for (let i = 0; i < blockCounts; i++) {
      if (i & 1) {
        k1 = dataUint32[i];
        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
        k1 = k1 << 15 | k1 >>> 17;
        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
        h1 ^= k1;
        h1 = h1 << 13 | h1 >>> 19;
        h1 = h1 * 5 + 3864292196;
      } else {
        k2 = dataUint32[i];
        k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
        k2 = k2 << 15 | k2 >>> 17;
        k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
        h2 ^= k2;
        h2 = h2 << 13 | h2 >>> 19;
        h2 = h2 * 5 + 3864292196;
      }
    }
    k1 = 0;
    switch (tailLength) {
      case 3:
        k1 ^= data[blockCounts * 4 + 2] << 16;
      case 2:
        k1 ^= data[blockCounts * 4 + 1] << 8;
      case 1:
        k1 ^= data[blockCounts * 4];
        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
        k1 = k1 << 15 | k1 >>> 17;
        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
        if (blockCounts & 1) {
          h1 ^= k1;
        } else {
          h2 ^= k1;
        }
    }
    this.h1 = h1;
    this.h2 = h2;
  }
  hexdigest() {
    let h1 = this.h1, h2 = this.h2;
    h1 ^= h2 >>> 1;
    h1 = h1 * 3981806797 & MASK_HIGH | h1 * 36045 & MASK_LOW;
    h2 = h2 * 4283543511 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 2950163797 & MASK_HIGH) >>> 16;
    h1 ^= h2 >>> 1;
    h1 = h1 * 444984403 & MASK_HIGH | h1 * 60499 & MASK_LOW;
    h2 = h2 * 3301882366 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 3120437893 & MASK_HIGH) >>> 16;
    h1 ^= h2 >>> 1;
    return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  }
};
var SerializableEmpty = Object.freeze({
  map: null,
  hash: "",
  transfer: void 0
});
var _modified, _modifiedIds, _storage, _setModified, setModified_fn;
var AnnotationStorage = class {
  constructor() {
    __privateAdd(this, _setModified);
    __privateAdd(this, _modified, false);
    __privateAdd(this, _modifiedIds, null);
    __privateAdd(this, _storage, /* @__PURE__ */ new Map());
    this.onSetModified = null;
    this.onResetModified = null;
    this.onAnnotationEditor = null;
  }
  getValue(key, defaultValue) {
    const value = __privateGet(this, _storage).get(key);
    if (value === void 0) {
      return defaultValue;
    }
    return Object.assign(defaultValue, value);
  }
  getRawValue(key) {
    return __privateGet(this, _storage).get(key);
  }
  remove(key) {
    __privateGet(this, _storage).delete(key);
    if (__privateGet(this, _storage).size === 0) {
      this.resetModified();
    }
    if (typeof this.onAnnotationEditor === "function") {
      for (const value of __privateGet(this, _storage).values()) {
        if (value instanceof AnnotationEditor) {
          return;
        }
      }
      this.onAnnotationEditor(null);
    }
  }
  setValue(key, value) {
    const obj = __privateGet(this, _storage).get(key);
    let modified = false;
    if (obj !== void 0) {
      for (const [entry, val] of Object.entries(value)) {
        if (obj[entry] !== val) {
          modified = true;
          obj[entry] = val;
        }
      }
    } else {
      modified = true;
      __privateGet(this, _storage).set(key, value);
    }
    if (modified) {
      __privateMethod(this, _setModified, setModified_fn).call(this);
    }
    if (value instanceof AnnotationEditor && typeof this.onAnnotationEditor === "function") {
      this.onAnnotationEditor(value.constructor._type);
    }
  }
  has(key) {
    return __privateGet(this, _storage).has(key);
  }
  getAll() {
    return __privateGet(this, _storage).size > 0 ? objectFromMap(__privateGet(this, _storage)) : null;
  }
  setAll(obj) {
    for (const [key, val] of Object.entries(obj)) {
      this.setValue(key, val);
    }
  }
  get size() {
    return __privateGet(this, _storage).size;
  }
  resetModified() {
    if (__privateGet(this, _modified)) {
      __privateSet(this, _modified, false);
      if (typeof this.onResetModified === "function") {
        this.onResetModified();
      }
    }
  }
  get print() {
    return new PrintAnnotationStorage(this);
  }
  get serializable() {
    if (__privateGet(this, _storage).size === 0) {
      return SerializableEmpty;
    }
    const map = /* @__PURE__ */ new Map(), hash = new MurmurHash3_64(), transfer = [];
    const context = /* @__PURE__ */ Object.create(null);
    let hasBitmap = false;
    for (const [key, val] of __privateGet(this, _storage)) {
      const serialized = val instanceof AnnotationEditor ? val.serialize(false, context) : val;
      if (serialized) {
        map.set(key, serialized);
        hash.update(`${key}:${JSON.stringify(serialized)}`);
        hasBitmap || (hasBitmap = !!serialized.bitmap);
      }
    }
    if (hasBitmap) {
      for (const value of map.values()) {
        if (value.bitmap) {
          transfer.push(value.bitmap);
        }
      }
    }
    return map.size > 0 ? {
      map,
      hash: hash.hexdigest(),
      transfer
    } : SerializableEmpty;
  }
  get editorStats() {
    var _a2;
    let stats = null;
    const typeToEditor = /* @__PURE__ */ new Map();
    for (const value of __privateGet(this, _storage).values()) {
      if (!(value instanceof AnnotationEditor)) {
        continue;
      }
      const editorStats = value.telemetryFinalData;
      if (!editorStats) {
        continue;
      }
      const {
        type
      } = editorStats;
      if (!typeToEditor.has(type)) {
        typeToEditor.set(type, Object.getPrototypeOf(value).constructor);
      }
      stats || (stats = /* @__PURE__ */ Object.create(null));
      const map = stats[type] || (stats[type] = /* @__PURE__ */ new Map());
      for (const [key, val] of Object.entries(editorStats)) {
        if (key === "type") {
          continue;
        }
        let counters = map.get(key);
        if (!counters) {
          counters = /* @__PURE__ */ new Map();
          map.set(key, counters);
        }
        const count = (_a2 = counters.get(val)) != null ? _a2 : 0;
        counters.set(val, count + 1);
      }
    }
    for (const [type, editor] of typeToEditor) {
      stats[type] = editor.computeTelemetryFinalData(stats[type]);
    }
    return stats;
  }
  resetModifiedIds() {
    __privateSet(this, _modifiedIds, null);
  }
  get modifiedIds() {
    if (__privateGet(this, _modifiedIds)) {
      return __privateGet(this, _modifiedIds);
    }
    const ids = [];
    for (const value of __privateGet(this, _storage).values()) {
      if (!(value instanceof AnnotationEditor) || !value.annotationElementId || !value.serialize()) {
        continue;
      }
      ids.push(value.annotationElementId);
    }
    return __privateSet(this, _modifiedIds, {
      ids: new Set(ids),
      hash: ids.join(",")
    });
  }
};
_modified = new WeakMap();
_modifiedIds = new WeakMap();
_storage = new WeakMap();
_setModified = new WeakSet();
setModified_fn = function() {
  if (!__privateGet(this, _modified)) {
    __privateSet(this, _modified, true);
    if (typeof this.onSetModified === "function") {
      this.onSetModified();
    }
  }
};
var _serializable;
var PrintAnnotationStorage = class extends AnnotationStorage {
  constructor(parent) {
    super();
    __privateAdd(this, _serializable, void 0);
    const {
      map,
      hash,
      transfer
    } = parent.serializable;
    const clone2 = structuredClone(map, transfer ? {
      transfer
    } : null);
    __privateSet(this, _serializable, {
      map: clone2,
      hash,
      transfer
    });
  }
  get print() {
    unreachable("Should not call PrintAnnotationStorage.print");
  }
  get serializable() {
    return __privateGet(this, _serializable);
  }
  get modifiedIds() {
    return shadow(this, "modifiedIds", {
      ids: /* @__PURE__ */ new Set(),
      hash: ""
    });
  }
};
_serializable = new WeakMap();
var _systemFonts;
var FontLoader = class {
  constructor({
    ownerDocument = globalThis.document,
    styleElement = null
  }) {
    __privateAdd(this, _systemFonts, /* @__PURE__ */ new Set());
    this._document = ownerDocument;
    this.nativeFontFaces = /* @__PURE__ */ new Set();
    this.styleElement = null;
    this.loadingRequests = [];
    this.loadTestFontId = 0;
  }
  addNativeFontFace(nativeFontFace) {
    this.nativeFontFaces.add(nativeFontFace);
    this._document.fonts.add(nativeFontFace);
  }
  removeNativeFontFace(nativeFontFace) {
    this.nativeFontFaces.delete(nativeFontFace);
    this._document.fonts.delete(nativeFontFace);
  }
  insertRule(rule) {
    if (!this.styleElement) {
      this.styleElement = this._document.createElement("style");
      this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);
    }
    const styleSheet = this.styleElement.sheet;
    styleSheet.insertRule(rule, styleSheet.cssRules.length);
  }
  clear() {
    for (const nativeFontFace of this.nativeFontFaces) {
      this._document.fonts.delete(nativeFontFace);
    }
    this.nativeFontFaces.clear();
    __privateGet(this, _systemFonts).clear();
    if (this.styleElement) {
      this.styleElement.remove();
      this.styleElement = null;
    }
  }
  async loadSystemFont({
    systemFontInfo: info2,
    _inspectFont
  }) {
    if (!info2 || __privateGet(this, _systemFonts).has(info2.loadedName)) {
      return;
    }
    assert(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set.");
    if (this.isFontLoadingAPISupported) {
      const {
        loadedName,
        src,
        style
      } = info2;
      const fontFace = new FontFace(loadedName, src, style);
      this.addNativeFontFace(fontFace);
      try {
        await fontFace.load();
        __privateGet(this, _systemFonts).add(loadedName);
        _inspectFont == null ? void 0 : _inspectFont(info2);
      } catch (e) {
        warn(`Cannot load system font: ${info2.baseFontName}, installing it could help to improve PDF rendering.`);
        this.removeNativeFontFace(fontFace);
      }
      return;
    }
    unreachable("Not implemented: loadSystemFont without the Font Loading API.");
  }
  async bind(font) {
    if (font.attached || font.missingFile && !font.systemFontInfo) {
      return;
    }
    font.attached = true;
    if (font.systemFontInfo) {
      await this.loadSystemFont(font);
      return;
    }
    if (this.isFontLoadingAPISupported) {
      const nativeFontFace = font.createNativeFontFace();
      if (nativeFontFace) {
        this.addNativeFontFace(nativeFontFace);
        try {
          await nativeFontFace.loaded;
        } catch (ex) {
          warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
          font.disableFontFace = true;
          throw ex;
        }
      }
      return;
    }
    const rule = font.createFontFaceRule();
    if (rule) {
      this.insertRule(rule);
      if (this.isSyncFontLoadingSupported) {
        return;
      }
      await new Promise((resolve) => {
        const request = this._queueLoadingCallback(resolve);
        this._prepareFontLoadEvent(font, request);
      });
    }
  }
  get isFontLoadingAPISupported() {
    var _a2;
    const hasFonts = !!((_a2 = this._document) == null ? void 0 : _a2.fonts);
    return shadow(this, "isFontLoadingAPISupported", hasFonts);
  }
  get isSyncFontLoadingSupported() {
    let supported = false;
    if (isNodeJS) {
      supported = true;
    } else if (typeof navigator !== "undefined" && typeof (navigator == null ? void 0 : navigator.userAgent) === "string" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) {
      supported = true;
    }
    return shadow(this, "isSyncFontLoadingSupported", supported);
  }
  _queueLoadingCallback(callback) {
    function completeRequest() {
      assert(!request.done, "completeRequest() cannot be called twice.");
      request.done = true;
      while (loadingRequests.length > 0 && loadingRequests[0].done) {
        const otherRequest = loadingRequests.shift();
        setTimeout(otherRequest.callback, 0);
      }
    }
    const {
      loadingRequests
    } = this;
    const request = {
      done: false,
      complete: completeRequest,
      callback
    };
    loadingRequests.push(request);
    return request;
  }
  get _loadTestFont() {
    const testFont = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
    return shadow(this, "_loadTestFont", testFont);
  }
  _prepareFontLoadEvent(font, request) {
    function int32(data2, offset) {
      return data2.charCodeAt(offset) << 24 | data2.charCodeAt(offset + 1) << 16 | data2.charCodeAt(offset + 2) << 8 | data2.charCodeAt(offset + 3) & 255;
    }
    function spliceString(s, offset, remove, insert2) {
      const chunk1 = s.substring(0, offset);
      const chunk2 = s.substring(offset + remove);
      return chunk1 + insert2 + chunk2;
    }
    let i, ii;
    const canvas = this._document.createElement("canvas");
    canvas.width = 1;
    canvas.height = 1;
    const ctx = canvas.getContext("2d");
    let called = 0;
    function isFontReady(name, callback) {
      if (++called > 30) {
        warn("Load test font never loaded.");
        callback();
        return;
      }
      ctx.font = "30px " + name;
      ctx.fillText(".", 0, 20);
      const imageData = ctx.getImageData(0, 0, 1, 1);
      if (imageData.data[3] > 0) {
        callback();
        return;
      }
      setTimeout(isFontReady.bind(null, name, callback));
    }
    const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;
    let data = this._loadTestFont;
    const COMMENT_OFFSET = 976;
    data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
    const CFF_CHECKSUM_OFFSET = 16;
    const XXXX_VALUE = 1482184792;
    let checksum = int32(data, CFF_CHECKSUM_OFFSET);
    for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
      checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
    }
    if (i < loadTestFontId.length) {
      checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
    }
    data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));
    const url = `url(data:font/opentype;base64,${btoa(data)});`;
    const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`;
    this.insertRule(rule);
    const div = this._document.createElement("div");
    div.style.visibility = "hidden";
    div.style.width = div.style.height = "10px";
    div.style.position = "absolute";
    div.style.top = div.style.left = "0px";
    for (const name of [font.loadedName, loadTestFontId]) {
      const span = this._document.createElement("span");
      span.textContent = "Hi";
      span.style.fontFamily = name;
      div.append(span);
    }
    this._document.body.append(div);
    isFontReady(loadTestFontId, () => {
      div.remove();
      request.complete();
    });
  }
};
_systemFonts = new WeakMap();
var FontFaceObject = class {
  constructor(translatedData, {
    disableFontFace = false,
    inspectFont = null
  }) {
    this.compiledGlyphs = /* @__PURE__ */ Object.create(null);
    for (const i in translatedData) {
      this[i] = translatedData[i];
    }
    this.disableFontFace = disableFontFace === true;
    this._inspectFont = inspectFont;
  }
  createNativeFontFace() {
    var _a2;
    if (!this.data || this.disableFontFace) {
      return null;
    }
    let nativeFontFace;
    if (!this.cssFontInfo) {
      nativeFontFace = new FontFace(this.loadedName, this.data, {});
    } else {
      const css2 = {
        weight: this.cssFontInfo.fontWeight
      };
      if (this.cssFontInfo.italicAngle) {
        css2.style = `oblique ${this.cssFontInfo.italicAngle}deg`;
      }
      nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css2);
    }
    (_a2 = this._inspectFont) == null ? void 0 : _a2.call(this, this);
    return nativeFontFace;
  }
  createFontFaceRule() {
    var _a2;
    if (!this.data || this.disableFontFace) {
      return null;
    }
    const data = bytesToString(this.data);
    const url = `url(data:${this.mimetype};base64,${btoa(data)});`;
    let rule;
    if (!this.cssFontInfo) {
      rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`;
    } else {
      let css2 = `font-weight: ${this.cssFontInfo.fontWeight};`;
      if (this.cssFontInfo.italicAngle) {
        css2 += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;
      }
      rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css2}src:${url}}`;
    }
    (_a2 = this._inspectFont) == null ? void 0 : _a2.call(this, this, url);
    return rule;
  }
  getPathGenerator(objs, character) {
    if (this.compiledGlyphs[character] !== void 0) {
      return this.compiledGlyphs[character];
    }
    let cmds;
    try {
      cmds = objs.get(this.loadedName + "_path_" + character);
    } catch (ex) {
      warn(`getPathGenerator - ignoring character: "${ex}".`);
    }
    if (!Array.isArray(cmds) || cmds.length === 0) {
      return this.compiledGlyphs[character] = function(c, size) {
      };
    }
    const commands = [];
    for (let i = 0, ii = cmds.length; i < ii; ) {
      switch (cmds[i++]) {
        case FontRenderOps.BEZIER_CURVE_TO:
          {
            const [a, b, c, d, e, f] = cmds.slice(i, i + 6);
            commands.push((ctx) => ctx.bezierCurveTo(a, b, c, d, e, f));
            i += 6;
          }
          break;
        case FontRenderOps.MOVE_TO:
          {
            const [a, b] = cmds.slice(i, i + 2);
            commands.push((ctx) => ctx.moveTo(a, b));
            i += 2;
          }
          break;
        case FontRenderOps.LINE_TO:
          {
            const [a, b] = cmds.slice(i, i + 2);
            commands.push((ctx) => ctx.lineTo(a, b));
            i += 2;
          }
          break;
        case FontRenderOps.QUADRATIC_CURVE_TO:
          {
            const [a, b, c, d] = cmds.slice(i, i + 4);
            commands.push((ctx) => ctx.quadraticCurveTo(a, b, c, d));
            i += 4;
          }
          break;
        case FontRenderOps.RESTORE:
          commands.push((ctx) => ctx.restore());
          break;
        case FontRenderOps.SAVE:
          commands.push((ctx) => ctx.save());
          break;
        case FontRenderOps.SCALE:
          assert(commands.length === 2, "Scale command is only valid at the third position.");
          break;
        case FontRenderOps.TRANSFORM:
          {
            const [a, b, c, d, e, f] = cmds.slice(i, i + 6);
            commands.push((ctx) => ctx.transform(a, b, c, d, e, f));
            i += 6;
          }
          break;
        case FontRenderOps.TRANSLATE:
          {
            const [a, b] = cmds.slice(i, i + 2);
            commands.push((ctx) => ctx.translate(a, b));
            i += 2;
          }
          break;
      }
    }
    return this.compiledGlyphs[character] = function glyphDrawer(ctx, size) {
      commands[0](ctx);
      commands[1](ctx);
      ctx.scale(size, -size);
      for (let i = 2, ii = commands.length; i < ii; i++) {
        commands[i](ctx);
      }
    };
  }
};
if (isNodeJS) {
  packageCapability = Promise.withResolvers();
  packageMap = null;
  const loadPackages = async () => {
    const fs = await import(
      /*webpackIgnore: true*/
      "fs"
    ), http = await import(
      /*webpackIgnore: true*/
      "http"
    ), https = await import(
      /*webpackIgnore: true*/
      "https"
    ), url = await import(
      /*webpackIgnore: true*/
      "url"
    );
    let canvas, path2d;
    return new Map(Object.entries({
      fs,
      http,
      https,
      url,
      canvas,
      path2d
    }));
  };
  loadPackages().then((map) => {
    packageMap = map;
    packageCapability.resolve();
  }, (reason) => {
    warn(`loadPackages: ${reason}`);
    packageMap = /* @__PURE__ */ new Map();
    packageCapability.resolve();
  });
}
var packageCapability;
var packageMap;
var NodePackages = class {
  static get promise() {
    return packageCapability.promise;
  }
  static get(name) {
    return packageMap == null ? void 0 : packageMap.get(name);
  }
};
var node_utils_fetchData = function(url) {
  const fs = NodePackages.get("fs");
  return fs.promises.readFile(url).then((data) => new Uint8Array(data));
};
var NodeFilterFactory = class extends BaseFilterFactory {
};
var NodeCanvasFactory = class extends BaseCanvasFactory {
  _createCanvas(width, height) {
    const canvas = NodePackages.get("canvas");
    return canvas.createCanvas(width, height);
  }
};
var NodeCMapReaderFactory = class extends BaseCMapReaderFactory {
  _fetchData(url, compressionType) {
    return node_utils_fetchData(url).then((data) => ({
      cMapData: data,
      compressionType
    }));
  }
};
var NodeStandardFontDataFactory = class extends BaseStandardFontDataFactory {
  _fetchData(url) {
    return node_utils_fetchData(url);
  }
};
var PathType = {
  FILL: "Fill",
  STROKE: "Stroke",
  SHADING: "Shading"
};
function applyBoundingBox(ctx, bbox) {
  if (!bbox) {
    return;
  }
  const width = bbox[2] - bbox[0];
  const height = bbox[3] - bbox[1];
  const region = new Path2D();
  region.rect(bbox[0], bbox[1], width, height);
  ctx.clip(region);
}
var BaseShadingPattern = class {
  getPattern() {
    unreachable("Abstract method `getPattern` called.");
  }
};
var RadialAxialShadingPattern = class extends BaseShadingPattern {
  constructor(IR) {
    super();
    this._type = IR[1];
    this._bbox = IR[2];
    this._colorStops = IR[3];
    this._p0 = IR[4];
    this._p1 = IR[5];
    this._r0 = IR[6];
    this._r1 = IR[7];
    this.matrix = null;
  }
  _createGradient(ctx) {
    let grad;
    if (this._type === "axial") {
      grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);
    } else if (this._type === "radial") {
      grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);
    }
    for (const colorStop of this._colorStops) {
      grad.addColorStop(colorStop[0], colorStop[1]);
    }
    return grad;
  }
  getPattern(ctx, owner, inverse, pathType) {
    let pattern;
    if (pathType === PathType.STROKE || pathType === PathType.FILL) {
      const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, getCurrentTransform(ctx)) || [0, 0, 0, 0];
      const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
      const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
      const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height, true);
      const tmpCtx = tmpCanvas.context;
      tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
      tmpCtx.beginPath();
      tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
      tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
      inverse = Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
      tmpCtx.transform(...owner.baseTransform);
      if (this.matrix) {
        tmpCtx.transform(...this.matrix);
      }
      applyBoundingBox(tmpCtx, this._bbox);
      tmpCtx.fillStyle = this._createGradient(tmpCtx);
      tmpCtx.fill();
      pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
      const domMatrix = new DOMMatrix(inverse);
      pattern.setTransform(domMatrix);
    } else {
      applyBoundingBox(ctx, this._bbox);
      pattern = this._createGradient(ctx);
    }
    return pattern;
  }
};
function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
  const coords = context.coords, colors = context.colors;
  const bytes = data.data, rowSize = data.width * 4;
  let tmp;
  if (coords[p1 + 1] > coords[p2 + 1]) {
    tmp = p1;
    p1 = p2;
    p2 = tmp;
    tmp = c1;
    c1 = c2;
    c2 = tmp;
  }
  if (coords[p2 + 1] > coords[p3 + 1]) {
    tmp = p2;
    p2 = p3;
    p3 = tmp;
    tmp = c2;
    c2 = c3;
    c3 = tmp;
  }
  if (coords[p1 + 1] > coords[p2 + 1]) {
    tmp = p1;
    p1 = p2;
    p2 = tmp;
    tmp = c1;
    c1 = c2;
    c2 = tmp;
  }
  const x1 = (coords[p1] + context.offsetX) * context.scaleX;
  const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
  const x2 = (coords[p2] + context.offsetX) * context.scaleX;
  const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
  const x3 = (coords[p3] + context.offsetX) * context.scaleX;
  const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
  if (y1 >= y3) {
    return;
  }
  const c1r = colors[c1], c1g = colors[c1 + 1], c1b = colors[c1 + 2];
  const c2r = colors[c2], c2g = colors[c2 + 1], c2b = colors[c2 + 2];
  const c3r = colors[c3], c3g = colors[c3 + 1], c3b = colors[c3 + 2];
  const minY = Math.round(y1), maxY = Math.round(y3);
  let xa, car, cag, cab;
  let xb, cbr, cbg, cbb;
  for (let y = minY; y <= maxY; y++) {
    if (y < y2) {
      const k2 = y < y1 ? 0 : (y1 - y) / (y1 - y2);
      xa = x1 - (x1 - x2) * k2;
      car = c1r - (c1r - c2r) * k2;
      cag = c1g - (c1g - c2g) * k2;
      cab = c1b - (c1b - c2b) * k2;
    } else {
      let k2;
      if (y > y3) {
        k2 = 1;
      } else if (y2 === y3) {
        k2 = 0;
      } else {
        k2 = (y2 - y) / (y2 - y3);
      }
      xa = x2 - (x2 - x3) * k2;
      car = c2r - (c2r - c3r) * k2;
      cag = c2g - (c2g - c3g) * k2;
      cab = c2b - (c2b - c3b) * k2;
    }
    let k;
    if (y < y1) {
      k = 0;
    } else if (y > y3) {
      k = 1;
    } else {
      k = (y1 - y) / (y1 - y3);
    }
    xb = x1 - (x1 - x3) * k;
    cbr = c1r - (c1r - c3r) * k;
    cbg = c1g - (c1g - c3g) * k;
    cbb = c1b - (c1b - c3b) * k;
    const x1_ = Math.round(Math.min(xa, xb));
    const x2_ = Math.round(Math.max(xa, xb));
    let j = rowSize * y + x1_ * 4;
    for (let x = x1_; x <= x2_; x++) {
      k = (xa - x) / (xa - xb);
      if (k < 0) {
        k = 0;
      } else if (k > 1) {
        k = 1;
      }
      bytes[j++] = car - (car - cbr) * k | 0;
      bytes[j++] = cag - (cag - cbg) * k | 0;
      bytes[j++] = cab - (cab - cbb) * k | 0;
      bytes[j++] = 255;
    }
  }
}
function drawFigure(data, figure, context) {
  const ps = figure.coords;
  const cs = figure.colors;
  let i, ii;
  switch (figure.type) {
    case "lattice":
      const verticesPerRow = figure.verticesPerRow;
      const rows = Math.floor(ps.length / verticesPerRow) - 1;
      const cols = verticesPerRow - 1;
      for (i = 0; i < rows; i++) {
        let q = i * verticesPerRow;
        for (let j = 0; j < cols; j++, q++) {
          drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
          drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
        }
      }
      break;
    case "triangles":
      for (i = 0, ii = ps.length; i < ii; i += 3) {
        drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
      }
      break;
    default:
      throw new Error("illegal figure");
  }
}
var MeshShadingPattern = class extends BaseShadingPattern {
  constructor(IR) {
    super();
    this._coords = IR[2];
    this._colors = IR[3];
    this._figures = IR[4];
    this._bounds = IR[5];
    this._bbox = IR[7];
    this._background = IR[8];
    this.matrix = null;
  }
  _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {
    const EXPECTED_SCALE = 1.1;
    const MAX_PATTERN_SIZE = 3e3;
    const BORDER_SIZE = 2;
    const offsetX = Math.floor(this._bounds[0]);
    const offsetY = Math.floor(this._bounds[1]);
    const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
    const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
    const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
    const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
    const scaleX = boundsWidth / width;
    const scaleY = boundsHeight / height;
    const context = {
      coords: this._coords,
      colors: this._colors,
      offsetX: -offsetX,
      offsetY: -offsetY,
      scaleX: 1 / scaleX,
      scaleY: 1 / scaleY
    };
    const paddedWidth = width + BORDER_SIZE * 2;
    const paddedHeight = height + BORDER_SIZE * 2;
    const tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
    const tmpCtx = tmpCanvas.context;
    const data = tmpCtx.createImageData(width, height);
    if (backgroundColor) {
      const bytes = data.data;
      for (let i = 0, ii = bytes.length; i < ii; i += 4) {
        bytes[i] = backgroundColor[0];
        bytes[i + 1] = backgroundColor[1];
        bytes[i + 2] = backgroundColor[2];
        bytes[i + 3] = 255;
      }
    }
    for (const figure of this._figures) {
      drawFigure(data, figure, context);
    }
    tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
    const canvas = tmpCanvas.canvas;
    return {
      canvas,
      offsetX: offsetX - BORDER_SIZE * scaleX,
      offsetY: offsetY - BORDER_SIZE * scaleY,
      scaleX,
      scaleY
    };
  }
  getPattern(ctx, owner, inverse, pathType) {
    applyBoundingBox(ctx, this._bbox);
    let scale;
    if (pathType === PathType.SHADING) {
      scale = Util.singularValueDecompose2dScale(getCurrentTransform(ctx));
    } else {
      scale = Util.singularValueDecompose2dScale(owner.baseTransform);
      if (this.matrix) {
        const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
        scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
      }
    }
    const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);
    if (pathType !== PathType.SHADING) {
      ctx.setTransform(...owner.baseTransform);
      if (this.matrix) {
        ctx.transform(...this.matrix);
      }
    }
    ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
    ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
    return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
  }
};
var DummyShadingPattern = class extends BaseShadingPattern {
  getPattern() {
    return "hotpink";
  }
};
function getShadingPattern(IR) {
  switch (IR[0]) {
    case "RadialAxial":
      return new RadialAxialShadingPattern(IR);
    case "Mesh":
      return new MeshShadingPattern(IR);
    case "Dummy":
      return new DummyShadingPattern();
  }
  throw new Error(`Unknown IR type: ${IR[0]}`);
}
var PaintType = {
  COLORED: 1,
  UNCOLORED: 2
};
var _TilingPattern = class {
  constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
    this.operatorList = IR[2];
    this.matrix = IR[3];
    this.bbox = IR[4];
    this.xstep = IR[5];
    this.ystep = IR[6];
    this.paintType = IR[7];
    this.tilingType = IR[8];
    this.color = color;
    this.ctx = ctx;
    this.canvasGraphicsFactory = canvasGraphicsFactory;
    this.baseTransform = baseTransform;
  }
  createPatternCanvas(owner) {
    const operatorList = this.operatorList;
    const bbox = this.bbox;
    const xstep = this.xstep;
    const ystep = this.ystep;
    const paintType = this.paintType;
    const tilingType = this.tilingType;
    const color = this.color;
    const canvasGraphicsFactory = this.canvasGraphicsFactory;
    info("TilingType: " + tilingType);
    const x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3];
    const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
    const curMatrixScale = Util.singularValueDecompose2dScale(this.baseTransform);
    const combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
    const dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
    const dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
    const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true);
    const tmpCtx = tmpCanvas.context;
    const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
    graphics.groupLevel = owner.groupLevel;
    this.setFillAndStrokeStyleToContext(graphics, paintType, color);
    let adjustedX0 = x0;
    let adjustedY0 = y0;
    let adjustedX1 = x1;
    let adjustedY1 = y1;
    if (x0 < 0) {
      adjustedX0 = 0;
      adjustedX1 += Math.abs(x0);
    }
    if (y0 < 0) {
      adjustedY0 = 0;
      adjustedY1 += Math.abs(y0);
    }
    tmpCtx.translate(-(dimx.scale * adjustedX0), -(dimy.scale * adjustedY0));
    graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
    tmpCtx.save();
    this.clipBbox(graphics, adjustedX0, adjustedY0, adjustedX1, adjustedY1);
    graphics.baseTransform = getCurrentTransform(graphics.ctx);
    graphics.executeOperatorList(operatorList);
    graphics.endDrawing();
    return {
      canvas: tmpCanvas.canvas,
      scaleX: dimx.scale,
      scaleY: dimy.scale,
      offsetX: adjustedX0,
      offsetY: adjustedY0
    };
  }
  getSizeAndScale(step, realOutputSize, scale) {
    step = Math.abs(step);
    const maxSize = Math.max(_TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
    let size = Math.ceil(step * scale);
    if (size >= maxSize) {
      size = maxSize;
    } else {
      scale = size / step;
    }
    return {
      scale,
      size
    };
  }
  clipBbox(graphics, x0, y0, x1, y1) {
    const bboxWidth = x1 - x0;
    const bboxHeight = y1 - y0;
    graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
    graphics.current.updateRectMinMax(getCurrentTransform(graphics.ctx), [x0, y0, x1, y1]);
    graphics.clip();
    graphics.endPath();
  }
  setFillAndStrokeStyleToContext(graphics, paintType, color) {
    const context = graphics.ctx, current = graphics.current;
    switch (paintType) {
      case PaintType.COLORED:
        const ctx = this.ctx;
        context.fillStyle = ctx.fillStyle;
        context.strokeStyle = ctx.strokeStyle;
        current.fillColor = ctx.fillStyle;
        current.strokeColor = ctx.strokeStyle;
        break;
      case PaintType.UNCOLORED:
        const cssColor = Util.makeHexColor(color[0], color[1], color[2]);
        context.fillStyle = cssColor;
        context.strokeStyle = cssColor;
        current.fillColor = cssColor;
        current.strokeColor = cssColor;
        break;
      default:
        throw new FormatError(`Unsupported paint type: ${paintType}`);
    }
  }
  getPattern(ctx, owner, inverse, pathType) {
    let matrix2 = inverse;
    if (pathType !== PathType.SHADING) {
      matrix2 = Util.transform(matrix2, owner.baseTransform);
      if (this.matrix) {
        matrix2 = Util.transform(matrix2, this.matrix);
      }
    }
    const temporaryPatternCanvas = this.createPatternCanvas(owner);
    let domMatrix = new DOMMatrix(matrix2);
    domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
    domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
    const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
    pattern.setTransform(domMatrix);
    return pattern;
  }
};
var TilingPattern = _TilingPattern;
__publicField(TilingPattern, "MAX_PATTERN_SIZE", 3e3);
function convertBlackAndWhiteToRGBA({
  src,
  srcPos = 0,
  dest,
  width,
  height,
  nonBlackColor = 4294967295,
  inverseDecode = false
}) {
  const black = util_FeatureTest.isLittleEndian ? 4278190080 : 255;
  const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
  const widthInSource = width >> 3;
  const widthRemainder = width & 7;
  const srcLength = src.length;
  dest = new Uint32Array(dest.buffer);
  let destPos = 0;
  for (let i = 0; i < height; i++) {
    for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
      const elem2 = srcPos < srcLength ? src[srcPos] : 255;
      dest[destPos++] = elem2 & 128 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 64 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 32 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 16 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 8 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 4 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 2 ? oneMapping : zeroMapping;
      dest[destPos++] = elem2 & 1 ? oneMapping : zeroMapping;
    }
    if (widthRemainder === 0) {
      continue;
    }
    const elem = srcPos < srcLength ? src[srcPos++] : 255;
    for (let j = 0; j < widthRemainder; j++) {
      dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
    }
  }
  return {
    srcPos,
    destPos
  };
}
var MIN_FONT_SIZE = 16;
var MAX_FONT_SIZE = 100;
var EXECUTION_TIME = 15;
var EXECUTION_STEPS = 10;
var MAX_SIZE_TO_COMPILE = 1e3;
var FULL_CHUNK_HEIGHT = 16;
function mirrorContextOperations(ctx, destCtx) {
  if (ctx._removeMirroring) {
    throw new Error("Context is already forwarding operations.");
  }
  ctx.__originalSave = ctx.save;
  ctx.__originalRestore = ctx.restore;
  ctx.__originalRotate = ctx.rotate;
  ctx.__originalScale = ctx.scale;
  ctx.__originalTranslate = ctx.translate;
  ctx.__originalTransform = ctx.transform;
  ctx.__originalSetTransform = ctx.setTransform;
  ctx.__originalResetTransform = ctx.resetTransform;
  ctx.__originalClip = ctx.clip;
  ctx.__originalMoveTo = ctx.moveTo;
  ctx.__originalLineTo = ctx.lineTo;
  ctx.__originalBezierCurveTo = ctx.bezierCurveTo;
  ctx.__originalRect = ctx.rect;
  ctx.__originalClosePath = ctx.closePath;
  ctx.__originalBeginPath = ctx.beginPath;
  ctx._removeMirroring = () => {
    ctx.save = ctx.__originalSave;
    ctx.restore = ctx.__originalRestore;
    ctx.rotate = ctx.__originalRotate;
    ctx.scale = ctx.__originalScale;
    ctx.translate = ctx.__originalTranslate;
    ctx.transform = ctx.__originalTransform;
    ctx.setTransform = ctx.__originalSetTransform;
    ctx.resetTransform = ctx.__originalResetTransform;
    ctx.clip = ctx.__originalClip;
    ctx.moveTo = ctx.__originalMoveTo;
    ctx.lineTo = ctx.__originalLineTo;
    ctx.bezierCurveTo = ctx.__originalBezierCurveTo;
    ctx.rect = ctx.__originalRect;
    ctx.closePath = ctx.__originalClosePath;
    ctx.beginPath = ctx.__originalBeginPath;
    delete ctx._removeMirroring;
  };
  ctx.save = function ctxSave() {
    destCtx.save();
    this.__originalSave();
  };
  ctx.restore = function ctxRestore() {
    destCtx.restore();
    this.__originalRestore();
  };
  ctx.translate = function ctxTranslate(x, y) {
    destCtx.translate(x, y);
    this.__originalTranslate(x, y);
  };
  ctx.scale = function ctxScale(x, y) {
    destCtx.scale(x, y);
    this.__originalScale(x, y);
  };
  ctx.transform = function ctxTransform(a, b, c, d, e, f) {
    destCtx.transform(a, b, c, d, e, f);
    this.__originalTransform(a, b, c, d, e, f);
  };
  ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
    destCtx.setTransform(a, b, c, d, e, f);
    this.__originalSetTransform(a, b, c, d, e, f);
  };
  ctx.resetTransform = function ctxResetTransform() {
    destCtx.resetTransform();
    this.__originalResetTransform();
  };
  ctx.rotate = function ctxRotate(angle) {
    destCtx.rotate(angle);
    this.__originalRotate(angle);
  };
  ctx.clip = function ctxRotate(rule) {
    destCtx.clip(rule);
    this.__originalClip(rule);
  };
  ctx.moveTo = function(x, y) {
    destCtx.moveTo(x, y);
    this.__originalMoveTo(x, y);
  };
  ctx.lineTo = function(x, y) {
    destCtx.lineTo(x, y);
    this.__originalLineTo(x, y);
  };
  ctx.bezierCurveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {
    destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
    this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
  };
  ctx.rect = function(x, y, width, height) {
    destCtx.rect(x, y, width, height);
    this.__originalRect(x, y, width, height);
  };
  ctx.closePath = function() {
    destCtx.closePath();
    this.__originalClosePath();
  };
  ctx.beginPath = function() {
    destCtx.beginPath();
    this.__originalBeginPath();
  };
}
var CachedCanvases = class {
  constructor(canvasFactory) {
    this.canvasFactory = canvasFactory;
    this.cache = /* @__PURE__ */ Object.create(null);
  }
  getCanvas(id, width, height) {
    let canvasEntry;
    if (this.cache[id] !== void 0) {
      canvasEntry = this.cache[id];
      this.canvasFactory.reset(canvasEntry, width, height);
    } else {
      canvasEntry = this.canvasFactory.create(width, height);
      this.cache[id] = canvasEntry;
    }
    return canvasEntry;
  }
  delete(id) {
    delete this.cache[id];
  }
  clear() {
    for (const id in this.cache) {
      const canvasEntry = this.cache[id];
      this.canvasFactory.destroy(canvasEntry);
      delete this.cache[id];
    }
  }
};
function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
  const [a, b, c, d, tx, ty] = getCurrentTransform(ctx);
  if (b === 0 && c === 0) {
    const tlX = destX * a + tx;
    const rTlX = Math.round(tlX);
    const tlY = destY * d + ty;
    const rTlY = Math.round(tlY);
    const brX = (destX + destW) * a + tx;
    const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
    const brY = (destY + destH) * d + ty;
    const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
    ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
    ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
    ctx.setTransform(a, b, c, d, tx, ty);
    return [rWidth, rHeight];
  }
  if (a === 0 && d === 0) {
    const tlX = destY * c + tx;
    const rTlX = Math.round(tlX);
    const tlY = destX * b + ty;
    const rTlY = Math.round(tlY);
    const brX = (destY + destH) * c + tx;
    const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
    const brY = (destX + destW) * b + ty;
    const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
    ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, rTlX, rTlY);
    ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rHeight, rWidth);
    ctx.setTransform(a, b, c, d, tx, ty);
    return [rHeight, rWidth];
  }
  ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
  const scaleX = Math.hypot(a, b);
  const scaleY = Math.hypot(c, d);
  return [scaleX * destW, scaleY * destH];
}
function compileType3Glyph(imgData) {
  const {
    width,
    height
  } = imgData;
  if (width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) {
    return null;
  }
  const POINT_TO_PROCESS_LIMIT = 1e3;
  const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
  const width1 = width + 1;
  let points = new Uint8Array(width1 * (height + 1));
  let i, j, j0;
  const lineSize = width + 7 & ~7;
  let data = new Uint8Array(lineSize * height), pos = 0;
  for (const elem of imgData.data) {
    let mask = 128;
    while (mask > 0) {
      data[pos++] = elem & mask ? 0 : 255;
      mask >>= 1;
    }
  }
  let count = 0;
  pos = 0;
  if (data[pos] !== 0) {
    points[0] = 1;
    ++count;
  }
  for (j = 1; j < width; j++) {
    if (data[pos] !== data[pos + 1]) {
      points[j] = data[pos] ? 2 : 1;
      ++count;
    }
    pos++;
  }
  if (data[pos] !== 0) {
    points[j] = 2;
    ++count;
  }
  for (i = 1; i < height; i++) {
    pos = i * lineSize;
    j0 = i * width1;
    if (data[pos - lineSize] !== data[pos]) {
      points[j0] = data[pos] ? 1 : 8;
      ++count;
    }
    let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
    for (j = 1; j < width; j++) {
      sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
      if (POINT_TYPES[sum]) {
        points[j0 + j] = POINT_TYPES[sum];
        ++count;
      }
      pos++;
    }
    if (data[pos - lineSize] !== data[pos]) {
      points[j0 + j] = data[pos] ? 2 : 4;
      ++count;
    }
    if (count > POINT_TO_PROCESS_LIMIT) {
      return null;
    }
  }
  pos = lineSize * (height - 1);
  j0 = i * width1;
  if (data[pos] !== 0) {
    points[j0] = 8;
    ++count;
  }
  for (j = 1; j < width; j++) {
    if (data[pos] !== data[pos + 1]) {
      points[j0 + j] = data[pos] ? 4 : 8;
      ++count;
    }
    pos++;
  }
  if (data[pos] !== 0) {
    points[j0 + j] = 4;
    ++count;
  }
  if (count > POINT_TO_PROCESS_LIMIT) {
    return null;
  }
  const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
  const path = new Path2D();
  for (i = 0; count && i <= height; i++) {
    let p = i * width1;
    const end = p + width;
    while (p < end && !points[p]) {
      p++;
    }
    if (p === end) {
      continue;
    }
    path.moveTo(p % width1, i);
    const p0 = p;
    let type = points[p];
    do {
      const step = steps[type];
      do {
        p += step;
      } while (!points[p]);
      const pp = points[p];
      if (pp !== 5 && pp !== 10) {
        type = pp;
        points[p] = 0;
      } else {
        type = pp & 51 * type >> 4;
        points[p] &= type >> 2 | type << 2;
      }
      path.lineTo(p % width1, p / width1 | 0);
      if (!points[p]) {
        --count;
      }
    } while (p0 !== p);
    --i;
  }
  data = null;
  points = null;
  const drawOutline = function(c) {
    c.save();
    c.scale(1 / width, -1 / height);
    c.translate(0, -height);
    c.fill(path);
    c.beginPath();
    c.restore();
  };
  return drawOutline;
}
var CanvasExtraState = class {
  constructor(width, height) {
    this.alphaIsShape = false;
    this.fontSize = 0;
    this.fontSizeScale = 1;
    this.textMatrix = IDENTITY_MATRIX;
    this.textMatrixScale = 1;
    this.fontMatrix = FONT_IDENTITY_MATRIX;
    this.leading = 0;
    this.x = 0;
    this.y = 0;
    this.lineX = 0;
    this.lineY = 0;
    this.charSpacing = 0;
    this.wordSpacing = 0;
    this.textHScale = 1;
    this.textRenderingMode = TextRenderingMode.FILL;
    this.textRise = 0;
    this.fillColor = "#000000";
    this.strokeColor = "#000000";
    this.patternFill = false;
    this.fillAlpha = 1;
    this.strokeAlpha = 1;
    this.lineWidth = 1;
    this.activeSMask = null;
    this.transferMaps = "none";
    this.startNewPathAndClipBox([0, 0, width, height]);
  }
  clone() {
    const clone2 = Object.create(this);
    clone2.clipBox = this.clipBox.slice();
    return clone2;
  }
  setCurrentPoint(x, y) {
    this.x = x;
    this.y = y;
  }
  updatePathMinMax(transform, x, y) {
    [x, y] = Util.applyTransform([x, y], transform);
    this.minX = Math.min(this.minX, x);
    this.minY = Math.min(this.minY, y);
    this.maxX = Math.max(this.maxX, x);
    this.maxY = Math.max(this.maxY, y);
  }
  updateRectMinMax(transform, rect) {
    const p1 = Util.applyTransform(rect, transform);
    const p2 = Util.applyTransform(rect.slice(2), transform);
    const p3 = Util.applyTransform([rect[0], rect[3]], transform);
    const p4 = Util.applyTransform([rect[2], rect[1]], transform);
    this.minX = Math.min(this.minX, p1[0], p2[0], p3[0], p4[0]);
    this.minY = Math.min(this.minY, p1[1], p2[1], p3[1], p4[1]);
    this.maxX = Math.max(this.maxX, p1[0], p2[0], p3[0], p4[0]);
    this.maxY = Math.max(this.maxY, p1[1], p2[1], p3[1], p4[1]);
  }
  updateScalingPathMinMax(transform, minMax) {
    Util.scaleMinMax(transform, minMax);
    this.minX = Math.min(this.minX, minMax[0]);
    this.minY = Math.min(this.minY, minMax[1]);
    this.maxX = Math.max(this.maxX, minMax[2]);
    this.maxY = Math.max(this.maxY, minMax[3]);
  }
  updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
    const box = Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax);
    if (minMax) {
      return;
    }
    this.updateRectMinMax(transform, box);
  }
  getPathBoundingBox(pathType = PathType.FILL, transform = null) {
    const box = [this.minX, this.minY, this.maxX, this.maxY];
    if (pathType === PathType.STROKE) {
      if (!transform) {
        unreachable("Stroke bounding box must include transform.");
      }
      const scale = Util.singularValueDecompose2dScale(transform);
      const xStrokePad = scale[0] * this.lineWidth / 2;
      const yStrokePad = scale[1] * this.lineWidth / 2;
      box[0] -= xStrokePad;
      box[1] -= yStrokePad;
      box[2] += xStrokePad;
      box[3] += yStrokePad;
    }
    return box;
  }
  updateClipFromPath() {
    const intersect = Util.intersect(this.clipBox, this.getPathBoundingBox());
    this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
  }
  isEmptyClip() {
    return this.minX === Infinity;
  }
  startNewPathAndClipBox(box) {
    this.clipBox = box;
    this.minX = Infinity;
    this.minY = Infinity;
    this.maxX = 0;
    this.maxY = 0;
  }
  getClippedPathBoundingBox(pathType = PathType.FILL, transform = null) {
    return Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
  }
};
function putBinaryImageData(ctx, imgData) {
  if (typeof ImageData !== "undefined" && imgData instanceof ImageData) {
    ctx.putImageData(imgData, 0, 0);
    return;
  }
  const height = imgData.height, width = imgData.width;
  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  let srcPos = 0, destPos;
  const src = imgData.data;
  const dest = chunkImgData.data;
  let i, j, thisChunkHeight, elemsInThisChunk;
  if (imgData.kind === util_ImageKind.GRAYSCALE_1BPP) {
    const srcLength = src.byteLength;
    const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
    const dest32DataLength = dest32.length;
    const fullSrcDiff = width + 7 >> 3;
    const white = 4294967295;
    const black = util_FeatureTest.isLittleEndian ? 4278190080 : 255;
    for (i = 0; i < totalChunks; i++) {
      thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
      destPos = 0;
      for (j = 0; j < thisChunkHeight; j++) {
        const srcDiff = srcLength - srcPos;
        let k = 0;
        const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
        const kEndUnrolled = kEnd & ~7;
        let mask = 0;
        let srcByte = 0;
        for (; k < kEndUnrolled; k += 8) {
          srcByte = src[srcPos++];
          dest32[destPos++] = srcByte & 128 ? white : black;
          dest32[destPos++] = srcByte & 64 ? white : black;
          dest32[destPos++] = srcByte & 32 ? white : black;
          dest32[destPos++] = srcByte & 16 ? white : black;
          dest32[destPos++] = srcByte & 8 ? white : black;
          dest32[destPos++] = srcByte & 4 ? white : black;
          dest32[destPos++] = srcByte & 2 ? white : black;
          dest32[destPos++] = srcByte & 1 ? white : black;
        }
        for (; k < kEnd; k++) {
          if (mask === 0) {
            srcByte = src[srcPos++];
            mask = 128;
          }
          dest32[destPos++] = srcByte & mask ? white : black;
          mask >>= 1;
        }
      }
      while (destPos < dest32DataLength) {
        dest32[destPos++] = 0;
      }
      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
    }
  } else if (imgData.kind === util_ImageKind.RGBA_32BPP) {
    j = 0;
    elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
    for (i = 0; i < fullChunks; i++) {
      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
      srcPos += elemsInThisChunk;
      ctx.putImageData(chunkImgData, 0, j);
      j += FULL_CHUNK_HEIGHT;
    }
    if (i < totalChunks) {
      elemsInThisChunk = width * partialChunkHeight * 4;
      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
      ctx.putImageData(chunkImgData, 0, j);
    }
  } else if (imgData.kind === util_ImageKind.RGB_24BPP) {
    thisChunkHeight = FULL_CHUNK_HEIGHT;
    elemsInThisChunk = width * thisChunkHeight;
    for (i = 0; i < totalChunks; i++) {
      if (i >= fullChunks) {
        thisChunkHeight = partialChunkHeight;
        elemsInThisChunk = width * thisChunkHeight;
      }
      destPos = 0;
      for (j = elemsInThisChunk; j--; ) {
        dest[destPos++] = src[srcPos++];
        dest[destPos++] = src[srcPos++];
        dest[destPos++] = src[srcPos++];
        dest[destPos++] = 255;
      }
      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
    }
  } else {
    throw new Error(`bad image kind: ${imgData.kind}`);
  }
}
function putBinaryImageMask(ctx, imgData) {
  if (imgData.bitmap) {
    ctx.drawImage(imgData.bitmap, 0, 0);
    return;
  }
  const height = imgData.height, width = imgData.width;
  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  let srcPos = 0;
  const src = imgData.data;
  const dest = chunkImgData.data;
  for (let i = 0; i < totalChunks; i++) {
    const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
    ({
      srcPos
    } = convertBlackAndWhiteToRGBA({
      src,
      srcPos,
      dest,
      width,
      height: thisChunkHeight,
      nonBlackColor: 0
    }));
    ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  }
}
function copyCtxState(sourceCtx, destCtx) {
  const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
  for (const property of properties) {
    if (sourceCtx[property] !== void 0) {
      destCtx[property] = sourceCtx[property];
    }
  }
  if (sourceCtx.setLineDash !== void 0) {
    destCtx.setLineDash(sourceCtx.getLineDash());
    destCtx.lineDashOffset = sourceCtx.lineDashOffset;
  }
}
function resetCtxToDefault(ctx) {
  ctx.strokeStyle = ctx.fillStyle = "#000000";
  ctx.fillRule = "nonzero";
  ctx.globalAlpha = 1;
  ctx.lineWidth = 1;
  ctx.lineCap = "butt";
  ctx.lineJoin = "miter";
  ctx.miterLimit = 10;
  ctx.globalCompositeOperation = "source-over";
  ctx.font = "10px sans-serif";
  if (ctx.setLineDash !== void 0) {
    ctx.setLineDash([]);
    ctx.lineDashOffset = 0;
  }
  if (!isNodeJS) {
    const {
      filter
    } = ctx;
    if (filter !== "none" && filter !== "") {
      ctx.filter = "none";
    }
  }
}
function getImageSmoothingEnabled(transform, interpolate) {
  if (interpolate) {
    return true;
  }
  const scale = Util.singularValueDecompose2dScale(transform);
  scale[0] = Math.fround(scale[0]);
  scale[1] = Math.fround(scale[1]);
  const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * PixelsPerInch.PDF_TO_CSS_UNITS);
  return scale[0] <= actualScale && scale[1] <= actualScale;
}
var LINE_CAP_STYLES = ["butt", "round", "square"];
var LINE_JOIN_STYLES = ["miter", "round", "bevel"];
var NORMAL_CLIP = {};
var EO_CLIP = {};
var _restoreInitialState, restoreInitialState_fn, _drawFilter, drawFilter_fn;
var _CanvasGraphics = class {
  constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
    optionalContentConfig,
    markedContentStack = null
  }, annotationCanvasMap, pageColors) {
    __privateAdd(this, _restoreInitialState);
    __privateAdd(this, _drawFilter);
    this.ctx = canvasCtx;
    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
    this.stateStack = [];
    this.pendingClip = null;
    this.pendingEOFill = false;
    this.res = null;
    this.xobjs = null;
    this.commonObjs = commonObjs;
    this.objs = objs;
    this.canvasFactory = canvasFactory;
    this.filterFactory = filterFactory;
    this.groupStack = [];
    this.processingType3 = null;
    this.baseTransform = null;
    this.baseTransformStack = [];
    this.groupLevel = 0;
    this.smaskStack = [];
    this.smaskCounter = 0;
    this.tempSMask = null;
    this.suspendedCtx = null;
    this.contentVisible = true;
    this.markedContentStack = markedContentStack || [];
    this.optionalContentConfig = optionalContentConfig;
    this.cachedCanvases = new CachedCanvases(this.canvasFactory);
    this.cachedPatterns = /* @__PURE__ */ new Map();
    this.annotationCanvasMap = annotationCanvasMap;
    this.viewportScale = 1;
    this.outputScaleX = 1;
    this.outputScaleY = 1;
    this.pageColors = pageColors;
    this._cachedScaleForStroking = [-1, 0];
    this._cachedGetSinglePixelWidth = null;
    this._cachedBitmapsMap = /* @__PURE__ */ new Map();
  }
  getObject(data, fallback = null) {
    if (typeof data === "string") {
      return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
    }
    return fallback;
  }
  beginDrawing({
    transform,
    viewport,
    transparency = false,
    background = null
  }) {
    const width = this.ctx.canvas.width;
    const height = this.ctx.canvas.height;
    const savedFillStyle = this.ctx.fillStyle;
    this.ctx.fillStyle = background || "#ffffff";
    this.ctx.fillRect(0, 0, width, height);
    this.ctx.fillStyle = savedFillStyle;
    if (transparency) {
      const transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height);
      this.compositeCtx = this.ctx;
      this.transparentCanvas = transparentCanvas.canvas;
      this.ctx = transparentCanvas.context;
      this.ctx.save();
      this.ctx.transform(...getCurrentTransform(this.compositeCtx));
    }
    this.ctx.save();
    resetCtxToDefault(this.ctx);
    if (transform) {
      this.ctx.transform(...transform);
      this.outputScaleX = transform[0];
      this.outputScaleY = transform[0];
    }
    this.ctx.transform(...viewport.transform);
    this.viewportScale = viewport.scale;
    this.baseTransform = getCurrentTransform(this.ctx);
  }
  executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
    const argsArray = operatorList.argsArray;
    const fnArray = operatorList.fnArray;
    let i = executionStartIdx || 0;
    const argsArrayLen = argsArray.length;
    if (argsArrayLen === i) {
      return i;
    }
    const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
    const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
    let steps = 0;
    const commonObjs = this.commonObjs;
    const objs = this.objs;
    let fnId;
    while (true) {
      if (stepper !== void 0 && i === stepper.nextBreakPoint) {
        stepper.breakIt(i, continueCallback);
        return i;
      }
      fnId = fnArray[i];
      if (fnId !== OPS.dependency) {
        this[fnId].apply(this, argsArray[i]);
      } else {
        for (const depObjId of argsArray[i]) {
          const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
          if (!objsPool.has(depObjId)) {
            objsPool.get(depObjId, continueCallback);
            return i;
          }
        }
      }
      i++;
      if (i === argsArrayLen) {
        return i;
      }
      if (chunkOperations && ++steps > EXECUTION_STEPS) {
        if (Date.now() > endTime) {
          continueCallback();
          return i;
        }
        steps = 0;
      }
    }
  }
  endDrawing() {
    __privateMethod(this, _restoreInitialState, restoreInitialState_fn).call(this);
    this.cachedCanvases.clear();
    this.cachedPatterns.clear();
    for (const cache of this._cachedBitmapsMap.values()) {
      for (const canvas of cache.values()) {
        if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
          canvas.width = canvas.height = 0;
        }
      }
      cache.clear();
    }
    this._cachedBitmapsMap.clear();
    __privateMethod(this, _drawFilter, drawFilter_fn).call(this);
  }
  _scaleImage(img, inverseTransform) {
    const width = img.width;
    const height = img.height;
    let widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
    let heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
    let paintWidth = width, paintHeight = height;
    let tmpCanvasId = "prescale1";
    let tmpCanvas, tmpCtx;
    while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
      let newWidth = paintWidth, newHeight = paintHeight;
      if (widthScale > 2 && paintWidth > 1) {
        newWidth = paintWidth >= 16384 ? Math.floor(paintWidth / 2) - 1 || 1 : Math.ceil(paintWidth / 2);
        widthScale /= paintWidth / newWidth;
      }
      if (heightScale > 2 && paintHeight > 1) {
        newHeight = paintHeight >= 16384 ? Math.floor(paintHeight / 2) - 1 || 1 : Math.ceil(paintHeight) / 2;
        heightScale /= paintHeight / newHeight;
      }
      tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
      tmpCtx = tmpCanvas.context;
      tmpCtx.clearRect(0, 0, newWidth, newHeight);
      tmpCtx.drawImage(img, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
      img = tmpCanvas.canvas;
      paintWidth = newWidth;
      paintHeight = newHeight;
      tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
    }
    return {
      img,
      paintWidth,
      paintHeight
    };
  }
  _createMaskCanvas(img) {
    const ctx = this.ctx;
    const {
      width,
      height
    } = img;
    const fillColor = this.current.fillColor;
    const isPatternFill = this.current.patternFill;
    const currentTransform = getCurrentTransform(ctx);
    let cache, cacheKey, scaled, maskCanvas;
    if ((img.bitmap || img.data) && img.count > 1) {
      const mainKey = img.bitmap || img.data.buffer;
      cacheKey = JSON.stringify(isPatternFill ? currentTransform : [currentTransform.slice(0, 4), fillColor]);
      cache = this._cachedBitmapsMap.get(mainKey);
      if (!cache) {
        cache = /* @__PURE__ */ new Map();
        this._cachedBitmapsMap.set(mainKey, cache);
      }
      const cachedImage = cache.get(cacheKey);
      if (cachedImage && !isPatternFill) {
        const offsetX2 = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
        const offsetY2 = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
        return {
          canvas: cachedImage,
          offsetX: offsetX2,
          offsetY: offsetY2
        };
      }
      scaled = cachedImage;
    }
    if (!scaled) {
      maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
      putBinaryImageMask(maskCanvas.context, img);
    }
    let maskToCanvas = Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
    maskToCanvas = Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
    const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox([0, 0, width, height], maskToCanvas);
    const drawnWidth = Math.round(maxX - minX) || 1;
    const drawnHeight = Math.round(maxY - minY) || 1;
    const fillCanvas = this.cachedCanvases.getCanvas("fillCanvas", drawnWidth, drawnHeight);
    const fillCtx = fillCanvas.context;
    const offsetX = minX;
    const offsetY = minY;
    fillCtx.translate(-offsetX, -offsetY);
    fillCtx.transform(...maskToCanvas);
    if (!scaled) {
      scaled = this._scaleImage(maskCanvas.canvas, getCurrentTransformInverse(fillCtx));
      scaled = scaled.img;
      if (cache && isPatternFill) {
        cache.set(cacheKey, scaled);
      }
    }
    fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(fillCtx), img.interpolate);
    drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
    fillCtx.globalCompositeOperation = "source-in";
    const inverse = Util.transform(getCurrentTransformInverse(fillCtx), [1, 0, 0, 1, -offsetX, -offsetY]);
    fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, PathType.FILL) : fillColor;
    fillCtx.fillRect(0, 0, width, height);
    if (cache && !isPatternFill) {
      this.cachedCanvases.delete("fillCanvas");
      cache.set(cacheKey, fillCanvas.canvas);
    }
    return {
      canvas: fillCanvas.canvas,
      offsetX: Math.round(offsetX),
      offsetY: Math.round(offsetY)
    };
  }
  setLineWidth(width) {
    if (width !== this.current.lineWidth) {
      this._cachedScaleForStroking[0] = -1;
    }
    this.current.lineWidth = width;
    this.ctx.lineWidth = width;
  }
  setLineCap(style) {
    this.ctx.lineCap = LINE_CAP_STYLES[style];
  }
  setLineJoin(style) {
    this.ctx.lineJoin = LINE_JOIN_STYLES[style];
  }
  setMiterLimit(limit) {
    this.ctx.miterLimit = limit;
  }
  setDash(dashArray, dashPhase) {
    const ctx = this.ctx;
    if (ctx.setLineDash !== void 0) {
      ctx.setLineDash(dashArray);
      ctx.lineDashOffset = dashPhase;
    }
  }
  setRenderingIntent(intent) {
  }
  setFlatness(flatness) {
  }
  setGState(states) {
    for (const [key, value] of states) {
      switch (key) {
        case "LW":
          this.setLineWidth(value);
          break;
        case "LC":
          this.setLineCap(value);
          break;
        case "LJ":
          this.setLineJoin(value);
          break;
        case "ML":
          this.setMiterLimit(value);
          break;
        case "D":
          this.setDash(value[0], value[1]);
          break;
        case "RI":
          this.setRenderingIntent(value);
          break;
        case "FL":
          this.setFlatness(value);
          break;
        case "Font":
          this.setFont(value[0], value[1]);
          break;
        case "CA":
          this.current.strokeAlpha = value;
          break;
        case "ca":
          this.current.fillAlpha = value;
          this.ctx.globalAlpha = value;
          break;
        case "BM":
          this.ctx.globalCompositeOperation = value;
          break;
        case "SMask":
          this.current.activeSMask = value ? this.tempSMask : null;
          this.tempSMask = null;
          this.checkSMaskState();
          break;
        case "TR":
          this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
          break;
      }
    }
  }
  get inSMaskMode() {
    return !!this.suspendedCtx;
  }
  checkSMaskState() {
    const inSMaskMode = this.inSMaskMode;
    if (this.current.activeSMask && !inSMaskMode) {
      this.beginSMaskMode();
    } else if (!this.current.activeSMask && inSMaskMode) {
      this.endSMaskMode();
    }
  }
  beginSMaskMode() {
    if (this.inSMaskMode) {
      throw new Error("beginSMaskMode called while already in smask mode");
    }
    const drawnWidth = this.ctx.canvas.width;
    const drawnHeight = this.ctx.canvas.height;
    const cacheId = "smaskGroupAt" + this.groupLevel;
    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
    this.suspendedCtx = this.ctx;
    this.ctx = scratchCanvas.context;
    const ctx = this.ctx;
    ctx.setTransform(...getCurrentTransform(this.suspendedCtx));
    copyCtxState(this.suspendedCtx, ctx);
    mirrorContextOperations(ctx, this.suspendedCtx);
    this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
  }
  endSMaskMode() {
    if (!this.inSMaskMode) {
      throw new Error("endSMaskMode called while not in smask mode");
    }
    this.ctx._removeMirroring();
    copyCtxState(this.ctx, this.suspendedCtx);
    this.ctx = this.suspendedCtx;
    this.suspendedCtx = null;
  }
  compose(dirtyBox) {
    if (!this.current.activeSMask) {
      return;
    }
    if (!dirtyBox) {
      dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
    } else {
      dirtyBox[0] = Math.floor(dirtyBox[0]);
      dirtyBox[1] = Math.floor(dirtyBox[1]);
      dirtyBox[2] = Math.ceil(dirtyBox[2]);
      dirtyBox[3] = Math.ceil(dirtyBox[3]);
    }
    const smask = this.current.activeSMask;
    const suspendedCtx = this.suspendedCtx;
    this.composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);
    this.ctx.save();
    this.ctx.setTransform(1, 0, 0, 1, 0, 0);
    this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
    this.ctx.restore();
  }
  composeSMask(ctx, smask, layerCtx, layerBox) {
    const layerOffsetX = layerBox[0];
    const layerOffsetY = layerBox[1];
    const layerWidth = layerBox[2] - layerOffsetX;
    const layerHeight = layerBox[3] - layerOffsetY;
    if (layerWidth === 0 || layerHeight === 0) {
      return;
    }
    this.genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);
    ctx.save();
    ctx.globalAlpha = 1;
    ctx.globalCompositeOperation = "source-over";
    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.drawImage(layerCtx.canvas, 0, 0);
    ctx.restore();
  }
  genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, layerOffsetY, maskOffsetX, maskOffsetY) {
    let maskCanvas = maskCtx.canvas;
    let maskX = layerOffsetX - maskOffsetX;
    let maskY = layerOffsetY - maskOffsetY;
    if (backdrop) {
      if (maskX < 0 || maskY < 0 || maskX + width > maskCanvas.width || maskY + height > maskCanvas.height) {
        const canvas = this.cachedCanvases.getCanvas("maskExtension", width, height);
        const ctx = canvas.context;
        ctx.drawImage(maskCanvas, -maskX, -maskY);
        if (backdrop.some((c) => c !== 0)) {
          ctx.globalCompositeOperation = "destination-atop";
          ctx.fillStyle = Util.makeHexColor(...backdrop);
          ctx.fillRect(0, 0, width, height);
          ctx.globalCompositeOperation = "source-over";
        }
        maskCanvas = canvas.canvas;
        maskX = maskY = 0;
      } else if (backdrop.some((c) => c !== 0)) {
        maskCtx.save();
        maskCtx.globalAlpha = 1;
        maskCtx.setTransform(1, 0, 0, 1, 0, 0);
        const clip2 = new Path2D();
        clip2.rect(maskX, maskY, width, height);
        maskCtx.clip(clip2);
        maskCtx.globalCompositeOperation = "destination-atop";
        maskCtx.fillStyle = Util.makeHexColor(...backdrop);
        maskCtx.fillRect(maskX, maskY, width, height);
        maskCtx.restore();
      }
    }
    layerCtx.save();
    layerCtx.globalAlpha = 1;
    layerCtx.setTransform(1, 0, 0, 1, 0, 0);
    if (subtype === "Alpha" && transferMap) {
      layerCtx.filter = this.filterFactory.addAlphaFilter(transferMap);
    } else if (subtype === "Luminosity") {
      layerCtx.filter = this.filterFactory.addLuminosityFilter(transferMap);
    }
    const clip = new Path2D();
    clip.rect(layerOffsetX, layerOffsetY, width, height);
    layerCtx.clip(clip);
    layerCtx.globalCompositeOperation = "destination-in";
    layerCtx.drawImage(maskCanvas, maskX, maskY, width, height, layerOffsetX, layerOffsetY, width, height);
    layerCtx.restore();
  }
  save() {
    if (this.inSMaskMode) {
      copyCtxState(this.ctx, this.suspendedCtx);
      this.suspendedCtx.save();
    } else {
      this.ctx.save();
    }
    const old = this.current;
    this.stateStack.push(old);
    this.current = old.clone();
  }
  restore() {
    if (this.stateStack.length === 0 && this.inSMaskMode) {
      this.endSMaskMode();
    }
    if (this.stateStack.length !== 0) {
      this.current = this.stateStack.pop();
      if (this.inSMaskMode) {
        this.suspendedCtx.restore();
        copyCtxState(this.suspendedCtx, this.ctx);
      } else {
        this.ctx.restore();
      }
      this.checkSMaskState();
      this.pendingClip = null;
      this._cachedScaleForStroking[0] = -1;
      this._cachedGetSinglePixelWidth = null;
    }
  }
  transform(a, b, c, d, e, f) {
    this.ctx.transform(a, b, c, d, e, f);
    this._cachedScaleForStroking[0] = -1;
    this._cachedGetSinglePixelWidth = null;
  }
  constructPath(ops, args, minMax) {
    const ctx = this.ctx;
    const current = this.current;
    let x = current.x, y = current.y;
    let startX, startY;
    const currentTransform = getCurrentTransform(ctx);
    const isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
    const minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
    for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
      switch (ops[i] | 0) {
        case OPS.rectangle:
          x = args[j++];
          y = args[j++];
          const width = args[j++];
          const height = args[j++];
          const xw = x + width;
          const yh = y + height;
          ctx.moveTo(x, y);
          if (width === 0 || height === 0) {
            ctx.lineTo(xw, yh);
          } else {
            ctx.lineTo(xw, y);
            ctx.lineTo(xw, yh);
            ctx.lineTo(x, yh);
          }
          if (!isScalingMatrix) {
            current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
          }
          ctx.closePath();
          break;
        case OPS.moveTo:
          x = args[j++];
          y = args[j++];
          ctx.moveTo(x, y);
          if (!isScalingMatrix) {
            current.updatePathMinMax(currentTransform, x, y);
          }
          break;
        case OPS.lineTo:
          x = args[j++];
          y = args[j++];
          ctx.lineTo(x, y);
          if (!isScalingMatrix) {
            current.updatePathMinMax(currentTransform, x, y);
          }
          break;
        case OPS.curveTo:
          startX = x;
          startY = y;
          x = args[j + 4];
          y = args[j + 5];
          ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
          current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], args[j + 2], args[j + 3], x, y, minMaxForBezier);
          j += 6;
          break;
        case OPS.curveTo2:
          startX = x;
          startY = y;
          ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
          current.updateCurvePathMinMax(currentTransform, startX, startY, x, y, args[j], args[j + 1], args[j + 2], args[j + 3], minMaxForBezier);
          x = args[j + 2];
          y = args[j + 3];
          j += 4;
          break;
        case OPS.curveTo3:
          startX = x;
          startY = y;
          x = args[j + 2];
          y = args[j + 3];
          ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
          current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], x, y, x, y, minMaxForBezier);
          j += 4;
          break;
        case OPS.closePath:
          ctx.closePath();
          break;
      }
    }
    if (isScalingMatrix) {
      current.updateScalingPathMinMax(currentTransform, minMaxForBezier);
    }
    current.setCurrentPoint(x, y);
  }
  closePath() {
    this.ctx.closePath();
  }
  stroke(consumePath = true) {
    const ctx = this.ctx;
    const strokeColor = this.current.strokeColor;
    ctx.globalAlpha = this.current.strokeAlpha;
    if (this.contentVisible) {
      if (typeof strokeColor === "object" && (strokeColor == null ? void 0 : strokeColor.getPattern)) {
        ctx.save();
        ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE);
        this.rescaleAndStroke(false);
        ctx.restore();
      } else {
        this.rescaleAndStroke(true);
      }
    }
    if (consumePath) {
      this.consumePath(this.current.getClippedPathBoundingBox());
    }
    ctx.globalAlpha = this.current.fillAlpha;
  }
  closeStroke() {
    this.closePath();
    this.stroke();
  }
  fill(consumePath = true) {
    const ctx = this.ctx;
    const fillColor = this.current.fillColor;
    const isPatternFill = this.current.patternFill;
    let needRestore = false;
    if (isPatternFill) {
      ctx.save();
      ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
      needRestore = true;
    }
    const intersect = this.current.getClippedPathBoundingBox();
    if (this.contentVisible && intersect !== null) {
      if (this.pendingEOFill) {
        ctx.fill("evenodd");
        this.pendingEOFill = false;
      } else {
        ctx.fill();
      }
    }
    if (needRestore) {
      ctx.restore();
    }
    if (consumePath) {
      this.consumePath(intersect);
    }
  }
  eoFill() {
    this.pendingEOFill = true;
    this.fill();
  }
  fillStroke() {
    this.fill(false);
    this.stroke(false);
    this.consumePath();
  }
  eoFillStroke() {
    this.pendingEOFill = true;
    this.fillStroke();
  }
  closeFillStroke() {
    this.closePath();
    this.fillStroke();
  }
  closeEOFillStroke() {
    this.pendingEOFill = true;
    this.closePath();
    this.fillStroke();
  }
  endPath() {
    this.consumePath();
  }
  clip() {
    this.pendingClip = NORMAL_CLIP;
  }
  eoClip() {
    this.pendingClip = EO_CLIP;
  }
  beginText() {
    this.current.textMatrix = IDENTITY_MATRIX;
    this.current.textMatrixScale = 1;
    this.current.x = this.current.lineX = 0;
    this.current.y = this.current.lineY = 0;
  }
  endText() {
    const paths = this.pendingTextPaths;
    const ctx = this.ctx;
    if (paths === void 0) {
      ctx.beginPath();
      return;
    }
    ctx.save();
    ctx.beginPath();
    for (const path of paths) {
      ctx.setTransform(...path.transform);
      ctx.translate(path.x, path.y);
      path.addToPath(ctx, path.fontSize);
    }
    ctx.restore();
    ctx.clip();
    ctx.beginPath();
    delete this.pendingTextPaths;
  }
  setCharSpacing(spacing) {
    this.current.charSpacing = spacing;
  }
  setWordSpacing(spacing) {
    this.current.wordSpacing = spacing;
  }
  setHScale(scale) {
    this.current.textHScale = scale / 100;
  }
  setLeading(leading) {
    this.current.leading = -leading;
  }
  setFont(fontRefName, size) {
    var _a2;
    const fontObj = this.commonObjs.get(fontRefName);
    const current = this.current;
    if (!fontObj) {
      throw new Error(`Can't find font for ${fontRefName}`);
    }
    current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
    if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
      warn("Invalid font matrix for font " + fontRefName);
    }
    if (size < 0) {
      size = -size;
      current.fontDirection = -1;
    } else {
      current.fontDirection = 1;
    }
    this.current.font = fontObj;
    this.current.fontSize = size;
    if (fontObj.isType3Font) {
      return;
    }
    const name = fontObj.loadedName || "sans-serif";
    const typeface = ((_a2 = fontObj.systemFontInfo) == null ? void 0 : _a2.css) || `"${name}", ${fontObj.fallbackName}`;
    let bold = "normal";
    if (fontObj.black) {
      bold = "900";
    } else if (fontObj.bold) {
      bold = "bold";
    }
    const italic = fontObj.italic ? "italic" : "normal";
    let browserFontSize = size;
    if (size < MIN_FONT_SIZE) {
      browserFontSize = MIN_FONT_SIZE;
    } else if (size > MAX_FONT_SIZE) {
      browserFontSize = MAX_FONT_SIZE;
    }
    this.current.fontSizeScale = size / browserFontSize;
    this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
  }
  setTextRenderingMode(mode) {
    this.current.textRenderingMode = mode;
  }
  setTextRise(rise) {
    this.current.textRise = rise;
  }
  moveText(x, y) {
    this.current.x = this.current.lineX += x;
    this.current.y = this.current.lineY += y;
  }
  setLeadingMoveText(x, y) {
    this.setLeading(-y);
    this.moveText(x, y);
  }
  setTextMatrix(a, b, c, d, e, f) {
    this.current.textMatrix = [a, b, c, d, e, f];
    this.current.textMatrixScale = Math.hypot(a, b);
    this.current.x = this.current.lineX = 0;
    this.current.y = this.current.lineY = 0;
  }
  nextLine() {
    this.moveText(0, this.current.leading);
  }
  paintChar(character, x, y, patternTransform) {
    const ctx = this.ctx;
    const current = this.current;
    const font = current.font;
    const textRenderingMode = current.textRenderingMode;
    const fontSize = current.fontSize / current.fontSizeScale;
    const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
    const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
    const patternFill = current.patternFill && !font.missingFile;
    let addToPath;
    if (font.disableFontFace || isAddToPathSet || patternFill) {
      addToPath = font.getPathGenerator(this.commonObjs, character);
    }
    if (font.disableFontFace || patternFill) {
      ctx.save();
      ctx.translate(x, y);
      ctx.beginPath();
      addToPath(ctx, fontSize);
      if (patternTransform) {
        ctx.setTransform(...patternTransform);
      }
      if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
        ctx.fill();
      }
      if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
        ctx.stroke();
      }
      ctx.restore();
    } else {
      if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
        ctx.fillText(character, x, y);
      }
      if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
        ctx.strokeText(character, x, y);
      }
    }
    if (isAddToPathSet) {
      const paths = this.pendingTextPaths || (this.pendingTextPaths = []);
      paths.push({
        transform: getCurrentTransform(ctx),
        x,
        y,
        fontSize,
        addToPath
      });
    }
  }
  get isFontSubpixelAAEnabled() {
    const {
      context: ctx
    } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
    ctx.scale(1.5, 1);
    ctx.fillText("I", 0, 10);
    const data = ctx.getImageData(0, 0, 10, 10).data;
    let enabled = false;
    for (let i = 3; i < data.length; i += 4) {
      if (data[i] > 0 && data[i] < 255) {
        enabled = true;
        break;
      }
    }
    return shadow(this, "isFontSubpixelAAEnabled", enabled);
  }
  showText(glyphs) {
    const current = this.current;
    const font = current.font;
    if (font.isType3Font) {
      return this.showType3Text(glyphs);
    }
    const fontSize = current.fontSize;
    if (fontSize === 0) {
      return void 0;
    }
    const ctx = this.ctx;
    const fontSizeScale = current.fontSizeScale;
    const charSpacing = current.charSpacing;
    const wordSpacing = current.wordSpacing;
    const fontDirection = current.fontDirection;
    const textHScale = current.textHScale * fontDirection;
    const glyphsLength = glyphs.length;
    const vertical = font.vertical;
    const spacingDir = vertical ? 1 : -1;
    const defaultVMetrics = font.defaultVMetrics;
    const widthAdvanceScale = fontSize * current.fontMatrix[0];
    const simpleFillText = current.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
    ctx.save();
    ctx.transform(...current.textMatrix);
    ctx.translate(current.x, current.y + current.textRise);
    if (fontDirection > 0) {
      ctx.scale(textHScale, -1);
    } else {
      ctx.scale(textHScale, 1);
    }
    let patternTransform;
    if (current.patternFill) {
      ctx.save();
      const pattern = current.fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
      patternTransform = getCurrentTransform(ctx);
      ctx.restore();
      ctx.fillStyle = pattern;
    }
    let lineWidth = current.lineWidth;
    const scale = current.textMatrixScale;
    if (scale === 0 || lineWidth === 0) {
      const fillStrokeMode = current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
      if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
        lineWidth = this.getSinglePixelWidth();
      }
    } else {
      lineWidth /= scale;
    }
    if (fontSizeScale !== 1) {
      ctx.scale(fontSizeScale, fontSizeScale);
      lineWidth /= fontSizeScale;
    }
    ctx.lineWidth = lineWidth;
    if (font.isInvalidPDFjsFont) {
      const chars = [];
      let width = 0;
      for (const glyph of glyphs) {
        chars.push(glyph.unicode);
        width += glyph.width;
      }
      ctx.fillText(chars.join(""), 0, 0);
      current.x += width * widthAdvanceScale * textHScale;
      ctx.restore();
      this.compose();
      return void 0;
    }
    let x = 0, i;
    for (i = 0; i < glyphsLength; ++i) {
      const glyph = glyphs[i];
      if (typeof glyph === "number") {
        x += spacingDir * glyph * fontSize / 1e3;
        continue;
      }
      let restoreNeeded = false;
      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
      const character = glyph.fontChar;
      const accent = glyph.accent;
      let scaledX, scaledY;
      let width = glyph.width;
      if (vertical) {
        const vmetric = glyph.vmetric || defaultVMetrics;
        const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;
        const vy = vmetric[2] * widthAdvanceScale;
        width = vmetric ? -vmetric[0] : width;
        scaledX = vx / fontSizeScale;
        scaledY = (x + vy) / fontSizeScale;
      } else {
        scaledX = x / fontSizeScale;
        scaledY = 0;
      }
      if (font.remeasure && width > 0) {
        const measuredWidth = ctx.measureText(character).width * 1e3 / fontSize * fontSizeScale;
        if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
          const characterScaleX = width / measuredWidth;
          restoreNeeded = true;
          ctx.save();
          ctx.scale(characterScaleX, 1);
          scaledX /= characterScaleX;
        } else if (width !== measuredWidth) {
          scaledX += (width - measuredWidth) / 2e3 * fontSize / fontSizeScale;
        }
      }
      if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
        if (simpleFillText && !accent) {
          ctx.fillText(character, scaledX, scaledY);
        } else {
          this.paintChar(character, scaledX, scaledY, patternTransform);
          if (accent) {
            const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
            const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
            this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
          }
        }
      }
      const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
      x += charWidth;
      if (restoreNeeded) {
        ctx.restore();
      }
    }
    if (vertical) {
      current.y -= x;
    } else {
      current.x += x * textHScale;
    }
    ctx.restore();
    this.compose();
    return void 0;
  }
  showType3Text(glyphs) {
    const ctx = this.ctx;
    const current = this.current;
    const font = current.font;
    const fontSize = current.fontSize;
    const fontDirection = current.fontDirection;
    const spacingDir = font.vertical ? 1 : -1;
    const charSpacing = current.charSpacing;
    const wordSpacing = current.wordSpacing;
    const textHScale = current.textHScale * fontDirection;
    const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
    const glyphsLength = glyphs.length;
    const isTextInvisible = current.textRenderingMode === TextRenderingMode.INVISIBLE;
    let i, glyph, width, spacingLength;
    if (isTextInvisible || fontSize === 0) {
      return;
    }
    this._cachedScaleForStroking[0] = -1;
    this._cachedGetSinglePixelWidth = null;
    ctx.save();
    ctx.transform(...current.textMatrix);
    ctx.translate(current.x, current.y);
    ctx.scale(textHScale, fontDirection);
    for (i = 0; i < glyphsLength; ++i) {
      glyph = glyphs[i];
      if (typeof glyph === "number") {
        spacingLength = spacingDir * glyph * fontSize / 1e3;
        this.ctx.translate(spacingLength, 0);
        current.x += spacingLength * textHScale;
        continue;
      }
      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
      const operatorList = font.charProcOperatorList[glyph.operatorListId];
      if (!operatorList) {
        warn(`Type3 character "${glyph.operatorListId}" is not available.`);
        continue;
      }
      if (this.contentVisible) {
        this.processingType3 = glyph;
        this.save();
        ctx.scale(fontSize, fontSize);
        ctx.transform(...fontMatrix);
        this.executeOperatorList(operatorList);
        this.restore();
      }
      const transformed = Util.applyTransform([glyph.width, 0], fontMatrix);
      width = transformed[0] * fontSize + spacing;
      ctx.translate(width, 0);
      current.x += width * textHScale;
    }
    ctx.restore();
    this.processingType3 = null;
  }
  setCharWidth(xWidth, yWidth) {
  }
  setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
    this.ctx.rect(llx, lly, urx - llx, ury - lly);
    this.ctx.clip();
    this.endPath();
  }
  getColorN_Pattern(IR) {
    let pattern;
    if (IR[0] === "TilingPattern") {
      const color = IR[1];
      const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
      const canvasGraphicsFactory = {
        createCanvasGraphics: (ctx) => new _CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
          optionalContentConfig: this.optionalContentConfig,
          markedContentStack: this.markedContentStack
        })
      };
      pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
    } else {
      pattern = this._getPattern(IR[1], IR[2]);
    }
    return pattern;
  }
  setStrokeColorN() {
    this.current.strokeColor = this.getColorN_Pattern(arguments);
  }
  setFillColorN() {
    this.current.fillColor = this.getColorN_Pattern(arguments);
    this.current.patternFill = true;
  }
  setStrokeRGBColor(r, g, b) {
    this.ctx.strokeStyle = this.current.strokeColor = Util.makeHexColor(r, g, b);
  }
  setStrokeTransparent() {
    this.ctx.strokeStyle = this.current.strokeColor = "transparent";
  }
  setFillRGBColor(r, g, b) {
    this.ctx.fillStyle = this.current.fillColor = Util.makeHexColor(r, g, b);
    this.current.patternFill = false;
  }
  setFillTransparent() {
    this.ctx.fillStyle = this.current.fillColor = "transparent";
    this.current.patternFill = false;
  }
  _getPattern(objId, matrix2 = null) {
    let pattern;
    if (this.cachedPatterns.has(objId)) {
      pattern = this.cachedPatterns.get(objId);
    } else {
      pattern = getShadingPattern(this.getObject(objId));
      this.cachedPatterns.set(objId, pattern);
    }
    if (matrix2) {
      pattern.matrix = matrix2;
    }
    return pattern;
  }
  shadingFill(objId) {
    if (!this.contentVisible) {
      return;
    }
    const ctx = this.ctx;
    this.save();
    const pattern = this._getPattern(objId);
    ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING);
    const inv = getCurrentTransformInverse(ctx);
    if (inv) {
      const {
        width,
        height
      } = ctx.canvas;
      const [x0, y0, x1, y1] = Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
      this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
    } else {
      this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
    }
    this.compose(this.current.getClippedPathBoundingBox());
    this.restore();
  }
  beginInlineImage() {
    unreachable("Should not call beginInlineImage");
  }
  beginImageData() {
    unreachable("Should not call beginImageData");
  }
  paintFormXObjectBegin(matrix2, bbox) {
    if (!this.contentVisible) {
      return;
    }
    this.save();
    this.baseTransformStack.push(this.baseTransform);
    if (matrix2) {
      this.transform(...matrix2);
    }
    this.baseTransform = getCurrentTransform(this.ctx);
    if (bbox) {
      const width = bbox[2] - bbox[0];
      const height = bbox[3] - bbox[1];
      this.ctx.rect(bbox[0], bbox[1], width, height);
      this.current.updateRectMinMax(getCurrentTransform(this.ctx), bbox);
      this.clip();
      this.endPath();
    }
  }
  paintFormXObjectEnd() {
    if (!this.contentVisible) {
      return;
    }
    this.restore();
    this.baseTransform = this.baseTransformStack.pop();
  }
  beginGroup(group) {
    if (!this.contentVisible) {
      return;
    }
    this.save();
    if (this.inSMaskMode) {
      this.endSMaskMode();
      this.current.activeSMask = null;
    }
    const currentCtx = this.ctx;
    if (!group.isolated) {
      info("TODO: Support non-isolated groups.");
    }
    if (group.knockout) {
      warn("Knockout groups not supported.");
    }
    const currentTransform = getCurrentTransform(currentCtx);
    if (group.matrix) {
      currentCtx.transform(...group.matrix);
    }
    if (!group.bbox) {
      throw new Error("Bounding box is required.");
    }
    let bounds = Util.getAxialAlignedBoundingBox(group.bbox, getCurrentTransform(currentCtx));
    const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
    bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
    const offsetX = Math.floor(bounds[0]);
    const offsetY = Math.floor(bounds[1]);
    const drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
    const drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
    this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
    let cacheId = "groupAt" + this.groupLevel;
    if (group.smask) {
      cacheId += "_smask_" + this.smaskCounter++ % 2;
    }
    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
    const groupCtx = scratchCanvas.context;
    groupCtx.translate(-offsetX, -offsetY);
    groupCtx.transform(...currentTransform);
    if (group.smask) {
      this.smaskStack.push({
        canvas: scratchCanvas.canvas,
        context: groupCtx,
        offsetX,
        offsetY,
        subtype: group.smask.subtype,
        backdrop: group.smask.backdrop,
        transferMap: group.smask.transferMap || null,
        startTransformInverse: null
      });
    } else {
      currentCtx.setTransform(1, 0, 0, 1, 0, 0);
      currentCtx.translate(offsetX, offsetY);
      currentCtx.save();
    }
    copyCtxState(currentCtx, groupCtx);
    this.ctx = groupCtx;
    this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
    this.groupStack.push(currentCtx);
    this.groupLevel++;
  }
  endGroup(group) {
    if (!this.contentVisible) {
      return;
    }
    this.groupLevel--;
    const groupCtx = this.ctx;
    const ctx = this.groupStack.pop();
    this.ctx = ctx;
    this.ctx.imageSmoothingEnabled = false;
    if (group.smask) {
      this.tempSMask = this.smaskStack.pop();
      this.restore();
    } else {
      this.ctx.restore();
      const currentMtx = getCurrentTransform(this.ctx);
      this.restore();
      this.ctx.save();
      this.ctx.setTransform(...currentMtx);
      const dirtyBox = Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);
      this.ctx.drawImage(groupCtx.canvas, 0, 0);
      this.ctx.restore();
      this.compose(dirtyBox);
    }
  }
  beginAnnotation(id, rect, transform, matrix2, hasOwnCanvas) {
    __privateMethod(this, _restoreInitialState, restoreInitialState_fn).call(this);
    resetCtxToDefault(this.ctx);
    this.ctx.save();
    this.save();
    if (this.baseTransform) {
      this.ctx.setTransform(...this.baseTransform);
    }
    if (rect) {
      const width = rect[2] - rect[0];
      const height = rect[3] - rect[1];
      if (hasOwnCanvas && this.annotationCanvasMap) {
        transform = transform.slice();
        transform[4] -= rect[0];
        transform[5] -= rect[1];
        rect = rect.slice();
        rect[0] = rect[1] = 0;
        rect[2] = width;
        rect[3] = height;
        const [scaleX, scaleY] = Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx));
        const {
          viewportScale
        } = this;
        const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
        const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
        this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
        const {
          canvas,
          context
        } = this.annotationCanvas;
        this.annotationCanvasMap.set(id, canvas);
        this.annotationCanvas.savedCtx = this.ctx;
        this.ctx = context;
        this.ctx.save();
        this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
        resetCtxToDefault(this.ctx);
      } else {
        resetCtxToDefault(this.ctx);
        this.ctx.rect(rect[0], rect[1], width, height);
        this.ctx.clip();
        this.endPath();
      }
    }
    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
    this.transform(...transform);
    this.transform(...matrix2);
  }
  endAnnotation() {
    if (this.annotationCanvas) {
      this.ctx.restore();
      __privateMethod(this, _drawFilter, drawFilter_fn).call(this);
      this.ctx = this.annotationCanvas.savedCtx;
      delete this.annotationCanvas.savedCtx;
      delete this.annotationCanvas;
    }
  }
  paintImageMaskXObject(img) {
    if (!this.contentVisible) {
      return;
    }
    const count = img.count;
    img = this.getObject(img.data, img);
    img.count = count;
    const ctx = this.ctx;
    const glyph = this.processingType3;
    if (glyph) {
      if (glyph.compiled === void 0) {
        glyph.compiled = compileType3Glyph(img);
      }
      if (glyph.compiled) {
        glyph.compiled(ctx);
        return;
      }
    }
    const mask = this._createMaskCanvas(img);
    const maskCanvas = mask.canvas;
    ctx.save();
    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
    ctx.restore();
    this.compose();
  }
  paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
    if (!this.contentVisible) {
      return;
    }
    img = this.getObject(img.data, img);
    const ctx = this.ctx;
    ctx.save();
    const currentTransform = getCurrentTransform(ctx);
    ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
    const mask = this._createMaskCanvas(img);
    ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
    for (let i = 0, ii = positions.length; i < ii; i += 2) {
      const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
      const [x, y] = Util.applyTransform([0, 0], trans);
      ctx.drawImage(mask.canvas, x, y);
    }
    ctx.restore();
    this.compose();
  }
  paintImageMaskXObjectGroup(images) {
    if (!this.contentVisible) {
      return;
    }
    const ctx = this.ctx;
    const fillColor = this.current.fillColor;
    const isPatternFill = this.current.patternFill;
    for (const image of images) {
      const {
        data,
        width,
        height,
        transform
      } = image;
      const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
      const maskCtx = maskCanvas.context;
      maskCtx.save();
      const img = this.getObject(data, image);
      putBinaryImageMask(maskCtx, img);
      maskCtx.globalCompositeOperation = "source-in";
      maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL) : fillColor;
      maskCtx.fillRect(0, 0, width, height);
      maskCtx.restore();
      ctx.save();
      ctx.transform(...transform);
      ctx.scale(1, -1);
      drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
      ctx.restore();
    }
    this.compose();
  }
  paintImageXObject(objId) {
    if (!this.contentVisible) {
      return;
    }
    const imgData = this.getObject(objId);
    if (!imgData) {
      warn("Dependent image isn't ready yet");
      return;
    }
    this.paintInlineImageXObject(imgData);
  }
  paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
    if (!this.contentVisible) {
      return;
    }
    const imgData = this.getObject(objId);
    if (!imgData) {
      warn("Dependent image isn't ready yet");
      return;
    }
    const width = imgData.width;
    const height = imgData.height;
    const map = [];
    for (let i = 0, ii = positions.length; i < ii; i += 2) {
      map.push({
        transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
        x: 0,
        y: 0,
        w: width,
        h: height
      });
    }
    this.paintInlineImageXObjectGroup(imgData, map);
  }
  applyTransferMapsToCanvas(ctx) {
    if (this.current.transferMaps !== "none") {
      ctx.filter = this.current.transferMaps;
      ctx.drawImage(ctx.canvas, 0, 0);
      ctx.filter = "none";
    }
    return ctx.canvas;
  }
  applyTransferMapsToBitmap(imgData) {
    if (this.current.transferMaps === "none") {
      return imgData.bitmap;
    }
    const {
      bitmap,
      width,
      height
    } = imgData;
    const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
    const tmpCtx = tmpCanvas.context;
    tmpCtx.filter = this.current.transferMaps;
    tmpCtx.drawImage(bitmap, 0, 0);
    tmpCtx.filter = "none";
    return tmpCanvas.canvas;
  }
  paintInlineImageXObject(imgData) {
    if (!this.contentVisible) {
      return;
    }
    const width = imgData.width;
    const height = imgData.height;
    const ctx = this.ctx;
    this.save();
    if (!isNodeJS) {
      const {
        filter
      } = ctx;
      if (filter !== "none" && filter !== "") {
        ctx.filter = "none";
      }
    }
    ctx.scale(1 / width, -1 / height);
    let imgToPaint;
    if (imgData.bitmap) {
      imgToPaint = this.applyTransferMapsToBitmap(imgData);
    } else if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
      imgToPaint = imgData;
    } else {
      const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
      const tmpCtx = tmpCanvas.context;
      putBinaryImageData(tmpCtx, imgData);
      imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
    }
    const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
    ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
    drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
    this.compose();
    this.restore();
  }
  paintInlineImageXObjectGroup(imgData, map) {
    if (!this.contentVisible) {
      return;
    }
    const ctx = this.ctx;
    let imgToPaint;
    if (imgData.bitmap) {
      imgToPaint = imgData.bitmap;
    } else {
      const w = imgData.width;
      const h = imgData.height;
      const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
      const tmpCtx = tmpCanvas.context;
      putBinaryImageData(tmpCtx, imgData);
      imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
    }
    for (const entry of map) {
      ctx.save();
      ctx.transform(...entry.transform);
      ctx.scale(1, -1);
      drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
      ctx.restore();
    }
    this.compose();
  }
  paintSolidColorImageMask() {
    if (!this.contentVisible) {
      return;
    }
    this.ctx.fillRect(0, 0, 1, 1);
    this.compose();
  }
  markPoint(tag) {
  }
  markPointProps(tag, properties) {
  }
  beginMarkedContent(tag) {
    this.markedContentStack.push({
      visible: true
    });
  }
  beginMarkedContentProps(tag, properties) {
    if (tag === "OC") {
      this.markedContentStack.push({
        visible: this.optionalContentConfig.isVisible(properties)
      });
    } else {
      this.markedContentStack.push({
        visible: true
      });
    }
    this.contentVisible = this.isContentVisible();
  }
  endMarkedContent() {
    this.markedContentStack.pop();
    this.contentVisible = this.isContentVisible();
  }
  beginCompat() {
  }
  endCompat() {
  }
  consumePath(clipBox) {
    const isEmpty = this.current.isEmptyClip();
    if (this.pendingClip) {
      this.current.updateClipFromPath();
    }
    if (!this.pendingClip) {
      this.compose(clipBox);
    }
    const ctx = this.ctx;
    if (this.pendingClip) {
      if (!isEmpty) {
        if (this.pendingClip === EO_CLIP) {
          ctx.clip("evenodd");
        } else {
          ctx.clip();
        }
      }
      this.pendingClip = null;
    }
    this.current.startNewPathAndClipBox(this.current.clipBox);
    ctx.beginPath();
  }
  getSinglePixelWidth() {
    if (!this._cachedGetSinglePixelWidth) {
      const m = getCurrentTransform(this.ctx);
      if (m[1] === 0 && m[2] === 0) {
        this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
      } else {
        const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
        const normX = Math.hypot(m[0], m[2]);
        const normY = Math.hypot(m[1], m[3]);
        this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
      }
    }
    return this._cachedGetSinglePixelWidth;
  }
  getScaleForStroking() {
    if (this._cachedScaleForStroking[0] === -1) {
      const {
        lineWidth
      } = this.current;
      const {
        a,
        b,
        c,
        d
      } = this.ctx.getTransform();
      let scaleX, scaleY;
      if (b === 0 && c === 0) {
        const normX = Math.abs(a);
        const normY = Math.abs(d);
        if (normX === normY) {
          if (lineWidth === 0) {
            scaleX = scaleY = 1 / normX;
          } else {
            const scaledLineWidth = normX * lineWidth;
            scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
          }
        } else if (lineWidth === 0) {
          scaleX = 1 / normX;
          scaleY = 1 / normY;
        } else {
          const scaledXLineWidth = normX * lineWidth;
          const scaledYLineWidth = normY * lineWidth;
          scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
          scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
        }
      } else {
        const absDet = Math.abs(a * d - b * c);
        const normX = Math.hypot(a, b);
        const normY = Math.hypot(c, d);
        if (lineWidth === 0) {
          scaleX = normY / absDet;
          scaleY = normX / absDet;
        } else {
          const baseArea = lineWidth * absDet;
          scaleX = normY > baseArea ? normY / baseArea : 1;
          scaleY = normX > baseArea ? normX / baseArea : 1;
        }
      }
      this._cachedScaleForStroking[0] = scaleX;
      this._cachedScaleForStroking[1] = scaleY;
    }
    return this._cachedScaleForStroking;
  }
  rescaleAndStroke(saveRestore) {
    const {
      ctx
    } = this;
    const {
      lineWidth
    } = this.current;
    const [scaleX, scaleY] = this.getScaleForStroking();
    ctx.lineWidth = lineWidth || 1;
    if (scaleX === 1 && scaleY === 1) {
      ctx.stroke();
      return;
    }
    const dashes = ctx.getLineDash();
    if (saveRestore) {
      ctx.save();
    }
    ctx.scale(scaleX, scaleY);
    if (dashes.length > 0) {
      const scale = Math.max(scaleX, scaleY);
      ctx.setLineDash(dashes.map((x) => x / scale));
      ctx.lineDashOffset /= scale;
    }
    ctx.stroke();
    if (saveRestore) {
      ctx.restore();
    }
  }
  isContentVisible() {
    for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
      if (!this.markedContentStack[i].visible) {
        return false;
      }
    }
    return true;
  }
};
var CanvasGraphics = _CanvasGraphics;
_restoreInitialState = new WeakSet();
restoreInitialState_fn = function() {
  while (this.stateStack.length || this.inSMaskMode) {
    this.restore();
  }
  this.current.activeSMask = null;
  this.ctx.restore();
  if (this.transparentCanvas) {
    this.ctx = this.compositeCtx;
    this.ctx.save();
    this.ctx.setTransform(1, 0, 0, 1, 0, 0);
    this.ctx.drawImage(this.transparentCanvas, 0, 0);
    this.ctx.restore();
    this.transparentCanvas = null;
  }
};
_drawFilter = new WeakSet();
drawFilter_fn = function() {
  if (this.pageColors) {
    const hcmFilterId = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
    if (hcmFilterId !== "none") {
      const savedFilter = this.ctx.filter;
      this.ctx.filter = hcmFilterId;
      this.ctx.drawImage(this.ctx.canvas, 0, 0);
      this.ctx.filter = savedFilter;
    }
  }
};
for (const op in OPS) {
  if (CanvasGraphics.prototype[op] !== void 0) {
    CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
  }
}
var _port, _src;
var GlobalWorkerOptions = class {
  static get workerPort() {
    return __privateGet(this, _port);
  }
  static set workerPort(val) {
    if (!(typeof Worker !== "undefined" && val instanceof Worker) && val !== null) {
      throw new Error("Invalid `workerPort` type.");
    }
    __privateSet(this, _port, val);
  }
  static get workerSrc() {
    return __privateGet(this, _src);
  }
  static set workerSrc(val) {
    if (typeof val !== "string") {
      throw new Error("Invalid `workerSrc` type.");
    }
    __privateSet(this, _src, val);
  }
};
_port = new WeakMap();
_src = new WeakMap();
__privateAdd(GlobalWorkerOptions, _port, null);
__privateAdd(GlobalWorkerOptions, _src, "");
var CallbackKind = {
  UNKNOWN: 0,
  DATA: 1,
  ERROR: 2
};
var StreamKind = {
  UNKNOWN: 0,
  CANCEL: 1,
  CANCEL_COMPLETE: 2,
  CLOSE: 3,
  ENQUEUE: 4,
  ERROR: 5,
  PULL: 6,
  PULL_COMPLETE: 7,
  START_COMPLETE: 8
};
function wrapReason(reason) {
  if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
    unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  }
  switch (reason.name) {
    case "AbortException":
      return new AbortException(reason.message);
    case "MissingPDFException":
      return new MissingPDFException(reason.message);
    case "PasswordException":
      return new PasswordException(reason.message, reason.code);
    case "UnexpectedResponseException":
      return new UnexpectedResponseException(reason.message, reason.status);
    case "UnknownErrorException":
      return new UnknownErrorException(reason.message, reason.details);
    default:
      return new UnknownErrorException(reason.message, reason.toString());
  }
}
var _createStreamSink, createStreamSink_fn, _processStreamMessage, processStreamMessage_fn, _deleteStreamController, deleteStreamController_fn;
var MessageHandler = class {
  constructor(sourceName, targetName, comObj) {
    __privateAdd(this, _createStreamSink);
    __privateAdd(this, _processStreamMessage);
    __privateAdd(this, _deleteStreamController);
    this.sourceName = sourceName;
    this.targetName = targetName;
    this.comObj = comObj;
    this.callbackId = 1;
    this.streamId = 1;
    this.streamSinks = /* @__PURE__ */ Object.create(null);
    this.streamControllers = /* @__PURE__ */ Object.create(null);
    this.callbackCapabilities = /* @__PURE__ */ Object.create(null);
    this.actionHandler = /* @__PURE__ */ Object.create(null);
    this._onComObjOnMessage = (event) => {
      const data = event.data;
      if (data.targetName !== this.sourceName) {
        return;
      }
      if (data.stream) {
        __privateMethod(this, _processStreamMessage, processStreamMessage_fn).call(this, data);
        return;
      }
      if (data.callback) {
        const callbackId = data.callbackId;
        const capability = this.callbackCapabilities[callbackId];
        if (!capability) {
          throw new Error(`Cannot resolve callback ${callbackId}`);
        }
        delete this.callbackCapabilities[callbackId];
        if (data.callback === CallbackKind.DATA) {
          capability.resolve(data.data);
        } else if (data.callback === CallbackKind.ERROR) {
          capability.reject(wrapReason(data.reason));
        } else {
          throw new Error("Unexpected callback case");
        }
        return;
      }
      const action = this.actionHandler[data.action];
      if (!action) {
        throw new Error(`Unknown action from worker: ${data.action}`);
      }
      if (data.callbackId) {
        const cbSourceName = this.sourceName;
        const cbTargetName = data.sourceName;
        new Promise(function(resolve) {
          resolve(action(data.data));
        }).then(function(result) {
          comObj.postMessage({
            sourceName: cbSourceName,
            targetName: cbTargetName,
            callback: CallbackKind.DATA,
            callbackId: data.callbackId,
            data: result
          });
        }, function(reason) {
          comObj.postMessage({
            sourceName: cbSourceName,
            targetName: cbTargetName,
            callback: CallbackKind.ERROR,
            callbackId: data.callbackId,
            reason: wrapReason(reason)
          });
        });
        return;
      }
      if (data.streamId) {
        __privateMethod(this, _createStreamSink, createStreamSink_fn).call(this, data);
        return;
      }
      action(data.data);
    };
    comObj.addEventListener("message", this._onComObjOnMessage);
  }
  on(actionName, handler) {
    const ah = this.actionHandler;
    if (ah[actionName]) {
      throw new Error(`There is already an actionName called "${actionName}"`);
    }
    ah[actionName] = handler;
  }
  send(actionName, data, transfers) {
    this.comObj.postMessage({
      sourceName: this.sourceName,
      targetName: this.targetName,
      action: actionName,
      data
    }, transfers);
  }
  sendWithPromise(actionName, data, transfers) {
    const callbackId = this.callbackId++;
    const capability = Promise.withResolvers();
    this.callbackCapabilities[callbackId] = capability;
    try {
      this.comObj.postMessage({
        sourceName: this.sourceName,
        targetName: this.targetName,
        action: actionName,
        callbackId,
        data
      }, transfers);
    } catch (ex) {
      capability.reject(ex);
    }
    return capability.promise;
  }
  sendWithStream(actionName, data, queueingStrategy, transfers) {
    const streamId = this.streamId++, sourceName = this.sourceName, targetName = this.targetName, comObj = this.comObj;
    return new ReadableStream({
      start: (controller) => {
        const startCapability = Promise.withResolvers();
        this.streamControllers[streamId] = {
          controller,
          startCall: startCapability,
          pullCall: null,
          cancelCall: null,
          isClosed: false
        };
        comObj.postMessage({
          sourceName,
          targetName,
          action: actionName,
          streamId,
          data,
          desiredSize: controller.desiredSize
        }, transfers);
        return startCapability.promise;
      },
      pull: (controller) => {
        const pullCapability = Promise.withResolvers();
        this.streamControllers[streamId].pullCall = pullCapability;
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.PULL,
          streamId,
          desiredSize: controller.desiredSize
        });
        return pullCapability.promise;
      },
      cancel: (reason) => {
        assert(reason instanceof Error, "cancel must have a valid reason");
        const cancelCapability = Promise.withResolvers();
        this.streamControllers[streamId].cancelCall = cancelCapability;
        this.streamControllers[streamId].isClosed = true;
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.CANCEL,
          streamId,
          reason: wrapReason(reason)
        });
        return cancelCapability.promise;
      }
    }, queueingStrategy);
  }
  destroy() {
    this.comObj.removeEventListener("message", this._onComObjOnMessage);
  }
};
_createStreamSink = new WeakSet();
createStreamSink_fn = function(data) {
  const streamId = data.streamId, sourceName = this.sourceName, targetName = data.sourceName, comObj = this.comObj;
  const self = this, action = this.actionHandler[data.action];
  const streamSink = {
    enqueue(chunk, size = 1, transfers) {
      if (this.isCancelled) {
        return;
      }
      const lastDesiredSize = this.desiredSize;
      this.desiredSize -= size;
      if (lastDesiredSize > 0 && this.desiredSize <= 0) {
        this.sinkCapability = Promise.withResolvers();
        this.ready = this.sinkCapability.promise;
      }
      comObj.postMessage({
        sourceName,
        targetName,
        stream: StreamKind.ENQUEUE,
        streamId,
        chunk
      }, transfers);
    },
    close() {
      if (this.isCancelled) {
        return;
      }
      this.isCancelled = true;
      comObj.postMessage({
        sourceName,
        targetName,
        stream: StreamKind.CLOSE,
        streamId
      });
      delete self.streamSinks[streamId];
    },
    error(reason) {
      assert(reason instanceof Error, "error must have a valid reason");
      if (this.isCancelled) {
        return;
      }
      this.isCancelled = true;
      comObj.postMessage({
        sourceName,
        targetName,
        stream: StreamKind.ERROR,
        streamId,
        reason: wrapReason(reason)
      });
    },
    sinkCapability: Promise.withResolvers(),
    onPull: null,
    onCancel: null,
    isCancelled: false,
    desiredSize: data.desiredSize,
    ready: null
  };
  streamSink.sinkCapability.resolve();
  streamSink.ready = streamSink.sinkCapability.promise;
  this.streamSinks[streamId] = streamSink;
  new Promise(function(resolve) {
    resolve(action(data.data, streamSink));
  }).then(function() {
    comObj.postMessage({
      sourceName,
      targetName,
      stream: StreamKind.START_COMPLETE,
      streamId,
      success: true
    });
  }, function(reason) {
    comObj.postMessage({
      sourceName,
      targetName,
      stream: StreamKind.START_COMPLETE,
      streamId,
      reason: wrapReason(reason)
    });
  });
};
_processStreamMessage = new WeakSet();
processStreamMessage_fn = function(data) {
  const streamId = data.streamId, sourceName = this.sourceName, targetName = data.sourceName, comObj = this.comObj;
  const streamController = this.streamControllers[streamId], streamSink = this.streamSinks[streamId];
  switch (data.stream) {
    case StreamKind.START_COMPLETE:
      if (data.success) {
        streamController.startCall.resolve();
      } else {
        streamController.startCall.reject(wrapReason(data.reason));
      }
      break;
    case StreamKind.PULL_COMPLETE:
      if (data.success) {
        streamController.pullCall.resolve();
      } else {
        streamController.pullCall.reject(wrapReason(data.reason));
      }
      break;
    case StreamKind.PULL:
      if (!streamSink) {
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.PULL_COMPLETE,
          streamId,
          success: true
        });
        break;
      }
      if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
        streamSink.sinkCapability.resolve();
      }
      streamSink.desiredSize = data.desiredSize;
      new Promise(function(resolve) {
        var _a2;
        resolve((_a2 = streamSink.onPull) == null ? void 0 : _a2.call(streamSink));
      }).then(function() {
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.PULL_COMPLETE,
          streamId,
          success: true
        });
      }, function(reason) {
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.PULL_COMPLETE,
          streamId,
          reason: wrapReason(reason)
        });
      });
      break;
    case StreamKind.ENQUEUE:
      assert(streamController, "enqueue should have stream controller");
      if (streamController.isClosed) {
        break;
      }
      streamController.controller.enqueue(data.chunk);
      break;
    case StreamKind.CLOSE:
      assert(streamController, "close should have stream controller");
      if (streamController.isClosed) {
        break;
      }
      streamController.isClosed = true;
      streamController.controller.close();
      __privateMethod(this, _deleteStreamController, deleteStreamController_fn).call(this, streamController, streamId);
      break;
    case StreamKind.ERROR:
      assert(streamController, "error should have stream controller");
      streamController.controller.error(wrapReason(data.reason));
      __privateMethod(this, _deleteStreamController, deleteStreamController_fn).call(this, streamController, streamId);
      break;
    case StreamKind.CANCEL_COMPLETE:
      if (data.success) {
        streamController.cancelCall.resolve();
      } else {
        streamController.cancelCall.reject(wrapReason(data.reason));
      }
      __privateMethod(this, _deleteStreamController, deleteStreamController_fn).call(this, streamController, streamId);
      break;
    case StreamKind.CANCEL:
      if (!streamSink) {
        break;
      }
      new Promise(function(resolve) {
        var _a2;
        resolve((_a2 = streamSink.onCancel) == null ? void 0 : _a2.call(streamSink, wrapReason(data.reason)));
      }).then(function() {
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.CANCEL_COMPLETE,
          streamId,
          success: true
        });
      }, function(reason) {
        comObj.postMessage({
          sourceName,
          targetName,
          stream: StreamKind.CANCEL_COMPLETE,
          streamId,
          reason: wrapReason(reason)
        });
      });
      streamSink.sinkCapability.reject(wrapReason(data.reason));
      streamSink.isCancelled = true;
      delete this.streamSinks[streamId];
      break;
    default:
      throw new Error("Unexpected stream case");
  }
};
_deleteStreamController = new WeakSet();
deleteStreamController_fn = async function(streamController, streamId) {
  var _a2, _b, _c;
  await Promise.allSettled([(_a2 = streamController.startCall) == null ? void 0 : _a2.promise, (_b = streamController.pullCall) == null ? void 0 : _b.promise, (_c = streamController.cancelCall) == null ? void 0 : _c.promise]);
  delete this.streamControllers[streamId];
};
var _metadataMap, _data;
var Metadata = class {
  constructor({
    parsedData,
    rawData
  }) {
    __privateAdd(this, _metadataMap, void 0);
    __privateAdd(this, _data, void 0);
    __privateSet(this, _metadataMap, parsedData);
    __privateSet(this, _data, rawData);
  }
  getRaw() {
    return __privateGet(this, _data);
  }
  get(name) {
    var _a2;
    return (_a2 = __privateGet(this, _metadataMap).get(name)) != null ? _a2 : null;
  }
  getAll() {
    return objectFromMap(__privateGet(this, _metadataMap));
  }
  has(name) {
    return __privateGet(this, _metadataMap).has(name);
  }
};
_metadataMap = new WeakMap();
_data = new WeakMap();
var INTERNAL = Symbol("INTERNAL");
var _isDisplay, _isPrint, _userSet, _visible;
var OptionalContentGroup = class {
  constructor(renderingIntent, {
    name,
    intent,
    usage
  }) {
    __privateAdd(this, _isDisplay, false);
    __privateAdd(this, _isPrint, false);
    __privateAdd(this, _userSet, false);
    __privateAdd(this, _visible, true);
    __privateSet(this, _isDisplay, !!(renderingIntent & RenderingIntentFlag.DISPLAY));
    __privateSet(this, _isPrint, !!(renderingIntent & RenderingIntentFlag.PRINT));
    this.name = name;
    this.intent = intent;
    this.usage = usage;
  }
  get visible() {
    if (__privateGet(this, _userSet)) {
      return __privateGet(this, _visible);
    }
    if (!__privateGet(this, _visible)) {
      return false;
    }
    const {
      print,
      view
    } = this.usage;
    if (__privateGet(this, _isDisplay)) {
      return (view == null ? void 0 : view.viewState) !== "OFF";
    } else if (__privateGet(this, _isPrint)) {
      return (print == null ? void 0 : print.printState) !== "OFF";
    }
    return true;
  }
  _setVisible(internal, visible, userSet = false) {
    if (internal !== INTERNAL) {
      unreachable("Internal method `_setVisible` called.");
    }
    __privateSet(this, _userSet, userSet);
    __privateSet(this, _visible, visible);
  }
};
_isDisplay = new WeakMap();
_isPrint = new WeakMap();
_userSet = new WeakMap();
_visible = new WeakMap();
var _cachedGetHash, _groups, _initialHash, _order, _evaluateVisibilityExpression, evaluateVisibilityExpression_fn;
var OptionalContentConfig = class {
  constructor(data, renderingIntent = RenderingIntentFlag.DISPLAY) {
    __privateAdd(this, _evaluateVisibilityExpression);
    __privateAdd(this, _cachedGetHash, null);
    __privateAdd(this, _groups, /* @__PURE__ */ new Map());
    __privateAdd(this, _initialHash, null);
    __privateAdd(this, _order, null);
    this.renderingIntent = renderingIntent;
    this.name = null;
    this.creator = null;
    if (data === null) {
      return;
    }
    this.name = data.name;
    this.creator = data.creator;
    __privateSet(this, _order, data.order);
    for (const group of data.groups) {
      __privateGet(this, _groups).set(group.id, new OptionalContentGroup(renderingIntent, group));
    }
    if (data.baseState === "OFF") {
      for (const group of __privateGet(this, _groups).values()) {
        group._setVisible(INTERNAL, false);
      }
    }
    for (const on2 of data.on) {
      __privateGet(this, _groups).get(on2)._setVisible(INTERNAL, true);
    }
    for (const off2 of data.off) {
      __privateGet(this, _groups).get(off2)._setVisible(INTERNAL, false);
    }
    __privateSet(this, _initialHash, this.getHash());
  }
  isVisible(group) {
    if (__privateGet(this, _groups).size === 0) {
      return true;
    }
    if (!group) {
      info("Optional content group not defined.");
      return true;
    }
    if (group.type === "OCG") {
      if (!__privateGet(this, _groups).has(group.id)) {
        warn(`Optional content group not found: ${group.id}`);
        return true;
      }
      return __privateGet(this, _groups).get(group.id).visible;
    } else if (group.type === "OCMD") {
      if (group.expression) {
        return __privateMethod(this, _evaluateVisibilityExpression, evaluateVisibilityExpression_fn).call(this, group.expression);
      }
      if (!group.policy || group.policy === "AnyOn") {
        for (const id of group.ids) {
          if (!__privateGet(this, _groups).has(id)) {
            warn(`Optional content group not found: ${id}`);
            return true;
          }
          if (__privateGet(this, _groups).get(id).visible) {
            return true;
          }
        }
        return false;
      } else if (group.policy === "AllOn") {
        for (const id of group.ids) {
          if (!__privateGet(this, _groups).has(id)) {
            warn(`Optional content group not found: ${id}`);
            return true;
          }
          if (!__privateGet(this, _groups).get(id).visible) {
            return false;
          }
        }
        return true;
      } else if (group.policy === "AnyOff") {
        for (const id of group.ids) {
          if (!__privateGet(this, _groups).has(id)) {
            warn(`Optional content group not found: ${id}`);
            return true;
          }
          if (!__privateGet(this, _groups).get(id).visible) {
            return true;
          }
        }
        return false;
      } else if (group.policy === "AllOff") {
        for (const id of group.ids) {
          if (!__privateGet(this, _groups).has(id)) {
            warn(`Optional content group not found: ${id}`);
            return true;
          }
          if (__privateGet(this, _groups).get(id).visible) {
            return false;
          }
        }
        return true;
      }
      warn(`Unknown optional content policy ${group.policy}.`);
      return true;
    }
    warn(`Unknown group type ${group.type}.`);
    return true;
  }
  setVisibility(id, visible = true) {
    const group = __privateGet(this, _groups).get(id);
    if (!group) {
      warn(`Optional content group not found: ${id}`);
      return;
    }
    group._setVisible(INTERNAL, !!visible, true);
    __privateSet(this, _cachedGetHash, null);
  }
  setOCGState({
    state,
    preserveRB
  }) {
    let operator;
    for (const elem of state) {
      switch (elem) {
        case "ON":
        case "OFF":
        case "Toggle":
          operator = elem;
          continue;
      }
      const group = __privateGet(this, _groups).get(elem);
      if (!group) {
        continue;
      }
      switch (operator) {
        case "ON":
          group._setVisible(INTERNAL, true);
          break;
        case "OFF":
          group._setVisible(INTERNAL, false);
          break;
        case "Toggle":
          group._setVisible(INTERNAL, !group.visible);
          break;
      }
    }
    __privateSet(this, _cachedGetHash, null);
  }
  get hasInitialVisibility() {
    return __privateGet(this, _initialHash) === null || this.getHash() === __privateGet(this, _initialHash);
  }
  getOrder() {
    if (!__privateGet(this, _groups).size) {
      return null;
    }
    if (__privateGet(this, _order)) {
      return __privateGet(this, _order).slice();
    }
    return [...__privateGet(this, _groups).keys()];
  }
  getGroups() {
    return __privateGet(this, _groups).size > 0 ? objectFromMap(__privateGet(this, _groups)) : null;
  }
  getGroup(id) {
    return __privateGet(this, _groups).get(id) || null;
  }
  getHash() {
    if (__privateGet(this, _cachedGetHash) !== null) {
      return __privateGet(this, _cachedGetHash);
    }
    const hash = new MurmurHash3_64();
    for (const [id, group] of __privateGet(this, _groups)) {
      hash.update(`${id}:${group.visible}`);
    }
    return __privateSet(this, _cachedGetHash, hash.hexdigest());
  }
};
_cachedGetHash = new WeakMap();
_groups = new WeakMap();
_initialHash = new WeakMap();
_order = new WeakMap();
_evaluateVisibilityExpression = new WeakSet();
evaluateVisibilityExpression_fn = function(array) {
  const length = array.length;
  if (length < 2) {
    return true;
  }
  const operator = array[0];
  for (let i = 1; i < length; i++) {
    const element2 = array[i];
    let state;
    if (Array.isArray(element2)) {
      state = __privateMethod(this, _evaluateVisibilityExpression, evaluateVisibilityExpression_fn).call(this, element2);
    } else if (__privateGet(this, _groups).has(element2)) {
      state = __privateGet(this, _groups).get(element2).visible;
    } else {
      warn(`Optional content group not found: ${element2}`);
      return true;
    }
    switch (operator) {
      case "And":
        if (!state) {
          return false;
        }
        break;
      case "Or":
        if (state) {
          return true;
        }
        break;
      case "Not":
        return !state;
      default:
        return true;
    }
  }
  return operator === "And";
};
var PDFDataTransportStream = class {
  constructor(pdfDataRangeTransport, {
    disableRange = false,
    disableStream = false
  }) {
    assert(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
    const {
      length,
      initialData,
      progressiveDone,
      contentDispositionFilename
    } = pdfDataRangeTransport;
    this._queuedChunks = [];
    this._progressiveDone = progressiveDone;
    this._contentDispositionFilename = contentDispositionFilename;
    if ((initialData == null ? void 0 : initialData.length) > 0) {
      const buffer = initialData instanceof Uint8Array && initialData.byteLength === initialData.buffer.byteLength ? initialData.buffer : new Uint8Array(initialData).buffer;
      this._queuedChunks.push(buffer);
    }
    this._pdfDataRangeTransport = pdfDataRangeTransport;
    this._isStreamingSupported = !disableStream;
    this._isRangeSupported = !disableRange;
    this._contentLength = length;
    this._fullRequestReader = null;
    this._rangeReaders = [];
    pdfDataRangeTransport.addRangeListener((begin, chunk) => {
      this._onReceiveData({
        begin,
        chunk
      });
    });
    pdfDataRangeTransport.addProgressListener((loaded, total) => {
      this._onProgress({
        loaded,
        total
      });
    });
    pdfDataRangeTransport.addProgressiveReadListener((chunk) => {
      this._onReceiveData({
        chunk
      });
    });
    pdfDataRangeTransport.addProgressiveDoneListener(() => {
      this._onProgressiveDone();
    });
    pdfDataRangeTransport.transportReady();
  }
  _onReceiveData({
    begin,
    chunk
  }) {
    const buffer = chunk instanceof Uint8Array && chunk.byteLength === chunk.buffer.byteLength ? chunk.buffer : new Uint8Array(chunk).buffer;
    if (begin === void 0) {
      if (this._fullRequestReader) {
        this._fullRequestReader._enqueue(buffer);
      } else {
        this._queuedChunks.push(buffer);
      }
    } else {
      const found = this._rangeReaders.some(function(rangeReader) {
        if (rangeReader._begin !== begin) {
          return false;
        }
        rangeReader._enqueue(buffer);
        return true;
      });
      assert(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
    }
  }
  get _progressiveDataLength() {
    var _a2, _b;
    return (_b = (_a2 = this._fullRequestReader) == null ? void 0 : _a2._loaded) != null ? _b : 0;
  }
  _onProgress(evt) {
    var _a2, _b, _c, _d;
    if (evt.total === void 0) {
      (_b = (_a2 = this._rangeReaders[0]) == null ? void 0 : _a2.onProgress) == null ? void 0 : _b.call(_a2, {
        loaded: evt.loaded
      });
    } else {
      (_d = (_c = this._fullRequestReader) == null ? void 0 : _c.onProgress) == null ? void 0 : _d.call(_c, {
        loaded: evt.loaded,
        total: evt.total
      });
    }
  }
  _onProgressiveDone() {
    var _a2;
    (_a2 = this._fullRequestReader) == null ? void 0 : _a2.progressiveDone();
    this._progressiveDone = true;
  }
  _removeRangeReader(reader) {
    const i = this._rangeReaders.indexOf(reader);
    if (i >= 0) {
      this._rangeReaders.splice(i, 1);
    }
  }
  getFullReader() {
    assert(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
    const queuedChunks = this._queuedChunks;
    this._queuedChunks = null;
    return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename);
  }
  getRangeReader(begin, end) {
    if (end <= this._progressiveDataLength) {
      return null;
    }
    const reader = new PDFDataTransportStreamRangeReader(this, begin, end);
    this._pdfDataRangeTransport.requestDataRange(begin, end);
    this._rangeReaders.push(reader);
    return reader;
  }
  cancelAllRequests(reason) {
    var _a2;
    (_a2 = this._fullRequestReader) == null ? void 0 : _a2.cancel(reason);
    for (const reader of this._rangeReaders.slice(0)) {
      reader.cancel(reason);
    }
    this._pdfDataRangeTransport.abort();
  }
};
var PDFDataTransportStreamReader = class {
  constructor(stream, queuedChunks, progressiveDone = false, contentDispositionFilename = null) {
    this._stream = stream;
    this._done = progressiveDone || false;
    this._filename = isPdfFile(contentDispositionFilename) ? contentDispositionFilename : null;
    this._queuedChunks = queuedChunks || [];
    this._loaded = 0;
    for (const chunk of this._queuedChunks) {
      this._loaded += chunk.byteLength;
    }
    this._requests = [];
    this._headersReady = Promise.resolve();
    stream._fullRequestReader = this;
    this.onProgress = null;
  }
  _enqueue(chunk) {
    if (this._done) {
      return;
    }
    if (this._requests.length > 0) {
      const requestCapability = this._requests.shift();
      requestCapability.resolve({
        value: chunk,
        done: false
      });
    } else {
      this._queuedChunks.push(chunk);
    }
    this._loaded += chunk.byteLength;
  }
  get headersReady() {
    return this._headersReady;
  }
  get filename() {
    return this._filename;
  }
  get isRangeSupported() {
    return this._stream._isRangeSupported;
  }
  get isStreamingSupported() {
    return this._stream._isStreamingSupported;
  }
  get contentLength() {
    return this._stream._contentLength;
  }
  async read() {
    if (this._queuedChunks.length > 0) {
      const chunk = this._queuedChunks.shift();
      return {
        value: chunk,
        done: false
      };
    }
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    const requestCapability = Promise.withResolvers();
    this._requests.push(requestCapability);
    return requestCapability.promise;
  }
  cancel(reason) {
    this._done = true;
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
  }
  progressiveDone() {
    if (this._done) {
      return;
    }
    this._done = true;
  }
};
var PDFDataTransportStreamRangeReader = class {
  constructor(stream, begin, end) {
    this._stream = stream;
    this._begin = begin;
    this._end = end;
    this._queuedChunk = null;
    this._requests = [];
    this._done = false;
    this.onProgress = null;
  }
  _enqueue(chunk) {
    if (this._done) {
      return;
    }
    if (this._requests.length === 0) {
      this._queuedChunk = chunk;
    } else {
      const requestsCapability = this._requests.shift();
      requestsCapability.resolve({
        value: chunk,
        done: false
      });
      for (const requestCapability of this._requests) {
        requestCapability.resolve({
          value: void 0,
          done: true
        });
      }
      this._requests.length = 0;
    }
    this._done = true;
    this._stream._removeRangeReader(this);
  }
  get isStreamingSupported() {
    return false;
  }
  async read() {
    if (this._queuedChunk) {
      const chunk = this._queuedChunk;
      this._queuedChunk = null;
      return {
        value: chunk,
        done: false
      };
    }
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    const requestCapability = Promise.withResolvers();
    this._requests.push(requestCapability);
    return requestCapability.promise;
  }
  cancel(reason) {
    this._done = true;
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
    this._stream._removeRangeReader(this);
  }
};
function getFilenameFromContentDispositionHeader(contentDisposition) {
  let needsEncodingFixup = true;
  let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
  if (tmp) {
    tmp = tmp[1];
    let filename = rfc2616unquote(tmp);
    filename = unescape(filename);
    filename = rfc5987decode(filename);
    filename = rfc2047decode(filename);
    return fixupEncoding(filename);
  }
  tmp = rfc2231getparam(contentDisposition);
  if (tmp) {
    const filename = rfc2047decode(tmp);
    return fixupEncoding(filename);
  }
  tmp = toParamRegExp("filename", "i").exec(contentDisposition);
  if (tmp) {
    tmp = tmp[1];
    let filename = rfc2616unquote(tmp);
    filename = rfc2047decode(filename);
    return fixupEncoding(filename);
  }
  function toParamRegExp(attributePattern, flags) {
    return new RegExp("(?:^|;)\\s*" + attributePattern + '\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)', flags);
  }
  function textdecode(encoding, value) {
    if (encoding) {
      if (!/^[\x00-\xFF]+$/.test(value)) {
        return value;
      }
      try {
        const decoder = new TextDecoder(encoding, {
          fatal: true
        });
        const buffer = stringToBytes(value);
        value = decoder.decode(buffer);
        needsEncodingFixup = false;
      } catch (e) {
      }
    }
    return value;
  }
  function fixupEncoding(value) {
    if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
      value = textdecode("utf-8", value);
      if (needsEncodingFixup) {
        value = textdecode("iso-8859-1", value);
      }
    }
    return value;
  }
  function rfc2231getparam(contentDispositionStr) {
    const matches2 = [];
    let match;
    const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
    while ((match = iter.exec(contentDispositionStr)) !== null) {
      let [, n, quot, part] = match;
      n = parseInt(n, 10);
      if (n in matches2) {
        if (n === 0) {
          break;
        }
        continue;
      }
      matches2[n] = [quot, part];
    }
    const parts = [];
    for (let n = 0; n < matches2.length; ++n) {
      if (!(n in matches2)) {
        break;
      }
      let [quot, part] = matches2[n];
      part = rfc2616unquote(part);
      if (quot) {
        part = unescape(part);
        if (n === 0) {
          part = rfc5987decode(part);
        }
      }
      parts.push(part);
    }
    return parts.join("");
  }
  function rfc2616unquote(value) {
    if (value.startsWith('"')) {
      const parts = value.slice(1).split('\\"');
      for (let i = 0; i < parts.length; ++i) {
        const quotindex = parts[i].indexOf('"');
        if (quotindex !== -1) {
          parts[i] = parts[i].slice(0, quotindex);
          parts.length = i + 1;
        }
        parts[i] = parts[i].replaceAll(/\\(.)/g, "$1");
      }
      value = parts.join('"');
    }
    return value;
  }
  function rfc5987decode(extvalue) {
    const encodingend = extvalue.indexOf("'");
    if (encodingend === -1) {
      return extvalue;
    }
    const encoding = extvalue.slice(0, encodingend);
    const langvalue = extvalue.slice(encodingend + 1);
    const value = langvalue.replace(/^[^']*'/, "");
    return textdecode(encoding, value);
  }
  function rfc2047decode(value) {
    if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
      return value;
    }
    return value.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function(matches2, charset, encoding, text2) {
      if (encoding === "q" || encoding === "Q") {
        text2 = text2.replaceAll("_", " ");
        text2 = text2.replaceAll(/=([0-9a-fA-F]{2})/g, function(match, hex) {
          return String.fromCharCode(parseInt(hex, 16));
        });
        return textdecode(charset, text2);
      }
      try {
        text2 = atob(text2);
      } catch (e) {
      }
      return textdecode(charset, text2);
    });
  }
  return "";
}
function validateRangeRequestCapabilities({
  getResponseHeader,
  isHttp,
  rangeChunkSize,
  disableRange
}) {
  const returnValues = {
    allowRangeRequests: false,
    suggestedLength: void 0
  };
  const length = parseInt(getResponseHeader("Content-Length"), 10);
  if (!Number.isInteger(length)) {
    return returnValues;
  }
  returnValues.suggestedLength = length;
  if (length <= 2 * rangeChunkSize) {
    return returnValues;
  }
  if (disableRange || !isHttp) {
    return returnValues;
  }
  if (getResponseHeader("Accept-Ranges") !== "bytes") {
    return returnValues;
  }
  const contentEncoding = getResponseHeader("Content-Encoding") || "identity";
  if (contentEncoding !== "identity") {
    return returnValues;
  }
  returnValues.allowRangeRequests = true;
  return returnValues;
}
function extractFilenameFromHeader(getResponseHeader) {
  const contentDisposition = getResponseHeader("Content-Disposition");
  if (contentDisposition) {
    let filename = getFilenameFromContentDispositionHeader(contentDisposition);
    if (filename.includes("%")) {
      try {
        filename = decodeURIComponent(filename);
      } catch (e) {
      }
    }
    if (isPdfFile(filename)) {
      return filename;
    }
  }
  return null;
}
function createResponseStatusError(status, url) {
  if (status === 404 || status === 0 && url.startsWith("file:")) {
    return new MissingPDFException('Missing PDF "' + url + '".');
  }
  return new UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF "${url}".`, status);
}
function validateResponseStatus(status) {
  return status === 200 || status === 206;
}
function createFetchOptions(headers, withCredentials, abortController) {
  return {
    method: "GET",
    headers,
    signal: abortController.signal,
    mode: "cors",
    credentials: withCredentials ? "include" : "same-origin",
    redirect: "follow"
  };
}
function createHeaders(httpHeaders) {
  const headers = new Headers();
  for (const property in httpHeaders) {
    const value = httpHeaders[property];
    if (value === void 0) {
      continue;
    }
    headers.append(property, value);
  }
  return headers;
}
function getArrayBuffer(val) {
  if (val instanceof Uint8Array) {
    return val.buffer;
  }
  if (val instanceof ArrayBuffer) {
    return val;
  }
  warn(`getArrayBuffer - unexpected data format: ${val}`);
  return new Uint8Array(val).buffer;
}
var PDFFetchStream = class {
  constructor(source) {
    this.source = source;
    this.isHttp = /^https?:/i.test(source.url);
    this.httpHeaders = this.isHttp && source.httpHeaders || {};
    this._fullRequestReader = null;
    this._rangeRequestReaders = [];
  }
  get _progressiveDataLength() {
    var _a2, _b;
    return (_b = (_a2 = this._fullRequestReader) == null ? void 0 : _a2._loaded) != null ? _b : 0;
  }
  getFullReader() {
    assert(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
    this._fullRequestReader = new PDFFetchStreamReader(this);
    return this._fullRequestReader;
  }
  getRangeReader(begin, end) {
    if (end <= this._progressiveDataLength) {
      return null;
    }
    const reader = new PDFFetchStreamRangeReader(this, begin, end);
    this._rangeRequestReaders.push(reader);
    return reader;
  }
  cancelAllRequests(reason) {
    var _a2;
    (_a2 = this._fullRequestReader) == null ? void 0 : _a2.cancel(reason);
    for (const reader of this._rangeRequestReaders.slice(0)) {
      reader.cancel(reason);
    }
  }
};
var PDFFetchStreamReader = class {
  constructor(stream) {
    this._stream = stream;
    this._reader = null;
    this._loaded = 0;
    this._filename = null;
    const source = stream.source;
    this._withCredentials = source.withCredentials || false;
    this._contentLength = source.length;
    this._headersCapability = Promise.withResolvers();
    this._disableRange = source.disableRange || false;
    this._rangeChunkSize = source.rangeChunkSize;
    if (!this._rangeChunkSize && !this._disableRange) {
      this._disableRange = true;
    }
    this._abortController = new AbortController();
    this._isStreamingSupported = !source.disableStream;
    this._isRangeSupported = !source.disableRange;
    this._headers = createHeaders(this._stream.httpHeaders);
    const url = source.url;
    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then((response) => {
      if (!validateResponseStatus(response.status)) {
        throw createResponseStatusError(response.status, url);
      }
      this._reader = response.body.getReader();
      this._headersCapability.resolve();
      const getResponseHeader = (name) => response.headers.get(name);
      const {
        allowRangeRequests,
        suggestedLength
      } = validateRangeRequestCapabilities({
        getResponseHeader,
        isHttp: this._stream.isHttp,
        rangeChunkSize: this._rangeChunkSize,
        disableRange: this._disableRange
      });
      this._isRangeSupported = allowRangeRequests;
      this._contentLength = suggestedLength || this._contentLength;
      this._filename = extractFilenameFromHeader(getResponseHeader);
      if (!this._isStreamingSupported && this._isRangeSupported) {
        this.cancel(new AbortException("Streaming is disabled."));
      }
    }).catch(this._headersCapability.reject);
    this.onProgress = null;
  }
  get headersReady() {
    return this._headersCapability.promise;
  }
  get filename() {
    return this._filename;
  }
  get contentLength() {
    return this._contentLength;
  }
  get isRangeSupported() {
    return this._isRangeSupported;
  }
  get isStreamingSupported() {
    return this._isStreamingSupported;
  }
  async read() {
    var _a2;
    await this._headersCapability.promise;
    const {
      value,
      done
    } = await this._reader.read();
    if (done) {
      return {
        value,
        done
      };
    }
    this._loaded += value.byteLength;
    (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
      loaded: this._loaded,
      total: this._contentLength
    });
    return {
      value: getArrayBuffer(value),
      done: false
    };
  }
  cancel(reason) {
    var _a2;
    (_a2 = this._reader) == null ? void 0 : _a2.cancel(reason);
    this._abortController.abort();
  }
};
var PDFFetchStreamRangeReader = class {
  constructor(stream, begin, end) {
    this._stream = stream;
    this._reader = null;
    this._loaded = 0;
    const source = stream.source;
    this._withCredentials = source.withCredentials || false;
    this._readCapability = Promise.withResolvers();
    this._isStreamingSupported = !source.disableStream;
    this._abortController = new AbortController();
    this._headers = createHeaders(this._stream.httpHeaders);
    this._headers.append("Range", `bytes=${begin}-${end - 1}`);
    const url = source.url;
    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then((response) => {
      if (!validateResponseStatus(response.status)) {
        throw createResponseStatusError(response.status, url);
      }
      this._readCapability.resolve();
      this._reader = response.body.getReader();
    }).catch(this._readCapability.reject);
    this.onProgress = null;
  }
  get isStreamingSupported() {
    return this._isStreamingSupported;
  }
  async read() {
    var _a2;
    await this._readCapability.promise;
    const {
      value,
      done
    } = await this._reader.read();
    if (done) {
      return {
        value,
        done
      };
    }
    this._loaded += value.byteLength;
    (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
      loaded: this._loaded
    });
    return {
      value: getArrayBuffer(value),
      done: false
    };
  }
  cancel(reason) {
    var _a2;
    (_a2 = this._reader) == null ? void 0 : _a2.cancel(reason);
    this._abortController.abort();
  }
};
var OK_RESPONSE = 200;
var PARTIAL_CONTENT_RESPONSE = 206;
function network_getArrayBuffer(xhr) {
  const data = xhr.response;
  if (typeof data !== "string") {
    return data;
  }
  return stringToBytes(data).buffer;
}
var NetworkManager = class {
  constructor(url, args = {}) {
    this.url = url;
    this.isHttp = /^https?:/i.test(url);
    this.httpHeaders = this.isHttp && args.httpHeaders || /* @__PURE__ */ Object.create(null);
    this.withCredentials = args.withCredentials || false;
    this.currXhrId = 0;
    this.pendingRequests = /* @__PURE__ */ Object.create(null);
  }
  requestRange(begin, end, listeners) {
    const args = {
      begin,
      end
    };
    for (const prop in listeners) {
      args[prop] = listeners[prop];
    }
    return this.request(args);
  }
  requestFull(listeners) {
    return this.request(listeners);
  }
  request(args) {
    const xhr = new XMLHttpRequest();
    const xhrId = this.currXhrId++;
    const pendingRequest = this.pendingRequests[xhrId] = {
      xhr
    };
    xhr.open("GET", this.url);
    xhr.withCredentials = this.withCredentials;
    for (const property in this.httpHeaders) {
      const value = this.httpHeaders[property];
      if (value === void 0) {
        continue;
      }
      xhr.setRequestHeader(property, value);
    }
    if (this.isHttp && "begin" in args && "end" in args) {
      xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`);
      pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
    } else {
      pendingRequest.expectedStatus = OK_RESPONSE;
    }
    xhr.responseType = "arraybuffer";
    if (args.onError) {
      xhr.onerror = function(evt) {
        args.onError(xhr.status);
      };
    }
    xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
    xhr.onprogress = this.onProgress.bind(this, xhrId);
    pendingRequest.onHeadersReceived = args.onHeadersReceived;
    pendingRequest.onDone = args.onDone;
    pendingRequest.onError = args.onError;
    pendingRequest.onProgress = args.onProgress;
    xhr.send(null);
    return xhrId;
  }
  onProgress(xhrId, evt) {
    var _a2;
    const pendingRequest = this.pendingRequests[xhrId];
    if (!pendingRequest) {
      return;
    }
    (_a2 = pendingRequest.onProgress) == null ? void 0 : _a2.call(pendingRequest, evt);
  }
  onStateChange(xhrId, evt) {
    var _a2, _b, _c;
    const pendingRequest = this.pendingRequests[xhrId];
    if (!pendingRequest) {
      return;
    }
    const xhr = pendingRequest.xhr;
    if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
      pendingRequest.onHeadersReceived();
      delete pendingRequest.onHeadersReceived;
    }
    if (xhr.readyState !== 4) {
      return;
    }
    if (!(xhrId in this.pendingRequests)) {
      return;
    }
    delete this.pendingRequests[xhrId];
    if (xhr.status === 0 && this.isHttp) {
      (_a2 = pendingRequest.onError) == null ? void 0 : _a2.call(pendingRequest, xhr.status);
      return;
    }
    const xhrStatus = xhr.status || OK_RESPONSE;
    const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
    if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
      (_b = pendingRequest.onError) == null ? void 0 : _b.call(pendingRequest, xhr.status);
      return;
    }
    const chunk = network_getArrayBuffer(xhr);
    if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
      const rangeHeader = xhr.getResponseHeader("Content-Range");
      const matches2 = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
      pendingRequest.onDone({
        begin: parseInt(matches2[1], 10),
        chunk
      });
    } else if (chunk) {
      pendingRequest.onDone({
        begin: 0,
        chunk
      });
    } else {
      (_c = pendingRequest.onError) == null ? void 0 : _c.call(pendingRequest, xhr.status);
    }
  }
  getRequestXhr(xhrId) {
    return this.pendingRequests[xhrId].xhr;
  }
  isPendingRequest(xhrId) {
    return xhrId in this.pendingRequests;
  }
  abortRequest(xhrId) {
    const xhr = this.pendingRequests[xhrId].xhr;
    delete this.pendingRequests[xhrId];
    xhr.abort();
  }
};
var PDFNetworkStream = class {
  constructor(source) {
    this._source = source;
    this._manager = new NetworkManager(source.url, {
      httpHeaders: source.httpHeaders,
      withCredentials: source.withCredentials
    });
    this._rangeChunkSize = source.rangeChunkSize;
    this._fullRequestReader = null;
    this._rangeRequestReaders = [];
  }
  _onRangeRequestReaderClosed(reader) {
    const i = this._rangeRequestReaders.indexOf(reader);
    if (i >= 0) {
      this._rangeRequestReaders.splice(i, 1);
    }
  }
  getFullReader() {
    assert(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
    this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
    return this._fullRequestReader;
  }
  getRangeReader(begin, end) {
    const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
    reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
    this._rangeRequestReaders.push(reader);
    return reader;
  }
  cancelAllRequests(reason) {
    var _a2;
    (_a2 = this._fullRequestReader) == null ? void 0 : _a2.cancel(reason);
    for (const reader of this._rangeRequestReaders.slice(0)) {
      reader.cancel(reason);
    }
  }
};
var PDFNetworkStreamFullRequestReader = class {
  constructor(manager, source) {
    this._manager = manager;
    const args = {
      onHeadersReceived: this._onHeadersReceived.bind(this),
      onDone: this._onDone.bind(this),
      onError: this._onError.bind(this),
      onProgress: this._onProgress.bind(this)
    };
    this._url = source.url;
    this._fullRequestId = manager.requestFull(args);
    this._headersReceivedCapability = Promise.withResolvers();
    this._disableRange = source.disableRange || false;
    this._contentLength = source.length;
    this._rangeChunkSize = source.rangeChunkSize;
    if (!this._rangeChunkSize && !this._disableRange) {
      this._disableRange = true;
    }
    this._isStreamingSupported = false;
    this._isRangeSupported = false;
    this._cachedChunks = [];
    this._requests = [];
    this._done = false;
    this._storedError = void 0;
    this._filename = null;
    this.onProgress = null;
  }
  _onHeadersReceived() {
    const fullRequestXhrId = this._fullRequestId;
    const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
    const getResponseHeader = (name) => fullRequestXhr.getResponseHeader(name);
    const {
      allowRangeRequests,
      suggestedLength
    } = validateRangeRequestCapabilities({
      getResponseHeader,
      isHttp: this._manager.isHttp,
      rangeChunkSize: this._rangeChunkSize,
      disableRange: this._disableRange
    });
    if (allowRangeRequests) {
      this._isRangeSupported = true;
    }
    this._contentLength = suggestedLength || this._contentLength;
    this._filename = extractFilenameFromHeader(getResponseHeader);
    if (this._isRangeSupported) {
      this._manager.abortRequest(fullRequestXhrId);
    }
    this._headersReceivedCapability.resolve();
  }
  _onDone(data) {
    if (data) {
      if (this._requests.length > 0) {
        const requestCapability = this._requests.shift();
        requestCapability.resolve({
          value: data.chunk,
          done: false
        });
      } else {
        this._cachedChunks.push(data.chunk);
      }
    }
    this._done = true;
    if (this._cachedChunks.length > 0) {
      return;
    }
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
  }
  _onError(status) {
    this._storedError = createResponseStatusError(status, this._url);
    this._headersReceivedCapability.reject(this._storedError);
    for (const requestCapability of this._requests) {
      requestCapability.reject(this._storedError);
    }
    this._requests.length = 0;
    this._cachedChunks.length = 0;
  }
  _onProgress(evt) {
    var _a2;
    (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
      loaded: evt.loaded,
      total: evt.lengthComputable ? evt.total : this._contentLength
    });
  }
  get filename() {
    return this._filename;
  }
  get isRangeSupported() {
    return this._isRangeSupported;
  }
  get isStreamingSupported() {
    return this._isStreamingSupported;
  }
  get contentLength() {
    return this._contentLength;
  }
  get headersReady() {
    return this._headersReceivedCapability.promise;
  }
  async read() {
    if (this._storedError) {
      throw this._storedError;
    }
    if (this._cachedChunks.length > 0) {
      const chunk = this._cachedChunks.shift();
      return {
        value: chunk,
        done: false
      };
    }
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    const requestCapability = Promise.withResolvers();
    this._requests.push(requestCapability);
    return requestCapability.promise;
  }
  cancel(reason) {
    this._done = true;
    this._headersReceivedCapability.reject(reason);
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
    if (this._manager.isPendingRequest(this._fullRequestId)) {
      this._manager.abortRequest(this._fullRequestId);
    }
    this._fullRequestReader = null;
  }
};
var PDFNetworkStreamRangeRequestReader = class {
  constructor(manager, begin, end) {
    this._manager = manager;
    const args = {
      onDone: this._onDone.bind(this),
      onError: this._onError.bind(this),
      onProgress: this._onProgress.bind(this)
    };
    this._url = manager.url;
    this._requestId = manager.requestRange(begin, end, args);
    this._requests = [];
    this._queuedChunk = null;
    this._done = false;
    this._storedError = void 0;
    this.onProgress = null;
    this.onClosed = null;
  }
  _close() {
    var _a2;
    (_a2 = this.onClosed) == null ? void 0 : _a2.call(this, this);
  }
  _onDone(data) {
    const chunk = data.chunk;
    if (this._requests.length > 0) {
      const requestCapability = this._requests.shift();
      requestCapability.resolve({
        value: chunk,
        done: false
      });
    } else {
      this._queuedChunk = chunk;
    }
    this._done = true;
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
    this._close();
  }
  _onError(status) {
    this._storedError = createResponseStatusError(status, this._url);
    for (const requestCapability of this._requests) {
      requestCapability.reject(this._storedError);
    }
    this._requests.length = 0;
    this._queuedChunk = null;
  }
  _onProgress(evt) {
    var _a2;
    if (!this.isStreamingSupported) {
      (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
        loaded: evt.loaded
      });
    }
  }
  get isStreamingSupported() {
    return false;
  }
  async read() {
    if (this._storedError) {
      throw this._storedError;
    }
    if (this._queuedChunk !== null) {
      const chunk = this._queuedChunk;
      this._queuedChunk = null;
      return {
        value: chunk,
        done: false
      };
    }
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    const requestCapability = Promise.withResolvers();
    this._requests.push(requestCapability);
    return requestCapability.promise;
  }
  cancel(reason) {
    this._done = true;
    for (const requestCapability of this._requests) {
      requestCapability.resolve({
        value: void 0,
        done: true
      });
    }
    this._requests.length = 0;
    if (this._manager.isPendingRequest(this._requestId)) {
      this._manager.abortRequest(this._requestId);
    }
    this._close();
  }
};
var urlRegex = /^[a-z][a-z0-9\-+.]+:/i;
function parseUrlOrPath(sourceUrl) {
  if (urlRegex.test(sourceUrl)) {
    return new URL(sourceUrl);
  }
  const url = NodePackages.get("url");
  return new URL(url.pathToFileURL(sourceUrl));
}
function createRequest(url, headers, callback) {
  if (url.protocol === "http:") {
    const http = NodePackages.get("http");
    return http.request(url, {
      headers
    }, callback);
  }
  const https = NodePackages.get("https");
  return https.request(url, {
    headers
  }, callback);
}
var PDFNodeStream = class {
  constructor(source) {
    this.source = source;
    this.url = parseUrlOrPath(source.url);
    this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
    this.isFsUrl = this.url.protocol === "file:";
    this.httpHeaders = this.isHttp && source.httpHeaders || {};
    this._fullRequestReader = null;
    this._rangeRequestReaders = [];
  }
  get _progressiveDataLength() {
    var _a2, _b;
    return (_b = (_a2 = this._fullRequestReader) == null ? void 0 : _a2._loaded) != null ? _b : 0;
  }
  getFullReader() {
    assert(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
    this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
    return this._fullRequestReader;
  }
  getRangeReader(start, end) {
    if (end <= this._progressiveDataLength) {
      return null;
    }
    const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
    this._rangeRequestReaders.push(rangeReader);
    return rangeReader;
  }
  cancelAllRequests(reason) {
    var _a2;
    (_a2 = this._fullRequestReader) == null ? void 0 : _a2.cancel(reason);
    for (const reader of this._rangeRequestReaders.slice(0)) {
      reader.cancel(reason);
    }
  }
};
var BaseFullReader = class {
  constructor(stream) {
    this._url = stream.url;
    this._done = false;
    this._storedError = null;
    this.onProgress = null;
    const source = stream.source;
    this._contentLength = source.length;
    this._loaded = 0;
    this._filename = null;
    this._disableRange = source.disableRange || false;
    this._rangeChunkSize = source.rangeChunkSize;
    if (!this._rangeChunkSize && !this._disableRange) {
      this._disableRange = true;
    }
    this._isStreamingSupported = !source.disableStream;
    this._isRangeSupported = !source.disableRange;
    this._readableStream = null;
    this._readCapability = Promise.withResolvers();
    this._headersCapability = Promise.withResolvers();
  }
  get headersReady() {
    return this._headersCapability.promise;
  }
  get filename() {
    return this._filename;
  }
  get contentLength() {
    return this._contentLength;
  }
  get isRangeSupported() {
    return this._isRangeSupported;
  }
  get isStreamingSupported() {
    return this._isStreamingSupported;
  }
  async read() {
    var _a2;
    await this._readCapability.promise;
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    if (this._storedError) {
      throw this._storedError;
    }
    const chunk = this._readableStream.read();
    if (chunk === null) {
      this._readCapability = Promise.withResolvers();
      return this.read();
    }
    this._loaded += chunk.length;
    (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
      loaded: this._loaded,
      total: this._contentLength
    });
    const buffer = new Uint8Array(chunk).buffer;
    return {
      value: buffer,
      done: false
    };
  }
  cancel(reason) {
    if (!this._readableStream) {
      this._error(reason);
      return;
    }
    this._readableStream.destroy(reason);
  }
  _error(reason) {
    this._storedError = reason;
    this._readCapability.resolve();
  }
  _setReadableStream(readableStream) {
    this._readableStream = readableStream;
    readableStream.on("readable", () => {
      this._readCapability.resolve();
    });
    readableStream.on("end", () => {
      readableStream.destroy();
      this._done = true;
      this._readCapability.resolve();
    });
    readableStream.on("error", (reason) => {
      this._error(reason);
    });
    if (!this._isStreamingSupported && this._isRangeSupported) {
      this._error(new AbortException("streaming is disabled"));
    }
    if (this._storedError) {
      this._readableStream.destroy(this._storedError);
    }
  }
};
var BaseRangeReader = class {
  constructor(stream) {
    this._url = stream.url;
    this._done = false;
    this._storedError = null;
    this.onProgress = null;
    this._loaded = 0;
    this._readableStream = null;
    this._readCapability = Promise.withResolvers();
    const source = stream.source;
    this._isStreamingSupported = !source.disableStream;
  }
  get isStreamingSupported() {
    return this._isStreamingSupported;
  }
  async read() {
    var _a2;
    await this._readCapability.promise;
    if (this._done) {
      return {
        value: void 0,
        done: true
      };
    }
    if (this._storedError) {
      throw this._storedError;
    }
    const chunk = this._readableStream.read();
    if (chunk === null) {
      this._readCapability = Promise.withResolvers();
      return this.read();
    }
    this._loaded += chunk.length;
    (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, {
      loaded: this._loaded
    });
    const buffer = new Uint8Array(chunk).buffer;
    return {
      value: buffer,
      done: false
    };
  }
  cancel(reason) {
    if (!this._readableStream) {
      this._error(reason);
      return;
    }
    this._readableStream.destroy(reason);
  }
  _error(reason) {
    this._storedError = reason;
    this._readCapability.resolve();
  }
  _setReadableStream(readableStream) {
    this._readableStream = readableStream;
    readableStream.on("readable", () => {
      this._readCapability.resolve();
    });
    readableStream.on("end", () => {
      readableStream.destroy();
      this._done = true;
      this._readCapability.resolve();
    });
    readableStream.on("error", (reason) => {
      this._error(reason);
    });
    if (this._storedError) {
      this._readableStream.destroy(this._storedError);
    }
  }
};
var PDFNodeStreamFullReader = class extends BaseFullReader {
  constructor(stream) {
    super(stream);
    const handleResponse = (response) => {
      if (response.statusCode === 404) {
        const error = new MissingPDFException(`Missing PDF "${this._url}".`);
        this._storedError = error;
        this._headersCapability.reject(error);
        return;
      }
      this._headersCapability.resolve();
      this._setReadableStream(response);
      const getResponseHeader = (name) => this._readableStream.headers[name.toLowerCase()];
      const {
        allowRangeRequests,
        suggestedLength
      } = validateRangeRequestCapabilities({
        getResponseHeader,
        isHttp: stream.isHttp,
        rangeChunkSize: this._rangeChunkSize,
        disableRange: this._disableRange
      });
      this._isRangeSupported = allowRangeRequests;
      this._contentLength = suggestedLength || this._contentLength;
      this._filename = extractFilenameFromHeader(getResponseHeader);
    };
    this._request = createRequest(this._url, stream.httpHeaders, handleResponse);
    this._request.on("error", (reason) => {
      this._storedError = reason;
      this._headersCapability.reject(reason);
    });
    this._request.end();
  }
};
var PDFNodeStreamRangeReader = class extends BaseRangeReader {
  constructor(stream, start, end) {
    super(stream);
    this._httpHeaders = {};
    for (const property in stream.httpHeaders) {
      const value = stream.httpHeaders[property];
      if (value === void 0) {
        continue;
      }
      this._httpHeaders[property] = value;
    }
    this._httpHeaders.Range = `bytes=${start}-${end - 1}`;
    const handleResponse = (response) => {
      if (response.statusCode === 404) {
        const error = new MissingPDFException(`Missing PDF "${this._url}".`);
        this._storedError = error;
        return;
      }
      this._setReadableStream(response);
    };
    this._request = createRequest(this._url, this._httpHeaders, handleResponse);
    this._request.on("error", (reason) => {
      this._storedError = reason;
    });
    this._request.end();
  }
};
var PDFNodeStreamFsFullReader = class extends BaseFullReader {
  constructor(stream) {
    super(stream);
    const fs = NodePackages.get("fs");
    fs.promises.lstat(this._url).then((stat) => {
      this._contentLength = stat.size;
      this._setReadableStream(fs.createReadStream(this._url));
      this._headersCapability.resolve();
    }, (error) => {
      if (error.code === "ENOENT") {
        error = new MissingPDFException(`Missing PDF "${this._url}".`);
      }
      this._storedError = error;
      this._headersCapability.reject(error);
    });
  }
};
var PDFNodeStreamFsRangeReader = class extends BaseRangeReader {
  constructor(stream, start, end) {
    super(stream);
    const fs = NodePackages.get("fs");
    this._setReadableStream(fs.createReadStream(this._url, {
      start,
      end: end - 1
    }));
  }
};
var MAX_TEXT_DIVS_TO_RENDER = 1e5;
var DEFAULT_FONT_SIZE = 30;
var DEFAULT_FONT_ASCENT = 0.8;
var _a, _capability, _container2, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _minFontSize, _pendingTextLayers, _processItems, processItems_fn, _appendText, appendText_fn, _layout, layout_fn, _getCtx, getCtx_fn, _ensureMinFontSizeComputed, ensureMinFontSizeComputed_fn, _getAscent, getAscent_fn;
var _TextLayer = class {
  constructor({
    textContentSource,
    container,
    viewport
  }) {
    __privateAdd(this, _processItems);
    __privateAdd(this, _appendText);
    __privateAdd(this, _layout);
    __privateAdd(this, _capability, Promise.withResolvers());
    __privateAdd(this, _container2, null);
    __privateAdd(this, _disableProcessItems, false);
    __privateAdd(this, _fontInspectorEnabled, !!((_a = globalThis.FontInspector) == null ? void 0 : _a.enabled));
    __privateAdd(this, _lang, null);
    __privateAdd(this, _layoutTextParams, null);
    __privateAdd(this, _pageHeight, 0);
    __privateAdd(this, _pageWidth, 0);
    __privateAdd(this, _reader, null);
    __privateAdd(this, _rootContainer, null);
    __privateAdd(this, _rotation, 0);
    __privateAdd(this, _scale, 0);
    __privateAdd(this, _styleCache, /* @__PURE__ */ Object.create(null));
    __privateAdd(this, _textContentItemsStr, []);
    __privateAdd(this, _textContentSource, null);
    __privateAdd(this, _textDivs, []);
    __privateAdd(this, _textDivProperties, /* @__PURE__ */ new WeakMap());
    __privateAdd(this, _transform, null);
    var _a2;
    if (textContentSource instanceof ReadableStream) {
      __privateSet(this, _textContentSource, textContentSource);
    } else if (typeof textContentSource === "object") {
      __privateSet(this, _textContentSource, new ReadableStream({
        start(controller) {
          controller.enqueue(textContentSource);
          controller.close();
        }
      }));
    } else {
      throw new Error('No "textContentSource" parameter specified.');
    }
    __privateSet(this, _container2, __privateSet(this, _rootContainer, container));
    __privateSet(this, _scale, viewport.scale * (globalThis.devicePixelRatio || 1));
    __privateSet(this, _rotation, viewport.rotation);
    __privateSet(this, _layoutTextParams, {
      prevFontSize: null,
      prevFontFamily: null,
      div: null,
      properties: null,
      ctx: null
    });
    const {
      pageWidth,
      pageHeight,
      pageX,
      pageY
    } = viewport.rawDims;
    __privateSet(this, _transform, [1, 0, 0, -1, -pageX, pageY + pageHeight]);
    __privateSet(this, _pageWidth, pageWidth);
    __privateSet(this, _pageHeight, pageHeight);
    __privateMethod(_a2 = _TextLayer, _ensureMinFontSizeComputed, ensureMinFontSizeComputed_fn).call(_a2);
    setLayerDimensions(container, viewport);
    __privateGet(this, _capability).promise.catch(() => {
    }).then(() => {
      __privateGet(_TextLayer, _pendingTextLayers).delete(this);
      __privateSet(this, _layoutTextParams, null);
      __privateSet(this, _styleCache, null);
    });
  }
  render() {
    const pump = () => {
      __privateGet(this, _reader).read().then(({
        value,
        done
      }) => {
        var _a2;
        if (done) {
          __privateGet(this, _capability).resolve();
          return;
        }
        (_a2 = __privateGet(this, _lang)) != null ? _a2 : __privateSet(this, _lang, value.lang);
        Object.assign(__privateGet(this, _styleCache), value.styles);
        __privateMethod(this, _processItems, processItems_fn).call(this, value.items);
        pump();
      }, __privateGet(this, _capability).reject);
    };
    __privateSet(this, _reader, __privateGet(this, _textContentSource).getReader());
    __privateGet(_TextLayer, _pendingTextLayers).add(this);
    pump();
    return __privateGet(this, _capability).promise;
  }
  update({
    viewport,
    onBefore = null
  }) {
    var _a2;
    const scale = viewport.scale * (globalThis.devicePixelRatio || 1);
    const rotation = viewport.rotation;
    if (rotation !== __privateGet(this, _rotation)) {
      onBefore == null ? void 0 : onBefore();
      __privateSet(this, _rotation, rotation);
      setLayerDimensions(__privateGet(this, _rootContainer), {
        rotation
      });
    }
    if (scale !== __privateGet(this, _scale)) {
      onBefore == null ? void 0 : onBefore();
      __privateSet(this, _scale, scale);
      const params = {
        prevFontSize: null,
        prevFontFamily: null,
        div: null,
        properties: null,
        ctx: __privateMethod(_a2 = _TextLayer, _getCtx, getCtx_fn).call(_a2, __privateGet(this, _lang))
      };
      for (const div of __privateGet(this, _textDivs)) {
        params.properties = __privateGet(this, _textDivProperties).get(div);
        params.div = div;
        __privateMethod(this, _layout, layout_fn).call(this, params);
      }
    }
  }
  cancel() {
    var _a2;
    const abortEx = new AbortException("TextLayer task cancelled.");
    (_a2 = __privateGet(this, _reader)) == null ? void 0 : _a2.cancel(abortEx).catch(() => {
    });
    __privateSet(this, _reader, null);
    __privateGet(this, _capability).reject(abortEx);
  }
  get textDivs() {
    return __privateGet(this, _textDivs);
  }
  get textContentItemsStr() {
    return __privateGet(this, _textContentItemsStr);
  }
  static cleanup() {
    if (__privateGet(this, _pendingTextLayers).size > 0) {
      return;
    }
    __privateGet(this, _ascentCache).clear();
    for (const {
      canvas
    } of __privateGet(this, _canvasContexts).values()) {
      canvas.remove();
    }
    __privateGet(this, _canvasContexts).clear();
  }
};
var TextLayer = _TextLayer;
_capability = new WeakMap();
_container2 = new WeakMap();
_disableProcessItems = new WeakMap();
_fontInspectorEnabled = new WeakMap();
_lang = new WeakMap();
_layoutTextParams = new WeakMap();
_pageHeight = new WeakMap();
_pageWidth = new WeakMap();
_reader = new WeakMap();
_rootContainer = new WeakMap();
_rotation = new WeakMap();
_scale = new WeakMap();
_styleCache = new WeakMap();
_textContentItemsStr = new WeakMap();
_textContentSource = new WeakMap();
_textDivs = new WeakMap();
_textDivProperties = new WeakMap();
_transform = new WeakMap();
_ascentCache = new WeakMap();
_canvasContexts = new WeakMap();
_minFontSize = new WeakMap();
_pendingTextLayers = new WeakMap();
_processItems = new WeakSet();
processItems_fn = function(items) {
  var _a2, _b, _c;
  if (__privateGet(this, _disableProcessItems)) {
    return;
  }
  (_c = (_b = __privateGet(this, _layoutTextParams)).ctx) != null ? _c : _b.ctx = __privateMethod(_a2 = _TextLayer, _getCtx, getCtx_fn).call(_a2, __privateGet(this, _lang));
  const textDivs = __privateGet(this, _textDivs), textContentItemsStr = __privateGet(this, _textContentItemsStr);
  for (const item of items) {
    if (textDivs.length > MAX_TEXT_DIVS_TO_RENDER) {
      warn("Ignoring additional textDivs for performance reasons.");
      __privateSet(this, _disableProcessItems, true);
      return;
    }
    if (item.str === void 0) {
      if (item.type === "beginMarkedContentProps" || item.type === "beginMarkedContent") {
        const parent = __privateGet(this, _container2);
        __privateSet(this, _container2, document.createElement("span"));
        __privateGet(this, _container2).classList.add("markedContent");
        if (item.id !== null) {
          __privateGet(this, _container2).setAttribute("id", `${item.id}`);
        }
        parent.append(__privateGet(this, _container2));
      } else if (item.type === "endMarkedContent") {
        __privateSet(this, _container2, __privateGet(this, _container2).parentNode);
      }
      continue;
    }
    textContentItemsStr.push(item.str);
    __privateMethod(this, _appendText, appendText_fn).call(this, item);
  }
};
_appendText = new WeakSet();
appendText_fn = function(geom) {
  var _a2;
  const textDiv = document.createElement("span");
  const textDivProperties = {
    angle: 0,
    canvasWidth: 0,
    hasText: geom.str !== "",
    hasEOL: geom.hasEOL,
    fontSize: 0
  };
  __privateGet(this, _textDivs).push(textDiv);
  const tx = Util.transform(__privateGet(this, _transform), geom.transform);
  let angle = Math.atan2(tx[1], tx[0]);
  const style = __privateGet(this, _styleCache)[geom.fontName];
  if (style.vertical) {
    angle += Math.PI / 2;
  }
  const fontFamily = __privateGet(this, _fontInspectorEnabled) && style.fontSubstitution || style.fontFamily;
  const fontHeight = Math.hypot(tx[2], tx[3]);
  const fontAscent = fontHeight * __privateMethod(_a2 = _TextLayer, _getAscent, getAscent_fn).call(_a2, fontFamily, __privateGet(this, _lang));
  let left, top;
  if (angle === 0) {
    left = tx[4];
    top = tx[5] - fontAscent;
  } else {
    left = tx[4] + fontAscent * Math.sin(angle);
    top = tx[5] - fontAscent * Math.cos(angle);
  }
  const scaleFactorStr = "calc(var(--scale-factor)*";
  const divStyle = textDiv.style;
  if (__privateGet(this, _container2) === __privateGet(this, _rootContainer)) {
    divStyle.left = `${(100 * left / __privateGet(this, _pageWidth)).toFixed(2)}%`;
    divStyle.top = `${(100 * top / __privateGet(this, _pageHeight)).toFixed(2)}%`;
  } else {
    divStyle.left = `${scaleFactorStr}${left.toFixed(2)}px)`;
    divStyle.top = `${scaleFactorStr}${top.toFixed(2)}px)`;
  }
  divStyle.fontSize = `${scaleFactorStr}${(__privateGet(_TextLayer, _minFontSize) * fontHeight).toFixed(2)}px)`;
  divStyle.fontFamily = fontFamily;
  textDivProperties.fontSize = fontHeight;
  textDiv.setAttribute("role", "presentation");
  textDiv.textContent = geom.str;
  textDiv.dir = geom.dir;
  if (__privateGet(this, _fontInspectorEnabled)) {
    textDiv.dataset.fontName = style.fontSubstitutionLoadedName || geom.fontName;
  }
  if (angle !== 0) {
    textDivProperties.angle = angle * (180 / Math.PI);
  }
  let shouldScaleText = false;
  if (geom.str.length > 1) {
    shouldScaleText = true;
  } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
    const absScaleX = Math.abs(geom.transform[0]), absScaleY = Math.abs(geom.transform[3]);
    if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
      shouldScaleText = true;
    }
  }
  if (shouldScaleText) {
    textDivProperties.canvasWidth = style.vertical ? geom.height : geom.width;
  }
  __privateGet(this, _textDivProperties).set(textDiv, textDivProperties);
  __privateGet(this, _layoutTextParams).div = textDiv;
  __privateGet(this, _layoutTextParams).properties = textDivProperties;
  __privateMethod(this, _layout, layout_fn).call(this, __privateGet(this, _layoutTextParams));
  if (textDivProperties.hasText) {
    __privateGet(this, _container2).append(textDiv);
  }
  if (textDivProperties.hasEOL) {
    const br = document.createElement("br");
    br.setAttribute("role", "presentation");
    __privateGet(this, _container2).append(br);
  }
};
_layout = new WeakSet();
layout_fn = function(params) {
  const {
    div,
    properties,
    ctx,
    prevFontSize,
    prevFontFamily
  } = params;
  const {
    style
  } = div;
  let transform = "";
  if (__privateGet(_TextLayer, _minFontSize) > 1) {
    transform = `scale(${1 / __privateGet(_TextLayer, _minFontSize)})`;
  }
  if (properties.canvasWidth !== 0 && properties.hasText) {
    const {
      fontFamily
    } = style;
    const {
      canvasWidth,
      fontSize
    } = properties;
    if (prevFontSize !== fontSize || prevFontFamily !== fontFamily) {
      ctx.font = `${fontSize * __privateGet(this, _scale)}px ${fontFamily}`;
      params.prevFontSize = fontSize;
      params.prevFontFamily = fontFamily;
    }
    const {
      width
    } = ctx.measureText(div.textContent);
    if (width > 0) {
      transform = `scaleX(${canvasWidth * __privateGet(this, _scale) / width}) ${transform}`;
    }
  }
  if (properties.angle !== 0) {
    transform = `rotate(${properties.angle}deg) ${transform}`;
  }
  if (transform.length > 0) {
    style.transform = transform;
  }
};
_getCtx = new WeakSet();
getCtx_fn = function(lang = null) {
  let canvasContext = __privateGet(this, _canvasContexts).get(lang || (lang = ""));
  if (!canvasContext) {
    const canvas = document.createElement("canvas");
    canvas.className = "hiddenCanvasElement";
    canvas.lang = lang;
    document.body.append(canvas);
    canvasContext = canvas.getContext("2d", {
      alpha: false,
      willReadFrequently: true
    });
    __privateGet(this, _canvasContexts).set(lang, canvasContext);
  }
  return canvasContext;
};
_ensureMinFontSizeComputed = new WeakSet();
ensureMinFontSizeComputed_fn = function() {
  if (__privateGet(this, _minFontSize) !== null) {
    return;
  }
  const div = document.createElement("div");
  div.style.opacity = 0;
  div.style.lineHeight = 1;
  div.style.fontSize = "1px";
  div.style.position = "absolute";
  div.textContent = "X";
  document.body.append(div);
  __privateSet(this, _minFontSize, div.getBoundingClientRect().height);
  div.remove();
};
_getAscent = new WeakSet();
getAscent_fn = function(fontFamily, lang) {
  const cachedAscent = __privateGet(this, _ascentCache).get(fontFamily);
  if (cachedAscent) {
    return cachedAscent;
  }
  const ctx = __privateMethod(this, _getCtx, getCtx_fn).call(this, lang);
  const savedFont = ctx.font;
  ctx.canvas.width = ctx.canvas.height = DEFAULT_FONT_SIZE;
  ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;
  const metrics = ctx.measureText("");
  let ascent = metrics.fontBoundingBoxAscent;
  let descent = Math.abs(metrics.fontBoundingBoxDescent);
  if (ascent) {
    const ratio2 = ascent / (ascent + descent);
    __privateGet(this, _ascentCache).set(fontFamily, ratio2);
    ctx.canvas.width = ctx.canvas.height = 0;
    ctx.font = savedFont;
    return ratio2;
  }
  ctx.strokeStyle = "red";
  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
  ctx.strokeText("g", 0, 0);
  let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
  descent = 0;
  for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
    if (pixels[i] > 0) {
      descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
      break;
    }
  }
  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
  ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
  pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
  ascent = 0;
  for (let i = 0, ii = pixels.length; i < ii; i += 4) {
    if (pixels[i] > 0) {
      ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);
      break;
    }
  }
  ctx.canvas.width = ctx.canvas.height = 0;
  ctx.font = savedFont;
  const ratio = ascent ? ascent / (ascent + descent) : DEFAULT_FONT_ASCENT;
  __privateGet(this, _ascentCache).set(fontFamily, ratio);
  return ratio;
};
__privateAdd(TextLayer, _getCtx);
__privateAdd(TextLayer, _ensureMinFontSizeComputed);
__privateAdd(TextLayer, _getAscent);
__privateAdd(TextLayer, _ascentCache, /* @__PURE__ */ new Map());
__privateAdd(TextLayer, _canvasContexts, /* @__PURE__ */ new Map());
__privateAdd(TextLayer, _minFontSize, null);
__privateAdd(TextLayer, _pendingTextLayers, /* @__PURE__ */ new Set());
var XfaText = class {
  static textContent(xfa) {
    const items = [];
    const output = {
      items,
      styles: /* @__PURE__ */ Object.create(null)
    };
    function walk(node) {
      var _a2;
      if (!node) {
        return;
      }
      let str = null;
      const name = node.name;
      if (name === "#text") {
        str = node.value;
      } else if (!XfaText.shouldBuildText(name)) {
        return;
      } else if ((_a2 = node == null ? void 0 : node.attributes) == null ? void 0 : _a2.textContent) {
        str = node.attributes.textContent;
      } else if (node.value) {
        str = node.value;
      }
      if (str !== null) {
        items.push({
          str
        });
      }
      if (!node.children) {
        return;
      }
      for (const child of node.children) {
        walk(child);
      }
    }
    walk(xfa);
    return output;
  }
  static shouldBuildText(name) {
    return !(name === "textarea" || name === "input" || name === "option" || name === "select");
  }
};
var DEFAULT_RANGE_CHUNK_SIZE = 65536;
var RENDERING_CANCELLED_TIMEOUT = 100;
var DELAYED_CLEANUP_TIMEOUT = 5e3;
var DefaultCanvasFactory = isNodeJS ? NodeCanvasFactory : DOMCanvasFactory;
var DefaultCMapReaderFactory = isNodeJS ? NodeCMapReaderFactory : DOMCMapReaderFactory;
var DefaultFilterFactory = isNodeJS ? NodeFilterFactory : DOMFilterFactory;
var DefaultStandardFontDataFactory = isNodeJS ? NodeStandardFontDataFactory : DOMStandardFontDataFactory;
function getDocument(src = {}) {
  var _a2, _b;
  if (typeof src === "string" || src instanceof URL) {
    src = {
      url: src
    };
  } else if (src instanceof ArrayBuffer || ArrayBuffer.isView(src)) {
    src = {
      data: src
    };
  }
  const task = new PDFDocumentLoadingTask();
  const {
    docId
  } = task;
  const url = src.url ? getUrlProp(src.url) : null;
  const data = src.data ? getDataProp(src.data) : null;
  const httpHeaders = src.httpHeaders || null;
  const withCredentials = src.withCredentials === true;
  const password = (_a2 = src.password) != null ? _a2 : null;
  const rangeTransport = src.range instanceof PDFDataRangeTransport ? src.range : null;
  const rangeChunkSize = Number.isInteger(src.rangeChunkSize) && src.rangeChunkSize > 0 ? src.rangeChunkSize : DEFAULT_RANGE_CHUNK_SIZE;
  let worker = src.worker instanceof PDFWorker ? src.worker : null;
  const verbosity2 = src.verbosity;
  const docBaseUrl = typeof src.docBaseUrl === "string" && !isDataScheme(src.docBaseUrl) ? src.docBaseUrl : null;
  const cMapUrl = typeof src.cMapUrl === "string" ? src.cMapUrl : null;
  const cMapPacked = src.cMapPacked !== false;
  const CMapReaderFactory = src.CMapReaderFactory || DefaultCMapReaderFactory;
  const standardFontDataUrl = typeof src.standardFontDataUrl === "string" ? src.standardFontDataUrl : null;
  const StandardFontDataFactory = src.StandardFontDataFactory || DefaultStandardFontDataFactory;
  const ignoreErrors = src.stopAtErrors !== true;
  const maxImageSize = Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 ? src.maxImageSize : -1;
  const isEvalSupported2 = src.isEvalSupported !== false;
  const isOffscreenCanvasSupported = typeof src.isOffscreenCanvasSupported === "boolean" ? src.isOffscreenCanvasSupported : !isNodeJS;
  const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes) ? src.canvasMaxAreaInBytes : -1;
  const disableFontFace = typeof src.disableFontFace === "boolean" ? src.disableFontFace : isNodeJS;
  const fontExtraProperties = src.fontExtraProperties === true;
  const enableXfa = src.enableXfa === true;
  const ownerDocument = src.ownerDocument || globalThis.document;
  const disableRange = src.disableRange === true;
  const disableStream = src.disableStream === true;
  const disableAutoFetch = src.disableAutoFetch === true;
  const pdfBug = src.pdfBug === true;
  const enableHWA = src.enableHWA === true;
  const length = rangeTransport ? rangeTransport.length : (_b = src.length) != null ? _b : NaN;
  const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !isNodeJS && !disableFontFace;
  const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : CMapReaderFactory === DOMCMapReaderFactory && StandardFontDataFactory === DOMStandardFontDataFactory && cMapUrl && standardFontDataUrl && isValidFetchUrl(cMapUrl, document.baseURI) && isValidFetchUrl(standardFontDataUrl, document.baseURI);
  const canvasFactory = src.canvasFactory || new DefaultCanvasFactory({
    ownerDocument,
    enableHWA
  });
  const filterFactory = src.filterFactory || new DefaultFilterFactory({
    docId,
    ownerDocument
  });
  const styleElement = null;
  setVerbosityLevel(verbosity2);
  const transportFactory = {
    canvasFactory,
    filterFactory
  };
  if (!useWorkerFetch) {
    transportFactory.cMapReaderFactory = new CMapReaderFactory({
      baseUrl: cMapUrl,
      isCompressed: cMapPacked
    });
    transportFactory.standardFontDataFactory = new StandardFontDataFactory({
      baseUrl: standardFontDataUrl
    });
  }
  if (!worker) {
    const workerParams = {
      verbosity: verbosity2,
      port: GlobalWorkerOptions.workerPort
    };
    worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
    task._worker = worker;
  }
  const docParams = {
    docId,
    apiVersion: "4.6.82",
    data,
    password,
    disableAutoFetch,
    rangeChunkSize,
    length,
    docBaseUrl,
    enableXfa,
    evaluatorOptions: {
      maxImageSize,
      disableFontFace,
      ignoreErrors,
      isEvalSupported: isEvalSupported2,
      isOffscreenCanvasSupported,
      canvasMaxAreaInBytes,
      fontExtraProperties,
      useSystemFonts,
      cMapUrl: useWorkerFetch ? cMapUrl : null,
      standardFontDataUrl: useWorkerFetch ? standardFontDataUrl : null
    }
  };
  const transportParams = {
    disableFontFace,
    fontExtraProperties,
    ownerDocument,
    pdfBug,
    styleElement,
    loadingParams: {
      disableAutoFetch,
      enableXfa
    }
  };
  worker.promise.then(function() {
    if (task.destroyed) {
      throw new Error("Loading aborted");
    }
    if (worker.destroyed) {
      throw new Error("Worker was destroyed");
    }
    const workerIdPromise = worker.messageHandler.sendWithPromise("GetDocRequest", docParams, data ? [data.buffer] : null);
    let networkStream;
    if (rangeTransport) {
      networkStream = new PDFDataTransportStream(rangeTransport, {
        disableRange,
        disableStream
      });
    } else if (!data) {
      if (!url) {
        throw new Error("getDocument - no `url` parameter provided.");
      }
      const createPDFNetworkStream = (params) => {
        if (isNodeJS) {
          const isFetchSupported = function() {
            return typeof fetch !== "undefined" && typeof Response !== "undefined" && "body" in Response.prototype;
          };
          return isFetchSupported() && isValidFetchUrl(params.url) ? new PDFFetchStream(params) : new PDFNodeStream(params);
        }
        return isValidFetchUrl(params.url) ? new PDFFetchStream(params) : new PDFNetworkStream(params);
      };
      networkStream = createPDFNetworkStream({
        url,
        length,
        httpHeaders,
        withCredentials,
        rangeChunkSize,
        disableRange,
        disableStream
      });
    }
    return workerIdPromise.then((workerId) => {
      if (task.destroyed) {
        throw new Error("Loading aborted");
      }
      if (worker.destroyed) {
        throw new Error("Worker was destroyed");
      }
      const messageHandler = new MessageHandler(docId, workerId, worker.port);
      const transport = new WorkerTransport(messageHandler, task, networkStream, transportParams, transportFactory);
      task._transport = transport;
      messageHandler.send("Ready", null);
    });
  }).catch(task._capability.reject);
  return task;
}
function getUrlProp(val) {
  if (val instanceof URL) {
    return val.href;
  }
  try {
    return new URL(val, window.location).href;
  } catch (e) {
    if (isNodeJS && typeof val === "string") {
      return val;
    }
  }
  throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
}
function getDataProp(val) {
  if (isNodeJS && typeof Buffer !== "undefined" && val instanceof Buffer) {
    throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
  }
  if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
    return val;
  }
  if (typeof val === "string") {
    return stringToBytes(val);
  }
  if (val instanceof ArrayBuffer || ArrayBuffer.isView(val) || typeof val === "object" && !isNaN(val == null ? void 0 : val.length)) {
    return new Uint8Array(val);
  }
  throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");
}
function isRefProxy(ref) {
  return typeof ref === "object" && Number.isInteger(ref == null ? void 0 : ref.num) && ref.num >= 0 && Number.isInteger(ref == null ? void 0 : ref.gen) && ref.gen >= 0;
}
var _docId2;
var _PDFDocumentLoadingTask = class {
  constructor() {
    this._capability = Promise.withResolvers();
    this._transport = null;
    this._worker = null;
    this.docId = `d${__privateWrapper(_PDFDocumentLoadingTask, _docId2)._++}`;
    this.destroyed = false;
    this.onPassword = null;
    this.onProgress = null;
  }
  get promise() {
    return this._capability.promise;
  }
  async destroy() {
    var _a2, _b, _c;
    this.destroyed = true;
    try {
      if ((_a2 = this._worker) == null ? void 0 : _a2.port) {
        this._worker._pendingDestroy = true;
      }
      await ((_b = this._transport) == null ? void 0 : _b.destroy());
    } catch (ex) {
      if ((_c = this._worker) == null ? void 0 : _c.port) {
        delete this._worker._pendingDestroy;
      }
      throw ex;
    }
    this._transport = null;
    if (this._worker) {
      this._worker.destroy();
      this._worker = null;
    }
  }
};
var PDFDocumentLoadingTask = _PDFDocumentLoadingTask;
_docId2 = new WeakMap();
__privateAdd(PDFDocumentLoadingTask, _docId2, 0);
var PDFDataRangeTransport = class {
  constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) {
    this.length = length;
    this.initialData = initialData;
    this.progressiveDone = progressiveDone;
    this.contentDispositionFilename = contentDispositionFilename;
    this._rangeListeners = [];
    this._progressListeners = [];
    this._progressiveReadListeners = [];
    this._progressiveDoneListeners = [];
    this._readyCapability = Promise.withResolvers();
  }
  addRangeListener(listener) {
    this._rangeListeners.push(listener);
  }
  addProgressListener(listener) {
    this._progressListeners.push(listener);
  }
  addProgressiveReadListener(listener) {
    this._progressiveReadListeners.push(listener);
  }
  addProgressiveDoneListener(listener) {
    this._progressiveDoneListeners.push(listener);
  }
  onDataRange(begin, chunk) {
    for (const listener of this._rangeListeners) {
      listener(begin, chunk);
    }
  }
  onDataProgress(loaded, total) {
    this._readyCapability.promise.then(() => {
      for (const listener of this._progressListeners) {
        listener(loaded, total);
      }
    });
  }
  onDataProgressiveRead(chunk) {
    this._readyCapability.promise.then(() => {
      for (const listener of this._progressiveReadListeners) {
        listener(chunk);
      }
    });
  }
  onDataProgressiveDone() {
    this._readyCapability.promise.then(() => {
      for (const listener of this._progressiveDoneListeners) {
        listener();
      }
    });
  }
  transportReady() {
    this._readyCapability.resolve();
  }
  requestDataRange(begin, end) {
    unreachable("Abstract method PDFDataRangeTransport.requestDataRange");
  }
  abort() {
  }
};
var PDFDocumentProxy = class {
  constructor(pdfInfo, transport) {
    this._pdfInfo = pdfInfo;
    this._transport = transport;
  }
  get annotationStorage() {
    return this._transport.annotationStorage;
  }
  get filterFactory() {
    return this._transport.filterFactory;
  }
  get numPages() {
    return this._pdfInfo.numPages;
  }
  get fingerprints() {
    return this._pdfInfo.fingerprints;
  }
  get isPureXfa() {
    return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
  }
  get allXfaHtml() {
    return this._transport._htmlForXfa;
  }
  getPage(pageNumber) {
    return this._transport.getPage(pageNumber);
  }
  getPageIndex(ref) {
    return this._transport.getPageIndex(ref);
  }
  getDestinations() {
    return this._transport.getDestinations();
  }
  getDestination(id) {
    return this._transport.getDestination(id);
  }
  getPageLabels() {
    return this._transport.getPageLabels();
  }
  getPageLayout() {
    return this._transport.getPageLayout();
  }
  getPageMode() {
    return this._transport.getPageMode();
  }
  getViewerPreferences() {
    return this._transport.getViewerPreferences();
  }
  getOpenAction() {
    return this._transport.getOpenAction();
  }
  getAttachments() {
    return this._transport.getAttachments();
  }
  getJSActions() {
    return this._transport.getDocJSActions();
  }
  getOutline() {
    return this._transport.getOutline();
  }
  getOptionalContentConfig({
    intent = "display"
  } = {}) {
    const {
      renderingIntent
    } = this._transport.getRenderingIntent(intent);
    return this._transport.getOptionalContentConfig(renderingIntent);
  }
  getPermissions() {
    return this._transport.getPermissions();
  }
  getMetadata() {
    return this._transport.getMetadata();
  }
  getMarkInfo() {
    return this._transport.getMarkInfo();
  }
  getData() {
    return this._transport.getData();
  }
  saveDocument() {
    return this._transport.saveDocument();
  }
  getDownloadInfo() {
    return this._transport.downloadInfoCapability.promise;
  }
  cleanup(keepLoadedFonts = false) {
    return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
  }
  destroy() {
    return this.loadingTask.destroy();
  }
  cachedPageNumber(ref) {
    return this._transport.cachedPageNumber(ref);
  }
  get loadingParams() {
    return this._transport.loadingParams;
  }
  get loadingTask() {
    return this._transport.loadingTask;
  }
  getFieldObjects() {
    return this._transport.getFieldObjects();
  }
  hasJSActions() {
    return this._transport.hasJSActions();
  }
  getCalculationOrderIds() {
    return this._transport.getCalculationOrderIds();
  }
};
var _delayedCleanupTimeout, _pendingCleanup, _tryCleanup, tryCleanup_fn, _abortDelayedCleanup, abortDelayedCleanup_fn;
var PDFPageProxy = class {
  constructor(pageIndex, pageInfo, transport, pdfBug = false) {
    __privateAdd(this, _tryCleanup);
    __privateAdd(this, _abortDelayedCleanup);
    __privateAdd(this, _delayedCleanupTimeout, null);
    __privateAdd(this, _pendingCleanup, false);
    this._pageIndex = pageIndex;
    this._pageInfo = pageInfo;
    this._transport = transport;
    this._stats = pdfBug ? new StatTimer() : null;
    this._pdfBug = pdfBug;
    this.commonObjs = transport.commonObjs;
    this.objs = new PDFObjects();
    this._maybeCleanupAfterRender = false;
    this._intentStates = /* @__PURE__ */ new Map();
    this.destroyed = false;
  }
  get pageNumber() {
    return this._pageIndex + 1;
  }
  get rotate() {
    return this._pageInfo.rotate;
  }
  get ref() {
    return this._pageInfo.ref;
  }
  get userUnit() {
    return this._pageInfo.userUnit;
  }
  get view() {
    return this._pageInfo.view;
  }
  getViewport({
    scale,
    rotation = this.rotate,
    offsetX = 0,
    offsetY = 0,
    dontFlip = false
  } = {}) {
    return new PageViewport({
      viewBox: this.view,
      scale,
      rotation,
      offsetX,
      offsetY,
      dontFlip
    });
  }
  getAnnotations({
    intent = "display"
  } = {}) {
    const {
      renderingIntent
    } = this._transport.getRenderingIntent(intent);
    return this._transport.getAnnotations(this._pageIndex, renderingIntent);
  }
  getJSActions() {
    return this._transport.getPageJSActions(this._pageIndex);
  }
  get filterFactory() {
    return this._transport.filterFactory;
  }
  get isPureXfa() {
    return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
  }
  async getXfa() {
    var _a2;
    return ((_a2 = this._transport._htmlForXfa) == null ? void 0 : _a2.children[this._pageIndex]) || null;
  }
  render({
    canvasContext,
    viewport,
    intent = "display",
    annotationMode = AnnotationMode.ENABLE,
    transform = null,
    background = null,
    optionalContentConfigPromise = null,
    annotationCanvasMap = null,
    pageColors = null,
    printAnnotationStorage = null,
    isEditing = false
  }) {
    var _a2, _b;
    (_a2 = this._stats) == null ? void 0 : _a2.time("Overall");
    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing);
    const {
      renderingIntent,
      cacheKey
    } = intentArgs;
    __privateSet(this, _pendingCleanup, false);
    __privateMethod(this, _abortDelayedCleanup, abortDelayedCleanup_fn).call(this);
    optionalContentConfigPromise || (optionalContentConfigPromise = this._transport.getOptionalContentConfig(renderingIntent));
    let intentState = this._intentStates.get(cacheKey);
    if (!intentState) {
      intentState = /* @__PURE__ */ Object.create(null);
      this._intentStates.set(cacheKey, intentState);
    }
    if (intentState.streamReaderCancelTimeout) {
      clearTimeout(intentState.streamReaderCancelTimeout);
      intentState.streamReaderCancelTimeout = null;
    }
    const intentPrint = !!(renderingIntent & RenderingIntentFlag.PRINT);
    if (!intentState.displayReadyCapability) {
      intentState.displayReadyCapability = Promise.withResolvers();
      intentState.operatorList = {
        fnArray: [],
        argsArray: [],
        lastChunk: false,
        separateAnnots: null
      };
      (_b = this._stats) == null ? void 0 : _b.time("Page Request");
      this._pumpOperatorList(intentArgs);
    }
    const complete = (error) => {
      var _a3;
      intentState.renderTasks.delete(internalRenderTask);
      if (this._maybeCleanupAfterRender || intentPrint) {
        __privateSet(this, _pendingCleanup, true);
      }
      __privateMethod(this, _tryCleanup, tryCleanup_fn).call(this, !intentPrint);
      if (error) {
        internalRenderTask.capability.reject(error);
        this._abortOperatorList({
          intentState,
          reason: error instanceof Error ? error : new Error(error)
        });
      } else {
        internalRenderTask.capability.resolve();
      }
      if (this._stats) {
        this._stats.timeEnd("Rendering");
        this._stats.timeEnd("Overall");
        if ((_a3 = globalThis.Stats) == null ? void 0 : _a3.enabled) {
          globalThis.Stats.add(this.pageNumber, this._stats);
        }
      }
    };
    const internalRenderTask = new InternalRenderTask({
      callback: complete,
      params: {
        canvasContext,
        viewport,
        transform,
        background
      },
      objs: this.objs,
      commonObjs: this.commonObjs,
      annotationCanvasMap,
      operatorList: intentState.operatorList,
      pageIndex: this._pageIndex,
      canvasFactory: this._transport.canvasFactory,
      filterFactory: this._transport.filterFactory,
      useRequestAnimationFrame: !intentPrint,
      pdfBug: this._pdfBug,
      pageColors
    });
    (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(internalRenderTask);
    const renderTask = internalRenderTask.task;
    Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
      var _a3;
      if (this.destroyed) {
        complete();
        return;
      }
      (_a3 = this._stats) == null ? void 0 : _a3.time("Rendering");
      if (!(optionalContentConfig.renderingIntent & renderingIntent)) {
        throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");
      }
      internalRenderTask.initializeGraphics({
        transparency,
        optionalContentConfig
      });
      internalRenderTask.operatorListChanged();
    }).catch(complete);
    return renderTask;
  }
  getOperatorList({
    intent = "display",
    annotationMode = AnnotationMode.ENABLE,
    printAnnotationStorage = null,
    isEditing = false
  } = {}) {
    var _a2;
    function operatorListChanged() {
      if (intentState.operatorList.lastChunk) {
        intentState.opListReadCapability.resolve(intentState.operatorList);
        intentState.renderTasks.delete(opListTask);
      }
    }
    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing, true);
    let intentState = this._intentStates.get(intentArgs.cacheKey);
    if (!intentState) {
      intentState = /* @__PURE__ */ Object.create(null);
      this._intentStates.set(intentArgs.cacheKey, intentState);
    }
    let opListTask;
    if (!intentState.opListReadCapability) {
      opListTask = /* @__PURE__ */ Object.create(null);
      opListTask.operatorListChanged = operatorListChanged;
      intentState.opListReadCapability = Promise.withResolvers();
      (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(opListTask);
      intentState.operatorList = {
        fnArray: [],
        argsArray: [],
        lastChunk: false,
        separateAnnots: null
      };
      (_a2 = this._stats) == null ? void 0 : _a2.time("Page Request");
      this._pumpOperatorList(intentArgs);
    }
    return intentState.opListReadCapability.promise;
  }
  streamTextContent({
    includeMarkedContent = false,
    disableNormalization = false
  } = {}) {
    const TEXT_CONTENT_CHUNK_SIZE = 100;
    return this._transport.messageHandler.sendWithStream("GetTextContent", {
      pageIndex: this._pageIndex,
      includeMarkedContent: includeMarkedContent === true,
      disableNormalization: disableNormalization === true
    }, {
      highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
      size(textContent) {
        return textContent.items.length;
      }
    });
  }
  getTextContent(params = {}) {
    if (this._transport._htmlForXfa) {
      return this.getXfa().then((xfa) => XfaText.textContent(xfa));
    }
    const readableStream = this.streamTextContent(params);
    return new Promise(function(resolve, reject) {
      function pump() {
        reader.read().then(function({
          value,
          done
        }) {
          var _a2;
          if (done) {
            resolve(textContent);
            return;
          }
          (_a2 = textContent.lang) != null ? _a2 : textContent.lang = value.lang;
          Object.assign(textContent.styles, value.styles);
          textContent.items.push(...value.items);
          pump();
        }, reject);
      }
      const reader = readableStream.getReader();
      const textContent = {
        items: [],
        styles: /* @__PURE__ */ Object.create(null),
        lang: null
      };
      pump();
    });
  }
  getStructTree() {
    return this._transport.getStructTree(this._pageIndex);
  }
  _destroy() {
    this.destroyed = true;
    const waitOn = [];
    for (const intentState of this._intentStates.values()) {
      this._abortOperatorList({
        intentState,
        reason: new Error("Page was destroyed."),
        force: true
      });
      if (intentState.opListReadCapability) {
        continue;
      }
      for (const internalRenderTask of intentState.renderTasks) {
        waitOn.push(internalRenderTask.completed);
        internalRenderTask.cancel();
      }
    }
    this.objs.clear();
    __privateSet(this, _pendingCleanup, false);
    __privateMethod(this, _abortDelayedCleanup, abortDelayedCleanup_fn).call(this);
    return Promise.all(waitOn);
  }
  cleanup(resetStats = false) {
    __privateSet(this, _pendingCleanup, true);
    const success = __privateMethod(this, _tryCleanup, tryCleanup_fn).call(this, false);
    if (resetStats && success) {
      this._stats && (this._stats = new StatTimer());
    }
    return success;
  }
  _startRenderPage(transparency, cacheKey) {
    var _a2, _b;
    const intentState = this._intentStates.get(cacheKey);
    if (!intentState) {
      return;
    }
    (_a2 = this._stats) == null ? void 0 : _a2.timeEnd("Page Request");
    (_b = intentState.displayReadyCapability) == null ? void 0 : _b.resolve(transparency);
  }
  _renderPageChunk(operatorListChunk, intentState) {
    for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {
      intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
      intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
    }
    intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
    intentState.operatorList.separateAnnots = operatorListChunk.separateAnnots;
    for (const internalRenderTask of intentState.renderTasks) {
      internalRenderTask.operatorListChanged();
    }
    if (operatorListChunk.lastChunk) {
      __privateMethod(this, _tryCleanup, tryCleanup_fn).call(this, true);
    }
  }
  _pumpOperatorList({
    renderingIntent,
    cacheKey,
    annotationStorageSerializable,
    modifiedIds
  }) {
    const {
      map,
      transfer
    } = annotationStorageSerializable;
    const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
      pageIndex: this._pageIndex,
      intent: renderingIntent,
      cacheKey,
      annotationStorage: map,
      modifiedIds
    }, transfer);
    const reader = readableStream.getReader();
    const intentState = this._intentStates.get(cacheKey);
    intentState.streamReader = reader;
    const pump = () => {
      reader.read().then(({
        value,
        done
      }) => {
        if (done) {
          intentState.streamReader = null;
          return;
        }
        if (this._transport.destroyed) {
          return;
        }
        this._renderPageChunk(value, intentState);
        pump();
      }, (reason) => {
        intentState.streamReader = null;
        if (this._transport.destroyed) {
          return;
        }
        if (intentState.operatorList) {
          intentState.operatorList.lastChunk = true;
          for (const internalRenderTask of intentState.renderTasks) {
            internalRenderTask.operatorListChanged();
          }
          __privateMethod(this, _tryCleanup, tryCleanup_fn).call(this, true);
        }
        if (intentState.displayReadyCapability) {
          intentState.displayReadyCapability.reject(reason);
        } else if (intentState.opListReadCapability) {
          intentState.opListReadCapability.reject(reason);
        } else {
          throw reason;
        }
      });
    };
    pump();
  }
  _abortOperatorList({
    intentState,
    reason,
    force = false
  }) {
    if (!intentState.streamReader) {
      return;
    }
    if (intentState.streamReaderCancelTimeout) {
      clearTimeout(intentState.streamReaderCancelTimeout);
      intentState.streamReaderCancelTimeout = null;
    }
    if (!force) {
      if (intentState.renderTasks.size > 0) {
        return;
      }
      if (reason instanceof RenderingCancelledException) {
        let delay = RENDERING_CANCELLED_TIMEOUT;
        if (reason.extraDelay > 0 && reason.extraDelay < 1e3) {
          delay += reason.extraDelay;
        }
        intentState.streamReaderCancelTimeout = setTimeout(() => {
          intentState.streamReaderCancelTimeout = null;
          this._abortOperatorList({
            intentState,
            reason,
            force: true
          });
        }, delay);
        return;
      }
    }
    intentState.streamReader.cancel(new AbortException(reason.message)).catch(() => {
    });
    intentState.streamReader = null;
    if (this._transport.destroyed) {
      return;
    }
    for (const [curCacheKey, curIntentState] of this._intentStates) {
      if (curIntentState === intentState) {
        this._intentStates.delete(curCacheKey);
        break;
      }
    }
    this.cleanup();
  }
  get stats() {
    return this._stats;
  }
};
_delayedCleanupTimeout = new WeakMap();
_pendingCleanup = new WeakMap();
_tryCleanup = new WeakSet();
tryCleanup_fn = function(delayed = false) {
  __privateMethod(this, _abortDelayedCleanup, abortDelayedCleanup_fn).call(this);
  if (!__privateGet(this, _pendingCleanup) || this.destroyed) {
    return false;
  }
  if (delayed) {
    __privateSet(this, _delayedCleanupTimeout, setTimeout(() => {
      __privateSet(this, _delayedCleanupTimeout, null);
      __privateMethod(this, _tryCleanup, tryCleanup_fn).call(this, false);
    }, DELAYED_CLEANUP_TIMEOUT));
    return false;
  }
  for (const {
    renderTasks,
    operatorList
  } of this._intentStates.values()) {
    if (renderTasks.size > 0 || !operatorList.lastChunk) {
      return false;
    }
  }
  this._intentStates.clear();
  this.objs.clear();
  __privateSet(this, _pendingCleanup, false);
  return true;
};
_abortDelayedCleanup = new WeakSet();
abortDelayedCleanup_fn = function() {
  if (__privateGet(this, _delayedCleanupTimeout)) {
    clearTimeout(__privateGet(this, _delayedCleanupTimeout));
    __privateSet(this, _delayedCleanupTimeout, null);
  }
};
var _listeners, _deferred;
var LoopbackPort = class {
  constructor() {
    __privateAdd(this, _listeners, /* @__PURE__ */ new Set());
    __privateAdd(this, _deferred, Promise.resolve());
  }
  postMessage(obj, transfer) {
    const event = {
      data: structuredClone(obj, transfer ? {
        transfer
      } : null)
    };
    __privateGet(this, _deferred).then(() => {
      for (const listener of __privateGet(this, _listeners)) {
        listener.call(this, event);
      }
    });
  }
  addEventListener(name, listener) {
    __privateGet(this, _listeners).add(listener);
  }
  removeEventListener(name, listener) {
    __privateGet(this, _listeners).delete(listener);
  }
  terminate() {
    __privateGet(this, _listeners).clear();
  }
};
_listeners = new WeakMap();
_deferred = new WeakMap();
var _fakeWorkerId, _isWorkerDisabled, _workerPorts, _resolve, resolve_fn, _mainThreadWorkerMessageHandler, mainThreadWorkerMessageHandler_get;
var _PDFWorker = class {
  constructor({
    name = null,
    port = null,
    verbosity: verbosity2 = getVerbosityLevel()
  } = {}) {
    __privateAdd(this, _resolve);
    var _a2;
    this.name = name;
    this.destroyed = false;
    this.verbosity = verbosity2;
    this._readyCapability = Promise.withResolvers();
    this._port = null;
    this._webWorker = null;
    this._messageHandler = null;
    if (port) {
      if ((_a2 = __privateGet(_PDFWorker, _workerPorts)) == null ? void 0 : _a2.has(port)) {
        throw new Error("Cannot use more than one PDFWorker per port.");
      }
      (__privateGet(_PDFWorker, _workerPorts) || __privateSet(_PDFWorker, _workerPorts, /* @__PURE__ */ new WeakMap())).set(port, this);
      this._initializeFromPort(port);
      return;
    }
    this._initialize();
  }
  get promise() {
    if (isNodeJS) {
      return Promise.all([NodePackages.promise, this._readyCapability.promise]);
    }
    return this._readyCapability.promise;
  }
  get port() {
    return this._port;
  }
  get messageHandler() {
    return this._messageHandler;
  }
  _initializeFromPort(port) {
    this._port = port;
    this._messageHandler = new MessageHandler("main", "worker", port);
    this._messageHandler.on("ready", function() {
    });
    __privateMethod(this, _resolve, resolve_fn).call(this);
  }
  _initialize() {
    if (__privateGet(_PDFWorker, _isWorkerDisabled) || __privateGet(_PDFWorker, _mainThreadWorkerMessageHandler, mainThreadWorkerMessageHandler_get)) {
      this._setupFakeWorker();
      return;
    }
    let {
      workerSrc
    } = _PDFWorker;
    try {
      if (!_PDFWorker._isSameOrigin(window.location.href, workerSrc)) {
        workerSrc = _PDFWorker._createCDNWrapper(new URL(workerSrc, window.location).href);
      }
      const worker = new Worker(workerSrc, {
        type: "module"
      });
      const messageHandler = new MessageHandler("main", "worker", worker);
      const terminateEarly = () => {
        ac.abort();
        messageHandler.destroy();
        worker.terminate();
        if (this.destroyed) {
          this._readyCapability.reject(new Error("Worker was destroyed"));
        } else {
          this._setupFakeWorker();
        }
      };
      const ac = new AbortController();
      worker.addEventListener("error", () => {
        if (!this._webWorker) {
          terminateEarly();
        }
      }, {
        signal: ac.signal
      });
      messageHandler.on("test", (data) => {
        ac.abort();
        if (this.destroyed || !data) {
          terminateEarly();
          return;
        }
        this._messageHandler = messageHandler;
        this._port = worker;
        this._webWorker = worker;
        __privateMethod(this, _resolve, resolve_fn).call(this);
      });
      messageHandler.on("ready", (data) => {
        ac.abort();
        if (this.destroyed) {
          terminateEarly();
          return;
        }
        try {
          sendTest();
        } catch (e) {
          this._setupFakeWorker();
        }
      });
      const sendTest = () => {
        const testObj = new Uint8Array();
        messageHandler.send("test", testObj, [testObj.buffer]);
      };
      sendTest();
      return;
    } catch (e) {
      info("The worker has been disabled.");
    }
    this._setupFakeWorker();
  }
  _setupFakeWorker() {
    if (!__privateGet(_PDFWorker, _isWorkerDisabled)) {
      warn("Setting up fake worker.");
      __privateSet(_PDFWorker, _isWorkerDisabled, true);
    }
    _PDFWorker._setupFakeWorkerGlobal.then((WorkerMessageHandler) => {
      if (this.destroyed) {
        this._readyCapability.reject(new Error("Worker was destroyed"));
        return;
      }
      const port = new LoopbackPort();
      this._port = port;
      const id = `fake${__privateWrapper(_PDFWorker, _fakeWorkerId)._++}`;
      const workerHandler = new MessageHandler(id + "_worker", id, port);
      WorkerMessageHandler.setup(workerHandler, port);
      this._messageHandler = new MessageHandler(id, id + "_worker", port);
      __privateMethod(this, _resolve, resolve_fn).call(this);
    }).catch((reason) => {
      this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`));
    });
  }
  destroy() {
    var _a2;
    this.destroyed = true;
    if (this._webWorker) {
      this._webWorker.terminate();
      this._webWorker = null;
    }
    (_a2 = __privateGet(_PDFWorker, _workerPorts)) == null ? void 0 : _a2.delete(this._port);
    this._port = null;
    if (this._messageHandler) {
      this._messageHandler.destroy();
      this._messageHandler = null;
    }
  }
  static fromPort(params) {
    var _a2;
    if (!(params == null ? void 0 : params.port)) {
      throw new Error("PDFWorker.fromPort - invalid method signature.");
    }
    const cachedPort = (_a2 = __privateGet(this, _workerPorts)) == null ? void 0 : _a2.get(params.port);
    if (cachedPort) {
      if (cachedPort._pendingDestroy) {
        throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
      }
      return cachedPort;
    }
    return new _PDFWorker(params);
  }
  static get workerSrc() {
    if (GlobalWorkerOptions.workerSrc) {
      return GlobalWorkerOptions.workerSrc;
    }
    throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
  }
  static get _setupFakeWorkerGlobal() {
    const loader = async () => {
      if (__privateGet(this, _mainThreadWorkerMessageHandler, mainThreadWorkerMessageHandler_get)) {
        return __privateGet(this, _mainThreadWorkerMessageHandler, mainThreadWorkerMessageHandler_get);
      }
      const worker = await import(
        /*webpackIgnore: true*/
        this.workerSrc
      );
      return worker.WorkerMessageHandler;
    };
    return shadow(this, "_setupFakeWorkerGlobal", loader());
  }
};
var PDFWorker = _PDFWorker;
_fakeWorkerId = new WeakMap();
_isWorkerDisabled = new WeakMap();
_workerPorts = new WeakMap();
_resolve = new WeakSet();
resolve_fn = function() {
  this._readyCapability.resolve();
  this._messageHandler.send("configure", {
    verbosity: this.verbosity
  });
};
_mainThreadWorkerMessageHandler = new WeakSet();
mainThreadWorkerMessageHandler_get = function() {
  var _a2;
  try {
    return ((_a2 = globalThis.pdfjsWorker) == null ? void 0 : _a2.WorkerMessageHandler) || null;
  } catch (e) {
    return null;
  }
};
__privateAdd(PDFWorker, _mainThreadWorkerMessageHandler);
__privateAdd(PDFWorker, _fakeWorkerId, 0);
__privateAdd(PDFWorker, _isWorkerDisabled, false);
__privateAdd(PDFWorker, _workerPorts, void 0);
(() => {
  if (isNodeJS) {
    __privateSet(_PDFWorker, _isWorkerDisabled, true);
    GlobalWorkerOptions.workerSrc || (GlobalWorkerOptions.workerSrc = "./pdf.worker.mjs");
  }
  _PDFWorker._isSameOrigin = (baseUrl, otherUrl) => {
    let base;
    try {
      base = new URL(baseUrl);
      if (!base.origin || base.origin === "null") {
        return false;
      }
    } catch (e) {
      return false;
    }
    const other = new URL(otherUrl, base);
    return base.origin === other.origin;
  };
  _PDFWorker._createCDNWrapper = (url) => {
    const wrapper = `await import("${url}");`;
    return URL.createObjectURL(new Blob([wrapper], {
      type: "text/javascript"
    }));
  };
})();
var _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _cacheSimpleMethod, cacheSimpleMethod_fn;
var WorkerTransport = class {
  constructor(messageHandler, loadingTask, networkStream, params, factory) {
    __privateAdd(this, _cacheSimpleMethod);
    __privateAdd(this, _methodPromises, /* @__PURE__ */ new Map());
    __privateAdd(this, _pageCache, /* @__PURE__ */ new Map());
    __privateAdd(this, _pagePromises, /* @__PURE__ */ new Map());
    __privateAdd(this, _pageRefCache, /* @__PURE__ */ new Map());
    __privateAdd(this, _passwordCapability, null);
    this.messageHandler = messageHandler;
    this.loadingTask = loadingTask;
    this.commonObjs = new PDFObjects();
    this.fontLoader = new FontLoader({
      ownerDocument: params.ownerDocument,
      styleElement: params.styleElement
    });
    this.loadingParams = params.loadingParams;
    this._params = params;
    this.canvasFactory = factory.canvasFactory;
    this.filterFactory = factory.filterFactory;
    this.cMapReaderFactory = factory.cMapReaderFactory;
    this.standardFontDataFactory = factory.standardFontDataFactory;
    this.destroyed = false;
    this.destroyCapability = null;
    this._networkStream = networkStream;
    this._fullReader = null;
    this._lastProgress = null;
    this.downloadInfoCapability = Promise.withResolvers();
    this.setupMessageHandler();
  }
  get annotationStorage() {
    return shadow(this, "annotationStorage", new AnnotationStorage());
  }
  getRenderingIntent(intent, annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, isEditing = false, isOpList = false) {
    let renderingIntent = RenderingIntentFlag.DISPLAY;
    let annotationStorageSerializable = SerializableEmpty;
    switch (intent) {
      case "any":
        renderingIntent = RenderingIntentFlag.ANY;
        break;
      case "display":
        break;
      case "print":
        renderingIntent = RenderingIntentFlag.PRINT;
        break;
      default:
        warn(`getRenderingIntent - invalid intent: ${intent}`);
    }
    const annotationStorage = renderingIntent & RenderingIntentFlag.PRINT && printAnnotationStorage instanceof PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
    switch (annotationMode) {
      case AnnotationMode.DISABLE:
        renderingIntent += RenderingIntentFlag.ANNOTATIONS_DISABLE;
        break;
      case AnnotationMode.ENABLE:
        break;
      case AnnotationMode.ENABLE_FORMS:
        renderingIntent += RenderingIntentFlag.ANNOTATIONS_FORMS;
        break;
      case AnnotationMode.ENABLE_STORAGE:
        renderingIntent += RenderingIntentFlag.ANNOTATIONS_STORAGE;
        annotationStorageSerializable = annotationStorage.serializable;
        break;
      default:
        warn(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
    }
    if (isEditing) {
      renderingIntent += RenderingIntentFlag.IS_EDITING;
    }
    if (isOpList) {
      renderingIntent += RenderingIntentFlag.OPLIST;
    }
    const {
      ids: modifiedIds,
      hash: modifiedIdsHash
    } = annotationStorage.modifiedIds;
    const cacheKeyBuf = [renderingIntent, annotationStorageSerializable.hash, modifiedIdsHash];
    return {
      renderingIntent,
      cacheKey: cacheKeyBuf.join("_"),
      annotationStorageSerializable,
      modifiedIds
    };
  }
  destroy() {
    var _a2;
    if (this.destroyCapability) {
      return this.destroyCapability.promise;
    }
    this.destroyed = true;
    this.destroyCapability = Promise.withResolvers();
    (_a2 = __privateGet(this, _passwordCapability)) == null ? void 0 : _a2.reject(new Error("Worker was destroyed during onPassword callback"));
    const waitOn = [];
    for (const page of __privateGet(this, _pageCache).values()) {
      waitOn.push(page._destroy());
    }
    __privateGet(this, _pageCache).clear();
    __privateGet(this, _pagePromises).clear();
    __privateGet(this, _pageRefCache).clear();
    if (this.hasOwnProperty("annotationStorage")) {
      this.annotationStorage.resetModified();
    }
    const terminated = this.messageHandler.sendWithPromise("Terminate", null);
    waitOn.push(terminated);
    Promise.all(waitOn).then(() => {
      var _a3;
      this.commonObjs.clear();
      this.fontLoader.clear();
      __privateGet(this, _methodPromises).clear();
      this.filterFactory.destroy();
      TextLayer.cleanup();
      (_a3 = this._networkStream) == null ? void 0 : _a3.cancelAllRequests(new AbortException("Worker was terminated."));
      if (this.messageHandler) {
        this.messageHandler.destroy();
        this.messageHandler = null;
      }
      this.destroyCapability.resolve();
    }, this.destroyCapability.reject);
    return this.destroyCapability.promise;
  }
  setupMessageHandler() {
    const {
      messageHandler,
      loadingTask
    } = this;
    messageHandler.on("GetReader", (data, sink) => {
      assert(this._networkStream, "GetReader - no `IPDFStream` instance available.");
      this._fullReader = this._networkStream.getFullReader();
      this._fullReader.onProgress = (evt) => {
        this._lastProgress = {
          loaded: evt.loaded,
          total: evt.total
        };
      };
      sink.onPull = () => {
        this._fullReader.read().then(function({
          value,
          done
        }) {
          if (done) {
            sink.close();
            return;
          }
          assert(value instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer.");
          sink.enqueue(new Uint8Array(value), 1, [value]);
        }).catch((reason) => {
          sink.error(reason);
        });
      };
      sink.onCancel = (reason) => {
        this._fullReader.cancel(reason);
        sink.ready.catch((readyReason) => {
          if (this.destroyed) {
            return;
          }
          throw readyReason;
        });
      };
    });
    messageHandler.on("ReaderHeadersReady", (data) => {
      const headersCapability = Promise.withResolvers();
      const fullReader = this._fullReader;
      fullReader.headersReady.then(() => {
        var _a2;
        if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
          if (this._lastProgress) {
            (_a2 = loadingTask.onProgress) == null ? void 0 : _a2.call(loadingTask, this._lastProgress);
          }
          fullReader.onProgress = (evt) => {
            var _a3;
            (_a3 = loadingTask.onProgress) == null ? void 0 : _a3.call(loadingTask, {
              loaded: evt.loaded,
              total: evt.total
            });
          };
        }
        headersCapability.resolve({
          isStreamingSupported: fullReader.isStreamingSupported,
          isRangeSupported: fullReader.isRangeSupported,
          contentLength: fullReader.contentLength
        });
      }, headersCapability.reject);
      return headersCapability.promise;
    });
    messageHandler.on("GetRangeReader", (data, sink) => {
      assert(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
      const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
      if (!rangeReader) {
        sink.close();
        return;
      }
      sink.onPull = () => {
        rangeReader.read().then(function({
          value,
          done
        }) {
          if (done) {
            sink.close();
            return;
          }
          assert(value instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer.");
          sink.enqueue(new Uint8Array(value), 1, [value]);
        }).catch((reason) => {
          sink.error(reason);
        });
      };
      sink.onCancel = (reason) => {
        rangeReader.cancel(reason);
        sink.ready.catch((readyReason) => {
          if (this.destroyed) {
            return;
          }
          throw readyReason;
        });
      };
    });
    messageHandler.on("GetDoc", ({
      pdfInfo
    }) => {
      this._numPages = pdfInfo.numPages;
      this._htmlForXfa = pdfInfo.htmlForXfa;
      delete pdfInfo.htmlForXfa;
      loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
    });
    messageHandler.on("DocException", function(ex) {
      let reason;
      switch (ex.name) {
        case "PasswordException":
          reason = new PasswordException(ex.message, ex.code);
          break;
        case "InvalidPDFException":
          reason = new InvalidPDFException(ex.message);
          break;
        case "MissingPDFException":
          reason = new MissingPDFException(ex.message);
          break;
        case "UnexpectedResponseException":
          reason = new UnexpectedResponseException(ex.message, ex.status);
          break;
        case "UnknownErrorException":
          reason = new UnknownErrorException(ex.message, ex.details);
          break;
        default:
          unreachable("DocException - expected a valid Error.");
      }
      loadingTask._capability.reject(reason);
    });
    messageHandler.on("PasswordRequest", (exception) => {
      __privateSet(this, _passwordCapability, Promise.withResolvers());
      if (loadingTask.onPassword) {
        const updatePassword = (password) => {
          if (password instanceof Error) {
            __privateGet(this, _passwordCapability).reject(password);
          } else {
            __privateGet(this, _passwordCapability).resolve({
              password
            });
          }
        };
        try {
          loadingTask.onPassword(updatePassword, exception.code);
        } catch (ex) {
          __privateGet(this, _passwordCapability).reject(ex);
        }
      } else {
        __privateGet(this, _passwordCapability).reject(new PasswordException(exception.message, exception.code));
      }
      return __privateGet(this, _passwordCapability).promise;
    });
    messageHandler.on("DataLoaded", (data) => {
      var _a2;
      (_a2 = loadingTask.onProgress) == null ? void 0 : _a2.call(loadingTask, {
        loaded: data.length,
        total: data.length
      });
      this.downloadInfoCapability.resolve(data);
    });
    messageHandler.on("StartRenderPage", (data) => {
      if (this.destroyed) {
        return;
      }
      const page = __privateGet(this, _pageCache).get(data.pageIndex);
      page._startRenderPage(data.transparency, data.cacheKey);
    });
    messageHandler.on("commonobj", ([id, type, exportedData]) => {
      var _a2;
      if (this.destroyed) {
        return null;
      }
      if (this.commonObjs.has(id)) {
        return null;
      }
      switch (type) {
        case "Font":
          const {
            disableFontFace,
            fontExtraProperties,
            pdfBug
          } = this._params;
          if ("error" in exportedData) {
            const exportedError = exportedData.error;
            warn(`Error during font loading: ${exportedError}`);
            this.commonObjs.resolve(id, exportedError);
            break;
          }
          const inspectFont = pdfBug && ((_a2 = globalThis.FontInspector) == null ? void 0 : _a2.enabled) ? (font2, url) => globalThis.FontInspector.fontAdded(font2, url) : null;
          const font = new FontFaceObject(exportedData, {
            disableFontFace,
            inspectFont
          });
          this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", {
            id
          })).finally(() => {
            if (!fontExtraProperties && font.data) {
              font.data = null;
            }
            this.commonObjs.resolve(id, font);
          });
          break;
        case "CopyLocalImage":
          const {
            imageRef
          } = exportedData;
          assert(imageRef, "The imageRef must be defined.");
          for (const pageProxy of __privateGet(this, _pageCache).values()) {
            for (const [, data] of pageProxy.objs) {
              if ((data == null ? void 0 : data.ref) !== imageRef) {
                continue;
              }
              if (!data.dataLen) {
                return null;
              }
              this.commonObjs.resolve(id, structuredClone(data));
              return data.dataLen;
            }
          }
          break;
        case "FontPath":
        case "Image":
        case "Pattern":
          this.commonObjs.resolve(id, exportedData);
          break;
        default:
          throw new Error(`Got unknown common object type ${type}`);
      }
      return null;
    });
    messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
      var _a2;
      if (this.destroyed) {
        return;
      }
      const pageProxy = __privateGet(this, _pageCache).get(pageIndex);
      if (pageProxy.objs.has(id)) {
        return;
      }
      if (pageProxy._intentStates.size === 0) {
        (_a2 = imageData == null ? void 0 : imageData.bitmap) == null ? void 0 : _a2.close();
        return;
      }
      switch (type) {
        case "Image":
          pageProxy.objs.resolve(id, imageData);
          if ((imageData == null ? void 0 : imageData.dataLen) > MAX_IMAGE_SIZE_TO_CACHE) {
            pageProxy._maybeCleanupAfterRender = true;
          }
          break;
        case "Pattern":
          pageProxy.objs.resolve(id, imageData);
          break;
        default:
          throw new Error(`Got unknown object type ${type}`);
      }
    });
    messageHandler.on("DocProgress", (data) => {
      var _a2;
      if (this.destroyed) {
        return;
      }
      (_a2 = loadingTask.onProgress) == null ? void 0 : _a2.call(loadingTask, {
        loaded: data.loaded,
        total: data.total
      });
    });
    messageHandler.on("FetchBuiltInCMap", (data) => {
      if (this.destroyed) {
        return Promise.reject(new Error("Worker was destroyed."));
      }
      if (!this.cMapReaderFactory) {
        return Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."));
      }
      return this.cMapReaderFactory.fetch(data);
    });
    messageHandler.on("FetchStandardFontData", (data) => {
      if (this.destroyed) {
        return Promise.reject(new Error("Worker was destroyed."));
      }
      if (!this.standardFontDataFactory) {
        return Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."));
      }
      return this.standardFontDataFactory.fetch(data);
    });
  }
  getData() {
    return this.messageHandler.sendWithPromise("GetData", null);
  }
  saveDocument() {
    var _a2, _b;
    if (this.annotationStorage.size <= 0) {
      warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
    }
    const {
      map,
      transfer
    } = this.annotationStorage.serializable;
    return this.messageHandler.sendWithPromise("SaveDocument", {
      isPureXfa: !!this._htmlForXfa,
      numPages: this._numPages,
      annotationStorage: map,
      filename: (_b = (_a2 = this._fullReader) == null ? void 0 : _a2.filename) != null ? _b : null
    }, transfer).finally(() => {
      this.annotationStorage.resetModified();
    });
  }
  getPage(pageNumber) {
    if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
      return Promise.reject(new Error("Invalid page request."));
    }
    const pageIndex = pageNumber - 1, cachedPromise = __privateGet(this, _pagePromises).get(pageIndex);
    if (cachedPromise) {
      return cachedPromise;
    }
    const promise = this.messageHandler.sendWithPromise("GetPage", {
      pageIndex
    }).then((pageInfo) => {
      if (this.destroyed) {
        throw new Error("Transport destroyed");
      }
      if (pageInfo.refStr) {
        __privateGet(this, _pageRefCache).set(pageInfo.refStr, pageNumber);
      }
      const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug);
      __privateGet(this, _pageCache).set(pageIndex, page);
      return page;
    });
    __privateGet(this, _pagePromises).set(pageIndex, promise);
    return promise;
  }
  getPageIndex(ref) {
    if (!isRefProxy(ref)) {
      return Promise.reject(new Error("Invalid pageIndex request."));
    }
    return this.messageHandler.sendWithPromise("GetPageIndex", {
      num: ref.num,
      gen: ref.gen
    });
  }
  getAnnotations(pageIndex, intent) {
    return this.messageHandler.sendWithPromise("GetAnnotations", {
      pageIndex,
      intent
    });
  }
  getFieldObjects() {
    return __privateMethod(this, _cacheSimpleMethod, cacheSimpleMethod_fn).call(this, "GetFieldObjects");
  }
  hasJSActions() {
    return __privateMethod(this, _cacheSimpleMethod, cacheSimpleMethod_fn).call(this, "HasJSActions");
  }
  getCalculationOrderIds() {
    return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
  }
  getDestinations() {
    return this.messageHandler.sendWithPromise("GetDestinations", null);
  }
  getDestination(id) {
    if (typeof id !== "string") {
      return Promise.reject(new Error("Invalid destination request."));
    }
    return this.messageHandler.sendWithPromise("GetDestination", {
      id
    });
  }
  getPageLabels() {
    return this.messageHandler.sendWithPromise("GetPageLabels", null);
  }
  getPageLayout() {
    return this.messageHandler.sendWithPromise("GetPageLayout", null);
  }
  getPageMode() {
    return this.messageHandler.sendWithPromise("GetPageMode", null);
  }
  getViewerPreferences() {
    return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
  }
  getOpenAction() {
    return this.messageHandler.sendWithPromise("GetOpenAction", null);
  }
  getAttachments() {
    return this.messageHandler.sendWithPromise("GetAttachments", null);
  }
  getDocJSActions() {
    return __privateMethod(this, _cacheSimpleMethod, cacheSimpleMethod_fn).call(this, "GetDocJSActions");
  }
  getPageJSActions(pageIndex) {
    return this.messageHandler.sendWithPromise("GetPageJSActions", {
      pageIndex
    });
  }
  getStructTree(pageIndex) {
    return this.messageHandler.sendWithPromise("GetStructTree", {
      pageIndex
    });
  }
  getOutline() {
    return this.messageHandler.sendWithPromise("GetOutline", null);
  }
  getOptionalContentConfig(renderingIntent) {
    return __privateMethod(this, _cacheSimpleMethod, cacheSimpleMethod_fn).call(this, "GetOptionalContentConfig").then((data) => new OptionalContentConfig(data, renderingIntent));
  }
  getPermissions() {
    return this.messageHandler.sendWithPromise("GetPermissions", null);
  }
  getMetadata() {
    const name = "GetMetadata", cachedPromise = __privateGet(this, _methodPromises).get(name);
    if (cachedPromise) {
      return cachedPromise;
    }
    const promise = this.messageHandler.sendWithPromise(name, null).then((results) => {
      var _a2, _b, _c, _d;
      return {
        info: results[0],
        metadata: results[1] ? new Metadata(results[1]) : null,
        contentDispositionFilename: (_b = (_a2 = this._fullReader) == null ? void 0 : _a2.filename) != null ? _b : null,
        contentLength: (_d = (_c = this._fullReader) == null ? void 0 : _c.contentLength) != null ? _d : null
      };
    });
    __privateGet(this, _methodPromises).set(name, promise);
    return promise;
  }
  getMarkInfo() {
    return this.messageHandler.sendWithPromise("GetMarkInfo", null);
  }
  async startCleanup(keepLoadedFonts = false) {
    if (this.destroyed) {
      return;
    }
    await this.messageHandler.sendWithPromise("Cleanup", null);
    for (const page of __privateGet(this, _pageCache).values()) {
      const cleanupSuccessful = page.cleanup();
      if (!cleanupSuccessful) {
        throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);
      }
    }
    this.commonObjs.clear();
    if (!keepLoadedFonts) {
      this.fontLoader.clear();
    }
    __privateGet(this, _methodPromises).clear();
    this.filterFactory.destroy(true);
    TextLayer.cleanup();
  }
  cachedPageNumber(ref) {
    var _a2;
    if (!isRefProxy(ref)) {
      return null;
    }
    const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
    return (_a2 = __privateGet(this, _pageRefCache).get(refStr)) != null ? _a2 : null;
  }
};
_methodPromises = new WeakMap();
_pageCache = new WeakMap();
_pagePromises = new WeakMap();
_pageRefCache = new WeakMap();
_passwordCapability = new WeakMap();
_cacheSimpleMethod = new WeakSet();
cacheSimpleMethod_fn = function(name, data = null) {
  const cachedPromise = __privateGet(this, _methodPromises).get(name);
  if (cachedPromise) {
    return cachedPromise;
  }
  const promise = this.messageHandler.sendWithPromise(name, data);
  __privateGet(this, _methodPromises).set(name, promise);
  return promise;
};
var INITIAL_DATA = Symbol("INITIAL_DATA");
var _objs, _ensureObj, ensureObj_fn;
var PDFObjects = class {
  constructor() {
    __privateAdd(this, _ensureObj);
    __privateAdd(this, _objs, /* @__PURE__ */ Object.create(null));
  }
  get(objId, callback = null) {
    if (callback) {
      const obj2 = __privateMethod(this, _ensureObj, ensureObj_fn).call(this, objId);
      obj2.promise.then(() => callback(obj2.data));
      return null;
    }
    const obj = __privateGet(this, _objs)[objId];
    if (!obj || obj.data === INITIAL_DATA) {
      throw new Error(`Requesting object that isn't resolved yet ${objId}.`);
    }
    return obj.data;
  }
  has(objId) {
    const obj = __privateGet(this, _objs)[objId];
    return !!obj && obj.data !== INITIAL_DATA;
  }
  resolve(objId, data = null) {
    const obj = __privateMethod(this, _ensureObj, ensureObj_fn).call(this, objId);
    obj.data = data;
    obj.resolve();
  }
  clear() {
    var _a2;
    for (const objId in __privateGet(this, _objs)) {
      const {
        data
      } = __privateGet(this, _objs)[objId];
      (_a2 = data == null ? void 0 : data.bitmap) == null ? void 0 : _a2.close();
    }
    __privateSet(this, _objs, /* @__PURE__ */ Object.create(null));
  }
  *[Symbol.iterator]() {
    for (const objId in __privateGet(this, _objs)) {
      const {
        data
      } = __privateGet(this, _objs)[objId];
      if (data === INITIAL_DATA) {
        continue;
      }
      yield [objId, data];
    }
  }
};
_objs = new WeakMap();
_ensureObj = new WeakSet();
ensureObj_fn = function(objId) {
  var _a2;
  return (_a2 = __privateGet(this, _objs))[objId] || (_a2[objId] = {
    ...Promise.withResolvers(),
    data: INITIAL_DATA
  });
};
var _internalRenderTask;
var RenderTask = class {
  constructor(internalRenderTask) {
    __privateAdd(this, _internalRenderTask, null);
    __privateSet(this, _internalRenderTask, internalRenderTask);
    this.onContinue = null;
  }
  get promise() {
    return __privateGet(this, _internalRenderTask).capability.promise;
  }
  cancel(extraDelay = 0) {
    __privateGet(this, _internalRenderTask).cancel(null, extraDelay);
  }
  get separateAnnots() {
    const {
      separateAnnots
    } = __privateGet(this, _internalRenderTask).operatorList;
    if (!separateAnnots) {
      return false;
    }
    const {
      annotationCanvasMap
    } = __privateGet(this, _internalRenderTask);
    return separateAnnots.form || separateAnnots.canvas && (annotationCanvasMap == null ? void 0 : annotationCanvasMap.size) > 0;
  }
};
_internalRenderTask = new WeakMap();
var _rAF, _canvasInUse;
var _InternalRenderTask = class {
  constructor({
    callback,
    params,
    objs,
    commonObjs,
    annotationCanvasMap,
    operatorList,
    pageIndex,
    canvasFactory,
    filterFactory,
    useRequestAnimationFrame = false,
    pdfBug = false,
    pageColors = null
  }) {
    __privateAdd(this, _rAF, null);
    this.callback = callback;
    this.params = params;
    this.objs = objs;
    this.commonObjs = commonObjs;
    this.annotationCanvasMap = annotationCanvasMap;
    this.operatorListIdx = null;
    this.operatorList = operatorList;
    this._pageIndex = pageIndex;
    this.canvasFactory = canvasFactory;
    this.filterFactory = filterFactory;
    this._pdfBug = pdfBug;
    this.pageColors = pageColors;
    this.running = false;
    this.graphicsReadyCallback = null;
    this.graphicsReady = false;
    this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
    this.cancelled = false;
    this.capability = Promise.withResolvers();
    this.task = new RenderTask(this);
    this._cancelBound = this.cancel.bind(this);
    this._continueBound = this._continue.bind(this);
    this._scheduleNextBound = this._scheduleNext.bind(this);
    this._nextBound = this._next.bind(this);
    this._canvas = params.canvasContext.canvas;
  }
  get completed() {
    return this.capability.promise.catch(function() {
    });
  }
  initializeGraphics({
    transparency = false,
    optionalContentConfig
  }) {
    var _a2, _b;
    if (this.cancelled) {
      return;
    }
    if (this._canvas) {
      if (__privateGet(_InternalRenderTask, _canvasInUse).has(this._canvas)) {
        throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");
      }
      __privateGet(_InternalRenderTask, _canvasInUse).add(this._canvas);
    }
    if (this._pdfBug && ((_a2 = globalThis.StepperManager) == null ? void 0 : _a2.enabled)) {
      this.stepper = globalThis.StepperManager.create(this._pageIndex);
      this.stepper.init(this.operatorList);
      this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
    }
    const {
      canvasContext,
      viewport,
      transform,
      background
    } = this.params;
    this.gfx = new CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
      optionalContentConfig
    }, this.annotationCanvasMap, this.pageColors);
    this.gfx.beginDrawing({
      transform,
      viewport,
      transparency,
      background
    });
    this.operatorListIdx = 0;
    this.graphicsReady = true;
    (_b = this.graphicsReadyCallback) == null ? void 0 : _b.call(this);
  }
  cancel(error = null, extraDelay = 0) {
    var _a2;
    this.running = false;
    this.cancelled = true;
    (_a2 = this.gfx) == null ? void 0 : _a2.endDrawing();
    if (__privateGet(this, _rAF)) {
      window.cancelAnimationFrame(__privateGet(this, _rAF));
      __privateSet(this, _rAF, null);
    }
    __privateGet(_InternalRenderTask, _canvasInUse).delete(this._canvas);
    this.callback(error || new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, extraDelay));
  }
  operatorListChanged() {
    var _a2;
    if (!this.graphicsReady) {
      this.graphicsReadyCallback || (this.graphicsReadyCallback = this._continueBound);
      return;
    }
    (_a2 = this.stepper) == null ? void 0 : _a2.updateOperatorList(this.operatorList);
    if (this.running) {
      return;
    }
    this._continue();
  }
  _continue() {
    this.running = true;
    if (this.cancelled) {
      return;
    }
    if (this.task.onContinue) {
      this.task.onContinue(this._scheduleNextBound);
    } else {
      this._scheduleNext();
    }
  }
  _scheduleNext() {
    if (this._useRequestAnimationFrame) {
      __privateSet(this, _rAF, window.requestAnimationFrame(() => {
        __privateSet(this, _rAF, null);
        this._nextBound().catch(this._cancelBound);
      }));
    } else {
      Promise.resolve().then(this._nextBound).catch(this._cancelBound);
    }
  }
  async _next() {
    if (this.cancelled) {
      return;
    }
    this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
    if (this.operatorListIdx === this.operatorList.argsArray.length) {
      this.running = false;
      if (this.operatorList.lastChunk) {
        this.gfx.endDrawing();
        __privateGet(_InternalRenderTask, _canvasInUse).delete(this._canvas);
        this.callback();
      }
    }
  }
};
var InternalRenderTask = _InternalRenderTask;
_rAF = new WeakMap();
_canvasInUse = new WeakMap();
__privateAdd(InternalRenderTask, _canvasInUse, /* @__PURE__ */ new WeakSet());
var version2 = "4.6.82";
var build = "9b541910f";
function makeColorComp(n) {
  return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
}
function scaleAndClamp(x) {
  return Math.max(0, Math.min(255, 255 * x));
}
var ColorConverters = class {
  static CMYK_G([c, y, m, k]) {
    return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
  }
  static G_CMYK([g]) {
    return ["CMYK", 0, 0, 0, 1 - g];
  }
  static G_RGB([g]) {
    return ["RGB", g, g, g];
  }
  static G_rgb([g]) {
    g = scaleAndClamp(g);
    return [g, g, g];
  }
  static G_HTML([g]) {
    const G = makeColorComp(g);
    return `#${G}${G}${G}`;
  }
  static RGB_G([r, g, b]) {
    return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
  }
  static RGB_rgb(color) {
    return color.map(scaleAndClamp);
  }
  static RGB_HTML(color) {
    return `#${color.map(makeColorComp).join("")}`;
  }
  static T_HTML() {
    return "#00000000";
  }
  static T_rgb() {
    return [null];
  }
  static CMYK_RGB([c, y, m, k]) {
    return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
  }
  static CMYK_rgb([c, y, m, k]) {
    return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))];
  }
  static CMYK_HTML(components) {
    const rgb = this.CMYK_RGB(components).slice(1);
    return this.RGB_HTML(rgb);
  }
  static RGB_CMYK([r, g, b]) {
    const c = 1 - r;
    const m = 1 - g;
    const y = 1 - b;
    const k = Math.min(c, m, y);
    return ["CMYK", c, m, y, k];
  }
};
var XfaLayer = class {
  static setupStorage(html, id, element2, storage, intent) {
    const storedData = storage.getValue(id, {
      value: null
    });
    switch (element2.name) {
      case "textarea":
        if (storedData.value !== null) {
          html.textContent = storedData.value;
        }
        if (intent === "print") {
          break;
        }
        html.addEventListener("input", (event) => {
          storage.setValue(id, {
            value: event.target.value
          });
        });
        break;
      case "input":
        if (element2.attributes.type === "radio" || element2.attributes.type === "checkbox") {
          if (storedData.value === element2.attributes.xfaOn) {
            html.setAttribute("checked", true);
          } else if (storedData.value === element2.attributes.xfaOff) {
            html.removeAttribute("checked");
          }
          if (intent === "print") {
            break;
          }
          html.addEventListener("change", (event) => {
            storage.setValue(id, {
              value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
            });
          });
        } else {
          if (storedData.value !== null) {
            html.setAttribute("value", storedData.value);
          }
          if (intent === "print") {
            break;
          }
          html.addEventListener("input", (event) => {
            storage.setValue(id, {
              value: event.target.value
            });
          });
        }
        break;
      case "select":
        if (storedData.value !== null) {
          html.setAttribute("value", storedData.value);
          for (const option2 of element2.children) {
            if (option2.attributes.value === storedData.value) {
              option2.attributes.selected = true;
            } else if (option2.attributes.hasOwnProperty("selected")) {
              delete option2.attributes.selected;
            }
          }
        }
        html.addEventListener("input", (event) => {
          const options = event.target.options;
          const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
          storage.setValue(id, {
            value
          });
        });
        break;
    }
  }
  static setAttributes({
    html,
    element: element2,
    storage = null,
    intent,
    linkService
  }) {
    const {
      attributes
    } = element2;
    const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
    if (attributes.type === "radio") {
      attributes.name = `${attributes.name}-${intent}`;
    }
    for (const [key, value] of Object.entries(attributes)) {
      if (value === null || value === void 0) {
        continue;
      }
      switch (key) {
        case "class":
          if (value.length) {
            html.setAttribute(key, value.join(" "));
          }
          break;
        case "dataId":
          break;
        case "id":
          html.setAttribute("data-element-id", value);
          break;
        case "style":
          Object.assign(html.style, value);
          break;
        case "textContent":
          html.textContent = value;
          break;
        default:
          if (!isHTMLAnchorElement || key !== "href" && key !== "newWindow") {
            html.setAttribute(key, value);
          }
      }
    }
    if (isHTMLAnchorElement) {
      linkService.addLinkAttributes(html, attributes.href, attributes.newWindow);
    }
    if (storage && attributes.dataId) {
      this.setupStorage(html, attributes.dataId, element2, storage);
    }
  }
  static render(parameters) {
    var _a2, _b;
    const storage = parameters.annotationStorage;
    const linkService = parameters.linkService;
    const root = parameters.xfaHtml;
    const intent = parameters.intent || "display";
    const rootHtml = document.createElement(root.name);
    if (root.attributes) {
      this.setAttributes({
        html: rootHtml,
        element: root,
        intent,
        linkService
      });
    }
    const isNotForRichText = intent !== "richText";
    const rootDiv = parameters.div;
    rootDiv.append(rootHtml);
    if (parameters.viewport) {
      const transform = `matrix(${parameters.viewport.transform.join(",")})`;
      rootDiv.style.transform = transform;
    }
    if (isNotForRichText) {
      rootDiv.setAttribute("class", "xfaLayer xfaFont");
    }
    const textDivs = [];
    if (root.children.length === 0) {
      if (root.value) {
        const node = document.createTextNode(root.value);
        rootHtml.append(node);
        if (isNotForRichText && XfaText.shouldBuildText(root.name)) {
          textDivs.push(node);
        }
      }
      return {
        textDivs
      };
    }
    const stack = [[root, -1, rootHtml]];
    while (stack.length > 0) {
      const [parent, i, html] = stack.at(-1);
      if (i + 1 === parent.children.length) {
        stack.pop();
        continue;
      }
      const child = parent.children[++stack.at(-1)[1]];
      if (child === null) {
        continue;
      }
      const {
        name
      } = child;
      if (name === "#text") {
        const node = document.createTextNode(child.value);
        textDivs.push(node);
        html.append(node);
        continue;
      }
      const childHtml = ((_a2 = child == null ? void 0 : child.attributes) == null ? void 0 : _a2.xmlns) ? document.createElementNS(child.attributes.xmlns, name) : document.createElement(name);
      html.append(childHtml);
      if (child.attributes) {
        this.setAttributes({
          html: childHtml,
          element: child,
          storage,
          intent,
          linkService
        });
      }
      if (((_b = child.children) == null ? void 0 : _b.length) > 0) {
        stack.push([child, -1, childHtml]);
      } else if (child.value) {
        const node = document.createTextNode(child.value);
        if (isNotForRichText && XfaText.shouldBuildText(name)) {
          textDivs.push(node);
        }
        childHtml.append(node);
      }
    }
    for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
      el.setAttribute("readOnly", true);
    }
    return {
      textDivs
    };
  }
  static update(parameters) {
    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
    parameters.div.style.transform = transform;
    parameters.div.hidden = false;
  }
};
var DEFAULT_TAB_INDEX = 1e3;
var annotation_layer_DEFAULT_FONT_SIZE = 9;
var GetElementsByNameSet = /* @__PURE__ */ new WeakSet();
function getRectDims(rect) {
  return {
    width: rect[2] - rect[0],
    height: rect[3] - rect[1]
  };
}
var AnnotationElementFactory = class {
  static create(parameters) {
    const subtype = parameters.data.annotationType;
    switch (subtype) {
      case AnnotationType.LINK:
        return new LinkAnnotationElement(parameters);
      case AnnotationType.TEXT:
        return new TextAnnotationElement(parameters);
      case AnnotationType.WIDGET:
        const fieldType = parameters.data.fieldType;
        switch (fieldType) {
          case "Tx":
            return new TextWidgetAnnotationElement(parameters);
          case "Btn":
            if (parameters.data.radioButton) {
              return new RadioButtonWidgetAnnotationElement(parameters);
            } else if (parameters.data.checkBox) {
              return new CheckboxWidgetAnnotationElement(parameters);
            }
            return new PushButtonWidgetAnnotationElement(parameters);
          case "Ch":
            return new ChoiceWidgetAnnotationElement(parameters);
          case "Sig":
            return new SignatureWidgetAnnotationElement(parameters);
        }
        return new WidgetAnnotationElement(parameters);
      case AnnotationType.POPUP:
        return new PopupAnnotationElement(parameters);
      case AnnotationType.FREETEXT:
        return new FreeTextAnnotationElement(parameters);
      case AnnotationType.LINE:
        return new LineAnnotationElement(parameters);
      case AnnotationType.SQUARE:
        return new SquareAnnotationElement(parameters);
      case AnnotationType.CIRCLE:
        return new CircleAnnotationElement(parameters);
      case AnnotationType.POLYLINE:
        return new PolylineAnnotationElement(parameters);
      case AnnotationType.CARET:
        return new CaretAnnotationElement(parameters);
      case AnnotationType.INK:
        return new InkAnnotationElement(parameters);
      case AnnotationType.POLYGON:
        return new PolygonAnnotationElement(parameters);
      case AnnotationType.HIGHLIGHT:
        return new HighlightAnnotationElement(parameters);
      case AnnotationType.UNDERLINE:
        return new UnderlineAnnotationElement(parameters);
      case AnnotationType.SQUIGGLY:
        return new SquigglyAnnotationElement(parameters);
      case AnnotationType.STRIKEOUT:
        return new StrikeOutAnnotationElement(parameters);
      case AnnotationType.STAMP:
        return new StampAnnotationElement(parameters);
      case AnnotationType.FILEATTACHMENT:
        return new FileAttachmentAnnotationElement(parameters);
      default:
        return new AnnotationElement(parameters);
    }
  }
};
var _updates, _hasBorder, _popupElement, _setRectEdited, setRectEdited_fn;
var _AnnotationElement = class {
  constructor(parameters, {
    isRenderable = false,
    ignoreBorder = false,
    createQuadrilaterals = false
  } = {}) {
    __privateAdd(this, _setRectEdited);
    __privateAdd(this, _updates, null);
    __privateAdd(this, _hasBorder, false);
    __privateAdd(this, _popupElement, null);
    this.isRenderable = isRenderable;
    this.data = parameters.data;
    this.layer = parameters.layer;
    this.linkService = parameters.linkService;
    this.downloadManager = parameters.downloadManager;
    this.imageResourcesPath = parameters.imageResourcesPath;
    this.renderForms = parameters.renderForms;
    this.svgFactory = parameters.svgFactory;
    this.annotationStorage = parameters.annotationStorage;
    this.enableScripting = parameters.enableScripting;
    this.hasJSActions = parameters.hasJSActions;
    this._fieldObjects = parameters.fieldObjects;
    this.parent = parameters.parent;
    if (isRenderable) {
      this.container = this._createContainer(ignoreBorder);
    }
    if (createQuadrilaterals) {
      this._createQuadrilaterals();
    }
  }
  static _hasPopupData({
    titleObj,
    contentsObj,
    richText
  }) {
    return !!((titleObj == null ? void 0 : titleObj.str) || (contentsObj == null ? void 0 : contentsObj.str) || (richText == null ? void 0 : richText.str));
  }
  get _isEditable() {
    return this.data.isEditable;
  }
  get hasPopupData() {
    return _AnnotationElement._hasPopupData(this.data);
  }
  updateEdited(params) {
    var _a2;
    if (!this.container) {
      return;
    }
    __privateGet(this, _updates) || __privateSet(this, _updates, {
      rect: this.data.rect.slice(0)
    });
    const {
      rect
    } = params;
    if (rect) {
      __privateMethod(this, _setRectEdited, setRectEdited_fn).call(this, rect);
    }
    (_a2 = __privateGet(this, _popupElement)) == null ? void 0 : _a2.popup.updateEdited(params);
  }
  resetEdited() {
    var _a2;
    if (!__privateGet(this, _updates)) {
      return;
    }
    __privateMethod(this, _setRectEdited, setRectEdited_fn).call(this, __privateGet(this, _updates).rect);
    (_a2 = __privateGet(this, _popupElement)) == null ? void 0 : _a2.popup.resetEdited();
    __privateSet(this, _updates, null);
  }
  _createContainer(ignoreBorder) {
    const {
      data,
      parent: {
        page,
        viewport
      }
    } = this;
    const container = document.createElement("section");
    container.setAttribute("data-annotation-id", data.id);
    if (!(this instanceof WidgetAnnotationElement)) {
      container.tabIndex = DEFAULT_TAB_INDEX;
    }
    const {
      style
    } = container;
    style.zIndex = this.parent.zIndex++;
    if (data.popupRef) {
      container.setAttribute("aria-haspopup", "dialog");
    }
    if (data.alternativeText) {
      container.title = data.alternativeText;
    }
    if (data.noRotate) {
      container.classList.add("norotate");
    }
    if (!data.rect || this instanceof PopupAnnotationElement) {
      const {
        rotation: rotation2
      } = data;
      if (!data.hasOwnCanvas && rotation2 !== 0) {
        this.setRotation(rotation2, container);
      }
      return container;
    }
    const {
      width,
      height
    } = getRectDims(data.rect);
    if (!ignoreBorder && data.borderStyle.width > 0) {
      style.borderWidth = `${data.borderStyle.width}px`;
      const horizontalRadius = data.borderStyle.horizontalCornerRadius;
      const verticalRadius = data.borderStyle.verticalCornerRadius;
      if (horizontalRadius > 0 || verticalRadius > 0) {
        const radius = `calc(${horizontalRadius}px * var(--scale-factor)) / calc(${verticalRadius}px * var(--scale-factor))`;
        style.borderRadius = radius;
      } else if (this instanceof RadioButtonWidgetAnnotationElement) {
        const radius = `calc(${width}px * var(--scale-factor)) / calc(${height}px * var(--scale-factor))`;
        style.borderRadius = radius;
      }
      switch (data.borderStyle.style) {
        case AnnotationBorderStyleType.SOLID:
          style.borderStyle = "solid";
          break;
        case AnnotationBorderStyleType.DASHED:
          style.borderStyle = "dashed";
          break;
        case AnnotationBorderStyleType.BEVELED:
          warn("Unimplemented border style: beveled");
          break;
        case AnnotationBorderStyleType.INSET:
          warn("Unimplemented border style: inset");
          break;
        case AnnotationBorderStyleType.UNDERLINE:
          style.borderBottomStyle = "solid";
          break;
        default:
          break;
      }
      const borderColor = data.borderColor || null;
      if (borderColor) {
        __privateSet(this, _hasBorder, true);
        style.borderColor = Util.makeHexColor(borderColor[0] | 0, borderColor[1] | 0, borderColor[2] | 0);
      } else {
        style.borderWidth = 0;
      }
    }
    const rect = Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
    const {
      pageWidth,
      pageHeight,
      pageX,
      pageY
    } = viewport.rawDims;
    style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
    style.top = `${100 * (rect[1] - pageY) / pageHeight}%`;
    const {
      rotation
    } = data;
    if (data.hasOwnCanvas || rotation === 0) {
      style.width = `${100 * width / pageWidth}%`;
      style.height = `${100 * height / pageHeight}%`;
    } else {
      this.setRotation(rotation, container);
    }
    return container;
  }
  setRotation(angle, container = this.container) {
    if (!this.data.rect) {
      return;
    }
    const {
      pageWidth,
      pageHeight
    } = this.parent.viewport.rawDims;
    const {
      width,
      height
    } = getRectDims(this.data.rect);
    let elementWidth, elementHeight;
    if (angle % 180 === 0) {
      elementWidth = 100 * width / pageWidth;
      elementHeight = 100 * height / pageHeight;
    } else {
      elementWidth = 100 * height / pageWidth;
      elementHeight = 100 * width / pageHeight;
    }
    container.style.width = `${elementWidth}%`;
    container.style.height = `${elementHeight}%`;
    container.setAttribute("data-main-rotation", (360 - angle) % 360);
  }
  get _commonActions() {
    const setColor = (jsName, styleName, event) => {
      const color = event.detail[jsName];
      const colorType = color[0];
      const colorArray = color.slice(1);
      event.target.style[styleName] = ColorConverters[`${colorType}_HTML`](colorArray);
      this.annotationStorage.setValue(this.data.id, {
        [styleName]: ColorConverters[`${colorType}_rgb`](colorArray)
      });
    };
    return shadow(this, "_commonActions", {
      display: (event) => {
        const {
          display
        } = event.detail;
        const hidden = display % 2 === 1;
        this.container.style.visibility = hidden ? "hidden" : "visible";
        this.annotationStorage.setValue(this.data.id, {
          noView: hidden,
          noPrint: display === 1 || display === 2
        });
      },
      print: (event) => {
        this.annotationStorage.setValue(this.data.id, {
          noPrint: !event.detail.print
        });
      },
      hidden: (event) => {
        const {
          hidden
        } = event.detail;
        this.container.style.visibility = hidden ? "hidden" : "visible";
        this.annotationStorage.setValue(this.data.id, {
          noPrint: hidden,
          noView: hidden
        });
      },
      focus: (event) => {
        setTimeout(() => event.target.focus({
          preventScroll: false
        }), 0);
      },
      userName: (event) => {
        event.target.title = event.detail.userName;
      },
      readonly: (event) => {
        event.target.disabled = event.detail.readonly;
      },
      required: (event) => {
        this._setRequired(event.target, event.detail.required);
      },
      bgColor: (event) => {
        setColor("bgColor", "backgroundColor", event);
      },
      fillColor: (event) => {
        setColor("fillColor", "backgroundColor", event);
      },
      fgColor: (event) => {
        setColor("fgColor", "color", event);
      },
      textColor: (event) => {
        setColor("textColor", "color", event);
      },
      borderColor: (event) => {
        setColor("borderColor", "borderColor", event);
      },
      strokeColor: (event) => {
        setColor("strokeColor", "borderColor", event);
      },
      rotation: (event) => {
        const angle = event.detail.rotation;
        this.setRotation(angle);
        this.annotationStorage.setValue(this.data.id, {
          rotation: angle
        });
      }
    });
  }
  _dispatchEventFromSandbox(actions, jsEvent) {
    const commonActions = this._commonActions;
    for (const name of Object.keys(jsEvent.detail)) {
      const action = actions[name] || commonActions[name];
      action == null ? void 0 : action(jsEvent);
    }
  }
  _setDefaultPropertiesFromJS(element2) {
    if (!this.enableScripting) {
      return;
    }
    const storedData = this.annotationStorage.getRawValue(this.data.id);
    if (!storedData) {
      return;
    }
    const commonActions = this._commonActions;
    for (const [actionName, detail] of Object.entries(storedData)) {
      const action = commonActions[actionName];
      if (action) {
        const eventProxy = {
          detail: {
            [actionName]: detail
          },
          target: element2
        };
        action(eventProxy);
        delete storedData[actionName];
      }
    }
  }
  _createQuadrilaterals() {
    if (!this.container) {
      return;
    }
    const {
      quadPoints
    } = this.data;
    if (!quadPoints) {
      return;
    }
    const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect.map((x) => Math.fround(x));
    if (quadPoints.length === 8) {
      const [trX, trY, blX, blY] = quadPoints.subarray(2, 6);
      if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
        return;
      }
    }
    const {
      style
    } = this.container;
    let svgBuffer;
    if (__privateGet(this, _hasBorder)) {
      const {
        borderColor,
        borderWidth
      } = style;
      style.borderWidth = 0;
      svgBuffer = ["url('data:image/svg+xml;utf8,", `<svg xmlns="http://www.w3.org/2000/svg"`, ` preserveAspectRatio="none" viewBox="0 0 1 1">`, `<g fill="transparent" stroke="${borderColor}" stroke-width="${borderWidth}">`];
      this.container.classList.add("hasBorder");
    }
    const width = rectTrX - rectBlX;
    const height = rectTrY - rectBlY;
    const {
      svgFactory
    } = this;
    const svg = svgFactory.createElement("svg");
    svg.classList.add("quadrilateralsContainer");
    svg.setAttribute("width", 0);
    svg.setAttribute("height", 0);
    const defs = svgFactory.createElement("defs");
    svg.append(defs);
    const clipPath = svgFactory.createElement("clipPath");
    const id = `clippath_${this.data.id}`;
    clipPath.setAttribute("id", id);
    clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
    defs.append(clipPath);
    for (let i = 2, ii = quadPoints.length; i < ii; i += 8) {
      const trX = quadPoints[i];
      const trY = quadPoints[i + 1];
      const blX = quadPoints[i + 2];
      const blY = quadPoints[i + 3];
      const rect = svgFactory.createElement("rect");
      const x = (blX - rectBlX) / width;
      const y = (rectTrY - trY) / height;
      const rectWidth = (trX - blX) / width;
      const rectHeight = (trY - blY) / height;
      rect.setAttribute("x", x);
      rect.setAttribute("y", y);
      rect.setAttribute("width", rectWidth);
      rect.setAttribute("height", rectHeight);
      clipPath.append(rect);
      svgBuffer == null ? void 0 : svgBuffer.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${y}" width="${rectWidth}" height="${rectHeight}"/>`);
    }
    if (__privateGet(this, _hasBorder)) {
      svgBuffer.push(`</g></svg>')`);
      style.backgroundImage = svgBuffer.join("");
    }
    this.container.append(svg);
    this.container.style.clipPath = `url(#${id})`;
  }
  _createPopup() {
    const {
      container,
      data
    } = this;
    container.setAttribute("aria-haspopup", "dialog");
    const popup = __privateSet(this, _popupElement, new PopupAnnotationElement({
      data: {
        color: data.color,
        titleObj: data.titleObj,
        modificationDate: data.modificationDate,
        contentsObj: data.contentsObj,
        richText: data.richText,
        parentRect: data.rect,
        borderStyle: 0,
        id: `popup_${data.id}`,
        rotation: data.rotation
      },
      parent: this.parent,
      elements: [this]
    }));
    this.parent.div.append(popup.render());
  }
  render() {
    unreachable("Abstract method `AnnotationElement.render` called");
  }
  _getElementsByName(name, skipId = null) {
    const fields = [];
    if (this._fieldObjects) {
      const fieldObj = this._fieldObjects[name];
      if (fieldObj) {
        for (const {
          page,
          id,
          exportValues
        } of fieldObj) {
          if (page === -1) {
            continue;
          }
          if (id === skipId) {
            continue;
          }
          const exportValue = typeof exportValues === "string" ? exportValues : null;
          const domElement = document.querySelector(`[data-element-id="${id}"]`);
          if (domElement && !GetElementsByNameSet.has(domElement)) {
            warn(`_getElementsByName - element not allowed: ${id}`);
            continue;
          }
          fields.push({
            id,
            exportValue,
            domElement
          });
        }
      }
      return fields;
    }
    for (const domElement of document.getElementsByName(name)) {
      const {
        exportValue
      } = domElement;
      const id = domElement.getAttribute("data-element-id");
      if (id === skipId) {
        continue;
      }
      if (!GetElementsByNameSet.has(domElement)) {
        continue;
      }
      fields.push({
        id,
        exportValue,
        domElement
      });
    }
    return fields;
  }
  show() {
    var _a2;
    if (this.container) {
      this.container.hidden = false;
    }
    (_a2 = this.popup) == null ? void 0 : _a2.maybeShow();
  }
  hide() {
    var _a2;
    if (this.container) {
      this.container.hidden = true;
    }
    (_a2 = this.popup) == null ? void 0 : _a2.forceHide();
  }
  getElementsToTriggerPopup() {
    return this.container;
  }
  addHighlightArea() {
    const triggers = this.getElementsToTriggerPopup();
    if (Array.isArray(triggers)) {
      for (const element2 of triggers) {
        element2.classList.add("highlightArea");
      }
    } else {
      triggers.classList.add("highlightArea");
    }
  }
  _editOnDoubleClick() {
    if (!this._isEditable) {
      return;
    }
    const {
      annotationEditorType: mode,
      data: {
        id: editId
      }
    } = this;
    this.container.addEventListener("dblclick", () => {
      var _a2;
      (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("switchannotationeditormode", {
        source: this,
        mode,
        editId
      });
    });
  }
};
var AnnotationElement = _AnnotationElement;
_updates = new WeakMap();
_hasBorder = new WeakMap();
_popupElement = new WeakMap();
_setRectEdited = new WeakSet();
setRectEdited_fn = function(rect) {
  const {
    container: {
      style
    },
    data: {
      rect: currentRect,
      rotation
    },
    parent: {
      viewport: {
        rawDims: {
          pageWidth,
          pageHeight,
          pageX,
          pageY
        }
      }
    }
  } = this;
  currentRect == null ? void 0 : currentRect.splice(0, 4, ...rect);
  const {
    width,
    height
  } = getRectDims(rect);
  style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
  style.top = `${100 * (pageHeight - rect[3] + pageY) / pageHeight}%`;
  if (rotation === 0) {
    style.width = `${100 * width / pageWidth}%`;
    style.height = `${100 * height / pageHeight}%`;
  } else {
    this.setRotation(rotation);
  }
};
var _setInternalLink, setInternalLink_fn, _bindAttachment, bindAttachment_fn, _bindSetOCGState, bindSetOCGState_fn;
var LinkAnnotationElement = class extends AnnotationElement {
  constructor(parameters, options = null) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: !!(options == null ? void 0 : options.ignoreBorder),
      createQuadrilaterals: true
    });
    __privateAdd(this, _setInternalLink);
    __privateAdd(this, _bindAttachment);
    __privateAdd(this, _bindSetOCGState);
    this.isTooltipOnly = parameters.data.isTooltipOnly;
  }
  render() {
    const {
      data,
      linkService
    } = this;
    const link = document.createElement("a");
    link.setAttribute("data-element-id", data.id);
    let isBound = false;
    if (data.url) {
      linkService.addLinkAttributes(link, data.url, data.newWindow);
      isBound = true;
    } else if (data.action) {
      this._bindNamedAction(link, data.action);
      isBound = true;
    } else if (data.attachment) {
      __privateMethod(this, _bindAttachment, bindAttachment_fn).call(this, link, data.attachment, data.attachmentDest);
      isBound = true;
    } else if (data.setOCGState) {
      __privateMethod(this, _bindSetOCGState, bindSetOCGState_fn).call(this, link, data.setOCGState);
      isBound = true;
    } else if (data.dest) {
      this._bindLink(link, data.dest);
      isBound = true;
    } else {
      if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) {
        this._bindJSAction(link, data);
        isBound = true;
      }
      if (data.resetForm) {
        this._bindResetFormAction(link, data.resetForm);
        isBound = true;
      } else if (this.isTooltipOnly && !isBound) {
        this._bindLink(link, "");
        isBound = true;
      }
    }
    this.container.classList.add("linkAnnotation");
    if (isBound) {
      this.container.append(link);
    }
    return this.container;
  }
  _bindLink(link, destination) {
    link.href = this.linkService.getDestinationHash(destination);
    link.onclick = () => {
      if (destination) {
        this.linkService.goToDestination(destination);
      }
      return false;
    };
    if (destination || destination === "") {
      __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
    }
  }
  _bindNamedAction(link, action) {
    link.href = this.linkService.getAnchorUrl("");
    link.onclick = () => {
      this.linkService.executeNamedAction(action);
      return false;
    };
    __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
  }
  _bindJSAction(link, data) {
    link.href = this.linkService.getAnchorUrl("");
    const map = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
    for (const name of Object.keys(data.actions)) {
      const jsName = map.get(name);
      if (!jsName) {
        continue;
      }
      link[jsName] = () => {
        var _a2;
        (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("dispatcheventinsandbox", {
          source: this,
          detail: {
            id: data.id,
            name
          }
        });
        return false;
      };
    }
    if (!link.onclick) {
      link.onclick = () => false;
    }
    __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
  }
  _bindResetFormAction(link, resetForm) {
    const otherClickAction = link.onclick;
    if (!otherClickAction) {
      link.href = this.linkService.getAnchorUrl("");
    }
    __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
    if (!this._fieldObjects) {
      warn(`_bindResetFormAction - "resetForm" action not supported, ensure that the \`fieldObjects\` parameter is provided.`);
      if (!otherClickAction) {
        link.onclick = () => false;
      }
      return;
    }
    link.onclick = () => {
      var _a2;
      otherClickAction == null ? void 0 : otherClickAction();
      const {
        fields: resetFormFields,
        refs: resetFormRefs,
        include
      } = resetForm;
      const allFields = [];
      if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {
        const fieldIds = new Set(resetFormRefs);
        for (const fieldName of resetFormFields) {
          const fields = this._fieldObjects[fieldName] || [];
          for (const {
            id
          } of fields) {
            fieldIds.add(id);
          }
        }
        for (const fields of Object.values(this._fieldObjects)) {
          for (const field of fields) {
            if (fieldIds.has(field.id) === include) {
              allFields.push(field);
            }
          }
        }
      } else {
        for (const fields of Object.values(this._fieldObjects)) {
          allFields.push(...fields);
        }
      }
      const storage = this.annotationStorage;
      const allIds = [];
      for (const field of allFields) {
        const {
          id
        } = field;
        allIds.push(id);
        switch (field.type) {
          case "text": {
            const value = field.defaultValue || "";
            storage.setValue(id, {
              value
            });
            break;
          }
          case "checkbox":
          case "radiobutton": {
            const value = field.defaultValue === field.exportValues;
            storage.setValue(id, {
              value
            });
            break;
          }
          case "combobox":
          case "listbox": {
            const value = field.defaultValue || "";
            storage.setValue(id, {
              value
            });
            break;
          }
          default:
            continue;
        }
        const domElement = document.querySelector(`[data-element-id="${id}"]`);
        if (!domElement) {
          continue;
        } else if (!GetElementsByNameSet.has(domElement)) {
          warn(`_bindResetFormAction - element not allowed: ${id}`);
          continue;
        }
        domElement.dispatchEvent(new Event("resetform"));
      }
      if (this.enableScripting) {
        (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("dispatcheventinsandbox", {
          source: this,
          detail: {
            id: "app",
            ids: allIds,
            name: "ResetForm"
          }
        });
      }
      return false;
    };
  }
};
_setInternalLink = new WeakSet();
setInternalLink_fn = function() {
  this.container.setAttribute("data-internal-link", "");
};
_bindAttachment = new WeakSet();
bindAttachment_fn = function(link, attachment, dest = null) {
  link.href = this.linkService.getAnchorUrl("");
  if (attachment.description) {
    link.title = attachment.description;
  }
  link.onclick = () => {
    var _a2;
    (_a2 = this.downloadManager) == null ? void 0 : _a2.openOrDownloadData(attachment.content, attachment.filename, dest);
    return false;
  };
  __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
};
_bindSetOCGState = new WeakSet();
bindSetOCGState_fn = function(link, action) {
  link.href = this.linkService.getAnchorUrl("");
  link.onclick = () => {
    this.linkService.executeSetOCGState(action);
    return false;
  };
  __privateMethod(this, _setInternalLink, setInternalLink_fn).call(this);
};
var TextAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true
    });
  }
  render() {
    this.container.classList.add("textAnnotation");
    const image = document.createElement("img");
    image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
    image.setAttribute("data-l10n-id", "pdfjs-text-annotation-type");
    image.setAttribute("data-l10n-args", JSON.stringify({
      type: this.data.name
    }));
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this.container.append(image);
    return this.container;
  }
};
var WidgetAnnotationElement = class extends AnnotationElement {
  render() {
    return this.container;
  }
  showElementAndHideCanvas(element2) {
    var _a2;
    if (this.data.hasOwnCanvas) {
      if (((_a2 = element2.previousSibling) == null ? void 0 : _a2.nodeName) === "CANVAS") {
        element2.previousSibling.hidden = true;
      }
      element2.hidden = false;
    }
  }
  _getKeyModifier(event) {
    return util_FeatureTest.platform.isMac ? event.metaKey : event.ctrlKey;
  }
  _setEventListener(element2, elementData, baseName, eventName, valueGetter) {
    if (baseName.includes("mouse")) {
      element2.addEventListener(baseName, (event) => {
        var _a2;
        (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("dispatcheventinsandbox", {
          source: this,
          detail: {
            id: this.data.id,
            name: eventName,
            value: valueGetter(event),
            shift: event.shiftKey,
            modifier: this._getKeyModifier(event)
          }
        });
      });
    } else {
      element2.addEventListener(baseName, (event) => {
        var _a2;
        if (baseName === "blur") {
          if (!elementData.focused || !event.relatedTarget) {
            return;
          }
          elementData.focused = false;
        } else if (baseName === "focus") {
          if (elementData.focused) {
            return;
          }
          elementData.focused = true;
        }
        if (!valueGetter) {
          return;
        }
        (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("dispatcheventinsandbox", {
          source: this,
          detail: {
            id: this.data.id,
            name: eventName,
            value: valueGetter(event)
          }
        });
      });
    }
  }
  _setEventListeners(element2, elementData, names, getter) {
    var _a2, _b, _c;
    for (const [baseName, eventName] of names) {
      if (eventName === "Action" || ((_a2 = this.data.actions) == null ? void 0 : _a2[eventName])) {
        if (eventName === "Focus" || eventName === "Blur") {
          elementData || (elementData = {
            focused: false
          });
        }
        this._setEventListener(element2, elementData, baseName, eventName, getter);
        if (eventName === "Focus" && !((_b = this.data.actions) == null ? void 0 : _b.Blur)) {
          this._setEventListener(element2, elementData, "blur", "Blur", null);
        } else if (eventName === "Blur" && !((_c = this.data.actions) == null ? void 0 : _c.Focus)) {
          this._setEventListener(element2, elementData, "focus", "Focus", null);
        }
      }
    }
  }
  _setBackgroundColor(element2) {
    const color = this.data.backgroundColor || null;
    element2.style.backgroundColor = color === null ? "transparent" : Util.makeHexColor(color[0], color[1], color[2]);
  }
  _setTextStyle(element2) {
    const TEXT_ALIGNMENT = ["left", "center", "right"];
    const {
      fontColor
    } = this.data.defaultAppearanceData;
    const fontSize = this.data.defaultAppearanceData.fontSize || annotation_layer_DEFAULT_FONT_SIZE;
    const style = element2.style;
    let computedFontSize;
    const BORDER_SIZE = 2;
    const roundToOneDecimal = (x) => Math.round(10 * x) / 10;
    if (this.data.multiLine) {
      const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
      const numberOfLines = Math.round(height / (LINE_FACTOR * fontSize)) || 1;
      const lineHeight = height / numberOfLines;
      computedFontSize = Math.min(fontSize, roundToOneDecimal(lineHeight / LINE_FACTOR));
    } else {
      const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
      computedFontSize = Math.min(fontSize, roundToOneDecimal(height / LINE_FACTOR));
    }
    style.fontSize = `calc(${computedFontSize}px * var(--scale-factor))`;
    style.color = Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);
    if (this.data.textAlignment !== null) {
      style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
    }
  }
  _setRequired(element2, isRequired) {
    if (isRequired) {
      element2.setAttribute("required", true);
    } else {
      element2.removeAttribute("required");
    }
    element2.setAttribute("aria-required", isRequired);
  }
};
var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
  constructor(parameters) {
    const isRenderable = parameters.renderForms || parameters.data.hasOwnCanvas || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
    super(parameters, {
      isRenderable
    });
  }
  setPropertyOnSiblings(base, key, value, keyInStorage) {
    const storage = this.annotationStorage;
    for (const element2 of this._getElementsByName(base.name, base.id)) {
      if (element2.domElement) {
        element2.domElement[key] = value;
      }
      storage.setValue(element2.id, {
        [keyInStorage]: value
      });
    }
  }
  render() {
    var _a2, _b;
    const storage = this.annotationStorage;
    const id = this.data.id;
    this.container.classList.add("textWidgetAnnotation");
    let element2 = null;
    if (this.renderForms) {
      const storedData = storage.getValue(id, {
        value: this.data.fieldValue
      });
      let textContent = storedData.value || "";
      const maxLen = storage.getValue(id, {
        charLimit: this.data.maxLen
      }).charLimit;
      if (maxLen && textContent.length > maxLen) {
        textContent = textContent.slice(0, maxLen);
      }
      let fieldFormattedValues = storedData.formattedValue || ((_a2 = this.data.textContent) == null ? void 0 : _a2.join("\n")) || null;
      if (fieldFormattedValues && this.data.comb) {
        fieldFormattedValues = fieldFormattedValues.replaceAll(/\s+/g, "");
      }
      const elementData = {
        userValue: textContent,
        formattedValue: fieldFormattedValues,
        lastCommittedValue: null,
        commitKey: 1,
        focused: false
      };
      if (this.data.multiLine) {
        element2 = document.createElement("textarea");
        element2.textContent = fieldFormattedValues != null ? fieldFormattedValues : textContent;
        if (this.data.doNotScroll) {
          element2.style.overflowY = "hidden";
        }
      } else {
        element2 = document.createElement("input");
        element2.type = "text";
        element2.setAttribute("value", fieldFormattedValues != null ? fieldFormattedValues : textContent);
        if (this.data.doNotScroll) {
          element2.style.overflowX = "hidden";
        }
      }
      if (this.data.hasOwnCanvas) {
        element2.hidden = true;
      }
      GetElementsByNameSet.add(element2);
      element2.setAttribute("data-element-id", id);
      element2.disabled = this.data.readOnly;
      element2.name = this.data.fieldName;
      element2.tabIndex = DEFAULT_TAB_INDEX;
      this._setRequired(element2, this.data.required);
      if (maxLen) {
        element2.maxLength = maxLen;
      }
      element2.addEventListener("input", (event) => {
        storage.setValue(id, {
          value: event.target.value
        });
        this.setPropertyOnSiblings(element2, "value", event.target.value, "value");
        elementData.formattedValue = null;
      });
      element2.addEventListener("resetform", (event) => {
        var _a3;
        const defaultValue = (_a3 = this.data.defaultFieldValue) != null ? _a3 : "";
        element2.value = elementData.userValue = defaultValue;
        elementData.formattedValue = null;
      });
      let blurListener = (event) => {
        const {
          formattedValue
        } = elementData;
        if (formattedValue !== null && formattedValue !== void 0) {
          event.target.value = formattedValue;
        }
        event.target.scrollLeft = 0;
      };
      if (this.enableScripting && this.hasJSActions) {
        element2.addEventListener("focus", (event) => {
          var _a3;
          if (elementData.focused) {
            return;
          }
          const {
            target
          } = event;
          if (elementData.userValue) {
            target.value = elementData.userValue;
          }
          elementData.lastCommittedValue = target.value;
          elementData.commitKey = 1;
          if (!((_a3 = this.data.actions) == null ? void 0 : _a3.Focus)) {
            elementData.focused = true;
          }
        });
        element2.addEventListener("updatefromsandbox", (jsEvent) => {
          this.showElementAndHideCanvas(jsEvent.target);
          const actions = {
            value(event) {
              var _a3;
              elementData.userValue = (_a3 = event.detail.value) != null ? _a3 : "";
              storage.setValue(id, {
                value: elementData.userValue.toString()
              });
              event.target.value = elementData.userValue;
            },
            formattedValue(event) {
              const {
                formattedValue
              } = event.detail;
              elementData.formattedValue = formattedValue;
              if (formattedValue !== null && formattedValue !== void 0 && event.target !== document.activeElement) {
                event.target.value = formattedValue;
              }
              storage.setValue(id, {
                formattedValue
              });
            },
            selRange(event) {
              event.target.setSelectionRange(...event.detail.selRange);
            },
            charLimit: (event) => {
              var _a3;
              const {
                charLimit
              } = event.detail;
              const {
                target
              } = event;
              if (charLimit === 0) {
                target.removeAttribute("maxLength");
                return;
              }
              target.setAttribute("maxLength", charLimit);
              let value = elementData.userValue;
              if (!value || value.length <= charLimit) {
                return;
              }
              value = value.slice(0, charLimit);
              target.value = elementData.userValue = value;
              storage.setValue(id, {
                value
              });
              (_a3 = this.linkService.eventBus) == null ? void 0 : _a3.dispatch("dispatcheventinsandbox", {
                source: this,
                detail: {
                  id,
                  name: "Keystroke",
                  value,
                  willCommit: true,
                  commitKey: 1,
                  selStart: target.selectionStart,
                  selEnd: target.selectionEnd
                }
              });
            }
          };
          this._dispatchEventFromSandbox(actions, jsEvent);
        });
        element2.addEventListener("keydown", (event) => {
          var _a3;
          elementData.commitKey = 1;
          let commitKey = -1;
          if (event.key === "Escape") {
            commitKey = 0;
          } else if (event.key === "Enter" && !this.data.multiLine) {
            commitKey = 2;
          } else if (event.key === "Tab") {
            elementData.commitKey = 3;
          }
          if (commitKey === -1) {
            return;
          }
          const {
            value
          } = event.target;
          if (elementData.lastCommittedValue === value) {
            return;
          }
          elementData.lastCommittedValue = value;
          elementData.userValue = value;
          (_a3 = this.linkService.eventBus) == null ? void 0 : _a3.dispatch("dispatcheventinsandbox", {
            source: this,
            detail: {
              id,
              name: "Keystroke",
              value,
              willCommit: true,
              commitKey,
              selStart: event.target.selectionStart,
              selEnd: event.target.selectionEnd
            }
          });
        });
        const _blurListener = blurListener;
        blurListener = null;
        element2.addEventListener("blur", (event) => {
          var _a3, _b2;
          if (!elementData.focused || !event.relatedTarget) {
            return;
          }
          if (!((_a3 = this.data.actions) == null ? void 0 : _a3.Blur)) {
            elementData.focused = false;
          }
          const {
            value
          } = event.target;
          elementData.userValue = value;
          if (elementData.lastCommittedValue !== value) {
            (_b2 = this.linkService.eventBus) == null ? void 0 : _b2.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id,
                name: "Keystroke",
                value,
                willCommit: true,
                commitKey: elementData.commitKey,
                selStart: event.target.selectionStart,
                selEnd: event.target.selectionEnd
              }
            });
          }
          _blurListener(event);
        });
        if ((_b = this.data.actions) == null ? void 0 : _b.Keystroke) {
          element2.addEventListener("beforeinput", (event) => {
            var _a3;
            elementData.lastCommittedValue = null;
            const {
              data,
              target
            } = event;
            const {
              value,
              selectionStart,
              selectionEnd
            } = target;
            let selStart = selectionStart, selEnd = selectionEnd;
            switch (event.inputType) {
              case "deleteWordBackward": {
                const match = value.substring(0, selectionStart).match(/\w*[^\w]*$/);
                if (match) {
                  selStart -= match[0].length;
                }
                break;
              }
              case "deleteWordForward": {
                const match = value.substring(selectionStart).match(/^[^\w]*\w*/);
                if (match) {
                  selEnd += match[0].length;
                }
                break;
              }
              case "deleteContentBackward":
                if (selectionStart === selectionEnd) {
                  selStart -= 1;
                }
                break;
              case "deleteContentForward":
                if (selectionStart === selectionEnd) {
                  selEnd += 1;
                }
                break;
            }
            event.preventDefault();
            (_a3 = this.linkService.eventBus) == null ? void 0 : _a3.dispatch("dispatcheventinsandbox", {
              source: this,
              detail: {
                id,
                name: "Keystroke",
                value,
                change: data || "",
                willCommit: false,
                selStart,
                selEnd
              }
            });
          });
        }
        this._setEventListeners(element2, elementData, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.value);
      }
      if (blurListener) {
        element2.addEventListener("blur", blurListener);
      }
      if (this.data.comb) {
        const fieldWidth = this.data.rect[2] - this.data.rect[0];
        const combWidth = fieldWidth / maxLen;
        element2.classList.add("comb");
        element2.style.letterSpacing = `calc(${combWidth}px * var(--scale-factor) - 1ch)`;
      }
    } else {
      element2 = document.createElement("div");
      element2.textContent = this.data.fieldValue;
      element2.style.verticalAlign = "middle";
      element2.style.display = "table-cell";
      if (this.data.hasOwnCanvas) {
        element2.hidden = true;
      }
    }
    this._setTextStyle(element2);
    this._setBackgroundColor(element2);
    this._setDefaultPropertiesFromJS(element2);
    this.container.append(element2);
    return this.container;
  }
};
var SignatureWidgetAnnotationElement = class extends WidgetAnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: !!parameters.data.hasOwnCanvas
    });
  }
};
var CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: parameters.renderForms
    });
  }
  render() {
    const storage = this.annotationStorage;
    const data = this.data;
    const id = data.id;
    let value = storage.getValue(id, {
      value: data.exportValue === data.fieldValue
    }).value;
    if (typeof value === "string") {
      value = value !== "Off";
      storage.setValue(id, {
        value
      });
    }
    this.container.classList.add("buttonWidgetAnnotation", "checkBox");
    const element2 = document.createElement("input");
    GetElementsByNameSet.add(element2);
    element2.setAttribute("data-element-id", id);
    element2.disabled = data.readOnly;
    this._setRequired(element2, this.data.required);
    element2.type = "checkbox";
    element2.name = data.fieldName;
    if (value) {
      element2.setAttribute("checked", true);
    }
    element2.setAttribute("exportValue", data.exportValue);
    element2.tabIndex = DEFAULT_TAB_INDEX;
    element2.addEventListener("change", (event) => {
      const {
        name,
        checked
      } = event.target;
      for (const checkbox of this._getElementsByName(name, id)) {
        const curChecked = checked && checkbox.exportValue === data.exportValue;
        if (checkbox.domElement) {
          checkbox.domElement.checked = curChecked;
        }
        storage.setValue(checkbox.id, {
          value: curChecked
        });
      }
      storage.setValue(id, {
        value: checked
      });
    });
    element2.addEventListener("resetform", (event) => {
      const defaultValue = data.defaultFieldValue || "Off";
      event.target.checked = defaultValue === data.exportValue;
    });
    if (this.enableScripting && this.hasJSActions) {
      element2.addEventListener("updatefromsandbox", (jsEvent) => {
        const actions = {
          value(event) {
            event.target.checked = event.detail.value !== "Off";
            storage.setValue(id, {
              value: event.target.checked
            });
          }
        };
        this._dispatchEventFromSandbox(actions, jsEvent);
      });
      this._setEventListeners(element2, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.checked);
    }
    this._setBackgroundColor(element2);
    this._setDefaultPropertiesFromJS(element2);
    this.container.append(element2);
    return this.container;
  }
};
var RadioButtonWidgetAnnotationElement = class extends WidgetAnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: parameters.renderForms
    });
  }
  render() {
    this.container.classList.add("buttonWidgetAnnotation", "radioButton");
    const storage = this.annotationStorage;
    const data = this.data;
    const id = data.id;
    let value = storage.getValue(id, {
      value: data.fieldValue === data.buttonValue
    }).value;
    if (typeof value === "string") {
      value = value !== data.buttonValue;
      storage.setValue(id, {
        value
      });
    }
    if (value) {
      for (const radio of this._getElementsByName(data.fieldName, id)) {
        storage.setValue(radio.id, {
          value: false
        });
      }
    }
    const element2 = document.createElement("input");
    GetElementsByNameSet.add(element2);
    element2.setAttribute("data-element-id", id);
    element2.disabled = data.readOnly;
    this._setRequired(element2, this.data.required);
    element2.type = "radio";
    element2.name = data.fieldName;
    if (value) {
      element2.setAttribute("checked", true);
    }
    element2.tabIndex = DEFAULT_TAB_INDEX;
    element2.addEventListener("change", (event) => {
      const {
        name,
        checked
      } = event.target;
      for (const radio of this._getElementsByName(name, id)) {
        storage.setValue(radio.id, {
          value: false
        });
      }
      storage.setValue(id, {
        value: checked
      });
    });
    element2.addEventListener("resetform", (event) => {
      const defaultValue = data.defaultFieldValue;
      event.target.checked = defaultValue !== null && defaultValue !== void 0 && defaultValue === data.buttonValue;
    });
    if (this.enableScripting && this.hasJSActions) {
      const pdfButtonValue = data.buttonValue;
      element2.addEventListener("updatefromsandbox", (jsEvent) => {
        const actions = {
          value: (event) => {
            const checked = pdfButtonValue === event.detail.value;
            for (const radio of this._getElementsByName(event.target.name)) {
              const curChecked = checked && radio.id === id;
              if (radio.domElement) {
                radio.domElement.checked = curChecked;
              }
              storage.setValue(radio.id, {
                value: curChecked
              });
            }
          }
        };
        this._dispatchEventFromSandbox(actions, jsEvent);
      });
      this._setEventListeners(element2, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], (event) => event.target.checked);
    }
    this._setBackgroundColor(element2);
    this._setDefaultPropertiesFromJS(element2);
    this.container.append(element2);
    return this.container;
  }
};
var PushButtonWidgetAnnotationElement = class extends LinkAnnotationElement {
  constructor(parameters) {
    super(parameters, {
      ignoreBorder: parameters.data.hasAppearance
    });
  }
  render() {
    const container = super.render();
    container.classList.add("buttonWidgetAnnotation", "pushButton");
    const linkElement = container.lastChild;
    if (this.enableScripting && this.hasJSActions && linkElement) {
      this._setDefaultPropertiesFromJS(linkElement);
      linkElement.addEventListener("updatefromsandbox", (jsEvent) => {
        this._dispatchEventFromSandbox({}, jsEvent);
      });
    }
    return container;
  }
};
var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: parameters.renderForms
    });
  }
  render() {
    this.container.classList.add("choiceWidgetAnnotation");
    const storage = this.annotationStorage;
    const id = this.data.id;
    const storedData = storage.getValue(id, {
      value: this.data.fieldValue
    });
    const selectElement = document.createElement("select");
    GetElementsByNameSet.add(selectElement);
    selectElement.setAttribute("data-element-id", id);
    selectElement.disabled = this.data.readOnly;
    this._setRequired(selectElement, this.data.required);
    selectElement.name = this.data.fieldName;
    selectElement.tabIndex = DEFAULT_TAB_INDEX;
    let addAnEmptyEntry = this.data.combo && this.data.options.length > 0;
    if (!this.data.combo) {
      selectElement.size = this.data.options.length;
      if (this.data.multiSelect) {
        selectElement.multiple = true;
      }
    }
    selectElement.addEventListener("resetform", (event) => {
      const defaultValue = this.data.defaultFieldValue;
      for (const option2 of selectElement.options) {
        option2.selected = option2.value === defaultValue;
      }
    });
    for (const option2 of this.data.options) {
      const optionElement = document.createElement("option");
      optionElement.textContent = option2.displayValue;
      optionElement.value = option2.exportValue;
      if (storedData.value.includes(option2.exportValue)) {
        optionElement.setAttribute("selected", true);
        addAnEmptyEntry = false;
      }
      selectElement.append(optionElement);
    }
    let removeEmptyEntry = null;
    if (addAnEmptyEntry) {
      const noneOptionElement = document.createElement("option");
      noneOptionElement.value = " ";
      noneOptionElement.setAttribute("hidden", true);
      noneOptionElement.setAttribute("selected", true);
      selectElement.prepend(noneOptionElement);
      removeEmptyEntry = () => {
        noneOptionElement.remove();
        selectElement.removeEventListener("input", removeEmptyEntry);
        removeEmptyEntry = null;
      };
      selectElement.addEventListener("input", removeEmptyEntry);
    }
    const getValue = (isExport) => {
      const name = isExport ? "value" : "textContent";
      const {
        options,
        multiple
      } = selectElement;
      if (!multiple) {
        return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];
      }
      return Array.prototype.filter.call(options, (option2) => option2.selected).map((option2) => option2[name]);
    };
    let selectedValues = getValue(false);
    const getItems = (event) => {
      const options = event.target.options;
      return Array.prototype.map.call(options, (option2) => ({
        displayValue: option2.textContent,
        exportValue: option2.value
      }));
    };
    if (this.enableScripting && this.hasJSActions) {
      selectElement.addEventListener("updatefromsandbox", (jsEvent) => {
        const actions = {
          value(event) {
            removeEmptyEntry == null ? void 0 : removeEmptyEntry();
            const value = event.detail.value;
            const values = new Set(Array.isArray(value) ? value : [value]);
            for (const option2 of selectElement.options) {
              option2.selected = values.has(option2.value);
            }
            storage.setValue(id, {
              value: getValue(true)
            });
            selectedValues = getValue(false);
          },
          multipleSelection(event) {
            selectElement.multiple = true;
          },
          remove(event) {
            const options = selectElement.options;
            const index2 = event.detail.remove;
            options[index2].selected = false;
            selectElement.remove(index2);
            if (options.length > 0) {
              const i = Array.prototype.findIndex.call(options, (option2) => option2.selected);
              if (i === -1) {
                options[0].selected = true;
              }
            }
            storage.setValue(id, {
              value: getValue(true),
              items: getItems(event)
            });
            selectedValues = getValue(false);
          },
          clear(event) {
            while (selectElement.length !== 0) {
              selectElement.remove(0);
            }
            storage.setValue(id, {
              value: null,
              items: []
            });
            selectedValues = getValue(false);
          },
          insert(event) {
            const {
              index: index2,
              displayValue,
              exportValue
            } = event.detail.insert;
            const selectChild = selectElement.children[index2];
            const optionElement = document.createElement("option");
            optionElement.textContent = displayValue;
            optionElement.value = exportValue;
            if (selectChild) {
              selectChild.before(optionElement);
            } else {
              selectElement.append(optionElement);
            }
            storage.setValue(id, {
              value: getValue(true),
              items: getItems(event)
            });
            selectedValues = getValue(false);
          },
          items(event) {
            const {
              items
            } = event.detail;
            while (selectElement.length !== 0) {
              selectElement.remove(0);
            }
            for (const item of items) {
              const {
                displayValue,
                exportValue
              } = item;
              const optionElement = document.createElement("option");
              optionElement.textContent = displayValue;
              optionElement.value = exportValue;
              selectElement.append(optionElement);
            }
            if (selectElement.options.length > 0) {
              selectElement.options[0].selected = true;
            }
            storage.setValue(id, {
              value: getValue(true),
              items: getItems(event)
            });
            selectedValues = getValue(false);
          },
          indices(event) {
            const indices = new Set(event.detail.indices);
            for (const option2 of event.target.options) {
              option2.selected = indices.has(option2.index);
            }
            storage.setValue(id, {
              value: getValue(true)
            });
            selectedValues = getValue(false);
          },
          editable(event) {
            event.target.disabled = !event.detail.editable;
          }
        };
        this._dispatchEventFromSandbox(actions, jsEvent);
      });
      selectElement.addEventListener("input", (event) => {
        var _a2;
        const exportValue = getValue(true);
        const change = getValue(false);
        storage.setValue(id, {
          value: exportValue
        });
        event.preventDefault();
        (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("dispatcheventinsandbox", {
          source: this,
          detail: {
            id,
            name: "Keystroke",
            value: selectedValues,
            change,
            changeEx: exportValue,
            willCommit: false,
            commitKey: 1,
            keyDown: false
          }
        });
      });
      this._setEventListeners(selectElement, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], (event) => event.target.value);
    } else {
      selectElement.addEventListener("input", function(event) {
        storage.setValue(id, {
          value: getValue(true)
        });
      });
    }
    if (this.data.combo) {
      this._setTextStyle(selectElement);
    } else {
    }
    this._setBackgroundColor(selectElement);
    this._setDefaultPropertiesFromJS(selectElement);
    this.container.append(selectElement);
    return this.container;
  }
};
var PopupAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    const {
      data,
      elements
    } = parameters;
    super(parameters, {
      isRenderable: AnnotationElement._hasPopupData(data)
    });
    this.elements = elements;
    this.popup = null;
  }
  render() {
    this.container.classList.add("popupAnnotation");
    const popup = this.popup = new PopupElement({
      container: this.container,
      color: this.data.color,
      titleObj: this.data.titleObj,
      modificationDate: this.data.modificationDate,
      contentsObj: this.data.contentsObj,
      richText: this.data.richText,
      rect: this.data.rect,
      parentRect: this.data.parentRect || null,
      parent: this.parent,
      elements: this.elements,
      open: this.data.open
    });
    const elementIds = [];
    for (const element2 of this.elements) {
      element2.popup = popup;
      elementIds.push(element2.data.id);
      element2.addHighlightArea();
    }
    this.container.setAttribute("aria-controls", elementIds.map((id) => `${AnnotationPrefix}${id}`).join(","));
    return this.container;
  }
};
var _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container3, _contentsObj, _dateObj, _elements, _parent, _parentRect, _pinned, _popup, _position2, _rect, _richText, _titleObj, _updates2, _wasVisible, _html, html_get, _fontSize, fontSize_get, _fontColor, fontColor_get, _makePopupContent, makePopupContent_fn, _keyDown, keyDown_fn, _setPosition, setPosition_fn, _toggle, toggle_fn, _show, show_fn, _hide, hide_fn;
var PopupElement = class {
  constructor({
    container,
    color,
    elements,
    titleObj,
    modificationDate,
    contentsObj,
    richText,
    parent,
    rect,
    parentRect,
    open
  }) {
    __privateAdd(this, _html);
    __privateAdd(this, _fontSize);
    __privateAdd(this, _fontColor);
    __privateAdd(this, _makePopupContent);
    __privateAdd(this, _keyDown);
    __privateAdd(this, _setPosition);
    __privateAdd(this, _toggle);
    __privateAdd(this, _show);
    __privateAdd(this, _hide);
    __privateAdd(this, _boundKeyDown, __privateMethod(this, _keyDown, keyDown_fn).bind(this));
    __privateAdd(this, _boundHide, __privateMethod(this, _hide, hide_fn).bind(this));
    __privateAdd(this, _boundShow, __privateMethod(this, _show, show_fn).bind(this));
    __privateAdd(this, _boundToggle, __privateMethod(this, _toggle, toggle_fn).bind(this));
    __privateAdd(this, _color, null);
    __privateAdd(this, _container3, null);
    __privateAdd(this, _contentsObj, null);
    __privateAdd(this, _dateObj, null);
    __privateAdd(this, _elements, null);
    __privateAdd(this, _parent, null);
    __privateAdd(this, _parentRect, null);
    __privateAdd(this, _pinned, false);
    __privateAdd(this, _popup, null);
    __privateAdd(this, _position2, null);
    __privateAdd(this, _rect, null);
    __privateAdd(this, _richText, null);
    __privateAdd(this, _titleObj, null);
    __privateAdd(this, _updates2, null);
    __privateAdd(this, _wasVisible, false);
    var _a2;
    __privateSet(this, _container3, container);
    __privateSet(this, _titleObj, titleObj);
    __privateSet(this, _contentsObj, contentsObj);
    __privateSet(this, _richText, richText);
    __privateSet(this, _parent, parent);
    __privateSet(this, _color, color);
    __privateSet(this, _rect, rect);
    __privateSet(this, _parentRect, parentRect);
    __privateSet(this, _elements, elements);
    __privateSet(this, _dateObj, PDFDateString.toDateObject(modificationDate));
    this.trigger = elements.flatMap((e) => e.getElementsToTriggerPopup());
    for (const element2 of this.trigger) {
      element2.addEventListener("click", __privateGet(this, _boundToggle));
      element2.addEventListener("mouseenter", __privateGet(this, _boundShow));
      element2.addEventListener("mouseleave", __privateGet(this, _boundHide));
      element2.classList.add("popupTriggerArea");
    }
    for (const element2 of elements) {
      (_a2 = element2.container) == null ? void 0 : _a2.addEventListener("keydown", __privateGet(this, _boundKeyDown));
    }
    __privateGet(this, _container3).hidden = true;
    if (open) {
      __privateMethod(this, _toggle, toggle_fn).call(this);
    }
  }
  render() {
    if (__privateGet(this, _popup)) {
      return;
    }
    const popup = __privateSet(this, _popup, document.createElement("div"));
    popup.className = "popup";
    if (__privateGet(this, _color)) {
      const baseColor = popup.style.outlineColor = Util.makeHexColor(...__privateGet(this, _color));
      if (CSS.supports("background-color", "color-mix(in srgb, red 30%, white)")) {
        popup.style.backgroundColor = `color-mix(in srgb, ${baseColor} 30%, white)`;
      } else {
        const BACKGROUND_ENLIGHT = 0.7;
        popup.style.backgroundColor = Util.makeHexColor(...__privateGet(this, _color).map((c) => Math.floor(BACKGROUND_ENLIGHT * (255 - c) + c)));
      }
    }
    const header = document.createElement("span");
    header.className = "header";
    const title = document.createElement("h1");
    header.append(title);
    ({
      dir: title.dir,
      str: title.textContent
    } = __privateGet(this, _titleObj));
    popup.append(header);
    if (__privateGet(this, _dateObj)) {
      const modificationDate = document.createElement("span");
      modificationDate.classList.add("popupDate");
      modificationDate.setAttribute("data-l10n-id", "pdfjs-annotation-date-time-string");
      modificationDate.setAttribute("data-l10n-args", JSON.stringify({
        dateObj: __privateGet(this, _dateObj).valueOf()
      }));
      header.append(modificationDate);
    }
    const html = __privateGet(this, _html, html_get);
    if (html) {
      XfaLayer.render({
        xfaHtml: html,
        intent: "richText",
        div: popup
      });
      popup.lastChild.classList.add("richText", "popupContent");
    } else {
      const contents = this._formatContents(__privateGet(this, _contentsObj));
      popup.append(contents);
    }
    __privateGet(this, _container3).append(popup);
  }
  _formatContents({
    str,
    dir
  }) {
    const p = document.createElement("p");
    p.classList.add("popupContent");
    p.dir = dir;
    const lines = str.split(/(?:\r\n?|\n)/);
    for (let i = 0, ii = lines.length; i < ii; ++i) {
      const line = lines[i];
      p.append(document.createTextNode(line));
      if (i < ii - 1) {
        p.append(document.createElement("br"));
      }
    }
    return p;
  }
  updateEdited({
    rect,
    popupContent
  }) {
    var _a2;
    __privateGet(this, _updates2) || __privateSet(this, _updates2, {
      contentsObj: __privateGet(this, _contentsObj),
      richText: __privateGet(this, _richText)
    });
    if (rect) {
      __privateSet(this, _position2, null);
    }
    if (popupContent) {
      __privateSet(this, _richText, __privateMethod(this, _makePopupContent, makePopupContent_fn).call(this, popupContent));
      __privateSet(this, _contentsObj, null);
    }
    (_a2 = __privateGet(this, _popup)) == null ? void 0 : _a2.remove();
    __privateSet(this, _popup, null);
  }
  resetEdited() {
    var _a2;
    if (!__privateGet(this, _updates2)) {
      return;
    }
    ({
      contentsObj: __privateWrapper(this, _contentsObj)._,
      richText: __privateWrapper(this, _richText)._
    } = __privateGet(this, _updates2));
    __privateSet(this, _updates2, null);
    (_a2 = __privateGet(this, _popup)) == null ? void 0 : _a2.remove();
    __privateSet(this, _popup, null);
    __privateSet(this, _position2, null);
  }
  forceHide() {
    __privateSet(this, _wasVisible, this.isVisible);
    if (!__privateGet(this, _wasVisible)) {
      return;
    }
    __privateGet(this, _container3).hidden = true;
  }
  maybeShow() {
    if (!__privateGet(this, _wasVisible)) {
      return;
    }
    if (!__privateGet(this, _popup)) {
      __privateMethod(this, _show, show_fn).call(this);
    }
    __privateSet(this, _wasVisible, false);
    __privateGet(this, _container3).hidden = false;
  }
  get isVisible() {
    return __privateGet(this, _container3).hidden === false;
  }
};
_boundKeyDown = new WeakMap();
_boundHide = new WeakMap();
_boundShow = new WeakMap();
_boundToggle = new WeakMap();
_color = new WeakMap();
_container3 = new WeakMap();
_contentsObj = new WeakMap();
_dateObj = new WeakMap();
_elements = new WeakMap();
_parent = new WeakMap();
_parentRect = new WeakMap();
_pinned = new WeakMap();
_popup = new WeakMap();
_position2 = new WeakMap();
_rect = new WeakMap();
_richText = new WeakMap();
_titleObj = new WeakMap();
_updates2 = new WeakMap();
_wasVisible = new WeakMap();
_html = new WeakSet();
html_get = function() {
  const richText = __privateGet(this, _richText);
  const contentsObj = __privateGet(this, _contentsObj);
  if ((richText == null ? void 0 : richText.str) && (!(contentsObj == null ? void 0 : contentsObj.str) || contentsObj.str === richText.str)) {
    return __privateGet(this, _richText).html || null;
  }
  return null;
};
_fontSize = new WeakSet();
fontSize_get = function() {
  var _a2, _b, _c;
  return ((_c = (_b = (_a2 = __privateGet(this, _html, html_get)) == null ? void 0 : _a2.attributes) == null ? void 0 : _b.style) == null ? void 0 : _c.fontSize) || 0;
};
_fontColor = new WeakSet();
fontColor_get = function() {
  var _a2, _b, _c;
  return ((_c = (_b = (_a2 = __privateGet(this, _html, html_get)) == null ? void 0 : _a2.attributes) == null ? void 0 : _b.style) == null ? void 0 : _c.color) || null;
};
_makePopupContent = new WeakSet();
makePopupContent_fn = function(text2) {
  const popupLines = [];
  const popupContent = {
    str: text2,
    html: {
      name: "div",
      attributes: {
        dir: "auto"
      },
      children: [{
        name: "p",
        children: popupLines
      }]
    }
  };
  const lineAttributes = {
    style: {
      color: __privateGet(this, _fontColor, fontColor_get),
      fontSize: __privateGet(this, _fontSize, fontSize_get) ? `calc(${__privateGet(this, _fontSize, fontSize_get)}px * var(--scale-factor))` : ""
    }
  };
  for (const line of text2.split("\n")) {
    popupLines.push({
      name: "span",
      value: line,
      attributes: lineAttributes
    });
  }
  return popupContent;
};
_keyDown = new WeakSet();
keyDown_fn = function(event) {
  if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
    return;
  }
  if (event.key === "Enter" || event.key === "Escape" && __privateGet(this, _pinned)) {
    __privateMethod(this, _toggle, toggle_fn).call(this);
  }
};
_setPosition = new WeakSet();
setPosition_fn = function() {
  if (__privateGet(this, _position2) !== null) {
    return;
  }
  const {
    page: {
      view
    },
    viewport: {
      rawDims: {
        pageWidth,
        pageHeight,
        pageX,
        pageY
      }
    }
  } = __privateGet(this, _parent);
  let useParentRect = !!__privateGet(this, _parentRect);
  let rect = useParentRect ? __privateGet(this, _parentRect) : __privateGet(this, _rect);
  for (const element2 of __privateGet(this, _elements)) {
    if (!rect || Util.intersect(element2.data.rect, rect) !== null) {
      rect = element2.data.rect;
      useParentRect = true;
      break;
    }
  }
  const normalizedRect = Util.normalizeRect([rect[0], view[3] - rect[1] + view[1], rect[2], view[3] - rect[3] + view[1]]);
  const HORIZONTAL_SPACE_AFTER_ANNOTATION = 5;
  const parentWidth = useParentRect ? rect[2] - rect[0] + HORIZONTAL_SPACE_AFTER_ANNOTATION : 0;
  const popupLeft = normalizedRect[0] + parentWidth;
  const popupTop = normalizedRect[1];
  __privateSet(this, _position2, [100 * (popupLeft - pageX) / pageWidth, 100 * (popupTop - pageY) / pageHeight]);
  const {
    style
  } = __privateGet(this, _container3);
  style.left = `${__privateGet(this, _position2)[0]}%`;
  style.top = `${__privateGet(this, _position2)[1]}%`;
};
_toggle = new WeakSet();
toggle_fn = function() {
  __privateSet(this, _pinned, !__privateGet(this, _pinned));
  if (__privateGet(this, _pinned)) {
    __privateMethod(this, _show, show_fn).call(this);
    __privateGet(this, _container3).addEventListener("click", __privateGet(this, _boundToggle));
    __privateGet(this, _container3).addEventListener("keydown", __privateGet(this, _boundKeyDown));
  } else {
    __privateMethod(this, _hide, hide_fn).call(this);
    __privateGet(this, _container3).removeEventListener("click", __privateGet(this, _boundToggle));
    __privateGet(this, _container3).removeEventListener("keydown", __privateGet(this, _boundKeyDown));
  }
};
_show = new WeakSet();
show_fn = function() {
  if (!__privateGet(this, _popup)) {
    this.render();
  }
  if (!this.isVisible) {
    __privateMethod(this, _setPosition, setPosition_fn).call(this);
    __privateGet(this, _container3).hidden = false;
    __privateGet(this, _container3).style.zIndex = parseInt(__privateGet(this, _container3).style.zIndex) + 1e3;
  } else if (__privateGet(this, _pinned)) {
    __privateGet(this, _container3).classList.add("focused");
  }
};
_hide = new WeakSet();
hide_fn = function() {
  __privateGet(this, _container3).classList.remove("focused");
  if (__privateGet(this, _pinned) || !this.isVisible) {
    return;
  }
  __privateGet(this, _container3).hidden = true;
  __privateGet(this, _container3).style.zIndex = parseInt(__privateGet(this, _container3).style.zIndex) - 1e3;
};
var FreeTextAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    this.textContent = parameters.data.textContent;
    this.textPosition = parameters.data.textPosition;
    this.annotationEditorType = AnnotationEditorType.FREETEXT;
  }
  render() {
    this.container.classList.add("freeTextAnnotation");
    if (this.textContent) {
      const content = document.createElement("div");
      content.classList.add("annotationTextContent");
      content.setAttribute("role", "comment");
      for (const line of this.textContent) {
        const lineSpan = document.createElement("span");
        lineSpan.textContent = line;
        content.append(lineSpan);
      }
      this.container.append(content);
    }
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this._editOnDoubleClick();
    return this.container;
  }
};
var _line;
var LineAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    __privateAdd(this, _line, null);
  }
  render() {
    this.container.classList.add("lineAnnotation");
    const data = this.data;
    const {
      width,
      height
    } = getRectDims(data.rect);
    const svg = this.svgFactory.create(width, height, true);
    const line = __privateSet(this, _line, this.svgFactory.createElement("svg:line"));
    line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
    line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
    line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
    line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
    line.setAttribute("stroke-width", data.borderStyle.width || 1);
    line.setAttribute("stroke", "transparent");
    line.setAttribute("fill", "transparent");
    svg.append(line);
    this.container.append(svg);
    if (!data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _line);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_line = new WeakMap();
var _square;
var SquareAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    __privateAdd(this, _square, null);
  }
  render() {
    this.container.classList.add("squareAnnotation");
    const data = this.data;
    const {
      width,
      height
    } = getRectDims(data.rect);
    const svg = this.svgFactory.create(width, height, true);
    const borderWidth = data.borderStyle.width;
    const square = __privateSet(this, _square, this.svgFactory.createElement("svg:rect"));
    square.setAttribute("x", borderWidth / 2);
    square.setAttribute("y", borderWidth / 2);
    square.setAttribute("width", width - borderWidth);
    square.setAttribute("height", height - borderWidth);
    square.setAttribute("stroke-width", borderWidth || 1);
    square.setAttribute("stroke", "transparent");
    square.setAttribute("fill", "transparent");
    svg.append(square);
    this.container.append(svg);
    if (!data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _square);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_square = new WeakMap();
var _circle;
var CircleAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    __privateAdd(this, _circle, null);
  }
  render() {
    this.container.classList.add("circleAnnotation");
    const data = this.data;
    const {
      width,
      height
    } = getRectDims(data.rect);
    const svg = this.svgFactory.create(width, height, true);
    const borderWidth = data.borderStyle.width;
    const circle = __privateSet(this, _circle, this.svgFactory.createElement("svg:ellipse"));
    circle.setAttribute("cx", width / 2);
    circle.setAttribute("cy", height / 2);
    circle.setAttribute("rx", width / 2 - borderWidth / 2);
    circle.setAttribute("ry", height / 2 - borderWidth / 2);
    circle.setAttribute("stroke-width", borderWidth || 1);
    circle.setAttribute("stroke", "transparent");
    circle.setAttribute("fill", "transparent");
    svg.append(circle);
    this.container.append(svg);
    if (!data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _circle);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_circle = new WeakMap();
var _polyline;
var PolylineAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    __privateAdd(this, _polyline, null);
    this.containerClassName = "polylineAnnotation";
    this.svgElementName = "svg:polyline";
  }
  render() {
    this.container.classList.add(this.containerClassName);
    const {
      data: {
        rect,
        vertices,
        borderStyle,
        popupRef
      }
    } = this;
    if (!vertices) {
      return this.container;
    }
    const {
      width,
      height
    } = getRectDims(rect);
    const svg = this.svgFactory.create(width, height, true);
    let points = [];
    for (let i = 0, ii = vertices.length; i < ii; i += 2) {
      const x = vertices[i] - rect[0];
      const y = rect[3] - vertices[i + 1];
      points.push(`${x},${y}`);
    }
    points = points.join(" ");
    const polyline = __privateSet(this, _polyline, this.svgFactory.createElement(this.svgElementName));
    polyline.setAttribute("points", points);
    polyline.setAttribute("stroke-width", borderStyle.width || 1);
    polyline.setAttribute("stroke", "transparent");
    polyline.setAttribute("fill", "transparent");
    svg.append(polyline);
    this.container.append(svg);
    if (!popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _polyline);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_polyline = new WeakMap();
var PolygonAnnotationElement = class extends PolylineAnnotationElement {
  constructor(parameters) {
    super(parameters);
    this.containerClassName = "polygonAnnotation";
    this.svgElementName = "svg:polygon";
  }
};
var CaretAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
  }
  render() {
    this.container.classList.add("caretAnnotation");
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
};
var _polylines;
var InkAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
    __privateAdd(this, _polylines, []);
    this.containerClassName = "inkAnnotation";
    this.svgElementName = "svg:polyline";
    this.annotationEditorType = AnnotationEditorType.INK;
  }
  render() {
    this.container.classList.add(this.containerClassName);
    const {
      data: {
        rect,
        inkLists,
        borderStyle,
        popupRef
      }
    } = this;
    const {
      width,
      height
    } = getRectDims(rect);
    const svg = this.svgFactory.create(width, height, true);
    for (const inkList of inkLists) {
      let points = [];
      for (let i = 0, ii = inkList.length; i < ii; i += 2) {
        const x = inkList[i] - rect[0];
        const y = rect[3] - inkList[i + 1];
        points.push(`${x},${y}`);
      }
      points = points.join(" ");
      const polyline = this.svgFactory.createElement(this.svgElementName);
      __privateGet(this, _polylines).push(polyline);
      polyline.setAttribute("points", points);
      polyline.setAttribute("stroke-width", borderStyle.width || 1);
      polyline.setAttribute("stroke", "transparent");
      polyline.setAttribute("fill", "transparent");
      if (!popupRef && this.hasPopupData) {
        this._createPopup();
      }
      svg.append(polyline);
    }
    this.container.append(svg);
    return this.container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _polylines);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_polylines = new WeakMap();
var HighlightAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true,
      createQuadrilaterals: true
    });
  }
  render() {
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this.container.classList.add("highlightAnnotation");
    return this.container;
  }
};
var UnderlineAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true,
      createQuadrilaterals: true
    });
  }
  render() {
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this.container.classList.add("underlineAnnotation");
    return this.container;
  }
};
var SquigglyAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true,
      createQuadrilaterals: true
    });
  }
  render() {
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this.container.classList.add("squigglyAnnotation");
    return this.container;
  }
};
var StrikeOutAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true,
      createQuadrilaterals: true
    });
  }
  render() {
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    this.container.classList.add("strikeoutAnnotation");
    return this.container;
  }
};
var StampAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    super(parameters, {
      isRenderable: true,
      ignoreBorder: true
    });
  }
  render() {
    this.container.classList.add("stampAnnotation");
    if (!this.data.popupRef && this.hasPopupData) {
      this._createPopup();
    }
    return this.container;
  }
};
var _trigger, _download, download_fn;
var FileAttachmentAnnotationElement = class extends AnnotationElement {
  constructor(parameters) {
    var _a2;
    super(parameters, {
      isRenderable: true
    });
    __privateAdd(this, _download);
    __privateAdd(this, _trigger, null);
    const {
      file
    } = this.data;
    this.filename = file.filename;
    this.content = file.content;
    (_a2 = this.linkService.eventBus) == null ? void 0 : _a2.dispatch("fileattachmentannotation", {
      source: this,
      ...file
    });
  }
  render() {
    this.container.classList.add("fileAttachmentAnnotation");
    const {
      container,
      data
    } = this;
    let trigger;
    if (data.hasAppearance || data.fillAlpha === 0) {
      trigger = document.createElement("div");
    } else {
      trigger = document.createElement("img");
      trigger.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(data.name) ? "paperclip" : "pushpin"}.svg`;
      if (data.fillAlpha && data.fillAlpha < 1) {
        trigger.style = `filter: opacity(${Math.round(data.fillAlpha * 100)}%);`;
      }
    }
    trigger.addEventListener("dblclick", __privateMethod(this, _download, download_fn).bind(this));
    __privateSet(this, _trigger, trigger);
    const {
      isMac
    } = util_FeatureTest.platform;
    container.addEventListener("keydown", (evt) => {
      if (evt.key === "Enter" && (isMac ? evt.metaKey : evt.ctrlKey)) {
        __privateMethod(this, _download, download_fn).call(this);
      }
    });
    if (!data.popupRef && this.hasPopupData) {
      this._createPopup();
    } else {
      trigger.classList.add("popupTriggerArea");
    }
    container.append(trigger);
    return container;
  }
  getElementsToTriggerPopup() {
    return __privateGet(this, _trigger);
  }
  addHighlightArea() {
    this.container.classList.add("highlightArea");
  }
};
_trigger = new WeakMap();
_download = new WeakSet();
download_fn = function() {
  var _a2;
  (_a2 = this.downloadManager) == null ? void 0 : _a2.openOrDownloadData(this.content, this.filename);
};
var _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _appendElement, appendElement_fn, _setAnnotationCanvasMap, setAnnotationCanvasMap_fn;
var AnnotationLayer = class {
  constructor({
    div,
    accessibilityManager,
    annotationCanvasMap,
    annotationEditorUIManager,
    page,
    viewport
  }) {
    __privateAdd(this, _appendElement);
    __privateAdd(this, _setAnnotationCanvasMap);
    __privateAdd(this, _accessibilityManager, null);
    __privateAdd(this, _annotationCanvasMap, null);
    __privateAdd(this, _editableAnnotations, /* @__PURE__ */ new Map());
    this.div = div;
    __privateSet(this, _accessibilityManager, accessibilityManager);
    __privateSet(this, _annotationCanvasMap, annotationCanvasMap);
    this.page = page;
    this.viewport = viewport;
    this.zIndex = 0;
    this._annotationEditorUIManager = annotationEditorUIManager;
  }
  hasEditableAnnotations() {
    return __privateGet(this, _editableAnnotations).size > 0;
  }
  async render(params) {
    var _a2;
    const {
      annotations
    } = params;
    const layer = this.div;
    setLayerDimensions(layer, this.viewport);
    const popupToElements = /* @__PURE__ */ new Map();
    const elementParams = {
      data: null,
      layer,
      linkService: params.linkService,
      downloadManager: params.downloadManager,
      imageResourcesPath: params.imageResourcesPath || "",
      renderForms: params.renderForms !== false,
      svgFactory: new DOMSVGFactory(),
      annotationStorage: params.annotationStorage || new AnnotationStorage(),
      enableScripting: params.enableScripting === true,
      hasJSActions: params.hasJSActions,
      fieldObjects: params.fieldObjects,
      parent: this,
      elements: null
    };
    for (const data of annotations) {
      if (data.noHTML) {
        continue;
      }
      const isPopupAnnotation = data.annotationType === AnnotationType.POPUP;
      if (!isPopupAnnotation) {
        const {
          width,
          height
        } = getRectDims(data.rect);
        if (width <= 0 || height <= 0) {
          continue;
        }
      } else {
        const elements = popupToElements.get(data.id);
        if (!elements) {
          continue;
        }
        elementParams.elements = elements;
      }
      elementParams.data = data;
      const element2 = AnnotationElementFactory.create(elementParams);
      if (!element2.isRenderable) {
        continue;
      }
      if (!isPopupAnnotation && data.popupRef) {
        const elements = popupToElements.get(data.popupRef);
        if (!elements) {
          popupToElements.set(data.popupRef, [element2]);
        } else {
          elements.push(element2);
        }
      }
      const rendered = element2.render();
      if (data.hidden) {
        rendered.style.visibility = "hidden";
      }
      __privateMethod(this, _appendElement, appendElement_fn).call(this, rendered, data.id);
      if (element2._isEditable) {
        __privateGet(this, _editableAnnotations).set(element2.data.id, element2);
        (_a2 = this._annotationEditorUIManager) == null ? void 0 : _a2.renderAnnotationElement(element2);
      }
    }
    __privateMethod(this, _setAnnotationCanvasMap, setAnnotationCanvasMap_fn).call(this);
  }
  update({
    viewport
  }) {
    const layer = this.div;
    this.viewport = viewport;
    setLayerDimensions(layer, {
      rotation: viewport.rotation
    });
    __privateMethod(this, _setAnnotationCanvasMap, setAnnotationCanvasMap_fn).call(this);
    layer.hidden = false;
  }
  getEditableAnnotations() {
    return Array.from(__privateGet(this, _editableAnnotations).values());
  }
  getEditableAnnotation(id) {
    return __privateGet(this, _editableAnnotations).get(id);
  }
};
_accessibilityManager = new WeakMap();
_annotationCanvasMap = new WeakMap();
_editableAnnotations = new WeakMap();
_appendElement = new WeakSet();
appendElement_fn = function(element2, id) {
  var _a2;
  const contentElement = element2.firstChild || element2;
  contentElement.id = `${AnnotationPrefix}${id}`;
  this.div.append(element2);
  (_a2 = __privateGet(this, _accessibilityManager)) == null ? void 0 : _a2.moveElementInDOM(this.div, element2, contentElement, false);
};
_setAnnotationCanvasMap = new WeakSet();
setAnnotationCanvasMap_fn = function() {
  if (!__privateGet(this, _annotationCanvasMap)) {
    return;
  }
  const layer = this.div;
  for (const [id, canvas] of __privateGet(this, _annotationCanvasMap)) {
    const element2 = layer.querySelector(`[data-annotation-id="${id}"]`);
    if (!element2) {
      continue;
    }
    canvas.className = "annotationContent";
    const {
      firstChild
    } = element2;
    if (!firstChild) {
      element2.append(canvas);
    } else if (firstChild.nodeName === "CANVAS") {
      firstChild.replaceWith(canvas);
    } else if (!firstChild.classList.contains("annotationContent")) {
      firstChild.before(canvas);
    } else {
      firstChild.after(canvas);
    }
  }
  __privateGet(this, _annotationCanvasMap).clear();
};
var EOL_PATTERN = /\r\n?|\n/g;
var _color2, _content, _editorDivId, _editModeAC, _fontSize2, _initialData, _updateFontSize, updateFontSize_fn, _updateColor, updateColor_fn, _extractText, extractText_fn, _setEditorDimensions, setEditorDimensions_fn, _getNodeContent, getNodeContent_fn, _setContent, setContent_fn, _serializeContent, serializeContent_fn, _deserializeContent, deserializeContent_fn, _hasElementChanged, hasElementChanged_fn;
var _FreeTextEditor = class extends AnnotationEditor {
  constructor(params) {
    super({
      ...params,
      name: "freeTextEditor"
    });
    __privateAdd(this, _updateFontSize);
    __privateAdd(this, _updateColor);
    __privateAdd(this, _extractText);
    __privateAdd(this, _setEditorDimensions);
    __privateAdd(this, _setContent);
    __privateAdd(this, _serializeContent);
    __privateAdd(this, _hasElementChanged);
    __privateAdd(this, _color2, void 0);
    __privateAdd(this, _content, "");
    __privateAdd(this, _editorDivId, `${this.id}-editor`);
    __privateAdd(this, _editModeAC, null);
    __privateAdd(this, _fontSize2, void 0);
    __privateAdd(this, _initialData, null);
    __privateSet(this, _color2, params.color || _FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor);
    __privateSet(this, _fontSize2, params.fontSize || _FreeTextEditor._defaultFontSize);
  }
  static get _keyboardManager() {
    const proto = _FreeTextEditor.prototype;
    const arrowChecker = (self) => self.isEmpty();
    const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
    const big = AnnotationEditorUIManager.TRANSLATE_BIG;
    return shadow(this, "_keyboardManager", new KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], proto.commitOrRemove, {
      bubbles: true
    }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], proto.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], proto._translateEmpty, {
      args: [-small, 0],
      checker: arrowChecker
    }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto._translateEmpty, {
      args: [-big, 0],
      checker: arrowChecker
    }], [["ArrowRight", "mac+ArrowRight"], proto._translateEmpty, {
      args: [small, 0],
      checker: arrowChecker
    }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto._translateEmpty, {
      args: [big, 0],
      checker: arrowChecker
    }], [["ArrowUp", "mac+ArrowUp"], proto._translateEmpty, {
      args: [0, -small],
      checker: arrowChecker
    }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto._translateEmpty, {
      args: [0, -big],
      checker: arrowChecker
    }], [["ArrowDown", "mac+ArrowDown"], proto._translateEmpty, {
      args: [0, small],
      checker: arrowChecker
    }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto._translateEmpty, {
      args: [0, big],
      checker: arrowChecker
    }]]));
  }
  static initialize(l10n, uiManager) {
    AnnotationEditor.initialize(l10n, uiManager, {
      strings: ["pdfjs-free-text-default-content"]
    });
    const style = getComputedStyle(document.documentElement);
    this._internalPadding = parseFloat(style.getPropertyValue("--freetext-padding"));
  }
  static updateDefaultParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.FREETEXT_SIZE:
        _FreeTextEditor._defaultFontSize = value;
        break;
      case AnnotationEditorParamsType.FREETEXT_COLOR:
        _FreeTextEditor._defaultColor = value;
        break;
    }
  }
  updateParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.FREETEXT_SIZE:
        __privateMethod(this, _updateFontSize, updateFontSize_fn).call(this, value);
        break;
      case AnnotationEditorParamsType.FREETEXT_COLOR:
        __privateMethod(this, _updateColor, updateColor_fn).call(this, value);
        break;
    }
  }
  static get defaultPropertiesToUpdate() {
    return [[AnnotationEditorParamsType.FREETEXT_SIZE, _FreeTextEditor._defaultFontSize], [AnnotationEditorParamsType.FREETEXT_COLOR, _FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor]];
  }
  get propertiesToUpdate() {
    return [[AnnotationEditorParamsType.FREETEXT_SIZE, __privateGet(this, _fontSize2)], [AnnotationEditorParamsType.FREETEXT_COLOR, __privateGet(this, _color2)]];
  }
  _translateEmpty(x, y) {
    this._uiManager.translateSelectedEditors(x, y, true);
  }
  getInitialTranslation() {
    const scale = this.parentScale;
    return [-_FreeTextEditor._internalPadding * scale, -(_FreeTextEditor._internalPadding + __privateGet(this, _fontSize2)) * scale];
  }
  rebuild() {
    if (!this.parent) {
      return;
    }
    super.rebuild();
    if (this.div === null) {
      return;
    }
    if (!this.isAttachedToDOM) {
      this.parent.add(this);
    }
  }
  enableEditMode() {
    if (this.isInEditMode()) {
      return;
    }
    this.parent.setEditingState(false);
    this.parent.updateToolbar(AnnotationEditorType.FREETEXT);
    super.enableEditMode();
    this.overlayDiv.classList.remove("enabled");
    this.editorDiv.contentEditable = true;
    this._isDraggable = false;
    this.div.removeAttribute("aria-activedescendant");
    __privateSet(this, _editModeAC, new AbortController());
    const signal = this._uiManager.combinedSignal(__privateGet(this, _editModeAC));
    this.editorDiv.addEventListener("keydown", this.editorDivKeydown.bind(this), {
      signal
    });
    this.editorDiv.addEventListener("focus", this.editorDivFocus.bind(this), {
      signal
    });
    this.editorDiv.addEventListener("blur", this.editorDivBlur.bind(this), {
      signal
    });
    this.editorDiv.addEventListener("input", this.editorDivInput.bind(this), {
      signal
    });
    this.editorDiv.addEventListener("paste", this.editorDivPaste.bind(this), {
      signal
    });
  }
  disableEditMode() {
    var _a2;
    if (!this.isInEditMode()) {
      return;
    }
    this.parent.setEditingState(true);
    super.disableEditMode();
    this.overlayDiv.classList.add("enabled");
    this.editorDiv.contentEditable = false;
    this.div.setAttribute("aria-activedescendant", __privateGet(this, _editorDivId));
    this._isDraggable = true;
    (_a2 = __privateGet(this, _editModeAC)) == null ? void 0 : _a2.abort();
    __privateSet(this, _editModeAC, null);
    this.div.focus({
      preventScroll: true
    });
    this.isEditing = false;
    this.parent.div.classList.add("freetextEditing");
  }
  focusin(event) {
    if (!this._focusEventsAllowed) {
      return;
    }
    super.focusin(event);
    if (event.target !== this.editorDiv) {
      this.editorDiv.focus();
    }
  }
  onceAdded() {
    var _a2;
    if (this.width) {
      return;
    }
    this.enableEditMode();
    this.editorDiv.focus();
    if ((_a2 = this._initialOptions) == null ? void 0 : _a2.isCentered) {
      this.center();
    }
    this._initialOptions = null;
  }
  isEmpty() {
    return !this.editorDiv || this.editorDiv.innerText.trim() === "";
  }
  remove() {
    this.isEditing = false;
    if (this.parent) {
      this.parent.setEditingState(true);
      this.parent.div.classList.add("freetextEditing");
    }
    super.remove();
  }
  commit() {
    if (!this.isInEditMode()) {
      return;
    }
    super.commit();
    this.disableEditMode();
    const savedText = __privateGet(this, _content);
    const newText = __privateSet(this, _content, __privateMethod(this, _extractText, extractText_fn).call(this).trimEnd());
    if (savedText === newText) {
      return;
    }
    const setText = (text2) => {
      __privateSet(this, _content, text2);
      if (!text2) {
        this.remove();
        return;
      }
      __privateMethod(this, _setContent, setContent_fn).call(this);
      this._uiManager.rebuild(this);
      __privateMethod(this, _setEditorDimensions, setEditorDimensions_fn).call(this);
    };
    this.addCommands({
      cmd: () => {
        setText(newText);
      },
      undo: () => {
        setText(savedText);
      },
      mustExec: false
    });
    __privateMethod(this, _setEditorDimensions, setEditorDimensions_fn).call(this);
  }
  shouldGetKeyboardEvents() {
    return this.isInEditMode();
  }
  enterInEditMode() {
    this.enableEditMode();
    this.editorDiv.focus();
  }
  dblclick(event) {
    this.enterInEditMode();
  }
  keydown(event) {
    if (event.target === this.div && event.key === "Enter") {
      this.enterInEditMode();
      event.preventDefault();
    }
  }
  editorDivKeydown(event) {
    _FreeTextEditor._keyboardManager.exec(this, event);
  }
  editorDivFocus(event) {
    this.isEditing = true;
  }
  editorDivBlur(event) {
    this.isEditing = false;
  }
  editorDivInput(event) {
    this.parent.div.classList.toggle("freetextEditing", this.isEmpty());
  }
  disableEditing() {
    this.editorDiv.setAttribute("role", "comment");
    this.editorDiv.removeAttribute("aria-multiline");
  }
  enableEditing() {
    this.editorDiv.setAttribute("role", "textbox");
    this.editorDiv.setAttribute("aria-multiline", true);
  }
  render() {
    if (this.div) {
      return this.div;
    }
    let baseX, baseY;
    if (this.width) {
      baseX = this.x;
      baseY = this.y;
    }
    super.render();
    this.editorDiv = document.createElement("div");
    this.editorDiv.className = "internal";
    this.editorDiv.setAttribute("id", __privateGet(this, _editorDivId));
    this.editorDiv.setAttribute("data-l10n-id", "pdfjs-free-text");
    this.enableEditing();
    AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then((msg) => {
      var _a2;
      return (_a2 = this.editorDiv) == null ? void 0 : _a2.setAttribute("default-content", msg);
    });
    this.editorDiv.contentEditable = true;
    const {
      style
    } = this.editorDiv;
    style.fontSize = `calc(${__privateGet(this, _fontSize2)}px * var(--scale-factor))`;
    style.color = __privateGet(this, _color2);
    this.div.append(this.editorDiv);
    this.overlayDiv = document.createElement("div");
    this.overlayDiv.classList.add("overlay", "enabled");
    this.div.append(this.overlayDiv);
    bindEvents(this, this.div, ["dblclick", "keydown"]);
    if (this.width) {
      const [parentWidth, parentHeight] = this.parentDimensions;
      if (this.annotationElementId) {
        const {
          position
        } = __privateGet(this, _initialData);
        let [tx, ty] = this.getInitialTranslation();
        [tx, ty] = this.pageTranslationToScreen(tx, ty);
        const [pageWidth, pageHeight] = this.pageDimensions;
        const [pageX, pageY] = this.pageTranslation;
        let posX, posY;
        switch (this.rotation) {
          case 0:
            posX = baseX + (position[0] - pageX) / pageWidth;
            posY = baseY + this.height - (position[1] - pageY) / pageHeight;
            break;
          case 90:
            posX = baseX + (position[0] - pageX) / pageWidth;
            posY = baseY - (position[1] - pageY) / pageHeight;
            [tx, ty] = [ty, -tx];
            break;
          case 180:
            posX = baseX - this.width + (position[0] - pageX) / pageWidth;
            posY = baseY - (position[1] - pageY) / pageHeight;
            [tx, ty] = [-tx, -ty];
            break;
          case 270:
            posX = baseX + (position[0] - pageX - this.height * pageHeight) / pageWidth;
            posY = baseY + (position[1] - pageY - this.width * pageWidth) / pageHeight;
            [tx, ty] = [-ty, tx];
            break;
        }
        this.setAt(posX * parentWidth, posY * parentHeight, tx, ty);
      } else {
        this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
      }
      __privateMethod(this, _setContent, setContent_fn).call(this);
      this._isDraggable = true;
      this.editorDiv.contentEditable = false;
    } else {
      this._isDraggable = false;
      this.editorDiv.contentEditable = true;
    }
    return this.div;
  }
  editorDivPaste(event) {
    var _a2, _b, _c;
    const clipboardData = event.clipboardData || window.clipboardData;
    const {
      types
    } = clipboardData;
    if (types.length === 1 && types[0] === "text/plain") {
      return;
    }
    event.preventDefault();
    const paste = __privateMethod(_a2 = _FreeTextEditor, _deserializeContent, deserializeContent_fn).call(_a2, clipboardData.getData("text") || "").replaceAll(EOL_PATTERN, "\n");
    if (!paste) {
      return;
    }
    const selection = window.getSelection();
    if (!selection.rangeCount) {
      return;
    }
    this.editorDiv.normalize();
    selection.deleteFromDocument();
    const range = selection.getRangeAt(0);
    if (!paste.includes("\n")) {
      range.insertNode(document.createTextNode(paste));
      this.editorDiv.normalize();
      selection.collapseToStart();
      return;
    }
    const {
      startContainer,
      startOffset
    } = range;
    const bufferBefore = [];
    const bufferAfter = [];
    if (startContainer.nodeType === Node.TEXT_NODE) {
      const parent = startContainer.parentElement;
      bufferAfter.push(startContainer.nodeValue.slice(startOffset).replaceAll(EOL_PATTERN, ""));
      if (parent !== this.editorDiv) {
        let buffer = bufferBefore;
        for (const child of this.editorDiv.childNodes) {
          if (child === parent) {
            buffer = bufferAfter;
            continue;
          }
          buffer.push(__privateMethod(_b = _FreeTextEditor, _getNodeContent, getNodeContent_fn).call(_b, child));
        }
      }
      bufferBefore.push(startContainer.nodeValue.slice(0, startOffset).replaceAll(EOL_PATTERN, ""));
    } else if (startContainer === this.editorDiv) {
      let buffer = bufferBefore;
      let i = 0;
      for (const child of this.editorDiv.childNodes) {
        if (i++ === startOffset) {
          buffer = bufferAfter;
        }
        buffer.push(__privateMethod(_c = _FreeTextEditor, _getNodeContent, getNodeContent_fn).call(_c, child));
      }
    }
    __privateSet(this, _content, `${bufferBefore.join("\n")}${paste}${bufferAfter.join("\n")}`);
    __privateMethod(this, _setContent, setContent_fn).call(this);
    const newRange = new Range();
    let beforeLength = bufferBefore.reduce((acc, line) => acc + line.length, 0);
    for (const {
      firstChild
    } of this.editorDiv.childNodes) {
      if (firstChild.nodeType === Node.TEXT_NODE) {
        const length = firstChild.nodeValue.length;
        if (beforeLength <= length) {
          newRange.setStart(firstChild, beforeLength);
          newRange.setEnd(firstChild, beforeLength);
          break;
        }
        beforeLength -= length;
      }
    }
    selection.removeAllRanges();
    selection.addRange(newRange);
  }
  get contentDiv() {
    return this.editorDiv;
  }
  static deserialize(data, parent, uiManager) {
    var _a2;
    let initialData = null;
    if (data instanceof FreeTextAnnotationElement) {
      const {
        data: {
          defaultAppearanceData: {
            fontSize,
            fontColor
          },
          rect,
          rotation,
          id
        },
        textContent,
        textPosition,
        parent: {
          page: {
            pageNumber
          }
        }
      } = data;
      if (!textContent || textContent.length === 0) {
        return null;
      }
      initialData = data = {
        annotationType: AnnotationEditorType.FREETEXT,
        color: Array.from(fontColor),
        fontSize,
        value: textContent.join("\n"),
        position: textPosition,
        pageIndex: pageNumber - 1,
        rect: rect.slice(0),
        rotation,
        id,
        deleted: false
      };
    }
    const editor = super.deserialize(data, parent, uiManager);
    __privateSet(editor, _fontSize2, data.fontSize);
    __privateSet(editor, _color2, Util.makeHexColor(...data.color));
    __privateSet(editor, _content, __privateMethod(_a2 = _FreeTextEditor, _deserializeContent, deserializeContent_fn).call(_a2, data.value));
    editor.annotationElementId = data.id || null;
    __privateSet(editor, _initialData, initialData);
    return editor;
  }
  serialize(isForCopying = false) {
    if (this.isEmpty()) {
      return null;
    }
    if (this.deleted) {
      return {
        pageIndex: this.pageIndex,
        id: this.annotationElementId,
        deleted: true
      };
    }
    const padding = _FreeTextEditor._internalPadding * this.parentScale;
    const rect = this.getRect(padding, padding);
    const color = AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : __privateGet(this, _color2));
    const serialized = {
      annotationType: AnnotationEditorType.FREETEXT,
      color,
      fontSize: __privateGet(this, _fontSize2),
      value: __privateMethod(this, _serializeContent, serializeContent_fn).call(this),
      pageIndex: this.pageIndex,
      rect,
      rotation: this.rotation,
      structTreeParentId: this._structTreeParentId
    };
    if (isForCopying) {
      return serialized;
    }
    if (this.annotationElementId && !__privateMethod(this, _hasElementChanged, hasElementChanged_fn).call(this, serialized)) {
      return null;
    }
    serialized.id = this.annotationElementId;
    return serialized;
  }
  renderAnnotationElement(annotation) {
    const content = super.renderAnnotationElement(annotation);
    if (this.deleted) {
      return content;
    }
    const {
      style
    } = content;
    style.fontSize = `calc(${__privateGet(this, _fontSize2)}px * var(--scale-factor))`;
    style.color = __privateGet(this, _color2);
    content.replaceChildren();
    for (const line of __privateGet(this, _content).split("\n")) {
      const div = document.createElement("div");
      div.append(line ? document.createTextNode(line) : document.createElement("br"));
      content.append(div);
    }
    const padding = _FreeTextEditor._internalPadding * this.parentScale;
    annotation.updateEdited({
      rect: this.getRect(padding, padding),
      popupContent: __privateGet(this, _content)
    });
    return content;
  }
  resetAnnotationElement(annotation) {
    super.resetAnnotationElement(annotation);
    annotation.resetEdited();
  }
};
var FreeTextEditor = _FreeTextEditor;
_color2 = new WeakMap();
_content = new WeakMap();
_editorDivId = new WeakMap();
_editModeAC = new WeakMap();
_fontSize2 = new WeakMap();
_initialData = new WeakMap();
_updateFontSize = new WeakSet();
updateFontSize_fn = function(fontSize) {
  const setFontsize = (size) => {
    this.editorDiv.style.fontSize = `calc(${size}px * var(--scale-factor))`;
    this.translate(0, -(size - __privateGet(this, _fontSize2)) * this.parentScale);
    __privateSet(this, _fontSize2, size);
    __privateMethod(this, _setEditorDimensions, setEditorDimensions_fn).call(this);
  };
  const savedFontsize = __privateGet(this, _fontSize2);
  this.addCommands({
    cmd: setFontsize.bind(this, fontSize),
    undo: setFontsize.bind(this, savedFontsize),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.FREETEXT_SIZE,
    overwriteIfSameType: true,
    keepUndo: true
  });
};
_updateColor = new WeakSet();
updateColor_fn = function(color) {
  const setColor = (col) => {
    __privateSet(this, _color2, this.editorDiv.style.color = col);
  };
  const savedColor = __privateGet(this, _color2);
  this.addCommands({
    cmd: setColor.bind(this, color),
    undo: setColor.bind(this, savedColor),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.FREETEXT_COLOR,
    overwriteIfSameType: true,
    keepUndo: true
  });
};
_extractText = new WeakSet();
extractText_fn = function() {
  var _a2;
  const buffer = [];
  this.editorDiv.normalize();
  for (const child of this.editorDiv.childNodes) {
    buffer.push(__privateMethod(_a2 = _FreeTextEditor, _getNodeContent, getNodeContent_fn).call(_a2, child));
  }
  return buffer.join("\n");
};
_setEditorDimensions = new WeakSet();
setEditorDimensions_fn = function() {
  const [parentWidth, parentHeight] = this.parentDimensions;
  let rect;
  if (this.isAttachedToDOM) {
    rect = this.div.getBoundingClientRect();
  } else {
    const {
      currentLayer,
      div
    } = this;
    const savedDisplay = div.style.display;
    const savedVisibility = div.classList.contains("hidden");
    div.classList.remove("hidden");
    div.style.display = "hidden";
    currentLayer.div.append(this.div);
    rect = div.getBoundingClientRect();
    div.remove();
    div.style.display = savedDisplay;
    div.classList.toggle("hidden", savedVisibility);
  }
  if (this.rotation % 180 === this.parentRotation % 180) {
    this.width = rect.width / parentWidth;
    this.height = rect.height / parentHeight;
  } else {
    this.width = rect.height / parentWidth;
    this.height = rect.width / parentHeight;
  }
  this.fixAndSetPosition();
};
_getNodeContent = new WeakSet();
getNodeContent_fn = function(node) {
  return (node.nodeType === Node.TEXT_NODE ? node.nodeValue : node.innerText).replaceAll(EOL_PATTERN, "");
};
_setContent = new WeakSet();
setContent_fn = function() {
  this.editorDiv.replaceChildren();
  if (!__privateGet(this, _content)) {
    return;
  }
  for (const line of __privateGet(this, _content).split("\n")) {
    const div = document.createElement("div");
    div.append(line ? document.createTextNode(line) : document.createElement("br"));
    this.editorDiv.append(div);
  }
};
_serializeContent = new WeakSet();
serializeContent_fn = function() {
  return __privateGet(this, _content).replaceAll("\xA0", " ");
};
_deserializeContent = new WeakSet();
deserializeContent_fn = function(content) {
  return content.replaceAll(" ", "\xA0");
};
_hasElementChanged = new WeakSet();
hasElementChanged_fn = function(serialized) {
  const {
    value,
    fontSize,
    color,
    pageIndex
  } = __privateGet(this, _initialData);
  return this._hasBeenMoved || serialized.value !== value || serialized.fontSize !== fontSize || serialized.color.some((c, i) => c !== color[i]) || serialized.pageIndex !== pageIndex;
};
__privateAdd(FreeTextEditor, _getNodeContent);
__privateAdd(FreeTextEditor, _deserializeContent);
__publicField(FreeTextEditor, "_freeTextDefaultContent", "");
__publicField(FreeTextEditor, "_internalPadding", 0);
__publicField(FreeTextEditor, "_defaultColor", null);
__publicField(FreeTextEditor, "_defaultFontSize", 10);
__publicField(FreeTextEditor, "_type", "freetext");
__publicField(FreeTextEditor, "_editorType", AnnotationEditorType.FREETEXT);
var _box, _verticalEdges, _intervals, _getOutlines, getOutlines_fn, _binarySearch, binarySearch_fn, _insert, insert_fn, _remove, remove_fn, _breakEdge, breakEdge_fn;
var Outliner = class {
  constructor(boxes, borderWidth = 0, innerMargin = 0, isLTR = true) {
    __privateAdd(this, _getOutlines);
    __privateAdd(this, _binarySearch);
    __privateAdd(this, _insert);
    __privateAdd(this, _remove);
    __privateAdd(this, _breakEdge);
    __privateAdd(this, _box, void 0);
    __privateAdd(this, _verticalEdges, []);
    __privateAdd(this, _intervals, []);
    let minX = Infinity;
    let maxX = -Infinity;
    let minY = Infinity;
    let maxY = -Infinity;
    const NUMBER_OF_DIGITS = 4;
    const EPSILON = 10 ** -NUMBER_OF_DIGITS;
    for (const {
      x,
      y,
      width,
      height
    } of boxes) {
      const x1 = Math.floor((x - borderWidth) / EPSILON) * EPSILON;
      const x2 = Math.ceil((x + width + borderWidth) / EPSILON) * EPSILON;
      const y1 = Math.floor((y - borderWidth) / EPSILON) * EPSILON;
      const y2 = Math.ceil((y + height + borderWidth) / EPSILON) * EPSILON;
      const left = [x1, y1, y2, true];
      const right = [x2, y1, y2, false];
      __privateGet(this, _verticalEdges).push(left, right);
      minX = Math.min(minX, x1);
      maxX = Math.max(maxX, x2);
      minY = Math.min(minY, y1);
      maxY = Math.max(maxY, y2);
    }
    const bboxWidth = maxX - minX + 2 * innerMargin;
    const bboxHeight = maxY - minY + 2 * innerMargin;
    const shiftedMinX = minX - innerMargin;
    const shiftedMinY = minY - innerMargin;
    const lastEdge = __privateGet(this, _verticalEdges).at(isLTR ? -1 : -2);
    const lastPoint = [lastEdge[0], lastEdge[2]];
    for (const edge of __privateGet(this, _verticalEdges)) {
      const [x, y1, y2] = edge;
      edge[0] = (x - shiftedMinX) / bboxWidth;
      edge[1] = (y1 - shiftedMinY) / bboxHeight;
      edge[2] = (y2 - shiftedMinY) / bboxHeight;
    }
    __privateSet(this, _box, {
      x: shiftedMinX,
      y: shiftedMinY,
      width: bboxWidth,
      height: bboxHeight,
      lastPoint
    });
  }
  getOutlines() {
    __privateGet(this, _verticalEdges).sort((a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2]);
    const outlineVerticalEdges = [];
    for (const edge of __privateGet(this, _verticalEdges)) {
      if (edge[3]) {
        outlineVerticalEdges.push(...__privateMethod(this, _breakEdge, breakEdge_fn).call(this, edge));
        __privateMethod(this, _insert, insert_fn).call(this, edge);
      } else {
        __privateMethod(this, _remove, remove_fn).call(this, edge);
        outlineVerticalEdges.push(...__privateMethod(this, _breakEdge, breakEdge_fn).call(this, edge));
      }
    }
    return __privateMethod(this, _getOutlines, getOutlines_fn).call(this, outlineVerticalEdges);
  }
};
_box = new WeakMap();
_verticalEdges = new WeakMap();
_intervals = new WeakMap();
_getOutlines = new WeakSet();
getOutlines_fn = function(outlineVerticalEdges) {
  const edges = [];
  const allEdges = /* @__PURE__ */ new Set();
  for (const edge of outlineVerticalEdges) {
    const [x, y1, y2] = edge;
    edges.push([x, y1, edge], [x, y2, edge]);
  }
  edges.sort((a, b) => a[1] - b[1] || a[0] - b[0]);
  for (let i = 0, ii = edges.length; i < ii; i += 2) {
    const edge1 = edges[i][2];
    const edge2 = edges[i + 1][2];
    edge1.push(edge2);
    edge2.push(edge1);
    allEdges.add(edge1);
    allEdges.add(edge2);
  }
  const outlines = [];
  let outline;
  while (allEdges.size > 0) {
    const edge = allEdges.values().next().value;
    let [x, y1, y2, edge1, edge2] = edge;
    allEdges.delete(edge);
    let lastPointX = x;
    let lastPointY = y1;
    outline = [x, y2];
    outlines.push(outline);
    while (true) {
      let e;
      if (allEdges.has(edge1)) {
        e = edge1;
      } else if (allEdges.has(edge2)) {
        e = edge2;
      } else {
        break;
      }
      allEdges.delete(e);
      [x, y1, y2, edge1, edge2] = e;
      if (lastPointX !== x) {
        outline.push(lastPointX, lastPointY, x, lastPointY === y1 ? y1 : y2);
        lastPointX = x;
      }
      lastPointY = lastPointY === y1 ? y2 : y1;
    }
    outline.push(lastPointX, lastPointY);
  }
  return new HighlightOutline(outlines, __privateGet(this, _box));
};
_binarySearch = new WeakSet();
binarySearch_fn = function(y) {
  const array = __privateGet(this, _intervals);
  let start = 0;
  let end = array.length - 1;
  while (start <= end) {
    const middle = start + end >> 1;
    const y1 = array[middle][0];
    if (y1 === y) {
      return middle;
    }
    if (y1 < y) {
      start = middle + 1;
    } else {
      end = middle - 1;
    }
  }
  return end + 1;
};
_insert = new WeakSet();
insert_fn = function([, y1, y2]) {
  const index2 = __privateMethod(this, _binarySearch, binarySearch_fn).call(this, y1);
  __privateGet(this, _intervals).splice(index2, 0, [y1, y2]);
};
_remove = new WeakSet();
remove_fn = function([, y1, y2]) {
  const index2 = __privateMethod(this, _binarySearch, binarySearch_fn).call(this, y1);
  for (let i = index2; i < __privateGet(this, _intervals).length; i++) {
    const [start, end] = __privateGet(this, _intervals)[i];
    if (start !== y1) {
      break;
    }
    if (start === y1 && end === y2) {
      __privateGet(this, _intervals).splice(i, 1);
      return;
    }
  }
  for (let i = index2 - 1; i >= 0; i--) {
    const [start, end] = __privateGet(this, _intervals)[i];
    if (start !== y1) {
      break;
    }
    if (start === y1 && end === y2) {
      __privateGet(this, _intervals).splice(i, 1);
      return;
    }
  }
};
_breakEdge = new WeakSet();
breakEdge_fn = function(edge) {
  const [x, y1, y2] = edge;
  const results = [[x, y1, y2]];
  const index2 = __privateMethod(this, _binarySearch, binarySearch_fn).call(this, y2);
  for (let i = 0; i < index2; i++) {
    const [start, end] = __privateGet(this, _intervals)[i];
    for (let j = 0, jj = results.length; j < jj; j++) {
      const [, y3, y4] = results[j];
      if (end <= y3 || y4 <= start) {
        continue;
      }
      if (y3 >= start) {
        if (y4 > end) {
          results[j][1] = end;
        } else {
          if (jj === 1) {
            return [];
          }
          results.splice(j, 1);
          j--;
          jj--;
        }
        continue;
      }
      results[j][2] = start;
      if (y4 > end) {
        results.push([x, end, y4]);
      }
    }
  }
  return results;
};
var Outline = class {
  toSVGPath() {
    throw new Error("Abstract method `toSVGPath` must be implemented.");
  }
  get box() {
    throw new Error("Abstract getter `box` must be implemented.");
  }
  serialize(_bbox2, _rotation2) {
    throw new Error("Abstract method `serialize` must be implemented.");
  }
  get free() {
    return this instanceof FreeHighlightOutline;
  }
};
var _box2, _outlines;
var HighlightOutline = class extends Outline {
  constructor(outlines, box) {
    super();
    __privateAdd(this, _box2, void 0);
    __privateAdd(this, _outlines, void 0);
    __privateSet(this, _outlines, outlines);
    __privateSet(this, _box2, box);
  }
  toSVGPath() {
    const buffer = [];
    for (const polygon of __privateGet(this, _outlines)) {
      let [prevX, prevY] = polygon;
      buffer.push(`M${prevX} ${prevY}`);
      for (let i = 2; i < polygon.length; i += 2) {
        const x = polygon[i];
        const y = polygon[i + 1];
        if (x === prevX) {
          buffer.push(`V${y}`);
          prevY = y;
        } else if (y === prevY) {
          buffer.push(`H${x}`);
          prevX = x;
        }
      }
      buffer.push("Z");
    }
    return buffer.join(" ");
  }
  serialize([blX, blY, trX, trY], _rotation2) {
    const outlines = [];
    const width = trX - blX;
    const height = trY - blY;
    for (const outline of __privateGet(this, _outlines)) {
      const points = new Array(outline.length);
      for (let i = 0; i < outline.length; i += 2) {
        points[i] = blX + outline[i] * width;
        points[i + 1] = trY - outline[i + 1] * height;
      }
      outlines.push(points);
    }
    return outlines;
  }
  get box() {
    return __privateGet(this, _box2);
  }
};
_box2 = new WeakMap();
_outlines = new WeakMap();
var _box3, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _getLastCoords, getLastCoords_fn;
var _FreeOutliner = class {
  constructor({
    x,
    y
  }, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
    __privateAdd(this, _getLastCoords);
    __privateAdd(this, _box3, void 0);
    __privateAdd(this, _bottom, []);
    __privateAdd(this, _innerMargin, void 0);
    __privateAdd(this, _isLTR, void 0);
    __privateAdd(this, _top, []);
    __privateAdd(this, _last, new Float64Array(18));
    __privateAdd(this, _lastX, void 0);
    __privateAdd(this, _lastY, void 0);
    __privateAdd(this, _min, void 0);
    __privateAdd(this, _min_dist, void 0);
    __privateAdd(this, _scaleFactor, void 0);
    __privateAdd(this, _thickness, void 0);
    __privateAdd(this, _points, []);
    __privateSet(this, _box3, box);
    __privateSet(this, _thickness, thickness * scaleFactor);
    __privateSet(this, _isLTR, isLTR);
    __privateGet(this, _last).set([NaN, NaN, NaN, NaN, x, y], 6);
    __privateSet(this, _innerMargin, innerMargin);
    __privateSet(this, _min_dist, __privateGet(_FreeOutliner, _MIN_DIST) * scaleFactor);
    __privateSet(this, _min, __privateGet(_FreeOutliner, _MIN) * scaleFactor);
    __privateSet(this, _scaleFactor, scaleFactor);
    __privateGet(this, _points).push(x, y);
  }
  get free() {
    return true;
  }
  isEmpty() {
    return isNaN(__privateGet(this, _last)[8]);
  }
  add({
    x,
    y
  }) {
    var _a2;
    __privateSet(this, _lastX, x);
    __privateSet(this, _lastY, y);
    const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box3);
    let [x1, y1, x2, y2] = __privateGet(this, _last).subarray(8, 12);
    const diffX = x - x2;
    const diffY = y - y2;
    const d = Math.hypot(diffX, diffY);
    if (d < __privateGet(this, _min)) {
      return false;
    }
    const diffD = d - __privateGet(this, _min_dist);
    const K = diffD / d;
    const shiftX = K * diffX;
    const shiftY = K * diffY;
    let x0 = x1;
    let y0 = y1;
    x1 = x2;
    y1 = y2;
    x2 += shiftX;
    y2 += shiftY;
    (_a2 = __privateGet(this, _points)) == null ? void 0 : _a2.push(x, y);
    const nX = -shiftY / diffD;
    const nY = shiftX / diffD;
    const thX = nX * __privateGet(this, _thickness);
    const thY = nY * __privateGet(this, _thickness);
    __privateGet(this, _last).set(__privateGet(this, _last).subarray(2, 8), 0);
    __privateGet(this, _last).set([x2 + thX, y2 + thY], 4);
    __privateGet(this, _last).set(__privateGet(this, _last).subarray(14, 18), 12);
    __privateGet(this, _last).set([x2 - thX, y2 - thY], 16);
    if (isNaN(__privateGet(this, _last)[6])) {
      if (__privateGet(this, _top).length === 0) {
        __privateGet(this, _last).set([x1 + thX, y1 + thY], 2);
        __privateGet(this, _top).push(NaN, NaN, NaN, NaN, (x1 + thX - layerX) / layerWidth, (y1 + thY - layerY) / layerHeight);
        __privateGet(this, _last).set([x1 - thX, y1 - thY], 14);
        __privateGet(this, _bottom).push(NaN, NaN, NaN, NaN, (x1 - thX - layerX) / layerWidth, (y1 - thY - layerY) / layerHeight);
      }
      __privateGet(this, _last).set([x0, y0, x1, y1, x2, y2], 6);
      return !this.isEmpty();
    }
    __privateGet(this, _last).set([x0, y0, x1, y1, x2, y2], 6);
    const angle = Math.abs(Math.atan2(y0 - y1, x0 - x1) - Math.atan2(shiftY, shiftX));
    if (angle < Math.PI / 2) {
      [x1, y1, x2, y2] = __privateGet(this, _last).subarray(2, 6);
      __privateGet(this, _top).push(NaN, NaN, NaN, NaN, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
      [x1, y1, x0, y0] = __privateGet(this, _last).subarray(14, 18);
      __privateGet(this, _bottom).push(NaN, NaN, NaN, NaN, ((x0 + x1) / 2 - layerX) / layerWidth, ((y0 + y1) / 2 - layerY) / layerHeight);
      return true;
    }
    [x0, y0, x1, y1, x2, y2] = __privateGet(this, _last).subarray(0, 6);
    __privateGet(this, _top).push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
    [x2, y2, x1, y1, x0, y0] = __privateGet(this, _last).subarray(12, 18);
    __privateGet(this, _bottom).push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
    return true;
  }
  toSVGPath() {
    if (this.isEmpty()) {
      return "";
    }
    const top = __privateGet(this, _top);
    const bottom = __privateGet(this, _bottom);
    const lastTop = __privateGet(this, _last).subarray(4, 6);
    const lastBottom = __privateGet(this, _last).subarray(16, 18);
    const [x, y, width, height] = __privateGet(this, _box3);
    const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _getLastCoords, getLastCoords_fn).call(this);
    if (isNaN(__privateGet(this, _last)[6]) && !this.isEmpty()) {
      return `M${(__privateGet(this, _last)[2] - x) / width} ${(__privateGet(this, _last)[3] - y) / height} L${(__privateGet(this, _last)[4] - x) / width} ${(__privateGet(this, _last)[5] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(__privateGet(this, _last)[16] - x) / width} ${(__privateGet(this, _last)[17] - y) / height} L${(__privateGet(this, _last)[14] - x) / width} ${(__privateGet(this, _last)[15] - y) / height} Z`;
    }
    const buffer = [];
    buffer.push(`M${top[4]} ${top[5]}`);
    for (let i = 6; i < top.length; i += 6) {
      if (isNaN(top[i])) {
        buffer.push(`L${top[i + 4]} ${top[i + 5]}`);
      } else {
        buffer.push(`C${top[i]} ${top[i + 1]} ${top[i + 2]} ${top[i + 3]} ${top[i + 4]} ${top[i + 5]}`);
      }
    }
    buffer.push(`L${(lastTop[0] - x) / width} ${(lastTop[1] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(lastBottom[0] - x) / width} ${(lastBottom[1] - y) / height}`);
    for (let i = bottom.length - 6; i >= 6; i -= 6) {
      if (isNaN(bottom[i])) {
        buffer.push(`L${bottom[i + 4]} ${bottom[i + 5]}`);
      } else {
        buffer.push(`C${bottom[i]} ${bottom[i + 1]} ${bottom[i + 2]} ${bottom[i + 3]} ${bottom[i + 4]} ${bottom[i + 5]}`);
      }
    }
    buffer.push(`L${bottom[4]} ${bottom[5]} Z`);
    return buffer.join(" ");
  }
  getOutlines() {
    var _a2, _b;
    const top = __privateGet(this, _top);
    const bottom = __privateGet(this, _bottom);
    const last = __privateGet(this, _last);
    const lastTop = last.subarray(4, 6);
    const lastBottom = last.subarray(16, 18);
    const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box3);
    const points = new Float64Array(((_b = (_a2 = __privateGet(this, _points)) == null ? void 0 : _a2.length) != null ? _b : 0) + 2);
    for (let i = 0, ii = points.length - 2; i < ii; i += 2) {
      points[i] = (__privateGet(this, _points)[i] - layerX) / layerWidth;
      points[i + 1] = (__privateGet(this, _points)[i + 1] - layerY) / layerHeight;
    }
    points[points.length - 2] = (__privateGet(this, _lastX) - layerX) / layerWidth;
    points[points.length - 1] = (__privateGet(this, _lastY) - layerY) / layerHeight;
    const [lastTopX, lastTopY, lastBottomX, lastBottomY] = __privateMethod(this, _getLastCoords, getLastCoords_fn).call(this);
    if (isNaN(last[6]) && !this.isEmpty()) {
      const outline2 = new Float64Array(36);
      outline2.set([NaN, NaN, NaN, NaN, (last[2] - layerX) / layerWidth, (last[3] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last[4] - layerX) / layerWidth, (last[5] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (last[16] - layerX) / layerWidth, (last[17] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last[14] - layerX) / layerWidth, (last[15] - layerY) / layerHeight], 0);
      return new FreeHighlightOutline(outline2, points, __privateGet(this, _box3), __privateGet(this, _scaleFactor), __privateGet(this, _innerMargin), __privateGet(this, _isLTR));
    }
    const outline = new Float64Array(__privateGet(this, _top).length + 24 + __privateGet(this, _bottom).length);
    let N = top.length;
    for (let i = 0; i < N; i += 2) {
      if (isNaN(top[i])) {
        outline[i] = outline[i + 1] = NaN;
        continue;
      }
      outline[i] = top[i];
      outline[i + 1] = top[i + 1];
    }
    outline.set([NaN, NaN, NaN, NaN, (lastTop[0] - layerX) / layerWidth, (lastTop[1] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (lastBottom[0] - layerX) / layerWidth, (lastBottom[1] - layerY) / layerHeight], N);
    N += 24;
    for (let i = bottom.length - 6; i >= 6; i -= 6) {
      for (let j = 0; j < 6; j += 2) {
        if (isNaN(bottom[i + j])) {
          outline[N] = outline[N + 1] = NaN;
          N += 2;
          continue;
        }
        outline[N] = bottom[i + j];
        outline[N + 1] = bottom[i + j + 1];
        N += 2;
      }
    }
    outline.set([NaN, NaN, NaN, NaN, bottom[4], bottom[5]], N);
    return new FreeHighlightOutline(outline, points, __privateGet(this, _box3), __privateGet(this, _scaleFactor), __privateGet(this, _innerMargin), __privateGet(this, _isLTR));
  }
};
var FreeOutliner = _FreeOutliner;
_box3 = new WeakMap();
_bottom = new WeakMap();
_innerMargin = new WeakMap();
_isLTR = new WeakMap();
_top = new WeakMap();
_last = new WeakMap();
_lastX = new WeakMap();
_lastY = new WeakMap();
_min = new WeakMap();
_min_dist = new WeakMap();
_scaleFactor = new WeakMap();
_thickness = new WeakMap();
_points = new WeakMap();
_MIN_DIST = new WeakMap();
_MIN_DIFF = new WeakMap();
_MIN = new WeakMap();
_getLastCoords = new WeakSet();
getLastCoords_fn = function() {
  const lastTop = __privateGet(this, _last).subarray(4, 6);
  const lastBottom = __privateGet(this, _last).subarray(16, 18);
  const [x, y, width, height] = __privateGet(this, _box3);
  return [(__privateGet(this, _lastX) + (lastTop[0] - lastBottom[0]) / 2 - x) / width, (__privateGet(this, _lastY) + (lastTop[1] - lastBottom[1]) / 2 - y) / height, (__privateGet(this, _lastX) + (lastBottom[0] - lastTop[0]) / 2 - x) / width, (__privateGet(this, _lastY) + (lastBottom[1] - lastTop[1]) / 2 - y) / height];
};
__privateAdd(FreeOutliner, _MIN_DIST, 8);
__privateAdd(FreeOutliner, _MIN_DIFF, 2);
__privateAdd(FreeOutliner, _MIN, __privateGet(_FreeOutliner, _MIN_DIST) + __privateGet(_FreeOutliner, _MIN_DIFF));
var _box4, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _rescale, rescale_fn, _rescaleAndSwap, rescaleAndSwap_fn, _computeMinMax, computeMinMax_fn;
var FreeHighlightOutline = class extends Outline {
  constructor(outline, points, box, scaleFactor, innerMargin, isLTR) {
    super();
    __privateAdd(this, _rescale);
    __privateAdd(this, _rescaleAndSwap);
    __privateAdd(this, _computeMinMax);
    __privateAdd(this, _box4, void 0);
    __privateAdd(this, _bbox, null);
    __privateAdd(this, _innerMargin2, void 0);
    __privateAdd(this, _isLTR2, void 0);
    __privateAdd(this, _points2, void 0);
    __privateAdd(this, _scaleFactor2, void 0);
    __privateAdd(this, _outline, void 0);
    __privateSet(this, _outline, outline);
    __privateSet(this, _points2, points);
    __privateSet(this, _box4, box);
    __privateSet(this, _scaleFactor2, scaleFactor);
    __privateSet(this, _innerMargin2, innerMargin);
    __privateSet(this, _isLTR2, isLTR);
    __privateMethod(this, _computeMinMax, computeMinMax_fn).call(this, isLTR);
    const {
      x,
      y,
      width,
      height
    } = __privateGet(this, _bbox);
    for (let i = 0, ii = outline.length; i < ii; i += 2) {
      outline[i] = (outline[i] - x) / width;
      outline[i + 1] = (outline[i + 1] - y) / height;
    }
    for (let i = 0, ii = points.length; i < ii; i += 2) {
      points[i] = (points[i] - x) / width;
      points[i + 1] = (points[i + 1] - y) / height;
    }
  }
  toSVGPath() {
    const buffer = [`M${__privateGet(this, _outline)[4]} ${__privateGet(this, _outline)[5]}`];
    for (let i = 6, ii = __privateGet(this, _outline).length; i < ii; i += 6) {
      if (isNaN(__privateGet(this, _outline)[i])) {
        buffer.push(`L${__privateGet(this, _outline)[i + 4]} ${__privateGet(this, _outline)[i + 5]}`);
        continue;
      }
      buffer.push(`C${__privateGet(this, _outline)[i]} ${__privateGet(this, _outline)[i + 1]} ${__privateGet(this, _outline)[i + 2]} ${__privateGet(this, _outline)[i + 3]} ${__privateGet(this, _outline)[i + 4]} ${__privateGet(this, _outline)[i + 5]}`);
    }
    buffer.push("Z");
    return buffer.join(" ");
  }
  serialize([blX, blY, trX, trY], rotation) {
    const width = trX - blX;
    const height = trY - blY;
    let outline;
    let points;
    switch (rotation) {
      case 0:
        outline = __privateMethod(this, _rescale, rescale_fn).call(this, __privateGet(this, _outline), blX, trY, width, -height);
        points = __privateMethod(this, _rescale, rescale_fn).call(this, __privateGet(this, _points2), blX, trY, width, -height);
        break;
      case 90:
        outline = __privateMethod(this, _rescaleAndSwap, rescaleAndSwap_fn).call(this, __privateGet(this, _outline), blX, blY, width, height);
        points = __privateMethod(this, _rescaleAndSwap, rescaleAndSwap_fn).call(this, __privateGet(this, _points2), blX, blY, width, height);
        break;
      case 180:
        outline = __privateMethod(this, _rescale, rescale_fn).call(this, __privateGet(this, _outline), trX, blY, -width, height);
        points = __privateMethod(this, _rescale, rescale_fn).call(this, __privateGet(this, _points2), trX, blY, -width, height);
        break;
      case 270:
        outline = __privateMethod(this, _rescaleAndSwap, rescaleAndSwap_fn).call(this, __privateGet(this, _outline), trX, trY, -width, -height);
        points = __privateMethod(this, _rescaleAndSwap, rescaleAndSwap_fn).call(this, __privateGet(this, _points2), trX, trY, -width, -height);
        break;
    }
    return {
      outline: Array.from(outline),
      points: [Array.from(points)]
    };
  }
  get box() {
    return __privateGet(this, _bbox);
  }
  getNewOutline(thickness, innerMargin) {
    const {
      x,
      y,
      width,
      height
    } = __privateGet(this, _bbox);
    const [layerX, layerY, layerWidth, layerHeight] = __privateGet(this, _box4);
    const sx = width * layerWidth;
    const sy = height * layerHeight;
    const tx = x * layerWidth + layerX;
    const ty = y * layerHeight + layerY;
    const outliner = new FreeOutliner({
      x: __privateGet(this, _points2)[0] * sx + tx,
      y: __privateGet(this, _points2)[1] * sy + ty
    }, __privateGet(this, _box4), __privateGet(this, _scaleFactor2), thickness, __privateGet(this, _isLTR2), innerMargin != null ? innerMargin : __privateGet(this, _innerMargin2));
    for (let i = 2; i < __privateGet(this, _points2).length; i += 2) {
      outliner.add({
        x: __privateGet(this, _points2)[i] * sx + tx,
        y: __privateGet(this, _points2)[i + 1] * sy + ty
      });
    }
    return outliner.getOutlines();
  }
};
_box4 = new WeakMap();
_bbox = new WeakMap();
_innerMargin2 = new WeakMap();
_isLTR2 = new WeakMap();
_points2 = new WeakMap();
_scaleFactor2 = new WeakMap();
_outline = new WeakMap();
_rescale = new WeakSet();
rescale_fn = function(src, tx, ty, sx, sy) {
  const dest = new Float64Array(src.length);
  for (let i = 0, ii = src.length; i < ii; i += 2) {
    dest[i] = tx + src[i] * sx;
    dest[i + 1] = ty + src[i + 1] * sy;
  }
  return dest;
};
_rescaleAndSwap = new WeakSet();
rescaleAndSwap_fn = function(src, tx, ty, sx, sy) {
  const dest = new Float64Array(src.length);
  for (let i = 0, ii = src.length; i < ii; i += 2) {
    dest[i] = tx + src[i + 1] * sx;
    dest[i + 1] = ty + src[i] * sy;
  }
  return dest;
};
_computeMinMax = new WeakSet();
computeMinMax_fn = function(isLTR) {
  const outline = __privateGet(this, _outline);
  let lastX = outline[4];
  let lastY = outline[5];
  let minX = lastX;
  let minY = lastY;
  let maxX = lastX;
  let maxY = lastY;
  let lastPointX = lastX;
  let lastPointY = lastY;
  const ltrCallback = isLTR ? Math.max : Math.min;
  for (let i = 6, ii = outline.length; i < ii; i += 6) {
    if (isNaN(outline[i])) {
      minX = Math.min(minX, outline[i + 4]);
      minY = Math.min(minY, outline[i + 5]);
      maxX = Math.max(maxX, outline[i + 4]);
      maxY = Math.max(maxY, outline[i + 5]);
      if (lastPointY < outline[i + 5]) {
        lastPointX = outline[i + 4];
        lastPointY = outline[i + 5];
      } else if (lastPointY === outline[i + 5]) {
        lastPointX = ltrCallback(lastPointX, outline[i + 4]);
      }
    } else {
      const bbox = Util.bezierBoundingBox(lastX, lastY, ...outline.slice(i, i + 6));
      minX = Math.min(minX, bbox[0]);
      minY = Math.min(minY, bbox[1]);
      maxX = Math.max(maxX, bbox[2]);
      maxY = Math.max(maxY, bbox[3]);
      if (lastPointY < bbox[3]) {
        lastPointX = bbox[2];
        lastPointY = bbox[3];
      } else if (lastPointY === bbox[3]) {
        lastPointX = ltrCallback(lastPointX, bbox[2]);
      }
    }
    lastX = outline[i + 4];
    lastY = outline[i + 5];
  }
  const x = minX - __privateGet(this, _innerMargin2), y = minY - __privateGet(this, _innerMargin2), width = maxX - minX + 2 * __privateGet(this, _innerMargin2), height = maxY - minY + 2 * __privateGet(this, _innerMargin2);
  __privateSet(this, _bbox, {
    x,
    y,
    width,
    height,
    lastPoint: [lastPointX, lastPointY]
  });
};
var _boundKeyDown2, _boundPointerDown, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor3, _eventBus, _uiManager2, _type, _getDropdownRoot, getDropdownRoot_fn, _colorSelect, colorSelect_fn, _keyDown2, keyDown_fn2, _openDropdown, openDropdown_fn, _pointerDown2, pointerDown_fn2, _isDropdownVisible, isDropdownVisible_get;
var _ColorPicker = class {
  constructor({
    editor = null,
    uiManager = null
  }) {
    __privateAdd(this, _getDropdownRoot);
    __privateAdd(this, _colorSelect);
    __privateAdd(this, _keyDown2);
    __privateAdd(this, _openDropdown);
    __privateAdd(this, _pointerDown2);
    __privateAdd(this, _isDropdownVisible);
    __privateAdd(this, _boundKeyDown2, __privateMethod(this, _keyDown2, keyDown_fn2).bind(this));
    __privateAdd(this, _boundPointerDown, __privateMethod(this, _pointerDown2, pointerDown_fn2).bind(this));
    __privateAdd(this, _button, null);
    __privateAdd(this, _buttonSwatch, null);
    __privateAdd(this, _defaultColor, void 0);
    __privateAdd(this, _dropdown, null);
    __privateAdd(this, _dropdownWasFromKeyboard, false);
    __privateAdd(this, _isMainColorPicker, false);
    __privateAdd(this, _editor3, null);
    __privateAdd(this, _eventBus, void 0);
    __privateAdd(this, _uiManager2, null);
    __privateAdd(this, _type, void 0);
    var _a2;
    if (editor) {
      __privateSet(this, _isMainColorPicker, false);
      __privateSet(this, _type, AnnotationEditorParamsType.HIGHLIGHT_COLOR);
      __privateSet(this, _editor3, editor);
    } else {
      __privateSet(this, _isMainColorPicker, true);
      __privateSet(this, _type, AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR);
    }
    __privateSet(this, _uiManager2, (editor == null ? void 0 : editor._uiManager) || uiManager);
    __privateSet(this, _eventBus, __privateGet(this, _uiManager2)._eventBus);
    __privateSet(this, _defaultColor, (editor == null ? void 0 : editor.color) || ((_a2 = __privateGet(this, _uiManager2)) == null ? void 0 : _a2.highlightColors.values().next().value) || "#FFFF98");
  }
  static get _keyboardManager() {
    return shadow(this, "_keyboardManager", new KeyboardManager([[["Escape", "mac+Escape"], _ColorPicker.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], _ColorPicker.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], _ColorPicker.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], _ColorPicker.prototype._moveToPrevious], [["Home", "mac+Home"], _ColorPicker.prototype._moveToBeginning], [["End", "mac+End"], _ColorPicker.prototype._moveToEnd]]));
  }
  renderButton() {
    const button = __privateSet(this, _button, document.createElement("button"));
    button.className = "colorPicker";
    button.tabIndex = "0";
    button.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-button");
    button.setAttribute("aria-haspopup", true);
    const signal = __privateGet(this, _uiManager2)._signal;
    button.addEventListener("click", __privateMethod(this, _openDropdown, openDropdown_fn).bind(this), {
      signal
    });
    button.addEventListener("keydown", __privateGet(this, _boundKeyDown2), {
      signal
    });
    const swatch = __privateSet(this, _buttonSwatch, document.createElement("span"));
    swatch.className = "swatch";
    swatch.setAttribute("aria-hidden", true);
    swatch.style.backgroundColor = __privateGet(this, _defaultColor);
    button.append(swatch);
    return button;
  }
  renderMainDropdown() {
    const dropdown = __privateSet(this, _dropdown, __privateMethod(this, _getDropdownRoot, getDropdownRoot_fn).call(this));
    dropdown.setAttribute("aria-orientation", "horizontal");
    dropdown.setAttribute("aria-labelledby", "highlightColorPickerLabel");
    return dropdown;
  }
  _colorSelectFromKeyboard(event) {
    if (event.target === __privateGet(this, _button)) {
      __privateMethod(this, _openDropdown, openDropdown_fn).call(this, event);
      return;
    }
    const color = event.target.getAttribute("data-color");
    if (!color) {
      return;
    }
    __privateMethod(this, _colorSelect, colorSelect_fn).call(this, color, event);
  }
  _moveToNext(event) {
    var _a2, _b;
    if (!__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
      __privateMethod(this, _openDropdown, openDropdown_fn).call(this, event);
      return;
    }
    if (event.target === __privateGet(this, _button)) {
      (_a2 = __privateGet(this, _dropdown).firstChild) == null ? void 0 : _a2.focus();
      return;
    }
    (_b = event.target.nextSibling) == null ? void 0 : _b.focus();
  }
  _moveToPrevious(event) {
    var _a2, _b;
    if (event.target === ((_a2 = __privateGet(this, _dropdown)) == null ? void 0 : _a2.firstChild) || event.target === __privateGet(this, _button)) {
      if (__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
        this._hideDropdownFromKeyboard();
      }
      return;
    }
    if (!__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
      __privateMethod(this, _openDropdown, openDropdown_fn).call(this, event);
    }
    (_b = event.target.previousSibling) == null ? void 0 : _b.focus();
  }
  _moveToBeginning(event) {
    var _a2;
    if (!__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
      __privateMethod(this, _openDropdown, openDropdown_fn).call(this, event);
      return;
    }
    (_a2 = __privateGet(this, _dropdown).firstChild) == null ? void 0 : _a2.focus();
  }
  _moveToEnd(event) {
    var _a2;
    if (!__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
      __privateMethod(this, _openDropdown, openDropdown_fn).call(this, event);
      return;
    }
    (_a2 = __privateGet(this, _dropdown).lastChild) == null ? void 0 : _a2.focus();
  }
  hideDropdown() {
    var _a2;
    (_a2 = __privateGet(this, _dropdown)) == null ? void 0 : _a2.classList.add("hidden");
    window.removeEventListener("pointerdown", __privateGet(this, _boundPointerDown));
  }
  _hideDropdownFromKeyboard() {
    var _a2;
    if (__privateGet(this, _isMainColorPicker)) {
      return;
    }
    if (!__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
      (_a2 = __privateGet(this, _editor3)) == null ? void 0 : _a2.unselect();
      return;
    }
    this.hideDropdown();
    __privateGet(this, _button).focus({
      preventScroll: true,
      focusVisible: __privateGet(this, _dropdownWasFromKeyboard)
    });
  }
  updateColor(color) {
    if (__privateGet(this, _buttonSwatch)) {
      __privateGet(this, _buttonSwatch).style.backgroundColor = color;
    }
    if (!__privateGet(this, _dropdown)) {
      return;
    }
    const i = __privateGet(this, _uiManager2).highlightColors.values();
    for (const child of __privateGet(this, _dropdown).children) {
      child.setAttribute("aria-selected", i.next().value === color);
    }
  }
  destroy() {
    var _a2, _b;
    (_a2 = __privateGet(this, _button)) == null ? void 0 : _a2.remove();
    __privateSet(this, _button, null);
    __privateSet(this, _buttonSwatch, null);
    (_b = __privateGet(this, _dropdown)) == null ? void 0 : _b.remove();
    __privateSet(this, _dropdown, null);
  }
};
var ColorPicker = _ColorPicker;
_boundKeyDown2 = new WeakMap();
_boundPointerDown = new WeakMap();
_button = new WeakMap();
_buttonSwatch = new WeakMap();
_defaultColor = new WeakMap();
_dropdown = new WeakMap();
_dropdownWasFromKeyboard = new WeakMap();
_isMainColorPicker = new WeakMap();
_editor3 = new WeakMap();
_eventBus = new WeakMap();
_uiManager2 = new WeakMap();
_type = new WeakMap();
_getDropdownRoot = new WeakSet();
getDropdownRoot_fn = function() {
  const div = document.createElement("div");
  const signal = __privateGet(this, _uiManager2)._signal;
  div.addEventListener("contextmenu", noContextMenu, {
    signal
  });
  div.className = "dropdown";
  div.role = "listbox";
  div.setAttribute("aria-multiselectable", false);
  div.setAttribute("aria-orientation", "vertical");
  div.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-dropdown");
  for (const [name, color] of __privateGet(this, _uiManager2).highlightColors) {
    const button = document.createElement("button");
    button.tabIndex = "0";
    button.role = "option";
    button.setAttribute("data-color", color);
    button.title = name;
    button.setAttribute("data-l10n-id", `pdfjs-editor-colorpicker-${name}`);
    const swatch = document.createElement("span");
    button.append(swatch);
    swatch.className = "swatch";
    swatch.style.backgroundColor = color;
    button.setAttribute("aria-selected", color === __privateGet(this, _defaultColor));
    button.addEventListener("click", __privateMethod(this, _colorSelect, colorSelect_fn).bind(this, color), {
      signal
    });
    div.append(button);
  }
  div.addEventListener("keydown", __privateGet(this, _boundKeyDown2), {
    signal
  });
  return div;
};
_colorSelect = new WeakSet();
colorSelect_fn = function(color, event) {
  event.stopPropagation();
  __privateGet(this, _eventBus).dispatch("switchannotationeditorparams", {
    source: this,
    type: __privateGet(this, _type),
    value: color
  });
};
_keyDown2 = new WeakSet();
keyDown_fn2 = function(event) {
  _ColorPicker._keyboardManager.exec(this, event);
};
_openDropdown = new WeakSet();
openDropdown_fn = function(event) {
  if (__privateGet(this, _isDropdownVisible, isDropdownVisible_get)) {
    this.hideDropdown();
    return;
  }
  __privateSet(this, _dropdownWasFromKeyboard, event.detail === 0);
  window.addEventListener("pointerdown", __privateGet(this, _boundPointerDown), {
    signal: __privateGet(this, _uiManager2)._signal
  });
  if (__privateGet(this, _dropdown)) {
    __privateGet(this, _dropdown).classList.remove("hidden");
    return;
  }
  const root = __privateSet(this, _dropdown, __privateMethod(this, _getDropdownRoot, getDropdownRoot_fn).call(this));
  __privateGet(this, _button).append(root);
};
_pointerDown2 = new WeakSet();
pointerDown_fn2 = function(event) {
  var _a2;
  if ((_a2 = __privateGet(this, _dropdown)) == null ? void 0 : _a2.contains(event.target)) {
    return;
  }
  this.hideDropdown();
};
_isDropdownVisible = new WeakSet();
isDropdownVisible_get = function() {
  return __privateGet(this, _dropdown) && !__privateGet(this, _dropdown).classList.contains("hidden");
};
var _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint, _opacity, _outlineId, _text, _thickness2, _methodOfCreation, _createOutlines, createOutlines_fn, _createFreeOutlines, createFreeOutlines_fn, _updateColor2, updateColor_fn2, _updateThickness, updateThickness_fn, _changeThickness, changeThickness_fn, _cleanDrawLayer, cleanDrawLayer_fn, _addToDrawLayer, addToDrawLayer_fn, _rotateBbox, rotateBbox_fn, _keydown, keydown_fn, _setCaret, setCaret_fn, _getRotation, getRotation_fn, _serializeBoxes, serializeBoxes_fn, _serializeOutlines, serializeOutlines_fn, _highlightMove, highlightMove_fn, _endHighlight, endHighlight_fn;
var _HighlightEditor = class extends AnnotationEditor {
  constructor(params) {
    super({
      ...params,
      name: "highlightEditor"
    });
    __privateAdd(this, _createOutlines);
    __privateAdd(this, _createFreeOutlines);
    __privateAdd(this, _updateColor2);
    __privateAdd(this, _updateThickness);
    __privateAdd(this, _changeThickness);
    __privateAdd(this, _cleanDrawLayer);
    __privateAdd(this, _addToDrawLayer);
    __privateAdd(this, _keydown);
    __privateAdd(this, _setCaret);
    __privateAdd(this, _getRotation);
    __privateAdd(this, _serializeBoxes);
    __privateAdd(this, _serializeOutlines);
    __privateAdd(this, _anchorNode, null);
    __privateAdd(this, _anchorOffset, 0);
    __privateAdd(this, _boxes, void 0);
    __privateAdd(this, _clipPathId, null);
    __privateAdd(this, _colorPicker2, null);
    __privateAdd(this, _focusOutlines, null);
    __privateAdd(this, _focusNode, null);
    __privateAdd(this, _focusOffset, 0);
    __privateAdd(this, _highlightDiv, null);
    __privateAdd(this, _highlightOutlines, null);
    __privateAdd(this, _id4, null);
    __privateAdd(this, _isFreeHighlight, false);
    __privateAdd(this, _lastPoint, null);
    __privateAdd(this, _opacity, void 0);
    __privateAdd(this, _outlineId, null);
    __privateAdd(this, _text, "");
    __privateAdd(this, _thickness2, void 0);
    __privateAdd(this, _methodOfCreation, "");
    this.color = params.color || _HighlightEditor._defaultColor;
    __privateSet(this, _thickness2, params.thickness || _HighlightEditor._defaultThickness);
    __privateSet(this, _opacity, params.opacity || _HighlightEditor._defaultOpacity);
    __privateSet(this, _boxes, params.boxes || null);
    __privateSet(this, _methodOfCreation, params.methodOfCreation || "");
    __privateSet(this, _text, params.text || "");
    this._isDraggable = false;
    if (params.highlightId > -1) {
      __privateSet(this, _isFreeHighlight, true);
      __privateMethod(this, _createFreeOutlines, createFreeOutlines_fn).call(this, params);
      __privateMethod(this, _addToDrawLayer, addToDrawLayer_fn).call(this);
    } else {
      __privateSet(this, _anchorNode, params.anchorNode);
      __privateSet(this, _anchorOffset, params.anchorOffset);
      __privateSet(this, _focusNode, params.focusNode);
      __privateSet(this, _focusOffset, params.focusOffset);
      __privateMethod(this, _createOutlines, createOutlines_fn).call(this);
      __privateMethod(this, _addToDrawLayer, addToDrawLayer_fn).call(this);
      this.rotate(this.rotation);
    }
  }
  static get _keyboardManager() {
    const proto = _HighlightEditor.prototype;
    return shadow(this, "_keyboardManager", new KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], proto._moveCaret, {
      args: [0]
    }], [["ArrowRight", "mac+ArrowRight"], proto._moveCaret, {
      args: [1]
    }], [["ArrowUp", "mac+ArrowUp"], proto._moveCaret, {
      args: [2]
    }], [["ArrowDown", "mac+ArrowDown"], proto._moveCaret, {
      args: [3]
    }]]));
  }
  get telemetryInitialData() {
    return {
      action: "added",
      type: __privateGet(this, _isFreeHighlight) ? "free_highlight" : "highlight",
      color: this._uiManager.highlightColorNames.get(this.color),
      thickness: __privateGet(this, _thickness2),
      methodOfCreation: __privateGet(this, _methodOfCreation)
    };
  }
  get telemetryFinalData() {
    return {
      type: "highlight",
      color: this._uiManager.highlightColorNames.get(this.color)
    };
  }
  static computeTelemetryFinalData(data) {
    return {
      numberOfColors: data.get("color").size
    };
  }
  static initialize(l10n, uiManager) {
    var _a2;
    AnnotationEditor.initialize(l10n, uiManager);
    _HighlightEditor._defaultColor || (_HighlightEditor._defaultColor = ((_a2 = uiManager.highlightColors) == null ? void 0 : _a2.values().next().value) || "#fff066");
  }
  static updateDefaultParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
        _HighlightEditor._defaultColor = value;
        break;
      case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
        _HighlightEditor._defaultThickness = value;
        break;
    }
  }
  translateInPage(x, y) {
  }
  get toolbarPosition() {
    return __privateGet(this, _lastPoint);
  }
  updateParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.HIGHLIGHT_COLOR:
        __privateMethod(this, _updateColor2, updateColor_fn2).call(this, value);
        break;
      case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
        __privateMethod(this, _updateThickness, updateThickness_fn).call(this, value);
        break;
    }
  }
  static get defaultPropertiesToUpdate() {
    return [[AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR, _HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, _HighlightEditor._defaultThickness]];
  }
  get propertiesToUpdate() {
    return [[AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.color || _HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, __privateGet(this, _thickness2) || _HighlightEditor._defaultThickness], [AnnotationEditorParamsType.HIGHLIGHT_FREE, __privateGet(this, _isFreeHighlight)]];
  }
  async addEditToolbar() {
    const toolbar = await super.addEditToolbar();
    if (!toolbar) {
      return null;
    }
    if (this._uiManager.highlightColors) {
      __privateSet(this, _colorPicker2, new ColorPicker({
        editor: this
      }));
      toolbar.addColorPicker(__privateGet(this, _colorPicker2));
    }
    return toolbar;
  }
  disableEditing() {
    super.disableEditing();
    this.div.classList.toggle("disabled", true);
  }
  enableEditing() {
    super.enableEditing();
    this.div.classList.toggle("disabled", false);
  }
  fixAndSetPosition() {
    return super.fixAndSetPosition(__privateMethod(this, _getRotation, getRotation_fn).call(this));
  }
  getBaseTranslation() {
    return [0, 0];
  }
  getRect(tx, ty) {
    return super.getRect(tx, ty, __privateMethod(this, _getRotation, getRotation_fn).call(this));
  }
  onceAdded() {
    this.parent.addUndoableEditor(this);
    this.div.focus();
  }
  remove() {
    __privateMethod(this, _cleanDrawLayer, cleanDrawLayer_fn).call(this);
    this._reportTelemetry({
      action: "deleted"
    });
    super.remove();
  }
  rebuild() {
    if (!this.parent) {
      return;
    }
    super.rebuild();
    if (this.div === null) {
      return;
    }
    __privateMethod(this, _addToDrawLayer, addToDrawLayer_fn).call(this);
    if (!this.isAttachedToDOM) {
      this.parent.add(this);
    }
  }
  setParent(parent) {
    var _a2;
    let mustBeSelected = false;
    if (this.parent && !parent) {
      __privateMethod(this, _cleanDrawLayer, cleanDrawLayer_fn).call(this);
    } else if (parent) {
      __privateMethod(this, _addToDrawLayer, addToDrawLayer_fn).call(this, parent);
      mustBeSelected = !this.parent && ((_a2 = this.div) == null ? void 0 : _a2.classList.contains("selectedEditor"));
    }
    super.setParent(parent);
    this.show(this._isVisible);
    if (mustBeSelected) {
      this.select();
    }
  }
  rotate(angle) {
    var _a2, _b, _c;
    const {
      drawLayer
    } = this.parent;
    let box;
    if (__privateGet(this, _isFreeHighlight)) {
      angle = (angle - this.rotation + 360) % 360;
      box = __privateMethod(_a2 = _HighlightEditor, _rotateBbox, rotateBbox_fn).call(_a2, __privateGet(this, _highlightOutlines).box, angle);
    } else {
      box = __privateMethod(_b = _HighlightEditor, _rotateBbox, rotateBbox_fn).call(_b, this, angle);
    }
    drawLayer.rotate(__privateGet(this, _id4), angle);
    drawLayer.rotate(__privateGet(this, _outlineId), angle);
    drawLayer.updateBox(__privateGet(this, _id4), box);
    drawLayer.updateBox(__privateGet(this, _outlineId), __privateMethod(_c = _HighlightEditor, _rotateBbox, rotateBbox_fn).call(_c, __privateGet(this, _focusOutlines).box, angle));
  }
  render() {
    if (this.div) {
      return this.div;
    }
    const div = super.render();
    if (__privateGet(this, _text)) {
      div.setAttribute("aria-label", __privateGet(this, _text));
      div.setAttribute("role", "mark");
    }
    if (__privateGet(this, _isFreeHighlight)) {
      div.classList.add("free");
    } else {
      this.div.addEventListener("keydown", __privateMethod(this, _keydown, keydown_fn).bind(this), {
        signal: this._uiManager._signal
      });
    }
    const highlightDiv = __privateSet(this, _highlightDiv, document.createElement("div"));
    div.append(highlightDiv);
    highlightDiv.setAttribute("aria-hidden", "true");
    highlightDiv.className = "internal";
    highlightDiv.style.clipPath = __privateGet(this, _clipPathId);
    const [parentWidth, parentHeight] = this.parentDimensions;
    this.setDims(this.width * parentWidth, this.height * parentHeight);
    bindEvents(this, __privateGet(this, _highlightDiv), ["pointerover", "pointerleave"]);
    this.enableEditing();
    return div;
  }
  pointerover() {
    this.parent.drawLayer.addClass(__privateGet(this, _outlineId), "hovered");
  }
  pointerleave() {
    this.parent.drawLayer.removeClass(__privateGet(this, _outlineId), "hovered");
  }
  _moveCaret(direction) {
    this.parent.unselect(this);
    switch (direction) {
      case 0:
      case 2:
        __privateMethod(this, _setCaret, setCaret_fn).call(this, true);
        break;
      case 1:
      case 3:
        __privateMethod(this, _setCaret, setCaret_fn).call(this, false);
        break;
    }
  }
  select() {
    var _a2, _b;
    super.select();
    if (!__privateGet(this, _outlineId)) {
      return;
    }
    (_a2 = this.parent) == null ? void 0 : _a2.drawLayer.removeClass(__privateGet(this, _outlineId), "hovered");
    (_b = this.parent) == null ? void 0 : _b.drawLayer.addClass(__privateGet(this, _outlineId), "selected");
  }
  unselect() {
    var _a2;
    super.unselect();
    if (!__privateGet(this, _outlineId)) {
      return;
    }
    (_a2 = this.parent) == null ? void 0 : _a2.drawLayer.removeClass(__privateGet(this, _outlineId), "selected");
    if (!__privateGet(this, _isFreeHighlight)) {
      __privateMethod(this, _setCaret, setCaret_fn).call(this, false);
    }
  }
  get _mustFixPosition() {
    return !__privateGet(this, _isFreeHighlight);
  }
  show(visible = this._isVisible) {
    super.show(visible);
    if (this.parent) {
      this.parent.drawLayer.show(__privateGet(this, _id4), visible);
      this.parent.drawLayer.show(__privateGet(this, _outlineId), visible);
    }
  }
  static startHighlighting(parent, isLTR, {
    target: textLayer,
    x,
    y
  }) {
    const {
      x: layerX,
      y: layerY,
      width: parentWidth,
      height: parentHeight
    } = textLayer.getBoundingClientRect();
    const ac = new AbortController();
    const signal = parent.combinedSignal(ac);
    const pointerDown = (e) => {
      e.preventDefault();
      e.stopPropagation();
    };
    const pointerUpCallback = (e) => {
      ac.abort();
      __privateMethod(this, _endHighlight, endHighlight_fn).call(this, parent, e);
    };
    window.addEventListener("blur", pointerUpCallback, {
      signal
    });
    window.addEventListener("pointerup", pointerUpCallback, {
      signal
    });
    window.addEventListener("pointerdown", pointerDown, {
      capture: true,
      passive: false,
      signal
    });
    window.addEventListener("contextmenu", noContextMenu, {
      signal
    });
    textLayer.addEventListener("pointermove", __privateMethod(this, _highlightMove, highlightMove_fn).bind(this, parent), {
      signal
    });
    this._freeHighlight = new FreeOutliner({
      x,
      y
    }, [layerX, layerY, parentWidth, parentHeight], parent.scale, this._defaultThickness / 2, isLTR, 1e-3);
    ({
      id: this._freeHighlightId,
      clipPathId: this._freeHighlightClipId
    } = parent.drawLayer.highlight(this._freeHighlight, this._defaultColor, this._defaultOpacity, true));
  }
  static deserialize(data, parent, uiManager) {
    var _a2;
    const editor = super.deserialize(data, parent, uiManager);
    const {
      rect: [blX, blY, trX, trY],
      color,
      quadPoints
    } = data;
    editor.color = Util.makeHexColor(...color);
    __privateSet(editor, _opacity, data.opacity);
    const [pageWidth, pageHeight] = editor.pageDimensions;
    editor.width = (trX - blX) / pageWidth;
    editor.height = (trY - blY) / pageHeight;
    const boxes = __privateSet(editor, _boxes, []);
    for (let i = 0; i < quadPoints.length; i += 8) {
      boxes.push({
        x: (quadPoints[4] - trX) / pageWidth,
        y: (trY - (1 - quadPoints[i + 5])) / pageHeight,
        width: (quadPoints[i + 2] - quadPoints[i]) / pageWidth,
        height: (quadPoints[i + 5] - quadPoints[i + 1]) / pageHeight
      });
    }
    __privateMethod(_a2 = editor, _createOutlines, createOutlines_fn).call(_a2);
    return editor;
  }
  serialize(isForCopying = false) {
    if (this.isEmpty() || isForCopying) {
      return null;
    }
    const rect = this.getRect(0, 0);
    const color = AnnotationEditor._colorManager.convert(this.color);
    return {
      annotationType: AnnotationEditorType.HIGHLIGHT,
      color,
      opacity: __privateGet(this, _opacity),
      thickness: __privateGet(this, _thickness2),
      quadPoints: __privateMethod(this, _serializeBoxes, serializeBoxes_fn).call(this),
      outlines: __privateMethod(this, _serializeOutlines, serializeOutlines_fn).call(this, rect),
      pageIndex: this.pageIndex,
      rect,
      rotation: __privateMethod(this, _getRotation, getRotation_fn).call(this),
      structTreeParentId: this._structTreeParentId
    };
  }
  static canCreateNewEmptyEditor() {
    return false;
  }
};
var HighlightEditor = _HighlightEditor;
_anchorNode = new WeakMap();
_anchorOffset = new WeakMap();
_boxes = new WeakMap();
_clipPathId = new WeakMap();
_colorPicker2 = new WeakMap();
_focusOutlines = new WeakMap();
_focusNode = new WeakMap();
_focusOffset = new WeakMap();
_highlightDiv = new WeakMap();
_highlightOutlines = new WeakMap();
_id4 = new WeakMap();
_isFreeHighlight = new WeakMap();
_lastPoint = new WeakMap();
_opacity = new WeakMap();
_outlineId = new WeakMap();
_text = new WeakMap();
_thickness2 = new WeakMap();
_methodOfCreation = new WeakMap();
_createOutlines = new WeakSet();
createOutlines_fn = function() {
  const outliner = new Outliner(__privateGet(this, _boxes), 1e-3);
  __privateSet(this, _highlightOutlines, outliner.getOutlines());
  ({
    x: this.x,
    y: this.y,
    width: this.width,
    height: this.height
  } = __privateGet(this, _highlightOutlines).box);
  const outlinerForOutline = new Outliner(__privateGet(this, _boxes), 25e-4, 1e-3, this._uiManager.direction === "ltr");
  __privateSet(this, _focusOutlines, outlinerForOutline.getOutlines());
  const {
    lastPoint
  } = __privateGet(this, _focusOutlines).box;
  __privateSet(this, _lastPoint, [(lastPoint[0] - this.x) / this.width, (lastPoint[1] - this.y) / this.height]);
};
_createFreeOutlines = new WeakSet();
createFreeOutlines_fn = function({
  highlightOutlines,
  highlightId,
  clipPathId
}) {
  var _a2, _b;
  __privateSet(this, _highlightOutlines, highlightOutlines);
  const extraThickness = 1.5;
  __privateSet(this, _focusOutlines, highlightOutlines.getNewOutline(__privateGet(this, _thickness2) / 2 + extraThickness, 25e-4));
  if (highlightId >= 0) {
    __privateSet(this, _id4, highlightId);
    __privateSet(this, _clipPathId, clipPathId);
    this.parent.drawLayer.finalizeLine(highlightId, highlightOutlines);
    __privateSet(this, _outlineId, this.parent.drawLayer.highlightOutline(__privateGet(this, _focusOutlines)));
  } else if (this.parent) {
    const angle = this.parent.viewport.rotation;
    this.parent.drawLayer.updateLine(__privateGet(this, _id4), highlightOutlines);
    this.parent.drawLayer.updateBox(__privateGet(this, _id4), __privateMethod(_a2 = _HighlightEditor, _rotateBbox, rotateBbox_fn).call(_a2, __privateGet(this, _highlightOutlines).box, (angle - this.rotation + 360) % 360));
    this.parent.drawLayer.updateLine(__privateGet(this, _outlineId), __privateGet(this, _focusOutlines));
    this.parent.drawLayer.updateBox(__privateGet(this, _outlineId), __privateMethod(_b = _HighlightEditor, _rotateBbox, rotateBbox_fn).call(_b, __privateGet(this, _focusOutlines).box, angle));
  }
  const {
    x,
    y,
    width,
    height
  } = highlightOutlines.box;
  switch (this.rotation) {
    case 0:
      this.x = x;
      this.y = y;
      this.width = width;
      this.height = height;
      break;
    case 90: {
      const [pageWidth, pageHeight] = this.parentDimensions;
      this.x = y;
      this.y = 1 - x;
      this.width = width * pageHeight / pageWidth;
      this.height = height * pageWidth / pageHeight;
      break;
    }
    case 180:
      this.x = 1 - x;
      this.y = 1 - y;
      this.width = width;
      this.height = height;
      break;
    case 270: {
      const [pageWidth, pageHeight] = this.parentDimensions;
      this.x = 1 - y;
      this.y = x;
      this.width = width * pageHeight / pageWidth;
      this.height = height * pageWidth / pageHeight;
      break;
    }
  }
  const {
    lastPoint
  } = __privateGet(this, _focusOutlines).box;
  __privateSet(this, _lastPoint, [(lastPoint[0] - x) / width, (lastPoint[1] - y) / height]);
};
_updateColor2 = new WeakSet();
updateColor_fn2 = function(color) {
  const setColor = (col) => {
    var _a2, _b;
    this.color = col;
    (_a2 = this.parent) == null ? void 0 : _a2.drawLayer.changeColor(__privateGet(this, _id4), col);
    (_b = __privateGet(this, _colorPicker2)) == null ? void 0 : _b.updateColor(col);
  };
  const savedColor = this.color;
  this.addCommands({
    cmd: setColor.bind(this, color),
    undo: setColor.bind(this, savedColor),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.HIGHLIGHT_COLOR,
    overwriteIfSameType: true,
    keepUndo: true
  });
  this._reportTelemetry({
    action: "color_changed",
    color: this._uiManager.highlightColorNames.get(color)
  }, true);
};
_updateThickness = new WeakSet();
updateThickness_fn = function(thickness) {
  const savedThickness = __privateGet(this, _thickness2);
  const setThickness = (th) => {
    __privateSet(this, _thickness2, th);
    __privateMethod(this, _changeThickness, changeThickness_fn).call(this, th);
  };
  this.addCommands({
    cmd: setThickness.bind(this, thickness),
    undo: setThickness.bind(this, savedThickness),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.INK_THICKNESS,
    overwriteIfSameType: true,
    keepUndo: true
  });
  this._reportTelemetry({
    action: "thickness_changed",
    thickness
  }, true);
};
_changeThickness = new WeakSet();
changeThickness_fn = function(thickness) {
  if (!__privateGet(this, _isFreeHighlight)) {
    return;
  }
  __privateMethod(this, _createFreeOutlines, createFreeOutlines_fn).call(this, {
    highlightOutlines: __privateGet(this, _highlightOutlines).getNewOutline(thickness / 2)
  });
  this.fixAndSetPosition();
  const [parentWidth, parentHeight] = this.parentDimensions;
  this.setDims(this.width * parentWidth, this.height * parentHeight);
};
_cleanDrawLayer = new WeakSet();
cleanDrawLayer_fn = function() {
  if (__privateGet(this, _id4) === null || !this.parent) {
    return;
  }
  this.parent.drawLayer.remove(__privateGet(this, _id4));
  __privateSet(this, _id4, null);
  this.parent.drawLayer.remove(__privateGet(this, _outlineId));
  __privateSet(this, _outlineId, null);
};
_addToDrawLayer = new WeakSet();
addToDrawLayer_fn = function(parent = this.parent) {
  if (__privateGet(this, _id4) !== null) {
    return;
  }
  ({
    id: __privateWrapper(this, _id4)._,
    clipPathId: __privateWrapper(this, _clipPathId)._
  } = parent.drawLayer.highlight(__privateGet(this, _highlightOutlines), this.color, __privateGet(this, _opacity)));
  __privateSet(this, _outlineId, parent.drawLayer.highlightOutline(__privateGet(this, _focusOutlines)));
  if (__privateGet(this, _highlightDiv)) {
    __privateGet(this, _highlightDiv).style.clipPath = __privateGet(this, _clipPathId);
  }
};
_rotateBbox = new WeakSet();
rotateBbox_fn = function({
  x,
  y,
  width,
  height
}, angle) {
  switch (angle) {
    case 90:
      return {
        x: 1 - y - height,
        y: x,
        width: height,
        height: width
      };
    case 180:
      return {
        x: 1 - x - width,
        y: 1 - y - height,
        width,
        height
      };
    case 270:
      return {
        x: y,
        y: 1 - x - width,
        width: height,
        height: width
      };
  }
  return {
    x,
    y,
    width,
    height
  };
};
_keydown = new WeakSet();
keydown_fn = function(event) {
  _HighlightEditor._keyboardManager.exec(this, event);
};
_setCaret = new WeakSet();
setCaret_fn = function(start) {
  if (!__privateGet(this, _anchorNode)) {
    return;
  }
  const selection = window.getSelection();
  if (start) {
    selection.setPosition(__privateGet(this, _anchorNode), __privateGet(this, _anchorOffset));
  } else {
    selection.setPosition(__privateGet(this, _focusNode), __privateGet(this, _focusOffset));
  }
};
_getRotation = new WeakSet();
getRotation_fn = function() {
  return __privateGet(this, _isFreeHighlight) ? this.rotation : 0;
};
_serializeBoxes = new WeakSet();
serializeBoxes_fn = function() {
  if (__privateGet(this, _isFreeHighlight)) {
    return null;
  }
  const [pageWidth, pageHeight] = this.pageDimensions;
  const [pageX, pageY] = this.pageTranslation;
  const boxes = __privateGet(this, _boxes);
  const quadPoints = new Float32Array(boxes.length * 8);
  let i = 0;
  for (const {
    x,
    y,
    width,
    height
  } of boxes) {
    const sx = x * pageWidth + pageX;
    const sy = (1 - y - height) * pageHeight + pageY;
    quadPoints[i] = quadPoints[i + 4] = sx;
    quadPoints[i + 1] = quadPoints[i + 3] = sy;
    quadPoints[i + 2] = quadPoints[i + 6] = sx + width * pageWidth;
    quadPoints[i + 5] = quadPoints[i + 7] = sy + height * pageHeight;
    i += 8;
  }
  return quadPoints;
};
_serializeOutlines = new WeakSet();
serializeOutlines_fn = function(rect) {
  return __privateGet(this, _highlightOutlines).serialize(rect, __privateMethod(this, _getRotation, getRotation_fn).call(this));
};
_highlightMove = new WeakSet();
highlightMove_fn = function(parent, event) {
  if (this._freeHighlight.add(event)) {
    parent.drawLayer.updatePath(this._freeHighlightId, this._freeHighlight);
  }
};
_endHighlight = new WeakSet();
endHighlight_fn = function(parent, event) {
  if (!this._freeHighlight.isEmpty()) {
    parent.createAndAddNewEditor(event, false, {
      highlightId: this._freeHighlightId,
      highlightOutlines: this._freeHighlight.getOutlines(),
      clipPathId: this._freeHighlightClipId,
      methodOfCreation: "main_toolbar"
    });
  } else {
    parent.drawLayer.removeFreeHighlight(this._freeHighlightId);
  }
  this._freeHighlightId = -1;
  this._freeHighlight = null;
  this._freeHighlightClipId = "";
};
__privateAdd(HighlightEditor, _rotateBbox);
__privateAdd(HighlightEditor, _highlightMove);
__privateAdd(HighlightEditor, _endHighlight);
__publicField(HighlightEditor, "_defaultColor", null);
__publicField(HighlightEditor, "_defaultOpacity", 1);
__publicField(HighlightEditor, "_defaultThickness", 12);
__publicField(HighlightEditor, "_l10nPromise");
__publicField(HighlightEditor, "_type", "highlight");
__publicField(HighlightEditor, "_editorType", AnnotationEditorType.HIGHLIGHT);
__publicField(HighlightEditor, "_freeHighlightId", -1);
__publicField(HighlightEditor, "_freeHighlight", null);
__publicField(HighlightEditor, "_freeHighlightClipId", "");
var _baseHeight, _baseWidth, _canvasContextMenuTimeoutId, _currentPath2D, _disableEditing, _drawingAC, _hasSomethingToDraw, _isCanvasInitialized, _observer, _pointerdownAC, _realWidth, _realHeight, _requestFrameCallback, _updateThickness2, updateThickness_fn2, _updateColor3, updateColor_fn3, _updateOpacity, updateOpacity_fn, _getInitialBBox, getInitialBBox_fn, _setStroke, setStroke_fn, _startDrawing, startDrawing_fn, _draw, draw_fn, _endPath, endPath_fn, _stopDrawing, stopDrawing_fn, _drawPoints, drawPoints_fn, _makeBezierCurve, makeBezierCurve_fn, _generateBezierPoints, generateBezierPoints_fn, _redraw, redraw_fn, _addPointerdownListener, addPointerdownListener_fn, _removePointerdownListener, removePointerdownListener_fn, _endDrawing, endDrawing_fn, _createCanvas, createCanvas_fn, _createObserver, createObserver_fn, _setCanvasDims, setCanvasDims_fn, _setScaleFactor, setScaleFactor_fn, _updateTransform, updateTransform_fn, _buildPath2D, buildPath2D_fn, _toPDFCoordinates, toPDFCoordinates_fn, _fromPDFCoordinates, fromPDFCoordinates_fn, _serializePaths, serializePaths_fn, _getBbox, getBbox_fn, _getPadding, getPadding_fn, _fitToContent, fitToContent_fn;
var _InkEditor = class extends AnnotationEditor {
  constructor(params) {
    super({
      ...params,
      name: "inkEditor"
    });
    __privateAdd(this, _updateThickness2);
    __privateAdd(this, _updateColor3);
    __privateAdd(this, _updateOpacity);
    __privateAdd(this, _getInitialBBox);
    __privateAdd(this, _setStroke);
    __privateAdd(this, _startDrawing);
    __privateAdd(this, _draw);
    __privateAdd(this, _endPath);
    __privateAdd(this, _stopDrawing);
    __privateAdd(this, _drawPoints);
    __privateAdd(this, _makeBezierCurve);
    __privateAdd(this, _generateBezierPoints);
    __privateAdd(this, _redraw);
    __privateAdd(this, _addPointerdownListener);
    __privateAdd(this, _removePointerdownListener);
    __privateAdd(this, _endDrawing);
    __privateAdd(this, _createCanvas);
    __privateAdd(this, _createObserver);
    __privateAdd(this, _setCanvasDims);
    __privateAdd(this, _setScaleFactor);
    __privateAdd(this, _updateTransform);
    __privateAdd(this, _serializePaths);
    __privateAdd(this, _getBbox);
    __privateAdd(this, _getPadding);
    __privateAdd(this, _fitToContent);
    __privateAdd(this, _baseHeight, 0);
    __privateAdd(this, _baseWidth, 0);
    __privateAdd(this, _canvasContextMenuTimeoutId, null);
    __privateAdd(this, _currentPath2D, new Path2D());
    __privateAdd(this, _disableEditing, false);
    __privateAdd(this, _drawingAC, null);
    __privateAdd(this, _hasSomethingToDraw, false);
    __privateAdd(this, _isCanvasInitialized, false);
    __privateAdd(this, _observer, null);
    __privateAdd(this, _pointerdownAC, null);
    __privateAdd(this, _realWidth, 0);
    __privateAdd(this, _realHeight, 0);
    __privateAdd(this, _requestFrameCallback, null);
    this.color = params.color || null;
    this.thickness = params.thickness || null;
    this.opacity = params.opacity || null;
    this.paths = [];
    this.bezierPath2D = [];
    this.allRawPaths = [];
    this.currentPath = [];
    this.scaleFactor = 1;
    this.translationX = this.translationY = 0;
    this.x = 0;
    this.y = 0;
    this._willKeepAspectRatio = true;
  }
  static initialize(l10n, uiManager) {
    AnnotationEditor.initialize(l10n, uiManager);
  }
  static updateDefaultParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.INK_THICKNESS:
        _InkEditor._defaultThickness = value;
        break;
      case AnnotationEditorParamsType.INK_COLOR:
        _InkEditor._defaultColor = value;
        break;
      case AnnotationEditorParamsType.INK_OPACITY:
        _InkEditor._defaultOpacity = value / 100;
        break;
    }
  }
  updateParams(type, value) {
    switch (type) {
      case AnnotationEditorParamsType.INK_THICKNESS:
        __privateMethod(this, _updateThickness2, updateThickness_fn2).call(this, value);
        break;
      case AnnotationEditorParamsType.INK_COLOR:
        __privateMethod(this, _updateColor3, updateColor_fn3).call(this, value);
        break;
      case AnnotationEditorParamsType.INK_OPACITY:
        __privateMethod(this, _updateOpacity, updateOpacity_fn).call(this, value);
        break;
    }
  }
  static get defaultPropertiesToUpdate() {
    return [[AnnotationEditorParamsType.INK_THICKNESS, _InkEditor._defaultThickness], [AnnotationEditorParamsType.INK_COLOR, _InkEditor._defaultColor || AnnotationEditor._defaultLineColor], [AnnotationEditorParamsType.INK_OPACITY, Math.round(_InkEditor._defaultOpacity * 100)]];
  }
  get propertiesToUpdate() {
    var _a2;
    return [[AnnotationEditorParamsType.INK_THICKNESS, this.thickness || _InkEditor._defaultThickness], [AnnotationEditorParamsType.INK_COLOR, this.color || _InkEditor._defaultColor || AnnotationEditor._defaultLineColor], [AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * ((_a2 = this.opacity) != null ? _a2 : _InkEditor._defaultOpacity))]];
  }
  rebuild() {
    if (!this.parent) {
      return;
    }
    super.rebuild();
    if (this.div === null) {
      return;
    }
    if (!this.canvas) {
      __privateMethod(this, _createCanvas, createCanvas_fn).call(this);
      __privateMethod(this, _createObserver, createObserver_fn).call(this);
    }
    if (!this.isAttachedToDOM) {
      this.parent.add(this);
      __privateMethod(this, _setCanvasDims, setCanvasDims_fn).call(this);
    }
    __privateMethod(this, _fitToContent, fitToContent_fn).call(this);
  }
  remove() {
    var _a2;
    if (this.canvas === null) {
      return;
    }
    if (!this.isEmpty()) {
      this.commit();
    }
    this.canvas.width = this.canvas.height = 0;
    this.canvas.remove();
    this.canvas = null;
    if (__privateGet(this, _canvasContextMenuTimeoutId)) {
      clearTimeout(__privateGet(this, _canvasContextMenuTimeoutId));
      __privateSet(this, _canvasContextMenuTimeoutId, null);
    }
    (_a2 = __privateGet(this, _observer)) == null ? void 0 : _a2.disconnect();
    __privateSet(this, _observer, null);
    super.remove();
  }
  setParent(parent) {
    if (!this.parent && parent) {
      this._uiManager.removeShouldRescale(this);
    } else if (this.parent && parent === null) {
      this._uiManager.addShouldRescale(this);
    }
    super.setParent(parent);
  }
  onScaleChanging() {
    const [parentWidth, parentHeight] = this.parentDimensions;
    const width = this.width * parentWidth;
    const height = this.height * parentHeight;
    this.setDimensions(width, height);
  }
  enableEditMode() {
    if (__privateGet(this, _disableEditing) || this.canvas === null) {
      return;
    }
    super.enableEditMode();
    this._isDraggable = false;
    __privateMethod(this, _addPointerdownListener, addPointerdownListener_fn).call(this);
  }
  disableEditMode() {
    if (!this.isInEditMode() || this.canvas === null) {
      return;
    }
    super.disableEditMode();
    this._isDraggable = !this.isEmpty();
    this.div.classList.remove("editing");
    __privateMethod(this, _removePointerdownListener, removePointerdownListener_fn).call(this);
  }
  onceAdded() {
    this._isDraggable = !this.isEmpty();
  }
  isEmpty() {
    return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
  }
  commit() {
    if (__privateGet(this, _disableEditing)) {
      return;
    }
    super.commit();
    this.isEditing = false;
    this.disableEditMode();
    this.setInForeground();
    __privateSet(this, _disableEditing, true);
    this.div.classList.add("disabled");
    __privateMethod(this, _fitToContent, fitToContent_fn).call(this, true);
    this.select();
    this.parent.addInkEditorIfNeeded(true);
    this.moveInDOM();
    this.div.focus({
      preventScroll: true
    });
  }
  focusin(event) {
    if (!this._focusEventsAllowed) {
      return;
    }
    super.focusin(event);
    this.enableEditMode();
  }
  canvasPointerdown(event) {
    if (event.button !== 0 || !this.isInEditMode() || __privateGet(this, _disableEditing)) {
      return;
    }
    this.setInForeground();
    event.preventDefault();
    if (!this.div.contains(document.activeElement)) {
      this.div.focus({
        preventScroll: true
      });
    }
    __privateMethod(this, _startDrawing, startDrawing_fn).call(this, event.offsetX, event.offsetY);
  }
  canvasPointermove(event) {
    event.preventDefault();
    __privateMethod(this, _draw, draw_fn).call(this, event.offsetX, event.offsetY);
  }
  canvasPointerup(event) {
    event.preventDefault();
    __privateMethod(this, _endDrawing, endDrawing_fn).call(this, event);
  }
  canvasPointerleave(event) {
    __privateMethod(this, _endDrawing, endDrawing_fn).call(this, event);
  }
  get isResizable() {
    return !this.isEmpty() && __privateGet(this, _disableEditing);
  }
  render() {
    if (this.div) {
      return this.div;
    }
    let baseX, baseY;
    if (this.width) {
      baseX = this.x;
      baseY = this.y;
    }
    super.render();
    this.div.setAttribute("data-l10n-id", "pdfjs-ink");
    const [x, y, w, h] = __privateMethod(this, _getInitialBBox, getInitialBBox_fn).call(this);
    this.setAt(x, y, 0, 0);
    this.setDims(w, h);
    __privateMethod(this, _createCanvas, createCanvas_fn).call(this);
    if (this.width) {
      const [parentWidth, parentHeight] = this.parentDimensions;
      this.setAspectRatio(this.width * parentWidth, this.height * parentHeight);
      this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
      __privateSet(this, _isCanvasInitialized, true);
      __privateMethod(this, _setCanvasDims, setCanvasDims_fn).call(this);
      this.setDims(this.width * parentWidth, this.height * parentHeight);
      __privateMethod(this, _redraw, redraw_fn).call(this);
      this.div.classList.add("disabled");
    } else {
      this.div.classList.add("editing");
      this.enableEditMode();
    }
    __privateMethod(this, _createObserver, createObserver_fn).call(this);
    return this.div;
  }
  setDimensions(width, height) {
    const roundedWidth = Math.round(width);
    const roundedHeight = Math.round(height);
    if (__privateGet(this, _realWidth) === roundedWidth && __privateGet(this, _realHeight) === roundedHeight) {
      return;
    }
    __privateSet(this, _realWidth, roundedWidth);
    __privateSet(this, _realHeight, roundedHeight);
    this.canvas.style.visibility = "hidden";
    const [parentWidth, parentHeight] = this.parentDimensions;
    this.width = width / parentWidth;
    this.height = height / parentHeight;
    this.fixAndSetPosition();
    if (__privateGet(this, _disableEditing)) {
      __privateMethod(this, _setScaleFactor, setScaleFactor_fn).call(this, width, height);
    }
    __privateMethod(this, _setCanvasDims, setCanvasDims_fn).call(this);
    __privateMethod(this, _redraw, redraw_fn).call(this);
    this.canvas.style.visibility = "visible";
    this.fixDims();
  }
  static deserialize(data, parent, uiManager) {
    var _a2, _b, _c;
    if (data instanceof InkAnnotationElement) {
      return null;
    }
    const editor = super.deserialize(data, parent, uiManager);
    editor.thickness = data.thickness;
    editor.color = Util.makeHexColor(...data.color);
    editor.opacity = data.opacity;
    const [pageWidth, pageHeight] = editor.pageDimensions;
    const width = editor.width * pageWidth;
    const height = editor.height * pageHeight;
    const scaleFactor = editor.parentScale;
    const padding = data.thickness / 2;
    __privateSet(editor, _disableEditing, true);
    __privateSet(editor, _realWidth, Math.round(width));
    __privateSet(editor, _realHeight, Math.round(height));
    const {
      paths,
      rect,
      rotation
    } = data;
    for (let {
      bezier
    } of paths) {
      bezier = __privateMethod(_a2 = _InkEditor, _fromPDFCoordinates, fromPDFCoordinates_fn).call(_a2, bezier, rect, rotation);
      const path = [];
      editor.paths.push(path);
      let p0 = scaleFactor * (bezier[0] - padding);
      let p1 = scaleFactor * (bezier[1] - padding);
      for (let i = 2, ii = bezier.length; i < ii; i += 6) {
        const p10 = scaleFactor * (bezier[i] - padding);
        const p11 = scaleFactor * (bezier[i + 1] - padding);
        const p20 = scaleFactor * (bezier[i + 2] - padding);
        const p21 = scaleFactor * (bezier[i + 3] - padding);
        const p30 = scaleFactor * (bezier[i + 4] - padding);
        const p31 = scaleFactor * (bezier[i + 5] - padding);
        path.push([[p0, p1], [p10, p11], [p20, p21], [p30, p31]]);
        p0 = p30;
        p1 = p31;
      }
      const path2D = __privateMethod(this, _buildPath2D, buildPath2D_fn).call(this, path);
      editor.bezierPath2D.push(path2D);
    }
    const bbox = __privateMethod(_b = editor, _getBbox, getBbox_fn).call(_b);
    __privateSet(editor, _baseWidth, Math.max(AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]));
    __privateSet(editor, _baseHeight, Math.max(AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]));
    __privateMethod(_c = editor, _setScaleFactor, setScaleFactor_fn).call(_c, width, height);
    return editor;
  }
  serialize() {
    if (this.isEmpty()) {
      return null;
    }
    const rect = this.getRect(0, 0);
    const color = AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
    return {
      annotationType: AnnotationEditorType.INK,
      color,
      thickness: this.thickness,
      opacity: this.opacity,
      paths: __privateMethod(this, _serializePaths, serializePaths_fn).call(this, this.scaleFactor / this.parentScale, this.translationX, this.translationY, rect),
      pageIndex: this.pageIndex,
      rect,
      rotation: this.rotation,
      structTreeParentId: this._structTreeParentId
    };
  }
};
var InkEditor = _InkEditor;
_baseHeight = new WeakMap();
_baseWidth = new WeakMap();
_canvasContextMenuTimeoutId = new WeakMap();
_currentPath2D = new WeakMap();
_disableEditing = new WeakMap();
_drawingAC = new WeakMap();
_hasSomethingToDraw = new WeakMap();
_isCanvasInitialized = new WeakMap();
_observer = new WeakMap();
_pointerdownAC = new WeakMap();
_realWidth = new WeakMap();
_realHeight = new WeakMap();
_requestFrameCallback = new WeakMap();
_updateThickness2 = new WeakSet();
updateThickness_fn2 = function(thickness) {
  const setThickness = (th) => {
    this.thickness = th;
    __privateMethod(this, _fitToContent, fitToContent_fn).call(this);
  };
  const savedThickness = this.thickness;
  this.addCommands({
    cmd: setThickness.bind(this, thickness),
    undo: setThickness.bind(this, savedThickness),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.INK_THICKNESS,
    overwriteIfSameType: true,
    keepUndo: true
  });
};
_updateColor3 = new WeakSet();
updateColor_fn3 = function(color) {
  const setColor = (col) => {
    this.color = col;
    __privateMethod(this, _redraw, redraw_fn).call(this);
  };
  const savedColor = this.color;
  this.addCommands({
    cmd: setColor.bind(this, color),
    undo: setColor.bind(this, savedColor),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.INK_COLOR,
    overwriteIfSameType: true,
    keepUndo: true
  });
};
_updateOpacity = new WeakSet();
updateOpacity_fn = function(opacity) {
  const setOpacity = (op) => {
    this.opacity = op;
    __privateMethod(this, _redraw, redraw_fn).call(this);
  };
  opacity /= 100;
  const savedOpacity = this.opacity;
  this.addCommands({
    cmd: setOpacity.bind(this, opacity),
    undo: setOpacity.bind(this, savedOpacity),
    post: this._uiManager.updateUI.bind(this._uiManager, this),
    mustExec: true,
    type: AnnotationEditorParamsType.INK_OPACITY,
    overwriteIfSameType: true,
    keepUndo: true
  });
};
_getInitialBBox = new WeakSet();
getInitialBBox_fn = function() {
  const {
    parentRotation,
    parentDimensions: [width, height]
  } = this;
  switch (parentRotation) {
    case 90:
      return [0, height, height, width];
    case 180:
      return [width, height, width, height];
    case 270:
      return [width, 0, height, width];
    default:
      return [0, 0, width, height];
  }
};
_setStroke = new WeakSet();
setStroke_fn = function() {
  const {
    ctx,
    color,
    opacity,
    thickness,
    parentScale,
    scaleFactor
  } = this;
  ctx.lineWidth = thickness * parentScale / scaleFactor;
  ctx.lineCap = "round";
  ctx.lineJoin = "round";
  ctx.miterLimit = 10;
  ctx.strokeStyle = `${color}${opacityToHex(opacity)}`;
};
_startDrawing = new WeakSet();
startDrawing_fn = function(x, y) {
  var _a2;
  this.canvas.addEventListener("contextmenu", noContextMenu, {
    signal: this._uiManager._signal
  });
  __privateMethod(this, _removePointerdownListener, removePointerdownListener_fn).call(this);
  __privateSet(this, _drawingAC, new AbortController());
  const signal = this._uiManager.combinedSignal(__privateGet(this, _drawingAC));
  this.canvas.addEventListener("pointerleave", this.canvasPointerleave.bind(this), {
    signal
  });
  this.canvas.addEventListener("pointermove", this.canvasPointermove.bind(this), {
    signal
  });
  this.canvas.addEventListener("pointerup", this.canvasPointerup.bind(this), {
    signal
  });
  this.isEditing = true;
  if (!__privateGet(this, _isCanvasInitialized)) {
    __privateSet(this, _isCanvasInitialized, true);
    __privateMethod(this, _setCanvasDims, setCanvasDims_fn).call(this);
    this.thickness || (this.thickness = _InkEditor._defaultThickness);
    this.color || (this.color = _InkEditor._defaultColor || AnnotationEditor._defaultLineColor);
    (_a2 = this.opacity) != null ? _a2 : this.opacity = _InkEditor._defaultOpacity;
  }
  this.currentPath.push([x, y]);
  __privateSet(this, _hasSomethingToDraw, false);
  __privateMethod(this, _setStroke, setStroke_fn).call(this);
  __privateSet(this, _requestFrameCallback, () => {
    __privateMethod(this, _drawPoints, drawPoints_fn).call(this);
    if (__privateGet(this, _requestFrameCallback)) {
      window.requestAnimationFrame(__privateGet(this, _requestFrameCallback));
    }
  });
  window.requestAnimationFrame(__privateGet(this, _requestFrameCallback));
};
_draw = new WeakSet();
draw_fn = function(x, y) {
  const [lastX, lastY] = this.currentPath.at(-1);
  if (this.currentPath.length > 1 && x === lastX && y === lastY) {
    return;
  }
  const currentPath = this.currentPath;
  let path2D = __privateGet(this, _currentPath2D);
  currentPath.push([x, y]);
  __privateSet(this, _hasSomethingToDraw, true);
  if (currentPath.length <= 2) {
    path2D.moveTo(...currentPath[0]);
    path2D.lineTo(x, y);
    return;
  }
  if (currentPath.length === 3) {
    __privateSet(this, _currentPath2D, path2D = new Path2D());
    path2D.moveTo(...currentPath[0]);
  }
  __privateMethod(this, _makeBezierCurve, makeBezierCurve_fn).call(this, path2D, ...currentPath.at(-3), ...currentPath.at(-2), x, y);
};
_endPath = new WeakSet();
endPath_fn = function() {
  if (this.currentPath.length === 0) {
    return;
  }
  const lastPoint = this.currentPath.at(-1);
  __privateGet(this, _currentPath2D).lineTo(...lastPoint);
};
_stopDrawing = new WeakSet();
stopDrawing_fn = function(x, y) {
  __privateSet(this, _requestFrameCallback, null);
  x = Math.min(Math.max(x, 0), this.canvas.width);
  y = Math.min(Math.max(y, 0), this.canvas.height);
  __privateMethod(this, _draw, draw_fn).call(this, x, y);
  __privateMethod(this, _endPath, endPath_fn).call(this);
  let bezier;
  if (this.currentPath.length !== 1) {
    bezier = __privateMethod(this, _generateBezierPoints, generateBezierPoints_fn).call(this);
  } else {
    const xy = [x, y];
    bezier = [[xy, xy.slice(), xy.slice(), xy]];
  }
  const path2D = __privateGet(this, _currentPath2D);
  const currentPath = this.currentPath;
  this.currentPath = [];
  __privateSet(this, _currentPath2D, new Path2D());
  const cmd = () => {
    this.allRawPaths.push(currentPath);
    this.paths.push(bezier);
    this.bezierPath2D.push(path2D);
    this._uiManager.rebuild(this);
  };
  const undo = () => {
    this.allRawPaths.pop();
    this.paths.pop();
    this.bezierPath2D.pop();
    if (this.paths.length === 0) {
      this.remove();
    } else {
      if (!this.canvas) {
        __privateMethod(this, _createCanvas, createCanvas_fn).call(this);
        __privateMethod(this, _createObserver, createObserver_fn).call(this);
      }
      __privateMethod(this, _fitToContent, fitToContent_fn).call(this);
    }
  };
  this.addCommands({
    cmd,
    undo,
    mustExec: true
  });
};
_drawPoints = new WeakSet();
drawPoints_fn = function() {
  if (!__privateGet(this, _hasSomethingToDraw)) {
    return;
  }
  __privateSet(this, _hasSomethingToDraw, false);
  const thickness = Math.ceil(this.thickness * this.parentScale);
  const lastPoints = this.currentPath.slice(-3);
  const x = lastPoints.map((xy) => xy[0]);
  const y = lastPoints.map((xy) => xy[1]);
  const xMin = Math.min(...x) - thickness;
  const xMax = Math.max(...x) + thickness;
  const yMin = Math.min(...y) - thickness;
  const yMax = Math.max(...y) + thickness;
  const {
    ctx
  } = this;
  ctx.save();
  ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
  for (const path of this.bezierPath2D) {
    ctx.stroke(path);
  }
  ctx.stroke(__privateGet(this, _currentPath2D));
  ctx.restore();
};
_makeBezierCurve = new WeakSet();
makeBezierCurve_fn = function(path2D, x0, y0, x1, y1, x2, y2) {
  const prevX = (x0 + x1) / 2;
  const prevY = (y0 + y1) / 2;
  const x3 = (x1 + x2) / 2;
  const y3 = (y1 + y2) / 2;
  path2D.bezierCurveTo(prevX + 2 * (x1 - prevX) / 3, prevY + 2 * (y1 - prevY) / 3, x3 + 2 * (x1 - x3) / 3, y3 + 2 * (y1 - y3) / 3, x3, y3);
};
_generateBezierPoints = new WeakSet();
generateBezierPoints_fn = function() {
  const path = this.currentPath;
  if (path.length <= 2) {
    return [[path[0], path[0], path.at(-1), path.at(-1)]];
  }
  const bezierPoints = [];
  let i;
  let [x0, y0] = path[0];
  for (i = 1; i < path.length - 2; i++) {
    const [x12, y12] = path[i];
    const [x22, y22] = path[i + 1];
    const x3 = (x12 + x22) / 2;
    const y3 = (y12 + y22) / 2;
    const control12 = [x0 + 2 * (x12 - x0) / 3, y0 + 2 * (y12 - y0) / 3];
    const control22 = [x3 + 2 * (x12 - x3) / 3, y3 + 2 * (y12 - y3) / 3];
    bezierPoints.push([[x0, y0], control12, control22, [x3, y3]]);
    [x0, y0] = [x3, y3];
  }
  const [x1, y1] = path[i];
  const [x2, y2] = path[i + 1];
  const control1 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3];
  const control2 = [x2 + 2 * (x1 - x2) / 3, y2 + 2 * (y1 - y2) / 3];
  bezierPoints.push([[x0, y0], control1, control2, [x2, y2]]);
  return bezierPoints;
};
_redraw = new WeakSet();
redraw_fn = function() {
  if (this.isEmpty()) {
    __privateMethod(this, _updateTransform, updateTransform_fn).call(this);
    return;
  }
  __privateMethod(this, _setStroke, setStroke_fn).call(this);
  const {
    canvas,
    ctx
  } = this;
  ctx.setTransform(1, 0, 0, 1, 0, 0);
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  __privateMethod(this, _updateTransform, updateTransform_fn).call(this);
  for (const path of this.bezierPath2D) {
    ctx.stroke(path);
  }
};
_addPointerdownListener = new WeakSet();
addPointerdownListener_fn = function() {
  if (__privateGet(this, _pointerdownAC)) {
    return;
  }
  __privateSet(this, _pointerdownAC, new AbortController());
  const signal = this._uiManager.combinedSignal(__privateGet(this, _pointerdownAC));
  this.canvas.addEventListener("pointerdown", this.canvasPointerdown.bind(this), {
    signal
  });
};
_removePointerdownListener = new WeakSet();
removePointerdownListener_fn = function() {
  var _a2;
  (_a2 = this.pointerdownAC) == null ? void 0 : _a2.abort();
  this.pointerdownAC = null;
};
_endDrawing = new WeakSet();
endDrawing_fn = function(event) {
  var _a2;
  (_a2 = __privateGet(this, _drawingAC)) == null ? void 0 : _a2.abort();
  __privateSet(this, _drawingAC, null);
  __privateMethod(this, _addPointerdownListener, addPointerdownListener_fn).call(this);
  if (__privateGet(this, _canvasContextMenuTimeoutId)) {
    clearTimeout(__privateGet(this, _canvasContextMenuTimeoutId));
  }
  __privateSet(this, _canvasContextMenuTimeoutId, setTimeout(() => {
    __privateSet(this, _canvasContextMenuTimeoutId, null);
    this.canvas.removeEventListener("contextmenu", noContextMenu);
  }, 10));
  __privateMethod(this, _stopDrawing, stopDrawing_fn).call(this, event.offsetX, event.offsetY);
  this.addToAnnotationStorage();
  this.setInBackground();
};
_createCanvas = new WeakSet();
createCanvas_fn = function() {
  this.canvas = document.createElement("canvas");
  this.canvas.width = this.canvas.height = 0;
  this.canvas.className = "inkEditorCanvas";
  this.canvas.setAttribute("data-l10n-id", "pdfjs-ink-canvas");
  this.div.append(this.canvas);
  this.ctx = this.canvas.getContext("2d");
};
_createObserver = new WeakSet();
createObserver_fn = function() {
  __privateSet(this, _observer, new ResizeObserver((entries) => {
    const rect = entries[0].contentRect;
    if (rect.width && rect.height) {
      this.setDimensions(rect.width, rect.height);
    }
  }));
  __privateGet(this, _observer).observe(this.div);
  this._uiManager._signal.addEventListener("abort", () => {
    var _a2;
    (_a2 = __privateGet(this, _observer)) == null ? void 0 : _a2.disconnect();
    __privateSet(this, _observer, null);
  }, {
    once: true
  });
};
_setCanvasDims = new WeakSet();
setCanvasDims_fn = function() {
  if (!__privateGet(this, _isCanvasInitialized)) {
    return;
  }
  const [parentWidth, parentHeight] = this.parentDimensions;
  this.canvas.width = Math.ceil(this.width * parentWidth);
  this.canvas.height = Math.ceil(this.height * parentHeight);
  __privateMethod(this, _updateTransform, updateTransform_fn).call(this);
};
_setScaleFactor = new WeakSet();
setScaleFactor_fn = function(width, height) {
  const padding = __privateMethod(this, _getPadding, getPadding_fn).call(this);
  const scaleFactorW = (width - padding) / __privateGet(this, _baseWidth);
  const scaleFactorH = (height - padding) / __privateGet(this, _baseHeight);
  this.scaleFactor = Math.min(scaleFactorW, scaleFactorH);
};
_updateTransform = new WeakSet();
updateTransform_fn = function() {
  const padding = __privateMethod(this, _getPadding, getPadding_fn).call(this) / 2;
  this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + padding, this.translationY * this.scaleFactor + padding);
};
_buildPath2D = new WeakSet();
buildPath2D_fn = function(bezier) {
  const path2D = new Path2D();
  for (let i = 0, ii = bezier.length; i < ii; i++) {
    const [first, control1, control2, second] = bezier[i];
    if (i === 0) {
      path2D.moveTo(...first);
    }
    path2D.bezierCurveTo(control1[0], control1[1], control2[0], control2[1], second[0], second[1]);
  }
  return path2D;
};
_toPDFCoordinates = new WeakSet();
toPDFCoordinates_fn = function(points, rect, rotation) {
  const [blX, blY, trX, trY] = rect;
  switch (rotation) {
    case 0:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        points[i] += blX;
        points[i + 1] = trY - points[i + 1];
      }
      break;
    case 90:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        const x = points[i];
        points[i] = points[i + 1] + blX;
        points[i + 1] = x + blY;
      }
      break;
    case 180:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        points[i] = trX - points[i];
        points[i + 1] += blY;
      }
      break;
    case 270:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        const x = points[i];
        points[i] = trX - points[i + 1];
        points[i + 1] = trY - x;
      }
      break;
    default:
      throw new Error("Invalid rotation");
  }
  return points;
};
_fromPDFCoordinates = new WeakSet();
fromPDFCoordinates_fn = function(points, rect, rotation) {
  const [blX, blY, trX, trY] = rect;
  switch (rotation) {
    case 0:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        points[i] -= blX;
        points[i + 1] = trY - points[i + 1];
      }
      break;
    case 90:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        const x = points[i];
        points[i] = points[i + 1] - blY;
        points[i + 1] = x - blX;
      }
      break;
    case 180:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        points[i] = trX - points[i];
        points[i + 1] -= blY;
      }
      break;
    case 270:
      for (let i = 0, ii = points.length; i < ii; i += 2) {
        const x = points[i];
        points[i] = trY - points[i + 1];
        points[i + 1] = trX - x;
      }
      break;
    default:
      throw new Error("Invalid rotation");
  }
  return points;
};
_serializePaths = new WeakSet();
serializePaths_fn = function(s, tx, ty, rect) {
  var _a2, _b;
  const paths = [];
  const padding = this.thickness / 2;
  const shiftX = s * tx + padding;
  const shiftY = s * ty + padding;
  for (const bezier of this.paths) {
    const buffer = [];
    const points = [];
    for (let j = 0, jj = bezier.length; j < jj; j++) {
      const [first, control1, control2, second] = bezier[j];
      if (first[0] === second[0] && first[1] === second[1] && jj === 1) {
        const p0 = s * first[0] + shiftX;
        const p1 = s * first[1] + shiftY;
        buffer.push(p0, p1);
        points.push(p0, p1);
        break;
      }
      const p10 = s * first[0] + shiftX;
      const p11 = s * first[1] + shiftY;
      const p20 = s * control1[0] + shiftX;
      const p21 = s * control1[1] + shiftY;
      const p30 = s * control2[0] + shiftX;
      const p31 = s * control2[1] + shiftY;
      const p40 = s * second[0] + shiftX;
      const p41 = s * second[1] + shiftY;
      if (j === 0) {
        buffer.push(p10, p11);
        points.push(p10, p11);
      }
      buffer.push(p20, p21, p30, p31, p40, p41);
      points.push(p20, p21);
      if (j === jj - 1) {
        points.push(p40, p41);
      }
    }
    paths.push({
      bezier: __privateMethod(_a2 = _InkEditor, _toPDFCoordinates, toPDFCoordinates_fn).call(_a2, buffer, rect, this.rotation),
      points: __privateMethod(_b = _InkEditor, _toPDFCoordinates, toPDFCoordinates_fn).call(_b, points, rect, this.rotation)
    });
  }
  return paths;
};
_getBbox = new WeakSet();
getBbox_fn = function() {
  let xMin = Infinity;
  let xMax = -Infinity;
  let yMin = Infinity;
  let yMax = -Infinity;
  for (const path of this.paths) {
    for (const [first, control1, control2, second] of path) {
      const bbox = Util.bezierBoundingBox(...first, ...control1, ...control2, ...second);
      xMin = Math.min(xMin, bbox[0]);
      yMin = Math.min(yMin, bbox[1]);
      xMax = Math.max(xMax, bbox[2]);
      yMax = Math.max(yMax, bbox[3]);
    }
  }
  return [xMin, yMin, xMax, yMax];
};
_getPadding = new WeakSet();
getPadding_fn = function() {
  return __privateGet(this, _disableEditing) ? Math.ceil(this.thickness * this.parentScale) : 0;
};
_fitToContent = new WeakSet();
fitToContent_fn = function(firstTime = false) {
  if (this.isEmpty()) {
    return;
  }
  if (!__privateGet(this, _disableEditing)) {
    __privateMethod(this, _redraw, redraw_fn).call(this);
    return;
  }
  const bbox = __privateMethod(this, _getBbox, getBbox_fn).call(this);
  const padding = __privateMethod(this, _getPadding, getPadding_fn).call(this);
  __privateSet(this, _baseWidth, Math.max(AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]));
  __privateSet(this, _baseHeight, Math.max(AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]));
  const width = Math.ceil(padding + __privateGet(this, _baseWidth) * this.scaleFactor);
  const height = Math.ceil(padding + __privateGet(this, _baseHeight) * this.scaleFactor);
  const [parentWidth, parentHeight] = this.parentDimensions;
  this.width = width / parentWidth;
  this.height = height / parentHeight;
  this.setAspectRatio(width, height);
  const prevTranslationX = this.translationX;
  const prevTranslationY = this.translationY;
  this.translationX = -bbox[0];
  this.translationY = -bbox[1];
  __privateMethod(this, _setCanvasDims, setCanvasDims_fn).call(this);
  __privateMethod(this, _redraw, redraw_fn).call(this);
  __privateSet(this, _realWidth, width);
  __privateSet(this, _realHeight, height);
  this.setDims(width, height);
  const unscaledPadding = firstTime ? padding / this.scaleFactor / 2 : 0;
  this.translate(prevTranslationX - this.translationX - unscaledPadding, prevTranslationY - this.translationY - unscaledPadding);
};
__privateAdd(InkEditor, _buildPath2D);
__privateAdd(InkEditor, _toPDFCoordinates);
__privateAdd(InkEditor, _fromPDFCoordinates);
__publicField(InkEditor, "_defaultColor", null);
__publicField(InkEditor, "_defaultOpacity", 1);
__publicField(InkEditor, "_defaultThickness", 1);
__publicField(InkEditor, "_type", "ink");
__publicField(InkEditor, "_editorType", AnnotationEditorType.INK);
var _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas, _observer2, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _getBitmapFetched, getBitmapFetched_fn, _getBitmapDone, getBitmapDone_fn, _getBitmap, getBitmap_fn, _createCanvas2, createCanvas_fn2, _setDimensions, setDimensions_fn, _scaleBitmap, scaleBitmap_fn, _drawBitmap, drawBitmap_fn, _serializeBitmap, serializeBitmap_fn, _createObserver2, createObserver_fn2;
var _StampEditor = class extends AnnotationEditor {
  constructor(params) {
    super({
      ...params,
      name: "stampEditor"
    });
    __privateAdd(this, _getBitmapFetched);
    __privateAdd(this, _getBitmapDone);
    __privateAdd(this, _getBitmap);
    __privateAdd(this, _createCanvas2);
    __privateAdd(this, _setDimensions);
    __privateAdd(this, _scaleBitmap);
    __privateAdd(this, _drawBitmap);
    __privateAdd(this, _serializeBitmap);
    __privateAdd(this, _createObserver2);
    __privateAdd(this, _bitmap, null);
    __privateAdd(this, _bitmapId, null);
    __privateAdd(this, _bitmapPromise, null);
    __privateAdd(this, _bitmapUrl, null);
    __privateAdd(this, _bitmapFile, null);
    __privateAdd(this, _bitmapFileName, "");
    __privateAdd(this, _canvas, null);
    __privateAdd(this, _observer2, null);
    __privateAdd(this, _resizeTimeoutId, null);
    __privateAdd(this, _isSvg, false);
    __privateAdd(this, _hasBeenAddedInUndoStack, false);
    __privateSet(this, _bitmapUrl, params.bitmapUrl);
    __privateSet(this, _bitmapFile, params.bitmapFile);
  }
  static initialize(l10n, uiManager) {
    AnnotationEditor.initialize(l10n, uiManager);
  }
  static get supportedTypes() {
    const types = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
    return shadow(this, "supportedTypes", types.map((type) => `image/${type}`));
  }
  static get supportedTypesStr() {
    return shadow(this, "supportedTypesStr", this.supportedTypes.join(","));
  }
  static isHandlingMimeForPasting(mime) {
    return this.supportedTypes.includes(mime);
  }
  static paste(item, parent) {
    parent.pasteEditor(AnnotationEditorType.STAMP, {
      bitmapFile: item.getAsFile()
    });
  }
  altTextFinish() {
    if (this._uiManager.useNewAltTextFlow) {
      this.div.hidden = false;
    }
    super.altTextFinish();
  }
  get telemetryFinalData() {
    var _a2;
    return {
      type: "stamp",
      hasAltText: !!((_a2 = this.altTextData) == null ? void 0 : _a2.altText)
    };
  }
  static computeTelemetryFinalData(data) {
    var _a2, _b;
    const hasAltTextStats = data.get("hasAltText");
    return {
      hasAltText: (_a2 = hasAltTextStats.get(true)) != null ? _a2 : 0,
      hasNoAltText: (_b = hasAltTextStats.get(false)) != null ? _b : 0
    };
  }
  async mlGuessAltText(imageData = null, updateAltTextData = true) {
    if (this.hasAltTextData()) {
      return null;
    }
    const {
      mlManager
    } = this._uiManager;
    if (!mlManager) {
      throw new Error("No ML.");
    }
    if (!await mlManager.isEnabledFor("altText")) {
      throw new Error("ML isn't enabled for alt text.");
    }
    const {
      data,
      width,
      height
    } = imageData || this.copyCanvas(null, true).imageData;
    const response = await mlManager.guess({
      name: "altText",
      request: {
        data,
        width,
        height,
        channels: data.length / (width * height)
      }
    });
    if (!response) {
      throw new Error("No response from the AI service.");
    }
    if (response.error) {
      throw new Error("Error from the AI service.");
    }
    if (response.cancel) {
      return null;
    }
    if (!response.output) {
      throw new Error("No valid response from the AI service.");
    }
    const altText = response.output;
    await this.setGuessedAltText(altText);
    if (updateAltTextData && !this.hasAltTextData()) {
      this.altTextData = {
        alt: altText,
        decorative: false
      };
    }
    return altText;
  }
  remove() {
    var _a2, _b;
    if (__privateGet(this, _bitmapId)) {
      __privateSet(this, _bitmap, null);
      this._uiManager.imageManager.deleteId(__privateGet(this, _bitmapId));
      (_a2 = __privateGet(this, _canvas)) == null ? void 0 : _a2.remove();
      __privateSet(this, _canvas, null);
      (_b = __privateGet(this, _observer2)) == null ? void 0 : _b.disconnect();
      __privateSet(this, _observer2, null);
      if (__privateGet(this, _resizeTimeoutId)) {
        clearTimeout(__privateGet(this, _resizeTimeoutId));
        __privateSet(this, _resizeTimeoutId, null);
      }
    }
    super.remove();
  }
  rebuild() {
    if (!this.parent) {
      if (__privateGet(this, _bitmapId)) {
        __privateMethod(this, _getBitmap, getBitmap_fn).call(this);
      }
      return;
    }
    super.rebuild();
    if (this.div === null) {
      return;
    }
    if (__privateGet(this, _bitmapId) && __privateGet(this, _canvas) === null) {
      __privateMethod(this, _getBitmap, getBitmap_fn).call(this);
    }
    if (!this.isAttachedToDOM) {
      this.parent.add(this);
    }
  }
  onceAdded() {
    this._isDraggable = true;
    this.div.focus();
  }
  isEmpty() {
    return !(__privateGet(this, _bitmapPromise) || __privateGet(this, _bitmap) || __privateGet(this, _bitmapUrl) || __privateGet(this, _bitmapFile) || __privateGet(this, _bitmapId));
  }
  get isResizable() {
    return true;
  }
  render() {
    if (this.div) {
      return this.div;
    }
    let baseX, baseY;
    if (this.width) {
      baseX = this.x;
      baseY = this.y;
    }
    super.render();
    this.div.hidden = true;
    this.addAltTextButton();
    if (__privateGet(this, _bitmap)) {
      __privateMethod(this, _createCanvas2, createCanvas_fn2).call(this);
    } else {
      __privateMethod(this, _getBitmap, getBitmap_fn).call(this);
    }
    if (this.width) {
      const [parentWidth, parentHeight] = this.parentDimensions;
      this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
    }
    return this.div;
  }
  copyCanvas(maxDimension, createImageData = false) {
    var _a2;
    if (!maxDimension) {
      maxDimension = 224;
    }
    const {
      width: bitmapWidth,
      height: bitmapHeight
    } = __privateGet(this, _bitmap);
    const canvas = document.createElement("canvas");
    let bitmap = __privateGet(this, _bitmap);
    let width = bitmapWidth, height = bitmapHeight;
    if (bitmapWidth > maxDimension || bitmapHeight > maxDimension) {
      const ratio = Math.min(maxDimension / bitmapWidth, maxDimension / bitmapHeight);
      width = Math.floor(bitmapWidth * ratio);
      height = Math.floor(bitmapHeight * ratio);
      if (!__privateGet(this, _isSvg)) {
        bitmap = __privateMethod(this, _scaleBitmap, scaleBitmap_fn).call(this, width, height);
      }
    }
    canvas.width = width;
    canvas.height = height;
    const ctx = canvas.getContext("2d");
    ctx.filter = this._uiManager.hcmFilter;
    let white = "white", black = "#cfcfd8";
    if (this._uiManager.hcmFilter !== "none") {
      black = "black";
    } else if ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-color-scheme: dark)").matches) {
      white = "#8f8f9d";
      black = "#42414d";
    }
    const boxDim = 15;
    const pattern = new OffscreenCanvas(boxDim * 2, boxDim * 2);
    const patternCtx = pattern.getContext("2d");
    patternCtx.fillStyle = white;
    patternCtx.fillRect(0, 0, boxDim * 2, boxDim * 2);
    patternCtx.fillStyle = black;
    patternCtx.fillRect(0, 0, boxDim, boxDim);
    patternCtx.fillRect(boxDim, boxDim, boxDim, boxDim);
    ctx.fillStyle = ctx.createPattern(pattern, "repeat");
    ctx.fillRect(0, 0, width, height);
    if (createImageData) {
      const offscreen = new OffscreenCanvas(width, height);
      const offscreenCtx = offscreen.getContext("2d", {
        willReadFrequently: true
      });
      offscreenCtx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
      const data = offscreenCtx.getImageData(0, 0, width, height).data;
      ctx.drawImage(offscreen, 0, 0);
      return {
        canvas,
        imageData: {
          width,
          height,
          data
        }
      };
    }
    ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
    return {
      canvas,
      imageData: null
    };
  }
  getImageForAltText() {
    return __privateGet(this, _canvas);
  }
  static deserialize(data, parent, uiManager) {
    if (data instanceof StampAnnotationElement) {
      return null;
    }
    const editor = super.deserialize(data, parent, uiManager);
    const {
      rect,
      bitmapUrl,
      bitmapId,
      isSvg,
      accessibilityData
    } = data;
    if (bitmapId && uiManager.imageManager.isValidId(bitmapId)) {
      __privateSet(editor, _bitmapId, bitmapId);
    } else {
      __privateSet(editor, _bitmapUrl, bitmapUrl);
    }
    __privateSet(editor, _isSvg, isSvg);
    const [parentWidth, parentHeight] = editor.pageDimensions;
    editor.width = (rect[2] - rect[0]) / parentWidth;
    editor.height = (rect[3] - rect[1]) / parentHeight;
    if (accessibilityData) {
      editor.altTextData = accessibilityData;
    }
    return editor;
  }
  serialize(isForCopying = false, context = null) {
    if (this.isEmpty()) {
      return null;
    }
    const serialized = {
      annotationType: AnnotationEditorType.STAMP,
      bitmapId: __privateGet(this, _bitmapId),
      pageIndex: this.pageIndex,
      rect: this.getRect(0, 0),
      rotation: this.rotation,
      isSvg: __privateGet(this, _isSvg),
      structTreeParentId: this._structTreeParentId
    };
    if (isForCopying) {
      serialized.bitmapUrl = __privateMethod(this, _serializeBitmap, serializeBitmap_fn).call(this, true);
      serialized.accessibilityData = this.serializeAltText(true);
      return serialized;
    }
    const {
      decorative,
      altText
    } = this.serializeAltText(false);
    if (!decorative && altText) {
      serialized.accessibilityData = {
        type: "Figure",
        alt: altText
      };
    }
    if (context === null) {
      return serialized;
    }
    context.stamps || (context.stamps = /* @__PURE__ */ new Map());
    const area = __privateGet(this, _isSvg) ? (serialized.rect[2] - serialized.rect[0]) * (serialized.rect[3] - serialized.rect[1]) : null;
    if (!context.stamps.has(__privateGet(this, _bitmapId))) {
      context.stamps.set(__privateGet(this, _bitmapId), {
        area,
        serialized
      });
      serialized.bitmap = __privateMethod(this, _serializeBitmap, serializeBitmap_fn).call(this, false);
    } else if (__privateGet(this, _isSvg)) {
      const prevData = context.stamps.get(__privateGet(this, _bitmapId));
      if (area > prevData.area) {
        prevData.area = area;
        prevData.serialized.bitmap.close();
        prevData.serialized.bitmap = __privateMethod(this, _serializeBitmap, serializeBitmap_fn).call(this, false);
      }
    }
    return serialized;
  }
};
var StampEditor = _StampEditor;
_bitmap = new WeakMap();
_bitmapId = new WeakMap();
_bitmapPromise = new WeakMap();
_bitmapUrl = new WeakMap();
_bitmapFile = new WeakMap();
_bitmapFileName = new WeakMap();
_canvas = new WeakMap();
_observer2 = new WeakMap();
_resizeTimeoutId = new WeakMap();
_isSvg = new WeakMap();
_hasBeenAddedInUndoStack = new WeakMap();
_getBitmapFetched = new WeakSet();
getBitmapFetched_fn = function(data, fromId = false) {
  if (!data) {
    this.remove();
    return;
  }
  __privateSet(this, _bitmap, data.bitmap);
  if (!fromId) {
    __privateSet(this, _bitmapId, data.id);
    __privateSet(this, _isSvg, data.isSvg);
  }
  if (data.file) {
    __privateSet(this, _bitmapFileName, data.file.name);
  }
  __privateMethod(this, _createCanvas2, createCanvas_fn2).call(this);
};
_getBitmapDone = new WeakSet();
getBitmapDone_fn = function() {
  __privateSet(this, _bitmapPromise, null);
  this._uiManager.enableWaiting(false);
  if (!__privateGet(this, _canvas)) {
    return;
  }
  if (this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && __privateGet(this, _bitmap)) {
    this._editToolbar.hide();
    this._uiManager.editAltText(this, true);
    return;
  }
  if (!this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && __privateGet(this, _bitmap)) {
    this._reportTelemetry({
      action: "pdfjs.image.image_added",
      data: {
        alt_text_modal: false,
        alt_text_type: "empty"
      }
    });
    try {
      this.mlGuessAltText();
    } catch (e) {
    }
  }
  this.div.focus();
};
_getBitmap = new WeakSet();
getBitmap_fn = function() {
  if (__privateGet(this, _bitmapId)) {
    this._uiManager.enableWaiting(true);
    this._uiManager.imageManager.getFromId(__privateGet(this, _bitmapId)).then((data) => __privateMethod(this, _getBitmapFetched, getBitmapFetched_fn).call(this, data, true)).finally(() => __privateMethod(this, _getBitmapDone, getBitmapDone_fn).call(this));
    return;
  }
  if (__privateGet(this, _bitmapUrl)) {
    const url = __privateGet(this, _bitmapUrl);
    __privateSet(this, _bitmapUrl, null);
    this._uiManager.enableWaiting(true);
    __privateSet(this, _bitmapPromise, this._uiManager.imageManager.getFromUrl(url).then((data) => __privateMethod(this, _getBitmapFetched, getBitmapFetched_fn).call(this, data)).finally(() => __privateMethod(this, _getBitmapDone, getBitmapDone_fn).call(this)));
    return;
  }
  if (__privateGet(this, _bitmapFile)) {
    const file = __privateGet(this, _bitmapFile);
    __privateSet(this, _bitmapFile, null);
    this._uiManager.enableWaiting(true);
    __privateSet(this, _bitmapPromise, this._uiManager.imageManager.getFromFile(file).then((data) => __privateMethod(this, _getBitmapFetched, getBitmapFetched_fn).call(this, data)).finally(() => __privateMethod(this, _getBitmapDone, getBitmapDone_fn).call(this)));
    return;
  }
  const input = document.createElement("input");
  input.type = "file";
  input.accept = _StampEditor.supportedTypesStr;
  const signal = this._uiManager._signal;
  __privateSet(this, _bitmapPromise, new Promise((resolve) => {
    input.addEventListener("change", async () => {
      if (!input.files || input.files.length === 0) {
        this.remove();
      } else {
        this._uiManager.enableWaiting(true);
        const data = await this._uiManager.imageManager.getFromFile(input.files[0]);
        this._reportTelemetry({
          action: "pdfjs.image.image_selected",
          data: {
            alt_text_modal: this._uiManager.useNewAltTextFlow
          }
        });
        __privateMethod(this, _getBitmapFetched, getBitmapFetched_fn).call(this, data);
      }
      resolve();
    }, {
      signal
    });
    input.addEventListener("cancel", () => {
      this.remove();
      resolve();
    }, {
      signal
    });
  }).finally(() => __privateMethod(this, _getBitmapDone, getBitmapDone_fn).call(this)));
  input.click();
};
_createCanvas2 = new WeakSet();
createCanvas_fn2 = function() {
  const {
    div
  } = this;
  let {
    width,
    height
  } = __privateGet(this, _bitmap);
  const [pageWidth, pageHeight] = this.pageDimensions;
  const MAX_RATIO = 0.75;
  if (this.width) {
    width = this.width * pageWidth;
    height = this.height * pageHeight;
  } else if (width > MAX_RATIO * pageWidth || height > MAX_RATIO * pageHeight) {
    const factor = Math.min(MAX_RATIO * pageWidth / width, MAX_RATIO * pageHeight / height);
    width *= factor;
    height *= factor;
  }
  const [parentWidth, parentHeight] = this.parentDimensions;
  this.setDims(width * parentWidth / pageWidth, height * parentHeight / pageHeight);
  this._uiManager.enableWaiting(false);
  const canvas = __privateSet(this, _canvas, document.createElement("canvas"));
  div.append(canvas);
  if (!this._uiManager.useNewAltTextWhenAddingImage || !this._uiManager.useNewAltTextFlow) {
    div.hidden = false;
  }
  __privateMethod(this, _drawBitmap, drawBitmap_fn).call(this, width, height);
  __privateMethod(this, _createObserver2, createObserver_fn2).call(this);
  if (!__privateGet(this, _hasBeenAddedInUndoStack)) {
    this.parent.addUndoableEditor(this);
    __privateSet(this, _hasBeenAddedInUndoStack, true);
  }
  this._reportTelemetry({
    action: "inserted_image"
  });
  if (__privateGet(this, _bitmapFileName)) {
    canvas.setAttribute("aria-label", __privateGet(this, _bitmapFileName));
  }
};
_setDimensions = new WeakSet();
setDimensions_fn = function(width, height) {
  var _a2;
  const [parentWidth, parentHeight] = this.parentDimensions;
  this.width = width / parentWidth;
  this.height = height / parentHeight;
  this.setDims(width, height);
  if ((_a2 = this._initialOptions) == null ? void 0 : _a2.isCentered) {
    this.center();
  } else {
    this.fixAndSetPosition();
  }
  this._initialOptions = null;
  if (__privateGet(this, _resizeTimeoutId) !== null) {
    clearTimeout(__privateGet(this, _resizeTimeoutId));
  }
  const TIME_TO_WAIT = 200;
  __privateSet(this, _resizeTimeoutId, setTimeout(() => {
    __privateSet(this, _resizeTimeoutId, null);
    __privateMethod(this, _drawBitmap, drawBitmap_fn).call(this, width, height);
  }, TIME_TO_WAIT));
};
_scaleBitmap = new WeakSet();
scaleBitmap_fn = function(width, height) {
  const {
    width: bitmapWidth,
    height: bitmapHeight
  } = __privateGet(this, _bitmap);
  let newWidth = bitmapWidth;
  let newHeight = bitmapHeight;
  let bitmap = __privateGet(this, _bitmap);
  while (newWidth > 2 * width || newHeight > 2 * height) {
    const prevWidth = newWidth;
    const prevHeight = newHeight;
    if (newWidth > 2 * width) {
      newWidth = newWidth >= 16384 ? Math.floor(newWidth / 2) - 1 : Math.ceil(newWidth / 2);
    }
    if (newHeight > 2 * height) {
      newHeight = newHeight >= 16384 ? Math.floor(newHeight / 2) - 1 : Math.ceil(newHeight / 2);
    }
    const offscreen = new OffscreenCanvas(newWidth, newHeight);
    const ctx = offscreen.getContext("2d");
    ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
    bitmap = offscreen.transferToImageBitmap();
  }
  return bitmap;
};
_drawBitmap = new WeakSet();
drawBitmap_fn = function(width, height) {
  width = Math.ceil(width);
  height = Math.ceil(height);
  const canvas = __privateGet(this, _canvas);
  if (!canvas || canvas.width === width && canvas.height === height) {
    return;
  }
  canvas.width = width;
  canvas.height = height;
  const bitmap = __privateGet(this, _isSvg) ? __privateGet(this, _bitmap) : __privateMethod(this, _scaleBitmap, scaleBitmap_fn).call(this, width, height);
  const ctx = canvas.getContext("2d");
  ctx.filter = this._uiManager.hcmFilter;
  ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
};
_serializeBitmap = new WeakSet();
serializeBitmap_fn = function(toUrl) {
  if (toUrl) {
    if (__privateGet(this, _isSvg)) {
      const url = this._uiManager.imageManager.getSvgUrl(__privateGet(this, _bitmapId));
      if (url) {
        return url;
      }
    }
    const canvas = document.createElement("canvas");
    ({
      width: canvas.width,
      height: canvas.height
    } = __privateGet(this, _bitmap));
    const ctx = canvas.getContext("2d");
    ctx.drawImage(__privateGet(this, _bitmap), 0, 0);
    return canvas.toDataURL();
  }
  if (__privateGet(this, _isSvg)) {
    const [pageWidth, pageHeight] = this.pageDimensions;
    const width = Math.round(this.width * pageWidth * PixelsPerInch.PDF_TO_CSS_UNITS);
    const height = Math.round(this.height * pageHeight * PixelsPerInch.PDF_TO_CSS_UNITS);
    const offscreen = new OffscreenCanvas(width, height);
    const ctx = offscreen.getContext("2d");
    ctx.drawImage(__privateGet(this, _bitmap), 0, 0, __privateGet(this, _bitmap).width, __privateGet(this, _bitmap).height, 0, 0, width, height);
    return offscreen.transferToImageBitmap();
  }
  return structuredClone(__privateGet(this, _bitmap));
};
_createObserver2 = new WeakSet();
createObserver_fn2 = function() {
  if (!this._uiManager._signal) {
    return;
  }
  __privateSet(this, _observer2, new ResizeObserver((entries) => {
    const rect = entries[0].contentRect;
    if (rect.width && rect.height) {
      __privateMethod(this, _setDimensions, setDimensions_fn).call(this, rect.width, rect.height);
    }
  }));
  __privateGet(this, _observer2).observe(this.div);
  this._uiManager._signal.addEventListener("abort", () => {
    var _a2;
    (_a2 = __privateGet(this, _observer2)) == null ? void 0 : _a2.disconnect();
    __privateSet(this, _observer2, null);
  }, {
    once: true
  });
};
__publicField(StampEditor, "_type", "stamp");
__publicField(StampEditor, "_editorType", AnnotationEditorType.STAMP);
var _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isCleaningUp, _isDisabling, _textLayer, _textSelectionAC, _uiManager3, _editorTypes2, _textLayerPointerDown, textLayerPointerDown_fn, _currentEditorType, currentEditorType_get, _createNewEditor, createNewEditor_fn, _getCenterPoint, getCenterPoint_fn, _cleanup, cleanup_fn;
var _AnnotationEditorLayer = class {
  constructor({
    uiManager,
    pageIndex,
    div,
    accessibilityManager,
    annotationLayer,
    drawLayer,
    textLayer,
    viewport,
    l10n
  }) {
    __privateAdd(this, _textLayerPointerDown);
    __privateAdd(this, _currentEditorType);
    __privateAdd(this, _createNewEditor);
    __privateAdd(this, _getCenterPoint);
    __privateAdd(this, _cleanup);
    __privateAdd(this, _accessibilityManager2, void 0);
    __privateAdd(this, _allowClick, false);
    __privateAdd(this, _annotationLayer, null);
    __privateAdd(this, _clickAC, null);
    __privateAdd(this, _editorFocusTimeoutId, null);
    __privateAdd(this, _editors, /* @__PURE__ */ new Map());
    __privateAdd(this, _hadPointerDown, false);
    __privateAdd(this, _isCleaningUp, false);
    __privateAdd(this, _isDisabling, false);
    __privateAdd(this, _textLayer, null);
    __privateAdd(this, _textSelectionAC, null);
    __privateAdd(this, _uiManager3, void 0);
    const editorTypes = [...__privateGet(_AnnotationEditorLayer, _editorTypes2).values()];
    if (!_AnnotationEditorLayer._initialized) {
      _AnnotationEditorLayer._initialized = true;
      for (const editorType of editorTypes) {
        editorType.initialize(l10n, uiManager);
      }
    }
    uiManager.registerEditorTypes(editorTypes);
    __privateSet(this, _uiManager3, uiManager);
    this.pageIndex = pageIndex;
    this.div = div;
    __privateSet(this, _accessibilityManager2, accessibilityManager);
    __privateSet(this, _annotationLayer, annotationLayer);
    this.viewport = viewport;
    __privateSet(this, _textLayer, textLayer);
    this.drawLayer = drawLayer;
    __privateGet(this, _uiManager3).addLayer(this);
  }
  get isEmpty() {
    return __privateGet(this, _editors).size === 0;
  }
  get isInvisible() {
    return this.isEmpty && __privateGet(this, _uiManager3).getMode() === AnnotationEditorType.NONE;
  }
  updateToolbar(mode) {
    __privateGet(this, _uiManager3).updateToolbar(mode);
  }
  updateMode(mode = __privateGet(this, _uiManager3).getMode()) {
    __privateMethod(this, _cleanup, cleanup_fn).call(this);
    switch (mode) {
      case AnnotationEditorType.NONE:
        this.disableTextSelection();
        this.togglePointerEvents(false);
        this.toggleAnnotationLayerPointerEvents(true);
        this.disableClick();
        return;
      case AnnotationEditorType.INK:
        this.addInkEditorIfNeeded(false);
        this.disableTextSelection();
        this.togglePointerEvents(true);
        this.disableClick();
        break;
      case AnnotationEditorType.HIGHLIGHT:
        this.enableTextSelection();
        this.togglePointerEvents(false);
        this.disableClick();
        break;
      default:
        this.disableTextSelection();
        this.togglePointerEvents(true);
        this.enableClick();
    }
    this.toggleAnnotationLayerPointerEvents(false);
    const {
      classList
    } = this.div;
    for (const editorType of __privateGet(_AnnotationEditorLayer, _editorTypes2).values()) {
      classList.toggle(`${editorType._type}Editing`, mode === editorType._editorType);
    }
    this.div.hidden = false;
  }
  hasTextLayer(textLayer) {
    var _a2;
    return textLayer === ((_a2 = __privateGet(this, _textLayer)) == null ? void 0 : _a2.div);
  }
  addInkEditorIfNeeded(isCommitting) {
    if (__privateGet(this, _uiManager3).getMode() !== AnnotationEditorType.INK) {
      return;
    }
    if (!isCommitting) {
      for (const editor2 of __privateGet(this, _editors).values()) {
        if (editor2.isEmpty()) {
          editor2.setInBackground();
          return;
        }
      }
    }
    const editor = this.createAndAddNewEditor({
      offsetX: 0,
      offsetY: 0
    }, false);
    editor.setInBackground();
  }
  setEditingState(isEditing) {
    __privateGet(this, _uiManager3).setEditingState(isEditing);
  }
  addCommands(params) {
    __privateGet(this, _uiManager3).addCommands(params);
  }
  toggleDrawing(enabled = false) {
    this.div.classList.toggle("drawing", !enabled);
  }
  togglePointerEvents(enabled = false) {
    this.div.classList.toggle("disabled", !enabled);
  }
  toggleAnnotationLayerPointerEvents(enabled = false) {
    var _a2;
    (_a2 = __privateGet(this, _annotationLayer)) == null ? void 0 : _a2.div.classList.toggle("disabled", !enabled);
  }
  enable() {
    this.div.tabIndex = 0;
    this.togglePointerEvents(true);
    const annotationElementIds = /* @__PURE__ */ new Set();
    for (const editor of __privateGet(this, _editors).values()) {
      editor.enableEditing();
      editor.show(true);
      if (editor.annotationElementId) {
        __privateGet(this, _uiManager3).removeChangedExistingAnnotation(editor);
        annotationElementIds.add(editor.annotationElementId);
      }
    }
    if (!__privateGet(this, _annotationLayer)) {
      return;
    }
    const editables = __privateGet(this, _annotationLayer).getEditableAnnotations();
    for (const editable of editables) {
      editable.hide();
      if (__privateGet(this, _uiManager3).isDeletedAnnotationElement(editable.data.id)) {
        continue;
      }
      if (annotationElementIds.has(editable.data.id)) {
        continue;
      }
      const editor = this.deserialize(editable);
      if (!editor) {
        continue;
      }
      this.addOrRebuild(editor);
      editor.enableEditing();
    }
  }
  disable() {
    var _a2;
    __privateSet(this, _isDisabling, true);
    this.div.tabIndex = -1;
    this.togglePointerEvents(false);
    const changedAnnotations = /* @__PURE__ */ new Map();
    const resetAnnotations = /* @__PURE__ */ new Map();
    for (const editor of __privateGet(this, _editors).values()) {
      editor.disableEditing();
      if (!editor.annotationElementId) {
        continue;
      }
      if (editor.serialize() !== null) {
        changedAnnotations.set(editor.annotationElementId, editor);
        continue;
      } else {
        resetAnnotations.set(editor.annotationElementId, editor);
      }
      (_a2 = this.getEditableAnnotation(editor.annotationElementId)) == null ? void 0 : _a2.show();
      editor.remove();
    }
    if (__privateGet(this, _annotationLayer)) {
      const editables = __privateGet(this, _annotationLayer).getEditableAnnotations();
      for (const editable of editables) {
        const {
          id
        } = editable.data;
        if (__privateGet(this, _uiManager3).isDeletedAnnotationElement(id)) {
          continue;
        }
        let editor = resetAnnotations.get(id);
        if (editor) {
          editor.resetAnnotationElement(editable);
          editor.show(false);
          editable.show();
          continue;
        }
        editor = changedAnnotations.get(id);
        if (editor) {
          __privateGet(this, _uiManager3).addChangedExistingAnnotation(editor);
          editor.renderAnnotationElement(editable);
          editor.show(false);
        }
        editable.show();
      }
    }
    __privateMethod(this, _cleanup, cleanup_fn).call(this);
    if (this.isEmpty) {
      this.div.hidden = true;
    }
    const {
      classList
    } = this.div;
    for (const editorType of __privateGet(_AnnotationEditorLayer, _editorTypes2).values()) {
      classList.remove(`${editorType._type}Editing`);
    }
    this.disableTextSelection();
    this.toggleAnnotationLayerPointerEvents(true);
    __privateSet(this, _isDisabling, false);
  }
  getEditableAnnotation(id) {
    var _a2;
    return ((_a2 = __privateGet(this, _annotationLayer)) == null ? void 0 : _a2.getEditableAnnotation(id)) || null;
  }
  setActiveEditor(editor) {
    const currentActive = __privateGet(this, _uiManager3).getActive();
    if (currentActive === editor) {
      return;
    }
    __privateGet(this, _uiManager3).setActiveEditor(editor);
  }
  enableTextSelection() {
    var _a2;
    this.div.tabIndex = -1;
    if (((_a2 = __privateGet(this, _textLayer)) == null ? void 0 : _a2.div) && !__privateGet(this, _textSelectionAC)) {
      __privateSet(this, _textSelectionAC, new AbortController());
      const signal = __privateGet(this, _uiManager3).combinedSignal(__privateGet(this, _textSelectionAC));
      __privateGet(this, _textLayer).div.addEventListener("pointerdown", __privateMethod(this, _textLayerPointerDown, textLayerPointerDown_fn).bind(this), {
        signal
      });
      __privateGet(this, _textLayer).div.classList.add("highlighting");
    }
  }
  disableTextSelection() {
    var _a2;
    this.div.tabIndex = 0;
    if (((_a2 = __privateGet(this, _textLayer)) == null ? void 0 : _a2.div) && __privateGet(this, _textSelectionAC)) {
      __privateGet(this, _textSelectionAC).abort();
      __privateSet(this, _textSelectionAC, null);
      __privateGet(this, _textLayer).div.classList.remove("highlighting");
    }
  }
  enableClick() {
    if (__privateGet(this, _clickAC)) {
      return;
    }
    __privateSet(this, _clickAC, new AbortController());
    const signal = __privateGet(this, _uiManager3).combinedSignal(__privateGet(this, _clickAC));
    this.div.addEventListener("pointerdown", this.pointerdown.bind(this), {
      signal
    });
    this.div.addEventListener("pointerup", this.pointerup.bind(this), {
      signal
    });
  }
  disableClick() {
    var _a2;
    (_a2 = __privateGet(this, _clickAC)) == null ? void 0 : _a2.abort();
    __privateSet(this, _clickAC, null);
  }
  attach(editor) {
    __privateGet(this, _editors).set(editor.id, editor);
    const {
      annotationElementId
    } = editor;
    if (annotationElementId && __privateGet(this, _uiManager3).isDeletedAnnotationElement(annotationElementId)) {
      __privateGet(this, _uiManager3).removeDeletedAnnotationElement(editor);
    }
  }
  detach(editor) {
    var _a2;
    __privateGet(this, _editors).delete(editor.id);
    (_a2 = __privateGet(this, _accessibilityManager2)) == null ? void 0 : _a2.removePointerInTextLayer(editor.contentDiv);
    if (!__privateGet(this, _isDisabling) && editor.annotationElementId) {
      __privateGet(this, _uiManager3).addDeletedAnnotationElement(editor);
    }
  }
  remove(editor) {
    this.detach(editor);
    __privateGet(this, _uiManager3).removeEditor(editor);
    editor.div.remove();
    editor.isAttachedToDOM = false;
    if (!__privateGet(this, _isCleaningUp)) {
      this.addInkEditorIfNeeded(false);
    }
  }
  changeParent(editor) {
    var _a2;
    if (editor.parent === this) {
      return;
    }
    if (editor.parent && editor.annotationElementId) {
      __privateGet(this, _uiManager3).addDeletedAnnotationElement(editor.annotationElementId);
      AnnotationEditor.deleteAnnotationElement(editor);
      editor.annotationElementId = null;
    }
    this.attach(editor);
    (_a2 = editor.parent) == null ? void 0 : _a2.detach(editor);
    editor.setParent(this);
    if (editor.div && editor.isAttachedToDOM) {
      editor.div.remove();
      this.div.append(editor.div);
    }
  }
  add(editor) {
    if (editor.parent === this && editor.isAttachedToDOM) {
      return;
    }
    this.changeParent(editor);
    __privateGet(this, _uiManager3).addEditor(editor);
    this.attach(editor);
    if (!editor.isAttachedToDOM) {
      const div = editor.render();
      this.div.append(div);
      editor.isAttachedToDOM = true;
    }
    editor.fixAndSetPosition();
    editor.onceAdded();
    __privateGet(this, _uiManager3).addToAnnotationStorage(editor);
    editor._reportTelemetry(editor.telemetryInitialData);
  }
  moveEditorInDOM(editor) {
    var _a2;
    if (!editor.isAttachedToDOM) {
      return;
    }
    const {
      activeElement
    } = document;
    if (editor.div.contains(activeElement) && !__privateGet(this, _editorFocusTimeoutId)) {
      editor._focusEventsAllowed = false;
      __privateSet(this, _editorFocusTimeoutId, setTimeout(() => {
        __privateSet(this, _editorFocusTimeoutId, null);
        if (!editor.div.contains(document.activeElement)) {
          editor.div.addEventListener("focusin", () => {
            editor._focusEventsAllowed = true;
          }, {
            once: true,
            signal: __privateGet(this, _uiManager3)._signal
          });
          activeElement.focus();
        } else {
          editor._focusEventsAllowed = true;
        }
      }, 0));
    }
    editor._structTreeParentId = (_a2 = __privateGet(this, _accessibilityManager2)) == null ? void 0 : _a2.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
  }
  addOrRebuild(editor) {
    if (editor.needsToBeRebuilt()) {
      editor.parent || (editor.parent = this);
      editor.rebuild();
      editor.show();
    } else {
      this.add(editor);
    }
  }
  addUndoableEditor(editor) {
    const cmd = () => editor._uiManager.rebuild(editor);
    const undo = () => {
      editor.remove();
    };
    this.addCommands({
      cmd,
      undo,
      mustExec: false
    });
  }
  getNextId() {
    return __privateGet(this, _uiManager3).getId();
  }
  combinedSignal(ac) {
    return __privateGet(this, _uiManager3).combinedSignal(ac);
  }
  canCreateNewEmptyEditor() {
    var _a2;
    return (_a2 = __privateGet(this, _currentEditorType, currentEditorType_get)) == null ? void 0 : _a2.canCreateNewEmptyEditor();
  }
  pasteEditor(mode, params) {
    __privateGet(this, _uiManager3).updateToolbar(mode);
    __privateGet(this, _uiManager3).updateMode(mode);
    const {
      offsetX,
      offsetY
    } = __privateMethod(this, _getCenterPoint, getCenterPoint_fn).call(this);
    const id = this.getNextId();
    const editor = __privateMethod(this, _createNewEditor, createNewEditor_fn).call(this, {
      parent: this,
      id,
      x: offsetX,
      y: offsetY,
      uiManager: __privateGet(this, _uiManager3),
      isCentered: true,
      ...params
    });
    if (editor) {
      this.add(editor);
    }
  }
  deserialize(data) {
    var _a2, _b;
    return ((_b = __privateGet(_AnnotationEditorLayer, _editorTypes2).get((_a2 = data.annotationType) != null ? _a2 : data.annotationEditorType)) == null ? void 0 : _b.deserialize(data, this, __privateGet(this, _uiManager3))) || null;
  }
  createAndAddNewEditor(event, isCentered, data = {}) {
    const id = this.getNextId();
    const editor = __privateMethod(this, _createNewEditor, createNewEditor_fn).call(this, {
      parent: this,
      id,
      x: event.offsetX,
      y: event.offsetY,
      uiManager: __privateGet(this, _uiManager3),
      isCentered,
      ...data
    });
    if (editor) {
      this.add(editor);
    }
    return editor;
  }
  addNewEditor() {
    this.createAndAddNewEditor(__privateMethod(this, _getCenterPoint, getCenterPoint_fn).call(this), true);
  }
  setSelected(editor) {
    __privateGet(this, _uiManager3).setSelected(editor);
  }
  toggleSelected(editor) {
    __privateGet(this, _uiManager3).toggleSelected(editor);
  }
  isSelected(editor) {
    return __privateGet(this, _uiManager3).isSelected(editor);
  }
  unselect(editor) {
    __privateGet(this, _uiManager3).unselect(editor);
  }
  pointerup(event) {
    const {
      isMac
    } = util_FeatureTest.platform;
    if (event.button !== 0 || event.ctrlKey && isMac) {
      return;
    }
    if (event.target !== this.div) {
      return;
    }
    if (!__privateGet(this, _hadPointerDown)) {
      return;
    }
    __privateSet(this, _hadPointerDown, false);
    if (!__privateGet(this, _allowClick)) {
      __privateSet(this, _allowClick, true);
      return;
    }
    if (__privateGet(this, _uiManager3).getMode() === AnnotationEditorType.STAMP) {
      __privateGet(this, _uiManager3).unselectAll();
      return;
    }
    this.createAndAddNewEditor(event, false);
  }
  pointerdown(event) {
    if (__privateGet(this, _uiManager3).getMode() === AnnotationEditorType.HIGHLIGHT) {
      this.enableTextSelection();
    }
    if (__privateGet(this, _hadPointerDown)) {
      __privateSet(this, _hadPointerDown, false);
      return;
    }
    const {
      isMac
    } = util_FeatureTest.platform;
    if (event.button !== 0 || event.ctrlKey && isMac) {
      return;
    }
    if (event.target !== this.div) {
      return;
    }
    __privateSet(this, _hadPointerDown, true);
    const editor = __privateGet(this, _uiManager3).getActive();
    __privateSet(this, _allowClick, !editor || editor.isEmpty());
  }
  findNewParent(editor, x, y) {
    const layer = __privateGet(this, _uiManager3).findParent(x, y);
    if (layer === null || layer === this) {
      return false;
    }
    layer.changeParent(editor);
    return true;
  }
  destroy() {
    var _a2, _b;
    if (((_a2 = __privateGet(this, _uiManager3).getActive()) == null ? void 0 : _a2.parent) === this) {
      __privateGet(this, _uiManager3).commitOrRemove();
      __privateGet(this, _uiManager3).setActiveEditor(null);
    }
    if (__privateGet(this, _editorFocusTimeoutId)) {
      clearTimeout(__privateGet(this, _editorFocusTimeoutId));
      __privateSet(this, _editorFocusTimeoutId, null);
    }
    for (const editor of __privateGet(this, _editors).values()) {
      (_b = __privateGet(this, _accessibilityManager2)) == null ? void 0 : _b.removePointerInTextLayer(editor.contentDiv);
      editor.setParent(null);
      editor.isAttachedToDOM = false;
      editor.div.remove();
    }
    this.div = null;
    __privateGet(this, _editors).clear();
    __privateGet(this, _uiManager3).removeLayer(this);
  }
  render({
    viewport
  }) {
    this.viewport = viewport;
    setLayerDimensions(this.div, viewport);
    for (const editor of __privateGet(this, _uiManager3).getEditors(this.pageIndex)) {
      this.add(editor);
      editor.rebuild();
    }
    this.updateMode();
  }
  update({
    viewport
  }) {
    __privateGet(this, _uiManager3).commitOrRemove();
    __privateMethod(this, _cleanup, cleanup_fn).call(this);
    const oldRotation = this.viewport.rotation;
    const rotation = viewport.rotation;
    this.viewport = viewport;
    setLayerDimensions(this.div, {
      rotation
    });
    if (oldRotation !== rotation) {
      for (const editor of __privateGet(this, _editors).values()) {
        editor.rotate(rotation);
      }
    }
    this.addInkEditorIfNeeded(false);
  }
  get pageDimensions() {
    const {
      pageWidth,
      pageHeight
    } = this.viewport.rawDims;
    return [pageWidth, pageHeight];
  }
  get scale() {
    return __privateGet(this, _uiManager3).viewParameters.realScale;
  }
};
var AnnotationEditorLayer = _AnnotationEditorLayer;
_accessibilityManager2 = new WeakMap();
_allowClick = new WeakMap();
_annotationLayer = new WeakMap();
_clickAC = new WeakMap();
_editorFocusTimeoutId = new WeakMap();
_editors = new WeakMap();
_hadPointerDown = new WeakMap();
_isCleaningUp = new WeakMap();
_isDisabling = new WeakMap();
_textLayer = new WeakMap();
_textSelectionAC = new WeakMap();
_uiManager3 = new WeakMap();
_editorTypes2 = new WeakMap();
_textLayerPointerDown = new WeakSet();
textLayerPointerDown_fn = function(event) {
  __privateGet(this, _uiManager3).unselectAll();
  const {
    target
  } = event;
  if (target === __privateGet(this, _textLayer).div || target.classList.contains("endOfContent") && __privateGet(this, _textLayer).div.contains(target)) {
    const {
      isMac
    } = util_FeatureTest.platform;
    if (event.button !== 0 || event.ctrlKey && isMac) {
      return;
    }
    __privateGet(this, _uiManager3).showAllEditors("highlight", true, true);
    __privateGet(this, _textLayer).div.classList.add("free");
    this.toggleDrawing();
    HighlightEditor.startHighlighting(this, __privateGet(this, _uiManager3).direction === "ltr", event);
    __privateGet(this, _textLayer).div.addEventListener("pointerup", () => {
      __privateGet(this, _textLayer).div.classList.remove("free");
      this.toggleDrawing(true);
    }, {
      once: true,
      signal: __privateGet(this, _uiManager3)._signal
    });
    event.preventDefault();
  }
};
_currentEditorType = new WeakSet();
currentEditorType_get = function() {
  return __privateGet(_AnnotationEditorLayer, _editorTypes2).get(__privateGet(this, _uiManager3).getMode());
};
_createNewEditor = new WeakSet();
createNewEditor_fn = function(params) {
  const editorType = __privateGet(this, _currentEditorType, currentEditorType_get);
  return editorType ? new editorType.prototype.constructor(params) : null;
};
_getCenterPoint = new WeakSet();
getCenterPoint_fn = function() {
  const {
    x,
    y,
    width,
    height
  } = this.div.getBoundingClientRect();
  const tlX = Math.max(0, x);
  const tlY = Math.max(0, y);
  const brX = Math.min(window.innerWidth, x + width);
  const brY = Math.min(window.innerHeight, y + height);
  const centerX = (tlX + brX) / 2 - x;
  const centerY = (tlY + brY) / 2 - y;
  const [offsetX, offsetY] = this.viewport.rotation % 180 === 0 ? [centerX, centerY] : [centerY, centerX];
  return {
    offsetX,
    offsetY
  };
};
_cleanup = new WeakSet();
cleanup_fn = function() {
  __privateSet(this, _isCleaningUp, true);
  for (const editor of __privateGet(this, _editors).values()) {
    if (editor.isEmpty()) {
      editor.remove();
    }
  }
  __privateSet(this, _isCleaningUp, false);
};
__publicField(AnnotationEditorLayer, "_initialized", false);
__privateAdd(AnnotationEditorLayer, _editorTypes2, new Map([FreeTextEditor, InkEditor, StampEditor, HighlightEditor].map((type) => [type._editorType, type])));
var _parent2, _id5, _mapping, _toUpdate, _setBox, setBox_fn, _createSVG, createSVG_fn, _createClipPath, createClipPath_fn;
var _DrawLayer = class {
  constructor({
    pageIndex
  }) {
    __privateAdd(this, _createSVG);
    __privateAdd(this, _createClipPath);
    __privateAdd(this, _parent2, null);
    __privateAdd(this, _id5, 0);
    __privateAdd(this, _mapping, /* @__PURE__ */ new Map());
    __privateAdd(this, _toUpdate, /* @__PURE__ */ new Map());
    this.pageIndex = pageIndex;
  }
  setParent(parent) {
    if (!__privateGet(this, _parent2)) {
      __privateSet(this, _parent2, parent);
      return;
    }
    if (__privateGet(this, _parent2) !== parent) {
      if (__privateGet(this, _mapping).size > 0) {
        for (const root of __privateGet(this, _mapping).values()) {
          root.remove();
          parent.append(root);
        }
      }
      __privateSet(this, _parent2, parent);
    }
  }
  static get _svgFactory() {
    return shadow(this, "_svgFactory", new DOMSVGFactory());
  }
  highlight(outlines, color, opacity, isPathUpdatable = false) {
    const id = __privateWrapper(this, _id5)._++;
    const root = __privateMethod(this, _createSVG, createSVG_fn).call(this, outlines.box);
    root.classList.add("highlight");
    if (outlines.free) {
      root.classList.add("free");
    }
    const defs = _DrawLayer._svgFactory.createElement("defs");
    root.append(defs);
    const path = _DrawLayer._svgFactory.createElement("path");
    defs.append(path);
    const pathId = `path_p${this.pageIndex}_${id}`;
    path.setAttribute("id", pathId);
    path.setAttribute("d", outlines.toSVGPath());
    if (isPathUpdatable) {
      __privateGet(this, _toUpdate).set(id, path);
    }
    const clipPathId = __privateMethod(this, _createClipPath, createClipPath_fn).call(this, defs, pathId);
    const use = _DrawLayer._svgFactory.createElement("use");
    root.append(use);
    root.setAttribute("fill", color);
    root.setAttribute("fill-opacity", opacity);
    use.setAttribute("href", `#${pathId}`);
    __privateGet(this, _mapping).set(id, root);
    return {
      id,
      clipPathId: `url(#${clipPathId})`
    };
  }
  highlightOutline(outlines) {
    const id = __privateWrapper(this, _id5)._++;
    const root = __privateMethod(this, _createSVG, createSVG_fn).call(this, outlines.box);
    root.classList.add("highlightOutline");
    const defs = _DrawLayer._svgFactory.createElement("defs");
    root.append(defs);
    const path = _DrawLayer._svgFactory.createElement("path");
    defs.append(path);
    const pathId = `path_p${this.pageIndex}_${id}`;
    path.setAttribute("id", pathId);
    path.setAttribute("d", outlines.toSVGPath());
    path.setAttribute("vector-effect", "non-scaling-stroke");
    let maskId;
    if (outlines.free) {
      root.classList.add("free");
      const mask = _DrawLayer._svgFactory.createElement("mask");
      defs.append(mask);
      maskId = `mask_p${this.pageIndex}_${id}`;
      mask.setAttribute("id", maskId);
      mask.setAttribute("maskUnits", "objectBoundingBox");
      const rect = _DrawLayer._svgFactory.createElement("rect");
      mask.append(rect);
      rect.setAttribute("width", "1");
      rect.setAttribute("height", "1");
      rect.setAttribute("fill", "white");
      const use = _DrawLayer._svgFactory.createElement("use");
      mask.append(use);
      use.setAttribute("href", `#${pathId}`);
      use.setAttribute("stroke", "none");
      use.setAttribute("fill", "black");
      use.setAttribute("fill-rule", "nonzero");
      use.classList.add("mask");
    }
    const use1 = _DrawLayer._svgFactory.createElement("use");
    root.append(use1);
    use1.setAttribute("href", `#${pathId}`);
    if (maskId) {
      use1.setAttribute("mask", `url(#${maskId})`);
    }
    const use2 = use1.cloneNode();
    root.append(use2);
    use1.classList.add("mainOutline");
    use2.classList.add("secondaryOutline");
    __privateGet(this, _mapping).set(id, root);
    return id;
  }
  finalizeLine(id, line) {
    const path = __privateGet(this, _toUpdate).get(id);
    __privateGet(this, _toUpdate).delete(id);
    this.updateBox(id, line.box);
    path.setAttribute("d", line.toSVGPath());
  }
  updateLine(id, line) {
    const root = __privateGet(this, _mapping).get(id);
    const defs = root.firstChild;
    const path = defs.firstChild;
    path.setAttribute("d", line.toSVGPath());
  }
  removeFreeHighlight(id) {
    this.remove(id);
    __privateGet(this, _toUpdate).delete(id);
  }
  updatePath(id, line) {
    __privateGet(this, _toUpdate).get(id).setAttribute("d", line.toSVGPath());
  }
  updateBox(id, box) {
    var _a2;
    __privateMethod(_a2 = _DrawLayer, _setBox, setBox_fn).call(_a2, __privateGet(this, _mapping).get(id), box);
  }
  show(id, visible) {
    __privateGet(this, _mapping).get(id).classList.toggle("hidden", !visible);
  }
  rotate(id, angle) {
    __privateGet(this, _mapping).get(id).setAttribute("data-main-rotation", angle);
  }
  changeColor(id, color) {
    __privateGet(this, _mapping).get(id).setAttribute("fill", color);
  }
  changeOpacity(id, opacity) {
    __privateGet(this, _mapping).get(id).setAttribute("fill-opacity", opacity);
  }
  addClass(id, className) {
    __privateGet(this, _mapping).get(id).classList.add(className);
  }
  removeClass(id, className) {
    __privateGet(this, _mapping).get(id).classList.remove(className);
  }
  remove(id) {
    if (__privateGet(this, _parent2) === null) {
      return;
    }
    __privateGet(this, _mapping).get(id).remove();
    __privateGet(this, _mapping).delete(id);
  }
  destroy() {
    __privateSet(this, _parent2, null);
    for (const root of __privateGet(this, _mapping).values()) {
      root.remove();
    }
    __privateGet(this, _mapping).clear();
  }
};
var DrawLayer = _DrawLayer;
_parent2 = new WeakMap();
_id5 = new WeakMap();
_mapping = new WeakMap();
_toUpdate = new WeakMap();
_setBox = new WeakSet();
setBox_fn = function(element2, {
  x = 0,
  y = 0,
  width = 1,
  height = 1
} = {}) {
  const {
    style
  } = element2;
  style.top = `${100 * y}%`;
  style.left = `${100 * x}%`;
  style.width = `${100 * width}%`;
  style.height = `${100 * height}%`;
};
_createSVG = new WeakSet();
createSVG_fn = function(box) {
  var _a2;
  const svg = _DrawLayer._svgFactory.create(1, 1, true);
  __privateGet(this, _parent2).append(svg);
  svg.setAttribute("aria-hidden", true);
  __privateMethod(_a2 = _DrawLayer, _setBox, setBox_fn).call(_a2, svg, box);
  return svg;
};
_createClipPath = new WeakSet();
createClipPath_fn = function(defs, pathId) {
  const clipPath = _DrawLayer._svgFactory.createElement("clipPath");
  defs.append(clipPath);
  const clipPathId = `clip_${pathId}`;
  clipPath.setAttribute("id", clipPathId);
  clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
  const clipPathUse = _DrawLayer._svgFactory.createElement("use");
  clipPath.append(clipPathUse);
  clipPathUse.setAttribute("href", `#${pathId}`);
  clipPathUse.classList.add("clip");
  return clipPathId;
};
__privateAdd(DrawLayer, _setBox);
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;
var __webpack_exports__AnnotationEditorParamsType = __webpack_exports__.AnnotationEditorParamsType;
var __webpack_exports__AnnotationEditorType = __webpack_exports__.AnnotationEditorType;
var __webpack_exports__AnnotationEditorUIManager = __webpack_exports__.AnnotationEditorUIManager;
var __webpack_exports__AnnotationLayer = __webpack_exports__.AnnotationLayer;
var __webpack_exports__AnnotationMode = __webpack_exports__.AnnotationMode;
var __webpack_exports__CMapCompressionType = __webpack_exports__.CMapCompressionType;
var __webpack_exports__ColorPicker = __webpack_exports__.ColorPicker;
var __webpack_exports__DOMSVGFactory = __webpack_exports__.DOMSVGFactory;
var __webpack_exports__DrawLayer = __webpack_exports__.DrawLayer;
var __webpack_exports__FeatureTest = __webpack_exports__.FeatureTest;
var __webpack_exports__GlobalWorkerOptions = __webpack_exports__.GlobalWorkerOptions;
var __webpack_exports__ImageKind = __webpack_exports__.ImageKind;
var __webpack_exports__InvalidPDFException = __webpack_exports__.InvalidPDFException;
var __webpack_exports__MissingPDFException = __webpack_exports__.MissingPDFException;
var __webpack_exports__OPS = __webpack_exports__.OPS;
var __webpack_exports__PDFDataRangeTransport = __webpack_exports__.PDFDataRangeTransport;
var __webpack_exports__PDFDateString = __webpack_exports__.PDFDateString;
var __webpack_exports__PDFWorker = __webpack_exports__.PDFWorker;
var __webpack_exports__PasswordResponses = __webpack_exports__.PasswordResponses;
var __webpack_exports__PermissionFlag = __webpack_exports__.PermissionFlag;
var __webpack_exports__PixelsPerInch = __webpack_exports__.PixelsPerInch;
var __webpack_exports__RenderingCancelledException = __webpack_exports__.RenderingCancelledException;
var __webpack_exports__TextLayer = __webpack_exports__.TextLayer;
var __webpack_exports__UnexpectedResponseException = __webpack_exports__.UnexpectedResponseException;
var __webpack_exports__Util = __webpack_exports__.Util;
var __webpack_exports__VerbosityLevel = __webpack_exports__.VerbosityLevel;
var __webpack_exports__XfaLayer = __webpack_exports__.XfaLayer;
var __webpack_exports__build = __webpack_exports__.build;
var __webpack_exports__createValidAbsoluteUrl = __webpack_exports__.createValidAbsoluteUrl;
var __webpack_exports__fetchData = __webpack_exports__.fetchData;
var __webpack_exports__getDocument = __webpack_exports__.getDocument;
var __webpack_exports__getFilenameFromUrl = __webpack_exports__.getFilenameFromUrl;
var __webpack_exports__getPdfFilenameFromUrl = __webpack_exports__.getPdfFilenameFromUrl;
var __webpack_exports__getXfaPageViewport = __webpack_exports__.getXfaPageViewport;
var __webpack_exports__isDataScheme = __webpack_exports__.isDataScheme;
var __webpack_exports__isPdfFile = __webpack_exports__.isPdfFile;
var __webpack_exports__noContextMenu = __webpack_exports__.noContextMenu;
var __webpack_exports__normalizeUnicode = __webpack_exports__.normalizeUnicode;
var __webpack_exports__setLayerDimensions = __webpack_exports__.setLayerDimensions;
var __webpack_exports__shadow = __webpack_exports__.shadow;
var __webpack_exports__version = __webpack_exports__.version;

// 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;
}

// src/processors/pdf.worker.js
function Worker2() {
  return inlineWorker('var Rn=Object.defineProperty;var xu=Object.getOwnPropertyDescriptor;var mu=Object.getOwnPropertyNames;var pu=Object.prototype.hasOwnProperty;var wu=(e,A,t)=>A in e?Rn(e,A,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[A]=t;var yu=(e,A)=>{for(var t in A)Rn(e,t,{get:A[t],enumerable:!0})},bu=(e,A,t,i)=>{if(A&&typeof A=="object"||typeof A=="function")for(let s of mu(A))!pu.call(e,s)&&s!==t&&Rn(e,s,{get:()=>A[s],enumerable:!(i=xu(A,s))||i.enumerable});return e};var Du=e=>bu(Rn({},"__esModule",{value:!0}),e);var et=(e,A,t)=>(wu(e,typeof A!="symbol"?A+"":A,t),t),lo=(e,A,t)=>{if(!A.has(e))throw TypeError("Cannot "+t)};var ne=(e,A,t)=>(lo(e,A,"read from private field"),t?t.call(e):A.get(e)),HA=(e,A,t)=>{if(A.has(e))throw TypeError("Cannot add the same private member more than once");A instanceof WeakSet?A.add(e):A.set(e,t)},_s=(e,A,t,i)=>(lo(e,A,"write to private field"),i?i.call(e,t):A.set(e,t),t);var mA=(e,A,t)=>(lo(e,A,"access private method"),t);var Dx={};yu(Dx,{WorkerMessageHandler:()=>bx});module.exports=Du(Dx);var Ba={};Ba.d=(e,A)=>{for(var t in A)Ba.o(A,t)&&!Ba.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:A[t]})};Ba.o=(e,A)=>Object.prototype.hasOwnProperty.call(e,A);var qE=globalThis.pdfjsWorker={};Ba.d(qE,{WorkerMessageHandler:()=>H0});var ku=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Wt=[1,0,0,1,0,0],E0=[.001,0,0,.001,0,0],Su=1e7,Qi=1.35,Cr=.35,R1=Cr/Qi,st={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256};var TE="pdfjs_internal_editor_",bi={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15};var N1={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PE={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ke={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Le={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Ho={GROUP:"Group",REPLY:"R"},it={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},Te={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},Y0={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},WE={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},Fu={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},Ru={O:"PageOpen",C:"PageClose"},Da={ERRORS:0,WARNINGS:1,INFOS:5},Br={NONE:0,BINARY:1},y={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},G1={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Xg=Da.WARNINGS;function Nu(e){Number.isInteger(e)&&(Xg=e)}function Gu(){return Xg}function PA(e){Xg>=Da.INFOS&&console.log(`Info: ${e}`)}function k(e){Xg>=Da.WARNINGS&&console.log(`Warning: ${e}`)}function OA(e){throw new Error(e)}function gt(e,A){e||OA(A)}function Uu(e){switch(e==null?void 0:e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Qr(e,A=null,t=null){if(!e)return null;try{if(t&&typeof e=="string"){if(t.addDefaultProtocol&&e.startsWith("www.")){let s=e.match(/\\./g);(s==null?void 0:s.length)>=2&&(e=`http://${e}`)}if(t.tryConvertEncoding)try{e=ka(e)}catch(s){}}let i=A?new URL(e,A):new URL(e);if(Uu(i))return i}catch(i){}return null}function nA(e,A,t,i=!1){return Object.defineProperty(e,A,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}var At=function(){function A(t,i){this.message=t,this.name=i}return A.prototype=new Error,A.constructor=A,A}(),bs=class extends At{constructor(A,t){super(A,"PasswordException"),this.code=t}},Ds=class extends At{constructor(A,t){super(A,"UnknownErrorException"),this.details=t}},ks=class extends At{constructor(A){super(A,"InvalidPDFException")}},Er=class extends At{constructor(A){super(A,"MissingPDFException")}},fr=class extends At{constructor(A,t){super(A,"UnexpectedResponseException"),this.status=t}},v=class extends At{constructor(A){super(A,"FormatError")}},ve=class extends At{constructor(A){super(A,"AbortException")}};function Qt(e){(typeof e!="object"||(e==null?void 0:e.length)===void 0)&&OA("Invalid argument for bytesToString");let A=e.length,t=8192;if(A<t)return String.fromCharCode.apply(null,e);let i=[];for(let s=0;s<A;s+=t){let a=Math.min(s+t,A),n=e.subarray(s,a);i.push(String.fromCharCode.apply(null,n))}return i.join("")}function Pe(e){typeof e!="string"&&OA("Invalid argument for stringToBytes");let A=e.length,t=new Uint8Array(A);for(let i=0;i<A;++i)t[i]=e.charCodeAt(i)&255;return t}function qe(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function OE(e){return Object.keys(e).length}function Mu(){let e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function Lu(){try{return new Function(""),!0}catch(e){return!1}}var Ot=class{static get isLittleEndian(){return nA(this,"isLittleEndian",Mu())}static get isEvalSupported(){return nA(this,"isEvalSupported",Lu())}static get isOffscreenCanvasSupported(){return nA(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas!="undefined")}static get platform(){return typeof navigator!="undefined"&&typeof(navigator==null?void 0:navigator.platform)=="string"?nA(this,"platform",{isMac:navigator.platform.includes("Mac")}):nA(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var A,t;return nA(this,"isCSSRoundSupported",(t=(A=globalThis.CSS)==null?void 0:A.supports)==null?void 0:t.call(A,"width: round(1.5px, 1px)"))}},ho=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0")),Es,zn,nn,Jo,Ce=class{static makeHexColor(A,t,i){return`#${ho[A]}${ho[t]}${ho[i]}`}static scaleMinMax(A,t){let i;A[0]?(A[0]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=A[0],t[2]*=A[0],A[3]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=A[3],t[3]*=A[3]):(i=t[0],t[0]=t[1],t[1]=i,i=t[2],t[2]=t[3],t[3]=i,A[1]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=A[1],t[3]*=A[1],A[2]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=A[2],t[2]*=A[2]),t[0]+=A[4],t[1]+=A[5],t[2]+=A[4],t[3]+=A[5]}static transform(A,t){return[A[0]*t[0]+A[2]*t[1],A[1]*t[0]+A[3]*t[1],A[0]*t[2]+A[2]*t[3],A[1]*t[2]+A[3]*t[3],A[0]*t[4]+A[2]*t[5]+A[4],A[1]*t[4]+A[3]*t[5]+A[5]]}static applyTransform(A,t){let i=A[0]*t[0]+A[1]*t[2]+t[4],s=A[0]*t[1]+A[1]*t[3]+t[5];return[i,s]}static applyInverseTransform(A,t){let i=t[0]*t[3]-t[1]*t[2],s=(A[0]*t[3]-A[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,a=(-A[0]*t[1]+A[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i;return[s,a]}static getAxialAlignedBoundingBox(A,t){let i=this.applyTransform(A,t),s=this.applyTransform(A.slice(2,4),t),a=this.applyTransform([A[0],A[3]],t),n=this.applyTransform([A[2],A[1]],t);return[Math.min(i[0],s[0],a[0],n[0]),Math.min(i[1],s[1],a[1],n[1]),Math.max(i[0],s[0],a[0],n[0]),Math.max(i[1],s[1],a[1],n[1])]}static inverseTransform(A){let t=A[0]*A[3]-A[1]*A[2];return[A[3]/t,-A[1]/t,-A[2]/t,A[0]/t,(A[2]*A[5]-A[4]*A[3])/t,(A[4]*A[1]-A[5]*A[0])/t]}static singularValueDecompose2dScale(A){let t=[A[0],A[2],A[1],A[3]],i=A[0]*t[0]+A[1]*t[2],s=A[0]*t[1]+A[1]*t[3],a=A[2]*t[0]+A[3]*t[2],n=A[2]*t[1]+A[3]*t[3],r=(i+n)/2,g=Math.sqrt((i+n)**2-4*(i*n-a*s))/2,o=r+g||1,I=r-g||1;return[Math.sqrt(o),Math.sqrt(I)]}static normalizeRect(A){let t=A.slice(0);return A[0]>A[2]&&(t[0]=A[2],t[2]=A[0]),A[1]>A[3]&&(t[1]=A[3],t[3]=A[1]),t}static intersect(A,t){let i=Math.max(Math.min(A[0],A[2]),Math.min(t[0],t[2])),s=Math.min(Math.max(A[0],A[2]),Math.max(t[0],t[2]));if(i>s)return null;let a=Math.max(Math.min(A[1],A[3]),Math.min(t[1],t[3])),n=Math.min(Math.max(A[1],A[3]),Math.max(t[1],t[3]));return a>n?null:[i,a,s,n]}static bezierBoundingBox(A,t,i,s,a,n,r,g,o){return o?(o[0]=Math.min(o[0],A,r),o[1]=Math.min(o[1],t,g),o[2]=Math.max(o[2],A,r),o[3]=Math.max(o[3],t,g)):o=[Math.min(A,r),Math.min(t,g),Math.max(A,r),Math.max(t,g)],mA(this,nn,Jo).call(this,A,i,a,r,t,s,n,g,3*(-A+3*(i-a)+r),6*(A-2*i+a),3*(i-A),o),mA(this,nn,Jo).call(this,A,i,a,r,t,s,n,g,3*(-t+3*(s-n)+g),6*(t-2*s+n),3*(s-t),o),o}};Es=new WeakSet,zn=function(A,t,i,s,a,n,r,g,o,I){if(o<=0||o>=1)return;let c=1-o,l=o*o,h=l*o,C=c*(c*(c*A+3*o*t)+3*l*i)+h*s,B=c*(c*(c*a+3*o*n)+3*l*r)+h*g;I[0]=Math.min(I[0],C),I[1]=Math.min(I[1],B),I[2]=Math.max(I[2],C),I[3]=Math.max(I[3],B)},nn=new WeakSet,Jo=function(A,t,i,s,a,n,r,g,o,I,c,l){if(Math.abs(o)<1e-12){Math.abs(I)>=1e-12&&mA(this,Es,zn).call(this,A,t,i,s,a,n,r,g,-c/I,l);return}let h=I**2-4*c*o;if(h<0)return;let C=Math.sqrt(h),B=2*o;mA(this,Es,zn).call(this,A,t,i,s,a,n,r,g,(-I+C)/B,l),mA(this,Es,zn).call(this,A,t,i,s,a,n,r,g,(-I-C)/B,l)},HA(Ce,Es),HA(Ce,nn);var Hu=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function jA(e){if(e[0]>="\\xEF"){let t;if(e[0]==="\\xFE"&&e[1]==="\\xFF"?(t="utf-16be",e.length%2===1&&(e=e.slice(0,-1))):e[0]==="\\xFF"&&e[1]==="\\xFE"?(t="utf-16le",e.length%2===1&&(e=e.slice(0,-1))):e[0]==="\\xEF"&&e[1]==="\\xBB"&&e[2]==="\\xBF"&&(t="utf-8"),t)try{let i=new TextDecoder(t,{fatal:!0}),s=Pe(e),a=i.decode(s);return a.includes("\\x1B")?a.replaceAll(/\\x1b[^\\x1b]*(?:\\x1b|$)/g,""):a}catch(i){k(`stringToPDFString: "${i}".`)}}let A=[];for(let t=0,i=e.length;t<i;t++){let s=e.charCodeAt(t);if(s===27){for(;++t<i&&e.charCodeAt(t)!==27;);continue}let a=Hu[s];A.push(a?String.fromCharCode(a):e.charAt(t))}return A.join("")}function ka(e){return decodeURIComponent(escape(e))}function Yo(e){return unescape(encodeURIComponent(e))}function Ss(e,A){if(e.length!==A.length)return!1;for(let t=0,i=e.length;t<i;t++)if(e[t]!==A[t])return!1;return!0}function Zi(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")}var Co=null,U1=null;function Ju(e){return Co||(Co=/([\\u00a0\\u00b5\\u037e\\u0eb3\\u2000-\\u200a\\u202f\\u2126\\ufb00-\\ufb04\\ufb06\\ufb20-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufba1\\ufba4-\\ufba9\\ufbae-\\ufbb1\\ufbd3-\\ufbdc\\ufbde-\\ufbe7\\ufbea-\\ufbf8\\ufbfc-\\ufbfd\\ufc00-\\ufc5d\\ufc64-\\ufcf1\\ufcf5-\\ufd3d\\ufd88\\ufdf4\\ufdfa-\\ufdfb\\ufe71\\ufe77\\ufe79\\ufe7b\\ufe7d]+)|(\\ufb05+)/gu,U1=new Map([["\\uFB05","\\u017Ft"]])),e.replaceAll(Co,(A,t,i)=>t?t.normalize("NFKC"):U1.get(i))}var Yu="pdfjs_internal_id_",_e={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8},Ku=Symbol("CIRCULAR_REF"),Ge=Symbol("EOF"),$n=Object.create(null),Ar=Object.create(null),W0=Object.create(null);function vu(){$n=Object.create(null),Ar=Object.create(null),W0=Object.create(null)}var M=class{constructor(A){this.name=A}static get(A){return Ar[A]||(Ar[A]=new M(A))}},fe=class{constructor(A){this.cmd=A}static get(A){return $n[A]||($n[A]=new fe(A))}},ZE=function(){return ZE},F=class{constructor(A=null){this._map=Object.create(null),this.xref=A,this.objId=null,this.suppressEncryption=!1,this.__nonSerializable__=ZE}assignXref(A){this.xref=A}get size(){return Object.keys(this._map).length}get(A,t,i){let s=this._map[A];return s===void 0&&t!==void 0&&(s=this._map[t],s===void 0&&i!==void 0&&(s=this._map[i])),s instanceof oA&&this.xref?this.xref.fetch(s,this.suppressEncryption):s}async getAsync(A,t,i){let s=this._map[A];return s===void 0&&t!==void 0&&(s=this._map[t],s===void 0&&i!==void 0&&(s=this._map[i])),s instanceof oA&&this.xref?this.xref.fetchAsync(s,this.suppressEncryption):s}getArray(A,t,i){let s=this._map[A];if(s===void 0&&t!==void 0&&(s=this._map[t],s===void 0&&i!==void 0&&(s=this._map[i])),s instanceof oA&&this.xref&&(s=this.xref.fetch(s,this.suppressEncryption)),Array.isArray(s)){s=s.slice();for(let a=0,n=s.length;a<n;a++)s[a]instanceof oA&&this.xref&&(s[a]=this.xref.fetch(s[a],this.suppressEncryption))}return s}getRaw(A){return this._map[A]}getKeys(){return Object.keys(this._map)}getRawValues(){return Object.values(this._map)}set(A,t){this._map[A]=t}has(A){return this._map[A]!==void 0}forEach(A){for(let t in this._map)A(t,this.get(t))}static get empty(){let A=new F(null);return A.set=(t,i)=>{OA("Should not call `set` on the empty dictionary.")},nA(this,"empty",A)}static merge({xref:A,dictArray:t,mergeSubDicts:i=!1}){let s=new F(A),a=new Map;for(let n of t)if(n instanceof F)for(let[r,g]of Object.entries(n._map)){let o=a.get(r);if(o===void 0)o=[],a.set(r,o);else if(!i||!(g instanceof F))continue;o.push(g)}for(let[n,r]of a){if(r.length===1||!(r[0]instanceof F)){s._map[n]=r[0];continue}let g=new F(A);for(let o of r)for(let[I,c]of Object.entries(o._map))g._map[I]===void 0&&(g._map[I]=c);g.size>0&&(s._map[n]=g)}return a.clear(),s.size>0?s:F.empty}clone(){let A=new F(this.xref);for(let t of this.getKeys())A.set(t,this.getRaw(t));return A}delete(A){delete this._map[A]}},oA=class{constructor(A,t){this.num=A,this.gen=t}toString(){return this.gen===0?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(A){let t=W0[A];if(t)return t;let i=/^(\\d+)R(\\d*)$/.exec(A);return!i||i[1]==="0"?null:W0[A]=new oA(parseInt(i[1]),i[2]?parseInt(i[2]):0)}static get(A,t){let i=t===0?`${A}R`:`${A}R${t}`;return W0[i]||(W0[i]=new oA(A,t))}},be=class{constructor(A=null){this._set=new Set(A==null?void 0:A._set)}has(A){return this._set.has(A.toString())}put(A){this._set.add(A.toString())}remove(A){this._set.delete(A.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}},mt=class{constructor(){this._map=new Map}get size(){return this._map.size}get(A){return this._map.get(A.toString())}has(A){return this._map.has(A.toString())}put(A,t){this._map.set(A.toString(),t)}putAlias(A,t){this._map.set(A.toString(),this.get(t))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(let[A,t]of this._map)yield[oA.fromString(A),t]}};function ye(e,A){return e instanceof M&&(A===void 0||e.name===A)}function Ne(e,A){return e instanceof fe&&(A===void 0||e.cmd===A)}function jE(e,A){return e instanceof F&&(A===void 0||ye(e.get("Type"),A))}function ur(e,A){return e.num===A.num&&e.gen===A.gen}var KA=class{get length(){OA("Abstract getter `length` accessed")}get isEmpty(){OA("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return nA(this,"isDataLoaded",!0)}getByte(){OA("Abstract method `getByte` called")}getBytes(A){OA("Abstract method `getBytes` called")}async getImageData(A,t){return this.getBytes(A,t)}async asyncGetBytes(){OA("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}peekByte(){let A=this.getByte();return A!==-1&&this.pos--,A}peekBytes(A){let t=this.getBytes(A);return this.pos-=t.length,t}getUint16(){let A=this.getByte(),t=this.getByte();return A===-1||t===-1?-1:(A<<8)+t}getInt32(){let A=this.getByte(),t=this.getByte(),i=this.getByte(),s=this.getByte();return(A<<24)+(t<<16)+(i<<8)+s}getByteRange(A,t){OA("Abstract method `getByteRange` called")}getString(A){return Qt(this.getBytes(A))}skip(A){this.pos+=A||1}reset(){OA("Abstract method `reset` called")}moveStart(){OA("Abstract method `moveStart` called")}makeSubStream(A,t,i=null){OA("Abstract method `makeSubStream` called")}getBaseStreams(){return null}},XE=/^[1-9]\\.\\d$/;function he(e){let A;return function(){return e&&(A=Object.create(null),e(A),e=null),A}}var ge=class extends At{constructor(A,t){super(`Missing data [${A}, ${t})`,"MissingDataException"),this.begin=A,this.end=t}},Sa=class extends At{constructor(A){super(A,"ParserEOFException")}},ti=class extends At{constructor(A){super(A,"XRefEntryException")}},Pi=class extends At{constructor(A){super(A,"XRefParseException")}};function VE(e){let A=e.length;if(A===0)return new Uint8Array(0);if(A===1)return new Uint8Array(e[0]);let t=0;for(let a=0;a<A;a++)t+=e[a].byteLength;let i=new Uint8Array(t),s=0;for(let a=0;a<A;a++){let n=new Uint8Array(e[a]);i.set(n,s),s+=n.byteLength}return i}function Mt({dict:e,key:A,getArray:t=!1,stopWhenFound:i=!0}){let s,a=new be;for(;e instanceof F&&!(e.objId&&a.has(e.objId));){e.objId&&a.put(e.objId);let n=t?e.getArray(A):e.get(A);if(n!==void 0){if(i)return n;(s||(s=[])).push(n)}e=e.get("Parent")}return s}var Bo=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"];function qu(e,A=!1){gt(Number.isInteger(e)&&e>0,"The number should be a positive integer.");let t=[],i;for(;e>=1e3;)e-=1e3,t.push("M");i=e/100|0,e%=100,t.push(Bo[i]),i=e/10|0,e%=10,t.push(Bo[10+i]),t.push(Bo[20+e]);let s=t.join("");return A?s.toLowerCase():s}function g1(e){return e<=0?0:Math.ceil(Math.log2(e))}function Di(e,A){return e[A]<<24>>24}function we(e,A){return e[A]<<8|e[A+1]}function le(e,A){return(e[A]<<24|e[A+1]<<16|e[A+2]<<8|e[A+3])>>>0}function pt(e){return e===32||e===9||e===13||e===10}function Tu(e,A){return Array.isArray(e)&&(A===null||e.length===A)&&e.every(t=>typeof t=="boolean")}function wt(e,A){return Array.isArray(e)?(A===null||e.length===A)&&e.every(t=>typeof t=="number"):ArrayBuffer.isView(e)&&(e.length===0||typeof e[0]=="number")&&(A===null||e.length===A)}function Ki(e,A){return wt(e,6)?e:A}function Ko(e,A){return wt(e,4)?e:A}function Ei(e,A){return wt(e,4)?Ce.normalizeRect(e):A}function _E(e){let A=/(.+)\\[(\\d+)\\]$/;return e.split(".").map(t=>{let i=t.match(A);return i?{name:i[1],pos:parseInt(i[2],10)}:{name:t,pos:0}})}function o1(e){let A=[],t=0;for(let i=0,s=e.length;i<s;i++){let a=e.charCodeAt(i);(a<33||a>126||a===35||a===40||a===41||a===60||a===62||a===91||a===93||a===123||a===125||a===47||a===37)&&(t<i&&A.push(e.substring(t,i)),A.push(`#${a.toString(16)}`),t=i+1)}return A.length===0?e:(t<e.length&&A.push(e.substring(t,e.length)),A.join(""))}function Fs(e){return e.replaceAll(/([()\\\\\\n\\r])/g,A=>A===`\n`?"\\\\n":A==="\\r"?"\\\\r":`\\\\${A}`)}function dr(e,A,t,i){if(!e)return;let s=null;if(e instanceof oA){if(i.has(e))return;s=e,i.put(s),e=A.fetch(e)}if(Array.isArray(e))for(let a of e)dr(a,A,t,i);else if(e instanceof F){if(ye(e.get("S"),"JavaScript")){let a=e.get("JS"),n;a instanceof KA?n=a.getString():typeof a=="string"&&(n=a),n&&(n=jA(n).replaceAll("\\0","")),n&&t.push(n)}dr(e.getRaw("Next"),A,t,i)}s&&i.remove(s)}function Vg(e,A,t){let i=Object.create(null),s=Mt({dict:A,key:"AA",stopWhenFound:!1});if(s)for(let a=s.length-1;a>=0;a--){let n=s[a];if(n instanceof F)for(let r of n.getKeys()){let g=t[r];if(!g)continue;let o=n.getRaw(r),I=new be,c=[];dr(o,e,c,I),c.length>0&&(i[g]=c)}}if(A.has("A")){let a=A.get("A"),n=new be,r=[];dr(a,e,r,n),r.length>0&&(i.Action=r)}return OE(i)>0?i:null}var Pu={60:"&lt;",62:"&gt;",38:"&amp;",34:"&quot;",39:"&apos;"};function*Wu(e){for(let A=0,t=e.length;A<t;A++){let i=e.codePointAt(A);i>55295&&(i<57344||i>65533)&&A++,yield i}}function ls(e){let A=[],t=0;for(let i=0,s=e.length;i<s;i++){let a=e.codePointAt(i);if(32<=a&&a<=126){let n=Pu[a];n&&(t<i&&A.push(e.substring(t,i)),A.push(n),t=i+1)}else t<i&&A.push(e.substring(t,i)),A.push(`&#x${a.toString(16).toUpperCase()};`),a>55295&&(a<57344||a>65533)&&i++,t=i+1}return A.length===0?e:(t<e.length&&A.push(e.substring(t,e.length)),A.join(""))}function vo(e,A=!1){let t=/^("|\').*("|\')$/.exec(e);if(t&&t[1]===t[2]){if(new RegExp(`[^\\\\\\\\]${t[1]}`).test(e.slice(1,-1)))return A&&k(`FontFamily contains unescaped ${t[1]}: ${e}.`),!1}else for(let i of e.split(/[ \\t]+/))if(/^(\\d|(-(\\d|-)))/.test(i)||!/^[\\w-\\\\]+$/.test(i))return A&&k(`FontFamily contains invalid <custom-ident>: ${e}.`),!1;return!0}function Ou(e){let A="14",t="400",i=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:s,fontWeight:a,italicAngle:n}=e;if(!vo(s,!0))return!1;let r=a?a.toString():"";e.fontWeight=i.has(r)?r:t;let g=parseFloat(n);return e.italicAngle=isNaN(g)||g<-90||g>90?A:n.toString(),!0}function zE(e){let A=["app.launchURL","window.open","xfa.host.gotoURL"],i=new RegExp("^\\\\s*("+A.join("|").replaceAll(".","\\\\.")+`)\\\\((?:\'|")([^\'"]*)(?:\'|")(?:,\\\\s*(\\\\w+)\\\\)|\\\\))`,"i").exec(e);if(i!=null&&i[2]){let s=i[2],a=!1;return i[3]==="true"&&i[1]==="app.launchURL"&&(a=!0),{url:s,newWindow:a}}return null}function Ae(e){if(Number.isInteger(e))return e.toString();let A=Math.round(e*100);return A%100===0?(A/100).toString():A%10===0?e.toFixed(1):e.toFixed(2)}function $E(e){if(!e)return null;let A=new Map;for(let[t,i]of e){if(!t.startsWith(TE))continue;let s=A.get(i.pageIndex);s||(s=[],A.set(i.pageIndex,s)),s.push(i)}return A.size>0?A:null}function ii(e){return Zu(e)?e:Af(e,!0)}function Zu(e){return/^[\\x00-\\x7F]*$/.test(e)}function ju(e){let A=[];for(let t=0,i=e.length;t<i;t++){let s=e.charCodeAt(t);A.push((s>>8&255).toString(16).padStart(2,"0"),(s&255).toString(16).padStart(2,"0"))}return A.join("")}function Af(e,A=!1){let t=[];A&&t.push("\\xFE\\xFF");for(let i=0,s=e.length;i<s;i++){let a=e.charCodeAt(i);t.push(String.fromCharCode(a>>8&255),String.fromCharCode(a&255))}return t.join("")}function xr(e,A,t){switch(e){case 90:return[0,1,-1,0,A,0];case 180:return[-1,0,0,-1,A,t];case 270:return[0,-1,1,0,0,t];default:throw new Error("Invalid rotation")}}function M1(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}var Ie=class extends KA{constructor(A,t,i,s){super(),this.bytes=A instanceof Uint8Array?A:new Uint8Array(A),this.start=t||0,this.pos=this.start,this.end=t+i||this.bytes.length,this.dict=s}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(A){let t=this.bytes,i=this.pos,s=this.end;if(!A)return t.subarray(i,s);let a=i+A;return a>s&&(a=s),this.pos=a,t.subarray(i,a)}getByteRange(A,t){return A<0&&(A=0),t>this.end&&(t=this.end),this.bytes.subarray(A,t)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(A,t,i=null){return new Ie(this.bytes.buffer,A,t,i)}},It=class extends Ie{constructor(A){super(Pe(A))}},Rs=class extends Ie{constructor(){super(new Uint8Array(0))}},qo=class extends Ie{constructor(A,t,i){super(new Uint8Array(A),0,A,null),this.chunkSize=t,this._loadedChunks=new Set,this.numChunks=Math.ceil(A/t),this.manager=i,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){let A=[];for(let t=0,i=this.numChunks;t<i;++t)this._loadedChunks.has(t)||A.push(t);return A}get numChunksLoaded(){return this._loadedChunks.size}get isDataLoaded(){return this.numChunksLoaded===this.numChunks}onReceiveData(A,t){let i=this.chunkSize;if(A%i!==0)throw new Error(`Bad begin offset: ${A}`);let s=A+t.byteLength;if(s%i!==0&&s!==this.bytes.length)throw new Error(`Bad end offset: ${s}`);this.bytes.set(new Uint8Array(t),A);let a=Math.floor(A/i),n=Math.floor((s-1)/i)+1;for(let r=a;r<n;++r)this._loadedChunks.add(r)}onReceiveProgressiveData(A){let t=this.progressiveDataLength,i=Math.floor(t/this.chunkSize);this.bytes.set(new Uint8Array(A),t),t+=A.byteLength,this.progressiveDataLength=t;let s=t>=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let a=i;a<s;++a)this._loadedChunks.add(a)}ensureByte(A){if(A<this.progressiveDataLength)return;let t=Math.floor(A/this.chunkSize);if(!(t>this.numChunks)&&t!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new ge(A,A+1);this.lastSuccessfulEnsureByteChunk=t}}ensureRange(A,t){if(A>=t||t<=this.progressiveDataLength)return;let i=Math.floor(A/this.chunkSize);if(i>this.numChunks)return;let s=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let a=i;a<s;++a)if(!this._loadedChunks.has(a))throw new ge(A,t)}nextEmptyChunk(A){let t=this.numChunks;for(let i=0;i<t;++i){let s=(A+i)%t;if(!this._loadedChunks.has(s))return s}return null}hasChunk(A){return this._loadedChunks.has(A)}getByte(){let A=this.pos;return A>=this.end?-1:(A>=this.progressiveDataLength&&this.ensureByte(A),this.bytes[this.pos++])}getBytes(A){let t=this.bytes,i=this.pos,s=this.end;if(!A)return s>this.progressiveDataLength&&this.ensureRange(i,s),t.subarray(i,s);let a=i+A;return a>s&&(a=s),a>this.progressiveDataLength&&this.ensureRange(i,a),this.pos=a,t.subarray(i,a)}getByteRange(A,t){return A<0&&(A=0),t>this.end&&(t=this.end),t>this.progressiveDataLength&&this.ensureRange(A,t),this.bytes.subarray(A,t)}makeSubStream(A,t,i=null){t?A+t>this.progressiveDataLength&&this.ensureRange(A,A+t):A>=this.progressiveDataLength&&this.ensureByte(A);function s(){}s.prototype=Object.create(this),s.prototype.getMissingChunks=function(){let n=this.chunkSize,r=Math.floor(this.start/n),g=Math.floor((this.end-1)/n)+1,o=[];for(let I=r;I<g;++I)this._loadedChunks.has(I)||o.push(I);return o},Object.defineProperty(s.prototype,"isDataLoaded",{get(){return this.numChunksLoaded===this.numChunks?!0:this.getMissingChunks().length===0},configurable:!0});let a=new s;return a.pos=a.start=A,a.end=A+t||this.end,a.dict=i,a}getBaseStreams(){return[this]}},To=class{constructor(A,t){this.length=t.length,this.chunkSize=t.rangeChunkSize,this.stream=new qo(this.length,this.chunkSize,this),this.pdfNetworkStream=A,this.disableAutoFetch=t.disableAutoFetch,this.msgHandler=t.msgHandler,this.currRequestId=0,this._chunksNeededByRequest=new Map,this._requestsByChunk=new Map,this._promisesByRequest=new Map,this.progressiveDataLength=0,this.aborted=!1,this._loadedStreamCapability=Promise.withResolvers()}sendRequest(A,t){let i=this.pdfNetworkStream.getRangeReader(A,t);i.isStreamingSupported||(i.onProgress=this.onProgress.bind(this));let s=[],a=0;return new Promise((n,r)=>{let g=({value:o,done:I})=>{try{if(I){let c=VE(s);s=null,n(c);return}a+=o.byteLength,i.isStreamingSupported&&this.onProgress({loaded:a}),s.push(o),i.read().then(g,r)}catch(c){r(c)}};i.read().then(g,r)}).then(n=>{this.aborted||this.onReceiveData({chunk:n,begin:A})})}requestAllChunks(A=!1){if(!A){let t=this.stream.getMissingChunks();this._requestChunks(t)}return this._loadedStreamCapability.promise}_requestChunks(A){let t=this.currRequestId++,i=new Set;this._chunksNeededByRequest.set(t,i);for(let n of A)this.stream.hasChunk(n)||i.add(n);if(i.size===0)return Promise.resolve();let s=Promise.withResolvers();this._promisesByRequest.set(t,s);let a=[];for(let n of i){let r=this._requestsByChunk.get(n);r||(r=[],this._requestsByChunk.set(n,r),a.push(n)),r.push(t)}if(a.length>0){let n=this.groupChunks(a);for(let r of n){let g=r.beginChunk*this.chunkSize,o=Math.min(r.endChunk*this.chunkSize,this.length);this.sendRequest(g,o).catch(s.reject)}}return s.promise.catch(n=>{if(!this.aborted)throw n})}getStream(){return this.stream}requestRange(A,t){t=Math.min(t,this.length);let i=this.getBeginChunk(A),s=this.getEndChunk(t),a=[];for(let n=i;n<s;++n)a.push(n);return this._requestChunks(a)}requestRanges(A=[]){let t=[];for(let i of A){let s=this.getBeginChunk(i.begin),a=this.getEndChunk(i.end);for(let n=s;n<a;++n)t.includes(n)||t.push(n)}return t.sort(function(i,s){return i-s}),this._requestChunks(t)}groupChunks(A){let t=[],i=-1,s=-1;for(let a=0,n=A.length;a<n;++a){let r=A[a];i<0&&(i=r),s>=0&&s+1!==r&&(t.push({beginChunk:i,endChunk:s+1}),i=r),a+1===A.length&&t.push({beginChunk:i,endChunk:r+1}),s=r}return t}onProgress(A){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+A.loaded,total:this.length})}onReceiveData(A){let t=A.chunk,i=A.begin===void 0,s=i?this.progressiveDataLength:A.begin,a=s+t.byteLength,n=Math.floor(s/this.chunkSize),r=a<this.length?Math.floor(a/this.chunkSize):Math.ceil(a/this.chunkSize);i?(this.stream.onReceiveProgressiveData(t),this.progressiveDataLength=a):this.stream.onReceiveData(s,t),this.stream.isDataLoaded&&this._loadedStreamCapability.resolve(this.stream);let g=[];for(let o=n;o<r;++o){let I=this._requestsByChunk.get(o);if(I){this._requestsByChunk.delete(o);for(let c of I){let l=this._chunksNeededByRequest.get(c);l.has(o)&&l.delete(o),!(l.size>0)&&g.push(c)}}}if(!this.disableAutoFetch&&this._requestsByChunk.size===0){let o;if(this.stream.numChunksLoaded===1){let I=this.stream.numChunks-1;this.stream.hasChunk(I)||(o=I)}else o=this.stream.nextEmptyChunk(r);Number.isInteger(o)&&this._requestChunks([o])}for(let o of g){let I=this._promisesByRequest.get(o);this._promisesByRequest.delete(o),I.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(A){this._loadedStreamCapability.reject(A)}getBeginChunk(A){return Math.floor(A/this.chunkSize)}getEndChunk(A){return Math.floor((A-1)/this.chunkSize)+1}abort(A){var t;this.aborted=!0,(t=this.pdfNetworkStream)==null||t.cancelAllRequests(A);for(let i of this._promisesByRequest.values())i.reject(A)}};function Xu(e,A,t,i,s,a,n){n=n!==1?0:n;let g=t/s,o=i/a,I=0,c,l=new Uint16Array(s),h=t*3;for(let C=0;C<s;C++)l[C]=Math.floor(C*g)*3;for(let C=0;C<a;C++){let B=Math.floor(C*o)*h;for(let Q=0;Q<s;Q++)c=B+l[Q],A[I++]=e[c++],A[I++]=e[c++],A[I++]=e[c++],I+=n}}var JA=class{constructor(A,t){this.name=A,this.numComps=t}getRgb(A,t){let i=new Uint8ClampedArray(3);return this.getRgbItem(A,t,i,0),i}getRgbItem(A,t,i,s){OA("Should not call ColorSpace.getRgbItem")}getRgbBuffer(A,t,i,s,a,n,r){OA("Should not call ColorSpace.getRgbBuffer")}getOutputLength(A,t){OA("Should not call ColorSpace.getOutputLength")}isPassthrough(A){return!1}isDefaultDecode(A,t){return JA.isDefaultDecode(A,this.numComps)}fillRgb(A,t,i,s,a,n,r,g,o){let I=t*i,c=null,l=1<<r,h=i!==a||t!==s;if(this.isPassthrough(r))c=g;else if(this.numComps===1&&I>l&&this.name!=="DeviceGray"&&this.name!=="DeviceRGB"){let C=r<=8?new Uint8Array(l):new Uint16Array(l);for(let Q=0;Q<l;Q++)C[Q]=Q;let B=new Uint8ClampedArray(l*3);if(this.getRgbBuffer(C,0,l,B,0,r,0),h){c=new Uint8Array(I*3);let Q=0;for(let E=0;E<I;++E){let f=g[E]*3;c[Q++]=B[f],c[Q++]=B[f+1],c[Q++]=B[f+2]}}else{let Q=0;for(let E=0;E<I;++E){let f=g[E]*3;A[Q++]=B[f],A[Q++]=B[f+1],A[Q++]=B[f+2],Q+=o}}}else h?(c=new Uint8ClampedArray(I*3),this.getRgbBuffer(g,0,I,c,0,r,0)):this.getRgbBuffer(g,0,s*n,A,0,r,o);if(c)if(h)Xu(c,A,t,i,s,a,o);else{let C=0,B=0;for(let Q=0,E=s*n;Q<E;Q++)A[C++]=c[B++],A[C++]=c[B++],A[C++]=c[B++],C+=o}}get usesZeroToOneRange(){return nA(this,"usesZeroToOneRange",!0)}static _cache(A,t,i,s){if(!i)throw new Error(\'ColorSpace._cache - expected "localColorSpaceCache" argument.\');if(!s)throw new Error(\'ColorSpace._cache - expected "parsedColorSpace" argument.\');let a,n;A instanceof oA&&(n=A,A=t.fetch(A)),A instanceof M&&(a=A.name),(a||n)&&i.set(a,n,s)}static getCached(A,t,i){if(!i)throw new Error(\'ColorSpace.getCached - expected "localColorSpaceCache" argument.\');if(A instanceof oA){let s=i.getByRef(A);if(s)return s;try{A=t.fetch(A)}catch(a){if(a instanceof ge)throw a}}if(A instanceof M){let s=i.getByName(A.name);if(s)return s}return null}static async parseAsync({cs:A,xref:t,resources:i=null,pdfFunctionFactory:s,localColorSpaceCache:a}){let n=this._parse(A,t,i,s);return this._cache(A,t,a,n),n}static parse({cs:A,xref:t,resources:i=null,pdfFunctionFactory:s,localColorSpaceCache:a}){let n=this.getCached(A,t,a);if(n)return n;let r=this._parse(A,t,i,s);return this._cache(A,t,a,r),r}static _parse(A,t,i=null,s){if(A=t.fetchIfRef(A),A instanceof M)switch(A.name){case"G":case"DeviceGray":return this.singletons.gray;case"RGB":case"DeviceRGB":return this.singletons.rgb;case"DeviceRGBA":return this.singletons.rgba;case"CMYK":case"DeviceCMYK":return this.singletons.cmyk;case"Pattern":return new mr(null);default:if(i instanceof F){let a=i.get("ColorSpace");if(a instanceof F){let n=a.get(A.name);if(n){if(n instanceof M)return this._parse(n,t,i,s);A=n;break}}}return k(`Unrecognized ColorSpace: ${A.name}`),this.singletons.gray}if(Array.isArray(A)){let a=t.fetchIfRef(A[0]).name,n,r,g,o,I,c;switch(a){case"G":case"DeviceGray":return this.singletons.gray;case"RGB":case"DeviceRGB":return this.singletons.rgb;case"CMYK":case"DeviceCMYK":return this.singletons.cmyk;case"CalGray":return n=t.fetchIfRef(A[1]),o=n.getArray("WhitePoint"),I=n.getArray("BlackPoint"),c=n.get("Gamma"),new _o(o,I,c);case"CalRGB":n=t.fetchIfRef(A[1]),o=n.getArray("WhitePoint"),I=n.getArray("BlackPoint"),c=n.getArray("Gamma");let l=n.getArray("Matrix");return new vt(o,I,c,l);case"ICCBased":let C=t.fetchIfRef(A[1]).dict;r=C.get("N");let B=C.get("Alternate");if(B){let x=this._parse(B,t,i,s);if(x.numComps===r)return x;k("ICCBased color space: Ignoring incorrect /Alternate entry.")}if(r===1)return this.singletons.gray;if(r===3)return this.singletons.rgb;if(r===4)return this.singletons.cmyk;break;case"Pattern":return g=A[1]||null,g&&(g=this._parse(g,t,i,s)),new mr(g);case"I":case"Indexed":g=this._parse(A[1],t,i,s);let Q=t.fetchIfRef(A[2])+1,E=t.fetchIfRef(A[3]);return new Wo(g,Q,E);case"Separation":case"DeviceN":let f=t.fetchIfRef(A[1]);r=Array.isArray(f)?f.length:1,g=this._parse(A[2],t,i,s);let u=s.create(A[3]);return new Po(r,g,u);case"Lab":n=t.fetchIfRef(A[1]),o=n.getArray("WhitePoint"),I=n.getArray("BlackPoint");let d=n.getArray("Range");return new AI(o,I,d);default:return k(`Unimplemented ColorSpace object: ${a}`),this.singletons.gray}}return k(`Unrecognized ColorSpace object: ${A}`),this.singletons.gray}static isDefaultDecode(A,t){if(!Array.isArray(A))return!0;if(t*2!==A.length)return k("The decode map is not the correct length"),!0;for(let i=0,s=A.length;i<s;i+=2)if(A[i]!==0||A[i+1]!==1)return!1;return!0}static get singletons(){return nA(this,"singletons",{get gray(){return nA(this,"gray",new Oo)},get rgb(){return nA(this,"rgb",new Zo)},get rgba(){return nA(this,"rgba",new jo)},get cmyk(){return nA(this,"cmyk",new Xo)}})}},Po=class extends JA{constructor(A,t,i){super("Alternate",A),this.base=t,this.tintFn=i,this.tmpBuf=new Float32Array(t.numComps)}getRgbItem(A,t,i,s){let a=this.tmpBuf;this.tintFn(A,t,a,0),this.base.getRgbItem(a,0,i,s)}getRgbBuffer(A,t,i,s,a,n,r){let g=this.tintFn,o=this.base,I=1/((1<<n)-1),c=o.numComps,l=o.usesZeroToOneRange,h=(o.isPassthrough(8)||!l)&&r===0,C=h?a:0,B=h?s:new Uint8ClampedArray(c*i),Q=this.numComps,E=new Float32Array(Q),f=new Float32Array(c),u,d;for(u=0;u<i;u++){for(d=0;d<Q;d++)E[d]=A[t++]*I;if(g(E,0,f,0),l)for(d=0;d<c;d++)B[C++]=f[d]*255;else o.getRgbItem(f,0,B,C),C+=c}h||o.getRgbBuffer(B,0,i,s,a,8,r)}getOutputLength(A,t){return this.base.getOutputLength(A*this.base.numComps/this.numComps,t)}},mr=class extends JA{constructor(A){super("Pattern",null),this.base=A}isDefaultDecode(A,t){OA("Should not call PatternCS.isDefaultDecode")}},Wo=class extends JA{constructor(A,t,i){super("Indexed",1),this.base=A,this.highVal=t;let s=A.numComps*t;if(this.lookup=new Uint8Array(s),i instanceof KA){let a=i.getBytes(s);this.lookup.set(a)}else if(typeof i=="string")for(let a=0;a<s;++a)this.lookup[a]=i.charCodeAt(a)&255;else throw new v(`IndexedCS - unrecognized lookup table: ${i}`)}getRgbItem(A,t,i,s){let a=this.base.numComps,n=A[t]*a;this.base.getRgbBuffer(this.lookup,n,1,i,s,8,0)}getRgbBuffer(A,t,i,s,a,n,r){let g=this.base,o=g.numComps,I=g.getOutputLength(o,r),c=this.lookup;for(let l=0;l<i;++l){let h=A[t++]*o;g.getRgbBuffer(c,h,1,s,a,8,r),a+=I}}getOutputLength(A,t){return this.base.getOutputLength(A*this.base.numComps,t)}isDefaultDecode(A,t){return Array.isArray(A)?A.length!==2?(k("Decode map length is not correct"),!0):!Number.isInteger(t)||t<1?(k("Bits per component is not correct"),!0):A[0]===0&&A[1]===(1<<t)-1:!0}},Oo=class extends JA{constructor(){super("DeviceGray",1)}getRgbItem(A,t,i,s){let a=A[t]*255;i[s]=i[s+1]=i[s+2]=a}getRgbBuffer(A,t,i,s,a,n,r){let g=255/((1<<n)-1),o=t,I=a;for(let c=0;c<i;++c){let l=g*A[o++];s[I++]=l,s[I++]=l,s[I++]=l,I+=r}}getOutputLength(A,t){return A*(3+t)}},Zo=class extends JA{constructor(){super("DeviceRGB",3)}getRgbItem(A,t,i,s){i[s]=A[t]*255,i[s+1]=A[t+1]*255,i[s+2]=A[t+2]*255}getRgbBuffer(A,t,i,s,a,n,r){if(n===8&&r===0){s.set(A.subarray(t,t+i*3),a);return}let g=255/((1<<n)-1),o=t,I=a;for(let c=0;c<i;++c)s[I++]=g*A[o++],s[I++]=g*A[o++],s[I++]=g*A[o++],I+=r}getOutputLength(A,t){return A*(3+t)/3|0}isPassthrough(A){return A===8}},jo=class extends JA{constructor(){super("DeviceRGBA",4)}getOutputLength(A,t){return A*4}isPassthrough(A){return A===8}},rn,Vo,Xo=class extends JA{constructor(){super("DeviceCMYK",4);HA(this,rn)}getRgbItem(t,i,s,a){mA(this,rn,Vo).call(this,t,i,1,s,a)}getRgbBuffer(t,i,s,a,n,r,g){let o=1/((1<<r)-1);for(let I=0;I<s;I++)mA(this,rn,Vo).call(this,t,i,o,a,n),i+=4,n+=3+g}getOutputLength(t,i){return t/4*(3+i)|0}};rn=new WeakSet,Vo=function(t,i,s,a,n){let r=t[i]*s,g=t[i+1]*s,o=t[i+2]*s,I=t[i+3]*s;a[n]=255+r*(-4.387332384609988*r+54.48615194189176*g+18.82290502165302*o+212.25662451639585*I+-285.2331026137004)+g*(1.7149763477362134*g-5.6096736904047315*o+-17.873870861415444*I-5.497006427196366)+o*(-2.5217340131683033*o-21.248923337353073*I+17.5119270841813)+I*(-21.86122147463605*I-189.48180835922747),a[n+1]=255+r*(8.841041422036149*r+60.118027045597366*g+6.871425592049007*o+31.159100130055922*I+-79.2970844816548)+g*(-15.310361306967817*g+17.575251261109482*o+131.35250912493976*I-190.9453302588951)+o*(4.444339102852739*o+9.8632861493405*I-24.86741582555878)+I*(-20.737325471181034*I-187.80453709719578),a[n+2]=255+r*(.8842522430003296*r+8.078677503112928*g+30.89978309703729*o-.23883238689178934*I+-14.183576799673286)+g*(10.49593273432072*g+63.02378494754052*o+50.606957656360734*I-112.23884253719248)+o*(.03296041114873217*o+115.60384449646641*I+-193.58209356861505)+I*(-22.33816807309886*I-180.12613974708367)};var gn,zo,_o=class extends JA{constructor(t,i,s){super("CalGray",1);HA(this,gn);if(!t)throw new v("WhitePoint missing - required for color space CalGray");if([this.XW,this.YW,this.ZW]=t,[this.XB,this.YB,this.ZB]=i||[0,0,0],this.G=s||1,this.XW<0||this.ZW<0||this.YW!==1)throw new v(`Invalid WhitePoint components for ${this.name}, no fallback available`);(this.XB<0||this.YB<0||this.ZB<0)&&(PA(`Invalid BlackPoint for ${this.name}, falling back to default.`),this.XB=this.YB=this.ZB=0),(this.XB!==0||this.YB!==0||this.ZB!==0)&&k(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ZB: ${this.ZB}, only default values are supported.`),this.G<1&&(PA(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`),this.G=1)}getRgbItem(t,i,s,a){mA(this,gn,zo).call(this,t,i,s,a,1)}getRgbBuffer(t,i,s,a,n,r,g){let o=1/((1<<r)-1);for(let I=0;I<s;++I)mA(this,gn,zo).call(this,t,i,a,n,o),i+=1,n+=3+g}getOutputLength(t,i){return t*(3+i)}};gn=new WeakSet,zo=function(t,i,s,a,n){let g=(t[i]*n)**this.G,o=this.YW*g,I=Math.max(295.8*o**.3333333333333333-40.8,0);s[a]=I,s[a+1]=I,s[a+2]=I};var on,In,bg,Dg,cn,fs,ln,kg,Li,O0,Sg,ef,Fg,tf,us,er,Hi,Z0,Ji,j0,Rg,sf,Ng,af,Gg,nf,hn,$o,je=class extends JA{constructor(t,i,s,a){super("CalRGB",3);HA(this,Li);HA(this,Sg);HA(this,Fg);HA(this,us);HA(this,Hi);HA(this,Ji);HA(this,Rg);HA(this,Ng);HA(this,Gg);HA(this,hn);if(!t)throw new v("WhitePoint missing - required for color space CalRGB");let[n,r,g]=this.whitePoint=t,[o,I,c]=this.blackPoint=i||new Float32Array(3);if([this.GR,this.GG,this.GB]=s||new Float32Array([1,1,1]),[this.MXA,this.MYA,this.MZA,this.MXB,this.MYB,this.MZB,this.MXC,this.MYC,this.MZC]=a||new Float32Array([1,0,0,0,1,0,0,0,1]),n<0||g<0||r!==1)throw new v(`Invalid WhitePoint components for ${this.name}, no fallback available`);(o<0||I<0||c<0)&&(PA(`Invalid BlackPoint for ${this.name} [${o}, ${I}, ${c}], falling back to default.`),this.blackPoint=new Float32Array(3)),(this.GR<0||this.GG<0||this.GB<0)&&(PA(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ${this.name}, falling back to default.`),this.GR=this.GG=this.GB=1)}getRgbItem(t,i,s,a){mA(this,hn,$o).call(this,t,i,s,a,1)}getRgbBuffer(t,i,s,a,n,r,g){let o=1/((1<<r)-1);for(let I=0;I<s;++I)mA(this,hn,$o).call(this,t,i,a,n,o),i+=3,n+=3+g}getOutputLength(t,i){return t*(3+i)/3|0}},vt=je;on=new WeakMap,In=new WeakMap,bg=new WeakMap,Dg=new WeakMap,cn=new WeakMap,fs=new WeakMap,ln=new WeakMap,kg=new WeakMap,Li=new WeakSet,O0=function(t,i,s){s[0]=t[0]*i[0]+t[1]*i[1]+t[2]*i[2],s[1]=t[3]*i[0]+t[4]*i[1]+t[5]*i[2],s[2]=t[6]*i[0]+t[7]*i[1]+t[8]*i[2]},Sg=new WeakSet,ef=function(t,i,s){s[0]=i[0]*1/t[0],s[1]=i[1]*1/t[1],s[2]=i[2]*1/t[2]},Fg=new WeakSet,tf=function(t,i,s){s[0]=i[0]*.95047/t[0],s[1]=i[1]*1/t[1],s[2]=i[2]*1.08883/t[2]},us=new WeakSet,er=function(t){return t<=.0031308?mA(this,Hi,Z0).call(this,0,1,12.92*t):t>=.99554525?1:mA(this,Hi,Z0).call(this,0,1,(1+.055)*t**(1/2.4)-.055)},Hi=new WeakSet,Z0=function(t,i,s){return Math.max(t,Math.min(i,s))},Ji=new WeakSet,j0=function(t){return t<0?-mA(this,Ji,j0).call(this,-t):t>8?((t+16)/116)**3:t*ne(je,kg)},Rg=new WeakSet,sf=function(t,i,s){if(t[0]===0&&t[1]===0&&t[2]===0){s[0]=i[0],s[1]=i[1],s[2]=i[2];return}let a=mA(this,Ji,j0).call(this,0),n=a,r=mA(this,Ji,j0).call(this,t[0]),g=a,o=mA(this,Ji,j0).call(this,t[1]),I=a,c=mA(this,Ji,j0).call(this,t[2]),l=(1-n)/(1-r),h=1-l,C=(1-g)/(1-o),B=1-C,Q=(1-I)/(1-c),E=1-Q;s[0]=i[0]*l+h,s[1]=i[1]*C+B,s[2]=i[2]*Q+E},Ng=new WeakSet,af=function(t,i,s){if(t[0]===1&&t[2]===1){s[0]=i[0],s[1]=i[1],s[2]=i[2];return}let a=s;mA(this,Li,O0).call(this,ne(je,on),i,a);let n=ne(je,cn);mA(this,Sg,ef).call(this,t,a,n),mA(this,Li,O0).call(this,ne(je,In),n,s)},Gg=new WeakSet,nf=function(t,i,s){let a=s;mA(this,Li,O0).call(this,ne(je,on),i,a);let n=ne(je,cn);mA(this,Fg,tf).call(this,t,a,n),mA(this,Li,O0).call(this,ne(je,In),n,s)},hn=new WeakSet,$o=function(t,i,s,a,n){let r=mA(this,Hi,Z0).call(this,0,1,t[i]*n),g=mA(this,Hi,Z0).call(this,0,1,t[i+1]*n),o=mA(this,Hi,Z0).call(this,0,1,t[i+2]*n),I=r===1?1:r**this.GR,c=g===1?1:g**this.GG,l=o===1?1:o**this.GB,h=this.MXA*I+this.MXB*c+this.MXC*l,C=this.MYA*I+this.MYB*c+this.MYC*l,B=this.MZA*I+this.MZB*c+this.MZC*l,Q=ne(je,fs);Q[0]=h,Q[1]=C,Q[2]=B;let E=ne(je,ln);mA(this,Ng,af).call(this,this.whitePoint,Q,E);let f=ne(je,fs);mA(this,Rg,sf).call(this,this.blackPoint,E,f);let u=ne(je,ln);mA(this,Gg,nf).call(this,ne(je,Dg),f,u);let d=ne(je,fs);mA(this,Li,O0).call(this,ne(je,bg),u,d),s[a]=mA(this,us,er).call(this,d[0])*255,s[a+1]=mA(this,us,er).call(this,d[1])*255,s[a+2]=mA(this,us,er).call(this,d[2])*255},HA(vt,on,new Float32Array([.8951,.2664,-.1614,-.7502,1.7135,.0367,.0389,-.0685,1.0296])),HA(vt,In,new Float32Array([.9869929,-.1470543,.1599627,.4323053,.5183603,.0492912,-.0085287,.0400428,.9684867])),HA(vt,bg,new Float32Array([3.2404542,-1.5371385,-.4985314,-.969266,1.8760108,.041556,.0556434,-.2040259,1.0572252])),HA(vt,Dg,new Float32Array([1,1,1])),HA(vt,cn,new Float32Array(3)),HA(vt,fs,new Float32Array(3)),HA(vt,ln,new Float32Array(3)),HA(vt,kg,((8+16)/116)**3/8);var ds,tr,xs,ir,Cn,eI,AI=class extends JA{constructor(t,i,s){super("Lab",3);HA(this,ds);HA(this,xs);HA(this,Cn);if(!t)throw new v("WhitePoint missing - required for color space Lab");if([this.XW,this.YW,this.ZW]=t,[this.amin,this.amax,this.bmin,this.bmax]=s||[-100,100,-100,100],[this.XB,this.YB,this.ZB]=i||[0,0,0],this.XW<0||this.ZW<0||this.YW!==1)throw new v("Invalid WhitePoint components, no fallback available");(this.XB<0||this.YB<0||this.ZB<0)&&(PA("Invalid BlackPoint, falling back to default"),this.XB=this.YB=this.ZB=0),(this.amin>this.amax||this.bmin>this.bmax)&&(PA("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}getRgbItem(t,i,s,a){mA(this,Cn,eI).call(this,t,i,!1,s,a)}getRgbBuffer(t,i,s,a,n,r,g){let o=(1<<r)-1;for(let I=0;I<s;I++)mA(this,Cn,eI).call(this,t,i,o,a,n),i+=3,n+=3+g}getOutputLength(t,i){return t*(3+i)/3|0}isDefaultDecode(t,i){return!0}get usesZeroToOneRange(){return nA(this,"usesZeroToOneRange",!1)}};ds=new WeakSet,tr=function(t){return t>=6/29?t**3:108/841*(t-4/29)},xs=new WeakSet,ir=function(t,i,s,a){return s+t*(a-s)/i},Cn=new WeakSet,eI=function(t,i,s,a,n){let r=t[i],g=t[i+1],o=t[i+2];s!==!1&&(r=mA(this,xs,ir).call(this,r,s,0,100),g=mA(this,xs,ir).call(this,g,s,this.amin,this.amax),o=mA(this,xs,ir).call(this,o,s,this.bmin,this.bmax)),g>this.amax?g=this.amax:g<this.amin&&(g=this.amin),o>this.bmax?o=this.bmax:o<this.bmin&&(o=this.bmin);let I=(r+16)/116,c=I+g/500,l=I-o/200,h=this.XW*mA(this,ds,tr).call(this,c),C=this.YW*mA(this,ds,tr).call(this,I),B=this.ZW*mA(this,ds,tr).call(this,l),Q,E,f;this.ZW<1?(Q=h*3.1339+C*-1.617+B*-.4906,E=h*-.9785+C*1.916+B*.0333,f=h*.072+C*-.229+B*1.4057):(Q=h*3.2406+C*-1.5372+B*-.4986,E=h*-.9689+C*1.8758+B*.0415,f=h*.0557+C*-.204+B*1.057),a[n]=Math.sqrt(Q)*255,a[n+1]=Math.sqrt(E)*255,a[n+2]=Math.sqrt(f)*255};function Ze(e,A){let t=0;for(let i=0;i<=A;i++)t=t<<8|e[i];return t>>>0}function Nn(e,A){return A===1?String.fromCharCode(e[0],e[1]):A===3?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode(...e.subarray(0,A+1))}function tt(e,A,t){let i=0;for(let s=t;s>=0;s--)i+=e[s]+A[s],e[s]=i&255,i>>=8}function e0(e,A){let t=1;for(let i=A;i>=0&&t>0;i--)t+=e[i],e[i]=t&255,t>>=8}var K0=16,Vu=19,tI=class{constructor(A){this.buffer=A,this.pos=0,this.end=A.length,this.tmpBuf=new Uint8Array(Vu)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let A=0,t;do{let i=this.readByte();if(i<0)throw new v("unexpected EOF in bcmap");t=!(i&128),A=A<<7|i&127}while(!t);return A}readSigned(){let A=this.readNumber();return A&1?~(A>>>1):A>>>1}readHex(A,t){A.set(this.buffer.subarray(this.pos,this.pos+t+1)),this.pos+=t+1}readHexNumber(A,t){let i,s=this.tmpBuf,a=0;do{let o=this.readByte();if(o<0)throw new v("unexpected EOF in bcmap");i=!(o&128),s[a++]=o&127}while(!i);let n=t,r=0,g=0;for(;n>=0;){for(;g<8&&s.length>0;)r|=s[--a]<<g,g+=7;A[n]=r&255,n--,r>>=8,g-=8}}readHexSigned(A,t){this.readHexNumber(A,t);let i=A[t]&1?255:0,s=0;for(let a=0;a<=t;a++)s=(s&1)<<8|A[a],A[a]=s>>1^i}readString(){let A=this.readNumber(),t=new Array(A);for(let i=0;i<A;i++)t[i]=this.readNumber();return String.fromCharCode(...t)}},iI=class{async process(A,t,i){let s=new tI(A),a=s.readByte();t.vertical=!!(a&1);let n=null,r=new Uint8Array(K0),g=new Uint8Array(K0),o=new Uint8Array(K0),I=new Uint8Array(K0),c=new Uint8Array(K0),l,h;for(;(h=s.readByte())>=0;){let C=h>>5;if(C===7){switch(h&31){case 0:s.readString();break;case 1:n=s.readString();break}continue}let B=!!(h&16),Q=h&15;if(Q+1>K0)throw new Error("BinaryCMapReader.process: Invalid dataSize.");let E=1,f=s.readNumber();switch(C){case 0:s.readHex(r,Q),s.readHexNumber(g,Q),tt(g,r,Q),t.addCodespaceRange(Q+1,Ze(r,Q),Ze(g,Q));for(let u=1;u<f;u++)e0(g,Q),s.readHexNumber(r,Q),tt(r,g,Q),s.readHexNumber(g,Q),tt(g,r,Q),t.addCodespaceRange(Q+1,Ze(r,Q),Ze(g,Q));break;case 1:s.readHex(r,Q),s.readHexNumber(g,Q),tt(g,r,Q),s.readNumber();for(let u=1;u<f;u++)e0(g,Q),s.readHexNumber(r,Q),tt(r,g,Q),s.readHexNumber(g,Q),tt(g,r,Q),s.readNumber();break;case 2:s.readHex(o,Q),l=s.readNumber(),t.mapOne(Ze(o,Q),l);for(let u=1;u<f;u++)e0(o,Q),B||(s.readHexNumber(c,Q),tt(o,c,Q)),l=s.readSigned()+(l+1),t.mapOne(Ze(o,Q),l);break;case 3:s.readHex(r,Q),s.readHexNumber(g,Q),tt(g,r,Q),l=s.readNumber(),t.mapCidRange(Ze(r,Q),Ze(g,Q),l);for(let u=1;u<f;u++)e0(g,Q),B?r.set(g):(s.readHexNumber(r,Q),tt(r,g,Q)),s.readHexNumber(g,Q),tt(g,r,Q),l=s.readNumber(),t.mapCidRange(Ze(r,Q),Ze(g,Q),l);break;case 4:s.readHex(o,E),s.readHex(I,Q),t.mapOne(Ze(o,E),Nn(I,Q));for(let u=1;u<f;u++)e0(o,E),B||(s.readHexNumber(c,E),tt(o,c,E)),e0(I,Q),s.readHexSigned(c,Q),tt(I,c,Q),t.mapOne(Ze(o,E),Nn(I,Q));break;case 5:s.readHex(r,E),s.readHexNumber(g,E),tt(g,r,E),s.readHex(I,Q),t.mapBfRange(Ze(r,E),Ze(g,E),Nn(I,Q));for(let u=1;u<f;u++)e0(g,E),B?r.set(g):(s.readHexNumber(r,E),tt(r,g,E)),s.readHexNumber(g,E),tt(g,r,E),s.readHex(I,Q),t.mapBfRange(Ze(r,E),Ze(g,E),Nn(I,Q));break;default:throw new Error(`BinaryCMapReader.process - unknown type: ${C}`)}}return n?i(n):t}},_u=new Uint8Array(0),Me=class extends KA{constructor(A){if(super(),this._rawMinBufferLength=A||0,this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=_u,this.minBufferLength=512,A)for(;this.minBufferLength<A;)this.minBufferLength*=2}get isEmpty(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0}ensureBuffer(A){let t=this.buffer;if(A<=t.byteLength)return t;let i=this.minBufferLength;for(;i<A;)i*=2;let s=new Uint8Array(i);return s.set(t),this.buffer=s}getByte(){let A=this.pos;for(;this.bufferLength<=A;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]}getBytes(A,t=null){let i=this.pos,s;if(A){for(this.ensureBuffer(i+A),s=i+A;!this.eof&&this.bufferLength<s;)this.readBlock(t);let a=this.bufferLength;s>a&&(s=a)}else{for(;!this.eof;)this.readBlock(t);s=this.bufferLength}return this.pos=s,this.buffer.subarray(i,s)}async getImageData(A,t=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(A,t);let i=await this.stream.asyncGetBytes();return this.decodeImage(i,t)}reset(){this.pos=0}makeSubStream(A,t,i=null){if(t===void 0)for(;!this.eof;)this.readBlock();else{let s=A+t;for(;this.bufferLength<=s&&!this.eof;)this.readBlock()}return new Ie(this.buffer,A,t,i)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}},sI=class extends Me{constructor(A,t=null){let i=0;for(let s of A)i+=s instanceof Me?s._rawMinBufferLength:s.length;super(i),this.streams=A,this._onError=t}readBlock(){var r;let A=this.streams;if(A.length===0){this.eof=!0;return}let t=A.shift(),i;try{i=t.getBytes()}catch(g){if(this._onError){this._onError(g,(r=t.dict)==null?void 0:r.objId);return}throw g}let s=this.bufferLength,a=s+i.length;this.ensureBuffer(a).set(i,s),this.bufferLength=a}getBaseStreams(){let A=[];for(let t of this.streams){let i=t.getBaseStreams();i&&A.push(...i)}return A.length>0?A:null}},aI=class extends Me{constructor(A,t){t&&(t*=.8),super(t),this.str=A,this.dict=A.dict,this.input=new Uint8Array(5)}readBlock(){let s=this.str,a=s.getByte();for(;pt(a);)a=s.getByte();if(a===-1||a===126){this.eof=!0;return}let n=this.bufferLength,r,g;if(a===122){for(r=this.ensureBuffer(n+4),g=0;g<4;++g)r[n+g]=0;this.bufferLength+=4}else{let o=this.input;for(o[0]=a,g=1;g<5;++g){for(a=s.getByte();pt(a);)a=s.getByte();if(o[g]=a,a===-1||a===126)break}if(r=this.ensureBuffer(n+g-1),this.bufferLength+=g-1,g<5){for(;g<5;++g)o[g]=33+84;this.eof=!0}let I=0;for(g=0;g<5;++g)I=I*85+(o[g]-33);for(g=3;g>=0;--g)r[n+g]=I&255,I>>=8}}},nI=class extends Me{constructor(A,t){t&&(t*=.5),super(t),this.str=A,this.dict=A.dict,this.firstDigit=-1}readBlock(){let t=this.str.getBytes(8e3);if(!t.length){this.eof=!0;return}let i=t.length+1>>1,s=this.ensureBuffer(this.bufferLength+i),a=this.bufferLength,n=this.firstDigit;for(let r of t){let g;if(r>=48&&r<=57)g=r&15;else if(r>=65&&r<=70||r>=97&&r<=102)g=(r&15)+9;else if(r===62){this.eof=!0;break}else continue;n<0?n=g:(s[a++]=n<<4|g,n=-1)}n>=0&&this.eof&&(s[a++]=n<<4,n=-1),this.firstDigit=n,this.bufferLength=a}},rI=-2,gi=-1,Ii=0,He=1,kA=2,Je=3,Ye=4,gI=5,oI=6,rf=7,gf=8,L1=[[-1,-1],[-1,-1],[7,gf],[7,rf],[6,oI],[6,oI],[6,gI],[6,gI],[4,Ii],[4,Ii],[4,Ii],[4,Ii],[4,Ii],[4,Ii],[4,Ii],[4,Ii],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,He],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Ye],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[3,Je],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA],[1,kA]],H1=[[-1,-1],[12,rI],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],J1=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Y1=[[-1,-1],[-1,-1],[12,rI],[12,rI],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],K1=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],v1=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]],pr=class{constructor(A,t={}){var s;if(!A||typeof A.next!="function")throw new Error(\'CCITTFaxDecoder - invalid "source" parameter.\');this.source=A,this.eof=!1,this.encoding=t.K||0,this.eoline=t.EndOfLine||!1,this.byteAlign=t.EncodedByteAlign||!1,this.columns=t.Columns||1728,this.rows=t.Rows||0,this.eoblock=(s=t.EndOfBlock)!=null?s:!0,this.black=t.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;let i;for(;(i=this._lookBits(12))===0;)this._eatBits(1);i===1&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}readNextChar(){if(this.eof)return-1;let A=this.refLine,t=this.codingLine,i=this.columns,s,a,n,r;if(this.outputBits===0){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;this.err=!1;let o,I,c;if(this.nextLine2D){for(r=0;t[r]<i;++r)A[r]=t[r];for(A[r++]=i,A[r]=i,t[0]=0,this.codingPos=0,s=0,a=0;t[this.codingPos]<i;)switch(o=this._getTwoDimCode(),o){case Ii:this._addPixels(A[s+1],a),A[s+1]<i&&(s+=2);break;case He:if(o=I=0,a){do o+=c=this._getBlackCode();while(c>=64);do I+=c=this._getWhiteCode();while(c>=64)}else{do o+=c=this._getWhiteCode();while(c>=64);do I+=c=this._getBlackCode();while(c>=64)}for(this._addPixels(t[this.codingPos]+o,a),t[this.codingPos]<i&&this._addPixels(t[this.codingPos]+I,a^1);A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case rf:if(this._addPixels(A[s]+3,a),a^=1,t[this.codingPos]<i)for(++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case gI:if(this._addPixels(A[s]+2,a),a^=1,t[this.codingPos]<i)for(++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case Je:if(this._addPixels(A[s]+1,a),a^=1,t[this.codingPos]<i)for(++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case kA:if(this._addPixels(A[s],a),a^=1,t[this.codingPos]<i)for(++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case gf:if(this._addPixelsNeg(A[s]-3,a),a^=1,t[this.codingPos]<i)for(s>0?--s:++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case oI:if(this._addPixelsNeg(A[s]-2,a),a^=1,t[this.codingPos]<i)for(s>0?--s:++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case Ye:if(this._addPixelsNeg(A[s]-1,a),a^=1,t[this.codingPos]<i)for(s>0?--s:++s;A[s]<=t[this.codingPos]&&A[s]<i;)s+=2;break;case gi:this._addPixels(i,0),this.eof=!0;break;default:PA("bad 2d code"),this._addPixels(i,0),this.err=!0}}else for(t[0]=0,this.codingPos=0,a=0;t[this.codingPos]<i;){if(o=0,a)do o+=c=this._getBlackCode();while(c>=64);else do o+=c=this._getWhiteCode();while(c>=64);this._addPixels(t[this.codingPos]+o,a),a^=1}let l=!1;if(this.byteAlign&&(this.inputBits&=-8),!this.eoblock&&this.row===this.rows-1)this.rowsDone=!0;else{if(o=this._lookBits(12),this.eoline)for(;o!==gi&&o!==1;)this._eatBits(1),o=this._lookBits(12);else for(;o===0;)this._eatBits(1),o=this._lookBits(12);o===1?(this._eatBits(12),l=!0):o===gi&&(this.eof=!0)}if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&l&&this.byteAlign){if(o=this._lookBits(12),o===1){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(r=0;r<4;++r)o=this._lookBits(12),o!==1&&PA("bad rtc code: "+o),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(o=this._lookBits(13),o===gi)return this.eof=!0,-1;if(o>>1===1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(o&1))}this.outputBits=t[0]>0?t[this.codingPos=0]:t[this.codingPos=1],this.row++}let g;if(this.outputBits>=8)g=this.codingPos&1?0:255,this.outputBits-=8,this.outputBits===0&&t[this.codingPos]<i&&(this.codingPos++,this.outputBits=t[this.codingPos]-t[this.codingPos-1]);else{n=8,g=0;do{if(typeof this.outputBits!="number")throw new v(\'Invalid /CCITTFaxDecode data, "outputBits" must be a number.\');this.outputBits>n?(g<<=n,this.codingPos&1||(g|=255>>8-n),this.outputBits-=n,n=0):(g<<=this.outputBits,this.codingPos&1||(g|=255>>8-this.outputBits),n-=this.outputBits,this.outputBits=0,t[this.codingPos]<i?(this.codingPos++,this.outputBits=t[this.codingPos]-t[this.codingPos-1]):n>0&&(g<<=n,n=0))}while(n)}return this.black&&(g^=255),g}_addPixels(A,t){let i=this.codingLine,s=this.codingPos;A>i[s]&&(A>this.columns&&(PA("row is wrong length"),this.err=!0,A=this.columns),s&1^t&&++s,i[s]=A),this.codingPos=s}_addPixelsNeg(A,t){let i=this.codingLine,s=this.codingPos;if(A>i[s])A>this.columns&&(PA("row is wrong length"),this.err=!0,A=this.columns),s&1^t&&++s,i[s]=A;else if(A<i[s]){for(A<0&&(PA("invalid code"),this.err=!0,A=0);s>0&&A<i[s-1];)--s;i[s]=A}this.codingPos=s}_findTableCode(A,t,i,s){let a=s||0;for(let n=A;n<=t;++n){let r=this._lookBits(n);if(r===gi)return[!0,1,!1];if(n<t&&(r<<=t-n),!a||r>=a){let g=i[r-a];if(g[0]===n)return this._eatBits(n),[!0,g[1],!0]}}return[!1,0,!1]}_getTwoDimCode(){let A=0,t;if(this.eoblock){if(A=this._lookBits(7),t=L1[A],(t==null?void 0:t[0])>0)return this._eatBits(t[0]),t[1]}else{let i=this._findTableCode(1,7,L1);if(i[0]&&i[2])return i[1]}return PA("Bad two dim code"),gi}_getWhiteCode(){let A=0,t;if(this.eoblock){if(A=this._lookBits(12),A===gi)return 1;if(t=A>>5?J1[A>>3]:H1[A],t[0]>0)return this._eatBits(t[0]),t[1]}else{let i=this._findTableCode(1,9,J1);if(i[0]||(i=this._findTableCode(11,12,H1),i[0]))return i[1]}return PA("bad white code"),this._eatBits(1),1}_getBlackCode(){let A,t;if(this.eoblock){if(A=this._lookBits(13),A===gi)return 1;if(A>>7?!(A>>9)&&A>>7?t=K1[(A>>1)-64]:t=v1[A>>7]:t=Y1[A],t[0]>0)return this._eatBits(t[0]),t[1]}else{let i=this._findTableCode(2,6,v1);if(i[0]||(i=this._findTableCode(7,12,K1,64),i[0])||(i=this._findTableCode(10,13,Y1),i[0]))return i[1]}return PA("bad black code"),this._eatBits(1),1}_lookBits(A){let t;for(;this.inputBits<A;){if((t=this.source.next())===-1)return this.inputBits===0?gi:this.inputBuf<<A-this.inputBits&65535>>16-A;this.inputBuf=this.inputBuf<<8|t,this.inputBits+=8}return this.inputBuf>>this.inputBits-A&65535>>16-A}_eatBits(A){(this.inputBits-=A)<0&&(this.inputBits=0)}},II=class extends Me{constructor(A,t,i){super(t),this.str=A,this.dict=A.dict,i instanceof F||(i=F.empty);let s={next(){return A.getByte()}};this.ccittFaxDecoder=new pr(s,{K:i.get("K"),EndOfLine:i.get("EndOfLine"),EncodedByteAlign:i.get("EncodedByteAlign"),Columns:i.get("Columns"),Rows:i.get("Rows"),EndOfBlock:i.get("EndOfBlock"),BlackIs1:i.get("BlackIs1")})}readBlock(){for(;!this.eof;){let A=this.ccittFaxDecoder.readNextChar();if(A===-1){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=A}}},q1=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zu=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),$u=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Ad=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],ed=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],Yi,X0,wr=class extends Me{constructor(t,i){super(i);HA(this,Yi);this.str=t,this.dict=t.dict;let s=t.getByte(),a=t.getByte();if(s===-1||a===-1)throw new v(`Invalid header in flate stream: ${s}, ${a}`);if((s&15)!==8)throw new v(`Unknown compression method in flate stream: ${s}, ${a}`);if(((s<<8)+a)%31!==0)throw new v(`Bad FCHECK in flate stream: ${s}, ${a}`);if(a&32)throw new v(`FDICT bit set in flate stream: ${s}, ${a}`);this.codeSize=0,this.codeBuf=0}async getImageData(t,i){let s=await this.asyncGetBytes();return(s==null?void 0:s.subarray(0,t))||this.getBytes(t)}async asyncGetBytes(){this.str.reset();let t=this.str.getBytes();try{let{readable:i,writable:s}=new DecompressionStream("deflate"),a=s.getWriter();a.write(t),a.close();let n=[],r=0;for await(let I of i)n.push(I),r+=I.byteLength;let g=new Uint8Array(r),o=0;for(let I of n)g.set(I,o),o+=I.byteLength;return g}catch(i){return this.str=new Ie(t,2,t.length,this.str.dict),this.reset(),null}}get isAsync(){return!0}getBits(t){let i=this.str,s=this.codeSize,a=this.codeBuf,n;for(;s<t;){if((n=i.getByte())===-1)throw new v("Bad encoding in flate stream");a|=n<<s,s+=8}return n=a&(1<<t)-1,this.codeBuf=a>>t,this.codeSize=s-=t,n}getCode(t){let i=this.str,s=t[0],a=t[1],n=this.codeSize,r=this.codeBuf,g;for(;n<a&&(g=i.getByte())!==-1;)r|=g<<n,n+=8;let o=s[r&(1<<a)-1],I=o>>16,c=o&65535;if(I<1||n<I)throw new v("Bad encoding in flate stream");return this.codeBuf=r>>I,this.codeSize=n-I,c}generateHuffmanTable(t){let i=t.length,s=0,a;for(a=0;a<i;++a)t[a]>s&&(s=t[a]);let n=1<<s,r=new Int32Array(n);for(let g=1,o=0,I=2;g<=s;++g,o<<=1,I<<=1)for(let c=0;c<i;++c)if(t[c]===g){let l=0,h=o;for(a=0;a<g;++a)l=l<<1|h&1,h>>=1;for(a=l;a<n;a+=I)r[a]=g<<16|c;++o}return[r,s]}readBlock(){let t,i,s,a=this.str;try{i=this.getBits(3)}catch(I){mA(this,Yi,X0).call(this,I.message);return}if(i&1&&(this.eof=!0),i>>=1,i===0){let I;if((I=a.getByte())===-1){mA(this,Yi,X0).call(this,"Bad block header in flate stream");return}let c=I;if((I=a.getByte())===-1){mA(this,Yi,X0).call(this,"Bad block header in flate stream");return}if(c|=I<<8,(I=a.getByte())===-1){mA(this,Yi,X0).call(this,"Bad block header in flate stream");return}let l=I;if((I=a.getByte())===-1){mA(this,Yi,X0).call(this,"Bad block header in flate stream");return}if(l|=I<<8,l!==(~c&65535)&&(c!==0||l!==0))throw new v("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;let h=this.bufferLength,C=h+c;if(t=this.ensureBuffer(C),this.bufferLength=C,c===0)a.peekByte()===-1&&(this.eof=!0);else{let B=a.getBytes(c);t.set(B,h),B.length<c&&(this.eof=!0)}return}let n,r;if(i===1)n=Ad,r=ed;else if(i===2){let I=this.getBits(5)+257,c=this.getBits(5)+1,l=this.getBits(4)+4,h=new Uint8Array(q1.length),C;for(C=0;C<l;++C)h[q1[C]]=this.getBits(3);let B=this.generateHuffmanTable(h);s=0,C=0;let Q=I+c,E=new Uint8Array(Q),f,u,d;for(;C<Q;){let x=this.getCode(B);if(x===16)f=2,u=3,d=s;else if(x===17)f=3,u=3,d=s=0;else if(x===18)f=7,u=11,d=s=0;else{E[C++]=s=x;continue}let p=this.getBits(f)+u;for(;p-- >0;)E[C++]=d}n=this.generateHuffmanTable(E.subarray(0,I)),r=this.generateHuffmanTable(E.subarray(I,Q))}else throw new v("Unknown block type in flate stream");t=this.buffer;let g=t?t.length:0,o=this.bufferLength;for(;;){let I=this.getCode(n);if(I<256){o+1>=g&&(t=this.ensureBuffer(o+1),g=t.length),t[o++]=I;continue}if(I===256){this.bufferLength=o;return}I-=257,I=zu[I];let c=I>>16;c>0&&(c=this.getBits(c)),s=(I&65535)+c,I=this.getCode(r),I=$u[I],c=I>>16,c>0&&(c=this.getBits(c));let l=(I&65535)+c;o+s>=g&&(t=this.ensureBuffer(o+s),g=t.length);for(let h=0;h<s;++h,++o)t[o]=t[o-l]}}};Yi=new WeakSet,X0=function(t){PA(t),this.eof=!0};var td=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}],cI=class{constructor(A,t,i){this.data=A,this.bp=t,this.dataEnd=i,this.chigh=A[t],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){let A=this.data,t=this.bp;A[t]===255?A[t+1]>143?(this.clow+=65280,this.ct=8):(t++,this.clow+=A[t]<<9,this.ct=7,this.bp=t):(t++,this.clow+=t<this.dataEnd?A[t]<<8:65280,this.ct=8,this.bp=t),this.clow>65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(A,t){let i=A[t]>>1,s=A[t]&1,a=td[i],n=a.qe,r,g=this.a-n;if(this.chigh<n)g<n?(g=n,r=s,i=a.nmps):(g=n,r=1^s,a.switchFlag===1&&(s=r),i=a.nlps);else{if(this.chigh-=n,g&32768)return this.a=g,s;g<n?(r=1^s,a.switchFlag===1&&(s=r),i=a.nlps):(r=s,i=a.nmps)}do this.ct===0&&this.byteIn(),g<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(g&32768));return this.a=g,A[t]=i<<1|s,r}},oe=class extends At{constructor(A){super(A,"Jbig2Error")}},lI=class{getContexts(A){return A in this?this[A]:this[A]=new Int8Array(1<<16)}},g0=class{constructor(A,t,i){this.data=A,this.start=t,this.end=i}get decoder(){let A=new cI(this.data,this.start,this.end);return nA(this,"decoder",A)}get contextCache(){let A=new lI;return nA(this,"contextCache",A)}},id=2**31-1,sd=-(2**31);function Xe(e,A,t){let i=e.getContexts(A),s=1;function a(o){let I=0;for(let c=0;c<o;c++){let l=t.readBit(i,s);s=s<256?s<<1|l:(s<<1|l)&511|256,I=I<<1|l}return I>>>0}let n=a(1),r=a(1)?a(1)?a(1)?a(1)?a(1)?a(32)+4436:a(12)+340:a(8)+84:a(6)+20:a(4)+4:a(2),g;return n===0?g=r:r>0&&(g=-r),g>=sd&&g<=id?g:null}function of(e,A,t){let i=e.getContexts("IAID"),s=1;for(let a=0;a<t;a++){let n=A.readBit(i,s);s=s<<1|n}return t<31?s&(1<<t)-1:s&2147483647}var T1=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"PatternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],ad=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],P1=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],nd=[39717,1941,229,405],rd=[32,8];function gd(e,A,t){let i=t.decoder,s=t.contextCache.getContexts("GB"),a=[],n,r,g,o,I,c,l,h=31735;for(r=0;r<A;r++)for(I=a[r]=new Uint8Array(e),c=r<1?I:a[r-1],l=r<2?I:a[r-2],n=l[0]<<13|l[1]<<12|l[2]<<11|c[0]<<7|c[1]<<6|c[2]<<5|c[3]<<4,g=0;g<e;g++)I[g]=o=i.readBit(s,n),n=(n&h)<<1|(g+3<e?l[g+3]<<11:0)|(g+4<e?c[g+4]<<4:0)|o;return a}function _g(e,A,t,i,s,a,n,r){if(e){let lA=new w0(r.data,r.start,r.end);return I1(lA,A,t,!1)}if(i===0&&!a&&!s&&n.length===4&&n[0].x===3&&n[0].y===-1&&n[1].x===-3&&n[1].y===-1&&n[2].x===2&&n[2].y===-2&&n[3].x===-2&&n[3].y===-2)return gd(A,t,r);let g=!!a,o=ad[i].concat(n);o.sort(function(lA,EA){return lA.y-EA.y||lA.x-EA.x});let I=o.length,c=new Int8Array(I),l=new Int8Array(I),h=[],C=0,B=0,Q=0,E=0,f,u;for(u=0;u<I;u++)c[u]=o[u].x,l[u]=o[u].y,B=Math.min(B,o[u].x),Q=Math.max(Q,o[u].x),E=Math.min(E,o[u].y),u<I-1&&o[u].y===o[u+1].y&&o[u].x===o[u+1].x-1?C|=1<<I-1-u:h.push(u);let d=h.length,x=new Int8Array(d),p=new Int8Array(d),m=new Uint16Array(d);for(f=0;f<d;f++)u=h[f],x[f]=o[u].x,p[f]=o[u].y,m[f]=1<<I-1-u;let D=-B,S=-E,w=A-Q,Y=nd[i],U=new Uint8Array(A),K=[],Z=r.decoder,AA=r.contextCache.getContexts("GB"),gA=0,R,_,tA,IA=0,QA,V;for(let lA=0;lA<t;lA++){if(s){let EA=Z.readBit(AA,Y);if(gA^=EA,gA){K.push(U);continue}}for(U=new Uint8Array(U),K.push(U),R=0;R<A;R++){if(g&&a[lA][R]){U[R]=0;continue}if(R>=D&&R<w&&lA>=S)for(IA=IA<<1&C,u=0;u<d;u++)_=lA+p[u],tA=R+x[u],QA=K[_][tA],QA&&(QA=m[u],IA|=QA);else for(IA=0,V=I-1,u=0;u<I;u++,V--)tA=R+c[u],tA>=0&&tA<A&&(_=lA+l[u],_>=0&&(QA=K[_][tA],QA&&(IA|=QA<<V)));let EA=Z.readBit(AA,IA);U[R]=EA}}return K}function If(e,A,t,i,s,a,n,r,g){let o=P1[t].coding;t===0&&(o=o.concat([r[0]]));let I=o.length,c=new Int32Array(I),l=new Int32Array(I),h;for(h=0;h<I;h++)c[h]=o[h].x,l[h]=o[h].y;let C=P1[t].reference;t===0&&(C=C.concat([r[1]]));let B=C.length,Q=new Int32Array(B),E=new Int32Array(B);for(h=0;h<B;h++)Q[h]=C[h].x,E[h]=C[h].y;let f=i[0].length,u=i.length,d=rd[t],x=[],p=g.decoder,m=g.contextCache.getContexts("GR"),D=0;for(let S=0;S<A;S++){if(n){let Y=p.readBit(m,d);if(D^=Y,D)throw new oe("prediction is not supported")}let w=new Uint8Array(e);x.push(w);for(let Y=0;Y<e;Y++){let U,K,Z=0;for(h=0;h<I;h++)U=S+l[h],K=Y+c[h],U<0||K<0||K>=e?Z<<=1:Z=Z<<1|x[U][K];for(h=0;h<B;h++)U=S+E[h]-a,K=Y+Q[h]-s,U<0||U>=u||K<0||K>=f?Z<<=1:Z=Z<<1|i[U][K];let AA=p.readBit(m,Z);w[Y]=AA}}return x}function od(e,A,t,i,s,a,n,r,g,o,I,c){if(e&&A)throw new oe("symbol refinement with Huffman is not supported");let l=[],h=0,C=g1(t.length+i),B=I.decoder,Q=I.contextCache,E,f;for(e&&(E=vi(1),f=[],C=Math.max(C,1));l.length<i;){let S=e?a.tableDeltaHeight.decode(c):Xe(Q,"IADH",B);h+=S;let w=0,Y=0,U=e?f.length:0;for(;;){let K=e?a.tableDeltaWidth.decode(c):Xe(Q,"IADW",B);if(K===null)break;w+=K,Y+=w;let Z;if(A){let AA=Xe(Q,"IAAI",B);if(AA>1)Z=cf(e,A,w,h,0,AA,1,t.concat(l),C,0,0,1,0,a,g,o,I,0,c);else{let gA=of(Q,B,C),R=Xe(Q,"IARDX",B),_=Xe(Q,"IARDY",B),tA=gA<t.length?t[gA]:l[gA-t.length];Z=If(w,h,g,tA,R,_,!1,o,I)}l.push(Z)}else e?f.push(w):(Z=_g(!1,w,h,n,!1,null,r,I),l.push(Z))}if(e&&!A){let K=a.tableBitmapSize.decode(c);c.byteAlign();let Z;if(K===0)Z=dd(c,Y,h);else{let gA=c.end,R=c.position+K;c.end=R,Z=I1(c,Y,h,!1),c.end=gA,c.position=R}let AA=f.length;if(U===AA-1)l.push(Z);else{let gA,R,_=0,tA,IA,QA;for(gA=U;gA<AA;gA++){for(IA=f[gA],tA=_+IA,QA=[],R=0;R<h;R++)QA.push(Z[R].subarray(_,tA));l.push(QA),_=tA}}}}let u=[],d=[],x=!1,p,m,D=t.length+i;for(;d.length<D;){let S=e?E.decode(c):Xe(Q,"IAEX",B);for(;S--;)d.push(x);x=!x}for(p=0,m=t.length;p<m;p++)d[p]&&u.push(t[p]);for(let S=0;S<i;p++,S++)d[p]&&u.push(l[S]);return u}function cf(e,A,t,i,s,a,n,r,g,o,I,c,l,h,C,B,Q,E,f){if(e&&A)throw new oe("refinement with Huffman is not supported");let u=[],d,x;for(d=0;d<i;d++){if(x=new Uint8Array(t),s)for(let w=0;w<t;w++)x[w]=s;u.push(x)}let p=Q.decoder,m=Q.contextCache,D=e?-h.tableDeltaT.decode(f):-Xe(m,"IADT",p),S=0;for(d=0;d<a;){let w=e?h.tableDeltaT.decode(f):Xe(m,"IADT",p);D+=w;let Y=e?h.tableFirstS.decode(f):Xe(m,"IAFS",p);S+=Y;let U=S;do{let K=0;n>1&&(K=e?f.readBits(E):Xe(m,"IAIT",p));let Z=n*D+K,AA=e?h.symbolIDTable.decode(f):of(m,p,g),gA=A&&(e?f.readBit():Xe(m,"IARI",p)),R=r[AA],_=R[0].length,tA=R.length;if(gA){let N=Xe(m,"IARDW",p),H=Xe(m,"IARDH",p),q=Xe(m,"IARDX",p),T=Xe(m,"IARDY",p);_+=N,tA+=H,R=If(_,tA,C,R,(N>>1)+q,(H>>1)+T,!1,B,Q)}let IA=0;o?c&1?IA=tA-1:U+=tA-1:c>1?U+=_-1:IA=_-1;let QA=Z-(c&1?0:tA-1),V=U-(c&2?_-1:0),lA,EA,fA;if(o)for(lA=0;lA<tA;lA++){if(x=u[V+lA],!x)continue;fA=R[lA];let N=Math.min(t-QA,_);switch(l){case 0:for(EA=0;EA<N;EA++)x[QA+EA]|=fA[EA];break;case 2:for(EA=0;EA<N;EA++)x[QA+EA]^=fA[EA];break;default:throw new oe(`operator ${l} is not supported`)}}else for(EA=0;EA<tA;EA++)if(x=u[QA+EA],!!x)switch(fA=R[EA],l){case 0:for(lA=0;lA<_;lA++)x[V+lA]|=fA[lA];break;case 2:for(lA=0;lA<_;lA++)x[V+lA]^=fA[lA];break;default:throw new oe(`operator ${l} is not supported`)}d++;let CA=e?h.tableDeltaS.decode(f):Xe(m,"IADS",p);if(CA===null)break;U+=IA+CA+I}while(!0)}return u}function Id(e,A,t,i,s,a){let n=[];e||(n.push({x:-A,y:0}),s===0&&n.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));let r=(i+1)*A,g=_g(e,r,t,s,!1,null,n,a),o=[];for(let I=0;I<=i;I++){let c=[],l=A*I,h=l+A;for(let C=0;C<t;C++)c.push(g[C].subarray(l,h));o.push(c)}return o}function cd(e,A,t,i,s,a,n,r,g,o,I,c,l,h,C){if(n)throw new oe("skip is not supported");if(r!==0)throw new oe(`operator "${r}" is not supported in halftone region`);let Q=[],E,f,u;for(E=0;E<s;E++){if(u=new Uint8Array(i),a)for(f=0;f<i;f++)u[f]=a;Q.push(u)}let d=A.length,x=A[0],p=x[0].length,m=x.length,D=g1(d),S=[];e||(S.push({x:t<=1?3:2,y:-1}),t===0&&S.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));let w=[],Y,U;for(e&&(Y=new w0(C.data,C.start,C.end)),E=D-1;E>=0;E--)e?U=I1(Y,g,o,!0):U=_g(!1,g,o,t,!1,null,S,C),w[E]=U;let K,Z,AA,gA,R,_,tA,IA,QA;for(K=0;K<o;K++)for(Z=0;Z<g;Z++){for(AA=0,gA=0,f=D-1;f>=0;f--)AA^=w[f][K][Z],gA|=AA<<f;if(R=A[gA],_=I+K*h+Z*l>>8,tA=c+K*l-Z*h>>8,_>=0&&_+p<=i&&tA>=0&&tA+m<=s)for(E=0;E<m;E++)for(QA=Q[tA+E],IA=R[E],f=0;f<p;f++)QA[_+f]|=IA[f];else{let V,lA;for(E=0;E<m;E++)if(lA=tA+E,!(lA<0||lA>=s))for(QA=Q[lA],IA=R[E],f=0;f<p;f++)V=_+f,V>=0&&V<i&&(QA[V]|=IA[f])}}return Q}function ld(e,A){let t={};t.number=le(e,A);let i=e[A+4],s=i&63;if(!T1[s])throw new oe("invalid segment type: "+s);t.type=s,t.typeName=T1[s],t.deferredNonRetain=!!(i&128);let a=!!(i&64),n=e[A+5],r=n>>5&7,g=[n&31],o=A+6;if(n===7){r=le(e,o-1)&536870911,o+=3;let C=r+7>>3;for(g[0]=e[o++];--C>0;)g.push(e[o++])}else if(n===5||n===6)throw new oe("invalid referred-to flags");t.retainBits=g;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);let c=[],l,h;for(l=0;l<r;l++){let C;I===1?C=e[o]:I===2?C=we(e,o):C=le(e,o),c.push(C),o+=I}if(t.referredTo=c,a?(t.pageAssociation=le(e,o),o+=4):t.pageAssociation=e[o++],t.length=le(e,o),o+=4,t.length===4294967295)if(s===38){let C=sr(e,o),Q=!!(e[o+ar]&1),E=6,f=new Uint8Array(E);for(Q||(f[0]=255,f[1]=172),f[2]=C.height>>>24&255,f[3]=C.height>>16&255,f[4]=C.height>>8&255,f[5]=C.height&255,l=o,h=e.length;l<h;l++){let u=0;for(;u<E&&f[u]===e[l+u];)u++;if(u===E){t.length=l+E;break}}if(t.length===4294967295)throw new oe("segment end was not found")}else throw new oe("invalid unknown segment length");return t.headerEnd=o,t}function hd(e,A,t,i){let s=[],a=t;for(;a<i;){let n=ld(A,a);a=n.headerEnd;let r={header:n,data:A};if(e.randomAccess||(r.start=a,a+=n.length,r.end=a),s.push(r),n.type===51)break}if(e.randomAccess)for(let n=0,r=s.length;n<r;n++)s[n].start=a,a+=s[n].header.length,s[n].end=a;return s}function sr(e,A){return{width:le(e,A),height:le(e,A+4),x:le(e,A+8),y:le(e,A+12),combinationOperator:e[A+16]&7}}var ar=17;function Cd(e,A){let t=e.header,i=e.data,s=e.end,a=e.start,n,r,g,o;switch(t.type){case 0:let c={},l=we(i,a);if(c.huffman=!!(l&1),c.refinement=!!(l&2),c.huffmanDHSelector=l>>2&3,c.huffmanDWSelector=l>>4&3,c.bitmapSizeSelector=l>>6&1,c.aggregationInstancesSelector=l>>7&1,c.bitmapCodingContextUsed=!!(l&256),c.bitmapCodingContextRetained=!!(l&512),c.template=l>>10&3,c.refinementTemplate=l>>12&1,a+=2,!c.huffman){for(o=c.template===0?4:1,r=[],g=0;g<o;g++)r.push({x:Di(i,a),y:Di(i,a+1)}),a+=2;c.at=r}if(c.refinement&&!c.refinementTemplate){for(r=[],g=0;g<2;g++)r.push({x:Di(i,a),y:Di(i,a+1)}),a+=2;c.refinementAt=r}c.numberOfExportedSymbols=le(i,a),a+=4,c.numberOfNewSymbols=le(i,a),a+=4,n=[c,t.number,t.referredTo,i,a,s];break;case 6:case 7:let h={};h.info=sr(i,a),a+=ar;let C=we(i,a);if(a+=2,h.huffman=!!(C&1),h.refinement=!!(C&2),h.logStripSize=C>>2&3,h.stripSize=1<<h.logStripSize,h.referenceCorner=C>>4&3,h.transposed=!!(C&64),h.combinationOperator=C>>7&3,h.defaultPixelValue=C>>9&1,h.dsOffset=C<<17>>27,h.refinementTemplate=C>>15&1,h.huffman){let m=we(i,a);a+=2,h.huffmanFS=m&3,h.huffmanDS=m>>2&3,h.huffmanDT=m>>4&3,h.huffmanRefinementDW=m>>6&3,h.huffmanRefinementDH=m>>8&3,h.huffmanRefinementDX=m>>10&3,h.huffmanRefinementDY=m>>12&3,h.huffmanRefinementSizeSelector=!!(m&16384)}if(h.refinement&&!h.refinementTemplate){for(r=[],g=0;g<2;g++)r.push({x:Di(i,a),y:Di(i,a+1)}),a+=2;h.refinementAt=r}h.numberOfSymbolInstances=le(i,a),a+=4,n=[h,t.referredTo,i,a,s];break;case 16:let B={},Q=i[a++];B.mmr=!!(Q&1),B.template=Q>>1&3,B.patternWidth=i[a++],B.patternHeight=i[a++],B.maxPatternIndex=le(i,a),a+=4,n=[B,t.number,i,a,s];break;case 22:case 23:let E={};E.info=sr(i,a),a+=ar;let f=i[a++];E.mmr=!!(f&1),E.template=f>>1&3,E.enableSkip=!!(f&8),E.combinationOperator=f>>4&7,E.defaultPixelValue=f>>7&1,E.gridWidth=le(i,a),a+=4,E.gridHeight=le(i,a),a+=4,E.gridOffsetX=le(i,a)&4294967295,a+=4,E.gridOffsetY=le(i,a)&4294967295,a+=4,E.gridVectorX=we(i,a),a+=2,E.gridVectorY=we(i,a),a+=2,n=[E,t.referredTo,i,a,s];break;case 38:case 39:let u={};u.info=sr(i,a),a+=ar;let d=i[a++];if(u.mmr=!!(d&1),u.template=d>>1&3,u.prediction=!!(d&8),!u.mmr){for(o=u.template===0?4:1,r=[],g=0;g<o;g++)r.push({x:Di(i,a),y:Di(i,a+1)}),a+=2;u.at=r}n=[u,i,a,s];break;case 48:let x={width:le(i,a),height:le(i,a+4),resolutionX:le(i,a+8),resolutionY:le(i,a+12)};x.height===4294967295&&delete x.height;let p=i[a+16];we(i,a+17),x.lossless=!!(p&1),x.refinement=!!(p&2),x.defaultPixelValue=p>>2&1,x.combinationOperator=p>>3&3,x.requiresBuffer=!!(p&32),x.combinationOperatorOverride=!!(p&64),n=[x];break;case 49:break;case 50:break;case 51:break;case 53:n=[t.number,i,a,s];break;case 62:break;default:throw new oe(`segment type ${t.typeName}(${t.type}) is not implemented`)}let I="on"+t.typeName;I in A&&A[I].apply(A,n)}function Bd(e,A){for(let t=0,i=e.length;t<i;t++)Cd(e[t],A)}function Qd(e){let A=new hI;for(let t=0,i=e.length;t<i;t++){let s=e[t],a=hd({},s.data,s.start,s.end);Bd(a,A)}return A.buffer}var hI=class{onPageInformation(A){this.currentPageInfo=A;let t=A.width+7>>3,i=new Uint8ClampedArray(t*A.height);A.defaultPixelValue&&i.fill(255),this.buffer=i}drawBitmap(A,t){let i=this.currentPageInfo,s=A.width,a=A.height,n=i.width+7>>3,r=i.combinationOperatorOverride?A.combinationOperator:i.combinationOperator,g=this.buffer,o=128>>(A.x&7),I=A.y*n+(A.x>>3),c,l,h,C;switch(r){case 0:for(c=0;c<a;c++){for(h=o,C=I,l=0;l<s;l++)t[c][l]&&(g[C]|=h),h>>=1,h||(h=128,C++);I+=n}break;case 2:for(c=0;c<a;c++){for(h=o,C=I,l=0;l<s;l++)t[c][l]&&(g[C]^=h),h>>=1,h||(h=128,C++);I+=n}break;default:throw new oe(`operator ${r} is not supported`)}}onImmediateGenericRegion(A,t,i,s){let a=A.info,n=new g0(t,i,s),r=_g(A.mmr,a.width,a.height,A.template,A.prediction,null,A.at,n);this.drawBitmap(a,r)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(A,t,i,s,a,n){let r,g;A.huffman&&(r=ud(A,i,this.customTables),g=new w0(s,a,n));let o=this.symbols;o||(this.symbols=o={});let I=[];for(let l of i){let h=o[l];h&&I.push(...h)}let c=new g0(s,a,n);o[t]=od(A.huffman,A.refinement,I,A.numberOfNewSymbols,A.numberOfExportedSymbols,r,A.template,A.at,A.refinementTemplate,A.refinementAt,c,g)}onImmediateTextRegion(A,t,i,s,a){let n=A.info,r,g,o=this.symbols,I=[];for(let C of t){let B=o[C];B&&I.push(...B)}let c=g1(I.length);A.huffman&&(g=new w0(i,s,a),r=fd(A,t,this.customTables,I.length,g));let l=new g0(i,s,a),h=cf(A.huffman,A.refinement,n.width,n.height,A.defaultPixelValue,A.numberOfSymbolInstances,A.stripSize,I,c,A.transposed,A.dsOffset,A.referenceCorner,A.combinationOperator,r,A.refinementTemplate,A.refinementAt,l,A.logStripSize,g);this.drawBitmap(n,h)}onImmediateLosslessTextRegion(){this.onImmediateTextRegion(...arguments)}onPatternDictionary(A,t,i,s,a){let n=this.patterns;n||(this.patterns=n={});let r=new g0(i,s,a);n[t]=Id(A.mmr,A.patternWidth,A.patternHeight,A.maxPatternIndex,A.template,r)}onImmediateHalftoneRegion(A,t,i,s,a){let n=this.patterns[t[0]],r=A.info,g=new g0(i,s,a),o=cd(A.mmr,n,A.template,r.width,r.height,A.defaultPixelValue,A.enableSkip,A.combinationOperator,A.gridWidth,A.gridHeight,A.gridOffsetX,A.gridOffsetY,A.gridVectorX,A.gridVectorY,g);this.drawBitmap(r,o)}onImmediateLosslessHalftoneRegion(){this.onImmediateHalftoneRegion(...arguments)}onTables(A,t,i,s){let a=this.customTables;a||(this.customTables=a={}),a[A]=Ed(t,i,s)}},si=class{constructor(A){A.length===2?(this.isOOB=!0,this.rangeLow=0,this.prefixLength=A[0],this.rangeLength=0,this.prefixCode=A[1],this.isLowerRange=!1):(this.isOOB=!1,this.rangeLow=A[0],this.prefixLength=A[1],this.rangeLength=A[2],this.prefixCode=A[3],this.isLowerRange=A[4]==="lower")}},Ns=class{constructor(A){this.children=[],A?(this.isLeaf=!0,this.rangeLength=A.rangeLength,this.rangeLow=A.rangeLow,this.isLowerRange=A.isLowerRange,this.isOOB=A.isOOB):this.isLeaf=!1}buildTree(A,t){let i=A.prefixCode>>t&1;if(t<=0)this.children[i]=new Ns(A);else{let s=this.children[i];s||(this.children[i]=s=new Ns(null)),s.buildTree(A,t-1)}}decodeNode(A){if(this.isLeaf){if(this.isOOB)return null;let i=A.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-i:i)}let t=this.children[A.readBit()];if(!t)throw new oe("invalid Huffman data");return t.decodeNode(A)}},Gs=class{constructor(A,t){t||this.assignPrefixCodes(A),this.rootNode=new Ns(null);for(let i=0,s=A.length;i<s;i++){let a=A[i];a.prefixLength>0&&this.rootNode.buildTree(a,a.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){let t=A.length,i=0;for(let I=0;I<t;I++)i=Math.max(i,A[I].prefixLength);let s=new Uint32Array(i+1);for(let I=0;I<t;I++)s[A[I].prefixLength]++;let a=1,n=0,r,g,o;for(s[0]=0;a<=i;){for(n=n+s[a-1]<<1,r=n,g=0;g<t;)o=A[g],o.prefixLength===a&&(o.prefixCode=r,r++),g++;a++}}};function Ed(e,A,t){let i=e[A],s=le(e,A+1)&4294967295,a=le(e,A+5)&4294967295,n=new w0(e,A+9,t),r=(i>>1&7)+1,g=(i>>4&7)+1,o=[],I,c,l=s;do I=n.readBits(r),c=n.readBits(g),o.push(new si([l,I,c,0])),l+=1<<c;while(l<a);return I=n.readBits(r),o.push(new si([s-1,I,32,0,"lower"])),I=n.readBits(r),o.push(new si([a,I,32,0])),i&1&&(I=n.readBits(r),o.push(new si([I,0]))),new Gs(o,!1)}var W1={};function vi(e){let A=W1[e];if(A)return A;let t;switch(e){case 1:t=[[0,1,4,0],[16,2,8,2],[272,3,16,6],[65808,3,32,7]];break;case 2:t=[[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[75,6,32,62],[6,63]];break;case 3:t=[[-256,8,8,254],[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[-257,8,32,255,"lower"],[75,7,32,126],[6,62]];break;case 4:t=[[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[76,5,32,31]];break;case 5:t=[[-255,7,8,126],[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[-256,7,32,127,"lower"],[76,6,32,62]];break;case 6:t=[[-2048,5,10,28],[-1024,4,9,8],[-512,4,8,9],[-256,4,7,10],[-128,5,6,29],[-64,5,5,30],[-32,4,5,11],[0,2,7,0],[128,3,7,2],[256,3,8,3],[512,4,9,12],[1024,4,10,13],[-2049,6,32,62,"lower"],[2048,6,32,63]];break;case 7:t=[[-1024,4,9,8],[-512,3,8,0],[-256,4,7,9],[-128,5,6,26],[-64,5,5,27],[-32,4,5,10],[0,4,5,11],[32,5,5,28],[64,5,6,29],[128,4,7,12],[256,3,8,1],[512,3,9,2],[1024,3,10,3],[-1025,5,32,30,"lower"],[2048,5,32,31]];break;case 8:t=[[-15,8,3,252],[-7,9,1,508],[-5,8,1,253],[-3,9,0,509],[-2,7,0,124],[-1,4,0,10],[0,2,1,0],[2,5,0,26],[3,6,0,58],[4,3,4,4],[20,6,1,59],[22,4,4,11],[38,4,5,12],[70,5,6,27],[134,5,7,28],[262,6,7,60],[390,7,8,125],[646,6,10,61],[-16,9,32,510,"lower"],[1670,9,32,511],[2,1]];break;case 9:t=[[-31,8,4,252],[-15,9,2,508],[-11,8,2,253],[-7,9,1,509],[-5,7,1,124],[-3,4,1,10],[-1,3,1,2],[1,3,1,3],[3,5,1,26],[5,6,1,58],[7,3,5,4],[39,6,2,59],[43,4,5,11],[75,4,6,12],[139,5,7,27],[267,5,8,28],[523,6,8,60],[779,7,9,125],[1291,6,11,61],[-32,9,32,510,"lower"],[3339,9,32,511],[2,0]];break;case 10:t=[[-21,7,4,122],[-5,8,0,252],[-4,7,0,123],[-3,5,0,24],[-2,2,2,0],[2,5,0,25],[3,6,0,54],[4,7,0,124],[5,8,0,253],[6,2,6,1],[70,5,5,26],[102,6,5,55],[134,6,6,56],[198,6,7,57],[326,6,8,58],[582,6,9,59],[1094,6,10,60],[2118,7,11,125],[-22,8,32,254,"lower"],[4166,8,32,255],[2,2]];break;case 11:t=[[1,1,0,0],[2,2,1,2],[4,4,0,12],[5,4,1,13],[7,5,1,28],[9,5,2,29],[13,6,2,60],[17,7,2,122],[21,7,3,123],[29,7,4,124],[45,7,5,125],[77,7,6,126],[141,7,32,127]];break;case 12:t=[[1,1,0,0],[2,2,0,2],[3,3,1,6],[5,5,0,28],[6,5,1,29],[8,6,1,60],[10,7,0,122],[11,7,1,123],[13,7,2,124],[17,7,3,125],[25,7,4,126],[41,8,5,254],[73,8,32,255]];break;case 13:t=[[1,1,0,0],[2,3,0,4],[3,4,0,12],[4,5,0,28],[5,4,1,13],[7,3,3,5],[15,6,1,58],[17,6,2,59],[21,6,3,60],[29,6,4,61],[45,6,5,62],[77,7,6,126],[141,7,32,127]];break;case 14:t=[[-2,3,0,4],[-1,3,0,5],[0,1,0,0],[1,3,0,6],[2,3,0,7]];break;case 15:t=[[-24,7,4,124],[-8,6,2,60],[-4,5,1,28],[-2,4,0,12],[-1,3,0,4],[0,1,0,0],[1,3,0,5],[2,4,0,13],[3,5,1,29],[5,6,2,61],[9,7,4,125],[-25,7,32,126,"lower"],[25,7,32,127]];break;default:throw new oe(`standard table B.${e} does not exist`)}for(let i=0,s=t.length;i<s;i++)t[i]=new si(t[i]);return A=new Gs(t,!0),W1[e]=A,A}var w0=class{constructor(A,t,i){this.data=A,this.start=t,this.end=i,this.position=t,this.shift=-1,this.currentByte=0}readBit(){if(this.shift<0){if(this.position>=this.end)throw new oe("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7}let A=this.currentByte>>this.shift&1;return this.shift--,A}readBits(A){let t=0,i;for(i=A-1;i>=0;i--)t|=this.readBit()<<i;return t}byteAlign(){this.shift=-1}next(){return this.position>=this.end?-1:this.data[this.position++]}};function h0(e,A,t){let i=0;for(let s=0,a=A.length;s<a;s++){let n=t[A[s]];if(n){if(e===i)return n;i++}}throw new oe("can\'t find custom Huffman table")}function fd(e,A,t,i,s){let a=[];for(let l=0;l<=34;l++){let h=s.readBits(4);a.push(new si([l,h,0,0]))}let n=new Gs(a,!1);a.length=0;for(let l=0;l<i;){let h=n.decode(s);if(h>=32){let C,B,Q;switch(h){case 32:if(l===0)throw new oe("no previous value in symbol ID table");B=s.readBits(2)+3,C=a[l-1].prefixLength;break;case 33:B=s.readBits(3)+3,C=0;break;case 34:B=s.readBits(7)+11,C=0;break;default:throw new oe("invalid code length in symbol ID table")}for(Q=0;Q<B;Q++)a.push(new si([l,C,0,0])),l++}else a.push(new si([l,h,0,0])),l++}s.byteAlign();let r=new Gs(a,!1),g=0,o,I,c;switch(e.huffmanFS){case 0:case 1:o=vi(e.huffmanFS+6);break;case 3:o=h0(g,A,t),g++;break;default:throw new oe("invalid Huffman FS selector")}switch(e.huffmanDS){case 0:case 1:case 2:I=vi(e.huffmanDS+8);break;case 3:I=h0(g,A,t),g++;break;default:throw new oe("invalid Huffman DS selector")}switch(e.huffmanDT){case 0:case 1:case 2:c=vi(e.huffmanDT+11);break;case 3:c=h0(g,A,t),g++;break;default:throw new oe("invalid Huffman DT selector")}if(e.refinement)throw new oe("refinement with Huffman is not supported");return{symbolIDTable:r,tableFirstS:o,tableDeltaS:I,tableDeltaT:c}}function ud(e,A,t){let i=0,s,a;switch(e.huffmanDHSelector){case 0:case 1:s=vi(e.huffmanDHSelector+4);break;case 3:s=h0(i,A,t),i++;break;default:throw new oe("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:a=vi(e.huffmanDWSelector+2);break;case 3:a=h0(i,A,t),i++;break;default:throw new oe("invalid Huffman DW selector")}let n,r;return e.bitmapSizeSelector?(n=h0(i,A,t),i++):n=vi(1),e.aggregationInstancesSelector?r=h0(i,A,t):r=vi(1),{tableDeltaHeight:s,tableDeltaWidth:a,tableBitmapSize:n,tableAggregateInstances:r}}function dd(e,A,t){let i=[];for(let s=0;s<t;s++){let a=new Uint8Array(A);i.push(a);for(let n=0;n<A;n++)a[n]=e.readBit();e.byteAlign()}return i}function I1(e,A,t,i){let s={K:-1,Columns:A,Rows:t,BlackIs1:!0,EndOfBlock:i},a=new pr(e,s),n=[],r,g=!1;for(let o=0;o<t;o++){let I=new Uint8Array(A);n.push(I);let c=-1;for(let l=0;l<A;l++)c<0&&(r=a.readNextChar(),r===-1&&(r=0,g=!0),c=7),I[l]=r>>c&1,c--}if(i&&!g)for(let I=0;I<5&&a.readNextChar()!==-1;I++);return n}var CI=class{parseChunks(A){return Qd(A)}parse(A){throw new Error("Not implemented: Jbig2Image.parse")}},BI=class extends Me{constructor(A,t,i){super(t),this.stream=A,this.dict=A.dict,this.maybeLength=t,this.params=i}get bytes(){return nA(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(){this.decodeImage()}decodeImage(A){if(this.eof)return this.buffer;A||(A=this.bytes);let t=new CI,i=[];if(this.params instanceof F){let n=this.params.get("JBIG2Globals");if(n instanceof KA){let r=n.getBytes();i.push({data:r,start:0,end:r.length})}}i.push({data:A,start:0,end:A.length});let s=t.parseChunks(i),a=s.length;for(let n=0;n<a;n++)s[n]^=255;return this.buffer=s,this.bufferLength=a,this.eof=!0,this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}};function xd(e){switch(e.kind){case Ke.GRAYSCALE_1BPP:return QI(e);case Ke.RGB_24BPP:return md(e)}return null}function QI({src:e,srcPos:A=0,dest:t,width:i,height:s,nonBlackColor:a=4294967295,inverseDecode:n=!1}){let r=Ot.isLittleEndian?4278190080:255,[g,o]=n?[a,r]:[r,a],I=i>>3,c=i&7,l=e.length;t=new Uint32Array(t.buffer);let h=0;for(let C=0;C<s;C++){for(let Q=A+I;A<Q;A++){let E=A<l?e[A]:255;t[h++]=E&128?o:g,t[h++]=E&64?o:g,t[h++]=E&32?o:g,t[h++]=E&16?o:g,t[h++]=E&8?o:g,t[h++]=E&4?o:g,t[h++]=E&2?o:g,t[h++]=E&1?o:g}if(c===0)continue;let B=A<l?e[A++]:255;for(let Q=0;Q<c;Q++)t[h++]=B&1<<7-Q?o:g}return{srcPos:A,destPos:h}}function md({src:e,srcPos:A=0,dest:t,destPos:i=0,width:s,height:a}){let n=0,r=e.length>>2,g=new Uint32Array(e.buffer,A,r);if(Ot.isLittleEndian){for(;n<r-2;n+=3,i+=4){let o=g[n],I=g[n+1],c=g[n+2];t[i]=o|4278190080,t[i+1]=o>>>24|I<<8|4278190080,t[i+2]=I>>>16|c<<16|4278190080,t[i+3]=c>>>8|4278190080}for(let o=n*4,I=e.length;o<I;o+=3)t[i++]=e[o]|e[o+1]<<8|e[o+2]<<16|4278190080}else{for(;n<r-2;n+=3,i+=4){let o=g[n],I=g[n+1],c=g[n+2];t[i]=o|255,t[i+1]=o<<24|I>>>8|255,t[i+2]=I<<16|c>>>16|255,t[i+3]=c<<8|255}for(let o=n*4,I=e.length;o<I;o+=3)t[i++]=e[o]<<24|e[o+1]<<16|e[o+2]<<8|255}return{srcPos:A,destPos:i}}function pd(e,A){if(Ot.isLittleEndian)for(let t=0,i=e.length;t<i;t++)A[t]=e[t]*65793|4278190080;else for(let t=0,i=e.length;t<i;t++)A[t]=e[t]*16843008|255}var Gt=class extends At{constructor(A){super(A,"JpegError")}},Fa=class extends At{constructor(A,t){super(A,"DNLMarkerError"),this.scanLines=t}},yr=class extends At{constructor(A){super(A,"EOIMarkerError")}},Qa=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Gn=4017,Un=799,Mn=3406,Ln=2276,Hn=1567,Jn=3784,v0=5793,Yn=2896;function wd(e,A){let t=0,i,s,a=16;for(;a>0&&!e[a-1];)a--;let n=[{children:[],index:0}],r=n[0],g;for(i=0;i<a;i++){for(s=0;s<e[i];s++){for(r=n.pop(),r.children[r.index]=A[t];r.index>0;)r=n.pop();for(r.index++,n.push(r);n.length<=i;)n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g;t++}i+1<a&&(n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g)}return n[0].children}function EI(e,A,t){return 64*((e.blocksPerLine+1)*A+t)}function yd(e,A,t,i,s,a,n,r,g,o=!1){let I=t.mcusPerLine,c=t.progressive,l=A,h=0,C=0;function B(){if(C>0)return C--,h>>C&1;if(h=e[A++],h===255){let CA=e[A++];if(CA){if(CA===220&&o){A+=2;let N=we(e,A);if(A+=2,N>0&&N!==t.scanLines)throw new Fa("Found DNL marker (0xFFDC) while parsing scan data",N)}else if(CA===217){if(o){let N=Y*(t.precision===8?8:0);if(N>0&&Math.round(t.scanLines/N)>=5)throw new Fa("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",N)}throw new yr("Found EOI marker (0xFFD9) while parsing scan data")}throw new Gt(`unexpected marker ${(h<<8|CA).toString(16)}`)}}return C=7,h>>>7}function Q(CA){let N=CA;for(;;){switch(N=N[B()],typeof N){case"number":return N;case"object":continue}throw new Gt("invalid huffman sequence")}}function E(CA){let N=0;for(;CA>0;)N=N<<1|B(),CA--;return N}function f(CA){if(CA===1)return B()===1?1:-1;let N=E(CA);return N>=1<<CA-1?N:N+(-1<<CA)+1}function u(CA,N){let H=Q(CA.huffmanTableDC),q=H===0?0:f(H);CA.blockData[N]=CA.pred+=q;let T=1;for(;T<64;){let $=Q(CA.huffmanTableAC),X=$&15,W=$>>4;if(X===0){if(W<15)break;T+=16;continue}T+=W;let G=Qa[T];CA.blockData[N+G]=f(X),T++}}function d(CA,N){let H=Q(CA.huffmanTableDC),q=H===0?0:f(H)<<g;CA.blockData[N]=CA.pred+=q}function x(CA,N){CA.blockData[N]|=B()<<g}let p=0;function m(CA,N){if(p>0){p--;return}let H=a,q=n;for(;H<=q;){let T=Q(CA.huffmanTableAC),$=T&15,X=T>>4;if($===0){if(X<15){p=E(X)+(1<<X)-1;break}H+=16;continue}H+=X;let W=Qa[H];CA.blockData[N+W]=f($)*(1<<g),H++}}let D=0,S;function w(CA,N){let H=a,q=n,T=0,$,X;for(;H<=q;){let W=N+Qa[H],G=CA.blockData[W]<0?-1:1;switch(D){case 0:if(X=Q(CA.huffmanTableAC),$=X&15,T=X>>4,$===0)T<15?(p=E(T)+(1<<T),D=4):(T=16,D=1);else{if($!==1)throw new Gt("invalid ACn encoding");S=f($),D=T?2:3}continue;case 1:case 2:CA.blockData[W]?CA.blockData[W]+=G*(B()<<g):(T--,T===0&&(D=D===2?3:0));break;case 3:CA.blockData[W]?CA.blockData[W]+=G*(B()<<g):(CA.blockData[W]=S<<g,D=0);break;case 4:CA.blockData[W]&&(CA.blockData[W]+=G*(B()<<g));break}H++}D===4&&(p--,p===0&&(D=0))}let Y=0;function U(CA,N,H,q,T){let $=H/I|0,X=H%I;Y=$*CA.v+q;let W=X*CA.h+T,G=EI(CA,Y,W);N(CA,G)}function K(CA,N,H){Y=H/CA.blocksPerLine|0;let q=H%CA.blocksPerLine,T=EI(CA,Y,q);N(CA,T)}let Z=i.length,AA,gA,R,_,tA,IA;c?a===0?IA=r===0?d:x:IA=r===0?m:w:IA=u;let QA=0,V,lA=Z===1?i[0].blocksPerLine*i[0].blocksPerColumn:I*t.mcusPerColumn,EA,fA;for(;QA<=lA;){let CA=s?Math.min(lA-QA,s):lA;if(CA>0){for(gA=0;gA<Z;gA++)i[gA].pred=0;if(p=0,Z===1)for(AA=i[0],tA=0;tA<CA;tA++)K(AA,IA,QA),QA++;else for(tA=0;tA<CA;tA++){for(gA=0;gA<Z;gA++)for(AA=i[gA],EA=AA.h,fA=AA.v,R=0;R<fA;R++)for(_=0;_<EA;_++)U(AA,IA,QA,R,_);QA++}}if(C=0,V=fI(e,A),!V)break;if(V.invalid){let N=CA>0?"unexpected":"excessive";k(`decodeScan - ${N} MCU data, current marker is: ${V.invalid}`),A=V.offset}if(V.marker>=65488&&V.marker<=65495)A+=2;else break}return A-l}function bd(e,A,t){let i=e.quantizationTable,s=e.blockData,a,n,r,g,o,I,c,l,h,C,B,Q,E,f,u,d,x;if(!i)throw new Gt("missing required Quantization Table.");for(let p=0;p<64;p+=8){if(h=s[A+p],C=s[A+p+1],B=s[A+p+2],Q=s[A+p+3],E=s[A+p+4],f=s[A+p+5],u=s[A+p+6],d=s[A+p+7],h*=i[p],!(C|B|Q|E|f|u|d)){x=v0*h+512>>10,t[p]=x,t[p+1]=x,t[p+2]=x,t[p+3]=x,t[p+4]=x,t[p+5]=x,t[p+6]=x,t[p+7]=x;continue}C*=i[p+1],B*=i[p+2],Q*=i[p+3],E*=i[p+4],f*=i[p+5],u*=i[p+6],d*=i[p+7],a=v0*h+128>>8,n=v0*E+128>>8,r=B,g=u,o=Yn*(C-d)+128>>8,l=Yn*(C+d)+128>>8,I=Q<<4,c=f<<4,a=a+n+1>>1,n=a-n,x=r*Jn+g*Hn+128>>8,r=r*Hn-g*Jn+128>>8,g=x,o=o+c+1>>1,c=o-c,l=l+I+1>>1,I=l-I,a=a+g+1>>1,g=a-g,n=n+r+1>>1,r=n-r,x=o*Ln+l*Mn+2048>>12,o=o*Mn-l*Ln+2048>>12,l=x,x=I*Un+c*Gn+2048>>12,I=I*Gn-c*Un+2048>>12,c=x,t[p]=a+l,t[p+7]=a-l,t[p+1]=n+c,t[p+6]=n-c,t[p+2]=r+I,t[p+5]=r-I,t[p+3]=g+o,t[p+4]=g-o}for(let p=0;p<8;++p){if(h=t[p],C=t[p+8],B=t[p+16],Q=t[p+24],E=t[p+32],f=t[p+40],u=t[p+48],d=t[p+56],!(C|B|Q|E|f|u|d)){x=v0*h+8192>>14,x<-2040?x=0:x>=2024?x=255:x=x+2056>>4,s[A+p]=x,s[A+p+8]=x,s[A+p+16]=x,s[A+p+24]=x,s[A+p+32]=x,s[A+p+40]=x,s[A+p+48]=x,s[A+p+56]=x;continue}a=v0*h+2048>>12,n=v0*E+2048>>12,r=B,g=u,o=Yn*(C-d)+2048>>12,l=Yn*(C+d)+2048>>12,I=Q,c=f,a=(a+n+1>>1)+4112,n=a-n,x=r*Jn+g*Hn+2048>>12,r=r*Hn-g*Jn+2048>>12,g=x,o=o+c+1>>1,c=o-c,l=l+I+1>>1,I=l-I,a=a+g+1>>1,g=a-g,n=n+r+1>>1,r=n-r,x=o*Ln+l*Mn+2048>>12,o=o*Mn-l*Ln+2048>>12,l=x,x=I*Un+c*Gn+2048>>12,I=I*Gn-c*Un+2048>>12,c=x,h=a+l,d=a-l,C=n+c,u=n-c,B=r+I,f=r-I,Q=g+o,E=g-o,h<16?h=0:h>=4080?h=255:h>>=4,C<16?C=0:C>=4080?C=255:C>>=4,B<16?B=0:B>=4080?B=255:B>>=4,Q<16?Q=0:Q>=4080?Q=255:Q>>=4,E<16?E=0:E>=4080?E=255:E>>=4,f<16?f=0:f>=4080?f=255:f>>=4,u<16?u=0:u>=4080?u=255:u>>=4,d<16?d=0:d>=4080?d=255:d>>=4,s[A+p]=h,s[A+p+8]=C,s[A+p+16]=B,s[A+p+24]=Q,s[A+p+32]=E,s[A+p+40]=f,s[A+p+48]=u,s[A+p+56]=d}}function Dd(e,A){let t=A.blocksPerLine,i=A.blocksPerColumn,s=new Int16Array(64);for(let a=0;a<i;a++)for(let n=0;n<t;n++){let r=EI(A,a,n);bd(A,r,s)}return A.blockData}function fI(e,A,t=A){let i=e.length-1,s=t<A?t:A;if(A>=i)return null;let a=we(e,A);if(a>=65472&&a<=65534)return{invalid:null,marker:a,offset:A};let n=we(e,s);for(;!(n>=65472&&n<=65534);){if(++s>=i)return null;n=we(e,s)}return{invalid:a.toString(16),marker:n,offset:s}}var uI=class{constructor({decodeTransform:A=null,colorTransform:t=-1}={}){this._decodeTransform=A,this._colorTransform=t}parse(A,{dnlScanLines:t=null}={}){function i(){let B=we(A,a);a+=2;let Q=a+B-2,E=fI(A,Q,a);E!=null&&E.invalid&&(k("readDataBlock - incorrect length, current marker is: "+E.invalid),Q=E.offset);let f=A.subarray(a,Q);return a+=f.length,f}function s(B){let Q=Math.ceil(B.samplesPerLine/8/B.maxH),E=Math.ceil(B.scanLines/8/B.maxV);for(let f of B.components){let u=Math.ceil(Math.ceil(B.samplesPerLine/8)*f.h/B.maxH),d=Math.ceil(Math.ceil(B.scanLines/8)*f.v/B.maxV),x=Q*f.h,m=64*(E*f.v)*(x+1);f.blockData=new Int16Array(m),f.blocksPerLine=u,f.blocksPerColumn=d}B.mcusPerLine=Q,B.mcusPerColumn=E}let a=0,n=null,r=null,g,o,I=0,c=[],l=[],h=[],C=we(A,a);if(a+=2,C!==65496)throw new Gt("SOI not found");C=we(A,a),a+=2;A:for(;C!==65497;){let B,Q,E;switch(C){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:let f=i();C===65504&&f[0]===74&&f[1]===70&&f[2]===73&&f[3]===70&&f[4]===0&&(n={version:{major:f[5],minor:f[6]},densityUnits:f[7],xDensity:f[8]<<8|f[9],yDensity:f[10]<<8|f[11],thumbWidth:f[12],thumbHeight:f[13],thumbData:f.subarray(14,14+3*f[12]*f[13])}),C===65518&&f[0]===65&&f[1]===100&&f[2]===111&&f[3]===98&&f[4]===101&&(r={version:f[5]<<8|f[6],flags0:f[7]<<8|f[8],flags1:f[9]<<8|f[10],transformCode:f[11]});break;case 65499:let u=we(A,a);a+=2;let d=u+a-2,x;for(;a<d;){let _=A[a++],tA=new Uint16Array(64);if(_>>4)if(_>>4===1)for(Q=0;Q<64;Q++)x=Qa[Q],tA[x]=we(A,a),a+=2;else throw new Gt("DQT - invalid table spec");else for(Q=0;Q<64;Q++)x=Qa[Q],tA[x]=A[a++];c[_&15]=tA}break;case 65472:case 65473:case 65474:if(g)throw new Gt("Only single frame JPEGs supported");a+=2,g={},g.extended=C===65473,g.progressive=C===65474,g.precision=A[a++];let p=we(A,a);a+=2,g.scanLines=t||p,g.samplesPerLine=we(A,a),a+=2,g.components=[],g.componentIds={};let m=A[a++],D=0,S=0;for(B=0;B<m;B++){let _=A[a],tA=A[a+1]>>4,IA=A[a+1]&15;D<tA&&(D=tA),S<IA&&(S=IA);let QA=A[a+2];E=g.components.push({h:tA,v:IA,quantizationId:QA,quantizationTable:null}),g.componentIds[_]=E-1,a+=3}g.maxH=D,g.maxV=S,s(g);break;case 65476:let w=we(A,a);for(a+=2,B=2;B<w;){let _=A[a++],tA=new Uint8Array(16),IA=0;for(Q=0;Q<16;Q++,a++)IA+=tA[Q]=A[a];let QA=new Uint8Array(IA);for(Q=0;Q<IA;Q++,a++)QA[Q]=A[a];B+=17+IA,(_>>4?l:h)[_&15]=wd(tA,QA)}break;case 65501:a+=2,o=we(A,a),a+=2;break;case 65498:let Y=++I===1&&!t;a+=2;let U=A[a++],K=[];for(B=0;B<U;B++){let _=A[a++],tA=g.componentIds[_],IA=g.components[tA];IA.index=_;let QA=A[a++];IA.huffmanTableDC=h[QA>>4],IA.huffmanTableAC=l[QA&15],K.push(IA)}let Z=A[a++],AA=A[a++],gA=A[a++];try{let _=yd(A,a,g,K,o,Z,AA,gA>>4,gA&15,Y);a+=_}catch(_){if(_ instanceof Fa)return k(`${_.message} -- attempting to re-parse the JPEG image.`),this.parse(A,{dnlScanLines:_.scanLines});if(_ instanceof yr){k(`${_.message} -- ignoring the rest of the image data.`);break A}throw _}break;case 65500:a+=4;break;case 65535:A[a]!==255&&a--;break;default:let R=fI(A,a-2,a-3);if(R!=null&&R.invalid){k("JpegImage.parse - unexpected data, current marker is: "+R.invalid),a=R.offset;break}if(!R||a>=A.length-1){k("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new Gt("JpegImage.parse - unknown marker: "+C.toString(16))}C=we(A,a),a+=2}if(!g)throw new Gt("JpegImage.parse - no frame data found.");this.width=g.samplesPerLine,this.height=g.scanLines,this.jfif=n,this.adobe=r,this.components=[];for(let B of g.components){let Q=c[B.quantizationId];Q&&(B.quantizationTable=Q),this.components.push({index:B.index,output:Dd(g,B),scaleX:B.h/g.maxH,scaleY:B.v/g.maxV,blocksPerLine:B.blocksPerLine,blocksPerColumn:B.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(A,t,i=!1){let s=this.width/A,a=this.height/t,n,r,g,o,I,c,l,h,C,B,Q=0,E,f=this.components.length,u=A*t*f,d=new Uint8ClampedArray(u),x=new Uint32Array(A),p=4294967288,m;for(l=0;l<f;l++){if(n=this.components[l],r=n.scaleX*s,g=n.scaleY*a,Q=l,E=n.output,o=n.blocksPerLine+1<<3,r!==m){for(I=0;I<A;I++)h=0|I*r,x[I]=(h&p)<<3|h&7;m=r}for(c=0;c<t;c++)for(h=0|c*g,B=o*(h&p)|(h&7)<<3,I=0;I<A;I++)d[Q]=E[B+x[I]],Q+=f}let D=this._decodeTransform;if(!i&&f===4&&!D&&(D=new Int32Array([-256,255,-256,255,-256,255,-256,255])),D)for(l=0;l<u;)for(h=0,C=0;h<f;h++,l++,C+=2)d[l]=(d[l]*D[C]>>8)+D[C+1];return d}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:this.numComponents===3?this._colorTransform===0?!1:!(this.components[0].index===82&&this.components[1].index===71&&this.components[2].index===66):this._colorTransform===1}_convertYccToRgb(A){let t,i,s;for(let a=0,n=A.length;a<n;a+=3)t=A[a],i=A[a+1],s=A[a+2],A[a]=t-179.456+1.402*s,A[a+1]=t+135.459-.344*i-.714*s,A[a+2]=t-226.816+1.772*i;return A}_convertYccToRgba(A,t){for(let i=0,s=0,a=A.length;i<a;i+=3,s+=4){let n=A[i],r=A[i+1],g=A[i+2];t[s]=n-179.456+1.402*g,t[s+1]=n+135.459-.344*r-.714*g,t[s+2]=n-226.816+1.772*r,t[s+3]=255}return t}_convertYcckToRgb(A){let t,i,s,a,n=0;for(let r=0,g=A.length;r<g;r+=4)t=A[r],i=A[r+1],s=A[r+2],a=A[r+3],A[n++]=-122.67195406894+i*(-660635669420364e-19*i+.000437130475926232*s-54080610064599e-18*t+.00048449797120281*a-.154362151871126)+s*(-.000957964378445773*s+.000817076911346625*t-.00477271405408747*a+1.53380253221734)+t*(.000961250184130688*t-.00266257332283933*a+.48357088451265)+a*(-.000336197177618394*a+.484791561490776),A[n++]=107.268039397724+i*(219927104525741e-19*i-.000640992018297945*s+.000659397001245577*t+.000426105652938837*a-.176491792462875)+s*(-.000778269941513683*s+.00130872261408275*t+.000770482631801132*a-.151051492775562)+t*(.00126935368114843*t-.00265090189010898*a+.25802910206845)+a*(-.000318913117588328*a-.213742400323665),A[n++]=-20.810012546947+i*(-.000570115196973677*i-263409051004589e-19*s+.0020741088115012*t-.00288260236853442*a+.814272968359295)+s*(-153496057440975e-19*s-.000132689043961446*t+.000560833691242812*a-.195152027534049)+t*(.00174418132927582*t-.00255243321439347*a+.116935020465145)+a*(-.000343531996510555*a+.24165260232407);return A.subarray(0,n)}_convertYcckToRgba(A){for(let t=0,i=A.length;t<i;t+=4){let s=A[t],a=A[t+1],n=A[t+2],r=A[t+3];A[t]=-122.67195406894+a*(-660635669420364e-19*a+.000437130475926232*n-54080610064599e-18*s+.00048449797120281*r-.154362151871126)+n*(-.000957964378445773*n+.000817076911346625*s-.00477271405408747*r+1.53380253221734)+s*(.000961250184130688*s-.00266257332283933*r+.48357088451265)+r*(-.000336197177618394*r+.484791561490776),A[t+1]=107.268039397724+a*(219927104525741e-19*a-.000640992018297945*n+.000659397001245577*s+.000426105652938837*r-.176491792462875)+n*(-.000778269941513683*n+.00130872261408275*s+.000770482631801132*r-.151051492775562)+s*(.00126935368114843*s-.00265090189010898*r+.25802910206845)+r*(-.000318913117588328*r-.213742400323665),A[t+2]=-20.810012546947+a*(-.000570115196973677*a-263409051004589e-19*n+.0020741088115012*s-.00288260236853442*r+.814272968359295)+n*(-153496057440975e-19*n-.000132689043961446*s+.000560833691242812*r-.195152027534049)+s*(.00174418132927582*s-.00255243321439347*r+.116935020465145)+r*(-.000343531996510555*r+.24165260232407),A[t+3]=255}return A}_convertYcckToCmyk(A){let t,i,s;for(let a=0,n=A.length;a<n;a+=4)t=A[a],i=A[a+1],s=A[a+2],A[a]=434.456-t-1.402*s,A[a+1]=119.541-t+.344*i+.714*s,A[a+2]=481.816-t-1.772*i;return A}_convertCmykToRgb(A){let t,i,s,a,n=0;for(let r=0,g=A.length;r<g;r+=4)t=A[r],i=A[r+1],s=A[r+2],a=A[r+3],A[n++]=255+t*(-6747147073602441e-20*t+.0008379262121013727*i+.0002894718188643294*s+.003264231057537806*a-1.1185611867203937)+i*(26374107616089405e-21*i-8626949158638572e-20*s-.0002748769067499491*a-.02155688794978967)+s*(-3878099212869363e-20*s-.0003267808279485286*a+.0686742238595345)-a*(.0003361971776183937*a+.7430659151342254),A[n++]=255+t*(.00013596372813588848*t+.000924537132573585*i+.00010567359618683593*s+.0004791864687436512*a-.3109689587515875)+i*(-.00023545346108370344*i+.0002702845253534714*s+.0020200308977307156*a-.7488052167015494)+s*(6834815998235662e-20*s+.00015168452363460973*a-.09751927774728933)-a*(.0003189131175883281*a+.7364883807733168),A[n++]=255+t*(13598650411385307e-21*t+.00012423956175490851*i+.0004751985097583589*s-36729317476630422e-22*a-.05562186980264034)+i*(.00016141380598724676*i+.0009692239130725186*s+.0007782692450036253*a-.44015232367526463)+s*(5068882914068769e-22*s+.0017778369011375071*a-.7591454649749609)-a*(.0003435319965105553*a+.7063770186160144);return A.subarray(0,n)}_convertCmykToRgba(A){for(let t=0,i=A.length;t<i;t+=4){let s=A[t],a=A[t+1],n=A[t+2],r=A[t+3];A[t]=255+s*(-6747147073602441e-20*s+.0008379262121013727*a+.0002894718188643294*n+.003264231057537806*r-1.1185611867203937)+a*(26374107616089405e-21*a-8626949158638572e-20*n-.0002748769067499491*r-.02155688794978967)+n*(-3878099212869363e-20*n-.0003267808279485286*r+.0686742238595345)-r*(.0003361971776183937*r+.7430659151342254),A[t+1]=255+s*(.00013596372813588848*s+.000924537132573585*a+.00010567359618683593*n+.0004791864687436512*r-.3109689587515875)+a*(-.00023545346108370344*a+.0002702845253534714*n+.0020200308977307156*r-.7488052167015494)+n*(6834815998235662e-20*n+.00015168452363460973*r-.09751927774728933)-r*(.0003189131175883281*r+.7364883807733168),A[t+2]=255+s*(13598650411385307e-21*s+.00012423956175490851*a+.0004751985097583589*n-36729317476630422e-22*r-.05562186980264034)+a*(.00016141380598724676*a+.0009692239130725186*n+.0007782692450036253*r-.44015232367526463)+n*(5068882914068769e-22*n+.0017778369011375071*r-.7591454649749609)-r*(.0003435319965105553*r+.7063770186160144),A[t+3]=255}return A}getData({width:A,height:t,forceRGBA:i=!1,forceRGB:s=!1,isSourcePDF:a=!1}){if(this.numComponents>4)throw new Gt("Unsupported color mode");let n=this._getLinearizedBlockData(A,t,a);if(this.numComponents===1&&(i||s)){let r=n.length*(i?4:3),g=new Uint8ClampedArray(r),o=0;if(i)pd(n,new Uint32Array(g.buffer));else for(let I of n)g[o++]=I,g[o++]=I,g[o++]=I;return g}else if(this.numComponents===3&&this._isColorConversionNeeded){if(i){let r=new Uint8ClampedArray(n.length/3*4);return this._convertYccToRgba(n,r)}return this._convertYccToRgb(n)}else if(this.numComponents===4){if(this._isColorConversionNeeded)return i?this._convertYcckToRgba(n):s?this._convertYcckToRgb(n):this._convertYcckToCmyk(n);if(i)return this._convertCmykToRgba(n);if(s)return this._convertCmykToRgb(n)}return n}},Ra=class extends Me{constructor(A,t,i){super(t),this.stream=A,this.dict=A.dict,this.maybeLength=t,this.params=i}get bytes(){return nA(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(){this.decodeImage()}decodeImage(A){if(this.eof)return this.buffer;A||(A=this.bytes);for(let n=0,r=A.length-1;n<r;n++)if(A[n]===255&&A[n+1]===216){n>0&&(A=A.subarray(n));break}let t={decodeTransform:void 0,colorTransform:void 0},i=this.dict.getArray("D","Decode");if((this.forceRGBA||this.forceRGB)&&Array.isArray(i)){let n=this.dict.get("BPC","BitsPerComponent")||8,r=i.length,g=new Int32Array(r),o=!1,I=(1<<n)-1;for(let c=0;c<r;c+=2)g[c]=(i[c+1]-i[c])*256|0,g[c+1]=i[c]*I|0,(g[c]!==256||g[c+1]!==0)&&(o=!0);o&&(t.decodeTransform=g)}if(this.params instanceof F){let n=this.params.get("ColorTransform");Number.isInteger(n)&&(t.colorTransform=n)}let s=new uI(t);s.parse(A);let a=s.getData({width:this.drawWidth,height:this.drawHeight,forceRGBA:this.forceRGBA,forceRGB:this.forceRGB,isSourcePDF:!0});return this.buffer=a,this.bufferLength=a.length,this.eof=!0,this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}},kd=(()=>{var A;var e=typeof document!="undefined"?(A=document.currentScript)==null?void 0:A.src:void 0;return function(t={}){var i,s=t,a,n,r=new Promise((z,rA)=>{a=z,n=rA}),g=!0,o=!1;s.decode=function(z,{numComponents:rA=4,isIndexedColormap:xA=!1,smaskInData:RA=!1}){let YA=z.length,ae=s._malloc(YA);s.HEAPU8.set(z,ae);let ee=s._jp2_decode(ae,YA,rA>0?rA:0,!!xA,!!RA);if(s._free(ae),ee){let{errorMessages:te}=s;return te?(delete s.errorMessages,te):"Unknown error"}let{imageData:Oe}=s;return s.imageData=null,Oe};var I=Object.assign({},s),c=[],l="./this.program",h=(z,rA)=>{throw rA},C="",B,Q,E;(g||o)&&(o?C=self.location.href:typeof document!="undefined"&&document.currentScript&&(C=document.currentScript.src),e&&(C=e),C.startsWith("blob:")?C="":C=C.substr(0,C.replace(/[?#].*/,"").lastIndexOf("/")+1),B=z=>{var rA=new XMLHttpRequest;return rA.open("GET",z,!1),rA.send(null),rA.responseText},o&&(E=z=>{var rA=new XMLHttpRequest;return rA.open("GET",z,!1),rA.responseType="arraybuffer",rA.send(null),new Uint8Array(rA.response)}),Q=(z,rA,xA)=>{fetch(z,{credentials:"same-origin"}).then(RA=>RA.ok?RA.arrayBuffer():Promise.reject(new Error(RA.status+" : "+RA.url))).then(rA,xA)});var f=s.print||console.log.bind(console),u=s.printErr||console.error.bind(console);Object.assign(s,I),I=null,s.arguments&&(c=s.arguments),s.thisProgram&&(l=s.thisProgram),s.quit&&(h=s.quit);var d;s.wasmBinary&&(d=s.wasmBinary);function x(z){for(var rA=atob(z),xA=new Uint8Array(rA.length),RA=0;RA<rA.length;++RA)xA[RA]=rA.charCodeAt(RA);return xA}function p(z){if(G(z))return x(z.slice(W.length))}var m,D=!1,S,w,Y,U,K,Z,AA,gA;function R(){var z=m.buffer;s.HEAP8=S=new Int8Array(z),s.HEAP16=Y=new Int16Array(z),s.HEAPU8=w=new Uint8Array(z),s.HEAPU16=U=new Uint16Array(z),s.HEAP32=K=new Int32Array(z),s.HEAPU32=Z=new Uint32Array(z),s.HEAPF32=AA=new Float32Array(z),s.HEAPF64=gA=new Float64Array(z)}var _=[],tA=[],IA=[],QA=!1;function V(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)fA(s.preRun.shift());cA(_)}function lA(){QA=!0,cA(tA)}function EA(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)N(s.postRun.shift());cA(IA)}function fA(z){_.unshift(z)}function CA(z){tA.unshift(z)}function N(z){IA.unshift(z)}var H=0,q=null,T=null;function $(z){var rA;H++,(rA=s.monitorRunDependencies)==null||rA.call(s,H)}function X(z){var xA;if(H--,(xA=s.monitorRunDependencies)==null||xA.call(s,H),H==0&&(q!==null&&(clearInterval(q),q=null),T)){var rA=T;T=null,rA()}}var W="data:application/octet-stream;base64,",G=z=>z.startsWith(W);function BA(){var z="data:application/octet-stream;base64, ";return z}var uA;function bA(z){if(z==uA&&d)return new Uint8Array(d);var rA=p(z);if(rA)return rA;if(E)return E(z);throw\'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)\'}function iA(z,rA){var xA,RA=bA(z);xA=new WebAssembly.Module(RA);var YA=new WebAssembly.Instance(xA,rA);return[YA,xA]}function wA(){return{a:du}}function FA(){var z=wA();function rA(RA,YA){return wi=RA.exports,m=wi.p,R(),CA(wi.q),X("wasm-instantiate"),wi}if($("wasm-instantiate"),s.instantiateWasm)try{return s.instantiateWasm(z,rA)}catch(RA){u(`Module.instantiateWasm callback failed with error: ${RA}`),n(RA)}uA||(uA=BA());var xA=iA(uA,z);return rA(xA[0])}var cA=z=>{for(;z.length>0;)z.shift()(s)},yA=s.noExitRuntime||!0,aA=(z,rA,xA)=>w.copyWithin(z,rA,rA+xA);function DA(z,rA){z>>=2;let xA=s.imageData=new Uint8ClampedArray(rA),RA=s.HEAP32.subarray(z,z+rA);xA.set(RA)}function UA(z,rA,xA,RA){z>>=2,rA>>=2,xA>>=2;let YA=s.imageData=new Uint8ClampedArray(RA*3),ae=s.HEAP32.subarray(z,z+RA),ee=s.HEAP32.subarray(rA,rA+RA),Oe=s.HEAP32.subarray(xA,xA+RA);for(let te=0;te<RA;te++)YA[3*te]=ae[te],YA[3*te+1]=ee[te],YA[3*te+2]=Oe[te]}function Ee(z,rA,xA,RA,YA){z>>=2,rA>>=2,xA>>=2,RA>>=2;let ae=s.imageData=new Uint8ClampedArray(YA*4),ee=s.HEAP32.subarray(z,z+YA),Oe=s.HEAP32.subarray(rA,rA+YA),te=s.HEAP32.subarray(xA,xA+YA),yi=s.HEAP32.subarray(RA,RA+YA);for(let Xt=0;Xt<YA;Xt++)ae[4*Xt]=ee[Xt],ae[4*Xt+1]=Oe[Xt],ae[4*Xt+2]=te[Xt],ae[4*Xt+3]=yi[Xt]}var pA=()=>2147483648,TA=z=>{var rA=m.buffer,xA=(z-rA.byteLength+65535)/65536;try{return m.grow(xA),R(),1}catch(RA){}},LA=z=>{var rA=w.length;z>>>=0;var xA=pA();if(z>xA)return!1;for(var RA=(te,yi)=>te+(yi-te%yi)%yi,YA=1;YA<=4;YA*=2){var ae=rA*(1+.2/YA);ae=Math.min(ae,z+100663296);var ee=Math.min(xA,RA(Math.max(z,ae),65536)),Oe=TA(ee);if(Oe)return!0}return!1},WA={},re=()=>l||"./this.program",De=()=>{if(!De.strings){var z=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",rA={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:z,_:re()};for(var xA in WA)WA[xA]===void 0?delete rA[xA]:rA[xA]=WA[xA];var RA=[];for(var xA in rA)RA.push(`${xA}=${rA[xA]}`);De.strings=RA}return De.strings},Dn=(z,rA)=>{for(var xA=0;xA<z.length;++xA)S[rA++]=z.charCodeAt(xA);S[rA]=0},kn=(z,rA)=>{var xA=0;return De().forEach((RA,YA)=>{var ae=rA+xA;Z[z+YA*4>>2]=ae,Dn(RA,ae),xA+=RA.length+1}),0},Sn=(z,rA)=>{var xA=De();Z[z>>2]=xA.length;var RA=0;return xA.forEach(YA=>RA+=YA.length+1),Z[rA>>2]=RA,0},co=z=>52,Iu=(z,rA)=>rA+2097152>>>0<4194305-!!z?(z>>>0)+rA*4294967296:NaN;function cu(z,rA,xA,RA,YA){var ae=Iu(rA,xA);return 70}var lu=[null,[],[]],D1=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,k1=(z,rA,xA)=>{for(var RA=rA+xA,YA=rA;z[YA]&&!(YA>=RA);)++YA;if(YA-rA>16&&z.buffer&&D1)return D1.decode(z.subarray(rA,YA));for(var ae="";rA<YA;){var ee=z[rA++];if(!(ee&128)){ae+=String.fromCharCode(ee);continue}var Oe=z[rA++]&63;if((ee&224)==192){ae+=String.fromCharCode((ee&31)<<6|Oe);continue}var te=z[rA++]&63;if((ee&240)==224?ee=(ee&15)<<12|Oe<<6|te:ee=(ee&7)<<18|Oe<<12|te<<6|z[rA++]&63,ee<65536)ae+=String.fromCharCode(ee);else{var yi=ee-65536;ae+=String.fromCharCode(55296|yi>>10,56320|yi&1023)}}return ae},hu=(z,rA)=>{var xA=lu[z];rA===0||rA===10?((z===1?f:u)(k1(xA,0)),xA.length=0):xA.push(rA)},S1=(z,rA)=>z?k1(w,z,rA):"",Cu=(z,rA,xA,RA)=>{for(var YA=0,ae=0;ae<xA;ae++){var ee=Z[rA>>2],Oe=Z[rA+4>>2];rA+=8;for(var te=0;te<Oe;te++)hu(z,w[ee+te]);YA+=Oe}return Z[RA>>2]=YA,0};function Bu(z,rA){z>>=2;let xA=s.imageData=new Uint8ClampedArray(rA*4),RA=s.HEAP32.subarray(z,z+rA);for(let YA=0;YA<rA;YA++)xA[4*YA]=xA[4*YA+1]=xA[4*YA+2]=RA[YA],xA[4*YA+3]=255}function Qu(z,rA,xA){z>>=2,rA>>=2;let RA=s.imageData=new Uint8ClampedArray(xA*4),YA=s.HEAP32.subarray(z,z+xA),ae=s.HEAP32.subarray(rA,rA+xA);for(let ee=0;ee<xA;ee++)RA[4*ee]=RA[4*ee+1]=RA[4*ee+2]=YA[ee],RA[4*ee+3]=ae[ee]}function Eu(z){let rA=S1(z);(s.warn||console.warn)(`OpenJPEG: ${rA}`)}function fu(z,rA,xA,RA){z>>=2,rA>>=2,xA>>=2;let YA=s.imageData=new Uint8ClampedArray(RA*4),ae=s.HEAP32.subarray(z,z+RA),ee=s.HEAP32.subarray(rA,rA+RA),Oe=s.HEAP32.subarray(xA,xA+RA);for(let te=0;te<RA;te++)YA[4*te]=ae[te],YA[4*te+1]=ee[te],YA[4*te+2]=Oe[te],YA[4*te+3]=255}function uu(z){let rA=S1(z);s.errorMessages?s.errorMessages+=`\n`+rA:s.errorMessages=rA}var du={c:aA,g:DA,f:UA,e:Ee,k:LA,l:kn,m:Sn,n:co,j:cu,b:Cu,o:Bu,i:Qu,d:Eu,h:fu,a:uu},wi=FA(),kx=wi.q,Sx=s._malloc=wi.r,Fx=s._free=wi.s,Rx=s._jp2_decode=wi.u,Fn;T=function z(){Fn||F1(),Fn||(T=z)};function F1(){if(H>0||(V(),H>0))return;function z(){Fn||(Fn=!0,s.calledRun=!0,!D&&(lA(),a(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),EA()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),z()},1)):z()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return F1(),i=s,i}})(),Sd=kd,br=class extends At{constructor(A){super(A,"JpxError")}},ms,hs=class{static decode(A,t){t||(t={}),ne(this,ms)||_s(this,ms,Sd({warn:k}));let i=ne(this,ms).decode(A,t);if(typeof i=="string")throw new br(i);return i}static cleanup(){_s(this,ms,null)}static parseImageProperties(A){let t=A.getByte();for(;t>=0;){let i=t;if(t=A.getByte(),(i<<8|t)===65361){A.skip(4);let a=A.getInt32()>>>0,n=A.getInt32()>>>0,r=A.getInt32()>>>0,g=A.getInt32()>>>0;A.skip(16);let o=A.getUint16();return{width:a-r,height:n-g,bitsPerComponent:8,componentsCount:o}}}throw new br("No size marker found in JPX stream")}};ms=new WeakMap,HA(hs,ms,null);var dI=class extends Me{constructor(A,t,i){super(t),this.stream=A,this.dict=A.dict,this.maybeLength=t,this.params=i}get bytes(){return nA(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(A){this.decodeImage(null,A)}decodeImage(A,t){return this.eof?this.buffer:(A||(A=this.bytes),this.buffer=hs.decode(A,t),this.bufferLength=this.buffer.length,this.eof=!0,this.buffer)}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}},Dr=class extends Me{constructor(A,t,i){super(t),this.str=A,this.dict=A.dict,this.cachedData=0,this.bitsCached=0;let s=4096,a={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(s),dictionaryLengths:new Uint16Array(s),dictionaryPrevCodes:new Uint16Array(s),currentSequence:new Uint8Array(s),currentSequenceLength:0};for(let n=0;n<256;++n)a.dictionaryValues[n]=n,a.dictionaryLengths[n]=1;this.lzwState=a}readBits(A){let t=this.bitsCached,i=this.cachedData;for(;t<A;){let s=this.str.getByte();if(s===-1)return this.eof=!0,null;i=i<<8|s,t+=8}return this.bitsCached=t-=A,this.cachedData=i,this.lastCode=null,i>>>t&(1<<A)-1}readBlock(){let i=1024,s,a,n,r=this.lzwState;if(!r)return;let g=r.earlyChange,o=r.nextCode,I=r.dictionaryValues,c=r.dictionaryLengths,l=r.dictionaryPrevCodes,h=r.codeLength,C=r.prevCode,B=r.currentSequence,Q=r.currentSequenceLength,E=0,f=this.bufferLength,u=this.ensureBuffer(this.bufferLength+i);for(s=0;s<512;s++){let d=this.readBits(h),x=Q>0;if(d<256)B[0]=d,Q=1;else if(d>=258)if(d<o)for(Q=c[d],a=Q-1,n=d;a>=0;a--)B[a]=I[n],n=l[n];else B[Q++]=B[0];else if(d===256){h=9,o=258,Q=0;continue}else{this.eof=!0,delete this.lzwState;break}if(x&&(l[o]=C,c[o]=c[C]+1,I[o]=B[0],o++,h=o+g&o+g-1?h:Math.min(Math.log(o+g)/.6931471805599453+1,12)|0),C=d,E+=Q,i<E){do i+=512;while(i<E);u=this.ensureBuffer(this.bufferLength+i)}for(a=0;a<Q;a++)u[f++]=B[a]}r.nextCode=o,r.codeLength=h,r.prevCode=C,r.currentSequenceLength=Q,this.bufferLength=f}},kr=class extends Me{constructor(A,t,i){if(super(t),!(i instanceof F))return A;let s=this.predictor=i.get("Predictor")||1;if(s<=1)return A;if(s!==2&&(s<10||s>15))throw new v(`Unsupported predictor: ${s}`);this.readBlock=s===2?this.readBlockTiff:this.readBlockPng,this.str=A,this.dict=A.dict;let a=this.colors=i.get("Colors")||1,n=this.bits=i.get("BPC","BitsPerComponent")||8,r=this.columns=i.get("Columns")||1;return this.pixBytes=a*n+7>>3,this.rowBytes=r*a*n+7>>3,this}readBlockTiff(){let A=this.rowBytes,t=this.bufferLength,i=this.ensureBuffer(t+A),s=this.bits,a=this.colors,n=this.str.getBytes(A);if(this.eof=!n.length,this.eof)return;let r=0,g=0,o=0,I=0,c=t,l;if(s===1&&a===1)for(l=0;l<A;++l){let h=n[l]^r;h^=h>>1,h^=h>>2,h^=h>>4,r=(h&1)<<7,i[c++]=h}else if(s===8){for(l=0;l<a;++l)i[c++]=n[l];for(;l<A;++l)i[c]=i[c-a]+n[l],c++}else if(s===16){let h=a*2;for(l=0;l<h;++l)i[c++]=n[l];for(;l<A;l+=2){let C=((n[l]&255)<<8)+(n[l+1]&255)+((i[c-h]&255)<<8)+(i[c-h+1]&255);i[c++]=C>>8&255,i[c++]=C&255}}else{let h=new Uint8Array(a+1),C=(1<<s)-1,B=0,Q=t,E=this.columns;for(l=0;l<E;++l)for(let f=0;f<a;++f)o<s&&(r=r<<8|n[B++]&255,o+=8),h[f]=h[f]+(r>>o-s)&C,o-=s,g=g<<s|h[f],I+=s,I>=8&&(i[Q++]=g>>I-8&255,I-=8);I>0&&(i[Q++]=(g<<8-I)+(r&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){let A=this.rowBytes,t=this.pixBytes,i=this.str.getByte(),s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let a=this.bufferLength,n=this.ensureBuffer(a+A),r=n.subarray(a-A,a);r.length===0&&(r=new Uint8Array(A));let g,o=a,I,c;switch(i){case 0:for(g=0;g<A;++g)n[o++]=s[g];break;case 1:for(g=0;g<t;++g)n[o++]=s[g];for(;g<A;++g)n[o]=n[o-t]+s[g]&255,o++;break;case 2:for(g=0;g<A;++g)n[o++]=r[g]+s[g]&255;break;case 3:for(g=0;g<t;++g)n[o++]=(r[g]>>1)+s[g];for(;g<A;++g)n[o]=(r[g]+n[o-t]>>1)+s[g]&255,o++;break;case 4:for(g=0;g<t;++g)I=r[g],c=s[g],n[o++]=I+c;for(;g<A;++g){I=r[g];let l=r[g-t],h=n[o-t],C=h+I-l,B=C-h;B<0&&(B=-B);let Q=C-I;Q<0&&(Q=-Q);let E=C-l;E<0&&(E=-E),c=s[g],B<=Q&&B<=E?n[o++]=h+c:Q<=E?n[o++]=I+c:n[o++]=l+c}break;default:throw new v(`Unsupported predictor: ${i}`)}this.bufferLength+=A}},xI=class extends Me{constructor(A,t){super(t),this.str=A,this.dict=A.dict}readBlock(){let A=this.str.getBytes(2);if(!A||A.length<2||A[0]===128){this.eof=!0;return}let t,i=this.bufferLength,s=A[0];if(s<128){if(t=this.ensureBuffer(i+s+1),t[i++]=A[1],s>0){let a=this.str.getBytes(s);t.set(a,i),i+=s}}else{s=257-s;let a=A[1];t=this.ensureBuffer(i+s+1);for(let n=0;n<s;n++)t[i++]=a}this.bufferLength=i}},Fd=1e3;function Rd(e){let A=[],t=e.length,i=0;for(;i<t-1;)A.push(e[i++]<<8|e[i++]);return i<t&&A.push(e[i]),t+"_"+String.fromCharCode.apply(null,A)}var Ug,lf,zt=class{constructor({lexer:A,xref:t,allowStreams:i=!1,recoveryMode:s=!1}){HA(this,Ug);this.lexer=A,this.xref=t,this.allowStreams=i,this.recoveryMode=s,this.imageCache=Object.create(null),this._imageId=0,this.refill()}refill(){this.buf1=this.lexer.getObj(),this.buf2=this.lexer.getObj()}shift(){this.buf2 instanceof fe&&this.buf2.cmd==="ID"?(this.buf1=this.buf2,this.buf2=null):(this.buf1=this.buf2,this.buf2=this.lexer.getObj())}tryShift(){try{return this.shift(),!0}catch(A){if(A instanceof ge)throw A;return!1}}getObj(A=null){let t=this.buf1;if(this.shift(),t instanceof fe)switch(t.cmd){case"BI":return this.makeInlineImage(A);case"[":let i=[];for(;!Ne(this.buf1,"]")&&this.buf1!==Ge;)i.push(this.getObj(A));if(this.buf1===Ge){if(this.recoveryMode)return i;throw new Sa("End of file inside array.")}return this.shift(),i;case"<<":let s=new F(this.xref);for(;!Ne(this.buf1,">>")&&this.buf1!==Ge;){if(!(this.buf1 instanceof M)){PA("Malformed dictionary: key must be a name object"),this.shift();continue}let a=this.buf1.name;if(this.shift(),this.buf1===Ge)break;s.set(a,this.getObj(A))}if(this.buf1===Ge){if(this.recoveryMode)return s;throw new Sa("End of file inside dictionary.")}return Ne(this.buf2,"stream")?this.allowStreams?this.makeStream(s,A):s:(this.shift(),s);default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&Ne(this.buf2,"R")){let i=oA.get(t,this.buf1);return this.shift(),this.shift(),i}return t}return typeof t=="string"&&A?A.decryptString(t):t}findDefaultInlineStreamEnd(A){let{knownCommands:g}=this.lexer,o=A.pos,I=15,c=0,l,h;for(;(l=A.getByte())!==-1;)if(c===0)c=l===69?1:0;else if(c===1)c=l===73?2:0;else if(l===32||l===10||l===13){h=A.pos;let B=A.peekBytes(I),Q=B.length;if(Q===0)break;for(let u=0;u<Q;u++)if(l=B[u],!(l===0&&B[u+1]!==0)&&l!==10&&l!==13&&(l<32||l>127)){c=0;break}if(c!==2)continue;if(!g){k("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}let E=new dt(new Ie(B.slice()),g);E._hexStringWarn=()=>{};let f=0;for(;;){let u=E.getObj();if(u===Ge){c=0;break}if(u instanceof fe){let d=g[u.cmd];if(d){if(d.variableArgs?f<=d.numArgs:f===d.numArgs)break}else{c=0;break}f=0;continue}f++}if(c===2)break}else c=0;l===-1&&(k("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),h&&(k(\'... trying to recover by using the last "EI" occurrence.\'),A.skip(-(A.pos-h))));let C=4;return A.skip(-C),l=A.peekByte(),A.skip(C),pt(l)||C--,A.pos-C-o}findDCTDecodeInlineStreamEnd(A){let t=A.pos,i=!1,s,a;for(;(s=A.getByte())!==-1;)if(s===255){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:i=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:a=A.getUint16(),a>2?A.skip(a-2):A.skip(-2);break}if(i)break}let n=A.pos-t;return s===-1?(k("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-n),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),n)}findASCII85DecodeInlineStreamEnd(A){let s=A.pos,a;for(;(a=A.getByte())!==-1;)if(a===126){let r=A.pos;for(a=A.peekByte();pt(a);)A.skip(),a=A.peekByte();if(a===62){A.skip();break}if(A.pos>r){let g=A.peekBytes(2);if(g[0]===69&&g[1]===73)break}}let n=A.pos-s;return a===-1?(k("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-n),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),n)}findASCIIHexDecodeInlineStreamEnd(A){let i=A.pos,s;for(;(s=A.getByte())!==-1&&s!==62;);let a=A.pos-i;return s===-1?(k("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-a),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),a)}inlineStreamSkipEI(A){let s=0,a;for(;(a=A.getByte())!==-1;)if(s===0)s=a===69?1:0;else if(s===1)s=a===73?2:0;else if(s===2)break}makeInlineImage(A){let t=this.lexer,i=t.stream,s=Object.create(null),a;for(;!Ne(this.buf1,"ID")&&this.buf1!==Ge;){if(!(this.buf1 instanceof M))throw new v("Dictionary key must be a name object");let h=this.buf1.name;if(this.shift(),this.buf1===Ge)break;s[h]=this.getObj(A)}t.beginInlineImagePos!==-1&&(a=i.pos-t.beginInlineImagePos);let n=this.xref.fetchIfRef(s.F||s.Filter),r;if(n instanceof M)r=n.name;else if(Array.isArray(n)){let h=this.xref.fetchIfRef(n[0]);h instanceof M&&(r=h.name)}let g=i.pos,o;switch(r){case"DCT":case"DCTDecode":o=this.findDCTDecodeInlineStreamEnd(i);break;case"A85":case"ASCII85Decode":o=this.findASCII85DecodeInlineStreamEnd(i);break;case"AHx":case"ASCIIHexDecode":o=this.findASCIIHexDecodeInlineStreamEnd(i);break;default:o=this.findDefaultInlineStreamEnd(i)}let I;if(o<Fd&&a>0){let h=i.pos;i.pos=t.beginInlineImagePos,I=Rd(i.getBytes(a+o)),i.pos=h;let C=this.imageCache[I];if(C!==void 0)return this.buf2=fe.get("EI"),this.shift(),C.reset(),C}let c=new F(this.xref);for(let h in s)c.set(h,s[h]);let l=i.makeSubStream(g,o,c);return A&&(l=A.createStream(l,o)),l=this.filter(l,c,o),l.dict=c,I!==void 0&&(l.cacheKey=`inline_img_${++this._imageId}`,this.imageCache[I]=l),this.buf2=fe.get("EI"),this.shift(),l}makeStream(A,t){let i=this.lexer,s=i.stream;i.skipToNextLine();let a=s.pos-1,n=A.get("Length");if(Number.isInteger(n)||(PA(`Bad length "${n&&n.toString()}" in stream.`),n=0),s.pos=a+n,i.nextChar(),this.tryShift()&&Ne(this.buf2,"endstream"))this.shift();else{if(n=mA(this,Ug,lf).call(this,a),n<0)throw new v("Missing endstream command.");i.nextChar(),this.shift(),this.shift()}return this.shift(),s=s.makeSubStream(a,n,A),t&&(s=t.createStream(s,n)),s=this.filter(s,A,n),s.dict=A,s}filter(A,t,i){let s=t.get("F","Filter"),a=t.get("DP","DecodeParms");if(s instanceof M)return Array.isArray(a)&&k("/DecodeParms should not be an Array, when /Filter is a Name."),this.makeFilter(A,s.name,i,a);let n=i;if(Array.isArray(s)){let r=s,g=a;for(let o=0,I=r.length;o<I;++o){if(s=this.xref.fetchIfRef(r[o]),!(s instanceof M))throw new v(`Bad filter name "${s}"`);a=null,Array.isArray(g)&&o in g&&(a=this.xref.fetchIfRef(g[o])),A=this.makeFilter(A,s.name,n,a),n=null}}return A}makeFilter(A,t,i,s){if(i===0)return k(`Empty "${t}" stream.`),new Rs;try{switch(t){case"Fl":case"FlateDecode":return s?new kr(new wr(A,i),i,s):new wr(A,i);case"LZW":case"LZWDecode":let a=1;return s?(s.has("EarlyChange")&&(a=s.get("EarlyChange")),new kr(new Dr(A,i,a),i,s)):new Dr(A,i,a);case"DCT":case"DCTDecode":return new Ra(A,i,s);case"JPX":case"JPXDecode":return new dI(A,i,s);case"A85":case"ASCII85Decode":return new aI(A,i);case"AHx":case"ASCIIHexDecode":return new nI(A,i);case"CCF":case"CCITTFaxDecode":return new II(A,i,s);case"RL":case"RunLengthDecode":return new xI(A,i);case"JBIG2Decode":return new BI(A,i,s)}return k(`Filter "${t}" is not supported.`),A}catch(a){if(a instanceof ge)throw a;return k(`Invalid stream: "${a}"`),new Rs}}};Ug=new WeakSet,lf=function(A){let{stream:t}=this.lexer;t.pos=A;let i=2048,s=9,a=new Uint8Array([101,110,100]),n=a.length,r=[new Uint8Array([115,116,114,101,97,109]),new Uint8Array([115,116,101,97,109]),new Uint8Array([115,116,114,101,97])],g=s-n;for(;t.pos<t.end;){let o=t.peekBytes(i),I=o.length-s;if(I<=0)break;let c=0;for(;c<I;){let l=0;for(;l<n&&o[c+l]===a[l];)l++;if(l>=n){let h=!1;for(let C of r){let B=C.length,Q=0;for(;Q<B&&o[c+l+Q]===C[Q];)Q++;if(Q>=g){h=!0;break}if(Q>=B){let E=o[c+l+Q];pt(E)&&(PA(`Found "${Qt([...a,...C])}" when searching for endstream command.`),h=!0);break}}if(h)return t.pos+=c,t.pos-A}c++}t.pos+=I}return-1};var q0=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function Qo(e){return e>=48&&e<=57?e&15:e>=65&&e<=70||e>=97&&e<=102?(e&15)+9:-1}var dt=class{constructor(A,t=null){this.stream=A,this.nextChar(),this.strBuf=[],this.knownCommands=t,this._hexStringNumWarn=0,this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let A=this.currentChar,t=!1,i=0,s=1;if(A===45?(s=-1,A=this.nextChar(),A===45&&(A=this.nextChar())):A===43&&(A=this.nextChar()),A===10||A===13)do A=this.nextChar();while(A===10||A===13);if(A===46&&(i=10,A=this.nextChar()),A<48||A>57){let g=`Invalid number: ${String.fromCharCode(A)} (charCode ${A})`;if(pt(A)||A===-1)return PA(`Lexer.getNumber - "${g}".`),0;throw new v(g)}let a=A-48,n=0,r=1;for(;(A=this.nextChar())>=0;)if(A>=48&&A<=57){let g=A-48;t?n=n*10+g:(i!==0&&(i*=10),a=a*10+g)}else if(A===46)if(i===0)i=1;else break;else if(A===45)k("Badly formatted number: minus sign in the middle");else if(A===69||A===101){if(A=this.peekChar(),A===43||A===45)r=A===45?-1:1,this.nextChar();else if(A<48||A>57)break;t=!0}else break;return i!==0&&(a/=i),t&&(a*=10**(r*n)),s*a}getString(){let A=1,t=!1,i=this.strBuf;i.length=0;let s=this.nextChar();for(;;){let a=!1;switch(s|0){case-1:k("Unterminated string"),t=!0;break;case 40:++A,i.push("(");break;case 41:--A===0?(this.nextChar(),t=!0):i.push(")");break;case 92:switch(s=this.nextChar(),s){case-1:k("Unterminated string"),t=!0;break;case 110:i.push(`\n`);break;case 114:i.push("\\r");break;case 116:i.push("	");break;case 98:i.push("\\b");break;case 102:i.push("\\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(s));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let n=s&15;s=this.nextChar(),a=!0,s>=48&&s<=55&&(n=(n<<3)+(s&15),s=this.nextChar(),s>=48&&s<=55&&(a=!1,n=(n<<3)+(s&15))),i.push(String.fromCharCode(n));break;case 13:this.peekChar()===10&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(s));break}break;default:i.push(String.fromCharCode(s));break}if(t)break;a||(s=this.nextChar())}return i.join("")}getName(){let A,t,i=this.strBuf;for(i.length=0;(A=this.nextChar())>=0&&!q0[A];)if(A===35){if(A=this.nextChar(),q0[A]){k("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number."),i.push("#");break}let s=Qo(A);if(s!==-1){t=A,A=this.nextChar();let a=Qo(A);if(a===-1){if(k(`Lexer_getName: Illegal digit (${String.fromCharCode(A)}) in hexadecimal number.`),i.push("#",String.fromCharCode(t)),q0[A])break;i.push(String.fromCharCode(A));continue}i.push(String.fromCharCode(s<<4|a))}else i.push("#",String.fromCharCode(A))}else i.push(String.fromCharCode(A));return i.length>127&&k(`Name token is longer than allowed by the spec: ${i.length}`),M.get(i.join(""))}_hexStringWarn(A){if(this._hexStringNumWarn++===5){k("getHexString - ignoring additional invalid characters.");return}this._hexStringNumWarn>5||k(`getHexString - ignoring invalid character: ${A}`)}getHexString(){let A=this.strBuf;A.length=0;let t=this.currentChar,i=-1,s=-1;for(this._hexStringNumWarn=0;;)if(t<0){k("Unterminated hex string");break}else if(t===62){this.nextChar();break}else if(q0[t]===1){t=this.nextChar();continue}else s=Qo(t),s===-1?this._hexStringWarn(t):i===-1?i=s:(A.push(String.fromCharCode(i<<4|s)),i=-1),t=this.nextChar();return i!==-1&&A.push(String.fromCharCode(i<<4)),A.join("")}getObj(){let A=!1,t=this.currentChar;for(;;){if(t<0)return Ge;if(A)(t===10||t===13)&&(A=!1);else if(t===37)A=!0;else if(q0[t]!==1)break;t=this.nextChar()}switch(t|0){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),fe.get("[");case 93:return this.nextChar(),fe.get("]");case 60:return t=this.nextChar(),t===60?(this.nextChar(),fe.get("<<")):this.getHexString();case 62:return t=this.nextChar(),t===62?(this.nextChar(),fe.get(">>")):fe.get(">");case 123:return this.nextChar(),fe.get("{");case 125:return this.nextChar(),fe.get("}");case 41:throw this.nextChar(),new v(`Illegal character: ${t}`)}let i=String.fromCharCode(t);if(t<32||t>127){let n=this.peekChar();if(n>=32&&n<=127)return this.nextChar(),fe.get(i)}let s=this.knownCommands,a=(s==null?void 0:s[i])!==void 0;for(;(t=this.nextChar())>=0&&!q0[t];){let n=i+String.fromCharCode(t);if(a&&s[n]===void 0)break;if(i.length===128)throw new v(`Command token too long: ${i.length}`);i=n,a=(s==null?void 0:s[i])!==void 0}return i==="true"?!0:i==="false"?!1:i==="null"?null:(i==="BI"&&(this.beginInlineImagePos=this.stream.pos),fe.get(i))}skipToNextLine(){let A=this.currentChar;for(;A>=0;){if(A===13){A=this.nextChar(),A===10&&this.nextChar();break}else if(A===10){this.nextChar();break}A=this.nextChar()}}},mI=class{static create(A){function t(c,l,h=!1){let C=c.get(l);if(Number.isInteger(C)&&(h?C>=0:C>0))return C;throw new Error(`The "${l}" parameter in the linearization dictionary is invalid.`)}function i(c){let l=c.get("H"),h;if(Array.isArray(l)&&((h=l.length)===2||h===4)){for(let C=0;C<h;C++){let B=l[C];if(!(Number.isInteger(B)&&B>0))throw new Error(`Hint (${C}) in the linearization dictionary is invalid.`)}return l}throw new Error("Hint array in the linearization dictionary is invalid.")}let s=new zt({lexer:new dt(A),xref:null}),a=s.getObj(),n=s.getObj(),r=s.getObj(),g=s.getObj(),o,I;if(Number.isInteger(a)&&Number.isInteger(n)&&Ne(r,"obj")&&g instanceof F&&typeof(o=g.get("Linearized"))=="number"&&o>0){if((I=t(g,"L"))!==A.length)throw new Error(\'The "L" parameter in the linearization dictionary does not equal the stream length.\')}else return null;return{length:I,hints:i(g),objectNumberFirst:t(g,"O"),endFirst:t(g,"E"),numPages:t(g,"N"),mainXRefEntriesOffset:t(g,"T"),pageFirst:g.has("P")?t(g,"P",!0):0}}},Nd=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],Eo=2**24-1,Na=class{constructor(A=!1){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=A}addCodespaceRange(A,t,i){this.codespaceRanges[A-1].push(t,i),this.numCodespaceRanges++}mapCidRange(A,t,i){if(t-A>Eo)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;A<=t;)this._map[A++]=i++}mapBfRange(A,t,i){if(t-A>Eo)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");let s=i.length-1;for(;A<=t;){this._map[A++]=i;let a=i.charCodeAt(s)+1;if(a>255){i=i.substring(0,s-1)+String.fromCharCode(i.charCodeAt(s-1)+1)+"\\0";continue}i=i.substring(0,s)+String.fromCharCode(a)}}mapBfRangeToArray(A,t,i){if(t-A>Eo)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");let s=i.length,a=0;for(;A<=t&&a<s;)this._map[A]=i[a++],++A}mapOne(A,t){this._map[A]=t}lookup(A){return this._map[A]}contains(A){return this._map[A]!==void 0}forEach(A){let t=this._map,i=t.length;if(i<=65536)for(let s=0;s<i;s++)t[s]!==void 0&&A(s,t[s]);else for(let s in t)A(s,t[s])}charCodeOf(A){let t=this._map;if(t.length<=65536)return t.indexOf(A);for(let i in t)if(t[i]===A)return i|0;return-1}getMap(){return this._map}readCharCode(A,t,i){let s=0,a=this.codespaceRanges;for(let n=0,r=a.length;n<r;n++){s=(s<<8|A.charCodeAt(t+n))>>>0;let g=a[n];for(let o=0,I=g.length;o<I;){let c=g[o++],l=g[o++];if(s>=c&&s<=l){i.charcode=s,i.length=n+1;return}}}i.charcode=0,i.length=1}getCharCodeLength(A){let t=this.codespaceRanges;for(let i=0,s=t.length;i<s;i++){let a=t[i];for(let n=0,r=a.length;n<r;){let g=a[n++],o=a[n++];if(A>=g&&A<=o)return i+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if(!(this.name==="Identity-H"||this.name==="Identity-V")||this._map.length!==65536)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}},Wi=class extends Na{constructor(A,t){super(),this.vertical=A,this.addCodespaceRange(t,0,65535)}mapCidRange(A,t,i){OA("should not call mapCidRange")}mapBfRange(A,t,i){OA("should not call mapBfRange")}mapBfRangeToArray(A,t,i){OA("should not call mapBfRangeToArray")}mapOne(A,t){OA("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let t=0;t<=65535;t++)A(t,t)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){let A=new Array(65536);for(let t=0;t<=65535;t++)A[t]=t;return A}get length(){return 65536}get isIdentityCMap(){OA("should not access .isIdentityCMap")}};function ji(e){let A=0;for(let t=0;t<e.length;t++)A=A<<8|e.charCodeAt(t);return A>>>0}function y0(e){if(typeof e!="string")throw new v("Malformed CMap: expected string.")}function hf(e){if(!Number.isInteger(e))throw new v("Malformed CMap: expected int.")}function Gd(e,A){for(;;){let t=A.getObj();if(t===Ge)break;if(Ne(t,"endbfchar"))return;y0(t);let i=ji(t);t=A.getObj(),y0(t);let s=t;e.mapOne(i,s)}}function Ud(e,A){for(;;){let t=A.getObj();if(t===Ge)break;if(Ne(t,"endbfrange"))return;y0(t);let i=ji(t);t=A.getObj(),y0(t);let s=ji(t);if(t=A.getObj(),Number.isInteger(t)||typeof t=="string"){let a=Number.isInteger(t)?String.fromCharCode(t):t;e.mapBfRange(i,s,a)}else if(Ne(t,"[")){t=A.getObj();let a=[];for(;!Ne(t,"]")&&t!==Ge;)a.push(t),t=A.getObj();e.mapBfRangeToArray(i,s,a)}else break}throw new v("Invalid bf range.")}function Md(e,A){for(;;){let t=A.getObj();if(t===Ge)break;if(Ne(t,"endcidchar"))return;y0(t);let i=ji(t);t=A.getObj(),hf(t);let s=t;e.mapOne(i,s)}}function Ld(e,A){for(;;){let t=A.getObj();if(t===Ge)break;if(Ne(t,"endcidrange"))return;y0(t);let i=ji(t);t=A.getObj(),y0(t);let s=ji(t);t=A.getObj(),hf(t);let a=t;e.mapCidRange(i,s,a)}}function Hd(e,A){for(;;){let t=A.getObj();if(t===Ge)break;if(Ne(t,"endcodespacerange"))return;if(typeof t!="string")break;let i=ji(t);if(t=A.getObj(),typeof t!="string")break;let s=ji(t);e.addCodespaceRange(t.length,i,s)}throw new v("Invalid codespace range.")}function Jd(e,A){let t=A.getObj();Number.isInteger(t)&&(e.vertical=!!t)}function Yd(e,A){let t=A.getObj();t instanceof M&&(e.name=t.name)}async function Cf(e,A,t,i){let s,a;A:for(;;)try{let n=A.getObj();if(n===Ge)break;if(n instanceof M)n.name==="WMode"?Jd(e,A):n.name==="CMapName"&&Yd(e,A),s=n;else if(n instanceof fe)switch(n.cmd){case"endcmap":break A;case"usecmap":s instanceof M&&(a=s.name);break;case"begincodespacerange":Hd(e,A);break;case"beginbfchar":Gd(e,A);break;case"begincidchar":Md(e,A);break;case"beginbfrange":Ud(e,A);break;case"begincidrange":Ld(e,A);break}}catch(n){if(n instanceof ge)throw n;k("Invalid cMap data: "+n);continue}return!i&&a&&(i=a),i?Bf(e,t,i):e}async function Bf(e,A,t){if(e.useCMap=await pI(t,A),e.numCodespaceRanges===0){let i=e.useCMap.codespaceRanges;for(let s=0;s<i.length;s++)e.codespaceRanges[s]=i[s].slice();e.numCodespaceRanges=e.useCMap.numCodespaceRanges}return e.useCMap.forEach(function(i,s){e.contains(i)||e.mapOne(i,e.useCMap.lookup(i))}),e}async function pI(e,A){if(e==="Identity-H")return new Wi(!1,2);if(e==="Identity-V")return new Wi(!0,2);if(!Nd.includes(e))throw new Error("Unknown CMap name: "+e);if(!A)throw new Error("Built-in CMap parameters are not provided.");let{cMapData:t,compressionType:i}=await A(e),s=new Na(!0);if(i===Br.BINARY)return new iI().process(t,s,a=>Bf(s,A,a));if(i===Br.NONE){let a=new dt(new Ie(t));return Cf(s,a,A,null)}throw new Error(`Invalid CMap "compressionType" value: ${i}`)}var es=class{static async create({encoding:A,fetchBuiltInCMap:t,useCMap:i}){if(A instanceof M)return pI(A.name,t);if(A instanceof KA){let s=await Cf(new Na,new dt(A),t,i);return s.isIdentityCMap?pI(s.name,t):s}throw new Error("Encoding required.")}},Kd=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],vd=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],qd=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Qf=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Td=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],c1=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],fi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],Ga=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],l1=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],h1=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function Ua(e){switch(e){case"WinAnsiEncoding":return Ga;case"StandardEncoding":return fi;case"MacRomanEncoding":return c1;case"SymbolSetEncoding":return l1;case"ZapfDingbatsEncoding":return h1;case"ExpertEncoding":return Qf;case"MacExpertEncoding":return Td;default:return null}}var Pd=10,nr=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Kn=391,T0=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Wd=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(e,A){e[A-2]=e[A-2]+e[A-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(e,A){e[A-2]=e[A-2]-e[A-1]}},{id:"div",min:2,stackDelta:-1,stackFn(e,A){e[A-2]=e[A-2]/e[A-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(e,A){e[A-1]=-e[A-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(e,A){e[A-2]=e[A-2]*e[A-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}],Ma=class{constructor(A,t,i){this.bytes=A.getBytes(),this.properties=t,this.seacAnalysisEnabled=!!i}parse(){let A=this.properties,t=new Sr;this.cff=t;let i=this.parseHeader(),s=this.parseIndex(i.endPos),a=this.parseIndex(s.endPos),n=this.parseIndex(a.endPos),r=this.parseIndex(n.endPos),g=this.parseDict(a.obj.get(0)),o=this.createDict(b0,g,t.strings);t.header=i.obj,t.names=this.parseNameIndex(s.obj),t.strings=this.parseStringIndex(n.obj),t.topDict=o,t.globalSubrIndex=r.obj,this.parsePrivateDict(t.topDict),t.isCIDFont=o.hasName("ROS");let I=o.getByName("CharStrings"),c=this.parseIndex(I).obj,l=o.getByName("FontMatrix");l&&(A.fontMatrix=l);let h=o.getByName("FontBBox");h&&(A.ascent=Math.max(h[3],h[1]),A.descent=Math.min(h[1],h[3]),A.ascentScaled=!0);let C,B;if(t.isCIDFont){let E=this.parseIndex(o.getByName("FDArray")).obj;for(let f=0,u=E.count;f<u;++f){let d=E.get(f),x=this.createDict(b0,this.parseDict(d),t.strings);this.parsePrivateDict(x),t.fdArray.push(x)}B=null,C=this.parseCharsets(o.getByName("charset"),c.count,t.strings,!0),t.fdSelect=this.parseFDSelect(o.getByName("FDSelect"),c.count)}else C=this.parseCharsets(o.getByName("charset"),c.count,t.strings,!1),B=this.parseEncoding(o.getByName("Encoding"),A,t.strings,C.charset);t.charset=C,t.encoding=B;let Q=this.parseCharStrings({charStrings:c,localSubrIndex:o.privateDict.subrsIndex,globalSubrIndex:r.obj,fdSelect:t.fdSelect,fdArray:t.fdArray,privateDict:o.privateDict});return t.charStrings=Q.charStrings,t.seacs=Q.seacs,t.widths=Q.widths,t}parseHeader(){let A=this.bytes,t=A.length,i=0;for(;i<t&&A[i]!==1;)++i;if(i>=t)throw new v("Invalid CFF header");i!==0&&(PA("cff data is shifted"),A=A.subarray(i),this.bytes=A);let s=A[0],a=A[1],n=A[2],r=A[3];return{obj:new Fr(s,a,n,r),endPos:n}}parseDict(A){let t=0;function i(){let g=A[t++];return g===30?s():g===28?(g=A[t++],g=(g<<24|A[t++]<<16)>>16,g):g===29?(g=A[t++],g=g<<8|A[t++],g=g<<8|A[t++],g=g<<8|A[t++],g):g>=32&&g<=246?g-139:g>=247&&g<=250?(g-247)*256+A[t++]+108:g>=251&&g<=254?-((g-251)*256)-A[t++]-108:(k(\'CFFParser_parseDict: "\'+g+\'" is a reserved command.\'),NaN)}function s(){let g="",I=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],c=A.length;for(;t<c;){let l=A[t++],h=l>>4,C=l&15;if(h===15||(g+=I[h],C===15))break;g+=I[C]}return parseFloat(g)}let a=[],n=[];t=0;let r=A.length;for(;t<r;){let g=A[t];g<=21?(g===12&&(g=g<<8|A[++t]),n.push([g,a]),a=[],++t):a.push(i())}return n}parseIndex(A){let t=new ai,i=this.bytes,s=i[A++]<<8|i[A++],a=[],n=A,r,g;if(s!==0){let o=i[A++],I=A+(s+1)*o-1;for(r=0,g=s+1;r<g;++r){let c=0;for(let l=0;l<o;++l)c<<=8,c+=i[A++];a.push(I+c)}n=a[s]}for(r=0,g=a.length-1;r<g;++r){let o=a[r],I=a[r+1];t.add(i.subarray(o,I))}return{obj:t,endPos:n}}parseNameIndex(A){let t=[];for(let i=0,s=A.count;i<s;++i){let a=A.get(i);t.push(Qt(a))}return t}parseStringIndex(A){let t=new La;for(let i=0,s=A.count;i<s;++i){let a=A.get(i);t.add(Qt(a))}return t}createDict(A,t,i){let s=new A(i);for(let[a,n]of t)s.setByKey(a,n);return s}parseCharString(A,t,i,s){if(!t||A.callDepth>Pd)return!1;let a=A.stackSize,n=A.stack,r=t.length;for(let g=0;g<r;){let o=t[g++],I=null;if(o===12){let c=t[g++];c===0?(t[g-2]=139,t[g-1]=22,a=0):I=Wd[c]}else if(o===28)n[a]=(t[g]<<24|t[g+1]<<16)>>16,g+=2,a++;else if(o===14){if(a>=4&&(a-=4,this.seacAnalysisEnabled))return A.seac=n.slice(a,a+4),!1;I=T0[o]}else if(o>=32&&o<=246)n[a]=o-139,a++;else if(o>=247&&o<=254)n[a]=o<251?(o-247<<8)+t[g]+108:-(o-251<<8)-t[g]-108,g++,a++;else if(o===255)n[a]=(t[g]<<24|t[g+1]<<16|t[g+2]<<8|t[g+3])/65536,g+=4,a++;else if(o===19||o===20){if(A.hints+=a>>1,A.hints===0){t.copyWithin(g-1,g,-1),g-=1,r-=1;continue}g+=A.hints+7>>3,a%=2,I=T0[o]}else if(o===10||o===29){let c=o===10?i:s;if(!c)return I=T0[o],k("Missing subrsIndex for "+I.id),!1;let l=32768;c.count<1240?l=107:c.count<33900&&(l=1131);let h=n[--a]+l;if(h<0||h>=c.count||isNaN(h))return I=T0[o],k("Out of bounds subrIndex for "+I.id),!1;if(A.stackSize=a,A.callDepth++,!this.parseCharString(A,c.get(h),i,s))return!1;A.callDepth--,a=A.stackSize;continue}else{if(o===11)return A.stackSize=a,!0;if(o===0&&g===t.length)t[g-1]=14,I=T0[14];else if(o===9){t.copyWithin(g-1,g,-1),g-=1,r-=1;continue}else I=T0[o]}if(I){if(I.stem&&(A.hints+=a>>1,o===3||o===23?A.hasVStems=!0:A.hasVStems&&(o===1||o===18)&&(k("CFF stem hints are in wrong order"),t[g-1]=o===1?3:23)),"min"in I&&!A.undefStack&&a<I.min)return k("Not enough parameters for "+I.id+"; actual: "+a+", expected: "+I.min),a===0?(t[g-1]=14,!0):!1;A.firstStackClearing&&I.stackClearing&&(A.firstStackClearing=!1,a-=I.min,a>=2&&I.stem?a%=2:a>1&&k("Found too many parameters for stack-clearing command"),a>0&&(A.width=n[a-1])),"stackDelta"in I?("stackFn"in I&&I.stackFn(n,a),a+=I.stackDelta):I.stackClearing?a=0:I.resetStack?(a=0,A.undefStack=!1):I.undefStack&&(a=0,A.undefStack=!0,A.firstStackClearing=!1)}}return r<t.length&&t.fill(14,r),A.stackSize=a,!0}parseCharStrings({charStrings:A,localSubrIndex:t,globalSubrIndex:i,fdSelect:s,fdArray:a,privateDict:n}){let r=[],g=[],o=A.count;for(let I=0;I<o;I++){let c=A.get(I),l={callDepth:0,stackSize:0,stack:[],undefStack:!0,hints:0,firstStackClearing:!0,seac:null,width:null,hasVStems:!1},h=!0,C=null,B=n;if(s&&a.length){let Q=s.getFDIndex(I);Q===-1&&(k("Glyph index is not in fd select."),h=!1),Q>=a.length&&(k("Invalid fd index for glyph index."),h=!1),h&&(B=a[Q].privateDict,C=B.subrsIndex)}else t&&(C=t);if(h&&(h=this.parseCharString(l,c,C,i)),l.width!==null){let Q=B.getByName("nominalWidthX");g[I]=Q+l.width}else{let Q=B.getByName("defaultWidthX");g[I]=Q}l.seac!==null&&(r[I]=l.seac),h||A.set(I,new Uint8Array([14]))}return{charStrings:A,seacs:r,widths:g}}emptyPrivateDictionary(A){let t=this.createDict(D0,[],A.strings);A.setByKey(18,[0,0]),A.privateDict=t}parsePrivateDict(A){if(!A.hasName("Private")){this.emptyPrivateDictionary(A);return}let t=A.getByName("Private");if(!Array.isArray(t)||t.length!==2){A.removeByName("Private");return}let i=t[0],s=t[1];if(i===0||s>=this.bytes.length){this.emptyPrivateDictionary(A);return}let a=s+i,n=this.bytes.subarray(s,a),r=this.parseDict(n),g=this.createDict(D0,r,A.strings);if(A.privateDict=g,g.getByName("ExpansionFactor")===0&&g.setByName("ExpansionFactor",.06),!g.getByName("Subrs"))return;let o=g.getByName("Subrs"),I=s+o;if(o===0||I>=this.bytes.length){this.emptyPrivateDictionary(A);return}let c=this.parseIndex(I);g.subrsIndex=c.obj}parseCharsets(A,t,i,s){if(A===0)return new C0(!0,fo.ISO_ADOBE,Kd);if(A===1)return new C0(!0,fo.EXPERT,vd);if(A===2)return new C0(!0,fo.EXPERT_SUBSET,qd);let a=this.bytes,n=A,r=a[A++],g=[s?0:".notdef"],o,I,c;switch(t-=1,r){case 0:for(c=0;c<t;c++)o=a[A++]<<8|a[A++],g.push(s?o:i.get(o));break;case 1:for(;g.length<=t;)for(o=a[A++]<<8|a[A++],I=a[A++],c=0;c<=I;c++)g.push(s?o++:i.get(o++));break;case 2:for(;g.length<=t;)for(o=a[A++]<<8|a[A++],I=a[A++]<<8|a[A++],c=0;c<=I;c++)g.push(s?o++:i.get(o++));break;default:throw new v("Unknown charset format")}let l=A,h=a.subarray(n,l);return new C0(!1,r,g,h)}parseEncoding(A,t,i,s){let a=Object.create(null),n=this.bytes,r=!1,g,o,I,c=null;function l(){let h=n[A++];for(o=0;o<h;o++){let C=n[A++],B=(n[A++]<<8)+(n[A++]&255);a[C]=s.indexOf(i.get(B))}}if(A===0||A===1){r=!0,g=A;let h=A?Qf:fi;for(o=0,I=s.length;o<I;o++){let C=h.indexOf(s[o]);C!==-1&&(a[C]=o)}}else{let h=A;switch(g=n[A++],g&127){case 0:let B=n[A++];for(o=1;o<=B;o++)a[n[A++]]=o;break;case 1:let Q=n[A++],E=1;for(o=0;o<Q;o++){let f=n[A++],u=n[A++];for(let d=f;d<=f+u;d++)a[d]=E++}break;default:throw new v(`Unknown encoding format: ${g} in CFF`)}let C=A;g&128&&(n[h]&=127,l()),c=n.subarray(h,C)}return g&=127,new wI(r,g,a,c)}parseFDSelect(A,t){let i=this.bytes,s=i[A++],a=[],n;switch(s){case 0:for(n=0;n<t;++n){let g=i[A++];a.push(g)}break;case 3:let r=i[A++]<<8|i[A++];for(n=0;n<r;++n){let g=i[A++]<<8|i[A++];n===0&&g!==0&&(k("parseFDSelect: The first range must have a first GID of 0 -- trying to recover."),g=0);let o=i[A++],I=i[A]<<8|i[A+1];for(let c=g;c<I;++c)a.push(o)}A+=2;break;default:throw new v(`parseFDSelect: Unknown format "${s}".`)}if(a.length!==t)throw new v("parseFDSelect: Invalid font data.");return new yI(s,a)}},Sr=class{constructor(){this.header=null,this.names=[],this.topDict=null,this.strings=new La,this.globalSubrIndex=null,this.encoding=null,this.charset=null,this.charStrings=null,this.fdArray=[],this.fdSelect=null,this.isCIDFont=!1}duplicateFirstGlyph(){if(this.charStrings.count>=65535){k("Not enough space in charstrings to duplicate first glyph.");return}let A=this.charStrings.get(0);this.charStrings.add(A),this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(A){return A<0||A>=this.charStrings.count?!1:this.charStrings.get(A).length>0}},Fr=class{constructor(A,t,i,s){this.major=A,this.minor=t,this.hdrSize=i,this.offSize=s}},La=class{constructor(){this.strings=[]}get(A){return A>=0&&A<=Kn-1?nr[A]:A-Kn<=this.strings.length?this.strings[A-Kn]:nr[0]}getSID(A){let t=nr.indexOf(A);return t!==-1?t:(t=this.strings.indexOf(A),t!==-1?t+Kn:-1)}add(A){this.strings.push(A)}get count(){return this.strings.length}},ai=class{constructor(){this.objects=[],this.length=0}add(A){this.length+=A.length,this.objects.push(A)}set(A,t){this.length+=t.length-this.objects[A].length,this.objects[A]=t}get(A){return this.objects[A]}get count(){return this.objects.length}},Rr=class{constructor(A,t){this.keyToNameMap=A.keyToNameMap,this.nameToKeyMap=A.nameToKeyMap,this.defaults=A.defaults,this.types=A.types,this.opcodes=A.opcodes,this.order=A.order,this.strings=t,this.values=Object.create(null)}setByKey(A,t){if(!(A in this.keyToNameMap))return!1;if(t.length===0)return!0;for(let s of t)if(isNaN(s))return k(`Invalid CFFDict value: "${t}" for key "${A}".`),!0;let i=this.types[A];return(i==="num"||i==="sid"||i==="offset")&&(t=t[0]),this.values[A]=t,!0}setByName(A,t){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name "${A}"`);this.values[this.nameToKeyMap[A]]=t}hasName(A){return this.nameToKeyMap[A]in this.values}getByName(A){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name ${A}"`);let t=this.nameToKeyMap[A];return t in this.values?this.values[t]:this.defaults[t]}removeByName(A){delete this.values[this.nameToKeyMap[A]]}static createTables(A){let t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(let i of A){let s=Array.isArray(i[0])?(i[0][0]<<8)+i[0][1]:i[0];t.keyToNameMap[s]=i[1],t.nameToKeyMap[i[1]]=s,t.types[s]=i[2],t.defaults[s]=i[3],t.opcodes[s]=Array.isArray(i[0])?i[0]:[i[0]],t.order.push(s)}return t}},Od=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]],b0=class extends Rr{static get tables(){return nA(this,"tables",this.createTables(Od))}constructor(A){super(b0.tables,A),this.privateDict=null}},Zd=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]],D0=class extends Rr{static get tables(){return nA(this,"tables",this.createTables(Zd))}constructor(A){super(D0.tables,A),this.subrsIndex=null}},fo={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2},C0=class{constructor(A,t,i,s){this.predefined=A,this.format=t,this.charset=i,this.raw=s}},wI=class{constructor(A,t,i,s){this.predefined=A,this.format=t,this.encoding=i,this.raw=s}},yI=class{constructor(A,t){this.format=A,this.fdSelect=t}getFDIndex(A){return A<0||A>=this.fdSelect.length?-1:this.fdSelect[A]}},Nr=class{constructor(){this.offsets=Object.create(null)}isTracking(A){return A in this.offsets}track(A,t){if(A in this.offsets)throw new v(`Already tracking location of ${A}`);this.offsets[A]=t}offset(A){for(let t in this.offsets)this.offsets[t]+=A}setEntryLocation(A,t,i){if(!(A in this.offsets))throw new v(`Not tracking location of ${A}`);let s=i.data,a=this.offsets[A],n=5;for(let r=0,g=t.length;r<g;++r){let o=r*n+a,I=o+1,c=o+2,l=o+3,h=o+4;if(s[o]!==29||s[I]!==0||s[c]!==0||s[l]!==0||s[h]!==0)throw new v("writing to an offset that is not empty");let C=t[r];s[o]=29,s[I]=C>>24&255,s[c]=C>>16&255,s[l]=C>>8&255,s[h]=C&255}}},k0=class{constructor(A){this.cff=A}compile(){let A=this.cff,t={data:[],length:0,add(l){try{this.data.push(...l)}catch(h){this.data=this.data.concat(l)}this.length=this.data.length}},i=this.compileHeader(A.header);t.add(i);let s=this.compileNameIndex(A.names);if(t.add(s),A.isCIDFont&&A.topDict.hasName("FontMatrix")){let l=A.topDict.getByName("FontMatrix");A.topDict.removeByName("FontMatrix");for(let h of A.fdArray){let C=l.slice(0);h.hasName("FontMatrix")&&(C=Ce.transform(C,h.getByName("FontMatrix"))),h.setByName("FontMatrix",C)}}let a=A.topDict.getByName("XUID");(a==null?void 0:a.length)>16&&A.topDict.removeByName("XUID"),A.topDict.setByName("charset",0);let n=this.compileTopDicts([A.topDict],t.length,A.isCIDFont);t.add(n.output);let r=n.trackers[0],g=this.compileStringIndex(A.strings.strings);t.add(g);let o=this.compileIndex(A.globalSubrIndex);if(t.add(o),A.encoding&&A.topDict.hasName("Encoding"))if(A.encoding.predefined)r.setEntryLocation("Encoding",[A.encoding.format],t);else{let l=this.compileEncoding(A.encoding);r.setEntryLocation("Encoding",[t.length],t),t.add(l)}let I=this.compileCharset(A.charset,A.charStrings.count,A.strings,A.isCIDFont);r.setEntryLocation("charset",[t.length],t),t.add(I);let c=this.compileCharStrings(A.charStrings);if(r.setEntryLocation("CharStrings",[t.length],t),t.add(c),A.isCIDFont){r.setEntryLocation("FDSelect",[t.length],t);let l=this.compileFDSelect(A.fdSelect);t.add(l),n=this.compileTopDicts(A.fdArray,t.length,!0),r.setEntryLocation("FDArray",[t.length],t),t.add(n.output);let h=n.trackers;this.compilePrivateDicts(A.fdArray,h,t)}return this.compilePrivateDicts([A.topDict],[r],t),t.add([0]),t.data}encodeNumber(A){return Number.isInteger(A)?this.encodeInteger(A):this.encodeFloat(A)}static get EncodeFloatRegExp(){return nA(this,"EncodeFloatRegExp",/\\.(\\d*?)(?:9{5,20}|0{5,20})\\d{0,2}(?:e(.+)|$)/)}encodeFloat(A){let t=A.toString(),i=k0.EncodeFloatRegExp.exec(t);if(i){let g=parseFloat("1e"+((i[2]?+i[2]:0)+i[1].length));t=(Math.round(A*g)/g).toString()}let s="",a,n;for(a=0,n=t.length;a<n;++a){let g=t[a];g==="e"?s+=t[++a]==="-"?"c":"b":g==="."?s+="a":g==="-"?s+="e":s+=g}s+=s.length&1?"f":"ff";let r=[30];for(a=0,n=s.length;a<n;a+=2)r.push(parseInt(s.substring(a,a+2),16));return r}encodeInteger(A){let t;return A>=-107&&A<=107?t=[A+139]:A>=108&&A<=1131?(A-=108,t=[(A>>8)+247,A&255]):A>=-1131&&A<=-108?(A=-A-108,t=[(A>>8)+251,A&255]):A>=-32768&&A<=32767?t=[28,A>>8&255,A&255]:t=[29,A>>24&255,A>>16&255,A>>8&255,A&255],t}compileHeader(A){return[A.major,A.minor,4,A.offSize]}compileNameIndex(A){let t=new ai;for(let i of A){let s=Math.min(i.length,127),a=new Array(s);for(let n=0;n<s;n++){let r=i[n];(r<"!"||r>"~"||r==="["||r==="]"||r==="("||r===")"||r==="{"||r==="}"||r==="<"||r===">"||r==="/"||r==="%")&&(r="_"),a[n]=r}a=a.join(""),a===""&&(a="Bad_Font_Name"),t.add(Pe(a))}return this.compileIndex(t)}compileTopDicts(A,t,i){let s=[],a=new ai;for(let n of A){i&&(n.removeByName("CIDFontVersion"),n.removeByName("CIDFontRevision"),n.removeByName("CIDFontType"),n.removeByName("CIDCount"),n.removeByName("UIDBase"));let r=new Nr,g=this.compileDict(n,r);s.push(r),a.add(g),r.offset(t)}return a=this.compileIndex(a,s),{trackers:s,output:a}}compilePrivateDicts(A,t,i){for(let s=0,a=A.length;s<a;++s){let n=A[s],r=n.privateDict;if(!r||!n.hasName("Private"))throw new v("There must be a private dictionary.");let g=new Nr,o=this.compileDict(r,g),I=i.length;if(g.offset(I),o.length||(I=0),t[s].setEntryLocation("Private",[o.length,I],i),i.add(o),r.subrsIndex&&r.hasName("Subrs")){let c=this.compileIndex(r.subrsIndex);g.setEntryLocation("Subrs",[o.length],i),i.add(c)}}}compileDict(A,t){let i=[];for(let s of A.order){if(!(s in A.values))continue;let a=A.values[s],n=A.types[s];if(Array.isArray(n)||(n=[n]),Array.isArray(a)||(a=[a]),a.length!==0){for(let r=0,g=n.length;r<g;++r){let o=n[r],I=a[r];switch(o){case"num":case"sid":i.push(...this.encodeNumber(I));break;case"offset":let c=A.keyToNameMap[s];t.isTracking(c)||t.track(c,i.length),i.push(29,0,0,0,0);break;case"array":case"delta":i.push(...this.encodeNumber(I));for(let l=1,h=a.length;l<h;++l)i.push(...this.encodeNumber(a[l]));break;default:throw new v(`Unknown data type of ${o}`)}}i.push(...A.opcodes[s])}}return i}compileStringIndex(A){let t=new ai;for(let i of A)t.add(Pe(i));return this.compileIndex(t)}compileCharStrings(A){let t=new ai;for(let i=0;i<A.count;i++){let s=A.get(i);if(s.length===0){t.add(new Uint8Array([139,14]));continue}t.add(s)}return this.compileIndex(t)}compileCharset(A,t,i,s){let a,n=t-1;if(s)a=new Uint8Array([2,0,0,n>>8&255,n&255]);else{let r=1+n*2;a=new Uint8Array(r),a[0]=0;let g=0,o=A.charset.length,I=!1;for(let c=1;c<a.length;c+=2){let l=0;if(g<o){let h=A.charset[g++];l=i.getSID(h),l===-1&&(l=0,I||(I=!0,k(`Couldn\'t find ${h} in CFF strings`)))}a[c]=l>>8&255,a[c+1]=l&255}}return this.compileTypedArray(a)}compileEncoding(A){return this.compileTypedArray(A.raw)}compileFDSelect(A){let t=A.format,i,s;switch(t){case 0:for(i=new Uint8Array(1+A.fdSelect.length),i[0]=t,s=0;s<A.fdSelect.length;s++)i[s+1]=A.fdSelect[s];break;case 3:let a=0,n=A.fdSelect[0],r=[t,0,0,a>>8&255,a&255,n];for(s=1;s<A.fdSelect.length;s++){let o=A.fdSelect[s];o!==n&&(r.push(s>>8&255,s&255,o),n=o)}let g=(r.length-3)/3;r[1]=g>>8&255,r[2]=g&255,r.push(s>>8&255,s&255),i=new Uint8Array(r);break}return this.compileTypedArray(i)}compileTypedArray(A){return Array.from(A)}compileIndex(A,t=[]){let i=A.objects,s=i.length;if(s===0)return[0,0];let a=[s>>8&255,s&255],n=1,r;for(r=0;r<s;++r)n+=i[r].length;let g;n<256?g=1:n<65536?g=2:n<16777216?g=3:g=4,a.push(g);let o=1;for(r=0;r<s+1;r++)g===1?a.push(o&255):g===2?a.push(o>>8&255,o&255):g===3?a.push(o>>16&255,o>>8&255,o&255):a.push(o>>>24&255,o>>16&255,o>>8&255,o&255),i[r]&&(o+=i[r].length);for(r=0;r<s;r++)t[r]&&t[r].offset(a.length),a.push(...i[r]);return a}},Ai=he(function(e){e.A=65,e.AE=198,e.AEacute=508,e.AEmacron=482,e.AEsmall=63462,e.Aacute=193,e.Aacutesmall=63457,e.Abreve=258,e.Abreveacute=7854,e.Abrevecyrillic=1232,e.Abrevedotbelow=7862,e.Abrevegrave=7856,e.Abrevehookabove=7858,e.Abrevetilde=7860,e.Acaron=461,e.Acircle=9398,e.Acircumflex=194,e.Acircumflexacute=7844,e.Acircumflexdotbelow=7852,e.Acircumflexgrave=7846,e.Acircumflexhookabove=7848,e.Acircumflexsmall=63458,e.Acircumflextilde=7850,e.Acute=63177,e.Acutesmall=63412,e.Acyrillic=1040,e.Adblgrave=512,e.Adieresis=196,e.Adieresiscyrillic=1234,e.Adieresismacron=478,e.Adieresissmall=63460,e.Adotbelow=7840,e.Adotmacron=480,e.Agrave=192,e.Agravesmall=63456,e.Ahookabove=7842,e.Aiecyrillic=1236,e.Ainvertedbreve=514,e.Alpha=913,e.Alphatonos=902,e.Amacron=256,e.Amonospace=65313,e.Aogonek=260,e.Aring=197,e.Aringacute=506,e.Aringbelow=7680,e.Aringsmall=63461,e.Asmall=63329,e.Atilde=195,e.Atildesmall=63459,e.Aybarmenian=1329,e.B=66,e.Bcircle=9399,e.Bdotaccent=7682,e.Bdotbelow=7684,e.Becyrillic=1041,e.Benarmenian=1330,e.Beta=914,e.Bhook=385,e.Blinebelow=7686,e.Bmonospace=65314,e.Brevesmall=63220,e.Bsmall=63330,e.Btopbar=386,e.C=67,e.Caarmenian=1342,e.Cacute=262,e.Caron=63178,e.Caronsmall=63221,e.Ccaron=268,e.Ccedilla=199,e.Ccedillaacute=7688,e.Ccedillasmall=63463,e.Ccircle=9400,e.Ccircumflex=264,e.Cdot=266,e.Cdotaccent=266,e.Cedillasmall=63416,e.Chaarmenian=1353,e.Cheabkhasiancyrillic=1212,e.Checyrillic=1063,e.Chedescenderabkhasiancyrillic=1214,e.Chedescendercyrillic=1206,e.Chedieresiscyrillic=1268,e.Cheharmenian=1347,e.Chekhakassiancyrillic=1227,e.Cheverticalstrokecyrillic=1208,e.Chi=935,e.Chook=391,e.Circumflexsmall=63222,e.Cmonospace=65315,e.Coarmenian=1361,e.Csmall=63331,e.D=68,e.DZ=497,e.DZcaron=452,e.Daarmenian=1332,e.Dafrican=393,e.Dcaron=270,e.Dcedilla=7696,e.Dcircle=9401,e.Dcircumflexbelow=7698,e.Dcroat=272,e.Ddotaccent=7690,e.Ddotbelow=7692,e.Decyrillic=1044,e.Deicoptic=1006,e.Delta=8710,e.Deltagreek=916,e.Dhook=394,e.Dieresis=63179,e.DieresisAcute=63180,e.DieresisGrave=63181,e.Dieresissmall=63400,e.Digammagreek=988,e.Djecyrillic=1026,e.Dlinebelow=7694,e.Dmonospace=65316,e.Dotaccentsmall=63223,e.Dslash=272,e.Dsmall=63332,e.Dtopbar=395,e.Dz=498,e.Dzcaron=453,e.Dzeabkhasiancyrillic=1248,e.Dzecyrillic=1029,e.Dzhecyrillic=1039,e.E=69,e.Eacute=201,e.Eacutesmall=63465,e.Ebreve=276,e.Ecaron=282,e.Ecedillabreve=7708,e.Echarmenian=1333,e.Ecircle=9402,e.Ecircumflex=202,e.Ecircumflexacute=7870,e.Ecircumflexbelow=7704,e.Ecircumflexdotbelow=7878,e.Ecircumflexgrave=7872,e.Ecircumflexhookabove=7874,e.Ecircumflexsmall=63466,e.Ecircumflextilde=7876,e.Ecyrillic=1028,e.Edblgrave=516,e.Edieresis=203,e.Edieresissmall=63467,e.Edot=278,e.Edotaccent=278,e.Edotbelow=7864,e.Efcyrillic=1060,e.Egrave=200,e.Egravesmall=63464,e.Eharmenian=1335,e.Ehookabove=7866,e.Eightroman=8551,e.Einvertedbreve=518,e.Eiotifiedcyrillic=1124,e.Elcyrillic=1051,e.Elevenroman=8554,e.Emacron=274,e.Emacronacute=7702,e.Emacrongrave=7700,e.Emcyrillic=1052,e.Emonospace=65317,e.Encyrillic=1053,e.Endescendercyrillic=1186,e.Eng=330,e.Enghecyrillic=1188,e.Enhookcyrillic=1223,e.Eogonek=280,e.Eopen=400,e.Epsilon=917,e.Epsilontonos=904,e.Ercyrillic=1056,e.Ereversed=398,e.Ereversedcyrillic=1069,e.Escyrillic=1057,e.Esdescendercyrillic=1194,e.Esh=425,e.Esmall=63333,e.Eta=919,e.Etarmenian=1336,e.Etatonos=905,e.Eth=208,e.Ethsmall=63472,e.Etilde=7868,e.Etildebelow=7706,e.Euro=8364,e.Ezh=439,e.Ezhcaron=494,e.Ezhreversed=440,e.F=70,e.Fcircle=9403,e.Fdotaccent=7710,e.Feharmenian=1366,e.Feicoptic=996,e.Fhook=401,e.Fitacyrillic=1138,e.Fiveroman=8548,e.Fmonospace=65318,e.Fourroman=8547,e.Fsmall=63334,e.G=71,e.GBsquare=13191,e.Gacute=500,e.Gamma=915,e.Gammaafrican=404,e.Gangiacoptic=1002,e.Gbreve=286,e.Gcaron=486,e.Gcedilla=290,e.Gcircle=9404,e.Gcircumflex=284,e.Gcommaaccent=290,e.Gdot=288,e.Gdotaccent=288,e.Gecyrillic=1043,e.Ghadarmenian=1346,e.Ghemiddlehookcyrillic=1172,e.Ghestrokecyrillic=1170,e.Gheupturncyrillic=1168,e.Ghook=403,e.Gimarmenian=1331,e.Gjecyrillic=1027,e.Gmacron=7712,e.Gmonospace=65319,e.Grave=63182,e.Gravesmall=63328,e.Gsmall=63335,e.Gsmallhook=667,e.Gstroke=484,e.H=72,e.H18533=9679,e.H18543=9642,e.H18551=9643,e.H22073=9633,e.HPsquare=13259,e.Haabkhasiancyrillic=1192,e.Hadescendercyrillic=1202,e.Hardsigncyrillic=1066,e.Hbar=294,e.Hbrevebelow=7722,e.Hcedilla=7720,e.Hcircle=9405,e.Hcircumflex=292,e.Hdieresis=7718,e.Hdotaccent=7714,e.Hdotbelow=7716,e.Hmonospace=65320,e.Hoarmenian=1344,e.Horicoptic=1e3,e.Hsmall=63336,e.Hungarumlaut=63183,e.Hungarumlautsmall=63224,e.Hzsquare=13200,e.I=73,e.IAcyrillic=1071,e.IJ=306,e.IUcyrillic=1070,e.Iacute=205,e.Iacutesmall=63469,e.Ibreve=300,e.Icaron=463,e.Icircle=9406,e.Icircumflex=206,e.Icircumflexsmall=63470,e.Icyrillic=1030,e.Idblgrave=520,e.Idieresis=207,e.Idieresisacute=7726,e.Idieresiscyrillic=1252,e.Idieresissmall=63471,e.Idot=304,e.Idotaccent=304,e.Idotbelow=7882,e.Iebrevecyrillic=1238,e.Iecyrillic=1045,e.Ifraktur=8465,e.Igrave=204,e.Igravesmall=63468,e.Ihookabove=7880,e.Iicyrillic=1048,e.Iinvertedbreve=522,e.Iishortcyrillic=1049,e.Imacron=298,e.Imacroncyrillic=1250,e.Imonospace=65321,e.Iniarmenian=1339,e.Iocyrillic=1025,e.Iogonek=302,e.Iota=921,e.Iotaafrican=406,e.Iotadieresis=938,e.Iotatonos=906,e.Ismall=63337,e.Istroke=407,e.Itilde=296,e.Itildebelow=7724,e.Izhitsacyrillic=1140,e.Izhitsadblgravecyrillic=1142,e.J=74,e.Jaarmenian=1345,e.Jcircle=9407,e.Jcircumflex=308,e.Jecyrillic=1032,e.Jheharmenian=1355,e.Jmonospace=65322,e.Jsmall=63338,e.K=75,e.KBsquare=13189,e.KKsquare=13261,e.Kabashkircyrillic=1184,e.Kacute=7728,e.Kacyrillic=1050,e.Kadescendercyrillic=1178,e.Kahookcyrillic=1219,e.Kappa=922,e.Kastrokecyrillic=1182,e.Kaverticalstrokecyrillic=1180,e.Kcaron=488,e.Kcedilla=310,e.Kcircle=9408,e.Kcommaaccent=310,e.Kdotbelow=7730,e.Keharmenian=1364,e.Kenarmenian=1343,e.Khacyrillic=1061,e.Kheicoptic=998,e.Khook=408,e.Kjecyrillic=1036,e.Klinebelow=7732,e.Kmonospace=65323,e.Koppacyrillic=1152,e.Koppagreek=990,e.Ksicyrillic=1134,e.Ksmall=63339,e.L=76,e.LJ=455,e.LL=63167,e.Lacute=313,e.Lambda=923,e.Lcaron=317,e.Lcedilla=315,e.Lcircle=9409,e.Lcircumflexbelow=7740,e.Lcommaaccent=315,e.Ldot=319,e.Ldotaccent=319,e.Ldotbelow=7734,e.Ldotbelowmacron=7736,e.Liwnarmenian=1340,e.Lj=456,e.Ljecyrillic=1033,e.Llinebelow=7738,e.Lmonospace=65324,e.Lslash=321,e.Lslashsmall=63225,e.Lsmall=63340,e.M=77,e.MBsquare=13190,e.Macron=63184,e.Macronsmall=63407,e.Macute=7742,e.Mcircle=9410,e.Mdotaccent=7744,e.Mdotbelow=7746,e.Menarmenian=1348,e.Mmonospace=65325,e.Msmall=63341,e.Mturned=412,e.Mu=924,e.N=78,e.NJ=458,e.Nacute=323,e.Ncaron=327,e.Ncedilla=325,e.Ncircle=9411,e.Ncircumflexbelow=7754,e.Ncommaaccent=325,e.Ndotaccent=7748,e.Ndotbelow=7750,e.Nhookleft=413,e.Nineroman=8552,e.Nj=459,e.Njecyrillic=1034,e.Nlinebelow=7752,e.Nmonospace=65326,e.Nowarmenian=1350,e.Nsmall=63342,e.Ntilde=209,e.Ntildesmall=63473,e.Nu=925,e.O=79,e.OE=338,e.OEsmall=63226,e.Oacute=211,e.Oacutesmall=63475,e.Obarredcyrillic=1256,e.Obarreddieresiscyrillic=1258,e.Obreve=334,e.Ocaron=465,e.Ocenteredtilde=415,e.Ocircle=9412,e.Ocircumflex=212,e.Ocircumflexacute=7888,e.Ocircumflexdotbelow=7896,e.Ocircumflexgrave=7890,e.Ocircumflexhookabove=7892,e.Ocircumflexsmall=63476,e.Ocircumflextilde=7894,e.Ocyrillic=1054,e.Odblacute=336,e.Odblgrave=524,e.Odieresis=214,e.Odieresiscyrillic=1254,e.Odieresissmall=63478,e.Odotbelow=7884,e.Ogoneksmall=63227,e.Ograve=210,e.Ogravesmall=63474,e.Oharmenian=1365,e.Ohm=8486,e.Ohookabove=7886,e.Ohorn=416,e.Ohornacute=7898,e.Ohorndotbelow=7906,e.Ohorngrave=7900,e.Ohornhookabove=7902,e.Ohorntilde=7904,e.Ohungarumlaut=336,e.Oi=418,e.Oinvertedbreve=526,e.Omacron=332,e.Omacronacute=7762,e.Omacrongrave=7760,e.Omega=8486,e.Omegacyrillic=1120,e.Omegagreek=937,e.Omegaroundcyrillic=1146,e.Omegatitlocyrillic=1148,e.Omegatonos=911,e.Omicron=927,e.Omicrontonos=908,e.Omonospace=65327,e.Oneroman=8544,e.Oogonek=490,e.Oogonekmacron=492,e.Oopen=390,e.Oslash=216,e.Oslashacute=510,e.Oslashsmall=63480,e.Osmall=63343,e.Ostrokeacute=510,e.Otcyrillic=1150,e.Otilde=213,e.Otildeacute=7756,e.Otildedieresis=7758,e.Otildesmall=63477,e.P=80,e.Pacute=7764,e.Pcircle=9413,e.Pdotaccent=7766,e.Pecyrillic=1055,e.Peharmenian=1354,e.Pemiddlehookcyrillic=1190,e.Phi=934,e.Phook=420,e.Pi=928,e.Piwrarmenian=1363,e.Pmonospace=65328,e.Psi=936,e.Psicyrillic=1136,e.Psmall=63344,e.Q=81,e.Qcircle=9414,e.Qmonospace=65329,e.Qsmall=63345,e.R=82,e.Raarmenian=1356,e.Racute=340,e.Rcaron=344,e.Rcedilla=342,e.Rcircle=9415,e.Rcommaaccent=342,e.Rdblgrave=528,e.Rdotaccent=7768,e.Rdotbelow=7770,e.Rdotbelowmacron=7772,e.Reharmenian=1360,e.Rfraktur=8476,e.Rho=929,e.Ringsmall=63228,e.Rinvertedbreve=530,e.Rlinebelow=7774,e.Rmonospace=65330,e.Rsmall=63346,e.Rsmallinverted=641,e.Rsmallinvertedsuperior=694,e.S=83,e.SF010000=9484,e.SF020000=9492,e.SF030000=9488,e.SF040000=9496,e.SF050000=9532,e.SF060000=9516,e.SF070000=9524,e.SF080000=9500,e.SF090000=9508,e.SF100000=9472,e.SF110000=9474,e.SF190000=9569,e.SF200000=9570,e.SF210000=9558,e.SF220000=9557,e.SF230000=9571,e.SF240000=9553,e.SF250000=9559,e.SF260000=9565,e.SF270000=9564,e.SF280000=9563,e.SF360000=9566,e.SF370000=9567,e.SF380000=9562,e.SF390000=9556,e.SF400000=9577,e.SF410000=9574,e.SF420000=9568,e.SF430000=9552,e.SF440000=9580,e.SF450000=9575,e.SF460000=9576,e.SF470000=9572,e.SF480000=9573,e.SF490000=9561,e.SF500000=9560,e.SF510000=9554,e.SF520000=9555,e.SF530000=9579,e.SF540000=9578,e.Sacute=346,e.Sacutedotaccent=7780,e.Sampigreek=992,e.Scaron=352,e.Scarondotaccent=7782,e.Scaronsmall=63229,e.Scedilla=350,e.Schwa=399,e.Schwacyrillic=1240,e.Schwadieresiscyrillic=1242,e.Scircle=9416,e.Scircumflex=348,e.Scommaaccent=536,e.Sdotaccent=7776,e.Sdotbelow=7778,e.Sdotbelowdotaccent=7784,e.Seharmenian=1357,e.Sevenroman=8550,e.Shaarmenian=1351,e.Shacyrillic=1064,e.Shchacyrillic=1065,e.Sheicoptic=994,e.Shhacyrillic=1210,e.Shimacoptic=1004,e.Sigma=931,e.Sixroman=8549,e.Smonospace=65331,e.Softsigncyrillic=1068,e.Ssmall=63347,e.Stigmagreek=986,e.T=84,e.Tau=932,e.Tbar=358,e.Tcaron=356,e.Tcedilla=354,e.Tcircle=9417,e.Tcircumflexbelow=7792,e.Tcommaaccent=354,e.Tdotaccent=7786,e.Tdotbelow=7788,e.Tecyrillic=1058,e.Tedescendercyrillic=1196,e.Tenroman=8553,e.Tetsecyrillic=1204,e.Theta=920,e.Thook=428,e.Thorn=222,e.Thornsmall=63486,e.Threeroman=8546,e.Tildesmall=63230,e.Tiwnarmenian=1359,e.Tlinebelow=7790,e.Tmonospace=65332,e.Toarmenian=1337,e.Tonefive=444,e.Tonesix=388,e.Tonetwo=423,e.Tretroflexhook=430,e.Tsecyrillic=1062,e.Tshecyrillic=1035,e.Tsmall=63348,e.Twelveroman=8555,e.Tworoman=8545,e.U=85,e.Uacute=218,e.Uacutesmall=63482,e.Ubreve=364,e.Ucaron=467,e.Ucircle=9418,e.Ucircumflex=219,e.Ucircumflexbelow=7798,e.Ucircumflexsmall=63483,e.Ucyrillic=1059,e.Udblacute=368,e.Udblgrave=532,e.Udieresis=220,e.Udieresisacute=471,e.Udieresisbelow=7794,e.Udieresiscaron=473,e.Udieresiscyrillic=1264,e.Udieresisgrave=475,e.Udieresismacron=469,e.Udieresissmall=63484,e.Udotbelow=7908,e.Ugrave=217,e.Ugravesmall=63481,e.Uhookabove=7910,e.Uhorn=431,e.Uhornacute=7912,e.Uhorndotbelow=7920,e.Uhorngrave=7914,e.Uhornhookabove=7916,e.Uhorntilde=7918,e.Uhungarumlaut=368,e.Uhungarumlautcyrillic=1266,e.Uinvertedbreve=534,e.Ukcyrillic=1144,e.Umacron=362,e.Umacroncyrillic=1262,e.Umacrondieresis=7802,e.Umonospace=65333,e.Uogonek=370,e.Upsilon=933,e.Upsilon1=978,e.Upsilonacutehooksymbolgreek=979,e.Upsilonafrican=433,e.Upsilondieresis=939,e.Upsilondieresishooksymbolgreek=980,e.Upsilonhooksymbol=978,e.Upsilontonos=910,e.Uring=366,e.Ushortcyrillic=1038,e.Usmall=63349,e.Ustraightcyrillic=1198,e.Ustraightstrokecyrillic=1200,e.Utilde=360,e.Utildeacute=7800,e.Utildebelow=7796,e.V=86,e.Vcircle=9419,e.Vdotbelow=7806,e.Vecyrillic=1042,e.Vewarmenian=1358,e.Vhook=434,e.Vmonospace=65334,e.Voarmenian=1352,e.Vsmall=63350,e.Vtilde=7804,e.W=87,e.Wacute=7810,e.Wcircle=9420,e.Wcircumflex=372,e.Wdieresis=7812,e.Wdotaccent=7814,e.Wdotbelow=7816,e.Wgrave=7808,e.Wmonospace=65335,e.Wsmall=63351,e.X=88,e.Xcircle=9421,e.Xdieresis=7820,e.Xdotaccent=7818,e.Xeharmenian=1341,e.Xi=926,e.Xmonospace=65336,e.Xsmall=63352,e.Y=89,e.Yacute=221,e.Yacutesmall=63485,e.Yatcyrillic=1122,e.Ycircle=9422,e.Ycircumflex=374,e.Ydieresis=376,e.Ydieresissmall=63487,e.Ydotaccent=7822,e.Ydotbelow=7924,e.Yericyrillic=1067,e.Yerudieresiscyrillic=1272,e.Ygrave=7922,e.Yhook=435,e.Yhookabove=7926,e.Yiarmenian=1349,e.Yicyrillic=1031,e.Yiwnarmenian=1362,e.Ymonospace=65337,e.Ysmall=63353,e.Ytilde=7928,e.Yusbigcyrillic=1130,e.Yusbigiotifiedcyrillic=1132,e.Yuslittlecyrillic=1126,e.Yuslittleiotifiedcyrillic=1128,e.Z=90,e.Zaarmenian=1334,e.Zacute=377,e.Zcaron=381,e.Zcaronsmall=63231,e.Zcircle=9423,e.Zcircumflex=7824,e.Zdot=379,e.Zdotaccent=379,e.Zdotbelow=7826,e.Zecyrillic=1047,e.Zedescendercyrillic=1176,e.Zedieresiscyrillic=1246,e.Zeta=918,e.Zhearmenian=1338,e.Zhebrevecyrillic=1217,e.Zhecyrillic=1046,e.Zhedescendercyrillic=1174,e.Zhedieresiscyrillic=1244,e.Zlinebelow=7828,e.Zmonospace=65338,e.Zsmall=63354,e.Zstroke=437,e.a=97,e.aabengali=2438,e.aacute=225,e.aadeva=2310,e.aagujarati=2694,e.aagurmukhi=2566,e.aamatragurmukhi=2622,e.aarusquare=13059,e.aavowelsignbengali=2494,e.aavowelsigndeva=2366,e.aavowelsigngujarati=2750,e.abbreviationmarkarmenian=1375,e.abbreviationsigndeva=2416,e.abengali=2437,e.abopomofo=12570,e.abreve=259,e.abreveacute=7855,e.abrevecyrillic=1233,e.abrevedotbelow=7863,e.abrevegrave=7857,e.abrevehookabove=7859,e.abrevetilde=7861,e.acaron=462,e.acircle=9424,e.acircumflex=226,e.acircumflexacute=7845,e.acircumflexdotbelow=7853,e.acircumflexgrave=7847,e.acircumflexhookabove=7849,e.acircumflextilde=7851,e.acute=180,e.acutebelowcmb=791,e.acutecmb=769,e.acutecomb=769,e.acutedeva=2388,e.acutelowmod=719,e.acutetonecmb=833,e.acyrillic=1072,e.adblgrave=513,e.addakgurmukhi=2673,e.adeva=2309,e.adieresis=228,e.adieresiscyrillic=1235,e.adieresismacron=479,e.adotbelow=7841,e.adotmacron=481,e.ae=230,e.aeacute=509,e.aekorean=12624,e.aemacron=483,e.afii00208=8213,e.afii08941=8356,e.afii10017=1040,e.afii10018=1041,e.afii10019=1042,e.afii10020=1043,e.afii10021=1044,e.afii10022=1045,e.afii10023=1025,e.afii10024=1046,e.afii10025=1047,e.afii10026=1048,e.afii10027=1049,e.afii10028=1050,e.afii10029=1051,e.afii10030=1052,e.afii10031=1053,e.afii10032=1054,e.afii10033=1055,e.afii10034=1056,e.afii10035=1057,e.afii10036=1058,e.afii10037=1059,e.afii10038=1060,e.afii10039=1061,e.afii10040=1062,e.afii10041=1063,e.afii10042=1064,e.afii10043=1065,e.afii10044=1066,e.afii10045=1067,e.afii10046=1068,e.afii10047=1069,e.afii10048=1070,e.afii10049=1071,e.afii10050=1168,e.afii10051=1026,e.afii10052=1027,e.afii10053=1028,e.afii10054=1029,e.afii10055=1030,e.afii10056=1031,e.afii10057=1032,e.afii10058=1033,e.afii10059=1034,e.afii10060=1035,e.afii10061=1036,e.afii10062=1038,e.afii10063=63172,e.afii10064=63173,e.afii10065=1072,e.afii10066=1073,e.afii10067=1074,e.afii10068=1075,e.afii10069=1076,e.afii10070=1077,e.afii10071=1105,e.afii10072=1078,e.afii10073=1079,e.afii10074=1080,e.afii10075=1081,e.afii10076=1082,e.afii10077=1083,e.afii10078=1084,e.afii10079=1085,e.afii10080=1086,e.afii10081=1087,e.afii10082=1088,e.afii10083=1089,e.afii10084=1090,e.afii10085=1091,e.afii10086=1092,e.afii10087=1093,e.afii10088=1094,e.afii10089=1095,e.afii10090=1096,e.afii10091=1097,e.afii10092=1098,e.afii10093=1099,e.afii10094=1100,e.afii10095=1101,e.afii10096=1102,e.afii10097=1103,e.afii10098=1169,e.afii10099=1106,e.afii10100=1107,e.afii10101=1108,e.afii10102=1109,e.afii10103=1110,e.afii10104=1111,e.afii10105=1112,e.afii10106=1113,e.afii10107=1114,e.afii10108=1115,e.afii10109=1116,e.afii10110=1118,e.afii10145=1039,e.afii10146=1122,e.afii10147=1138,e.afii10148=1140,e.afii10192=63174,e.afii10193=1119,e.afii10194=1123,e.afii10195=1139,e.afii10196=1141,e.afii10831=63175,e.afii10832=63176,e.afii10846=1241,e.afii299=8206,e.afii300=8207,e.afii301=8205,e.afii57381=1642,e.afii57388=1548,e.afii57392=1632,e.afii57393=1633,e.afii57394=1634,e.afii57395=1635,e.afii57396=1636,e.afii57397=1637,e.afii57398=1638,e.afii57399=1639,e.afii57400=1640,e.afii57401=1641,e.afii57403=1563,e.afii57407=1567,e.afii57409=1569,e.afii57410=1570,e.afii57411=1571,e.afii57412=1572,e.afii57413=1573,e.afii57414=1574,e.afii57415=1575,e.afii57416=1576,e.afii57417=1577,e.afii57418=1578,e.afii57419=1579,e.afii57420=1580,e.afii57421=1581,e.afii57422=1582,e.afii57423=1583,e.afii57424=1584,e.afii57425=1585,e.afii57426=1586,e.afii57427=1587,e.afii57428=1588,e.afii57429=1589,e.afii57430=1590,e.afii57431=1591,e.afii57432=1592,e.afii57433=1593,e.afii57434=1594,e.afii57440=1600,e.afii57441=1601,e.afii57442=1602,e.afii57443=1603,e.afii57444=1604,e.afii57445=1605,e.afii57446=1606,e.afii57448=1608,e.afii57449=1609,e.afii57450=1610,e.afii57451=1611,e.afii57452=1612,e.afii57453=1613,e.afii57454=1614,e.afii57455=1615,e.afii57456=1616,e.afii57457=1617,e.afii57458=1618,e.afii57470=1607,e.afii57505=1700,e.afii57506=1662,e.afii57507=1670,e.afii57508=1688,e.afii57509=1711,e.afii57511=1657,e.afii57512=1672,e.afii57513=1681,e.afii57514=1722,e.afii57519=1746,e.afii57534=1749,e.afii57636=8362,e.afii57645=1470,e.afii57658=1475,e.afii57664=1488,e.afii57665=1489,e.afii57666=1490,e.afii57667=1491,e.afii57668=1492,e.afii57669=1493,e.afii57670=1494,e.afii57671=1495,e.afii57672=1496,e.afii57673=1497,e.afii57674=1498,e.afii57675=1499,e.afii57676=1500,e.afii57677=1501,e.afii57678=1502,e.afii57679=1503,e.afii57680=1504,e.afii57681=1505,e.afii57682=1506,e.afii57683=1507,e.afii57684=1508,e.afii57685=1509,e.afii57686=1510,e.afii57687=1511,e.afii57688=1512,e.afii57689=1513,e.afii57690=1514,e.afii57694=64298,e.afii57695=64299,e.afii57700=64331,e.afii57705=64287,e.afii57716=1520,e.afii57717=1521,e.afii57718=1522,e.afii57723=64309,e.afii57793=1460,e.afii57794=1461,e.afii57795=1462,e.afii57796=1467,e.afii57797=1464,e.afii57798=1463,e.afii57799=1456,e.afii57800=1458,e.afii57801=1457,e.afii57802=1459,e.afii57803=1474,e.afii57804=1473,e.afii57806=1465,e.afii57807=1468,e.afii57839=1469,e.afii57841=1471,e.afii57842=1472,e.afii57929=700,e.afii61248=8453,e.afii61289=8467,e.afii61352=8470,e.afii61573=8236,e.afii61574=8237,e.afii61575=8238,e.afii61664=8204,e.afii63167=1645,e.afii64937=701,e.agrave=224,e.agujarati=2693,e.agurmukhi=2565,e.ahiragana=12354,e.ahookabove=7843,e.aibengali=2448,e.aibopomofo=12574,e.aideva=2320,e.aiecyrillic=1237,e.aigujarati=2704,e.aigurmukhi=2576,e.aimatragurmukhi=2632,e.ainarabic=1593,e.ainfinalarabic=65226,e.aininitialarabic=65227,e.ainmedialarabic=65228,e.ainvertedbreve=515,e.aivowelsignbengali=2504,e.aivowelsigndeva=2376,e.aivowelsigngujarati=2760,e.akatakana=12450,e.akatakanahalfwidth=65393,e.akorean=12623,e.alef=1488,e.alefarabic=1575,e.alefdageshhebrew=64304,e.aleffinalarabic=65166,e.alefhamzaabovearabic=1571,e.alefhamzaabovefinalarabic=65156,e.alefhamzabelowarabic=1573,e.alefhamzabelowfinalarabic=65160,e.alefhebrew=1488,e.aleflamedhebrew=64335,e.alefmaddaabovearabic=1570,e.alefmaddaabovefinalarabic=65154,e.alefmaksuraarabic=1609,e.alefmaksurafinalarabic=65264,e.alefmaksurainitialarabic=65267,e.alefmaksuramedialarabic=65268,e.alefpatahhebrew=64302,e.alefqamatshebrew=64303,e.aleph=8501,e.allequal=8780,e.alpha=945,e.alphatonos=940,e.amacron=257,e.amonospace=65345,e.ampersand=38,e.ampersandmonospace=65286,e.ampersandsmall=63270,e.amsquare=13250,e.anbopomofo=12578,e.angbopomofo=12580,e.angbracketleft=12296,e.angbracketright=12297,e.angkhankhuthai=3674,e.angle=8736,e.anglebracketleft=12296,e.anglebracketleftvertical=65087,e.anglebracketright=12297,e.anglebracketrightvertical=65088,e.angleleft=9001,e.angleright=9002,e.angstrom=8491,e.anoteleia=903,e.anudattadeva=2386,e.anusvarabengali=2434,e.anusvaradeva=2306,e.anusvaragujarati=2690,e.aogonek=261,e.apaatosquare=13056,e.aparen=9372,e.apostrophearmenian=1370,e.apostrophemod=700,e.apple=63743,e.approaches=8784,e.approxequal=8776,e.approxequalorimage=8786,e.approximatelyequal=8773,e.araeaekorean=12686,e.araeakorean=12685,e.arc=8978,e.arighthalfring=7834,e.aring=229,e.aringacute=507,e.aringbelow=7681,e.arrowboth=8596,e.arrowdashdown=8675,e.arrowdashleft=8672,e.arrowdashright=8674,e.arrowdashup=8673,e.arrowdblboth=8660,e.arrowdbldown=8659,e.arrowdblleft=8656,e.arrowdblright=8658,e.arrowdblup=8657,e.arrowdown=8595,e.arrowdownleft=8601,e.arrowdownright=8600,e.arrowdownwhite=8681,e.arrowheaddownmod=709,e.arrowheadleftmod=706,e.arrowheadrightmod=707,e.arrowheadupmod=708,e.arrowhorizex=63719,e.arrowleft=8592,e.arrowleftdbl=8656,e.arrowleftdblstroke=8653,e.arrowleftoverright=8646,e.arrowleftwhite=8678,e.arrowright=8594,e.arrowrightdblstroke=8655,e.arrowrightheavy=10142,e.arrowrightoverleft=8644,e.arrowrightwhite=8680,e.arrowtableft=8676,e.arrowtabright=8677,e.arrowup=8593,e.arrowupdn=8597,e.arrowupdnbse=8616,e.arrowupdownbase=8616,e.arrowupleft=8598,e.arrowupleftofdown=8645,e.arrowupright=8599,e.arrowupwhite=8679,e.arrowvertex=63718,e.asciicircum=94,e.asciicircummonospace=65342,e.asciitilde=126,e.asciitildemonospace=65374,e.ascript=593,e.ascriptturned=594,e.asmallhiragana=12353,e.asmallkatakana=12449,e.asmallkatakanahalfwidth=65383,e.asterisk=42,e.asteriskaltonearabic=1645,e.asteriskarabic=1645,e.asteriskmath=8727,e.asteriskmonospace=65290,e.asterisksmall=65121,e.asterism=8258,e.asuperior=63209,e.asymptoticallyequal=8771,e.at=64,e.atilde=227,e.atmonospace=65312,e.atsmall=65131,e.aturned=592,e.aubengali=2452,e.aubopomofo=12576,e.audeva=2324,e.augujarati=2708,e.augurmukhi=2580,e.aulengthmarkbengali=2519,e.aumatragurmukhi=2636,e.auvowelsignbengali=2508,e.auvowelsigndeva=2380,e.auvowelsigngujarati=2764,e.avagrahadeva=2365,e.aybarmenian=1377,e.ayin=1506,e.ayinaltonehebrew=64288,e.ayinhebrew=1506,e.b=98,e.babengali=2476,e.backslash=92,e.backslashmonospace=65340,e.badeva=2348,e.bagujarati=2732,e.bagurmukhi=2604,e.bahiragana=12400,e.bahtthai=3647,e.bakatakana=12496,e.bar=124,e.barmonospace=65372,e.bbopomofo=12549,e.bcircle=9425,e.bdotaccent=7683,e.bdotbelow=7685,e.beamedsixteenthnotes=9836,e.because=8757,e.becyrillic=1073,e.beharabic=1576,e.behfinalarabic=65168,e.behinitialarabic=65169,e.behiragana=12409,e.behmedialarabic=65170,e.behmeeminitialarabic=64671,e.behmeemisolatedarabic=64520,e.behnoonfinalarabic=64621,e.bekatakana=12505,e.benarmenian=1378,e.bet=1489,e.beta=946,e.betasymbolgreek=976,e.betdagesh=64305,e.betdageshhebrew=64305,e.bethebrew=1489,e.betrafehebrew=64332,e.bhabengali=2477,e.bhadeva=2349,e.bhagujarati=2733,e.bhagurmukhi=2605,e.bhook=595,e.bihiragana=12403,e.bikatakana=12499,e.bilabialclick=664,e.bindigurmukhi=2562,e.birusquare=13105,e.blackcircle=9679,e.blackdiamond=9670,e.blackdownpointingtriangle=9660,e.blackleftpointingpointer=9668,e.blackleftpointingtriangle=9664,e.blacklenticularbracketleft=12304,e.blacklenticularbracketleftvertical=65083,e.blacklenticularbracketright=12305,e.blacklenticularbracketrightvertical=65084,e.blacklowerlefttriangle=9699,e.blacklowerrighttriangle=9698,e.blackrectangle=9644,e.blackrightpointingpointer=9658,e.blackrightpointingtriangle=9654,e.blacksmallsquare=9642,e.blacksmilingface=9787,e.blacksquare=9632,e.blackstar=9733,e.blackupperlefttriangle=9700,e.blackupperrighttriangle=9701,e.blackuppointingsmalltriangle=9652,e.blackuppointingtriangle=9650,e.blank=9251,e.blinebelow=7687,e.block=9608,e.bmonospace=65346,e.bobaimaithai=3610,e.bohiragana=12412,e.bokatakana=12508,e.bparen=9373,e.bqsquare=13251,e.braceex=63732,e.braceleft=123,e.braceleftbt=63731,e.braceleftmid=63730,e.braceleftmonospace=65371,e.braceleftsmall=65115,e.bracelefttp=63729,e.braceleftvertical=65079,e.braceright=125,e.bracerightbt=63742,e.bracerightmid=63741,e.bracerightmonospace=65373,e.bracerightsmall=65116,e.bracerighttp=63740,e.bracerightvertical=65080,e.bracketleft=91,e.bracketleftbt=63728,e.bracketleftex=63727,e.bracketleftmonospace=65339,e.bracketlefttp=63726,e.bracketright=93,e.bracketrightbt=63739,e.bracketrightex=63738,e.bracketrightmonospace=65341,e.bracketrighttp=63737,e.breve=728,e.brevebelowcmb=814,e.brevecmb=774,e.breveinvertedbelowcmb=815,e.breveinvertedcmb=785,e.breveinverteddoublecmb=865,e.bridgebelowcmb=810,e.bridgeinvertedbelowcmb=826,e.brokenbar=166,e.bstroke=384,e.bsuperior=63210,e.btopbar=387,e.buhiragana=12406,e.bukatakana=12502,e.bullet=8226,e.bulletinverse=9688,e.bulletoperator=8729,e.bullseye=9678,e.c=99,e.caarmenian=1390,e.cabengali=2458,e.cacute=263,e.cadeva=2330,e.cagujarati=2714,e.cagurmukhi=2586,e.calsquare=13192,e.candrabindubengali=2433,e.candrabinducmb=784,e.candrabindudeva=2305,e.candrabindugujarati=2689,e.capslock=8682,e.careof=8453,e.caron=711,e.caronbelowcmb=812,e.caroncmb=780,e.carriagereturn=8629,e.cbopomofo=12568,e.ccaron=269,e.ccedilla=231,e.ccedillaacute=7689,e.ccircle=9426,e.ccircumflex=265,e.ccurl=597,e.cdot=267,e.cdotaccent=267,e.cdsquare=13253,e.cedilla=184,e.cedillacmb=807,e.cent=162,e.centigrade=8451,e.centinferior=63199,e.centmonospace=65504,e.centoldstyle=63394,e.centsuperior=63200,e.chaarmenian=1401,e.chabengali=2459,e.chadeva=2331,e.chagujarati=2715,e.chagurmukhi=2587,e.chbopomofo=12564,e.cheabkhasiancyrillic=1213,e.checkmark=10003,e.checyrillic=1095,e.chedescenderabkhasiancyrillic=1215,e.chedescendercyrillic=1207,e.chedieresiscyrillic=1269,e.cheharmenian=1395,e.chekhakassiancyrillic=1228,e.cheverticalstrokecyrillic=1209,e.chi=967,e.chieuchacirclekorean=12919,e.chieuchaparenkorean=12823,e.chieuchcirclekorean=12905,e.chieuchkorean=12618,e.chieuchparenkorean=12809,e.chochangthai=3594,e.chochanthai=3592,e.chochingthai=3593,e.chochoethai=3596,e.chook=392,e.cieucacirclekorean=12918,e.cieucaparenkorean=12822,e.cieuccirclekorean=12904,e.cieuckorean=12616,e.cieucparenkorean=12808,e.cieucuparenkorean=12828,e.circle=9675,e.circlecopyrt=169,e.circlemultiply=8855,e.circleot=8857,e.circleplus=8853,e.circlepostalmark=12342,e.circlewithlefthalfblack=9680,e.circlewithrighthalfblack=9681,e.circumflex=710,e.circumflexbelowcmb=813,e.circumflexcmb=770,e.clear=8999,e.clickalveolar=450,e.clickdental=448,e.clicklateral=449,e.clickretroflex=451,e.club=9827,e.clubsuitblack=9827,e.clubsuitwhite=9831,e.cmcubedsquare=13220,e.cmonospace=65347,e.cmsquaredsquare=13216,e.coarmenian=1409,e.colon=58,e.colonmonetary=8353,e.colonmonospace=65306,e.colonsign=8353,e.colonsmall=65109,e.colontriangularhalfmod=721,e.colontriangularmod=720,e.comma=44,e.commaabovecmb=787,e.commaaboverightcmb=789,e.commaaccent=63171,e.commaarabic=1548,e.commaarmenian=1373,e.commainferior=63201,e.commamonospace=65292,e.commareversedabovecmb=788,e.commareversedmod=701,e.commasmall=65104,e.commasuperior=63202,e.commaturnedabovecmb=786,e.commaturnedmod=699,e.compass=9788,e.congruent=8773,e.contourintegral=8750,e.control=8963,e.controlACK=6,e.controlBEL=7,e.controlBS=8,e.controlCAN=24,e.controlCR=13,e.controlDC1=17,e.controlDC2=18,e.controlDC3=19,e.controlDC4=20,e.controlDEL=127,e.controlDLE=16,e.controlEM=25,e.controlENQ=5,e.controlEOT=4,e.controlESC=27,e.controlETB=23,e.controlETX=3,e.controlFF=12,e.controlFS=28,e.controlGS=29,e.controlHT=9,e.controlLF=10,e.controlNAK=21,e.controlNULL=0,e.controlRS=30,e.controlSI=15,e.controlSO=14,e.controlSOT=2,e.controlSTX=1,e.controlSUB=26,e.controlSYN=22,e.controlUS=31,e.controlVT=11,e.copyright=169,e.copyrightsans=63721,e.copyrightserif=63193,e.cornerbracketleft=12300,e.cornerbracketlefthalfwidth=65378,e.cornerbracketleftvertical=65089,e.cornerbracketright=12301,e.cornerbracketrighthalfwidth=65379,e.cornerbracketrightvertical=65090,e.corporationsquare=13183,e.cosquare=13255,e.coverkgsquare=13254,e.cparen=9374,e.cruzeiro=8354,e.cstretched=663,e.curlyand=8911,e.curlyor=8910,e.currency=164,e.cyrBreve=63185,e.cyrFlex=63186,e.cyrbreve=63188,e.cyrflex=63189,e.d=100,e.daarmenian=1380,e.dabengali=2470,e.dadarabic=1590,e.dadeva=2342,e.dadfinalarabic=65214,e.dadinitialarabic=65215,e.dadmedialarabic=65216,e.dagesh=1468,e.dageshhebrew=1468,e.dagger=8224,e.daggerdbl=8225,e.dagujarati=2726,e.dagurmukhi=2598,e.dahiragana=12384,e.dakatakana=12480,e.dalarabic=1583,e.dalet=1491,e.daletdagesh=64307,e.daletdageshhebrew=64307,e.dalethebrew=1491,e.dalfinalarabic=65194,e.dammaarabic=1615,e.dammalowarabic=1615,e.dammatanaltonearabic=1612,e.dammatanarabic=1612,e.danda=2404,e.dargahebrew=1447,e.dargalefthebrew=1447,e.dasiapneumatacyrilliccmb=1157,e.dblGrave=63187,e.dblanglebracketleft=12298,e.dblanglebracketleftvertical=65085,e.dblanglebracketright=12299,e.dblanglebracketrightvertical=65086,e.dblarchinvertedbelowcmb=811,e.dblarrowleft=8660,e.dblarrowright=8658,e.dbldanda=2405,e.dblgrave=63190,e.dblgravecmb=783,e.dblintegral=8748,e.dbllowline=8215,e.dbllowlinecmb=819,e.dbloverlinecmb=831,e.dblprimemod=698,e.dblverticalbar=8214,e.dblverticallineabovecmb=782,e.dbopomofo=12553,e.dbsquare=13256,e.dcaron=271,e.dcedilla=7697,e.dcircle=9427,e.dcircumflexbelow=7699,e.dcroat=273,e.ddabengali=2465,e.ddadeva=2337,e.ddagujarati=2721,e.ddagurmukhi=2593,e.ddalarabic=1672,e.ddalfinalarabic=64393,e.dddhadeva=2396,e.ddhabengali=2466,e.ddhadeva=2338,e.ddhagujarati=2722,e.ddhagurmukhi=2594,e.ddotaccent=7691,e.ddotbelow=7693,e.decimalseparatorarabic=1643,e.decimalseparatorpersian=1643,e.decyrillic=1076,e.degree=176,e.dehihebrew=1453,e.dehiragana=12391,e.deicoptic=1007,e.dekatakana=12487,e.deleteleft=9003,e.deleteright=8998,e.delta=948,e.deltaturned=397,e.denominatorminusonenumeratorbengali=2552,e.dezh=676,e.dhabengali=2471,e.dhadeva=2343,e.dhagujarati=2727,e.dhagurmukhi=2599,e.dhook=599,e.dialytikatonos=901,e.dialytikatonoscmb=836,e.diamond=9830,e.diamondsuitwhite=9826,e.dieresis=168,e.dieresisacute=63191,e.dieresisbelowcmb=804,e.dieresiscmb=776,e.dieresisgrave=63192,e.dieresistonos=901,e.dihiragana=12386,e.dikatakana=12482,e.dittomark=12291,e.divide=247,e.divides=8739,e.divisionslash=8725,e.djecyrillic=1106,e.dkshade=9619,e.dlinebelow=7695,e.dlsquare=13207,e.dmacron=273,e.dmonospace=65348,e.dnblock=9604,e.dochadathai=3598,e.dodekthai=3604,e.dohiragana=12393,e.dokatakana=12489,e.dollar=36,e.dollarinferior=63203,e.dollarmonospace=65284,e.dollaroldstyle=63268,e.dollarsmall=65129,e.dollarsuperior=63204,e.dong=8363,e.dorusquare=13094,e.dotaccent=729,e.dotaccentcmb=775,e.dotbelowcmb=803,e.dotbelowcomb=803,e.dotkatakana=12539,e.dotlessi=305,e.dotlessj=63166,e.dotlessjstrokehook=644,e.dotmath=8901,e.dottedcircle=9676,e.doubleyodpatah=64287,e.doubleyodpatahhebrew=64287,e.downtackbelowcmb=798,e.downtackmod=725,e.dparen=9375,e.dsuperior=63211,e.dtail=598,e.dtopbar=396,e.duhiragana=12389,e.dukatakana=12485,e.dz=499,e.dzaltone=675,e.dzcaron=454,e.dzcurl=677,e.dzeabkhasiancyrillic=1249,e.dzecyrillic=1109,e.dzhecyrillic=1119,e.e=101,e.eacute=233,e.earth=9793,e.ebengali=2447,e.ebopomofo=12572,e.ebreve=277,e.ecandradeva=2317,e.ecandragujarati=2701,e.ecandravowelsigndeva=2373,e.ecandravowelsigngujarati=2757,e.ecaron=283,e.ecedillabreve=7709,e.echarmenian=1381,e.echyiwnarmenian=1415,e.ecircle=9428,e.ecircumflex=234,e.ecircumflexacute=7871,e.ecircumflexbelow=7705,e.ecircumflexdotbelow=7879,e.ecircumflexgrave=7873,e.ecircumflexhookabove=7875,e.ecircumflextilde=7877,e.ecyrillic=1108,e.edblgrave=517,e.edeva=2319,e.edieresis=235,e.edot=279,e.edotaccent=279,e.edotbelow=7865,e.eegurmukhi=2575,e.eematragurmukhi=2631,e.efcyrillic=1092,e.egrave=232,e.egujarati=2703,e.eharmenian=1383,e.ehbopomofo=12573,e.ehiragana=12360,e.ehookabove=7867,e.eibopomofo=12575,e.eight=56,e.eightarabic=1640,e.eightbengali=2542,e.eightcircle=9319,e.eightcircleinversesansserif=10129,e.eightdeva=2414,e.eighteencircle=9329,e.eighteenparen=9349,e.eighteenperiod=9369,e.eightgujarati=2798,e.eightgurmukhi=2670,e.eighthackarabic=1640,e.eighthangzhou=12328,e.eighthnotebeamed=9835,e.eightideographicparen=12839,e.eightinferior=8328,e.eightmonospace=65304,e.eightoldstyle=63288,e.eightparen=9339,e.eightperiod=9359,e.eightpersian=1784,e.eightroman=8567,e.eightsuperior=8312,e.eightthai=3672,e.einvertedbreve=519,e.eiotifiedcyrillic=1125,e.ekatakana=12456,e.ekatakanahalfwidth=65396,e.ekonkargurmukhi=2676,e.ekorean=12628,e.elcyrillic=1083,e.element=8712,e.elevencircle=9322,e.elevenparen=9342,e.elevenperiod=9362,e.elevenroman=8570,e.ellipsis=8230,e.ellipsisvertical=8942,e.emacron=275,e.emacronacute=7703,e.emacrongrave=7701,e.emcyrillic=1084,e.emdash=8212,e.emdashvertical=65073,e.emonospace=65349,e.emphasismarkarmenian=1371,e.emptyset=8709,e.enbopomofo=12579,e.encyrillic=1085,e.endash=8211,e.endashvertical=65074,e.endescendercyrillic=1187,e.eng=331,e.engbopomofo=12581,e.enghecyrillic=1189,e.enhookcyrillic=1224,e.enspace=8194,e.eogonek=281,e.eokorean=12627,e.eopen=603,e.eopenclosed=666,e.eopenreversed=604,e.eopenreversedclosed=606,e.eopenreversedhook=605,e.eparen=9376,e.epsilon=949,e.epsilontonos=941,e.equal=61,e.equalmonospace=65309,e.equalsmall=65126,e.equalsuperior=8316,e.equivalence=8801,e.erbopomofo=12582,e.ercyrillic=1088,e.ereversed=600,e.ereversedcyrillic=1101,e.escyrillic=1089,e.esdescendercyrillic=1195,e.esh=643,e.eshcurl=646,e.eshortdeva=2318,e.eshortvowelsigndeva=2374,e.eshreversedloop=426,e.eshsquatreversed=645,e.esmallhiragana=12359,e.esmallkatakana=12455,e.esmallkatakanahalfwidth=65386,e.estimated=8494,e.esuperior=63212,e.eta=951,e.etarmenian=1384,e.etatonos=942,e.eth=240,e.etilde=7869,e.etildebelow=7707,e.etnahtafoukhhebrew=1425,e.etnahtafoukhlefthebrew=1425,e.etnahtahebrew=1425,e.etnahtalefthebrew=1425,e.eturned=477,e.eukorean=12641,e.euro=8364,e.evowelsignbengali=2503,e.evowelsigndeva=2375,e.evowelsigngujarati=2759,e.exclam=33,e.exclamarmenian=1372,e.exclamdbl=8252,e.exclamdown=161,e.exclamdownsmall=63393,e.exclammonospace=65281,e.exclamsmall=63265,e.existential=8707,e.ezh=658,e.ezhcaron=495,e.ezhcurl=659,e.ezhreversed=441,e.ezhtail=442,e.f=102,e.fadeva=2398,e.fagurmukhi=2654,e.fahrenheit=8457,e.fathaarabic=1614,e.fathalowarabic=1614,e.fathatanarabic=1611,e.fbopomofo=12552,e.fcircle=9429,e.fdotaccent=7711,e.feharabic=1601,e.feharmenian=1414,e.fehfinalarabic=65234,e.fehinitialarabic=65235,e.fehmedialarabic=65236,e.feicoptic=997,e.female=9792,e.ff=64256,e.f_f=64256,e.ffi=64259,e.f_f_i=64259,e.ffl=64260,e.f_f_l=64260,e.fi=64257,e.f_i=64257,e.fifteencircle=9326,e.fifteenparen=9346,e.fifteenperiod=9366,e.figuredash=8210,e.filledbox=9632,e.filledrect=9644,e.finalkaf=1498,e.finalkafdagesh=64314,e.finalkafdageshhebrew=64314,e.finalkafhebrew=1498,e.finalmem=1501,e.finalmemhebrew=1501,e.finalnun=1503,e.finalnunhebrew=1503,e.finalpe=1507,e.finalpehebrew=1507,e.finaltsadi=1509,e.finaltsadihebrew=1509,e.firsttonechinese=713,e.fisheye=9673,e.fitacyrillic=1139,e.five=53,e.fivearabic=1637,e.fivebengali=2539,e.fivecircle=9316,e.fivecircleinversesansserif=10126,e.fivedeva=2411,e.fiveeighths=8541,e.fivegujarati=2795,e.fivegurmukhi=2667,e.fivehackarabic=1637,e.fivehangzhou=12325,e.fiveideographicparen=12836,e.fiveinferior=8325,e.fivemonospace=65301,e.fiveoldstyle=63285,e.fiveparen=9336,e.fiveperiod=9356,e.fivepersian=1781,e.fiveroman=8564,e.fivesuperior=8309,e.fivethai=3669,e.fl=64258,e.f_l=64258,e.florin=402,e.fmonospace=65350,e.fmsquare=13209,e.fofanthai=3615,e.fofathai=3613,e.fongmanthai=3663,e.forall=8704,e.four=52,e.fourarabic=1636,e.fourbengali=2538,e.fourcircle=9315,e.fourcircleinversesansserif=10125,e.fourdeva=2410,e.fourgujarati=2794,e.fourgurmukhi=2666,e.fourhackarabic=1636,e.fourhangzhou=12324,e.fourideographicparen=12835,e.fourinferior=8324,e.fourmonospace=65300,e.fournumeratorbengali=2551,e.fouroldstyle=63284,e.fourparen=9335,e.fourperiod=9355,e.fourpersian=1780,e.fourroman=8563,e.foursuperior=8308,e.fourteencircle=9325,e.fourteenparen=9345,e.fourteenperiod=9365,e.fourthai=3668,e.fourthtonechinese=715,e.fparen=9377,e.fraction=8260,e.franc=8355,e.g=103,e.gabengali=2455,e.gacute=501,e.gadeva=2327,e.gafarabic=1711,e.gaffinalarabic=64403,e.gafinitialarabic=64404,e.gafmedialarabic=64405,e.gagujarati=2711,e.gagurmukhi=2583,e.gahiragana=12364,e.gakatakana=12460,e.gamma=947,e.gammalatinsmall=611,e.gammasuperior=736,e.gangiacoptic=1003,e.gbopomofo=12557,e.gbreve=287,e.gcaron=487,e.gcedilla=291,e.gcircle=9430,e.gcircumflex=285,e.gcommaaccent=291,e.gdot=289,e.gdotaccent=289,e.gecyrillic=1075,e.gehiragana=12370,e.gekatakana=12466,e.geometricallyequal=8785,e.gereshaccenthebrew=1436,e.gereshhebrew=1523,e.gereshmuqdamhebrew=1437,e.germandbls=223,e.gershayimaccenthebrew=1438,e.gershayimhebrew=1524,e.getamark=12307,e.ghabengali=2456,e.ghadarmenian=1394,e.ghadeva=2328,e.ghagujarati=2712,e.ghagurmukhi=2584,e.ghainarabic=1594,e.ghainfinalarabic=65230,e.ghaininitialarabic=65231,e.ghainmedialarabic=65232,e.ghemiddlehookcyrillic=1173,e.ghestrokecyrillic=1171,e.gheupturncyrillic=1169,e.ghhadeva=2394,e.ghhagurmukhi=2650,e.ghook=608,e.ghzsquare=13203,e.gihiragana=12366,e.gikatakana=12462,e.gimarmenian=1379,e.gimel=1490,e.gimeldagesh=64306,e.gimeldageshhebrew=64306,e.gimelhebrew=1490,e.gjecyrillic=1107,e.glottalinvertedstroke=446,e.glottalstop=660,e.glottalstopinverted=662,e.glottalstopmod=704,e.glottalstopreversed=661,e.glottalstopreversedmod=705,e.glottalstopreversedsuperior=740,e.glottalstopstroke=673,e.glottalstopstrokereversed=674,e.gmacron=7713,e.gmonospace=65351,e.gohiragana=12372,e.gokatakana=12468,e.gparen=9378,e.gpasquare=13228,e.gradient=8711,e.grave=96,e.gravebelowcmb=790,e.gravecmb=768,e.gravecomb=768,e.gravedeva=2387,e.gravelowmod=718,e.gravemonospace=65344,e.gravetonecmb=832,e.greater=62,e.greaterequal=8805,e.greaterequalorless=8923,e.greatermonospace=65310,e.greaterorequivalent=8819,e.greaterorless=8823,e.greateroverequal=8807,e.greatersmall=65125,e.gscript=609,e.gstroke=485,e.guhiragana=12368,e.guillemotleft=171,e.guillemotright=187,e.guilsinglleft=8249,e.guilsinglright=8250,e.gukatakana=12464,e.guramusquare=13080,e.gysquare=13257,e.h=104,e.haabkhasiancyrillic=1193,e.haaltonearabic=1729,e.habengali=2489,e.hadescendercyrillic=1203,e.hadeva=2361,e.hagujarati=2745,e.hagurmukhi=2617,e.haharabic=1581,e.hahfinalarabic=65186,e.hahinitialarabic=65187,e.hahiragana=12399,e.hahmedialarabic=65188,e.haitusquare=13098,e.hakatakana=12495,e.hakatakanahalfwidth=65418,e.halantgurmukhi=2637,e.hamzaarabic=1569,e.hamzalowarabic=1569,e.hangulfiller=12644,e.hardsigncyrillic=1098,e.harpoonleftbarbup=8636,e.harpoonrightbarbup=8640,e.hasquare=13258,e.hatafpatah=1458,e.hatafpatah16=1458,e.hatafpatah23=1458,e.hatafpatah2f=1458,e.hatafpatahhebrew=1458,e.hatafpatahnarrowhebrew=1458,e.hatafpatahquarterhebrew=1458,e.hatafpatahwidehebrew=1458,e.hatafqamats=1459,e.hatafqamats1b=1459,e.hatafqamats28=1459,e.hatafqamats34=1459,e.hatafqamatshebrew=1459,e.hatafqamatsnarrowhebrew=1459,e.hatafqamatsquarterhebrew=1459,e.hatafqamatswidehebrew=1459,e.hatafsegol=1457,e.hatafsegol17=1457,e.hatafsegol24=1457,e.hatafsegol30=1457,e.hatafsegolhebrew=1457,e.hatafsegolnarrowhebrew=1457,e.hatafsegolquarterhebrew=1457,e.hatafsegolwidehebrew=1457,e.hbar=295,e.hbopomofo=12559,e.hbrevebelow=7723,e.hcedilla=7721,e.hcircle=9431,e.hcircumflex=293,e.hdieresis=7719,e.hdotaccent=7715,e.hdotbelow=7717,e.he=1492,e.heart=9829,e.heartsuitblack=9829,e.heartsuitwhite=9825,e.hedagesh=64308,e.hedageshhebrew=64308,e.hehaltonearabic=1729,e.heharabic=1607,e.hehebrew=1492,e.hehfinalaltonearabic=64423,e.hehfinalalttwoarabic=65258,e.hehfinalarabic=65258,e.hehhamzaabovefinalarabic=64421,e.hehhamzaaboveisolatedarabic=64420,e.hehinitialaltonearabic=64424,e.hehinitialarabic=65259,e.hehiragana=12408,e.hehmedialaltonearabic=64425,e.hehmedialarabic=65260,e.heiseierasquare=13179,e.hekatakana=12504,e.hekatakanahalfwidth=65421,e.hekutaarusquare=13110,e.henghook=615,e.herutusquare=13113,e.het=1495,e.hethebrew=1495,e.hhook=614,e.hhooksuperior=689,e.hieuhacirclekorean=12923,e.hieuhaparenkorean=12827,e.hieuhcirclekorean=12909,e.hieuhkorean=12622,e.hieuhparenkorean=12813,e.hihiragana=12402,e.hikatakana=12498,e.hikatakanahalfwidth=65419,e.hiriq=1460,e.hiriq14=1460,e.hiriq21=1460,e.hiriq2d=1460,e.hiriqhebrew=1460,e.hiriqnarrowhebrew=1460,e.hiriqquarterhebrew=1460,e.hiriqwidehebrew=1460,e.hlinebelow=7830,e.hmonospace=65352,e.hoarmenian=1392,e.hohipthai=3627,e.hohiragana=12411,e.hokatakana=12507,e.hokatakanahalfwidth=65422,e.holam=1465,e.holam19=1465,e.holam26=1465,e.holam32=1465,e.holamhebrew=1465,e.holamnarrowhebrew=1465,e.holamquarterhebrew=1465,e.holamwidehebrew=1465,e.honokhukthai=3630,e.hookabovecomb=777,e.hookcmb=777,e.hookpalatalizedbelowcmb=801,e.hookretroflexbelowcmb=802,e.hoonsquare=13122,e.horicoptic=1001,e.horizontalbar=8213,e.horncmb=795,e.hotsprings=9832,e.house=8962,e.hparen=9379,e.hsuperior=688,e.hturned=613,e.huhiragana=12405,e.huiitosquare=13107,e.hukatakana=12501,e.hukatakanahalfwidth=65420,e.hungarumlaut=733,e.hungarumlautcmb=779,e.hv=405,e.hyphen=45,e.hypheninferior=63205,e.hyphenmonospace=65293,e.hyphensmall=65123,e.hyphensuperior=63206,e.hyphentwo=8208,e.i=105,e.iacute=237,e.iacyrillic=1103,e.ibengali=2439,e.ibopomofo=12583,e.ibreve=301,e.icaron=464,e.icircle=9432,e.icircumflex=238,e.icyrillic=1110,e.idblgrave=521,e.ideographearthcircle=12943,e.ideographfirecircle=12939,e.ideographicallianceparen=12863,e.ideographiccallparen=12858,e.ideographiccentrecircle=12965,e.ideographicclose=12294,e.ideographiccomma=12289,e.ideographiccommaleft=65380,e.ideographiccongratulationparen=12855,e.ideographiccorrectcircle=12963,e.ideographicearthparen=12847,e.ideographicenterpriseparen=12861,e.ideographicexcellentcircle=12957,e.ideographicfestivalparen=12864,e.ideographicfinancialcircle=12950,e.ideographicfinancialparen=12854,e.ideographicfireparen=12843,e.ideographichaveparen=12850,e.ideographichighcircle=12964,e.ideographiciterationmark=12293,e.ideographiclaborcircle=12952,e.ideographiclaborparen=12856,e.ideographicleftcircle=12967,e.ideographiclowcircle=12966,e.ideographicmedicinecircle=12969,e.ideographicmetalparen=12846,e.ideographicmoonparen=12842,e.ideographicnameparen=12852,e.ideographicperiod=12290,e.ideographicprintcircle=12958,e.ideographicreachparen=12867,e.ideographicrepresentparen=12857,e.ideographicresourceparen=12862,e.ideographicrightcircle=12968,e.ideographicsecretcircle=12953,e.ideographicselfparen=12866,e.ideographicsocietyparen=12851,e.ideographicspace=12288,e.ideographicspecialparen=12853,e.ideographicstockparen=12849,e.ideographicstudyparen=12859,e.ideographicsunparen=12848,e.ideographicsuperviseparen=12860,e.ideographicwaterparen=12844,e.ideographicwoodparen=12845,e.ideographiczero=12295,e.ideographmetalcircle=12942,e.ideographmooncircle=12938,e.ideographnamecircle=12948,e.ideographsuncircle=12944,e.ideographwatercircle=12940,e.ideographwoodcircle=12941,e.ideva=2311,e.idieresis=239,e.idieresisacute=7727,e.idieresiscyrillic=1253,e.idotbelow=7883,e.iebrevecyrillic=1239,e.iecyrillic=1077,e.ieungacirclekorean=12917,e.ieungaparenkorean=12821,e.ieungcirclekorean=12903,e.ieungkorean=12615,e.ieungparenkorean=12807,e.igrave=236,e.igujarati=2695,e.igurmukhi=2567,e.ihiragana=12356,e.ihookabove=7881,e.iibengali=2440,e.iicyrillic=1080,e.iideva=2312,e.iigujarati=2696,e.iigurmukhi=2568,e.iimatragurmukhi=2624,e.iinvertedbreve=523,e.iishortcyrillic=1081,e.iivowelsignbengali=2496,e.iivowelsigndeva=2368,e.iivowelsigngujarati=2752,e.ij=307,e.ikatakana=12452,e.ikatakanahalfwidth=65394,e.ikorean=12643,e.ilde=732,e.iluyhebrew=1452,e.imacron=299,e.imacroncyrillic=1251,e.imageorapproximatelyequal=8787,e.imatragurmukhi=2623,e.imonospace=65353,e.increment=8710,e.infinity=8734,e.iniarmenian=1387,e.integral=8747,e.integralbottom=8993,e.integralbt=8993,e.integralex=63733,e.integraltop=8992,e.integraltp=8992,e.intersection=8745,e.intisquare=13061,e.invbullet=9688,e.invcircle=9689,e.invsmileface=9787,e.iocyrillic=1105,e.iogonek=303,e.iota=953,e.iotadieresis=970,e.iotadieresistonos=912,e.iotalatin=617,e.iotatonos=943,e.iparen=9380,e.irigurmukhi=2674,e.ismallhiragana=12355,e.ismallkatakana=12451,e.ismallkatakanahalfwidth=65384,e.issharbengali=2554,e.istroke=616,e.isuperior=63213,e.iterationhiragana=12445,e.iterationkatakana=12541,e.itilde=297,e.itildebelow=7725,e.iubopomofo=12585,e.iucyrillic=1102,e.ivowelsignbengali=2495,e.ivowelsigndeva=2367,e.ivowelsigngujarati=2751,e.izhitsacyrillic=1141,e.izhitsadblgravecyrillic=1143,e.j=106,e.jaarmenian=1393,e.jabengali=2460,e.jadeva=2332,e.jagujarati=2716,e.jagurmukhi=2588,e.jbopomofo=12560,e.jcaron=496,e.jcircle=9433,e.jcircumflex=309,e.jcrossedtail=669,e.jdotlessstroke=607,e.jecyrillic=1112,e.jeemarabic=1580,e.jeemfinalarabic=65182,e.jeeminitialarabic=65183,e.jeemmedialarabic=65184,e.jeharabic=1688,e.jehfinalarabic=64395,e.jhabengali=2461,e.jhadeva=2333,e.jhagujarati=2717,e.jhagurmukhi=2589,e.jheharmenian=1403,e.jis=12292,e.jmonospace=65354,e.jparen=9381,e.jsuperior=690,e.k=107,e.kabashkircyrillic=1185,e.kabengali=2453,e.kacute=7729,e.kacyrillic=1082,e.kadescendercyrillic=1179,e.kadeva=2325,e.kaf=1499,e.kafarabic=1603,e.kafdagesh=64315,e.kafdageshhebrew=64315,e.kaffinalarabic=65242,e.kafhebrew=1499,e.kafinitialarabic=65243,e.kafmedialarabic=65244,e.kafrafehebrew=64333,e.kagujarati=2709,e.kagurmukhi=2581,e.kahiragana=12363,e.kahookcyrillic=1220,e.kakatakana=12459,e.kakatakanahalfwidth=65398,e.kappa=954,e.kappasymbolgreek=1008,e.kapyeounmieumkorean=12657,e.kapyeounphieuphkorean=12676,e.kapyeounpieupkorean=12664,e.kapyeounssangpieupkorean=12665,e.karoriisquare=13069,e.kashidaautoarabic=1600,e.kashidaautonosidebearingarabic=1600,e.kasmallkatakana=12533,e.kasquare=13188,e.kasraarabic=1616,e.kasratanarabic=1613,e.kastrokecyrillic=1183,e.katahiraprolongmarkhalfwidth=65392,e.kaverticalstrokecyrillic=1181,e.kbopomofo=12558,e.kcalsquare=13193,e.kcaron=489,e.kcedilla=311,e.kcircle=9434,e.kcommaaccent=311,e.kdotbelow=7731,e.keharmenian=1412,e.kehiragana=12369,e.kekatakana=12465,e.kekatakanahalfwidth=65401,e.kenarmenian=1391,e.kesmallkatakana=12534,e.kgreenlandic=312,e.khabengali=2454,e.khacyrillic=1093,e.khadeva=2326,e.khagujarati=2710,e.khagurmukhi=2582,e.khaharabic=1582,e.khahfinalarabic=65190,e.khahinitialarabic=65191,e.khahmedialarabic=65192,e.kheicoptic=999,e.khhadeva=2393,e.khhagurmukhi=2649,e.khieukhacirclekorean=12920,e.khieukhaparenkorean=12824,e.khieukhcirclekorean=12906,e.khieukhkorean=12619,e.khieukhparenkorean=12810,e.khokhaithai=3586,e.khokhonthai=3589,e.khokhuatthai=3587,e.khokhwaithai=3588,e.khomutthai=3675,e.khook=409,e.khorakhangthai=3590,e.khzsquare=13201,e.kihiragana=12365,e.kikatakana=12461,e.kikatakanahalfwidth=65399,e.kiroguramusquare=13077,e.kiromeetorusquare=13078,e.kirosquare=13076,e.kiyeokacirclekorean=12910,e.kiyeokaparenkorean=12814,e.kiyeokcirclekorean=12896,e.kiyeokkorean=12593,e.kiyeokparenkorean=12800,e.kiyeoksioskorean=12595,e.kjecyrillic=1116,e.klinebelow=7733,e.klsquare=13208,e.kmcubedsquare=13222,e.kmonospace=65355,e.kmsquaredsquare=13218,e.kohiragana=12371,e.kohmsquare=13248,e.kokaithai=3585,e.kokatakana=12467,e.kokatakanahalfwidth=65402,e.kooposquare=13086,e.koppacyrillic=1153,e.koreanstandardsymbol=12927,e.koroniscmb=835,e.kparen=9382,e.kpasquare=13226,e.ksicyrillic=1135,e.ktsquare=13263,e.kturned=670,e.kuhiragana=12367,e.kukatakana=12463,e.kukatakanahalfwidth=65400,e.kvsquare=13240,e.kwsquare=13246,e.l=108,e.labengali=2482,e.lacute=314,e.ladeva=2354,e.lagujarati=2738,e.lagurmukhi=2610,e.lakkhangyaothai=3653,e.lamaleffinalarabic=65276,e.lamalefhamzaabovefinalarabic=65272,e.lamalefhamzaaboveisolatedarabic=65271,e.lamalefhamzabelowfinalarabic=65274,e.lamalefhamzabelowisolatedarabic=65273,e.lamalefisolatedarabic=65275,e.lamalefmaddaabovefinalarabic=65270,e.lamalefmaddaaboveisolatedarabic=65269,e.lamarabic=1604,e.lambda=955,e.lambdastroke=411,e.lamed=1500,e.lameddagesh=64316,e.lameddageshhebrew=64316,e.lamedhebrew=1500,e.lamfinalarabic=65246,e.lamhahinitialarabic=64714,e.laminitialarabic=65247,e.lamjeeminitialarabic=64713,e.lamkhahinitialarabic=64715,e.lamlamhehisolatedarabic=65010,e.lammedialarabic=65248,e.lammeemhahinitialarabic=64904,e.lammeeminitialarabic=64716,e.largecircle=9711,e.lbar=410,e.lbelt=620,e.lbopomofo=12556,e.lcaron=318,e.lcedilla=316,e.lcircle=9435,e.lcircumflexbelow=7741,e.lcommaaccent=316,e.ldot=320,e.ldotaccent=320,e.ldotbelow=7735,e.ldotbelowmacron=7737,e.leftangleabovecmb=794,e.lefttackbelowcmb=792,e.less=60,e.lessequal=8804,e.lessequalorgreater=8922,e.lessmonospace=65308,e.lessorequivalent=8818,e.lessorgreater=8822,e.lessoverequal=8806,e.lesssmall=65124,e.lezh=622,e.lfblock=9612,e.lhookretroflex=621,e.lira=8356,e.liwnarmenian=1388,e.lj=457,e.ljecyrillic=1113,e.ll=63168,e.lladeva=2355,e.llagujarati=2739,e.llinebelow=7739,e.llladeva=2356,e.llvocalicbengali=2529,e.llvocalicdeva=2401,e.llvocalicvowelsignbengali=2531,e.llvocalicvowelsigndeva=2403,e.lmiddletilde=619,e.lmonospace=65356,e.lmsquare=13264,e.lochulathai=3628,e.logicaland=8743,e.logicalnot=172,e.logicalnotreversed=8976,e.logicalor=8744,e.lolingthai=3621,e.longs=383,e.lowlinecenterline=65102,e.lowlinecmb=818,e.lowlinedashed=65101,e.lozenge=9674,e.lparen=9383,e.lslash=322,e.lsquare=8467,e.lsuperior=63214,e.ltshade=9617,e.luthai=3622,e.lvocalicbengali=2444,e.lvocalicdeva=2316,e.lvocalicvowelsignbengali=2530,e.lvocalicvowelsigndeva=2402,e.lxsquare=13267,e.m=109,e.mabengali=2478,e.macron=175,e.macronbelowcmb=817,e.macroncmb=772,e.macronlowmod=717,e.macronmonospace=65507,e.macute=7743,e.madeva=2350,e.magujarati=2734,e.magurmukhi=2606,e.mahapakhhebrew=1444,e.mahapakhlefthebrew=1444,e.mahiragana=12414,e.maichattawalowleftthai=63637,e.maichattawalowrightthai=63636,e.maichattawathai=3659,e.maichattawaupperleftthai=63635,e.maieklowleftthai=63628,e.maieklowrightthai=63627,e.maiekthai=3656,e.maiekupperleftthai=63626,e.maihanakatleftthai=63620,e.maihanakatthai=3633,e.maitaikhuleftthai=63625,e.maitaikhuthai=3655,e.maitholowleftthai=63631,e.maitholowrightthai=63630,e.maithothai=3657,e.maithoupperleftthai=63629,e.maitrilowleftthai=63634,e.maitrilowrightthai=63633,e.maitrithai=3658,e.maitriupperleftthai=63632,e.maiyamokthai=3654,e.makatakana=12510,e.makatakanahalfwidth=65423,e.male=9794,e.mansyonsquare=13127,e.maqafhebrew=1470,e.mars=9794,e.masoracirclehebrew=1455,e.masquare=13187,e.mbopomofo=12551,e.mbsquare=13268,e.mcircle=9436,e.mcubedsquare=13221,e.mdotaccent=7745,e.mdotbelow=7747,e.meemarabic=1605,e.meemfinalarabic=65250,e.meeminitialarabic=65251,e.meemmedialarabic=65252,e.meemmeeminitialarabic=64721,e.meemmeemisolatedarabic=64584,e.meetorusquare=13133,e.mehiragana=12417,e.meizierasquare=13182,e.mekatakana=12513,e.mekatakanahalfwidth=65426,e.mem=1502,e.memdagesh=64318,e.memdageshhebrew=64318,e.memhebrew=1502,e.menarmenian=1396,e.merkhahebrew=1445,e.merkhakefulahebrew=1446,e.merkhakefulalefthebrew=1446,e.merkhalefthebrew=1445,e.mhook=625,e.mhzsquare=13202,e.middledotkatakanahalfwidth=65381,e.middot=183,e.mieumacirclekorean=12914,e.mieumaparenkorean=12818,e.mieumcirclekorean=12900,e.mieumkorean=12609,e.mieumpansioskorean=12656,e.mieumparenkorean=12804,e.mieumpieupkorean=12654,e.mieumsioskorean=12655,e.mihiragana=12415,e.mikatakana=12511,e.mikatakanahalfwidth=65424,e.minus=8722,e.minusbelowcmb=800,e.minuscircle=8854,e.minusmod=727,e.minusplus=8723,e.minute=8242,e.miribaarusquare=13130,e.mirisquare=13129,e.mlonglegturned=624,e.mlsquare=13206,e.mmcubedsquare=13219,e.mmonospace=65357,e.mmsquaredsquare=13215,e.mohiragana=12418,e.mohmsquare=13249,e.mokatakana=12514,e.mokatakanahalfwidth=65427,e.molsquare=13270,e.momathai=3617,e.moverssquare=13223,e.moverssquaredsquare=13224,e.mparen=9384,e.mpasquare=13227,e.mssquare=13235,e.msuperior=63215,e.mturned=623,e.mu=181,e.mu1=181,e.muasquare=13186,e.muchgreater=8811,e.muchless=8810,e.mufsquare=13196,e.mugreek=956,e.mugsquare=13197,e.muhiragana=12416,e.mukatakana=12512,e.mukatakanahalfwidth=65425,e.mulsquare=13205,e.multiply=215,e.mumsquare=13211,e.munahhebrew=1443,e.munahlefthebrew=1443,e.musicalnote=9834,e.musicalnotedbl=9835,e.musicflatsign=9837,e.musicsharpsign=9839,e.mussquare=13234,e.muvsquare=13238,e.muwsquare=13244,e.mvmegasquare=13241,e.mvsquare=13239,e.mwmegasquare=13247,e.mwsquare=13245,e.n=110,e.nabengali=2472,e.nabla=8711,e.nacute=324,e.nadeva=2344,e.nagujarati=2728,e.nagurmukhi=2600,e.nahiragana=12394,e.nakatakana=12490,e.nakatakanahalfwidth=65413,e.napostrophe=329,e.nasquare=13185,e.nbopomofo=12555,e.nbspace=160,e.ncaron=328,e.ncedilla=326,e.ncircle=9437,e.ncircumflexbelow=7755,e.ncommaaccent=326,e.ndotaccent=7749,e.ndotbelow=7751,e.nehiragana=12397,e.nekatakana=12493,e.nekatakanahalfwidth=65416,e.newsheqelsign=8362,e.nfsquare=13195,e.ngabengali=2457,e.ngadeva=2329,e.ngagujarati=2713,e.ngagurmukhi=2585,e.ngonguthai=3591,e.nhiragana=12435,e.nhookleft=626,e.nhookretroflex=627,e.nieunacirclekorean=12911,e.nieunaparenkorean=12815,e.nieuncieuckorean=12597,e.nieuncirclekorean=12897,e.nieunhieuhkorean=12598,e.nieunkorean=12596,e.nieunpansioskorean=12648,e.nieunparenkorean=12801,e.nieunsioskorean=12647,e.nieuntikeutkorean=12646,e.nihiragana=12395,e.nikatakana=12491,e.nikatakanahalfwidth=65414,e.nikhahitleftthai=63641,e.nikhahitthai=3661,e.nine=57,e.ninearabic=1641,e.ninebengali=2543,e.ninecircle=9320,e.ninecircleinversesansserif=10130,e.ninedeva=2415,e.ninegujarati=2799,e.ninegurmukhi=2671,e.ninehackarabic=1641,e.ninehangzhou=12329,e.nineideographicparen=12840,e.nineinferior=8329,e.ninemonospace=65305,e.nineoldstyle=63289,e.nineparen=9340,e.nineperiod=9360,e.ninepersian=1785,e.nineroman=8568,e.ninesuperior=8313,e.nineteencircle=9330,e.nineteenparen=9350,e.nineteenperiod=9370,e.ninethai=3673,e.nj=460,e.njecyrillic=1114,e.nkatakana=12531,e.nkatakanahalfwidth=65437,e.nlegrightlong=414,e.nlinebelow=7753,e.nmonospace=65358,e.nmsquare=13210,e.nnabengali=2467,e.nnadeva=2339,e.nnagujarati=2723,e.nnagurmukhi=2595,e.nnnadeva=2345,e.nohiragana=12398,e.nokatakana=12494,e.nokatakanahalfwidth=65417,e.nonbreakingspace=160,e.nonenthai=3603,e.nonuthai=3609,e.noonarabic=1606,e.noonfinalarabic=65254,e.noonghunnaarabic=1722,e.noonghunnafinalarabic=64415,e.nooninitialarabic=65255,e.noonjeeminitialarabic=64722,e.noonjeemisolatedarabic=64587,e.noonmedialarabic=65256,e.noonmeeminitialarabic=64725,e.noonmeemisolatedarabic=64590,e.noonnoonfinalarabic=64653,e.notcontains=8716,e.notelement=8713,e.notelementof=8713,e.notequal=8800,e.notgreater=8815,e.notgreaternorequal=8817,e.notgreaternorless=8825,e.notidentical=8802,e.notless=8814,e.notlessnorequal=8816,e.notparallel=8742,e.notprecedes=8832,e.notsubset=8836,e.notsucceeds=8833,e.notsuperset=8837,e.nowarmenian=1398,e.nparen=9385,e.nssquare=13233,e.nsuperior=8319,e.ntilde=241,e.nu=957,e.nuhiragana=12396,e.nukatakana=12492,e.nukatakanahalfwidth=65415,e.nuktabengali=2492,e.nuktadeva=2364,e.nuktagujarati=2748,e.nuktagurmukhi=2620,e.numbersign=35,e.numbersignmonospace=65283,e.numbersignsmall=65119,e.numeralsigngreek=884,e.numeralsignlowergreek=885,e.numero=8470,e.nun=1504,e.nundagesh=64320,e.nundageshhebrew=64320,e.nunhebrew=1504,e.nvsquare=13237,e.nwsquare=13243,e.nyabengali=2462,e.nyadeva=2334,e.nyagujarati=2718,e.nyagurmukhi=2590,e.o=111,e.oacute=243,e.oangthai=3629,e.obarred=629,e.obarredcyrillic=1257,e.obarreddieresiscyrillic=1259,e.obengali=2451,e.obopomofo=12571,e.obreve=335,e.ocandradeva=2321,e.ocandragujarati=2705,e.ocandravowelsigndeva=2377,e.ocandravowelsigngujarati=2761,e.ocaron=466,e.ocircle=9438,e.ocircumflex=244,e.ocircumflexacute=7889,e.ocircumflexdotbelow=7897,e.ocircumflexgrave=7891,e.ocircumflexhookabove=7893,e.ocircumflextilde=7895,e.ocyrillic=1086,e.odblacute=337,e.odblgrave=525,e.odeva=2323,e.odieresis=246,e.odieresiscyrillic=1255,e.odotbelow=7885,e.oe=339,e.oekorean=12634,e.ogonek=731,e.ogonekcmb=808,e.ograve=242,e.ogujarati=2707,e.oharmenian=1413,e.ohiragana=12362,e.ohookabove=7887,e.ohorn=417,e.ohornacute=7899,e.ohorndotbelow=7907,e.ohorngrave=7901,e.ohornhookabove=7903,e.ohorntilde=7905,e.ohungarumlaut=337,e.oi=419,e.oinvertedbreve=527,e.okatakana=12458,e.okatakanahalfwidth=65397,e.okorean=12631,e.olehebrew=1451,e.omacron=333,e.omacronacute=7763,e.omacrongrave=7761,e.omdeva=2384,e.omega=969,e.omega1=982,e.omegacyrillic=1121,e.omegalatinclosed=631,e.omegaroundcyrillic=1147,e.omegatitlocyrillic=1149,e.omegatonos=974,e.omgujarati=2768,e.omicron=959,e.omicrontonos=972,e.omonospace=65359,e.one=49,e.onearabic=1633,e.onebengali=2535,e.onecircle=9312,e.onecircleinversesansserif=10122,e.onedeva=2407,e.onedotenleader=8228,e.oneeighth=8539,e.onefitted=63196,e.onegujarati=2791,e.onegurmukhi=2663,e.onehackarabic=1633,e.onehalf=189,e.onehangzhou=12321,e.oneideographicparen=12832,e.oneinferior=8321,e.onemonospace=65297,e.onenumeratorbengali=2548,e.oneoldstyle=63281,e.oneparen=9332,e.oneperiod=9352,e.onepersian=1777,e.onequarter=188,e.oneroman=8560,e.onesuperior=185,e.onethai=3665,e.onethird=8531,e.oogonek=491,e.oogonekmacron=493,e.oogurmukhi=2579,e.oomatragurmukhi=2635,e.oopen=596,e.oparen=9386,e.openbullet=9702,e.option=8997,e.ordfeminine=170,e.ordmasculine=186,e.orthogonal=8735,e.oshortdeva=2322,e.oshortvowelsigndeva=2378,e.oslash=248,e.oslashacute=511,e.osmallhiragana=12361,e.osmallkatakana=12457,e.osmallkatakanahalfwidth=65387,e.ostrokeacute=511,e.osuperior=63216,e.otcyrillic=1151,e.otilde=245,e.otildeacute=7757,e.otildedieresis=7759,e.oubopomofo=12577,e.overline=8254,e.overlinecenterline=65098,e.overlinecmb=773,e.overlinedashed=65097,e.overlinedblwavy=65100,e.overlinewavy=65099,e.overscore=175,e.ovowelsignbengali=2507,e.ovowelsigndeva=2379,e.ovowelsigngujarati=2763,e.p=112,e.paampssquare=13184,e.paasentosquare=13099,e.pabengali=2474,e.pacute=7765,e.padeva=2346,e.pagedown=8671,e.pageup=8670,e.pagujarati=2730,e.pagurmukhi=2602,e.pahiragana=12401,e.paiyannoithai=3631,e.pakatakana=12497,e.palatalizationcyrilliccmb=1156,e.palochkacyrillic=1216,e.pansioskorean=12671,e.paragraph=182,e.parallel=8741,e.parenleft=40,e.parenleftaltonearabic=64830,e.parenleftbt=63725,e.parenleftex=63724,e.parenleftinferior=8333,e.parenleftmonospace=65288,e.parenleftsmall=65113,e.parenleftsuperior=8317,e.parenlefttp=63723,e.parenleftvertical=65077,e.parenright=41,e.parenrightaltonearabic=64831,e.parenrightbt=63736,e.parenrightex=63735,e.parenrightinferior=8334,e.parenrightmonospace=65289,e.parenrightsmall=65114,e.parenrightsuperior=8318,e.parenrighttp=63734,e.parenrightvertical=65078,e.partialdiff=8706,e.paseqhebrew=1472,e.pashtahebrew=1433,e.pasquare=13225,e.patah=1463,e.patah11=1463,e.patah1d=1463,e.patah2a=1463,e.patahhebrew=1463,e.patahnarrowhebrew=1463,e.patahquarterhebrew=1463,e.patahwidehebrew=1463,e.pazerhebrew=1441,e.pbopomofo=12550,e.pcircle=9439,e.pdotaccent=7767,e.pe=1508,e.pecyrillic=1087,e.pedagesh=64324,e.pedageshhebrew=64324,e.peezisquare=13115,e.pefinaldageshhebrew=64323,e.peharabic=1662,e.peharmenian=1402,e.pehebrew=1508,e.pehfinalarabic=64343,e.pehinitialarabic=64344,e.pehiragana=12410,e.pehmedialarabic=64345,e.pekatakana=12506,e.pemiddlehookcyrillic=1191,e.perafehebrew=64334,e.percent=37,e.percentarabic=1642,e.percentmonospace=65285,e.percentsmall=65130,e.period=46,e.periodarmenian=1417,e.periodcentered=183,e.periodhalfwidth=65377,e.periodinferior=63207,e.periodmonospace=65294,e.periodsmall=65106,e.periodsuperior=63208,e.perispomenigreekcmb=834,e.perpendicular=8869,e.perthousand=8240,e.peseta=8359,e.pfsquare=13194,e.phabengali=2475,e.phadeva=2347,e.phagujarati=2731,e.phagurmukhi=2603,e.phi=966,e.phi1=981,e.phieuphacirclekorean=12922,e.phieuphaparenkorean=12826,e.phieuphcirclekorean=12908,e.phieuphkorean=12621,e.phieuphparenkorean=12812,e.philatin=632,e.phinthuthai=3642,e.phisymbolgreek=981,e.phook=421,e.phophanthai=3614,e.phophungthai=3612,e.phosamphaothai=3616,e.pi=960,e.pieupacirclekorean=12915,e.pieupaparenkorean=12819,e.pieupcieuckorean=12662,e.pieupcirclekorean=12901,e.pieupkiyeokkorean=12658,e.pieupkorean=12610,e.pieupparenkorean=12805,e.pieupsioskiyeokkorean=12660,e.pieupsioskorean=12612,e.pieupsiostikeutkorean=12661,e.pieupthieuthkorean=12663,e.pieuptikeutkorean=12659,e.pihiragana=12404,e.pikatakana=12500,e.pisymbolgreek=982,e.piwrarmenian=1411,e.planckover2pi=8463,e.planckover2pi1=8463,e.plus=43,e.plusbelowcmb=799,e.pluscircle=8853,e.plusminus=177,e.plusmod=726,e.plusmonospace=65291,e.plussmall=65122,e.plussuperior=8314,e.pmonospace=65360,e.pmsquare=13272,e.pohiragana=12413,e.pointingindexdownwhite=9759,e.pointingindexleftwhite=9756,e.pointingindexrightwhite=9758,e.pointingindexupwhite=9757,e.pokatakana=12509,e.poplathai=3611,e.postalmark=12306,e.postalmarkface=12320,e.pparen=9387,e.precedes=8826,e.prescription=8478,e.primemod=697,e.primereversed=8245,e.product=8719,e.projective=8965,e.prolongedkana=12540,e.propellor=8984,e.propersubset=8834,e.propersuperset=8835,e.proportion=8759,e.proportional=8733,e.psi=968,e.psicyrillic=1137,e.psilipneumatacyrilliccmb=1158,e.pssquare=13232,e.puhiragana=12407,e.pukatakana=12503,e.pvsquare=13236,e.pwsquare=13242,e.q=113,e.qadeva=2392,e.qadmahebrew=1448,e.qafarabic=1602,e.qaffinalarabic=65238,e.qafinitialarabic=65239,e.qafmedialarabic=65240,e.qamats=1464,e.qamats10=1464,e.qamats1a=1464,e.qamats1c=1464,e.qamats27=1464,e.qamats29=1464,e.qamats33=1464,e.qamatsde=1464,e.qamatshebrew=1464,e.qamatsnarrowhebrew=1464,e.qamatsqatanhebrew=1464,e.qamatsqatannarrowhebrew=1464,e.qamatsqatanquarterhebrew=1464,e.qamatsqatanwidehebrew=1464,e.qamatsquarterhebrew=1464,e.qamatswidehebrew=1464,e.qarneyparahebrew=1439,e.qbopomofo=12561,e.qcircle=9440,e.qhook=672,e.qmonospace=65361,e.qof=1511,e.qofdagesh=64327,e.qofdageshhebrew=64327,e.qofhebrew=1511,e.qparen=9388,e.quarternote=9833,e.qubuts=1467,e.qubuts18=1467,e.qubuts25=1467,e.qubuts31=1467,e.qubutshebrew=1467,e.qubutsnarrowhebrew=1467,e.qubutsquarterhebrew=1467,e.qubutswidehebrew=1467,e.question=63,e.questionarabic=1567,e.questionarmenian=1374,e.questiondown=191,e.questiondownsmall=63423,e.questiongreek=894,e.questionmonospace=65311,e.questionsmall=63295,e.quotedbl=34,e.quotedblbase=8222,e.quotedblleft=8220,e.quotedblmonospace=65282,e.quotedblprime=12318,e.quotedblprimereversed=12317,e.quotedblright=8221,e.quoteleft=8216,e.quoteleftreversed=8219,e.quotereversed=8219,e.quoteright=8217,e.quoterightn=329,e.quotesinglbase=8218,e.quotesingle=39,e.quotesinglemonospace=65287,e.r=114,e.raarmenian=1404,e.rabengali=2480,e.racute=341,e.radeva=2352,e.radical=8730,e.radicalex=63717,e.radoverssquare=13230,e.radoverssquaredsquare=13231,e.radsquare=13229,e.rafe=1471,e.rafehebrew=1471,e.ragujarati=2736,e.ragurmukhi=2608,e.rahiragana=12425,e.rakatakana=12521,e.rakatakanahalfwidth=65431,e.ralowerdiagonalbengali=2545,e.ramiddlediagonalbengali=2544,e.ramshorn=612,e.ratio=8758,e.rbopomofo=12566,e.rcaron=345,e.rcedilla=343,e.rcircle=9441,e.rcommaaccent=343,e.rdblgrave=529,e.rdotaccent=7769,e.rdotbelow=7771,e.rdotbelowmacron=7773,e.referencemark=8251,e.reflexsubset=8838,e.reflexsuperset=8839,e.registered=174,e.registersans=63720,e.registerserif=63194,e.reharabic=1585,e.reharmenian=1408,e.rehfinalarabic=65198,e.rehiragana=12428,e.rekatakana=12524,e.rekatakanahalfwidth=65434,e.resh=1512,e.reshdageshhebrew=64328,e.reshhebrew=1512,e.reversedtilde=8765,e.reviahebrew=1431,e.reviamugrashhebrew=1431,e.revlogicalnot=8976,e.rfishhook=638,e.rfishhookreversed=639,e.rhabengali=2525,e.rhadeva=2397,e.rho=961,e.rhook=637,e.rhookturned=635,e.rhookturnedsuperior=693,e.rhosymbolgreek=1009,e.rhotichookmod=734,e.rieulacirclekorean=12913,e.rieulaparenkorean=12817,e.rieulcirclekorean=12899,e.rieulhieuhkorean=12608,e.rieulkiyeokkorean=12602,e.rieulkiyeoksioskorean=12649,e.rieulkorean=12601,e.rieulmieumkorean=12603,e.rieulpansioskorean=12652,e.rieulparenkorean=12803,e.rieulphieuphkorean=12607,e.rieulpieupkorean=12604,e.rieulpieupsioskorean=12651,e.rieulsioskorean=12605,e.rieulthieuthkorean=12606,e.rieultikeutkorean=12650,e.rieulyeorinhieuhkorean=12653,e.rightangle=8735,e.righttackbelowcmb=793,e.righttriangle=8895,e.rihiragana=12426,e.rikatakana=12522,e.rikatakanahalfwidth=65432,e.ring=730,e.ringbelowcmb=805,e.ringcmb=778,e.ringhalfleft=703,e.ringhalfleftarmenian=1369,e.ringhalfleftbelowcmb=796,e.ringhalfleftcentered=723,e.ringhalfright=702,e.ringhalfrightbelowcmb=825,e.ringhalfrightcentered=722,e.rinvertedbreve=531,e.rittorusquare=13137,e.rlinebelow=7775,e.rlongleg=636,e.rlonglegturned=634,e.rmonospace=65362,e.rohiragana=12429,e.rokatakana=12525,e.rokatakanahalfwidth=65435,e.roruathai=3619,e.rparen=9389,e.rrabengali=2524,e.rradeva=2353,e.rragurmukhi=2652,e.rreharabic=1681,e.rrehfinalarabic=64397,e.rrvocalicbengali=2528,e.rrvocalicdeva=2400,e.rrvocalicgujarati=2784,e.rrvocalicvowelsignbengali=2500,e.rrvocalicvowelsigndeva=2372,e.rrvocalicvowelsigngujarati=2756,e.rsuperior=63217,e.rtblock=9616,e.rturned=633,e.rturnedsuperior=692,e.ruhiragana=12427,e.rukatakana=12523,e.rukatakanahalfwidth=65433,e.rupeemarkbengali=2546,e.rupeesignbengali=2547,e.rupiah=63197,e.ruthai=3620,e.rvocalicbengali=2443,e.rvocalicdeva=2315,e.rvocalicgujarati=2699,e.rvocalicvowelsignbengali=2499,e.rvocalicvowelsigndeva=2371,e.rvocalicvowelsigngujarati=2755,e.s=115,e.sabengali=2488,e.sacute=347,e.sacutedotaccent=7781,e.sadarabic=1589,e.sadeva=2360,e.sadfinalarabic=65210,e.sadinitialarabic=65211,e.sadmedialarabic=65212,e.sagujarati=2744,e.sagurmukhi=2616,e.sahiragana=12373,e.sakatakana=12469,e.sakatakanahalfwidth=65403,e.sallallahoualayhewasallamarabic=65018,e.samekh=1505,e.samekhdagesh=64321,e.samekhdageshhebrew=64321,e.samekhhebrew=1505,e.saraaathai=3634,e.saraaethai=3649,e.saraaimaimalaithai=3652,e.saraaimaimuanthai=3651,e.saraamthai=3635,e.saraathai=3632,e.saraethai=3648,e.saraiileftthai=63622,e.saraiithai=3637,e.saraileftthai=63621,e.saraithai=3636,e.saraothai=3650,e.saraueeleftthai=63624,e.saraueethai=3639,e.saraueleftthai=63623,e.sarauethai=3638,e.sarauthai=3640,e.sarauuthai=3641,e.sbopomofo=12569,e.scaron=353,e.scarondotaccent=7783,e.scedilla=351,e.schwa=601,e.schwacyrillic=1241,e.schwadieresiscyrillic=1243,e.schwahook=602,e.scircle=9442,e.scircumflex=349,e.scommaaccent=537,e.sdotaccent=7777,e.sdotbelow=7779,e.sdotbelowdotaccent=7785,e.seagullbelowcmb=828,e.second=8243,e.secondtonechinese=714,e.section=167,e.seenarabic=1587,e.seenfinalarabic=65202,e.seeninitialarabic=65203,e.seenmedialarabic=65204,e.segol=1462,e.segol13=1462,e.segol1f=1462,e.segol2c=1462,e.segolhebrew=1462,e.segolnarrowhebrew=1462,e.segolquarterhebrew=1462,e.segoltahebrew=1426,e.segolwidehebrew=1462,e.seharmenian=1405,e.sehiragana=12379,e.sekatakana=12475,e.sekatakanahalfwidth=65406,e.semicolon=59,e.semicolonarabic=1563,e.semicolonmonospace=65307,e.semicolonsmall=65108,e.semivoicedmarkkana=12444,e.semivoicedmarkkanahalfwidth=65439,e.sentisquare=13090,e.sentosquare=13091,e.seven=55,e.sevenarabic=1639,e.sevenbengali=2541,e.sevencircle=9318,e.sevencircleinversesansserif=10128,e.sevendeva=2413,e.seveneighths=8542,e.sevengujarati=2797,e.sevengurmukhi=2669,e.sevenhackarabic=1639,e.sevenhangzhou=12327,e.sevenideographicparen=12838,e.seveninferior=8327,e.sevenmonospace=65303,e.sevenoldstyle=63287,e.sevenparen=9338,e.sevenperiod=9358,e.sevenpersian=1783,e.sevenroman=8566,e.sevensuperior=8311,e.seventeencircle=9328,e.seventeenparen=9348,e.seventeenperiod=9368,e.seventhai=3671,e.sfthyphen=173,e.shaarmenian=1399,e.shabengali=2486,e.shacyrillic=1096,e.shaddaarabic=1617,e.shaddadammaarabic=64609,e.shaddadammatanarabic=64606,e.shaddafathaarabic=64608,e.shaddakasraarabic=64610,e.shaddakasratanarabic=64607,e.shade=9618,e.shadedark=9619,e.shadelight=9617,e.shademedium=9618,e.shadeva=2358,e.shagujarati=2742,e.shagurmukhi=2614,e.shalshelethebrew=1427,e.shbopomofo=12565,e.shchacyrillic=1097,e.sheenarabic=1588,e.sheenfinalarabic=65206,e.sheeninitialarabic=65207,e.sheenmedialarabic=65208,e.sheicoptic=995,e.sheqel=8362,e.sheqelhebrew=8362,e.sheva=1456,e.sheva115=1456,e.sheva15=1456,e.sheva22=1456,e.sheva2e=1456,e.shevahebrew=1456,e.shevanarrowhebrew=1456,e.shevaquarterhebrew=1456,e.shevawidehebrew=1456,e.shhacyrillic=1211,e.shimacoptic=1005,e.shin=1513,e.shindagesh=64329,e.shindageshhebrew=64329,e.shindageshshindot=64300,e.shindageshshindothebrew=64300,e.shindageshsindot=64301,e.shindageshsindothebrew=64301,e.shindothebrew=1473,e.shinhebrew=1513,e.shinshindot=64298,e.shinshindothebrew=64298,e.shinsindot=64299,e.shinsindothebrew=64299,e.shook=642,e.sigma=963,e.sigma1=962,e.sigmafinal=962,e.sigmalunatesymbolgreek=1010,e.sihiragana=12375,e.sikatakana=12471,e.sikatakanahalfwidth=65404,e.siluqhebrew=1469,e.siluqlefthebrew=1469,e.similar=8764,e.sindothebrew=1474,e.siosacirclekorean=12916,e.siosaparenkorean=12820,e.sioscieuckorean=12670,e.sioscirclekorean=12902,e.sioskiyeokkorean=12666,e.sioskorean=12613,e.siosnieunkorean=12667,e.siosparenkorean=12806,e.siospieupkorean=12669,e.siostikeutkorean=12668,e.six=54,e.sixarabic=1638,e.sixbengali=2540,e.sixcircle=9317,e.sixcircleinversesansserif=10127,e.sixdeva=2412,e.sixgujarati=2796,e.sixgurmukhi=2668,e.sixhackarabic=1638,e.sixhangzhou=12326,e.sixideographicparen=12837,e.sixinferior=8326,e.sixmonospace=65302,e.sixoldstyle=63286,e.sixparen=9337,e.sixperiod=9357,e.sixpersian=1782,e.sixroman=8565,e.sixsuperior=8310,e.sixteencircle=9327,e.sixteencurrencydenominatorbengali=2553,e.sixteenparen=9347,e.sixteenperiod=9367,e.sixthai=3670,e.slash=47,e.slashmonospace=65295,e.slong=383,e.slongdotaccent=7835,e.smileface=9786,e.smonospace=65363,e.sofpasuqhebrew=1475,e.softhyphen=173,e.softsigncyrillic=1100,e.sohiragana=12381,e.sokatakana=12477,e.sokatakanahalfwidth=65407,e.soliduslongoverlaycmb=824,e.solidusshortoverlaycmb=823,e.sorusithai=3625,e.sosalathai=3624,e.sosothai=3595,e.sosuathai=3626,e.space=32,e.spacehackarabic=32,e.spade=9824,e.spadesuitblack=9824,e.spadesuitwhite=9828,e.sparen=9390,e.squarebelowcmb=827,e.squarecc=13252,e.squarecm=13213,e.squarediagonalcrosshatchfill=9641,e.squarehorizontalfill=9636,e.squarekg=13199,e.squarekm=13214,e.squarekmcapital=13262,e.squareln=13265,e.squarelog=13266,e.squaremg=13198,e.squaremil=13269,e.squaremm=13212,e.squaremsquared=13217,e.squareorthogonalcrosshatchfill=9638,e.squareupperlefttolowerrightfill=9639,e.squareupperrighttolowerleftfill=9640,e.squareverticalfill=9637,e.squarewhitewithsmallblack=9635,e.srsquare=13275,e.ssabengali=2487,e.ssadeva=2359,e.ssagujarati=2743,e.ssangcieuckorean=12617,e.ssanghieuhkorean=12677,e.ssangieungkorean=12672,e.ssangkiyeokkorean=12594,e.ssangnieunkorean=12645,e.ssangpieupkorean=12611,e.ssangsioskorean=12614,e.ssangtikeutkorean=12600,e.ssuperior=63218,e.sterling=163,e.sterlingmonospace=65505,e.strokelongoverlaycmb=822,e.strokeshortoverlaycmb=821,e.subset=8834,e.subsetnotequal=8842,e.subsetorequal=8838,e.succeeds=8827,e.suchthat=8715,e.suhiragana=12377,e.sukatakana=12473,e.sukatakanahalfwidth=65405,e.sukunarabic=1618,e.summation=8721,e.sun=9788,e.superset=8835,e.supersetnotequal=8843,e.supersetorequal=8839,e.svsquare=13276,e.syouwaerasquare=13180,e.t=116,e.tabengali=2468,e.tackdown=8868,e.tackleft=8867,e.tadeva=2340,e.tagujarati=2724,e.tagurmukhi=2596,e.taharabic=1591,e.tahfinalarabic=65218,e.tahinitialarabic=65219,e.tahiragana=12383,e.tahmedialarabic=65220,e.taisyouerasquare=13181,e.takatakana=12479,e.takatakanahalfwidth=65408,e.tatweelarabic=1600,e.tau=964,e.tav=1514,e.tavdages=64330,e.tavdagesh=64330,e.tavdageshhebrew=64330,e.tavhebrew=1514,e.tbar=359,e.tbopomofo=12554,e.tcaron=357,e.tccurl=680,e.tcedilla=355,e.tcheharabic=1670,e.tchehfinalarabic=64379,e.tchehinitialarabic=64380,e.tchehmedialarabic=64381,e.tcircle=9443,e.tcircumflexbelow=7793,e.tcommaaccent=355,e.tdieresis=7831,e.tdotaccent=7787,e.tdotbelow=7789,e.tecyrillic=1090,e.tedescendercyrillic=1197,e.teharabic=1578,e.tehfinalarabic=65174,e.tehhahinitialarabic=64674,e.tehhahisolatedarabic=64524,e.tehinitialarabic=65175,e.tehiragana=12390,e.tehjeeminitialarabic=64673,e.tehjeemisolatedarabic=64523,e.tehmarbutaarabic=1577,e.tehmarbutafinalarabic=65172,e.tehmedialarabic=65176,e.tehmeeminitialarabic=64676,e.tehmeemisolatedarabic=64526,e.tehnoonfinalarabic=64627,e.tekatakana=12486,e.tekatakanahalfwidth=65411,e.telephone=8481,e.telephoneblack=9742,e.telishagedolahebrew=1440,e.telishaqetanahebrew=1449,e.tencircle=9321,e.tenideographicparen=12841,e.tenparen=9341,e.tenperiod=9361,e.tenroman=8569,e.tesh=679,e.tet=1496,e.tetdagesh=64312,e.tetdageshhebrew=64312,e.tethebrew=1496,e.tetsecyrillic=1205,e.tevirhebrew=1435,e.tevirlefthebrew=1435,e.thabengali=2469,e.thadeva=2341,e.thagujarati=2725,e.thagurmukhi=2597,e.thalarabic=1584,e.thalfinalarabic=65196,e.thanthakhatlowleftthai=63640,e.thanthakhatlowrightthai=63639,e.thanthakhatthai=3660,e.thanthakhatupperleftthai=63638,e.theharabic=1579,e.thehfinalarabic=65178,e.thehinitialarabic=65179,e.thehmedialarabic=65180,e.thereexists=8707,e.therefore=8756,e.theta=952,e.theta1=977,e.thetasymbolgreek=977,e.thieuthacirclekorean=12921,e.thieuthaparenkorean=12825,e.thieuthcirclekorean=12907,e.thieuthkorean=12620,e.thieuthparenkorean=12811,e.thirteencircle=9324,e.thirteenparen=9344,e.thirteenperiod=9364,e.thonangmonthothai=3601,e.thook=429,e.thophuthaothai=3602,e.thorn=254,e.thothahanthai=3607,e.thothanthai=3600,e.thothongthai=3608,e.thothungthai=3606,e.thousandcyrillic=1154,e.thousandsseparatorarabic=1644,e.thousandsseparatorpersian=1644,e.three=51,e.threearabic=1635,e.threebengali=2537,e.threecircle=9314,e.threecircleinversesansserif=10124,e.threedeva=2409,e.threeeighths=8540,e.threegujarati=2793,e.threegurmukhi=2665,e.threehackarabic=1635,e.threehangzhou=12323,e.threeideographicparen=12834,e.threeinferior=8323,e.threemonospace=65299,e.threenumeratorbengali=2550,e.threeoldstyle=63283,e.threeparen=9334,e.threeperiod=9354,e.threepersian=1779,e.threequarters=190,e.threequartersemdash=63198,e.threeroman=8562,e.threesuperior=179,e.threethai=3667,e.thzsquare=13204,e.tihiragana=12385,e.tikatakana=12481,e.tikatakanahalfwidth=65409,e.tikeutacirclekorean=12912,e.tikeutaparenkorean=12816,e.tikeutcirclekorean=12898,e.tikeutkorean=12599,e.tikeutparenkorean=12802,e.tilde=732,e.tildebelowcmb=816,e.tildecmb=771,e.tildecomb=771,e.tildedoublecmb=864,e.tildeoperator=8764,e.tildeoverlaycmb=820,e.tildeverticalcmb=830,e.timescircle=8855,e.tipehahebrew=1430,e.tipehalefthebrew=1430,e.tippigurmukhi=2672,e.titlocyrilliccmb=1155,e.tiwnarmenian=1407,e.tlinebelow=7791,e.tmonospace=65364,e.toarmenian=1385,e.tohiragana=12392,e.tokatakana=12488,e.tokatakanahalfwidth=65412,e.tonebarextrahighmod=741,e.tonebarextralowmod=745,e.tonebarhighmod=742,e.tonebarlowmod=744,e.tonebarmidmod=743,e.tonefive=445,e.tonesix=389,e.tonetwo=424,e.tonos=900,e.tonsquare=13095,e.topatakthai=3599,e.tortoiseshellbracketleft=12308,e.tortoiseshellbracketleftsmall=65117,e.tortoiseshellbracketleftvertical=65081,e.tortoiseshellbracketright=12309,e.tortoiseshellbracketrightsmall=65118,e.tortoiseshellbracketrightvertical=65082,e.totaothai=3605,e.tpalatalhook=427,e.tparen=9391,e.trademark=8482,e.trademarksans=63722,e.trademarkserif=63195,e.tretroflexhook=648,e.triagdn=9660,e.triaglf=9668,e.triagrt=9658,e.triagup=9650,e.ts=678,e.tsadi=1510,e.tsadidagesh=64326,e.tsadidageshhebrew=64326,e.tsadihebrew=1510,e.tsecyrillic=1094,e.tsere=1461,e.tsere12=1461,e.tsere1e=1461,e.tsere2b=1461,e.tserehebrew=1461,e.tserenarrowhebrew=1461,e.tserequarterhebrew=1461,e.tserewidehebrew=1461,e.tshecyrillic=1115,e.tsuperior=63219,e.ttabengali=2463,e.ttadeva=2335,e.ttagujarati=2719,e.ttagurmukhi=2591,e.tteharabic=1657,e.ttehfinalarabic=64359,e.ttehinitialarabic=64360,e.ttehmedialarabic=64361,e.tthabengali=2464,e.tthadeva=2336,e.tthagujarati=2720,e.tthagurmukhi=2592,e.tturned=647,e.tuhiragana=12388,e.tukatakana=12484,e.tukatakanahalfwidth=65410,e.tusmallhiragana=12387,e.tusmallkatakana=12483,e.tusmallkatakanahalfwidth=65391,e.twelvecircle=9323,e.twelveparen=9343,e.twelveperiod=9363,e.twelveroman=8571,e.twentycircle=9331,e.twentyhangzhou=21316,e.twentyparen=9351,e.twentyperiod=9371,e.two=50,e.twoarabic=1634,e.twobengali=2536,e.twocircle=9313,e.twocircleinversesansserif=10123,e.twodeva=2408,e.twodotenleader=8229,e.twodotleader=8229,e.twodotleadervertical=65072,e.twogujarati=2792,e.twogurmukhi=2664,e.twohackarabic=1634,e.twohangzhou=12322,e.twoideographicparen=12833,e.twoinferior=8322,e.twomonospace=65298,e.twonumeratorbengali=2549,e.twooldstyle=63282,e.twoparen=9333,e.twoperiod=9353,e.twopersian=1778,e.tworoman=8561,e.twostroke=443,e.twosuperior=178,e.twothai=3666,e.twothirds=8532,e.u=117,e.uacute=250,e.ubar=649,e.ubengali=2441,e.ubopomofo=12584,e.ubreve=365,e.ucaron=468,e.ucircle=9444,e.ucircumflex=251,e.ucircumflexbelow=7799,e.ucyrillic=1091,e.udattadeva=2385,e.udblacute=369,e.udblgrave=533,e.udeva=2313,e.udieresis=252,e.udieresisacute=472,e.udieresisbelow=7795,e.udieresiscaron=474,e.udieresiscyrillic=1265,e.udieresisgrave=476,e.udieresismacron=470,e.udotbelow=7909,e.ugrave=249,e.ugujarati=2697,e.ugurmukhi=2569,e.uhiragana=12358,e.uhookabove=7911,e.uhorn=432,e.uhornacute=7913,e.uhorndotbelow=7921,e.uhorngrave=7915,e.uhornhookabove=7917,e.uhorntilde=7919,e.uhungarumlaut=369,e.uhungarumlautcyrillic=1267,e.uinvertedbreve=535,e.ukatakana=12454,e.ukatakanahalfwidth=65395,e.ukcyrillic=1145,e.ukorean=12636,e.umacron=363,e.umacroncyrillic=1263,e.umacrondieresis=7803,e.umatragurmukhi=2625,e.umonospace=65365,e.underscore=95,e.underscoredbl=8215,e.underscoremonospace=65343,e.underscorevertical=65075,e.underscorewavy=65103,e.union=8746,e.universal=8704,e.uogonek=371,e.uparen=9392,e.upblock=9600,e.upperdothebrew=1476,e.upsilon=965,e.upsilondieresis=971,e.upsilondieresistonos=944,e.upsilonlatin=650,e.upsilontonos=973,e.uptackbelowcmb=797,e.uptackmod=724,e.uragurmukhi=2675,e.uring=367,e.ushortcyrillic=1118,e.usmallhiragana=12357,e.usmallkatakana=12453,e.usmallkatakanahalfwidth=65385,e.ustraightcyrillic=1199,e.ustraightstrokecyrillic=1201,e.utilde=361,e.utildeacute=7801,e.utildebelow=7797,e.uubengali=2442,e.uudeva=2314,e.uugujarati=2698,e.uugurmukhi=2570,e.uumatragurmukhi=2626,e.uuvowelsignbengali=2498,e.uuvowelsigndeva=2370,e.uuvowelsigngujarati=2754,e.uvowelsignbengali=2497,e.uvowelsigndeva=2369,e.uvowelsigngujarati=2753,e.v=118,e.vadeva=2357,e.vagujarati=2741,e.vagurmukhi=2613,e.vakatakana=12535,e.vav=1493,e.vavdagesh=64309,e.vavdagesh65=64309,e.vavdageshhebrew=64309,e.vavhebrew=1493,e.vavholam=64331,e.vavholamhebrew=64331,e.vavvavhebrew=1520,e.vavyodhebrew=1521,e.vcircle=9445,e.vdotbelow=7807,e.vecyrillic=1074,e.veharabic=1700,e.vehfinalarabic=64363,e.vehinitialarabic=64364,e.vehmedialarabic=64365,e.vekatakana=12537,e.venus=9792,e.verticalbar=124,e.verticallineabovecmb=781,e.verticallinebelowcmb=809,e.verticallinelowmod=716,e.verticallinemod=712,e.vewarmenian=1406,e.vhook=651,e.vikatakana=12536,e.viramabengali=2509,e.viramadeva=2381,e.viramagujarati=2765,e.visargabengali=2435,e.visargadeva=2307,e.visargagujarati=2691,e.vmonospace=65366,e.voarmenian=1400,e.voicediterationhiragana=12446,e.voicediterationkatakana=12542,e.voicedmarkkana=12443,e.voicedmarkkanahalfwidth=65438,e.vokatakana=12538,e.vparen=9393,e.vtilde=7805,e.vturned=652,e.vuhiragana=12436,e.vukatakana=12532,e.w=119,e.wacute=7811,e.waekorean=12633,e.wahiragana=12431,e.wakatakana=12527,e.wakatakanahalfwidth=65436,e.wakorean=12632,e.wasmallhiragana=12430,e.wasmallkatakana=12526,e.wattosquare=13143,e.wavedash=12316,e.wavyunderscorevertical=65076,e.wawarabic=1608,e.wawfinalarabic=65262,e.wawhamzaabovearabic=1572,e.wawhamzaabovefinalarabic=65158,e.wbsquare=13277,e.wcircle=9446,e.wcircumflex=373,e.wdieresis=7813,e.wdotaccent=7815,e.wdotbelow=7817,e.wehiragana=12433,e.weierstrass=8472,e.wekatakana=12529,e.wekorean=12638,e.weokorean=12637,e.wgrave=7809,e.whitebullet=9702,e.whitecircle=9675,e.whitecircleinverse=9689,e.whitecornerbracketleft=12302,e.whitecornerbracketleftvertical=65091,e.whitecornerbracketright=12303,e.whitecornerbracketrightvertical=65092,e.whitediamond=9671,e.whitediamondcontainingblacksmalldiamond=9672,e.whitedownpointingsmalltriangle=9663,e.whitedownpointingtriangle=9661,e.whiteleftpointingsmalltriangle=9667,e.whiteleftpointingtriangle=9665,e.whitelenticularbracketleft=12310,e.whitelenticularbracketright=12311,e.whiterightpointingsmalltriangle=9657,e.whiterightpointingtriangle=9655,e.whitesmallsquare=9643,e.whitesmilingface=9786,e.whitesquare=9633,e.whitestar=9734,e.whitetelephone=9743,e.whitetortoiseshellbracketleft=12312,e.whitetortoiseshellbracketright=12313,e.whiteuppointingsmalltriangle=9653,e.whiteuppointingtriangle=9651,e.wihiragana=12432,e.wikatakana=12528,e.wikorean=12639,e.wmonospace=65367,e.wohiragana=12434,e.wokatakana=12530,e.wokatakanahalfwidth=65382,e.won=8361,e.wonmonospace=65510,e.wowaenthai=3623,e.wparen=9394,e.wring=7832,e.wsuperior=695,e.wturned=653,e.wynn=447,e.x=120,e.xabovecmb=829,e.xbopomofo=12562,e.xcircle=9447,e.xdieresis=7821,e.xdotaccent=7819,e.xeharmenian=1389,e.xi=958,e.xmonospace=65368,e.xparen=9395,e.xsuperior=739,e.y=121,e.yaadosquare=13134,e.yabengali=2479,e.yacute=253,e.yadeva=2351,e.yaekorean=12626,e.yagujarati=2735,e.yagurmukhi=2607,e.yahiragana=12420,e.yakatakana=12516,e.yakatakanahalfwidth=65428,e.yakorean=12625,e.yamakkanthai=3662,e.yasmallhiragana=12419,e.yasmallkatakana=12515,e.yasmallkatakanahalfwidth=65388,e.yatcyrillic=1123,e.ycircle=9448,e.ycircumflex=375,e.ydieresis=255,e.ydotaccent=7823,e.ydotbelow=7925,e.yeharabic=1610,e.yehbarreearabic=1746,e.yehbarreefinalarabic=64431,e.yehfinalarabic=65266,e.yehhamzaabovearabic=1574,e.yehhamzaabovefinalarabic=65162,e.yehhamzaaboveinitialarabic=65163,e.yehhamzaabovemedialarabic=65164,e.yehinitialarabic=65267,e.yehmedialarabic=65268,e.yehmeeminitialarabic=64733,e.yehmeemisolatedarabic=64600,e.yehnoonfinalarabic=64660,e.yehthreedotsbelowarabic=1745,e.yekorean=12630,e.yen=165,e.yenmonospace=65509,e.yeokorean=12629,e.yeorinhieuhkorean=12678,e.yerahbenyomohebrew=1450,e.yerahbenyomolefthebrew=1450,e.yericyrillic=1099,e.yerudieresiscyrillic=1273,e.yesieungkorean=12673,e.yesieungpansioskorean=12675,e.yesieungsioskorean=12674,e.yetivhebrew=1434,e.ygrave=7923,e.yhook=436,e.yhookabove=7927,e.yiarmenian=1397,e.yicyrillic=1111,e.yikorean=12642,e.yinyang=9775,e.yiwnarmenian=1410,e.ymonospace=65369,e.yod=1497,e.yoddagesh=64313,e.yoddageshhebrew=64313,e.yodhebrew=1497,e.yodyodhebrew=1522,e.yodyodpatahhebrew=64287,e.yohiragana=12424,e.yoikorean=12681,e.yokatakana=12520,e.yokatakanahalfwidth=65430,e.yokorean=12635,e.yosmallhiragana=12423,e.yosmallkatakana=12519,e.yosmallkatakanahalfwidth=65390,e.yotgreek=1011,e.yoyaekorean=12680,e.yoyakorean=12679,e.yoyakthai=3618,e.yoyingthai=3597,e.yparen=9396,e.ypogegrammeni=890,e.ypogegrammenigreekcmb=837,e.yr=422,e.yring=7833,e.ysuperior=696,e.ytilde=7929,e.yturned=654,e.yuhiragana=12422,e.yuikorean=12684,e.yukatakana=12518,e.yukatakanahalfwidth=65429,e.yukorean=12640,e.yusbigcyrillic=1131,e.yusbigiotifiedcyrillic=1133,e.yuslittlecyrillic=1127,e.yuslittleiotifiedcyrillic=1129,e.yusmallhiragana=12421,e.yusmallkatakana=12517,e.yusmallkatakanahalfwidth=65389,e.yuyekorean=12683,e.yuyeokorean=12682,e.yyabengali=2527,e.yyadeva=2399,e.z=122,e.zaarmenian=1382,e.zacute=378,e.zadeva=2395,e.zagurmukhi=2651,e.zaharabic=1592,e.zahfinalarabic=65222,e.zahinitialarabic=65223,e.zahiragana=12374,e.zahmedialarabic=65224,e.zainarabic=1586,e.zainfinalarabic=65200,e.zakatakana=12470,e.zaqefgadolhebrew=1429,e.zaqefqatanhebrew=1428,e.zarqahebrew=1432,e.zayin=1494,e.zayindagesh=64310,e.zayindageshhebrew=64310,e.zayinhebrew=1494,e.zbopomofo=12567,e.zcaron=382,e.zcircle=9449,e.zcircumflex=7825,e.zcurl=657,e.zdot=380,e.zdotaccent=380,e.zdotbelow=7827,e.zecyrillic=1079,e.zedescendercyrillic=1177,e.zedieresiscyrillic=1247,e.zehiragana=12380,e.zekatakana=12476,e.zero=48,e.zeroarabic=1632,e.zerobengali=2534,e.zerodeva=2406,e.zerogujarati=2790,e.zerogurmukhi=2662,e.zerohackarabic=1632,e.zeroinferior=8320,e.zeromonospace=65296,e.zerooldstyle=63280,e.zeropersian=1776,e.zerosuperior=8304,e.zerothai=3664,e.zerowidthjoiner=65279,e.zerowidthnonjoiner=8204,e.zerowidthspace=8203,e.zeta=950,e.zhbopomofo=12563,e.zhearmenian=1386,e.zhebrevecyrillic=1218,e.zhecyrillic=1078,e.zhedescendercyrillic=1175,e.zhedieresiscyrillic=1245,e.zihiragana=12376,e.zikatakana=12472,e.zinorhebrew=1454,e.zlinebelow=7829,e.zmonospace=65370,e.zohiragana=12382,e.zokatakana=12478,e.zparen=9397,e.zretroflexhook=656,e.zstroke=438,e.zuhiragana=12378,e.zukatakana=12474,e[".notdef"]=0,e.angbracketleftbig=9001,e.angbracketleftBig=9001,e.angbracketleftbigg=9001,e.angbracketleftBigg=9001,e.angbracketrightBig=9002,e.angbracketrightbig=9002,e.angbracketrightBigg=9002,e.angbracketrightbigg=9002,e.arrowhookleft=8618,e.arrowhookright=8617,e.arrowlefttophalf=8636,e.arrowleftbothalf=8637,e.arrownortheast=8599,e.arrownorthwest=8598,e.arrowrighttophalf=8640,e.arrowrightbothalf=8641,e.arrowsoutheast=8600,e.arrowsouthwest=8601,e.backslashbig=8726,e.backslashBig=8726,e.backslashBigg=8726,e.backslashbigg=8726,e.bardbl=8214,e.bracehtipdownleft=65079,e.bracehtipdownright=65079,e.bracehtipupleft=65080,e.bracehtipupright=65080,e.braceleftBig=123,e.braceleftbig=123,e.braceleftbigg=123,e.braceleftBigg=123,e.bracerightBig=125,e.bracerightbig=125,e.bracerightbigg=125,e.bracerightBigg=125,e.bracketleftbig=91,e.bracketleftBig=91,e.bracketleftbigg=91,e.bracketleftBigg=91,e.bracketrightBig=93,e.bracketrightbig=93,e.bracketrightbigg=93,e.bracketrightBigg=93,e.ceilingleftbig=8968,e.ceilingleftBig=8968,e.ceilingleftBigg=8968,e.ceilingleftbigg=8968,e.ceilingrightbig=8969,e.ceilingrightBig=8969,e.ceilingrightbigg=8969,e.ceilingrightBigg=8969,e.circledotdisplay=8857,e.circledottext=8857,e.circlemultiplydisplay=8855,e.circlemultiplytext=8855,e.circleplusdisplay=8853,e.circleplustext=8853,e.contintegraldisplay=8750,e.contintegraltext=8750,e.coproductdisplay=8720,e.coproducttext=8720,e.floorleftBig=8970,e.floorleftbig=8970,e.floorleftbigg=8970,e.floorleftBigg=8970,e.floorrightbig=8971,e.floorrightBig=8971,e.floorrightBigg=8971,e.floorrightbigg=8971,e.hatwide=770,e.hatwider=770,e.hatwidest=770,e.intercal=7488,e.integraldisplay=8747,e.integraltext=8747,e.intersectiondisplay=8898,e.intersectiontext=8898,e.logicalanddisplay=8743,e.logicalandtext=8743,e.logicalordisplay=8744,e.logicalortext=8744,e.parenleftBig=40,e.parenleftbig=40,e.parenleftBigg=40,e.parenleftbigg=40,e.parenrightBig=41,e.parenrightbig=41,e.parenrightBigg=41,e.parenrightbigg=41,e.prime=8242,e.productdisplay=8719,e.producttext=8719,e.radicalbig=8730,e.radicalBig=8730,e.radicalBigg=8730,e.radicalbigg=8730,e.radicalbt=8730,e.radicaltp=8730,e.radicalvertex=8730,e.slashbig=47,e.slashBig=47,e.slashBigg=47,e.slashbigg=47,e.summationdisplay=8721,e.summationtext=8721,e.tildewide=732,e.tildewider=732,e.tildewidest=732,e.uniondisplay=8899,e.unionmultidisplay=8846,e.unionmultitext=8846,e.unionsqdisplay=8852,e.unionsqtext=8852,e.uniontext=8899,e.vextenddouble=8741,e.vextendsingle=8739}),jd=he(function(e){e.space=32,e.a1=9985,e.a2=9986,e.a202=9987,e.a3=9988,e.a4=9742,e.a5=9990,e.a119=9991,e.a118=9992,e.a117=9993,e.a11=9755,e.a12=9758,e.a13=9996,e.a14=9997,e.a15=9998,e.a16=9999,e.a105=1e4,e.a17=10001,e.a18=10002,e.a19=10003,e.a20=10004,e.a21=10005,e.a22=10006,e.a23=10007,e.a24=10008,e.a25=10009,e.a26=10010,e.a27=10011,e.a28=10012,e.a6=10013,e.a7=10014,e.a8=10015,e.a9=10016,e.a10=10017,e.a29=10018,e.a30=10019,e.a31=10020,e.a32=10021,e.a33=10022,e.a34=10023,e.a35=9733,e.a36=10025,e.a37=10026,e.a38=10027,e.a39=10028,e.a40=10029,e.a41=10030,e.a42=10031,e.a43=10032,e.a44=10033,e.a45=10034,e.a46=10035,e.a47=10036,e.a48=10037,e.a49=10038,e.a50=10039,e.a51=10040,e.a52=10041,e.a53=10042,e.a54=10043,e.a55=10044,e.a56=10045,e.a57=10046,e.a58=10047,e.a59=10048,e.a60=10049,e.a61=10050,e.a62=10051,e.a63=10052,e.a64=10053,e.a65=10054,e.a66=10055,e.a67=10056,e.a68=10057,e.a69=10058,e.a70=10059,e.a71=9679,e.a72=10061,e.a73=9632,e.a74=10063,e.a203=10064,e.a75=10065,e.a204=10066,e.a76=9650,e.a77=9660,e.a78=9670,e.a79=10070,e.a81=9687,e.a82=10072,e.a83=10073,e.a84=10074,e.a97=10075,e.a98=10076,e.a99=10077,e.a100=10078,e.a101=10081,e.a102=10082,e.a103=10083,e.a104=10084,e.a106=10085,e.a107=10086,e.a108=10087,e.a112=9827,e.a111=9830,e.a110=9829,e.a109=9824,e.a120=9312,e.a121=9313,e.a122=9314,e.a123=9315,e.a124=9316,e.a125=9317,e.a126=9318,e.a127=9319,e.a128=9320,e.a129=9321,e.a130=10102,e.a131=10103,e.a132=10104,e.a133=10105,e.a134=10106,e.a135=10107,e.a136=10108,e.a137=10109,e.a138=10110,e.a139=10111,e.a140=10112,e.a141=10113,e.a142=10114,e.a143=10115,e.a144=10116,e.a145=10117,e.a146=10118,e.a147=10119,e.a148=10120,e.a149=10121,e.a150=10122,e.a151=10123,e.a152=10124,e.a153=10125,e.a154=10126,e.a155=10127,e.a156=10128,e.a157=10129,e.a158=10130,e.a159=10131,e.a160=10132,e.a161=8594,e.a163=8596,e.a164=8597,e.a196=10136,e.a165=10137,e.a192=10138,e.a166=10139,e.a167=10140,e.a168=10141,e.a169=10142,e.a170=10143,e.a171=10144,e.a172=10145,e.a173=10146,e.a162=10147,e.a174=10148,e.a175=10149,e.a176=10150,e.a177=10151,e.a178=10152,e.a179=10153,e.a193=10154,e.a180=10155,e.a199=10156,e.a181=10157,e.a200=10158,e.a182=10159,e.a201=10161,e.a183=10162,e.a184=10163,e.a197=10164,e.a185=10165,e.a194=10166,e.a198=10167,e.a186=10168,e.a195=10169,e.a187=10170,e.a188=10171,e.a189=10172,e.a190=10173,e.a191=10174,e.a89=10088,e.a90=10089,e.a93=10090,e.a94=10091,e.a91=10092,e.a92=10093,e.a205=10094,e.a85=10095,e.a206=10096,e.a86=10097,e.a87=10098,e.a88=10099,e.a95=10100,e.a96=10101,e[".notdef"]=0}),Xd=he(function(e){e[63721]=169,e[63193]=169,e[63720]=174,e[63194]=174,e[63722]=8482,e[63195]=8482,e[63729]=9127,e[63730]=9128,e[63731]=9129,e[63740]=9131,e[63741]=9132,e[63742]=9133,e[63726]=9121,e[63727]=9122,e[63728]=9123,e[63737]=9124,e[63738]=9125,e[63739]=9126,e[63723]=9115,e[63724]=9116,e[63725]=9117,e[63734]=9118,e[63735]=9119,e[63736]=9120});function Vd(e){return e>=65520&&e<=65535?0:e>=62976&&e<=63743?Xd()[e]||e:e===173?45:e}function Us(e,A){let t=A[e];if(t!==void 0)return t;if(!e)return-1;if(e[0]==="u"){let i=e.length,s;if(i===7&&e[1]==="n"&&e[2]==="i")s=e.substring(3);else if(i>=5&&i<=7)s=e.substring(1);else return-1;if(s===s.toUpperCase()&&(t=parseInt(s,16),t>=0))return t}return-1}var uo=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function _d(e,A=-1){if(A!==-1){let t=uo[A];for(let i=0,s=t.length;i<s;i+=2)if(e>=t[i]&&e<=t[i+1])return A}for(let t=0,i=uo.length;t<i;t++){let s=uo[t];for(let a=0,n=s.length;a<n;a+=2)if(e>=s[a]&&e<=s[a+1])return t}return-1}var zd=new RegExp("^(\\\\s)|(\\\\p{Mn})|(\\\\p{Cf})$","u"),bI=new Map;function $d(e){let A=bI.get(e);if(A)return A;let t=e.match(zd),i={isWhitespace:!!(t!=null&&t[1]),isZeroWidthDiacritic:!!(t!=null&&t[2]),isInvisibleFormatMark:!!(t!=null&&t[3])};return bI.set(e,i),i}function A2(){bI.clear()}var Cs=!0,Ft={FixedPitch:1,Serif:2,Symbolic:4,Script:8,Nonsymbolic:32,Italic:64,AllCap:65536,SmallCap:131072,ForceBold:262144},O1=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Ef(e,A){if(A[e]!==void 0)return e;let t=Us(e,A);if(t!==-1){for(let i in A)if(A[i]===t)return i}return PA("Unable to recover a standard glyph name for: "+e),e}function ff(e,A,t){let i=Object.create(null),s,a,n,r=!!(e.flags&Ft.Symbolic);if(e.isInternalFont)for(n=A,a=0;a<n.length;a++)s=t.indexOf(n[a]),i[a]=s>=0?s:0;else if(e.baseEncodingName)for(n=Ua(e.baseEncodingName),a=0;a<n.length;a++)s=t.indexOf(n[a]),i[a]=s>=0?s:0;else if(r)for(a in A)i[a]=A[a];else for(n=fi,a=0;a<n.length;a++)s=t.indexOf(n[a]),i[a]=s>=0?s:0;let g=e.differences,o;if(g)for(a in g){let I=g[a];if(s=t.indexOf(I),s===-1){o||(o=Ai());let c=Ef(I,o);c!==I&&(s=t.indexOf(c))}i[a]=s>=0?s:0}return i}function pn(e){return e.replaceAll(/[,_]/g,"-").replaceAll(/\\s/g,"")}var e2=he(e=>{e[8211]=65074,e[8212]=65073,e[8229]=65072,e[8230]=65049,e[12289]=65041,e[12290]=65042,e[12296]=65087,e[12297]=65088,e[12298]=65085,e[12299]=65086,e[12300]=65089,e[12301]=65090,e[12302]=65091,e[12303]=65092,e[12304]=65083,e[12305]=65084,e[12308]=65081,e[12309]=65082,e[12310]=65047,e[12311]=65048,e[65103]=65076,e[65281]=65045,e[65288]=65077,e[65289]=65078,e[65292]=65040,e[65306]=65043,e[65307]=65044,e[65311]=65046,e[65339]=65095,e[65341]=65096,e[65343]=65075,e[65371]=65079,e[65373]=65080}),zg=he(function(e){e["Times-Roman"]="Times-Roman",e.Helvetica="Helvetica",e.Courier="Courier",e.Symbol="Symbol",e["Times-Bold"]="Times-Bold",e["Helvetica-Bold"]="Helvetica-Bold",e["Courier-Bold"]="Courier-Bold",e.ZapfDingbats="ZapfDingbats",e["Times-Italic"]="Times-Italic",e["Helvetica-Oblique"]="Helvetica-Oblique",e["Courier-Oblique"]="Courier-Oblique",e["Times-BoldItalic"]="Times-BoldItalic",e["Helvetica-BoldOblique"]="Helvetica-BoldOblique",e["Courier-BoldOblique"]="Courier-BoldOblique",e.ArialNarrow="Helvetica",e["ArialNarrow-Bold"]="Helvetica-Bold",e["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique",e["ArialNarrow-Italic"]="Helvetica-Oblique",e.ArialBlack="Helvetica",e["ArialBlack-Bold"]="Helvetica-Bold",e["ArialBlack-BoldItalic"]="Helvetica-BoldOblique",e["ArialBlack-Italic"]="Helvetica-Oblique",e["Arial-Black"]="Helvetica",e["Arial-Black-Bold"]="Helvetica-Bold",e["Arial-Black-BoldItalic"]="Helvetica-BoldOblique",e["Arial-Black-Italic"]="Helvetica-Oblique",e.Arial="Helvetica",e["Arial-Bold"]="Helvetica-Bold",e["Arial-BoldItalic"]="Helvetica-BoldOblique",e["Arial-Italic"]="Helvetica-Oblique",e.ArialMT="Helvetica",e["Arial-BoldItalicMT"]="Helvetica-BoldOblique",e["Arial-BoldMT"]="Helvetica-Bold",e["Arial-ItalicMT"]="Helvetica-Oblique",e["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique",e["Arial-BoldMT-Bold"]="Helvetica-Bold",e["Arial-ItalicMT-Italic"]="Helvetica-Oblique",e.ArialUnicodeMS="Helvetica",e["ArialUnicodeMS-Bold"]="Helvetica-Bold",e["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique",e["ArialUnicodeMS-Italic"]="Helvetica-Oblique",e["Courier-BoldItalic"]="Courier-BoldOblique",e["Courier-Italic"]="Courier-Oblique",e.CourierNew="Courier",e["CourierNew-Bold"]="Courier-Bold",e["CourierNew-BoldItalic"]="Courier-BoldOblique",e["CourierNew-Italic"]="Courier-Oblique",e["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique",e["CourierNewPS-BoldMT"]="Courier-Bold",e["CourierNewPS-ItalicMT"]="Courier-Oblique",e.CourierNewPSMT="Courier",e["Helvetica-BoldItalic"]="Helvetica-BoldOblique",e["Helvetica-Italic"]="Helvetica-Oblique",e["Symbol-Bold"]="Symbol",e["Symbol-BoldItalic"]="Symbol",e["Symbol-Italic"]="Symbol",e.TimesNewRoman="Times-Roman",e["TimesNewRoman-Bold"]="Times-Bold",e["TimesNewRoman-BoldItalic"]="Times-BoldItalic",e["TimesNewRoman-Italic"]="Times-Italic",e.TimesNewRomanPS="Times-Roman",e["TimesNewRomanPS-Bold"]="Times-Bold",e["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic",e["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic",e["TimesNewRomanPS-BoldMT"]="Times-Bold",e["TimesNewRomanPS-Italic"]="Times-Italic",e["TimesNewRomanPS-ItalicMT"]="Times-Italic",e.TimesNewRomanPSMT="Times-Roman",e["TimesNewRomanPSMT-Bold"]="Times-Bold",e["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic",e["TimesNewRomanPSMT-Italic"]="Times-Italic"}),t2=he(function(e){e.Courier="FoxitFixed.pfb",e["Courier-Bold"]="FoxitFixedBold.pfb",e["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb",e["Courier-Oblique"]="FoxitFixedItalic.pfb",e.Helvetica="LiberationSans-Regular.ttf",e["Helvetica-Bold"]="LiberationSans-Bold.ttf",e["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf",e["Helvetica-Oblique"]="LiberationSans-Italic.ttf",e["Times-Roman"]="FoxitSerif.pfb",e["Times-Bold"]="FoxitSerifBold.pfb",e["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb",e["Times-Italic"]="FoxitSerifItalic.pfb",e.Symbol="FoxitSymbol.pfb",e.ZapfDingbats="FoxitDingbats.pfb",e["LiberationSans-Regular"]="LiberationSans-Regular.ttf",e["LiberationSans-Bold"]="LiberationSans-Bold.ttf",e["LiberationSans-Italic"]="LiberationSans-Italic.ttf",e["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"}),uf=he(function(e){e.Calibri="Helvetica",e["Calibri-Bold"]="Helvetica-Bold",e["Calibri-BoldItalic"]="Helvetica-BoldOblique",e["Calibri-Italic"]="Helvetica-Oblique",e.CenturyGothic="Helvetica",e["CenturyGothic-Bold"]="Helvetica-Bold",e["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique",e["CenturyGothic-Italic"]="Helvetica-Oblique",e.ComicSansMS="Comic Sans MS",e["ComicSansMS-Bold"]="Comic Sans MS-Bold",e["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic",e["ComicSansMS-Italic"]="Comic Sans MS-Italic",e.Impact="Helvetica",e["ItcSymbol-Bold"]="Helvetica-Bold",e["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique",e["ItcSymbol-Book"]="Helvetica",e["ItcSymbol-BookItalic"]="Helvetica-Oblique",e["ItcSymbol-Medium"]="Helvetica",e["ItcSymbol-MediumItalic"]="Helvetica-Oblique",e.LucidaConsole="Courier",e["LucidaConsole-Bold"]="Courier-Bold",e["LucidaConsole-BoldItalic"]="Courier-BoldOblique",e["LucidaConsole-Italic"]="Courier-Oblique",e["LucidaSans-Demi"]="Helvetica-Bold",e["MS-Gothic"]="MS Gothic",e["MS-Gothic-Bold"]="MS Gothic-Bold",e["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic",e["MS-Gothic-Italic"]="MS Gothic-Italic",e["MS-Mincho"]="MS Mincho",e["MS-Mincho-Bold"]="MS Mincho-Bold",e["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic",e["MS-Mincho-Italic"]="MS Mincho-Italic",e["MS-PGothic"]="MS PGothic",e["MS-PGothic-Bold"]="MS PGothic-Bold",e["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic",e["MS-PGothic-Italic"]="MS PGothic-Italic",e["MS-PMincho"]="MS PMincho",e["MS-PMincho-Bold"]="MS PMincho-Bold",e["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic",e["MS-PMincho-Italic"]="MS PMincho-Italic",e.NuptialScript="Times-Italic",e.SegoeUISymbol="Helvetica"}),C1=he(function(e){e["Adobe Jenson"]=!0,e["Adobe Text"]=!0,e.Albertus=!0,e.Aldus=!0,e.Alexandria=!0,e.Algerian=!0,e["American Typewriter"]=!0,e.Antiqua=!0,e.Apex=!0,e.Arno=!0,e.Aster=!0,e.Aurora=!0,e.Baskerville=!0,e.Bell=!0,e.Bembo=!0,e["Bembo Schoolbook"]=!0,e.Benguiat=!0,e["Berkeley Old Style"]=!0,e["Bernhard Modern"]=!0,e["Berthold City"]=!0,e.Bodoni=!0,e["Bauer Bodoni"]=!0,e["Book Antiqua"]=!0,e.Bookman=!0,e["Bordeaux Roman"]=!0,e["Californian FB"]=!0,e.Calisto=!0,e.Calvert=!0,e.Capitals=!0,e.Cambria=!0,e.Cartier=!0,e.Caslon=!0,e.Catull=!0,e.Centaur=!0,e["Century Old Style"]=!0,e["Century Schoolbook"]=!0,e.Chaparral=!0,e["Charis SIL"]=!0,e.Cheltenham=!0,e["Cholla Slab"]=!0,e.Clarendon=!0,e.Clearface=!0,e.Cochin=!0,e.Colonna=!0,e["Computer Modern"]=!0,e["Concrete Roman"]=!0,e.Constantia=!0,e["Cooper Black"]=!0,e.Corona=!0,e.Ecotype=!0,e.Egyptienne=!0,e.Elephant=!0,e.Excelsior=!0,e.Fairfield=!0,e["FF Scala"]=!0,e.Folkard=!0,e.Footlight=!0,e.FreeSerif=!0,e["Friz Quadrata"]=!0,e.Garamond=!0,e.Gentium=!0,e.Georgia=!0,e.Gloucester=!0,e["Goudy Old Style"]=!0,e["Goudy Schoolbook"]=!0,e["Goudy Pro Font"]=!0,e.Granjon=!0,e["Guardian Egyptian"]=!0,e.Heather=!0,e.Hercules=!0,e["High Tower Text"]=!0,e.Hiroshige=!0,e["Hoefler Text"]=!0,e["Humana Serif"]=!0,e.Imprint=!0,e["Ionic No. 5"]=!0,e.Janson=!0,e.Joanna=!0,e.Korinna=!0,e.Lexicon=!0,e.LiberationSerif=!0,e["Liberation Serif"]=!0,e["Linux Libertine"]=!0,e.Literaturnaya=!0,e.Lucida=!0,e["Lucida Bright"]=!0,e.Melior=!0,e.Memphis=!0,e.Miller=!0,e.Minion=!0,e.Modern=!0,e["Mona Lisa"]=!0,e["Mrs Eaves"]=!0,e["MS Serif"]=!0,e["Museo Slab"]=!0,e["New York"]=!0,e["Nimbus Roman"]=!0,e["NPS Rawlinson Roadway"]=!0,e.NuptialScript=!0,e.Palatino=!0,e.Perpetua=!0,e.Plantin=!0,e["Plantin Schoolbook"]=!0,e.Playbill=!0,e["Poor Richard"]=!0,e["Rawlinson Roadway"]=!0,e.Renault=!0,e.Requiem=!0,e.Rockwell=!0,e.Roman=!0,e["Rotis Serif"]=!0,e.Sabon=!0,e.Scala=!0,e.Seagull=!0,e.Sistina=!0,e.Souvenir=!0,e.STIX=!0,e["Stone Informal"]=!0,e["Stone Serif"]=!0,e.Sylfaen=!0,e.Times=!0,e.Trajan=!0,e.Trinit\\u00E9=!0,e["Trump Mediaeval"]=!0,e.Utopia=!0,e["Vale Type"]=!0,e["Bitstream Vera"]=!0,e["Vera Serif"]=!0,e.Versailles=!0,e.Wanted=!0,e.Weiss=!0,e["Wide Latin"]=!0,e.Windsor=!0,e.XITS=!0}),DI=he(function(e){e.Dingbats=!0,e.Symbol=!0,e.ZapfDingbats=!0,e.Wingdings=!0,e["Wingdings-Bold"]=!0,e["Wingdings-Regular"]=!0}),Z1=he(function(e){e[2]=10,e[3]=32,e[4]=33,e[5]=34,e[6]=35,e[7]=36,e[8]=37,e[9]=38,e[10]=39,e[11]=40,e[12]=41,e[13]=42,e[14]=43,e[15]=44,e[16]=45,e[17]=46,e[18]=47,e[19]=48,e[20]=49,e[21]=50,e[22]=51,e[23]=52,e[24]=53,e[25]=54,e[26]=55,e[27]=56,e[28]=57,e[29]=58,e[30]=894,e[31]=60,e[32]=61,e[33]=62,e[34]=63,e[35]=64,e[36]=65,e[37]=66,e[38]=67,e[39]=68,e[40]=69,e[41]=70,e[42]=71,e[43]=72,e[44]=73,e[45]=74,e[46]=75,e[47]=76,e[48]=77,e[49]=78,e[50]=79,e[51]=80,e[52]=81,e[53]=82,e[54]=83,e[55]=84,e[56]=85,e[57]=86,e[58]=87,e[59]=88,e[60]=89,e[61]=90,e[62]=91,e[63]=92,e[64]=93,e[65]=94,e[66]=95,e[67]=96,e[68]=97,e[69]=98,e[70]=99,e[71]=100,e[72]=101,e[73]=102,e[74]=103,e[75]=104,e[76]=105,e[77]=106,e[78]=107,e[79]=108,e[80]=109,e[81]=110,e[82]=111,e[83]=112,e[84]=113,e[85]=114,e[86]=115,e[87]=116,e[88]=117,e[89]=118,e[90]=119,e[91]=120,e[92]=121,e[93]=122,e[94]=123,e[95]=124,e[96]=125,e[97]=126,e[98]=196,e[99]=197,e[100]=199,e[101]=201,e[102]=209,e[103]=214,e[104]=220,e[105]=225,e[106]=224,e[107]=226,e[108]=228,e[109]=227,e[110]=229,e[111]=231,e[112]=233,e[113]=232,e[114]=234,e[115]=235,e[116]=237,e[117]=236,e[118]=238,e[119]=239,e[120]=241,e[121]=243,e[122]=242,e[123]=244,e[124]=246,e[125]=245,e[126]=250,e[127]=249,e[128]=251,e[129]=252,e[130]=8224,e[131]=176,e[132]=162,e[133]=163,e[134]=167,e[135]=8226,e[136]=182,e[137]=223,e[138]=174,e[139]=169,e[140]=8482,e[141]=180,e[142]=168,e[143]=8800,e[144]=198,e[145]=216,e[146]=8734,e[147]=177,e[148]=8804,e[149]=8805,e[150]=165,e[151]=181,e[152]=8706,e[153]=8721,e[154]=8719,e[156]=8747,e[157]=170,e[158]=186,e[159]=8486,e[160]=230,e[161]=248,e[162]=191,e[163]=161,e[164]=172,e[165]=8730,e[166]=402,e[167]=8776,e[168]=8710,e[169]=171,e[170]=187,e[171]=8230,e[179]=8220,e[180]=8221,e[181]=8216,e[182]=8217,e[200]=193,e[203]=205,e[207]=211,e[210]=218,e[223]=711,e[224]=321,e[225]=322,e[226]=352,e[227]=353,e[228]=381,e[229]=382,e[233]=221,e[234]=253,e[252]=263,e[253]=268,e[254]=269,e[258]=258,e[260]=260,e[261]=261,e[265]=280,e[266]=281,e[267]=282,e[268]=283,e[269]=313,e[275]=323,e[276]=324,e[278]=328,e[283]=344,e[284]=345,e[285]=346,e[286]=347,e[292]=367,e[295]=377,e[296]=378,e[298]=380,e[305]=963,e[306]=964,e[307]=966,e[308]=8215,e[309]=8252,e[310]=8319,e[311]=8359,e[312]=8592,e[313]=8593,e[337]=9552,e[493]=1039,e[494]=1040,e[672]=1488,e[673]=1489,e[674]=1490,e[675]=1491,e[676]=1492,e[677]=1493,e[678]=1494,e[679]=1495,e[680]=1496,e[681]=1497,e[682]=1498,e[683]=1499,e[684]=1500,e[685]=1501,e[686]=1502,e[687]=1503,e[688]=1504,e[689]=1505,e[690]=1506,e[691]=1507,e[692]=1508,e[693]=1509,e[694]=1510,e[695]=1511,e[696]=1512,e[697]=1513,e[698]=1514,e[705]=1524,e[706]=8362,e[710]=64288,e[711]=64298,e[759]=1617,e[761]=1776,e[763]=1778,e[775]=1652,e[777]=1764,e[778]=1780,e[779]=1781,e[780]=1782,e[782]=771,e[783]=64726,e[786]=8363,e[788]=8532,e[790]=768,e[791]=769,e[792]=768,e[795]=803,e[797]=64336,e[798]=64337,e[799]=64342,e[800]=64343,e[801]=64344,e[802]=64345,e[803]=64362,e[804]=64363,e[805]=64364,e[2424]=7821,e[2425]=7822,e[2426]=7823,e[2427]=7824,e[2428]=7825,e[2429]=7826,e[2430]=7827,e[2433]=7682,e[2678]=8045,e[2679]=8046,e[2830]=1552,e[2838]=686,e[2840]=751,e[2842]=753,e[2843]=754,e[2844]=755,e[2846]=757,e[2856]=767,e[2857]=848,e[2858]=849,e[2862]=853,e[2863]=854,e[2864]=855,e[2865]=861,e[2866]=862,e[2906]=7460,e[2908]=7462,e[2909]=7463,e[2910]=7464,e[2912]=7466,e[2913]=7467,e[2914]=7468,e[2916]=7470,e[2917]=7471,e[2918]=7472,e[2920]=7474,e[2921]=7475,e[2922]=7476,e[2924]=7478,e[2925]=7479,e[2926]=7480,e[2928]=7482,e[2929]=7483,e[2930]=7484,e[2932]=7486,e[2933]=7487,e[2934]=7488,e[2936]=7490,e[2937]=7491,e[2938]=7492,e[2940]=7494,e[2941]=7495,e[2942]=7496,e[2944]=7498,e[2946]=7500,e[2948]=7502,e[2950]=7504,e[2951]=7505,e[2952]=7506,e[2954]=7508,e[2955]=7509,e[2956]=7510,e[2958]=7512,e[2959]=7513,e[2960]=7514,e[2962]=7516,e[2963]=7517,e[2964]=7518,e[2966]=7520,e[2967]=7521,e[2968]=7522,e[2970]=7524,e[2971]=7525,e[2972]=7526,e[2974]=7528,e[2975]=7529,e[2976]=7530,e[2978]=1537,e[2979]=1538,e[2980]=1539,e[2982]=1549,e[2983]=1551,e[2984]=1552,e[2986]=1554,e[2987]=1555,e[2988]=1556,e[2990]=1623,e[2991]=1624,e[2995]=1775,e[2999]=1791,e[3002]=64290,e[3003]=64291,e[3004]=64292,e[3006]=64294,e[3007]=64295,e[3008]=64296,e[3011]=1900,e[3014]=8223,e[3015]=8244,e[3017]=7532,e[3018]=7533,e[3019]=7534,e[3075]=7590,e[3076]=7591,e[3079]=7594,e[3080]=7595,e[3083]=7598,e[3084]=7599,e[3087]=7602,e[3088]=7603,e[3091]=7606,e[3092]=7607,e[3095]=7610,e[3096]=7611,e[3099]=7614,e[3100]=7615,e[3103]=7618,e[3104]=7619,e[3107]=8337,e[3108]=8338,e[3116]=1884,e[3119]=1885,e[3120]=1885,e[3123]=1886,e[3124]=1886,e[3127]=1887,e[3128]=1887,e[3131]=1888,e[3132]=1888,e[3135]=1889,e[3136]=1889,e[3139]=1890,e[3140]=1890,e[3143]=1891,e[3144]=1891,e[3147]=1892,e[3148]=1892,e[3153]=580,e[3154]=581,e[3157]=584,e[3158]=585,e[3161]=588,e[3162]=589,e[3165]=891,e[3166]=892,e[3169]=1274,e[3170]=1275,e[3173]=1278,e[3174]=1279,e[3181]=7622,e[3182]=7623,e[3282]=11799,e[3316]=578,e[3379]=42785,e[3393]=1159,e[3416]=8377}),i2=he(function(e){e[227]=322,e[264]=261,e[291]=346}),s2=he(function(e){e[1]=32,e[4]=65,e[5]=192,e[6]=193,e[9]=196,e[17]=66,e[18]=67,e[21]=268,e[24]=68,e[28]=69,e[29]=200,e[30]=201,e[32]=282,e[38]=70,e[39]=71,e[44]=72,e[47]=73,e[48]=204,e[49]=205,e[58]=74,e[60]=75,e[62]=76,e[68]=77,e[69]=78,e[75]=79,e[76]=210,e[80]=214,e[87]=80,e[89]=81,e[90]=82,e[92]=344,e[94]=83,e[97]=352,e[100]=84,e[104]=85,e[109]=220,e[115]=86,e[116]=87,e[121]=88,e[122]=89,e[124]=221,e[127]=90,e[129]=381,e[258]=97,e[259]=224,e[260]=225,e[263]=228,e[268]=261,e[271]=98,e[272]=99,e[273]=263,e[275]=269,e[282]=100,e[286]=101,e[287]=232,e[288]=233,e[290]=283,e[295]=281,e[296]=102,e[336]=103,e[346]=104,e[349]=105,e[350]=236,e[351]=237,e[361]=106,e[364]=107,e[367]=108,e[371]=322,e[373]=109,e[374]=110,e[381]=111,e[382]=242,e[383]=243,e[386]=246,e[393]=112,e[395]=113,e[396]=114,e[398]=345,e[400]=115,e[401]=347,e[403]=353,e[410]=116,e[437]=117,e[442]=252,e[448]=118,e[449]=119,e[454]=120,e[455]=121,e[457]=253,e[460]=122,e[462]=382,e[463]=380,e[853]=44,e[855]=58,e[856]=46,e[876]=47,e[878]=45,e[882]=45,e[894]=40,e[895]=41,e[896]=91,e[897]=93,e[923]=64,e[1004]=48,e[1005]=49,e[1006]=50,e[1007]=51,e[1008]=52,e[1009]=53,e[1010]=54,e[1011]=55,e[1012]=56,e[1013]=57,e[1081]=37,e[1085]=43,e[1086]=45});function j1(e){let A=pn(e);return zg()[A]}function X1(e){let A=pn(e);return!!(zg()[A]||uf()[A]||C1()[A]||DI()[A])}var B0=class{constructor(A=[]){this._map=A}get length(){return this._map.length}forEach(A){for(let t in this._map)A(t,this._map[t].charCodeAt(0))}has(A){return this._map[A]!==void 0}get(A){return this._map[A]}charCodeOf(A){let t=this._map;if(t.length<=65536)return t.indexOf(A);for(let i in t)if(t[i]===A)return i|0;return-1}amend(A){for(let t in A)this._map[t]=A[t]}},Ct=class{constructor(A,t){this.firstChar=A,this.lastChar=t}get length(){return this.lastChar+1-this.firstChar}forEach(A){for(let t=this.firstChar,i=this.lastChar;t<=i;t++)A(t,t)}has(A){return this.firstChar<=A&&A<=this.lastChar}get(A){if(this.firstChar<=A&&A<=this.lastChar)return String.fromCharCode(A)}charCodeOf(A){return Number.isInteger(A)&&A>=this.firstChar&&A<=this.lastChar?A:-1}amend(A){OA("Should not call amend()")}},Ea=class{constructor(A,t){this.properties=t;let i=new Ma(A,t,Cs);this.cff=i.parse(),this.cff.duplicateFirstGlyph();let s=new k0(this.cff);this.seacs=this.cff.seacs;try{this.data=s.compile()}catch(a){k("Failed to compile font "+t.loadedName),this.data=A}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){let A=this.cff,t=this.properties,{cidToGidMap:i,cMap:s}=t,a=A.charset.charset,n,r;if(t.composite){let o;if((i==null?void 0:i.length)>0){o=Object.create(null);for(let c=0,l=i.length;c<l;c++){let h=i[c];h!==void 0&&(o[h]=c)}}n=Object.create(null);let I;if(A.isCIDFont)for(r=0;r<a.length;r++){let c=a[r];I=s.charCodeOf(c),(o==null?void 0:o[I])!==void 0&&(I=o[I]),n[I]=r}else for(r=0;r<A.charStrings.count;r++)I=s.charCodeOf(r),n[I]=r;return n}let g=A.encoding?A.encoding.encoding:null;return t.isInternalFont&&(g=t.defaultEncoding),n=ff(t,g,a),n}hasGlyphId(A){return this.cff.hasGlyphId(A)}_createBuiltInEncoding(){let{charset:A,encoding:t}=this.cff;if(!A||!t)return;let i=A.charset,s=t.encoding,a=[];for(let n in s){let r=s[n];if(r>=0){let g=i[r];g&&(a[n]=g)}}a.length>0&&(this.properties.builtInEncoding=a)}};function hi(e,A){return(e[A]<<24|e[A+1]<<16|e[A+2]<<8|e[A+3])>>>0}function Re(e,A){return e[A]<<8|e[A+1]}function V0(e,A){return(e[A]<<24|e[A+1]<<16)>>16}function V1(e,A){return e[A]<<24>>24}function t0(e,A){return V0(e,A)/16384}function kI(e){let A=e.length,t=32768;return A<1240?t=107:A<33900&&(t=1131),t}function a2(e,A,t){let i=Re(e,A+2)===1?hi(e,A+8):hi(e,A+16),s=Re(e,A+i),a,n,r;if(s===4){Re(e,A+i+2);let g=Re(e,A+i+6)>>1;for(n=A+i+14,a=[],r=0;r<g;r++,n+=2)a[r]={end:Re(e,n)};for(n+=2,r=0;r<g;r++,n+=2)a[r].start=Re(e,n);for(r=0;r<g;r++,n+=2)a[r].idDelta=Re(e,n);for(r=0;r<g;r++,n+=2){let o=Re(e,n);if(o!==0){a[r].ids=[];for(let I=0,c=a[r].end-a[r].start+1;I<c;I++)a[r].ids[I]=Re(e,n+o),o+=2}}return a}else if(s===12){let g=hi(e,A+i+12);for(n=A+i+16,a=[],r=0;r<g;r++)A=hi(e,n),a.push({start:A,end:hi(e,n+4),idDelta:hi(e,n+8)-A}),n+=12;return a}throw new v(`unsupported cmap: ${s}`)}function n2(e,A,t,i){var r,g,o;let s={},n=new Ma(new Ie(e,A,t-A),s,i).parse();return{glyphs:n.charStrings.objects,subrs:(g=(r=n.topDict.privateDict)==null?void 0:r.subrsIndex)==null?void 0:g.objects,gsubrs:(o=n.globalSubrIndex)==null?void 0:o.objects,isCFFCIDFont:n.isCIDFont,fdSelect:n.fdSelect,fdArray:n.fdArray}}function r2(e,A,t){let i,s;t?(i=4,s=hi):(i=2,s=(r,g)=>2*Re(r,g));let a=[],n=s(A,0);for(let r=i;r<A.length;r+=i){let g=s(A,r);a.push(e.subarray(n,g)),n=g}return a}function Gr(e,A){let t=A.codePointAt(0),i=0,s=0,a=e.length-1;for(;s<a;){let n=s+a+1>>1;t<e[n].start?a=n-1:s=n}return e[s].start<=t&&t<=e[s].end&&(i=e[s].idDelta+(e[s].ids?e[s].ids[t-e[s].start]:t)&65535),{charCode:t,glyphId:i}}function df(e,A,t){function i(c,l){A.add(_e.MOVE_TO,[c,l])}function s(c,l){A.add(_e.LINE_TO,[c,l])}function a(c,l,h,C){A.add(_e.QUADRATIC_CURVE_TO,[c,l,h,C])}let n=0,r=V0(e,n),g,o=0,I=0;if(n+=10,r<0)do{g=Re(e,n);let c=Re(e,n+2);n+=4;let l,h;g&1?(g&2?(l=V0(e,n),h=V0(e,n+2)):(l=Re(e,n),h=Re(e,n+2)),n+=4):g&2?(l=V1(e,n++),h=V1(e,n++)):(l=e[n++],h=e[n++]),g&2?(o=l,I=h):(o=0,I=0);let C=1,B=1,Q=0,E=0;g&8?(C=B=t0(e,n),n+=2):g&64?(C=t0(e,n),B=t0(e,n+2),n+=4):g&128&&(C=t0(e,n),Q=t0(e,n+2),E=t0(e,n+4),B=t0(e,n+6),n+=8);let f=t.glyphs[c];f&&(A.add(_e.SAVE),A.add(_e.TRANSFORM,[C,Q,E,B,o,I]),g&2,df(f,A,t),A.add(_e.RESTORE))}while(g&32);else{let c=[],l,h;for(l=0;l<r;l++)c.push(Re(e,n)),n+=2;let C=Re(e,n);n+=2+C;let B=c.at(-1)+1,Q=[];for(;Q.length<B;){g=e[n++];let f=1;for(g&8&&(f+=e[n++]);f-- >0;)Q.push({flags:g})}for(l=0;l<B;l++){switch(Q[l].flags&18){case 0:o+=V0(e,n),n+=2;break;case 2:o-=e[n++];break;case 18:o+=e[n++];break}Q[l].x=o}for(l=0;l<B;l++){switch(Q[l].flags&36){case 0:I+=V0(e,n),n+=2;break;case 4:I-=e[n++];break;case 36:I+=e[n++];break}Q[l].y=I}let E=0;for(n=0;n<r;n++){let f=c[n],u=Q.slice(E,f+1);if(u[0].flags&1)u.push(u[0]);else if(u.at(-1).flags&1)u.unshift(u.at(-1));else{let d={flags:1,x:(u[0].x+u.at(-1).x)/2,y:(u[0].y+u.at(-1).y)/2};u.unshift(d),u.push(d)}for(i(u[0].x,u[0].y),l=1,h=u.length;l<h;l++)u[l].flags&1?s(u[l].x,u[l].y):u[l+1].flags&1?(a(u[l].x,u[l].y,u[l+1].x,u[l+1].y),l++):a(u[l].x,u[l].y,(u[l].x+u[l+1].x)/2,(u[l].y+u[l+1].y)/2);E=f+1}}}function SI(e,A,t,i){function s(l,h){A.add(_e.MOVE_TO,[l,h])}function a(l,h){A.add(_e.LINE_TO,[l,h])}function n(l,h,C,B,Q,E){A.add(_e.BEZIER_CURVE_TO,[l,h,C,B,Q,E])}let r=[],g=0,o=0,I=0;function c(l){var C;let h=0;for(;h<l.length;){let B=!1,Q=l[h++],E,f,u,d,x,p,m,D,S;switch(Q){case 1:I+=r.length>>1,B=!0;break;case 3:I+=r.length>>1,B=!0;break;case 4:o+=r.pop(),s(g,o),B=!0;break;case 5:for(;r.length>0;)g+=r.shift(),o+=r.shift(),a(g,o);break;case 6:for(;r.length>0&&(g+=r.shift(),a(g,o),r.length!==0);)o+=r.shift(),a(g,o);break;case 7:for(;r.length>0&&(o+=r.shift(),a(g,o),r.length!==0);)g+=r.shift(),a(g,o);break;case 8:for(;r.length>0;)E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o);break;case 10:if(D=r.pop(),S=null,t.isCFFCIDFont){let w=t.fdSelect.getFDIndex(i);if(w>=0&&w<t.fdArray.length){let Y=t.fdArray[w],U;(C=Y.privateDict)!=null&&C.subrsIndex&&(U=Y.privateDict.subrsIndex.objects),U&&(D+=kI(U),S=U[D])}else k("Invalid fd index for glyph index.")}else S=t.subrs[D+t.subrsBias];S&&c(S);break;case 11:return;case 12:switch(Q=l[h++],Q){case 34:E=g+r.shift(),f=E+r.shift(),x=o+r.shift(),g=f+r.shift(),n(E,o,f,x,g,x),E=g+r.shift(),f=E+r.shift(),g=f+r.shift(),n(E,x,f,o,g,o);break;case 35:E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o),E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o),r.pop();break;case 36:E=g+r.shift(),x=o+r.shift(),f=E+r.shift(),p=x+r.shift(),g=f+r.shift(),n(E,x,f,p,g,p),E=g+r.shift(),f=E+r.shift(),m=p+r.shift(),g=f+r.shift(),n(E,p,f,m,g,o);break;case 37:let w=g,Y=o;E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o),E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f,o=d,Math.abs(g-w)>Math.abs(o-Y)?g+=r.shift():o+=r.shift(),n(E,u,f,d,g,o);break;default:throw new v(`unknown operator: 12 ${Q}`)}break;case 14:if(r.length>=4){let w=r.pop(),Y=r.pop();o=r.pop(),g=r.pop(),A.add(_e.SAVE),A.add(_e.TRANSLATE,[g,o]);let U=Gr(t.cmap,String.fromCharCode(t.glyphNameMap[fi[w]]));SI(t.glyphs[U.glyphId],A,t,U.glyphId),A.add(_e.RESTORE),U=Gr(t.cmap,String.fromCharCode(t.glyphNameMap[fi[Y]])),SI(t.glyphs[U.glyphId],A,t,U.glyphId)}return;case 18:I+=r.length>>1,B=!0;break;case 19:I+=r.length>>1,h+=I+7>>3,B=!0;break;case 20:I+=r.length>>1,h+=I+7>>3,B=!0;break;case 21:o+=r.pop(),g+=r.pop(),s(g,o),B=!0;break;case 22:g+=r.pop(),s(g,o),B=!0;break;case 23:I+=r.length>>1,B=!0;break;case 24:for(;r.length>2;)E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o);g+=r.shift(),o+=r.shift(),a(g,o);break;case 25:for(;r.length>6;)g+=r.shift(),o+=r.shift(),a(g,o);E=g+r.shift(),u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+r.shift(),n(E,u,f,d,g,o);break;case 26:for(r.length%2&&(g+=r.shift());r.length>0;)E=g,u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f,o=d+r.shift(),n(E,u,f,d,g,o);break;case 27:for(r.length%2&&(o+=r.shift());r.length>0;)E=g+r.shift(),u=o,f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d,n(E,u,f,d,g,o);break;case 28:r.push((l[h]<<24|l[h+1]<<16)>>16),h+=2;break;case 29:D=r.pop()+t.gsubrsBias,S=t.gsubrs[D],S&&c(S);break;case 30:for(;r.length>0&&(E=g,u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+(r.length===1?r.shift():0),n(E,u,f,d,g,o),r.length!==0);)E=g+r.shift(),u=o,f=E+r.shift(),d=u+r.shift(),o=d+r.shift(),g=f+(r.length===1?r.shift():0),n(E,u,f,d,g,o);break;case 31:for(;r.length>0&&(E=g+r.shift(),u=o,f=E+r.shift(),d=u+r.shift(),o=d+r.shift(),g=f+(r.length===1?r.shift():0),n(E,u,f,d,g,o),r.length!==0);)E=g,u=o+r.shift(),f=E+r.shift(),d=u+r.shift(),g=f+r.shift(),o=d+(r.length===1?r.shift():0),n(E,u,f,d,g,o);break;default:if(Q<32)throw new v(`unknown operator: ${Q}`);Q<247?r.push(Q-139):Q<251?r.push((Q-247)*256+l[h++]+108):Q<255?r.push(-(Q-251)*256-l[h++]-108):(r.push((l[h]<<24|l[h+1]<<16|l[h+2]<<8|l[h+3])/65536),h+=4);break}B&&(r.length=0)}}c(e)}var _1=[],FI=class{constructor(){et(this,"cmds",[])}add(A,t){if(t)if(wt(t,null))this.cmds.push(A,...t);else{k(`Commands.add - "${A}" has at least one non-number arg: "${t}".`);let i=t.map(s=>typeof s=="number"?s:0);this.cmds.push(A,...i)}else this.cmds.push(A)}},Ur=class{constructor(A){this.fontMatrix=A,this.compiledGlyphs=Object.create(null),this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(A){var n,r;let{charCode:t,glyphId:i}=Gr(this.cmap,A),s=this.compiledGlyphs[i],a;if(!s){try{s=this.compileGlyph(this.glyphs[i],i)}catch(g){s=_1,a=g}this.compiledGlyphs[i]=s}if((r=(n=this.compiledCharCodeToGlyphId)[t])!=null||(n[t]=i),a)throw a;return s}compileGlyph(A,t){if(!A||A.length===0||A[0]===14)return _1;let i=this.fontMatrix;if(this.isCFFCIDFont){let a=this.fdSelect.getFDIndex(t);a>=0&&a<this.fdArray.length?i=this.fdArray[a].getByName("FontMatrix")||E0:k("Invalid fd index for glyph index.")}let s=new FI;return s.add(_e.SAVE),s.add(_e.TRANSFORM,i.slice()),s.add(_e.SCALE),this.compileGlyphImpl(A,s,t),s.add(_e.RESTORE),s.cmds}compileGlyphImpl(){OA("Children classes should implement this.")}hasBuiltPath(A){let{charCode:t,glyphId:i}=Gr(this.cmap,A);return this.compiledGlyphs[i]!==void 0&&this.compiledCharCodeToGlyphId[t]!==void 0}},RI=class extends Ur{constructor(A,t,i){super(i||[488e-6,0,0,488e-6,0,0]),this.glyphs=A,this.cmap=t}compileGlyphImpl(A,t){df(A,t,this)}},NI=class extends Ur{constructor(A,t,i,s){super(i||[.001,0,0,.001,0,0]),this.glyphs=A.glyphs,this.gsubrs=A.gsubrs||[],this.subrs=A.subrs||[],this.cmap=t,this.glyphNameMap=s||Ai(),this.gsubrsBias=kI(this.gsubrs),this.subrsBias=kI(this.subrs),this.isCFFCIDFont=A.isCFFCIDFont,this.fdSelect=A.fdSelect,this.fdArray=A.fdArray}compileGlyphImpl(A,t,i){SI(A,t,this,i)}},GI=class{static create(A,t){let i=new Uint8Array(A.data),s,a,n,r,g,o,I=Re(i,4);for(let c=0,l=12;c<I;c++,l+=16){let h=Qt(i.subarray(l,l+4)),C=hi(i,l+8),B=hi(i,l+12);switch(h){case"cmap":s=a2(i,C,C+B);break;case"glyf":a=i.subarray(C,C+B);break;case"loca":n=i.subarray(C,C+B);break;case"head":o=Re(i,C+18),g=Re(i,C+50);break;case"CFF ":r=n2(i,C,C+B,t);break}}if(a){let c=o?[1/o,0,0,1/o,0,0]:A.fontMatrix;return new RI(r2(a,n,g),s,c)}return new NI(r,s,A.fontMatrix,A.glyphNameMap)}},g2=he(function(e){e.Courier=600,e["Courier-Bold"]=600,e["Courier-BoldOblique"]=600,e["Courier-Oblique"]=600,e.Helvetica=he(function(A){A.space=278,A.exclam=278,A.quotedbl=355,A.numbersign=556,A.dollar=556,A.percent=889,A.ampersand=667,A.quoteright=222,A.parenleft=333,A.parenright=333,A.asterisk=389,A.plus=584,A.comma=278,A.hyphen=333,A.period=278,A.slash=278,A.zero=556,A.one=556,A.two=556,A.three=556,A.four=556,A.five=556,A.six=556,A.seven=556,A.eight=556,A.nine=556,A.colon=278,A.semicolon=278,A.less=584,A.equal=584,A.greater=584,A.question=556,A.at=1015,A.A=667,A.B=667,A.C=722,A.D=722,A.E=667,A.F=611,A.G=778,A.H=722,A.I=278,A.J=500,A.K=667,A.L=556,A.M=833,A.N=722,A.O=778,A.P=667,A.Q=778,A.R=722,A.S=667,A.T=611,A.U=722,A.V=667,A.W=944,A.X=667,A.Y=667,A.Z=611,A.bracketleft=278,A.backslash=278,A.bracketright=278,A.asciicircum=469,A.underscore=556,A.quoteleft=222,A.a=556,A.b=556,A.c=500,A.d=556,A.e=556,A.f=278,A.g=556,A.h=556,A.i=222,A.j=222,A.k=500,A.l=222,A.m=833,A.n=556,A.o=556,A.p=556,A.q=556,A.r=333,A.s=500,A.t=278,A.u=556,A.v=500,A.w=722,A.x=500,A.y=500,A.z=500,A.braceleft=334,A.bar=260,A.braceright=334,A.asciitilde=584,A.exclamdown=333,A.cent=556,A.sterling=556,A.fraction=167,A.yen=556,A.florin=556,A.section=556,A.currency=556,A.quotesingle=191,A.quotedblleft=333,A.guillemotleft=556,A.guilsinglleft=333,A.guilsinglright=333,A.fi=500,A.fl=500,A.endash=556,A.dagger=556,A.daggerdbl=556,A.periodcentered=278,A.paragraph=537,A.bullet=350,A.quotesinglbase=222,A.quotedblbase=333,A.quotedblright=333,A.guillemotright=556,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=611,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=1e3,A.ordfeminine=370,A.Lslash=556,A.Oslash=778,A.OE=1e3,A.ordmasculine=365,A.ae=889,A.dotlessi=278,A.lslash=222,A.oslash=611,A.oe=944,A.germandbls=611,A.Idieresis=278,A.eacute=556,A.abreve=556,A.uhungarumlaut=556,A.ecaron=556,A.Ydieresis=667,A.divide=584,A.Yacute=667,A.Acircumflex=667,A.aacute=556,A.Ucircumflex=722,A.yacute=500,A.scommaaccent=500,A.ecircumflex=556,A.Uring=722,A.Udieresis=722,A.aogonek=556,A.Uacute=722,A.uogonek=556,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=737,A.Emacron=667,A.ccaron=500,A.aring=556,A.Ncommaaccent=722,A.lacute=222,A.agrave=556,A.Tcommaaccent=611,A.Cacute=722,A.atilde=556,A.Edotaccent=667,A.scaron=500,A.scedilla=500,A.iacute=278,A.lozenge=471,A.Rcaron=722,A.Gcommaaccent=778,A.ucircumflex=556,A.acircumflex=556,A.Amacron=667,A.rcaron=333,A.ccedilla=500,A.Zdotaccent=611,A.Thorn=667,A.Omacron=778,A.Racute=722,A.Sacute=667,A.dcaron=643,A.Umacron=722,A.uring=556,A.threesuperior=333,A.Ograve=778,A.Agrave=667,A.Abreve=667,A.multiply=584,A.uacute=556,A.Tcaron=611,A.partialdiff=476,A.ydieresis=500,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=556,A.edieresis=556,A.cacute=500,A.nacute=556,A.umacron=556,A.Ncaron=722,A.Iacute=278,A.plusminus=584,A.brokenbar=260,A.registered=737,A.Gbreve=778,A.Idotaccent=278,A.summation=600,A.Egrave=667,A.racute=333,A.omacron=556,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=722,A.lcommaaccent=222,A.tcaron=317,A.eogonek=556,A.Uogonek=722,A.Aacute=667,A.Adieresis=667,A.egrave=556,A.zacute=500,A.iogonek=222,A.Oacute=778,A.oacute=556,A.amacron=556,A.sacute=500,A.idieresis=278,A.Ocircumflex=778,A.Ugrave=722,A.Delta=612,A.thorn=556,A.twosuperior=333,A.Odieresis=778,A.mu=556,A.igrave=278,A.ohungarumlaut=556,A.Eogonek=667,A.dcroat=556,A.threequarters=834,A.Scedilla=667,A.lcaron=299,A.Kcommaaccent=667,A.Lacute=556,A.trademark=1e3,A.edotaccent=556,A.Igrave=278,A.Imacron=278,A.Lcaron=556,A.onehalf=834,A.lessequal=549,A.ocircumflex=556,A.ntilde=556,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=556,A.gbreve=556,A.onequarter=834,A.Scaron=667,A.Scommaaccent=667,A.Ohungarumlaut=778,A.degree=400,A.ograve=556,A.Ccaron=722,A.ugrave=556,A.radical=453,A.Dcaron=722,A.rcommaaccent=333,A.Ntilde=722,A.otilde=556,A.Rcommaaccent=722,A.Lcommaaccent=556,A.Atilde=667,A.Aogonek=667,A.Aring=667,A.Otilde=778,A.zdotaccent=500,A.Ecaron=667,A.Iogonek=278,A.kcommaaccent=500,A.minus=584,A.Icircumflex=278,A.ncaron=556,A.tcommaaccent=278,A.logicalnot=584,A.odieresis=556,A.udieresis=556,A.notequal=549,A.gcommaaccent=556,A.eth=556,A.zcaron=500,A.ncommaaccent=556,A.onesuperior=333,A.imacron=278,A.Euro=556}),e["Helvetica-Bold"]=he(function(A){A.space=278,A.exclam=333,A.quotedbl=474,A.numbersign=556,A.dollar=556,A.percent=889,A.ampersand=722,A.quoteright=278,A.parenleft=333,A.parenright=333,A.asterisk=389,A.plus=584,A.comma=278,A.hyphen=333,A.period=278,A.slash=278,A.zero=556,A.one=556,A.two=556,A.three=556,A.four=556,A.five=556,A.six=556,A.seven=556,A.eight=556,A.nine=556,A.colon=333,A.semicolon=333,A.less=584,A.equal=584,A.greater=584,A.question=611,A.at=975,A.A=722,A.B=722,A.C=722,A.D=722,A.E=667,A.F=611,A.G=778,A.H=722,A.I=278,A.J=556,A.K=722,A.L=611,A.M=833,A.N=722,A.O=778,A.P=667,A.Q=778,A.R=722,A.S=667,A.T=611,A.U=722,A.V=667,A.W=944,A.X=667,A.Y=667,A.Z=611,A.bracketleft=333,A.backslash=278,A.bracketright=333,A.asciicircum=584,A.underscore=556,A.quoteleft=278,A.a=556,A.b=611,A.c=556,A.d=611,A.e=556,A.f=333,A.g=611,A.h=611,A.i=278,A.j=278,A.k=556,A.l=278,A.m=889,A.n=611,A.o=611,A.p=611,A.q=611,A.r=389,A.s=556,A.t=333,A.u=611,A.v=556,A.w=778,A.x=556,A.y=556,A.z=500,A.braceleft=389,A.bar=280,A.braceright=389,A.asciitilde=584,A.exclamdown=333,A.cent=556,A.sterling=556,A.fraction=167,A.yen=556,A.florin=556,A.section=556,A.currency=556,A.quotesingle=238,A.quotedblleft=500,A.guillemotleft=556,A.guilsinglleft=333,A.guilsinglright=333,A.fi=611,A.fl=611,A.endash=556,A.dagger=556,A.daggerdbl=556,A.periodcentered=278,A.paragraph=556,A.bullet=350,A.quotesinglbase=278,A.quotedblbase=500,A.quotedblright=500,A.guillemotright=556,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=611,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=1e3,A.ordfeminine=370,A.Lslash=611,A.Oslash=778,A.OE=1e3,A.ordmasculine=365,A.ae=889,A.dotlessi=278,A.lslash=278,A.oslash=611,A.oe=944,A.germandbls=611,A.Idieresis=278,A.eacute=556,A.abreve=556,A.uhungarumlaut=611,A.ecaron=556,A.Ydieresis=667,A.divide=584,A.Yacute=667,A.Acircumflex=722,A.aacute=556,A.Ucircumflex=722,A.yacute=556,A.scommaaccent=556,A.ecircumflex=556,A.Uring=722,A.Udieresis=722,A.aogonek=556,A.Uacute=722,A.uogonek=611,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=737,A.Emacron=667,A.ccaron=556,A.aring=556,A.Ncommaaccent=722,A.lacute=278,A.agrave=556,A.Tcommaaccent=611,A.Cacute=722,A.atilde=556,A.Edotaccent=667,A.scaron=556,A.scedilla=556,A.iacute=278,A.lozenge=494,A.Rcaron=722,A.Gcommaaccent=778,A.ucircumflex=611,A.acircumflex=556,A.Amacron=722,A.rcaron=389,A.ccedilla=556,A.Zdotaccent=611,A.Thorn=667,A.Omacron=778,A.Racute=722,A.Sacute=667,A.dcaron=743,A.Umacron=722,A.uring=611,A.threesuperior=333,A.Ograve=778,A.Agrave=722,A.Abreve=722,A.multiply=584,A.uacute=611,A.Tcaron=611,A.partialdiff=494,A.ydieresis=556,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=556,A.edieresis=556,A.cacute=556,A.nacute=611,A.umacron=611,A.Ncaron=722,A.Iacute=278,A.plusminus=584,A.brokenbar=280,A.registered=737,A.Gbreve=778,A.Idotaccent=278,A.summation=600,A.Egrave=667,A.racute=389,A.omacron=611,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=722,A.lcommaaccent=278,A.tcaron=389,A.eogonek=556,A.Uogonek=722,A.Aacute=722,A.Adieresis=722,A.egrave=556,A.zacute=500,A.iogonek=278,A.Oacute=778,A.oacute=611,A.amacron=556,A.sacute=556,A.idieresis=278,A.Ocircumflex=778,A.Ugrave=722,A.Delta=612,A.thorn=611,A.twosuperior=333,A.Odieresis=778,A.mu=611,A.igrave=278,A.ohungarumlaut=611,A.Eogonek=667,A.dcroat=611,A.threequarters=834,A.Scedilla=667,A.lcaron=400,A.Kcommaaccent=722,A.Lacute=611,A.trademark=1e3,A.edotaccent=556,A.Igrave=278,A.Imacron=278,A.Lcaron=611,A.onehalf=834,A.lessequal=549,A.ocircumflex=611,A.ntilde=611,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=556,A.gbreve=611,A.onequarter=834,A.Scaron=667,A.Scommaaccent=667,A.Ohungarumlaut=778,A.degree=400,A.ograve=611,A.Ccaron=722,A.ugrave=611,A.radical=549,A.Dcaron=722,A.rcommaaccent=389,A.Ntilde=722,A.otilde=611,A.Rcommaaccent=722,A.Lcommaaccent=611,A.Atilde=722,A.Aogonek=722,A.Aring=722,A.Otilde=778,A.zdotaccent=500,A.Ecaron=667,A.Iogonek=278,A.kcommaaccent=556,A.minus=584,A.Icircumflex=278,A.ncaron=611,A.tcommaaccent=333,A.logicalnot=584,A.odieresis=611,A.udieresis=611,A.notequal=549,A.gcommaaccent=611,A.eth=611,A.zcaron=500,A.ncommaaccent=611,A.onesuperior=333,A.imacron=278,A.Euro=556}),e["Helvetica-BoldOblique"]=he(function(A){A.space=278,A.exclam=333,A.quotedbl=474,A.numbersign=556,A.dollar=556,A.percent=889,A.ampersand=722,A.quoteright=278,A.parenleft=333,A.parenright=333,A.asterisk=389,A.plus=584,A.comma=278,A.hyphen=333,A.period=278,A.slash=278,A.zero=556,A.one=556,A.two=556,A.three=556,A.four=556,A.five=556,A.six=556,A.seven=556,A.eight=556,A.nine=556,A.colon=333,A.semicolon=333,A.less=584,A.equal=584,A.greater=584,A.question=611,A.at=975,A.A=722,A.B=722,A.C=722,A.D=722,A.E=667,A.F=611,A.G=778,A.H=722,A.I=278,A.J=556,A.K=722,A.L=611,A.M=833,A.N=722,A.O=778,A.P=667,A.Q=778,A.R=722,A.S=667,A.T=611,A.U=722,A.V=667,A.W=944,A.X=667,A.Y=667,A.Z=611,A.bracketleft=333,A.backslash=278,A.bracketright=333,A.asciicircum=584,A.underscore=556,A.quoteleft=278,A.a=556,A.b=611,A.c=556,A.d=611,A.e=556,A.f=333,A.g=611,A.h=611,A.i=278,A.j=278,A.k=556,A.l=278,A.m=889,A.n=611,A.o=611,A.p=611,A.q=611,A.r=389,A.s=556,A.t=333,A.u=611,A.v=556,A.w=778,A.x=556,A.y=556,A.z=500,A.braceleft=389,A.bar=280,A.braceright=389,A.asciitilde=584,A.exclamdown=333,A.cent=556,A.sterling=556,A.fraction=167,A.yen=556,A.florin=556,A.section=556,A.currency=556,A.quotesingle=238,A.quotedblleft=500,A.guillemotleft=556,A.guilsinglleft=333,A.guilsinglright=333,A.fi=611,A.fl=611,A.endash=556,A.dagger=556,A.daggerdbl=556,A.periodcentered=278,A.paragraph=556,A.bullet=350,A.quotesinglbase=278,A.quotedblbase=500,A.quotedblright=500,A.guillemotright=556,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=611,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=1e3,A.ordfeminine=370,A.Lslash=611,A.Oslash=778,A.OE=1e3,A.ordmasculine=365,A.ae=889,A.dotlessi=278,A.lslash=278,A.oslash=611,A.oe=944,A.germandbls=611,A.Idieresis=278,A.eacute=556,A.abreve=556,A.uhungarumlaut=611,A.ecaron=556,A.Ydieresis=667,A.divide=584,A.Yacute=667,A.Acircumflex=722,A.aacute=556,A.Ucircumflex=722,A.yacute=556,A.scommaaccent=556,A.ecircumflex=556,A.Uring=722,A.Udieresis=722,A.aogonek=556,A.Uacute=722,A.uogonek=611,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=737,A.Emacron=667,A.ccaron=556,A.aring=556,A.Ncommaaccent=722,A.lacute=278,A.agrave=556,A.Tcommaaccent=611,A.Cacute=722,A.atilde=556,A.Edotaccent=667,A.scaron=556,A.scedilla=556,A.iacute=278,A.lozenge=494,A.Rcaron=722,A.Gcommaaccent=778,A.ucircumflex=611,A.acircumflex=556,A.Amacron=722,A.rcaron=389,A.ccedilla=556,A.Zdotaccent=611,A.Thorn=667,A.Omacron=778,A.Racute=722,A.Sacute=667,A.dcaron=743,A.Umacron=722,A.uring=611,A.threesuperior=333,A.Ograve=778,A.Agrave=722,A.Abreve=722,A.multiply=584,A.uacute=611,A.Tcaron=611,A.partialdiff=494,A.ydieresis=556,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=556,A.edieresis=556,A.cacute=556,A.nacute=611,A.umacron=611,A.Ncaron=722,A.Iacute=278,A.plusminus=584,A.brokenbar=280,A.registered=737,A.Gbreve=778,A.Idotaccent=278,A.summation=600,A.Egrave=667,A.racute=389,A.omacron=611,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=722,A.lcommaaccent=278,A.tcaron=389,A.eogonek=556,A.Uogonek=722,A.Aacute=722,A.Adieresis=722,A.egrave=556,A.zacute=500,A.iogonek=278,A.Oacute=778,A.oacute=611,A.amacron=556,A.sacute=556,A.idieresis=278,A.Ocircumflex=778,A.Ugrave=722,A.Delta=612,A.thorn=611,A.twosuperior=333,A.Odieresis=778,A.mu=611,A.igrave=278,A.ohungarumlaut=611,A.Eogonek=667,A.dcroat=611,A.threequarters=834,A.Scedilla=667,A.lcaron=400,A.Kcommaaccent=722,A.Lacute=611,A.trademark=1e3,A.edotaccent=556,A.Igrave=278,A.Imacron=278,A.Lcaron=611,A.onehalf=834,A.lessequal=549,A.ocircumflex=611,A.ntilde=611,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=556,A.gbreve=611,A.onequarter=834,A.Scaron=667,A.Scommaaccent=667,A.Ohungarumlaut=778,A.degree=400,A.ograve=611,A.Ccaron=722,A.ugrave=611,A.radical=549,A.Dcaron=722,A.rcommaaccent=389,A.Ntilde=722,A.otilde=611,A.Rcommaaccent=722,A.Lcommaaccent=611,A.Atilde=722,A.Aogonek=722,A.Aring=722,A.Otilde=778,A.zdotaccent=500,A.Ecaron=667,A.Iogonek=278,A.kcommaaccent=556,A.minus=584,A.Icircumflex=278,A.ncaron=611,A.tcommaaccent=333,A.logicalnot=584,A.odieresis=611,A.udieresis=611,A.notequal=549,A.gcommaaccent=611,A.eth=611,A.zcaron=500,A.ncommaaccent=611,A.onesuperior=333,A.imacron=278,A.Euro=556}),e["Helvetica-Oblique"]=he(function(A){A.space=278,A.exclam=278,A.quotedbl=355,A.numbersign=556,A.dollar=556,A.percent=889,A.ampersand=667,A.quoteright=222,A.parenleft=333,A.parenright=333,A.asterisk=389,A.plus=584,A.comma=278,A.hyphen=333,A.period=278,A.slash=278,A.zero=556,A.one=556,A.two=556,A.three=556,A.four=556,A.five=556,A.six=556,A.seven=556,A.eight=556,A.nine=556,A.colon=278,A.semicolon=278,A.less=584,A.equal=584,A.greater=584,A.question=556,A.at=1015,A.A=667,A.B=667,A.C=722,A.D=722,A.E=667,A.F=611,A.G=778,A.H=722,A.I=278,A.J=500,A.K=667,A.L=556,A.M=833,A.N=722,A.O=778,A.P=667,A.Q=778,A.R=722,A.S=667,A.T=611,A.U=722,A.V=667,A.W=944,A.X=667,A.Y=667,A.Z=611,A.bracketleft=278,A.backslash=278,A.bracketright=278,A.asciicircum=469,A.underscore=556,A.quoteleft=222,A.a=556,A.b=556,A.c=500,A.d=556,A.e=556,A.f=278,A.g=556,A.h=556,A.i=222,A.j=222,A.k=500,A.l=222,A.m=833,A.n=556,A.o=556,A.p=556,A.q=556,A.r=333,A.s=500,A.t=278,A.u=556,A.v=500,A.w=722,A.x=500,A.y=500,A.z=500,A.braceleft=334,A.bar=260,A.braceright=334,A.asciitilde=584,A.exclamdown=333,A.cent=556,A.sterling=556,A.fraction=167,A.yen=556,A.florin=556,A.section=556,A.currency=556,A.quotesingle=191,A.quotedblleft=333,A.guillemotleft=556,A.guilsinglleft=333,A.guilsinglright=333,A.fi=500,A.fl=500,A.endash=556,A.dagger=556,A.daggerdbl=556,A.periodcentered=278,A.paragraph=537,A.bullet=350,A.quotesinglbase=222,A.quotedblbase=333,A.quotedblright=333,A.guillemotright=556,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=611,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=1e3,A.ordfeminine=370,A.Lslash=556,A.Oslash=778,A.OE=1e3,A.ordmasculine=365,A.ae=889,A.dotlessi=278,A.lslash=222,A.oslash=611,A.oe=944,A.germandbls=611,A.Idieresis=278,A.eacute=556,A.abreve=556,A.uhungarumlaut=556,A.ecaron=556,A.Ydieresis=667,A.divide=584,A.Yacute=667,A.Acircumflex=667,A.aacute=556,A.Ucircumflex=722,A.yacute=500,A.scommaaccent=500,A.ecircumflex=556,A.Uring=722,A.Udieresis=722,A.aogonek=556,A.Uacute=722,A.uogonek=556,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=737,A.Emacron=667,A.ccaron=500,A.aring=556,A.Ncommaaccent=722,A.lacute=222,A.agrave=556,A.Tcommaaccent=611,A.Cacute=722,A.atilde=556,A.Edotaccent=667,A.scaron=500,A.scedilla=500,A.iacute=278,A.lozenge=471,A.Rcaron=722,A.Gcommaaccent=778,A.ucircumflex=556,A.acircumflex=556,A.Amacron=667,A.rcaron=333,A.ccedilla=500,A.Zdotaccent=611,A.Thorn=667,A.Omacron=778,A.Racute=722,A.Sacute=667,A.dcaron=643,A.Umacron=722,A.uring=556,A.threesuperior=333,A.Ograve=778,A.Agrave=667,A.Abreve=667,A.multiply=584,A.uacute=556,A.Tcaron=611,A.partialdiff=476,A.ydieresis=500,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=556,A.edieresis=556,A.cacute=500,A.nacute=556,A.umacron=556,A.Ncaron=722,A.Iacute=278,A.plusminus=584,A.brokenbar=260,A.registered=737,A.Gbreve=778,A.Idotaccent=278,A.summation=600,A.Egrave=667,A.racute=333,A.omacron=556,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=722,A.lcommaaccent=222,A.tcaron=317,A.eogonek=556,A.Uogonek=722,A.Aacute=667,A.Adieresis=667,A.egrave=556,A.zacute=500,A.iogonek=222,A.Oacute=778,A.oacute=556,A.amacron=556,A.sacute=500,A.idieresis=278,A.Ocircumflex=778,A.Ugrave=722,A.Delta=612,A.thorn=556,A.twosuperior=333,A.Odieresis=778,A.mu=556,A.igrave=278,A.ohungarumlaut=556,A.Eogonek=667,A.dcroat=556,A.threequarters=834,A.Scedilla=667,A.lcaron=299,A.Kcommaaccent=667,A.Lacute=556,A.trademark=1e3,A.edotaccent=556,A.Igrave=278,A.Imacron=278,A.Lcaron=556,A.onehalf=834,A.lessequal=549,A.ocircumflex=556,A.ntilde=556,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=556,A.gbreve=556,A.onequarter=834,A.Scaron=667,A.Scommaaccent=667,A.Ohungarumlaut=778,A.degree=400,A.ograve=556,A.Ccaron=722,A.ugrave=556,A.radical=453,A.Dcaron=722,A.rcommaaccent=333,A.Ntilde=722,A.otilde=556,A.Rcommaaccent=722,A.Lcommaaccent=556,A.Atilde=667,A.Aogonek=667,A.Aring=667,A.Otilde=778,A.zdotaccent=500,A.Ecaron=667,A.Iogonek=278,A.kcommaaccent=500,A.minus=584,A.Icircumflex=278,A.ncaron=556,A.tcommaaccent=278,A.logicalnot=584,A.odieresis=556,A.udieresis=556,A.notequal=549,A.gcommaaccent=556,A.eth=556,A.zcaron=500,A.ncommaaccent=556,A.onesuperior=333,A.imacron=278,A.Euro=556}),e.Symbol=he(function(A){A.space=250,A.exclam=333,A.universal=713,A.numbersign=500,A.existential=549,A.percent=833,A.ampersand=778,A.suchthat=439,A.parenleft=333,A.parenright=333,A.asteriskmath=500,A.plus=549,A.comma=250,A.minus=549,A.period=250,A.slash=278,A.zero=500,A.one=500,A.two=500,A.three=500,A.four=500,A.five=500,A.six=500,A.seven=500,A.eight=500,A.nine=500,A.colon=278,A.semicolon=278,A.less=549,A.equal=549,A.greater=549,A.question=444,A.congruent=549,A.Alpha=722,A.Beta=667,A.Chi=722,A.Delta=612,A.Epsilon=611,A.Phi=763,A.Gamma=603,A.Eta=722,A.Iota=333,A.theta1=631,A.Kappa=722,A.Lambda=686,A.Mu=889,A.Nu=722,A.Omicron=722,A.Pi=768,A.Theta=741,A.Rho=556,A.Sigma=592,A.Tau=611,A.Upsilon=690,A.sigma1=439,A.Omega=768,A.Xi=645,A.Psi=795,A.Zeta=611,A.bracketleft=333,A.therefore=863,A.bracketright=333,A.perpendicular=658,A.underscore=500,A.radicalex=500,A.alpha=631,A.beta=549,A.chi=549,A.delta=494,A.epsilon=439,A.phi=521,A.gamma=411,A.eta=603,A.iota=329,A.phi1=603,A.kappa=549,A.lambda=549,A.mu=576,A.nu=521,A.omicron=549,A.pi=549,A.theta=521,A.rho=549,A.sigma=603,A.tau=439,A.upsilon=576,A.omega1=713,A.omega=686,A.xi=493,A.psi=686,A.zeta=494,A.braceleft=480,A.bar=200,A.braceright=480,A.similar=549,A.Euro=750,A.Upsilon1=620,A.minute=247,A.lessequal=549,A.fraction=167,A.infinity=713,A.florin=500,A.club=753,A.diamond=753,A.heart=753,A.spade=753,A.arrowboth=1042,A.arrowleft=987,A.arrowup=603,A.arrowright=987,A.arrowdown=603,A.degree=400,A.plusminus=549,A.second=411,A.greaterequal=549,A.multiply=549,A.proportional=713,A.partialdiff=494,A.bullet=460,A.divide=549,A.notequal=549,A.equivalence=549,A.approxequal=549,A.ellipsis=1e3,A.arrowvertex=603,A.arrowhorizex=1e3,A.carriagereturn=658,A.aleph=823,A.Ifraktur=686,A.Rfraktur=795,A.weierstrass=987,A.circlemultiply=768,A.circleplus=768,A.emptyset=823,A.intersection=768,A.union=768,A.propersuperset=713,A.reflexsuperset=713,A.notsubset=713,A.propersubset=713,A.reflexsubset=713,A.element=713,A.notelement=713,A.angle=768,A.gradient=713,A.registerserif=790,A.copyrightserif=790,A.trademarkserif=890,A.product=823,A.radical=549,A.dotmath=250,A.logicalnot=713,A.logicaland=603,A.logicalor=603,A.arrowdblboth=1042,A.arrowdblleft=987,A.arrowdblup=603,A.arrowdblright=987,A.arrowdbldown=603,A.lozenge=494,A.angleleft=329,A.registersans=790,A.copyrightsans=790,A.trademarksans=786,A.summation=713,A.parenlefttp=384,A.parenleftex=384,A.parenleftbt=384,A.bracketlefttp=384,A.bracketleftex=384,A.bracketleftbt=384,A.bracelefttp=494,A.braceleftmid=494,A.braceleftbt=494,A.braceex=494,A.angleright=329,A.integral=274,A.integraltp=686,A.integralex=686,A.integralbt=686,A.parenrighttp=384,A.parenrightex=384,A.parenrightbt=384,A.bracketrighttp=384,A.bracketrightex=384,A.bracketrightbt=384,A.bracerighttp=494,A.bracerightmid=494,A.bracerightbt=494,A.apple=790}),e["Times-Roman"]=he(function(A){A.space=250,A.exclam=333,A.quotedbl=408,A.numbersign=500,A.dollar=500,A.percent=833,A.ampersand=778,A.quoteright=333,A.parenleft=333,A.parenright=333,A.asterisk=500,A.plus=564,A.comma=250,A.hyphen=333,A.period=250,A.slash=278,A.zero=500,A.one=500,A.two=500,A.three=500,A.four=500,A.five=500,A.six=500,A.seven=500,A.eight=500,A.nine=500,A.colon=278,A.semicolon=278,A.less=564,A.equal=564,A.greater=564,A.question=444,A.at=921,A.A=722,A.B=667,A.C=667,A.D=722,A.E=611,A.F=556,A.G=722,A.H=722,A.I=333,A.J=389,A.K=722,A.L=611,A.M=889,A.N=722,A.O=722,A.P=556,A.Q=722,A.R=667,A.S=556,A.T=611,A.U=722,A.V=722,A.W=944,A.X=722,A.Y=722,A.Z=611,A.bracketleft=333,A.backslash=278,A.bracketright=333,A.asciicircum=469,A.underscore=500,A.quoteleft=333,A.a=444,A.b=500,A.c=444,A.d=500,A.e=444,A.f=333,A.g=500,A.h=500,A.i=278,A.j=278,A.k=500,A.l=278,A.m=778,A.n=500,A.o=500,A.p=500,A.q=500,A.r=333,A.s=389,A.t=278,A.u=500,A.v=500,A.w=722,A.x=500,A.y=500,A.z=444,A.braceleft=480,A.bar=200,A.braceright=480,A.asciitilde=541,A.exclamdown=333,A.cent=500,A.sterling=500,A.fraction=167,A.yen=500,A.florin=500,A.section=500,A.currency=500,A.quotesingle=180,A.quotedblleft=444,A.guillemotleft=500,A.guilsinglleft=333,A.guilsinglright=333,A.fi=556,A.fl=556,A.endash=500,A.dagger=500,A.daggerdbl=500,A.periodcentered=250,A.paragraph=453,A.bullet=350,A.quotesinglbase=333,A.quotedblbase=444,A.quotedblright=444,A.guillemotright=500,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=444,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=889,A.ordfeminine=276,A.Lslash=611,A.Oslash=722,A.OE=889,A.ordmasculine=310,A.ae=667,A.dotlessi=278,A.lslash=278,A.oslash=500,A.oe=722,A.germandbls=500,A.Idieresis=333,A.eacute=444,A.abreve=444,A.uhungarumlaut=500,A.ecaron=444,A.Ydieresis=722,A.divide=564,A.Yacute=722,A.Acircumflex=722,A.aacute=444,A.Ucircumflex=722,A.yacute=500,A.scommaaccent=389,A.ecircumflex=444,A.Uring=722,A.Udieresis=722,A.aogonek=444,A.Uacute=722,A.uogonek=500,A.Edieresis=611,A.Dcroat=722,A.commaaccent=250,A.copyright=760,A.Emacron=611,A.ccaron=444,A.aring=444,A.Ncommaaccent=722,A.lacute=278,A.agrave=444,A.Tcommaaccent=611,A.Cacute=667,A.atilde=444,A.Edotaccent=611,A.scaron=389,A.scedilla=389,A.iacute=278,A.lozenge=471,A.Rcaron=667,A.Gcommaaccent=722,A.ucircumflex=500,A.acircumflex=444,A.Amacron=722,A.rcaron=333,A.ccedilla=444,A.Zdotaccent=611,A.Thorn=556,A.Omacron=722,A.Racute=667,A.Sacute=556,A.dcaron=588,A.Umacron=722,A.uring=500,A.threesuperior=300,A.Ograve=722,A.Agrave=722,A.Abreve=722,A.multiply=564,A.uacute=500,A.Tcaron=611,A.partialdiff=476,A.ydieresis=500,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=611,A.adieresis=444,A.edieresis=444,A.cacute=444,A.nacute=500,A.umacron=500,A.Ncaron=722,A.Iacute=333,A.plusminus=564,A.brokenbar=200,A.registered=760,A.Gbreve=722,A.Idotaccent=333,A.summation=600,A.Egrave=611,A.racute=333,A.omacron=500,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=667,A.lcommaaccent=278,A.tcaron=326,A.eogonek=444,A.Uogonek=722,A.Aacute=722,A.Adieresis=722,A.egrave=444,A.zacute=444,A.iogonek=278,A.Oacute=722,A.oacute=500,A.amacron=444,A.sacute=389,A.idieresis=278,A.Ocircumflex=722,A.Ugrave=722,A.Delta=612,A.thorn=500,A.twosuperior=300,A.Odieresis=722,A.mu=500,A.igrave=278,A.ohungarumlaut=500,A.Eogonek=611,A.dcroat=500,A.threequarters=750,A.Scedilla=556,A.lcaron=344,A.Kcommaaccent=722,A.Lacute=611,A.trademark=980,A.edotaccent=444,A.Igrave=333,A.Imacron=333,A.Lcaron=611,A.onehalf=750,A.lessequal=549,A.ocircumflex=500,A.ntilde=500,A.Uhungarumlaut=722,A.Eacute=611,A.emacron=444,A.gbreve=500,A.onequarter=750,A.Scaron=556,A.Scommaaccent=556,A.Ohungarumlaut=722,A.degree=400,A.ograve=500,A.Ccaron=667,A.ugrave=500,A.radical=453,A.Dcaron=722,A.rcommaaccent=333,A.Ntilde=722,A.otilde=500,A.Rcommaaccent=667,A.Lcommaaccent=611,A.Atilde=722,A.Aogonek=722,A.Aring=722,A.Otilde=722,A.zdotaccent=444,A.Ecaron=611,A.Iogonek=333,A.kcommaaccent=500,A.minus=564,A.Icircumflex=333,A.ncaron=500,A.tcommaaccent=278,A.logicalnot=564,A.odieresis=500,A.udieresis=500,A.notequal=549,A.gcommaaccent=500,A.eth=500,A.zcaron=444,A.ncommaaccent=500,A.onesuperior=300,A.imacron=278,A.Euro=500}),e["Times-Bold"]=he(function(A){A.space=250,A.exclam=333,A.quotedbl=555,A.numbersign=500,A.dollar=500,A.percent=1e3,A.ampersand=833,A.quoteright=333,A.parenleft=333,A.parenright=333,A.asterisk=500,A.plus=570,A.comma=250,A.hyphen=333,A.period=250,A.slash=278,A.zero=500,A.one=500,A.two=500,A.three=500,A.four=500,A.five=500,A.six=500,A.seven=500,A.eight=500,A.nine=500,A.colon=333,A.semicolon=333,A.less=570,A.equal=570,A.greater=570,A.question=500,A.at=930,A.A=722,A.B=667,A.C=722,A.D=722,A.E=667,A.F=611,A.G=778,A.H=778,A.I=389,A.J=500,A.K=778,A.L=667,A.M=944,A.N=722,A.O=778,A.P=611,A.Q=778,A.R=722,A.S=556,A.T=667,A.U=722,A.V=722,A.W=1e3,A.X=722,A.Y=722,A.Z=667,A.bracketleft=333,A.backslash=278,A.bracketright=333,A.asciicircum=581,A.underscore=500,A.quoteleft=333,A.a=500,A.b=556,A.c=444,A.d=556,A.e=444,A.f=333,A.g=500,A.h=556,A.i=278,A.j=333,A.k=556,A.l=278,A.m=833,A.n=556,A.o=500,A.p=556,A.q=556,A.r=444,A.s=389,A.t=333,A.u=556,A.v=500,A.w=722,A.x=500,A.y=500,A.z=444,A.braceleft=394,A.bar=220,A.braceright=394,A.asciitilde=520,A.exclamdown=333,A.cent=500,A.sterling=500,A.fraction=167,A.yen=500,A.florin=500,A.section=500,A.currency=500,A.quotesingle=278,A.quotedblleft=500,A.guillemotleft=500,A.guilsinglleft=333,A.guilsinglright=333,A.fi=556,A.fl=556,A.endash=500,A.dagger=500,A.daggerdbl=500,A.periodcentered=250,A.paragraph=540,A.bullet=350,A.quotesinglbase=333,A.quotedblbase=500,A.quotedblright=500,A.guillemotright=500,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=500,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=1e3,A.ordfeminine=300,A.Lslash=667,A.Oslash=778,A.OE=1e3,A.ordmasculine=330,A.ae=722,A.dotlessi=278,A.lslash=278,A.oslash=500,A.oe=722,A.germandbls=556,A.Idieresis=389,A.eacute=444,A.abreve=500,A.uhungarumlaut=556,A.ecaron=444,A.Ydieresis=722,A.divide=570,A.Yacute=722,A.Acircumflex=722,A.aacute=500,A.Ucircumflex=722,A.yacute=500,A.scommaaccent=389,A.ecircumflex=444,A.Uring=722,A.Udieresis=722,A.aogonek=500,A.Uacute=722,A.uogonek=556,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=747,A.Emacron=667,A.ccaron=444,A.aring=500,A.Ncommaaccent=722,A.lacute=278,A.agrave=500,A.Tcommaaccent=667,A.Cacute=722,A.atilde=500,A.Edotaccent=667,A.scaron=389,A.scedilla=389,A.iacute=278,A.lozenge=494,A.Rcaron=722,A.Gcommaaccent=778,A.ucircumflex=556,A.acircumflex=500,A.Amacron=722,A.rcaron=444,A.ccedilla=444,A.Zdotaccent=667,A.Thorn=611,A.Omacron=778,A.Racute=722,A.Sacute=556,A.dcaron=672,A.Umacron=722,A.uring=556,A.threesuperior=300,A.Ograve=778,A.Agrave=722,A.Abreve=722,A.multiply=570,A.uacute=556,A.Tcaron=667,A.partialdiff=494,A.ydieresis=500,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=500,A.edieresis=444,A.cacute=444,A.nacute=556,A.umacron=556,A.Ncaron=722,A.Iacute=389,A.plusminus=570,A.brokenbar=220,A.registered=747,A.Gbreve=778,A.Idotaccent=389,A.summation=600,A.Egrave=667,A.racute=444,A.omacron=500,A.Zacute=667,A.Zcaron=667,A.greaterequal=549,A.Eth=722,A.Ccedilla=722,A.lcommaaccent=278,A.tcaron=416,A.eogonek=444,A.Uogonek=722,A.Aacute=722,A.Adieresis=722,A.egrave=444,A.zacute=444,A.iogonek=278,A.Oacute=778,A.oacute=500,A.amacron=500,A.sacute=389,A.idieresis=278,A.Ocircumflex=778,A.Ugrave=722,A.Delta=612,A.thorn=556,A.twosuperior=300,A.Odieresis=778,A.mu=556,A.igrave=278,A.ohungarumlaut=500,A.Eogonek=667,A.dcroat=556,A.threequarters=750,A.Scedilla=556,A.lcaron=394,A.Kcommaaccent=778,A.Lacute=667,A.trademark=1e3,A.edotaccent=444,A.Igrave=389,A.Imacron=389,A.Lcaron=667,A.onehalf=750,A.lessequal=549,A.ocircumflex=500,A.ntilde=556,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=444,A.gbreve=500,A.onequarter=750,A.Scaron=556,A.Scommaaccent=556,A.Ohungarumlaut=778,A.degree=400,A.ograve=500,A.Ccaron=722,A.ugrave=556,A.radical=549,A.Dcaron=722,A.rcommaaccent=444,A.Ntilde=722,A.otilde=500,A.Rcommaaccent=722,A.Lcommaaccent=667,A.Atilde=722,A.Aogonek=722,A.Aring=722,A.Otilde=778,A.zdotaccent=444,A.Ecaron=667,A.Iogonek=389,A.kcommaaccent=556,A.minus=570,A.Icircumflex=389,A.ncaron=556,A.tcommaaccent=333,A.logicalnot=570,A.odieresis=500,A.udieresis=556,A.notequal=549,A.gcommaaccent=500,A.eth=500,A.zcaron=444,A.ncommaaccent=556,A.onesuperior=300,A.imacron=278,A.Euro=500}),e["Times-BoldItalic"]=he(function(A){A.space=250,A.exclam=389,A.quotedbl=555,A.numbersign=500,A.dollar=500,A.percent=833,A.ampersand=778,A.quoteright=333,A.parenleft=333,A.parenright=333,A.asterisk=500,A.plus=570,A.comma=250,A.hyphen=333,A.period=250,A.slash=278,A.zero=500,A.one=500,A.two=500,A.three=500,A.four=500,A.five=500,A.six=500,A.seven=500,A.eight=500,A.nine=500,A.colon=333,A.semicolon=333,A.less=570,A.equal=570,A.greater=570,A.question=500,A.at=832,A.A=667,A.B=667,A.C=667,A.D=722,A.E=667,A.F=667,A.G=722,A.H=778,A.I=389,A.J=500,A.K=667,A.L=611,A.M=889,A.N=722,A.O=722,A.P=611,A.Q=722,A.R=667,A.S=556,A.T=611,A.U=722,A.V=667,A.W=889,A.X=667,A.Y=611,A.Z=611,A.bracketleft=333,A.backslash=278,A.bracketright=333,A.asciicircum=570,A.underscore=500,A.quoteleft=333,A.a=500,A.b=500,A.c=444,A.d=500,A.e=444,A.f=333,A.g=500,A.h=556,A.i=278,A.j=278,A.k=500,A.l=278,A.m=778,A.n=556,A.o=500,A.p=500,A.q=500,A.r=389,A.s=389,A.t=278,A.u=556,A.v=444,A.w=667,A.x=500,A.y=444,A.z=389,A.braceleft=348,A.bar=220,A.braceright=348,A.asciitilde=570,A.exclamdown=389,A.cent=500,A.sterling=500,A.fraction=167,A.yen=500,A.florin=500,A.section=500,A.currency=500,A.quotesingle=278,A.quotedblleft=500,A.guillemotleft=500,A.guilsinglleft=333,A.guilsinglright=333,A.fi=556,A.fl=556,A.endash=500,A.dagger=500,A.daggerdbl=500,A.periodcentered=250,A.paragraph=500,A.bullet=350,A.quotesinglbase=333,A.quotedblbase=500,A.quotedblright=500,A.guillemotright=500,A.ellipsis=1e3,A.perthousand=1e3,A.questiondown=500,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=1e3,A.AE=944,A.ordfeminine=266,A.Lslash=611,A.Oslash=722,A.OE=944,A.ordmasculine=300,A.ae=722,A.dotlessi=278,A.lslash=278,A.oslash=500,A.oe=722,A.germandbls=500,A.Idieresis=389,A.eacute=444,A.abreve=500,A.uhungarumlaut=556,A.ecaron=444,A.Ydieresis=611,A.divide=570,A.Yacute=611,A.Acircumflex=667,A.aacute=500,A.Ucircumflex=722,A.yacute=444,A.scommaaccent=389,A.ecircumflex=444,A.Uring=722,A.Udieresis=722,A.aogonek=500,A.Uacute=722,A.uogonek=556,A.Edieresis=667,A.Dcroat=722,A.commaaccent=250,A.copyright=747,A.Emacron=667,A.ccaron=444,A.aring=500,A.Ncommaaccent=722,A.lacute=278,A.agrave=500,A.Tcommaaccent=611,A.Cacute=667,A.atilde=500,A.Edotaccent=667,A.scaron=389,A.scedilla=389,A.iacute=278,A.lozenge=494,A.Rcaron=667,A.Gcommaaccent=722,A.ucircumflex=556,A.acircumflex=500,A.Amacron=667,A.rcaron=389,A.ccedilla=444,A.Zdotaccent=611,A.Thorn=611,A.Omacron=722,A.Racute=667,A.Sacute=556,A.dcaron=608,A.Umacron=722,A.uring=556,A.threesuperior=300,A.Ograve=722,A.Agrave=667,A.Abreve=667,A.multiply=570,A.uacute=556,A.Tcaron=611,A.partialdiff=494,A.ydieresis=444,A.Nacute=722,A.icircumflex=278,A.Ecircumflex=667,A.adieresis=500,A.edieresis=444,A.cacute=444,A.nacute=556,A.umacron=556,A.Ncaron=722,A.Iacute=389,A.plusminus=570,A.brokenbar=220,A.registered=747,A.Gbreve=722,A.Idotaccent=389,A.summation=600,A.Egrave=667,A.racute=389,A.omacron=500,A.Zacute=611,A.Zcaron=611,A.greaterequal=549,A.Eth=722,A.Ccedilla=667,A.lcommaaccent=278,A.tcaron=366,A.eogonek=444,A.Uogonek=722,A.Aacute=667,A.Adieresis=667,A.egrave=444,A.zacute=389,A.iogonek=278,A.Oacute=722,A.oacute=500,A.amacron=500,A.sacute=389,A.idieresis=278,A.Ocircumflex=722,A.Ugrave=722,A.Delta=612,A.thorn=500,A.twosuperior=300,A.Odieresis=722,A.mu=576,A.igrave=278,A.ohungarumlaut=500,A.Eogonek=667,A.dcroat=500,A.threequarters=750,A.Scedilla=556,A.lcaron=382,A.Kcommaaccent=667,A.Lacute=611,A.trademark=1e3,A.edotaccent=444,A.Igrave=389,A.Imacron=389,A.Lcaron=611,A.onehalf=750,A.lessequal=549,A.ocircumflex=500,A.ntilde=556,A.Uhungarumlaut=722,A.Eacute=667,A.emacron=444,A.gbreve=500,A.onequarter=750,A.Scaron=556,A.Scommaaccent=556,A.Ohungarumlaut=722,A.degree=400,A.ograve=500,A.Ccaron=667,A.ugrave=556,A.radical=549,A.Dcaron=722,A.rcommaaccent=389,A.Ntilde=722,A.otilde=500,A.Rcommaaccent=667,A.Lcommaaccent=611,A.Atilde=667,A.Aogonek=667,A.Aring=667,A.Otilde=722,A.zdotaccent=389,A.Ecaron=667,A.Iogonek=389,A.kcommaaccent=500,A.minus=606,A.Icircumflex=389,A.ncaron=556,A.tcommaaccent=278,A.logicalnot=606,A.odieresis=500,A.udieresis=556,A.notequal=549,A.gcommaaccent=500,A.eth=500,A.zcaron=389,A.ncommaaccent=556,A.onesuperior=300,A.imacron=278,A.Euro=500}),e["Times-Italic"]=he(function(A){A.space=250,A.exclam=333,A.quotedbl=420,A.numbersign=500,A.dollar=500,A.percent=833,A.ampersand=778,A.quoteright=333,A.parenleft=333,A.parenright=333,A.asterisk=500,A.plus=675,A.comma=250,A.hyphen=333,A.period=250,A.slash=278,A.zero=500,A.one=500,A.two=500,A.three=500,A.four=500,A.five=500,A.six=500,A.seven=500,A.eight=500,A.nine=500,A.colon=333,A.semicolon=333,A.less=675,A.equal=675,A.greater=675,A.question=500,A.at=920,A.A=611,A.B=611,A.C=667,A.D=722,A.E=611,A.F=611,A.G=722,A.H=722,A.I=333,A.J=444,A.K=667,A.L=556,A.M=833,A.N=667,A.O=722,A.P=611,A.Q=722,A.R=611,A.S=500,A.T=556,A.U=722,A.V=611,A.W=833,A.X=611,A.Y=556,A.Z=556,A.bracketleft=389,A.backslash=278,A.bracketright=389,A.asciicircum=422,A.underscore=500,A.quoteleft=333,A.a=500,A.b=500,A.c=444,A.d=500,A.e=444,A.f=278,A.g=500,A.h=500,A.i=278,A.j=278,A.k=444,A.l=278,A.m=722,A.n=500,A.o=500,A.p=500,A.q=500,A.r=389,A.s=389,A.t=278,A.u=500,A.v=444,A.w=667,A.x=444,A.y=444,A.z=389,A.braceleft=400,A.bar=275,A.braceright=400,A.asciitilde=541,A.exclamdown=389,A.cent=500,A.sterling=500,A.fraction=167,A.yen=500,A.florin=500,A.section=500,A.currency=500,A.quotesingle=214,A.quotedblleft=556,A.guillemotleft=500,A.guilsinglleft=333,A.guilsinglright=333,A.fi=500,A.fl=500,A.endash=500,A.dagger=500,A.daggerdbl=500,A.periodcentered=250,A.paragraph=523,A.bullet=350,A.quotesinglbase=333,A.quotedblbase=556,A.quotedblright=556,A.guillemotright=500,A.ellipsis=889,A.perthousand=1e3,A.questiondown=500,A.grave=333,A.acute=333,A.circumflex=333,A.tilde=333,A.macron=333,A.breve=333,A.dotaccent=333,A.dieresis=333,A.ring=333,A.cedilla=333,A.hungarumlaut=333,A.ogonek=333,A.caron=333,A.emdash=889,A.AE=889,A.ordfeminine=276,A.Lslash=556,A.Oslash=722,A.OE=944,A.ordmasculine=310,A.ae=667,A.dotlessi=278,A.lslash=278,A.oslash=500,A.oe=667,A.germandbls=500,A.Idieresis=333,A.eacute=444,A.abreve=500,A.uhungarumlaut=500,A.ecaron=444,A.Ydieresis=556,A.divide=675,A.Yacute=556,A.Acircumflex=611,A.aacute=500,A.Ucircumflex=722,A.yacute=444,A.scommaaccent=389,A.ecircumflex=444,A.Uring=722,A.Udieresis=722,A.aogonek=500,A.Uacute=722,A.uogonek=500,A.Edieresis=611,A.Dcroat=722,A.commaaccent=250,A.copyright=760,A.Emacron=611,A.ccaron=444,A.aring=500,A.Ncommaaccent=667,A.lacute=278,A.agrave=500,A.Tcommaaccent=556,A.Cacute=667,A.atilde=500,A.Edotaccent=611,A.scaron=389,A.scedilla=389,A.iacute=278,A.lozenge=471,A.Rcaron=611,A.Gcommaaccent=722,A.ucircumflex=500,A.acircumflex=500,A.Amacron=611,A.rcaron=389,A.ccedilla=444,A.Zdotaccent=556,A.Thorn=611,A.Omacron=722,A.Racute=611,A.Sacute=500,A.dcaron=544,A.Umacron=722,A.uring=500,A.threesuperior=300,A.Ograve=722,A.Agrave=611,A.Abreve=611,A.multiply=675,A.uacute=500,A.Tcaron=556,A.partialdiff=476,A.ydieresis=444,A.Nacute=667,A.icircumflex=278,A.Ecircumflex=611,A.adieresis=500,A.edieresis=444,A.cacute=444,A.nacute=500,A.umacron=500,A.Ncaron=667,A.Iacute=333,A.plusminus=675,A.brokenbar=275,A.registered=760,A.Gbreve=722,A.Idotaccent=333,A.summation=600,A.Egrave=611,A.racute=389,A.omacron=500,A.Zacute=556,A.Zcaron=556,A.greaterequal=549,A.Eth=722,A.Ccedilla=667,A.lcommaaccent=278,A.tcaron=300,A.eogonek=444,A.Uogonek=722,A.Aacute=611,A.Adieresis=611,A.egrave=444,A.zacute=389,A.iogonek=278,A.Oacute=722,A.oacute=500,A.amacron=500,A.sacute=389,A.idieresis=278,A.Ocircumflex=722,A.Ugrave=722,A.Delta=612,A.thorn=500,A.twosuperior=300,A.Odieresis=722,A.mu=500,A.igrave=278,A.ohungarumlaut=500,A.Eogonek=611,A.dcroat=500,A.threequarters=750,A.Scedilla=500,A.lcaron=300,A.Kcommaaccent=667,A.Lacute=556,A.trademark=980,A.edotaccent=444,A.Igrave=333,A.Imacron=333,A.Lcaron=611,A.onehalf=750,A.lessequal=549,A.ocircumflex=500,A.ntilde=500,A.Uhungarumlaut=722,A.Eacute=611,A.emacron=444,A.gbreve=500,A.onequarter=750,A.Scaron=500,A.Scommaaccent=500,A.Ohungarumlaut=722,A.degree=400,A.ograve=500,A.Ccaron=667,A.ugrave=500,A.radical=453,A.Dcaron=722,A.rcommaaccent=389,A.Ntilde=667,A.otilde=500,A.Rcommaaccent=611,A.Lcommaaccent=556,A.Atilde=611,A.Aogonek=611,A.Aring=611,A.Otilde=722,A.zdotaccent=389,A.Ecaron=611,A.Iogonek=333,A.kcommaaccent=444,A.minus=675,A.Icircumflex=333,A.ncaron=500,A.tcommaaccent=278,A.logicalnot=675,A.odieresis=500,A.udieresis=500,A.notequal=549,A.gcommaaccent=500,A.eth=500,A.zcaron=389,A.ncommaaccent=500,A.onesuperior=300,A.imacron=278,A.Euro=500}),e.ZapfDingbats=he(function(A){A.space=278,A.a1=974,A.a2=961,A.a202=974,A.a3=980,A.a4=719,A.a5=789,A.a119=790,A.a118=791,A.a117=690,A.a11=960,A.a12=939,A.a13=549,A.a14=855,A.a15=911,A.a16=933,A.a105=911,A.a17=945,A.a18=974,A.a19=755,A.a20=846,A.a21=762,A.a22=761,A.a23=571,A.a24=677,A.a25=763,A.a26=760,A.a27=759,A.a28=754,A.a6=494,A.a7=552,A.a8=537,A.a9=577,A.a10=692,A.a29=786,A.a30=788,A.a31=788,A.a32=790,A.a33=793,A.a34=794,A.a35=816,A.a36=823,A.a37=789,A.a38=841,A.a39=823,A.a40=833,A.a41=816,A.a42=831,A.a43=923,A.a44=744,A.a45=723,A.a46=749,A.a47=790,A.a48=792,A.a49=695,A.a50=776,A.a51=768,A.a52=792,A.a53=759,A.a54=707,A.a55=708,A.a56=682,A.a57=701,A.a58=826,A.a59=815,A.a60=789,A.a61=789,A.a62=707,A.a63=687,A.a64=696,A.a65=689,A.a66=786,A.a67=787,A.a68=713,A.a69=791,A.a70=785,A.a71=791,A.a72=873,A.a73=761,A.a74=762,A.a203=762,A.a75=759,A.a204=759,A.a76=892,A.a77=892,A.a78=788,A.a79=784,A.a81=438,A.a82=138,A.a83=277,A.a84=415,A.a97=392,A.a98=392,A.a99=668,A.a100=668,A.a89=390,A.a90=390,A.a93=317,A.a94=317,A.a91=276,A.a92=276,A.a205=509,A.a85=509,A.a206=410,A.a86=410,A.a87=234,A.a88=234,A.a95=334,A.a96=334,A.a101=732,A.a102=544,A.a103=544,A.a104=910,A.a106=667,A.a107=760,A.a108=760,A.a112=776,A.a111=595,A.a110=694,A.a109=626,A.a120=788,A.a121=788,A.a122=788,A.a123=788,A.a124=788,A.a125=788,A.a126=788,A.a127=788,A.a128=788,A.a129=788,A.a130=788,A.a131=788,A.a132=788,A.a133=788,A.a134=788,A.a135=788,A.a136=788,A.a137=788,A.a138=788,A.a139=788,A.a140=788,A.a141=788,A.a142=788,A.a143=788,A.a144=788,A.a145=788,A.a146=788,A.a147=788,A.a148=788,A.a149=788,A.a150=788,A.a151=788,A.a152=788,A.a153=788,A.a154=788,A.a155=788,A.a156=788,A.a157=788,A.a158=788,A.a159=788,A.a160=894,A.a161=838,A.a163=1016,A.a164=458,A.a196=748,A.a165=924,A.a192=748,A.a166=918,A.a167=927,A.a168=928,A.a169=928,A.a170=834,A.a171=873,A.a172=828,A.a173=924,A.a162=924,A.a174=917,A.a175=930,A.a176=931,A.a177=463,A.a178=883,A.a179=836,A.a193=836,A.a180=867,A.a199=867,A.a181=696,A.a200=696,A.a182=874,A.a201=874,A.a183=760,A.a184=946,A.a197=771,A.a185=865,A.a194=771,A.a198=888,A.a186=967,A.a195=888,A.a187=831,A.a188=873,A.a189=927,A.a190=970,A.a191=918})}),o2=he(function(e){e.Courier={ascent:629,descent:-157,capHeight:562,xHeight:-426},e["Courier-Bold"]={ascent:629,descent:-157,capHeight:562,xHeight:439},e["Courier-Oblique"]={ascent:629,descent:-157,capHeight:562,xHeight:426},e["Courier-BoldOblique"]={ascent:629,descent:-157,capHeight:562,xHeight:426},e.Helvetica={ascent:718,descent:-207,capHeight:718,xHeight:523},e["Helvetica-Bold"]={ascent:718,descent:-207,capHeight:718,xHeight:532},e["Helvetica-Oblique"]={ascent:718,descent:-207,capHeight:718,xHeight:523},e["Helvetica-BoldOblique"]={ascent:718,descent:-207,capHeight:718,xHeight:532},e["Times-Roman"]={ascent:683,descent:-217,capHeight:662,xHeight:450},e["Times-Bold"]={ascent:683,descent:-217,capHeight:676,xHeight:461},e["Times-Italic"]={ascent:683,descent:-217,capHeight:653,xHeight:441},e["Times-BoldItalic"]={ascent:683,descent:-217,capHeight:669,xHeight:462},e.Symbol={ascent:Math.NaN,descent:Math.NaN,capHeight:Math.NaN,xHeight:Math.NaN},e.ZapfDingbats={ascent:Math.NaN,descent:Math.NaN,capHeight:Math.NaN,xHeight:Math.NaN}}),I2=1<<0,vn=1<<1,qn=1<<2,z1=1<<3,zs=1<<4,$s=1<<5,c2=1<<6,Aa=1<<0,Tn=1<<1,l2=1<<3,h2=1<<5,C2=1<<6,B2=1<<7,xo=1<<8,UI=class{constructor({glyfTable:A,isGlyphLocationsLong:t,locaTable:i,numGlyphs:s}){this.glyphs=[];let a=new DataView(i.buffer,i.byteOffset,i.byteLength),n=new DataView(A.buffer,A.byteOffset,A.byteLength),r=t?4:2,g=t?a.getUint32(0):2*a.getUint16(0),o=0;for(let I=0;I<s;I++){o+=r;let c=t?a.getUint32(o):2*a.getUint16(o);if(c===g){this.glyphs.push(new S0({}));continue}let l=S0.parse(g,n);this.glyphs.push(l),g=c}}getSize(){return this.glyphs.reduce((A,t)=>{let i=t.getSize();return A+(i+3&-4)},0)}write(){let A=this.getSize(),t=new DataView(new ArrayBuffer(A)),i=A>131070,s=i?4:2,a=new DataView(new ArrayBuffer((this.glyphs.length+1)*s));i?a.setUint32(0,0):a.setUint16(0,0);let n=0,r=0;for(let g of this.glyphs)n+=g.write(n,t),n=n+3&-4,r+=s,i?a.setUint32(r,n):a.setUint16(r,n>>1);return{isLocationLong:i,loca:new Uint8Array(a.buffer),glyf:new Uint8Array(t.buffer)}}scale(A){for(let t=0,i=this.glyphs.length;t<i;t++)this.glyphs[t].scale(A[t])}},S0=class{constructor({header:A=null,simple:t=null,composites:i=null}){this.header=A,this.simple=t,this.composites=i}static parse(A,t){let[i,s]=Ha.parse(A,t);if(A+=i,s.numberOfContours<0){let n=[];for(;;){let[r,g]=Ya.parse(A,t);if(A+=r,n.push(g),!(g.flags&h2))break}return new S0({header:s,composites:n})}let a=Ja.parse(A,t,s.numberOfContours);return new S0({header:s,simple:a})}getSize(){if(!this.header)return 0;let A=this.simple?this.simple.getSize():this.composites.reduce((t,i)=>t+i.getSize(),0);return this.header.getSize()+A}write(A,t){if(!this.header)return 0;let i=A;if(A+=this.header.write(A,t),this.simple)A+=this.simple.write(A,t);else for(let s of this.composites)A+=s.write(A,t);return A-i}scale(A){if(!this.header)return;let t=(this.header.xMin+this.header.xMax)/2;if(this.header.scale(t,A),this.simple)this.simple.scale(t,A);else for(let i of this.composites)i.scale(t,A)}},Ha=class{constructor({numberOfContours:A,xMin:t,yMin:i,xMax:s,yMax:a}){this.numberOfContours=A,this.xMin=t,this.yMin=i,this.xMax=s,this.yMax=a}static parse(A,t){return[10,new Ha({numberOfContours:t.getInt16(A),xMin:t.getInt16(A+2),yMin:t.getInt16(A+4),xMax:t.getInt16(A+6),yMax:t.getInt16(A+8)})]}getSize(){return 10}write(A,t){return t.setInt16(A,this.numberOfContours),t.setInt16(A+2,this.xMin),t.setInt16(A+4,this.yMin),t.setInt16(A+6,this.xMax),t.setInt16(A+8,this.yMax),10}scale(A,t){this.xMin=Math.round(A+(this.xMin-A)*t),this.xMax=Math.round(A+(this.xMax-A)*t)}},MI=class{constructor({flags:A,xCoordinates:t,yCoordinates:i}){this.xCoordinates=t,this.yCoordinates=i,this.flags=A}},Ja=class{constructor({contours:A,instructions:t}){this.contours=A,this.instructions=t}static parse(A,t,i){let s=[];for(let Q=0;Q<i;Q++){let E=t.getUint16(A);A+=2,s.push(E)}let a=s[i-1]+1,n=t.getUint16(A);A+=2;let r=new Uint8Array(t).slice(A,A+n);A+=n;let g=[];for(let Q=0;Q<a;A++,Q++){let E=t.getUint8(A);if(g.push(E),E&z1){let f=t.getUint8(++A);E^=z1;for(let u=0;u<f;u++)g.push(E);Q+=f}}let o=[],I=[],c=[],l=[],h=[],C=0,B=0;for(let Q=0;Q<a;Q++){let E=g[Q];if(E&vn){let f=t.getUint8(A++);B+=E&zs?f:-f,I.push(B)}else E&zs||(B+=t.getInt16(A),A+=2),I.push(B);s[C]===Q&&(C++,o.push(I),I=[])}B=0,C=0;for(let Q=0;Q<a;Q++){let E=g[Q];if(E&qn){let f=t.getUint8(A++);B+=E&$s?f:-f,c.push(B)}else E&$s||(B+=t.getInt16(A),A+=2),c.push(B);l.push(E&I2|E&c2),s[C]===Q&&(I=o[C],C++,h.push(new MI({flags:l,xCoordinates:I,yCoordinates:c})),c=[],l=[])}return new Ja({contours:h,instructions:r})}getSize(){let A=this.contours.length*2+2+this.instructions.length,t=0,i=0;for(let s of this.contours){A+=s.flags.length;for(let a=0,n=s.xCoordinates.length;a<n;a++){let r=s.xCoordinates[a],g=s.yCoordinates[a],o=Math.abs(r-t);o>255?A+=2:o>0&&(A+=1),t=r,o=Math.abs(g-i),o>255?A+=2:o>0&&(A+=1),i=g}}return A}write(A,t){let i=A,s=[],a=[],n=[],r=0,g=0;for(let o of this.contours){for(let I=0,c=o.xCoordinates.length;I<c;I++){let l=o.flags[I],h=o.xCoordinates[I],C=h-r;if(C===0)l|=zs,s.push(0);else{let Q=Math.abs(C);Q<=255?(l|=C>=0?vn|zs:vn,s.push(Q)):s.push(C)}r=h;let B=o.yCoordinates[I];if(C=B-g,C===0)l|=$s,a.push(0);else{let Q=Math.abs(C);Q<=255?(l|=C>=0?qn|$s:qn,a.push(Q)):a.push(C)}g=B,n.push(l)}t.setUint16(A,s.length-1),A+=2}t.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length);for(let o of n)t.setUint8(A++,o);for(let o=0,I=s.length;o<I;o++){let c=s[o],l=n[o];l&vn?t.setUint8(A++,c):l&zs||(t.setInt16(A,c),A+=2)}for(let o=0,I=a.length;o<I;o++){let c=a[o],l=n[o];l&qn?t.setUint8(A++,c):l&$s||(t.setInt16(A,c),A+=2)}return A-i}scale(A,t){for(let i of this.contours)if(i.xCoordinates.length!==0)for(let s=0,a=i.xCoordinates.length;s<a;s++)i.xCoordinates[s]=Math.round(A+(i.xCoordinates[s]-A)*t)}},Ya=class{constructor({flags:A,glyphIndex:t,argument1:i,argument2:s,transf:a,instructions:n}){this.flags=A,this.glyphIndex=t,this.argument1=i,this.argument2=s,this.transf=a,this.instructions=n}static parse(A,t){let i=A,s=[],a=t.getUint16(A),n=t.getUint16(A+2);A+=4;let r,g;a&Aa?(a&Tn?(r=t.getInt16(A),g=t.getInt16(A+2)):(r=t.getUint16(A),g=t.getUint16(A+2)),A+=4,a^=Aa):(a&Tn?(r=t.getInt8(A),g=t.getInt8(A+1)):(r=t.getUint8(A),g=t.getUint8(A+1)),A+=2),a&l2?(s.push(t.getUint16(A)),A+=2):a&C2?(s.push(t.getUint16(A),t.getUint16(A+2)),A+=4):a&B2&&(s.push(t.getUint16(A),t.getUint16(A+2),t.getUint16(A+4),t.getUint16(A+6)),A+=8);let o=null;if(a&xo){let I=t.getUint16(A);A+=2,o=new Uint8Array(t).slice(A,A+I),A+=I}return[A-i,new Ya({flags:a,glyphIndex:n,argument1:r,argument2:g,transf:s,instructions:o})]}getSize(){let A=4+this.transf.length*2;return this.flags&xo&&(A+=2+this.instructions.length),A+=2,this.flags&2?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(A+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(A+=2),A}write(A,t){let i=A;return this.flags&Tn?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=Aa):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=Aa),t.setUint16(A,this.flags),t.setUint16(A+2,this.glyphIndex),A+=4,this.flags&Aa?(this.flags&Tn?(t.setInt16(A,this.argument1),t.setInt16(A+2,this.argument2)):(t.setUint16(A,this.argument1),t.setUint16(A+2,this.argument2)),A+=4):(t.setUint8(A,this.argument1),t.setUint8(A+1,this.argument2),A+=2),this.flags&xo&&(t.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length)),A-i}scale(A,t){}};function Pn(e,A,t){e[A]=t>>8&255,e[A+1]=t&255}function mo(e,A,t){e[A]=t>>24&255,e[A+1]=t>>16&255,e[A+2]=t>>8&255,e[A+3]=t&255}function Q2(e,A,t){if(t instanceof Uint8Array)e.set(t,A);else if(typeof t=="string")for(let i=0,s=t.length;i<s;i++)e[A++]=t.charCodeAt(i)&255;else for(let i of t)e[A++]=i&255}var $1=12,AE=16,F0=class{constructor(A){this.sfnt=A,this.tables=Object.create(null)}static getSearchParams(A,t){let i=1,s=0;for(;(i^A)>i;)i<<=1,s++;let a=i*t;return{range:a,entry:s,rangeShift:t*A-a}}toArray(){let A=this.sfnt,t=this.tables,i=Object.keys(t);i.sort();let s=i.length,a,n,r,g,o,I=$1+s*AE,c=[I];for(a=0;a<s;a++){g=t[i[a]];let C=(g.length+3&-4)>>>0;I+=C,c.push(I)}let l=new Uint8Array(I);for(a=0;a<s;a++)g=t[i[a]],Q2(l,c[a],g);A==="true"&&(A=qe(65536)),l[0]=A.charCodeAt(0)&255,l[1]=A.charCodeAt(1)&255,l[2]=A.charCodeAt(2)&255,l[3]=A.charCodeAt(3)&255,Pn(l,4,s);let h=F0.getSearchParams(s,16);for(Pn(l,6,h.range),Pn(l,8,h.entry),Pn(l,10,h.rangeShift),I=$1,a=0;a<s;a++){o=i[a],l[I]=o.charCodeAt(0)&255,l[I+1]=o.charCodeAt(1)&255,l[I+2]=o.charCodeAt(2)&255,l[I+3]=o.charCodeAt(3)&255;let C=0;for(n=c[a],r=c[a+1];n<r;n+=4){let B=le(l,n);C=C+B>>>0}mo(l,I+4,C),mo(l,I+8,c[a]),mo(l,I+12,t[o].length),I+=AE}return l}addTable(A,t){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=t}},la=!1,Fe={hstem:[1],vstem:[3],vmoveto:[4],rlineto:[5],hlineto:[6],vlineto:[7],rrcurveto:[8],callsubr:[10],flex:[12,35],drop:[12,18],endchar:[14],rmoveto:[21],hmoveto:[22],vhcurveto:[30],hvcurveto:[31]},LI=class{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,t,i){let s=A.length,a=!1,n,r,g;for(let o=0;o<s;o++){let I=A[o];if(I<32){switch(I===12&&(I=(I<<8)+A[++o]),I){case 1:if(!la){this.stack=[];break}a=this.executeCommand(2,Fe.hstem);break;case 3:if(!la){this.stack=[];break}a=this.executeCommand(2,Fe.vstem);break;case 4:if(this.flexing){if(this.stack.length<1){a=!0;break}let B=this.stack.pop();this.stack.push(0,B);break}a=this.executeCommand(1,Fe.vmoveto);break;case 5:a=this.executeCommand(2,Fe.rlineto);break;case 6:a=this.executeCommand(1,Fe.hlineto);break;case 7:a=this.executeCommand(1,Fe.vlineto);break;case 8:a=this.executeCommand(6,Fe.rrcurveto);break;case 9:this.stack=[];break;case 10:if(this.stack.length<1){a=!0;break}if(g=this.stack.pop(),!t[g]){a=!0;break}a=this.convert(t[g],t,i);break;case 11:return a;case 13:if(this.stack.length<2){a=!0;break}n=this.stack.pop(),r=this.stack.pop(),this.lsb=r,this.width=n,this.stack.push(n,r),a=this.executeCommand(2,Fe.hmoveto);break;case 14:this.output.push(Fe.endchar[0]);break;case 21:if(this.flexing)break;a=this.executeCommand(2,Fe.rmoveto);break;case 22:if(this.flexing){this.stack.push(0);break}a=this.executeCommand(1,Fe.hmoveto);break;case 30:a=this.executeCommand(4,Fe.vhcurveto);break;case 31:a=this.executeCommand(4,Fe.hvcurveto);break;case(12<<8)+0:this.stack=[];break;case(12<<8)+1:if(!la){this.stack=[];break}a=this.executeCommand(2,Fe.vstem);break;case(12<<8)+2:if(!la){this.stack=[];break}a=this.executeCommand(2,Fe.hstem);break;case(12<<8)+6:if(i){let B=this.stack.at(-5);this.seac=this.stack.splice(-4,4),this.seac[0]+=this.lsb-B,a=this.executeCommand(0,Fe.endchar)}else a=this.executeCommand(4,Fe.endchar);break;case(12<<8)+7:if(this.stack.length<4){a=!0;break}this.stack.pop(),n=this.stack.pop();let c=this.stack.pop();r=this.stack.pop(),this.lsb=r,this.width=n,this.stack.push(n,r,c),a=this.executeCommand(3,Fe.rmoveto);break;case(12<<8)+12:if(this.stack.length<2){a=!0;break}let l=this.stack.pop(),h=this.stack.pop();this.stack.push(h/l);break;case(12<<8)+16:if(this.stack.length<2){a=!0;break}g=this.stack.pop();let C=this.stack.pop();if(g===0&&C===3){let B=this.stack.splice(-17,17);this.stack.push(B[2]+B[0],B[3]+B[1],B[4],B[5],B[6],B[7],B[8],B[9],B[10],B[11],B[12],B[13],B[14]),a=this.executeCommand(13,Fe.flex,!0),this.flexing=!1,this.stack.push(B[15],B[16])}else g===1&&C===0&&(this.flexing=!0);break;case(12<<8)+17:break;case(12<<8)+33:this.stack=[];break;default:k(\'Unknown type 1 charstring command of "\'+I+\'"\');break}if(a)break;continue}else I<=246?I-=139:I<=250?I=(I-247)*256+A[++o]+108:I<=254?I=-((I-251)*256)-A[++o]-108:I=(A[++o]&255)<<24|(A[++o]&255)<<16|(A[++o]&255)<<8|(A[++o]&255)<<0;this.stack.push(I)}return a}executeCommand(A,t,i){let s=this.stack.length;if(A>s)return!0;let a=s-A;for(let n=a;n<s;n++){let r=this.stack[n];Number.isInteger(r)?this.output.push(28,r>>8&255,r&255):(r=65536*r|0,this.output.push(255,r>>24&255,r>>16&255,r>>8&255,r&255))}return this.output.push(...t),i?this.stack.splice(a,A):this.stack.length=0,!1}},eE=55665,E2=4330;function _t(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function tE(e,A,t){if(t>=e.length)return new Uint8Array(0);let i=52845,s=22719,a=A|0,n,r;for(n=0;n<t;n++)a=(e[n]+a)*i+s&(1<<16)-1;let g=e.length-t,o=new Uint8Array(g);for(n=t,r=0;r<g;n++,r++){let I=e[n];o[r]=I^a>>8,a=(I+a)*i+s&(1<<16)-1}return o}function f2(e,A,t){let a=A|0,n=e.length,r=n>>>1,g=new Uint8Array(r),o,I;for(o=0,I=0;o<n;o++){let c=e[o];if(!_t(c))continue;o++;let l;for(;o<n&&!_t(l=e[o]);)o++;if(o<n){let h=parseInt(String.fromCharCode(c,l),16);g[I++]=h^a>>8,a=(h+a)*52845+22719&(1<<16)-1}}return g.slice(t,I)}function iE(e){return e===47||e===91||e===93||e===123||e===125||e===40||e===41}var Mr=class{constructor(A,t,i){if(t){let s=A.getBytes(),a=!((_t(s[0])||pt(s[0]))&&_t(s[1])&&_t(s[2])&&_t(s[3])&&_t(s[4])&&_t(s[5])&&_t(s[6])&&_t(s[7]));A=new Ie(a?tE(s,eE,4):f2(s,eE,4))}this.seacAnalysisEnabled=!!i,this.stream=A,this.nextChar()}readNumberArray(){this.getToken();let A=[];for(;;){let t=this.getToken();if(t===null||t==="]"||t==="}")break;A.push(parseFloat(t||0))}return A}readNumber(){let A=this.getToken();return parseFloat(A||0)}readInt(){let A=this.getToken();return parseInt(A||0,10)|0}readBoolean(){return this.getToken()==="true"?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){return this.stream.skip(-2),this.currentChar=this.stream.getByte()}getToken(){let A=!1,t=this.currentChar;for(;;){if(t===-1)return null;if(A)(t===10||t===13)&&(A=!1);else if(t===37)A=!0;else if(!pt(t))break;t=this.nextChar()}if(iE(t))return this.nextChar(),String.fromCharCode(t);let i="";do i+=String.fromCharCode(t),t=this.nextChar();while(t>=0&&!pt(t)&&!iE(t));return i}readCharStrings(A,t){return t===-1?A:tE(A,E2,t)}extractFontProgram(A){let t=this.stream,i=[],s=[],a=Object.create(null);a.lenIV=4;let n={subrs:[],charstrings:[],properties:{privateData:a}},r,g,o,I;for(;(r=this.getToken())!==null;)if(r==="/")switch(r=this.getToken(),r){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();r=this.getToken(),!(r===null||r==="end");){if(r!=="/")continue;let l=this.getToken();g=this.readInt(),this.getToken(),o=g>0?t.getBytes(g):new Uint8Array(0),I=n.properties.privateData.lenIV;let h=this.readCharStrings(o,I);this.nextChar(),r=this.getToken(),r==="noaccess"?this.getToken():r==="/"&&this.prevChar(),s.push({glyph:l,encoded:h})}break;case"Subrs":for(this.readInt(),this.getToken();this.getToken()==="dup";){let l=this.readInt();g=this.readInt(),this.getToken(),o=g>0?t.getBytes(g):new Uint8Array(0),I=n.properties.privateData.lenIV;let h=this.readCharStrings(o,I);this.nextChar(),r=this.getToken(),r==="noaccess"&&this.getToken(),i[l]=h}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":let c=this.readNumberArray();c.length>0&&c.length%2===0&&la&&(n.properties.privateData[r]=c);break;case"StemSnapH":case"StemSnapV":n.properties.privateData[r]=this.readNumberArray();break;case"StdHW":case"StdVW":n.properties.privateData[r]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":n.properties.privateData[r]=this.readNumber();break;case"ExpansionFactor":n.properties.privateData[r]=this.readNumber()||.06;break;case"ForceBold":n.properties.privateData[r]=this.readBoolean();break}for(let{encoded:c,glyph:l}of s){let h=new LI,C=h.convert(c,i,this.seacAnalysisEnabled),B=h.output;C&&(B=[14]);let Q={glyphName:l,charstring:B,width:h.width,lsb:h.lsb,seac:h.seac};if(l===".notdef"?n.charstrings.unshift(Q):n.charstrings.push(Q),A.builtInEncoding){let E=A.builtInEncoding.indexOf(l);E>-1&&A.widths[E]===void 0&&E>=A.firstChar&&E<=A.lastChar&&(A.widths[E]=h.width)}}return n}extractFontHeader(A){let t;for(;(t=this.getToken())!==null;)if(t==="/")switch(t=this.getToken(),t){case"FontMatrix":let i=this.readNumberArray();A.fontMatrix=i;break;case"Encoding":let s=this.getToken(),a;if(!/^\\d+$/.test(s))a=Ua(s);else{a=[];let r=parseInt(s,10)|0;this.getToken();for(let g=0;g<r;g++){for(t=this.getToken();t!=="dup"&&t!=="def";)if(t=this.getToken(),t===null)return;if(t==="def")break;let o=this.readInt();this.getToken();let I=this.getToken();a[o]=I,this.getToken()}}A.builtInEncoding=a;break;case"FontBBox":let n=this.readNumberArray();A.ascent=Math.max(n[3],n[1]),A.descent=Math.min(n[1],n[3]),A.ascentScaled=!0;break}}};function sE(e,A,t){let i=e.length,s=A.length,a=i-s,n=t,r=!1;for(;n<a;){let g=0;for(;g<s&&e[n+g]===A[g];)g++;if(g>=s){for(n+=g;n<i&&pt(e[n]);)n++;r=!0;break}n++}return{found:r,length:n}}function u2(e,A){let t=[101,101,120,101,99],i=e.pos,s,a,n;try{s=e.getBytes(A),a=s.length}catch(o){}if(a===A&&(n=sE(s,t,A-2*t.length),n.found&&n.length===A))return{stream:new Ie(s),length:A};k(\'Invalid "Length1" property in Type1 font -- trying to recover.\'),e.pos=i;let r=2048,g;for(;;){let o=e.peekBytes(r);if(n=sE(o,t,0),n.length===0)break;if(e.pos+=n.length,n.found){g=e.pos-i;break}}return e.pos=i,g?{stream:new Ie(e.getBytes(g)),length:g}:(k(\'Unable to recover "Length1" property in Type1 font -- using as is.\'),{stream:new Ie(e.getBytes(A)),length:A})}function d2(e,A){let t=e.getBytes();if(t.length===0)throw new v("getEexecBlock - no font program found.");return{stream:new Ie(t),length:t.length}}var HI=class{constructor(A,t,i){let a=i.length1,n=i.length2,r=t.peekBytes(6),g=r[0]===128&&r[1]===1;g&&(t.skip(6),a=r[5]<<24|r[4]<<16|r[3]<<8|r[2]);let o=u2(t,a);new Mr(o.stream,!1,Cs).extractFontHeader(i),g&&(r=t.getBytes(6),n=r[5]<<24|r[4]<<16|r[3]<<8|r[2]);let c=d2(t,n),h=new Mr(c.stream,!0,Cs).extractFontProgram(i);for(let E in h.properties)i[E]=h.properties[E];let C=h.charstrings,B=this.getType2Charstrings(C),Q=this.getType2Subrs(h.subrs);this.charstrings=C,this.data=this.wrap(A,B,this.charstrings,Q,i),this.seacs=this.getSeacs(h.charstrings)}get numGlyphs(){return this.charstrings.length+1}getCharset(){let A=[".notdef"];for(let{glyphName:t}of this.charstrings)A.push(t);return A}getGlyphMapping(A){let t=this.charstrings;if(A.composite){let r=Object.create(null);for(let g=0,o=t.length;g<o;g++){let I=A.cMap.charCodeOf(g);r[I]=g+1}return r}let i=[".notdef"],s,a;for(a=0;a<t.length;a++)i.push(t[a].glyphName);let n=A.builtInEncoding;if(n){s=Object.create(null);for(let r in n)a=i.indexOf(n[r]),a>=0&&(s[r]=a)}return ff(A,s,i)}hasGlyphId(A){return A<0||A>=this.numGlyphs?!1:A===0?!0:this.charstrings[A-1].charstring.length>0}getSeacs(A){let t=[];for(let i=0,s=A.length;i<s;i++){let a=A[i];a.seac&&(t[i+1]=a.seac)}return t}getType2Charstrings(A){let t=[];for(let i of A)t.push(i.charstring);return t}getType2Subrs(A){let t=0,i=A.length;i<1133?t=107:i<33769?t=1131:t=32768;let s=[],a;for(a=0;a<t;a++)s.push([11]);for(a=0;a<i;a++)s.push(A[a]);return s}wrap(A,t,i,s,a){let n=new Sr;n.header=new Fr(1,0,4,4),n.names=[A];let r=new b0;r.setByName("version",391),r.setByName("Notice",392),r.setByName("FullName",393),r.setByName("FamilyName",394),r.setByName("Weight",395),r.setByName("Encoding",null),r.setByName("FontMatrix",a.fontMatrix),r.setByName("FontBBox",a.bbox),r.setByName("charset",null),r.setByName("CharStrings",null),r.setByName("Private",null),n.topDict=r;let g=new La;g.add("Version 0.11"),g.add("See original notice"),g.add(A),g.add(A),g.add("Medium"),n.strings=g,n.globalSubrIndex=new ai;let o=t.length,I=[".notdef"],c,l;for(c=0;c<o;c++){let f=i[c].glyphName;nr.indexOf(f)===-1&&g.add(f),I.push(f)}n.charset=new C0(!1,0,I);let h=new ai;for(h.add([139,14]),c=0;c<o;c++)h.add(t[c]);n.charStrings=h;let C=new D0;C.setByName("Subrs",null);let B=["BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StemSnapH","StemSnapV","BlueShift","BlueFuzz","BlueScale","LanguageGroup","ExpansionFactor","ForceBold","StdHW","StdVW"];for(c=0,l=B.length;c<l;c++){let f=B[c];if(!(f in a.privateData))continue;let u=a.privateData[f];if(Array.isArray(u))for(let d=u.length-1;d>0;d--)u[d]-=u[d-1];C.setByName(f,u)}n.topDict.privateDict=C;let Q=new ai;for(c=0,l=s.length;c<l;c++)Q.add(s[c]);return C.subrsIndex=Q,new k0(n).compile()}},oi=[[57344,63743],[1048576,1114109]],n0=1e3,aE=["ascent","bbox","black","bold","charProcOperatorList","composite","cssFontInfo","data","defaultVMetrics","defaultWidth","descent","fallbackName","fontMatrix","isInvalidPDFjsFont","isType3Font","italic","loadedName","mimetype","missingFile","name","remeasure","subtype","systemFontInfo","type","vertical"],x2=["cMap","defaultEncoding","differences","isMonospace","isSerifFont","isSymbolicFont","seacMap","toFontChar","toUnicode","vmetrics","widths"];function po(e){if(!e.fontMatrix||e.fontMatrix[0]===E0[0])return;let A=.001/e.fontMatrix[0],t=e.widths;for(let i in t)t[i]*=A;e.defaultWidth*=A}function m2(e,A,t){if(e.isInternalFont||e.hasIncludedToUnicodeMap||e.hasEncoding||e.toUnicode instanceof Ct||!A||t.length===0||e.defaultEncoding===Ga)return;for(let n of t)if(!mf(n))return;let i=Ga,s=[],a=Ai();for(let n in i){let r=i[n];if(r==="")continue;let g=a[r];g!==void 0&&(s[n]=String.fromCharCode(g))}s.length>0&&e.toUnicode.amend(s)}function p2(e,A){if(e.isInternalFont||e.hasIncludedToUnicodeMap||A===e.defaultEncoding||e.toUnicode instanceof Ct)return;let t=[],i=Ai();for(let s in A){if(e.hasEncoding&&(e.baseEncodingName||e.differences[s]!==void 0))continue;let a=A[s],n=Us(a,i);n!==-1&&(t[s]=String.fromCharCode(n))}t.length>0&&e.toUnicode.amend(t)}function nE(e){if(!e.fallbackToUnicode||e.toUnicode instanceof Ct)return;let A=[];for(let t in e.fallbackToUnicode)e.toUnicode.has(t)||(A[t]=e.fallbackToUnicode[t]);A.length>0&&e.toUnicode.amend(A)}var JI=class{constructor(A,t,i,s,a,n,r,g,o){this.originalCharCode=A,this.fontChar=t,this.unicode=i,this.accent=s,this.width=a,this.vmetric=n,this.operatorListId=r,this.isSpace=g,this.isInFont=o}get category(){return nA(this,"category",$d(this.unicode),!0)}};function i0(e,A){return(e<<8)+A}function ea(e,A,t){e[A+1]=t,e[A]=t>>>8}function Dt(e,A){let t=(e<<8)+A;return t&1<<15?t-65536:t}function w2(e,A,t){e[A+3]=t&255,e[A+2]=t>>>8,e[A+1]=t>>>16,e[A]=t>>>24}function y2(e,A,t,i){return(e<<24)+(A<<16)+(t<<8)+i}function zA(e){return String.fromCharCode(e>>8&255,e&255)}function s0(e){return e>32767?e=32767:e<-32768&&(e=-32768),String.fromCharCode(e>>8&255,e&255)}function b2(e){let A=e.peekBytes(4);return le(A,0)===65536||Qt(A)==="true"}function xf(e){let A=e.peekBytes(4);return Qt(A)==="ttcf"}function D2(e){let A=e.peekBytes(4);return Qt(A)==="OTTO"}function k2(e){let A=e.peekBytes(2);return A[0]===37&&A[1]===33||A[0]===128&&A[1]===1}function S2(e){let A=e.peekBytes(4);return A[0]>=1&&A[3]>=1&&A[3]<=4}function F2(e,{type:A,subtype:t,composite:i}){let s,a;return b2(e)||xf(e)?s=i?"CIDFontType2":"TrueType":D2(e)?s=i?"CIDFontType2":"OpenType":k2(e)?i?s="CIDFontType0":s=A==="MMType1"?"MMType1":"Type1":S2(e)?i?(s="CIDFontType0",a="CIDFontType0C"):(s=A==="MMType1"?"MMType1":"Type1",a="Type1C"):(k("getFontFileType: Unable to detect correct font file Type/Subtype."),s=A,a=t),[s,a]}function Wn(e,A){for(let t in A)e[+t]=A[t]}function wo(e,A,t){let i=[],s;for(let a=0,n=e.length;a<n;a++)s=Us(e[a],A),s!==-1&&(i[a]=s);for(let a in t)s=Us(t[a],A),s!==-1&&(i[+a]=s);return i}function R2(e){return e.platform===1&&e.encoding===0&&e.language===0}function mf(e){return e.platform===3&&e.encoding===1&&e.language===1033}function yo(e,A,t=!1){switch(A.length){case 1:return A.charCodeAt(0);case 2:return A.charCodeAt(0)<<8|A.charCodeAt(1)}let i=`Unsupported CID string (charCode ${e}): "${A}".`;if(t)throw new v(i);return k(i),A}function rE(e,A,t,i){let s=Object.create(null),a=new Map,n=[],r=new Set,g=0,I=oi[g][0],c=oi[g][1],l=h=>oi[0][0]<=h&&h<=oi[0][1]||oi[1][0]<=h&&h<=oi[1][1];for(let h in e){let C=e[h];if(!A(C))continue;if(I>c){if(g++,g>=oi.length){k("Ran out of space in font private use area.");break}I=oi[g][0],c=oi[g][1]}let B=I++;C===0&&(C=t);let Q=i.get(h);typeof Q=="string"&&(Q=Q.codePointAt(0)),Q&&!l(Q)&&!r.has(C)&&(a.set(Q,C),r.add(C)),s[B]=C,n[h]=B}return{toFontChar:n,charCodeToGlyphId:s,toUnicodeExtraMap:a,nextAvailableFontCharCode:I}}function N2(e,A,t){let i=[];for(let n in e)e[n]>=t||i.push({fontCharCode:n|0,glyphId:e[n]});if(A)for(let[n,r]of A)r>=t||i.push({fontCharCode:n,glyphId:r});i.length===0&&i.push({fontCharCode:0,glyphId:0}),i.sort(function(r,g){return r.fontCharCode-g.fontCharCode});let s=[],a=i.length;for(let n=0;n<a;){let r=i[n].fontCharCode,g=[i[n].glyphId];++n;let o=r;for(;n<a&&o+1===i[n].fontCharCode&&(g.push(i[n].glyphId),++o,++n,o!==65535););s.push([r,o,g])}return s}function gE(e,A,t){let i=N2(e,A,t),s=i.at(-1)[1]>65535?2:1,a="\\0\\0"+zA(s)+"\\0\\0"+qe(4+s*8),n,r,g,o;for(n=i.length-1;n>=0&&!(i[n][0]<=65535);--n);let I=n+1;i[n][0]<65535&&i[n][1]===65535&&(i[n][1]=65534);let c=i[n][1]<65535?1:0,l=I+c,h=F0.getSearchParams(l,2),C="",B="",Q="",E="",f="",u=0,d,x,p,m;for(n=0,r=I;n<r;n++){d=i[n],x=d[0],p=d[1],C+=zA(x),B+=zA(p),m=d[2];let Y=!0;for(g=1,o=m.length;g<o;++g)if(m[g]!==m[g-1]+1){Y=!1;break}if(Y){let U=m[0];Q+=zA(U-x&65535),E+=zA(0)}else{let U=(l-n)*2+u*2;for(u+=p-x+1,Q+=zA(0),E+=zA(U),g=0,o=m.length;g<o;++g)f+=zA(m[g])}}c>0&&(B+="\\xFF\\xFF",C+="\\xFF\\xFF",Q+="\\0",E+="\\0\\0");let D="\\0\\0"+zA(2*l)+zA(h.range)+zA(h.entry)+zA(h.rangeShift)+B+"\\0\\0"+C+Q+E+f,S="",w="";if(s>1){for(a+=`\\0\\0\n`+qe(4+s*8+4+D.length),S="",n=0,r=i.length;n<r;n++){d=i[n],x=d[0],m=d[2];let Y=m[0];for(g=1,o=m.length;g<o;++g)m[g]!==m[g-1]+1&&(p=d[0]+g-1,S+=qe(x)+qe(p)+qe(Y),x=p+1,Y=m[g]);S+=qe(x)+qe(d[1])+qe(Y)}w="\\0\\f\\0\\0"+qe(S.length+16)+"\\0\\0\\0\\0"+qe(S.length/12)}return a+"\\0"+zA(D.length+4)+D+w+S}function G2(e,A){A.pos=(A.start||0)+e.offset;let t=A.getUint16();A.skip(60);let i=A.getUint16();if(t<4&&i&768)return!1;let s=A.getUint16(),a=A.getUint16();return s>a||(A.skip(6),A.getUint16()===0)?!1:(e.data[8]=e.data[9]=0,!0)}function oE(e,A,t){t||(t={unitsPerEm:0,yMax:0,yMin:0,ascent:0,descent:0});let i=0,s=0,a=0,n=0,r=null,g=0,o=-1;if(A){for(let E in A)if(E|=0,(r>E||!r)&&(r=E),g<E&&(g=E),o=_d(E,o),o<32)i|=1<<o;else if(o<64)s|=1<<o-32;else if(o<96)a|=1<<o-64;else if(o<123)n|=1<<o-96;else throw new v("Unicode ranges Bits > 123 are reserved for internal usage");g>65535&&(g=65535)}else r=0,g=255;let I=e.bbox||[0,0,0,0],c=t.unitsPerEm||(e.fontMatrix?1/Math.max(...e.fontMatrix.slice(0,4).map(Math.abs)):1e3),l=e.ascentScaled?1:c/n0,h=t.ascent||Math.round(l*(e.ascent||I[3])),C=t.descent||Math.round(l*(e.descent||I[1]));C>0&&e.descent>0&&I[1]<0&&(C=-C);let B=t.yMax||h,Q=-t.yMin||-C;return"\\0$\\xF4\\0\\0\\0\\x8A\\xBB\\0\\0\\0\\x8C\\x8A\\xBB\\0\\0\\xDF\\x001\\0\\0\\0\\0"+String.fromCharCode(e.fixedPitch?9:0)+"\\0\\0\\0\\0\\0\\0"+qe(i)+qe(s)+qe(a)+qe(n)+"*21*"+zA(e.italicAngle?1:0)+zA(r||e.firstChar)+zA(g||e.lastChar)+zA(h)+zA(C)+"\\0d"+zA(B)+zA(Q)+"\\0\\0\\0\\0\\0\\0\\0\\0"+zA(e.xHeight)+zA(e.capHeight)+zA(0)+zA(r||e.firstChar)+"\\0"}function IE(e){let A=Math.floor(e.italicAngle*65536);return"\\0\\0\\0"+qe(A)+"\\0\\0\\0\\0"+qe(e.fixedPitch?1:0)+"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"}function U2(e){return e.replaceAll(/[^\\x21-\\x7E]|[[\\](){}<>/%]/g,"").slice(0,63)}function bo(e,A){A||(A=[[],[]]);let t=[A[0][0]||"Original licence",A[0][1]||e,A[0][2]||"Unknown",A[0][3]||"uniqueID",A[0][4]||e,A[0][5]||"Version 0.11",A[0][6]||U2(e),A[0][7]||"Unknown",A[0][8]||"Unknown",A[0][9]||"Unknown"],i=[],s,a,n,r,g;for(s=0,a=t.length;s<a;s++){g=A[1][s]||t[s];let Q=[];for(n=0,r=g.length;n<r;n++)Q.push(zA(g.charCodeAt(n)));i.push(Q.join(""))}let o=[t,i],I=["\\0","\\0"],c=["\\0\\0","\\0"],l=["\\0\\0","	"],h=t.length*I.length,C="\\0\\0"+zA(h)+zA(h*12+6),B=0;for(s=0,a=I.length;s<a;s++){let Q=o[s];for(n=0,r=Q.length;n<r;n++){g=Q[n];let E=I[s]+c[s]+l[s]+zA(n)+zA(g.length)+zA(B);C+=E,B+=g.length}}return C+=t.join("")+i.join(""),C}var Lr=class{constructor(A,t,i){var o;this.name=A,this.psName=null,this.mimetype=null,this.disableFontFace=!1,this.loadedName=i.loadedName,this.isType3Font=i.isType3Font,this.missingFile=!1,this.cssFontInfo=i.cssFontInfo,this._charsCache=Object.create(null),this._glyphCache=Object.create(null);let s=!!(i.flags&Ft.Serif);if(!s&&!i.isSimulatedFlags){let I=A.replaceAll(/[,_]/g,"-").split("-",1)[0],c=C1();for(let l of I.split("+"))if(c[l]){s=!0;break}}this.isSerifFont=s,this.isSymbolicFont=!!(i.flags&Ft.Symbolic),this.isMonospace=!!(i.flags&Ft.FixedPitch);let{type:a,subtype:n}=i;this.type=a,this.subtype=n,this.systemFontInfo=i.systemFontInfo;let r=A.match(/^InvalidPDFjsFont_(.*)_\\d+$/);if(this.isInvalidPDFjsFont=!!r,this.isInvalidPDFjsFont?this.fallbackName=r[1]:this.isMonospace?this.fallbackName="monospace":this.isSerifFont?this.fallbackName="serif":this.fallbackName="sans-serif",(o=this.systemFontInfo)!=null&&o.guessFallback&&(this.systemFontInfo.guessFallback=!1,this.systemFontInfo.css+=`,${this.fallbackName}`),this.differences=i.differences,this.widths=i.widths,this.defaultWidth=i.defaultWidth,this.composite=i.composite,this.cMap=i.cMap,this.capHeight=i.capHeight/n0,this.ascent=i.ascent/n0,this.descent=i.descent/n0,this.lineHeight=this.ascent-this.descent,this.fontMatrix=i.fontMatrix,this.bbox=i.bbox,this.defaultEncoding=i.defaultEncoding,this.toUnicode=i.toUnicode,this.toFontChar=[],i.type==="Type3"){for(let I=0;I<256;I++)this.toFontChar[I]=this.differences[I]||i.defaultEncoding[I];return}if(this.cidEncoding=i.cidEncoding||"",this.vertical=!!i.vertical,this.vertical&&(this.vmetrics=i.vmetrics,this.defaultVMetrics=i.defaultVMetrics),!t||t.isEmpty){t&&k(\'Font file is empty in "\'+A+\'" (\'+this.loadedName+")"),this.fallbackToSystemFont(i);return}[a,n]=F2(t,i),(a!==this.type||n!==this.subtype)&&PA(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${a}/${n}.`);let g;try{switch(a){case"MMType1":PA("MMType1 font ("+A+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";let I=n==="Type1C"||n==="CIDFontType0C"?new Ea(t,i):new HI(A,t,i);po(i),g=this.convert(A,I,i);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",g=this.checkAndRepair(A,t,i),this.isOpenType&&(po(i),a="OpenType");break;default:throw new v(`Font ${a} is not supported`)}}catch(I){k(I),this.fallbackToSystemFont(i);return}nE(i),this.data=g,this.type=a,this.subtype=n,this.fontMatrix=i.fontMatrix,this.widths=i.widths,this.defaultWidth=i.defaultWidth,this.toUnicode=i.toUnicode,this.seacMap=i.seacMap}get renderer(){let A=GI.create(this,Cs);return nA(this,"renderer",A)}exportData(A=!1){let t=A?[...aE,...x2]:aE,i=Object.create(null),s,a;for(s of t)a=this[s],a!==void 0&&(i[s]=a);return i}fallbackToSystemFont(A){this.missingFile=!0;let{name:t,type:i}=this,s=pn(t),a=zg(),n=uf(),r=!!a[s],g=!!(n[s]&&a[n[s]]);s=a[s]||n[s]||s;let I=o2()[s];I&&(isNaN(this.ascent)&&(this.ascent=I.ascent/n0),isNaN(this.descent)&&(this.descent=I.descent/n0),isNaN(this.capHeight)&&(this.capHeight=I.capHeight/n0)),this.bold=/bold/gi.test(s),this.italic=/oblique|italic/gi.test(s),this.black=/Black/g.test(t);let c=/Narrow/g.test(t);if(this.remeasure=(!r||c)&&Object.keys(this.widths).length>0,(r||g)&&i==="CIDFontType2"&&this.cidEncoding.startsWith("Identity-")){let l=A.cidToGidMap,h=[];if(Wn(h,Z1()),/Arial-?Black/i.test(t)?Wn(h,i2()):/Calibri/i.test(t)&&Wn(h,s2()),l){for(let C in h){let B=h[C];l[B]!==void 0&&(h[+C]=l[B])}l.length!==this.toUnicode.length&&A.hasIncludedToUnicodeMap&&this.toUnicode instanceof Ct&&this.toUnicode.forEach(function(C,B){let Q=h[C];l[Q]===void 0&&(h[+C]=B)})}this.toUnicode instanceof Ct||this.toUnicode.forEach(function(C,B){h[+C]=B}),this.toFontChar=h,this.toUnicode=new B0(h)}else if(/Symbol/i.test(s))this.toFontChar=wo(l1,Ai(),this.differences);else if(/Dingbats/i.test(s))this.toFontChar=wo(h1,jd(),this.differences);else if(r||g){let l=wo(this.defaultEncoding,Ai(),this.differences);i==="CIDFontType2"&&!this.cidEncoding.startsWith("Identity-")&&!(this.toUnicode instanceof Ct)&&this.toUnicode.forEach(function(h,C){l[+h]=C}),this.toFontChar=l}else{let l=Ai(),h=[];this.toUnicode.forEach((C,B)=>{if(!this.composite){let Q=this.differences[C]||this.defaultEncoding[C],E=Us(Q,l);E!==-1&&(B=E)}h[+C]=B}),this.composite&&this.toUnicode instanceof Ct&&/Tahoma|Verdana/i.test(t)&&Wn(h,Z1()),this.toFontChar=h}nE(A),this.loadedName=s.split("-",1)[0]}checkAndRepair(A,t,i){var EA,fA,CA;let s=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function a(N,H){let q=Object.create(null);q["OS/2"]=null,q.cmap=null,q.head=null,q.hhea=null,q.hmtx=null,q.maxp=null,q.name=null,q.post=null;for(let T=0;T<H;T++){let $=n(N);s.includes($.tag)&&$.length!==0&&(q[$.tag]=$)}return q}function n(N){let H=N.getString(4),q=N.getInt32()>>>0,T=N.getInt32()>>>0,$=N.getInt32()>>>0,X=N.pos;N.pos=N.start||0,N.skip(T);let W=N.getBytes($);return N.pos=X,H==="head"&&(W[8]=W[9]=W[10]=W[11]=0,W[17]|=32),{tag:H,checksum:q,length:$,offset:T,data:W}}function r(N){return{version:N.getString(4),numTables:N.getUint16(),searchRange:N.getUint16(),entrySelector:N.getUint16(),rangeShift:N.getUint16()}}function g(N){let H=N.getString(4);gt(H==="ttcf","Must be a TrueType Collection font.");let q=N.getUint16(),T=N.getUint16(),$=N.getInt32()>>>0,X=[];for(let G=0;G<$;G++)X.push(N.getInt32()>>>0);let W={ttcTag:H,majorVersion:q,minorVersion:T,numFonts:$,offsetTable:X};switch(q){case 1:return W;case 2:return W.dsigTag=N.getInt32()>>>0,W.dsigLength=N.getInt32()>>>0,W.dsigOffset=N.getInt32()>>>0,W}throw new v(`Invalid TrueType Collection majorVersion: ${q}.`)}function o(N,H){var W;let{numFonts:q,offsetTable:T}=g(N),$=H.split("+"),X;for(let G=0;G<q;G++){N.pos=(N.start||0)+T[G];let BA=r(N),uA=a(N,BA.numTables);if(!uA.name)throw new v(\'TrueType Collection font must contain a "name" table.\');let[bA]=Q(uA.name);for(let iA=0,wA=bA.length;iA<wA;iA++)for(let FA=0,cA=bA[iA].length;FA<cA;FA++){let yA=(W=bA[iA][FA])==null?void 0:W.replaceAll(/\\s/g,"");if(yA){if(yA===H)return{header:BA,tables:uA};if(!($.length<2))for(let aA of $)yA===aA&&(X={name:aA,header:BA,tables:uA})}}}if(X)return k(`TrueType Collection does not contain "${H}" font, falling back to "${X.name}" font instead.`),{header:X.header,tables:X.tables};throw new v(`TrueType Collection does not contain "${H}" font.`)}function I(N,H,q,T){if(!N)return k("No cmap table available."),{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1};let $,X=(H.start||0)+N.offset;H.pos=X,H.skip(2);let W=H.getUint16(),G,BA=!1;for(let cA=0;cA<W;cA++){let yA=H.getUint16(),aA=H.getUint16(),DA=H.getInt32()>>>0,UA=!1;if(!((G==null?void 0:G.platformId)===yA&&(G==null?void 0:G.encodingId)===aA)){if(yA===0&&(aA===0||aA===1||aA===3))UA=!0;else if(yA===1&&aA===0)UA=!0;else if(yA===3&&aA===1&&(T||!G))UA=!0,q||(BA=!0);else if(q&&yA===3&&aA===0){UA=!0;let Ee=!0;if(cA<W-1){let pA=H.peekBytes(2);i0(pA[0],pA[1])<yA&&(Ee=!1)}Ee&&(BA=!0)}if(UA&&(G={platformId:yA,encodingId:aA,offset:DA}),BA)break}}if(G&&(H.pos=X+G.offset),!G||H.peekByte()===-1)return k("Could not find a preferred cmap table."),{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1};let uA=H.getUint16(),bA=!1,iA=[],wA,FA;if(uA===0){for(H.skip(2+2),wA=0;wA<256;wA++){let cA=H.getByte();cA&&iA.push({charCode:wA,glyphId:cA})}bA=!0}else if(uA===2){H.skip(2+2);let cA=[],yA=0;for(let DA=0;DA<256;DA++){let UA=H.getUint16()>>3;cA.push(UA),yA=Math.max(UA,yA)}let aA=[];for(let DA=0;DA<=yA;DA++)aA.push({firstCode:H.getUint16(),entryCount:H.getUint16(),idDelta:Dt(H.getByte(),H.getByte()),idRangePos:H.pos+H.getUint16()});for(let DA=0;DA<256;DA++)if(cA[DA]===0)H.pos=aA[0].idRangePos+2*DA,FA=H.getUint16(),iA.push({charCode:DA,glyphId:FA});else{let UA=aA[cA[DA]];for(wA=0;wA<UA.entryCount;wA++){let Ee=(DA<<8)+wA+UA.firstCode;H.pos=UA.idRangePos+2*wA,FA=H.getUint16(),FA!==0&&(FA=(FA+UA.idDelta)%65536),iA.push({charCode:Ee,glyphId:FA})}}}else if(uA===4){H.skip(2+2);let cA=H.getUint16()>>1;H.skip(6);let yA=[],aA;for(aA=0;aA<cA;aA++)yA.push({end:H.getUint16()});for(H.skip(2),aA=0;aA<cA;aA++)yA[aA].start=H.getUint16();for(aA=0;aA<cA;aA++)yA[aA].delta=H.getUint16();let DA=0,UA;for(aA=0;aA<cA;aA++){$=yA[aA];let pA=H.getUint16();if(!pA){$.offsetIndex=-1;continue}UA=(pA>>1)-(cA-aA),$.offsetIndex=UA,DA=Math.max(DA,UA+$.end-$.start+1)}let Ee=[];for(wA=0;wA<DA;wA++)Ee.push(H.getUint16());for(aA=0;aA<cA;aA++){$=yA[aA],X=$.start;let pA=$.end,TA=$.delta;for(UA=$.offsetIndex,wA=X;wA<=pA;wA++)wA!==65535&&(FA=UA<0?wA:Ee[UA+wA-X],FA=FA+TA&65535,iA.push({charCode:wA,glyphId:FA}))}}else if(uA===6){H.skip(2+2);let cA=H.getUint16(),yA=H.getUint16();for(wA=0;wA<yA;wA++){FA=H.getUint16();let aA=cA+wA;iA.push({charCode:aA,glyphId:FA})}}else if(uA===12){H.skip(2+4+4);let cA=H.getInt32()>>>0;for(wA=0;wA<cA;wA++){let yA=H.getInt32()>>>0,aA=H.getInt32()>>>0,DA=H.getInt32()>>>0;for(let UA=yA;UA<=aA;UA++)iA.push({charCode:UA,glyphId:DA++})}}else return k("cmap table has unsupported format: "+uA),{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1};iA.sort(function(cA,yA){return cA.charCode-yA.charCode});for(let cA=1;cA<iA.length;cA++)iA[cA-1].charCode===iA[cA].charCode&&(iA.splice(cA,1),cA--);return{platformId:G.platformId,encodingId:G.encodingId,mappings:iA,hasShortCmap:bA}}function c(N,H,q,T,$,X){if(!H){q&&(q.data=null);return}N.pos=(N.start||0)+H.offset,N.pos+=4,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2,N.pos+=2;let W=N.getUint16();N.pos+=8,N.pos+=2;let G=N.getUint16();W!==0&&(i0(T.data[44],T.data[45])&2||(H.data[22]=0,H.data[23]=0)),G>$&&(PA(`The numOfMetrics (${G}) should not be greater than the numGlyphs (${$}).`),G=$,H.data[34]=(G&65280)>>8,H.data[35]=G&255);let uA=$-G-(q.length-G*4>>1);if(uA>0){let bA=new Uint8Array(q.length+uA*2);bA.set(q.data),X&&(bA[q.length]=q.data[2],bA[q.length+1]=q.data[3]),q.data=bA}}function l(N,H,q,T,$,X){let W={length:0,sizeOfInstructions:0};if(H<0||H>=N.length||q>N.length||q-H<=12)return W;let G=N.subarray(H,q),BA=Dt(G[2],G[3]),uA=Dt(G[4],G[5]),bA=Dt(G[6],G[7]),iA=Dt(G[8],G[9]);BA>bA&&(ea(G,2,bA),ea(G,6,BA)),uA>iA&&(ea(G,4,iA),ea(G,8,uA));let wA=Dt(G[0],G[1]);if(wA<0)return wA<-1||(T.set(G,$),W.length=G.length),W;let FA,cA=10,yA=0;for(FA=0;FA<wA;FA++)yA=(G[cA]<<8|G[cA+1])+1,cA+=2;let aA=cA,DA=G[cA]<<8|G[cA+1];W.sizeOfInstructions=DA,cA+=2+DA;let UA=cA,Ee=0;for(FA=0;FA<yA;FA++){let TA=G[cA++];TA&192&&(G[cA-1]=TA&63);let LA=2;TA&2?LA=1:TA&16&&(LA=0);let WA=2;TA&4?WA=1:TA&32&&(WA=0);let re=LA+WA;if(Ee+=re,TA&8){let De=G[cA++];De===0&&(G[cA-1]^=8),FA+=De,Ee+=De*re}}if(Ee===0)return W;let pA=cA+Ee;return pA>G.length?W:!X&&DA>0?(T.set(G.subarray(0,aA),$),T.set([0,0],$+aA),T.set(G.subarray(UA,pA),$+aA+2),pA-=DA,G.length-pA>3&&(pA=pA+3&-4),W.length=pA,W):G.length-pA>3?(pA=pA+3&-4,T.set(G.subarray(0,pA),$),W.length=pA,W):(T.set(G,$),W.length=G.length,W)}function h(N,H,q){let T=N.data,$=y2(T[0],T[1],T[2],T[3]);$>>16!==1&&(PA("Attempting to fix invalid version in head table: "+$),T[0]=0,T[1]=1,T[2]=0,T[3]=0);let X=i0(T[50],T[51]);if(X<0||X>1){PA("Attempting to fix invalid indexToLocFormat in head table: "+X);let W=H+1;if(q===W<<1)T[50]=0,T[51]=0;else if(q===W<<2)T[50]=0,T[51]=1;else throw new v("Could not fix indexToLocFormat: "+X)}}function C(N,H,q,T,$,X,W){let G,BA,uA;T?(G=4,BA=function(WA,re){return WA[re]<<24|WA[re+1]<<16|WA[re+2]<<8|WA[re+3]},uA=function(WA,re,De){WA[re]=De>>>24&255,WA[re+1]=De>>16&255,WA[re+2]=De>>8&255,WA[re+3]=De&255}):(G=2,BA=function(WA,re){return WA[re]<<9|WA[re+1]<<1},uA=function(WA,re,De){WA[re]=De>>9&255,WA[re+1]=De>>1&255});let bA=X?q+1:q,iA=G*(1+bA),wA=new Uint8Array(iA);wA.set(N.data.subarray(0,iA)),N.data=wA;let FA=H.data,cA=FA.length,yA=new Uint8Array(cA),aA,DA,UA=[];for(aA=0,DA=0;aA<q+1;aA++,DA+=G){let LA=BA(wA,DA);LA>cA&&(LA=cA),UA.push({index:aA,offset:LA,endOffset:0})}for(UA.sort((LA,WA)=>LA.offset-WA.offset),aA=0;aA<q;aA++)UA[aA].endOffset=UA[aA+1].offset;for(UA.sort((LA,WA)=>LA.index-WA.index),aA=0;aA<q;aA++){let{offset:LA,endOffset:WA}=UA[aA];if(LA!==0||WA!==0)break;let re=UA[aA+1].offset;if(re!==0){UA[aA].endOffset=re;break}}let Ee=UA.at(-2);Ee.offset!==0&&Ee.endOffset===0&&(Ee.endOffset=cA);let pA=Object.create(null),TA=0;for(uA(wA,0,TA),aA=0,DA=G;aA<q;aA++,DA+=G){let LA=l(FA,UA[aA].offset,UA[aA].endOffset,yA,TA,$),WA=LA.length;WA===0&&(pA[aA]=!0),LA.sizeOfInstructions>W&&(W=LA.sizeOfInstructions),TA+=WA,uA(wA,DA,TA)}if(TA===0){let LA=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(aA=0,DA=G;aA<bA;aA++,DA+=G)uA(wA,DA,LA.length);H.data=LA}else if(X){let LA=BA(wA,G);yA.length>LA+TA?H.data=yA.subarray(0,LA+TA):(H.data=new Uint8Array(LA+TA),H.data.set(yA.subarray(0,TA))),H.data.set(yA.subarray(0,LA),TA),uA(N.data,wA.length-G,TA+LA)}else H.data=yA.subarray(0,TA);return{missingGlyphs:pA,maxSizeOfInstructions:W}}function B(N,H,q){let T=(t.start||0)+N.offset;t.pos=T;let $=N.length,X=T+$,W=t.getInt32();t.skip(28);let G,BA=!0,uA;switch(W){case 65536:G=O1;break;case 131072:let bA=t.getUint16();if(bA!==q){BA=!1;break}let iA=[];for(uA=0;uA<bA;++uA){let cA=t.getUint16();if(cA>=32768){BA=!1;break}iA.push(cA)}if(!BA)break;let wA=[],FA=[];for(;t.pos<X;){let cA=t.getByte();for(FA.length=cA,uA=0;uA<cA;++uA)FA[uA]=String.fromCharCode(t.getByte());wA.push(FA.join(""))}for(G=[],uA=0;uA<bA;++uA){let cA=iA[uA];if(cA<258){G.push(O1[cA]);continue}G.push(wA[cA-258])}break;case 196608:break;default:k("Unknown/unsupported post table version "+W),BA=!1,H.defaultEncoding&&(G=H.defaultEncoding);break}return H.glyphNames=G,BA}function Q(N){let H=(t.start||0)+N.offset;t.pos=H;let q=[[],[]],T=[],$=N.length,X=H+$;if(t.getUint16()!==0||$<6)return[q,T];let BA=t.getUint16(),uA=t.getUint16(),bA=12,iA,wA;for(iA=0;iA<BA&&t.pos+bA<=X;iA++){let FA={platform:t.getUint16(),encoding:t.getUint16(),language:t.getUint16(),name:t.getUint16(),length:t.getUint16(),offset:t.getUint16()};(R2(FA)||mf(FA))&&T.push(FA)}for(iA=0,wA=T.length;iA<wA;iA++){let FA=T[iA];if(FA.length<=0)continue;let cA=H+uA+FA.offset;if(cA+FA.length>X)continue;t.pos=cA;let yA=FA.name;if(FA.encoding){let aA="";for(let DA=0,UA=FA.length;DA<UA;DA+=2)aA+=String.fromCharCode(t.getUint16());q[1][yA]=aA}else q[0][yA]=t.getString(FA.length)}return[q,T]}let E=[0,0,0,0,0,0,0,0,-2,-2,-2,-2,0,0,-2,-5,-1,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,-1,-1,1,-1,-999,0,1,0,-1,-2,0,-1,-2,-1,-1,0,-1,-1,0,0,-999,-999,-1,-1,-1,-1,-2,-999,-2,-2,-999,0,-2,-2,0,0,-2,0,-2,0,0,0,-2,-1,-1,1,1,0,0,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,0,-999,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-2,-999,-999,-999,-999,-999,-1,-1,-2,-2,0,0,0,0,-1,-1,-999,-2,-2,0,0,-1,-2,-2,0,0,0,-1,-1,-1,-2];function f(N,H){let q=N.data,T=0,$,X,W,G,BA,uA=0,bA=0,iA=[],wA=[],FA=[],cA=H.tooComplexToFollowFunctions,yA=!1,aA=0,DA=0;for(let Ee=q.length;T<Ee;){let pA=q[T++];if(pA===64)if(X=q[T++],yA||DA)T+=X;else for($=0;$<X;$++)iA.push(q[T++]);else if(pA===65)if(X=q[T++],yA||DA)T+=X*2;else for($=0;$<X;$++)W=q[T++],iA.push(W<<8|q[T++]);else if((pA&248)===176)if(X=pA-176+1,yA||DA)T+=X;else for($=0;$<X;$++)iA.push(q[T++]);else if((pA&248)===184)if(X=pA-184+1,yA||DA)T+=X*2;else for($=0;$<X;$++)W=q[T++],iA.push(W<<8|q[T++]);else if(pA===43&&!cA){if(!yA&&!DA){if(G=iA.at(-1),isNaN(G))PA("TT: CALL empty stack (or invalid entry).");else if(H.functionsUsed[G]=!0,G in H.functionsStackDeltas){let TA=iA.length+H.functionsStackDeltas[G];if(TA<0){k("TT: CALL invalid functions stack delta."),H.hintsValid=!1;return}iA.length=TA}else if(G in H.functionsDefined&&!FA.includes(G)){if(wA.push({data:q,i:T,stackTop:iA.length-1}),FA.push(G),BA=H.functionsDefined[G],!BA){k("TT: CALL non-existent function"),H.hintsValid=!1;return}q=BA.data,T=BA.i}}}else if(pA===44&&!cA)(yA||DA)&&(k("TT: nested FDEFs not allowed"),cA=!0),yA=!0,bA=T,G=iA.pop(),H.functionsDefined[G]={data:q,i:T};else if(pA===45)if(yA)yA=!1,uA=T;else{if(BA=wA.pop(),!BA){k("TT: ENDF bad stack"),H.hintsValid=!1;return}G=FA.pop(),q=BA.data,T=BA.i,H.functionsStackDeltas[G]=iA.length-BA.stackTop}else if(pA===137)(yA||DA)&&(k("TT: nested IDEFs not allowed"),cA=!0),yA=!0,bA=T;else if(pA===88)++aA;else if(pA===27)DA=aA;else if(pA===89)DA===aA&&(DA=0),--aA;else if(pA===28&&!yA&&!DA){let TA=iA.at(-1);TA>0&&(T+=TA-1)}if(!yA&&!DA){let TA=0;for(pA<=142?TA=E[pA]:pA>=192&&pA<=223?TA=-1:pA>=224&&(TA=-2),pA>=113&&pA<=117&&(X=iA.pop(),isNaN(X)||(TA=-X*2));TA<0&&iA.length>0;)iA.pop(),TA++;for(;TA>0;)iA.push(NaN),TA--}}H.tooComplexToFollowFunctions=cA;let UA=[q];T>q.length&&UA.push(new Uint8Array(T-q.length)),bA>uA&&(k("TT: complementing a missing function tail"),UA.push(new Uint8Array([34,45]))),d(N,UA)}function u(N,H){if(!N.tooComplexToFollowFunctions){if(N.functionsDefined.length>H){k("TT: more functions defined than expected"),N.hintsValid=!1;return}for(let q=0,T=N.functionsUsed.length;q<T;q++){if(q>H){k("TT: invalid function id: "+q),N.hintsValid=!1;return}if(N.functionsUsed[q]&&!N.functionsDefined[q]){k("TT: undefined function: "+q),N.hintsValid=!1;return}}}}function d(N,H){if(H.length>1){let q=0,T,$;for(T=0,$=H.length;T<$;T++)q+=H[T].length;q=q+3&-4;let X=new Uint8Array(q),W=0;for(T=0,$=H.length;T<$;T++)X.set(H[T],W),W+=H[T].length;N.data=X,N.length=q}}function x(N,H,q,T){let $={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(N&&f(N,$),H&&f(H,$),N&&u($,T),q&&q.length&1){let X=new Uint8Array(q.length+1);X.set(q.data),q.data=X}return $.hintsValid}t=new Ie(new Uint8Array(t.getBytes()));let p,m;if(xf(t)){let N=o(t,this.name);p=N.header,m=N.tables}else p=r(t),m=a(t,p.numTables);let D,S,w=!m["CFF "];if(w){if(!m.loca)throw new v(\'Required "loca" table is not found\');m.glyf||(k(\'Required "glyf" table is not found -- trying to recover.\'),m.glyf={tag:"glyf",data:new Uint8Array(0)}),this.isOpenType=!1}else{let N=i.composite&&(((EA=i.cidToGidMap)==null?void 0:EA.length)>0||!(i.cMap instanceof Wi));if(p.version==="OTTO"&&!N||!m.head||!m.hhea||!m.maxp||!m.post)return S=new Ie(m["CFF "].data),D=new Ea(S,i),po(i),this.convert(A,D,i);delete m.glyf,delete m.loca,delete m.fpgm,delete m.prep,delete m["cvt "],this.isOpenType=!0}if(!m.maxp)throw new v(\'Required "maxp" table is not found\');t.pos=(t.start||0)+m.maxp.offset;let Y=t.getInt32(),U=t.getUint16();if(Y!==65536&&Y!==20480){if(m.maxp.length===6)Y=20480;else if(m.maxp.length>=32)Y=65536;else throw new v(\'"maxp" table has a wrong version number\');w2(m.maxp.data,0,Y)}if(((fA=i.scaleFactors)==null?void 0:fA.length)===U&&w){let{scaleFactors:N}=i,H=i0(m.head.data[50],m.head.data[51]),q=new UI({glyfTable:m.glyf.data,isGlyphLocationsLong:H,locaTable:m.loca.data,numGlyphs:U});q.scale(N);let{glyf:T,loca:$,isLocationLong:X}=q.write();m.glyf.data=T,m.loca.data=$,X!==!!H&&(m.head.data[50]=0,m.head.data[51]=X?1:0);let W=m.hmtx.data;for(let G=0;G<U;G++){let BA=4*G,uA=Math.round(N[G]*i0(W[BA],W[BA+1]));W[BA]=uA>>8&255,W[BA+1]=uA&255;let bA=Math.round(N[G]*Dt(W[BA+2],W[BA+3]));ea(W,BA+2,bA)}}let K=U+1,Z=!0;K>65535&&(Z=!1,K=U,k("Not enough space in glyfs to duplicate first glyph."));let AA=0,gA=0;Y>=65536&&m.maxp.length>=32&&(t.pos+=8,t.getUint16()>2&&(m.maxp.data[14]=0,m.maxp.data[15]=2),t.pos+=4,AA=t.getUint16(),t.pos+=4,gA=t.getUint16()),m.maxp.data[4]=K>>8,m.maxp.data[5]=K&255;let R=x(m.fpgm,m.prep,m["cvt "],AA);if(R||(delete m.fpgm,delete m.prep,delete m["cvt "]),c(t,m.hhea,m.hmtx,m.head,K,Z),!m.head)throw new v(\'Required "head" table is not found\');h(m.head,U,w?m.loca.length:0);let _=Object.create(null);if(w){let N=i0(m.head.data[50],m.head.data[51]),H=C(m.loca,m.glyf,U,N,R,Z,gA);_=H.missingGlyphs,Y>=65536&&m.maxp.length>=32&&(m.maxp.data[26]=H.maxSizeOfInstructions>>8,m.maxp.data[27]=H.maxSizeOfInstructions&255)}if(!m.hhea)throw new v(\'Required "hhea" table is not found\');m.hhea.data[10]===0&&m.hhea.data[11]===0&&(m.hhea.data[10]=255,m.hhea.data[11]=255);let tA={unitsPerEm:i0(m.head.data[18],m.head.data[19]),yMax:Dt(m.head.data[42],m.head.data[43]),yMin:Dt(m.head.data[38],m.head.data[39]),ascent:Dt(m.hhea.data[4],m.hhea.data[5]),descent:Dt(m.hhea.data[6],m.hhea.data[7]),lineGap:Dt(m.hhea.data[8],m.hhea.data[9])};this.ascent=tA.ascent/tA.unitsPerEm,this.descent=tA.descent/tA.unitsPerEm,this.lineGap=tA.lineGap/tA.unitsPerEm,(CA=this.cssFontInfo)!=null&&CA.lineHeight?(this.lineHeight=this.cssFontInfo.metrics.lineHeight,this.lineGap=this.cssFontInfo.metrics.lineGap):this.lineHeight=this.ascent-this.descent+this.lineGap,m.post&&B(m.post,i,U),m.post={tag:"post",data:IE(i)};let IA=Object.create(null);function QA(N){return!_[N]}if(i.composite){let N=i.cidToGidMap||[],H=N.length===0;i.cMap.forEach(function(q,T){if(typeof T=="string"&&(T=yo(q,T,!0)),T>65535)throw new v("Max size of CID is 65,535");let $=-1;H?$=T:N[T]!==void 0&&($=N[T]),$>=0&&$<U&&QA($)&&(IA[q]=$)})}else{let N=I(m.cmap,t,this.isSymbolicFont,i.hasEncoding),H=N.platformId,q=N.encodingId,T=N.mappings,$=[],X=!1;if(i.hasEncoding&&(i.baseEncodingName==="MacRomanEncoding"||i.baseEncodingName==="WinAnsiEncoding")&&($=Ua(i.baseEncodingName)),i.hasEncoding&&!this.isSymbolicFont&&(H===3&&q===1||H===1&&q===0)){let W=Ai();for(let G=0;G<256;G++){let BA;if(this.differences[G]!==void 0?BA=this.differences[G]:$.length&&$[G]!==""?BA=$[G]:BA=fi[G],!BA)continue;let uA=Ef(BA,W),bA;if(H===3&&q===1?bA=W[uA]:H===1&&q===0&&(bA=c1.indexOf(uA)),bA===void 0){if(!i.glyphNames&&i.hasIncludedToUnicodeMap&&!(this.toUnicode instanceof Ct)){let iA=this.toUnicode.get(G);iA&&(bA=iA.codePointAt(0))}if(bA===void 0)continue}for(let iA of T)if(iA.charCode===bA){IA[G]=iA.glyphId;break}}}else if(H===0){for(let W of T)IA[W.charCode]=W.glyphId;X=!0}else if(H===3&&q===0)for(let W of T){let G=W.charCode;G>=61440&&G<=61695&&(G&=255),IA[G]=W.glyphId}else for(let W of T)IA[W.charCode]=W.glyphId;if(i.glyphNames&&($.length||this.differences.length))for(let W=0;W<256;++W){if(!X&&IA[W]!==void 0)continue;let G=this.differences[W]||$[W];if(!G)continue;let BA=i.glyphNames.indexOf(G);BA>0&&QA(BA)&&(IA[W]=BA)}}IA.length===0&&(IA[0]=0);let V=K-1;if(Z||(V=0),!i.cssFontInfo){let N=rE(IA,QA,V,this.toUnicode);this.toFontChar=N.toFontChar,m.cmap={tag:"cmap",data:gE(N.charCodeToGlyphId,N.toUnicodeExtraMap,K)},(!m["OS/2"]||!G2(m["OS/2"],t))&&(m["OS/2"]={tag:"OS/2",data:oE(i,N.charCodeToGlyphId,tA)})}if(!w)try{S=new Ie(m["CFF "].data),D=new Ma(S,i,Cs).parse(),D.duplicateFirstGlyph();let H=new k0(D);m["CFF "].data=H.compile()}catch(N){k("Failed to compile font "+i.loadedName)}if(!m.name)m.name={tag:"name",data:bo(this.name)};else{let[N,H]=Q(m.name);m.name.data=bo(A,N),this.psName=N[0][6]||null,i.composite||m2(i,this.isSymbolicFont,H)}let lA=new F0(p.version);for(let N in m)lA.addTable(N,m[N].data);return lA.toArray()}convert(A,t,i){i.fixedPitch=!1,i.builtInEncoding&&p2(i,i.builtInEncoding);let s=1;t instanceof Ea&&(s=t.numGlyphs-1);let a=t.getGlyphMapping(i),n=null,r=a,g=null;i.cssFontInfo||(n=rE(a,t.hasGlyphId.bind(t),s,this.toUnicode),this.toFontChar=n.toFontChar,r=n.charCodeToGlyphId,g=n.toUnicodeExtraMap);let o=t.numGlyphs;function I(B,Q){let E=null;for(let f in B)Q===B[f]&&(E||(E=[])).push(f|0);return E}function c(B,Q){for(let E in B)if(Q===B[E])return E|0;return n.charCodeToGlyphId[n.nextAvailableFontCharCode]=Q,n.nextAvailableFontCharCode++}let l=t.seacs;if(n&&Cs&&(l!=null&&l.length)){let B=i.fontMatrix||E0,Q=t.getCharset(),E=Object.create(null);for(let f in l){f|=0;let u=l[f],d=fi[u[2]],x=fi[u[3]],p=Q.indexOf(d),m=Q.indexOf(x);if(p<0||m<0)continue;let D={x:u[0]*B[0]+u[1]*B[2]+B[4],y:u[0]*B[1]+u[1]*B[3]+B[5]},S=I(a,f);if(S)for(let w of S){let Y=n.charCodeToGlyphId,U=c(Y,p),K=c(Y,m);E[w]={baseFontCharCode:U,accentFontCharCode:K,accentOffset:D}}}i.seacMap=E}let h=i.fontMatrix?1/Math.max(...i.fontMatrix.slice(0,4).map(Math.abs)):1e3,C=new F0("OTTO");return C.addTable("CFF ",t.data),C.addTable("OS/2",oE(i,r)),C.addTable("cmap",gE(r,g,o)),C.addTable("head","\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0_<\\xF5\\0\\0"+s0(h)+"\\0\\0\\0\\0\\x9E\\v~\'\\0\\0\\0\\0\\x9E\\v~\'\\0\\0"+s0(i.descent)+"\\xFF"+s0(i.ascent)+zA(i.italicAngle?2:0)+"\\0\\0\\0\\0\\0\\0\\0"),C.addTable("hhea","\\0\\0\\0"+s0(i.ascent)+s0(i.descent)+"\\0\\0\\xFF\\xFF\\0\\0\\0\\0\\0\\0"+s0(i.capHeight)+s0(Math.tan(i.italicAngle)*i.xHeight)+"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"+zA(o)),C.addTable("hmtx",function(){let Q=t.charstrings,E=t.cff?t.cff.widths:null,f="\\0\\0\\0\\0";for(let u=1,d=o;u<d;u++){let x=0;if(Q){let p=Q[u-1];x="width"in p?p.width:0}else E&&(x=Math.ceil(E[u]||0));f+=zA(x)+zA(0)}return f}()),C.addTable("maxp","\\0\\0P\\0"+zA(o)),C.addTable("name",bo(A)),C.addTable("post",IE(i)),C.toArray()}get _spaceWidth(){let A=["space","minus","one","i","I"],t;for(let i of A){if(i in this.widths){t=this.widths[i];break}let a=Ai()[i],n=0;if(this.composite&&this.cMap.contains(a)&&(n=this.cMap.lookup(a),typeof n=="string"&&(n=yo(a,n))),!n&&this.toUnicode&&(n=this.toUnicode.charCodeOf(a)),n<=0&&(n=a),t=this.widths[n],t)break}return nA(this,"_spaceWidth",t||this.defaultWidth)}_charToGlyph(A,t=!1){var h,C,B;let i=this._glyphCache[A];if((i==null?void 0:i.isSpace)===t)return i;let s,a,n,r=A;(h=this.cMap)!=null&&h.contains(A)&&(r=this.cMap.lookup(A),typeof r=="string"&&(r=yo(A,r))),a=this.widths[r],typeof a!="number"&&(a=this.defaultWidth);let g=(C=this.vmetrics)==null?void 0:C[r],o=this.toUnicode.get(A)||A;typeof o=="number"&&(o=String.fromCharCode(o));let I=this.toFontChar[A]!==void 0;if(s=this.toFontChar[A]||A,this.missingFile){let Q=this.differences[A]||this.defaultEncoding[A];(Q===".notdef"||Q==="")&&this.type==="Type1"&&(s=32,Q===""&&(a||(a=this._spaceWidth),o=String.fromCharCode(s))),s=Vd(s)}this.isType3Font&&(n=s);let c=null;if((B=this.seacMap)!=null&&B[A]){I=!0;let Q=this.seacMap[A];s=Q.baseFontCharCode,c={fontChar:String.fromCodePoint(Q.accentFontCharCode),offset:Q.accentOffset}}let l="";if(typeof s=="number"&&(s<=1114111?l=String.fromCodePoint(s):k(`charToGlyph - invalid fontCharCode: ${s}`)),this.missingFile&&this.vertical&&l.length===1){let Q=e2()[l.charCodeAt(0)];Q&&(l=o=String.fromCharCode(Q))}return i=new JI(A,l,o,c,a,g,n,t,I),this._glyphCache[A]=i}charsToGlyphs(A){let t=this._charsCache[A];if(t)return t;if(t=[],this.cMap){let i=Object.create(null),s=A.length,a=0;for(;a<s;){this.cMap.readCharCode(A,a,i);let{charcode:n,length:r}=i;a+=r;let g=this._charToGlyph(n,r===1&&A.charCodeAt(a-1)===32);t.push(g)}}else for(let i=0,s=A.length;i<s;++i){let a=A.charCodeAt(i),n=this._charToGlyph(a,a===32);t.push(n)}return this._charsCache[A]=t}getCharPositions(A){let t=[];if(this.cMap){let i=Object.create(null),s=0;for(;s<A.length;){this.cMap.readCharCode(A,s,i);let a=i.length;t.push([s,s+a]),s+=a}}else for(let i=0,s=A.length;i<s;++i)t.push([i,i+1]);return t}get glyphCacheValues(){return Object.values(this._glyphCache)}encodeString(A){let t=[],i=[],s=()=>t.length%2===1,a=this.toUnicode instanceof Ct?n=>this.toUnicode.charCodeOf(n):n=>this.toUnicode.charCodeOf(String.fromCodePoint(n));for(let n=0,r=A.length;n<r;n++){let g=A.codePointAt(n);if(g>55295&&(g<57344||g>65533)&&n++,this.toUnicode){let o=a(g);if(o!==-1){s()&&(t.push(i.join("")),i.length=0);let I=this.cMap?this.cMap.getCharCodeLength(o):1;for(let c=I-1;c>=0;c--)i.push(String.fromCharCode(o>>8*c&255));continue}}s()||(t.push(i.join("")),i.length=0),i.push(String.fromCodePoint(g))}return t.push(i.join("")),t}},fa=class{constructor(A){this.error=A,this.loadedName="g_font_error",this.missingFile=!0}charsToGlyphs(){return[]}encodeString(A){return[A]}exportData(A=!1){return{error:this.error}}},nt={FUNCTION_BASED:1,AXIAL:2,RADIAL:3,FREE_FORM_MESH:4,LATTICE_FORM_MESH:5,COONS_PATCH_MESH:6,TENSOR_PATCH_MESH:7},YI=class{constructor(){OA("Cannot initialize Pattern.")}static parseShading(A,t,i,s,a){let n=A instanceof KA?A.dict:A,r=n.get("ShadingType");try{switch(r){case nt.AXIAL:case nt.RADIAL:return new KI(n,t,i,s,a);case nt.FREE_FORM_MESH:case nt.LATTICE_FORM_MESH:case nt.COONS_PATCH_MESH:case nt.TENSOR_PATCH_MESH:return new _0(A,t,i,s,a);default:throw new v("Unsupported ShadingType: "+r)}}catch(g){if(g instanceof ge)throw g;return k(g),new qI}}},Oi=class{getIR(){OA("Abstract method `getIR` called.")}};et(Oi,"SMALL_NUMBER",1e-6);var KI=class extends Oi{constructor(A,t,i,s,a){super(),this.shadingType=A.get("ShadingType");let n=0;if(this.shadingType===nt.AXIAL?n=4:this.shadingType===nt.RADIAL&&(n=6),this.coordsArr=A.getArray("Coords"),!wt(this.coordsArr,n))throw new v("RadialAxialShading: Invalid /Coords array.");let r=JA.parse({cs:A.getRaw("CS")||A.getRaw("ColorSpace"),xref:t,resources:i,pdfFunctionFactory:s,localColorSpaceCache:a});this.bbox=Ei(A.getArray("BBox"),null);let g=0,o=1,I=A.getArray("Domain");wt(I,2)&&([g,o]=I);let c=!1,l=!1,h=A.getArray("Extend");if(Tu(h,2)&&([c,l]=h),this.shadingType===nt.RADIAL&&(!c||!l)){let[tA,IA,QA,V,lA,EA]=this.coordsArr,fA=Math.hypot(tA-V,IA-lA);QA<=EA+fA&&EA<=QA+fA&&k("Unsupported radial gradient.")}this.extendStart=c,this.extendEnd=l;let C=A.getRaw("Function"),B=s.createFromArray(C),Q=840,E=(o-g)/Q,f=this.colorStops=[];if(g>=o||E<=0){PA("Bad shading domain.");return}let u=new Float32Array(r.numComps),d=new Float32Array(1),x,p=0;d[0]=g,B(d,0,u,0);let m=r.getRgb(u,0),D=Ce.makeHexColor(m[0],m[1],m[2]);f.push([0,D]);let S=1;d[0]=g+E,B(d,0,u,0);let w=r.getRgb(u,0),Y=w[0]-m[0]+1,U=w[1]-m[1]+1,K=w[2]-m[2]+1,Z=w[0]-m[0]-1,AA=w[1]-m[1]-1,gA=w[2]-m[2]-1;for(let tA=2;tA<Q;tA++){d[0]=g+tA*E,B(d,0,u,0),x=r.getRgb(u,0);let IA=tA-p;if(Y=Math.min(Y,(x[0]-m[0]+1)/IA),U=Math.min(U,(x[1]-m[1]+1)/IA),K=Math.min(K,(x[2]-m[2]+1)/IA),Z=Math.max(Z,(x[0]-m[0]-1)/IA),AA=Math.max(AA,(x[1]-m[1]-1)/IA),gA=Math.max(gA,(x[2]-m[2]-1)/IA),!(Z<=Y&&AA<=U&&gA<=K)){let V=Ce.makeHexColor(w[0],w[1],w[2]);f.push([S/Q,V]),Y=x[0]-w[0]+1,U=x[1]-w[1]+1,K=x[2]-w[2]+1,Z=x[0]-w[0]-1,AA=x[1]-w[1]-1,gA=x[2]-w[2]-1,p=S,m=w}S=tA,w=x}let R=Ce.makeHexColor(w[0],w[1],w[2]);f.push([1,R]);let _="transparent";A.has("Background")&&(x=r.getRgb(A.get("Background"),0),_=Ce.makeHexColor(x[0],x[1],x[2])),c||(f.unshift([0,_]),f[1][0]+=Oi.SMALL_NUMBER),l||(f.at(-1)[0]-=Oi.SMALL_NUMBER,f.push([1,_])),this.colorStops=f}getIR(){let{coordsArr:A,shadingType:t}=this,i,s,a,n,r;return t===nt.AXIAL?(s=[A[0],A[1]],a=[A[2],A[3]],n=null,r=null,i="axial"):t===nt.RADIAL?(s=[A[0],A[1]],a=[A[3],A[4]],n=A[2],r=A[5],i="radial"):OA(`getPattern type unknown: ${t}`),["RadialAxial",i,this.bbox,this.colorStops,s,a,n,r]}},vI=class{constructor(A,t){this.stream=A,this.context=t,this.buffer=0,this.bufferLength=0;let i=t.numComps;this.tmpCompsBuf=new Float32Array(i);let s=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(s):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos<this.stream.end;if(this.bufferLength>0)return!0;let A=this.stream.getByte();return A<0?!1:(this.buffer=A,this.bufferLength=8,!0)}readBits(A){let t=this.buffer,i=this.bufferLength;if(A===32){if(i===0)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();let s=this.stream.getByte();return this.buffer=s&(1<<i)-1,(t<<8-i|(s&255)>>i)>>>0}if(A===8&&i===0)return this.stream.getByte();for(;i<A;)t=t<<8|this.stream.getByte(),i+=8;return i-=A,this.bufferLength=i,this.buffer=t&(1<<i)-1,t>>i}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){let A=this.context.bitsPerCoordinate,t=this.readBits(A),i=this.readBits(A),s=this.context.decode,a=A<32?1/((1<<A)-1):23283064365386963e-26;return[t*a*(s[1]-s[0])+s[0],i*a*(s[3]-s[2])+s[2]]}readComponents(){let A=this.context.numComps,t=this.context.bitsPerComponent,i=t<32?1/((1<<t)-1):23283064365386963e-26,s=this.context.decode,a=this.tmpCompsBuf;for(let r=0,g=4;r<A;r++,g+=2){let o=this.readBits(t);a[r]=o*i*(s[g+1]-s[g])+s[g]}let n=this.tmpCsCompsBuf;return this.context.colorFn&&this.context.colorFn(a,0,n,0),this.context.colorSpace.getRgb(n,0)}},rr=Object.create(null);function M2(e){let A=[];for(let t=0;t<=e;t++){let i=t/e,s=1-i;A.push(new Float32Array([s**3,3*i*s**2,3*i**2*s,i**3]))}return A}function cE(e){return rr[e]||(rr[e]=M2(e))}function L2(){rr=Object.create(null)}var Gi=class extends Oi{constructor(A,t,i,s,a){if(super(),!(A instanceof KA))throw new v("Mesh data is not a stream");let n=A.dict;this.shadingType=n.get("ShadingType"),this.bbox=Ei(n.getArray("BBox"),null);let r=JA.parse({cs:n.getRaw("CS")||n.getRaw("ColorSpace"),xref:t,resources:i,pdfFunctionFactory:s,localColorSpaceCache:a});this.background=n.has("Background")?r.getRgb(n.get("Background"),0):null;let g=n.getRaw("Function"),o=g?s.createFromArray(g):null;this.coords=[],this.colors=[],this.figures=[];let I={bitsPerCoordinate:n.get("BitsPerCoordinate"),bitsPerComponent:n.get("BitsPerComponent"),bitsPerFlag:n.get("BitsPerFlag"),decode:n.getArray("Decode"),colorFn:o,colorSpace:r,numComps:o?1:r.numComps},c=new vI(A,I),l=!1;switch(this.shadingType){case nt.FREE_FORM_MESH:this._decodeType4Shading(c);break;case nt.LATTICE_FORM_MESH:let h=n.get("VerticesPerRow")|0;if(h<2)throw new v("Invalid VerticesPerRow");this._decodeType5Shading(c,h);break;case nt.COONS_PATCH_MESH:this._decodeType6Shading(c),l=!0;break;case nt.TENSOR_PATCH_MESH:this._decodeType7Shading(c),l=!0;break;default:OA("Unsupported mesh type.");break}if(l){this._updateBounds();for(let h=0,C=this.figures.length;h<C;h++)this._buildFigureFromPatch(h)}this._updateBounds(),this._packData()}_decodeType4Shading(A){let t=this.coords,i=this.colors,s=[],a=[],n=0;for(;A.hasData;){let r=A.readFlag(),g=A.readCoordinate(),o=A.readComponents();if(n===0){if(!(0<=r&&r<=2))throw new v("Unknown type4 flag");switch(r){case 0:n=3;break;case 1:a.push(a.at(-2),a.at(-1)),n=1;break;case 2:a.push(a.at(-3),a.at(-1)),n=1;break}s.push(r)}a.push(t.length),t.push(g),i.push(o),n--,A.align()}this.figures.push({type:"triangles",coords:new Int32Array(a),colors:new Int32Array(a)})}_decodeType5Shading(A,t){let i=this.coords,s=this.colors,a=[];for(;A.hasData;){let n=A.readCoordinate(),r=A.readComponents();a.push(i.length),i.push(n),s.push(r)}this.figures.push({type:"lattice",coords:new Int32Array(a),colors:new Int32Array(a),verticesPerRow:t})}_decodeType6Shading(A){let t=this.coords,i=this.colors,s=new Int32Array(16),a=new Int32Array(4);for(;A.hasData;){let n=A.readFlag();if(!(0<=n&&n<=3))throw new v("Unknown type6 flag");let r=t.length;for(let h=0,C=n!==0?8:12;h<C;h++)t.push(A.readCoordinate());let g=i.length;for(let h=0,C=n!==0?2:4;h<C;h++)i.push(A.readComponents());let o,I,c,l;switch(n){case 0:s[12]=r+3,s[13]=r+4,s[14]=r+5,s[15]=r+6,s[8]=r+2,s[11]=r+7,s[4]=r+1,s[7]=r+8,s[0]=r,s[1]=r+11,s[2]=r+10,s[3]=r+9,a[2]=g+1,a[3]=g+2,a[0]=g,a[1]=g+3;break;case 1:o=s[12],I=s[13],c=s[14],l=s[15],s[12]=l,s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=c,s[11]=r+3,s[4]=I,s[7]=r+4,s[0]=o,s[1]=r+7,s[2]=r+6,s[3]=r+5,o=a[2],I=a[3],a[2]=I,a[3]=g,a[0]=o,a[1]=g+1;break;case 2:o=s[15],I=s[11],s[12]=s[3],s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=s[7],s[11]=r+3,s[4]=I,s[7]=r+4,s[0]=o,s[1]=r+7,s[2]=r+6,s[3]=r+5,o=a[3],a[2]=a[1],a[3]=g,a[0]=o,a[1]=g+1;break;case 3:s[12]=s[0],s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=s[1],s[11]=r+3,s[4]=s[2],s[7]=r+4,s[0]=s[3],s[1]=r+7,s[2]=r+6,s[3]=r+5,a[2]=a[0],a[3]=g,a[0]=a[1],a[1]=g+1;break}s[5]=t.length,t.push([(-4*t[s[0]][0]-t[s[15]][0]+6*(t[s[4]][0]+t[s[1]][0])-2*(t[s[12]][0]+t[s[3]][0])+3*(t[s[13]][0]+t[s[7]][0]))/9,(-4*t[s[0]][1]-t[s[15]][1]+6*(t[s[4]][1]+t[s[1]][1])-2*(t[s[12]][1]+t[s[3]][1])+3*(t[s[13]][1]+t[s[7]][1]))/9]),s[6]=t.length,t.push([(-4*t[s[3]][0]-t[s[12]][0]+6*(t[s[2]][0]+t[s[7]][0])-2*(t[s[0]][0]+t[s[15]][0])+3*(t[s[4]][0]+t[s[14]][0]))/9,(-4*t[s[3]][1]-t[s[12]][1]+6*(t[s[2]][1]+t[s[7]][1])-2*(t[s[0]][1]+t[s[15]][1])+3*(t[s[4]][1]+t[s[14]][1]))/9]),s[9]=t.length,t.push([(-4*t[s[12]][0]-t[s[3]][0]+6*(t[s[8]][0]+t[s[13]][0])-2*(t[s[0]][0]+t[s[15]][0])+3*(t[s[11]][0]+t[s[1]][0]))/9,(-4*t[s[12]][1]-t[s[3]][1]+6*(t[s[8]][1]+t[s[13]][1])-2*(t[s[0]][1]+t[s[15]][1])+3*(t[s[11]][1]+t[s[1]][1]))/9]),s[10]=t.length,t.push([(-4*t[s[15]][0]-t[s[0]][0]+6*(t[s[11]][0]+t[s[14]][0])-2*(t[s[12]][0]+t[s[3]][0])+3*(t[s[2]][0]+t[s[8]][0]))/9,(-4*t[s[15]][1]-t[s[0]][1]+6*(t[s[11]][1]+t[s[14]][1])-2*(t[s[12]][1]+t[s[3]][1])+3*(t[s[2]][1]+t[s[8]][1]))/9]),this.figures.push({type:"patch",coords:new Int32Array(s),colors:new Int32Array(a)})}}_decodeType7Shading(A){let t=this.coords,i=this.colors,s=new Int32Array(16),a=new Int32Array(4);for(;A.hasData;){let n=A.readFlag();if(!(0<=n&&n<=3))throw new v("Unknown type7 flag");let r=t.length;for(let h=0,C=n!==0?12:16;h<C;h++)t.push(A.readCoordinate());let g=i.length;for(let h=0,C=n!==0?2:4;h<C;h++)i.push(A.readComponents());let o,I,c,l;switch(n){case 0:s[12]=r+3,s[13]=r+4,s[14]=r+5,s[15]=r+6,s[8]=r+2,s[9]=r+13,s[10]=r+14,s[11]=r+7,s[4]=r+1,s[5]=r+12,s[6]=r+15,s[7]=r+8,s[0]=r,s[1]=r+11,s[2]=r+10,s[3]=r+9,a[2]=g+1,a[3]=g+2,a[0]=g,a[1]=g+3;break;case 1:o=s[12],I=s[13],c=s[14],l=s[15],s[12]=l,s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=c,s[9]=r+9,s[10]=r+10,s[11]=r+3,s[4]=I,s[5]=r+8,s[6]=r+11,s[7]=r+4,s[0]=o,s[1]=r+7,s[2]=r+6,s[3]=r+5,o=a[2],I=a[3],a[2]=I,a[3]=g,a[0]=o,a[1]=g+1;break;case 2:o=s[15],I=s[11],s[12]=s[3],s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=s[7],s[9]=r+9,s[10]=r+10,s[11]=r+3,s[4]=I,s[5]=r+8,s[6]=r+11,s[7]=r+4,s[0]=o,s[1]=r+7,s[2]=r+6,s[3]=r+5,o=a[3],a[2]=a[1],a[3]=g,a[0]=o,a[1]=g+1;break;case 3:s[12]=s[0],s[13]=r+0,s[14]=r+1,s[15]=r+2,s[8]=s[1],s[9]=r+9,s[10]=r+10,s[11]=r+3,s[4]=s[2],s[5]=r+8,s[6]=r+11,s[7]=r+4,s[0]=s[3],s[1]=r+7,s[2]=r+6,s[3]=r+5,a[2]=a[0],a[3]=g,a[0]=a[1],a[1]=g+1;break}this.figures.push({type:"patch",coords:new Int32Array(s),colors:new Int32Array(a)})}}_buildFigureFromPatch(A){let t=this.figures[A];gt(t.type==="patch","Unexpected patch mesh figure");let i=this.coords,s=this.colors,a=t.coords,n=t.colors,r=Math.min(i[a[0]][0],i[a[3]][0],i[a[12]][0],i[a[15]][0]),g=Math.min(i[a[0]][1],i[a[3]][1],i[a[12]][1],i[a[15]][1]),o=Math.max(i[a[0]][0],i[a[3]][0],i[a[12]][0],i[a[15]][0]),I=Math.max(i[a[0]][1],i[a[3]][1],i[a[12]][1],i[a[15]][1]),c=Math.ceil((o-r)*Gi.TRIANGLE_DENSITY/(this.bounds[2]-this.bounds[0]));c=Math.max(Gi.MIN_SPLIT_PATCH_CHUNKS_AMOUNT,Math.min(Gi.MAX_SPLIT_PATCH_CHUNKS_AMOUNT,c));let l=Math.ceil((I-g)*Gi.TRIANGLE_DENSITY/(this.bounds[3]-this.bounds[1]));l=Math.max(Gi.MIN_SPLIT_PATCH_CHUNKS_AMOUNT,Math.min(Gi.MAX_SPLIT_PATCH_CHUNKS_AMOUNT,l));let h=c+1,C=new Int32Array((l+1)*h),B=new Int32Array((l+1)*h),Q=0,E=new Uint8Array(3),f=new Uint8Array(3),u=s[n[0]],d=s[n[1]],x=s[n[2]],p=s[n[3]],m=cE(l),D=cE(c);for(let S=0;S<=l;S++){E[0]=(u[0]*(l-S)+x[0]*S)/l|0,E[1]=(u[1]*(l-S)+x[1]*S)/l|0,E[2]=(u[2]*(l-S)+x[2]*S)/l|0,f[0]=(d[0]*(l-S)+p[0]*S)/l|0,f[1]=(d[1]*(l-S)+p[1]*S)/l|0,f[2]=(d[2]*(l-S)+p[2]*S)/l|0;for(let w=0;w<=c;w++,Q++){if((S===0||S===l)&&(w===0||w===c))continue;let Y=0,U=0,K=0;for(let AA=0;AA<=3;AA++)for(let gA=0;gA<=3;gA++,K++){let R=m[S][AA]*D[w][gA];Y+=i[a[K]][0]*R,U+=i[a[K]][1]*R}C[Q]=i.length,i.push([Y,U]),B[Q]=s.length;let Z=new Uint8Array(3);Z[0]=(E[0]*(c-w)+f[0]*w)/c|0,Z[1]=(E[1]*(c-w)+f[1]*w)/c|0,Z[2]=(E[2]*(c-w)+f[2]*w)/c|0,s.push(Z)}}C[0]=a[0],B[0]=n[0],C[c]=a[3],B[c]=n[1],C[h*l]=a[12],B[h*l]=n[2],C[h*l+c]=a[15],B[h*l+c]=n[3],this.figures[A]={type:"lattice",coords:C,colors:B,verticesPerRow:h}}_updateBounds(){let A=this.coords[0][0],t=this.coords[0][1],i=A,s=t;for(let a=1,n=this.coords.length;a<n;a++){let r=this.coords[a][0],g=this.coords[a][1];A=A>r?r:A,t=t>g?g:t,i=i<r?r:i,s=s<g?g:s}this.bounds=[A,t,i,s]}_packData(){let A,t,i,s,a=this.coords,n=new Float32Array(a.length*2);for(A=0,i=0,t=a.length;A<t;A++){let I=a[A];n[i++]=I[0],n[i++]=I[1]}this.coords=n;let r=this.colors,g=new Uint8Array(r.length*3);for(A=0,i=0,t=r.length;A<t;A++){let I=r[A];g[i++]=I[0],g[i++]=I[1],g[i++]=I[2]}this.colors=g;let o=this.figures;for(A=0,t=o.length;A<t;A++){let I=o[A],c=I.coords,l=I.colors;for(i=0,s=c.length;i<s;i++)c[i]*=2,l[i]*=3}}getIR(){let{bounds:A}=this;if(A[2]-A[0]===0||A[3]-A[1]===0)throw new v(`Invalid MeshShading bounds: [${A}].`);return["Mesh",this.shadingType,this.coords,this.colors,this.figures,A,this.bbox,this.background]}},_0=Gi;et(_0,"MIN_SPLIT_PATCH_CHUNKS_AMOUNT",3),et(_0,"MAX_SPLIT_PATCH_CHUNKS_AMOUNT",20),et(_0,"TRIANGLE_DENSITY",20);var qI=class extends Oi{getIR(){return["Dummy"]}};function lE(e,A,t){let i=Ki(A.getArray("Matrix"),Wt),s=Ei(A.getArray("BBox"),null);if(!s||s[2]-s[0]===0||s[3]-s[1]===0)throw new v("Invalid getTilingPatternIR /BBox array.");let a=A.get("XStep");if(typeof a!="number")throw new v("Invalid getTilingPatternIR /XStep value.");let n=A.get("YStep");if(typeof n!="number")throw new v("Invalid getTilingPatternIR /YStep value.");let r=A.get("PaintType");if(!Number.isInteger(r))throw new v("Invalid getTilingPatternIR /PaintType value.");let g=A.get("TilingType");if(!Number.isInteger(g))throw new v("Invalid getTilingPatternIR /TilingType value.");return["TilingPattern",t,e,i,s,a,n,r,g]}var H2=[1.3877,1,1,1,.97801,.92482,.89552,.91133,.81988,.97566,.98152,.93548,.93548,1.2798,.85284,.92794,1,.96134,1.54657,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.82845,.82845,.85284,.85284,.85284,.75859,.92138,.83908,.7762,.73293,.87289,.73133,.7514,.81921,.87356,.95958,.59526,.75727,.69225,1.04924,.9121,.86943,.79795,.88198,.77958,.70864,.81055,.90399,.88653,.96017,.82577,.77892,.78257,.97507,1.54657,.97507,.85284,.89552,.90176,.88762,.8785,.75241,.8785,.90518,.95015,.77618,.8785,.88401,.91916,.86304,.88401,.91488,.8785,.8801,.8785,.8785,.91343,.7173,1.04106,.8785,.85075,.95794,.82616,.85162,.79492,.88331,1.69808,.88331,.85284,.97801,.89552,.91133,.89552,.91133,1.7801,.89552,1.24487,1.13254,1.12401,.96839,.85284,.68787,.70645,.85592,.90747,1.01466,1.0088,.90323,1,1.07463,1,.91056,.75806,1.19118,.96839,.78864,.82845,.84133,.75859,.83908,.83908,.83908,.83908,.83908,.83908,.77539,.73293,.73133,.73133,.73133,.73133,.95958,.95958,.95958,.95958,.88506,.9121,.86943,.86943,.86943,.86943,.86943,.85284,.87508,.90399,.90399,.90399,.90399,.77892,.79795,.90807,.88762,.88762,.88762,.88762,.88762,.88762,.8715,.75241,.90518,.90518,.90518,.90518,.88401,.88401,.88401,.88401,.8785,.8785,.8801,.8801,.8801,.8801,.8801,.90747,.89049,.8785,.8785,.8785,.8785,.85162,.8785,.85162,.83908,.88762,.83908,.88762,.83908,.88762,.73293,.75241,.73293,.75241,.73293,.75241,.73293,.75241,.87289,.83016,.88506,.93125,.73133,.90518,.73133,.90518,.73133,.90518,.73133,.90518,.73133,.90518,.81921,.77618,.81921,.77618,.81921,.77618,1,1,.87356,.8785,.91075,.89608,.95958,.88401,.95958,.88401,.95958,.88401,.95958,.88401,.95958,.88401,.76229,.90167,.59526,.91916,1,1,.86304,.69225,.88401,1,1,.70424,.79468,.91926,.88175,.70823,.94903,.9121,.8785,1,1,.9121,.8785,.87802,.88656,.8785,.86943,.8801,.86943,.8801,.86943,.8801,.87402,.89291,.77958,.91343,1,1,.77958,.91343,.70864,.7173,.70864,.7173,.70864,.7173,.70864,.7173,1,1,.81055,.75841,.81055,1.06452,.90399,.8785,.90399,.8785,.90399,.8785,.90399,.8785,.90399,.8785,.90399,.8785,.96017,.95794,.77892,.85162,.77892,.78257,.79492,.78257,.79492,.78257,.79492,.9297,.56892,.83908,.88762,.77539,.8715,.87508,.89049,1,1,.81055,1.04106,1.20528,1.20528,1,1.15543,.70674,.98387,.94721,1.33431,1.45894,.95161,1.06303,.83908,.80352,.57184,.6965,.56289,.82001,.56029,.81235,1.02988,.83908,.7762,.68156,.80367,.73133,.78257,.87356,.86943,.95958,.75727,.89019,1.04924,.9121,.7648,.86943,.87356,.79795,.78275,.81055,.77892,.9762,.82577,.99819,.84896,.95958,.77892,.96108,1.01407,.89049,1.02988,.94211,.96108,.8936,.84021,.87842,.96399,.79109,.89049,1.00813,1.02988,.86077,.87445,.92099,.84723,.86513,.8801,.75638,.85714,.78216,.79586,.87965,.94211,.97747,.78287,.97926,.84971,1.02988,.94211,.8801,.94211,.84971,.73133,1,1,1,1,1,1,1,1,1,1,1,1,.90264,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.90518,1,1,1,1,1,1,1,1,1,1,1,1,.90548,1,1,1,1,1,1,.96017,.95794,.96017,.95794,.96017,.95794,.77892,.85162,1,1,.89552,.90527,1,.90363,.92794,.92794,.92794,.92794,.87012,.87012,.87012,.89552,.89552,1.42259,.71143,1.06152,1,1,1.03372,1.03372,.97171,1.4956,2.2807,.93835,.83406,.91133,.84107,.91133,1,1,1,.72021,1,1.23108,.83489,.88525,.88525,.81499,.90527,1.81055,.90527,1.81055,1.31006,1.53711,.94434,1.08696,1,.95018,.77192,.85284,.90747,1.17534,.69825,.9716,1.37077,.90747,.90747,.85356,.90747,.90747,1.44947,.85284,.8941,.8941,.70572,.8,.70572,.70572,.70572,.70572,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.99862,.99862,1,1,1,1,1,1.08004,.91027,1,1,1,.99862,1,1,1,1,1,1,1,1,1,1,1,1,.90727,.90727,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],J2={lineHeight:1.2207,lineGap:.2207},Y2=[1.3877,1,1,1,.97801,.92482,.89552,.91133,.81988,.97566,.98152,.93548,.93548,1.2798,.85284,.92794,1,.96134,1.56239,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.82845,.82845,.85284,.85284,.85284,.75859,.92138,.83908,.7762,.71805,.87289,.73133,.7514,.81921,.87356,.95958,.59526,.75727,.69225,1.04924,.90872,.85938,.79795,.87068,.77958,.69766,.81055,.90399,.88653,.96068,.82577,.77892,.78257,.97507,1.529,.97507,.85284,.89552,.90176,.94908,.86411,.74012,.86411,.88323,.95015,.86411,.86331,.88401,.91916,.86304,.88401,.9039,.86331,.86331,.86411,.86411,.90464,.70852,1.04106,.86331,.84372,.95794,.82616,.84548,.79492,.88331,1.69808,.88331,.85284,.97801,.89552,.91133,.89552,.91133,1.7801,.89552,1.24487,1.13254,1.19129,.96839,.85284,.68787,.70645,.85592,.90747,1.01466,1.0088,.90323,1,1.07463,1,.91056,.75806,1.19118,.96839,.78864,.82845,.84133,.75859,.83908,.83908,.83908,.83908,.83908,.83908,.77539,.71805,.73133,.73133,.73133,.73133,.95958,.95958,.95958,.95958,.88506,.90872,.85938,.85938,.85938,.85938,.85938,.85284,.87068,.90399,.90399,.90399,.90399,.77892,.79795,.90807,.94908,.94908,.94908,.94908,.94908,.94908,.85887,.74012,.88323,.88323,.88323,.88323,.88401,.88401,.88401,.88401,.8785,.86331,.86331,.86331,.86331,.86331,.86331,.90747,.89049,.86331,.86331,.86331,.86331,.84548,.86411,.84548,.83908,.94908,.83908,.94908,.83908,.94908,.71805,.74012,.71805,.74012,.71805,.74012,.71805,.74012,.87289,.79538,.88506,.92726,.73133,.88323,.73133,.88323,.73133,.88323,.73133,.88323,.73133,.88323,.81921,.86411,.81921,.86411,.81921,.86411,1,1,.87356,.86331,.91075,.8777,.95958,.88401,.95958,.88401,.95958,.88401,.95958,.88401,.95958,.88401,.76467,.90167,.59526,.91916,1,1,.86304,.69225,.88401,1,1,.70424,.77312,.91926,.88175,.70823,.94903,.90872,.86331,1,1,.90872,.86331,.86906,.88116,.86331,.85938,.86331,.85938,.86331,.85938,.86331,.87402,.86549,.77958,.90464,1,1,.77958,.90464,.69766,.70852,.69766,.70852,.69766,.70852,.69766,.70852,1,1,.81055,.75841,.81055,1.06452,.90399,.86331,.90399,.86331,.90399,.86331,.90399,.86331,.90399,.86331,.90399,.86331,.96068,.95794,.77892,.84548,.77892,.78257,.79492,.78257,.79492,.78257,.79492,.9297,.56892,.83908,.94908,.77539,.85887,.87068,.89049,1,1,.81055,1.04106,1.20528,1.20528,1,1.15543,.70088,.98387,.94721,1.33431,1.45894,.95161,1.48387,.83908,.80352,.57118,.6965,.56347,.79179,.55853,.80346,1.02988,.83908,.7762,.67174,.86036,.73133,.78257,.87356,.86441,.95958,.75727,.89019,1.04924,.90872,.74889,.85938,.87891,.79795,.7957,.81055,.77892,.97447,.82577,.97466,.87179,.95958,.77892,.94252,.95612,.8753,1.02988,.92733,.94252,.87411,.84021,.8728,.95612,.74081,.8753,1.02189,1.02988,.84814,.87445,.91822,.84723,.85668,.86331,.81344,.87581,.76422,.82046,.96057,.92733,.99375,.78022,.95452,.86015,1.02988,.92733,.86331,.92733,.86015,.73133,1,1,1,1,1,1,1,1,1,1,1,1,.90631,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.88323,1,1,1,1,1,1,1,1,1,1,1,1,.85174,1,1,1,1,1,1,.96068,.95794,.96068,.95794,.96068,.95794,.77892,.84548,1,1,.89552,.90527,1,.90363,.92794,.92794,.92794,.89807,.87012,.87012,.87012,.89552,.89552,1.42259,.71094,1.06152,1,1,1.03372,1.03372,.97171,1.4956,2.2807,.92972,.83406,.91133,.83326,.91133,1,1,1,.72021,1,1.23108,.83489,.88525,.88525,.81499,.90616,1.81055,.90527,1.81055,1.3107,1.53711,.94434,1.08696,1,.95018,.77192,.85284,.90747,1.17534,.69825,.9716,1.37077,.90747,.90747,.85356,.90747,.90747,1.44947,.85284,.8941,.8941,.70572,.8,.70572,.70572,.70572,.70572,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.99862,.99862,1,1,1,1,1,1.08004,.91027,1,1,1,.99862,1,1,1,1,1,1,1,1,1,1,1,1,.90727,.90727,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],K2={lineHeight:1.2207,lineGap:.2207},v2=[1.3877,1,1,1,1.17223,1.1293,.89552,.91133,.80395,1.02269,1.15601,.91056,.91056,1.2798,.85284,.89807,1,.90861,1.39543,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.96309,.96309,.85284,.85284,.85284,.83319,.88071,.8675,.81552,.72346,.85193,.73206,.7522,.81105,.86275,.90685,.6377,.77892,.75593,1.02638,.89249,.84118,.77452,.85374,.75186,.67789,.79776,.88844,.85066,.94309,.77818,.7306,.76659,1.10369,1.38313,1.10369,1.06139,.89552,.8739,.9245,.9245,.83203,.9245,.85865,1.09842,.9245,.9245,1.03297,1.07692,.90918,1.03297,.94959,.9245,.92274,.9245,.9245,1.02933,.77832,1.20562,.9245,.8916,.98986,.86621,.89453,.79004,.94152,1.77256,.94152,.85284,.97801,.89552,.91133,.89552,.91133,1.91729,.89552,1.17889,1.13254,1.16359,.92098,.85284,.68787,.71353,.84737,.90747,1.0088,1.0044,.87683,1,1.09091,1,.92229,.739,1.15642,.92098,.76288,.80504,.80972,.75859,.8675,.8675,.8675,.8675,.8675,.8675,.76318,.72346,.73206,.73206,.73206,.73206,.90685,.90685,.90685,.90685,.86477,.89249,.84118,.84118,.84118,.84118,.84118,.85284,.84557,.88844,.88844,.88844,.88844,.7306,.77452,.86331,.9245,.9245,.9245,.9245,.9245,.9245,.84843,.83203,.85865,.85865,.85865,.85865,.82601,.82601,.82601,.82601,.94469,.9245,.92274,.92274,.92274,.92274,.92274,.90747,.86651,.9245,.9245,.9245,.9245,.89453,.9245,.89453,.8675,.9245,.8675,.9245,.8675,.9245,.72346,.83203,.72346,.83203,.72346,.83203,.72346,.83203,.85193,.8875,.86477,.99034,.73206,.85865,.73206,.85865,.73206,.85865,.73206,.85865,.73206,.85865,.81105,.9245,.81105,.9245,.81105,.9245,1,1,.86275,.9245,.90872,.93591,.90685,.82601,.90685,.82601,.90685,.82601,.90685,1.03297,.90685,.82601,.77896,1.05611,.6377,1.07692,1,1,.90918,.75593,1.03297,1,1,.76032,.9375,.98156,.93407,.77261,1.11429,.89249,.9245,1,1,.89249,.9245,.92534,.86698,.9245,.84118,.92274,.84118,.92274,.84118,.92274,.8667,.86291,.75186,1.02933,1,1,.75186,1.02933,.67789,.77832,.67789,.77832,.67789,.77832,.67789,.77832,1,1,.79776,.97655,.79776,1.23023,.88844,.9245,.88844,.9245,.88844,.9245,.88844,.9245,.88844,.9245,.88844,.9245,.94309,.98986,.7306,.89453,.7306,.76659,.79004,.76659,.79004,.76659,.79004,1.09231,.54873,.8675,.9245,.76318,.84843,.84557,.86651,1,1,.79776,1.20562,1.18622,1.18622,1,1.1437,.67009,.96334,.93695,1.35191,1.40909,.95161,1.48387,.8675,.90861,.6192,.7363,.64824,.82411,.56321,.85696,1.23516,.8675,.81552,.7286,.84134,.73206,.76659,.86275,.84369,.90685,.77892,.85871,1.02638,.89249,.75828,.84118,.85984,.77452,.76466,.79776,.7306,.90782,.77818,.903,.87291,.90685,.7306,.99058,1.03667,.94635,1.23516,.9849,.99058,.92393,.8916,.942,1.03667,.75026,.94635,1.0297,1.23516,.90918,.94048,.98217,.89746,.84153,.92274,.82507,.88832,.84438,.88178,1.03525,.9849,1.00225,.78086,.97248,.89404,1.23516,.9849,.92274,.9849,.89404,.73206,1,1,1,1,1,1,1,1,1,1,1,1,.89693,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.85865,1,1,1,1,1,1,1,1,1,1,1,1,.90933,1,1,1,1,1,1,.94309,.98986,.94309,.98986,.94309,.98986,.7306,.89453,1,1,.89552,.90527,1,.90186,1.12308,1.12308,1.12308,1.12308,1.2566,1.2566,1.2566,.89552,.89552,1.42259,.68994,1.03809,1,1,1.0176,1.0176,1.11523,1.4956,2.01462,.97858,.82616,.91133,.83437,.91133,1,1,1,.70508,1,1.23108,.79801,.84426,.84426,.774,.90572,1.81055,.90749,1.81055,1.28809,1.55469,.94434,1.07806,1,.97094,.7589,.85284,.90747,1.19658,.69825,.97622,1.33512,.90747,.90747,.85284,.90747,.90747,1.44947,.85284,.8941,.8941,.70572,.8,.70572,.70572,.70572,.70572,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.99862,.99862,1,1,1,1,1,1.0336,.91027,1,1,1,.99862,1,1,1,1,1,1,1,1,1,1,1,1,1.05859,1.05859,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],q2={lineHeight:1.2207,lineGap:.2207},T2=[1.3877,1,1,1,1.17223,1.1293,.89552,.91133,.80395,1.02269,1.15601,.91056,.91056,1.2798,.85284,.89807,1,.90861,1.39016,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.91133,.96309,.96309,.85284,.85284,.85284,.83319,.88071,.8675,.81552,.73834,.85193,.73206,.7522,.81105,.86275,.90685,.6377,.77892,.75593,1.02638,.89385,.85122,.77452,.86503,.75186,.68887,.79776,.88844,.85066,.94258,.77818,.7306,.76659,1.10369,1.39016,1.10369,1.06139,.89552,.8739,.86128,.94469,.8457,.94469,.89464,1.09842,.84636,.94469,1.03297,1.07692,.90918,1.03297,.95897,.94469,.9482,.94469,.94469,1.04692,.78223,1.20562,.94469,.90332,.98986,.86621,.90527,.79004,.94152,1.77256,.94152,.85284,.97801,.89552,.91133,.89552,.91133,1.91729,.89552,1.17889,1.13254,1.08707,.92098,.85284,.68787,.71353,.84737,.90747,1.0088,1.0044,.87683,1,1.09091,1,.92229,.739,1.15642,.92098,.76288,.80504,.80972,.75859,.8675,.8675,.8675,.8675,.8675,.8675,.76318,.73834,.73206,.73206,.73206,.73206,.90685,.90685,.90685,.90685,.86477,.89385,.85122,.85122,.85122,.85122,.85122,.85284,.85311,.88844,.88844,.88844,.88844,.7306,.77452,.86331,.86128,.86128,.86128,.86128,.86128,.86128,.8693,.8457,.89464,.89464,.89464,.89464,.82601,.82601,.82601,.82601,.94469,.94469,.9482,.9482,.9482,.9482,.9482,.90747,.86651,.94469,.94469,.94469,.94469,.90527,.94469,.90527,.8675,.86128,.8675,.86128,.8675,.86128,.73834,.8457,.73834,.8457,.73834,.8457,.73834,.8457,.85193,.92454,.86477,.9921,.73206,.89464,.73206,.89464,.73206,.89464,.73206,.89464,.73206,.89464,.81105,.84636,.81105,.84636,.81105,.84636,1,1,.86275,.94469,.90872,.95786,.90685,.82601,.90685,.82601,.90685,.82601,.90685,1.03297,.90685,.82601,.77741,1.05611,.6377,1.07692,1,1,.90918,.75593,1.03297,1,1,.76032,.90452,.98156,1.11842,.77261,1.11429,.89385,.94469,1,1,.89385,.94469,.95877,.86901,.94469,.85122,.9482,.85122,.9482,.85122,.9482,.8667,.90016,.75186,1.04692,1,1,.75186,1.04692,.68887,.78223,.68887,.78223,.68887,.78223,.68887,.78223,1,1,.79776,.92188,.79776,1.23023,.88844,.94469,.88844,.94469,.88844,.94469,.88844,.94469,.88844,.94469,.88844,.94469,.94258,.98986,.7306,.90527,.7306,.76659,.79004,.76659,.79004,.76659,.79004,1.09231,.54873,.8675,.86128,.76318,.8693,.85311,.86651,1,1,.79776,1.20562,1.18622,1.18622,1,1.1437,.67742,.96334,.93695,1.35191,1.40909,.95161,1.48387,.86686,.90861,.62267,.74359,.65649,.85498,.56963,.88254,1.23516,.8675,.81552,.75443,.84503,.73206,.76659,.86275,.85122,.90685,.77892,.85746,1.02638,.89385,.75657,.85122,.86275,.77452,.74171,.79776,.7306,.95165,.77818,.89772,.88831,.90685,.7306,.98142,1.02191,.96576,1.23516,.99018,.98142,.9236,.89258,.94035,1.02191,.78848,.96576,.9561,1.23516,.90918,.92578,.95424,.89746,.83969,.9482,.80113,.89442,.85208,.86155,.98022,.99018,1.00452,.81209,.99247,.89181,1.23516,.99018,.9482,.99018,.89181,.73206,1,1,1,1,1,1,1,1,1,1,1,1,.88844,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.89464,1,1,1,1,1,1,1,1,1,1,1,1,.96766,1,1,1,1,1,1,.94258,.98986,.94258,.98986,.94258,.98986,.7306,.90527,1,1,.89552,.90527,1,.90186,1.12308,1.12308,1.12308,1.12308,1.2566,1.2566,1.2566,.89552,.89552,1.42259,.69043,1.03809,1,1,1.0176,1.0176,1.11523,1.4956,2.01462,.99331,.82616,.91133,.84286,.91133,1,1,1,.70508,1,1.23108,.79801,.84426,.84426,.774,.90527,1.81055,.90527,1.81055,1.28809,1.55469,.94434,1.07806,1,.97094,.7589,.85284,.90747,1.19658,.69825,.97622,1.33512,.90747,.90747,.85356,.90747,.90747,1.44947,.85284,.8941,.8941,.70572,.8,.70572,.70572,.70572,.70572,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.99862,.99862,1,1,1,1,1,1.0336,.91027,1,1,1,.99862,1,1,1,1,1,1,1,1,1,1,1,1,1.05859,1.05859,1,1,1,1.07185,.99413,.96334,1.08065,1,1,1,1,1,1,1,1,1,1,1],P2={lineHeight:1.2207,lineGap:.2207},W2=[.76116,1,1,1.0006,.99998,.99974,.99973,.99973,.99982,.99977,1.00087,.99998,.99998,.99959,1.00003,1.0006,.99998,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99998,1,1.00003,1.00003,1.00003,1.00026,.9999,.99977,.99977,.99977,.99977,1.00001,1.00026,1.00022,.99977,1.0006,.99973,.99977,1.00026,.99999,.99977,1.00022,1.00001,1.00022,.99977,1.00001,1.00026,.99977,1.00001,1.00016,1.00001,1.00001,1.00026,.99998,1.0006,.99998,1.00003,.99973,.99998,.99973,1.00026,.99973,1.00026,.99973,.99998,1.00026,1.00026,1.0006,1.0006,.99973,1.0006,.99982,1.00026,1.00026,1.00026,1.00026,.99959,.99973,.99998,1.00026,.99973,1.00022,.99973,.99973,1,.99959,1.00077,.99959,1.00003,.99998,.99973,.99973,.99973,.99973,1.00077,.99973,.99998,1.00025,.99968,.99973,1.00003,1.00025,.60299,1.00024,1.06409,1,1,.99998,1,.99973,1.0006,.99998,1,.99936,.99973,1.00002,1.00002,1.00002,1.00026,.99977,.99977,.99977,.99977,.99977,.99977,1,.99977,1.00001,1.00001,1.00001,1.00001,1.0006,1.0006,1.0006,1.0006,.99977,.99977,1.00022,1.00022,1.00022,1.00022,1.00022,1.00003,1.00022,.99977,.99977,.99977,.99977,1.00001,1.00001,1.00026,.99973,.99973,.99973,.99973,.99973,.99973,.99982,.99973,.99973,.99973,.99973,.99973,1.0006,1.0006,1.0006,1.0006,1.00026,1.00026,1.00026,1.00026,1.00026,1.00026,1.00026,1.06409,1.00026,1.00026,1.00026,1.00026,1.00026,.99973,1.00026,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,1.03374,.99977,1.00026,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,.99977,1.00026,.99977,1.00026,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.00042,.99973,.99973,1.0006,.99977,.99973,.99973,1.00026,1.0006,1.00026,1.0006,1.00026,1.03828,1.00026,.99999,1.00026,1.0006,.99977,1.00026,.99977,1.00026,.99977,1.00026,.9993,.9998,1.00026,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,1,1.00016,.99977,.99959,.99977,.99959,.99977,.99959,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00026,.99998,1.00026,.8121,1.00026,.99998,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,1.00016,1.00022,1.00001,.99973,1.00001,1.00026,1,1.00026,1,1.00026,1,1.0006,.99973,.99977,.99973,1,.99982,1.00022,1.00026,1.00001,.99973,1.00026,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,1.00034,.99977,1,.99997,1.00026,1.00078,1.00036,.99973,1.00013,1.0006,.99977,.99977,.99988,.85148,1.00001,1.00026,.99977,1.00022,1.0006,.99977,1.00001,.99999,.99977,1.00069,1.00022,.99977,1.00001,.99984,1.00026,1.00001,1.00024,1.00001,.9999,1,1.0006,1.00001,1.00041,.99962,1.00026,1.0006,.99995,1.00041,.99942,.99973,.99927,1.00082,.99902,1.00026,1.00087,1.0006,1.00069,.99973,.99867,.99973,.9993,1.00026,1.00049,1.00056,1,.99988,.99935,.99995,.99954,1.00055,.99945,1.00032,1.0006,.99995,1.00026,.99995,1.00032,1.00001,1.00008,.99971,1.00019,.9994,1.00001,1.0006,1.00044,.99973,1.00023,1.00047,1,.99942,.99561,.99989,1.00035,.99977,1.00035,.99977,1.00019,.99944,1.00001,1.00021,.99926,1.00035,1.00035,.99942,1.00048,.99999,.99977,1.00022,1.00035,1.00001,.99977,1.00026,.99989,1.00057,1.00001,.99936,1.00052,1.00012,.99996,1.00043,1,1.00035,.9994,.99976,1.00035,.99973,1.00052,1.00041,1.00119,1.00037,.99973,1.00002,.99986,1.00041,1.00041,.99902,.9996,1.00034,.99999,1.00026,.99999,1.00026,.99973,1.00052,.99973,1,.99973,1.00041,1.00075,.9994,1.0003,.99999,1,1.00041,.99955,1,.99915,.99973,.99973,1.00026,1.00119,.99955,.99973,1.0006,.99911,1.0006,1.00026,.99972,1.00026,.99902,1.00041,.99973,.99999,1,1,1.00038,1.0005,1.00016,1.00022,1.00016,1.00022,1.00016,1.00022,1.00001,.99973,1,1,.99973,1,1,.99955,1.0006,1.0006,1.0006,1.0006,1,1,1,.99973,.99973,.99972,1,1,1.00106,.99999,.99998,.99998,.99999,.99998,1.66475,1,.99973,.99973,1.00023,.99973,.99971,1.00047,1.00023,1,.99991,.99984,1.00002,1.00002,1.00002,1.00002,1,1,1,1,1,1,1,.99972,1,1.20985,1.39713,1.00003,1.00031,1.00015,1,.99561,1.00027,1.00031,1.00031,.99915,1.00031,1.00031,.99999,1.00003,.99999,.99999,1.41144,1.6,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.40579,1.40579,1.36625,.99999,1,.99861,.99861,1,1.00026,1.00026,1.00026,1.00026,.99972,.99999,.99999,.99999,.99999,1.40483,1,.99977,1.00054,1,1,.99953,.99962,1.00042,.9995,1,1,1,1,1,1,1,1,.99998,.99998,.99998,.99998,1,1,1,1,1,1,1,1,1,1,1],O2={lineHeight:1.2,lineGap:.2},Z2=[.76116,1,1,1.0006,.99998,.99974,.99973,.99973,.99982,.99977,1.00087,.99998,.99998,.99959,1.00003,1.0006,.99998,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99998,1,1.00003,1.00003,1.00003,1.00026,.9999,.99977,.99977,.99977,.99977,1.00001,1.00026,1.00022,.99977,1.0006,.99973,.99977,1.00026,.99999,.99977,1.00022,1.00001,1.00022,.99977,1.00001,1.00026,.99977,1.00001,1.00016,1.00001,1.00001,1.00026,.99998,1.0006,.99998,1.00003,.99973,.99998,.99973,1.00026,.99973,1.00026,.99973,.99998,1.00026,1.00026,1.0006,1.0006,.99973,1.0006,.99982,1.00026,1.00026,1.00026,1.00026,.99959,.99973,.99998,1.00026,.99973,1.00022,.99973,.99973,1,.99959,1.00077,.99959,1.00003,.99998,.99973,.99973,.99973,.99973,1.00077,.99973,.99998,1.00025,.99968,.99973,1.00003,1.00025,.60299,1.00024,1.06409,1,1,.99998,1,.99973,1.0006,.99998,1,.99936,.99973,1.00002,1.00002,1.00002,1.00026,.99977,.99977,.99977,.99977,.99977,.99977,1,.99977,1.00001,1.00001,1.00001,1.00001,1.0006,1.0006,1.0006,1.0006,.99977,.99977,1.00022,1.00022,1.00022,1.00022,1.00022,1.00003,1.00022,.99977,.99977,.99977,.99977,1.00001,1.00001,1.00026,.99973,.99973,.99973,.99973,.99973,.99973,.99982,.99973,.99973,.99973,.99973,.99973,1.0006,1.0006,1.0006,1.0006,1.00026,1.00026,1.00026,1.00026,1.00026,1.00026,1.00026,1.06409,1.00026,1.00026,1.00026,1.00026,1.00026,.99973,1.00026,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,1.0044,.99977,1.00026,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,.99977,1.00026,.99977,1.00026,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,.99971,.99973,.99973,1.0006,.99977,.99973,.99973,1.00026,1.0006,1.00026,1.0006,1.00026,1.01011,1.00026,.99999,1.00026,1.0006,.99977,1.00026,.99977,1.00026,.99977,1.00026,.9993,.9998,1.00026,1.00022,1.00026,1.00022,1.00026,1.00022,1.00026,1,1.00016,.99977,.99959,.99977,.99959,.99977,.99959,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00026,.99998,1.00026,.8121,1.00026,.99998,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,.99977,1.00026,1.00016,1.00022,1.00001,.99973,1.00001,1.00026,1,1.00026,1,1.00026,1,1.0006,.99973,.99977,.99973,1,.99982,1.00022,1.00026,1.00001,.99973,1.00026,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99977,1,1,1.00026,.99969,.99972,.99981,.9998,1.0006,.99977,.99977,1.00022,.91155,1.00001,1.00026,.99977,1.00022,1.0006,.99977,1.00001,.99999,.99977,.99966,1.00022,1.00032,1.00001,.99944,1.00026,1.00001,.99968,1.00001,1.00047,1,1.0006,1.00001,.99981,1.00101,1.00026,1.0006,.99948,.99981,1.00064,.99973,.99942,1.00101,1.00061,1.00026,1.00069,1.0006,1.00014,.99973,1.01322,.99973,1.00065,1.00026,1.00012,.99923,1,1.00064,1.00076,.99948,1.00055,1.00063,1.00007,.99943,1.0006,.99948,1.00026,.99948,.99943,1.00001,1.00001,1.00029,1.00038,1.00035,1.00001,1.0006,1.0006,.99973,.99978,1.00001,1.00057,.99989,.99967,.99964,.99967,.99977,.99999,.99977,1.00038,.99977,1.00001,.99973,1.00066,.99967,.99967,1.00041,.99998,.99999,.99977,1.00022,.99967,1.00001,.99977,1.00026,.99964,1.00031,1.00001,.99999,.99999,1,1.00023,1,1,.99999,1.00035,1.00001,.99999,.99973,.99977,.99999,1.00058,.99973,.99973,.99955,.9995,1.00026,1.00026,1.00032,.99989,1.00034,.99999,1.00026,1.00026,1.00026,.99973,.45998,.99973,1.00026,.99973,1.00001,.99999,.99982,.99994,.99996,1,1.00042,1.00044,1.00029,1.00023,.99973,.99973,1.00026,.99949,1.00002,.99973,1.0006,1.0006,1.0006,.99975,1.00026,1.00026,1.00032,.98685,.99973,1.00026,1,1,.99966,1.00044,1.00016,1.00022,1.00016,1.00022,1.00016,1.00022,1.00001,.99973,1,1,.99973,1,1,.99955,1.0006,1.0006,1.0006,1.0006,1,1,1,.99973,.99973,.99972,1,1,1.00106,.99999,.99998,.99998,.99999,.99998,1.66475,1,.99973,.99973,1,.99973,.99971,.99978,1,1,.99991,.99984,1.00002,1.00002,1.00002,1.00002,1.00098,1,1,1,1.00049,1,1,.99972,1,1.20985,1.39713,1.00003,1.00031,1.00015,1,.99561,1.00027,1.00031,1.00031,.99915,1.00031,1.00031,.99999,1.00003,.99999,.99999,1.41144,1.6,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.40579,1.40579,1.36625,.99999,1,.99861,.99861,1,1.00026,1.00026,1.00026,1.00026,.99972,.99999,.99999,.99999,.99999,1.40483,1,.99977,1.00054,1,1,.99953,.99962,1.00042,.9995,1,1,1,1,1,1,1,1,.99998,.99998,.99998,.99998,1,1,1,1,1,1,1,1,1,1,1],j2={lineHeight:1.35,lineGap:.2},X2=[.76116,1,1,1.0006,1.0006,1.00006,.99973,.99973,.99982,1.00001,1.00043,.99998,.99998,.99959,1.00003,1.0006,.99998,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,1.0006,1,1.00003,1.00003,1.00003,.99973,.99987,1.00001,1.00001,.99977,.99977,1.00001,1.00026,1.00022,.99977,1.0006,1,1.00001,.99973,.99999,.99977,1.00022,1.00001,1.00022,.99977,1.00001,1.00026,.99977,1.00001,1.00016,1.00001,1.00001,1.00026,1.0006,1.0006,1.0006,.99949,.99973,.99998,.99973,.99973,1,.99973,.99973,1.0006,.99973,.99973,.99924,.99924,1,.99924,.99999,.99973,.99973,.99973,.99973,.99998,1,1.0006,.99973,1,.99977,1,1,1,1.00005,1.0009,1.00005,1.00003,.99998,.99973,.99973,.99973,.99973,1.0009,.99973,.99998,1.00025,.99968,.99973,1.00003,1.00025,.60299,1.00024,1.06409,1,1,.99998,1,.9998,1.0006,.99998,1,.99936,.99973,1.00002,1.00002,1.00002,1.00026,1.00001,1.00001,1.00001,1.00001,1.00001,1.00001,1,.99977,1.00001,1.00001,1.00001,1.00001,1.0006,1.0006,1.0006,1.0006,.99977,.99977,1.00022,1.00022,1.00022,1.00022,1.00022,1.00003,1.00022,.99977,.99977,.99977,.99977,1.00001,1.00001,1.00026,.99973,.99973,.99973,.99973,.99973,.99973,.99982,1,.99973,.99973,.99973,.99973,1.0006,1.0006,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,1.06409,1.00026,.99973,.99973,.99973,.99973,1,.99973,1,1.00001,.99973,1.00001,.99973,1.00001,.99973,.99977,1,.99977,1,.99977,1,.99977,1,.99977,1.0288,.99977,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,.99977,.99973,.99977,.99973,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,.99924,1.0006,1.0006,.99946,1.00034,1,.99924,1.00001,1,1,.99973,.99924,.99973,.99924,.99973,1.06311,.99973,1.00024,.99973,.99924,.99977,.99973,.99977,.99973,.99977,.99973,1.00041,.9998,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,1,1.00016,.99977,.99998,.99977,.99998,.99977,.99998,1.00001,1,1.00001,1,1.00001,1,1.00001,1,1.00026,1.0006,1.00026,.89547,1.00026,1.0006,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,1.00016,.99977,1.00001,1,1.00001,1.00026,1,1.00026,1,1.00026,1,.99924,.99973,1.00001,.99973,1,.99982,1.00022,1.00026,1.00001,1,1.00026,1.0006,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,1.00001,1,1.00054,.99977,1.00084,1.00007,.99973,1.00013,.99924,1.00001,1.00001,.99945,.91221,1.00001,1.00026,.99977,1.00022,1.0006,1.00001,1.00001,.99999,.99977,.99933,1.00022,1.00054,1.00001,1.00065,1.00026,1.00001,1.0001,1.00001,1.00052,1,1.0006,1.00001,.99945,.99897,.99968,.99924,1.00036,.99945,.99949,1,1.0006,.99897,.99918,.99968,.99911,.99924,1,.99962,1.01487,1,1.0005,.99973,1.00012,1.00043,1,.99995,.99994,1.00036,.99947,1.00019,1.00063,1.00025,.99924,1.00036,.99973,1.00036,1.00025,1.00001,1.00001,1.00027,1.0001,1.00068,1.00001,1.0006,1.0006,1,1.00008,.99957,.99972,.9994,.99954,.99975,1.00051,1.00001,1.00019,1.00001,1.0001,.99986,1.00001,1.00001,1.00038,.99954,.99954,.9994,1.00066,.99999,.99977,1.00022,1.00054,1.00001,.99977,1.00026,.99975,1.0001,1.00001,.99993,.9995,.99955,1.00016,.99978,.99974,1.00019,1.00022,.99955,1.00053,.99973,1.00089,1.00005,.99967,1.00048,.99973,1.00002,1.00034,.99973,.99973,.99964,1.00006,1.00066,.99947,.99973,.98894,.99973,1,.44898,1,.99946,1,1.00039,1.00082,.99991,.99991,.99985,1.00022,1.00023,1.00061,1.00006,.99966,.99973,.99973,.99973,1.00019,1.0008,1,.99924,.99924,.99924,.99983,1.00044,.99973,.99964,.98332,1,.99973,1,1,.99962,.99895,1.00016,.99977,1.00016,.99977,1.00016,.99977,1.00001,1,1,1,.99973,1,1,.99955,.99924,.99924,.99924,.99924,.99998,.99998,.99998,.99973,.99973,.99972,1,1,1.00267,.99999,.99998,.99998,1,.99998,1.66475,1,.99973,.99973,1.00023,.99973,1.00423,.99925,.99999,1,.99991,.99984,1.00002,1.00002,1.00002,1.00002,1.00049,1,1.00245,1,1,1,1,.96329,1,1.20985,1.39713,1.00003,.8254,1.00015,1,1.00035,1.00027,1.00031,1.00031,1.00003,1.00031,1.00031,.99999,1.00003,.99999,.99999,1.41144,1.6,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.40579,1.40579,1.36625,.99999,1,.99861,.99861,1,1.00026,1.00026,1.00026,1.00026,.95317,.99999,.99999,.99999,.99999,1.40483,1,.99977,1.00054,1,1,.99953,.99962,1.00042,.9995,1,1,1,1,1,1,1,1,.99998,.99998,.99998,.99998,1,1,1,1,1,1,1,1,1,1,1],V2={lineHeight:1.35,lineGap:.2},_2=[.76116,1,1,1.0006,1.0006,1.00006,.99973,.99973,.99982,1.00001,1.00043,.99998,.99998,.99959,1.00003,1.0006,.99998,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,.99973,1.0006,1,1.00003,1.00003,1.00003,.99973,.99987,1.00001,1.00001,.99977,.99977,1.00001,1.00026,1.00022,.99977,1.0006,1,1.00001,.99973,.99999,.99977,1.00022,1.00001,1.00022,.99977,1.00001,1.00026,.99977,1.00001,1.00016,1.00001,1.00001,1.00026,1.0006,1.0006,1.0006,.99949,.99973,.99998,.99973,.99973,1,.99973,.99973,1.0006,.99973,.99973,.99924,.99924,1,.99924,.99999,.99973,.99973,.99973,.99973,.99998,1,1.0006,.99973,1,.99977,1,1,1,1.00005,1.0009,1.00005,1.00003,.99998,.99973,.99973,.99973,.99973,1.0009,.99973,.99998,1.00025,.99968,.99973,1.00003,1.00025,.60299,1.00024,1.06409,1,1,.99998,1,.9998,1.0006,.99998,1,.99936,.99973,1.00002,1.00002,1.00002,1.00026,1.00001,1.00001,1.00001,1.00001,1.00001,1.00001,1,.99977,1.00001,1.00001,1.00001,1.00001,1.0006,1.0006,1.0006,1.0006,.99977,.99977,1.00022,1.00022,1.00022,1.00022,1.00022,1.00003,1.00022,.99977,.99977,.99977,.99977,1.00001,1.00001,1.00026,.99973,.99973,.99973,.99973,.99973,.99973,.99982,1,.99973,.99973,.99973,.99973,1.0006,1.0006,1.0006,1.0006,.99973,.99973,.99973,.99973,.99973,.99973,.99973,1.06409,1.00026,.99973,.99973,.99973,.99973,1,.99973,1,1.00001,.99973,1.00001,.99973,1.00001,.99973,.99977,1,.99977,1,.99977,1,.99977,1,.99977,1.04596,.99977,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00001,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,.99977,.99973,.99977,.99973,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,1.0006,.99924,1.0006,1.0006,1.00019,1.00034,1,.99924,1.00001,1,1,.99973,.99924,.99973,.99924,.99973,1.02572,.99973,1.00005,.99973,.99924,.99977,.99973,.99977,.99973,.99977,.99973,.99999,.9998,.99973,1.00022,.99973,1.00022,.99973,1.00022,.99973,1,1.00016,.99977,.99998,.99977,.99998,.99977,.99998,1.00001,1,1.00001,1,1.00001,1,1.00001,1,1.00026,1.0006,1.00026,.84533,1.00026,1.0006,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,.99977,.99973,1.00016,.99977,1.00001,1,1.00001,1.00026,1,1.00026,1,1.00026,1,.99924,.99973,1.00001,.99973,1,.99982,1.00022,1.00026,1.00001,1,1.00026,1.0006,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99998,.99928,1,.99977,1.00013,1.00055,.99947,.99945,.99941,.99924,1.00001,1.00001,1.0004,.91621,1.00001,1.00026,.99977,1.00022,1.0006,1.00001,1.00005,.99999,.99977,1.00015,1.00022,.99977,1.00001,.99973,1.00026,1.00001,1.00019,1.00001,.99946,1,1.0006,1.00001,.99978,1.00045,.99973,.99924,1.00023,.99978,.99966,1,1.00065,1.00045,1.00019,.99973,.99973,.99924,1,1,.96499,1,1.00055,.99973,1.00008,1.00027,1,.9997,.99995,1.00023,.99933,1.00019,1.00015,1.00031,.99924,1.00023,.99973,1.00023,1.00031,1.00001,.99928,1.00029,1.00092,1.00035,1.00001,1.0006,1.0006,1,.99988,.99975,1,1.00082,.99561,.9996,1.00035,1.00001,.99962,1.00001,1.00092,.99964,1.00001,.99963,.99999,1.00035,1.00035,1.00082,.99962,.99999,.99977,1.00022,1.00035,1.00001,.99977,1.00026,.9996,.99967,1.00001,1.00034,1.00074,1.00054,1.00053,1.00063,.99971,.99962,1.00035,.99975,.99977,.99973,1.00043,.99953,1.0007,.99915,.99973,1.00008,.99892,1.00073,1.00073,1.00114,.99915,1.00073,.99955,.99973,1.00092,.99973,1,.99998,1,1.0003,1,1.00043,1.00001,.99969,1.0003,1,1.00035,1.00001,.9995,1,1.00092,.99973,.99973,.99973,1.0007,.9995,1,.99924,1.0006,.99924,.99972,1.00062,.99973,1.00114,1.00073,1,.99955,1,1,1.00047,.99968,1.00016,.99977,1.00016,.99977,1.00016,.99977,1.00001,1,1,1,.99973,1,1,.99955,.99924,.99924,.99924,.99924,.99998,.99998,.99998,.99973,.99973,.99972,1,1,1.00267,.99999,.99998,.99998,1,.99998,1.66475,1,.99973,.99973,1.00023,.99973,.99971,.99925,1.00023,1,.99991,.99984,1.00002,1.00002,1.00002,1.00002,1,1,1,1,1,1,1,.96329,1,1.20985,1.39713,1.00003,.8254,1.00015,1,1.00035,1.00027,1.00031,1.00031,.99915,1.00031,1.00031,.99999,1.00003,.99999,.99999,1.41144,1.6,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.41144,1.40579,1.40579,1.36625,.99999,1,.99861,.99861,1,1.00026,1.00026,1.00026,1.00026,.95317,.99999,.99999,.99999,.99999,1.40483,1,.99977,1.00054,1,1,.99953,.99962,1.00042,.9995,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],z2={lineHeight:1.2,lineGap:.2},ta=[365,0,333,278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,333,556,556,556,556,280,556,333,737,370,556,584,737,552,400,549,333,333,333,576,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,549,611,611,611,611,611,556,611,556,722,556,722,556,722,556,722,556,722,556,722,556,722,556,722,719,722,611,667,556,667,556,667,556,667,556,667,556,778,611,778,611,778,611,778,611,722,611,722,611,278,278,278,278,278,278,278,278,278,278,785,556,556,278,722,556,556,611,278,611,278,611,385,611,479,611,278,722,611,722,611,722,611,708,723,611,778,611,778,611,778,611,1e3,944,722,389,722,389,722,389,667,556,667,556,667,556,667,556,611,333,611,479,611,333,722,611,722,611,722,611,722,611,722,611,722,611,944,778,667,556,667,611,500,611,500,611,500,278,556,722,556,1e3,889,778,611,667,556,611,333,333,333,333,333,333,333,333,333,333,333,465,722,333,853,906,474,825,927,838,278,722,722,601,719,667,611,722,778,278,722,667,833,722,644,778,722,667,600,611,667,821,667,809,802,278,667,615,451,611,278,582,615,610,556,606,475,460,611,541,278,558,556,612,556,445,611,766,619,520,684,446,582,715,576,753,845,278,582,611,582,845,667,669,885,567,711,667,278,276,556,1094,1062,875,610,722,622,719,722,719,722,567,712,667,904,626,719,719,610,702,833,722,778,719,667,722,611,622,854,667,730,703,1005,1019,870,979,719,711,1031,719,556,618,615,417,635,556,709,497,615,615,500,635,740,604,611,604,611,556,490,556,875,556,615,581,833,844,729,854,615,552,854,583,556,556,611,417,552,556,278,281,278,969,906,611,500,615,556,604,778,611,487,447,944,778,944,778,944,778,667,556,333,333,556,1e3,1e3,552,278,278,278,278,500,500,500,556,556,350,1e3,1e3,240,479,333,333,604,333,167,396,556,556,1094,556,885,489,1115,1e3,768,600,834,834,834,834,1e3,500,1e3,500,1e3,500,500,494,612,823,713,584,549,713,979,722,274,549,549,583,549,549,604,584,604,604,708,625,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,729,604,604,354,354,1e3,990,990,990,990,494,604,604,604,604,354,1021,1052,917,750,750,531,656,594,510,500,750,750,611,611,333,333,333,333,333,333,333,333,222,222,333,333,333,333,333,333,333,333],ia=[-1,-1,-1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,402,506,507,508,509,510,511,536,537,538,539,710,711,713,728,729,730,731,732,733,900,901,902,903,904,905,906,908,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1138,1139,1168,1169,7808,7809,7810,7811,7812,7813,7922,7923,8208,8209,8211,8212,8213,8215,8216,8217,8218,8219,8220,8221,8222,8224,8225,8226,8230,8240,8242,8243,8249,8250,8252,8254,8260,8319,8355,8356,8359,8364,8453,8467,8470,8482,8486,8494,8539,8540,8541,8542,8592,8593,8594,8595,8596,8597,8616,8706,8710,8719,8721,8722,8730,8734,8735,8745,8747,8776,8800,8801,8804,8805,8962,8976,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632,9633,9642,9643,9644,9650,9658,9660,9668,9674,9675,9679,9688,9689,9702,9786,9787,9788,9792,9794,9824,9827,9829,9830,9834,9835,9836,61441,61442,61445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],sa=[365,0,333,278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,333,556,556,556,556,280,556,333,737,370,556,584,737,552,400,549,333,333,333,576,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,549,611,611,611,611,611,556,611,556,722,556,722,556,722,556,722,556,722,556,722,556,722,556,722,740,722,611,667,556,667,556,667,556,667,556,667,556,778,611,778,611,778,611,778,611,722,611,722,611,278,278,278,278,278,278,278,278,278,278,782,556,556,278,722,556,556,611,278,611,278,611,396,611,479,611,278,722,611,722,611,722,611,708,723,611,778,611,778,611,778,611,1e3,944,722,389,722,389,722,389,667,556,667,556,667,556,667,556,611,333,611,479,611,333,722,611,722,611,722,611,722,611,722,611,722,611,944,778,667,556,667,611,500,611,500,611,500,278,556,722,556,1e3,889,778,611,667,556,611,333,333,333,333,333,333,333,333,333,333,333,333,722,333,854,906,473,844,930,847,278,722,722,610,671,667,611,722,778,278,722,667,833,722,657,778,718,667,590,611,667,822,667,829,781,278,667,620,479,611,278,591,620,621,556,610,479,492,611,558,278,566,556,603,556,450,611,712,605,532,664,409,591,704,578,773,834,278,591,611,591,834,667,667,886,614,719,667,278,278,556,1094,1042,854,622,719,677,719,722,708,722,614,722,667,927,643,719,719,615,687,833,722,778,719,667,722,611,677,781,667,729,708,979,989,854,1e3,708,719,1042,729,556,619,604,534,618,556,736,510,611,611,507,622,740,604,611,611,611,556,889,556,885,556,646,583,889,935,707,854,594,552,865,589,556,556,611,469,563,556,278,278,278,969,906,611,507,619,556,611,778,611,575,467,944,778,944,778,944,778,667,556,333,333,556,1e3,1e3,552,278,278,278,278,500,500,500,556,556,350,1e3,1e3,240,479,333,333,604,333,167,396,556,556,1104,556,885,516,1146,1e3,768,600,834,834,834,834,999,500,1e3,500,1e3,500,500,494,612,823,713,584,549,713,979,722,274,549,549,583,549,549,604,584,604,604,708,625,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,729,604,604,354,354,1e3,990,990,990,990,494,604,604,604,604,354,1021,1052,917,750,750,531,656,594,510,500,750,750,611,611,333,333,333,333,333,333,333,333,222,222,333,333,333,333,333,333,333,333],aa=[-1,-1,-1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,402,506,507,508,509,510,511,536,537,538,539,710,711,713,728,729,730,731,732,733,900,901,902,903,904,905,906,908,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1138,1139,1168,1169,7808,7809,7810,7811,7812,7813,7922,7923,8208,8209,8211,8212,8213,8215,8216,8217,8218,8219,8220,8221,8222,8224,8225,8226,8230,8240,8242,8243,8249,8250,8252,8254,8260,8319,8355,8356,8359,8364,8453,8467,8470,8482,8486,8494,8539,8540,8541,8542,8592,8593,8594,8595,8596,8597,8616,8706,8710,8719,8721,8722,8730,8734,8735,8745,8747,8776,8800,8801,8804,8805,8962,8976,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632,9633,9642,9643,9644,9650,9658,9660,9668,9674,9675,9679,9688,9689,9702,9786,9787,9788,9792,9794,9824,9827,9829,9830,9834,9835,9836,61441,61442,61445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],na=[365,0,333,278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,333,556,556,556,556,260,556,333,737,370,556,584,737,552,400,549,333,333,333,576,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500,667,556,667,556,667,556,722,500,722,500,722,500,722,500,722,625,722,556,667,556,667,556,667,556,667,556,667,556,778,556,778,556,778,556,778,556,722,556,722,556,278,278,278,278,278,278,278,222,278,278,733,444,500,222,667,500,500,556,222,556,222,556,281,556,400,556,222,722,556,722,556,722,556,615,723,556,778,556,778,556,778,556,1e3,944,722,333,722,333,722,333,667,500,667,500,667,500,667,500,611,278,611,354,611,278,722,556,722,556,722,556,722,556,722,556,722,556,944,722,667,500,667,611,500,611,500,611,500,222,556,667,556,1e3,889,778,611,667,500,611,278,333,333,333,333,333,333,333,333,333,333,333,667,278,789,846,389,794,865,775,222,667,667,570,671,667,611,722,778,278,667,667,833,722,648,778,725,667,600,611,667,837,667,831,761,278,667,570,439,555,222,550,570,571,500,556,439,463,555,542,222,500,492,548,500,447,556,670,573,486,603,374,550,652,546,728,779,222,550,556,550,779,667,667,843,544,708,667,278,278,500,1066,982,844,589,715,639,724,667,651,667,544,704,667,917,614,715,715,589,686,833,722,778,725,667,722,611,639,795,667,727,673,920,923,805,886,651,694,1022,682,556,562,522,493,553,556,688,465,556,556,472,564,686,550,556,556,556,500,833,500,835,500,572,518,830,851,621,736,526,492,752,534,556,556,556,378,496,500,222,222,222,910,828,556,472,565,500,556,778,556,492,339,944,722,944,722,944,722,667,500,333,333,556,1e3,1e3,552,222,222,222,222,333,333,333,556,556,350,1e3,1e3,188,354,333,333,500,333,167,365,556,556,1094,556,885,323,1083,1e3,768,600,834,834,834,834,1e3,500,998,500,1e3,500,500,494,612,823,713,584,549,713,979,719,274,549,549,584,549,549,604,584,604,604,708,625,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,729,604,604,354,354,1e3,990,990,990,990,494,604,604,604,604,354,1021,1052,917,750,750,531,656,594,510,500,750,750,500,500,333,333,333,333,333,333,333,333,222,222,294,294,324,324,316,328,398,285],ra=[-1,-1,-1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,402,506,507,508,509,510,511,536,537,538,539,710,711,713,728,729,730,731,732,733,900,901,902,903,904,905,906,908,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1138,1139,1168,1169,7808,7809,7810,7811,7812,7813,7922,7923,8208,8209,8211,8212,8213,8215,8216,8217,8218,8219,8220,8221,8222,8224,8225,8226,8230,8240,8242,8243,8249,8250,8252,8254,8260,8319,8355,8356,8359,8364,8453,8467,8470,8482,8486,8494,8539,8540,8541,8542,8592,8593,8594,8595,8596,8597,8616,8706,8710,8719,8721,8722,8730,8734,8735,8745,8747,8776,8800,8801,8804,8805,8962,8976,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632,9633,9642,9643,9644,9650,9658,9660,9668,9674,9675,9679,9688,9689,9702,9786,9787,9788,9792,9794,9824,9827,9829,9830,9834,9835,9836,61441,61442,61445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],ga=[365,0,333,278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,333,556,556,556,556,260,556,333,737,370,556,584,737,552,400,549,333,333,333,576,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500,667,556,667,556,667,556,722,500,722,500,722,500,722,500,722,615,722,556,667,556,667,556,667,556,667,556,667,556,778,556,778,556,778,556,778,556,722,556,722,556,278,278,278,278,278,278,278,222,278,278,735,444,500,222,667,500,500,556,222,556,222,556,292,556,334,556,222,722,556,722,556,722,556,604,723,556,778,556,778,556,778,556,1e3,944,722,333,722,333,722,333,667,500,667,500,667,500,667,500,611,278,611,375,611,278,722,556,722,556,722,556,722,556,722,556,722,556,944,722,667,500,667,611,500,611,500,611,500,222,556,667,556,1e3,889,778,611,667,500,611,278,333,333,333,333,333,333,333,333,333,333,333,667,278,784,838,384,774,855,752,222,667,667,551,668,667,611,722,778,278,667,668,833,722,650,778,722,667,618,611,667,798,667,835,748,278,667,578,446,556,222,547,578,575,500,557,446,441,556,556,222,500,500,576,500,448,556,690,569,482,617,395,547,648,525,713,781,222,547,556,547,781,667,667,865,542,719,667,278,278,500,1057,1010,854,583,722,635,719,667,656,667,542,677,667,923,604,719,719,583,656,833,722,778,719,667,722,611,635,760,667,740,667,917,938,792,885,656,719,1010,722,556,573,531,365,583,556,669,458,559,559,438,583,688,552,556,542,556,500,458,500,823,500,573,521,802,823,625,719,521,510,750,542,556,556,556,365,510,500,222,278,222,906,812,556,438,559,500,552,778,556,489,411,944,722,944,722,944,722,667,500,333,333,556,1e3,1e3,552,222,222,222,222,333,333,333,556,556,350,1e3,1e3,188,354,333,333,500,333,167,365,556,556,1094,556,885,323,1073,1e3,768,600,834,834,834,834,1e3,500,1e3,500,1e3,500,500,494,612,823,713,584,549,713,979,719,274,549,549,583,549,549,604,584,604,604,708,625,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,729,604,604,354,354,1e3,990,990,990,990,494,604,604,604,604,354,1021,1052,917,750,750,531,656,594,510,500,750,750,500,500,333,333,333,333,333,333,333,333,222,222,294,294,324,324,316,328,398,285],oa=[-1,-1,-1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,402,506,507,508,509,510,511,536,537,538,539,710,711,713,728,729,730,731,732,733,900,901,902,903,904,905,906,908,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1138,1139,1168,1169,7808,7809,7810,7811,7812,7813,7922,7923,8208,8209,8211,8212,8213,8215,8216,8217,8218,8219,8220,8221,8222,8224,8225,8226,8230,8240,8242,8243,8249,8250,8252,8254,8260,8319,8355,8356,8359,8364,8453,8467,8470,8482,8486,8494,8539,8540,8541,8542,8592,8593,8594,8595,8596,8597,8616,8706,8710,8719,8721,8722,8730,8734,8735,8745,8747,8776,8800,8801,8804,8805,8962,8976,8992,8993,9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9600,9604,9608,9612,9616,9617,9618,9619,9632,9633,9642,9643,9644,9650,9658,9660,9668,9674,9675,9679,9688,9689,9702,9786,9787,9788,9792,9794,9824,9827,9829,9830,9834,9835,9836,61441,61442,61445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],$2=[1.36898,1,1,.72706,.80479,.83734,.98894,.99793,.9897,.93884,.86209,.94292,.94292,1.16661,1.02058,.93582,.96694,.93582,1.19137,.99793,.99793,.99793,.99793,.99793,.99793,.99793,.99793,.99793,.99793,.78076,.78076,1.02058,1.02058,1.02058,.72851,.78966,.90838,.83637,.82391,.96376,.80061,.86275,.8768,.95407,1.0258,.73901,.85022,.83655,1.0156,.95546,.92179,.87107,.92179,.82114,.8096,.89713,.94438,.95353,.94083,.91905,.90406,.9446,.94292,1.18777,.94292,1.02058,.89903,.90088,.94938,.97898,.81093,.97571,.94938,1.024,.9577,.95933,.98621,1.0474,.97455,.98981,.9672,.95933,.9446,.97898,.97407,.97646,.78036,1.10208,.95442,.95298,.97579,.9332,.94039,.938,.80687,1.01149,.80687,1.02058,.80479,.99793,.99793,.99793,.99793,1.01149,1.00872,.90088,.91882,1.0213,.8361,1.02058,.62295,.54324,.89022,1.08595,1,1,.90088,1,.97455,.93582,.90088,1,1.05686,.8361,.99642,.99642,.99642,.72851,.90838,.90838,.90838,.90838,.90838,.90838,.868,.82391,.80061,.80061,.80061,.80061,1.0258,1.0258,1.0258,1.0258,.97484,.95546,.92179,.92179,.92179,.92179,.92179,1.02058,.92179,.94438,.94438,.94438,.94438,.90406,.86958,.98225,.94938,.94938,.94938,.94938,.94938,.94938,.9031,.81093,.94938,.94938,.94938,.94938,.98621,.98621,.98621,.98621,.93969,.95933,.9446,.9446,.9446,.9446,.9446,1.08595,.9446,.95442,.95442,.95442,.95442,.94039,.97898,.94039,.90838,.94938,.90838,.94938,.90838,.94938,.82391,.81093,.82391,.81093,.82391,.81093,.82391,.81093,.96376,.84313,.97484,.97571,.80061,.94938,.80061,.94938,.80061,.94938,.80061,.94938,.80061,.94938,.8768,.9577,.8768,.9577,.8768,.9577,1,1,.95407,.95933,.97069,.95933,1.0258,.98621,1.0258,.98621,1.0258,.98621,1.0258,.98621,1.0258,.98621,.887,1.01591,.73901,1.0474,1,1,.97455,.83655,.98981,1,1,.83655,.73977,.83655,.73903,.84638,1.033,.95546,.95933,1,1,.95546,.95933,.8271,.95417,.95933,.92179,.9446,.92179,.9446,.92179,.9446,.936,.91964,.82114,.97646,1,1,.82114,.97646,.8096,.78036,.8096,.78036,1,1,.8096,.78036,1,1,.89713,.77452,.89713,1.10208,.94438,.95442,.94438,.95442,.94438,.95442,.94438,.95442,.94438,.95442,.94438,.95442,.94083,.97579,.90406,.94039,.90406,.9446,.938,.9446,.938,.9446,.938,1,.99793,.90838,.94938,.868,.9031,.92179,.9446,1,1,.89713,1.10208,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90989,.9358,.91945,.83181,.75261,.87992,.82976,.96034,.83689,.97268,1.0078,.90838,.83637,.8019,.90157,.80061,.9446,.95407,.92436,1.0258,.85022,.97153,1.0156,.95546,.89192,.92179,.92361,.87107,.96318,.89713,.93704,.95638,.91905,.91709,.92796,1.0258,.93704,.94836,1.0373,.95933,1.0078,.95871,.94836,.96174,.92601,.9498,.98607,.95776,.95933,1.05453,1.0078,.98275,.9314,.95617,.91701,1.05993,.9446,.78367,.9553,1,.86832,1.0128,.95871,.99394,.87548,.96361,.86774,1.0078,.95871,.9446,.95871,.86774,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.94083,.97579,.94083,.97579,.94083,.97579,.90406,.94039,.96694,1,.89903,1,1,1,.93582,.93582,.93582,1,.908,.908,.918,.94219,.94219,.96544,1,1.285,1,1,.81079,.81079,1,1,.74854,1,1,1,1,.99793,1,1,1,.65,1,1.36145,1,1,1,1,1,1,1,1,1,1,1,1.17173,1,.80535,.76169,1.02058,1.0732,1.05486,1,1,1.30692,1.08595,1.08595,1,1.08595,1.08595,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.16161,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],A9={lineHeight:1.2,lineGap:.2},e9=[1.36898,1,1,.66227,.80779,.81625,.97276,.97276,.97733,.92222,.83266,.94292,.94292,1.16148,1.02058,.93582,.96694,.93582,1.17337,.97276,.97276,.97276,.97276,.97276,.97276,.97276,.97276,.97276,.97276,.78076,.78076,1.02058,1.02058,1.02058,.71541,.76813,.85576,.80591,.80729,.94299,.77512,.83655,.86523,.92222,.98621,.71743,.81698,.79726,.98558,.92222,.90637,.83809,.90637,.80729,.76463,.86275,.90699,.91605,.9154,.85308,.85458,.90531,.94292,1.21296,.94292,1.02058,.89903,1.18616,.99613,.91677,.78216,.91677,.90083,.98796,.9135,.92168,.95381,.98981,.95298,.95381,.93459,.92168,.91513,.92004,.91677,.95077,.748,1.04502,.91677,.92061,.94236,.89544,.89364,.9,.80687,.8578,.80687,1.02058,.80779,.97276,.97276,.97276,.97276,.8578,.99973,1.18616,.91339,1.08074,.82891,1.02058,.55509,.71526,.89022,1.08595,1,1,1.18616,1,.96736,.93582,1.18616,1,1.04864,.82711,.99043,.99043,.99043,.71541,.85576,.85576,.85576,.85576,.85576,.85576,.845,.80729,.77512,.77512,.77512,.77512,.98621,.98621,.98621,.98621,.95961,.92222,.90637,.90637,.90637,.90637,.90637,1.02058,.90251,.90699,.90699,.90699,.90699,.85458,.83659,.94951,.99613,.99613,.99613,.99613,.99613,.99613,.85811,.78216,.90083,.90083,.90083,.90083,.95381,.95381,.95381,.95381,.9135,.92168,.91513,.91513,.91513,.91513,.91513,1.08595,.91677,.91677,.91677,.91677,.91677,.89364,.92332,.89364,.85576,.99613,.85576,.99613,.85576,.99613,.80729,.78216,.80729,.78216,.80729,.78216,.80729,.78216,.94299,.76783,.95961,.91677,.77512,.90083,.77512,.90083,.77512,.90083,.77512,.90083,.77512,.90083,.86523,.9135,.86523,.9135,.86523,.9135,1,1,.92222,.92168,.92222,.92168,.98621,.95381,.98621,.95381,.98621,.95381,.98621,.95381,.98621,.95381,.86036,.97096,.71743,.98981,1,1,.95298,.79726,.95381,1,1,.79726,.6894,.79726,.74321,.81691,1.0006,.92222,.92168,1,1,.92222,.92168,.79464,.92098,.92168,.90637,.91513,.90637,.91513,.90637,.91513,.909,.87514,.80729,.95077,1,1,.80729,.95077,.76463,.748,.76463,.748,1,1,.76463,.748,1,1,.86275,.72651,.86275,1.04502,.90699,.91677,.90699,.91677,.90699,.91677,.90699,.91677,.90699,.91677,.90699,.91677,.9154,.94236,.85458,.89364,.85458,.90531,.9,.90531,.9,.90531,.9,1,.97276,.85576,.99613,.845,.85811,.90251,.91677,1,1,.86275,1.04502,1.18616,1.18616,1.18616,1.18616,1.18616,1.18616,1.18616,1.18616,1.18616,1.00899,1.30628,.85576,.80178,.66862,.7927,.69323,.88127,.72459,.89711,.95381,.85576,.80591,.7805,.94729,.77512,.90531,.92222,.90637,.98621,.81698,.92655,.98558,.92222,.85359,.90637,.90976,.83809,.94523,.86275,.83509,.93157,.85308,.83392,.92346,.98621,.83509,.92886,.91324,.92168,.95381,.90646,.92886,.90557,.86847,.90276,.91324,.86842,.92168,.99531,.95381,.9224,.85408,.92699,.86847,1.0051,.91513,.80487,.93481,1,.88159,1.05214,.90646,.97355,.81539,.89398,.85923,.95381,.90646,.91513,.90646,.85923,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.9154,.94236,.9154,.94236,.9154,.94236,.85458,.89364,.96694,1,.89903,1,1,1,.91782,.91782,.91782,1,.896,.896,.896,.9332,.9332,.95973,1,1.26,1,1,.80479,.80178,1,1,.85633,1,1,1,1,.97276,1,1,1,.698,1,1.36145,1,1,1,1,1,1,1,1,1,1,1,1.14542,1,.79199,.78694,1.02058,1.03493,1.05486,1,1,1.23026,1.08595,1.08595,1,1.08595,1.08595,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.20006,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],t9={lineHeight:1.2,lineGap:.2},i9=[1.36898,1,1,.65507,.84943,.85639,.88465,.88465,.86936,.88307,.86948,.85283,.85283,1.06383,1.02058,.75945,.9219,.75945,1.17337,.88465,.88465,.88465,.88465,.88465,.88465,.88465,.88465,.88465,.88465,.75945,.75945,1.02058,1.02058,1.02058,.69046,.70926,.85158,.77812,.76852,.89591,.70466,.76125,.80094,.86822,.83864,.728,.77212,.79475,.93637,.87514,.8588,.76013,.8588,.72421,.69866,.77598,.85991,.80811,.87832,.78112,.77512,.8562,1.0222,1.18417,1.0222,1.27014,.89903,1.15012,.93859,.94399,.846,.94399,.81453,1.0186,.94219,.96017,1.03075,1.02175,.912,1.03075,.96998,.96017,.93859,.94399,.94399,.95493,.746,1.12658,.94578,.91,.979,.882,.882,.83,.85034,.83537,.85034,1.02058,.70869,.88465,.88465,.88465,.88465,.83537,.90083,1.15012,.9161,.94565,.73541,1.02058,.53609,.69353,.79519,1.08595,1,1,1.15012,1,.91974,.75945,1.15012,1,.9446,.73361,.9005,.9005,.9005,.62864,.85158,.85158,.85158,.85158,.85158,.85158,.773,.76852,.70466,.70466,.70466,.70466,.83864,.83864,.83864,.83864,.90561,.87514,.8588,.8588,.8588,.8588,.8588,1.02058,.85751,.85991,.85991,.85991,.85991,.77512,.76013,.88075,.93859,.93859,.93859,.93859,.93859,.93859,.8075,.846,.81453,.81453,.81453,.81453,.82424,.82424,.82424,.82424,.9278,.96017,.93859,.93859,.93859,.93859,.93859,1.08595,.8562,.94578,.94578,.94578,.94578,.882,.94578,.882,.85158,.93859,.85158,.93859,.85158,.93859,.76852,.846,.76852,.846,.76852,.846,.76852,.846,.89591,.8544,.90561,.94399,.70466,.81453,.70466,.81453,.70466,.81453,.70466,.81453,.70466,.81453,.80094,.94219,.80094,.94219,.80094,.94219,1,1,.86822,.96017,.86822,.96017,.83864,.82424,.83864,.82424,.83864,.82424,.83864,1.03075,.83864,.82424,.81402,1.02738,.728,1.02175,1,1,.912,.79475,1.03075,1,1,.79475,.83911,.79475,.66266,.80553,1.06676,.87514,.96017,1,1,.87514,.96017,.86865,.87396,.96017,.8588,.93859,.8588,.93859,.8588,.93859,.867,.84759,.72421,.95493,1,1,.72421,.95493,.69866,.746,.69866,.746,1,1,.69866,.746,1,1,.77598,.88417,.77598,1.12658,.85991,.94578,.85991,.94578,.85991,.94578,.85991,.94578,.85991,.94578,.85991,.94578,.87832,.979,.77512,.882,.77512,.8562,.83,.8562,.83,.8562,.83,1,.88465,.85158,.93859,.773,.8075,.85751,.8562,1,1,.77598,1.12658,1.15012,1.15012,1.15012,1.15012,1.15012,1.15313,1.15012,1.15012,1.15012,1.08106,1.03901,.85158,.77025,.62264,.7646,.65351,.86026,.69461,.89947,1.03075,.85158,.77812,.76449,.88836,.70466,.8562,.86822,.8588,.83864,.77212,.85308,.93637,.87514,.82352,.8588,.85701,.76013,.89058,.77598,.8156,.82565,.78112,.77899,.89386,.83864,.8156,.9486,.92388,.96186,1.03075,.91123,.9486,.93298,.878,.93942,.92388,.84596,.96186,.95119,1.03075,.922,.88787,.95829,.88,.93559,.93859,.78815,.93758,1,.89217,1.03737,.91123,.93969,.77487,.85769,.86799,1.03075,.91123,.93859,.91123,.86799,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.87832,.979,.87832,.979,.87832,.979,.77512,.882,.9219,1,.89903,1,1,1,.87321,.87321,.87321,1,1.027,1.027,1.027,.86847,.86847,.79121,1,1.124,1,1,.73572,.73572,1,1,.85034,1,1,1,1,.88465,1,1,1,.669,1,1.36145,1,1,1,1,1,1,1,1,1,1,1,1.04828,1,.74948,.75187,1.02058,.98391,1.02119,1,1,1.06233,1.08595,1.08595,1,1.08595,1.08595,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.05233,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],s9={lineHeight:1.2,lineGap:.2},a9=[1.36898,1,1,.76305,.82784,.94935,.89364,.92241,.89073,.90706,.98472,.85283,.85283,1.0664,1.02058,.74505,.9219,.74505,1.23456,.92241,.92241,.92241,.92241,.92241,.92241,.92241,.92241,.92241,.92241,.74505,.74505,1.02058,1.02058,1.02058,.73002,.72601,.91755,.8126,.80314,.92222,.73764,.79726,.83051,.90284,.86023,.74,.8126,.84869,.96518,.91115,.8858,.79761,.8858,.74498,.73914,.81363,.89591,.83659,.89633,.85608,.8111,.90531,1.0222,1.22736,1.0222,1.27014,.89903,.90088,.86667,1.0231,.896,1.01411,.90083,1.05099,1.00512,.99793,1.05326,1.09377,.938,1.06226,1.00119,.99793,.98714,1.0231,1.01231,.98196,.792,1.19137,.99074,.962,1.01915,.926,.942,.856,.85034,.92006,.85034,1.02058,.69067,.92241,.92241,.92241,.92241,.92006,.9332,.90088,.91882,.93484,.75339,1.02058,.56866,.54324,.79519,1.08595,1,1,.90088,1,.95325,.74505,.90088,1,.97198,.75339,.91009,.91009,.91009,.66466,.91755,.91755,.91755,.91755,.91755,.91755,.788,.80314,.73764,.73764,.73764,.73764,.86023,.86023,.86023,.86023,.92915,.91115,.8858,.8858,.8858,.8858,.8858,1.02058,.8858,.89591,.89591,.89591,.89591,.8111,.79611,.89713,.86667,.86667,.86667,.86667,.86667,.86667,.86936,.896,.90083,.90083,.90083,.90083,.84224,.84224,.84224,.84224,.97276,.99793,.98714,.98714,.98714,.98714,.98714,1.08595,.89876,.99074,.99074,.99074,.99074,.942,1.0231,.942,.91755,.86667,.91755,.86667,.91755,.86667,.80314,.896,.80314,.896,.80314,.896,.80314,.896,.92222,.93372,.92915,1.01411,.73764,.90083,.73764,.90083,.73764,.90083,.73764,.90083,.73764,.90083,.83051,1.00512,.83051,1.00512,.83051,1.00512,1,1,.90284,.99793,.90976,.99793,.86023,.84224,.86023,.84224,.86023,.84224,.86023,1.05326,.86023,.84224,.82873,1.07469,.74,1.09377,1,1,.938,.84869,1.06226,1,1,.84869,.83704,.84869,.81441,.85588,1.08927,.91115,.99793,1,1,.91115,.99793,.91887,.90991,.99793,.8858,.98714,.8858,.98714,.8858,.98714,.894,.91434,.74498,.98196,1,1,.74498,.98196,.73914,.792,.73914,.792,1,1,.73914,.792,1,1,.81363,.904,.81363,1.19137,.89591,.99074,.89591,.99074,.89591,.99074,.89591,.99074,.89591,.99074,.89591,.99074,.89633,1.01915,.8111,.942,.8111,.90531,.856,.90531,.856,.90531,.856,1,.92241,.91755,.86667,.788,.86936,.8858,.89876,1,1,.81363,1.19137,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90088,.90388,1.03901,.92138,.78105,.7154,.86169,.80513,.94007,.82528,.98612,1.06226,.91755,.8126,.81884,.92819,.73764,.90531,.90284,.8858,.86023,.8126,.91172,.96518,.91115,.83089,.8858,.87791,.79761,.89297,.81363,.88157,.89992,.85608,.81992,.94307,.86023,.88157,.95308,.98699,.99793,1.06226,.95817,.95308,.97358,.928,.98088,.98699,.92761,.99793,.96017,1.06226,.986,.944,.95978,.938,.96705,.98714,.80442,.98972,1,.89762,1.04552,.95817,.99007,.87064,.91879,.88888,1.06226,.95817,.98714,.95817,.88888,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.89633,1.01915,.89633,1.01915,.89633,1.01915,.8111,.942,.9219,1,.89903,1,1,1,.93173,.93173,.93173,1,1.06304,1.06304,1.06904,.89903,.89903,.80549,1,1.156,1,1,.76575,.76575,1,1,.72458,1,1,1,1,.92241,1,1,1,.619,1,1.36145,1,1,1,1,1,1,1,1,1,1,1,1.07257,1,.74705,.71119,1.02058,1.024,1.02119,1,1,1.1536,1.08595,1.08595,1,1.08595,1.08595,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.05638,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],n9={lineHeight:1.2,lineGap:.2},r9=[1.76738,1,1,.99297,.9824,1.04016,1.06497,1.03424,.97529,1.17647,1.23203,1.1085,1.1085,1.16939,1.2107,.9754,1.21408,.9754,1.59578,1.03424,1.03424,1.03424,1.03424,1.03424,1.03424,1.03424,1.03424,1.03424,1.03424,.81378,.81378,1.2107,1.2107,1.2107,.71703,.97847,.97363,.88776,.8641,1.02096,.79795,.85132,.914,1.06085,1.1406,.8007,.89858,.83693,1.14889,1.09398,.97489,.92094,.97489,.90399,.84041,.95923,1.00135,1,1.06467,.98243,.90996,.99361,1.1085,1.56942,1.1085,1.2107,.74627,.94282,.96752,1.01519,.86304,1.01359,.97278,1.15103,1.01359,.98561,1.02285,1.02285,1.00527,1.02285,1.0302,.99041,1.0008,1.01519,1.01359,1.02258,.79104,1.16862,.99041,.97454,1.02511,.99298,.96752,.95801,.94856,1.16579,.94856,1.2107,.9824,1.03424,1.03424,1,1.03424,1.16579,.8727,1.3871,1.18622,1.10818,1.04478,1.2107,1.18622,.75155,.94994,1.28826,1.21408,1.21408,.91056,1,.91572,.9754,.64663,1.18328,1.24866,1.04478,1.14169,1.15749,1.17389,.71703,.97363,.97363,.97363,.97363,.97363,.97363,.93506,.8641,.79795,.79795,.79795,.79795,1.1406,1.1406,1.1406,1.1406,1.02096,1.09398,.97426,.97426,.97426,.97426,.97426,1.2107,.97489,1.00135,1.00135,1.00135,1.00135,.90996,.92094,1.02798,.96752,.96752,.96752,.96752,.96752,.96752,.93136,.86304,.97278,.97278,.97278,.97278,1.02285,1.02285,1.02285,1.02285,.97122,.99041,1,1,1,1,1,1.28826,1.0008,.99041,.99041,.99041,.99041,.96752,1.01519,.96752,.97363,.96752,.97363,.96752,.97363,.96752,.8641,.86304,.8641,.86304,.8641,.86304,.8641,.86304,1.02096,1.03057,1.02096,1.03517,.79795,.97278,.79795,.97278,.79795,.97278,.79795,.97278,.79795,.97278,.914,1.01359,.914,1.01359,.914,1.01359,1,1,1.06085,.98561,1.06085,1.00879,1.1406,1.02285,1.1406,1.02285,1.1406,1.02285,1.1406,1.02285,1.1406,1.02285,.97138,1.08692,.8007,1.02285,1,1,1.00527,.83693,1.02285,1,1,.83693,.9455,.83693,.90418,.83693,1.13005,1.09398,.99041,1,1,1.09398,.99041,.96692,1.09251,.99041,.97489,1.0008,.97489,1.0008,.97489,1.0008,.93994,.97931,.90399,1.02258,1,1,.90399,1.02258,.84041,.79104,.84041,.79104,.84041,.79104,.84041,.79104,1,1,.95923,1.07034,.95923,1.16862,1.00135,.99041,1.00135,.99041,1.00135,.99041,1.00135,.99041,1.00135,.99041,1.00135,.99041,1.06467,1.02511,.90996,.96752,.90996,.99361,.95801,.99361,.95801,.99361,.95801,1.07733,1.03424,.97363,.96752,.93506,.93136,.97489,1.0008,1,1,.95923,1.16862,1.15103,1.15103,1.01173,1.03959,.75953,.81378,.79912,1.15103,1.21994,.95161,.87815,1.01149,.81525,.7676,.98167,1.01134,1.02546,.84097,1.03089,1.18102,.97363,.88776,.85134,.97826,.79795,.99361,1.06085,.97489,1.1406,.89858,1.0388,1.14889,1.09398,.86039,.97489,1.0595,.92094,.94793,.95923,.90996,.99346,.98243,1.02112,.95493,1.1406,.90996,1.03574,1.02597,1.0008,1.18102,1.06628,1.03574,1.0192,1.01932,1.00886,.97531,1.0106,1.0008,1.13189,1.18102,1.02277,.98683,1.0016,.99561,1.07237,1.0008,.90434,.99921,.93803,.8965,1.23085,1.06628,1.04983,.96268,1.0499,.98439,1.18102,1.06628,1.0008,1.06628,.98439,.79795,1,1,1,1,1,1,1,1,1,1,1,1,1.09466,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.97278,1,1,1,1,1,1,1,1,1,1,1,1,1.02065,1,1,1,1,1,1,1.06467,1.02511,1.06467,1.02511,1.06467,1.02511,.90996,.96752,1,1.21408,.89903,1,1,.75155,1.04394,1.04394,1.04394,1.04394,.98633,.98633,.98633,.73047,.73047,1.20642,.91211,1.25635,1.222,1.02956,1.03372,1.03372,.96039,1.24633,1,1.12454,.93503,1.03424,1.19687,1.03424,1,1,1,.771,1,1,1.15749,1.15749,1.15749,1.10948,.86279,.94434,.86279,.94434,.86182,1,1,1.16897,1,.96085,.90137,1.2107,1.18416,1.13973,.69825,.9716,2.10339,1.29004,1.29004,1.21172,1.29004,1.29004,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.42603,1,.99862,.99862,1,.87025,.87025,.87025,.87025,1.18874,1.42603,1,1.42603,1.42603,.99862,1,1,1,1,1,1.2886,1.04315,1.15296,1.34163,1,1,1,1.09193,1.09193,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],g9={lineHeight:1.33008,lineGap:0},o9=[1.76738,1,1,.98946,1.03959,1.04016,1.02809,1.036,.97639,1.10953,1.23203,1.11144,1.11144,1.16939,1.21237,.9754,1.21261,.9754,1.59754,1.036,1.036,1.036,1.036,1.036,1.036,1.036,1.036,1.036,1.036,.81378,.81378,1.21237,1.21237,1.21237,.73541,.97847,.97363,.89723,.87897,1.0426,.79429,.85292,.91149,1.05815,1.1406,.79631,.90128,.83853,1.04396,1.10615,.97552,.94436,.97552,.88641,.80527,.96083,1.00135,1,1.06777,.9817,.91142,.99361,1.11144,1.57293,1.11144,1.21237,.74627,1.31818,1.06585,.97042,.83055,.97042,.93503,1.1261,.97042,.97922,1.14236,.94552,1.01054,1.14236,1.02471,.97922,.94165,.97042,.97042,1.0276,.78929,1.1261,.97922,.95874,1.02197,.98507,.96752,.97168,.95107,1.16579,.95107,1.21237,1.03959,1.036,1.036,1,1.036,1.16579,.87357,1.31818,1.18754,1.26781,1.05356,1.21237,1.18622,.79487,.94994,1.29004,1.24047,1.24047,1.31818,1,.91484,.9754,1.31818,1.1349,1.24866,1.05356,1.13934,1.15574,1.17389,.73541,.97363,.97363,.97363,.97363,.97363,.97363,.94385,.87897,.79429,.79429,.79429,.79429,1.1406,1.1406,1.1406,1.1406,1.0426,1.10615,.97552,.97552,.97552,.97552,.97552,1.21237,.97552,1.00135,1.00135,1.00135,1.00135,.91142,.94436,.98721,1.06585,1.06585,1.06585,1.06585,1.06585,1.06585,.96705,.83055,.93503,.93503,.93503,.93503,1.14236,1.14236,1.14236,1.14236,.93125,.97922,.94165,.94165,.94165,.94165,.94165,1.29004,.94165,.97922,.97922,.97922,.97922,.96752,.97042,.96752,.97363,1.06585,.97363,1.06585,.97363,1.06585,.87897,.83055,.87897,.83055,.87897,.83055,.87897,.83055,1.0426,1.0033,1.0426,.97042,.79429,.93503,.79429,.93503,.79429,.93503,.79429,.93503,.79429,.93503,.91149,.97042,.91149,.97042,.91149,.97042,1,1,1.05815,.97922,1.05815,.97922,1.1406,1.14236,1.1406,1.14236,1.1406,1.14236,1.1406,1.14236,1.1406,1.14236,.97441,1.04302,.79631,1.01582,1,1,1.01054,.83853,1.14236,1,1,.83853,1.09125,.83853,.90418,.83853,1.19508,1.10615,.97922,1,1,1.10615,.97922,1.01034,1.10466,.97922,.97552,.94165,.97552,.94165,.97552,.94165,.91602,.91981,.88641,1.0276,1,1,.88641,1.0276,.80527,.78929,.80527,.78929,.80527,.78929,.80527,.78929,1,1,.96083,1.05403,.95923,1.16862,1.00135,.97922,1.00135,.97922,1.00135,.97922,1.00135,.97922,1.00135,.97922,1.00135,.97922,1.06777,1.02197,.91142,.96752,.91142,.99361,.97168,.99361,.97168,.99361,.97168,1.23199,1.036,.97363,1.06585,.94385,.96705,.97552,.94165,1,1,.96083,1.1261,1.31818,1.31818,1.31818,1.31818,1.31818,1.31818,1.31818,1.31818,1.31818,.95161,1.27126,1.00811,.83284,.77702,.99137,.95253,1.0347,.86142,1.07205,1.14236,.97363,.89723,.86869,1.09818,.79429,.99361,1.05815,.97552,1.1406,.90128,1.06662,1.04396,1.10615,.84918,.97552,1.04694,.94436,.98015,.96083,.91142,1.00356,.9817,1.01945,.98999,1.1406,.91142,1.04961,.9898,1.00639,1.14236,1.07514,1.04961,.99607,1.02897,1.008,.9898,.95134,1.00639,1.11121,1.14236,1.00518,.97981,1.02186,1,1.08578,.94165,.99314,.98387,.93028,.93377,1.35125,1.07514,1.10687,.93491,1.04232,1.00351,1.14236,1.07514,.94165,1.07514,1.00351,.79429,1,1,1,1,1,1,1,1,1,1,1,1,1.09097,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.93503,1,1,1,1,1,1,1,1,1,1,1,1,.96609,1,1,1,1,1,1,1.06777,1.02197,1.06777,1.02197,1.06777,1.02197,.91142,.96752,1,1.21261,.89903,1,1,.75155,1.04745,1.04745,1.04745,1.04394,.98633,.98633,.98633,.72959,.72959,1.20502,.91406,1.26514,1.222,1.02956,1.03372,1.03372,.96039,1.24633,1,1.09125,.93327,1.03336,1.16541,1.036,1,1,1,.771,1,1,1.15574,1.15574,1.15574,1.15574,.86364,.94434,.86279,.94434,.86224,1,1,1.16798,1,.96085,.90068,1.21237,1.18416,1.13904,.69825,.9716,2.10339,1.29004,1.29004,1.21339,1.29004,1.29004,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.42603,1,.99862,.99862,1,.87025,.87025,.87025,.87025,1.18775,1.42603,1,1.42603,1.42603,.99862,1,1,1,1,1,1.2886,1.04315,1.15296,1.34163,1,1,1,1.13269,1.13269,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],I9={lineHeight:1.33008,lineGap:0},c9=[1.76738,1,1,.98946,1.14763,1.05365,1.06234,.96927,.92586,1.15373,1.18414,.91349,.91349,1.07403,1.17308,.78383,1.20088,.78383,1.42531,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.78383,.78383,1.17308,1.17308,1.17308,.77349,.94565,.94729,.85944,.88506,.9858,.74817,.80016,.88449,.98039,.95782,.69238,.89898,.83231,.98183,1.03989,.96924,.86237,.96924,.80595,.74524,.86091,.95402,.94143,.98448,.8858,.83089,.93285,1.0949,1.39016,1.0949,1.45994,.74627,1.04839,.97454,.97454,.87207,.97454,.87533,1.06151,.97454,1.00176,1.16484,1.08132,.98047,1.16484,1.02989,1.01054,.96225,.97454,.97454,1.06598,.79004,1.16344,1.00351,.94629,.9973,.91016,.96777,.9043,.91082,.92481,.91082,1.17308,.95748,.96927,.96927,1,.96927,.92481,.80597,1.04839,1.23393,1.1781,.9245,1.17308,1.20808,.63218,.94261,1.24822,1.09971,1.09971,1.04839,1,.85273,.78032,1.04839,1.09971,1.22326,.9245,1.09836,1.13525,1.15222,.70424,.94729,.94729,.94729,.94729,.94729,.94729,.85498,.88506,.74817,.74817,.74817,.74817,.95782,.95782,.95782,.95782,.9858,1.03989,.96924,.96924,.96924,.96924,.96924,1.17308,.96924,.95402,.95402,.95402,.95402,.83089,.86237,.88409,.97454,.97454,.97454,.97454,.97454,.97454,.92916,.87207,.87533,.87533,.87533,.87533,.93146,.93146,.93146,.93146,.93854,1.01054,.96225,.96225,.96225,.96225,.96225,1.24822,.8761,1.00351,1.00351,1.00351,1.00351,.96777,.97454,.96777,.94729,.97454,.94729,.97454,.94729,.97454,.88506,.87207,.88506,.87207,.88506,.87207,.88506,.87207,.9858,.95391,.9858,.97454,.74817,.87533,.74817,.87533,.74817,.87533,.74817,.87533,.74817,.87533,.88449,.97454,.88449,.97454,.88449,.97454,1,1,.98039,1.00176,.98039,1.00176,.95782,.93146,.95782,.93146,.95782,.93146,.95782,1.16484,.95782,.93146,.84421,1.12761,.69238,1.08132,1,1,.98047,.83231,1.16484,1,1,.84723,1.04861,.84723,.78755,.83231,1.23736,1.03989,1.01054,1,1,1.03989,1.01054,.9857,1.03849,1.01054,.96924,.96225,.96924,.96225,.96924,.96225,.92383,.90171,.80595,1.06598,1,1,.80595,1.06598,.74524,.79004,.74524,.79004,.74524,.79004,.74524,.79004,1,1,.86091,1.02759,.85771,1.16344,.95402,1.00351,.95402,1.00351,.95402,1.00351,.95402,1.00351,.95402,1.00351,.95402,1.00351,.98448,.9973,.83089,.96777,.83089,.93285,.9043,.93285,.9043,.93285,.9043,1.31868,.96927,.94729,.97454,.85498,.92916,.96924,.8761,1,1,.86091,1.16344,1.04839,1.04839,1.04839,1.04839,1.04839,1.04839,1.04839,1.04839,1.04839,.81965,.81965,.94729,.78032,.71022,.90883,.84171,.99877,.77596,1.05734,1.2,.94729,.85944,.82791,.9607,.74817,.93285,.98039,.96924,.95782,.89898,.98316,.98183,1.03989,.78614,.96924,.97642,.86237,.86075,.86091,.83089,.90082,.8858,.97296,1.01284,.95782,.83089,1.0976,1.04,1.03342,1.2,1.0675,1.0976,.98205,1.03809,1.05097,1.04,.95364,1.03342,1.05401,1.2,1.02148,1.0119,1.04724,1.0127,1.02732,.96225,.8965,.97783,.93574,.94818,1.30679,1.0675,1.11826,.99821,1.0557,1.0326,1.2,1.0675,.96225,1.0675,1.0326,.74817,1,1,1,1,1,1,1,1,1,1,1,1,1.03754,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.87533,1,1,1,1,1,1,1,1,1,1,1,1,.98705,1,1,1,1,1,1,.98448,.9973,.98448,.9973,.98448,.9973,.83089,.96777,1,1.20088,.89903,1,1,.75155,.94945,.94945,.94945,.94945,1.12317,1.12317,1.12317,.67603,.67603,1.15621,.73584,1.21191,1.22135,1.06483,.94868,.94868,.95996,1.24633,1,1.07497,.87709,.96927,1.01473,.96927,1,1,1,.77295,1,1,1.09836,1.09836,1.09836,1.01522,.86321,.94434,.8649,.94434,.86182,1,1,1.083,1,.91578,.86438,1.17308,1.18416,1.14589,.69825,.97622,1.96791,1.24822,1.24822,1.17308,1.24822,1.24822,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.42603,1,.99862,.99862,1,.87025,.87025,.87025,.87025,1.17984,1.42603,1,1.42603,1.42603,.99862,1,1,1,1,1,1.2886,1.04315,1.15296,1.34163,1,1,1,1.10742,1.10742,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],l9={lineHeight:1.33008,lineGap:0},h9=[1.76738,1,1,.98594,1.02285,1.10454,1.06234,.96927,.92037,1.19985,1.2046,.90616,.90616,1.07152,1.1714,.78032,1.20088,.78032,1.40246,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.96927,.78032,.78032,1.1714,1.1714,1.1714,.80597,.94084,.96706,.85944,.85734,.97093,.75842,.79936,.88198,.9831,.95782,.71387,.86969,.84636,1.07796,1.03584,.96924,.83968,.96924,.82826,.79649,.85771,.95132,.93119,.98965,.88433,.8287,.93365,1.08612,1.3638,1.08612,1.45786,.74627,.80499,.91484,1.05707,.92383,1.05882,.9403,1.12654,1.05882,1.01756,1.09011,1.09011,.99414,1.09011,1.034,1.01756,1.05356,1.05707,1.05882,1.04399,.84863,1.21968,1.01756,.95801,1.00068,.91797,.96777,.9043,.90351,.92105,.90351,1.1714,.85337,.96927,.96927,.99912,.96927,.92105,.80597,1.2434,1.20808,1.05937,.90957,1.1714,1.20808,.75155,.94261,1.24644,1.09971,1.09971,.84751,1,.85273,.78032,.61584,1.05425,1.17914,.90957,1.08665,1.11593,1.14169,.73381,.96706,.96706,.96706,.96706,.96706,.96706,.86035,.85734,.75842,.75842,.75842,.75842,.95782,.95782,.95782,.95782,.97093,1.03584,.96924,.96924,.96924,.96924,.96924,1.1714,.96924,.95132,.95132,.95132,.95132,.8287,.83968,.89049,.91484,.91484,.91484,.91484,.91484,.91484,.93575,.92383,.9403,.9403,.9403,.9403,.8717,.8717,.8717,.8717,1.00527,1.01756,1.05356,1.05356,1.05356,1.05356,1.05356,1.24644,.95923,1.01756,1.01756,1.01756,1.01756,.96777,1.05707,.96777,.96706,.91484,.96706,.91484,.96706,.91484,.85734,.92383,.85734,.92383,.85734,.92383,.85734,.92383,.97093,1.0969,.97093,1.05882,.75842,.9403,.75842,.9403,.75842,.9403,.75842,.9403,.75842,.9403,.88198,1.05882,.88198,1.05882,.88198,1.05882,1,1,.9831,1.01756,.9831,1.01756,.95782,.8717,.95782,.8717,.95782,.8717,.95782,1.09011,.95782,.8717,.84784,1.11551,.71387,1.09011,1,1,.99414,.84636,1.09011,1,1,.84636,1.0536,.84636,.94298,.84636,1.23297,1.03584,1.01756,1,1,1.03584,1.01756,1.00323,1.03444,1.01756,.96924,1.05356,.96924,1.05356,.96924,1.05356,.93066,.98293,.82826,1.04399,1,1,.82826,1.04399,.79649,.84863,.79649,.84863,.79649,.84863,.79649,.84863,1,1,.85771,1.17318,.85771,1.21968,.95132,1.01756,.95132,1.01756,.95132,1.01756,.95132,1.01756,.95132,1.01756,.95132,1.01756,.98965,1.00068,.8287,.96777,.8287,.93365,.9043,.93365,.9043,.93365,.9043,1.08571,.96927,.96706,.91484,.86035,.93575,.96924,.95923,1,1,.85771,1.21968,1.11437,1.11437,.93109,.91202,.60411,.84164,.55572,1.01173,.97361,.81818,.81818,.96635,.78032,.72727,.92366,.98601,1.03405,.77968,1.09799,1.2,.96706,.85944,.85638,.96491,.75842,.93365,.9831,.96924,.95782,.86969,.94152,1.07796,1.03584,.78437,.96924,.98715,.83968,.83491,.85771,.8287,.94492,.88433,.9287,1.0098,.95782,.8287,1.0625,.98248,1.03424,1.2,1.01071,1.0625,.95246,1.03809,1.04912,.98248,1.00221,1.03424,1.05443,1.2,1.04785,.99609,1.00169,1.05176,.99346,1.05356,.9087,1.03004,.95542,.93117,1.23362,1.01071,1.07831,1.02512,1.05205,1.03502,1.2,1.01071,1.05356,1.01071,1.03502,.75842,1,1,1,1,1,1,1,1,1,1,1,1,1.03719,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.9403,1,1,1,1,1,1,1,1,1,1,1,1,1.04021,1,1,1,1,1,1,.98965,1.00068,.98965,1.00068,.98965,1.00068,.8287,.96777,1,1.20088,.89903,1,1,.75155,1.03077,1.03077,1.03077,1.03077,1.13196,1.13196,1.13196,.67428,.67428,1.16039,.73291,1.20996,1.22135,1.06483,.94868,.94868,.95996,1.24633,1,1.07497,.87796,.96927,1.01518,.96927,1,1,1,.77295,1,1,1.10539,1.10539,1.11358,1.06967,.86279,.94434,.86279,.94434,.86182,1,1,1.083,1,.91578,.86507,1.1714,1.18416,1.14589,.69825,.97622,1.9697,1.24822,1.24822,1.17238,1.24822,1.24822,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.42603,1,.99862,.99862,1,.87025,.87025,.87025,.87025,1.18083,1.42603,1,1.42603,1.42603,.99862,1,1,1,1,1,1.2886,1.04315,1.15296,1.34163,1,1,1,1.10938,1.10938,1,1,1,1.05425,1.09971,1.09971,1.09971,1,1,1,1,1,1,1,1,1,1,1],C9={lineHeight:1.33008,lineGap:0},B9=he(function(e){e["MyriadPro-Regular"]=e["PdfJS-Fallback-Regular"]={name:"LiberationSans-Regular",factors:a9,baseWidths:ga,baseMapping:oa,metrics:n9},e["MyriadPro-Bold"]=e["PdfJS-Fallback-Bold"]={name:"LiberationSans-Bold",factors:$2,baseWidths:ta,baseMapping:ia,metrics:A9},e["MyriadPro-It"]=e["MyriadPro-Italic"]=e["PdfJS-Fallback-Italic"]={name:"LiberationSans-Italic",factors:i9,baseWidths:na,baseMapping:ra,metrics:s9},e["MyriadPro-BoldIt"]=e["MyriadPro-BoldItalic"]=e["PdfJS-Fallback-BoldItalic"]={name:"LiberationSans-BoldItalic",factors:e9,baseWidths:sa,baseMapping:aa,metrics:t9},e.ArialMT=e.Arial=e["Arial-Regular"]={name:"LiberationSans-Regular",baseWidths:ga,baseMapping:oa},e["Arial-BoldMT"]=e["Arial-Bold"]={name:"LiberationSans-Bold",baseWidths:ta,baseMapping:ia},e["Arial-ItalicMT"]=e["Arial-Italic"]={name:"LiberationSans-Italic",baseWidths:na,baseMapping:ra},e["Arial-BoldItalicMT"]=e["Arial-BoldItalic"]={name:"LiberationSans-BoldItalic",baseWidths:sa,baseMapping:aa},e["Calibri-Regular"]={name:"LiberationSans-Regular",factors:T2,baseWidths:ga,baseMapping:oa,metrics:P2},e["Calibri-Bold"]={name:"LiberationSans-Bold",factors:H2,baseWidths:ta,baseMapping:ia,metrics:J2},e["Calibri-Italic"]={name:"LiberationSans-Italic",factors:v2,baseWidths:na,baseMapping:ra,metrics:q2},e["Calibri-BoldItalic"]={name:"LiberationSans-BoldItalic",factors:Y2,baseWidths:sa,baseMapping:aa,metrics:K2},e["Segoeui-Regular"]={name:"LiberationSans-Regular",factors:h9,baseWidths:ga,baseMapping:oa,metrics:C9},e["Segoeui-Bold"]={name:"LiberationSans-Bold",factors:r9,baseWidths:ta,baseMapping:ia,metrics:g9},e["Segoeui-Italic"]={name:"LiberationSans-Italic",factors:c9,baseWidths:na,baseMapping:ra,metrics:l9},e["Segoeui-BoldItalic"]={name:"LiberationSans-BoldItalic",factors:o9,baseWidths:sa,baseMapping:aa,metrics:I9},e["Helvetica-Regular"]=e.Helvetica={name:"LiberationSans-Regular",factors:_2,baseWidths:ga,baseMapping:oa,metrics:z2},e["Helvetica-Bold"]={name:"LiberationSans-Bold",factors:W2,baseWidths:ta,baseMapping:ia,metrics:O2},e["Helvetica-Italic"]={name:"LiberationSans-Italic",factors:X2,baseWidths:na,baseMapping:ra,metrics:V2},e["Helvetica-BoldItalic"]={name:"LiberationSans-BoldItalic",factors:Z2,baseWidths:sa,baseMapping:aa,metrics:j2}});function B1(e){let A=pn(e);return B9()[A]}function Q9(e){let A=B1(e);if(!A)return null;let{baseWidths:t,baseMapping:i,factors:s}=A,a=s?t.map((o,I)=>o*s[I]):t,n=-2,r,g=[];for(let[o,I]of i.map((c,l)=>[c,l]).sort(([c],[l])=>c-l))o!==-1&&(o===n+1?(r.push(a[I]),n+=1):(n=o,r=[a[I]],g.push(o,r)));return g}function pf(e){let A=Q9(e),t=new F(null);t.set("BaseFont",M.get(e)),t.set("Type",M.get("Font")),t.set("Subtype",M.get("CIDFontType2")),t.set("Encoding",M.get("Identity-H")),t.set("CIDToGIDMap",M.get("Identity")),t.set("W",A),t.set("FirstChar",A[0]),t.set("LastChar",A.at(-2)+A.at(-1).length-1);let i=new F(null);t.set("FontDescriptor",i);let s=new F(null);return s.set("Ordering","Identity"),s.set("Registry","Adobe"),s.set("Supplement",0),t.set("CIDSystemInfo",s),t}var TI=class{constructor(A){this.lexer=A,this.operators=[],this.token=null,this.prev=null}nextToken(){this.prev=this.token,this.token=this.lexer.getToken()}accept(A){return this.token.type===A?(this.nextToken(),!0):!1}expect(A){if(this.accept(A))return!0;throw new v(`Unexpected symbol: found ${this.token.type} expected ${A}.`)}parse(){return this.nextToken(),this.expect(Ve.LBRACE),this.parseBlock(),this.expect(Ve.RBRACE),this.operators}parseBlock(){for(;;)if(this.accept(Ve.NUMBER))this.operators.push(this.prev.value);else if(this.accept(Ve.OPERATOR))this.operators.push(this.prev.value);else if(this.accept(Ve.LBRACE))this.parseCondition();else return}parseCondition(){let A=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(Ve.RBRACE),this.accept(Ve.IF))this.operators[A]=this.operators.length,this.operators[A+1]="jz";else if(this.accept(Ve.LBRACE)){let t=this.operators.length;this.operators.push(null,null);let i=this.operators.length;this.parseBlock(),this.expect(Ve.RBRACE),this.expect(Ve.IFELSE),this.operators[t]=this.operators.length,this.operators[t+1]="j",this.operators[A]=i,this.operators[A+1]="jz"}else throw new v("PS Function: error parsing conditional.")}},Ve={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5},rt=class{static get opCache(){return nA(this,"opCache",Object.create(null))}constructor(A,t){this.type=A,this.value=t}static getOperator(A){var t;return(t=rt.opCache)[A]||(t[A]=new rt(Ve.OPERATOR,A))}static get LBRACE(){return nA(this,"LBRACE",new rt(Ve.LBRACE,"{"))}static get RBRACE(){return nA(this,"RBRACE",new rt(Ve.RBRACE,"}"))}static get IF(){return nA(this,"IF",new rt(Ve.IF,"IF"))}static get IFELSE(){return nA(this,"IFELSE",new rt(Ve.IFELSE,"IFELSE"))}},PI=class{constructor(A){this.stream=A,this.nextChar(),this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let A=!1,t=this.currentChar;for(;;){if(t<0)return Ge;if(A)(t===10||t===13)&&(A=!1);else if(t===37)A=!0;else if(!pt(t))break;t=this.nextChar()}switch(t|0){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new rt(Ve.NUMBER,this.getNumber());case 123:return this.nextChar(),rt.LBRACE;case 125:return this.nextChar(),rt.RBRACE}let i=this.strBuf;for(i.length=0,i[0]=String.fromCharCode(t);(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)i.push(String.fromCharCode(t));let s=i.join("");switch(s.toLowerCase()){case"if":return rt.IF;case"ifelse":return rt.IFELSE;default:return rt.getOperator(s)}}getNumber(){let A=this.currentChar,t=this.strBuf;for(t.length=0,t[0]=String.fromCharCode(A);(A=this.nextChar())>=0&&(A>=48&&A<=57||A===45||A===46);)t.push(String.fromCharCode(A));let i=parseFloat(t.join(""));if(isNaN(i))throw new v(`Invalid floating point number: ${i}`);return i}},Xi=class{constructor(A){this._onlyRefs=(A==null?void 0:A.onlyRefs)===!0,this._onlyRefs||(this._nameRefMap=new Map,this._imageMap=new Map),this._imageCache=new mt}getByName(A){this._onlyRefs&&OA("Should not call `getByName` method.");let t=this._nameRefMap.get(A);return t?this.getByRef(t):this._imageMap.get(A)||null}getByRef(A){return this._imageCache.get(A)||null}set(A,t,i){OA("Abstract method `set` called.")}},Hr=class extends Xi{set(A,t=null,i){if(typeof A!="string")throw new Error(\'LocalImageCache.set - expected "name" argument.\');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(A,t),this._imageCache.put(t,i);return}this._imageMap.has(A)||this._imageMap.set(A,i)}},Jr=class extends Xi{set(A=null,t=null,i){if(typeof A!="string"&&!t)throw new Error(\'LocalColorSpaceCache.set - expected "name" and/or "ref" argument.\');if(t){if(this._imageCache.has(t))return;A!==null&&this._nameRefMap.set(A,t),this._imageCache.put(t,i);return}this._imageMap.has(A)||this._imageMap.set(A,i)}},WI=class extends Xi{constructor(A){super({onlyRefs:!0})}set(A=null,t,i){if(!t)throw new Error(\'LocalFunctionCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}},Yr=class extends Xi{set(A,t=null,i){if(typeof A!="string")throw new Error(\'LocalGStateCache.set - expected "name" argument.\');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(A,t),this._imageCache.put(t,i);return}this._imageMap.has(A)||this._imageMap.set(A,i)}},OI=class extends Xi{constructor(A){super({onlyRefs:!0})}set(A=null,t,i){if(!t)throw new Error(\'LocalTilingPatternCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}},ZI=class extends Xi{constructor(A){super({onlyRefs:!0})}set(A=null,t,i){if(!t)throw new Error(\'RegionalImageCache.set - expected "ref" argument.\');this._imageCache.has(t)||this._imageCache.put(t,i)}},ps,Mg,wf,Bn,jI,os=class{constructor(){HA(this,Mg);HA(this,Bn);HA(this,ps,new be);this._refCache=new mt,this._imageCache=new mt}shouldCache(A,t){let i=this._refCache.get(A);return i||(i=new Set,this._refCache.put(A,i)),i.add(t),!(i.size<os.NUM_PAGES_THRESHOLD||!this._imageCache.has(A)&&ne(this,Bn,jI))}addDecodeFailed(A){ne(this,ps).put(A)}hasDecodeFailed(A){return ne(this,ps).has(A)}addByteSize(A,t){let i=this._imageCache.get(A);i&&(i.byteSize||(i.byteSize=t))}getData(A,t){let i=this._refCache.get(A);if(!i||i.size<os.NUM_PAGES_THRESHOLD)return null;let s=this._imageCache.get(A);return s?(i.add(t),s):null}setData(A,t){if(!this._refCache.has(A))throw new Error(\'GlobalImageCache.setData - expected "shouldCache" to have been called.\');if(!this._imageCache.has(A)){if(ne(this,Bn,jI)){k("GlobalImageCache.setData - cache limit reached.");return}this._imageCache.put(A,t)}}clear(A=!1){A||(ne(this,ps).clear(),this._refCache.clear()),this._imageCache.clear()}},z0=os;ps=new WeakMap,Mg=new WeakSet,wf=function(){let A=0;for(let t of this._imageCache)A+=t.byteSize;return A},Bn=new WeakSet,jI=function(){return!(this._imageCache.size<os.MIN_IMAGES_TO_CACHE||ne(this,Mg,wf)<os.MAX_BYTE_SIZE)},et(z0,"NUM_PAGES_THRESHOLD",2),et(z0,"MIN_IMAGES_TO_CACHE",10),et(z0,"MAX_BYTE_SIZE",5*Su);var Kr=class{constructor({xref:A,isEvalSupported:t=!0}){this.xref=A,this.isEvalSupported=t!==!1}create(A){let t=this.getCached(A);if(t)return t;let i=vr.parse({xref:this.xref,isEvalSupported:this.isEvalSupported,fn:A instanceof oA?this.xref.fetch(A):A});return this._cache(A,i),i}createFromArray(A){let t=this.getCached(A);if(t)return t;let i=vr.parseArray({xref:this.xref,isEvalSupported:this.isEvalSupported,fnObj:A instanceof oA?this.xref.fetch(A):A});return this._cache(A,i),i}getCached(A){var i;let t;if(A instanceof oA?t=A:A instanceof F?t=A.objId:A instanceof KA&&(t=(i=A.dict)==null?void 0:i.objId),t){let s=this._localFunctionCache.getByRef(t);if(s)return s}return null}_cache(A,t){var s;if(!t)throw new Error(\'PDFFunctionFactory._cache - expected "parsedFunction" argument.\');let i;A instanceof oA?i=A:A instanceof F?i=A.objId:A instanceof KA&&(i=(s=A.dict)==null?void 0:s.objId),i&&this._localFunctionCache.set(null,i,t)}get _localFunctionCache(){return nA(this,"_localFunctionCache",new WI)}};function kt(e){return Array.isArray(e)?wt(e,null)?e:e.map(A=>+A):null}var vr=class{static getSampleArray(A,t,i,s){let a,n,r=1;for(a=0,n=A.length;a<n;a++)r*=A[a];r*=t;let g=new Array(r),o=0,I=0,c=1/(2**i-1),l=s.getBytes((r*i+7)/8),h=0;for(a=0;a<r;a++){for(;o<i;)I<<=8,I|=l[h++],o+=8;o-=i,g[a]=(I>>o)*c,I&=(1<<o)-1}return g}static parse({xref:A,isEvalSupported:t,fn:i}){let s=i.dict||i;switch(s.get("FunctionType")){case 0:return this.constructSampled({xref:A,isEvalSupported:t,fn:i,dict:s});case 1:break;case 2:return this.constructInterpolated({xref:A,isEvalSupported:t,dict:s});case 3:return this.constructStiched({xref:A,isEvalSupported:t,dict:s});case 4:return this.constructPostScript({xref:A,isEvalSupported:t,fn:i,dict:s})}throw new v("Unknown type of function")}static parseArray({xref:A,isEvalSupported:t,fnObj:i}){if(!Array.isArray(i))return this.parse({xref:A,isEvalSupported:t,fn:i});let s=[];for(let a of i)s.push(this.parse({xref:A,isEvalSupported:t,fn:A.fetchIfRef(a)}));return function(a,n,r,g){for(let o=0,I=s.length;o<I;o++)s[o](a,n,r,g+o)}}static constructSampled({xref:A,isEvalSupported:t,fn:i,dict:s}){function a(E){let f=E.length,u=[],d=0;for(let x=0;x<f;x+=2)u[d++]=[E[x],E[x+1]];return u}function n(E,f,u,d,x){return d+(E-f)*((x-d)/(u-f))}let r=kt(s.getArray("Domain")),g=kt(s.getArray("Range"));if(!r||!g)throw new v("No domain or range");let o=r.length/2,I=g.length/2;r=a(r),g=a(g);let c=kt(s.getArray("Size")),l=s.get("BitsPerSample"),h=s.get("Order")||1;h!==1&&PA("No support for cubic spline interpolation: "+h);let C=kt(s.getArray("Encode"));if(C)C=a(C);else{C=[];for(let E=0;E<o;++E)C.push([0,c[E]-1])}let B=kt(s.getArray("Decode"));B=B?a(B):g;let Q=this.getSampleArray(c,I,l,i);return function(f,u,d,x){let p=1<<o,m=new Float64Array(p),D=new Uint32Array(p),S,w;for(w=0;w<p;w++)m[w]=1;let Y=I,U=1;for(S=0;S<o;++S){let K=r[S][0],Z=r[S][1],AA=Math.min(Math.max(f[u+S],K),Z),gA=n(AA,K,Z,C[S][0],C[S][1]),R=c[S];gA=Math.min(Math.max(gA,0),R-1);let _=gA<R-1?Math.floor(gA):gA-1,tA=_+1-gA,IA=gA-_,QA=_*Y,V=QA+Y;for(w=0;w<p;w++)w&U?(m[w]*=IA,D[w]+=V):(m[w]*=tA,D[w]+=QA);Y*=R,U<<=1}for(w=0;w<I;++w){let K=0;for(S=0;S<p;S++)K+=Q[D[S]+w]*m[S];K=n(K,0,1,B[w][0],B[w][1]),d[x+w]=Math.min(Math.max(K,g[w][0]),g[w][1])}}}static constructInterpolated({xref:A,isEvalSupported:t,dict:i}){let s=kt(i.getArray("C0"))||[0],a=kt(i.getArray("C1"))||[1],n=i.get("N"),r=[];for(let o=0,I=s.length;o<I;++o)r.push(a[o]-s[o]);let g=r.length;return function(I,c,l,h){let C=n===1?I[c]:I[c]**n;for(let B=0;B<g;++B)l[h+B]=s[B]+C*r[B]}}static constructStiched({xref:A,isEvalSupported:t,dict:i}){let s=kt(i.getArray("Domain"));if(!s)throw new v("No domain");if(s.length/2!==1)throw new v("Bad domain for stiched function");let n=[];for(let I of i.get("Functions"))n.push(this.parse({xref:A,isEvalSupported:t,fn:A.fetchIfRef(I)}));let r=kt(i.getArray("Bounds")),g=kt(i.getArray("Encode")),o=new Float32Array(1);return function(c,l,h,C){let Q=function(D,S,w){return D>w?D=w:D<S&&(D=S),D}(c[l],s[0],s[1]),E=r.length,f;for(f=0;f<E&&!(Q<r[f]);++f);let u=s[0];f>0&&(u=r[f-1]);let d=s[1];f<r.length&&(d=r[f]);let x=g[2*f],p=g[2*f+1];o[0]=u===d?x:x+(Q-u)*(p-x)/(d-u),n[f](o,0,h,C)}}static constructPostScript({xref:A,isEvalSupported:t,fn:i,dict:s}){let a=kt(s.getArray("Domain")),n=kt(s.getArray("Range"));if(!a)throw new v("No domain.");if(!n)throw new v("No range.");let r=new PI(i),o=new TI(r).parse();if(t&&Ot.isEvalSupported){let E=new zI().compile(o,a,n);if(E)return new Function("src","srcOffset","dest","destOffset",E)}PA("Unable to compile PS function");let I=n.length>>1,c=a.length>>1,l=new XI(o),h=Object.create(null),B=2048*4,Q=new Float32Array(c);return function(f,u,d,x){let p,m,D="",S=Q;for(p=0;p<c;p++)m=f[u+p],S[p]=m,D+=m+"_";let w=h[D];if(w!==void 0){d.set(w,x);return}let Y=new Float32Array(I),U=l.execute(S),K=U.length-I;for(p=0;p<I;p++){m=U[K+p];let Z=n[p*2];m<Z?m=Z:(Z=n[p*2+1],m>Z&&(m=Z)),Y[p]=m}B>0&&(B--,h[D]=Y),d.set(Y,x)}}};function Do(e){let A;if(e instanceof F)A=e;else if(e instanceof KA)A=e.dict;else return!1;return A.has("FunctionType")}var Lg=class{constructor(A){this.stack=A?Array.from(A):[]}push(A){if(this.stack.length>=Lg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(A)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(A){if(this.stack.length+A>=Lg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");let t=this.stack;for(let i=t.length-A,s=A-1;s>=0;s--,i++)t.push(t[i])}index(A){this.push(this.stack[this.stack.length-A-1])}roll(A,t){let i=this.stack,s=i.length-A,a=i.length-1,n=s+(t-Math.floor(t/A)*A);for(let r=s,g=a;r<g;r++,g--){let o=i[r];i[r]=i[g],i[g]=o}for(let r=s,g=n-1;r<g;r++,g--){let o=i[r];i[r]=i[g],i[g]=o}for(let r=n,g=a;r<g;r++,g--){let o=i[r];i[r]=i[g],i[g]=o}}},gr=Lg;et(gr,"MAX_STACK_SIZE",100);var XI=class{constructor(A){this.operators=A}execute(A){let t=new gr(A),i=0,s=this.operators,a=s.length,n,r,g;for(;i<a;){if(n=s[i++],typeof n=="number"){t.push(n);continue}switch(n){case"jz":g=t.pop(),r=t.pop(),r||(i=g);break;case"j":r=t.pop(),i=r;break;case"abs":r=t.pop(),t.push(Math.abs(r));break;case"add":g=t.pop(),r=t.pop(),t.push(r+g);break;case"and":g=t.pop(),r=t.pop(),typeof r=="boolean"&&typeof g=="boolean"?t.push(r&&g):t.push(r&g);break;case"atan":g=t.pop(),r=t.pop(),r=Math.atan2(r,g)/Math.PI*180,r<0&&(r+=360),t.push(r);break;case"bitshift":g=t.pop(),r=t.pop(),r>0?t.push(r<<g):t.push(r>>g);break;case"ceiling":r=t.pop(),t.push(Math.ceil(r));break;case"copy":r=t.pop(),t.copy(r);break;case"cos":r=t.pop(),t.push(Math.cos(r%360/180*Math.PI));break;case"cvi":r=t.pop()|0,t.push(r);break;case"cvr":break;case"div":g=t.pop(),r=t.pop(),t.push(r/g);break;case"dup":t.copy(1);break;case"eq":g=t.pop(),r=t.pop(),t.push(r===g);break;case"exch":t.roll(2,1);break;case"exp":g=t.pop(),r=t.pop(),t.push(r**g);break;case"false":t.push(!1);break;case"floor":r=t.pop(),t.push(Math.floor(r));break;case"ge":g=t.pop(),r=t.pop(),t.push(r>=g);break;case"gt":g=t.pop(),r=t.pop(),t.push(r>g);break;case"idiv":g=t.pop(),r=t.pop(),t.push(r/g|0);break;case"index":r=t.pop(),t.index(r);break;case"le":g=t.pop(),r=t.pop(),t.push(r<=g);break;case"ln":r=t.pop(),t.push(Math.log(r));break;case"log":r=t.pop(),t.push(Math.log10(r));break;case"lt":g=t.pop(),r=t.pop(),t.push(r<g);break;case"mod":g=t.pop(),r=t.pop(),t.push(r%g);break;case"mul":g=t.pop(),r=t.pop(),t.push(r*g);break;case"ne":g=t.pop(),r=t.pop(),t.push(r!==g);break;case"neg":r=t.pop(),t.push(-r);break;case"not":r=t.pop(),typeof r=="boolean"?t.push(!r):t.push(~r);break;case"or":g=t.pop(),r=t.pop(),typeof r=="boolean"&&typeof g=="boolean"?t.push(r||g):t.push(r|g);break;case"pop":t.pop();break;case"roll":g=t.pop(),r=t.pop(),t.roll(r,g);break;case"round":r=t.pop(),t.push(Math.round(r));break;case"sin":r=t.pop(),t.push(Math.sin(r%360/180*Math.PI));break;case"sqrt":r=t.pop(),t.push(Math.sqrt(r));break;case"sub":g=t.pop(),r=t.pop(),t.push(r-g);break;case"true":t.push(!0);break;case"truncate":r=t.pop(),r=r<0?Math.ceil(r):Math.floor(r),t.push(r);break;case"xor":g=t.pop(),r=t.pop(),typeof r=="boolean"&&typeof g=="boolean"?t.push(r!==g):t.push(r^g);break;default:throw new v(`Unknown operator ${n}`)}}return t.stack}},Vi=class{constructor(A){this.type=A}visit(A){OA("abstract method")}},VI=class extends Vi{constructor(A,t,i){super("args"),this.index=A,this.min=t,this.max=i}visit(A){A.visitArgument(this)}},ui=class extends Vi{constructor(A){super("literal"),this.number=A,this.min=A,this.max=A}visit(A){A.visitLiteral(this)}},Ka=class extends Vi{constructor(A,t,i,s,a){super("binary"),this.op=A,this.arg1=t,this.arg2=i,this.min=s,this.max=a}visit(A){A.visitBinaryOperation(this)}},_I=class extends Vi{constructor(A,t){super("max"),this.arg=A,this.min=A.min,this.max=t}visit(A){A.visitMin(this)}},qr=class extends Vi{constructor(A,t,i){super("var"),this.index=A,this.min=t,this.max=i}visit(A){A.visitVariable(this)}},Tr=class extends Vi{constructor(A,t){super("definition"),this.variable=A,this.arg=t}visit(A){A.visitVariableDefinition(this)}},Pr=class{constructor(){this.parts=[]}visitArgument(A){this.parts.push("Math.max(",A.min,", Math.min(",A.max,", src[srcOffset + ",A.index,"]))")}visitVariable(A){this.parts.push("v",A.index)}visitLiteral(A){this.parts.push(A.number)}visitBinaryOperation(A){this.parts.push("("),A.arg1.visit(this),this.parts.push(" ",A.op," "),A.arg2.visit(this),this.parts.push(")")}visitVariableDefinition(A){this.parts.push("var "),A.variable.visit(this),this.parts.push(" = "),A.arg.visit(this),this.parts.push(";")}visitMin(A){this.parts.push("Math.min("),A.arg.visit(this),this.parts.push(", ",A.max,")")}toString(){return this.parts.join("")}};function E9(e,A){return A.type==="literal"&&A.number===0?e:e.type==="literal"&&e.number===0?A:A.type==="literal"&&e.type==="literal"?new ui(e.number+A.number):new Ka("+",e,A,e.min+A.min,e.max+A.max)}function f9(e,A){if(A.type==="literal"){if(A.number===0)return new ui(0);if(A.number===1)return e;if(e.type==="literal")return new ui(e.number*A.number)}if(e.type==="literal"){if(e.number===0)return new ui(0);if(e.number===1)return A}let t=Math.min(e.min*A.min,e.min*A.max,e.max*A.min,e.max*A.max),i=Math.max(e.min*A.min,e.min*A.max,e.max*A.min,e.max*A.max);return new Ka("*",e,A,t,i)}function u9(e,A){if(A.type==="literal"){if(A.number===0)return e;if(e.type==="literal")return new ui(e.number-A.number)}return A.type==="binary"&&A.op==="-"&&e.type==="literal"&&e.number===1&&A.arg1.type==="literal"&&A.arg1.number===1?A.arg2:new Ka("-",e,A,e.min-A.max,e.max-A.min)}function d9(e,A){return e.min>=A?new ui(A):e.max<=A?e:new _I(e,A)}var zI=class{compile(A,t,i){let s=[],a=[],n=t.length>>1,r=i.length>>1,g=0,o,I,c,l,h,C,B,Q;for(let f=0;f<n;f++)s.push(new VI(f,t[f*2],t[f*2+1]));for(let f=0,u=A.length;f<u;f++){if(Q=A[f],typeof Q=="number"){s.push(new ui(Q));continue}switch(Q){case"add":if(s.length<2)return null;l=s.pop(),c=s.pop(),s.push(E9(c,l));break;case"cvr":if(s.length<1)return null;break;case"mul":if(s.length<2)return null;l=s.pop(),c=s.pop(),s.push(f9(c,l));break;case"sub":if(s.length<2)return null;l=s.pop(),c=s.pop(),s.push(u9(c,l));break;case"exch":if(s.length<2)return null;h=s.pop(),C=s.pop(),s.push(h,C);break;case"pop":if(s.length<1)return null;s.pop();break;case"index":if(s.length<1||(c=s.pop(),c.type!=="literal")||(o=c.number,o<0||!Number.isInteger(o)||s.length<o))return null;if(h=s[s.length-o-1],h.type==="literal"||h.type==="var"){s.push(h);break}B=new qr(g++,h.min,h.max),s[s.length-o-1]=B,s.push(B),a.push(new Tr(B,h));break;case"dup":if(s.length<1)return null;if(typeof A[f+1]=="number"&&A[f+2]==="gt"&&A[f+3]===f+7&&A[f+4]==="jz"&&A[f+5]==="pop"&&A[f+6]===A[f+1]){c=s.pop(),s.push(d9(c,A[f+1])),f+=6;break}if(h=s.at(-1),h.type==="literal"||h.type==="var"){s.push(h);break}B=new qr(g++,h.min,h.max),s[s.length-1]=B,s.push(B),a.push(new Tr(B,h));break;case"roll":if(s.length<2||(l=s.pop(),c=s.pop(),l.type!=="literal"||c.type!=="literal")||(I=l.number,o=c.number,o<=0||!Number.isInteger(o)||!Number.isInteger(I)||s.length<o))return null;if(I=(I%o+o)%o,I===0)break;s.push(...s.splice(s.length-o,o-I));break;default:return null}}if(s.length!==r)return null;let E=[];for(let f of a){let u=new Pr;f.visit(u),E.push(u.toString())}for(let f=0,u=s.length;f<u;f++){let d=s[f],x=new Pr;d.visit(x);let p=i[f*2],m=i[f*2+1],D=[x.toString()];p>d.min&&(D.unshift("Math.max(",p,", "),D.push(")")),m<d.max&&(D.unshift("Math.min(",m,", "),D.push(")")),D.unshift("dest[destOffset + ",f,"] = "),D.push(";"),E.push(D.join(""))}return E.join(`\n`)}},x9=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],m9=["AN","AN","AN","AN","AN","AN","ON","ON","AL","ET","ET","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL"];function hE(e){return(e&1)!==0}function p9(e){return(e&1)===0}function w9(e,A,t){let i,s;for(i=A,s=e.length;i<s;++i)if(e[i]!==t)return i;return i}function y9(e,A,t,i){for(let s=A;s<t;++s)e[s]=i}function CE(e,A,t){for(let i=A,s=t-1;i<s;++i,--s){let a=e[i];e[i]=e[s],e[s]=a}}function ko(e,A,t=!1){let i="ltr";return t?i="ttb":A||(i="rtl"),{str:e,dir:i}}var ki=[],VA=[];function yf(e,A=-1,t=!1){let i=!0,s=e.length;if(s===0||t)return ko(e,i,t);ki.length=s,VA.length=s;let a=0,n,r;for(n=0;n<s;++n){ki[n]=e.charAt(n);let E=e.charCodeAt(n),f="L";E<=255?f=x9[E]:1424<=E&&E<=1524?f="R":1536<=E&&E<=1791?(f=m9[E&255],f||k("Bidi: invalid Unicode character "+E.toString(16))):(1792<=E&&E<=2220||64336<=E&&E<=65023||65136<=E&&E<=65279)&&(f="AL"),(f==="R"||f==="AL"||f==="AN")&&a++,VA[n]=f}if(a===0)return i=!0,ko(e,i);A===-1&&(a/s<.3&&s>4?(i=!0,A=0):(i=!1,A=1));let g=[];for(n=0;n<s;++n)g[n]=A;let o=hE(A)?"R":"L",I=o,c=I,l=I;for(n=0;n<s;++n)VA[n]==="NSM"?VA[n]=l:l=VA[n];l=I;let h;for(n=0;n<s;++n)h=VA[n],h==="EN"?VA[n]=l==="AL"?"AN":"EN":(h==="R"||h==="L"||h==="AL")&&(l=h);for(n=0;n<s;++n)h=VA[n],h==="AL"&&(VA[n]="R");for(n=1;n<s-1;++n)VA[n]==="ES"&&VA[n-1]==="EN"&&VA[n+1]==="EN"&&(VA[n]="EN"),VA[n]==="CS"&&(VA[n-1]==="EN"||VA[n-1]==="AN")&&VA[n+1]===VA[n-1]&&(VA[n]=VA[n-1]);for(n=0;n<s;++n)if(VA[n]==="EN"){for(let E=n-1;E>=0&&VA[E]==="ET";--E)VA[E]="EN";for(let E=n+1;E<s&&VA[E]==="ET";++E)VA[E]="EN"}for(n=0;n<s;++n)h=VA[n],(h==="WS"||h==="ES"||h==="ET"||h==="CS")&&(VA[n]="ON");for(l=I,n=0;n<s;++n)h=VA[n],h==="EN"?VA[n]=l==="L"?"L":"EN":(h==="R"||h==="L")&&(l=h);for(n=0;n<s;++n)if(VA[n]==="ON"){let E=w9(VA,n+1,"ON"),f=I;n>0&&(f=VA[n-1]);let u=c;E+1<s&&(u=VA[E+1]),f!=="L"&&(f="R"),u!=="L"&&(u="R"),f===u&&y9(VA,n,E,f),n=E-1}for(n=0;n<s;++n)VA[n]==="ON"&&(VA[n]=o);for(n=0;n<s;++n)h=VA[n],p9(g[n])?h==="R"?g[n]+=1:(h==="AN"||h==="EN")&&(g[n]+=2):(h==="L"||h==="AN"||h==="EN")&&(g[n]+=1);let C=-1,B=99,Q;for(n=0,r=g.length;n<r;++n)Q=g[n],C<Q&&(C=Q),B>Q&&hE(Q)&&(B=Q);for(Q=C;Q>=B;--Q){let E=-1;for(n=0,r=g.length;n<r;++n)g[n]<Q?E>=0&&(CE(ki,E,n),E=-1):E<0&&(E=n);E>=0&&CE(ki,E,g.length)}for(n=0,r=ki.length;n<r;++n){let E=ki[n];(E==="<"||E===">")&&(ki[n]="")}return ko(ki.join(""),i)}var r0={style:"normal",weight:"normal"},o0={style:"normal",weight:"bold"},I0={style:"italic",weight:"normal"},c0={style:"italic",weight:"bold"},ua=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:r0,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:o0,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:I0,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:c0,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:r0,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:o0,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:I0,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:c0,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:r0,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:o0,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:I0,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:c0,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:r0,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:o0,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:I0,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:c0,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:r0,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:o0,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:I0,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:c0,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:r0}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),b9=new Map([["Arial-Black","ArialBlack"]]);function D9(e){switch(e){case o0:return"Bold";case I0:return"Italic";case c0:return"Bold Italic";default:if((e==null?void 0:e.weight)==="bold")return"Bold";if((e==null?void 0:e.style)==="italic")return"Italic"}return""}function BE(e){let A=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return e.split(/[- ,+]+/g).filter(t=>!A.has(t.toLowerCase())).join(" ")}function $I({alias:e,local:A,path:t,fallback:i,style:s,ultimate:a},n,r,g=!0,o=!0,I=""){let c={style:null,ultimate:null};if(A){let l=I?` ${I}`:"";for(let h of A)n.push(`local(${h}${l})`)}if(e){let l=ua.get(e),h=I||D9(s);Object.assign(c,$I(l,n,r,g&&!i,o&&!t,h))}if(s&&(c.style=s),a&&(c.ultimate=a),g&&i){let l=ua.get(i),{ultimate:h}=$I(l,n,r,g,o&&!t,I);c.ultimate||(c.ultimate=h)}return o&&t&&r&&n.push(`url(${r}${t})`),c}function QE(e,A,t,i,s,a){if(i.startsWith("InvalidPDFjsFont_"))return null;(a==="TrueType"||a==="Type1")&&/^[A-Z]{6}\\+/.test(i)&&(i=i.slice(7)),i=pn(i);let n=i,r=e.get(n);if(r)return r;let g=ua.get(i);if(!g){for(let[Q,E]of b9)if(i.startsWith(Q)){i=`${E}${i.substring(Q.length)}`,g=ua.get(i);break}}let o=!1;g||(g=ua.get(s),o=!0);let I=`${A.getDocId()}_s${A.createFontId()}`;if(!g){if(!vo(i))return k(`Cannot substitute the font because of its name: ${i}`),e.set(n,null),null;let Q=/bold/gi.test(i),E=/oblique|italic/gi.test(i),f=Q&&E&&c0||Q&&o0||E&&I0||r0;return r={css:`"${BE(i)}",${I}`,guessFallback:!0,loadedName:I,baseFontName:i,src:`local(${i})`,style:f},e.set(n,r),r}let c=[];o&&vo(i)&&c.push(`local(${i})`);let{style:l,ultimate:h}=$I(g,c,t),C=h===null,B=C?"":`,${h}`;return r={css:`"${BE(i)}",${I}${B}`,guessFallback:C,loadedName:I,baseFontName:i,src:c.join(","),style:l},e.set(n,r),r}var bf=2048,k9=65537,EE=128,at=class{constructor(A,t){this._imgData=A,this._isMask=t}static needsToBeResized(A,t){if(A<=this._goodSquareLength&&t<=this._goodSquareLength)return!1;let{MAX_DIM:i}=this;if(A>i||t>i)return!0;let s=A*t;if(this._hasMaxArea)return s>this.MAX_AREA;if(s<this._goodSquareLength**2)return!1;if(this._areGoodDims(A,t))return this._goodSquareLength=Math.max(this._goodSquareLength,Math.floor(Math.sqrt(A*t))),!1;this._goodSquareLength=this._guessMax(this._goodSquareLength,i,EE,0);let a=this.MAX_AREA=this._goodSquareLength**2;return s>a}static get MAX_DIM(){return nA(this,"MAX_DIM",this._guessMax(bf,k9,0,1))}static get MAX_AREA(){return this._hasMaxArea=!0,nA(this,"MAX_AREA",this._guessMax(at._goodSquareLength,this.MAX_DIM,EE,0)**2)}static set MAX_AREA(A){A>=0&&(this._hasMaxArea=!0,nA(this,"MAX_AREA",A))}static setMaxArea(A){this._hasMaxArea||(this.MAX_AREA=A>>2)}static _areGoodDims(A,t){try{let i=new OffscreenCanvas(A,t),s=i.getContext("2d");s.fillRect(0,0,1,1);let a=s.getImageData(0,0,1,1).data[3];return i.width=i.height=1,a!==0}catch(i){return!1}}static _guessMax(A,t,i,s){for(;A+i+1<t;){let a=Math.floor((A+t)/2),n=s||a;this._areGoodDims(a,n)?A=a:t=a}return A}static async createImage(A,t=!1){return new at(A,t)._createImage()}async _createImage(){let A=this._encodeBMP(),t=new Blob([A.buffer],{type:"image/bmp"}),i=createImageBitmap(t),{MAX_AREA:s,MAX_DIM:a}=at,{_imgData:n}=this,{width:r,height:g}=n,o=Math.max(r/a,g/a,Math.sqrt(r*g/s)),I=Math.max(o,2),c=Math.round(10*(o+1.25))/10/I,l=Math.floor(Math.log2(c)),h=new Array(l+2).fill(2);h[0]=I,h.splice(-1,1,c/(1<<l));let C=r,B=g,Q=await i;for(let E of h){let f=C,u=B;C=Math.floor(C/E)-1,B=Math.floor(B/E)-1;let d=new OffscreenCanvas(C,B);d.getContext("2d").drawImage(Q,0,0,f,u,0,0,C,B),Q=d.transferToImageBitmap()}return n.data=null,n.bitmap=Q,n.width=C,n.height=B,n}_encodeBMP(){let{width:A,height:t,kind:i}=this._imgData,s=this._imgData.data,a,n=new Uint8Array(0),r=n,g=0;switch(i){case Ke.GRAYSCALE_1BPP:{a=1,n=new Uint8Array(this._isMask?[255,255,255,255,0,0,0,0]:[0,0,0,0,255,255,255,255]);let B=A+7>>3,Q=B+3&-4;if(B!==Q){let E=new Uint8Array(Q*t),f=0;for(let u=0,d=t*B;u<d;u+=B,f+=Q)E.set(s.subarray(u,u+B),f);s=E}break}case Ke.RGB_24BPP:{if(a=24,A&3){let B=3*A,Q=B+3&-4,E=Q-B,f=new Uint8Array(Q*t),u=0;for(let d=0,x=t*B;d<x;d+=B){let p=s.subarray(d,d+B);for(let m=0;m<B;m+=3)f[u++]=p[m+2],f[u++]=p[m+1],f[u++]=p[m];u+=E}s=f}else for(let B=0,Q=s.length;B<Q;B+=3){let E=s[B];s[B]=s[B+2],s[B+2]=E}break}case Ke.RGBA_32BPP:a=32,g=3,r=new Uint8Array(4+4+4+4+52);let C=new DataView(r.buffer);Ot.isLittleEndian?(C.setUint32(0,255,!0),C.setUint32(4,65280,!0),C.setUint32(8,16711680,!0),C.setUint32(12,4278190080,!0)):(C.setUint32(0,4278190080,!0),C.setUint32(4,16711680,!0),C.setUint32(8,65280,!0),C.setUint32(12,255,!0));break;default:throw new Error("invalid format")}let o=0,I=40+r.length,c=14+I+n.length+s.length,l=new Uint8Array(c),h=new DataView(l.buffer);return h.setUint16(o,19778,!0),o+=2,h.setUint32(o,c,!0),o+=4,h.setUint32(o,0,!0),o+=4,h.setUint32(o,14+I+n.length,!0),o+=4,h.setUint32(o,I,!0),o+=4,h.setInt32(o,A,!0),o+=4,h.setInt32(o,-t,!0),o+=4,h.setUint16(o,1,!0),o+=2,h.setUint16(o,a,!0),o+=2,h.setUint32(o,g,!0),o+=4,h.setUint32(o,0,!0),o+=4,h.setInt32(o,0,!0),o+=4,h.setInt32(o,0,!0),o+=4,h.setUint32(o,n.length/4,!0),o+=4,h.setUint32(o,0,!0),o+=4,l.set(r,o),o+=r.length,l.set(n,o),o+=n.length,l.set(s,o),l}};at._goodSquareLength=bf;var fE=3285377520,St=4294901760,Vt=65535,Ac=class{constructor(A){this.h1=A?A&4294967295:fE,this.h2=A?A&4294967295:fE}update(A){let t,i;if(typeof A=="string"){t=new Uint8Array(A.length*2),i=0;for(let B=0,Q=A.length;B<Q;B++){let E=A.charCodeAt(B);E<=255?t[i++]=E:(t[i++]=E>>>8,t[i++]=E&255)}}else if(ArrayBuffer.isView(A))t=A.slice(),i=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-s*4,n=new Uint32Array(t.buffer,0,s),r=0,g=0,o=this.h1,I=this.h2,c=3432918353,l=461845907,h=c&Vt,C=l&Vt;for(let B=0;B<s;B++)B&1?(r=n[B],r=r*c&St|r*h&Vt,r=r<<15|r>>>17,r=r*l&St|r*C&Vt,o^=r,o=o<<13|o>>>19,o=o*5+3864292196):(g=n[B],g=g*c&St|g*h&Vt,g=g<<15|g>>>17,g=g*l&St|g*C&Vt,I^=g,I=I<<13|I>>>19,I=I*5+3864292196);switch(r=0,a){case 3:r^=t[s*4+2]<<16;case 2:r^=t[s*4+1]<<8;case 1:r^=t[s*4],r=r*c&St|r*h&Vt,r=r<<15|r>>>17,r=r*l&St|r*C&Vt,s&1?o^=r:I^=r}this.h1=o,this.h2=I}hexdigest(){let A=this.h1,t=this.h2;return A^=t>>>1,A=A*3981806797&St|A*36045&Vt,t=t*4283543511&St|((t<<16|A>>>16)*2950163797&St)>>>16,A^=t>>>1,A=A*444984403&St|A*60499&Vt,t=t*3301882366&St|((t<<16|A>>>16)*3120437893&St)>>>16,A^=t>>>1,(A>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}};function $g(e,A,t,i,s){let a=e;for(let n=0,r=A.length-1;n<r;n++){let g=A[n];a=a[g]||(a[g]=[])}a[A.at(-1)]={checkFn:t,iterateFn:i,processFn:s}}var Ms=[];$g(Ms,[y.save,y.transform,y.paintInlineImageXObject,y.restore],null,function(A,t){let i=A.fnArray,s=A.iCurr-3,a=(t-s)%4;switch(a){case 0:return i[t]===y.save;case 1:return i[t]===y.transform;case 2:return i[t]===y.paintInlineImageXObject;case 3:return i[t]===y.restore}throw new Error(`iterateInlineImageGroup - invalid pos: ${a}`)},function(A,t){let r=A.fnArray,g=A.argsArray,o=A.iCurr,I=o-3,c=o-2,l=o-1,h=Math.min(Math.floor((t-I)/4),200);if(h<10)return t-(t-I)%4;let C=0,B=[],Q=0,E=1,f=1;for(let D=0;D<h;D++){let S=g[c+(D<<2)],w=g[l+(D<<2)][0];E+w.width>1e3&&(C=Math.max(C,E),f+=Q+2*1,E=0,Q=0),B.push({transform:S,x:E,y:f,w:w.width,h:w.height}),E+=w.width+2*1,Q=Math.max(Q,w.height)}let u=Math.max(C,E)+1,d=f+Q+1,x=new Uint8Array(u*d*4),p=u<<2;for(let D=0;D<h;D++){let S=g[l+(D<<2)][0].data,w=B[D].w<<2,Y=0,U=B[D].x+B[D].y*u<<2;x.set(S.subarray(0,w),U-p);for(let K=0,Z=B[D].h;K<Z;K++)x.set(S.subarray(Y,Y+w),U),Y+=w,U+=p;for(x.set(S.subarray(Y-w,Y),U);U>=0;)S[U-4]=S[U],S[U-3]=S[U+1],S[U-2]=S[U+2],S[U-1]=S[U+3],S[U+w]=S[U+w-4],S[U+w+1]=S[U+w-3],S[U+w+2]=S[U+w-2],S[U+w+3]=S[U+w-1],U-=p}let m={width:u,height:d};if(A.isOffscreenCanvasSupported){let D=new OffscreenCanvas(u,d);D.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(x.buffer),u,d),0,0),m.bitmap=D.transferToImageBitmap(),m.data=null}else m.kind=Ke.RGBA_32BPP,m.data=x;return r.splice(I,h*4,y.paintInlineImageXObjectGroup),g.splice(I,h*4,[m,B]),I+1});$g(Ms,[y.save,y.transform,y.paintImageMaskXObject,y.restore],null,function(A,t){let i=A.fnArray,s=A.iCurr-3,a=(t-s)%4;switch(a){case 0:return i[t]===y.save;case 1:return i[t]===y.transform;case 2:return i[t]===y.paintImageMaskXObject;case 3:return i[t]===y.restore}throw new Error(`iterateImageMaskGroup - invalid pos: ${a}`)},function(A,t){let n=A.fnArray,r=A.argsArray,g=A.iCurr,o=g-3,I=g-2,c=g-1,l=Math.floor((t-o)/4);if(l<10)return t-(t-o)%4;let h=!1,C,B,Q=r[c][0],E=r[I][0],f=r[I][1],u=r[I][2],d=r[I][3];if(f===u){h=!0,C=I+4;let x=c+4;for(let p=1;p<l;p++,C+=4,x+=4)if(B=r[C],r[x][0]!==Q||B[0]!==E||B[1]!==f||B[2]!==u||B[3]!==d){p<10?h=!1:l=p;break}}if(h){l=Math.min(l,1e3);let x=new Float32Array(l*2);C=I;for(let p=0;p<l;p++,C+=4)B=r[C],x[p<<1]=B[4],x[(p<<1)+1]=B[5];n.splice(o,l*4,y.paintImageMaskXObjectRepeat),r.splice(o,l*4,[Q,E,f,u,d,x])}else{l=Math.min(l,100);let x=[];for(let p=0;p<l;p++){B=r[I+(p<<2)];let m=r[c+(p<<2)][0];x.push({data:m.data,width:m.width,height:m.height,interpolate:m.interpolate,count:m.count,transform:B})}n.splice(o,l*4,y.paintImageMaskXObjectGroup),r.splice(o,l*4,[x])}return o+1});$g(Ms,[y.save,y.transform,y.paintImageXObject,y.restore],function(e){let A=e.argsArray,t=e.iCurr-2;return A[t][1]===0&&A[t][2]===0},function(A,t){let i=A.fnArray,s=A.argsArray,a=A.iCurr-3,n=(t-a)%4;switch(n){case 0:return i[t]===y.save;case 1:if(i[t]!==y.transform)return!1;let r=A.iCurr-2,g=s[r][0],o=s[r][3];return!(s[t][0]!==g||s[t][1]!==0||s[t][2]!==0||s[t][3]!==o);case 2:if(i[t]!==y.paintImageXObject)return!1;let I=A.iCurr-1,c=s[I][0];return s[t][0]===c;case 3:return i[t]===y.restore}throw new Error(`iterateImageGroup - invalid pos: ${n}`)},function(e,A){let s=e.fnArray,a=e.argsArray,n=e.iCurr,r=n-3,g=n-2,o=n-1,I=a[o][0],c=a[g][0],l=a[g][3],h=Math.min(Math.floor((A-r)/4),1e3);if(h<3)return A-(A-r)%4;let C=new Float32Array(h*2),B=g;for(let E=0;E<h;E++,B+=4){let f=a[B];C[E<<1]=f[4],C[(E<<1)+1]=f[5]}let Q=[I,c,l,C];return s.splice(r,h*4,y.paintImageXObjectRepeat),a.splice(r,h*4,Q),r+1});$g(Ms,[y.beginText,y.setFont,y.setTextMatrix,y.showText,y.endText],null,function(A,t){let i=A.fnArray,s=A.argsArray,a=A.iCurr-4,n=(t-a)%5;switch(n){case 0:return i[t]===y.beginText;case 1:return i[t]===y.setFont;case 2:return i[t]===y.setTextMatrix;case 3:if(i[t]!==y.showText)return!1;let r=A.iCurr-3,g=s[r][0],o=s[r][1];return!(s[t][0]!==g||s[t][1]!==o);case 4:return i[t]===y.endText}throw new Error(`iterateShowTextGroup - invalid pos: ${n}`)},function(e,A){let s=e.fnArray,a=e.argsArray,n=e.iCurr,r=n-4,g=n-3,o=n-2,I=n-1,c=n,l=a[g][0],h=a[g][1],C=Math.min(Math.floor((A-r)/5),1e3);if(C<3)return A-(A-r)%5;let B=r;r>=4&&s[r-4]===s[g]&&s[r-3]===s[o]&&s[r-2]===s[I]&&s[r-1]===s[c]&&a[r-4][0]===l&&a[r-4][1]===h&&(C++,B-=5);let Q=B+4;for(let E=1;E<C;E++)s.splice(Q,3),a.splice(Q,3),Q+=2;return Q+1});var Wr=class{constructor(A){this.queue=A}_optimize(){}push(A,t){this.queue.fnArray.push(A),this.queue.argsArray.push(t),this._optimize()}flush(){}reset(){}},ec=class extends Wr{constructor(A){super(A),this.state=null,this.context={iCurr:0,fnArray:A.fnArray,argsArray:A.argsArray,isOffscreenCanvasSupported:!1},this.match=null,this.lastProcessed=0}set isOffscreenCanvasSupported(A){this.context.isOffscreenCanvasSupported=A}_optimize(){let A=this.queue.fnArray,t=this.lastProcessed,i=A.length,s=this.state,a=this.match;if(!s&&!a&&t+1===i&&!Ms[A[t]]){this.lastProcessed=i;return}let n=this.context;for(;t<i;){if(a){if((0,a.iterateFn)(n,t)){t++;continue}if(t=(0,a.processFn)(n,t+1),i=A.length,a=null,s=null,t>=i)break}if(s=(s||Ms)[A[t]],!s||Array.isArray(s)){t++;continue}if(n.iCurr=t,t++,s.checkFn&&!(0,s.checkFn)(n)){s=null;continue}a=s,s=null}this.state=s,this.match=a,this.lastProcessed=t}flush(){for(;this.match;){let A=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,A),this.match=null,this.state=null,this._optimize()}}reset(){this.state=null,this.match=null,this.lastProcessed=0}},Is=class{constructor(A=0,t){this._streamSink=t,this.fnArray=[],this.argsArray=[],this.optimizer=t&&!(A&st.OPLIST)?new ec(this):new Wr(this),this.dependencies=new Set,this._totalLength=0,this.weight=0,this._resolved=t?null:Promise.resolve()}set isOffscreenCanvasSupported(A){this.optimizer.isOffscreenCanvasSupported=A}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(A,t){this.optimizer.push(A,t),this.weight++,this._streamSink&&(this.weight>=Is.CHUNK_SIZE?this.flush():this.weight>=Is.CHUNK_SIZE_ABOUT&&(A===y.restore||A===y.endText)&&this.flush())}addImageOps(A,t,i){i!==void 0&&this.addOp(y.beginMarkedContentProps,["OC",i]),this.addOp(A,t),i!==void 0&&this.addOp(y.endMarkedContent,[])}addDependency(A){this.dependencies.has(A)||(this.dependencies.add(A),this.addOp(y.dependency,[A]))}addDependencies(A){for(let t of A)this.addDependency(t)}addOpList(A){if(!(A instanceof Is)){k(\'addOpList - ignoring invalid "opList" parameter.\');return}for(let t of A.dependencies)this.dependencies.add(t);for(let t=0,i=A.length;t<i;t++)this.addOp(A.fnArray[t],A.argsArray[t])}getIR(){return{fnArray:this.fnArray,argsArray:this.argsArray,length:this.length}}get _transfers(){var a;let A=[],{fnArray:t,argsArray:i,length:s}=this;for(let n=0;n<s;n++)switch(t[n]){case y.paintInlineImageXObject:case y.paintInlineImageXObjectGroup:case y.paintImageMaskXObject:let r=i[n][0];!r.cached&&((a=r.data)==null?void 0:a.buffer)instanceof ArrayBuffer&&A.push(r.data.buffer);break}return A}flush(A=!1,t=null){this.optimizer.flush();let i=this.length;this._totalLength+=i,this._streamSink.enqueue({fnArray:this.fnArray,argsArray:this.argsArray,lastChunk:A,separateAnnots:t,length:i},1,this._transfers),this.dependencies.clear(),this.fnArray.length=0,this.argsArray.length=0,this.weight=0,this.optimizer.reset()}},ze=Is;et(ze,"CHUNK_SIZE",1e3),et(ze,"CHUNK_SIZE_ABOUT",Is.CHUNK_SIZE-5);function S9(e,A,t,i){return e=A+e*t,e<0?e=0:e>i&&(e=i),e}function uE(e,A,t,i,s,a){let n=s*a,r;A<=8?r=new Uint8Array(n):A<=16?r=new Uint16Array(n):r=new Uint32Array(n);let g=t/s,o=i/a,I,c,l,h=0,C,B=new Uint16Array(s),Q=t;for(I=0;I<s;I++)B[I]=Math.floor(I*g);for(I=0;I<a;I++)for(l=Math.floor(I*o)*Q,c=0;c<s;c++)C=l+B[c],r[h++]=e[C];return r}var Pt=class{constructor({xref:A,res:t,image:i,isInline:s=!1,smask:a=null,mask:n=null,isMask:r=!1,pdfFunctionFactory:g,localColorSpaceCache:o}){var Q,E;this.image=i;let I=i.dict,c=I.get("F","Filter"),l;if(c instanceof M)l=c.name;else if(Array.isArray(c)){let f=A.fetchIfRef(c[0]);f instanceof M&&(l=f.name)}switch(l){case"JPXDecode":({width:i.width,height:i.height,componentsCount:i.numComps,bitsPerComponent:i.bitsPerComponent}=hs.parseImageProperties(i.stream)),i.stream.reset(),this.jpxDecoderOptions={numComponents:0,isIndexedColormap:!1,smaskInData:I.has("SMaskInData")};break;case"JBIG2Decode":i.bitsPerComponent=1,i.numComps=1;break}let h=I.get("W","Width"),C=I.get("H","Height");if(Number.isInteger(i.width)&&i.width>0&&Number.isInteger(i.height)&&i.height>0&&(i.width!==h||i.height!==C)&&(k("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),h=i.width,C=i.height),h<1||C<1)throw new v(`Invalid image width: ${h} or height: ${C}`);this.width=h,this.height=C,this.interpolate=I.get("I","Interpolate"),this.imageMask=I.get("IM","ImageMask")||!1,this.matte=I.get("Matte")||!1;let B=i.bitsPerComponent;if(!B&&(B=I.get("BPC","BitsPerComponent"),!B))if(this.imageMask)B=1;else throw new v(`Bits per component missing in image: ${this.imageMask}`);if(this.bpc=B,!this.imageMask){let f=I.getRaw("CS")||I.getRaw("ColorSpace"),u=!!f;if(u)(Q=this.jpxDecoderOptions)!=null&&Q.smaskInData&&(f=M.get("DeviceRGBA"));else if(this.jpxDecoderOptions)f=M.get("DeviceRGBA");else switch(i.numComps){case 1:f=M.get("DeviceGray");break;case 3:f=M.get("DeviceRGB");break;case 4:f=M.get("DeviceCMYK");break;default:throw new Error(`Images with ${i.numComps} color components not supported.`)}this.colorSpace=JA.parse({cs:f,xref:A,resources:s?t:null,pdfFunctionFactory:g,localColorSpaceCache:o}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=u?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap=this.colorSpace.name==="Indexed")}if(this.decode=I.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,B)||r&&!JA.isDefaultDecode(this.decode,1))){this.needsDecode=!0;let f=(1<<B)-1;this.decodeCoefficients=[],this.decodeAddends=[];let u=((E=this.colorSpace)==null?void 0:E.name)==="Indexed";for(let d=0,x=0;d<this.decode.length;d+=2,++x){let p=this.decode[d],m=this.decode[d+1];this.decodeCoefficients[x]=u?(m-p)/f:m-p,this.decodeAddends[x]=u?p:f*p}}a?this.smask=new Pt({xref:A,res:t,image:a,isInline:s,pdfFunctionFactory:g,localColorSpaceCache:o}):n&&(n instanceof KA?n.dict.get("IM","ImageMask")?this.mask=new Pt({xref:A,res:t,image:n,isInline:s,isMask:!0,pdfFunctionFactory:g,localColorSpaceCache:o}):k("Ignoring /Mask in image without /ImageMask."):this.mask=n)}static async buildImage({xref:A,res:t,image:i,isInline:s=!1,pdfFunctionFactory:a,localColorSpaceCache:n}){let r=i,g=null,o=null,I=i.dict.get("SMask"),c=i.dict.get("Mask");return I?I instanceof KA?g=I:k("Unsupported /SMask format."):c&&(c instanceof KA||Array.isArray(c)?o=c:k("Unsupported /Mask format.")),new Pt({xref:A,res:t,image:r,isInline:s,smask:g,mask:o,pdfFunctionFactory:a,localColorSpaceCache:n})}static createRawMask({imgArray:A,width:t,height:i,imageIsFromDecodeStream:s,inverseDecode:a,interpolate:n}){let r=(t+7>>3)*i,g=A.byteLength,o=r===g,I,c;if(s&&(!a||o)?I=A:a?(I=new Uint8Array(r),I.set(A),I.fill(255,g)):I=new Uint8Array(A),a)for(c=0;c<g;c++)I[c]^=255;return{data:I,width:t,height:i,interpolate:n}}static async createMask({imgArray:A,width:t,height:i,imageIsFromDecodeStream:s,inverseDecode:a,interpolate:n,isOffscreenCanvasSupported:r=!1}){let g=t===1&&i===1&&a===(A.length===0||!!(A[0]&128));if(g)return{isSingleOpaquePixel:g};if(r){if(at.needsToBeResized(t,i)){let h=new Uint8ClampedArray(t*i*4);return QI({src:A,dest:h,width:t,height:i,nonBlackColor:0,inverseDecode:a}),at.createImage({kind:Ke.RGBA_32BPP,data:h,width:t,height:i,interpolate:n})}let o=new OffscreenCanvas(t,i),I=o.getContext("2d"),c=I.createImageData(t,i);QI({src:A,dest:c.data,width:t,height:i,nonBlackColor:0,inverseDecode:a}),I.putImageData(c,0,0);let l=o.transferToImageBitmap();return{data:null,width:t,height:i,interpolate:n,bitmap:l}}return this.createRawMask({imgArray:A,width:t,height:i,inverseDecode:a,imageIsFromDecodeStream:s,interpolate:n})}get drawWidth(){var A,t;return Math.max(this.width,((A=this.smask)==null?void 0:A.width)||0,((t=this.mask)==null?void 0:t.width)||0)}get drawHeight(){var A,t;return Math.max(this.height,((A=this.smask)==null?void 0:A.height)||0,((t=this.mask)==null?void 0:t.height)||0)}decodeBuffer(A){let t=this.bpc,i=this.numComps,s=this.decodeAddends,a=this.decodeCoefficients,n=(1<<t)-1,r,g;if(t===1){for(r=0,g=A.length;r<g;r++)A[r]=+!A[r];return}let o=0;for(r=0,g=this.width*this.height;r<g;r++)for(let I=0;I<i;I++)A[o]=S9(A[o],s[I],a[I],n),o++}getComponents(A){let t=this.bpc;if(t===8)return A;let i=this.width,s=this.height,a=this.numComps,n=i*s*a,r=0,g;t<=8?g=new Uint8Array(n):t<=16?g=new Uint16Array(n):g=new Uint32Array(n);let o=i*a,I=(1<<t)-1,c=0,l,h;if(t===1){let C,B,Q;for(let E=0;E<s;E++){for(B=c+(o&-8),Q=c+o;c<B;)h=A[r++],g[c]=h>>7&1,g[c+1]=h>>6&1,g[c+2]=h>>5&1,g[c+3]=h>>4&1,g[c+4]=h>>3&1,g[c+5]=h>>2&1,g[c+6]=h>>1&1,g[c+7]=h&1,c+=8;if(c<Q)for(h=A[r++],C=128;c<Q;)g[c++]=+!!(h&C),C>>=1}}else{let C=0;for(h=0,c=0,l=n;c<l;++c){for(c%o===0&&(h=0,C=0);C<t;)h=h<<8|A[r++],C+=8;let B=C-t,Q=h>>B;Q<0?Q=0:Q>I&&(Q=I),g[c]=Q,h&=(1<<B)-1,C=B}}return g}async fillOpacity(A,t,i,s,a){let n=this.smask,r=this.mask,g,o,I,c,l,h;if(n)o=n.width,I=n.height,g=new Uint8ClampedArray(o*I),await n.fillGrayBuffer(g),(o!==t||I!==i)&&(g=uE(g,n.bpc,o,I,t,i));else if(r)if(r instanceof Pt){for(o=r.width,I=r.height,g=new Uint8ClampedArray(o*I),r.numComps=1,await r.fillGrayBuffer(g),c=0,l=o*I;c<l;++c)g[c]=255-g[c];(o!==t||I!==i)&&(g=uE(g,r.bpc,o,I,t,i))}else if(Array.isArray(r)){g=new Uint8ClampedArray(t*i);let C=this.numComps;for(c=0,l=t*i;c<l;++c){let B=0,Q=c*C;for(h=0;h<C;++h){let E=a[Q+h],f=h*2;if(E<r[f]||E>r[f+1]){B=255;break}}g[c]=B}}else throw new v("Unknown mask format.");if(g)for(c=0,h=3,l=t*s;c<l;++c,h+=4)A[h]=g[c];else for(c=0,h=3,l=t*s;c<l;++c,h+=4)A[h]=255}undoPreblend(A,t,i){var I;let s=(I=this.smask)==null?void 0:I.matte;if(!s)return;let a=this.colorSpace.getRgb(s,0),n=a[0],r=a[1],g=a[2],o=t*i*4;for(let c=0;c<o;c+=4){let l=A[c+3];if(l===0){A[c]=255,A[c+1]=255,A[c+2]=255;continue}let h=255/l;A[c]=(A[c]-n)*h+n,A[c+1]=(A[c+1]-r)*h+r,A[c+2]=(A[c+2]-g)*h+g}}async createImageData(A=!1,t=!1){let i=this.drawWidth,s=this.drawHeight,a={width:i,height:s,interpolate:this.interpolate,kind:0,data:null},n=this.numComps,r=this.width,g=this.height,o=this.bpc,I=r*n*o+7>>3,c=t&&at.needsToBeResized(i,s);if(this.colorSpace.name==="DeviceRGBA"){a.kind=Ke.RGBA_32BPP;let x=a.data=await this.getImageBytes(g*r*4,{});return t?c?at.createImage(a,!1):this.createBitmap(Ke.RGBA_32BPP,i,s,x):a}if(!A){let x;if(this.colorSpace.name==="DeviceGray"&&o===1?x=Ke.GRAYSCALE_1BPP:this.colorSpace.name==="DeviceRGB"&&o===8&&!this.needsDecode&&(x=Ke.RGB_24BPP),x&&!this.smask&&!this.mask&&i===r&&s===g){let p=await this.getImageBytes(g*I,{});if(t)return c?at.createImage({data:p,kind:x,width:i,height:s,interpolate:this.interpolate},this.needsDecode):this.createBitmap(x,r,g,p);if(a.kind=x,a.data=p,this.needsDecode){gt(x===Ke.GRAYSCALE_1BPP,"PDFImage.createImageData: The image must be grayscale.");let m=a.data;for(let D=0,S=m.length;D<S;D++)m[D]^=255}return a}if(this.image instanceof Ra&&!this.smask&&!this.mask&&!this.needsDecode){let p=g*I;if(t&&!c){let m=!1;switch(this.colorSpace.name){case"DeviceGray":p*=4,m=!0;break;case"DeviceRGB":p=p/3*4,m=!0;break;case"DeviceCMYK":m=!0;break}if(m){let D=await this.getImageBytes(p,{drawWidth:i,drawHeight:s,forceRGBA:!0});return this.createBitmap(Ke.RGBA_32BPP,i,s,D)}}else switch(this.colorSpace.name){case"DeviceGray":p*=3;case"DeviceRGB":case"DeviceCMYK":return a.kind=Ke.RGB_24BPP,a.data=await this.getImageBytes(p,{drawWidth:i,drawHeight:s,forceRGB:!0}),c?at.createImage(a):a}}}let l=await this.getImageBytes(g*I,{internal:!0}),h=0|l.length/I*s/g,C=this.getComponents(l),B,Q,E,f,u,d;if(t&&!c&&(E=new OffscreenCanvas(i,s),f=E.getContext("2d"),u=f.createImageData(i,s),d=u.data),a.kind=Ke.RGBA_32BPP,!A&&!this.smask&&!this.mask?(!t||c?(a.kind=Ke.RGB_24BPP,d=new Uint8ClampedArray(i*s*3),B=0):(new Uint32Array(d.buffer).fill(Ot.isLittleEndian?4278190080:255),B=1),Q=!1):((!t||c)&&(d=new Uint8ClampedArray(i*s*4)),B=1,Q=!0,await this.fillOpacity(d,i,s,h,C)),this.needsDecode&&this.decodeBuffer(C),this.colorSpace.fillRgb(d,r,g,i,s,h,o,C,B),Q&&this.undoPreblend(d,i,h),t&&!c){f.putImageData(u,0,0);let x=E.transferToImageBitmap();return{data:null,width:i,height:s,bitmap:x,interpolate:this.interpolate}}return a.data=d,c?at.createImage(a):a}async fillGrayBuffer(A){let t=this.numComps;if(t!==1)throw new v(`Reading gray scale from a color image: ${t}`);let i=this.width,s=this.height,a=this.bpc,n=i*t*a+7>>3,r=await this.getImageBytes(s*n,{internal:!0}),g=this.getComponents(r),o,I;if(a===1){if(I=i*s,this.needsDecode)for(o=0;o<I;++o)A[o]=g[o]-1&255;else for(o=0;o<I;++o)A[o]=-g[o]&255;return}this.needsDecode&&this.decodeBuffer(g),I=i*s;let c=255/((1<<a)-1);for(o=0;o<I;++o)A[o]=c*g[o]}createBitmap(A,t,i,s){let a=new OffscreenCanvas(t,i),n=a.getContext("2d"),r;A===Ke.RGBA_32BPP?r=new ImageData(s,t,i):(r=n.createImageData(t,i),xd({kind:A,src:s,dest:new Uint32Array(r.data.buffer),width:t,height:i,inverseDecode:this.needsDecode})),n.putImageData(r,0,0);let g=a.transferToImageBitmap();return{data:null,width:t,height:i,bitmap:g,interpolate:this.interpolate}}async getImageBytes(A,{drawWidth:t,drawHeight:i,forceRGBA:s=!1,forceRGB:a=!1,internal:n=!1}){this.image.reset(),this.image.drawWidth=t||this.width,this.image.drawHeight=i||this.height,this.image.forceRGBA=!!s,this.image.forceRGB=!!a;let r=await this.image.getImageData(A,this.jpxDecoderOptions);return n||this.image instanceof Me?r:(gt(r instanceof Uint8Array,\'PDFImage.getImageBytes: Unsupported "imageBytes" type.\'),new Uint8Array(r))}},Df=Object.freeze({maxImageSize:-1,disableFontFace:!1,ignoreErrors:!1,isEvalSupported:!0,isOffscreenCanvasSupported:!1,canvasMaxAreaInBytes:-1,fontExtraProperties:!1,useSystemFonts:!0,cMapUrl:null,standardFontDataUrl:null}),dE={TILING:1,SHADING:2},F9=10,xE=Promise.resolve();function kf(e,A=!1){if(Array.isArray(e)){for(let t of e){let i=kf(t,!0);if(i)return i}return k(`Unsupported blend mode Array: ${e}`),"source-over"}if(!(e instanceof M))return A?null:"source-over";switch(e.name){case"Normal":case"Compatible":return"source-over";case"Multiply":return"multiply";case"Screen":return"screen";case"Overlay":return"overlay";case"Darken":return"darken";case"Lighten":return"lighten";case"ColorDodge":return"color-dodge";case"ColorBurn":return"color-burn";case"HardLight":return"hard-light";case"SoftLight":return"soft-light";case"Difference":return"difference";case"Exclusion":return"exclusion";case"Hue":return"hue";case"Saturation":return"saturation";case"Color":return"color";case"Luminosity":return"luminosity"}return A?null:(k(`Unsupported blend mode: ${e.name}`),"source-over")}function So(e,A){var t;A.objId&&e.addDependency(A.objId),e.addImageOps(A.fn,A.args,A.optionalContent),A.fn===y.paintImageMaskXObject&&((t=A.args[0])==null?void 0:t.count)>0&&A.args[0].count++}var Hg=class{constructor(){this.reset()}check(){return++this.checked<Hg.CHECK_TIME_EVERY?!1:(this.checked=0,this.endTime<=Date.now())}reset(){this.endTime=Date.now()+Hg.TIME_SLOT_DURATION_MS,this.checked=0}},ts=Hg;et(ts,"TIME_SLOT_DURATION_MS",20),et(ts,"CHECK_TIME_EVERY",100);var Lt=class{constructor({xref:A,handler:t,pageIndex:i,idFactory:s,fontCache:a,builtInCMapCache:n,standardFontDataCache:r,globalImageCache:g,systemFontCache:o,options:I=null}){this.xref=A,this.handler=t,this.pageIndex=i,this.idFactory=s,this.fontCache=a,this.builtInCMapCache=n,this.standardFontDataCache=r,this.globalImageCache=g,this.systemFontCache=o,this.options=I||Df,this.type3FontRefs=null,this._regionalImageCache=new ZI,this._fetchBuiltInCMapBound=this.fetchBuiltInCMap.bind(this),at.setMaxArea(this.options.canvasMaxAreaInBytes)}get _pdfFunctionFactory(){let A=new Kr({xref:this.xref,isEvalSupported:this.options.isEvalSupported});return nA(this,"_pdfFunctionFactory",A)}get parsingType3Font(){return!!this.type3FontRefs}clone(A=null){let t=Object.create(this);return t.options=Object.assign(Object.create(null),this.options,A),t}hasBlendModes(A,t){if(!(A instanceof F)||A.objId&&t.has(A.objId))return!1;let i=new be(t);A.objId&&i.put(A.objId);let s=[A],a=this.xref;for(;s.length;){let n=s.shift(),r=n.get("ExtGState");if(r instanceof F)for(let o of r.getRawValues()){if(o instanceof oA){if(i.has(o))continue;try{o=a.fetch(o)}catch(c){i.put(o),PA(`hasBlendModes - ignoring ExtGState: "${c}".`);continue}}if(!(o instanceof F))continue;o.objId&&i.put(o.objId);let I=o.get("BM");if(I instanceof M){if(I.name!=="Normal")return!0;continue}if(I!==void 0&&Array.isArray(I)){for(let c of I)if(c instanceof M&&c.name!=="Normal")return!0}}let g=n.get("XObject");if(g instanceof F)for(let o of g.getRawValues()){if(o instanceof oA){if(i.has(o))continue;try{o=a.fetch(o)}catch(c){i.put(o),PA(`hasBlendModes - ignoring XObject: "${c}".`);continue}}if(!(o instanceof KA))continue;o.dict.objId&&i.put(o.dict.objId);let I=o.dict.get("Resources");I instanceof F&&(I.objId&&i.has(I.objId)||(s.push(I),I.objId&&i.put(I.objId)))}}for(let n of i)t.put(n);return!1}async fetchBuiltInCMap(A){let t=this.builtInCMapCache.get(A);if(t)return t;let i;if(this.options.cMapUrl!==null){let s=`${this.options.cMapUrl}${A}.bcmap`,a=await fetch(s);if(!a.ok)throw new Error(`fetchBuiltInCMap: failed to fetch file "${s}" with "${a.statusText}".`);i={cMapData:new Uint8Array(await a.arrayBuffer()),compressionType:Br.BINARY}}else i=await this.handler.sendWithPromise("FetchBuiltInCMap",{name:A});return i.compressionType!==Br.NONE&&this.builtInCMapCache.set(A,i),i}async fetchStandardFontData(A){let t=this.standardFontDataCache.get(A);if(t)return new Ie(t);if(this.options.useSystemFonts&&A!=="Symbol"&&A!=="ZapfDingbats")return null;let i=t2(),s=i[A],a;if(this.options.standardFontDataUrl!==null){let n=`${this.options.standardFontDataUrl}${s}`,r=await fetch(n);r.ok?a=new Uint8Array(await r.arrayBuffer()):k(`fetchStandardFontData: failed to fetch file "${n}" with "${r.statusText}".`)}else try{a=await this.handler.sendWithPromise("FetchStandardFontData",{filename:s})}catch(n){k(`fetchStandardFontData: failed to fetch file "${s}" with "${n}".`)}return a?(this.standardFontDataCache.set(A,a),new Ie(a)):null}async buildFormXObject(A,t,i,s,a,n,r){let g=t.dict,o=Ki(g.getArray("Matrix"),null),I=Ei(g.getArray("BBox"),null),c,l;g.has("OC")&&(c=await this.parseMarkedContentProps(g.get("OC"),A)),c!==void 0&&s.addOp(y.beginMarkedContentProps,["OC",c]);let h=g.get("Group");if(h){l={matrix:o,bbox:I,smask:i,isolated:!1,knockout:!1};let B=h.get("S"),Q=null;if(ye(B,"Transparency")&&(l.isolated=h.get("I")||!1,l.knockout=h.get("K")||!1,h.has("CS"))){let E=h.getRaw("CS"),f=JA.getCached(E,this.xref,r);f?Q=f:Q=await this.parseColorSpace({cs:E,resources:A,localColorSpaceCache:r})}i!=null&&i.backdrop&&(Q||(Q=JA.singletons.rgb),i.backdrop=Q.getRgb(i.backdrop,0)),s.addOp(y.beginGroup,[l])}let C=h?[o,null]:[o,I];s.addOp(y.paintFormXObjectBegin,C),await this.getOperatorList({stream:t,task:a,resources:g.get("Resources")||A,operatorList:s,initialState:n}),s.addOp(y.paintFormXObjectEnd,[]),h&&s.addOp(y.endGroup,[l]),c!==void 0&&s.addOp(y.endMarkedContent,[])}_sendImgData(A,t,i=!1){let s=t?[t.bitmap||t.data.buffer]:null;return this.parsingType3Font||i?this.handler.send("commonobj",[A,"Image",t],s):this.handler.send("obj",[A,this.pageIndex,"Image",t],s)}async buildPaintImageXObject({resources:A,image:t,isInline:i=!1,operatorList:s,cacheKey:a,localImageCache:n,localColorSpaceCache:r}){let g=t.dict,o=g.objId,I=g.get("W","Width"),c=g.get("H","Height");if(!(I&&typeof I=="number")||!(c&&typeof c=="number")){k("Image dimensions are missing, or not numbers.");return}let l=this.options.maxImageSize;if(l!==-1&&I*c>l){let d="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors){k(d);return}throw new Error(d)}let h;g.has("OC")&&(h=await this.parseMarkedContentProps(g.get("OC"),A));let C=g.get("IM","ImageMask")||!1,B,Q;if(C){let d=g.get("I","Interpolate"),x=I+7>>3,p=t.getBytes(x*c),m=g.getArray("D","Decode");if(this.parsingType3Font){if(B=Pt.createRawMask({imgArray:p,width:I,height:c,imageIsFromDecodeStream:t instanceof Me,inverseDecode:(m==null?void 0:m[0])>0,interpolate:d}),B.cached=!!a,Q=[B],s.addImageOps(y.paintImageMaskXObject,Q,h),a){let S={fn:y.paintImageMaskXObject,args:Q,optionalContent:h};n.set(a,o,S),o&&this._regionalImageCache.set(null,o,S)}return}if(B=await Pt.createMask({imgArray:p,width:I,height:c,imageIsFromDecodeStream:t instanceof Me,inverseDecode:(m==null?void 0:m[0])>0,interpolate:d,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported}),B.isSingleOpaquePixel){if(s.addImageOps(y.paintSolidColorImageMask,[],h),a){let S={fn:y.paintSolidColorImageMask,args:[],optionalContent:h};n.set(a,o,S),o&&this._regionalImageCache.set(null,o,S)}return}let D=`mask_${this.idFactory.createObjId()}`;if(s.addDependency(D),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,this._sendImgData(D,B),Q=[{data:D,width:B.width,height:B.height,interpolate:B.interpolate,count:1}],s.addImageOps(y.paintImageMaskXObject,Q,h),a){let S={objId:D,fn:y.paintImageMaskXObject,args:Q,optionalContent:h};n.set(a,o,S),o&&this._regionalImageCache.set(null,o,S)}return}let E=200;if(i&&I+c<E&&!g.has("SMask")&&!g.has("Mask")){try{B=await new Pt({xref:this.xref,res:A,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:r}).createImageData(!0,!1),s.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported,s.addImageOps(y.paintInlineImageXObject,[B],h)}catch(d){let x=`Unable to decode inline image: "${d}".`;if(!this.options.ignoreErrors)throw new Error(x);k(x)}return}let f=`img_${this.idFactory.createObjId()}`,u=!1;if(this.parsingType3Font?f=`${this.idFactory.getDocId()}_type3_${f}`:a&&o&&(u=this.globalImageCache.shouldCache(o,this.pageIndex),u&&(gt(!i,"Cannot cache an inline image globally."),f=`${this.idFactory.getDocId()}_${f}`)),s.addDependency(f),Q=[f,I,c],s.addImageOps(y.paintImageXObject,Q,h),u){if(this.globalImageCache.hasDecodeFailed(o)){this.globalImageCache.setData(o,{objId:f,fn:y.paintImageXObject,args:Q,optionalContent:h,byteSize:0}),this._sendImgData(f,null,u);return}if(I*c>25e4||g.has("SMask")||g.has("Mask")){let d=await this.handler.sendWithPromise("commonobj",[f,"CopyLocalImage",{imageRef:o}]);if(d){this.globalImageCache.setData(o,{objId:f,fn:y.paintImageXObject,args:Q,optionalContent:h,byteSize:0}),this.globalImageCache.addByteSize(o,d);return}}}if(Pt.buildImage({xref:this.xref,res:A,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:r}).then(async d=>(B=await d.createImageData(!1,this.options.isOffscreenCanvasSupported),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,B.ref=o,u&&this.globalImageCache.addByteSize(o,B.dataLen),this._sendImgData(f,B,u))).catch(d=>(k(`Unable to decode image "${f}": "${d}".`),o&&this.globalImageCache.addDecodeFailed(o),this._sendImgData(f,null,u))),a){let d={objId:f,fn:y.paintImageXObject,args:Q,optionalContent:h};n.set(a,o,d),o&&(this._regionalImageCache.set(null,o,d),u&&this.globalImageCache.setData(o,{objId:f,fn:y.paintImageXObject,args:Q,optionalContent:h,byteSize:0}))}}handleSMask(A,t,i,s,a,n){let r=A.get("G"),g={subtype:A.get("S").name,backdrop:A.get("BC")},o=A.get("TR");if(Do(o)){let I=this._pdfFunctionFactory.create(o),c=new Uint8Array(256),l=new Float32Array(1);for(let h=0;h<256;h++)l[0]=h/255,I(l,0,l,0),c[h]=l[0]*255|0;g.transferMap=c}return this.buildFormXObject(t,r,g,i,s,a.state.clone(),n)}handleTransferFunction(A){let t;if(Array.isArray(A))t=A;else if(Do(A))t=[A];else return null;let i=[],s=0,a=0;for(let n of t){let r=this.xref.fetchIfRef(n);if(s++,ye(r,"Identity")){i.push(null);continue}else if(!Do(r))return null;let g=this._pdfFunctionFactory.create(r),o=new Uint8Array(256),I=new Float32Array(1);for(let c=0;c<256;c++)I[0]=c/255,g(I,0,I,0),o[c]=I[0]*255|0;i.push(o),a++}return!(s===1||s===4)||a===0?null:i}handleTilingType(A,t,i,s,a,n,r,g){let o=new ze,I=F.merge({xref:this.xref,dictArray:[a.get("Resources"),i]});return this.getOperatorList({stream:s,task:r,resources:I,operatorList:o}).then(function(){let c=o.getIR(),l=lE(c,a,t);n.addDependencies(o.dependencies),n.addOp(A,l),a.objId&&g.set(null,a.objId,{operatorListIR:c,dict:a})}).catch(c=>{if(!(c instanceof ve)){if(this.options.ignoreErrors){k(`handleTilingType - ignoring pattern: "${c}".`);return}throw c}})}async handleSetFont(A,t,i,s,a,n,r=null,g=null){let o=(t==null?void 0:t[0])instanceof M?t[0].name:null,I=await this.loadFont(o,i,A,r,g);if(I.font.isType3Font)try{await I.loadType3Data(this,A,a),s.addDependencies(I.type3Dependencies)}catch(c){I=new is({loadedName:"g_font_error",font:new fa(`Type3 font load error: ${c}`),dict:I.font,evaluatorOptions:this.options})}return n.font=I.font,I.send(this.handler),I.loadedName}handleText(A,t){let i=t.font,s=i.charsToGlyphs(A);return i.data&&(t.textRenderingMode&PE.ADD_TO_PATH_FLAG||t.fillColorSpace.name==="Pattern"||i.disableFontFace||this.options.disableFontFace)&&Lt.buildFontPaths(i,s,this.handler,this.options),s}ensureStateFont(A){if(A.font)return;let t=new v("Missing setFont (Tf) operator before text rendering operator.");if(this.options.ignoreErrors){k(`ensureStateFont: "${t}".`);return}throw t}async setGState({resources:A,gState:t,operatorList:i,cacheKey:s,task:a,stateManager:n,localGStateCache:r,localColorSpaceCache:g}){let o=t.objId,I=!0,c=[],l=Promise.resolve();for(let h of t.getKeys()){let C=t.get(h);switch(h){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":c.push([h,C]);break;case"Font":I=!1,l=l.then(()=>this.handleSetFont(A,null,C[0],i,a,n.state).then(function(Q){i.addDependency(Q),c.push([h,[Q,C[1]]])}));break;case"BM":c.push([h,kf(C)]);break;case"SMask":if(ye(C,"None")){c.push([h,!1]);break}C instanceof F?(I=!1,l=l.then(()=>this.handleSMask(C,A,i,a,n,g)),c.push([h,!0])):k("Unsupported SMask type");break;case"TR":let B=this.handleTransferFunction(C);c.push([h,B]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":PA("graphic state operator "+h);break;default:PA("Unknown graphic state operator "+h);break}}await l,c.length>0&&i.addOp(y.setGState,[c]),I&&r.set(s,o,c)}loadFont(A,t,i,s=null,a=null){var B;let n=async()=>new is({loadedName:"g_font_error",font:new fa(`Font "${A}" is not available.`),dict:t,evaluatorOptions:this.options}),r;if(t)t instanceof oA&&(r=t);else{let Q=i.get("Font");Q&&(r=Q.getRaw(A))}if(r){if((B=this.type3FontRefs)!=null&&B.has(r))return n();if(this.fontCache.has(r))return this.fontCache.get(r);try{t=this.xref.fetchIfRef(r)}catch(Q){k(`loadFont - lookup failed: "${Q}".`)}}if(!(t instanceof F)){if(!this.options.ignoreErrors&&!this.parsingType3Font)return k(`Font "${A}" is not available.`),n();k(`Font "${A}" is not available -- attempting to fallback to a default font.`),t=s||Lt.fallbackFontDict}if(t.cacheKey&&this.fontCache.has(t.cacheKey))return this.fontCache.get(t.cacheKey);let{promise:g,resolve:o}=Promise.withResolvers(),I;try{I=this.preEvaluateFont(t),I.cssFontInfo=a}catch(Q){return k(`loadFont - preEvaluateFont failed: "${Q}".`),n()}let{descriptor:c,hash:l}=I,h=r instanceof oA,C;if(l&&c instanceof F){let Q=c.fontAliases||(c.fontAliases=Object.create(null));if(Q[l]){let E=Q[l].aliasRef;if(h&&E&&this.fontCache.has(E))return this.fontCache.putAlias(r,E),this.fontCache.get(r)}else Q[l]={fontID:this.idFactory.createFontId()};h&&(Q[l].aliasRef=r),C=Q[l].fontID}else C=this.idFactory.createFontId();return gt(C==null?void 0:C.startsWith("f"),\'The "fontID" must be (correctly) defined.\'),h?this.fontCache.put(r,g):(t.cacheKey=`cacheKey_${C}`,this.fontCache.put(t.cacheKey,g)),t.loadedName=`${this.idFactory.getDocId()}_${C}`,this.translateFont(I).then(Q=>{o(new is({loadedName:t.loadedName,font:Q,dict:t,evaluatorOptions:this.options}))}).catch(Q=>{k(`loadFont - translateFont failed: "${Q}".`),o(new is({loadedName:t.loadedName,font:new fa(Q instanceof Error?Q.message:Q),dict:t,evaluatorOptions:this.options}))}),g}buildPath(A,t,i,s=!1){let a=A.length-1;if(i||(i=[]),a<0||A.fnArray[a]!==y.constructPath){s&&(k(`Encountered path operator "${t}" inside of a text object.`),A.addOp(y.save,null));let n;switch(t){case y.rectangle:let r=i[0]+i[2],g=i[1]+i[3];n=[Math.min(i[0],r),Math.min(i[1],g),Math.max(i[0],r),Math.max(i[1],g)];break;case y.moveTo:case y.lineTo:n=[i[0],i[1],i[0],i[1]];break;default:n=[1/0,1/0,-1/0,-1/0];break}A.addOp(y.constructPath,[[t],i,n]),s&&A.addOp(y.restore,null)}else{let n=A.argsArray[a];n[0].push(t),n[1].push(...i);let r=n[2];switch(t){case y.rectangle:let g=i[0]+i[2],o=i[1]+i[3];r[0]=Math.min(r[0],i[0],g),r[1]=Math.min(r[1],i[1],o),r[2]=Math.max(r[2],i[0],g),r[3]=Math.max(r[3],i[1],o);break;case y.moveTo:case y.lineTo:r[0]=Math.min(r[0],i[0]),r[1]=Math.min(r[1],i[1]),r[2]=Math.max(r[2],i[0]),r[3]=Math.max(r[3],i[1]);break}}}parseColorSpace({cs:A,resources:t,localColorSpaceCache:i}){return JA.parseAsync({cs:A,xref:this.xref,resources:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:i}).catch(s=>{if(s instanceof ve)return null;if(this.options.ignoreErrors)return k(`parseColorSpace - ignoring ColorSpace: "${s}".`),null;throw s})}parseShading({shading:A,resources:t,localColorSpaceCache:i,localShadingPatternCache:s}){let a=s.get(A);if(a)return a;let n;try{n=YI.parseShading(A,this.xref,t,this._pdfFunctionFactory,i).getIR()}catch(r){if(r instanceof ve)return null;if(this.options.ignoreErrors)return k(`parseShading - ignoring shading: "${r}".`),s.set(A,null),null;throw r}return a=`pattern_${this.idFactory.createObjId()}`,this.parsingType3Font&&(a=`${this.idFactory.getDocId()}_type3_${a}`),s.set(A,a),this.parsingType3Font?this.handler.send("commonobj",[a,"Pattern",n]):this.handler.send("obj",[a,this.pageIndex,"Pattern",n]),a}handleColorN(A,t,i,s,a,n,r,g,o,I){let c=i.pop();if(c instanceof M){let l=a.getRaw(c.name),h=l instanceof oA&&o.getByRef(l);if(h)try{let B=s.base?s.base.getRgb(i,0):null,Q=lE(h.operatorListIR,h.dict,B);A.addOp(t,Q);return}catch(B){}let C=this.xref.fetchIfRef(l);if(C){let B=C instanceof KA?C.dict:C,Q=B.get("PatternType");if(Q===dE.TILING){let E=s.base?s.base.getRgb(i,0):null;return this.handleTilingType(t,E,n,C,B,A,r,o)}else if(Q===dE.SHADING){let E=B.get("Shading"),f=this.parseShading({shading:E,resources:n,localColorSpaceCache:g,localShadingPatternCache:I});if(f){let u=Ki(B.getArray("Matrix"),null);A.addOp(t,["Shading",f,u])}return}throw new v(`Unknown PatternType: ${Q}`)}}throw new v(`Unknown PatternName: ${c}`)}_parseVisibilityExpression(A,t,i){if(++t>10){k("Visibility expression is too deeply nested");return}let a=A.length,n=this.xref.fetchIfRef(A[0]);if(a<2||!(n instanceof M)){k("Invalid visibility expression");return}switch(n.name){case"And":case"Or":case"Not":i.push(n.name);break;default:k(`Invalid operator ${n.name} in visibility expression`);return}for(let r=1;r<a;r++){let g=A[r],o=this.xref.fetchIfRef(g);if(Array.isArray(o)){let I=[];i.push(I),this._parseVisibilityExpression(o,t,I)}else g instanceof oA&&i.push(g.toString())}}async parseMarkedContentProps(A,t){var a;let i;if(A instanceof M)i=t.get("Properties").get(A.name);else if(A instanceof F)i=A;else throw new v("Optional content properties malformed.");let s=(a=i.get("Type"))==null?void 0:a.name;if(s==="OCG")return{type:s,id:i.objId};if(s==="OCMD"){let n=i.get("VE");if(Array.isArray(n)){let g=[];if(this._parseVisibilityExpression(n,0,g),g.length>0)return{type:"OCMD",expression:g}}let r=i.get("OCGs");if(Array.isArray(r)||r instanceof F){let g=[];if(Array.isArray(r))for(let o of r)g.push(o.toString());else g.push(r.objId);return{type:s,ids:g,policy:i.get("P")instanceof M?i.get("P").name:null,expression:null}}else if(r instanceof oA)return{type:s,id:r.toString()}}return null}getOperatorList({stream:A,task:t,resources:i,operatorList:s,initialState:a=null,fallbackFontDict:n=null}){if(i||(i=F.empty),a||(a=new Or),!s)throw new Error(\'getOperatorList: missing "operatorList" parameter\');let r=this,g=this.xref,o=!1,I=new Hr,c=new Jr,l=new Yr,h=new OI,C=new Map,B=i.get("XObject")||F.empty,Q=i.get("Pattern")||F.empty,E=new Bs(a),f=new f0(A,g,E),u=new ts;function d(x){for(let p=0,m=f.savedStatesDepth;p<m;p++)s.addOp(y.restore,[])}return new Promise(function x(p,m){let D=function(V){Promise.all([V,s.ready]).then(function(){try{x(p,m)}catch(lA){m(lA)}},m)};t.ensureNotTerminated(),u.reset();let S={},w,Y,U,K,Z,AA;for(;!(w=u.check())&&(S.args=null,!!f.read(S));){let V=S.args,lA=S.fn;switch(lA|0){case y.paintXObject:if(AA=V[0]instanceof M,Z=V[0].name,AA){let fA=I.getByName(Z);if(fA){So(s,fA),V=null;continue}}D(new Promise(function(fA,CA){if(!AA)throw new v("XObject must be referred to by name.");let N=B.getRaw(Z);if(N instanceof oA){let q=I.getByRef(N)||r._regionalImageCache.getByRef(N);if(q){So(s,q),fA();return}let T=r.globalImageCache.getData(N,r.pageIndex);if(T){s.addDependency(T.objId),s.addImageOps(T.fn,T.args,T.optionalContent),fA();return}N=g.fetch(N)}if(!(N instanceof KA))throw new v("XObject should be a stream");let H=N.dict.get("Subtype");if(!(H instanceof M))throw new v("XObject should have a Name subtype");if(H.name==="Form"){E.save(),r.buildFormXObject(i,N,null,s,t,E.state.clone(),c).then(function(){E.restore(),fA()},CA);return}else if(H.name==="Image"){r.buildPaintImageXObject({resources:i,image:N,operatorList:s,cacheKey:Z,localImageCache:I,localColorSpaceCache:c}).then(fA,CA);return}else if(H.name==="PS")PA("Ignored XObject subtype PS");else throw new v(`Unhandled XObject subtype ${H.name}`);fA()}).catch(function(fA){if(!(fA instanceof ve)){if(r.options.ignoreErrors){k(`getOperatorList - ignoring XObject: "${fA}".`);return}throw fA}}));return;case y.setFont:var gA=V[1];D(r.handleSetFont(i,V,null,s,t,E.state,n).then(function(fA){s.addDependency(fA),s.addOp(y.setFont,[fA,gA])}));return;case y.beginText:o=!0;break;case y.endText:o=!1;break;case y.endInlineImage:var R=V[0].cacheKey;if(R){let fA=I.getByName(R);if(fA){So(s,fA),V=null;continue}}D(r.buildPaintImageXObject({resources:i,image:V[0],isInline:!0,operatorList:s,cacheKey:R,localImageCache:I,localColorSpaceCache:c}));return;case y.showText:if(!E.state.font){r.ensureStateFont(E.state);continue}V[0]=r.handleText(V[0],E.state);break;case y.showSpacedText:if(!E.state.font){r.ensureStateFont(E.state);continue}var _=[],tA=E.state;for(let fA of V[0])typeof fA=="string"?_.push(...r.handleText(fA,tA)):typeof fA=="number"&&_.push(fA);V[0]=_,lA=y.showText;break;case y.nextLineShowText:if(!E.state.font){r.ensureStateFont(E.state);continue}s.addOp(y.nextLine),V[0]=r.handleText(V[0],E.state),lA=y.showText;break;case y.nextLineSetSpacingShowText:if(!E.state.font){r.ensureStateFont(E.state);continue}s.addOp(y.nextLine),s.addOp(y.setWordSpacing,[V.shift()]),s.addOp(y.setCharSpacing,[V.shift()]),V[0]=r.handleText(V[0],E.state),lA=y.showText;break;case y.setTextRenderingMode:E.state.textRenderingMode=V[0];break;case y.setFillColorSpace:{let fA=JA.getCached(V[0],g,c);if(fA){E.state.fillColorSpace=fA;continue}D(r.parseColorSpace({cs:V[0],resources:i,localColorSpaceCache:c}).then(function(CA){E.state.fillColorSpace=CA||JA.singletons.gray}));return}case y.setStrokeColorSpace:{let fA=JA.getCached(V[0],g,c);if(fA){E.state.strokeColorSpace=fA;continue}D(r.parseColorSpace({cs:V[0],resources:i,localColorSpaceCache:c}).then(function(CA){E.state.strokeColorSpace=CA||JA.singletons.gray}));return}case y.setFillColor:K=E.state.fillColorSpace,V=K.getRgb(V,0),lA=y.setFillRGBColor;break;case y.setStrokeColor:K=E.state.strokeColorSpace,V=K.getRgb(V,0),lA=y.setStrokeRGBColor;break;case y.setFillGray:E.state.fillColorSpace=JA.singletons.gray,V=JA.singletons.gray.getRgb(V,0),lA=y.setFillRGBColor;break;case y.setStrokeGray:E.state.strokeColorSpace=JA.singletons.gray,V=JA.singletons.gray.getRgb(V,0),lA=y.setStrokeRGBColor;break;case y.setFillCMYKColor:E.state.fillColorSpace=JA.singletons.cmyk,V=JA.singletons.cmyk.getRgb(V,0),lA=y.setFillRGBColor;break;case y.setStrokeCMYKColor:E.state.strokeColorSpace=JA.singletons.cmyk,V=JA.singletons.cmyk.getRgb(V,0),lA=y.setStrokeRGBColor;break;case y.setFillRGBColor:E.state.fillColorSpace=JA.singletons.rgb,V=JA.singletons.rgb.getRgb(V,0);break;case y.setStrokeRGBColor:E.state.strokeColorSpace=JA.singletons.rgb,V=JA.singletons.rgb.getRgb(V,0);break;case y.setFillColorN:if(K=E.state.patternFillColorSpace,!K){V=[],lA=y.setFillTransparent;break}if(K.name==="Pattern"){D(r.handleColorN(s,y.setFillColorN,V,K,Q,i,t,c,h,C));return}V=K.getRgb(V,0),lA=y.setFillRGBColor;break;case y.setStrokeColorN:if(K=E.state.patternStrokeColorSpace,!K){V=[],lA=y.setStrokeTransparent;break}if(K.name==="Pattern"){D(r.handleColorN(s,y.setStrokeColorN,V,K,Q,i,t,c,h,C));return}V=K.getRgb(V,0),lA=y.setStrokeRGBColor;break;case y.shadingFill:var IA=i.get("Shading");if(!IA)throw new v("No shading resource found");var QA=IA.get(V[0].name);if(!QA)throw new v("No shading object found");let EA=r.parseShading({shading:QA,resources:i,localColorSpaceCache:c,localShadingPatternCache:C});if(!EA)continue;V=[EA],lA=y.shadingFill;break;case y.setGState:if(AA=V[0]instanceof M,Z=V[0].name,AA){let fA=l.getByName(Z);if(fA){fA.length>0&&s.addOp(y.setGState,[fA]),V=null;continue}}D(new Promise(function(fA,CA){if(!AA)throw new v("GState must be referred to by name.");let N=i.get("ExtGState");if(!(N instanceof F))throw new v("ExtGState should be a dictionary.");let H=N.get(Z);if(!(H instanceof F))throw new v("GState should be a dictionary.");r.setGState({resources:i,gState:H,operatorList:s,cacheKey:Z,task:t,stateManager:E,localGStateCache:l,localColorSpaceCache:c}).then(fA,CA)}).catch(function(fA){if(!(fA instanceof ve)){if(r.options.ignoreErrors){k(`getOperatorList - ignoring ExtGState: "${fA}".`);return}throw fA}}));return;case y.moveTo:case y.lineTo:case y.curveTo:case y.curveTo2:case y.curveTo3:case y.closePath:case y.rectangle:r.buildPath(s,lA,V,o);continue;case y.markPoint:case y.markPointProps:case y.beginCompat:case y.endCompat:continue;case y.beginMarkedContentProps:if(!(V[0]instanceof M)){k(`Expected name for beginMarkedContentProps arg0=${V[0]}`),s.addOp(y.beginMarkedContentProps,["OC",null]);continue}if(V[0].name==="OC"){D(r.parseMarkedContentProps(V[1],i).then(fA=>{s.addOp(y.beginMarkedContentProps,["OC",fA])}).catch(fA=>{if(!(fA instanceof ve)){if(r.options.ignoreErrors){k(`getOperatorList - ignoring beginMarkedContentProps: "${fA}".`),s.addOp(y.beginMarkedContentProps,["OC",null]);return}throw fA}}));return}V=[V[0].name,V[1]instanceof F?V[1].get("MCID"):null];break;case y.beginMarkedContent:case y.endMarkedContent:default:if(V!==null){for(Y=0,U=V.length;Y<U&&!(V[Y]instanceof F);Y++);if(Y<U){k("getOperatorList - ignoring operator: "+lA);continue}}}s.addOp(lA,V)}if(w){D(xE);return}d(),p()}).catch(x=>{if(!(x instanceof ve)){if(this.options.ignoreErrors){k(`getOperatorList - ignoring errors during "${t.name}" task: "${x}".`),d();return}throw x}})}getTextContent({stream:A,task:t,resources:i,stateManager:s=null,includeMarkedContent:a=!1,sink:n,seenStyles:r=new Set,viewBox:g,lang:o=null,markedContentData:I=null,disableNormalization:c=!1,keepWhiteSpace:l=!1}){i||(i=F.empty),s||(s=new Bs(new tc)),a&&(I||(I={level:0}));let h={items:[],styles:Object.create(null),lang:o},C={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},B=[" "," "],Q=0;function E(X){let W=(Q+1)%2,G=B[Q]!==" "&&B[W]===" ";return B[Q]=X,Q=W,!l&&G}function f(){return!l&&B[Q]!==" "&&B[(Q+1)%2]===" "}function u(){B[0]=B[1]=" ",Q=0}let d=.102,x=.03,p=-.2,m=.102,D=.6,S=.25,w=this,Y=this.xref,U=[],K=null,Z=new Hr,AA=new Yr,gA=new f0(A,Y,s),R;function _({width:X=0,height:W=0,transform:G=C.prevTransform,fontName:BA=C.fontName}){h.items.push({str:" ",dir:"ltr",width:X,height:W,transform:G,fontName:BA,hasEOL:!1})}function tA(){let X=R.font,W=[R.fontSize*R.textHScale,0,0,R.fontSize,0,R.textRise];if(X.isType3Font&&(R.fontSize<=1||X.isCharBBox)&&!Ss(R.fontMatrix,E0)){let G=X.bbox[3]-X.bbox[1];G>0&&(W[3]*=G*R.fontMatrix[3])}return Ce.transform(R.ctm,Ce.transform(R.textMatrix,W))}function IA(){if(C.initialized)return C;let{font:X,loadedName:W}=R;if(!r.has(W)&&(r.add(W),h.styles[W]={fontFamily:X.fallbackName,ascent:X.ascent,descent:X.descent,vertical:X.vertical},w.options.fontExtraProperties&&X.systemFontInfo)){let iA=h.styles[W];iA.fontSubstitution=X.systemFontInfo.css,iA.fontSubstitutionLoadedName=X.systemFontInfo.loadedName}C.fontName=W;let G=C.transform=tA();X.vertical?(C.width=C.totalWidth=Math.hypot(G[0],G[1]),C.height=C.totalHeight=0,C.vertical=!0):(C.width=C.totalWidth=0,C.height=C.totalHeight=Math.hypot(G[2],G[3]),C.vertical=!1);let BA=Math.hypot(R.textLineMatrix[0],R.textLineMatrix[1]),uA=Math.hypot(R.ctm[0],R.ctm[1]);C.textAdvanceScale=uA*BA;let{fontSize:bA}=R;return C.trackingSpaceMin=bA*d,C.notASpace=bA*x,C.negativeSpaceMax=bA*p,C.spaceInFlowMin=bA*m,C.spaceInFlowMax=bA*D,C.hasEOL=!1,C.initialized=!0,C}function QA(){if(!C.initialized)return;let X=Math.hypot(R.textLineMatrix[0],R.textLineMatrix[1]),G=Math.hypot(R.ctm[0],R.ctm[1])*X;G!==C.textAdvanceScale&&(C.vertical?(C.totalHeight+=C.height*C.textAdvanceScale,C.height=0):(C.totalWidth+=C.width*C.textAdvanceScale,C.width=0),C.textAdvanceScale=G)}function V(X){let W=X.str.join("");c||(W=Ju(W));let G=yf(W,-1,X.vertical);return{str:G.str,dir:G.dir,width:Math.abs(X.totalWidth),height:Math.abs(X.totalHeight),transform:X.transform,fontName:X.fontName,hasEOL:X.hasEOL}}async function lA(X,W){let G=await w.loadFont(X,W,i);if(G.font.isType3Font)try{await G.loadType3Data(w,i,t)}catch(BA){}R.loadedName=G.loadedName,R.font=G.font,R.fontMatrix=G.font.fontMatrix||E0}function EA(X,W,G){let BA=Math.hypot(G[0],G[1]);return[(G[0]*X+G[1]*W)/BA,(G[2]*X+G[3]*W)/BA]}function fA(X){var yA;let W=tA(),G=W[4],BA=W[5];if((yA=R.font)!=null&&yA.vertical){if(G<g[0]||G>g[2]||BA+X<g[1]||BA>g[3])return!1}else if(G+X<g[0]||G>g[2]||BA<g[1]||BA>g[3])return!1;if(!R.font||!C.prevTransform)return!0;let uA=C.prevTransform[4],bA=C.prevTransform[5];if(uA===G&&bA===BA)return!0;let iA=-1;switch(W[0]&&W[1]===0&&W[2]===0?iA=W[0]>0?0:180:W[1]&&W[0]===0&&W[3]===0&&(iA=W[1]>0?90:270),iA){case 0:break;case 90:[G,BA]=[BA,G],[uA,bA]=[bA,uA];break;case 180:[G,BA,uA,bA]=[-G,-BA,-uA,-bA];break;case 270:[G,BA]=[-BA,-G],[uA,bA]=[-bA,-uA];break;default:[G,BA]=EA(G,BA,W),[uA,bA]=EA(uA,bA,C.prevTransform)}if(R.font.vertical){let aA=(bA-BA)/C.textAdvanceScale,DA=G-uA,UA=Math.sign(C.height);return aA<UA*C.negativeSpaceMax?Math.abs(DA)>.5*C.width?(N(),!0):(u(),q(),!0):Math.abs(DA)>C.width?(N(),!0):(aA<=UA*C.notASpace&&u(),aA<=UA*C.trackingSpaceMin?f()?(u(),q(),_({height:Math.abs(aA)})):C.height+=aA:H(aA,C.prevTransform,UA)||(C.str.length===0?(u(),_({height:Math.abs(aA)})):C.height+=aA),Math.abs(DA)>C.width*S&&q(),!0)}let wA=(G-uA)/C.textAdvanceScale,FA=BA-bA,cA=Math.sign(C.width);return wA<cA*C.negativeSpaceMax?Math.abs(FA)>.5*C.height?(N(),!0):(u(),q(),!0):Math.abs(FA)>C.height?(N(),!0):(wA<=cA*C.notASpace&&u(),wA<=cA*C.trackingSpaceMin?f()?(u(),q(),_({width:Math.abs(wA)})):C.width+=wA:H(wA,C.prevTransform,cA)||(C.str.length===0?(u(),_({width:Math.abs(wA)})):C.width+=wA),Math.abs(FA)>C.height*S&&q(),!0)}function CA({chars:X,extraSpacing:W}){let G=R.font;if(!X){let bA=R.charSpacing+W;bA&&(G.vertical?R.translateTextMatrix(0,-bA):R.translateTextMatrix(bA*R.textHScale,0)),l&&fA(0);return}let BA=G.charsToGlyphs(X),uA=R.fontMatrix[0]*R.fontSize;for(let bA=0,iA=BA.length;bA<iA;bA++){let wA=BA[bA],{category:FA}=wA;if(FA.isInvisibleFormatMark)continue;let cA=R.charSpacing+(bA+1===iA?W:0),yA=wA.width;G.vertical&&(yA=wA.vmetric?wA.vmetric[0]:-yA);let aA=yA*uA;if(!l&&FA.isWhitespace){G.vertical?(cA+=-aA+R.wordSpacing,R.translateTextMatrix(0,-cA)):(cA+=aA+R.wordSpacing,R.translateTextMatrix(cA*R.textHScale,0)),E(" ");continue}if(!FA.isZeroWidthDiacritic&&!fA(aA)){G.vertical?R.translateTextMatrix(0,aA):R.translateTextMatrix(aA*R.textHScale,0);continue}let DA=IA();FA.isZeroWidthDiacritic&&(aA=0),G.vertical?(R.translateTextMatrix(0,aA),aA=Math.abs(aA),DA.height+=aA):(aA*=R.textHScale,R.translateTextMatrix(aA,0),DA.width+=aA),aA&&(DA.prevTransform=tA());let UA=wA.unicode;E(UA)&&DA.str.push(" "),DA.str.push(UA),cA&&(G.vertical?R.translateTextMatrix(0,-cA):R.translateTextMatrix(cA*R.textHScale,0))}}function N(){u(),C.initialized?(C.hasEOL=!0,q()):h.items.push({str:"",dir:"ltr",width:0,height:0,transform:tA(),fontName:R.loadedName,hasEOL:!0})}function H(X,W,G){if(G*C.spaceInFlowMin<=X&&X<=G*C.spaceInFlowMax)return C.initialized&&(u(),C.str.push(" ")),!1;let BA=C.fontName,uA=0;return C.vertical&&(uA=X,X=0),q(),u(),_({width:Math.abs(X),height:Math.abs(uA),transform:W||tA(),fontName:BA}),!0}function q(){!C.initialized||!C.str||(C.vertical?C.totalHeight+=C.height*C.textAdvanceScale:C.totalWidth+=C.width*C.textAdvanceScale,h.items.push(V(C)),C.initialized=!1,C.str.length=0)}function T(X=!1){let W=h.items.length;W!==0&&(X&&W<F9||(n.enqueue(h,W),h.items=[],h.styles=Object.create(null)))}let $=new ts;return new Promise(function X(W,G){let BA=function(aA){T(!0),Promise.all([aA,n.ready]).then(function(){try{X(W,G)}catch(DA){G(DA)}},G)};t.ensureNotTerminated(),$.reset();let uA={},bA,iA=[];for(;!(bA=$.check())&&(iA.length=0,uA.args=iA,!!gA.read(uA));){let aA=R;R=s.state;let DA=uA.fn;switch(iA=uA.args,DA|0){case y.setFont:var wA=iA[0].name,FA=iA[1];if(R.font&&wA===R.fontName&&FA===R.fontSize)break;q(),R.fontName=wA,R.fontSize=FA,BA(lA(wA,null));return;case y.setTextRise:R.textRise=iA[0];break;case y.setHScale:R.textHScale=iA[0]/100;break;case y.setLeading:R.leading=iA[0];break;case y.moveText:R.translateTextLineMatrix(iA[0],iA[1]),R.textMatrix=R.textLineMatrix.slice();break;case y.setLeadingMoveText:R.leading=-iA[1],R.translateTextLineMatrix(iA[0],iA[1]),R.textMatrix=R.textLineMatrix.slice();break;case y.nextLine:R.carriageReturn();break;case y.setTextMatrix:R.setTextMatrix(iA[0],iA[1],iA[2],iA[3],iA[4],iA[5]),R.setTextLineMatrix(iA[0],iA[1],iA[2],iA[3],iA[4],iA[5]),QA();break;case y.setCharSpacing:R.charSpacing=iA[0];break;case y.setWordSpacing:R.wordSpacing=iA[0];break;case y.beginText:R.textMatrix=Wt.slice(),R.textLineMatrix=Wt.slice();break;case y.showSpacedText:if(!s.state.font){w.ensureStateFont(s.state);continue}let UA=(R.font.vertical?1:-1)*R.fontSize/1e3,Ee=iA[0];for(let pA=0,TA=Ee.length;pA<TA;pA++){let LA=Ee[pA];if(typeof LA=="string")U.push(LA);else if(typeof LA=="number"&&LA!==0){let WA=U.join("");U.length=0,CA({chars:WA,extraSpacing:LA*UA})}}if(U.length>0){let pA=U.join("");U.length=0,CA({chars:pA,extraSpacing:0})}break;case y.showText:if(!s.state.font){w.ensureStateFont(s.state);continue}CA({chars:iA[0],extraSpacing:0});break;case y.nextLineShowText:if(!s.state.font){w.ensureStateFont(s.state);continue}R.carriageReturn(),CA({chars:iA[0],extraSpacing:0});break;case y.nextLineSetSpacingShowText:if(!s.state.font){w.ensureStateFont(s.state);continue}R.wordSpacing=iA[0],R.charSpacing=iA[1],R.carriageReturn(),CA({chars:iA[2],extraSpacing:0});break;case y.paintXObject:q(),K||(K=i.get("XObject")||F.empty);var cA=iA[0]instanceof M,yA=iA[0].name;if(cA&&Z.getByName(yA))break;BA(new Promise(function(pA,TA){if(!cA)throw new v("XObject must be referred to by name.");let LA=K.getRaw(yA);if(LA instanceof oA){if(Z.getByRef(LA)){pA();return}if(w.globalImageCache.getData(LA,w.pageIndex)){pA();return}LA=Y.fetch(LA)}if(!(LA instanceof KA))throw new v("XObject should be a stream");let WA=LA.dict.get("Subtype");if(!(WA instanceof M))throw new v("XObject should have a Name subtype");if(WA.name!=="Form"){Z.set(yA,LA.dict.objId,!0),pA();return}let re=s.state.clone(),De=new Bs(re),Dn=Ki(LA.dict.getArray("Matrix"),null);Dn&&De.transform(Dn),T();let kn={enqueueInvoked:!1,enqueue(Sn,co){this.enqueueInvoked=!0,n.enqueue(Sn,co)},get desiredSize(){return n.desiredSize},get ready(){return n.ready}};w.getTextContent({stream:LA,task:t,resources:LA.dict.get("Resources")||i,stateManager:De,includeMarkedContent:a,sink:kn,seenStyles:r,viewBox:g,lang:o,markedContentData:I,disableNormalization:c,keepWhiteSpace:l}).then(function(){kn.enqueueInvoked||Z.set(yA,LA.dict.objId,!0),pA()},TA)}).catch(function(pA){if(!(pA instanceof ve)){if(w.options.ignoreErrors){k(`getTextContent - ignoring XObject: "${pA}".`);return}throw pA}}));return;case y.setGState:if(cA=iA[0]instanceof M,yA=iA[0].name,cA&&AA.getByName(yA))break;BA(new Promise(function(pA,TA){if(!cA)throw new v("GState must be referred to by name.");let LA=i.get("ExtGState");if(!(LA instanceof F))throw new v("ExtGState should be a dictionary.");let WA=LA.get(yA);if(!(WA instanceof F))throw new v("GState should be a dictionary.");let re=WA.get("Font");if(!re){AA.set(yA,WA.objId,!0),pA();return}q(),R.fontName=null,R.fontSize=re[1],lA(null,re[0]).then(pA,TA)}).catch(function(pA){if(!(pA instanceof ve)){if(w.options.ignoreErrors){k(`getTextContent - ignoring ExtGState: "${pA}".`);return}throw pA}}));return;case y.beginMarkedContent:q(),a&&(I.level++,h.items.push({type:"beginMarkedContent",tag:iA[0]instanceof M?iA[0].name:null}));break;case y.beginMarkedContentProps:if(q(),a){I.level++;let pA=null;iA[1]instanceof F&&(pA=iA[1].get("MCID")),h.items.push({type:"beginMarkedContentProps",id:Number.isInteger(pA)?`${w.idFactory.getPageObjId()}_mc${pA}`:null,tag:iA[0]instanceof M?iA[0].name:null})}break;case y.endMarkedContent:if(q(),a){if(I.level===0)break;I.level--,h.items.push({type:"endMarkedContent"})}break;case y.restore:aA&&(aA.font!==R.font||aA.fontSize!==R.fontSize||aA.fontName!==R.fontName)&&q();break}if(h.items.length>=n.desiredSize){bA=!0;break}}if(bA){BA(xE);return}q(),T(),W()}).catch(X=>{if(!(X instanceof ve)){if(this.options.ignoreErrors){k(`getTextContent - ignoring errors during "${t.name}" task: "${X}".`),q(),T();return}throw X}})}async extractDataStructures(A,t){let i=this.xref,s,a=this.readToUnicode(t.toUnicode);if(t.composite){let l=A.get("CIDSystemInfo");l instanceof F&&(t.cidSystemInfo={registry:jA(l.get("Registry")),ordering:jA(l.get("Ordering")),supplement:l.get("Supplement")});try{let h=A.get("CIDToGIDMap");h instanceof KA&&(s=h.getBytes())}catch(h){if(!this.options.ignoreErrors)throw h;k(`extractDataStructures - ignoring CIDToGIDMap data: "${h}".`)}}let n=[],r=null,g;if(A.has("Encoding")){if(g=A.get("Encoding"),g instanceof F){if(r=g.get("BaseEncoding"),r=r instanceof M?r.name:null,g.has("Differences")){let l=g.get("Differences"),h=0;for(let C of l){let B=i.fetchIfRef(C);if(typeof B=="number")h=B;else if(B instanceof M)n[h++]=B.name;else throw new v(`Invalid entry in \'Differences\' array: ${B}`)}}}else if(g instanceof M)r=g.name;else{let l="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new v(l);k(l)}r!=="MacRomanEncoding"&&r!=="MacExpertEncoding"&&r!=="WinAnsiEncoding"&&(r=null)}let o=!t.file||t.isInternalFont,I=DI()[t.name];if(r&&o&&I&&(r=null),r)t.defaultEncoding=Ua(r);else{let l=!!(t.flags&Ft.Symbolic),h=!!(t.flags&Ft.Nonsymbolic);g=fi,t.type==="TrueType"&&!h&&(g=Ga),(l||I)&&(g=c1,o&&(/Symbol/i.test(t.name)?g=l1:/Dingbats/i.test(t.name)?g=h1:/Wingdings/i.test(t.name)&&(g=Ga))),t.defaultEncoding=g}t.differences=n,t.baseEncodingName=r,t.hasEncoding=!!r||n.length>0,t.dict=A,t.toUnicode=await a;let c=await this.buildToUnicode(t);return t.toUnicode=c,s&&(t.cidToGidMap=this.readCidToGidMap(s,c)),t}_simpleFontToUnicode(A,t=!1){gt(!A.composite,"Must be a simple font.");let i=[],s=A.defaultEncoding.slice(),a=A.baseEncodingName,n=A.differences;for(let g in n){let o=n[g];o!==".notdef"&&(s[g]=o)}let r=Ai();for(let g in s){let o=s[g];if(o==="")continue;let I=r[o];if(I!==void 0){i[g]=String.fromCharCode(I);continue}let c=0;switch(o[0]){case"G":o.length===3&&(c=parseInt(o.substring(1),16));break;case"g":o.length===5&&(c=parseInt(o.substring(1),16));break;case"C":case"c":if(o.length>=3&&o.length<=4){let l=o.substring(1);if(t){c=parseInt(l,16);break}if(c=+l,Number.isNaN(c)&&Number.isInteger(parseInt(l,16)))return this._simpleFontToUnicode(A,!0)}break;case"u":I=Us(o,r),I!==-1&&(c=I);break;default:switch(o){case"f_h":case"f_t":case"T_h":i[g]=o.replaceAll("_","");continue}break}if(c>0&&c<=1114111&&Number.isInteger(c)){if(a&&c===+g){let l=Ua(a);if(l&&(o=l[g])){i[g]=String.fromCharCode(r[o]);continue}}i[g]=String.fromCodePoint(c)}}return i}async buildToUnicode(A){var t,i;if(A.hasIncludedToUnicodeMap=((t=A.toUnicode)==null?void 0:t.length)>0,A.hasIncludedToUnicodeMap)return!A.composite&&A.hasEncoding&&(A.fallbackToUnicode=this._simpleFontToUnicode(A)),A.toUnicode;if(!A.composite)return new B0(this._simpleFontToUnicode(A));if(A.composite&&(A.cMap.builtInCMap&&!(A.cMap instanceof Wi)||((i=A.cidSystemInfo)==null?void 0:i.registry)==="Adobe"&&(A.cidSystemInfo.ordering==="GB1"||A.cidSystemInfo.ordering==="CNS1"||A.cidSystemInfo.ordering==="Japan1"||A.cidSystemInfo.ordering==="Korea1"))){let{registry:s,ordering:a}=A.cidSystemInfo,n=M.get(`${s}-${a}-UCS2`),r=await es.create({encoding:n,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),g=[],o=[];return A.cMap.forEach(function(I,c){if(c>65535)throw new v("Max size of CID is 65,535");let l=r.lookup(c);if(l){o.length=0;for(let h=0,C=l.length;h<C;h+=2)o.push((l.charCodeAt(h)<<8)+l.charCodeAt(h+1));g[I]=String.fromCharCode(...o)}}),new B0(g)}return new Ct(A.firstChar,A.lastChar)}async readToUnicode(A){if(!A)return null;if(A instanceof M){let t=await es.create({encoding:A,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null});return t instanceof Wi?new Ct(0,65535):new B0(t.getMap())}if(A instanceof KA)try{let t=await es.create({encoding:A,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null});if(t instanceof Wi)return new Ct(0,65535);let i=new Array(t.length);return t.forEach(function(s,a){if(typeof a=="number"){i[s]=String.fromCodePoint(a);return}a.length%2!==0&&(a="\\0"+a);let n=[];for(let r=0;r<a.length;r+=2){let g=a.charCodeAt(r)<<8|a.charCodeAt(r+1);if((g&63488)!==55296){n.push(g);continue}r+=2;let o=a.charCodeAt(r)<<8|a.charCodeAt(r+1);n.push(((g&1023)<<10)+(o&1023)+65536)}i[s]=String.fromCodePoint(...n)}),new B0(i)}catch(t){if(t instanceof ve)return null;if(this.options.ignoreErrors)return k(`readToUnicode - ignoring ToUnicode data: "${t}".`),null;throw t}return null}readCidToGidMap(A,t){let i=[];for(let s=0,a=A.length;s<a;s++){let n=A[s++]<<8|A[s],r=s>>1;n===0&&!t.has(r)||(i[r]=n)}return i}extractWidths(A,t,i){let s=this.xref,a=[],n=0,r=[],g;if(i.composite){let c=A.get("DW");n=typeof c=="number"?Math.ceil(c):1e3;let l=A.get("W");if(Array.isArray(l))for(let h=0,C=l.length;h<C;h++){let B=s.fetchIfRef(l[h++]);if(!Number.isInteger(B))break;let Q=s.fetchIfRef(l[h]);if(Array.isArray(Q))for(let E of Q){let f=s.fetchIfRef(E);typeof f=="number"&&(a[B]=f),B++}else if(Number.isInteger(Q)){let E=s.fetchIfRef(l[++h]);if(typeof E!="number")continue;for(let f=B;f<=Q;f++)a[f]=E}else break}if(i.vertical){let h=A.getArray("DW2"),C=wt(h,2)?h:[880,-1e3];if(g=[C[1],n*.5,C[0]],C=A.get("W2"),Array.isArray(C))for(let B=0,Q=C.length;B<Q;B++){let E=s.fetchIfRef(C[B++]);if(!Number.isInteger(E))break;let f=s.fetchIfRef(C[B]);if(Array.isArray(f))for(let u=0,d=f.length;u<d;u++){let x=[s.fetchIfRef(f[u++]),s.fetchIfRef(f[u++]),s.fetchIfRef(f[u])];wt(x,null)&&(r[E]=x),E++}else if(Number.isInteger(f)){let u=[s.fetchIfRef(C[++B]),s.fetchIfRef(C[++B]),s.fetchIfRef(C[++B])];if(!wt(u,null))continue;for(let d=E;d<=f;d++)r[d]=u}else break}}}else{let c=A.get("Widths");if(Array.isArray(c)){let l=i.firstChar;for(let C of c){let B=s.fetchIfRef(C);typeof B=="number"&&(a[l]=B),l++}let h=t.get("MissingWidth");n=typeof h=="number"?h:0}else{let l=A.get("BaseFont");if(l instanceof M){let h=this.getBaseFontMetrics(l.name);a=this.buildCharCodeToWidth(h.widths,i),n=h.defaultWidth}}}let o=!0,I=n;for(let c in a){let l=a[c];if(l){if(!I){I=l;continue}if(I!==l){o=!1;break}}}o?i.flags|=Ft.FixedPitch:i.flags&=~Ft.FixedPitch,i.defaultWidth=n,i.widths=a,i.defaultVMetrics=g,i.vmetrics=r}isSerifFont(A){let t=A.split("-",1)[0];return t in C1()||/serif/gi.test(t)}getBaseFontMetrics(A){let t=0,i=Object.create(null),s=!1,n=zg()[A]||A,r=g2();n in r||(n=this.isSerifFont(A)?"Times-Roman":"Helvetica");let g=r[n];return typeof g=="number"?(t=g,s=!0):i=g(),{defaultWidth:t,monospace:s,widths:i}}buildCharCodeToWidth(A,t){let i=Object.create(null),s=t.differences,a=t.defaultEncoding;for(let n=0;n<256;n++){if(n in s&&A[s[n]]){i[n]=A[s[n]];continue}if(n in a&&A[a[n]]){i[n]=A[a[n]];continue}}return i}preEvaluateFont(A){let t=A,i=A.get("Subtype");if(!(i instanceof M))throw new v("invalid font Subtype");let s=!1,a;if(i.name==="Type0"){let I=A.get("DescendantFonts");if(!I)throw new v("Descendant fonts are not specified");if(A=Array.isArray(I)?this.xref.fetchIfRef(I[0]):I,!(A instanceof F))throw new v("Descendant font is not a dictionary.");if(i=A.get("Subtype"),!(i instanceof M))throw new v("invalid font Subtype");s=!0}let n=A.get("FirstChar");Number.isInteger(n)||(n=0);let r=A.get("LastChar");Number.isInteger(r)||(r=s?65535:255);let g=A.get("FontDescriptor"),o=A.get("ToUnicode")||t.get("ToUnicode");if(g){a=new Ac;let I=t.getRaw("Encoding");if(I instanceof M)a.update(I.name);else if(I instanceof oA)a.update(I.toString());else if(I instanceof F){for(let l of I.getRawValues())if(l instanceof M)a.update(l.name);else if(l instanceof oA)a.update(l.toString());else if(Array.isArray(l)){let h=l.length,C=new Array(h);for(let B=0;B<h;B++){let Q=l[B];Q instanceof M?C[B]=Q.name:(typeof Q=="number"||Q instanceof oA)&&(C[B]=Q.toString())}a.update(C.join())}}if(a.update(`${n}-${r}`),o instanceof KA){let l=o.str||o,h=l.buffer?new Uint8Array(l.buffer.buffer,0,l.bufferLength):new Uint8Array(l.bytes.buffer,l.start,l.end-l.start);a.update(h)}else o instanceof M&&a.update(o.name);let c=A.get("Widths")||t.get("Widths");if(Array.isArray(c)){let l=[];for(let h of c)(typeof h=="number"||h instanceof oA)&&l.push(h.toString());a.update(l.join())}if(s){a.update("compositeFont");let l=A.get("W")||t.get("W");if(Array.isArray(l)){let C=[];for(let B of l)if(typeof B=="number"||B instanceof oA)C.push(B.toString());else if(Array.isArray(B)){let Q=[];for(let E of B)(typeof E=="number"||E instanceof oA)&&Q.push(E.toString());C.push(`[${Q.join()}]`)}a.update(C.join())}let h=A.getRaw("CIDToGIDMap")||t.getRaw("CIDToGIDMap");h instanceof M?a.update(h.name):h instanceof oA?a.update(h.toString()):h instanceof KA&&a.update(h.peekBytes())}}return{descriptor:g,dict:A,baseDict:t,composite:s,type:i.name,firstChar:n,lastChar:r,toUnicode:o,hash:a?a.hexdigest():""}}async translateFont({descriptor:A,dict:t,baseDict:i,composite:s,type:a,firstChar:n,lastChar:r,toUnicode:g,cssFontInfo:o}){let I=a==="Type3";if(!A)if(I){let R=Ei(t.getArray("FontBBox"),[0,0,0,0]);A=new F(null),A.set("FontName",M.get(a)),A.set("FontBBox",R)}else{let R=t.get("BaseFont");if(!(R instanceof M))throw new v("Base font is not specified");R=R.name.replaceAll(/[,_]/g,"-");let _=this.getBaseFontMetrics(R),tA=R.split("-",1)[0],IA=(this.isSerifFont(tA)?Ft.Serif:0)|(_.monospace?Ft.FixedPitch:0)|(DI()[tA]?Ft.Symbolic:Ft.Nonsymbolic),QA={type:a,name:R,loadedName:i.loadedName,systemFontInfo:null,widths:_.widths,defaultWidth:_.defaultWidth,isSimulatedFlags:!0,flags:IA,firstChar:n,lastChar:r,toUnicode:g,xHeight:0,capHeight:0,italicAngle:0,isType3Font:I},V=t.get("Widths"),lA=j1(R),EA=null;lA&&(EA=await this.fetchStandardFontData(lA),QA.isInternalFont=!!EA),!QA.isInternalFont&&this.options.useSystemFonts&&(QA.systemFontInfo=QE(this.systemFontCache,this.idFactory,this.options.standardFontDataUrl,R,lA,a));let fA=await this.extractDataStructures(t,QA);if(Array.isArray(V)){let CA=[],N=n;for(let H of V){let q=this.xref.fetchIfRef(H);typeof q=="number"&&(CA[N]=q),N++}fA.widths=CA}else fA.widths=this.buildCharCodeToWidth(_.widths,fA);return new Lr(R,EA,fA)}let c=A.get("FontName"),l=t.get("BaseFont");typeof c=="string"&&(c=M.get(c)),typeof l=="string"&&(l=M.get(l));let h=c==null?void 0:c.name,C=l==null?void 0:l.name;if(!I&&h!==C&&(PA(`The FontDescriptor\'s FontName is "${h}" but should be the same as the Font\'s BaseFont "${C}".`),h&&C&&(C.startsWith(h)||!X1(h)&&X1(C))&&(c=null)),c||(c=l),!(c instanceof M))throw new v("invalid font name");let B,Q,E,f,u;try{B=A.get("FontFile","FontFile2","FontFile3")}catch(R){if(!this.options.ignoreErrors)throw R;k(`translateFont - fetching "${c.name}" font file: "${R}".`),B=new Rs}let d=!1,x=null,p=null;if(B){if(B.dict){let R=B.dict.get("Subtype");R instanceof M&&(Q=R.name),E=B.dict.get("Length1"),f=B.dict.get("Length2"),u=B.dict.get("Length3")}}else if(o){let R=B1(c.name);R&&(o.fontFamily=`${o.fontFamily}-PdfJS-XFA`,o.metrics=R.metrics||null,x=R.factors||null,B=await this.fetchStandardFontData(R.name),d=!!B,i=t=pf(c.name),s=!0)}else if(!I){let R=j1(c.name);R&&(B=await this.fetchStandardFontData(R),d=!!B),!d&&this.options.useSystemFonts&&(p=QE(this.systemFontCache,this.idFactory,this.options.standardFontDataUrl,c.name,R,a))}let m=Ki(t.getArray("FontMatrix"),E0),D=Ei(A.getArray("FontBBox")||t.getArray("FontBBox"),void 0),S=A.get("Ascent");typeof S!="number"&&(S=void 0);let w=A.get("Descent");typeof w!="number"&&(w=void 0);let Y=A.get("XHeight");typeof Y!="number"&&(Y=0);let U=A.get("CapHeight");typeof U!="number"&&(U=0);let K=A.get("Flags");Number.isInteger(K)||(K=0);let Z=A.get("ItalicAngle");typeof Z!="number"&&(Z=0);let AA={type:a,name:c.name,subtype:Q,file:B,length1:E,length2:f,length3:u,isInternalFont:d,loadedName:i.loadedName,composite:s,fixedPitch:!1,fontMatrix:m,firstChar:n,lastChar:r,toUnicode:g,bbox:D,ascent:S,descent:w,xHeight:Y,capHeight:U,flags:K,italicAngle:Z,isType3Font:I,cssFontInfo:o,scaleFactors:x,systemFontInfo:p};if(s){let R=i.get("Encoding");R instanceof M&&(AA.cidEncoding=R.name);let _=await es.create({encoding:R,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null});AA.cMap=_,AA.vertical=AA.cMap.vertical}let gA=await this.extractDataStructures(t,AA);return this.extractWidths(t,A,gA),new Lr(c.name,B,gA)}static buildFontPaths(A,t,i,s){function a(n){let r=`${A.loadedName}_path_${n}`;try{if(A.renderer.hasBuiltPath(n))return;i.send("commonobj",[r,"FontPath",A.renderer.getPathJs(n)])}catch(g){if(s.ignoreErrors){k(`buildFontPaths - ignoring ${r} glyph: "${g}".`);return}throw g}}for(let n of t){a(n.fontChar);let r=n.accent;r!=null&&r.fontChar&&a(r.fontChar)}}static get fallbackFontDict(){let A=new F;return A.set("BaseFont",M.get("Helvetica")),A.set("Type",M.get("FallbackType")),A.set("Subtype",M.get("FallbackType")),A.set("Encoding",M.get("WinAnsiEncoding")),nA(this,"fallbackFontDict",A)}},is=class{constructor({loadedName:A,font:t,dict:i,evaluatorOptions:s}){this.loadedName=A,this.font=t,this.dict=i,this._evaluatorOptions=s||Df,this.type3Loaded=null,this.type3Dependencies=t.isType3Font?new Set:null,this.sent=!1}send(A){this.sent||(this.sent=!0,A.send("commonobj",[this.loadedName,"Font",this.font.exportData(this._evaluatorOptions.fontExtraProperties)]))}fallback(A){this.font.data&&(this.font.disableFontFace=!0,Lt.buildFontPaths(this.font,this.font.glyphCacheValues,A,this._evaluatorOptions))}loadType3Data(A,t,i){if(this.type3Loaded)return this.type3Loaded;if(!this.font.isType3Font)throw new Error("Must be a Type3 font.");let s=A.clone({ignoreErrors:!1}),a=new be(A.type3FontRefs);this.dict.objId&&!a.has(this.dict.objId)&&a.put(this.dict.objId),s.type3FontRefs=a;let n=this.font,r=this.type3Dependencies,g=Promise.resolve(),o=this.dict.get("CharProcs"),I=this.dict.get("Resources")||t,c=Object.create(null),l=Ce.normalizeRect(n.bbox||[0,0,0,0]),h=l[2]-l[0],C=l[3]-l[1],B=Math.hypot(h,C);for(let Q of o.getKeys())g=g.then(()=>{let E=o.get(Q),f=new ze;return s.getOperatorList({stream:E,task:i,resources:I,operatorList:f}).then(()=>{f.fnArray[0]===y.setCharWidthAndBounds&&this._removeType3ColorOperators(f,B),c[Q]=f.getIR();for(let u of f.dependencies)r.add(u)}).catch(function(u){k(`Type3 font resource "${Q}" is not available.`);let d=new ze;c[Q]=d.getIR()})});return this.type3Loaded=g.then(()=>{n.charProcOperatorList=c,this._bbox&&(n.isCharBBox=!0,n.bbox=this._bbox)}),this.type3Loaded}_removeType3ColorOperators(A,t=NaN){let i=Ce.normalizeRect(A.argsArray[0].slice(2)),s=i[2]-i[0],a=i[3]-i[1],n=Math.hypot(s,a);s===0||a===0?(A.fnArray.splice(0,1),A.argsArray.splice(0,1)):(t===0||Math.round(n/t)>=10)&&(this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]),this._bbox[0]=Math.min(this._bbox[0],i[0]),this._bbox[1]=Math.min(this._bbox[1],i[1]),this._bbox[2]=Math.max(this._bbox[2],i[2]),this._bbox[3]=Math.max(this._bbox[3],i[3]));let r=0,g=A.length;for(;r<g;){switch(A.fnArray[r]){case y.setCharWidthAndBounds:break;case y.setStrokeColorSpace:case y.setFillColorSpace:case y.setStrokeColor:case y.setStrokeColorN:case y.setFillColor:case y.setFillColorN:case y.setStrokeGray:case y.setFillGray:case y.setStrokeRGBColor:case y.setFillRGBColor:case y.setStrokeCMYKColor:case y.setFillCMYKColor:case y.shadingFill:case y.setRenderingIntent:A.fnArray.splice(r,1),A.argsArray.splice(r,1),g--;continue;case y.setGState:let[o]=A.argsArray[r],I=0,c=o.length;for(;I<c;){let[l]=o[I];switch(l){case"TR":case"TR2":case"HT":case"BG":case"BG2":case"UCR":case"UCR2":o.splice(I,1),c--;continue}I++}break}r++}}},Bs=class{constructor(A=new Or){this.state=A,this.stateStack=[]}save(){let A=this.state;this.stateStack.push(this.state),this.state=A.clone()}restore(){let A=this.stateStack.pop();A&&(this.state=A)}transform(A){this.state.ctm=Ce.transform(this.state.ctm,A)}},tc=class{constructor(){this.ctm=new Float32Array(Wt),this.fontName=null,this.fontSize=0,this.loadedName=null,this.font=null,this.fontMatrix=E0,this.textMatrix=Wt.slice(),this.textLineMatrix=Wt.slice(),this.charSpacing=0,this.wordSpacing=0,this.leading=0,this.textHScale=1,this.textRise=0}setTextMatrix(A,t,i,s,a,n){let r=this.textMatrix;r[0]=A,r[1]=t,r[2]=i,r[3]=s,r[4]=a,r[5]=n}setTextLineMatrix(A,t,i,s,a,n){let r=this.textLineMatrix;r[0]=A,r[1]=t,r[2]=i,r[3]=s,r[4]=a,r[5]=n}translateTextMatrix(A,t){let i=this.textMatrix;i[4]=i[0]*A+i[2]*t+i[4],i[5]=i[1]*A+i[3]*t+i[5]}translateTextLineMatrix(A,t){let i=this.textLineMatrix;i[4]=i[0]*A+i[2]*t+i[4],i[5]=i[1]*A+i[3]*t+i[5]}carriageReturn(){this.translateTextLineMatrix(0,-this.leading),this.textMatrix=this.textLineMatrix.slice()}clone(){let A=Object.create(this);return A.textMatrix=this.textMatrix.slice(),A.textLineMatrix=this.textLineMatrix.slice(),A.fontMatrix=this.fontMatrix.slice(),A}},Or=class{constructor(){this.ctm=new Float32Array(Wt),this.font=null,this.textRenderingMode=PE.FILL,this._fillColorSpace=JA.singletons.gray,this._strokeColorSpace=JA.singletons.gray,this.patternFillColorSpace=null,this.patternStrokeColorSpace=null}get fillColorSpace(){return this._fillColorSpace}set fillColorSpace(A){this._fillColorSpace=this.patternFillColorSpace=A}get strokeColorSpace(){return this._strokeColorSpace}set strokeColorSpace(A){this._strokeColorSpace=this.patternStrokeColorSpace=A}clone(){return Object.create(this)}},ba=class{static get opMap(){return nA(this,"opMap",Object.assign(Object.create(null),{w:{id:y.setLineWidth,numArgs:1,variableArgs:!1},J:{id:y.setLineCap,numArgs:1,variableArgs:!1},j:{id:y.setLineJoin,numArgs:1,variableArgs:!1},M:{id:y.setMiterLimit,numArgs:1,variableArgs:!1},d:{id:y.setDash,numArgs:2,variableArgs:!1},ri:{id:y.setRenderingIntent,numArgs:1,variableArgs:!1},i:{id:y.setFlatness,numArgs:1,variableArgs:!1},gs:{id:y.setGState,numArgs:1,variableArgs:!1},q:{id:y.save,numArgs:0,variableArgs:!1},Q:{id:y.restore,numArgs:0,variableArgs:!1},cm:{id:y.transform,numArgs:6,variableArgs:!1},m:{id:y.moveTo,numArgs:2,variableArgs:!1},l:{id:y.lineTo,numArgs:2,variableArgs:!1},c:{id:y.curveTo,numArgs:6,variableArgs:!1},v:{id:y.curveTo2,numArgs:4,variableArgs:!1},y:{id:y.curveTo3,numArgs:4,variableArgs:!1},h:{id:y.closePath,numArgs:0,variableArgs:!1},re:{id:y.rectangle,numArgs:4,variableArgs:!1},S:{id:y.stroke,numArgs:0,variableArgs:!1},s:{id:y.closeStroke,numArgs:0,variableArgs:!1},f:{id:y.fill,numArgs:0,variableArgs:!1},F:{id:y.fill,numArgs:0,variableArgs:!1},"f*":{id:y.eoFill,numArgs:0,variableArgs:!1},B:{id:y.fillStroke,numArgs:0,variableArgs:!1},"B*":{id:y.eoFillStroke,numArgs:0,variableArgs:!1},b:{id:y.closeFillStroke,numArgs:0,variableArgs:!1},"b*":{id:y.closeEOFillStroke,numArgs:0,variableArgs:!1},n:{id:y.endPath,numArgs:0,variableArgs:!1},W:{id:y.clip,numArgs:0,variableArgs:!1},"W*":{id:y.eoClip,numArgs:0,variableArgs:!1},BT:{id:y.beginText,numArgs:0,variableArgs:!1},ET:{id:y.endText,numArgs:0,variableArgs:!1},Tc:{id:y.setCharSpacing,numArgs:1,variableArgs:!1},Tw:{id:y.setWordSpacing,numArgs:1,variableArgs:!1},Tz:{id:y.setHScale,numArgs:1,variableArgs:!1},TL:{id:y.setLeading,numArgs:1,variableArgs:!1},Tf:{id:y.setFont,numArgs:2,variableArgs:!1},Tr:{id:y.setTextRenderingMode,numArgs:1,variableArgs:!1},Ts:{id:y.setTextRise,numArgs:1,variableArgs:!1},Td:{id:y.moveText,numArgs:2,variableArgs:!1},TD:{id:y.setLeadingMoveText,numArgs:2,variableArgs:!1},Tm:{id:y.setTextMatrix,numArgs:6,variableArgs:!1},"T*":{id:y.nextLine,numArgs:0,variableArgs:!1},Tj:{id:y.showText,numArgs:1,variableArgs:!1},TJ:{id:y.showSpacedText,numArgs:1,variableArgs:!1},"\'":{id:y.nextLineShowText,numArgs:1,variableArgs:!1},\'"\':{id:y.nextLineSetSpacingShowText,numArgs:3,variableArgs:!1},d0:{id:y.setCharWidth,numArgs:2,variableArgs:!1},d1:{id:y.setCharWidthAndBounds,numArgs:6,variableArgs:!1},CS:{id:y.setStrokeColorSpace,numArgs:1,variableArgs:!1},cs:{id:y.setFillColorSpace,numArgs:1,variableArgs:!1},SC:{id:y.setStrokeColor,numArgs:4,variableArgs:!0},SCN:{id:y.setStrokeColorN,numArgs:33,variableArgs:!0},sc:{id:y.setFillColor,numArgs:4,variableArgs:!0},scn:{id:y.setFillColorN,numArgs:33,variableArgs:!0},G:{id:y.setStrokeGray,numArgs:1,variableArgs:!1},g:{id:y.setFillGray,numArgs:1,variableArgs:!1},RG:{id:y.setStrokeRGBColor,numArgs:3,variableArgs:!1},rg:{id:y.setFillRGBColor,numArgs:3,variableArgs:!1},K:{id:y.setStrokeCMYKColor,numArgs:4,variableArgs:!1},k:{id:y.setFillCMYKColor,numArgs:4,variableArgs:!1},sh:{id:y.shadingFill,numArgs:1,variableArgs:!1},BI:{id:y.beginInlineImage,numArgs:0,variableArgs:!1},ID:{id:y.beginImageData,numArgs:0,variableArgs:!1},EI:{id:y.endInlineImage,numArgs:1,variableArgs:!1},Do:{id:y.paintXObject,numArgs:1,variableArgs:!1},MP:{id:y.markPoint,numArgs:1,variableArgs:!1},DP:{id:y.markPointProps,numArgs:2,variableArgs:!1},BMC:{id:y.beginMarkedContent,numArgs:1,variableArgs:!1},BDC:{id:y.beginMarkedContentProps,numArgs:2,variableArgs:!1},EMC:{id:y.endMarkedContent,numArgs:0,variableArgs:!1},BX:{id:y.beginCompat,numArgs:0,variableArgs:!1},EX:{id:y.endCompat,numArgs:0,variableArgs:!1},BM:null,BD:null,true:null,fa:null,fal:null,fals:null,false:null,nu:null,nul:null,null:null}))}constructor(A,t,i=new Bs){this.parser=new zt({lexer:new dt(A,ba.opMap),xref:t}),this.stateManager=i,this.nonProcessedArgs=[],this._isPathOp=!1,this._numInvalidPathOPS=0}get savedStatesDepth(){return this.stateManager.stateStack.length}read(A){let t=A.args;for(;;){let i=this.parser.getObj();if(i instanceof fe){let s=i.cmd,a=ba.opMap[s];if(!a){k(`Unknown command "${s}".`);continue}let n=a.id,r=a.numArgs,g=t!==null?t.length:0;if(this._isPathOp||(this._numInvalidPathOPS=0),this._isPathOp=n>=y.moveTo&&n<=y.endPath,a.variableArgs)g>r&&PA(`Command ${s}: expected [0, ${r}] args, but received ${g} args.`);else{if(g!==r){let o=this.nonProcessedArgs;for(;g>r;)o.push(t.shift()),g--;for(;g<r&&o.length!==0;)t===null&&(t=[]),t.unshift(o.pop()),g++}if(g<r){let o=`command ${s}: expected ${r} args, but received ${g} args.`;if(this._isPathOp&&++this._numInvalidPathOPS>ba.MAX_INVALID_PATH_OPS)throw new v(`Invalid ${o}`);k(`Skipping ${o}`),t!==null&&(t.length=0);continue}}return this.preprocessCommand(n,t),A.fn=n,A.args=t,!0}if(i===Ge)return!1;if(i!==null&&(t===null&&(t=[]),t.push(i),t.length>33))throw new v("Too many arguments")}}preprocessCommand(A,t){switch(A|0){case y.save:this.stateManager.save();break;case y.restore:this.stateManager.restore();break;case y.transform:this.stateManager.transform(t);break}}},f0=ba;et(f0,"MAX_INVALID_PATH_OPS",10);var ic=class extends f0{constructor(A){super(new It(A))}parse(){let A={fn:0,args:[]},t={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;A.args.length=0,!!this.read(A);){if(this.savedStatesDepth!==0)continue;let{fn:i,args:s}=A;switch(i|0){case y.setFont:let[a,n]=s;a instanceof M&&(t.fontName=a.name),typeof n=="number"&&n>0&&(t.fontSize=n);break;case y.setFillRGBColor:JA.singletons.rgb.getRgbItem(s,0,t.fontColor,0);break;case y.setFillGray:JA.singletons.gray.getRgbItem(s,0,t.fontColor,0);break;case y.setFillCMYKColor:JA.singletons.cmyk.getRgbItem(s,0,t.fontColor,0);break}}}catch(i){k(`parseDefaultAppearance - ignoring errors: "${i}".`)}return t}};function Q1(e){return new ic(e).parse()}var sc=class extends f0{constructor(A,t,i){var s;super(A),this.stream=A,this.evaluatorOptions=t,this.xref=i,this.resources=(s=A.dict)==null?void 0:s.get("Resources")}parse(){let A={fn:0,args:[]},t={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:JA.singletons.gray},i=!1,s=[];try{for(;A.args.length=0,!(i||!this.read(A));){let{fn:a,args:n}=A;switch(a|0){case y.save:s.push({scaleFactor:t.scaleFactor,fontSize:t.fontSize,fontName:t.fontName,fontColor:t.fontColor.slice(),fillColorSpace:t.fillColorSpace});break;case y.restore:t=s.pop()||t;break;case y.setTextMatrix:t.scaleFactor*=Math.hypot(n[0],n[1]);break;case y.setFont:let[r,g]=n;r instanceof M&&(t.fontName=r.name),typeof g=="number"&&g>0&&(t.fontSize=g*t.scaleFactor);break;case y.setFillColorSpace:t.fillColorSpace=JA.parse({cs:n[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case y.setFillColor:t.fillColorSpace.getRgbItem(n,0,t.fontColor,0);break;case y.setFillRGBColor:JA.singletons.rgb.getRgbItem(n,0,t.fontColor,0);break;case y.setFillGray:JA.singletons.gray.getRgbItem(n,0,t.fontColor,0);break;case y.setFillCMYKColor:JA.singletons.cmyk.getRgbItem(n,0,t.fontColor,0);break;case y.showText:case y.showSpacedText:case y.nextLineShowText:case y.nextLineSetSpacingShowText:i=!0;break}}}catch(a){k(`parseAppearanceStream - ignoring errors: "${a}".`)}return this.stream.reset(),delete t.scaleFactor,delete t.fillColorSpace,t}get _localColorSpaceCache(){return nA(this,"_localColorSpaceCache",new Jr)}get _pdfFunctionFactory(){let A=new Kr({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported});return nA(this,"_pdfFunctionFactory",A)}};function R9(e,A,t){return new sc(e,A,t).parse()}function mi(e,A){if(e[0]===e[1]&&e[1]===e[2]){let t=e[0]/255;return`${Ae(t)} ${A?"g":"G"}`}return Array.from(e,t=>Ae(t/255)).join(" ")+` ${A?"rg":"RG"}`}function N9({fontSize:e,fontName:A,fontColor:t}){return`/${o1(A)} ${e} Tf ${mi(t,!0)}`}var Ut=class{constructor(A,t){this.xref=A,this.widths=null,this.firstChar=1/0,this.lastChar=-1/0,this.fontFamily=t;let i=new OffscreenCanvas(1,1);this.ctxMeasure=i.getContext("2d",{willReadFrequently:!0}),Ut._fontNameId||(Ut._fontNameId=1),this.fontName=M.get(`InvalidPDFjsFont_${t}_${Ut._fontNameId++}`)}get fontDescriptorRef(){if(!Ut._fontDescriptorRef){let A=new F(this.xref);A.set("Type",M.get("FontDescriptor")),A.set("FontName",this.fontName),A.set("FontFamily","MyriadPro Regular"),A.set("FontBBox",[0,0,0,0]),A.set("FontStretch",M.get("Normal")),A.set("FontWeight",400),A.set("ItalicAngle",0),Ut._fontDescriptorRef=this.xref.getNewPersistentRef(A)}return Ut._fontDescriptorRef}get descendantFontRef(){let A=new F(this.xref);A.set("BaseFont",this.fontName),A.set("Type",M.get("Font")),A.set("Subtype",M.get("CIDFontType0")),A.set("CIDToGIDMap",M.get("Identity")),A.set("FirstChar",this.firstChar),A.set("LastChar",this.lastChar),A.set("FontDescriptor",this.fontDescriptorRef),A.set("DW",1e3);let t=[],i=[...this.widths.entries()].sort(),s=null,a=null;for(let[r,g]of i){if(!s){s=r,a=[g];continue}r===s+a.length?a.push(g):(t.push(s,a),s=r,a=[g])}s&&t.push(s,a),A.set("W",t);let n=new F(this.xref);return n.set("Ordering","Identity"),n.set("Registry","Adobe"),n.set("Supplement",0),A.set("CIDSystemInfo",n),this.xref.getNewPersistentRef(A)}get baseFontRef(){let A=new F(this.xref);return A.set("BaseFont",this.fontName),A.set("Type",M.get("Font")),A.set("Subtype",M.get("Type0")),A.set("Encoding",M.get("Identity-H")),A.set("DescendantFonts",[this.descendantFontRef]),A.set("ToUnicode",M.get("Identity-H")),this.xref.getNewPersistentRef(A)}get resources(){let A=new F(this.xref),t=new F(this.xref);return t.set(this.fontName.name,this.baseFontRef),A.set("Font",t),A}_createContext(){return this.widths=new Map,this.ctxMeasure.font=`1000px ${this.fontFamily}`,this.ctxMeasure}createFontResources(A){let t=this._createContext();for(let i of A.split(/\\r\\n?|\\n/))for(let s of i.split("")){let a=s.charCodeAt(0);if(this.widths.has(a))continue;let n=t.measureText(s),r=Math.ceil(n.width);this.widths.set(a,r),this.firstChar=Math.min(a,this.firstChar),this.lastChar=Math.max(a,this.lastChar)}return this.resources}static getFirstPositionInfo(A,t,i){let[s,a,n,r]=A,g=n-s,o=r-a;t%180!==0&&([g,o]=[o,g]);let I=Qi*i,c=Cr*i;return{coords:[0,o+c-I],bbox:[0,0,g,o],matrix:t!==0?xr(t,o,I):void 0}}createAppearance(A,t,i,s,a,n){let r=this._createContext(),g=[],o=-1/0;for(let K of A.split(/\\r\\n?|\\n/)){g.push(K);let Z=r.measureText(K).width;o=Math.max(o,Z);for(let AA of Wu(K)){let gA=String.fromCodePoint(AA),R=this.widths.get(AA);if(R===void 0){let _=r.measureText(gA);R=Math.ceil(_.width),this.widths.set(AA,R),this.firstChar=Math.min(AA,this.firstChar),this.lastChar=Math.max(AA,this.lastChar)}}}o*=s/1e3;let[I,c,l,h]=t,C=l-I,B=h-c;i%180!==0&&([C,B]=[B,C]);let Q=1;o>C&&(Q=C/o);let E=1,f=Qi*s,u=Cr*s,d=f*g.length;d>B&&(E=B/d);let x=Math.min(Q,E),p=s*x,m=["q",`0 0 ${Ae(C)} ${Ae(B)} re W n`,"BT",`1 0 0 1 0 ${Ae(B+u)} Tm 0 Tc ${mi(a,!0)}`,`/${this.fontName.name} ${Ae(p)} Tf`],{resources:D}=this;if(n=typeof n=="number"&&n>=0&&n<=1?n:1,n!==1){m.push("/R0 gs");let K=new F(this.xref),Z=new F(this.xref);Z.set("ca",n),Z.set("CA",n),Z.set("Type",M.get("ExtGState")),K.set("R0",Z),D.set("ExtGState",K)}let S=Ae(f);for(let K of g)m.push(`0 -${S} Td <${ju(K)}> Tj`);m.push("ET","Q");let w=m.join(`\n`),Y=new F(this.xref);if(Y.set("Subtype",M.get("Form")),Y.set("Type",M.get("XObject")),Y.set("BBox",[0,0,C,B]),Y.set("Length",w.length),Y.set("Resources",D),i){let K=xr(i,C,B);Y.set("Matrix",K)}let U=new It(w);return U.dict=Y,U}},Zr=class{constructor(A,t,i){this.root=A,this.xref=t,this._type=i}getAll(){let A=new Map;if(!this.root)return A;let t=this.xref,i=new be;i.put(this.root);let s=[this.root];for(;s.length>0;){let a=t.fetchIfRef(s.shift());if(!(a instanceof F))continue;if(a.has("Kids")){let r=a.get("Kids");if(!Array.isArray(r))continue;for(let g of r){if(i.has(g))throw new v(`Duplicate entry in "${this._type}" tree.`);s.push(g),i.put(g)}continue}let n=a.get(this._type);if(Array.isArray(n))for(let r=0,g=n.length;r<g;r+=2)A.set(t.fetchIfRef(n[r]),t.fetchIfRef(n[r+1]))}return A}get(A){if(!this.root)return null;let t=this.xref,i=t.fetchIfRef(this.root),s=0,a=10;for(;i.has("Kids");){if(++s>a)return k(`Search depth limit reached for "${this._type}" tree.`),null;let r=i.get("Kids");if(!Array.isArray(r))return null;let g=0,o=r.length-1;for(;g<=o;){let I=g+o>>1,c=t.fetchIfRef(r[I]),l=c.get("Limits");if(A<t.fetchIfRef(l[0]))o=I-1;else if(A>t.fetchIfRef(l[1]))g=I+1;else{i=c;break}}if(g>o)return null}let n=i.get(this._type);if(Array.isArray(n)){let r=0,g=n.length-2;for(;r<=g;){let o=r+g>>1,I=o+(o&1),c=t.fetchIfRef(n[I]);if(A<c)g=I-2;else if(A>c)r=I+2;else return t.fetchIfRef(n[I+1])}}return null}},Fi=class extends Zr{constructor(A,t){super(A,t,"Names")}},va=class extends Zr{constructor(A,t){super(A,t,"Nums")}};function E1(){L2(),vu(),A2(),hs.cleanup()}function mE(e){return e instanceof F?e.has("UF")?e.get("UF"):e.has("F")?e.get("F"):e.has("Unix")?e.get("Unix"):e.has("Mac")?e.get("Mac"):e.has("DOS")?e.get("DOS"):null:null}function G9(e){return e.substring(e.lastIndexOf("/")+1)}var Qn,qa=class{constructor(A,t,i=!1){HA(this,Qn,!1);A instanceof F&&(this.xref=t,this.root=A,A.has("FS")&&(this.fs=A.get("FS")),A.has("RF")&&k("Related file specifications are not supported"),i||(A.has("EF")?_s(this,Qn,!0):k("Non-embedded file specifications are not supported")))}get filename(){let A="",t=mE(this.root);return t&&typeof t=="string"&&(A=jA(t).replaceAll("\\\\\\\\","\\\\").replaceAll("\\\\/","/").replaceAll("\\\\","/")),nA(this,"filename",A||"unnamed")}get content(){var t;if(!ne(this,Qn))return null;this._contentRef||(this._contentRef=mE((t=this.root)==null?void 0:t.get("EF")));let A=null;if(this._contentRef){let i=this.xref.fetchIfRef(this._contentRef);i instanceof KA?A=i.getBytes():k("Embedded file specification points to non-existing/invalid content")}else k("Embedded file specification does not have any content");return A}get description(){var i;let A="",t=(i=this.root)==null?void 0:i.get("Desc");return t&&typeof t=="string"&&(A=jA(t)),nA(this,"description",A)}get serializable(){return{rawFilename:this.filename,filename:G9(this.filename),content:this.content,description:this.description}}};Qn=new WeakMap;var ht={NoError:0,EndOfDocument:-1,UnterminatedCdat:-2,UnterminatedXmlDeclaration:-3,UnterminatedDoctypeDeclaration:-4,UnterminatedComment:-5,MalformedElement:-6,OutOfMemory:-7,UnterminatedAttributeValue:-8,UnterminatedElement:-9,ElementNeverBegun:-10};function $0(e,A){let t=e[A];return t===" "||t===`\n`||t==="\\r"||t==="	"}function U9(e){for(let A=0,t=e.length;A<t;A++)if(!$0(e,A))return!1;return!0}var jr=class{_resolveEntities(A){return A.replaceAll(/&([^;]+);/g,(t,i)=>{if(i.substring(0,2)==="#x")return String.fromCodePoint(parseInt(i.substring(2),16));if(i.substring(0,1)==="#")return String.fromCodePoint(parseInt(i.substring(1),10));switch(i){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return\'"\';case"apos":return"\'"}return this.onResolveEntity(i)})}_parseContent(A,t){let i=[],s=t;function a(){for(;s<A.length&&$0(A,s);)++s}for(;s<A.length&&!$0(A,s)&&A[s]!==">"&&A[s]!=="/";)++s;let n=A.substring(t,s);for(a();s<A.length&&A[s]!==">"&&A[s]!=="/"&&A[s]!=="?";){a();let r="",g="";for(;s<A.length&&!$0(A,s)&&A[s]!=="=";)r+=A[s],++s;if(a(),A[s]!=="=")return null;++s,a();let o=A[s];if(o!==\'"\'&&o!=="\'")return null;let I=A.indexOf(o,++s);if(I<0)return null;g=A.substring(s,I),i.push({name:r,value:this._resolveEntities(g)}),s=I+1,a()}return{name:n,attributes:i,parsed:s-t}}_parseProcessingInstruction(A,t){let i=t;function s(){for(;i<A.length&&$0(A,i);)++i}for(;i<A.length&&!$0(A,i)&&A[i]!==">"&&A[i]!=="?"&&A[i]!=="/";)++i;let a=A.substring(t,i);s();let n=i;for(;i<A.length&&(A[i]!=="?"||A[i+1]!==">");)++i;let r=A.substring(n,i);return{name:a,value:r,parsed:i-t}}parseXml(A){let t=0;for(;t<A.length;){let i=A[t],s=t;if(i==="<"){++s;let a=A[s],n;switch(a){case"/":if(++s,n=A.indexOf(">",s),n<0){this.onError(ht.UnterminatedElement);return}this.onEndElement(A.substring(s,n)),s=n+1;break;case"?":++s;let r=this._parseProcessingInstruction(A,s);if(A.substring(s+r.parsed,s+r.parsed+2)!=="?>"){this.onError(ht.UnterminatedXmlDeclaration);return}this.onPi(r.name,r.value),s+=r.parsed+2;break;case"!":if(A.substring(s+1,s+3)==="--"){if(n=A.indexOf("-->",s+3),n<0){this.onError(ht.UnterminatedComment);return}this.onComment(A.substring(s+3,n)),s=n+3}else if(A.substring(s+1,s+8)==="[CDATA["){if(n=A.indexOf("]]>",s+8),n<0){this.onError(ht.UnterminatedCdat);return}this.onCdata(A.substring(s+8,n)),s=n+3}else if(A.substring(s+1,s+8)==="DOCTYPE"){let I=A.indexOf("[",s+8),c=!1;if(n=A.indexOf(">",s+8),n<0){this.onError(ht.UnterminatedDoctypeDeclaration);return}if(I>0&&n>I){if(n=A.indexOf("]>",s+8),n<0){this.onError(ht.UnterminatedDoctypeDeclaration);return}c=!0}let l=A.substring(s+8,n+(c?1:0));this.onDoctype(l),s=n+(c?2:1)}else{this.onError(ht.MalformedElement);return}break;default:let g=this._parseContent(A,s);if(g===null){this.onError(ht.MalformedElement);return}let o=!1;if(A.substring(s+g.parsed,s+g.parsed+2)==="/>")o=!0;else if(A.substring(s+g.parsed,s+g.parsed+1)!==">"){this.onError(ht.UnterminatedElement);return}this.onBeginElement(g.name,g.attributes,o),s+=g.parsed+(o?2:1);break}}else{for(;s<A.length&&A[s]!=="<";)s++;let a=A.substring(t,s);this.onText(this._resolveEntities(a))}t=s}}onResolveEntity(A){return`&${A};`}onPi(A,t){}onComment(A){}onCdata(A){}onDoctype(A){}onText(A){}onBeginElement(A,t,i){}onEndElement(A){}onError(A){}},u0=class{constructor(A,t){this.nodeName=A,this.nodeValue=t,Object.defineProperty(this,"parentNode",{value:null,writable:!0})}get firstChild(){var A;return(A=this.childNodes)==null?void 0:A[0]}get nextSibling(){let A=this.parentNode.childNodes;if(!A)return;let t=A.indexOf(this);if(t!==-1)return A[t+1]}get textContent(){return this.childNodes?this.childNodes.map(function(A){return A.textContent}).join(""):this.nodeValue||""}get children(){return this.childNodes||[]}hasChildNodes(){var A;return((A=this.childNodes)==null?void 0:A.length)>0}searchNode(A,t){var n;if(t>=A.length)return this;let i=A[t];if(i.name.startsWith("#")&&t<A.length-1)return this.searchNode(A,t+1);let s=[],a=this;for(;;){if(i.name===a.nodeName)if(i.pos===0){let r=a.searchNode(A,t+1);if(r!==null)return r}else{if(s.length===0)return null;{let[r]=s.pop(),g=0;for(let o of r.childNodes)if(i.name===o.nodeName){if(g===i.pos)return o.searchNode(A,t+1);g++}return a.searchNode(A,t+1)}}if(((n=a.childNodes)==null?void 0:n.length)>0)s.push([a,0]),a=a.childNodes[0];else{if(s.length===0)return null;for(;s.length!==0;){let[r,g]=s.pop(),o=g+1;if(o<r.childNodes.length){s.push([r,o]),a=r.childNodes[o];break}}if(s.length===0)return null}}}dump(A){if(this.nodeName==="#text"){A.push(ls(this.nodeValue));return}if(A.push(`<${this.nodeName}`),this.attributes)for(let t of this.attributes)A.push(` ${t.name}="${ls(t.value)}"`);if(this.hasChildNodes()){A.push(">");for(let t of this.childNodes)t.dump(A);A.push(`</${this.nodeName}>`)}else this.nodeValue?A.push(`>${ls(this.nodeValue)}</${this.nodeName}>`):A.push("/>")}},Ls=class extends jr{constructor({hasAttributes:A=!1,lowerCaseName:t=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=ht.NoError,this._hasAttributes=A,this._lowerCaseName=t}parseFromString(A){if(this._currentFragment=[],this._stack=[],this._errorCode=ht.NoError,this.parseXml(A),this._errorCode!==ht.NoError)return;let[t]=this._currentFragment;if(t)return{documentElement:t}}onText(A){if(U9(A))return;let t=new u0("#text",A);this._currentFragment.push(t)}onCdata(A){let t=new u0("#text",A);this._currentFragment.push(t)}onBeginElement(A,t,i){this._lowerCaseName&&(A=A.toLowerCase());let s=new u0(A);s.childNodes=[],this._hasAttributes&&(s.attributes=t),this._currentFragment.push(s),!i&&(this._stack.push(this._currentFragment),this._currentFragment=s.childNodes)}onEndElement(A){this._currentFragment=this._stack.pop()||[];let t=this._currentFragment.at(-1);if(!t)return null;for(let i of t.childNodes)i.parentNode=t;return t}onError(A){this._errorCode=A}},ac=class{constructor(A){A=this._repair(A);let i=new Ls({lowerCaseName:!0}).parseFromString(A);this._metadataMap=new Map,this._data=A,i&&this._parse(i)}_repair(A){return A.replace(/^[^<]+/,"").replaceAll(/>\\\\376\\\\377([^<]+)/g,function(t,i){let s=i.replaceAll(/\\\\([0-3])([0-7])([0-7])/g,function(n,r,g,o){return String.fromCharCode(r*64+g*8+o*1)}).replaceAll(/&(amp|apos|gt|lt|quot);/g,function(n,r){switch(r){case"amp":return"&";case"apos":return"\'";case"gt":return">";case"lt":return"<";case"quot":return\'"\'}throw new Error(`_repair: ${r} isn\'t defined.`)}),a=[">"];for(let n=0,r=s.length;n<r;n+=2){let g=s.charCodeAt(n)*256+s.charCodeAt(n+1);g>=32&&g<127&&g!==60&&g!==62&&g!==38?a.push(String.fromCharCode(g)):a.push("&#x"+(65536+g).toString(16).substring(1)+";")}return a.join("")})}_getSequence(A){let t=A.nodeName;return t!=="rdf:bag"&&t!=="rdf:seq"&&t!=="rdf:alt"?null:A.childNodes.filter(i=>i.nodeName==="rdf:li")}_parseArray(A){if(!A.hasChildNodes())return;let[t]=A.childNodes,i=this._getSequence(t)||[];this._metadataMap.set(A.nodeName,i.map(s=>s.textContent.trim()))}_parse(A){let t=A.documentElement;if(t.nodeName!=="rdf:rdf")for(t=t.firstChild;t&&t.nodeName!=="rdf:rdf";)t=t.nextSibling;if(!(!t||t.nodeName!=="rdf:rdf"||!t.hasChildNodes())){for(let i of t.childNodes)if(i.nodeName==="rdf:description")for(let s of i.childNodes){let a=s.nodeName;switch(a){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(s);continue}this._metadataMap.set(a,s.textContent.trim())}}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}},pE=512,nc=class extends Me{constructor(A,t,i){super(t),this.str=A,this.dict=A.dict,this.decrypt=i,this.nextChunk=null,this.initialized=!1}readBlock(){var r;let A;if(this.initialized?A=this.nextChunk:(A=this.str.getBytes(pE),this.initialized=!0),!A||A.length===0){this.eof=!0;return}this.nextChunk=this.str.getBytes(pE);let t=((r=this.nextChunk)==null?void 0:r.length)>0,i=this.decrypt;A=i(A,!t);let s=this.bufferLength,a=s+A.length;this.ensureBuffer(a).set(A,s),this.bufferLength=a}},ci=class{constructor(A){this.a=0,this.b=0;let t=new Uint8Array(256),i=A.length;for(let s=0;s<256;++s)t[s]=s;for(let s=0,a=0;s<256;++s){let n=t[s];a=a+n+A[s%i]&255,t[s]=t[a],t[a]=n}this.s=t}encryptBlock(A){let t=this.a,i=this.b,s=this.s,a=A.length,n=new Uint8Array(a);for(let r=0;r<a;++r){t=t+1&255;let g=s[t];i=i+g&255;let o=s[i];s[t]=o,s[i]=g,n[r]=A[r]^s[g+o&255]}return this.a=t,this.b=i,n}decryptBlock(A){return this.encryptBlock(A)}encrypt(A){return this.encryptBlock(A)}},Ri=function(){let A=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),t=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]);function i(s,a,n){let r=1732584193,g=-271733879,o=-1732584194,I=271733878,c=n+72&-64,l=new Uint8Array(c),h,C;for(h=0;h<n;++h)l[h]=s[a++];l[h++]=128;let B=c-8;for(;h<B;)l[h++]=0;l[h++]=n<<3&255,l[h++]=n>>5&255,l[h++]=n>>13&255,l[h++]=n>>21&255,l[h++]=n>>>29&255,l[h++]=0,l[h++]=0,l[h++]=0;let Q=new Int32Array(16);for(h=0;h<c;){for(C=0;C<16;++C,h+=4)Q[C]=l[h]|l[h+1]<<8|l[h+2]<<16|l[h+3]<<24;let E=r,f=g,u=o,d=I,x,p;for(C=0;C<64;++C){C<16?(x=f&u|~f&d,p=C):C<32?(x=d&f|~d&u,p=5*C+1&15):C<48?(x=f^u^d,p=3*C+5&15):(x=u^(f|~d),p=7*C&15);let m=d,D=E+x+t[C]+Q[p]|0,S=A[C];d=u,u=f,f=f+(D<<S|D>>>32-S)|0,E=m}r=r+E|0,g=g+f|0,o=o+u|0,I=I+d|0}return new Uint8Array([r&255,r>>8&255,r>>16&255,r>>>24&255,g&255,g>>8&255,g>>16&255,g>>>24&255,o&255,o>>8&255,o>>16&255,o>>>24&255,I&255,I>>8&255,I>>16&255,I>>>24&255])}return i}(),sA=class{constructor(A,t){this.high=A|0,this.low=t|0}and(A){this.high&=A.high,this.low&=A.low}xor(A){this.high^=A.high,this.low^=A.low}or(A){this.high|=A.high,this.low|=A.low}shiftRight(A){A>=32?(this.low=this.high>>>A-32|0,this.high=0):(this.low=this.low>>>A|this.high<<32-A,this.high=this.high>>>A|0)}shiftLeft(A){A>=32?(this.high=this.low<<A-32,this.low=0):(this.high=this.high<<A|this.low>>>32-A,this.low<<=A)}rotateRight(A){let t,i;A&32?(i=this.low,t=this.high):(t=this.low,i=this.high),A&=31,this.low=t>>>A|i<<32-A,this.high=i>>>A|t<<32-A}not(){this.high=~this.high,this.low=~this.low}add(A){let t=(this.low>>>0)+(A.low>>>0),i=(this.high>>>0)+(A.high>>>0);t>4294967295&&(i+=1),this.low=t|0,this.high=i|0}copyTo(A,t){A[t]=this.high>>>24&255,A[t+1]=this.high>>16&255,A[t+2]=this.high>>8&255,A[t+3]=this.high&255,A[t+4]=this.low>>>24&255,A[t+5]=this.low>>16&255,A[t+6]=this.low>>8&255,A[t+7]=this.low&255}assign(A){this.high=A.high,this.low=A.low}},ss=function(){function A(I,c){return I>>>c|I<<32-c}function t(I,c,l){return I&c^~I&l}function i(I,c,l){return I&c^I&l^c&l}function s(I){return A(I,2)^A(I,13)^A(I,22)}function a(I){return A(I,6)^A(I,11)^A(I,25)}function n(I){return A(I,7)^A(I,18)^I>>>3}function r(I){return A(I,17)^A(I,19)^I>>>10}let g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function o(I,c,l){let h=1779033703,C=3144134277,B=1013904242,Q=2773480762,E=1359893119,f=2600822924,u=528734635,d=1541459225,x=Math.ceil((l+9)/64)*64,p=new Uint8Array(x),m,D;for(m=0;m<l;++m)p[m]=I[c++];p[m++]=128;let S=x-8;for(;m<S;)p[m++]=0;p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=l>>>29&255,p[m++]=l>>21&255,p[m++]=l>>13&255,p[m++]=l>>5&255,p[m++]=l<<3&255;let w=new Uint32Array(64);for(m=0;m<x;){for(D=0;D<16;++D)w[D]=p[m]<<24|p[m+1]<<16|p[m+2]<<8|p[m+3],m+=4;for(D=16;D<64;++D)w[D]=r(w[D-2])+w[D-7]+n(w[D-15])+w[D-16]|0;let Y=h,U=C,K=B,Z=Q,AA=E,gA=f,R=u,_=d,tA,IA;for(D=0;D<64;++D)tA=_+a(AA)+t(AA,gA,R)+g[D]+w[D],IA=s(Y)+i(Y,U,K),_=R,R=gA,gA=AA,AA=Z+tA|0,Z=K,K=U,U=Y,Y=tA+IA|0;h=h+Y|0,C=C+U|0,B=B+K|0,Q=Q+Z|0,E=E+AA|0,f=f+gA|0,u=u+R|0,d=d+_|0}return new Uint8Array([h>>24&255,h>>16&255,h>>8&255,h&255,C>>24&255,C>>16&255,C>>8&255,C&255,B>>24&255,B>>16&255,B>>8&255,B&255,Q>>24&255,Q>>16&255,Q>>8&255,Q&255,E>>24&255,E>>16&255,E>>8&255,E&255,f>>24&255,f>>16&255,f>>8&255,f&255,u>>24&255,u>>16&255,u>>8&255,u&255,d>>24&255,d>>16&255,d>>8&255,d&255])}return o}(),Sf=function(){function A(o,I,c,l,h){o.assign(I),o.and(c),h.assign(I),h.not(),h.and(l),o.xor(h)}function t(o,I,c,l,h){o.assign(I),o.and(c),h.assign(I),h.and(l),o.xor(h),h.assign(c),h.and(l),o.xor(h)}function i(o,I,c){o.assign(I),o.rotateRight(28),c.assign(I),c.rotateRight(34),o.xor(c),c.assign(I),c.rotateRight(39),o.xor(c)}function s(o,I,c){o.assign(I),o.rotateRight(14),c.assign(I),c.rotateRight(18),o.xor(c),c.assign(I),c.rotateRight(41),o.xor(c)}function a(o,I,c){o.assign(I),o.rotateRight(1),c.assign(I),c.rotateRight(8),o.xor(c),c.assign(I),c.shiftRight(7),o.xor(c)}function n(o,I,c){o.assign(I),o.rotateRight(19),c.assign(I),c.rotateRight(61),o.xor(c),c.assign(I),c.shiftRight(6),o.xor(c)}let r=[new sA(1116352408,3609767458),new sA(1899447441,602891725),new sA(3049323471,3964484399),new sA(3921009573,2173295548),new sA(961987163,4081628472),new sA(1508970993,3053834265),new sA(2453635748,2937671579),new sA(2870763221,3664609560),new sA(3624381080,2734883394),new sA(310598401,1164996542),new sA(607225278,1323610764),new sA(1426881987,3590304994),new sA(1925078388,4068182383),new sA(2162078206,991336113),new sA(2614888103,633803317),new sA(3248222580,3479774868),new sA(3835390401,2666613458),new sA(4022224774,944711139),new sA(264347078,2341262773),new sA(604807628,2007800933),new sA(770255983,1495990901),new sA(1249150122,1856431235),new sA(1555081692,3175218132),new sA(1996064986,2198950837),new sA(2554220882,3999719339),new sA(2821834349,766784016),new sA(2952996808,2566594879),new sA(3210313671,3203337956),new sA(3336571891,1034457026),new sA(3584528711,2466948901),new sA(113926993,3758326383),new sA(338241895,168717936),new sA(666307205,1188179964),new sA(773529912,1546045734),new sA(1294757372,1522805485),new sA(1396182291,2643833823),new sA(1695183700,2343527390),new sA(1986661051,1014477480),new sA(2177026350,1206759142),new sA(2456956037,344077627),new sA(2730485921,1290863460),new sA(2820302411,3158454273),new sA(3259730800,3505952657),new sA(3345764771,106217008),new sA(3516065817,3606008344),new sA(3600352804,1432725776),new sA(4094571909,1467031594),new sA(275423344,851169720),new sA(430227734,3100823752),new sA(506948616,1363258195),new sA(659060556,3750685593),new sA(883997877,3785050280),new sA(958139571,3318307427),new sA(1322822218,3812723403),new sA(1537002063,2003034995),new sA(1747873779,3602036899),new sA(1955562222,1575990012),new sA(2024104815,1125592928),new sA(2227730452,2716904306),new sA(2361852424,442776044),new sA(2428436474,593698344),new sA(2756734187,3733110249),new sA(3204031479,2999351573),new sA(3329325298,3815920427),new sA(3391569614,3928383900),new sA(3515267271,566280711),new sA(3940187606,3454069534),new sA(4118630271,4000239992),new sA(116418474,1914138554),new sA(174292421,2731055270),new sA(289380356,3203993006),new sA(460393269,320620315),new sA(685471733,587496836),new sA(852142971,1086792851),new sA(1017036298,365543100),new sA(1126000580,2618297676),new sA(1288033470,3409855158),new sA(1501505948,4234509866),new sA(1607167915,987167468),new sA(1816402316,1246189591)];function g(o,I,c,l=!1){let h,C,B,Q,E,f,u,d;l?(h=new sA(3418070365,3238371032),C=new sA(1654270250,914150663),B=new sA(2438529370,812702999),Q=new sA(355462360,4144912697),E=new sA(1731405415,4290775857),f=new sA(2394180231,1750603025),u=new sA(3675008525,1694076839),d=new sA(1203062813,3204075428)):(h=new sA(1779033703,4089235720),C=new sA(3144134277,2227873595),B=new sA(1013904242,4271175723),Q=new sA(2773480762,1595750129),E=new sA(1359893119,2917565137),f=new sA(2600822924,725511199),u=new sA(528734635,4215389547),d=new sA(1541459225,327033209));let x=Math.ceil((c+17)/128)*128,p=new Uint8Array(x),m,D;for(m=0;m<c;++m)p[m]=o[I++];p[m++]=128;let S=x-16;for(;m<S;)p[m++]=0;p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=0,p[m++]=c>>>29&255,p[m++]=c>>21&255,p[m++]=c>>13&255,p[m++]=c>>5&255,p[m++]=c<<3&255;let w=new Array(80);for(m=0;m<80;m++)w[m]=new sA(0,0);let Y=new sA(0,0),U=new sA(0,0),K=new sA(0,0),Z=new sA(0,0),AA=new sA(0,0),gA=new sA(0,0),R=new sA(0,0),_=new sA(0,0),tA=new sA(0,0),IA=new sA(0,0),QA=new sA(0,0),V=new sA(0,0),lA;for(m=0;m<x;){for(D=0;D<16;++D)w[D].high=p[m]<<24|p[m+1]<<16|p[m+2]<<8|p[m+3],w[D].low=p[m+4]<<24|p[m+5]<<16|p[m+6]<<8|p[m+7],m+=8;for(D=16;D<80;++D)lA=w[D],n(lA,w[D-2],V),lA.add(w[D-7]),a(QA,w[D-15],V),lA.add(QA),lA.add(w[D-16]);for(Y.assign(h),U.assign(C),K.assign(B),Z.assign(Q),AA.assign(E),gA.assign(f),R.assign(u),_.assign(d),D=0;D<80;++D)tA.assign(_),s(QA,AA,V),tA.add(QA),A(QA,AA,gA,R,V),tA.add(QA),tA.add(r[D]),tA.add(w[D]),i(IA,Y,V),t(QA,Y,U,K,V),IA.add(QA),lA=_,_=R,R=gA,gA=AA,Z.add(tA),AA=Z,Z=K,K=U,U=Y,lA.assign(tA),lA.add(IA),Y=lA;h.add(Y),C.add(U),B.add(K),Q.add(Z),E.add(AA),f.add(gA),u.add(R),d.add(_)}let EA;return l?(EA=new Uint8Array(48),h.copyTo(EA,0),C.copyTo(EA,8),B.copyTo(EA,16),Q.copyTo(EA,24),E.copyTo(EA,32),f.copyTo(EA,40)):(EA=new Uint8Array(64),h.copyTo(EA,0),C.copyTo(EA,8),B.copyTo(EA,16),Q.copyTo(EA,24),E.copyTo(EA,32),f.copyTo(EA,40),u.copyTo(EA,48),d.copyTo(EA,56)),EA}return g}();function M9(e,A,t){return Sf(e,A,t,!0)}var rc=class{decryptBlock(A){return A}encrypt(A){return A}},Ta=class{constructor(){this._s=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),this._inv_s=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),this._mix=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]),this._mixCol=new Uint8Array(256);for(let A=0;A<256;A++)this._mixCol[A]=A<128?A<<1:A<<1^27;this.buffer=new Uint8Array(16),this.bufferPosition=0}_expandKey(A){OA("Cannot call `_expandKey` on the base class")}_decrypt(A,t){let i,s,a,n=new Uint8Array(16);n.set(A);for(let r=0,g=this._keySize;r<16;++r,++g)n[r]^=t[g];for(let r=this._cyclesOfRepetition-1;r>=1;--r){i=n[13],n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=i,i=n[14],s=n[10],n[14]=n[6],n[10]=n[2],n[6]=i,n[2]=s,i=n[15],s=n[11],a=n[7],n[15]=n[3],n[11]=i,n[7]=s,n[3]=a;for(let g=0;g<16;++g)n[g]=this._inv_s[n[g]];for(let g=0,o=r*16;g<16;++g,++o)n[g]^=t[o];for(let g=0;g<16;g+=4){let o=this._mix[n[g]],I=this._mix[n[g+1]],c=this._mix[n[g+2]],l=this._mix[n[g+3]];i=o^I>>>8^I<<24^c>>>16^c<<16^l>>>24^l<<8,n[g]=i>>>24&255,n[g+1]=i>>16&255,n[g+2]=i>>8&255,n[g+3]=i&255}}i=n[13],n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=i,i=n[14],s=n[10],n[14]=n[6],n[10]=n[2],n[6]=i,n[2]=s,i=n[15],s=n[11],a=n[7],n[15]=n[3],n[11]=i,n[7]=s,n[3]=a;for(let r=0;r<16;++r)n[r]=this._inv_s[n[r]],n[r]^=t[r];return n}_encrypt(A,t){let i=this._s,s,a,n,r=new Uint8Array(16);r.set(A);for(let g=0;g<16;++g)r[g]^=t[g];for(let g=1;g<this._cyclesOfRepetition;g++){for(let o=0;o<16;++o)r[o]=i[r[o]];n=r[1],r[1]=r[5],r[5]=r[9],r[9]=r[13],r[13]=n,n=r[2],a=r[6],r[2]=r[10],r[6]=r[14],r[10]=n,r[14]=a,n=r[3],a=r[7],s=r[11],r[3]=r[15],r[7]=n,r[11]=a,r[15]=s;for(let o=0;o<16;o+=4){let I=r[o+0],c=r[o+1],l=r[o+2],h=r[o+3];s=I^c^l^h,r[o+0]^=s^this._mixCol[I^c],r[o+1]^=s^this._mixCol[c^l],r[o+2]^=s^this._mixCol[l^h],r[o+3]^=s^this._mixCol[h^I]}for(let o=0,I=g*16;o<16;++o,++I)r[o]^=t[I]}for(let g=0;g<16;++g)r[g]=i[r[g]];n=r[1],r[1]=r[5],r[5]=r[9],r[9]=r[13],r[13]=n,n=r[2],a=r[6],r[2]=r[10],r[6]=r[14],r[10]=n,r[14]=a,n=r[3],a=r[7],s=r[11],r[3]=r[15],r[7]=n,r[11]=a,r[15]=s;for(let g=0,o=this._keySize;g<16;++g,++o)r[g]^=t[o];return r}_decryptBlock2(A,t){let i=A.length,s=this.buffer,a=this.bufferPosition,n=[],r=this.iv;for(let I=0;I<i;++I){if(s[a]=A[I],++a,a<16)continue;let c=this._decrypt(s,this._key);for(let l=0;l<16;++l)c[l]^=r[l];r=s,n.push(c),s=new Uint8Array(16),a=0}if(this.buffer=s,this.bufferLength=a,this.iv=r,n.length===0)return new Uint8Array(0);let g=16*n.length;if(t){let I=n.at(-1),c=I[15];if(c<=16){for(let l=15,h=16-c;l>=h;--l)if(I[l]!==c){c=0;break}g-=c,n[n.length-1]=I.subarray(0,16-c)}}let o=new Uint8Array(g);for(let I=0,c=0,l=n.length;I<l;++I,c+=16)o.set(n[I],c);return o}decryptBlock(A,t,i=null){let s=A.length,a=this.buffer,n=this.bufferPosition;if(i)this.iv=i;else{for(let r=0;n<16&&r<s;++r,++n)a[n]=A[r];if(n<16)return this.bufferLength=n,new Uint8Array(0);this.iv=a,A=A.subarray(16)}return this.buffer=new Uint8Array(16),this.bufferLength=0,this.decryptBlock=this._decryptBlock2,this.decryptBlock(A,t)}encrypt(A,t){let i=A.length,s=this.buffer,a=this.bufferPosition,n=[];t||(t=new Uint8Array(16));for(let o=0;o<i;++o){if(s[a]=A[o],++a,a<16)continue;for(let c=0;c<16;++c)s[c]^=t[c];let I=this._encrypt(s,this._key);t=I,n.push(I),s=new Uint8Array(16),a=0}if(this.buffer=s,this.bufferLength=a,this.iv=t,n.length===0)return new Uint8Array(0);let r=16*n.length,g=new Uint8Array(r);for(let o=0,I=0,c=n.length;o<c;++o,I+=16)g.set(n[o],I);return g}},Xr=class extends Ta{constructor(A){super(),this._cyclesOfRepetition=10,this._keySize=160,this._rcon=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),this._key=this._expandKey(A)}_expandKey(A){let i=this._s,s=this._rcon,a=new Uint8Array(176);a.set(A);for(let n=16,r=1;n<176;++r){let g=a[n-3],o=a[n-2],I=a[n-1],c=a[n-4];g=i[g],o=i[o],I=i[I],c=i[c],g^=s[r];for(let l=0;l<4;++l)a[n]=g^=a[n-16],n++,a[n]=o^=a[n-16],n++,a[n]=I^=a[n-16],n++,a[n]=c^=a[n-16],n++}return a}},R0=class extends Ta{constructor(A){super(),this._cyclesOfRepetition=14,this._keySize=224,this._key=this._expandKey(A)}_expandKey(A){let i=this._s,s=new Uint8Array(240);s.set(A);let a=1,n,r,g,o;for(let I=32,c=1;I<240;++c){I%32===16?(n=i[n],r=i[r],g=i[g],o=i[o]):I%32===0&&(n=s[I-3],r=s[I-2],g=s[I-1],o=s[I-4],n=i[n],r=i[r],g=i[g],o=i[o],n^=a,(a<<=1)>=256&&(a=(a^27)&255));for(let l=0;l<4;++l)s[I]=n^=s[I-32],I++,s[I]=r^=s[I-32],I++,s[I]=g^=s[I-32],I++,s[I]=o^=s[I-32],I++}return s}},gc=class{checkOwnerPassword(A,t,i,s){let a=new Uint8Array(A.length+56);a.set(A,0),a.set(t,A.length),a.set(i,A.length+t.length);let n=ss(a,0,a.length);return Ss(n,s)}checkUserPassword(A,t,i){let s=new Uint8Array(A.length+8);s.set(A,0),s.set(t,A.length);let a=ss(s,0,s.length);return Ss(a,i)}getOwnerKey(A,t,i,s){let a=new Uint8Array(A.length+56);a.set(A,0),a.set(t,A.length),a.set(i,A.length+t.length);let n=ss(a,0,a.length);return new R0(n).decryptBlock(s,!1,new Uint8Array(16))}getUserKey(A,t,i){let s=new Uint8Array(A.length+8);s.set(A,0),s.set(t,A.length);let a=ss(s,0,s.length);return new R0(a).decryptBlock(i,!1,new Uint8Array(16))}},oc=class{_hash(A,t,i){let s=ss(t,0,t.length).subarray(0,32),a=[0],n=0;for(;n<64||a.at(-1)>n-32;){let r=A.length+s.length+i.length,g=new Uint8Array(r),o=0;g.set(A,o),o+=A.length,g.set(s,o),o+=s.length,g.set(i,o);let I=new Uint8Array(r*64);for(let h=0,C=0;h<64;h++,C+=r)I.set(g,C);a=new Xr(s.subarray(0,16)).encrypt(I,s.subarray(16,32));let l=a.slice(0,16).reduce((h,C)=>h+C,0)%3;l===0?s=ss(a,0,a.length):l===1?s=M9(a,0,a.length):l===2&&(s=Sf(a,0,a.length)),n++}return s.subarray(0,32)}checkOwnerPassword(A,t,i,s){let a=new Uint8Array(A.length+56);a.set(A,0),a.set(t,A.length),a.set(i,A.length+t.length);let n=this._hash(A,a,i);return Ss(n,s)}checkUserPassword(A,t,i){let s=new Uint8Array(A.length+8);s.set(A,0),s.set(t,A.length);let a=this._hash(A,s,[]);return Ss(a,i)}getOwnerKey(A,t,i,s){let a=new Uint8Array(A.length+56);a.set(A,0),a.set(t,A.length),a.set(i,A.length+t.length);let n=this._hash(A,a,i);return new R0(n).decryptBlock(s,!1,new Uint8Array(16))}getUserKey(A,t,i){let s=new Uint8Array(A.length+8);s.set(A,0),s.set(t,A.length);let a=this._hash(A,s,[]);return new R0(a).decryptBlock(i,!1,new Uint8Array(16))}},Vr=class{constructor(A,t){this.StringCipherConstructor=A,this.StreamCipherConstructor=t}createStream(A,t){let i=new this.StreamCipherConstructor;return new nc(A,t,function(a,n){return i.decryptBlock(a,n)})}decryptString(A){let t=new this.StringCipherConstructor,i=Pe(A);return i=t.decryptBlock(i,!0),Qt(i)}encryptString(A){let t=new this.StringCipherConstructor;if(t instanceof Ta){let a=16-A.length%16;A+=String.fromCharCode(a).repeat(a);let n=new Uint8Array(16);if(typeof crypto!="undefined")crypto.getRandomValues(n);else for(let o=0;o<16;o++)n[o]=Math.floor(256*Math.random());let r=Pe(A);r=t.encrypt(r,n);let g=new Uint8Array(16+r.length);return g.set(n),g.set(r,16),Qt(g)}let i=Pe(A);return i=t.encrypt(i),Qt(i)}},Q0,Jg,Ff,En,Ic,Yg,Rf,ws,Ir,fn,cc,cs=class{constructor(A,t,i){HA(this,Jg);HA(this,En);HA(this,Yg);HA(this,ws);HA(this,fn);let s=A.get("Filter");if(!ye(s,"Standard"))throw new v("unknown encryption method");this.filterName=s.name,this.dict=A;let a=A.get("V");if(!Number.isInteger(a)||a!==1&&a!==2&&a!==4&&a!==5)throw new v("unsupported encryption algorithm");this.algorithm=a;let n=A.get("Length");if(!n)if(a<=3)n=40;else{let E=A.get("CF"),f=A.get("StmF");if(E instanceof F&&f instanceof M){E.suppressEncryption=!0;let u=E.get(f.name);n=(u==null?void 0:u.get("Length"))||128,n<40&&(n<<=3)}}if(!Number.isInteger(n)||n<40||n%8!==0)throw new v("invalid key length");let r=Pe(A.get("O")),g=Pe(A.get("U")),o=r.subarray(0,32),I=g.subarray(0,32),c=A.get("P"),l=A.get("R"),h=(a===4||a===5)&&A.get("EncryptMetadata")!==!1;this.encryptMetadata=h;let C=Pe(t),B;if(i){if(l===6)try{i=Yo(i)}catch(E){k("CipherTransformFactory: Unable to convert UTF8 encoded password.")}B=Pe(i)}let Q;if(a!==5)Q=mA(this,En,Ic).call(this,C,B,o,I,c,l,n,h);else{let E=r.subarray(32,40),f=r.subarray(40,48),u=g.subarray(0,48),d=g.subarray(32,40),x=g.subarray(40,48),p=Pe(A.get("OE")),m=Pe(A.get("UE")),D=Pe(A.get("Perms"));Q=mA(this,Jg,Ff).call(this,l,B,o,E,f,u,I,d,x,p,m,D)}if(!Q&&!i)throw new bs("No password given",G1.NEED_PASSWORD);if(!Q&&i){let E=mA(this,Yg,Rf).call(this,B,o,l,n);Q=mA(this,En,Ic).call(this,C,E,o,I,c,l,n,h)}if(!Q)throw new bs("Incorrect Password",G1.INCORRECT_PASSWORD);if(this.encryptionKey=Q,a>=4){let E=A.get("CF");E instanceof F&&(E.suppressEncryption=!0),this.cf=E,this.stmf=A.get("StmF")||M.get("Identity"),this.strf=A.get("StrF")||M.get("Identity"),this.eff=A.get("EFF")||this.stmf}}createCipherTransform(A,t){if(this.algorithm===4||this.algorithm===5)return new Vr(mA(this,fn,cc).call(this,this.cf,this.strf,A,t,this.encryptionKey),mA(this,fn,cc).call(this,this.cf,this.stmf,A,t,this.encryptionKey));let i=mA(this,ws,Ir).call(this,A,t,this.encryptionKey,!1),s=function(){return new ci(i)};return new Vr(s,s)}},or=cs;Q0=new WeakMap,Jg=new WeakSet,Ff=function(A,t,i,s,a,n,r,g,o,I,c,l){if(t){let C=Math.min(127,t.length);t=t.subarray(0,C)}else t=[];let h=A===6?new oc:new gc;return h.checkUserPassword(t,g,r)?h.getUserKey(t,o,c):t.length&&h.checkOwnerPassword(t,s,n,i)?h.getOwnerKey(t,a,n,I):null},En=new WeakSet,Ic=function(A,t,i,s,a,n,r,g){let o=40+i.length+A.length,I=new Uint8Array(o),c=0,l,h;if(t)for(h=Math.min(32,t.length);c<h;++c)I[c]=t[c];for(l=0;c<32;)I[c++]=ne(cs,Q0)[l++];for(l=0,h=i.length;l<h;++l)I[c++]=i[l];for(I[c++]=a&255,I[c++]=a>>8&255,I[c++]=a>>16&255,I[c++]=a>>>24&255,l=0,h=A.length;l<h;++l)I[c++]=A[l];n>=4&&!g&&(I[c++]=255,I[c++]=255,I[c++]=255,I[c++]=255);let C=Ri(I,0,c),B=r>>3;if(n>=3)for(l=0;l<50;++l)C=Ri(C,0,B);let Q=C.subarray(0,B),E,f;if(n>=3){for(c=0;c<32;++c)I[c]=ne(cs,Q0)[c];for(l=0,h=A.length;l<h;++l)I[c++]=A[l];E=new ci(Q),f=E.encryptBlock(Ri(I,0,c)),h=Q.length;let u=new Uint8Array(h);for(l=1;l<=19;++l){for(let d=0;d<h;++d)u[d]=Q[d]^l;E=new ci(u),f=E.encryptBlock(f)}for(l=0,h=f.length;l<h;++l)if(s[l]!==f[l])return null}else for(E=new ci(Q),f=E.encryptBlock(ne(cs,Q0)),l=0,h=f.length;l<h;++l)if(s[l]!==f[l])return null;return Q},Yg=new WeakSet,Rf=function(A,t,i,s){let a=new Uint8Array(32),n=0,r=Math.min(32,A.length);for(;n<r;++n)a[n]=A[n];let g=0;for(;n<32;)a[n++]=ne(cs,Q0)[g++];let o=Ri(a,0,n),I=s>>3;if(i>=3)for(g=0;g<50;++g)o=Ri(o,0,o.length);let c,l;if(i>=3){l=t;let h=new Uint8Array(I);for(g=19;g>=0;g--){for(let C=0;C<I;++C)h[C]=o[C]^g;c=new ci(h),l=c.encryptBlock(l)}}else c=new ci(o.subarray(0,I)),l=c.encryptBlock(t);return l},ws=new WeakSet,Ir=function(A,t,i,s=!1){let a=new Uint8Array(i.length+9),n=i.length,r;for(r=0;r<n;++r)a[r]=i[r];return a[r++]=A&255,a[r++]=A>>8&255,a[r++]=A>>16&255,a[r++]=t&255,a[r++]=t>>8&255,s&&(a[r++]=115,a[r++]=65,a[r++]=108,a[r++]=84),Ri(a,0,r).subarray(0,Math.min(i.length+5,16))},fn=new WeakSet,cc=function(A,t,i,s,a){if(!(t instanceof M))throw new v("Invalid crypt filter name.");let n=this,r=A.get(t.name),g=r==null?void 0:r.get("CFM");if(!g||g.name==="None")return function(){return new rc};if(g.name==="V2")return function(){var o;return new ci(mA(o=n,ws,Ir).call(o,i,s,a,!1))};if(g.name==="AESV2")return function(){var o;return new Xr(mA(o=n,ws,Ir).call(o,i,s,a,!0))};if(g.name==="AESV3")return function(){return new R0(a)};throw new v("Unknown crypto method")},HA(or,Q0,new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]));async function ot(e,A,t,{encrypt:i=null}){let s=i==null?void 0:i.createCipherTransform(e.num,e.gen);t.push(`${e.num} ${e.gen} obj\n`),A instanceof F?await Ao(A,t,s):A instanceof KA?await Nf(A,t,s):(Array.isArray(A)||ArrayBuffer.isView(A))&&await Gf(A,t,s),t.push(`\nendobj\n`)}async function Ao(e,A,t){A.push("<<");for(let i of e.getKeys())A.push(` /${o1(i)} `),await Uf(e.getRaw(i),A,t);A.push(">>")}async function Nf(e,A,t){let i=e.getBytes(),{dict:s}=e,[a,n]=await Promise.all([s.getAsync("Filter"),s.getAsync("DecodeParms")]),r=Array.isArray(a)?await s.xref.fetchIfRefAsync(a[0]):a,g=ye(r,"FlateDecode"),o=256;if(i.length>=o||g)try{let c=new CompressionStream("deflate"),l=c.writable.getWriter();l.write(i),l.close();let h=await new Response(c.readable).arrayBuffer();i=new Uint8Array(h);let C,B;a?g||(C=Array.isArray(a)?[M.get("FlateDecode"),...a]:[M.get("FlateDecode"),a],n&&(B=Array.isArray(n)?[null,...n]:[null,n])):C=M.get("FlateDecode"),C&&s.set("Filter",C),B&&s.set("DecodeParms",B)}catch(c){PA(`writeStream - cannot compress data: "${c}".`)}let I=Qt(i);t&&(I=t.encryptString(I)),s.set("Length",I.length),await Ao(s,A,t),A.push(` stream\n`,I,`\nendstream`)}async function Gf(e,A,t){A.push("[");let i=!0;for(let s of e)i?i=!1:A.push(" "),await Uf(s,A,t);A.push("]")}async function Uf(e,A,t){e instanceof M?A.push(`/${o1(e.name)}`):e instanceof oA?A.push(`${e.num} ${e.gen} R`):Array.isArray(e)||ArrayBuffer.isView(e)?await Gf(e,A,t):typeof e=="string"?(t&&(e=t.encryptString(e)),A.push(`(${Fs(e)})`)):typeof e=="number"?A.push(Ae(e)):typeof e=="boolean"?A.push(e.toString()):e instanceof F?await Ao(e,A,t):e instanceof KA?await Nf(e,A,t):e===null?A.push("null"):k(`Unhandled value in writer: ${typeof e}, please file a bug.`)}function Fo(e,A,t,i){for(let s=A+t-1;s>t-1;s--)i[s]=e&255,e>>=8;return t+A}function Mf(e,A,t){for(let i=0,s=e.length;i<s;i++)t[A+i]=e.charCodeAt(i)&255}function L9(e,A){let t=Math.floor(Date.now()/1e3),i=A.filename||"",s=[t.toString(),i,e.toString()],a=s.reduce((g,o)=>g+o.length,0);for(let g of Object.values(A.info))s.push(g),a+=g.length;let n=new Uint8Array(a),r=0;for(let g of s)Mf(g,r,n),r+=g.length;return Qt(Ri(n))}function H9(e,A){let t=new Ls({hasAttributes:!0}).parseFromString(e);for(let{xfa:s}of A){if(!s)continue;let{path:a,value:n}=s;if(!a)continue;let r=_E(a),g=t.documentElement.searchNode(r,0);!g&&r.length>1&&(g=t.documentElement.searchNode([r.at(-1)],0)),g?g.childNodes=Array.isArray(n)?n.map(o=>new u0("value",o)):[new u0("#text",n)]:k(`Node not found for path: ${a}`)}let i=[];return t.documentElement.dump(i),i.join("")}async function J9({xref:e,acroForm:A,acroFormRef:t,hasXfa:i,hasXfaDatasetsEntry:s,xfaDatasetsRef:a,needAppearances:n,newRefs:r}){if(i&&!s&&!a&&k("XFA - Cannot save it"),!n&&(!i||!a||s))return;let g=A.clone();if(i&&!s){let I=A.get("XFA").slice();I.splice(2,0,"datasets"),I.splice(3,0,a),g.set("XFA",I)}n&&g.set("NeedAppearances",!0);let o=[];await ot(t,g,o,e),r.push({ref:t,data:o.join("")})}function Y9({xfaData:e,xfaDatasetsRef:A,newRefs:t,xref:i}){if(e===null){let n=i.fetchIfRef(A);e=H9(n.getString(),t)}let s=i.encrypt;s&&(e=s.createCipherTransform(A.num,A.gen).encryptString(e));let a=`${A.num} ${A.gen} obj\n<< /Type /EmbeddedFile /Length ${e.length}>>\nstream\n`+e+`\nendstream\nendobj\n`;t.push({ref:A,data:a})}async function K9(e,A,t,i,s){s.push(`xref\n`);let a=Lf(t),n=0;for(let{ref:r,data:g}of t)r.num===a[n]&&(s.push(`${a[n]} ${a[n+1]}\n`),n+=2),g!==null?(s.push(`${A.toString().padStart(10,"0")} ${Math.min(r.gen,65535).toString().padStart(5,"0")} n\\r\n`),A+=g.length):s.push(`0000000000 ${Math.min(r.gen+1,65535).toString().padStart(5,"0")} f\\r\n`);Hf(A,e,i),s.push(`trailer\n`),await Ao(i,s),s.push(`\nstartxref\n`,A.toString(),`\n%%EOF\n`)}function Lf(e){let A=[];for(let{ref:t}of e)t.num===A.at(-2)+A.at(-1)?A[A.length-1]+=1:A.push(t.num,1);return A}async function v9(e,A,t,i,s){let a=[],n=0,r=0;for(let{ref:B,data:Q}of t){let E;n=Math.max(n,A),Q!==null?(E=Math.min(B.gen,65535),a.push([1,A,E]),A+=Q.length):(E=Math.min(B.gen+1,65535),a.push([0,0,E])),r=Math.max(r,E)}i.set("Index",Lf(t));let g=M1(n),o=M1(r),I=[1,g,o];i.set("W",I),Hf(A,e,i);let c=I.reduce((B,Q)=>B+Q,0),l=new Uint8Array(c*a.length),h=new Ie(l);h.dict=i;let C=0;for(let[B,Q,E]of a)C=Fo(B,I[0],C,l),C=Fo(Q,I[1],C,l),C=Fo(E,I[2],C,l);await ot(e.newRef,h,s,{}),s.push(`startxref\n`,A.toString(),`\n%%EOF\n`)}function Hf(e,A,t){if(Array.isArray(A.fileIds)&&A.fileIds.length>0){let i=L9(e,A);t.set("ID",[A.fileIds[0],i])}}function q9(e,A,t){let i=new F(null);i.set("Prev",e.startXRef);let s=e.newRef;return t?(A.push({ref:s,data:""}),i.set("Size",s.num+1),i.set("Type",M.get("XRef"))):i.set("Size",s.num),e.rootRef!==null&&i.set("Root",e.rootRef),e.infoRef!==null&&i.set("Info",e.infoRef),e.encryptRef!==null&&i.set("Encrypt",e.encryptRef),i}async function T9({originalData:e,xrefInfo:A,newRefs:t,xref:i=null,hasXfa:s=!1,xfaDatasetsRef:a=null,hasXfaDatasetsEntry:n=!1,needAppearances:r,acroFormRef:g=null,acroForm:o=null,xfaData:I=null,useXrefStream:c=!1}){await J9({xref:i,acroForm:o,acroFormRef:g,hasXfa:s,hasXfaDatasetsEntry:n,xfaDatasetsRef:a,needAppearances:r,newRefs:t}),s&&Y9({xfaData:I,xfaDatasetsRef:a,newRefs:t,xref:i});let l=[],h=e.length,C=e.at(-1);C!==10&&C!==13&&(l.push(`\n`),h+=1);let B=q9(A,t,c);t=t.sort((u,d)=>u.ref.num-d.ref.num);for(let{data:u}of t)u!==null&&l.push(u);await(c?v9(A,h,t,B,l):K9(A,h,t,B,l));let Q=l.reduce((u,d)=>u+d.length,e.length),E=new Uint8Array(Q);E.set(e);let f=e.length;for(let u of l)Mf(u,f,E),f+=u.length;return E}var wE=40,Nt={PAGE_CONTENT:1,STREAM_CONTENT:2,OBJECT:3,ANNOTATION:4,ELEMENT:5},Kg,Jf,un,lc,vg,Yf,qg,Kf,Tg=class{constructor(A,t){HA(this,Kg);this.dict=A,this.ref=t instanceof oA?t:null,this.roleMap=new Map,this.structParentIds=null}init(){this.readRoleMap()}addAnnotationIdToPage(A,t){mA(this,Kg,Jf).call(this,A,t,Nt.ANNOTATION)}readRoleMap(){let A=this.dict.get("RoleMap");A instanceof F&&A.forEach((t,i)=>{i instanceof M&&this.roleMap.set(t,i.name)})}static async canCreateStructureTree({catalogRef:A,pdfManager:t,newAnnotationsByPage:i}){var n;if(!(A instanceof oA))return k("Cannot save the struct tree: no catalog reference."),!1;let s=0,a=!0;for(let[r,g]of i){let{ref:o}=await t.getPage(r);if(!(o instanceof oA)){k(`Cannot save the struct tree: page ${r} has no ref.`),a=!0;break}for(let I of g)(n=I.accessibilityData)!=null&&n.type&&(I.parentTreeId=s++,a=!1)}if(a){for(let r of i.values())for(let g of r)delete g.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:A,xref:t,catalogRef:i,pdfManager:s,newRefs:a}){let n=s.catalog.cloneDict(),r=new mt;r.put(i,n);let g=t.getNewTemporaryRef();n.set("StructTreeRoot",g);let o=new F(t);o.set("Type",M.get("StructTreeRoot"));let I=t.getNewTemporaryRef();o.set("ParentTree",I);let c=[];o.set("K",c),r.put(g,o);let l=new F(t),h=[];l.set("Nums",h);let C=await mA(this,un,lc).call(this,{newAnnotationsByPage:A,structTreeRootRef:g,kids:c,nums:h,xref:t,pdfManager:s,cache:r});o.set("ParentTreeNextKey",C),r.put(I,l);let B=[];for(let[Q,E]of r.items())B.length=0,await ot(Q,E,B,t),a.push({ref:Q,data:B.join("")})}async canUpdateStructTree({pdfManager:A,xref:t,newAnnotationsByPage:i}){var o,I;if(!this.ref)return k("Cannot update the struct tree: no root reference."),!1;let s=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(s)||s<0)return k("Cannot update the struct tree: invalid next key."),!1;let a=this.dict.get("ParentTree");if(!(a instanceof F))return k("Cannot update the struct tree: ParentTree isn\'t a dict."),!1;let n=a.get("Nums");if(!Array.isArray(n))return k("Cannot update the struct tree: nums isn\'t an array."),!1;let r=new va(a,t);for(let c of i.keys()){let{pageDict:l}=await A.getPage(c);if(!l.has("StructParents"))continue;let h=l.get("StructParents");if(!Number.isInteger(h)||!Array.isArray(r.get(h)))return k(`Cannot save the struct tree: page ${c} has a wrong id.`),!1}let g=!0;for(let[c,l]of i){let{pageDict:h}=await A.getPage(c);mA(o=Tg,vg,Yf).call(o,{elements:l,xref:this.dict.xref,pageDict:h,numberTree:r});for(let C of l)(I=C.accessibilityData)!=null&&I.type&&(C.parentTreeId=s++,g=!1)}if(g){for(let c of i.values())for(let l of c)delete l.parentTreeId,delete l.structTreeParent;return!1}return!0}async updateStructureTree({newAnnotationsByPage:A,pdfManager:t,newRefs:i}){var C;let s=this.dict.xref,a=this.dict.clone(),n=this.ref,r=new mt;r.put(n,a);let g=a.getRaw("ParentTree"),o;g instanceof oA?o=s.fetch(g):(o=g,g=s.getNewTemporaryRef(),a.set("ParentTree",g)),o=o.clone(),r.put(g,o);let I=o.getRaw("Nums"),c=null;I instanceof oA&&(c=I,I=s.fetch(c)),I=I.slice(),c||o.set("Nums",I);let l=await mA(C=Tg,un,lc).call(C,{newAnnotationsByPage:A,structTreeRootRef:n,kids:null,nums:I,xref:s,pdfManager:t,cache:r});a.set("ParentTreeNextKey",l),c&&r.put(c,I);let h=[];for(let[B,Q]of r.items())h.length=0,await ot(B,Q,h,s),i.push({ref:B,data:h.join("")})}},Ui=Tg;Kg=new WeakSet,Jf=function(A,t,i){if(!(A instanceof oA)||t<0)return;this.structParentIds||(this.structParentIds=new mt);let s=this.structParentIds.get(A);s||(s=[],this.structParentIds.put(A,s)),s.push([t,i])},un=new WeakSet,lc=async function({newAnnotationsByPage:A,structTreeRootRef:t,kids:i,nums:s,xref:a,pdfManager:n,cache:r}){let g=M.get("OBJR"),o=-1/0;for(let[I,c]of A){let{ref:l}=await n.getPage(I),h=l instanceof oA;for(let{accessibilityData:C,ref:B,parentTreeId:Q,structTreeParent:E}of c){if(!(C!=null&&C.type))continue;let{type:f,title:u,lang:d,alt:x,expanded:p,actualText:m}=C;o=Math.max(o,Q);let D=a.getNewTemporaryRef(),S=new F(a);S.set("S",M.get(f)),u&&S.set("T",ii(u)),d&&S.set("Lang",d),x&&S.set("Alt",ii(x)),p&&S.set("E",ii(p)),m&&S.set("ActualText",ii(m)),await mA(this,qg,Kf).call(this,{structTreeParent:E,tagDict:S,newTagRef:D,structTreeRootRef:t,fallbackKids:i,xref:a,cache:r});let w=new F(a);S.set("K",w),w.set("Type",g),h&&w.set("Pg",l),w.set("Obj",B),r.put(D,S),s.push(Q,D)}}return o+1},vg=new WeakSet,Yf=function({elements:A,xref:t,pageDict:i,numberTree:s}){let a=new Map;for(let o of A)if(o.structTreeParentId){let I=parseInt(o.structTreeParentId.split("_mc")[1],10),c=a.get(I);c||(c=[],a.set(I,c)),c.push(o)}let n=i.get("StructParents");if(!Number.isInteger(n))return;let r=s.get(n),g=(o,I,c)=>{let l=a.get(o);if(l){let h=I.getRaw("P"),C=t.fetchIfRef(h);if(h instanceof oA&&C instanceof F){let B={ref:c,dict:I};for(let Q of l)Q.structTreeParent=B}return!0}return!1};for(let o of r){if(!(o instanceof oA))continue;let I=t.fetch(o),c=I.get("K");if(Number.isInteger(c)){g(c,I,o);continue}if(Array.isArray(c))for(let l of c){if(l=t.fetchIfRef(l),Number.isInteger(l)&&g(l,I,o))break;if(!(l instanceof F))continue;if(!ye(l.get("Type"),"MCR"))break;let h=l.get("MCID");if(Number.isInteger(h)&&g(h,I,o))break}}},qg=new WeakSet,Kf=async function({structTreeParent:A,tagDict:t,newTagRef:i,structTreeRootRef:s,fallbackKids:a,xref:n,cache:r}){let g=null,o;A?({ref:g}=A,o=A.dict.getRaw("P")||s):o=s,t.set("P",o);let I=n.fetchIfRef(o);if(!I){a.push(i);return}let c=r.get(o);c||(c=I.clone(),r.put(o,c));let l=c.getRaw("K"),h=l instanceof oA?r.get(l):null;if(!h){h=n.fetchIfRef(l),h=Array.isArray(h)?h.slice():[l];let B=n.getNewTemporaryRef();c.set("K",B),r.put(B,h)}let C=h.indexOf(g);h.splice(C>=0?C+1:h.length,0,i)},HA(Ui,un),HA(Ui,vg),HA(Ui,qg);var hc=class{constructor(A,t){this.tree=A,this.dict=t,this.kids=[],this.parseKids()}get role(){let A=this.dict.get("S"),t=A instanceof M?A.name:"",{root:i}=this.tree;return i.roleMap.has(t)?i.roleMap.get(t):t}parseKids(){let A=null,t=this.dict.getRaw("Pg");t instanceof oA&&(A=t.toString());let i=this.dict.get("K");if(Array.isArray(i))for(let s of i){let a=this.parseKid(A,s);a&&this.kids.push(a)}else{let s=this.parseKid(A,i);s&&this.kids.push(s)}}parseKid(A,t){if(Number.isInteger(t))return this.tree.pageDict.objId!==A?null:new as({type:Nt.PAGE_CONTENT,mcid:t,pageObjId:A});let i=null;if(t instanceof oA?i=this.dict.xref.fetch(t):t instanceof F&&(i=t),!i)return null;let s=i.getRaw("Pg");s instanceof oA&&(A=s.toString());let a=i.get("Type")instanceof M?i.get("Type").name:null;if(a==="MCR"){if(this.tree.pageDict.objId!==A)return null;let n=i.getRaw("Stm");return new as({type:Nt.STREAM_CONTENT,refObjId:n instanceof oA?n.toString():null,pageObjId:A,mcid:i.get("MCID")})}if(a==="OBJR"){if(this.tree.pageDict.objId!==A)return null;let n=i.getRaw("Obj");return new as({type:Nt.OBJECT,refObjId:n instanceof oA?n.toString():null,pageObjId:A})}return new as({type:Nt.ELEMENT,dict:i})}},as=class{constructor({type:A,dict:t=null,mcid:i=null,pageObjId:s=null,refObjId:a=null}){this.type=A,this.dict=t,this.mcid=i,this.pageObjId=s,this.refObjId=a,this.parentNode=null}},Cc=class{constructor(A,t){this.root=A,this.rootDict=A?A.dict:null,this.pageDict=t,this.nodes=[]}parse(A){var r,g;if(!this.root||!this.rootDict)return;let t=this.rootDict.get("ParentTree");if(!t)return;let i=this.pageDict.get("StructParents"),s=A instanceof oA&&((r=this.root.structParentIds)==null?void 0:r.get(A));if(!Number.isInteger(i)&&!s)return;let a=new Map,n=new va(t,this.rootDict.xref);if(Number.isInteger(i)){let o=n.get(i);if(Array.isArray(o))for(let I of o)I instanceof oA&&this.addNode(this.rootDict.xref.fetch(I),a)}if(s)for(let[o,I]of s){let c=n.get(o);if(c){let l=this.addNode(this.rootDict.xref.fetchIfRef(c),a);((g=l==null?void 0:l.kids)==null?void 0:g.length)===1&&l.kids[0].type===Nt.OBJECT&&(l.kids[0].type=I)}}}addNode(A,t,i=0){if(i>wE)return k("StructTree MAX_DEPTH reached."),null;if(!(A instanceof F))return null;if(t.has(A))return t.get(A);let s=new hc(this,A);t.set(A,s);let a=A.get("P");if(!a||ye(a.get("Type"),"StructTreeRoot"))return this.addTopLevelNode(A,s)||t.delete(A),s;let n=this.addNode(a,t,i+1);if(!n)return s;let r=!1;for(let g of n.kids)g.type===Nt.ELEMENT&&g.dict===A&&(g.parentNode=s,r=!0);return r||t.delete(A),s}addTopLevelNode(A,t){let i=this.rootDict.get("K");if(!i)return!1;if(i instanceof F)return i.objId!==A.objId?!1:(this.nodes[0]=t,!0);if(!Array.isArray(i))return!0;let s=!1;for(let a=0;a<i.length;a++){let n=i[a];(n==null?void 0:n.toString())===A.objId&&(this.nodes[a]=t,s=!0)}return s}get serializable(){function A(i,s,a=0){if(a>wE){k("StructTree too deep to be fully serialized.");return}let n=Object.create(null);n.role=i.role,n.children=[],s.children.push(n);let r=i.dict.get("Alt");typeof r=="string"&&(n.alt=jA(r));let g=i.dict.get("Lang");typeof g=="string"&&(n.lang=jA(g));for(let o of i.kids){let I=o.type===Nt.ELEMENT?o.parentNode:null;if(I){A(I,n,a+1);continue}else o.type===Nt.PAGE_CONTENT||o.type===Nt.STREAM_CONTENT?n.children.push({type:"content",id:`p${o.pageObjId}_mc${o.mcid}`}):o.type===Nt.OBJECT?n.children.push({type:"object",id:o.refObjId}):o.type===Nt.ANNOTATION&&n.children.push({type:"annotation",id:`${Yu}${o.refObjId}`})}}let t=Object.create(null);t.children=[],t.role="Root";for(let i of this.nodes)i&&A(i,t);return t}};function f1(e){if(!Array.isArray(e)||e.length<2)return!1;let[A,t,...i]=e;if(!(A instanceof oA)&&!Number.isInteger(A)||!(t instanceof M))return!1;let s=i.length,a=!0;switch(t.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;a=!1;break;default:return!1}for(let n of i)if(!(typeof n=="number"||a&&n===null))return!1;return!0}function On(e){return e instanceof F&&(e=e.get("D")),f1(e)?e:null}function yE(e){let A=e.get("D");if(A){if(A instanceof M&&(A=A.name),typeof A=="string")return jA(A);if(f1(A))return JSON.stringify(A)}return null}var Pg,vf,Wg,qf,Og=class{constructor(A,t){HA(this,Pg);HA(this,Wg);if(this.pdfManager=A,this.xref=t,this._catDict=t.getCatalogObj(),!(this._catDict instanceof F))throw new v("Catalog object is not a dictionary.");this.toplevelPagesDict,this._actualNumPages=null,this.fontCache=new mt,this.builtInCMapCache=new Map,this.standardFontDataCache=new Map,this.globalImageCache=new z0,this.pageKidsCountCache=new mt,this.pageIndexCache=new mt,this.pageDictCache=new mt,this.nonBlendModesSet=new be,this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){let A=this._catDict.get("Version");if(A instanceof M){if(XE.test(A.name))return nA(this,"version",A.name);k(`Invalid PDF catalog version: ${A.name}`)}return nA(this,"version",null)}get lang(){let A=this._catDict.get("Lang");return nA(this,"lang",A&&typeof A=="string"?jA(A):null)}get needsRendering(){let A=this._catDict.get("NeedsRendering");return nA(this,"needsRendering",typeof A=="boolean"?A:!1)}get collection(){let A=null;try{let t=this._catDict.get("Collection");t instanceof F&&t.size>0&&(A=t)}catch(t){if(t instanceof ge)throw t;PA("Cannot fetch Collection entry; assuming no collection is present.")}return nA(this,"collection",A)}get acroForm(){let A=null;try{let t=this._catDict.get("AcroForm");t instanceof F&&t.size>0&&(A=t)}catch(t){if(t instanceof ge)throw t;PA("Cannot fetch AcroForm entry; assuming no forms are present.")}return nA(this,"acroForm",A)}get acroFormRef(){let A=this._catDict.getRaw("AcroForm");return nA(this,"acroFormRef",A instanceof oA?A:null)}get metadata(){var i;let A=this._catDict.getRaw("Metadata");if(!(A instanceof oA))return nA(this,"metadata",null);let t=null;try{let s=this.xref.fetch(A,!((i=this.xref.encrypt)!=null&&i.encryptMetadata));if(s instanceof KA&&s.dict instanceof F){let a=s.dict.get("Type"),n=s.dict.get("Subtype");if(ye(a,"Metadata")&&ye(n,"XML")){let r=ka(s.getString());r&&(t=new ac(r).serializable)}}}catch(s){if(s instanceof ge)throw s;PA(`Skipping invalid Metadata: "${s}".`)}return nA(this,"metadata",t)}get markInfo(){let A=null;try{A=this._readMarkInfo()}catch(t){if(t instanceof ge)throw t;k("Unable to read mark info.")}return nA(this,"markInfo",A)}_readMarkInfo(){let A=this._catDict.get("MarkInfo");if(!(A instanceof F))return null;let t={Marked:!1,UserProperties:!1,Suspects:!1};for(let i in t){let s=A.get(i);typeof s=="boolean"&&(t[i]=s)}return t}get structTreeRoot(){let A=null;try{A=this._readStructTreeRoot()}catch(t){if(t instanceof ge)throw t;k("Unable read to structTreeRoot info.")}return nA(this,"structTreeRoot",A)}_readStructTreeRoot(){let A=this._catDict.getRaw("StructTreeRoot"),t=this.xref.fetchIfRef(A);if(!(t instanceof F))return null;let i=new Ui(t,A);return i.init(),i}get toplevelPagesDict(){let A=this._catDict.get("Pages");if(!(A instanceof F))throw new v("Invalid top-level pages dictionary.");return nA(this,"toplevelPagesDict",A)}get documentOutline(){let A=null;try{A=this._readDocumentOutline()}catch(t){if(t instanceof ge)throw t;k("Unable to read document outline.")}return nA(this,"documentOutline",A)}_readDocumentOutline(){let A=this._catDict.get("Outlines");if(!(A instanceof F)||(A=A.getRaw("First"),!(A instanceof oA)))return null;let t={items:[]},i=[{obj:A,parent:t}],s=new be;s.put(A);let a=this.xref,n=new Uint8ClampedArray(3);for(;i.length>0;){let r=i.shift(),g=a.fetchIfRef(r.obj);if(g===null)continue;g.has("Title")||k("Invalid outline item encountered.");let o={url:null,dest:null,action:null};Og.parseDestDictionary({destDict:g,resultObj:o,docBaseUrl:this.baseUrl,docAttachments:this.attachments});let I=g.get("Title"),c=g.get("F")||0,l=g.getArray("C"),h=g.get("Count"),C=n;wt(l,3)&&(l[0]!==0||l[1]!==0||l[2]!==0)&&(C=JA.singletons.rgb.getRgb(l,0));let B={action:o.action,attachment:o.attachment,dest:o.dest,url:o.url,unsafeUrl:o.unsafeUrl,newWindow:o.newWindow,setOCGState:o.setOCGState,title:typeof I=="string"?jA(I):"",color:C,count:Number.isInteger(h)?h:void 0,bold:!!(c&2),italic:!!(c&1),items:[]};r.parent.items.push(B),A=g.getRaw("First"),A instanceof oA&&!s.has(A)&&(i.push({obj:A,parent:B}),s.put(A)),A=g.getRaw("Next"),A instanceof oA&&!s.has(A)&&(i.push({obj:A,parent:r.parent}),s.put(A))}return t.items.length>0?t.items:null}get permissions(){let A=null;try{A=this._readPermissions()}catch(t){if(t instanceof ge)throw t;k("Unable to read permissions.")}return nA(this,"permissions",A)}_readPermissions(){let A=this.xref.trailer.get("Encrypt");if(!(A instanceof F))return null;let t=A.get("P");if(typeof t!="number")return null;t+=2**32;let i=[];for(let s in N1){let a=N1[s];t&a&&i.push(a)}return i}get optionalContentConfig(){let A=null;try{let t=this._catDict.get("OCProperties");if(!t)return nA(this,"optionalContentConfig",null);let i=t.get("D");if(!i)return nA(this,"optionalContentConfig",null);let s=t.get("OCGs");if(!Array.isArray(s))return nA(this,"optionalContentConfig",null);let a=[],n=new be;for(let r of s)!(r instanceof oA)||n.has(r)||(n.put(r),a.push(mA(this,Pg,vf).call(this,r)));A=mA(this,Wg,qf).call(this,i,n),A.groups=a}catch(t){if(t instanceof ge)throw t;k(`Unable to read optional content config: ${t}`)}return nA(this,"optionalContentConfig",A)}setActualNumPages(A=null){this._actualNumPages=A}get hasActualNumPages(){return this._actualNumPages!==null}get _pagesCount(){let A=this.toplevelPagesDict.get("Count");if(!Number.isInteger(A))throw new v("Page count in top-level pages dictionary is not an integer.");return nA(this,"_pagesCount",A)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){let A=this._readDests(),t=Object.create(null);if(A instanceof Fi)for(let[i,s]of A.getAll()){let a=On(s);a&&(t[jA(i)]=a)}else A instanceof F&&A.forEach(function(i,s){let a=On(s);a&&(t[i]=a)});return nA(this,"destinations",t)}getDestination(A){let t=this._readDests();if(t instanceof Fi){let i=On(t.get(A));if(i)return i;let s=this.destinations[A];if(s)return k(`Found "${A}" at an incorrect position in the NameTree.`),s}else if(t instanceof F){let i=On(t.get(A));if(i)return i}return null}_readDests(){let A=this._catDict.get("Names");if(A!=null&&A.has("Dests"))return new Fi(A.getRaw("Dests"),this.xref);if(this._catDict.has("Dests"))return this._catDict.get("Dests")}get pageLabels(){let A=null;try{A=this._readPageLabels()}catch(t){if(t instanceof ge)throw t;k("Unable to read page labels.")}return nA(this,"pageLabels",A)}_readPageLabels(){let A=this._catDict.getRaw("PageLabels");if(!A)return null;let t=new Array(this.numPages),i=null,s="",n=new va(A,this.xref).getAll(),r="",g=1;for(let o=0,I=this.numPages;o<I;o++){let c=n.get(o);if(c!==void 0){if(!(c instanceof F))throw new v("PageLabel is not a dictionary.");if(c.has("Type")&&!ye(c.get("Type"),"PageLabel"))throw new v("Invalid type in PageLabel dictionary.");if(c.has("S")){let l=c.get("S");if(!(l instanceof M))throw new v("Invalid style in PageLabel dictionary.");i=l.name}else i=null;if(c.has("P")){let l=c.get("P");if(typeof l!="string")throw new v("Invalid prefix in PageLabel dictionary.");s=jA(l)}else s="";if(c.has("St")){let l=c.get("St");if(!(Number.isInteger(l)&&l>=1))throw new v("Invalid start in PageLabel dictionary.");g=l}else g=1}switch(i){case"D":r=g;break;case"R":case"r":r=qu(g,i==="r");break;case"A":case"a":let l=26,B=i==="a"?97:65,Q=g-1;r=String.fromCharCode(B+Q%l).repeat(Math.floor(Q/l)+1);break;default:if(i)throw new v(`Invalid style "${i}" in PageLabel dictionary.`);r=""}t[o]=s+r,g++}return t}get pageLayout(){let A=this._catDict.get("PageLayout"),t="";if(A instanceof M)switch(A.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":t=A.name}return nA(this,"pageLayout",t)}get pageMode(){let A=this._catDict.get("PageMode"),t="UseNone";if(A instanceof M)switch(A.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=A.name}return nA(this,"pageMode",t)}get viewerPreferences(){let A=this._catDict.get("ViewerPreferences");if(!(A instanceof F))return nA(this,"viewerPreferences",null);let t=null;for(let i of A.getKeys()){let s=A.get(i),a;switch(i){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":typeof s=="boolean"&&(a=s);break;case"NonFullScreenPageMode":if(s instanceof M)switch(s.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":a=s.name;break;default:a="UseNone"}break;case"Direction":if(s instanceof M)switch(s.name){case"L2R":case"R2L":a=s.name;break;default:a="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(s instanceof M)switch(s.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":a=s.name;break;default:a="CropBox"}break;case"PrintScaling":if(s instanceof M)switch(s.name){case"None":case"AppDefault":a=s.name;break;default:a="AppDefault"}break;case"Duplex":if(s instanceof M)switch(s.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":a=s.name;break;default:a="None"}break;case"PrintPageRange":Array.isArray(s)&&s.length%2===0&&s.every((r,g,o)=>Number.isInteger(r)&&r>0&&(g===0||r>=o[g-1])&&r<=this.numPages)&&(a=s);break;case"NumCopies":Number.isInteger(s)&&s>0&&(a=s);break;default:k(`Ignoring non-standard key in ViewerPreferences: ${i}.`);continue}if(a===void 0){k(`Bad value, for key "${i}", in ViewerPreferences: ${s}.`);continue}t||(t=Object.create(null)),t[i]=a}return nA(this,"viewerPreferences",t)}get openAction(){let A=this._catDict.get("OpenAction"),t=Object.create(null);if(A instanceof F){let i=new F(this.xref);i.set("A",A);let s={url:null,dest:null,action:null};Og.parseDestDictionary({destDict:i,resultObj:s}),Array.isArray(s.dest)?t.dest=s.dest:s.action&&(t.action=s.action)}else Array.isArray(A)&&(t.dest=A);return nA(this,"openAction",OE(t)>0?t:null)}get attachments(){let A=this._catDict.get("Names"),t=null;if(A instanceof F&&A.has("EmbeddedFiles")){let i=new Fi(A.getRaw("EmbeddedFiles"),this.xref);for(let[s,a]of i.getAll()){let n=new qa(a,this.xref);t||(t=Object.create(null)),t[jA(s)]=n.serializable}}return nA(this,"attachments",t)}get xfaImages(){let A=this._catDict.get("Names"),t=null;if(A instanceof F&&A.has("XFAImages")){let i=new Fi(A.getRaw("XFAImages"),this.xref);for(let[s,a]of i.getAll())t||(t=new F(this.xref)),t.set(jA(s),a)}return nA(this,"xfaImages",t)}_collectJavaScript(){let A=this._catDict.get("Names"),t=null;function i(a,n){if(!(n instanceof F)||!ye(n.get("S"),"JavaScript"))return;let r=n.get("JS");if(r instanceof KA)r=r.getString();else if(typeof r!="string")return;r=jA(r).replaceAll("\\0",""),r&&(t||(t=new Map)).set(a,r)}if(A instanceof F&&A.has("JavaScript")){let a=new Fi(A.getRaw("JavaScript"),this.xref);for(let[n,r]of a.getAll())i(jA(n),r)}let s=this._catDict.get("OpenAction");return s&&i("OpenAction",s),t}get jsActions(){let A=this._collectJavaScript(),t=Vg(this.xref,this._catDict,Fu);if(A){t||(t=Object.create(null));for(let[i,s]of A)i in t?t[i].push(s):t[i]=[s]}return nA(this,"jsActions",t)}async fontFallback(A,t){let i=await Promise.all(this.fontCache);for(let s of i)if(s.loadedName===A){s.fallback(t);return}}async cleanup(A=!1){E1(),this.globalImageCache.clear(A),this.pageKidsCountCache.clear(),this.pageIndexCache.clear(),this.pageDictCache.clear(),this.nonBlendModesSet.clear();let t=await Promise.all(this.fontCache);for(let{dict:i}of t)delete i.cacheKey;this.fontCache.clear(),this.builtInCMapCache.clear(),this.standardFontDataCache.clear(),this.systemFontCache.clear()}async getPageDict(A){let t=[this.toplevelPagesDict],i=new be,s=this._catDict.getRaw("Pages");s instanceof oA&&i.put(s);let a=this.xref,n=this.pageKidsCountCache,r=this.pageIndexCache,g=this.pageDictCache,o=0;for(;t.length;){let I=t.pop();if(I instanceof oA){let C=n.get(I);if(C>=0&&o+C<=A){o+=C;continue}if(i.has(I))throw new v("Pages tree contains circular reference.");i.put(I);let B=await(g.get(I)||a.fetchAsync(I));if(B instanceof F){let Q=B.getRaw("Type");if(Q instanceof oA&&(Q=await a.fetchAsync(Q)),ye(Q,"Page")||!B.has("Kids")){if(n.has(I)||n.put(I,1),r.has(I)||r.put(I,o),o===A)return[B,I];o++;continue}}t.push(B);continue}if(!(I instanceof F))throw new v("Page dictionary kid reference points to wrong type of object.");let{objId:c}=I,l=I.getRaw("Count");if(l instanceof oA&&(l=await a.fetchAsync(l)),Number.isInteger(l)&&l>=0&&(c&&!n.has(c)&&n.put(c,l),o+l<=A)){o+=l;continue}let h=I.getRaw("Kids");if(h instanceof oA&&(h=await a.fetchAsync(h)),!Array.isArray(h)){let C=I.getRaw("Type");if(C instanceof oA&&(C=await a.fetchAsync(C)),ye(C,"Page")||!I.has("Kids")){if(o===A)return[I,null];o++;continue}throw new v("Page dictionary kids object is not an array.")}for(let C=h.length-1;C>=0;C--){let B=h[C];t.push(B),I===this.toplevelPagesDict&&B instanceof oA&&!g.has(B)&&g.put(B,a.fetchAsync(B))}}throw new Error(`Page index ${A} not found.`)}async getAllPageDicts(A=!1){let{ignoreErrors:t}=this.pdfManager.evaluatorOptions,i=[{currentNode:this.toplevelPagesDict,posInKids:0}],s=new be,a=this._catDict.getRaw("Pages");a instanceof oA&&s.put(a);let n=new Map,r=this.xref,g=this.pageIndexCache,o=0;function I(l,h){h&&!g.has(h)&&g.put(h,o),n.set(o++,[l,h])}function c(l){if(l instanceof ti&&!A)throw l;A&&t&&o===0&&(k(`getAllPageDicts - Skipping invalid first page: "${l}".`),l=F.empty),n.set(o++,[l,null])}for(;i.length>0;){let l=i.at(-1),{currentNode:h,posInKids:C}=l,B=h.getRaw("Kids");if(B instanceof oA)try{B=await r.fetchAsync(B)}catch(u){c(u);break}if(!Array.isArray(B)){c(new v("Page dictionary kids object is not an array."));break}if(C>=B.length){i.pop();continue}let Q=B[C],E;if(Q instanceof oA){if(s.has(Q)){c(new v("Pages tree contains circular reference."));break}s.put(Q);try{E=await r.fetchAsync(Q)}catch(u){c(u);break}}else E=Q;if(!(E instanceof F)){c(new v("Page dictionary kid reference points to wrong type of object."));break}let f=E.getRaw("Type");if(f instanceof oA)try{f=await r.fetchAsync(f)}catch(u){c(u);break}ye(f,"Page")||!E.has("Kids")?I(E,Q instanceof oA?Q:null):i.push({currentNode:E,posInKids:0}),l.posInKids++}return n}getPageIndex(A){let t=this.pageIndexCache.get(A);if(t!==void 0)return Promise.resolve(t);let i=this.xref;function s(r){let g=0,o;return i.fetchAsync(r).then(function(I){if(ur(r,A)&&!jE(I,"Page")&&!(I instanceof F&&!I.has("Type")&&I.has("Contents")))throw new v("The reference does not point to a /Page dictionary.");if(!I)return null;if(!(I instanceof F))throw new v("Node must be a dictionary.");return o=I.getRaw("Parent"),I.getAsync("Parent")}).then(function(I){if(!I)return null;if(!(I instanceof F))throw new v("Parent must be a dictionary.");return I.getAsync("Kids")}).then(function(I){if(!I)return null;let c=[],l=!1;for(let h of I){if(!(h instanceof oA))throw new v("Kid must be a reference.");if(ur(h,r)){l=!0;break}c.push(i.fetchAsync(h).then(function(C){if(!(C instanceof F))throw new v("Kid node must be a dictionary.");C.has("Count")?g+=C.get("Count"):g++}))}if(!l)throw new v("Kid reference not found in parent\'s kids.");return Promise.all(c).then(function(){return[g,o]})})}let a=0,n=r=>s(r).then(g=>{if(!g)return this.pageIndexCache.put(A,a),a;let[o,I]=g;return a+=o,n(I)});return n(A)}get baseUrl(){let A=this._catDict.get("URI");if(A instanceof F){let t=A.get("Base");if(typeof t=="string"){let i=Qr(t,null,{tryConvertEncoding:!0});if(i)return nA(this,"baseUrl",i.href)}}return nA(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:A,resultObj:t,docBaseUrl:i=null,docAttachments:s=null}){if(!(A instanceof F)){k("parseDestDictionary: `destDict` must be a dictionary.");return}let a=A.get("A"),n,r;if(a instanceof F||(A.has("Dest")?a=A.get("Dest"):(a=A.get("AA"),a instanceof F&&(a.has("D")?a=a.get("D"):a.has("U")&&(a=a.get("U"))))),a instanceof F){let g=a.get("S");if(!(g instanceof M)){k("parseDestDictionary: Invalid type in Action dictionary.");return}let o=g.name;switch(o){case"ResetForm":let I=a.get("Flags"),c=((typeof I=="number"?I:0)&1)===0,l=[],h=[];for(let w of a.get("Fields")||[])w instanceof oA?h.push(w.toString()):typeof w=="string"&&l.push(jA(w));t.resetForm={fields:l,refs:h,include:c};break;case"URI":n=a.get("URI"),n instanceof M&&(n="/"+n.name);break;case"GoTo":r=a.get("D");break;case"Launch":case"GoToR":let C=a.get("F");if(C instanceof F){let w=new qa(C,null,!0),{rawFilename:Y}=w.serializable;n=Y}else typeof C=="string"&&(n=C);let B=yE(a);B&&typeof n=="string"&&(n=n.split("#",1)[0]+"#"+B);let Q=a.get("NewWindow");typeof Q=="boolean"&&(t.newWindow=Q);break;case"GoToE":let E=a.get("T"),f;if(s&&E instanceof F){let w=E.get("R"),Y=E.get("N");ye(w,"C")&&typeof Y=="string"&&(f=s[jA(Y)])}if(f){t.attachment=f;let w=yE(a);w&&(t.attachmentDest=w)}else k(\'parseDestDictionary - unimplemented "GoToE" action.\');break;case"Named":let u=a.get("N");u instanceof M&&(t.action=u.name);break;case"SetOCGState":let d=a.get("State"),x=a.get("PreserveRB");if(!Array.isArray(d)||d.length===0)break;let p=[];for(let w of d)if(w instanceof M)switch(w.name){case"ON":case"OFF":case"Toggle":p.push(w.name);break}else w instanceof oA&&p.push(w.toString());if(p.length!==d.length)break;t.setOCGState={state:p,preserveRB:typeof x=="boolean"?x:!0};break;case"JavaScript":let m=a.get("JS"),D;m instanceof KA?D=m.getString():typeof m=="string"&&(D=m);let S=D&&zE(jA(D));if(S){n=S.url,t.newWindow=S.newWindow;break}default:if(o==="JavaScript"||o==="SubmitForm")break;k(`parseDestDictionary - unsupported action: "${o}".`);break}}else A.has("Dest")&&(r=A.get("Dest"));if(typeof n=="string"){let g=Qr(n,i,{addDefaultProtocol:!0,tryConvertEncoding:!0});g&&(t.url=g.href),t.unsafeUrl=n}r&&(r instanceof M&&(r=r.name),typeof r=="string"?t.dest=jA(r):f1(r)&&(t.dest=r))}},Pa=Og;Pg=new WeakSet,vf=function(A){let t=this.xref.fetch(A),i={id:A.toString(),name:null,intent:null,usage:{print:null,view:null}},s=t.get("Name");typeof s=="string"&&(i.name=jA(s));let a=t.getArray("Intent");Array.isArray(a)||(a=[a]),a.every(I=>I instanceof M)&&(i.intent=a.map(I=>I.name));let n=t.get("Usage");if(!(n instanceof F))return i;let r=i.usage,g=n.get("Print");if(g instanceof F){let I=g.get("PrintState");if(I instanceof M)switch(I.name){case"ON":case"OFF":r.print={printState:I.name}}}let o=n.get("View");if(o instanceof F){let I=o.get("ViewState");if(I instanceof M)switch(I.name){case"ON":case"OFF":r.view={viewState:I.name}}}return i},Wg=new WeakSet,qf=function(A,t){function i(o){let I=[];if(Array.isArray(o))for(let c of o)c instanceof oA&&t.has(c)&&I.push(c.toString());return I}function s(o,I=0){if(!Array.isArray(o))return null;let c=[];for(let h of o){if(h instanceof oA&&t.has(h)){r.put(h),c.push(h.toString());continue}let C=a(h,I);C&&c.push(C)}if(I>0)return c;let l=[];for(let h of t)r.has(h)||l.push(h.toString());return l.length&&c.push({name:null,order:l}),c}function a(o,I){if(++I>g)return k("parseNestedOrder - reached MAX_NESTED_LEVELS."),null;let c=n.fetchIfRef(o);if(!Array.isArray(c))return null;let l=n.fetchIfRef(c[0]);if(typeof l!="string")return null;let h=s(c.slice(1),I);return!h||!h.length?null:{name:jA(l),order:h}}let n=this.xref,r=new be,g=10;return{name:typeof A.get("Name")=="string"?jA(A.get("Name")):null,creator:typeof A.get("Creator")=="string"?jA(A.get("Creator")):null,baseState:A.get("BaseState")instanceof M?A.get("BaseState").name:null,on:i(A.get("ON")),off:i(A.get("OFF")),order:s(A.get("Order")),groups:null}};function P9(e){return e instanceof oA||e instanceof F||e instanceof KA||Array.isArray(e)}function W9(e,A){if(e instanceof F)e=e.getRawValues();else if(e instanceof KA)e=e.dict.getRawValues();else if(!Array.isArray(e))return;for(let t of e)P9(t)&&A.push(t)}var Hs=class{constructor(A,t,i){this.dict=A,this.keys=t,this.xref=i,this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;let{keys:A,dict:t}=this;this.refSet=new be;let i=[];for(let s of A){let a=t.getRaw(s);a!==void 0&&i.push(a)}return this._walk(i)}async _walk(A){let t=[],i=[];for(;A.length;){let s=A.pop();if(s instanceof oA){if(this.refSet.has(s))continue;try{this.refSet.put(s),s=this.xref.fetch(s)}catch(a){if(!(a instanceof ge)){k(`ObjectLoader._walk - requesting all data: "${a}".`),this.refSet=null;let{manager:n}=this.xref.stream;return n.requestAllChunks()}t.push(s),i.push({begin:a.begin,end:a.end})}}if(s instanceof KA){let a=s.getBaseStreams();if(a){let n=!1;for(let r of a)r.isDataLoaded||(n=!0,i.push({begin:r.start,end:r.end}));n&&t.push(s)}}W9(s,A)}if(i.length){await this.xref.stream.manager.requestRanges(i);for(let s of t)s instanceof oA&&this.refSet.remove(s);return this._walk(t)}this.refSet=null}},eo=Symbol(),d0=Symbol(),Be=Symbol(),_i=Symbol(),Yt=Symbol(),ns=Symbol(),cr=Symbol(),Tt=Symbol(),$t=Symbol(),P=Symbol("content"),Ht=Symbol("data"),Js=Symbol(),L=Symbol("extra"),se=Symbol(),wn=Symbol(),Bc=Symbol(),Tf=Symbol(),x0=Symbol(),to=Symbol(),Wa=Symbol(),da=Symbol(),u1=Symbol(),We=Symbol(),xa=Symbol(),Ue=Symbol(),Ys=Symbol(),Ci=Symbol(),xe=Symbol(),MA=Symbol(),ue=Symbol(),ie=Symbol(),Oa=Symbol(),As=Symbol(),Qc=Symbol(),lr=Symbol(),d1=Symbol(),J0=Symbol(),rs=Symbol(),Mi=Symbol(),ma=Symbol(),di=Symbol(),pi=Symbol(),Za=Symbol(),ja=Symbol(),O9=Symbol(),de=Symbol("namespaceId"),XA=Symbol("nodeName"),qi=Symbol(),ni=Symbol(),Ec=Symbol(),xi=Symbol(),ri=Symbol(),Bt=Symbol(),Xs=Symbol(),Ti=Symbol(),Pf=Symbol("root"),ha=Symbol(),Bi=Symbol(),fc=Symbol(),Wf=Symbol(),Et=Symbol(),qt=Symbol(),Se=Symbol(),Of=Symbol(),SA=Symbol(),pa=Symbol(),ZA=Symbol(),$A=Symbol("uid"),Zt=Symbol(),me={config:{id:0,check:e=>e.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:e=>e==="http://ns.adobe.com/xdp/pdf/"},signature:{id:6,check:e=>e==="http://www.w3.org/2000/09/xmldsig#"},sourceSet:{id:7,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:e=>e==="http://www.w3.org/1999/XSL/Transform"},template:{id:9,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:e=>e.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:e=>e==="http://ns.adobe.com/xdp/"},xfdf:{id:12,check:e=>e==="http://ns.adobe.com/xfdf/"},xhtml:{id:13,check:e=>e==="http://www.w3.org/1999/xhtml"},xmpmeta:{id:14,check:e=>e==="http://ns.adobe.com/xmpmeta/"}},Z9={pt:e=>e,cm:e=>e/2.54*72,mm:e=>e/(10*2.54)*72,in:e=>e*72,px:e=>e},j9=/([+-]?\\d+\\.?\\d*)(.*)/;function io(e){return e.startsWith("\'")||e.startsWith(\'"\')?e.slice(1,-1):e}function GA({data:e,defaultValue:A,validate:t}){if(!e)return A;e=e.trim();let i=parseInt(e,10);return!isNaN(i)&&t(i)?i:A}function _r({data:e,defaultValue:A,validate:t}){if(!e)return A;e=e.trim();let i=parseFloat(e);return!isNaN(i)&&t(i)?i:A}function so({data:e,defaultValue:A,validate:t}){return e?(e=e.trim(),t(e)?e:A):A}function O(e,A){return so({data:e,defaultValue:A[0],validate:t=>A.includes(t)})}function hA(e,A="0"){if(A||(A="0"),!e)return hA(A);let t=e.trim().match(j9);if(!t)return hA(A);let[,i,s]=t,a=parseFloat(i);if(isNaN(a))return hA(A);if(a===0)return 0;let n=Z9[s];return n?n(a):a}function bE(e){if(!e)return{num:1,den:1};let A=e.trim().split(/\\s*:\\s*/).map(s=>parseFloat(s)).filter(s=>!isNaN(s));if(A.length===1&&A.push(1),A.length===0)return{num:1,den:1};let[t,i]=A;return{num:t,den:i}}function jt(e){return e?e.trim().split(/\\s+/).map(A=>({excluded:A[0]==="-",viewname:A.substring(1)})):[]}function X9(e,A=[0,0,0]){let[t,i,s]=A;if(!e)return{r:t,g:i,b:s};let a=e.trim().split(/\\s*,\\s*/).map(n=>Math.min(Math.max(0,parseInt(n.trim(),10)),255)).map(n=>isNaN(n)?0:n);return a.length<3?{r:t,g:i,b:s}:([t,i,s]=a,{r:t,g:i,b:s})}function V9(e){if(!e)return{x:-1,y:-1,width:-1,height:-1};let t=e.trim().split(/\\s*,\\s*/).map(r=>hA(r,"-1"));if(t.length<4||t[2]<0||t[3]<0)return{x:-1,y:-1,width:-1,height:-1};let[i,s,a,n]=t;return{x:i,y:s,width:a,height:n}}var dA=class{static get FAILURE(){return nA(this,"FAILURE",new dA(!1,null,null,null))}static get EMPTY(){return nA(this,"EMPTY",new dA(!0,null,null,null))}constructor(A,t,i,s){this.success=A,this.html=t,this.bbox=i,this.breakNode=s}isBreak(){return!!this.breakNode}static breakNode(A){return new dA(!1,null,null,A)}static success(A,t=null){return new dA(!0,A,t,null)}},uc=class{constructor(A){this.fonts=new Map,this.cache=new Map,this.warned=new Set,this.defaultFont=null,this.add(A)}add(A,t=null){for(let s of A)this.addPdfFont(s);for(let s of this.fonts.values())s.regular||(s.regular=s.italic||s.bold||s.bolditalic);if(!t||t.size===0)return;let i=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(let s of t)this.fonts.set(s,i)}addPdfFont(A){var r,g,o;let t=A.cssFontInfo,i=t.fontFamily,s=this.fonts.get(i);s||(s=Object.create(null),this.fonts.set(i,s),this.defaultFont||(this.defaultFont=s));let a="",n=parseFloat(t.fontWeight);parseFloat(t.italicAngle)!==0?a=n>=700?"bolditalic":"italic":n>=700&&(a="bold"),a||((A.name.includes("Bold")||(r=A.psName)!=null&&r.includes("Bold"))&&(a="bold"),(A.name.includes("Italic")||A.name.endsWith("It")||(g=A.psName)!=null&&g.includes("Italic")||(o=A.psName)!=null&&o.endsWith("It"))&&(a+="italic")),a||(a="regular"),s[a]=A}getDefault(){return this.defaultFont}find(A,t=!0){var r,g;let i=this.fonts.get(A)||this.cache.get(A);if(i)return i;let s=/,|-|_| |bolditalic|bold|italic|regular|it/gi,a=A.replaceAll(s,"");if(i=this.fonts.get(a),i)return this.cache.set(A,i),i;a=a.toLowerCase();let n=[];for(let[o,I]of this.fonts.entries())o.replaceAll(s,"").toLowerCase().startsWith(a)&&n.push(I);if(n.length===0)for(let[,o]of this.fonts.entries())(r=o.regular.name)!=null&&r.replaceAll(s,"").toLowerCase().startsWith(a)&&n.push(o);if(n.length===0){a=a.replaceAll(/psmt|mt/gi,"");for(let[o,I]of this.fonts.entries())o.replaceAll(s,"").toLowerCase().startsWith(a)&&n.push(I)}if(n.length===0)for(let o of this.fonts.values())(g=o.regular.name)!=null&&g.replaceAll(s,"").toLowerCase().startsWith(a)&&n.push(o);return n.length>=1?(n.length!==1&&t&&k(`XFA - Too many choices to guess the correct font: ${A}`),this.cache.set(A,n[0]),n[0]):(t&&!this.warned.has(A)&&(this.warned.add(A),k(`XFA - Cannot find the font: ${A}`)),null)}};function x1(e,A){return e.posture==="italic"?e.weight==="bold"?A.bolditalic:A.italic:e.weight==="bold"?A.bold:A.regular}function _9(e,A=!1){let t=null;if(e){let n=io(e.typeface),r=e[ie].fontFinder.find(n);t=x1(e,r)}if(!t)return{lineHeight:12,lineGap:2,lineNoGap:10};let i=e.size||10,s=t.lineHeight?Math.max(A?0:1.2,t.lineHeight):1.2,a=t.lineGap===void 0?.2:t.lineGap;return{lineHeight:s*i,lineGap:a*i,lineNoGap:Math.max(1,s-a)*i}}var z9=1.02,zr=class{constructor(A,t,i,s){if(this.lineHeight=i,this.paraMargin=t||{top:0,bottom:0,left:0,right:0},!A){[this.pdfFont,this.xfaFont]=this.defaultFont(s);return}this.xfaFont={typeface:A.typeface,posture:A.posture,weight:A.weight,size:A.size,letterSpacing:A.letterSpacing};let a=s.find(A.typeface);if(!a){[this.pdfFont,this.xfaFont]=this.defaultFont(s);return}this.pdfFont=x1(A,a),this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(s))}defaultFont(A){let t=A.find("Helvetica",!1)||A.find("Myriad Pro",!1)||A.find("Arial",!1)||A.getDefault();if(t!=null&&t.regular){let s=t.regular,n={typeface:s.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0};return[s,n]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}},dc=class{constructor(A,t,i,s){this.fontFinder=s,this.stack=[new zr(A,t,i,s)]}pushData(A,t,i){let s=this.stack.at(-1);for(let n of["typeface","posture","weight","size","letterSpacing"])A[n]||(A[n]=s.xfaFont[n]);for(let n of["top","bottom","left","right"])isNaN(t[n])&&(t[n]=s.paraMargin[n]);let a=new zr(A,t,i||s.lineHeight,this.fontFinder);a.pdfFont||(a.pdfFont=s.pdfFont),this.stack.push(a)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}},xc=class{constructor(A,t,i,s){this.glyphs=[],this.fontSelector=new dc(A,t,i,s),this.extraHeight=0}pushData(A,t,i){this.fontSelector.pushData(A,t,i)}popFont(A){return this.fontSelector.popFont()}addPara(){let A=this.fontSelector.topFont();this.extraHeight+=A.paraMargin.top+A.paraMargin.bottom}addString(A){if(!A)return;let t=this.fontSelector.topFont(),i=t.xfaFont.size;if(t.pdfFont){let s=t.xfaFont.letterSpacing,a=t.pdfFont,n=a.lineHeight||1.2,r=t.lineHeight||Math.max(1.2,n)*i,g=a.lineGap===void 0?.2:a.lineGap,o=n-g,I=Math.max(1,o)*i,c=i/1e3,l=a.defaultWidth||a.charsToGlyphs(" ")[0].width;for(let h of A.split(/[\\u2029\\n]/)){let C=a.encodeString(h).join(""),B=a.charsToGlyphs(C);for(let Q of B){let E=Q.width||l;this.glyphs.push([E*c+s,r,I,Q.unicode,!1])}this.glyphs.push([0,0,0,`\n`,!0])}this.glyphs.pop();return}for(let s of A.split(/[\\u2029\\n]/)){for(let a of s.split(""))this.glyphs.push([i,1.2*i,i,a,!1]);this.glyphs.push([0,0,0,`\n`,!0])}this.glyphs.pop()}compute(A){let t=-1,i=0,s=0,a=0,n=0,r=0,g=!1,o=!0;for(let I=0,c=this.glyphs.length;I<c;I++){let[l,h,C,B,Q]=this.glyphs[I],E=B===" ",f=o?C:h;if(Q){s=Math.max(s,n),n=0,a+=r,r=f,t=-1,i=0,o=!1;continue}if(E){n+l>A?(s=Math.max(s,n),n=0,a+=r,r=f,t=-1,i=0,g=!0,o=!1):(r=Math.max(f,r),i=n,n+=l,t=I);continue}if(n+l>A){a+=r,r=f,t!==-1?(I=t,s=Math.max(s,i),n=0,t=-1,i=0):(s=Math.max(s,n),n=l),g=!0,o=!1;continue}n+=l,r=Math.max(f,r)}return s=Math.max(s,n),a+=r+this.extraHeight,{width:z9*s,height:a,isBroken:g}}},DE=/^[^.[]+/,$9=/^[^\\]]+/,xt={dot:0,dotDot:1,dotHash:2,dotBracket:3,dotParen:4},Zf=new Map([["$data",(e,A)=>e.datasets?e.datasets.data:e],["$record",(e,A)=>(e.datasets?e.datasets.data:e)[Ue]()[0]],["$template",(e,A)=>e.template],["$connectionSet",(e,A)=>e.connectionSet],["$form",(e,A)=>e.form],["$layout",(e,A)=>e.layout],["$host",(e,A)=>e.host],["$dataWindow",(e,A)=>e.dataWindow],["$event",(e,A)=>e.event],["!",(e,A)=>e.datasets],["$xfa",(e,A)=>e],["xfa",(e,A)=>e],["$",(e,A)=>A]]),kE=new WeakMap;function Ax(e){return e=e.trim(),e==="*"?1/0:parseInt(e,10)||0}function jf(e,A,t=!0){let i=e.match(DE);if(!i)return null;let[s]=i,a=[{name:s,cacheName:"."+s,index:0,js:null,formCalc:null,operator:xt.dot}],n=s.length;for(;n<e.length;){let r=n;if(e.charAt(n++)==="["){if(i=e.slice(n).match($9),!i)return k("XFA - Invalid index in SOM expression"),null;a.at(-1).index=Ax(i[0]),n+=i[0].length+1;continue}let o;switch(e.charAt(n)){case".":if(!A)return null;n++,o=xt.dotDot;break;case"#":n++,o=xt.dotHash;break;case"[":if(t)return k("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."),null;o=xt.dotBracket;break;case"(":if(t)return k("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."),null;o=xt.dotParen;break;default:o=xt.dot;break}if(i=e.slice(n).match(DE),!i)break;[s]=i,n+=s.length,a.push({name:s,cacheName:e.slice(r,n),operator:o,index:0,js:null,formCalc:null})}return a}function Ni(e,A,t,i=!0,s=!0){let a=jf(t,i);if(!a)return null;let n=Zf.get(a[0].name),r=0,g;n?(g=!0,e=[n(e,A)],r=1):(g=A===null,e=[A||e]);for(let o=a.length;r<o;r++){let{name:I,cacheName:c,operator:l,index:h}=a[r],C=[];for(let B of e){if(!B.isXFAObject)continue;let Q,E;if(s&&(E=kE.get(B),E||(E=new Map,kE.set(B,E)),Q=E.get(c)),!Q){switch(l){case xt.dot:Q=B[Wa](I,!1);break;case xt.dotDot:Q=B[Wa](I,!0);break;case xt.dotHash:Q=B[to](I),Q=Q.isXFAObjectArray?Q.children:[Q];break;default:break}s&&E.set(c,Q)}Q.length>0&&C.push(Q)}if(C.length===0&&!g&&r===0){if(A=A[MA](),!A)return null;r=-1,e=[A];continue}e=isFinite(h)?C.filter(B=>h<B.length).map(B=>B[h]):C.flat()}return e.length===0?null:e}function ex(e,A,t){let i=jf(t);if(!i||i.some(n=>n.operator===xt.dotDot))return null;let s=Zf.get(i[0].name),a=0;s?(e=s(e,A),a=1):e=A||e;for(let n=i.length;a<n;a++){let{name:r,operator:g,index:o}=i[a];if(!isFinite(o))return i[a].index=0,e.createNodes(i.slice(a));let I;switch(g){case xt.dot:I=e[Wa](r,!1);break;case xt.dotDot:I=e[Wa](r,!0);break;case xt.dotHash:I=e[to](r),I=I.isXFAObjectArray?I.children:[I];break;default:break}if(I.length===0)return e.createNodes(i.slice(a));if(o<I.length){let c=I[o];if(!c.isXFAObject)return k("XFA - Cannot create a node."),null;e=c}else return i[a].index=o-I.length,e.createNodes(i.slice(a))}return null}var Zn=Symbol(),a0=Symbol(),P0=Symbol(),vA=Symbol("_children"),Ro=Symbol(),Si=Symbol(),No=Symbol(),SE=Symbol(),Go=Symbol(),FE=Symbol(),Uo=Symbol(),Ca=Symbol(),jn=Symbol(),Rt=Symbol("parent"),Ia=Symbol(),ca=Symbol(),Mo=Symbol(),mc=0,Xf=me.datasets.id,J=class{constructor(A,t,i=!1){this[de]=A,this[XA]=t,this[Uo]=i,this[Rt]=null,this[vA]=[],this[$A]=`${t}${mc++}`,this[ie]=null}get isXFAObject(){return!0}get isXFAObjectArray(){return!1}createNodes(A){let t=this,i=null;for(let{name:s,index:a}of A){for(let n=0,r=isFinite(a)?a:0;n<=r;n++){let g=t[de]===Xf?-1:t[de];i=new Jt(g,s),t[Be](i)}t=i}return i}[ni](A){if(!this[Uo]||!this[Ec](A))return!1;let t=A[XA],i=this[t];if(i instanceof b){if(i.push(A))return this[Be](A),!0}else return i!==null&&this[Ti](i),this[t]=A,this[Be](A),!0;let s="";return this.id?s=` (id: ${this.id})`:this.name&&(s=` (name: ${this.name} ${this.h.value})`),k(`XFA - node "${this[XA]}"${s} has already enough "${t}"!`),!1}[Ec](A){return this.hasOwnProperty(A[XA])&&A[de]===this[de]}[ma](){return!1}[eo](){return!1}[d1](){return!1}[J0](){return!1}[Bt](){this.para&&this[ue]()[L].paraStack.pop()}[Xs](){this[ue]()[L].paraStack.push(this.para)}[fc](A){this.id&&this[de]===me.template.id&&A.set(this.id,this)}[ue](){return this[ie].template}[di](){return!1}[pi](){return!1}[Be](A){A[Rt]=this,this[vA].push(A),!A[ie]&&this[ie]&&(A[ie]=this[ie])}[Ti](A){let t=this[vA].indexOf(A);this[vA].splice(t,1)}[Oa](){return this.hasOwnProperty("value")}[Et](A){}[xi](A){}[se](){}[Yt](A){delete this[Uo],this[cr]&&(A.clean(this[cr]),delete this[cr])}[Qc](A){return this[vA].indexOf(A)}[lr](A,t){t[Rt]=this,this[vA].splice(A,0,t),!t[ie]&&this[ie]&&(t[ie]=this[ie])}[Za](){return!this.name}[O9](){return""}[Se](){return this[vA].length===0?this[P]:this[vA].map(A=>A[Se]()).join("")}get[P0](){let A=Object.getPrototypeOf(this);if(!A._attributes){let t=A._attributes=new Set;for(let i of Object.getOwnPropertyNames(this)){if(this[i]===null||this[i]instanceof J||this[i]instanceof b)break;t.add(i)}}return nA(this,P0,A._attributes)}[Mi](A){let t=this;for(;t;){if(t===A)return!0;t=t[MA]()}return!1}[MA](){return this[Rt]}[xe](){return this[MA]()}[Ue](A=null){return A?this[A]:this[vA]}[Js](){let A=Object.create(null);this[P]&&(A.$content=this[P]);for(let t of Object.getOwnPropertyNames(this)){let i=this[t];i!==null&&(i instanceof J?A[t]=i[Js]():i instanceof b?i.isEmpty()||(A[t]=i.dump()):A[t]=i)}return A}[ZA](){return null}[SA](){return dA.EMPTY}*[Ys](){for(let A of this[Ue]())yield A}*[SE](A,t){for(let i of this[Ys]())if(!A||t===A.has(i[XA])){let s=this[x0](),a=i[SA](s);a.success||(this[L].failingNode=i),yield a}}[wn](){return null}[d0](A,t){this[L].children.push(A)}[x0](){}[_i]({filter:A=null,include:t=!0}){if(!this[L].generator)this[L].generator=this[SE](A,t);else{let i=this[x0](),s=this[L].failingNode[SA](i);if(!s.success)return s;s.html&&this[d0](s.html,s.bbox),delete this[L].failingNode}for(;;){let i=this[L].generator.next();if(i.done)break;let s=i.value;if(!s.success)return s;s.html&&this[d0](s.html,s.bbox)}return this[L].generator=null,dA.EMPTY}[Wf](A){this[ca]=new Set(Object.keys(A))}[FE](A){let t=this[P0],i=this[ca];return[...A].filter(s=>t.has(s)&&!i.has(s))}[ha](A,t=new Set){for(let i of this[vA])i[Ia](A,t)}[Ia](A,t){let i=this[Go](A,t);i?this[Zn](i,A,t):this[ha](A,t)}[Go](A,t){let{use:i,usehref:s}=this;if(!i&&!s)return null;let a=null,n=null,r=null,g=i;if(s?(g=s,s.startsWith("#som(")&&s.endsWith(")")?n=s.slice(5,-1):s.startsWith(".#som(")&&s.endsWith(")")?n=s.slice(6,-1):s.startsWith("#")?r=s.slice(1):s.startsWith(".#")&&(r=s.slice(2))):i.startsWith("#")?r=i.slice(1):n=i,this.use=this.usehref="",r?a=A.get(r):(a=Ni(A.get(Pf),this,n,!0,!1),a&&(a=a[0])),!a)return k(`XFA - Invalid prototype reference: ${g}.`),null;if(a[XA]!==this[XA])return k(`XFA - Incompatible prototype: ${a[XA]} !== ${this[XA]}.`),null;if(t.has(a))return k("XFA - Cycle detected in prototypes use."),null;t.add(a);let o=a[Go](A,t);return o&&a[Zn](o,A,t),a[ha](A,t),t.delete(a),a}[Zn](A,t,i){if(i.has(A)){k("XFA - Cycle detected in prototypes use.");return}!this[P]&&A[P]&&(this[P]=A[P]),new Set(i).add(A);for(let a of this[FE](A[ca]))this[a]=A[a],this[ca]&&this[ca].add(a);for(let a of Object.getOwnPropertyNames(this)){if(this[P0].has(a))continue;let n=this[a],r=A[a];if(n instanceof b){for(let g of n[vA])g[Ia](t,i);for(let g=n[vA].length,o=r[vA].length;g<o;g++){let I=A[vA][g][Tt]();if(n.push(I))I[Rt]=this,this[vA].push(I),I[Ia](t,i);else break}continue}if(n!==null){n[ha](t,i),r&&n[Zn](r,t,i);continue}if(r!==null){let g=r[Tt]();g[Rt]=this,this[a]=g,this[vA].push(g),g[Ia](t,i)}}}static[Ro](A){return Array.isArray(A)?A.map(t=>J[Ro](t)):typeof A=="object"&&A!==null?Object.assign({},A):A}[Tt](){let A=Object.create(Object.getPrototypeOf(this));for(let t of Object.getOwnPropertySymbols(this))try{A[t]=this[t]}catch(i){nA(A,t,this[t])}A[$A]=`${A[XA]}${mc++}`,A[vA]=[];for(let t of Object.getOwnPropertyNames(this)){if(this[P0].has(t)){A[t]=J[Ro](this[t]);continue}let i=this[t];A[t]=i instanceof b?new b(i[Ca]):null}for(let t of this[vA]){let i=t[XA],s=t[Tt]();A[vA].push(s),s[Rt]=A,A[i]===null?A[i]=s:A[i][vA].push(s)}return A}[Ue](A=null){return A?this[vA].filter(t=>t[XA]===A):this[vA]}[to](A){return this[A]}[Wa](A,t,i=!0){return Array.from(this[da](A,t,i))}*[da](A,t,i=!0){if(A==="parent"){yield this[Rt];return}for(let s of this[vA])s[XA]===A&&(yield s),s.name===A&&(yield s),(t||s[Za]())&&(yield*s[da](A,t,!1));i&&this[P0].has(A)&&(yield new Xa(this,A,this[A]))}},b=class{constructor(A=1/0){this[Ca]=A,this[vA]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(A){return this[vA].length<=this[Ca]?(this[vA].push(A),!0):(k(`XFA - node "${A[XA]}" accepts no more than ${this[Ca]} children`),!1)}isEmpty(){return this[vA].length===0}dump(){return this[vA].length===1?this[vA][0][Js]():this[vA].map(A=>A[Js]())}[Tt](){let A=new b(this[Ca]);return A[vA]=this[vA].map(t=>t[Tt]()),A}get children(){return this[vA]}clear(){this[vA].length=0}},Xa=class{constructor(A,t,i){this[Rt]=A,this[XA]=t,this[P]=i,this[$t]=!1,this[$A]=`attribute${mc++}`}[MA](){return this[Rt]}[rs](){return!0}[u1](){return this[P].trim()}[Et](A){A=A.value||"",this[P]=A.toString()}[Se](){return this[P]}[Mi](A){return this[Rt]===A||this[Rt][Mi](A)}},Jt=class extends J{constructor(A,t,i={}){if(super(A,t),this[P]="",this[Si]=null,t!=="#text"){let s=new Map;this[a0]=s;for(let[a,n]of Object.entries(i))s.set(a,new Xa(this,a,n));if(i.hasOwnProperty(qi)){let a=i[qi].xfa.dataNode;a!==void 0&&(a==="dataGroup"?this[Si]=!1:a==="dataValue"&&(this[Si]=!0))}}this[$t]=!1}[pa](A){let t=this[XA];if(t==="#text"){A.push(ls(this[P]));return}let i=Yo(t),s=this[de]===Xf?"xfa:":"";A.push(`<${s}${i}`);for(let[a,n]of this[a0].entries()){let r=Yo(a);A.push(` ${r}="${ls(n[P])}"`)}if(this[Si]!==null&&(this[Si]?A.push(\' xfa:dataNode="dataValue"\'):A.push(\' xfa:dataNode="dataGroup"\')),!this[P]&&this[vA].length===0){A.push("/>");return}if(A.push(">"),this[P])typeof this[P]=="string"?A.push(ls(this[P])):this[P][pa](A);else for(let a of this[vA])a[pa](A);A.push(`</${s}${i}>`)}[ni](A){if(this[P]){let t=new Jt(this[de],"#text");this[Be](t),t[P]=this[P],this[P]=""}return this[Be](A),!0}[xi](A){this[P]+=A}[se](){if(this[P]&&this[vA].length>0){let A=new Jt(this[de],"#text");this[Be](A),A[P]=this[P],delete this[P]}}[SA](){return this[XA]==="#text"?dA.success({name:"#text",value:this[P]}):dA.EMPTY}[Ue](A=null){return A?this[vA].filter(t=>t[XA]===A):this[vA]}[Tf](){return this[a0]}[to](A){let t=this[a0].get(A);return t!==void 0?t:this[Ue](A)}*[da](A,t){let i=this[a0].get(A);i&&(yield i);for(let s of this[vA])s[XA]===A&&(yield s),t&&(yield*s[da](A,t))}*[Bc](A,t){let i=this[a0].get(A);i&&(!t||!i[$t])&&(yield i);for(let s of this[vA])yield*s[Bc](A,t)}*[xa](A,t,i){for(let s of this[vA])s[XA]===A&&(!i||!s[$t])&&(yield s),t&&(yield*s[xa](A,t,i))}[rs](){return this[Si]===null?this[vA].length===0||this[vA][0][de]===me.xhtml.id:this[Si]}[u1](){return this[Si]===null?this[vA].length===0?this[P].trim():this[vA][0][de]===me.xhtml.id?this[vA][0][Se]().trim():null:this[P].trim()}[Et](A){A=A.value||"",this[P]=A.toString()}[Js](A=!1){let t=Object.create(null);A&&(t.$ns=this[de]),this[P]&&(t.$content=this[P]),t.$name=this[XA],t.children=[];for(let i of this[vA])t.children.push(i[Js](A));t.attributes=Object.create(null);for(let[i,s]of this[a0])t.attributes[i]=s[P];return t}},ce=class extends J{constructor(A,t){super(A,t),this[P]=""}[xi](A){this[P]+=A}[se](){}},_A=class extends ce{constructor(A,t,i){super(A,t),this[jn]=i}[se](){this[P]=so({data:this[P],defaultValue:this[jn][0],validate:A=>this[jn].includes(A)})}[Yt](A){super[Yt](A),delete this[jn]}},qA=class extends ce{[se](){this[P]=this[P].trim()}},yt=class extends ce{constructor(A,t,i,s){super(A,t),this[No]=i,this[Mo]=s}[se](){this[P]=GA({data:this[P],defaultValue:this[No],validate:this[Mo]})}[Yt](A){super[Yt](A),delete this[No],delete this[Mo]}},pe=class extends yt{constructor(A,t){super(A,t,0,i=>i===1)}},$r=class extends yt{constructor(A,t){super(A,t,1,i=>i===0)}};function NA(e){return typeof e=="string"?"0px":Number.isInteger(e)?`${e}px`:`${e.toFixed(2)}px`}var RE={anchorType(e,A){let t=e[xe]();if(!(!t||t.layout&&t.layout!=="position"))switch("transform"in A||(A.transform=""),e.anchorType){case"bottomCenter":A.transform+="translate(-50%, -100%)";break;case"bottomLeft":A.transform+="translate(0,-100%)";break;case"bottomRight":A.transform+="translate(-100%,-100%)";break;case"middleCenter":A.transform+="translate(-50%,-50%)";break;case"middleLeft":A.transform+="translate(0,-50%)";break;case"middleRight":A.transform+="translate(-100%,-50%)";break;case"topCenter":A.transform+="translate(-50%,0)";break;case"topRight":A.transform+="translate(-100%,0)";break}},dimensions(e,A){var a;let t=e[xe](),i=e.w,s=e.h;if((a=t.layout)!=null&&a.includes("row")){let n=t[L],r=e.colSpan,g;r===-1?(g=n.columnWidths.slice(n.currentColumn).reduce((o,I)=>o+I,0),n.currentColumn=0):(g=n.columnWidths.slice(n.currentColumn,n.currentColumn+r).reduce((o,I)=>o+I,0),n.currentColumn=(n.currentColumn+e.colSpan)%n.columnWidths.length),isNaN(g)||(i=e.w=g)}A.width=i!==""?NA(i):"auto",A.height=s!==""?NA(s):"auto"},position(e,A){let t=e[xe]();t!=null&&t.layout&&t.layout!=="position"||(A.position="absolute",A.left=NA(e.x),A.top=NA(e.y))},rotate(e,A){e.rotate&&("transform"in A||(A.transform=""),A.transform+=`rotate(-${e.rotate}deg)`,A.transformOrigin="top left")},presence(e,A){switch(e.presence){case"invisible":A.visibility="hidden";break;case"hidden":case"inactive":A.display="none";break}},hAlign(e,A){if(e[XA]==="para")switch(e.hAlign){case"justifyAll":A.textAlign="justify-all";break;case"radix":A.textAlign="left";break;default:A.textAlign=e.hAlign}else switch(e.hAlign){case"left":A.alignSelf="start";break;case"center":A.alignSelf="center";break;case"right":A.alignSelf="end";break}},margin(e,A){e.margin&&(A.margin=e.margin[ZA]().margin)}};function Vf(e,A){e[xe]().layout==="position"&&(e.minW>0&&(A.minWidth=NA(e.minW)),e.maxW>0&&(A.maxWidth=NA(e.maxW)),e.minH>0&&(A.minHeight=NA(e.minH)),e.maxH>0&&(A.maxHeight=NA(e.maxH)))}function NE(e,A,t,i,s,a){let n=new xc(A,t,i,s);return typeof e=="string"?n.addString(e):e[ri](n),n.compute(a)}function m1(e,A){let t=null,i=null,s=!1;if((!e.w||!e.h)&&e.value){let a=0,n=0;e.margin&&(a=e.margin.leftInset+e.margin.rightInset,n=e.margin.topInset+e.margin.bottomInset);let r=null,g=null;e.para&&(g=Object.create(null),r=e.para.lineHeight===""?null:e.para.lineHeight,g.top=e.para.spaceAbove===""?0:e.para.spaceAbove,g.bottom=e.para.spaceBelow===""?0:e.para.spaceBelow,g.left=e.para.marginLeft===""?0:e.para.marginLeft,g.right=e.para.marginRight===""?0:e.para.marginRight);let o=e.font;if(!o){let l=e[ue](),h=e[MA]();for(;h&&h!==l;){if(h.font){o=h.font;break}h=h[MA]()}}let I=(e.w||A.width)-a,c=e[ie].fontFinder;if(e.value.exData&&e.value.exData[P]&&e.value.exData.contentType==="text/html"){let l=NE(e.value.exData[P],o,g,r,c,I);i=l.width,t=l.height,s=l.isBroken}else{let l=e.value[Se]();if(l){let h=NE(l,o,g,r,c,I);i=h.width,t=h.height,s=h.isBroken}}i!==null&&!e.w&&(i+=a),t!==null&&!e.h&&(t+=n)}return{w:i,h:t,isBroken:s}}function _f(e,A,t){let i;if(e.w!==""&&e.h!=="")i=[e.x,e.y,e.w,e.h];else{if(!t)return null;let s=e.w;if(s===""){if(e.maxW===0){let n=e[xe]();s=n.layout==="position"&&n.w!==""?0:e.minW}else s=Math.min(e.maxW,t.width);A.attributes.style.width=NA(s)}let a=e.h;if(a===""){if(e.maxH===0){let n=e[xe]();a=n.layout==="position"&&n.h!==""?0:e.minH}else a=Math.min(e.maxH,t.height);A.attributes.style.height=NA(a)}i=[e.x,e.y,s,a]}return i}function ao(e){var t;let A=e[xe]();if((t=A.layout)!=null&&t.includes("row")){let i=A[L],s=e.colSpan,a;s===-1?a=i.columnWidths.slice(i.currentColumn).reduce((n,r)=>n+r,0):a=i.columnWidths.slice(i.currentColumn,i.currentColumn+s).reduce((n,r)=>n+r,0),isNaN(a)||(e.w=a)}A.layout&&A.layout!=="position"&&(e.x=e.y=0),e.layout==="table"&&e.w===""&&Array.isArray(e.columnWidths)&&(e.w=e.columnWidths.reduce((i,s)=>i+s,0))}function zf(e){switch(e.layout){case"position":return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb";default:return"xfaPosition"}}function lt(e,...A){let t=Object.create(null);for(let i of A){let s=e[i];if(s!==null){if(RE.hasOwnProperty(i)){RE[i](e,t);continue}if(s instanceof J){let a=s[ZA]();a?Object.assign(t,a):k(`(DEBUG) - XFA - style for ${i} not implemented yet`)}}}return t}function m0(e,A){let{attributes:t}=A,{style:i}=t,s={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};if(t.class.push("xfaWrapped"),e.border){let{widths:a,insets:n}=e.border[L],r,g,o=n[0],I=n[3],c=n[0]+n[2],l=n[1]+n[3];switch(e.border.hand){case"even":o-=a[0]/2,I-=a[3]/2,r=`calc(100% + ${(a[1]+a[3])/2-l}px)`,g=`calc(100% + ${(a[0]+a[2])/2-c}px)`;break;case"left":o-=a[0],I-=a[3],r=`calc(100% + ${a[1]+a[3]-l}px)`,g=`calc(100% + ${a[0]+a[2]-c}px)`;break;case"right":r=l?`calc(100% - ${l}px)`:"100%",g=c?`calc(100% - ${c}px)`:"100%";break}let h=["xfaBorder"];Vs(e.border)&&h.push("xfaPrintOnly");let C={name:"div",attributes:{class:h,style:{top:`${o}px`,left:`${I}px`,width:r,height:g}},children:[]};for(let B of["border","borderWidth","borderColor","borderRadius","borderStyle"])i[B]!==void 0&&(C.attributes.style[B]=i[B],delete i[B]);s.children.push(C,A)}else s.children.push(A);for(let a of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])i[a]!==void 0&&(s.attributes.style[a]=i[a],delete i[a]);return s.attributes.style.position=i.position==="absolute"?"absolute":"relative",delete i.position,i.alignSelf&&(s.attributes.style.alignSelf=i.alignSelf,delete i.alignSelf),s}function $f(e){let A=hA(e.textIndent,"0px");if(A>=0)return;let i="padding"+((e.textAlign==="right"?"right":"left")==="left"?"Left":"Right"),s=hA(e[i],"0px");e[i]=`${s-A}px`}function p1(e,A){switch(e.access){case"nonInteractive":A.push("xfaNonInteractive");break;case"readOnly":A.push("xfaReadOnly");break;case"protected":A.push("xfaDisabled");break}}function Vs(e){return e.relevant.length>0&&!e.relevant[0].excluded&&e.relevant[0].viewname==="print"}function Au(e){let A=e[ue]()[L].paraStack;return A.length?A.at(-1):null}function eu(e,A,t){var i;if((i=t.attributes.class)!=null&&i.includes("xfaRich")){A&&(e.h===""&&(A.height="auto"),e.w===""&&(A.width="auto"));let s=Au(e);if(s){let a=t.attributes.style;switch(a.display="flex",a.flexDirection="column",s.vAlign){case"top":a.justifyContent="start";break;case"bottom":a.justifyContent="end";break;case"middle":a.justifyContent="center";break}let n=s[ZA]();for(let[r,g]of Object.entries(n))r in a||(a[r]=g)}}}function tu(e,A,t,i){if(!t){delete i.fontFamily;return}let s=io(e.typeface);i.fontFamily=`"${s}"`;let a=t.find(s);if(a){let{fontFamily:n}=a.regular.cssFontInfo;n!==s&&(i.fontFamily=`"${n}"`);let r=Au(A);if(r&&r.lineHeight!==""||i.lineHeight)return;let g=x1(e,a);g&&(i.lineHeight=Math.max(1.2,g.lineHeight))}}function iu(e){let A=Qr(e,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return A?A.href:null}function su(e,A){return{name:"div",attributes:{class:[e.layout==="lr-tb"?"xfaLr":"xfaRl"]},children:A}}function au(e){if(!e[L])return null;let t={name:"div",attributes:e[L].attributes,children:e[L].children};if(e[L].failingNode){let i=e[L].failingNode[wn]();i&&(e.layout.endsWith("-tb")?t.children.push(su(e,[i])):t.children.push(i))}return t.children.length===0?null:t}function nu(e,A,t){let i=e[L],s=i.availableSpace,[a,n,r,g]=t;switch(e.layout){case"position":{i.width=Math.max(i.width,a+r),i.height=Math.max(i.height,n+g),i.children.push(A);break}case"lr-tb":case"rl-tb":(!i.line||i.attempt===1)&&(i.line=su(e,[]),i.children.push(i.line),i.numberInLine=0),i.numberInLine+=1,i.line.children.push(A),i.attempt===0?(i.currentWidth+=r,i.height=Math.max(i.height,i.prevHeight+g)):(i.currentWidth=r,i.prevHeight=i.height,i.height+=g,i.attempt=0),i.width=Math.max(i.width,i.currentWidth);break;case"rl-row":case"row":{i.children.push(A),i.width+=r,i.height=Math.max(i.height,g);let o=NA(i.height);for(let I of i.children)I.attributes.style.height=o;break}case"table":{i.width=Math.min(s.width,Math.max(i.width,r)),i.height+=g,i.children.push(A);break}case"tb":{i.width=Math.min(s.width,Math.max(i.width,r)),i.height+=g,i.children.push(A);break}}}function ru(e){let A=e[L].availableSpace,t=e.margin?e.margin.topInset+e.margin.bottomInset:0,i=e.margin?e.margin.leftInset+e.margin.rightInset:0;switch(e.layout){case"lr-tb":case"rl-tb":return e[L].attempt===0?{width:A.width-i-e[L].currentWidth,height:A.height-t-e[L].prevHeight}:{width:A.width-i,height:A.height-t-e[L].height};case"rl-row":case"row":return{width:e[L].columnWidths.slice(e[L].currentColumn).reduce((a,n)=>a+n),height:A.height-i};case"table":case"tb":return{width:A.width-i,height:A.height-t-e[L].height};case"position":default:return A}}function tx(e){let A=e.w===""?NaN:e.w,t=e.h===""?NaN:e.h,[i,s]=[0,0];switch(e.anchorType||""){case"bottomCenter":[i,s]=[A/2,t];break;case"bottomLeft":[i,s]=[0,t];break;case"bottomRight":[i,s]=[A,t];break;case"middleCenter":[i,s]=[A/2,t/2];break;case"middleLeft":[i,s]=[0,t/2];break;case"middleRight":[i,s]=[A,t/2];break;case"topCenter":[i,s]=[A/2,0];break;case"topRight":[i,s]=[A,0];break}let a,n;switch(e.rotate||0){case 0:[a,n]=[-i,-s];break;case 90:[a,n]=[-s,i],[A,t]=[t,-A];break;case 180:[a,n]=[i,s],[A,t]=[-A,-t];break;case 270:[a,n]=[s,-i],[A,t]=[-t,A];break}return[e.x+a+Math.min(0,A),e.y+n+Math.min(0,t),Math.abs(A),Math.abs(t)]}function no(e,A){var g;if(e[ue]()[L].firstUnsplittable===null||e.w===0||e.h===0)return!0;let t=2,i=e[xe](),s=((g=i[L])==null?void 0:g.attempt)||0,[,a,n,r]=tx(e);switch(i.layout){case"lr-tb":case"rl-tb":return s===0?e[ue]()[L].noLayoutFailure?e.w!==""?Math.round(n-A.width)<=t:A.width>t:e.h!==""&&Math.round(r-A.height)>t?!1:e.w!==""?Math.round(n-A.width)<=t?!0:i[L].numberInLine===0?A.height>t:!1:A.width>t:e[ue]()[L].noLayoutFailure?!0:e.h!==""&&Math.round(r-A.height)>t?!1:e.w===""||Math.round(n-A.width)<=t?A.height>t:i[pi]()?!1:A.height>t;case"table":case"tb":return e[ue]()[L].noLayoutFailure?!0:e.h!==""&&!e[di]()?Math.round(r-A.height)<=t:e.w===""||Math.round(n-A.width)<=t?A.height>t:i[pi]()?!1:A.height>t;case"position":if(e[ue]()[L].noLayoutFailure||e.h===""||Math.round(r+a-A.height)<=t)return!0;let o=e[ue]()[L].currentContentArea;return r+a>o.h;case"rl-row":case"row":return e[ue]()[L].noLayoutFailure?!0:e.h!==""?Math.round(r-A.height)<=t:!0;default:return!0}}var eA=me.template.id,p0="http://www.w3.org/2000/svg",Ag=2,ix=3,sx=5e3,ax=/^H(\\d+)$/,nx=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),rx=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function GE(e){if(!e||!e.border)return{w:0,h:0};let A=e.border[We]();return A?{w:A.widths[0]+A.widths[2]+A.insets[0]+A.insets[2],h:A.widths[1]+A.widths[3]+A.insets[1]+A.insets[3]}:{w:0,h:0}}function w1(e){return e.margin&&(e.margin.topInset||e.margin.rightInset||e.margin.bottomInset||e.margin.leftInset)}function y1(e,A){if(!e.value){let t=new an({});e[Be](t),e.value=t}e.value[Et](A)}function*b1(e){for(let A of e[Ue]()){if(A instanceof en){yield*A[Ys]();continue}yield A}}function yn(e){var A;return((A=e.validate)==null?void 0:A.nullTest)==="error"}function ro(e){for(;e;){if(!e.traversal){e[qt]=e[MA]()[qt];return}if(e[qt])return;let A=null;for(let s of e.traversal[Ue]())if(s.operation==="next"){A=s;break}if(!A||!A.ref){e[qt]=e[MA]()[qt];return}let t=e[ue]();e[qt]=++t[qt];let i=t[Bi](A.ref,e);if(!i)return;e=i[0]}}function go(e,A){var i;let t=e.assist;if(t){let s=t[SA]();s&&(A.title=s);let n=t.role.match(ax);if(n){let r="heading",g=n[1];A.role=r,A["aria-level"]=g}}if(e.layout==="table")A.role="table";else if(e.layout==="row")A.role="row";else{let s=e[MA]();s.layout==="row"&&(A.role=((i=s.assist)==null?void 0:i.role)==="TH"?"columnheader":"cell")}}function N0(e){if(!e.assist)return null;let A=e.assist;return A.speak&&A.speak[P]!==""?A.speak[P]:A.toolTip?A.toolTip[P]:null}function A0(e){return dA.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:e}]})}function oo(e){let A=e[ue]();A[L].firstUnsplittable===null&&(A[L].firstUnsplittable=e,A[L].noLayoutFailure=!0)}function Io(e){let A=e[ue]();A[L].firstUnsplittable===e&&(A[L].noLayoutFailure=!1)}function UE(e){if(e[L]||(e[L]=Object.create(null),e.targetType==="auto"))return!1;let A=e[ue](),t=null;if(e.target){if(t=A[Bi](e.target,e[MA]()),!t)return!1;t=t[0]}let{currentPageArea:i,currentContentArea:s}=A[L];if(e.targetType==="pageArea")return t instanceof zi||(t=null),e.startNew?(e[L].target=t||i,!0):t&&t!==i?(e[L].target=t,!0):!1;t instanceof _a||(t=null);let a=t&&t[MA](),n,r=a;if(e.startNew)if(t){let g=a.contentArea.children,o=g.indexOf(s),I=g.indexOf(t);o!==-1&&o<I&&(r=null),n=I-1}else n=i.contentArea.children.indexOf(s);else if(t&&t!==s)n=a.contentArea.children.indexOf(t)-1,r=a===i?null:a;else return!1;return e[L].target=r,e[L].index=n,!0}function ME(e,A,t){let i=e[ue](),s=i[L].noLayoutFailure,a=A[xe];A[xe]=()=>e,i[L].noLayoutFailure=!0;let n=A[SA](t);e[d0](n.html,n.bbox),i[L].noLayoutFailure=s,A[xe]=a}var pc=class extends qA{constructor(A){super(eA,"appearanceFilter"),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}},eg=class extends J{constructor(A){super(eA,"arc",!0),this.circular=GA({data:A.circular,defaultValue:0,validate:t=>t===1}),this.hand=O(A.hand,["even","left","right"]),this.id=A.id||"",this.startAngle=_r({data:A.startAngle,defaultValue:0,validate:t=>!0}),this.sweepAngle=_r({data:A.sweepAngle,defaultValue:360,validate:t=>!0}),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null,this.fill=null}[SA](){var g;let A=this.edge||new G0({}),t=A[ZA](),i=Object.create(null);((g=this.fill)==null?void 0:g.presence)==="visible"?Object.assign(i,this.fill[ZA]()):i.fill="transparent",i.strokeWidth=NA(A.presence==="visible"?A.thickness:0),i.stroke=t.color;let s,a={xmlns:p0,style:{width:"100%",height:"100%",overflow:"visible"}};if(this.sweepAngle===360)s={name:"ellipse",attributes:{xmlns:p0,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:i}};else{let o=this.startAngle*Math.PI/180,I=this.sweepAngle*Math.PI/180,c=this.sweepAngle>180?1:0,[l,h,C,B]=[50*(1+Math.cos(o)),50*(1-Math.sin(o)),50*(1+Math.cos(o+I)),50*(1-Math.sin(o+I))];s={name:"path",attributes:{xmlns:p0,d:`M ${l} ${h} A 50 50 0 ${c} 0 ${C} ${B}`,vectorEffect:"non-scaling-stroke",style:i}},Object.assign(a,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}let n={name:"svg",children:[s],attributes:a},r=this[MA]()[MA]();return w1(r)?dA.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[n]}):(n.attributes.style.position="absolute",dA.success(n))}},wc=class extends J{constructor(A){super(eA,"area",!0),this.colSpan=GA({data:A.colSpan,defaultValue:1,validate:t=>t>=1||t===-1}),this.id=A.id||"",this.name=A.name||"",this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.desc=null,this.extras=null,this.area=new b,this.draw=new b,this.exObject=new b,this.exclGroup=new b,this.field=new b,this.subform=new b,this.subformSet=new b}*[Ys](){yield*b1(this)}[Za](){return!0}[J0](){return!0}[d0](A,t){let[i,s,a,n]=t;this[L].width=Math.max(this[L].width,i+a),this[L].height=Math.max(this[L].height,s+n),this[L].children.push(A)}[x0](){return this[L].availableSpace}[SA](A){let t=lt(this,"position"),i={style:t,id:this[$A],class:["xfaArea"]};Vs(this)&&i.class.push("xfaPrintOnly"),this.name&&(i.xfaName=this.name);let s=[];this[L]={children:s,width:0,height:0,availableSpace:A};let a=this[_i]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!a.success)return a.isBreak()?a:(delete this[L],dA.FAILURE);t.width=NA(this[L].width),t.height=NA(this[L].height);let n={name:"div",attributes:i,children:s},r=[this.x,this.y,this[L].width,this[L].height];return delete this[L],dA.success(n,r)}},yc=class extends J{constructor(A){super(eA,"assist",!0),this.id=A.id||"",this.role=A.role||"",this.use=A.use||"",this.usehref=A.usehref||"",this.speak=null,this.toolTip=null}[SA](){var A;return((A=this.toolTip)==null?void 0:A[P])||null}},bc=class extends J{constructor(A){super(eA,"barcode",!0),this.charEncoding=so({data:A.charEncoding?A.charEncoding.toLowerCase():"",defaultValue:"",validate:t=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(t)||t.match(/iso-8859-\\d{2}/)}),this.checksum=O(A.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]),this.dataColumnCount=GA({data:A.dataColumnCount,defaultValue:-1,validate:t=>t>=0}),this.dataLength=GA({data:A.dataLength,defaultValue:-1,validate:t=>t>=0}),this.dataPrep=O(A.dataPrep,["none","flateCompress"]),this.dataRowCount=GA({data:A.dataRowCount,defaultValue:-1,validate:t=>t>=0}),this.endChar=A.endChar||"",this.errorCorrectionLevel=GA({data:A.errorCorrectionLevel,defaultValue:-1,validate:t=>t>=0&&t<=8}),this.id=A.id||"",this.moduleHeight=hA(A.moduleHeight,"5mm"),this.moduleWidth=hA(A.moduleWidth,"0.25mm"),this.printCheckDigit=GA({data:A.printCheckDigit,defaultValue:0,validate:t=>t===1}),this.rowColumnRatio=bE(A.rowColumnRatio),this.startChar=A.startChar||"",this.textLocation=O(A.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]),this.truncate=GA({data:A.truncate,defaultValue:0,validate:t=>t===1}),this.type=O(A.type?A.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]),this.upsMode=O(A.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]),this.use=A.use||"",this.usehref=A.usehref||"",this.wideNarrowRatio=bE(A.wideNarrowRatio),this.encrypt=null,this.extras=null}},Dc=class extends J{constructor(A){super(eA,"bind",!0),this.match=O(A.match,["once","dataRef","global","none"]),this.ref=A.ref||"",this.picture=null}},Va=class extends J{constructor(A){super(eA,"bindItems"),this.connection=A.connection||"",this.labelRef=A.labelRef||"",this.ref=A.ref||"",this.valueRef=A.valueRef||""}},kc=class extends J{constructor(A){super(eA,"bookend"),this.id=A.id||"",this.leader=A.leader||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}},Sc=class extends pe{constructor(A){super(eA,"boolean"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[SA](A){return A0(this[P]===1?"1":"0")}},tg=class extends J{constructor(A){super(eA,"border",!0),this.break=O(A.break,["close","open"]),this.hand=O(A.hand,["even","left","right"]),this.id=A.id||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new b(4),this.edge=new b(4),this.extras=null,this.fill=null,this.margin=null}[We](){if(!this[L]){let A=this.edge.children.slice();if(A.length<4){let s=A.at(-1)||new G0({});for(let a=A.length;a<4;a++)A.push(s)}let t=A.map(s=>s.thickness),i=[0,0,0,0];this.margin&&(i[0]=this.margin.topInset,i[1]=this.margin.rightInset,i[2]=this.margin.bottomInset,i[3]=this.margin.leftInset),this[L]={widths:t,insets:i,edges:A}}return this[L]}[ZA](){var s;let{edges:A}=this[We](),t=A.map(a=>{let n=a[ZA]();return n.color||(n.color="#000000"),n}),i=Object.create(null);if(this.margin&&Object.assign(i,this.margin[ZA]()),((s=this.fill)==null?void 0:s.presence)==="visible"&&Object.assign(i,this.fill[ZA]()),this.corner.children.some(a=>a.radius!==0)){let a=this.corner.children.map(n=>n[ZA]());if(a.length===2||a.length===3){let n=a.at(-1);for(let r=a.length;r<4;r++)a.push(n)}i.borderRadius=a.map(n=>n.radius).join(" ")}switch(this.presence){case"invisible":case"hidden":i.borderStyle="";break;case"inactive":i.borderStyle="none";break;default:i.borderStyle=t.map(a=>a.style).join(" ");break}return i.borderWidth=t.map(a=>a.width).join(" "),i.borderColor=t.map(a=>a.color).join(" "),i}},Fc=class extends J{constructor(A){super(eA,"break",!0),this.after=O(A.after,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.afterTarget=A.afterTarget||"",this.before=O(A.before,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.beforeTarget=A.beforeTarget||"",this.bookendLeader=A.bookendLeader||"",this.bookendTrailer=A.bookendTrailer||"",this.id=A.id||"",this.overflowLeader=A.overflowLeader||"",this.overflowTarget=A.overflowTarget||"",this.overflowTrailer=A.overflowTrailer||"",this.startNew=GA({data:A.startNew,defaultValue:0,validate:t=>t===1}),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}},ig=class extends J{constructor(A){super(eA,"breakAfter",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=GA({data:A.startNew,defaultValue:0,validate:t=>t===1}),this.target=A.target||"",this.targetType=O(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}},sg=class extends J{constructor(A){super(eA,"breakBefore",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=GA({data:A.startNew,defaultValue:0,validate:t=>t===1}),this.target=A.target||"",this.targetType=O(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}[SA](A){return this[L]={},dA.FAILURE}},Rc=class extends J{constructor(A){super(eA,"button",!0),this.highlight=O(A.highlight,["inverted","none","outline","push"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[SA](A){let i=this[MA]()[MA](),s={name:"button",attributes:{id:this[$A],class:["xfaButton"],style:{}},children:[]};for(let a of i.event.children){if(a.activity!=="click"||!a.script)continue;let n=zE(a.script[P]);if(!n)continue;let r=iu(n.url);r&&s.children.push({name:"a",attributes:{id:"link"+this[$A],href:r,newWindow:n.newWindow,class:["xfaLink"],style:{}},children:[]})}return dA.success(s)}},Nc=class extends J{constructor(A){super(eA,"calculate",!0),this.id=A.id||"",this.override=O(A.override,["disabled","error","ignore","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.script=null}},Gc=class extends J{constructor(A){super(eA,"caption",!0),this.id=A.id||"",this.placement=O(A.placement,["left","bottom","inline","right","top"]),this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.reserve=Math.ceil(hA(A.reserve)),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.font=null,this.margin=null,this.para=null,this.value=null}[Et](A){y1(this,A)}[We](A){if(!this[L]){let{width:t,height:i}=A;switch(this.placement){case"left":case"right":case"inline":t=this.reserve<=0?t:this.reserve;break;case"top":case"bottom":i=this.reserve<=0?i:this.reserve;break}this[L]=m1(this,{width:t,height:i})}return this[L]}[SA](A){if(!this.value)return dA.EMPTY;this[Xs]();let t=this.value[SA](A).html;if(!t)return this[Bt](),dA.EMPTY;let i=this.reserve;if(this.reserve<=0){let{w:n,h:r}=this[We](A);switch(this.placement){case"left":case"right":case"inline":this.reserve=n;break;case"top":case"bottom":this.reserve=r;break}}let s=[];typeof t=="string"?s.push({name:"#text",value:t}):s.push(t);let a=lt(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(a.width=NA(this.reserve));break;case"top":case"bottom":this.reserve>0&&(a.height=NA(this.reserve));break}return eu(this,null,t),this[Bt](),this.reserve=i,dA.success({name:"div",attributes:{style:a,class:["xfaCaption"]},children:s})}},Uc=class extends qA{constructor(A){super(eA,"certificate"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},Mc=class extends J{constructor(A){super(eA,"certificates",!0),this.credentialServerPolicy=O(A.credentialServerPolicy,["optional","required"]),this.id=A.id||"",this.url=A.url||"",this.urlPolicy=A.urlPolicy||"",this.use=A.use||"",this.usehref=A.usehref||"",this.encryption=null,this.issuers=null,this.keyUsage=null,this.oids=null,this.signing=null,this.subjectDNs=null}},ag=class extends J{constructor(A){super(eA,"checkButton",!0),this.id=A.id||"",this.mark=O(A.mark,["default","check","circle","cross","diamond","square","star"]),this.shape=O(A.shape,["square","round"]),this.size=hA(A.size,"10pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[SA](A){var Q,E,f;let t=lt("margin"),i=NA(this.size);t.width=t.height=i;let s,a,n,r=this[MA]()[MA](),g=r.items.children.length&&r.items.children[0][SA]().html||[],o={on:(g[0]!==void 0?g[0]:"on").toString(),off:(g[1]!==void 0?g[1]:"off").toString()},c=(((Q=r.value)==null?void 0:Q[Se]())||"off")===o.on||void 0,l=r[xe](),h=r[$A],C;l instanceof og?(n=l[$A],s="radio",a="xfaRadio",C=((E=l[Ht])==null?void 0:E[$A])||l[$A]):(s="checkbox",a="xfaCheckbox",C=((f=r[Ht])==null?void 0:f[$A])||r[$A]);let B={name:"input",attributes:{class:[a],style:t,fieldId:h,dataId:C,type:s,checked:c,xfaOn:o.on,xfaOff:o.off,"aria-label":N0(r),"aria-required":!1}};return n&&(B.attributes.name=n),yn(r)&&(B.attributes["aria-required"]=!0,B.attributes.required=!0),dA.success({name:"label",attributes:{class:["xfaLabel"]},children:[B]})}},ng=class extends J{constructor(A){super(eA,"choiceList",!0),this.commitOn=O(A.commitOn,["select","exit"]),this.id=A.id||"",this.open=O(A.open,["userControl","always","multiSelect","onEntry"]),this.textEntry=GA({data:A.textEntry,defaultValue:0,validate:t=>t===1}),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[SA](A){var o,I,c;let t=lt(this,"border","margin"),s=this[MA]()[MA](),n={fontSize:`calc(${((o=s.font)==null?void 0:o.size)||10}px * var(--scale-factor))`},r=[];if(s.items.children.length>0){let l=s.items,h=0,C=0;l.children.length===2&&(h=l.children[0].save,C=1-h);let B=l.children[h][SA]().html,Q=l.children[C][SA]().html,E=!1,f=((I=s.value)==null?void 0:I[Se]())||"";for(let u=0,d=B.length;u<d;u++){let x={name:"option",attributes:{value:Q[u]||B[u],style:n},value:B[u]};Q[u]===f&&(x.attributes.selected=E=!0),r.push(x)}E||r.splice(0,0,{name:"option",attributes:{hidden:!0,selected:!0},value:" "})}let g={class:["xfaSelect"],fieldId:s[$A],dataId:((c=s[Ht])==null?void 0:c[$A])||s[$A],style:t,"aria-label":N0(s),"aria-required":!1};return yn(s)&&(g["aria-required"]=!0,g.required=!0),this.open==="multiSelect"&&(g.multiple=!0),dA.success({name:"label",attributes:{class:["xfaLabel"]},children:[{name:"select",children:r,attributes:g}]})}},Lc=class extends J{constructor(A){super(eA,"color",!0),this.cSpace=O(A.cSpace,["SRGB"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.value=A.value?X9(A.value):"",this.extras=null}[Oa](){return!1}[ZA](){return this.value?Ce.makeHexColor(this.value.r,this.value.g,this.value.b):null}},Hc=class extends J{constructor(A){super(eA,"comb"),this.id=A.id||"",this.numberOfCells=GA({data:A.numberOfCells,defaultValue:0,validate:t=>t>=0}),this.use=A.use||"",this.usehref=A.usehref||""}},Jc=class extends J{constructor(A){super(eA,"connect",!0),this.connection=A.connection||"",this.id=A.id||"",this.ref=A.ref||"",this.usage=O(A.usage,["exportAndImport","exportOnly","importOnly"]),this.use=A.use||"",this.usehref=A.usehref||"",this.picture=null}},_a=class extends J{constructor(A){super(eA,"contentArea",!0),this.h=hA(A.h),this.id=A.id||"",this.name=A.name||"",this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=hA(A.w),this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.desc=null,this.extras=null}[SA](A){let t=NA(this.x),i=NA(this.y),s={left:t,top:i,width:NA(this.w),height:NA(this.h)},a=["xfaContentarea"];return Vs(this)&&a.push("xfaPrintOnly"),dA.success({name:"div",children:[],attributes:{style:s,class:a,id:this[$A]}})}},rg=class extends J{constructor(A){super(eA,"corner",!0),this.id=A.id||"",this.inverted=GA({data:A.inverted,defaultValue:0,validate:t=>t===1}),this.join=O(A.join,["square","round"]),this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.radius=hA(A.radius),this.stroke=O(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=hA(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](){let A=lt(this,"visibility");return A.radius=NA(this.join==="square"?0:this.radius),A}},Yc=class extends ce{constructor(A){super(eA,"date"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=this[P].trim();this[P]=A?new Date(A):null}[SA](A){return A0(this[P]?this[P].toString():"")}},Kc=class extends ce{constructor(A){super(eA,"dateTime"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=this[P].trim();this[P]=A?new Date(A):null}[SA](A){return A0(this[P]?this[P].toString():"")}},vc=class extends J{constructor(A){super(eA,"dateTimeEdit",!0),this.hScrollPolicy=O(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.picker=O(A.picker,["host","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[SA](A){var a;let t=lt(this,"border","font","margin"),i=this[MA]()[MA](),s={name:"input",attributes:{type:"text",fieldId:i[$A],dataId:((a=i[Ht])==null?void 0:a[$A])||i[$A],class:["xfaTextfield"],style:t,"aria-label":N0(i),"aria-required":!1}};return yn(i)&&(s.attributes["aria-required"]=!0,s.attributes.required=!0),dA.success({name:"label",attributes:{class:["xfaLabel"]},children:[s]})}},qc=class extends ce{constructor(A){super(eA,"decimal"),this.fracDigits=GA({data:A.fracDigits,defaultValue:2,validate:t=>!0}),this.id=A.id||"",this.leadDigits=GA({data:A.leadDigits,defaultValue:-1,validate:t=>!0}),this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=parseFloat(this[P].trim());this[P]=isNaN(A)?null:A}[SA](A){return A0(this[P]!==null?this[P].toString():"")}},Tc=class extends J{constructor(A){super(eA,"defaultUi",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}},Pc=class extends J{constructor(A){super(eA,"desc",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new b,this.date=new b,this.dateTime=new b,this.decimal=new b,this.exData=new b,this.float=new b,this.image=new b,this.integer=new b,this.text=new b,this.time=new b}},Wc=class extends _A{constructor(A){super(eA,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}},Oc=class extends J{constructor(A){super(eA,"digestMethods",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.digestMethod=new b}},gg=class extends J{constructor(A){super(eA,"draw",!0),this.anchorType=O(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=GA({data:A.colSpan,defaultValue:1,validate:t=>t>=1||t===-1}),this.h=A.h?hA(A.h):"",this.hAlign=O(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=hA(A.maxH,"0pt"),this.maxW=hA(A.maxW,"0pt"),this.minH=hA(A.minH,"0pt"),this.minW=hA(A.minW,"0pt"),this.name=A.name||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=jt(A.relevant),this.rotate=GA({data:A.rotate,defaultValue:0,validate:t=>t%90===0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?hA(A.w):"",this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.assist=null,this.border=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.value=null,this.setProperty=new b}[Et](A){y1(this,A)}[SA](A){if(ro(this),this.presence==="hidden"||this.presence==="inactive")return dA.EMPTY;ao(this),this[Xs]();let t=this.w,i=this.h,{w:s,h:a,isBroken:n}=m1(this,A);if(s&&this.w===""){if(n&&this[xe]()[pi]())return this[Bt](),dA.FAILURE;this.w=s}if(a&&this.h===""&&(this.h=a),oo(this),!no(this,A))return this.w=t,this.h=i,this[Bt](),dA.FAILURE;Io(this);let r=lt(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");Vf(this,r),r.margin&&(r.padding=r.margin,delete r.margin);let g=["xfaDraw"];this.font&&g.push("xfaFont"),Vs(this)&&g.push("xfaPrintOnly");let o={style:r,id:this[$A],class:g};this.name&&(o.xfaName=this.name);let I={name:"div",attributes:o,children:[]};go(this,o);let c=_f(this,I,A),l=this.value?this.value[SA](A).html:null;return l===null?(this.w=t,this.h=i,this[Bt](),dA.success(m0(this,I),c)):(I.children.push(l),eu(this,r,l),this.w=t,this.h=i,this[Bt](),dA.success(m0(this,I),c))}},G0=class extends J{constructor(A){super(eA,"edge",!0),this.cap=O(A.cap,["square","butt","round"]),this.id=A.id||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.stroke=O(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=hA(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](){let A=lt(this,"visibility");if(Object.assign(A,{linecap:this.cap,width:NA(this.thickness),color:this.color?this.color[ZA]():"#000000",style:""}),this.presence!=="visible")A.style="none";else switch(this.stroke){case"solid":A.style="solid";break;case"dashDot":A.style="dashed";break;case"dashDotDot":A.style="dashed";break;case"dashed":A.style="dashed";break;case"dotted":A.style="dotted";break;case"embossed":A.style="ridge";break;case"etched":A.style="groove";break;case"lowered":A.style="inset";break;case"raised":A.style="outset";break}return A}},Zc=class extends _A{constructor(A){super(eA,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}},jc=class extends J{constructor(A){super(eA,"encodings",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encoding=new b}},Xc=class extends J{constructor(A){super(eA,"encrypt",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=null}},Vc=class extends J{constructor(A){super(eA,"encryptData",!0),this.id=A.id||"",this.operation=O(A.operation,["encrypt","decrypt"]),this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}},_c=class extends J{constructor(A){super(eA,"encryption",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new b}},zc=class extends _A{constructor(A){super(eA,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}},$c=class extends J{constructor(A){super(eA,"encryptionMethods",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encryptionMethod=new b}},Al=class extends J{constructor(A){super(eA,"event",!0),this.activity=O(A.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]),this.id=A.id||"",this.listen=O(A.listen,["refOnly","refAndDescendents"]),this.name=A.name||"",this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.encryptData=null,this.execute=null,this.script=null,this.signData=null,this.submit=null}},el=class extends ce{constructor(A){super(eA,"exData"),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.maxLength=GA({data:A.maxLength,defaultValue:-1,validate:t=>t>=-1}),this.name=A.name||"",this.rid=A.rid||"",this.transferEncoding=O(A.transferEncoding,["none","base64","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[d1](){return this.contentType==="text/html"}[ni](A){return this.contentType==="text/html"&&A[de]===me.xhtml.id?(this[P]=A,!0):this.contentType==="text/xml"?(this[P]=A,!0):!1}[SA](A){return this.contentType!=="text/html"||!this[P]?dA.EMPTY:this[P][SA](A)}},tl=class extends J{constructor(A){super(eA,"exObject",!0),this.archive=A.archive||"",this.classId=A.classId||"",this.codeBase=A.codeBase||"",this.codeType=A.codeType||"",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.boolean=new b,this.date=new b,this.dateTime=new b,this.decimal=new b,this.exData=new b,this.exObject=new b,this.float=new b,this.image=new b,this.integer=new b,this.text=new b,this.time=new b}},og=class extends J{constructor(A){super(eA,"exclGroup",!0),this.access=O(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=O(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=GA({data:A.colSpan,defaultValue:1,validate:t=>t>=1||t===-1}),this.h=A.h?hA(A.h):"",this.hAlign=O(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=O(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.maxH=hA(A.maxH,"0pt"),this.maxW=hA(A.maxW,"0pt"),this.minH=hA(A.minH,"0pt"),this.minW=hA(A.minW,"0pt"),this.name=A.name||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?hA(A.w):"",this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.margin=null,this.para=null,this.traversal=null,this.validate=null,this.connect=new b,this.event=new b,this.field=new b,this.setProperty=new b}[J0](){return!0}[Oa](){return!0}[Et](A){for(let t of this.field.children){if(!t.value){let i=new an({});t[Be](i),t.value=i}t.value[Et](A)}}[pi](){return this.layout.endsWith("-tb")&&this[L].attempt===0&&this[L].numberInLine>0||this[MA]()[pi]()}[di](){var t;let A=this[xe]();return A[di]()?this[L]._isSplittable!==void 0?this[L]._isSplittable:this.layout==="position"||this.layout.includes("row")?(this[L]._isSplittable=!1,!1):(t=A.layout)!=null&&t.endsWith("-tb")&&A[L].numberInLine!==0?!1:(this[L]._isSplittable=!0,!0):!1}[wn](){return au(this)}[d0](A,t){nu(this,A,t)}[x0](){return ru(this)}[SA](A){if(ro(this),this.presence==="hidden"||this.presence==="inactive"||this.h===0||this.w===0)return dA.EMPTY;ao(this);let t=[],i={id:this[$A],class:[]};p1(this,i.class),this[L]||(this[L]=Object.create(null)),Object.assign(this[L],{children:t,attributes:i,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});let s=this[di]();if(s||oo(this),!no(this,A))return dA.FAILURE;let a=new Set(["field"]);if(this.layout.includes("row")){let E=this[xe]().columnWidths;Array.isArray(E)&&E.length>0&&(this[L].columnWidths=E,this[L].currentColumn=0)}let n=lt(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),r=["xfaExclgroup"],g=zf(this);g&&r.push(g),Vs(this)&&r.push("xfaPrintOnly"),i.style=n,i.class=r,this.name&&(i.xfaName=this.name),this[Xs]();let o=this.layout==="lr-tb"||this.layout==="rl-tb",I=o?Ag:1;for(;this[L].attempt<I;this[L].attempt++){o&&this[L].attempt===Ag-1&&(this[L].numberInLine=0);let E=this[_i]({filter:a,include:!0});if(E.success)break;if(E.isBreak())return this[Bt](),E;if(o&&this[L].attempt===0&&this[L].numberInLine===0&&!this[ue]()[L].noLayoutFailure){this[L].attempt=I;break}}if(this[Bt](),s||Io(this),this[L].attempt===I)return s||delete this[L],dA.FAILURE;let c=0,l=0;this.margin&&(c=this.margin.leftInset+this.margin.rightInset,l=this.margin.topInset+this.margin.bottomInset);let h=Math.max(this[L].width+c,this.w||0),C=Math.max(this[L].height+l,this.h||0),B=[this.x,this.y,h,C];this.w===""&&(n.width=NA(h)),this.h===""&&(n.height=NA(C));let Q={name:"div",attributes:i,children:t};return go(this,i),delete this[L],dA.success(m0(this,Q),B)}},il=class extends J{constructor(A){super(eA,"execute"),this.connection=A.connection||"",this.executeType=O(A.executeType,["import","remerge"]),this.id=A.id||"",this.runAt=O(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}},sl=class extends J{constructor(A){super(eA,"extras",!0),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new b,this.date=new b,this.dateTime=new b,this.decimal=new b,this.exData=new b,this.extras=new b,this.float=new b,this.image=new b,this.integer=new b,this.text=new b,this.time=new b}},za=class extends J{constructor(A){super(eA,"field",!0),this.access=O(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=O(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=GA({data:A.colSpan,defaultValue:1,validate:t=>t>=1||t===-1}),this.h=A.h?hA(A.h):"",this.hAlign=O(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=hA(A.maxH,"0pt"),this.maxW=hA(A.maxW,"0pt"),this.minH=hA(A.minH,"0pt"),this.minW=hA(A.minW,"0pt"),this.name=A.name||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=jt(A.relevant),this.rotate=GA({data:A.rotate,defaultValue:0,validate:t=>t%90===0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?hA(A.w):"",this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.format=null,this.items=new b(2),this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.validate=null,this.value=null,this.bindItems=new b,this.connect=new b,this.event=new b,this.setProperty=new b}[J0](){return!0}[Et](A){y1(this,A)}[SA](A){var E,f,u;if(ro(this),!this.ui){this.ui=new sn({}),this.ui[ie]=this[ie],this[Be](this.ui);let d;switch(this.items.children.length){case 0:d=new Bg({}),this.ui.textEdit=d;break;case 1:d=new ag({}),this.ui.checkButton=d;break;case 2:d=new ng({}),this.ui.choiceList=d;break}this.ui[Be](d)}if(!this.ui||this.presence==="hidden"||this.presence==="inactive"||this.h===0||this.w===0)return dA.EMPTY;this.caption&&delete this.caption[L],this[Xs]();let t=this.caption?this.caption[SA](A).html:null,i=this.w,s=this.h,a=0,n=0;this.margin&&(a=this.margin.leftInset+this.margin.rightInset,n=this.margin.topInset+this.margin.bottomInset);let r=null;if(this.w===""||this.h===""){let d=null,x=null,p=0,m=0;if(this.ui.checkButton)p=m=this.ui.checkButton.size;else{let{w:D,h:S}=m1(this,A);D!==null?(p=D,m=S):m=_9(this.font,!0).lineNoGap}if(r=GE(this.ui[We]()),p+=r.w,m+=r.h,this.caption){let{w:D,h:S,isBroken:w}=this.caption[We](A);if(w&&this[xe]()[pi]())return this[Bt](),dA.FAILURE;switch(d=D,x=S,this.caption.placement){case"left":case"right":case"inline":d+=p;break;case"top":case"bottom":x+=m;break}}else d=p,x=m;d&&this.w===""&&(d+=a,this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1<d?d:this.minW)),x&&this.h===""&&(x+=n,this.h=Math.min(this.maxH<=0?1/0:this.maxH,this.minH+1<x?x:this.minH))}if(this[Bt](),ao(this),oo(this),!no(this,A))return this.w=i,this.h=s,this[Bt](),dA.FAILURE;Io(this);let g=lt(this,"font","dimensions","position","rotate","anchorType","presence","margin","hAlign");Vf(this,g);let o=["xfaField"];this.font&&o.push("xfaFont"),Vs(this)&&o.push("xfaPrintOnly");let I={style:g,id:this[$A],class:o};g.margin&&(g.padding=g.margin,delete g.margin),p1(this,o),this.name&&(I.xfaName=this.name);let c=[],l={name:"div",attributes:I,children:c};go(this,I);let h=this.border?this.border[ZA]():null,C=_f(this,l,A),B=this.ui[SA]().html;if(!B)return Object.assign(g,h),dA.success(m0(this,l),C);this[qt]&&((E=B.children)!=null&&E[0]?B.children[0].attributes.tabindex=this[qt]:B.attributes.tabindex=this[qt]),B.attributes.style||(B.attributes.style=Object.create(null));let Q=null;if(this.ui.button?(B.children.length===1&&([Q]=B.children.splice(0,1)),Object.assign(B.attributes.style,h)):Object.assign(g,h),c.push(B),this.value){if(this.ui.imageEdit)B.children.push(this.value[SA]().html);else if(!this.ui.button){let d="";if(this.value.exData)d=this.value.exData[Se]();else if(this.value.text)d=this.value.text[We]();else{let x=this.value[SA]().html;x!==null&&(d=x.children[0].value)}this.ui.textEdit&&((f=this.value.text)!=null&&f.maxChars)&&(B.children[0].attributes.maxLength=this.value.text.maxChars),d&&(this.ui.numericEdit&&(d=parseFloat(d),d=isNaN(d)?"":d.toString()),B.children[0].name==="textarea"?B.children[0].attributes.textContent=d:B.children[0].attributes.value=d)}}if(!this.ui.imageEdit&&((u=B.children)!=null&&u[0])&&this.h){r=r||GE(this.ui[We]());let d=0;if(this.caption&&["top","bottom"].includes(this.caption.placement)){d=this.caption.reserve,d<=0&&(d=this.caption[We](A).h);let x=this.h-d-n-r.h;B.children[0].attributes.style.height=NA(x)}else B.children[0].attributes.style.height="100%"}if(Q&&B.children.push(Q),!t)return B.attributes.class&&B.attributes.class.push("xfaLeft"),this.w=i,this.h=s,dA.success(m0(this,l),C);if(this.ui.button)return g.padding&&delete g.padding,t.name==="div"&&(t.name="span"),B.children.push(t),dA.success(l,C);switch(this.ui.checkButton&&(t.attributes.class[0]="xfaCaptionForCheckButton"),B.attributes.class||(B.attributes.class=[]),B.children.splice(0,0,t),this.caption.placement){case"left":B.attributes.class.push("xfaLeft");break;case"right":B.attributes.class.push("xfaRight");break;case"top":B.attributes.class.push("xfaTop");break;case"bottom":B.attributes.class.push("xfaBottom");break;case"inline":B.attributes.class.push("xfaLeft");break}return this.w=i,this.h=s,dA.success(m0(this,l),C)}},al=class extends J{constructor(A){super(eA,"fill",!0),this.id=A.id||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null,this.linear=null,this.pattern=null,this.radial=null,this.solid=null,this.stipple=null}[ZA](){var r;let A=this[MA](),i=A[MA]()[MA](),s=Object.create(null),a="color",n=a;A instanceof tg&&(a="background-color",n="background",i instanceof sn&&(s.backgroundColor="white")),(A instanceof lg||A instanceof eg)&&(a=n="fill",s.fill="white");for(let g of Object.getOwnPropertyNames(this)){if(g==="extras"||g==="color")continue;let o=this[g];if(!(o instanceof J))continue;let I=o[ZA](this.color);return I&&(s[I.startsWith("#")?a:n]=I),s}if((r=this.color)!=null&&r.value){let g=this.color[ZA]();s[g.startsWith("#")?a:n]=g}return s}},nl=class extends J{constructor(A){super(eA,"filter",!0),this.addRevocationInfo=O(A.addRevocationInfo,["","required","optional","none"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.version=GA({data:this.version,defaultValue:5,validate:t=>t>=1&&t<=5}),this.appearanceFilter=null,this.certificates=null,this.digestMethods=null,this.encodings=null,this.encryptionMethods=null,this.handler=null,this.lockDocument=null,this.mdp=null,this.reasons=null,this.timeStamp=null}},rl=class extends ce{constructor(A){super(eA,"float"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=parseFloat(this[P].trim());this[P]=isNaN(A)?null:A}[SA](A){return A0(this[P]!==null?this[P].toString():"")}},gl=class extends J{constructor(A){super(eA,"font",!0),this.baselineShift=hA(A.baselineShift),this.fontHorizontalScale=_r({data:A.fontHorizontalScale,defaultValue:100,validate:t=>t>=0}),this.fontVerticalScale=_r({data:A.fontVerticalScale,defaultValue:100,validate:t=>t>=0}),this.id=A.id||"",this.kerningMode=O(A.kerningMode,["none","pair"]),this.letterSpacing=hA(A.letterSpacing,"0"),this.lineThrough=GA({data:A.lineThrough,defaultValue:0,validate:t=>t===1||t===2}),this.lineThroughPeriod=O(A.lineThroughPeriod,["all","word"]),this.overline=GA({data:A.overline,defaultValue:0,validate:t=>t===1||t===2}),this.overlinePeriod=O(A.overlinePeriod,["all","word"]),this.posture=O(A.posture,["normal","italic"]),this.size=hA(A.size,"10pt"),this.typeface=A.typeface||"Courier",this.underline=GA({data:A.underline,defaultValue:0,validate:t=>t===1||t===2}),this.underlinePeriod=O(A.underlinePeriod,["all","word"]),this.use=A.use||"",this.usehref=A.usehref||"",this.weight=O(A.weight,["normal","bold"]),this.extras=null,this.fill=null}[Yt](A){super[Yt](A),this[ie].usedTypefaces.add(this.typeface)}[ZA](){let A=lt(this,"fill"),t=A.color;return t&&(t==="#000000"?delete A.color:t.startsWith("#")||(A.background=t,A.backgroundClip="text",A.color="transparent")),this.baselineShift&&(A.verticalAlign=NA(this.baselineShift)),A.fontKerning=this.kerningMode==="none"?"none":"normal",A.letterSpacing=NA(this.letterSpacing),this.lineThrough!==0&&(A.textDecoration="line-through",this.lineThrough===2&&(A.textDecorationStyle="double")),this.overline!==0&&(A.textDecoration="overline",this.overline===2&&(A.textDecorationStyle="double")),A.fontStyle=this.posture,A.fontSize=NA(.99*this.size),tu(this,this,this[ie].fontFinder,A),this.underline!==0&&(A.textDecoration="underline",this.underline===2&&(A.textDecorationStyle="double")),A.fontWeight=this.weight,A}},ol=class extends J{constructor(A){super(eA,"format",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null}},Il=class extends qA{constructor(A){super(eA,"handler"),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}},cl=class extends J{constructor(A){super(eA,"hyphenation"),this.excludeAllCaps=GA({data:A.excludeAllCaps,defaultValue:0,validate:t=>t===1}),this.excludeInitialCap=GA({data:A.excludeInitialCap,defaultValue:0,validate:t=>t===1}),this.hyphenate=GA({data:A.hyphenate,defaultValue:0,validate:t=>t===1}),this.id=A.id||"",this.pushCharacterCount=GA({data:A.pushCharacterCount,defaultValue:3,validate:t=>t>=0}),this.remainCharacterCount=GA({data:A.remainCharacterCount,defaultValue:3,validate:t=>t>=0}),this.use=A.use||"",this.usehref=A.usehref||"",this.wordCharacterCount=GA({data:A.wordCharacterCount,defaultValue:7,validate:t=>t>=0})}},Ig=class extends qA{constructor(A){super(eA,"image"),this.aspect=O(A.aspect,["fit","actual","height","none","width"]),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.name=A.name||"",this.transferEncoding=O(A.transferEncoding,["base64","none","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[SA](){if(this.contentType&&!nx.has(this.contentType.toLowerCase()))return dA.EMPTY;let A=this[ie].images&&this[ie].images.get(this.href);if(!A&&(this.href||!this[P])||(!A&&this.transferEncoding==="base64"&&(A=Pe(atob(this[P]))),!A))return dA.EMPTY;if(!this.contentType){for(let[a,n]of rx)if(A.length>a.length&&a.every((r,g)=>r===A[g])){this.contentType=n;break}if(!this.contentType)return dA.EMPTY}let t=new Blob([A],{type:this.contentType}),i;switch(this.aspect){case"fit":case"actual":break;case"height":i={height:"100%",objectFit:"fill"};break;case"none":i={width:"100%",height:"100%",objectFit:"fill"};break;case"width":i={width:"100%",objectFit:"fill"};break}let s=this[MA]();return dA.success({name:"img",attributes:{class:["xfaImage"],style:i,src:URL.createObjectURL(t),alt:s?N0(s[MA]()):null}})}},ll=class extends J{constructor(A){super(eA,"imageEdit",!0),this.data=O(A.data,["link","embed"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[SA](A){return this.data==="embed"?dA.success({name:"div",children:[],attributes:{}}):dA.EMPTY}},hl=class extends ce{constructor(A){super(eA,"integer"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=parseInt(this[P].trim(),10);this[P]=isNaN(A)?null:A}[SA](A){return A0(this[P]!==null?this[P].toString():"")}},Cl=class extends J{constructor(A){super(eA,"issuers",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new b}},$a=class extends J{constructor(A){super(eA,"items",!0),this.id=A.id||"",this.name=A.name||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.ref=A.ref||"",this.save=GA({data:A.save,defaultValue:0,validate:t=>t===1}),this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new b,this.date=new b,this.dateTime=new b,this.decimal=new b,this.exData=new b,this.float=new b,this.image=new b,this.integer=new b,this.text=new b,this.time=new b}[SA](){let A=[];for(let t of this[Ue]())A.push(t[Se]());return dA.success(A)}},Bl=class extends J{constructor(A){super(eA,"keep",!0),this.id=A.id||"";let t=["none","contentArea","pageArea"];this.intact=O(A.intact,t),this.next=O(A.next,t),this.previous=O(A.previous,t),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}},Ql=class extends J{constructor(A){super(eA,"keyUsage");let t=["","yes","no"];this.crlSign=O(A.crlSign,t),this.dataEncipherment=O(A.dataEncipherment,t),this.decipherOnly=O(A.decipherOnly,t),this.digitalSignature=O(A.digitalSignature,t),this.encipherOnly=O(A.encipherOnly,t),this.id=A.id||"",this.keyAgreement=O(A.keyAgreement,t),this.keyCertSign=O(A.keyCertSign,t),this.keyEncipherment=O(A.keyEncipherment,t),this.nonRepudiation=O(A.nonRepudiation,t),this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}},El=class extends J{constructor(A){super(eA,"line",!0),this.hand=O(A.hand,["even","left","right"]),this.id=A.id||"",this.slope=O(A.slope,["\\\\","/"]),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null}[SA](){let A=this[MA]()[MA](),t=this.edge||new G0({}),i=t[ZA](),s=Object.create(null),a=t.presence==="visible"?t.thickness:0;s.strokeWidth=NA(a),s.stroke=i.color;let n,r,g,o,I="100%",c="100%";A.w<=a?([n,r,g,o]=["50%",0,"50%","100%"],I=s.strokeWidth):A.h<=a?([n,r,g,o]=[0,"50%","100%","50%"],c=s.strokeWidth):this.slope==="\\\\"?[n,r,g,o]=[0,0,"100%","100%"]:[n,r,g,o]=[0,"100%","100%",0];let h={name:"svg",children:[{name:"line",attributes:{xmlns:p0,x1:n,y1:r,x2:g,y2:o,style:s}}],attributes:{xmlns:p0,width:I,height:c,style:{overflow:"visible"}}};return w1(A)?dA.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[h]}):(h.attributes.style.position="absolute",dA.success(h))}},fl=class extends J{constructor(A){super(eA,"linear",!0),this.id=A.id||"",this.type=O(A.type,["toRight","toBottom","toLeft","toTop"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](A){A=A?A[ZA]():"#FFFFFF";let t=this.type.replace(/([RBLT])/," $1").toLowerCase(),i=this.color?this.color[ZA]():"#000000";return`linear-gradient(${t}, ${A}, ${i})`}},ul=class extends ce{constructor(A){super(eA,"lockDocument"),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}[se](){this[P]=O(this[P],["auto","0","1"])}},dl=class extends J{constructor(A){super(eA,"manifest",!0),this.action=O(A.action,["include","all","exclude"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.ref=new b}},xl=class extends J{constructor(A){super(eA,"margin",!0),this.bottomInset=hA(A.bottomInset,"0"),this.id=A.id||"",this.leftInset=hA(A.leftInset,"0"),this.rightInset=hA(A.rightInset,"0"),this.topInset=hA(A.topInset,"0"),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[ZA](){return{margin:NA(this.topInset)+" "+NA(this.rightInset)+" "+NA(this.bottomInset)+" "+NA(this.leftInset)}}},ml=class extends J{constructor(A){super(eA,"mdp"),this.id=A.id||"",this.permissions=GA({data:A.permissions,defaultValue:2,validate:t=>t===1||t===3}),this.signatureType=O(A.signatureType,["filler","author"]),this.use=A.use||"",this.usehref=A.usehref||""}},pl=class extends J{constructor(A){super(eA,"medium"),this.id=A.id||"",this.imagingBBox=V9(A.imagingBBox),this.long=hA(A.long),this.orientation=O(A.orientation,["portrait","landscape"]),this.short=hA(A.short),this.stock=A.stock||"",this.trayIn=O(A.trayIn,["auto","delegate","pageFront"]),this.trayOut=O(A.trayOut,["auto","delegate"]),this.use=A.use||"",this.usehref=A.usehref||""}},wl=class extends J{constructor(A){super(eA,"message",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.text=new b}},yl=class extends J{constructor(A){super(eA,"numericEdit",!0),this.hScrollPolicy=O(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[SA](A){var a;let t=lt(this,"border","font","margin"),i=this[MA]()[MA](),s={name:"input",attributes:{type:"text",fieldId:i[$A],dataId:((a=i[Ht])==null?void 0:a[$A])||i[$A],class:["xfaTextfield"],style:t,"aria-label":N0(i),"aria-required":!1}};return yn(i)&&(s.attributes["aria-required"]=!0,s.attributes.required=!0),dA.success({name:"label",attributes:{class:["xfaLabel"]},children:[s]})}},bl=class extends J{constructor(A){super(eA,"occur",!0),this.id=A.id||"",this.initial=A.initial!==""?GA({data:A.initial,defaultValue:"",validate:t=>!0}):"",this.max=A.max!==""?GA({data:A.max,defaultValue:1,validate:t=>!0}):"",this.min=A.min!==""?GA({data:A.min,defaultValue:1,validate:t=>!0}):"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[Yt](){let A=this[MA](),t=this.min;this.min===""&&(this.min=A instanceof zi||A instanceof U0?0:1),this.max===""&&(t===""?this.max=A instanceof zi||A instanceof U0?-1:1:this.max=this.min),this.max!==-1&&this.max<this.min&&(this.max=this.min),this.initial===""&&(this.initial=A instanceof tn?1:this.min)}},Dl=class extends qA{constructor(A){super(eA,"oid"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},kl=class extends J{constructor(A){super(eA,"oids",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.oid=new b}},cg=class extends J{constructor(A){super(eA,"overflow"),this.id=A.id||"",this.leader=A.leader||"",this.target=A.target||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}[We](){if(!this[L]){let A=this[MA](),t=this[ue](),i=t[Bi](this.target,A),s=t[Bi](this.leader,A),a=t[Bi](this.trailer,A);this[L]={target:(i==null?void 0:i[0])||null,leader:(s==null?void 0:s[0])||null,trailer:(a==null?void 0:a[0])||null,addLeader:!1,addTrailer:!1}}return this[L]}},zi=class extends J{constructor(A){super(eA,"pageArea",!0),this.blankOrNotBlank=O(A.blankOrNotBlank,["any","blank","notBlank"]),this.id=A.id||"",this.initialNumber=GA({data:A.initialNumber,defaultValue:1,validate:t=>!0}),this.name=A.name||"",this.numbered=GA({data:A.numbered,defaultValue:1,validate:t=>!0}),this.oddOrEven=O(A.oddOrEven,["any","even","odd"]),this.pagePosition=O(A.pagePosition,["any","first","last","only","rest"]),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.desc=null,this.extras=null,this.medium=null,this.occur=null,this.area=new b,this.contentArea=new b,this.draw=new b,this.exclGroup=new b,this.field=new b,this.subform=new b}[ja](){return this[L]?!this.occur||this.occur.max===-1||this[L].numberOfUse<this.occur.max:(this[L]={numberOfUse:0},!0)}[ns](){delete this[L]}[Ci](){this[L]||(this[L]={numberOfUse:0});let A=this[MA]();return A.relation==="orderedOccurrence"&&this[ja]()?(this[L].numberOfUse+=1,this):A[Ci]()}[x0](){return this[L].space||{width:0,height:0}}[SA](){this[L]||(this[L]={numberOfUse:1});let A=[];this[L].children=A;let t=Object.create(null);if(this.medium&&this.medium.short&&this.medium.long){if(t.width=NA(this.medium.short),t.height=NA(this.medium.long),this[L].space={width:this.medium.short,height:this.medium.long},this.medium.orientation==="landscape"){let i=t.width;t.width=t.height,t.height=i,this[L].space={width:this.medium.long,height:this.medium.short}}}else k("XFA - No medium specified in pageArea: please file a bug.");return this[_i]({filter:new Set(["area","draw","field","subform"]),include:!0}),this[_i]({filter:new Set(["contentArea"]),include:!0}),dA.success({name:"div",children:A,attributes:{class:["xfaPage"],id:this[$A],style:t,xfaName:this.name}})}},U0=class extends J{constructor(A){super(eA,"pageSet",!0),this.duplexImposition=O(A.duplexImposition,["longEdge","shortEdge"]),this.id=A.id||"",this.name=A.name||"",this.relation=O(A.relation,["orderedOccurrence","duplexPaginated","simplexPaginated"]),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.occur=null,this.pageArea=new b,this.pageSet=new b}[ns](){for(let A of this.pageArea.children)A[ns]();for(let A of this.pageSet.children)A[ns]()}[ja](){return!this.occur||this.occur.max===-1||this[L].numberOfUse<this.occur.max}[Ci](){if(this[L]||(this[L]={numberOfUse:1,pageIndex:-1,pageSetIndex:-1}),this.relation==="orderedOccurrence"){if(this[L].pageIndex+1<this.pageArea.children.length)return this[L].pageIndex+=1,this.pageArea.children[this[L].pageIndex][Ci]();if(this[L].pageSetIndex+1<this.pageSet.children.length)return this[L].pageSetIndex+=1,this.pageSet.children[this[L].pageSetIndex][Ci]();if(this[ja]())return this[L].numberOfUse+=1,this[L].pageIndex=-1,this[L].pageSetIndex=-1,this[Ci]();let a=this[MA]();return a instanceof U0?a[Ci]():(this[ns](),this[Ci]())}let A=this[ue]()[L].pageNumber,t=A%2===0?"even":"odd",i=A===0?"first":"rest",s=this.pageArea.children.find(a=>a.oddOrEven===t&&a.pagePosition===i);return s||(s=this.pageArea.children.find(a=>a.oddOrEven==="any"&&a.pagePosition===i),s)||(s=this.pageArea.children.find(a=>a.oddOrEven==="any"&&a.pagePosition==="any"),s)?s:this.pageArea.children[0]}},Sl=class extends J{constructor(A){super(eA,"para",!0),this.hAlign=O(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.lineHeight=A.lineHeight?hA(A.lineHeight,"0pt"):"",this.marginLeft=A.marginLeft?hA(A.marginLeft,"0pt"):"",this.marginRight=A.marginRight?hA(A.marginRight,"0pt"):"",this.orphans=GA({data:A.orphans,defaultValue:0,validate:t=>t>=0}),this.preserve=A.preserve||"",this.radixOffset=A.radixOffset?hA(A.radixOffset,"0pt"):"",this.spaceAbove=A.spaceAbove?hA(A.spaceAbove,"0pt"):"",this.spaceBelow=A.spaceBelow?hA(A.spaceBelow,"0pt"):"",this.tabDefault=A.tabDefault?hA(this.tabDefault):"",this.tabStops=(A.tabStops||"").trim().split(/\\s+/).map((t,i)=>i%2===1?hA(t):t),this.textIndent=A.textIndent?hA(A.textIndent,"0pt"):"",this.use=A.use||"",this.usehref=A.usehref||"",this.vAlign=O(A.vAlign,["top","bottom","middle"]),this.widows=GA({data:A.widows,defaultValue:0,validate:t=>t>=0}),this.hyphenation=null}[ZA](){let A=lt(this,"hAlign");return this.marginLeft!==""&&(A.paddingLeft=NA(this.marginLeft)),this.marginRight!==""&&(A.paddingight=NA(this.marginRight)),this.spaceAbove!==""&&(A.paddingTop=NA(this.spaceAbove)),this.spaceBelow!==""&&(A.paddingBottom=NA(this.spaceBelow)),this.textIndent!==""&&(A.textIndent=NA(this.textIndent),$f(A)),this.lineHeight>0&&(A.lineHeight=NA(this.lineHeight)),this.tabDefault!==""&&(A.tabSize=NA(this.tabDefault)),this.tabStops.length>0,this.hyphenatation&&Object.assign(A,this.hyphenatation[ZA]()),A}},Fl=class extends J{constructor(A){super(eA,"passwordEdit",!0),this.hScrollPolicy=O(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.passwordChar=A.passwordChar||"*",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}},Rl=class extends J{constructor(A){super(eA,"pattern",!0),this.id=A.id||"",this.type=O(A.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](A){A=A?A[ZA]():"#FFFFFF";let t=this.color?this.color[ZA]():"#000000",i=5,s="repeating-linear-gradient",a=`${A},${A} ${i}px,${t} ${i}px,${t} ${2*i}px`;switch(this.type){case"crossHatch":return`${s}(to top,${a}) ${s}(to right,${a})`;case"crossDiagonal":return`${s}(45deg,${a}) ${s}(-45deg,${a})`;case"diagonalLeft":return`${s}(45deg,${a})`;case"diagonalRight":return`${s}(-45deg,${a})`;case"horizontal":return`${s}(to top,${a})`;case"vertical":return`${s}(to right,${a})`}return""}},Nl=class extends qA{constructor(A){super(eA,"picture"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}},Gl=class extends J{constructor(A){super(eA,"proto",!0),this.appearanceFilter=new b,this.arc=new b,this.area=new b,this.assist=new b,this.barcode=new b,this.bindItems=new b,this.bookend=new b,this.boolean=new b,this.border=new b,this.break=new b,this.breakAfter=new b,this.breakBefore=new b,this.button=new b,this.calculate=new b,this.caption=new b,this.certificate=new b,this.certificates=new b,this.checkButton=new b,this.choiceList=new b,this.color=new b,this.comb=new b,this.connect=new b,this.contentArea=new b,this.corner=new b,this.date=new b,this.dateTime=new b,this.dateTimeEdit=new b,this.decimal=new b,this.defaultUi=new b,this.desc=new b,this.digestMethod=new b,this.digestMethods=new b,this.draw=new b,this.edge=new b,this.encoding=new b,this.encodings=new b,this.encrypt=new b,this.encryptData=new b,this.encryption=new b,this.encryptionMethod=new b,this.encryptionMethods=new b,this.event=new b,this.exData=new b,this.exObject=new b,this.exclGroup=new b,this.execute=new b,this.extras=new b,this.field=new b,this.fill=new b,this.filter=new b,this.float=new b,this.font=new b,this.format=new b,this.handler=new b,this.hyphenation=new b,this.image=new b,this.imageEdit=new b,this.integer=new b,this.issuers=new b,this.items=new b,this.keep=new b,this.keyUsage=new b,this.line=new b,this.linear=new b,this.lockDocument=new b,this.manifest=new b,this.margin=new b,this.mdp=new b,this.medium=new b,this.message=new b,this.numericEdit=new b,this.occur=new b,this.oid=new b,this.oids=new b,this.overflow=new b,this.pageArea=new b,this.pageSet=new b,this.para=new b,this.passwordEdit=new b,this.pattern=new b,this.picture=new b,this.radial=new b,this.reason=new b,this.reasons=new b,this.rectangle=new b,this.ref=new b,this.script=new b,this.setProperty=new b,this.signData=new b,this.signature=new b,this.signing=new b,this.solid=new b,this.speak=new b,this.stipple=new b,this.subform=new b,this.subformSet=new b,this.subjectDN=new b,this.subjectDNs=new b,this.submit=new b,this.text=new b,this.textEdit=new b,this.time=new b,this.timeStamp=new b,this.toolTip=new b,this.traversal=new b,this.traverse=new b,this.ui=new b,this.validate=new b,this.value=new b,this.variables=new b}},Ul=class extends J{constructor(A){super(eA,"radial",!0),this.id=A.id||"",this.type=O(A.type,["toEdge","toCenter"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](A){A=A?A[ZA]():"#FFFFFF";let t=this.color?this.color[ZA]():"#000000";return`radial-gradient(circle at center, ${this.type==="toEdge"?`${A},${t}`:`${t},${A}`})`}},Ml=class extends qA{constructor(A){super(eA,"reason"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},Ll=class extends J{constructor(A){super(eA,"reasons",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.reason=new b}},lg=class extends J{constructor(A){super(eA,"rectangle",!0),this.hand=O(A.hand,["even","left","right"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new b(4),this.edge=new b(4),this.fill=null}[SA](){var o;let A=this.edge.children.length?this.edge.children[0]:new G0({}),t=A[ZA](),i=Object.create(null);((o=this.fill)==null?void 0:o.presence)==="visible"?Object.assign(i,this.fill[ZA]()):i.fill="transparent",i.strokeWidth=NA(A.presence==="visible"?A.thickness:0),i.stroke=t.color;let a=(this.corner.children.length?this.corner.children[0]:new rg({}))[ZA](),r={name:"svg",children:[{name:"rect",attributes:{xmlns:p0,width:"100%",height:"100%",x:0,y:0,rx:a.radius,ry:a.radius,style:i}}],attributes:{xmlns:p0,style:{overflow:"visible"},width:"100%",height:"100%"}},g=this[MA]()[MA]();return w1(g)?dA.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[r]}):(r.attributes.style.position="absolute",dA.success(r))}},Hl=class extends qA{constructor(A){super(eA,"ref"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}},Jl=class extends qA{constructor(A){super(eA,"script"),this.binding=A.binding||"",this.contentType=A.contentType||"",this.id=A.id||"",this.name=A.name||"",this.runAt=O(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}},An=class extends J{constructor(A){super(eA,"setProperty"),this.connection=A.connection||"",this.ref=A.ref||"",this.target=A.target||""}},Yl=class extends J{constructor(A){super(eA,"signData",!0),this.id=A.id||"",this.operation=O(A.operation,["sign","clear","verify"]),this.ref=A.ref||"",this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}},Kl=class extends J{constructor(A){super(eA,"signature",!0),this.id=A.id||"",this.type=O(A.type,["PDF1.3","PDF1.6"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.filter=null,this.manifest=null,this.margin=null}},vl=class extends J{constructor(A){super(eA,"signing",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new b}},ql=class extends J{constructor(A){super(eA,"solid",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[ZA](A){return A?A[ZA]():"#FFFFFF"}},Tl=class extends qA{constructor(A){super(eA,"speak"),this.disable=GA({data:A.disable,defaultValue:0,validate:t=>t===1}),this.id=A.id||"",this.priority=O(A.priority,["custom","caption","name","toolTip"]),this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}},Pl=class extends J{constructor(A){super(eA,"stipple",!0),this.id=A.id||"",this.rate=GA({data:A.rate,defaultValue:50,validate:t=>t>=0&&t<=100}),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[ZA](A){let t=this.rate/100;return Ce.makeHexColor(Math.round(A.value.r*(1-t)+this.value.r*t),Math.round(A.value.g*(1-t)+this.value.g*t),Math.round(A.value.b*(1-t)+this.value.b*t))}},hg=class extends J{constructor(A){super(eA,"subform",!0),this.access=O(A.access,["open","nonInteractive","protected","readOnly"]),this.allowMacro=GA({data:A.allowMacro,defaultValue:0,validate:t=>t===1}),this.anchorType=O(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=GA({data:A.colSpan,defaultValue:1,validate:t=>t>=1||t===-1}),this.columnWidths=(A.columnWidths||"").trim().split(/\\s+/).map(t=>t==="-1"?-1:hA(t)),this.h=A.h?hA(A.h):"",this.hAlign=O(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=O(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.locale=A.locale||"",this.maxH=hA(A.maxH,"0pt"),this.maxW=hA(A.maxW,"0pt"),this.mergeMode=O(A.mergeMode,["consumeData","matchTemplate"]),this.minH=hA(A.minH,"0pt"),this.minW=hA(A.minW,"0pt"),this.name=A.name||"",this.presence=O(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=jt(A.relevant),this.restoreState=O(A.restoreState,["manual","auto"]),this.scope=O(A.scope,["name","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?hA(A.w):"",this.x=hA(A.x,"0pt"),this.y=hA(A.y,"0pt"),this.assist=null,this.bind=null,this.bookend=null,this.border=null,this.break=null,this.calculate=null,this.desc=null,this.extras=null,this.keep=null,this.margin=null,this.occur=null,this.overflow=null,this.pageSet=null,this.para=null,this.traversal=null,this.validate=null,this.variables=null,this.area=new b,this.breakAfter=new b,this.breakBefore=new b,this.connect=new b,this.draw=new b,this.event=new b,this.exObject=new b,this.exclGroup=new b,this.field=new b,this.proto=new b,this.setProperty=new b,this.subform=new b,this.subformSet=new b}[xe](){let A=this[MA]();return A instanceof en?A[xe]():A}[J0](){return!0}[pi](){return this.layout.endsWith("-tb")&&this[L].attempt===0&&this[L].numberInLine>0||this[MA]()[pi]()}*[Ys](){yield*b1(this)}[wn](){return au(this)}[d0](A,t){nu(this,A,t)}[x0](){return ru(this)}[di](){var t;let A=this[xe]();return A[di]()?this[L]._isSplittable!==void 0?this[L]._isSplittable:this.layout==="position"||this.layout.includes("row")?(this[L]._isSplittable=!1,!1):this.keep&&this.keep.intact!=="none"?(this[L]._isSplittable=!1,!1):(t=A.layout)!=null&&t.endsWith("-tb")&&A[L].numberInLine!==0?!1:(this[L]._isSplittable=!0,!0):!1}[SA](A){var d;if(ro(this),this.break){if(this.break.after!=="auto"||this.break.afterTarget!==""){let x=new ig({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});x[ie]=this[ie],this[Be](x),this.breakAfter.push(x)}if(this.break.before!=="auto"||this.break.beforeTarget!==""){let x=new sg({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});x[ie]=this[ie],this[Be](x),this.breakBefore.push(x)}if(this.break.overflowTarget!==""){let x=new cg({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});x[ie]=this[ie],this[Be](x),this.overflow.push(x)}this[Ti](this.break),this.break=null}if(this.presence==="hidden"||this.presence==="inactive")return dA.EMPTY;if((this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&k("XFA - Several breakBefore or breakAfter in subforms: please file a bug."),this.breakBefore.children.length>=1){let x=this.breakBefore.children[0];if(UE(x))return dA.breakNode(x)}if((d=this[L])!=null&&d.afterBreakAfter)return dA.EMPTY;ao(this);let t=[],i={id:this[$A],class:[]};p1(this,i.class),this[L]||(this[L]=Object.create(null)),Object.assign(this[L],{children:t,line:null,attributes:i,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});let s=this[ue](),a=s[L].noLayoutFailure,n=this[di]();if(n||oo(this),!no(this,A))return dA.FAILURE;let r=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){let x=this[xe]().columnWidths;Array.isArray(x)&&x.length>0&&(this[L].columnWidths=x,this[L].currentColumn=0)}let g=lt(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),o=["xfaSubform"],I=zf(this);if(I&&o.push(I),i.style=g,i.class=o,this.name&&(i.xfaName=this.name),this.overflow){let x=this.overflow[We]();x.addLeader&&(x.addLeader=!1,ME(this,x.leader,A))}this[Xs]();let c=this.layout==="lr-tb"||this.layout==="rl-tb",l=c?Ag:1;for(;this[L].attempt<l;this[L].attempt++){c&&this[L].attempt===Ag-1&&(this[L].numberInLine=0);let x=this[_i]({filter:r,include:!0});if(x.success)break;if(x.isBreak())return this[Bt](),x;if(c&&this[L].attempt===0&&this[L].numberInLine===0&&!s[L].noLayoutFailure){this[L].attempt=l;break}}if(this[Bt](),n||Io(this),s[L].noLayoutFailure=a,this[L].attempt===l)return this.overflow&&(this[ue]()[L].overflowNode=this.overflow),n||delete this[L],dA.FAILURE;if(this.overflow){let x=this.overflow[We]();x.addTrailer&&(x.addTrailer=!1,ME(this,x.trailer,A))}let h=0,C=0;this.margin&&(h=this.margin.leftInset+this.margin.rightInset,C=this.margin.topInset+this.margin.bottomInset);let B=Math.max(this[L].width+h,this.w||0),Q=Math.max(this[L].height+C,this.h||0),E=[this.x,this.y,B,Q];if(this.w===""&&(g.width=NA(B)),this.h===""&&(g.height=NA(Q)),(g.width==="0px"||g.height==="0px")&&t.length===0)return dA.EMPTY;let f={name:"div",attributes:i,children:t};go(this,i);let u=dA.success(m0(this,f),E);if(this.breakAfter.children.length>=1){let x=this.breakAfter.children[0];if(UE(x))return this[L].afterBreakAfter=u,dA.breakNode(x)}return delete this[L],u}},en=class extends J{constructor(A){super(eA,"subformSet",!0),this.id=A.id||"",this.name=A.name||"",this.relation=O(A.relation,["ordered","choice","unordered"]),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.bookend=null,this.break=null,this.desc=null,this.extras=null,this.occur=null,this.overflow=null,this.breakAfter=new b,this.breakBefore=new b,this.subform=new b,this.subformSet=new b}*[Ys](){yield*b1(this)}[xe](){let A=this[MA]();for(;!(A instanceof hg);)A=A[MA]();return A}[J0](){return!0}},Wl=class extends ce{constructor(A){super(eA,"subjectDN"),this.delimiter=A.delimiter||",",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){this[P]=new Map(this[P].split(this.delimiter).map(A=>(A=A.split("=",2),A[0]=A[0].trim(),A)))}},Ol=class extends J{constructor(A){super(eA,"subjectDNs",!0),this.id=A.id||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.subjectDN=new b}},Zl=class extends J{constructor(A){super(eA,"submit",!0),this.embedPDF=GA({data:A.embedPDF,defaultValue:0,validate:t=>t===1}),this.format=O(A.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]),this.id=A.id||"",this.target=A.target||"",this.textEncoding=so({data:A.textEncoding?A.textEncoding.toLowerCase():"",defaultValue:"",validate:t=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(t)||t.match(/iso-8859-\\d{2}/)}),this.use=A.use||"",this.usehref=A.usehref||"",this.xdpContent=A.xdpContent||"",this.encrypt=null,this.encryptData=new b,this.signData=new b}},tn=class extends J{constructor(A){super(eA,"template",!0),this.baseProfile=O(A.baseProfile,["full","interactiveForms"]),this.extras=null,this.subform=new b}[se](){this.subform.children.length===0&&k("XFA - No subforms in template node."),this.subform.children.length>=2&&k("XFA - Several subforms in template node: please file a bug."),this[qt]=sx}[di](){return!0}[Bi](A,t){return A.startsWith("#")?[this[As].get(A.slice(1))]:Ni(this,t,A,!0,!0)}*[Of](){var C,B,Q;if(!this.subform.children.length)return dA.success({name:"div",children:[]});this[L]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};let A=this.subform.children[0];A.pageSet[ns]();let t=A.pageSet.pageArea.children,i={name:"div",children:[]},s=null,a=null,n=null;if(A.breakBefore.children.length>=1?(a=A.breakBefore.children[0],n=a.target):A.subform.children.length>=1&&A.subform.children[0].breakBefore.children.length>=1?(a=A.subform.children[0].breakBefore.children[0],n=a.target):(C=A.break)!=null&&C.beforeTarget?(a=A.break,n=a.beforeTarget):A.subform.children.length>=1&&((B=A.subform.children[0].break)!=null&&B.beforeTarget)&&(a=A.subform.children[0].break,n=a.beforeTarget),a){let E=this[Bi](n,a[MA]());E instanceof zi&&(s=E,a[L]={})}s||(s=t[0]),s[L]={numberOfUse:1};let r=s[MA]();r[L]={numberOfUse:1,pageIndex:r.pageArea.children.indexOf(s),pageSetIndex:0};let g,o=null,I=null,c=!0,l=0,h=0;for(;;){if(c)l=0;else if(i.children.pop(),++l===ix)return k("XFA - Something goes wrong: please file a bug."),i;g=null,this[L].currentPageArea=s;let E=s[SA]().html;i.children.push(E),o&&(this[L].noLayoutFailure=!0,E.children.push(o[SA](s[L].space).html),o=null),I&&(this[L].noLayoutFailure=!0,E.children.push(I[SA](s[L].space).html),I=null);let f=s.contentArea.children,u=E.children.filter(x=>x.attributes.class.includes("xfaContentarea"));c=!1,this[L].firstUnsplittable=null,this[L].noLayoutFailure=!1;let d=x=>{var m;let p=A[wn]();p&&(c||(c=((m=p.children)==null?void 0:m.length)>0),u[x].children.push(p))};for(let x=h,p=f.length;x<p;x++){let m=this[L].currentContentArea=f[x],D={width:m.w,height:m.h};h=0,o&&(u[x].children.push(o[SA](D).html),o=null),I&&(u[x].children.push(I[SA](D).html),I=null);let S=A[SA](D);if(S.success)return S.html?(c||(c=((Q=S.html.children)==null?void 0:Q.length)>0),u[x].children.push(S.html)):!c&&i.children.length>1&&i.children.pop(),i;if(S.isBreak()){let w=S.breakNode;if(d(x),w.targetType==="auto")continue;w.leader&&(o=this[Bi](w.leader,w[MA]()),o=o?o[0]:null),w.trailer&&(I=this[Bi](w.trailer,w[MA]()),I=I?I[0]:null),w.targetType==="pageArea"?(g=w[L].target,x=1/0):w[L].target?(g=w[L].target,h=w[L].index+1,x=1/0):x=w[L].index;continue}if(this[L].overflowNode){let w=this[L].overflowNode;this[L].overflowNode=null;let Y=w[We](),U=Y.target;Y.addLeader=Y.leader!==null,Y.addTrailer=Y.trailer!==null,d(x);let K=x;if(x=1/0,U instanceof zi)g=U;else if(U instanceof _a){let Z=f.indexOf(U);Z!==-1?Z>K?x=Z-1:h=Z:(g=U[MA](),h=g.contentArea.children.indexOf(U))}continue}d(x)}this[L].pageNumber+=1,g&&(g[ja]()?g[L].numberOfUse+=1:g=null),s=g||s[Ci](),yield null}}},Cg=class extends ce{constructor(A){super(eA,"text"),this.id=A.id||"",this.maxChars=GA({data:A.maxChars,defaultValue:0,validate:t=>t>=0}),this.name=A.name||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}[eo](){return!0}[ni](A){return A[de]===me.xhtml.id?(this[P]=A,!0):(k(`XFA - Invalid content in Text: ${A[XA]}.`),!1)}[xi](A){this[P]instanceof J||super[xi](A)}[se](){typeof this[P]=="string"&&(this[P]=this[P].replaceAll(`\\r\n`,`\n`))}[We](){return typeof this[P]=="string"?this[P].split(/[\\u2029\\u2028\\n]/).reduce((A,t)=>(t&&A.push(t),A),[]).join(`\n`):this[P][Se]()}[SA](A){if(typeof this[P]=="string"){let t=A0(this[P]).html;return this[P].includes("\\u2029")?(t.name="div",t.children=[],this[P].split("\\u2029").map(i=>i.split(/[\\u2028\\n]/).reduce((s,a)=>(s.push({name:"span",value:a},{name:"br"}),s),[])).forEach(i=>{t.children.push({name:"p",children:i})})):/[\\u2028\\n]/.test(this[P])&&(t.name="div",t.children=[],this[P].split(/[\\u2028\\n]/).forEach(i=>{t.children.push({name:"span",value:i},{name:"br"})})),dA.success(t)}return this[P][SA](A)}},Bg=class extends J{constructor(A){super(eA,"textEdit",!0),this.allowRichText=GA({data:A.allowRichText,defaultValue:0,validate:t=>t===1}),this.hScrollPolicy=O(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.multiLine=GA({data:A.multiLine,defaultValue:"",validate:t=>t===0||t===1}),this.use=A.use||"",this.usehref=A.usehref||"",this.vScrollPolicy=O(A.vScrollPolicy,["auto","off","on"]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[SA](A){var a,n;let t=lt(this,"border","font","margin"),i,s=this[MA]()[MA]();return this.multiLine===""&&(this.multiLine=s instanceof gg?1:0),this.multiLine===1?i={name:"textarea",attributes:{dataId:((a=s[Ht])==null?void 0:a[$A])||s[$A],fieldId:s[$A],class:["xfaTextfield"],style:t,"aria-label":N0(s),"aria-required":!1}}:i={name:"input",attributes:{type:"text",dataId:((n=s[Ht])==null?void 0:n[$A])||s[$A],fieldId:s[$A],class:["xfaTextfield"],style:t,"aria-label":N0(s),"aria-required":!1}},yn(s)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),dA.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}},jl=class extends qA{constructor(A){super(eA,"time"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[se](){let A=this[P].trim();this[P]=A?new Date(A):null}[SA](A){return A0(this[P]?this[P].toString():"")}},Xl=class extends J{constructor(A){super(eA,"timeStamp"),this.id=A.id||"",this.server=A.server||"",this.type=O(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}},Vl=class extends qA{constructor(A){super(eA,"toolTip"),this.id=A.id||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}},_l=class extends J{constructor(A){super(eA,"traversal",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.traverse=new b}},zl=class extends J{constructor(A){super(eA,"traverse",!0),this.id=A.id||"",this.operation=O(A.operation,["next","back","down","first","left","right","up"]),this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.script=null}get name(){return this.operation}[Za](){return!1}},sn=class extends J{constructor(A){super(eA,"ui",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null,this.barcode=null,this.button=null,this.checkButton=null,this.choiceList=null,this.dateTimeEdit=null,this.defaultUi=null,this.imageEdit=null,this.numericEdit=null,this.passwordEdit=null,this.signature=null,this.textEdit=null}[We](){if(this[L]===void 0){for(let A of Object.getOwnPropertyNames(this)){if(A==="extras"||A==="picture")continue;let t=this[A];if(t instanceof J)return this[L]=t,t}this[L]=null}return this[L]}[SA](A){let t=this[We]();return t?t[SA](A):dA.EMPTY}},$l=class extends J{constructor(A){super(eA,"validate",!0),this.formatTest=O(A.formatTest,["warning","disabled","error"]),this.id=A.id||"",this.nullTest=O(A.nullTest,["disabled","error","warning"]),this.scriptTest=O(A.scriptTest,["error","disabled","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.picture=null,this.script=null}},an=class extends J{constructor(A){super(eA,"value",!0),this.id=A.id||"",this.override=GA({data:A.override,defaultValue:0,validate:t=>t===1}),this.relevant=jt(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.arc=null,this.boolean=null,this.date=null,this.dateTime=null,this.decimal=null,this.exData=null,this.float=null,this.image=null,this.integer=null,this.line=null,this.rectangle=null,this.text=null,this.time=null}[Et](A){var s;let t=this[MA]();if(t instanceof za&&(s=t.ui)!=null&&s.imageEdit){this.image||(this.image=new Ig({}),this[Be](this.image)),this.image[P]=A[P];return}let i=A[XA];if(this[i]!==null){this[i][P]=A[P];return}for(let a of Object.getOwnPropertyNames(this)){let n=this[a];n instanceof J&&(this[a]=null,this[Ti](n))}this[A[XA]]=A,this[Be](A)}[Se](){if(this.exData)return typeof this.exData[P]=="string"?this.exData[P].trim():this.exData[P][Se]().trim();for(let A of Object.getOwnPropertyNames(this)){if(A==="image")continue;let t=this[A];if(t instanceof J)return(t[P]||"").toString().trim()}return null}[SA](A){for(let t of Object.getOwnPropertyNames(this)){let i=this[t];if(i instanceof J)return i[SA](A)}return dA.EMPTY}},Ah=class extends J{constructor(A){super(eA,"variables",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new b,this.date=new b,this.dateTime=new b,this.decimal=new b,this.exData=new b,this.float=new b,this.image=new b,this.integer=new b,this.manifest=new b,this.script=new b,this.text=new b,this.time=new b}[Za](){return!0}},Ks=class{static[Zt](A,t){if(Ks.hasOwnProperty(A)){let i=Ks[A](t);return i[Wf](t),i}}static appearanceFilter(A){return new pc(A)}static arc(A){return new eg(A)}static area(A){return new wc(A)}static assist(A){return new yc(A)}static barcode(A){return new bc(A)}static bind(A){return new Dc(A)}static bindItems(A){return new Va(A)}static bookend(A){return new kc(A)}static boolean(A){return new Sc(A)}static border(A){return new tg(A)}static break(A){return new Fc(A)}static breakAfter(A){return new ig(A)}static breakBefore(A){return new sg(A)}static button(A){return new Rc(A)}static calculate(A){return new Nc(A)}static caption(A){return new Gc(A)}static certificate(A){return new Uc(A)}static certificates(A){return new Mc(A)}static checkButton(A){return new ag(A)}static choiceList(A){return new ng(A)}static color(A){return new Lc(A)}static comb(A){return new Hc(A)}static connect(A){return new Jc(A)}static contentArea(A){return new _a(A)}static corner(A){return new rg(A)}static date(A){return new Yc(A)}static dateTime(A){return new Kc(A)}static dateTimeEdit(A){return new vc(A)}static decimal(A){return new qc(A)}static defaultUi(A){return new Tc(A)}static desc(A){return new Pc(A)}static digestMethod(A){return new Wc(A)}static digestMethods(A){return new Oc(A)}static draw(A){return new gg(A)}static edge(A){return new G0(A)}static encoding(A){return new Zc(A)}static encodings(A){return new jc(A)}static encrypt(A){return new Xc(A)}static encryptData(A){return new Vc(A)}static encryption(A){return new _c(A)}static encryptionMethod(A){return new zc(A)}static encryptionMethods(A){return new $c(A)}static event(A){return new Al(A)}static exData(A){return new el(A)}static exObject(A){return new tl(A)}static exclGroup(A){return new og(A)}static execute(A){return new il(A)}static extras(A){return new sl(A)}static field(A){return new za(A)}static fill(A){return new al(A)}static filter(A){return new nl(A)}static float(A){return new rl(A)}static font(A){return new gl(A)}static format(A){return new ol(A)}static handler(A){return new Il(A)}static hyphenation(A){return new cl(A)}static image(A){return new Ig(A)}static imageEdit(A){return new ll(A)}static integer(A){return new hl(A)}static issuers(A){return new Cl(A)}static items(A){return new $a(A)}static keep(A){return new Bl(A)}static keyUsage(A){return new Ql(A)}static line(A){return new El(A)}static linear(A){return new fl(A)}static lockDocument(A){return new ul(A)}static manifest(A){return new dl(A)}static margin(A){return new xl(A)}static mdp(A){return new ml(A)}static medium(A){return new pl(A)}static message(A){return new wl(A)}static numericEdit(A){return new yl(A)}static occur(A){return new bl(A)}static oid(A){return new Dl(A)}static oids(A){return new kl(A)}static overflow(A){return new cg(A)}static pageArea(A){return new zi(A)}static pageSet(A){return new U0(A)}static para(A){return new Sl(A)}static passwordEdit(A){return new Fl(A)}static pattern(A){return new Rl(A)}static picture(A){return new Nl(A)}static proto(A){return new Gl(A)}static radial(A){return new Ul(A)}static reason(A){return new Ml(A)}static reasons(A){return new Ll(A)}static rectangle(A){return new lg(A)}static ref(A){return new Hl(A)}static script(A){return new Jl(A)}static setProperty(A){return new An(A)}static signData(A){return new Yl(A)}static signature(A){return new Kl(A)}static signing(A){return new vl(A)}static solid(A){return new ql(A)}static speak(A){return new Tl(A)}static stipple(A){return new Pl(A)}static subform(A){return new hg(A)}static subformSet(A){return new en(A)}static subjectDN(A){return new Wl(A)}static subjectDNs(A){return new Ol(A)}static submit(A){return new Zl(A)}static template(A){return new tn(A)}static text(A){return new Cg(A)}static textEdit(A){return new Bg(A)}static time(A){return new jl(A)}static timeStamp(A){return new Xl(A)}static toolTip(A){return new Vl(A)}static traversal(A){return new _l(A)}static traverse(A){return new zl(A)}static ui(A){return new sn(A)}static validate(A){return new $l(A)}static value(A){return new an(A)}static variables(A){return new Ah(A)}},LE=me.datasets.id;function Xn(e){let A=new Cg({});return A[P]=e,A}var eh=class{constructor(A){var t;this.root=A,this.datasets=A.datasets,this.data=((t=A.datasets)==null?void 0:t.data)||new Jt(me.datasets.id,"data"),this.emptyMerge=this.data[Ue]().length===0,this.root.form=this.form=A.template[Tt]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){return this._bindElement(this.form,this.data),this.form}getData(){return this.data}_bindValue(A,t,i){var s,a;if(A[Ht]=t,A[Oa]())if(t[rs]()){let n=t[u1]();A[Et](Xn(n))}else if(A instanceof za&&((a=(s=A.ui)==null?void 0:s.choiceList)==null?void 0:a.open)==="multiSelect"){let n=t[Ue]().map(r=>r[P].trim()).join(`\n`);A[Et](Xn(n))}else this._isConsumeData()&&k("XFA - Nodes haven\'t the same type.");else!t[rs]()||this._isMatchTemplate()?this._bindElement(A,t):k("XFA - Nodes haven\'t the same type.")}_findDataByNameToConsume(A,t,i,s){if(!A)return null;let a,n;for(let r=0;r<3;r++){for(a=i[xa](A,!1,!0);n=a.next().value,!!n;)if(t===n[rs]())return n;if(i[de]===me.datasets.id&&i[XA]==="data")break;i=i[MA]()}return s?(a=this.data[xa](A,!0,!1),n=a.next().value,n||(a=this.data[Bc](A,!0),n=a.next().value,n!=null&&n[rs]())?n:null):null}_setProperties(A,t){if(A.hasOwnProperty("setProperty"))for(let{ref:i,target:s,connection:a}of A.setProperty.children){if(a||!i)continue;let n=Ni(this.root,t,i,!1,!1);if(!n){k(`XFA - Invalid reference: ${i}.`);continue}let[r]=n;if(!r[Mi](this.data)){k("XFA - Invalid node: must be a data node.");continue}let g=Ni(this.root,A,s,!1,!1);if(!g){k(`XFA - Invalid target: ${s}.`);continue}let[o]=g;if(!o[Mi](A)){k("XFA - Invalid target: must be a property or subproperty.");continue}let I=o[MA]();if(o instanceof An||I instanceof An){k("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(o instanceof Va||I instanceof Va){k("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}let c=r[Se](),l=o[XA];if(o instanceof Xa){let h=Object.create(null);h[l]=c;let C=Reflect.construct(Object.getPrototypeOf(I).constructor,[h]);I[l]=C[l];continue}if(!o.hasOwnProperty(P)){k("XFA - Invalid node to use in setProperty");continue}o[Ht]=r,o[P]=c,o[se]()}}_bindItems(A,t){if(!A.hasOwnProperty("items")||!A.hasOwnProperty("bindItems")||A.bindItems.isEmpty())return;for(let a of A.items.children)A[Ti](a);A.items.clear();let i=new $a({}),s=new $a({});A[Be](i),A.items.push(i),A[Be](s),A.items.push(s);for(let{ref:a,labelRef:n,valueRef:r,connection:g}of A.bindItems.children){if(g||!a)continue;let o=Ni(this.root,t,a,!1,!1);if(!o){k(`XFA - Invalid reference: ${a}.`);continue}for(let I of o){if(!I[Mi](this.datasets)){k(`XFA - Invalid ref (${a}): must be a datasets child.`);continue}let c=Ni(this.root,I,n,!0,!1);if(!c){k(`XFA - Invalid label: ${n}.`);continue}let[l]=c;if(!l[Mi](this.datasets)){k("XFA - Invalid label: must be a datasets child.");continue}let h=Ni(this.root,I,r,!0,!1);if(!h){k(`XFA - Invalid value: ${r}.`);continue}let[C]=h;if(!C[Mi](this.datasets)){k("XFA - Invalid value: must be a datasets child.");continue}let B=Xn(l[Se]()),Q=Xn(C[Se]());i[Be](B),i.text.push(B),s[Be](Q),s.text.push(Q)}}}_bindOccurrences(A,t,i){let s;if(t.length>1&&(s=A[Tt](),s[Ti](s.occur),s.occur=null),this._bindValue(A,t[0],i),this._setProperties(A,t[0]),this._bindItems(A,t[0]),t.length===1)return;let a=A[MA](),n=A[XA],r=a[Qc](A);for(let g=1,o=t.length;g<o;g++){let I=t[g],c=s[Tt]();a[n].push(c),a[lr](r+g,c),this._bindValue(c,I,i),this._setProperties(c,I),this._bindItems(c,I)}}_createOccurrences(A){if(!this.emptyMerge)return;let{occur:t}=A;if(!t||t.initial<=1)return;let i=A[MA](),s=A[XA];if(!(i[s]instanceof b))return;let a;A.name?a=i[s].children.filter(g=>g.name===A.name).length:a=i[s].children.length;let n=i[Qc](A)+1,r=t.initial-a;if(r){let g=A[Tt]();g[Ti](g.occur),g.occur=null,i[s].push(g),i[lr](n,g);for(let o=1;o<r;o++){let I=g[Tt]();i[s].push(I),i[lr](n+o,I)}}}_getOccurInfo(A){let{name:t,occur:i}=A;if(!i||!t)return[1,1];let s=i.max===-1?1/0:i.max;return[i.min,s]}_setAndBind(A,t){this._setProperties(A,t),this._bindItems(A,t),this._bindElement(A,t)}_bindElement(A,t){let i=[];this._createOccurrences(A);for(let s of A[Ue]()){if(s[Ht])continue;if(this._mergeMode===void 0&&s[XA]==="subform"){this._mergeMode=s.mergeMode==="consumeData";let c=t[Ue]();if(c.length>0)this._bindOccurrences(s,[c[0]],null);else if(this.emptyMerge){let l=t[de]===LE?-1:t[de],h=s[Ht]=new Jt(l,s.name||"root");t[Be](h),this._bindElement(s,h)}continue}if(!s[J0]())continue;let a=!1,n=null,r=null,g=null;if(s.bind){switch(s.bind.match){case"none":this._setAndBind(s,t);continue;case"global":a=!0;break;case"dataRef":if(!s.bind.ref){k(`XFA - ref is empty in node ${s[XA]}.`),this._setAndBind(s,t);continue}r=s.bind.ref;break;default:break}s.bind.picture&&(n=s.bind.picture[P])}let[o,I]=this._getOccurInfo(s);if(r)if(g=Ni(this.root,t,r,!0,!1),g===null){if(g=ex(this.data,t,r),!g)continue;this._isConsumeData()&&(g[$t]=!0),this._setAndBind(s,g);continue}else this._isConsumeData()&&(g=g.filter(c=>!c[$t])),g.length>I?g=g.slice(0,I):g.length===0&&(g=null),g&&this._isConsumeData()&&g.forEach(c=>{c[$t]=!0});else{if(!s.name){this._setAndBind(s,t);continue}if(this._isConsumeData()){let c=[];for(;c.length<I;){let l=this._findDataByNameToConsume(s.name,s[Oa](),t,a);if(!l)break;l[$t]=!0,c.push(l)}g=c.length>0?c:null}else{if(g=t[xa](s.name,!1,this.emptyMerge).next().value,!g){if(o===0){i.push(s);continue}let c=t[de]===LE?-1:t[de];g=s[Ht]=new Jt(c,s.name),this.emptyMerge&&(g[$t]=!0),t[Be](g),this._setAndBind(s,g);continue}this.emptyMerge&&(g[$t]=!0),g=[g]}}g?this._bindOccurrences(s,g,n):o>0?this._setAndBind(s,t):i.push(s)}i.forEach(s=>s[MA]()[Ti](s))}},th=class{constructor(A,t){this.data=t,this.dataset=A.datasets||null}serialize(A){let t=[[-1,this.data[Ue]()]];for(;t.length>0;){let s=t.at(-1),[a,n]=s;if(a+1===n.length){t.pop();continue}let r=n[++s[0]],g=A.get(r[$A]);if(g)r[Et](g);else{let I=r[Tf]();for(let c of I.values()){let l=A.get(c[$A]);if(l){c[Et](l);break}}}let o=r[Ue]();o.length>0&&t.push([-1,o])}let i=[\'<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">\'];if(this.dataset)for(let s of this.dataset[Ue]())s[XA]!=="data"&&s[pa](i);return this.data[pa](i),i.push("</xfa:datasets>"),i.join("")}},j=me.config.id,ih=class extends J{constructor(A){super(j,"acrobat",!0),this.acrobat7=null,this.autoSave=null,this.common=null,this.validate=null,this.validateApprovalSignatures=null,this.submitUrl=new b}},sh=class extends J{constructor(A){super(j,"acrobat7",!0),this.dynamicRender=null}},ah=class extends _A{constructor(A){super(j,"ADBE_JSConsole",["delegate","Enable","Disable"])}},nh=class extends _A{constructor(A){super(j,"ADBE_JSDebugger",["delegate","Enable","Disable"])}},rh=class extends pe{constructor(A){super(j,"addSilentPrint")}},gh=class extends pe{constructor(A){super(j,"addViewerPreferences")}},oh=class extends $r{constructor(A){super(j,"adjustData")}},Ih=class extends yt{constructor(A){super(j,"adobeExtensionLevel",0,t=>t>=1&&t<=8)}},ch=class extends J{constructor(A){super(j,"agent",!0),this.name=A.name?A.name.trim():"",this.common=new b}},lh=class extends ce{constructor(A){super(j,"alwaysEmbed")}},hh=class extends qA{constructor(A){super(j,"amd")}},Ch=class extends J{constructor(A){super(j,"area"),this.level=GA({data:A.level,defaultValue:0,validate:t=>t>=1&&t<=3}),this.name=O(A.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}},Bh=class extends _A{constructor(A){super(j,"attributes",["preserve","delegate","ignore"])}},Qh=class extends _A{constructor(A){super(j,"autoSave",["disabled","enabled"])}},Eh=class extends qA{constructor(A){super(j,"base")}},fh=class extends J{constructor(A){super(j,"batchOutput"),this.format=O(A.format,["none","concat","zip","zipCompress"])}},uh=class extends ce{constructor(A){super(j,"behaviorOverride")}[se](){this[P]=new Map(this[P].trim().split(/\\s+/).filter(A=>A.includes(":")).map(A=>A.split(":",2)))}},dh=class extends J{constructor(A){super(j,"cache",!0),this.templateCache=null}},xh=class extends pe{constructor(A){super(j,"change")}},mh=class extends J{constructor(A){super(j,"common",!0),this.data=null,this.locale=null,this.localeSet=null,this.messaging=null,this.suppressBanner=null,this.template=null,this.validationMessaging=null,this.versionControl=null,this.log=new b}},ph=class extends J{constructor(A){super(j,"compress"),this.scope=O(A.scope,["imageOnly","document"])}},wh=class extends pe{constructor(A){super(j,"compressLogicalStructure")}},yh=class extends $r{constructor(A){super(j,"compressObjectStream")}},bh=class extends J{constructor(A){super(j,"compression",!0),this.compressLogicalStructure=null,this.compressObjectStream=null,this.level=null,this.type=null}},Dh=class extends J{constructor(A){super(j,"config",!0),this.acrobat=null,this.present=null,this.trace=null,this.agent=new b}},kh=class extends _A{constructor(A){super(j,"conformance",["A","B"])}},Sh=class extends pe{constructor(A){super(j,"contentCopy")}},Fh=class extends yt{constructor(A){super(j,"copies",1,t=>t>=1)}},Rh=class extends qA{constructor(A){super(j,"creator")}},Nh=class extends yt{constructor(A){super(j,"currentPage",0,t=>t>=0)}},Gh=class extends J{constructor(A){super(j,"data",!0),this.adjustData=null,this.attributes=null,this.incrementalLoad=null,this.outputXSL=null,this.range=null,this.record=null,this.startNode=null,this.uri=null,this.window=null,this.xsl=null,this.excludeNS=new b,this.transform=new b}},Uh=class extends J{constructor(A){super(j,"debug",!0),this.uri=null}},Mh=class extends ce{constructor(A){super(j,"defaultTypeface"),this.writingScript=O(A.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}},Lh=class extends _A{constructor(A){super(j,"destination",["pdf","pcl","ps","webClient","zpl"])}},Hh=class extends pe{constructor(A){super(j,"documentAssembly")}},Jh=class extends J{constructor(A){super(j,"driver",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}},Yh=class extends _A{constructor(A){super(j,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}},Kh=class extends _A{constructor(A){super(j,"dynamicRender",["forbidden","required"])}},vh=class extends pe{constructor(A){super(j,"embed")}},qh=class extends pe{constructor(A){super(j,"encrypt")}},Th=class extends J{constructor(A){super(j,"encryption",!0),this.encrypt=null,this.encryptionLevel=null,this.permissions=null}},Ph=class extends _A{constructor(A){super(j,"encryptionLevel",["40bit","128bit"])}},Wh=class extends qA{constructor(A){super(j,"enforce")}},Oh=class extends J{constructor(A){super(j,"equate"),this.force=GA({data:A.force,defaultValue:1,validate:t=>t===0}),this.from=A.from||"",this.to=A.to||""}},Zh=class extends J{constructor(A){super(j,"equateRange"),this.from=A.from||"",this.to=A.to||"",this._unicodeRange=A.unicodeRange||""}get unicodeRange(){let A=[],t=/U\\+([0-9a-fA-F]+)/,i=this._unicodeRange;for(let s of i.split(",").map(a=>a.trim()).filter(a=>!!a))s=s.split("-",2).map(a=>{let n=a.match(t);return n?parseInt(n[1],16):0}),s.length===1&&s.push(s[0]),A.push(s);return nA(this,"unicodeRange",A)}},jh=class extends ce{constructor(A){super(j,"exclude")}[se](){this[P]=this[P].trim().split(/\\s+/).filter(A=>A&&["calculate","close","enter","exit","initialize","ready","validate"].includes(A))}},Xh=class extends qA{constructor(A){super(j,"excludeNS")}},Vh=class extends _A{constructor(A){super(j,"flipLabel",["usePrinterSetting","on","off"])}},_h=class extends J{constructor(A){super(j,"fontInfo",!0),this.embed=null,this.map=null,this.subsetBelow=null,this.alwaysEmbed=new b,this.defaultTypeface=new b,this.neverEmbed=new b}},zh=class extends pe{constructor(A){super(j,"formFieldFilling")}},$h=class extends qA{constructor(A){super(j,"groupParent")}},AC=class extends _A{constructor(A){super(j,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}},eC=class extends qA{constructor(A){super(j,"includeXDPContent")}},tC=class extends _A{constructor(A){super(j,"incrementalLoad",["none","forwardOnly"])}},iC=class extends pe{constructor(A){super(j,"incrementalMerge")}},sC=class extends pe{constructor(A){super(j,"interactive")}},aC=class extends _A{constructor(A){super(j,"jog",["usePrinterSetting","none","pageSet"])}},nC=class extends J{constructor(A){super(j,"labelPrinter",!0),this.name=O(A.name,["zpl","dpl","ipl","tcpl"]),this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}},rC=class extends _A{constructor(A){super(j,"layout",["paginate","panel"])}},gC=class extends yt{constructor(A){super(j,"level",0,t=>t>0)}},oC=class extends pe{constructor(A){super(j,"linearized")}},IC=class extends qA{constructor(A){super(j,"locale")}},cC=class extends qA{constructor(A){super(j,"localeSet")}},lC=class extends J{constructor(A){super(j,"log",!0),this.mode=null,this.threshold=null,this.to=null,this.uri=null}},hC=class extends J{constructor(A){super(j,"map",!0),this.equate=new b,this.equateRange=new b}},CC=class extends J{constructor(A){super(j,"mediumInfo",!0),this.map=null}},BC=class extends J{constructor(A){super(j,"message",!0),this.msgId=null,this.severity=null}},QC=class extends J{constructor(A){super(j,"messaging",!0),this.message=new b}},EC=class extends _A{constructor(A){super(j,"mode",["append","overwrite"])}},fC=class extends pe{constructor(A){super(j,"modifyAnnots")}},uC=class extends yt{constructor(A){super(j,"msgId",1,t=>t>=1)}},dC=class extends qA{constructor(A){super(j,"nameAttr")}},xC=class extends ce{constructor(A){super(j,"neverEmbed")}},mC=class extends yt{constructor(A){super(j,"numberOfCopies",null,t=>t>=2&&t<=5)}},pC=class extends J{constructor(A){super(j,"openAction",!0),this.destination=null}},wC=class extends J{constructor(A){super(j,"output",!0),this.to=null,this.type=null,this.uri=null}},yC=class extends qA{constructor(A){super(j,"outputBin")}},bC=class extends J{constructor(A){super(j,"outputXSL",!0),this.uri=null}},DC=class extends _A{constructor(A){super(j,"overprint",["none","both","draw","field"])}},kC=class extends qA{constructor(A){super(j,"packets")}[se](){this[P]!=="*"&&(this[P]=this[P].trim().split(/\\s+/).filter(A=>["config","datasets","template","xfdf","xslt"].includes(A)))}},SC=class extends J{constructor(A){super(j,"pageOffset"),this.x=GA({data:A.x,defaultValue:"useXDCSetting",validate:t=>!0}),this.y=GA({data:A.y,defaultValue:"useXDCSetting",validate:t=>!0})}},FC=class extends qA{constructor(A){super(j,"pageRange")}[se](){let A=this[P].trim().split(/\\s+/).map(i=>parseInt(i,10)),t=[];for(let i=0,s=A.length;i<s;i+=2)t.push(A.slice(i,i+2));this[P]=t}},RC=class extends _A{constructor(A){super(j,"pagination",["simplex","duplexShortEdge","duplexLongEdge"])}},NC=class extends _A{constructor(A){super(j,"paginationOverride",["none","forceDuplex","forceDuplexLongEdge","forceDuplexShortEdge","forceSimplex"])}},GC=class extends yt{constructor(A){super(j,"part",1,t=>!1)}},UC=class extends J{constructor(A){super(j,"pcl",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.pageOffset=null,this.staple=null,this.xdc=null}},MC=class extends J{constructor(A){super(j,"pdf",!0),this.name=A.name||"",this.adobeExtensionLevel=null,this.batchOutput=null,this.compression=null,this.creator=null,this.encryption=null,this.fontInfo=null,this.interactive=null,this.linearized=null,this.openAction=null,this.pdfa=null,this.producer=null,this.renderPolicy=null,this.scriptModel=null,this.silentPrint=null,this.submitFormat=null,this.tagged=null,this.version=null,this.viewerPreferences=null,this.xdc=null}},LC=class extends J{constructor(A){super(j,"pdfa",!0),this.amd=null,this.conformance=null,this.includeXDPContent=null,this.part=null}},HC=class extends J{constructor(A){super(j,"permissions",!0),this.accessibleContent=null,this.change=null,this.contentCopy=null,this.documentAssembly=null,this.formFieldFilling=null,this.modifyAnnots=null,this.plaintextMetadata=null,this.print=null,this.printHighQuality=null}},JC=class extends pe{constructor(A){super(j,"pickTrayByPDFSize")}},YC=class extends qA{constructor(A){super(j,"picture")}},KC=class extends pe{constructor(A){super(j,"plaintextMetadata")}},vC=class extends _A{constructor(A){super(j,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}},qC=class extends J{constructor(A){super(j,"present",!0),this.behaviorOverride=null,this.cache=null,this.common=null,this.copies=null,this.destination=null,this.incrementalMerge=null,this.layout=null,this.output=null,this.overprint=null,this.pagination=null,this.paginationOverride=null,this.script=null,this.validate=null,this.xdp=null,this.driver=new b,this.labelPrinter=new b,this.pcl=new b,this.pdf=new b,this.ps=new b,this.submitUrl=new b,this.webClient=new b,this.zpl=new b}},TC=class extends pe{constructor(A){super(j,"print")}},PC=class extends pe{constructor(A){super(j,"printHighQuality")}},WC=class extends _A{constructor(A){super(j,"printScaling",["appdefault","noScaling"])}},OC=class extends qA{constructor(A){super(j,"printerName")}},ZC=class extends qA{constructor(A){super(j,"producer")}},jC=class extends J{constructor(A){super(j,"ps",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.staple=null,this.xdc=null}},XC=class extends ce{constructor(A){super(j,"range")}[se](){this[P]=this[P].trim().split(/\\s*,\\s*/,2).map(A=>A.split("-").map(t=>parseInt(t.trim(),10))).filter(A=>A.every(t=>!isNaN(t))).map(A=>(A.length===1&&A.push(A[0]),A))}},VC=class extends ce{constructor(A){super(j,"record")}[se](){this[P]=this[P].trim();let A=parseInt(this[P],10);!isNaN(A)&&A>=0&&(this[P]=A)}},_C=class extends ce{constructor(A){super(j,"relevant")}[se](){this[P]=this[P].trim().split(/\\s+/)}},zC=class extends ce{constructor(A){super(j,"rename")}[se](){this[P]=this[P].trim(),(this[P].toLowerCase().startsWith("xml")||new RegExp("[\\\\p{L}_][\\\\p{L}\\\\d._\\\\p{M}-]*","u").test(this[P]))&&k("XFA - Rename: invalid XFA name")}},$C=class extends _A{constructor(A){super(j,"renderPolicy",["server","client"])}},AB=class extends _A{constructor(A){super(j,"runScripts",["both","client","none","server"])}},eB=class extends J{constructor(A){super(j,"script",!0),this.currentPage=null,this.exclude=null,this.runScripts=null}},tB=class extends _A{constructor(A){super(j,"scriptModel",["XFA","none"])}},iB=class extends _A{constructor(A){super(j,"severity",["ignore","error","information","trace","warning"])}},sB=class extends J{constructor(A){super(j,"silentPrint",!0),this.addSilentPrint=null,this.printerName=null}},aB=class extends J{constructor(A){super(j,"staple"),this.mode=O(A.mode,["usePrinterSetting","on","off"])}},nB=class extends qA{constructor(A){super(j,"startNode")}},rB=class extends yt{constructor(A){super(j,"startPage",0,t=>!0)}},gB=class extends _A{constructor(A){super(j,"submitFormat",["html","delegate","fdf","xml","pdf"])}},oB=class extends qA{constructor(A){super(j,"submitUrl")}},IB=class extends yt{constructor(A){super(j,"subsetBelow",100,t=>t>=0&&t<=100)}},cB=class extends pe{constructor(A){super(j,"suppressBanner")}},lB=class extends pe{constructor(A){super(j,"tagged")}},hB=class extends J{constructor(A){super(j,"template",!0),this.base=null,this.relevant=null,this.startPage=null,this.uri=null,this.xsl=null}},CB=class extends _A{constructor(A){super(j,"threshold",["trace","error","information","warning"])}},BB=class extends _A{constructor(A){super(j,"to",["null","memory","stderr","stdout","system","uri"])}},QB=class extends J{constructor(A){super(j,"templateCache"),this.maxEntries=GA({data:A.maxEntries,defaultValue:5,validate:t=>t>=0})}},EB=class extends J{constructor(A){super(j,"trace",!0),this.area=new b}},fB=class extends J{constructor(A){super(j,"transform",!0),this.groupParent=null,this.ifEmpty=null,this.nameAttr=null,this.picture=null,this.presence=null,this.rename=null,this.whitespace=null}},uB=class extends _A{constructor(A){super(j,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}},dB=class extends qA{constructor(A){super(j,"uri")}},xB=class extends _A{constructor(A){super(j,"validate",["preSubmit","prePrint","preExecute","preSave"])}},mB=class extends ce{constructor(A){super(j,"validateApprovalSignatures")}[se](){this[P]=this[P].trim().split(/\\s+/).filter(A=>["docReady","postSign"].includes(A))}},pB=class extends _A{constructor(A){super(j,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}},wB=class extends _A{constructor(A){super(j,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}},yB=class extends J{constructor(A){super(j,"VersionControl"),this.outputBelow=O(A.outputBelow,["warn","error","update"]),this.sourceAbove=O(A.sourceAbove,["warn","error"]),this.sourceBelow=O(A.sourceBelow,["update","maintain"])}},bB=class extends J{constructor(A){super(j,"viewerPreferences",!0),this.ADBE_JSConsole=null,this.ADBE_JSDebugger=null,this.addViewerPreferences=null,this.duplexOption=null,this.enforce=null,this.numberOfCopies=null,this.pageRange=null,this.pickTrayByPDFSize=null,this.printScaling=null}},DB=class extends J{constructor(A){super(j,"webClient",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}},kB=class extends _A{constructor(A){super(j,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}},SB=class extends ce{constructor(A){super(j,"window")}[se](){let A=this[P].trim().split(/\\s*,\\s*/,2).map(t=>parseInt(t,10));if(A.some(t=>isNaN(t))){this[P]=[0,0];return}A.length===1&&A.push(A[0]),this[P]=A}},FB=class extends J{constructor(A){super(j,"xdc",!0),this.uri=new b,this.xsl=new b}},RB=class extends J{constructor(A){super(j,"xdp",!0),this.packets=null}},NB=class extends J{constructor(A){super(j,"xsl",!0),this.debug=null,this.uri=null}},GB=class extends J{constructor(A){super(j,"zpl",!0),this.name=A.name?A.name.trim():"",this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}},vs=class{static[Zt](A,t){if(vs.hasOwnProperty(A))return vs[A](t)}static acrobat(A){return new ih(A)}static acrobat7(A){return new sh(A)}static ADBE_JSConsole(A){return new ah(A)}static ADBE_JSDebugger(A){return new nh(A)}static addSilentPrint(A){return new rh(A)}static addViewerPreferences(A){return new gh(A)}static adjustData(A){return new oh(A)}static adobeExtensionLevel(A){return new Ih(A)}static agent(A){return new ch(A)}static alwaysEmbed(A){return new lh(A)}static amd(A){return new hh(A)}static area(A){return new Ch(A)}static attributes(A){return new Bh(A)}static autoSave(A){return new Qh(A)}static base(A){return new Eh(A)}static batchOutput(A){return new fh(A)}static behaviorOverride(A){return new uh(A)}static cache(A){return new dh(A)}static change(A){return new xh(A)}static common(A){return new mh(A)}static compress(A){return new ph(A)}static compressLogicalStructure(A){return new wh(A)}static compressObjectStream(A){return new yh(A)}static compression(A){return new bh(A)}static config(A){return new Dh(A)}static conformance(A){return new kh(A)}static contentCopy(A){return new Sh(A)}static copies(A){return new Fh(A)}static creator(A){return new Rh(A)}static currentPage(A){return new Nh(A)}static data(A){return new Gh(A)}static debug(A){return new Uh(A)}static defaultTypeface(A){return new Mh(A)}static destination(A){return new Lh(A)}static documentAssembly(A){return new Hh(A)}static driver(A){return new Jh(A)}static duplexOption(A){return new Yh(A)}static dynamicRender(A){return new Kh(A)}static embed(A){return new vh(A)}static encrypt(A){return new qh(A)}static encryption(A){return new Th(A)}static encryptionLevel(A){return new Ph(A)}static enforce(A){return new Wh(A)}static equate(A){return new Oh(A)}static equateRange(A){return new Zh(A)}static exclude(A){return new jh(A)}static excludeNS(A){return new Xh(A)}static flipLabel(A){return new Vh(A)}static fontInfo(A){return new _h(A)}static formFieldFilling(A){return new zh(A)}static groupParent(A){return new $h(A)}static ifEmpty(A){return new AC(A)}static includeXDPContent(A){return new eC(A)}static incrementalLoad(A){return new tC(A)}static incrementalMerge(A){return new iC(A)}static interactive(A){return new sC(A)}static jog(A){return new aC(A)}static labelPrinter(A){return new nC(A)}static layout(A){return new rC(A)}static level(A){return new gC(A)}static linearized(A){return new oC(A)}static locale(A){return new IC(A)}static localeSet(A){return new cC(A)}static log(A){return new lC(A)}static map(A){return new hC(A)}static mediumInfo(A){return new CC(A)}static message(A){return new BC(A)}static messaging(A){return new QC(A)}static mode(A){return new EC(A)}static modifyAnnots(A){return new fC(A)}static msgId(A){return new uC(A)}static nameAttr(A){return new dC(A)}static neverEmbed(A){return new xC(A)}static numberOfCopies(A){return new mC(A)}static openAction(A){return new pC(A)}static output(A){return new wC(A)}static outputBin(A){return new yC(A)}static outputXSL(A){return new bC(A)}static overprint(A){return new DC(A)}static packets(A){return new kC(A)}static pageOffset(A){return new SC(A)}static pageRange(A){return new FC(A)}static pagination(A){return new RC(A)}static paginationOverride(A){return new NC(A)}static part(A){return new GC(A)}static pcl(A){return new UC(A)}static pdf(A){return new MC(A)}static pdfa(A){return new LC(A)}static permissions(A){return new HC(A)}static pickTrayByPDFSize(A){return new JC(A)}static picture(A){return new YC(A)}static plaintextMetadata(A){return new KC(A)}static presence(A){return new vC(A)}static present(A){return new qC(A)}static print(A){return new TC(A)}static printHighQuality(A){return new PC(A)}static printScaling(A){return new WC(A)}static printerName(A){return new OC(A)}static producer(A){return new ZC(A)}static ps(A){return new jC(A)}static range(A){return new XC(A)}static record(A){return new VC(A)}static relevant(A){return new _C(A)}static rename(A){return new zC(A)}static renderPolicy(A){return new $C(A)}static runScripts(A){return new AB(A)}static script(A){return new eB(A)}static scriptModel(A){return new tB(A)}static severity(A){return new iB(A)}static silentPrint(A){return new sB(A)}static staple(A){return new aB(A)}static startNode(A){return new nB(A)}static startPage(A){return new rB(A)}static submitFormat(A){return new gB(A)}static submitUrl(A){return new oB(A)}static subsetBelow(A){return new IB(A)}static suppressBanner(A){return new cB(A)}static tagged(A){return new lB(A)}static template(A){return new hB(A)}static templateCache(A){return new QB(A)}static threshold(A){return new CB(A)}static to(A){return new BB(A)}static trace(A){return new EB(A)}static transform(A){return new fB(A)}static type(A){return new uB(A)}static uri(A){return new dB(A)}static validate(A){return new xB(A)}static validateApprovalSignatures(A){return new mB(A)}static validationMessaging(A){return new pB(A)}static version(A){return new wB(A)}static versionControl(A){return new yB(A)}static viewerPreferences(A){return new bB(A)}static webClient(A){return new DB(A)}static whitespace(A){return new kB(A)}static window(A){return new SB(A)}static xdc(A){return new FB(A)}static xdp(A){return new RB(A)}static xsl(A){return new NB(A)}static zpl(A){return new GB(A)}},Kt=me.connectionSet.id,UB=class extends J{constructor(A){super(Kt,"connectionSet",!0),this.wsdlConnection=new b,this.xmlConnection=new b,this.xsdConnection=new b}},MB=class extends J{constructor(A){super(Kt,"effectiveInputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},LB=class extends J{constructor(A){super(Kt,"effectiveOutputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},HB=class extends qA{constructor(A){super(Kt,"operation"),this.id=A.id||"",this.input=A.input||"",this.name=A.name||"",this.output=A.output||"",this.use=A.use||"",this.usehref=A.usehref||""}},JB=class extends qA{constructor(A){super(Kt,"rootElement"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},YB=class extends qA{constructor(A){super(Kt,"soapAction"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},KB=class extends qA{constructor(A){super(Kt,"soapAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},vB=class extends qA{constructor(A){super(Kt,"uri"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},qB=class extends qA{constructor(A){super(Kt,"wsdlAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}},TB=class extends J{constructor(A){super(Kt,"wsdlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.effectiveInputPolicy=null,this.effectiveOutputPolicy=null,this.operation=null,this.soapAction=null,this.soapAddress=null,this.wsdlAddress=null}},PB=class extends J{constructor(A){super(Kt,"xmlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.uri=null}},WB=class extends J{constructor(A){super(Kt,"xsdConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.rootElement=null,this.uri=null}},qs=class{static[Zt](A,t){if(qs.hasOwnProperty(A))return qs[A](t)}static connectionSet(A){return new UB(A)}static effectiveInputPolicy(A){return new MB(A)}static effectiveOutputPolicy(A){return new LB(A)}static operation(A){return new HB(A)}static rootElement(A){return new JB(A)}static soapAction(A){return new YB(A)}static soapAddress(A){return new KB(A)}static uri(A){return new vB(A)}static wsdlAddress(A){return new qB(A)}static wsdlConnection(A){return new TB(A)}static xmlConnection(A){return new PB(A)}static xsdConnection(A){return new WB(A)}},OB=me.datasets.id,ZB=class extends Jt{constructor(A){super(OB,"data",A)}[ma](){return!0}},jB=class extends J{constructor(A){super(OB,"datasets",!0),this.data=null,this.Signature=null}[ni](A){let t=A[XA];(t==="data"&&A[de]===OB||t==="Signature"&&A[de]===me.signature.id)&&(this[t]=A),this[Be](A)}},Ts=class{static[Zt](A,t){if(Ts.hasOwnProperty(A))return Ts[A](t)}static datasets(A){return new jB(A)}static data(A){return new ZB(A)}},Qe=me.localeSet.id,XB=class extends J{constructor(A){super(Qe,"calendarSymbols",!0),this.name="gregorian",this.dayNames=new b(2),this.eraNames=null,this.meridiemNames=null,this.monthNames=new b(2)}},VB=class extends qA{constructor(A){super(Qe,"currencySymbol"),this.name=O(A.name,["symbol","isoname","decimal"])}},_B=class extends J{constructor(A){super(Qe,"currencySymbols",!0),this.currencySymbol=new b(3)}},zB=class extends qA{constructor(A){super(Qe,"datePattern"),this.name=O(A.name,["full","long","med","short"])}},$B=class extends J{constructor(A){super(Qe,"datePatterns",!0),this.datePattern=new b(4)}},AQ=class extends ce{constructor(A){super(Qe,"dateTimeSymbols")}},eQ=class extends qA{constructor(A){super(Qe,"day")}},tQ=class extends J{constructor(A){super(Qe,"dayNames",!0),this.abbr=GA({data:A.abbr,defaultValue:0,validate:t=>t===1}),this.day=new b(7)}},iQ=class extends qA{constructor(A){super(Qe,"era")}},sQ=class extends J{constructor(A){super(Qe,"eraNames",!0),this.era=new b(2)}},aQ=class extends J{constructor(A){super(Qe,"locale",!0),this.desc=A.desc||"",this.name="isoname",this.calendarSymbols=null,this.currencySymbols=null,this.datePatterns=null,this.dateTimeSymbols=null,this.numberPatterns=null,this.numberSymbols=null,this.timePatterns=null,this.typeFaces=null}},nQ=class extends J{constructor(A){super(Qe,"localeSet",!0),this.locale=new b}},rQ=class extends qA{constructor(A){super(Qe,"meridiem")}},gQ=class extends J{constructor(A){super(Qe,"meridiemNames",!0),this.meridiem=new b(2)}},oQ=class extends qA{constructor(A){super(Qe,"month")}},IQ=class extends J{constructor(A){super(Qe,"monthNames",!0),this.abbr=GA({data:A.abbr,defaultValue:0,validate:t=>t===1}),this.month=new b(12)}},cQ=class extends qA{constructor(A){super(Qe,"numberPattern"),this.name=O(A.name,["full","long","med","short"])}},lQ=class extends J{constructor(A){super(Qe,"numberPatterns",!0),this.numberPattern=new b(4)}},hQ=class extends qA{constructor(A){super(Qe,"numberSymbol"),this.name=O(A.name,["decimal","grouping","percent","minus","zero"])}},CQ=class extends J{constructor(A){super(Qe,"numberSymbols",!0),this.numberSymbol=new b(5)}},BQ=class extends qA{constructor(A){super(Qe,"timePattern"),this.name=O(A.name,["full","long","med","short"])}},QQ=class extends J{constructor(A){super(Qe,"timePatterns",!0),this.timePattern=new b(4)}},EQ=class extends J{constructor(A){super(Qe,"typeFace",!0),this.name=A.name|""}},fQ=class extends J{constructor(A){super(Qe,"typeFaces",!0),this.typeFace=new b}},Ps=class{static[Zt](A,t){if(Ps.hasOwnProperty(A))return Ps[A](t)}static calendarSymbols(A){return new XB(A)}static currencySymbol(A){return new VB(A)}static currencySymbols(A){return new _B(A)}static datePattern(A){return new zB(A)}static datePatterns(A){return new $B(A)}static dateTimeSymbols(A){return new AQ(A)}static day(A){return new eQ(A)}static dayNames(A){return new tQ(A)}static era(A){return new iQ(A)}static eraNames(A){return new sQ(A)}static locale(A){return new aQ(A)}static localeSet(A){return new nQ(A)}static meridiem(A){return new rQ(A)}static meridiemNames(A){return new gQ(A)}static month(A){return new oQ(A)}static monthNames(A){return new IQ(A)}static numberPattern(A){return new cQ(A)}static numberPatterns(A){return new lQ(A)}static numberSymbol(A){return new hQ(A)}static numberSymbols(A){return new CQ(A)}static timePattern(A){return new BQ(A)}static timePatterns(A){return new QQ(A)}static typeFace(A){return new EQ(A)}static typeFaces(A){return new fQ(A)}},gx=me.signature.id,uQ=class extends J{constructor(A){super(gx,"signature",!0)}},Ws=class{static[Zt](A,t){if(Ws.hasOwnProperty(A))return Ws[A](t)}static signature(A){return new uQ(A)}},ox=me.stylesheet.id,dQ=class extends J{constructor(A){super(ox,"stylesheet",!0)}},Os=class{static[Zt](A,t){if(Os.hasOwnProperty(A))return Os[A](t)}static stylesheet(A){return new dQ(A)}},Ix=me.xdp.id,xQ=class extends J{constructor(A){super(Ix,"xdp",!0),this.uuid=A.uuid||"",this.timeStamp=A.timeStamp||"",this.config=null,this.connectionSet=null,this.datasets=null,this.localeSet=null,this.stylesheet=new b,this.template=null}[Ec](A){let t=me[A[XA]];return t&&A[de]===t.id}},Zs=class{static[Zt](A,t){if(Zs.hasOwnProperty(A))return Zs[A](t)}static xdp(A){return new xQ(A)}},cx=me.xhtml.id,Vn=Symbol(),lx=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),hx=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",e=>e==="none"?"none":"normal"],["xfa-font-horizontal-scale",e=>`scaleX(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-font-vertical-scale",e=>`scaleY(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(e,A)=>(e=A.fontSize=hA(e),NA(.99*e))],["letter-spacing",e=>NA(hA(e))],["line-height",e=>NA(hA(e))],["margin",e=>NA(hA(e))],["margin-bottom",e=>NA(hA(e))],["margin-left",e=>NA(hA(e))],["margin-right",e=>NA(hA(e))],["margin-top",e=>NA(hA(e))],["text-indent",e=>NA(hA(e))],["font-family",e=>e],["vertical-align",e=>NA(hA(e))]]),Cx=/\\s+/g,Bx=/[\\r\\n]+/g,Qx=/\\r\\n?/g;function Ex(e,A,t){let i=Object.create(null);if(!e)return i;let s=Object.create(null);for(let[a,n]of e.split(";").map(r=>r.split(":",2))){let r=hx.get(a);if(r==="")continue;let g=n;r&&(g=typeof r=="string"?r:r(n,s)),a.endsWith("scale")?i.transform=i.transform?`${i[a]} ${g}`:g:i[a.replaceAll(/-([a-zA-Z])/g,(o,I)=>I.toUpperCase())]=g}if(i.fontFamily&&tu({typeface:i.fontFamily,weight:i.fontWeight||"normal",posture:i.fontStyle||"normal",size:s.fontSize||0},A,A[ie].fontFinder,i),t&&i.verticalAlign&&i.verticalAlign!=="0px"&&i.fontSize){let r=hA(i.fontSize);i.fontSize=NA(r*.583),i.verticalAlign=NA(Math.sign(hA(i.verticalAlign))*r*.333)}return t&&i.fontSize&&(i.fontSize=`calc(${i.fontSize} * var(--scale-factor))`),$f(i),i}function fx(e){return e.style?e.style.trim().split(/\\s*;\\s*/).filter(A=>!!A).map(A=>A.split(/\\s*:\\s*/,2)).filter(([A,t])=>(A==="font-family"&&e[ie].usedTypefaces.add(t),lx.has(A))).map(A=>A.join(":")).join(";"):""}var ux=new Set(["body","html"]),ct=class extends Jt{constructor(A,t){super(cx,t),this[Vn]=!1,this.style=A.style||""}[Yt](A){super[Yt](A),this.style=fx(this)}[eo](){return!ux.has(this[XA])}[xi](A,t=!1){t?this[Vn]=!0:(A=A.replaceAll(Bx,""),this.style.includes("xfa-spacerun:yes")||(A=A.replaceAll(Cx," "))),A&&(this[P]+=A)}[ri](A,t=!0){let i=Object.create(null),s={top:NaN,bottom:NaN,left:NaN,right:NaN},a=null;for(let[n,r]of this.style.split(";").map(g=>g.split(":",2)))switch(n){case"font-family":i.typeface=io(r);break;case"font-size":i.size=hA(r);break;case"font-weight":i.weight=r;break;case"font-style":i.posture=r;break;case"letter-spacing":i.letterSpacing=hA(r);break;case"margin":let g=r.split(/ \\t/).map(o=>hA(o));switch(g.length){case 1:s.top=s.bottom=s.left=s.right=g[0];break;case 2:s.top=s.bottom=g[0],s.left=s.right=g[1];break;case 3:s.top=g[0],s.bottom=g[2],s.left=s.right=g[1];break;case 4:s.top=g[0],s.left=g[1],s.bottom=g[2],s.right=g[3];break}break;case"margin-top":s.top=hA(r);break;case"margin-bottom":s.bottom=hA(r);break;case"margin-left":s.left=hA(r);break;case"margin-right":s.right=hA(r);break;case"line-height":a=hA(r);break}if(A.pushData(i,s,a),this[P])A.addString(this[P]);else for(let n of this[Ue]()){if(n[XA]==="#text"){A.addString(n[P]);continue}n[ri](A)}t&&A.popFont()}[SA](A){let t=[];if(this[L]={children:t},this[_i]({}),t.length===0&&!this[P])return dA.EMPTY;let i;return this[Vn]?i=this[P]?this[P].replaceAll(Qx,`\n`):void 0:i=this[P]||void 0,dA.success({name:this[XA],attributes:{href:this.href,style:Ex(this.style,this,this[Vn])},children:t,value:i})}},mQ=class extends ct{constructor(A){super(A,"a"),this.href=iu(A.href)||""}},pQ=class extends ct{constructor(A){super(A,"b")}[ri](A){A.pushFont({weight:"bold"}),super[ri](A),A.popFont()}},wQ=class extends ct{constructor(A){super(A,"body")}[SA](A){let t=super[SA](A),{html:i}=t;return i?(i.name="div",i.attributes.class=["xfaRich"],t):dA.EMPTY}},yQ=class extends ct{constructor(A){super(A,"br")}[Se](){return`\n`}[ri](A){A.addString(`\n`)}[SA](A){return dA.success({name:"br"})}},bQ=class extends ct{constructor(A){super(A,"html")}[SA](A){var i;let t=[];if(this[L]={children:t},this[_i]({}),t.length===0)return dA.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[P]||""});if(t.length===1){let s=t[0];if((i=s.attributes)!=null&&i.class.includes("xfaRich"))return dA.success(s)}return dA.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:t})}},DQ=class extends ct{constructor(A){super(A,"i")}[ri](A){A.pushFont({posture:"italic"}),super[ri](A),A.popFont()}},kQ=class extends ct{constructor(A){super(A,"li")}},SQ=class extends ct{constructor(A){super(A,"ol")}},FQ=class extends ct{constructor(A){super(A,"p")}[ri](A){super[ri](A,!1),A.addString(`\n`),A.addPara(),A.popFont()}[Se](){return this[MA]()[Ue]().at(-1)===this?super[Se]():super[Se]()+`\n`}},RQ=class extends ct{constructor(A){super(A,"span")}},NQ=class extends ct{constructor(A){super(A,"sub")}},GQ=class extends ct{constructor(A){super(A,"sup")}},UQ=class extends ct{constructor(A){super(A,"ul")}},$i=class{static[Zt](A,t){if($i.hasOwnProperty(A))return $i[A](t)}static a(A){return new mQ(A)}static b(A){return new pQ(A)}static body(A){return new wQ(A)}static br(A){return new yQ(A)}static html(A){return new bQ(A)}static i(A){return new DQ(A)}static li(A){return new kQ(A)}static ol(A){return new SQ(A)}static p(A){return new FQ(A)}static span(A){return new RQ(A)}static sub(A){return new NQ(A)}static sup(A){return new GQ(A)}static ul(A){return new UQ(A)}},HE={config:vs,connection:qs,datasets:Ts,localeSet:Ps,signature:Ws,stylesheet:Os,template:Ks,xdp:Zs,xhtml:$i},Qg=class{constructor(A){this.namespaceId=A}[Zt](A,t){return new Jt(this.namespaceId,A,t)}},MQ=class extends J{constructor(A){super(-1,"root",Object.create(null)),this.element=null,this[As]=A}[ni](A){return this.element=A,!0}[se](){super[se](),this.element.template instanceof tn&&(this[As].set(Pf,this.element),this.element.template[ha](this[As]),this.element.template[As]=this[As])}},LQ=class extends J{constructor(){super(-1,"",Object.create(null))}[ni](A){return!1}},HQ=class{constructor(A=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=new Map,this._namespaces=new Map,this._nextNsId=Math.max(...Object.values(me).map(({id:t})=>t)),this._currentNamespace=A||new Qg(++this._nextNsId)}buildRoot(A){return new MQ(A)}build({nsPrefix:A,name:t,attributes:i,namespace:s,prefixes:a}){let n=s!==null;if(n&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(s)),a&&this._addNamespacePrefix(a),i.hasOwnProperty(qi)){let o=HE.datasets,I=i[qi],c=null;for(let[l,h]of Object.entries(I))if(this._getNamespaceToUse(l)===o){c={xfa:h};break}c?i[qi]=c:delete i[qi]}let r=this._getNamespaceToUse(A),g=(r==null?void 0:r[Zt](t,i))||new LQ;return g[ma]()&&this._nsAgnosticLevel++,(n||a||g[ma]())&&(g[cr]={hasNamespace:n,prefixes:a,nsAgnostic:g[ma]()}),g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(A){let t=this._namespaces.get(A);if(t)return t;for(let[i,{check:s}]of Object.entries(me))if(s(A)){if(t=HE[i],t)return this._namespaces.set(A,t),t;break}return t=new Qg(++this._nextNsId),this._namespaces.set(A,t),t}_addNamespacePrefix(A){for(let{prefix:t,value:i}of A){let s=this._searchNamespace(i),a=this._namespacePrefixes.get(t);a||(a=[],this._namespacePrefixes.set(t,a)),a.push(s)}}_getNamespaceToUse(A){if(!A)return this._currentNamespace;let t=this._namespacePrefixes.get(A);return(t==null?void 0:t.length)>0?t.at(-1):(k(`Unknown namespace prefix: ${A}.`),null)}clean(A){let{hasNamespace:t,prefixes:i,nsAgnostic:s}=A;t&&(this._currentNamespace=this._namespaceStack.pop()),i&&i.forEach(({prefix:a})=>{this._namespacePrefixes.get(a).pop()}),s&&this._nsAgnosticLevel--}},js=class extends jr{constructor(A=null,t=!1){super(),this._builder=new HQ(A),this._stack=[],this._globalData={usedTypefaces:new Set},this._ids=new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=ht.NoError,this._whiteRegex=/^\\s+$/,this._nbsps=/\\xa0+/g,this._richText=t}parse(A){if(this.parseXml(A),this._errorCode===ht.NoError)return this._current[se](),this._current.element}onText(A){if(A=A.replace(this._nbsps,t=>t.slice(1)+" "),this._richText||this._current[eo]()){this._current[xi](A,this._richText);return}this._whiteRegex.test(A)||this._current[xi](A.trim())}onCdata(A){this._current[xi](A)}_mkAttributes(A,t){let i=null,s=null,a=Object.create({});for(let{name:n,value:r}of A)if(n==="xmlns")i?k(`XFA - multiple namespace definition in <${t}>`):i=r;else if(n.startsWith("xmlns:")){let g=n.substring(6);s||(s=[]),s.push({prefix:g,value:r})}else{let g=n.indexOf(":");if(g===-1)a[n]=r;else{let o=a[qi];o||(o=a[qi]=Object.create(null));let[I,c]=[n.slice(0,g),n.slice(g+1)],l=o[I]||(o[I]=Object.create(null));l[c]=r}}return[i,s,a]}_getNameAndPrefix(A,t){let i=A.indexOf(":");return i===-1?[A,null]:[A.substring(i+1),t?"":A.substring(0,i)]}onBeginElement(A,t,i){let[s,a,n]=this._mkAttributes(t,A),[r,g]=this._getNameAndPrefix(A,this._builder.isNsAgnostic()),o=this._builder.build({nsPrefix:g,name:r,attributes:n,namespace:s,prefixes:a});if(o[ie]=this._globalData,i){o[se](),this._current[ni](o)&&o[fc](this._ids),o[Yt](this._builder);return}this._stack.push(this._current),this._current=o}onEndElement(A){let t=this._current;if(t[d1]()&&typeof t[P]=="string"){let i=new js;i._globalData=this._globalData;let s=i.parse(t[P]);t[P]=null,t[ni](s)}t[se](),this._current=this._stack.pop(),this._current[ni](t)&&t[fc](this._ids),t[Yt](this._builder)}onError(A){this._errorCode=A}},M0=class{constructor(A){try{this.root=new js().parse(M0._createDocument(A));let t=new eh(this.root);this.form=t.bind(),this.dataHandler=new th(this.root,t.getData()),this.form[ie].template=this.form}catch(t){k(`XFA - an error occurred during parsing and binding: ${t}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){let A=this.form[Of]();return new Promise((t,i)=>{let s=()=>{try{let a=A.next();a.done?t(a.value):setTimeout(s,0)}catch(a){i(a)}};setTimeout(s,0)})}async _createPages(){try{this.pages=await this._createPagesHelper(),this.dims=this.pages.children.map(A=>{let{width:t,height:i}=A.attributes.style;return[0,0,parseInt(t),parseInt(i)]})}catch(A){k(`XFA - an error occurred during layout: ${A}`)}}getBoundingBox(A){return this.dims[A]}async getNumPages(){return this.pages||await this._createPages(),this.dims.length}setImages(A){this.form[ie].images=A}setFonts(A){this.form[ie].fontFinder=new uc(A);let t=[];for(let i of this.form[ie].usedTypefaces)i=io(i),this.form[ie].fontFinder.find(i)||t.push(i);return t.length>0?t:null}appendFonts(A,t){this.form[ie].fontFinder.add(A,t)}async getPages(){this.pages||await this._createPages();let A=this.pages;return this.pages=null,A}serializeData(A){return this.dataHandler.serialize(A)}static _createDocument(A){return A["/xdp:xdp"]?Object.values(A).join(""):A["xdp:xdp"]}static getRichTextAsHtml(A){if(!A||typeof A!="string")return null;try{let t=new js($i,!0).parse(A);if(!["body","xhtml"].includes(t[XA])){let n=$i.body({});n[Be](t),t=n}let i=t[SA]();if(!i.success)return null;let{html:s}=i,{attributes:a}=s;return a&&(a.class&&(a.class=a.class.filter(n=>!n.startsWith("xfa"))),a.dir="auto"),{html:s,str:t[Se]()}}catch(t){k(`XFA - an error occurred during parsing of rich text: ${t}`)}return null}},ei=class{static createGlobals(A){return Promise.all([A.ensureCatalog("acroForm"),A.ensureDoc("xfaDatasets"),A.ensureCatalog("structTreeRoot"),A.ensureCatalog("baseUrl"),A.ensureCatalog("attachments")]).then(([t,i,s,a,n])=>({pdfManager:A,acroForm:t instanceof F?t:F.empty,xfaDatasets:i,structTreeRoot:s,baseUrl:a,attachments:n}),t=>(k(`createGlobals: "${t}".`),null))}static async create(A,t,i,s,a,n){let r=a?await this._getPageIndex(A,t,i.pdfManager):null;return i.pdfManager.ensure(this,"_create",[A,t,i,s,a,r,n])}static _create(A,t,i,s,a=!1,n=null,r=null){let g=A.fetchIfRef(t);if(!(g instanceof F))return;let{acroForm:o,pdfManager:I}=i,c=t instanceof oA?t.toString():`annot_${s.createObjId()}`,l=g.get("Subtype");l=l instanceof M?l.name:null;let h={xref:A,ref:t,dict:g,subtype:l,id:c,annotationGlobals:i,collectFields:a,needAppearances:!a&&o.get("NeedAppearances")===!0,pageIndex:n,evaluatorOptions:I.evaluatorOptions,pageRef:r};switch(l){case"Link":return new PQ(h);case"Text":return new TQ(h);case"Widget":let C=Mt({dict:g,key:"FT"});switch(C=C instanceof M?C.name:null,C){case"Tx":return new KQ(h);case"Btn":return new vQ(h);case"Ch":return new qQ(h);case"Sig":return new Eg(h)}return k(`Unimplemented widget field type "${C}", falling back to base field type.`),new bt(h);case"Popup":return new fg(h);case"FreeText":return new wa(h);case"Line":return new WQ(h);case"Square":return new OQ(h);case"Circle":return new ZQ(h);case"PolyLine":return new ug(h);case"Polygon":return new dg(h);case"Caret":return new jQ(h);case"Ink":return new l0(h);case"Highlight":return new ya(h);case"Underline":return new XQ(h);case"Squiggly":return new VQ(h);case"StrikeOut":return new _Q(h);case"Stamp":return new gs(h);case"FileAttachment":return new zQ(h);default:return a||k(l?`Unimplemented annotation type "${l}", falling back to base annotation.`:"Annotation is missing the required /Subtype."),new L0(h)}}static async _getPageIndex(A,t,i){try{let s=await A.fetchIfRefAsync(t);if(!(s instanceof F))return-1;let a=s.getRaw("P");if(a instanceof oA)try{return await i.ensureCatalog("getPageIndex",[a])}catch(r){PA(`_getPageIndex -- not a valid page reference: "${r}".`)}if(s.has("Kids"))return-1;let n=await i.ensureDoc("numPages");for(let r=0;r<n;r++){let g=await i.getPage(r),o=await i.ensure(g,"annotations");for(let I of o)if(I instanceof oA&&ur(I,t))return r}}catch(s){k(`_getPageIndex: "${s}".`)}return-1}static generateImages(A,t,i){if(!i)return k("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images."),null;let s;for(let{bitmapId:a,bitmap:n}of A)n&&(s||(s=new Map),s.set(a,gs.createImage(n,t)));return s}static async saveNewAnnotations(A,t,i,s){let a=A.xref,n,r=[],g=[],{isOffscreenCanvasSupported:o}=A.options;for(let I of i)if(!I.deleted)switch(I.annotationType){case bi.FREETEXT:if(!n){let l=new F(a);l.set("BaseFont",M.get("Helvetica")),l.set("Type",M.get("Font")),l.set("Subtype",M.get("Type1")),l.set("Encoding",M.get("WinAnsiEncoding"));let h=[];n=a.getNewTemporaryRef(),await ot(n,l,h,a),r.push({ref:n,data:h.join("")})}g.push(wa.createNewAnnotation(a,I,r,{evaluator:A,task:t,baseFontRef:n}));break;case bi.HIGHLIGHT:I.quadPoints?g.push(ya.createNewAnnotation(a,I,r)):g.push(l0.createNewAnnotation(a,I,r));break;case bi.INK:g.push(l0.createNewAnnotation(a,I,r));break;case bi.STAMP:if(!o)break;let c=await s.get(I.bitmapId);if(c.imageStream){let{imageStream:l,smaskStream:h}=c,C=[];if(h){let Q=a.getNewTemporaryRef();await ot(Q,h,C,a),r.push({ref:Q,data:C.join("")}),l.dict.set("SMask",Q),C.length=0}let B=c.imageRef=a.getNewTemporaryRef();await ot(B,l,C,a),r.push({ref:B,data:C.join("")}),c.imageStream=c.smaskStream=null}g.push(gs.createNewAnnotation(a,I,r,{image:c}));break}return{annotations:await Promise.all(g),dependencies:r}}static async printNewAnnotations(A,t,i,s,a){if(!s)return null;let{options:n,xref:r}=t,g=[];for(let o of s)if(!o.deleted)switch(o.annotationType){case bi.FREETEXT:g.push(wa.createNewPrintAnnotation(A,r,o,{evaluator:t,task:i,evaluatorOptions:n}));break;case bi.HIGHLIGHT:o.quadPoints?g.push(ya.createNewPrintAnnotation(A,r,o,{evaluatorOptions:n})):g.push(l0.createNewPrintAnnotation(A,r,o,{evaluatorOptions:n}));break;case bi.INK:g.push(l0.createNewPrintAnnotation(A,r,o,{evaluatorOptions:n}));break;case bi.STAMP:if(!n.isOffscreenCanvasSupported)break;let I=await a.get(o.bitmapId);if(I.imageStream){let{imageStream:c,smaskStream:l}=I;l&&c.dict.set("SMask",l),I.imageRef=new Ra(c,c.length),I.imageStream=I.smaskStream=null}g.push(gs.createNewPrintAnnotation(A,r,o,{image:I,evaluatorOptions:n}));break}return Promise.all(g)}};function Qs(e,A=new Uint8ClampedArray(3)){if(!Array.isArray(e))return A;let t=A||new Uint8ClampedArray(3);switch(e.length){case 0:return null;case 1:return JA.singletons.gray.getRgbItem(e,0,t,0),t;case 3:return JA.singletons.rgb.getRgbItem(e,0,t,0),t;case 4:return JA.singletons.cmyk.getRgbItem(e,0,t,0),t;default:return A}}function ft(e){return Array.from(e,A=>A/255)}function bn(e,A){let t=e.getArray("QuadPoints");if(!wt(t,null)||t.length===0||t.length%8>0)return null;let i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s+=8){let[n,r,g,o,I,c,l,h]=t.slice(s,s+8),C=Math.min(n,g,I,l),B=Math.max(n,g,I,l),Q=Math.min(r,o,c,h),E=Math.max(r,o,c,h);if(A!==null&&(C<A[0]||B>A[2]||Q<A[1]||E>A[3]))return null;i.set([C,E,B,E,C,Q,B,Q],s)}return i}function JQ(e,A,t){let[i,s,a,n]=Ce.getAxialAlignedBoundingBox(A,t);if(i===a||s===n)return[1,0,0,1,e[0],e[1]];let r=(e[2]-e[0])/(a-i),g=(e[3]-e[1])/(n-s);return[r,0,0,g,e[0]-i*r,e[1]-s*g]}var L0=class{constructor(A){let{dict:t,xref:i,annotationGlobals:s}=A;this.setTitle(t.get("T")),this.setContents(t.get("Contents")),this.setModificationDate(t.get("M")),this.setFlags(t.get("F")),this.setRectangle(t.getArray("Rect")),this.setColor(t.getArray("C")),this.setBorderStyle(t),this.setAppearance(t),this.setOptionalContent(t);let a=t.get("MK");this.setBorderAndBackgroundColors(a),this.setRotation(a,t),this.ref=A.ref instanceof oA?A.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);let n=!!(this.flags&it.LOCKED),r=!!(this.flags&it.LOCKEDCONTENTS);if(s.structTreeRoot){let g=t.get("StructParent");g=Number.isInteger(g)&&g>=0?g:-1,s.structTreeRoot.addAnnotationIdToPage(A.pageRef,g)}if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:A.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:A.subtype,hasOwnCanvas:!1,noRotate:!!(this.flags&it.NOROTATE),noHTML:n&&r,isEditable:!1},A.collectFields){let g=t.get("Kids");if(Array.isArray(g)){let o=[];for(let I of g)I instanceof oA&&o.push(I.toString());o.length!==0&&(this.data.kidIds=o)}this.data.actions=Vg(i,t,WE),this.data.fieldName=this._constructFieldName(t),this.data.pageIndex=A.pageIndex}this._isOffscreenCanvasSupported=A.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(A,t){return!!(A&t)}_isViewable(A){return!this._hasFlag(A,it.INVISIBLE)&&!this._hasFlag(A,it.NOVIEW)}_isPrintable(A){return this._hasFlag(A,it.PRINT)&&!this._hasFlag(A,it.HIDDEN)&&!this._hasFlag(A,it.INVISIBLE)}mustBeViewed(A,t){var s;let i=(s=A==null?void 0:A.get(this.data.id))==null?void 0:s.noView;return i!==void 0?!i:this.viewable&&!this._hasFlag(this.flags,it.HIDDEN)}mustBePrinted(A){var i;let t=(i=A==null?void 0:A.get(this.data.id))==null?void 0:i.noPrint;return t!==void 0?!t:this.printable}mustBeViewedWhenEditing(A,t=null){return A?!this.data.isEditable:!(t!=null&&t.has(this.data.id))}get viewable(){return this.data.quadPoints===null?!1:this.flags===0?!0:this._isViewable(this.flags)}get printable(){return this.data.quadPoints===null||this.flags===0?!1:this._isPrintable(this.flags)}_parseStringHelper(A){let t=typeof A=="string"?jA(A):"",i=t&&yf(t).dir==="rtl"?"rtl":"ltr";return{str:t,dir:i}}setDefaultAppearance(A){let{dict:t,annotationGlobals:i}=A,s=Mt({dict:t,key:"DA"})||i.acroForm.get("DA");this._defaultAppearance=typeof s=="string"?s:"",this.data.defaultAppearanceData=Q1(this._defaultAppearance)}setTitle(A){this._title=this._parseStringHelper(A)}setContents(A){this._contents=this._parseStringHelper(A)}setModificationDate(A){this.modificationDate=typeof A=="string"?A:null}setFlags(A){this.flags=Number.isInteger(A)&&A>0?A:0,this.flags&it.INVISIBLE&&this.constructor.name!=="Annotation"&&(this.flags^=it.INVISIBLE)}hasFlag(A){return this._hasFlag(this.flags,A)}setRectangle(A){this.rectangle=Ei(A,[0,0,0,0])}setColor(A){this.color=Qs(A)}setLineEndings(A){if(this.lineEndings=["None","None"],Array.isArray(A)&&A.length===2)for(let t=0;t<2;t++){let i=A[t];if(i instanceof M)switch(i.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[t]=i.name;continue}k(`Ignoring invalid lineEnding: ${i}`)}}setRotation(A,t){this.rotation=0;let i=A instanceof F?A.get("R")||0:t.get("Rotate")||0;Number.isInteger(i)&&i!==0&&(i%=360,i<0&&(i+=360),i%90===0&&(this.rotation=i))}setBorderAndBackgroundColors(A){A instanceof F?(this.borderColor=Qs(A.getArray("BC"),null),this.backgroundColor=Qs(A.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(A){if(this.borderStyle=new YQ,A instanceof F)if(A.has("BS")){let t=A.get("BS");if(t instanceof F){let i=t.get("Type");(!i||ye(i,"Border"))&&(this.borderStyle.setWidth(t.get("W"),this.rectangle),this.borderStyle.setStyle(t.get("S")),this.borderStyle.setDashArray(t.getArray("D")))}}else if(A.has("Border")){let t=A.getArray("Border");Array.isArray(t)&&t.length>=3&&(this.borderStyle.setHorizontalCornerRadius(t[0]),this.borderStyle.setVerticalCornerRadius(t[1]),this.borderStyle.setWidth(t[2],this.rectangle),t.length===4&&this.borderStyle.setDashArray(t[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(A){this.appearance=null;let t=A.get("AP");if(!(t instanceof F))return;let i=t.get("N");if(i instanceof KA){this.appearance=i;return}if(!(i instanceof F))return;let s=A.get("AS");if(!(s instanceof M)||!i.has(s.name))return;let a=i.get(s.name);a instanceof KA&&(this.appearance=a)}setOptionalContent(A){this.oc=null;let t=A.get("OC");t instanceof M?k("setOptionalContent: Support for /Name-entry is not implemented."):t instanceof F&&(this.oc=t)}loadResources(A,t){return t.dict.getAsync("Resources").then(i=>i?new Hs(i,A,i.xref).load().then(function(){return i}):void 0)}async getOperatorList(A,t,i,s){let{hasOwnCanvas:a,id:n,rect:r}=this.data,g=this.appearance,o=!!(a&&i&st.DISPLAY);if(o&&(r[0]===r[2]||r[1]===r[3]))return this.data.hasOwnCanvas=!1,{opList:new ze,separateForm:!1,separateCanvas:!1};if(!g){if(!o)return{opList:new ze,separateForm:!1,separateCanvas:!1};g=new It(""),g.dict=new F}let I=g.dict,c=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],g),l=Ko(I.getArray("BBox"),[0,0,1,1]),h=Ki(I.getArray("Matrix"),Wt),C=JQ(r,l,h),B=new ze,Q;return this.oc&&(Q=await A.parseMarkedContentProps(this.oc,null)),Q!==void 0&&B.addOp(y.beginMarkedContentProps,["OC",Q]),B.addOp(y.beginAnnotation,[n,r,C,h,o]),await A.getOperatorList({stream:g,task:t,resources:c,operatorList:B,fallbackFontDict:this._fallbackFontDict}),B.addOp(y.endAnnotation,[]),Q!==void 0&&B.addOp(y.endMarkedContent,[]),this.reset(),{opList:B,separateForm:!1,separateCanvas:o}}async save(A,t,i){return null}get hasTextContent(){return!1}async extractTextContent(A,t,i){if(!this.appearance)return;let s=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),a=[],n=[],r=null,g={desiredSize:Math.Infinity,ready:!0,enqueue(o,I){for(let c of o.items)c.str!==void 0&&(r||(r=c.transform.slice(-2)),n.push(c.str),c.hasEOL&&(a.push(n.join("").trimEnd()),n.length=0))}};if(await A.getTextContent({stream:this.appearance,task:t,resources:s,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:i}),this.reset(),n.length&&a.push(n.join("").trimEnd()),a.length>1||a[0]){let o=this.appearance.dict,I=Ko(o.getArray("BBox"),null),c=Ki(o.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(r,I,c),this.data.textContent=a}}_transformPoint(A,t,i){let{rect:s}=this.data;t||(t=[0,0,1,1]),i||(i=[1,0,0,1,0,0]);let a=JQ(s,t,i);return a[4]-=s[0],a[5]-=s[1],A=Ce.applyTransform(A,a),Ce.applyTransform(A,i)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(let A of this._streams)A.reset()}_constructFieldName(A){if(!A.has("T")&&!A.has("Parent"))return k("Unknown field name, falling back to empty field name."),"";if(!A.has("Parent"))return jA(A.get("T"));let t=[];A.has("T")&&t.unshift(jA(A.get("T")));let i=A,s=new be;for(A.objId&&s.put(A.objId);i.has("Parent")&&(i=i.get("Parent"),!(!(i instanceof F)||i.objId&&s.has(i.objId)));)i.objId&&s.put(i.objId),i.has("T")&&t.unshift(jA(i.get("T")));return t.join(".")}},YQ=class{constructor(){this.width=1,this.style=Y0.SOLID,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(A,t=[0,0,0,0]){if(A instanceof M){this.width=0;return}if(typeof A=="number"){if(A>0){let i=(t[2]-t[0])/2,s=(t[3]-t[1])/2;i>0&&s>0&&(A>i||A>s)&&(k(`AnnotationBorderStyle.setWidth - ignoring width: ${A}`),A=1)}this.width=A}}setStyle(A){if(A instanceof M)switch(A.name){case"S":this.style=Y0.SOLID;break;case"D":this.style=Y0.DASHED;break;case"B":this.style=Y0.BEVELED;break;case"I":this.style=Y0.INSET;break;case"U":this.style=Y0.UNDERLINE;break;default:break}}setDashArray(A,t=!1){if(Array.isArray(A)){let i=!0,s=!0;for(let a of A)if(+a>=0)a>0&&(s=!1);else{i=!1;break}A.length===0||i&&!s?(this.dashArray=A,t&&this.setStyle(M.get("D"))):this.width=0}else A&&(this.width=0)}setHorizontalCornerRadius(A){Number.isInteger(A)&&(this.horizontalCornerRadius=A)}setVerticalCornerRadius(A){Number.isInteger(A)&&(this.verticalCornerRadius=A)}},$e=class extends L0{constructor(A){super(A);let{dict:t}=A;if(t.has("IRT")){let s=t.getRaw("IRT");this.data.inReplyTo=s instanceof oA?s.toString():null;let a=t.get("RT");this.data.replyType=a instanceof M?a.name:Ho.REPLY}let i=null;if(this.data.replyType===Ho.GROUP){let s=t.get("IRT");this.setTitle(s.get("T")),this.data.titleObj=this._title,this.setContents(s.get("Contents")),this.data.contentsObj=this._contents,s.has("CreationDate")?(this.setCreationDate(s.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,s.has("M")?(this.setModificationDate(s.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,i=s.getRaw("Popup"),s.has("C")?(this.setColor(s.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(t.get("CreationDate")),this.data.creationDate=this.creationDate,i=t.getRaw("Popup"),t.has("C")||(this.data.color=null);this.data.popupRef=i instanceof oA?i.toString():null,t.has("RC")&&(this.data.richText=M0.getRichTextAsHtml(t.get("RC")))}setCreationDate(A){this.creationDate=typeof A=="string"?A:null}_setDefaultAppearance({xref:A,extra:t,strokeColor:i,fillColor:s,blendMode:a,strokeAlpha:n,fillAlpha:r,pointsCallback:g}){let o=Number.MAX_VALUE,I=Number.MAX_VALUE,c=Number.MIN_VALUE,l=Number.MIN_VALUE,h=["q"];t&&h.push(t),i&&h.push(`${i[0]} ${i[1]} ${i[2]} RG`),s&&h.push(`${s[0]} ${s[1]} ${s[2]} rg`);let C=this.data.quadPoints;C||(C=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let m=0,D=C.length;m<D;m+=8){let[S,w,Y,U]=g(h,C.subarray(m,m+8));o=Math.min(o,S),c=Math.max(c,w),I=Math.min(I,Y),l=Math.max(l,U)}h.push("Q");let B=new F(A),Q=new F(A);Q.set("Subtype",M.get("Form"));let E=new It(h.join(" "));E.dict=Q,B.set("Fm0",E);let f=new F(A);a&&f.set("BM",M.get(a)),typeof n=="number"&&f.set("CA",n),typeof r=="number"&&f.set("ca",r);let u=new F(A);u.set("GS0",f);let d=new F(A);d.set("ExtGState",u),d.set("XObject",B);let x=new F(A);x.set("Resources",d);let p=this.data.rect=[o,I,c,l];x.set("BBox",p),this.appearance=new It("/GS0 gs /Fm0 Do"),this.appearance.dict=x,this._streams.push(this.appearance,E)}static async createNewAnnotation(A,t,i,s){let a;t.ref?a=(await A.fetchIfRefAsync(t.ref)).clone():t.ref=A.getNewTemporaryRef();let n=t.ref,r=await this.createNewAppearanceStream(t,A,s),g=[],o;if(r){let I=A.getNewTemporaryRef();o=this.createNewDict(t,A,{apRef:I,oldAnnotation:a}),await ot(I,r,g,A),i.push({ref:I,data:g.join("")})}else o=this.createNewDict(t,A,{oldAnnotation:a});return Number.isInteger(t.parentTreeId)&&o.set("StructParent",t.parentTreeId),g.length=0,await ot(n,o,g,A),{ref:n,data:g.join("")}}static async createNewPrintAnnotation(A,t,i,s){let a=await this.createNewAppearanceStream(i,t,s),n=this.createNewDict(i,t,{ap:a}),r=new this.prototype.constructor({dict:n,xref:t,annotationGlobals:A,evaluatorOptions:s.evaluatorOptions});return i.ref&&(r.ref=r.refToReplace=i.ref),r}},bt=class extends L0{constructor(A){var l;super(A);let{dict:t,xref:i,annotationGlobals:s}=A,a=this.data;this._needAppearances=A.needAppearances,a.annotationType=Le.WIDGET,a.fieldName===void 0&&(a.fieldName=this._constructFieldName(t)),a.actions===void 0&&(a.actions=Vg(i,t,WE));let n=Mt({dict:t,key:"V",getArray:!0});a.fieldValue=this._decodeFormValue(n);let r=Mt({dict:t,key:"DV",getArray:!0});if(a.defaultFieldValue=this._decodeFormValue(r),n===void 0&&s.xfaDatasets){let h=this._title.str;h&&(this._hasValueFromXFA=!0,a.fieldValue=n=s.xfaDatasets.getValue(h))}n===void 0&&a.defaultFieldValue!==null&&(a.fieldValue=a.defaultFieldValue),a.alternativeText=jA(t.get("TU")||""),this.setDefaultAppearance(A),a.hasAppearance||(a.hasAppearance=this._needAppearances&&a.fieldValue!==void 0&&a.fieldValue!==null);let g=Mt({dict:t,key:"FT"});a.fieldType=g instanceof M?g.name:null;let o=Mt({dict:t,key:"DR"}),I=s.acroForm.get("DR"),c=(l=this.appearance)==null?void 0:l.dict.get("Resources");this._fieldResources={localResources:o,acroFormResources:I,appearanceResources:c,mergedResources:F.merge({xref:i,dictArray:[o,c,I],mergeSubDicts:!0})},a.fieldFlags=Mt({dict:t,key:"Ff"}),(!Number.isInteger(a.fieldFlags)||a.fieldFlags<0)&&(a.fieldFlags=0),a.readOnly=this.hasFieldFlag(Te.READONLY),a.required=this.hasFieldFlag(Te.REQUIRED),a.hidden=this._hasFlag(a.annotationFlags,it.HIDDEN)||this._hasFlag(a.annotationFlags,it.NOVIEW)}_decodeFormValue(A){return Array.isArray(A)?A.filter(t=>typeof t=="string").map(t=>jA(t)):A instanceof M?jA(A.name):typeof A=="string"?jA(A):null}hasFieldFlag(A){return!!(this.data.fieldFlags&A)}_isViewable(A){return!0}mustBeViewed(A,t){return t?this.viewable:super.mustBeViewed(A,t)&&!this._hasFlag(this.flags,it.NOVIEW)}getRotationMatrix(A){var a;let t=(a=A==null?void 0:A.get(this.data.id))==null?void 0:a.rotation;if(t===void 0&&(t=this.rotation),t===0)return Wt;let i=this.data.rect[2]-this.data.rect[0],s=this.data.rect[3]-this.data.rect[1];return xr(t,i,s)}getBorderAndBackgroundAppearances(A){var r;let t=(r=A==null?void 0:A.get(this.data.id))==null?void 0:r.rotation;if(t===void 0&&(t=this.rotation),!this.backgroundColor&&!this.borderColor)return"";let i=this.data.rect[2]-this.data.rect[0],s=this.data.rect[3]-this.data.rect[1],a=t===0||t===180?`0 0 ${i} ${s} re`:`0 0 ${s} ${i} re`,n="";if(this.backgroundColor&&(n=`${mi(this.backgroundColor,!0)} ${a} f `),this.borderColor){let g=this.borderStyle.width||1;n+=`${g} w ${mi(this.borderColor,!1)} ${a} S `}return n}async getOperatorList(A,t,i,s){if(i&st.ANNOTATIONS_FORMS&&!(this instanceof Eg)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new ze,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(A,t,i,s);let a=await this._getAppearance(A,t,i,s);if(this.appearance&&a===null)return super.getOperatorList(A,t,i,s);let n=new ze;if(!this._defaultAppearance||a===null)return{opList:n,separateForm:!1,separateCanvas:!1};let r=!!(this.data.hasOwnCanvas&&i&st.DISPLAY),g=[1,0,0,1,0,0],o=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],I=JQ(this.data.rect,o,g),c;this.oc&&(c=await A.parseMarkedContentProps(this.oc,null)),c!==void 0&&n.addOp(y.beginMarkedContentProps,["OC",c]),n.addOp(y.beginAnnotation,[this.data.id,this.data.rect,I,this.getRotationMatrix(s),r]);let l=new It(a);return await A.getOperatorList({stream:l,task:t,resources:this._fieldResources.mergedResources,operatorList:n}),n.addOp(y.endAnnotation,[]),c!==void 0&&n.addOp(y.endMarkedContent,[]),{opList:n,separateForm:!1,separateCanvas:r}}_getMKDict(A){let t=new F(null);return A&&t.set("R",A),this.borderColor&&t.set("BC",ft(this.borderColor)),this.backgroundColor&&t.set("BG",ft(this.backgroundColor)),t.size>0?t:null}amendSavedDict(A,t){}async save(A,t,i){let s=i==null?void 0:i.get(this.data.id),a=s==null?void 0:s.value,n=s==null?void 0:s.rotation;if(a===this.data.fieldValue||a===void 0){if(!this._hasValueFromXFA&&n===void 0)return null;a||(a=this.data.fieldValue)}if(n===void 0&&!this._hasValueFromXFA&&Array.isArray(a)&&Array.isArray(this.data.fieldValue)&&a.length===this.data.fieldValue.length&&a.every((Q,E)=>Q===this.data.fieldValue[E]))return null;n===void 0&&(n=this.rotation);let r=null;if(!this._needAppearances&&(r=await this._getAppearance(A,t,st.SAVE,i),r===null))return null;let g=!1;r!=null&&r.needAppearances&&(g=!0,r=null);let{xref:o}=A,I=o.fetchIfRef(this.ref);if(!(I instanceof F))return null;let c=new F(o);for(let Q of I.getKeys())Q!=="AP"&&c.set(Q,I.getRaw(Q));let l={path:this.data.fieldName,value:a};c.set("V",Array.isArray(a)?a.map(ii):ii(a)),this.amendSavedDict(i,c);let h=this._getMKDict(n);h&&c.set("MK",h);let C=[],B=[{ref:this.ref,data:"",xfa:l,needAppearances:g}];if(r!==null){let Q=o.getNewTemporaryRef(),E=new F(o);c.set("AP",E),E.set("N",Q);let f=this._getSaveFieldResources(o),u=new It(r),d=u.dict=new F(o);d.set("Subtype",M.get("Form")),d.set("Resources",f),d.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);let x=this.getRotationMatrix(i);x!==Wt&&d.set("Matrix",x),await ot(Q,u,C,o),B.push({ref:Q,data:C.join(""),xfa:null,needAppearances:!1}),C.length=0}return c.set("M",`D:${Zi()}`),await ot(this.ref,c,C,o),B[0].data=C.join(""),B}async _getAppearance(A,t,i,s){if(this.hasFieldFlag(Te.PASSWORD))return null;let n=s==null?void 0:s.get(this.data.id),r,g;if(n&&(r=n.formattedValue||n.value,g=n.rotation),g===void 0&&r===void 0&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;let o=this.getBorderAndBackgroundAppearances(s);if(r===void 0&&(r=this.data.fieldValue,!r))return`/Tx BMC q ${o}Q EMC`;if(Array.isArray(r)&&r.length===1&&(r=r[0]),gt(typeof r=="string","Expected `value` to be a string."),r=r.trim(),this.data.combo){let U=this.data.options.find(({exportValue:K})=>r===K);r=(U==null?void 0:U.displayValue)||r}if(r==="")return`/Tx BMC q ${o}Q EMC`;g===void 0&&(g=this.rotation);let I=-1,c;this.data.multiLine?(c=r.split(/\\r\\n?|\\n/).map(U=>U.normalize("NFC")),I=c.length):c=[r.replace(/\\r\\n?|\\n/,"").normalize("NFC")];let l=1,h=2,C=this.data.rect[3]-this.data.rect[1],B=this.data.rect[2]-this.data.rect[0];(g===90||g===270)&&([B,C]=[C,B]),this._defaultAppearance||(this.data.defaultAppearanceData=Q1(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let Q=await bt._getFontData(A,t,this.data.defaultAppearanceData,this._fieldResources.mergedResources),E,f,u,d=[],x=!1;for(let U of c){let K=Q.encodeString(U);K.length>1&&(x=!0),d.push(K.join(""))}if(x&&i&st.SAVE)return{needAppearances:!0};if(x&&this._isOffscreenCanvasSupported){let U=this.data.comb?"monospace":"sans-serif",K=new Ut(A.xref,U),Z=K.createFontResources(c.join("")),AA=Z.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){let _=this._fieldResources.mergedResources.get("Font");for(let tA of AA.getKeys())_.set(tA,AA.getRaw(tA))}else this._fieldResources.mergedResources.set("Font",AA);let gA=K.fontName.name;Q=await bt._getFontData(A,t,{fontName:gA,fontSize:0},Z);for(let _=0,tA=d.length;_<tA;_++)d[_]=Af(c[_]);let R=Object.assign(Object.create(null),this.data.defaultAppearanceData);this.data.defaultAppearanceData.fontSize=0,this.data.defaultAppearanceData.fontName=gA,[E,f,u]=this._computeFontSize(C-2*l,B-2*h,r,Q,I),this.data.defaultAppearanceData=R}else this._isOffscreenCanvasSupported||k("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly."),[E,f,u]=this._computeFontSize(C-2*l,B-2*h,r,Q,I);let p=Q.descent;isNaN(p)?p=R1*u:p=Math.max(R1*u,Math.abs(p)*f);let m=Math.min(Math.floor((C-f)/2),l),D=this.data.textAlignment;if(this.data.multiLine)return this._getMultilineAppearance(E,d,Q,f,B,C,D,h,m,p,u,s);if(this.data.comb)return this._getCombAppearance(E,Q,d[0],f,B,C,h,m,p,u,s);let S=m+p;if(D===0||D>2)return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 ${Ae(h)} ${Ae(S)} Tm (${Fs(d[0])}) Tj ET Q EMC`;let w={shift:0},Y=this._renderText(d[0],Q,f,B,D,w,h,S);return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 0 0 Tm ${Y} ET Q EMC`}static async _getFontData(A,t,i,s){let a=new ze,n={font:null,clone(){return this}},{fontName:r,fontSize:g}=i;return await A.handleSetFont(s,[r&&M.get(r),g],null,a,t,n,null),n.font}_getTextWidth(A,t){return t.charsToGlyphs(A).reduce((i,s)=>i+s.width,0)/1e3}_computeFontSize(A,t,i,s,a){let{fontSize:n}=this.data.defaultAppearanceData,r=(n||12)*Qi,g=Math.round(A/r);if(!n){let o=l=>Math.floor(l*100)/100;if(a===-1){let l=this._getTextWidth(i,s);n=o(Math.min(A/Qi,l>t?t/l:1/0)),g=1}else{let l=i.split(/\\r\\n?|\\n/),h=[];for(let B of l){let Q=s.encodeString(B).join(""),E=s.charsToGlyphs(Q),f=s.getCharPositions(Q);h.push({line:Q,glyphs:E,positions:f})}let C=B=>{let Q=0;for(let E of h){let f=this._splitLine(null,s,B,t,E);if(Q+=f.length*B,Q>A)return!0}return!1};for(g=Math.max(g,a);;){if(r=A/g,n=o(r/Qi),C(n)){g++;continue}break}}let{fontName:I,fontColor:c}=this.data.defaultAppearanceData;this._defaultAppearance=N9({fontSize:n,fontName:I,fontColor:c})}return[this._defaultAppearance,n,A/g]}_renderText(A,t,i,s,a,n,r,g){let o;if(a===1){let c=this._getTextWidth(A,t)*i;o=(s-c)/2}else if(a===2){let c=this._getTextWidth(A,t)*i;o=s-c-r}else o=r;let I=Ae(o-n.shift);return n.shift=o,g=Ae(g),`${I} ${g} Td (${Fs(A)}) Tj`}_getSaveFieldResources(A){var n;let{localResources:t,appearanceResources:i,acroFormResources:s}=this._fieldResources,a=(n=this.data.defaultAppearanceData)==null?void 0:n.fontName;if(!a)return t||F.empty;for(let r of[t,i])if(r instanceof F){let g=r.get("Font");if(g instanceof F&&g.has(a))return r}if(s instanceof F){let r=s.get("Font");if(r instanceof F&&r.has(a)){let g=new F(A);g.set(a,r.getRaw(a));let o=new F(A);return o.set("Font",g),F.merge({xref:A,dictArray:[o,t],mergeSubDicts:!0})}}return t||F.empty}getFieldObject(){return null}},KQ=class extends bt{constructor(A){super(A);let{dict:t}=A;t.has("PMD")&&(this.flags|=it.HIDDEN,this.data.hidden=!0,k("Barcodes are not supported")),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0,typeof this.data.fieldValue!="string"&&(this.data.fieldValue="");let i=Mt({dict:t,key:"Q"});(!Number.isInteger(i)||i<0||i>2)&&(i=null),this.data.textAlignment=i;let s=Mt({dict:t,key:"MaxLen"});(!Number.isInteger(s)||s<0)&&(s=0),this.data.maxLen=s,this.data.multiLine=this.hasFieldFlag(Te.MULTILINE),this.data.comb=this.hasFieldFlag(Te.COMB)&&!this.hasFieldFlag(Te.MULTILINE)&&!this.hasFieldFlag(Te.PASSWORD)&&!this.hasFieldFlag(Te.FILESELECT)&&this.data.maxLen!==0,this.data.doNotScroll=this.hasFieldFlag(Te.DONOTSCROLL)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(A,t,i,s,a,n,r,g,o,I,c){let l=a/this.data.maxLen,h=this.getBorderAndBackgroundAppearances(c),C=[],B=t.getCharPositions(i);for(let[E,f]of B)C.push(`(${Fs(i.substring(E,f))}) Tj`);let Q=C.join(` ${Ae(l)} 0 Td `);return`/Tx BMC q ${h}BT `+A+` 1 0 0 1 ${Ae(r)} ${Ae(g+o)} Tm ${Q} ET Q EMC`}_getMultilineAppearance(A,t,i,s,a,n,r,g,o,I,c,l){let h=[],C=a-2*g,B={shift:0};for(let f=0,u=t.length;f<u;f++){let d=t[f],x=this._splitLine(d,i,s,C);for(let p=0,m=x.length;p<m;p++){let D=x[p],S=f===0&&p===0?-o-(c-I):-c;h.push(this._renderText(D,i,s,a,r,B,g,S))}}let Q=this.getBorderAndBackgroundAppearances(l),E=h.join(`\n`);return`/Tx BMC q ${Q}BT `+A+` 1 0 0 1 0 ${Ae(n)} Tm ${E} ET Q EMC`}_splitLine(A,t,i,s,a={}){A=a.line||A;let n=a.glyphs||t.charsToGlyphs(A);if(n.length<=1)return[A];let r=a.positions||t.getCharPositions(A),g=i/1e3,o=[],I=-1,c=-1,l=-1,h=0,C=0;for(let B=0,Q=n.length;B<Q;B++){let[E,f]=r[B],u=n[B],d=u.width*g;u.unicode===" "?C+d>s?(o.push(A.substring(h,E)),h=E,C=d,I=-1,l=-1):(C+=d,I=E,c=f,l=B):C+d>s?I!==-1?(o.push(A.substring(h,c)),h=c,B=l+1,I=-1,C=0):(o.push(A.substring(h,E)),h=E,C=d):C+=d}return h<A.length&&o.push(A.substring(h,A.length)),o}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.hasFieldFlag(Te.PASSWORD),charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:"text"}}},vQ=class extends bt{constructor(A){super(A),this.checkedAppearance=null,this.uncheckedAppearance=null,this.data.checkBox=!this.hasFieldFlag(Te.RADIO)&&!this.hasFieldFlag(Te.PUSHBUTTON),this.data.radioButton=this.hasFieldFlag(Te.RADIO)&&!this.hasFieldFlag(Te.PUSHBUTTON),this.data.pushButton=this.hasFieldFlag(Te.PUSHBUTTON),this.data.isTooltipOnly=!1,this.data.checkBox?this._processCheckBox(A):this.data.radioButton?this._processRadioButton(A):this.data.pushButton?(this.data.hasOwnCanvas=!0,this.data.noHTML=!1,this._processPushButton(A)):k("Invalid field flags for button widget annotation")}async getOperatorList(A,t,i,s){if(this.data.pushButton)return super.getOperatorList(A,t,i,!1,s);let a=null,n=null;if(s){let g=s.get(this.data.id);a=g?g.value:null,n=g?g.rotation:null}if(a===null&&this.appearance)return super.getOperatorList(A,t,i,s);a==null&&(a=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);let r=a?this.checkedAppearance:this.uncheckedAppearance;if(r){let g=this.appearance,o=Ki(r.dict.getArray("Matrix"),Wt);n&&r.dict.set("Matrix",this.getRotationMatrix(s)),this.appearance=r;let I=super.getOperatorList(A,t,i,s);return this.appearance=g,r.dict.set("Matrix",o),I}return{opList:new ze,separateForm:!1,separateCanvas:!1}}async save(A,t,i){return this.data.checkBox?this._saveCheckbox(A,t,i):this.data.radioButton?this._saveRadioButton(A,t,i):null}async _saveCheckbox(A,t,i){if(!i)return null;let s=i.get(this.data.id),a=s==null?void 0:s.rotation,n=s==null?void 0:s.value;if(a===void 0&&(n===void 0||this.data.fieldValue===this.data.exportValue===n))return null;let r=A.xref.fetchIfRef(this.ref);if(!(r instanceof F))return null;a===void 0&&(a=this.rotation),n===void 0&&(n=this.data.fieldValue===this.data.exportValue);let g={path:this.data.fieldName,value:n?this.data.exportValue:""},o=M.get(n?this.data.exportValue:"Off");r.set("V",o),r.set("AS",o),r.set("M",`D:${Zi()}`);let I=this._getMKDict(a);I&&r.set("MK",I);let c=[];return await ot(this.ref,r,c,A.xref),[{ref:this.ref,data:c.join(""),xfa:g}]}async _saveRadioButton(A,t,i){if(!i)return null;let s=i.get(this.data.id),a=s==null?void 0:s.rotation,n=s==null?void 0:s.value;if(a===void 0&&(n===void 0||this.data.fieldValue===this.data.buttonValue===n))return null;let r=A.xref.fetchIfRef(this.ref);if(!(r instanceof F))return null;n===void 0&&(n=this.data.fieldValue===this.data.buttonValue),a===void 0&&(a=this.rotation);let g={path:this.data.fieldName,value:n?this.data.buttonValue:""},o=M.get(n?this.data.buttonValue:"Off"),I=[],c=null;if(n)if(this.parent instanceof oA){let C=A.xref.fetch(this.parent);C.set("V",o),await ot(this.parent,C,I,A.xref),c=I.join(""),I.length=0}else this.parent instanceof F&&this.parent.set("V",o);r.set("AS",o),r.set("M",`D:${Zi()}`);let l=this._getMKDict(a);l&&r.set("MK",l),await ot(this.ref,r,I,A.xref);let h=[{ref:this.ref,data:I.join(""),xfa:g}];return c&&h.push({ref:this.parent,data:c,xfa:null}),h}_getDefaultCheckedAppearance(A,t){let i=this.data.rect[2]-this.data.rect[0],s=this.data.rect[3]-this.data.rect[1],a=[0,0,i,s],n=.8,r=Math.min(i,s)*n,g,o;t==="check"?(g={width:.755*r,height:.705*r},o="3"):t==="disc"?(g={width:.791*r,height:.705*r},o="l"):OA(`_getDefaultCheckedAppearance - unsupported type: ${t}`);let I=Ae((i-g.width)/2),c=Ae((s-g.height)/2),l=`q BT /PdfJsZaDb ${r} Tf 0 g ${I} ${c} Td (${o}) Tj ET Q`,h=new F(A.xref);h.set("FormType",1),h.set("Subtype",M.get("Form")),h.set("Type",M.get("XObject")),h.set("BBox",a),h.set("Matrix",[1,0,0,1,0,0]),h.set("Length",l.length);let C=new F(A.xref),B=new F(A.xref);B.set("PdfJsZaDb",this.fallbackFontDict),C.set("Font",B),h.set("Resources",C),this.checkedAppearance=new It(l),this.checkedAppearance.dict=h,this._streams.push(this.checkedAppearance)}_processCheckBox(A){let t=A.dict.get("AP");if(!(t instanceof F))return;let i=t.get("N");if(!(i instanceof F))return;let s=this._decodeFormValue(A.dict.get("AS"));typeof s=="string"&&(this.data.fieldValue=s);let a=this.data.fieldValue!==null&&this.data.fieldValue!=="Off"?this.data.fieldValue:"Yes",n=i.getKeys();if(n.length===0)n.push("Off",a);else if(n.length===1)n[0]==="Off"?n.push(a):n.unshift("Off");else if(n.includes(a))n.length=0,n.push("Off",a);else{let o=n.find(I=>I!=="Off");n.length=0,n.push("Off",o)}n.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=n[1];let r=i.get(this.data.exportValue);this.checkedAppearance=r instanceof KA?r:null;let g=i.get("Off");this.uncheckedAppearance=g instanceof KA?g:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,this.data.defaultFieldValue===null&&(this.data.defaultFieldValue="Off")}_processRadioButton(A){this.data.buttonValue=null;let t=A.dict.get("Parent");if(t instanceof F){this.parent=A.dict.getRaw("Parent");let r=t.get("V");r instanceof M&&(this.data.fieldValue=this._decodeFormValue(r))}let i=A.dict.get("AP");if(!(i instanceof F))return;let s=i.get("N");if(!(s instanceof F))return;for(let r of s.getKeys())if(r!=="Off"){this.data.buttonValue=this._decodeFormValue(r);break}let a=s.get(this.data.buttonValue);this.checkedAppearance=a instanceof KA?a:null;let n=s.get("Off");this.uncheckedAppearance=n instanceof KA?n:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,this.data.defaultFieldValue===null&&(this.data.defaultFieldValue="Off")}_processPushButton(A){let{dict:t,annotationGlobals:i}=A;if(!t.has("A")&&!t.has("AA")&&!this.data.alternativeText){k("Push buttons without action dictionaries are not supported");return}this.data.isTooltipOnly=!t.has("A")&&!t.has("AA"),Pa.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:i.baseUrl,docAttachments:i.attachments})}getFieldObject(){let A="button",t;return this.data.checkBox?(A="checkbox",t=this.data.exportValue):this.data.radioButton&&(A="radiobutton",t=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:t,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}get fallbackFontDict(){let A=new F;return A.set("BaseFont",M.get("ZapfDingbats")),A.set("Type",M.get("FallbackType")),A.set("Subtype",M.get("FallbackType")),A.set("Encoding",M.get("ZapfDingbatsEncoding")),nA(this,"fallbackFontDict",A)}},qQ=class extends bt{constructor(A){super(A);let{dict:t,xref:i}=A;this.indices=t.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];let s=Mt({dict:t,key:"Opt"});if(Array.isArray(s))for(let a=0,n=s.length;a<n;a++){let r=i.fetchIfRef(s[a]),g=Array.isArray(r);this.data.options[a]={exportValue:this._decodeFormValue(g?i.fetchIfRef(r[0]):r),displayValue:this._decodeFormValue(g?i.fetchIfRef(r[1]):r)}}if(!this.hasIndices)typeof this.data.fieldValue=="string"?this.data.fieldValue=[this.data.fieldValue]:this.data.fieldValue||(this.data.fieldValue=[]);else{this.data.fieldValue=[];let a=this.data.options.length;for(let n of this.indices)Number.isInteger(n)&&n>=0&&n<a&&this.data.fieldValue.push(this.data.options[n].exportValue)}this.data.combo=this.hasFieldFlag(Te.COMBO),this.data.multiSelect=this.hasFieldFlag(Te.MULTISELECT),this._hasText=!0}getFieldObject(){let A=this.data.combo?"combobox":"listbox",t=this.data.fieldValue.length>0?this.data.fieldValue[0]:null;return{id:this.data.id,value:t,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}amendSavedDict(A,t){var n;if(!this.hasIndices)return;let i=(n=A==null?void 0:A.get(this.data.id))==null?void 0:n.value;Array.isArray(i)||(i=[i]);let s=[],{options:a}=this.data;for(let r=0,g=0,o=a.length;r<o;r++)a[r].exportValue===i[g]&&(s.push(r),g+=1);t.set("I",s)}async _getAppearance(A,t,i,s){if(this.data.combo)return super._getAppearance(A,t,i,s);let a,n,r=s==null?void 0:s.get(this.data.id);if(r&&(n=r.rotation,a=r.value),n===void 0&&a===void 0&&!this._needAppearances)return null;a===void 0?a=this.data.fieldValue:Array.isArray(a)||(a=[a]);let g=1,o=2,I=this.data.rect[3]-this.data.rect[1],c=this.data.rect[2]-this.data.rect[0];(n===90||n===270)&&([c,I]=[I,c]);let l=this.data.options.length,h=[];for(let D=0;D<l;D++){let{exportValue:S}=this.data.options[D];a.includes(S)&&h.push(D)}this._defaultAppearance||(this.data.defaultAppearanceData=Q1(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let C=await bt._getFontData(A,t,this.data.defaultAppearanceData,this._fieldResources.mergedResources),B,{fontSize:Q}=this.data.defaultAppearanceData;if(Q)B=this._defaultAppearance;else{let D=(I-g)/l,S=-1,w;for(let{displayValue:Y}of this.data.options){let U=this._getTextWidth(Y,C);U>S&&(S=U,w=Y)}[B,Q]=this._computeFontSize(D,c-2*o,w,C,-1)}let E=Q*Qi,f=(E-Q)/2,u=Math.floor(I/E),d=0;if(h.length>0){let D=Math.min(...h),S=Math.max(...h);d=Math.max(0,S-u+1),d>D&&(d=D)}let x=Math.min(d+u+1,l),p=["/Tx BMC q",`1 1 ${c} ${I} re W n`];if(h.length){p.push("0.600006 0.756866 0.854904 rg");for(let D of h)d<=D&&D<x&&p.push(`1 ${I-(D-d+1)*E} ${c} ${E} re f`)}p.push("BT",B,`1 0 0 1 0 ${I} Tm`);let m={shift:0};for(let D=d;D<x;D++){let{displayValue:S}=this.data.options[D],w=D===d?f:0;p.push(this._renderText(S,C,Q,c,0,m,o,-E+w))}return p.push("ET Q EMC"),p.join(`\n`)}},Eg=class extends bt{constructor(A){super(A),this.data.fieldValue=null,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!this.data.hasOwnCanvas}getFieldObject(){return{id:this.data.id,value:null,page:this.data.pageIndex,type:"signature"}}},TQ=class extends $e{constructor(A){super(A),this.data.noRotate=!0,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let{dict:i}=A;this.data.annotationType=Le.TEXT,this.data.hasAppearance?this.data.name="NoIcon":(this.data.rect[1]=this.data.rect[3]-22,this.data.rect[2]=this.data.rect[0]+22,this.data.name=i.has("Name")?i.get("Name").name:"Note"),i.has("State")?(this.data.state=i.get("State")||null,this.data.stateModel=i.get("StateModel")||null):(this.data.state=null,this.data.stateModel=null)}},PQ=class extends L0{constructor(A){var a;super(A);let{dict:t,annotationGlobals:i}=A;this.data.annotationType=Le.LINK,this.data.noHTML=!1;let s=bn(t,this.rectangle);s&&(this.data.quadPoints=s),(a=this.data).borderColor||(a.borderColor=this.data.color),Pa.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:i.baseUrl,docAttachments:i.attachments})}},fg=class extends L0{constructor(A){super(A);let{dict:t}=A;this.data.annotationType=Le.POPUP,this.data.noHTML=!1,(this.data.rect[0]===this.data.rect[2]||this.data.rect[1]===this.data.rect[3])&&(this.data.rect=null);let i=t.get("Parent");if(!i){k("Popup annotation has a missing or invalid parent annotation.");return}this.data.parentRect=Ei(i.getArray("Rect"),null);let s=i.get("RT");if(ye(s,Ho.GROUP)&&(i=i.get("IRT")),i.has("M")?(this.setModificationDate(i.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,i.has("C")?(this.setColor(i.getArray("C")),this.data.color=this.color):this.data.color=null,!this.viewable){let a=i.get("F");this._isViewable(a)&&this.setFlags(a)}this.setTitle(i.get("T")),this.data.titleObj=this._title,this.setContents(i.get("Contents")),this.data.contentsObj=this._contents,i.has("RC")&&(this.data.richText=M0.getRichTextAsHtml(i.get("RC"))),this.data.open=!!t.get("Open")}},wa=class extends $e{constructor(A){var s;super(A),this.data.hasOwnCanvas=this.data.noRotate,this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1;let{evaluatorOptions:t,xref:i}=A;if(this.data.annotationType=Le.FREETEXT,this.setDefaultAppearance(A),this._hasAppearance=!!this.appearance,this._hasAppearance){let{fontColor:a,fontSize:n}=R9(this.appearance,t,i);this.data.defaultAppearanceData.fontColor=a,this.data.defaultAppearanceData.fontSize=n||10}else{(s=this.data.defaultAppearanceData).fontSize||(s.fontSize=10);let{fontColor:a,fontSize:n}=this.data.defaultAppearanceData;if(this._contents.str){this.data.textContent=this._contents.str.split(/\\r\\n?|\\n/).map(I=>I.trimEnd());let{coords:r,bbox:g,matrix:o}=Ut.getFirstPositionInfo(this.rectangle,this.rotation,n);this.data.textPosition=this._transformPoint(r,g,o)}if(this._isOffscreenCanvasSupported){let r=A.dict.get("CA"),g=new Ut(i,"sans-serif");this.appearance=g.createAppearance(this._contents.str,this.rectangle,this.rotation,n,a,r),this._streams.push(this.appearance)}else k("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(A,t,{apRef:i,ap:s,oldAnnotation:a}){let{color:n,fontSize:r,rect:g,rotation:o,user:I,value:c}=A,l=a||new F(t);l.set("Type",M.get("Annot")),l.set("Subtype",M.get("FreeText")),a?(l.set("M",`D:${Zi()}`),l.delete("RC")):l.set("CreationDate",`D:${Zi()}`),l.set("Rect",g);let h=`/Helv ${r} Tf ${mi(n,!0)}`;if(l.set("DA",h),l.set("Contents",ii(c)),l.set("F",4),l.set("Border",[0,0,0]),l.set("Rotate",o),I&&l.set("T",ii(I)),i||s){let C=new F(t);l.set("AP",C),i?C.set("N",i):C.set("N",s)}return l}static async createNewAppearanceStream(A,t,i){let{baseFontRef:s,evaluator:a,task:n}=i,{color:r,fontSize:g,rect:o,rotation:I,value:c}=A,l=new F(t),h=new F(t);if(s)h.set("Helv",s);else{let EA=new F(t);EA.set("BaseFont",M.get("Helvetica")),EA.set("Type",M.get("Font")),EA.set("Subtype",M.get("Type1")),EA.set("Encoding",M.get("WinAnsiEncoding")),h.set("Helv",EA)}l.set("Font",h);let C=await bt._getFontData(a,n,{fontName:"Helv",fontSize:g},l),[B,Q,E,f]=o,u=E-B,d=f-Q;I%180!==0&&([u,d]=[d,u]);let x=c.split(`\n`),p=g/1e3,m=-1/0,D=[];for(let EA of x){let fA=C.encodeString(EA);if(fA.length>1)return null;EA=fA.join(""),D.push(EA);let CA=0,N=C.charsToGlyphs(EA);for(let H of N)CA+=H.width*p;m=Math.max(m,CA)}let S=1;m>u&&(S=u/m);let w=1,Y=Qi*g,U=(Qi-Cr)*g,K=Y*x.length;K>d&&(w=d/K);let Z=Math.min(S,w),AA=g*Z,gA,R,_;switch(I){case 0:_=[1,0,0,1],R=[o[0],o[1],u,d],gA=[o[0],o[3]-U];break;case 90:_=[0,1,-1,0],R=[o[1],-o[2],u,d],gA=[o[1],-o[0]-U];break;case 180:_=[-1,0,0,-1],R=[-o[2],-o[3],u,d],gA=[-o[2],-o[1]-U];break;case 270:_=[0,-1,1,0],R=[-o[3],o[0],u,d],gA=[-o[3],o[2]-U];break}let tA=["q",`${_.join(" ")} 0 0 cm`,`${R.join(" ")} re W n`,"BT",`${mi(r,!0)}`,`0 Tc /Helv ${Ae(AA)} Tf`];tA.push(`${gA.join(" ")} Td (${Fs(D[0])}) Tj`);let IA=Ae(Y);for(let EA=1,fA=D.length;EA<fA;EA++){let CA=D[EA];tA.push(`0 -${IA} Td (${Fs(CA)}) Tj`)}tA.push("ET","Q");let QA=tA.join(`\n`),V=new F(t);V.set("FormType",1),V.set("Subtype",M.get("Form")),V.set("Type",M.get("XObject")),V.set("BBox",o),V.set("Resources",l),V.set("Matrix",[1,0,0,1,-o[0],-o[1]]);let lA=new It(QA);return lA.dict=V,lA}},WQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;this.data.annotationType=Le.LINE,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let s=Ko(t.getArray("L"),[0,0,0,0]);if(this.data.lineCoordinates=Ce.normalizeRect(s),this.setLineEndings(t.getArray("LE")),this.data.lineEndings=this.lineEndings,!this.appearance){let a=this.color?ft(this.color):[0,0,0],n=t.get("CA"),r=Qs(t.getArray("IC"),null),g=r?ft(r):null,o=g?n:null,I=this.borderStyle.width||1,c=2*I,l=[this.data.lineCoordinates[0]-c,this.data.lineCoordinates[1]-c,this.data.lineCoordinates[2]+c,this.data.lineCoordinates[3]+c];Ce.intersect(this.rectangle,l)||(this.rectangle=l),this._setDefaultAppearance({xref:i,extra:`${I} w`,strokeColor:a,fillColor:g,strokeAlpha:n,fillAlpha:o,pointsCallback:(h,C)=>(h.push(`${s[0]} ${s[1]} m`,`${s[2]} ${s[3]} l`,"S"),[C[0]-I,C[2]+I,C[7]-I,C[3]+I])})}}},OQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.SQUARE,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){let s=this.color?ft(this.color):[0,0,0],a=t.get("CA"),n=Qs(t.getArray("IC"),null),r=n?ft(n):null,g=r?a:null;if(this.borderStyle.width===0&&!r)return;this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:s,fillColor:r,strokeAlpha:a,fillAlpha:g,pointsCallback:(o,I)=>{let c=I[4]+this.borderStyle.width/2,l=I[5]+this.borderStyle.width/2,h=I[6]-I[4]-this.borderStyle.width,C=I[3]-I[7]-this.borderStyle.width;return o.push(`${c} ${l} ${h} ${C} re`),r?o.push("B"):o.push("S"),[I[0],I[2],I[7],I[3]]}})}}},ZQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.CIRCLE,!this.appearance){let s=this.color?ft(this.color):[0,0,0],a=t.get("CA"),n=Qs(t.getArray("IC"),null),r=n?ft(n):null,g=r?a:null;if(this.borderStyle.width===0&&!r)return;let o=4/3*Math.tan(Math.PI/(2*4));this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:s,fillColor:r,strokeAlpha:a,fillAlpha:g,pointsCallback:(I,c)=>{let l=c[0]+this.borderStyle.width/2,h=c[1]-this.borderStyle.width/2,C=c[6]-this.borderStyle.width/2,B=c[7]+this.borderStyle.width/2,Q=l+(C-l)/2,E=h+(B-h)/2,f=(C-l)/2*o,u=(B-h)/2*o;return I.push(`${Q} ${B} m`,`${Q+f} ${B} ${C} ${E+u} ${C} ${E} c`,`${C} ${E-u} ${Q+f} ${h} ${Q} ${h} c`,`${Q-f} ${h} ${l} ${E-u} ${l} ${E} c`,`${l} ${E+u} ${Q-f} ${B} ${Q} ${B} c`,"h"),r?I.push("B"):I.push("S"),[c[0],c[2],c[7],c[3]]}})}}},ug=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;this.data.annotationType=Le.POLYLINE,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof dg||(this.setLineEndings(t.getArray("LE")),this.data.lineEndings=this.lineEndings);let s=t.getArray("Vertices");if(!wt(s,null))return;let a=this.data.vertices=Float32Array.from(s);if(!this.appearance){let n=this.color?ft(this.color):[0,0,0],r=t.get("CA"),g=this.borderStyle.width||1,o=2*g,I=[1/0,1/0,-1/0,-1/0];for(let c=0,l=a.length;c<l;c+=2)I[0]=Math.min(I[0],a[c]-o),I[1]=Math.min(I[1],a[c+1]-o),I[2]=Math.max(I[2],a[c]+o),I[3]=Math.max(I[3],a[c+1]+o);Ce.intersect(this.rectangle,I)||(this.rectangle=I),this._setDefaultAppearance({xref:i,extra:`${g} w`,strokeColor:n,strokeAlpha:r,pointsCallback:(c,l)=>{for(let h=0,C=a.length;h<C;h+=2)c.push(`${a[h]} ${a[h+1]} ${h===0?"m":"l"}`);return c.push("S"),[l[0],l[2],l[7],l[3]]}})}}},dg=class extends ug{constructor(A){super(A),this.data.annotationType=Le.POLYGON}},jQ=class extends $e{constructor(A){super(A),this.data.annotationType=Le.CARET}},l0=class extends $e{constructor(A){super(A),this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let{dict:t,xref:i}=A;this.data.annotationType=Le.INK,this.data.inkLists=[];let s=t.getArray("InkList");if(Array.isArray(s)){for(let a=0,n=s.length;a<n;++a){if(!Array.isArray(s[a]))continue;let r=new Float32Array(s[a].length);this.data.inkLists.push(r);for(let g=0,o=s[a].length;g<o;g+=2){let I=i.fetchIfRef(s[a][g]),c=i.fetchIfRef(s[a][g+1]);typeof I=="number"&&typeof c=="number"&&(r[g]=I,r[g+1]=c)}}if(!this.appearance){let a=this.color?ft(this.color):[0,0,0],n=t.get("CA"),r=this.borderStyle.width||1,g=2*r,o=[1/0,1/0,-1/0,-1/0];for(let I of this.data.inkLists)for(let c=0,l=I.length;c<l;c+=2)o[0]=Math.min(o[0],I[c]-g),o[1]=Math.min(o[1],I[c+1]-g),o[2]=Math.max(o[2],I[c]+g),o[3]=Math.max(o[3],I[c+1]+g);Ce.intersect(this.rectangle,o)||(this.rectangle=o),this._setDefaultAppearance({xref:i,extra:`${r} w`,strokeColor:a,strokeAlpha:n,pointsCallback:(I,c)=>{for(let l of this.data.inkLists){for(let h=0,C=l.length;h<C;h+=2)I.push(`${l[h]} ${l[h+1]} ${h===0?"m":"l"}`);I.push("S")}return[c[0],c[2],c[7],c[3]]}})}}}static createNewDict(A,t,{apRef:i,ap:s}){let{color:a,opacity:n,paths:r,outlines:g,rect:o,rotation:I,thickness:c}=A,l=new F(t);l.set("Type",M.get("Annot")),l.set("Subtype",M.get("Ink")),l.set("CreationDate",`D:${Zi()}`),l.set("Rect",o),l.set("InkList",(g==null?void 0:g.points)||r.map(B=>B.points)),l.set("F",4),l.set("Rotate",I),g&&l.set("IT",M.get("InkHighlight"));let h=new F(t);l.set("BS",h),h.set("W",c),l.set("C",Array.from(a,B=>B/255)),l.set("CA",n);let C=new F(t);return l.set("AP",C),i?C.set("N",i):C.set("N",s),l}static async createNewAppearanceStream(A,t,i){if(A.outlines)return this.createNewAppearanceStreamForHighlight(A,t,i);let{color:s,rect:a,paths:n,thickness:r,opacity:g}=A,o=[`${r} w 1 J 1 j`,`${mi(s,!1)}`];g!==1&&o.push("/R0 gs");let I=[];for(let{bezier:C}of n){if(I.length=0,I.push(`${Ae(C[0])} ${Ae(C[1])} m`),C.length===2)I.push(`${Ae(C[0])} ${Ae(C[1])} l S`);else{for(let B=2,Q=C.length;B<Q;B+=6){let E=C.slice(B,B+6).map(Ae).join(" ");I.push(`${E} c`)}I.push("S")}o.push(I.join(`\n`))}let c=o.join(`\n`),l=new F(t);if(l.set("FormType",1),l.set("Subtype",M.get("Form")),l.set("Type",M.get("XObject")),l.set("BBox",a),l.set("Length",c.length),g!==1){let C=new F(t),B=new F(t),Q=new F(t);Q.set("CA",g),Q.set("Type",M.get("ExtGState")),B.set("R0",Q),C.set("ExtGState",B),l.set("Resources",C)}let h=new It(c);return h.dict=l,h}static async createNewAppearanceStreamForHighlight(A,t,i){let{color:s,rect:a,outlines:{outline:n},opacity:r}=A,g=[`${mi(s,!0)}`,"/R0 gs"];g.push(`${Ae(n[4])} ${Ae(n[5])} m`);for(let B=6,Q=n.length;B<Q;B+=6)if(isNaN(n[B])||n[B]===null)g.push(`${Ae(n[B+4])} ${Ae(n[B+5])} l`);else{let E=n.slice(B,B+6).map(Ae).join(" ");g.push(`${E} c`)}g.push("h f");let o=g.join(`\n`),I=new F(t);I.set("FormType",1),I.set("Subtype",M.get("Form")),I.set("Type",M.get("XObject")),I.set("BBox",a),I.set("Length",o.length);let c=new F(t),l=new F(t);c.set("ExtGState",l),I.set("Resources",c);let h=new F(t);l.set("R0",h),h.set("BM",M.get("Multiply")),r!==1&&(h.set("ca",r),h.set("Type",M.get("ExtGState")));let C=new It(o);return C.dict=I,C}},ya=class extends $e{constructor(A){var a;super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.HIGHLIGHT,this.data.quadPoints=bn(t,null)){let n=(a=this.appearance)==null?void 0:a.dict.get("Resources");if(!this.appearance||!(n!=null&&n.has("ExtGState"))){this.appearance&&k("HighlightAnnotation - ignoring built-in appearance stream.");let r=this.color?ft(this.color):[1,1,0],g=t.get("CA");this._setDefaultAppearance({xref:i,fillColor:r,blendMode:"Multiply",fillAlpha:g,pointsCallback:(o,I)=>(o.push(`${I[0]} ${I[1]} m`,`${I[2]} ${I[3]} l`,`${I[6]} ${I[7]} l`,`${I[4]} ${I[5]} l`,"f"),[I[0],I[2],I[7],I[3]])})}}else this.data.popupRef=null}static createNewDict(A,t,{apRef:i,ap:s}){let{color:a,opacity:n,rect:r,rotation:g,user:o,quadPoints:I}=A,c=new F(t);if(c.set("Type",M.get("Annot")),c.set("Subtype",M.get("Highlight")),c.set("CreationDate",`D:${Zi()}`),c.set("Rect",r),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",g),c.set("QuadPoints",I),c.set("C",Array.from(a,l=>l/255)),c.set("CA",n),o&&c.set("T",ii(o)),i||s){let l=new F(t);c.set("AP",l),l.set("N",i||s)}return c}static async createNewAppearanceStream(A,t,i){let{color:s,rect:a,outlines:n,opacity:r}=A,g=[`${mi(s,!0)}`,"/R0 gs"],o=[];for(let Q of n){o.length=0,o.push(`${Ae(Q[0])} ${Ae(Q[1])} m`);for(let E=2,f=Q.length;E<f;E+=2)o.push(`${Ae(Q[E])} ${Ae(Q[E+1])} l`);o.push("h"),g.push(o.join(`\n`))}g.push("f*");let I=g.join(`\n`),c=new F(t);c.set("FormType",1),c.set("Subtype",M.get("Form")),c.set("Type",M.get("XObject")),c.set("BBox",a),c.set("Length",I.length);let l=new F(t),h=new F(t);l.set("ExtGState",h),c.set("Resources",l);let C=new F(t);h.set("R0",C),C.set("BM",M.get("Multiply")),r!==1&&(C.set("ca",r),C.set("Type",M.get("ExtGState")));let B=new It(I);return B.dict=c,B}},XQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.UNDERLINE,this.data.quadPoints=bn(t,null)){if(!this.appearance){let a=this.color?ft(this.color):[0,0,0],n=t.get("CA");this._setDefaultAppearance({xref:i,extra:"[] 0 d 0.571 w",strokeColor:a,strokeAlpha:n,pointsCallback:(r,g)=>(r.push(`${g[4]} ${g[5]+1.3} m`,`${g[6]} ${g[7]+1.3} l`,"S"),[g[0],g[2],g[7],g[3]])})}}else this.data.popupRef=null}},VQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.SQUIGGLY,this.data.quadPoints=bn(t,null)){if(!this.appearance){let a=this.color?ft(this.color):[0,0,0],n=t.get("CA");this._setDefaultAppearance({xref:i,extra:"[] 0 d 1 w",strokeColor:a,strokeAlpha:n,pointsCallback:(r,g)=>{let o=(g[1]-g[5])/6,I=o,c=g[4],l=g[5],h=g[6];r.push(`${c} ${l+I} m`);do c+=2,I=I===0?o:0,r.push(`${c} ${l+I} l`);while(c<h);return r.push("S"),[g[4],h,l-2*o,l+2*o]}})}}else this.data.popupRef=null}},_Q=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A;if(this.data.annotationType=Le.STRIKEOUT,this.data.quadPoints=bn(t,null)){if(!this.appearance){let a=this.color?ft(this.color):[0,0,0],n=t.get("CA");this._setDefaultAppearance({xref:i,extra:"[] 0 d 1 w",strokeColor:a,strokeAlpha:n,pointsCallback:(r,g)=>(r.push(`${(g[0]+g[4])/2} ${(g[1]+g[5])/2} m`,`${(g[2]+g[6])/2} ${(g[3]+g[7])/2} l`,"S"),[g[0],g[2],g[7],g[3]])})}}else this.data.popupRef=null}},gs=class extends $e{constructor(A){super(A),this.data.annotationType=Le.STAMP,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(A,t){let{width:i,height:s}=A,a=new OffscreenCanvas(i,s),n=a.getContext("2d",{alpha:!0});n.drawImage(A,0,0);let r=n.getImageData(0,0,i,s).data,g=new Uint32Array(r.buffer),o=g.some(Ot.isLittleEndian?Q=>Q>>>24!==255:Q=>(Q&255)!==255);o&&(n.fillStyle="white",n.fillRect(0,0,i,s),n.drawImage(A,0,0));let I=a.convertToBlob({type:"image/jpeg",quality:1}).then(Q=>Q.arrayBuffer()),c=M.get("XObject"),l=M.get("Image"),h=new F(t);h.set("Type",c),h.set("Subtype",l),h.set("BitsPerComponent",8),h.set("ColorSpace",M.get("DeviceRGB")),h.set("Filter",M.get("DCTDecode")),h.set("BBox",[0,0,i,s]),h.set("Width",i),h.set("Height",s);let C=null;if(o){let Q=new Uint8Array(g.length);if(Ot.isLittleEndian)for(let f=0,u=g.length;f<u;f++)Q[f]=g[f]>>>24;else for(let f=0,u=g.length;f<u;f++)Q[f]=g[f]&255;let E=new F(t);E.set("Type",c),E.set("Subtype",l),E.set("BitsPerComponent",8),E.set("ColorSpace",M.get("DeviceGray")),E.set("Width",i),E.set("Height",s),C=new Ie(Q,0,0,E)}return{imageStream:new Ie(await I,0,0,h),smaskStream:C,width:i,height:s}}static createNewDict(A,t,{apRef:i,ap:s}){let{rect:a,rotation:n,user:r}=A,g=new F(t);if(g.set("Type",M.get("Annot")),g.set("Subtype",M.get("Stamp")),g.set("CreationDate",`D:${Zi()}`),g.set("Rect",a),g.set("F",4),g.set("Border",[0,0,0]),g.set("Rotate",n),r&&g.set("T",ii(r)),i||s){let o=new F(t);g.set("AP",o),i?o.set("N",i):o.set("N",s)}return g}static async createNewAppearanceStream(A,t,i){let{rotation:s}=A,{imageRef:a,width:n,height:r}=i.image,g=new F(t),o=new F(t);g.set("XObject",o),o.set("Im0",a);let I=`q ${n} 0 0 ${r} 0 0 cm /Im0 Do Q`,c=new F(t);if(c.set("FormType",1),c.set("Subtype",M.get("Form")),c.set("Type",M.get("XObject")),c.set("BBox",[0,0,n,r]),c.set("Resources",g),s){let h=xr(s,n,r);c.set("Matrix",h)}let l=new It(I);return l.dict=c,l}},zQ=class extends $e{constructor(A){super(A);let{dict:t,xref:i}=A,s=new qa(t.get("FS"),i);this.data.annotationType=Le.FILEATTACHMENT,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.file=s.serializable;let a=t.get("Name");this.data.name=a instanceof M?jA(a.name):"PushPin";let n=t.get("ca");this.data.fillAlpha=typeof n=="number"&&n>=0&&n<=1?n:null}};function JE(e){try{return ka(e)}catch(A){return k(`UTF-8 decoding failed: "${A}".`),e}}var $Q=class extends Ls{constructor(A){super(A),this.node=null}onEndElement(A){let t=super.onEndElement(A);if(t&&A==="xfa:datasets")throw this.node=t,new Error("Aborting DatasetXMLParser.")}},A1=class{constructor(A){if(A.datasets)this.node=new Ls({hasAttributes:!0}).parseFromString(A.datasets).documentElement;else{let t=new $Q({hasAttributes:!0});try{t.parseFromString(A["xdp:xdp"])}catch(i){}this.node=t.node}}getValue(A){if(!this.node||!A)return"";let t=this.node.searchNode(_E(A),0);if(!t)return"";let i=t.firstChild;return(i==null?void 0:i.nodeName)==="value"?t.children.map(s=>JE(s.textContent)):JE(t.textContent)}},dn,e1=class{constructor(A,t){HA(this,dn,null);this.stream=A,this.pdfManager=t,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new be,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(A){this._newPersistentRefNum===null&&(this._newPersistentRefNum=this.entries.length||1);let t=this._newPersistentRefNum++;return this._cacheMap.set(t,A),oA.get(t,0)}getNewTemporaryRef(){if(this._newTemporaryRefNum===null&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let A=this._newTemporaryRefNum;A<this._newPersistentRefNum;A++)this._persistentRefsCache.set(A,this._cacheMap.get(A)),this._cacheMap.delete(A)}return oA.get(this._newTemporaryRefNum++,0)}resetNewTemporaryRef(){if(this._newTemporaryRefNum=null,this._persistentRefsCache)for(let[A,t]of this._persistentRefsCache)this._cacheMap.set(A,t);this._persistentRefsCache=null}setStartXRef(A){this.startXRefQueue=[A]}parse(A=!1){let t;A?(k("Indexing all PDF objects"),t=this.indexObjects()):t=this.readXRef(),t.assignXref(this),this.trailer=t;let i;try{i=t.get("Encrypt")}catch(a){if(a instanceof ge)throw a;k(`XRef.parse - Invalid "Encrypt" reference: "${a}".`)}if(i instanceof F){let a=t.get("ID"),n=a!=null&&a.length?a[0]:"";i.suppressEncryption=!0,this.encrypt=new or(i,n,this.pdfManager.password)}let s;try{s=t.get("Root")}catch(a){if(a instanceof ge)throw a;k(`XRef.parse - Invalid "Root" reference: "${a}".`)}if(s instanceof F)try{if(s.get("Pages")instanceof F){this.root=s;return}}catch(a){if(a instanceof ge)throw a;k(`XRef.parse - Invalid "Pages" reference: "${a}".`)}throw A?new ks("Invalid Root reference."):new Pi}processXRefTable(A){"tableState"in this||(this.tableState={entryNum:0,streamPos:A.lexer.stream.pos,parserBuf1:A.buf1,parserBuf2:A.buf2});let t=this.readXRefTable(A);if(!Ne(t,"trailer"))throw new v("Invalid XRef table: could not find trailer dictionary");let i=A.getObj();if(!(i instanceof F)&&i.dict&&(i=i.dict),!(i instanceof F))throw new v("Invalid XRef table: could not parse trailer dictionary");return delete this.tableState,i}readXRefTable(A){let t=A.lexer.stream,i=this.tableState;t.pos=i.streamPos,A.buf1=i.parserBuf1,A.buf2=i.parserBuf2;let s;for(;;){if(!("firstEntryNum"in i)||!("entryCount"in i)){if(Ne(s=A.getObj(),"trailer"))break;i.firstEntryNum=s,i.entryCount=A.getObj()}let a=i.firstEntryNum,n=i.entryCount;if(!Number.isInteger(a)||!Number.isInteger(n))throw new v("Invalid XRef table: wrong types in subsection header");for(let r=i.entryNum;r<n;r++){i.streamPos=t.pos,i.entryNum=r,i.parserBuf1=A.buf1,i.parserBuf2=A.buf2;let g={};g.offset=A.getObj(),g.gen=A.getObj();let o=A.getObj();if(o instanceof fe)switch(o.cmd){case"f":g.free=!0;break;case"n":g.uncompressed=!0;break}if(!Number.isInteger(g.offset)||!Number.isInteger(g.gen)||!(g.free||g.uncompressed))throw new v(`Invalid entry in XRef subsection: ${a}, ${n}`);r===0&&g.free&&a===1&&(a=0),this.entries[r+a]||(this.entries[r+a]=g)}i.entryNum=0,i.streamPos=t.pos,i.parserBuf1=A.buf1,i.parserBuf2=A.buf2,delete i.firstEntryNum,delete i.entryCount}if(this.entries[0]&&!this.entries[0].free)throw new v("Invalid XRef table: unexpected first object");return s}processXRefStream(A){if(!("streamState"in this)){let t=A.dict,i=t.get("W"),s=t.get("Index");s||(s=[0,t.get("Size")]),this.streamState={entryRanges:s,byteWidths:i,entryNum:0,streamPos:A.pos}}return this.readXRefStream(A),delete this.streamState,A.dict}readXRefStream(A){let t=this.streamState;A.pos=t.streamPos;let[i,s,a]=t.byteWidths,n=t.entryRanges;for(;n.length>0;){let[r,g]=n;if(!Number.isInteger(r)||!Number.isInteger(g))throw new v(`Invalid XRef range fields: ${r}, ${g}`);if(!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(a))throw new v(`Invalid XRef entry fields length: ${r}, ${g}`);for(let o=t.entryNum;o<g;++o){t.entryNum=o,t.streamPos=A.pos;let I=0,c=0,l=0;for(let C=0;C<i;++C){let B=A.getByte();if(B===-1)throw new v("Invalid XRef byteWidths \'type\'.");I=I<<8|B}i===0&&(I=1);for(let C=0;C<s;++C){let B=A.getByte();if(B===-1)throw new v("Invalid XRef byteWidths \'offset\'.");c=c<<8|B}for(let C=0;C<a;++C){let B=A.getByte();if(B===-1)throw new v("Invalid XRef byteWidths \'generation\'.");l=l<<8|B}let h={};switch(h.offset=c,h.gen=l,I){case 0:h.free=!0;break;case 1:h.uncompressed=!0;break;case 2:break;default:throw new v(`Invalid XRef entry type: ${I}`)}this.entries[r+o]||(this.entries[r+o]=h)}t.entryNum=0,t.streamPos=A.pos,n.splice(0,2)}}indexObjects(){function r(w,Y){let U="",K=w[Y];for(;K!==10&&K!==13&&K!==60&&!(++Y>=w.length);)U+=String.fromCharCode(K),K=w[Y];return U}function g(w,Y,U){let K=U.length,Z=w.length,AA=0;for(;Y<Z;){let gA=0;for(;gA<K&&w[Y+gA]===U[gA];)++gA;if(gA>=K)break;Y++,AA++}return AA}let o=/\\b(endobj|\\d+\\s+\\d+\\s+obj|xref|trailer\\s*<<)\\b/g,I=/\\b(startxref|\\d+\\s+\\d+\\s+obj)\\b/g,c=/^(\\d+)\\s+(\\d+)\\s+obj\\b/,l=new Uint8Array([116,114,97,105,108,101,114]),h=new Uint8Array([115,116,97,114,116,120,114,101,102]),C=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();let B=this.stream;B.pos=0;let Q=B.getBytes(),E=Qt(Q),f=Q.length,u=B.start,d=[],x=[];for(;u<f;){let w=Q[u];if(w===9||w===10||w===13||w===32){++u;continue}if(w===37){do{if(++u,u>=f)break;w=Q[u]}while(w!==10&&w!==13);continue}let Y=r(Q,u),U;if(Y.startsWith("xref")&&(Y.length===4||/\\s/.test(Y[4])))u+=g(Q,u,l),d.push(u),u+=g(Q,u,h);else if(U=c.exec(Y)){let K=U[1]|0,Z=U[2]|0,AA=u+Y.length,gA,R=!1;if(!this.entries[K])R=!0;else if(this.entries[K].gen===Z)try{new zt({lexer:new dt(B.makeSubStream(AA))}).getObj(),R=!0}catch(QA){QA instanceof Sa?k(`indexObjects -- checking object (${Y}): "${QA}".`):R=!0}R&&(this.entries[K]={offset:u-B.start,gen:Z,uncompressed:!0}),o.lastIndex=AA;let _=o.exec(E);_?(gA=o.lastIndex+1-u,_[1]!=="endobj"&&(k(`indexObjects: Found "${_[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),gA-=_[1].length+1)):gA=f-u;let tA=Q.subarray(u,u+gA),IA=g(tA,0,C);IA<gA&&tA[IA+5]<64&&(x.push(u-B.start),this._xrefStms.add(u-B.start)),u+=gA}else if(Y.startsWith("trailer")&&(Y.length===7||/\\s/.test(Y[7]))){d.push(u);let K=u+Y.length,Z;I.lastIndex=K;let AA=I.exec(E);AA?(Z=I.lastIndex+1-u,AA[1]!=="startxref"&&(k(`indexObjects: Found "${AA[1]}" after "trailer", caused by missing "startxref" -- trying to recover.`),Z-=AA[1].length+1)):Z=f-u,u+=Z}else u+=Y.length+1}for(let w of x)this.startXRefQueue.push(w),this.readXRef(!0);let p=[],m=!1;for(let w of d){B.pos=w;let Y=new zt({lexer:new dt(B),xref:this,allowStreams:!0,recoveryMode:!0}),U=Y.getObj();if(!Ne(U,"trailer"))continue;let K=Y.getObj();K instanceof F&&(p.push(K),K.has("Encrypt")&&(m=!0))}let D,S;for(let w of[...p,"genFallback",...p]){if(w==="genFallback"){if(!S)break;this._generationFallback=!0;continue}let Y=!1;try{let U=w.get("Root");if(!(U instanceof F))continue;let K=U.get("Pages");if(!(K instanceof F))continue;let Z=K.get("Count");Number.isInteger(Z)&&(Y=!0)}catch(U){S=U;continue}if(Y&&(!m||w.has("Encrypt"))&&w.has("ID"))return w;D=w}if(D)return D;if(this.topDict)return this.topDict;throw new ks("Invalid PDF structure.")}readXRef(A=!1){var s;let t=this.stream,i=new Set;for(;this.startXRefQueue.length;){try{let a=this.startXRefQueue[0];if(i.has(a)){k("readXRef - skipping XRef table since it was already parsed."),this.startXRefQueue.shift();continue}i.add(a),t.pos=a+t.start;let n=new zt({lexer:new dt(t),xref:this,allowStreams:!0}),r=n.getObj(),g;if(Ne(r,"xref"))g=this.processXRefTable(n),this.topDict||(this.topDict=g),r=g.get("XRefStm"),Number.isInteger(r)&&!this._xrefStms.has(r)&&(this._xrefStms.add(r),this.startXRefQueue.push(r),(s=ne(this,dn))!=null||_s(this,dn,r));else if(Number.isInteger(r)){if(!Number.isInteger(n.getObj())||!Ne(n.getObj(),"obj")||!((r=n.getObj())instanceof KA))throw new v("Invalid XRef stream");if(g=this.processXRefStream(r),this.topDict||(this.topDict=g),!g)throw new v("Failed to read XRef stream")}else throw new v("Invalid XRef stream header");r=g.get("Prev"),Number.isInteger(r)?this.startXRefQueue.push(r):r instanceof oA&&this.startXRefQueue.push(r.num)}catch(a){if(a instanceof ge)throw a;PA("(while reading XRef): "+a)}this.startXRefQueue.shift()}if(this.topDict)return this.topDict;if(!A)throw new Pi}get lastXRefStreamPos(){var A;return(A=ne(this,dn))!=null?A:this._xrefStms.size>0?Math.max(...this._xrefStms):null}getEntry(A){let t=this.entries[A];return t&&!t.free&&t.offset?t:null}fetchIfRef(A,t=!1){return A instanceof oA?this.fetch(A,t):A}fetch(A,t=!1){if(!(A instanceof oA))throw new Error("ref object is not a reference");let i=A.num,s=this._cacheMap.get(i);if(s!==void 0)return s instanceof F&&!s.objId&&(s.objId=A.toString()),s;let a=this.getEntry(i);if(a===null)return this._cacheMap.set(i,a),a;if(this._pendingRefs.has(A))return this._pendingRefs.remove(A),k(`Ignoring circular reference: ${A}.`),Ku;this._pendingRefs.put(A);try{a=a.uncompressed?this.fetchUncompressed(A,a,t):this.fetchCompressed(A,a,t),this._pendingRefs.remove(A)}catch(n){throw this._pendingRefs.remove(A),n}return a instanceof F?a.objId=A.toString():a instanceof KA&&(a.dict.objId=A.toString()),a}fetchUncompressed(A,t,i=!1){let s=A.gen,a=A.num;if(t.gen!==s){let c=`Inconsistent generation in XRef: ${A}`;if(this._generationFallback&&t.gen<s)return k(c),this.fetchUncompressed(oA.get(a,t.gen),t,i);throw new ti(c)}let n=this.stream.makeSubStream(t.offset+this.stream.start),r=new zt({lexer:new dt(n),xref:this,allowStreams:!0}),g=r.getObj(),o=r.getObj(),I=r.getObj();if(g!==a||o!==s||!(I instanceof fe))throw new ti(`Bad (uncompressed) XRef entry: ${A}`);if(I.cmd!=="obj"){if(I.cmd.startsWith("obj")&&(a=parseInt(I.cmd.substring(3),10),!Number.isNaN(a)))return a;throw new ti(`Bad (uncompressed) XRef entry: ${A}`)}return t=this.encrypt&&!i?r.getObj(this.encrypt.createCipherTransform(a,s)):r.getObj(),t instanceof KA||this._cacheMap.set(a,t),t}fetchCompressed(A,t,i=!1){let s=t.offset,a=this.fetch(oA.get(s,0));if(!(a instanceof KA))throw new v("bad ObjStm stream");let n=a.dict.get("First"),r=a.dict.get("N");if(!Number.isInteger(n)||!Number.isInteger(r))throw new v("invalid first and n parameters for ObjStm stream");let g=new zt({lexer:new dt(a),xref:this,allowStreams:!0}),o=new Array(r),I=new Array(r);for(let h=0;h<r;++h){let C=g.getObj();if(!Number.isInteger(C))throw new v(`invalid object number in the ObjStm stream: ${C}`);let B=g.getObj();if(!Number.isInteger(B))throw new v(`invalid object offset in the ObjStm stream: ${B}`);o[h]=C,I[h]=B}let c=(a.start||0)+n,l=new Array(r);for(let h=0;h<r;++h){let C=h<r-1?I[h+1]-I[h]:void 0;if(C<0)throw new v("Invalid offset in the ObjStm stream.");g=new zt({lexer:new dt(a.makeSubStream(c+I[h],C,a.dict)),xref:this,allowStreams:!0});let B=g.getObj();if(l[h]=B,B instanceof KA)continue;let Q=o[h],E=this.entries[Q];E&&E.offset===s&&E.gen===h&&this._cacheMap.set(Q,B)}if(t=l[t.gen],t===void 0)throw new ti(`Bad (compressed) XRef entry: ${A}`);return t}async fetchIfRefAsync(A,t){return A instanceof oA?this.fetchAsync(A,t):A}async fetchAsync(A,t){try{return this.fetch(A,t)}catch(i){if(!(i instanceof ge))throw i;return await this.pdfManager.requestRange(i.begin,i.end),this.fetchAsync(A,t)}}getCatalogObj(){return this.root}};dn=new WeakMap;var dx=1,xx=[0,0,612,792],xn,t1,xg=class{constructor({pdfManager:A,xref:t,pageIndex:i,pageDict:s,ref:a,globalIdFactory:n,fontCache:r,builtInCMapCache:g,standardFontDataCache:o,globalImageCache:I,systemFontCache:c,nonBlendModesSet:l,xfaFactory:h}){HA(this,xn);this.pdfManager=A,this.pageIndex=i,this.pageDict=s,this.xref=t,this.ref=a,this.fontCache=r,this.builtInCMapCache=g,this.standardFontDataCache=o,this.globalImageCache=I,this.systemFontCache=c,this.nonBlendModesSet=l,this.evaluatorOptions=A.evaluatorOptions,this.resourcesPromise=null,this.xfaFactory=h;let C={obj:0};this._localIdFactory=class extends n{static createObjId(){return`p${i}_${++C.obj}`}static getPageObjId(){return`p${a.toString()}`}}}_getInheritableProperty(A,t=!1){let i=Mt({dict:this.pageDict,key:A,getArray:t,stopWhenFound:!1});return Array.isArray(i)?i.length===1||!(i[0]instanceof F)?i[0]:F.merge({xref:this.xref,dictArray:i}):i}get content(){return this.pageDict.getArray("Contents")}get resources(){let A=this._getInheritableProperty("Resources");return nA(this,"resources",A instanceof F?A:F.empty)}_getBoundingBox(A){if(this.xfaData)return this.xfaData.bbox;let t=Ei(this._getInheritableProperty(A,!0),null);if(t){if(t[2]-t[0]>0&&t[3]-t[1]>0)return t;k(`Empty, or invalid, /${A} entry.`)}return null}get mediaBox(){return nA(this,"mediaBox",this._getBoundingBox("MediaBox")||xx)}get cropBox(){return nA(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let A=this.pageDict.get("UserUnit");return(typeof A!="number"||A<=0)&&(A=dx),nA(this,"userUnit",A)}get view(){let{cropBox:A,mediaBox:t}=this;if(A!==t&&!Ss(A,t)){let i=Ce.intersect(A,t);if(i&&i[2]-i[0]>0&&i[3]-i[1]>0)return nA(this,"view",i);k("Empty /CropBox and /MediaBox intersection.")}return nA(this,"view",t)}get rotate(){let A=this._getInheritableProperty("Rotate")||0;return A%90!==0?A=0:A>=360?A%=360:A<0&&(A=(A%360+360)%360),nA(this,"rotate",A)}_onSubStreamError(A,t){if(this.evaluatorOptions.ignoreErrors){k(`getContentStream - ignoring sub-stream (${t}): "${A}".`);return}throw A}getContentStream(){return this.pdfManager.ensure(this,"content").then(A=>A instanceof KA?A:Array.isArray(A)?new sI(A,this._onSubStreamError.bind(this)):new Rs)}get xfaData(){return nA(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async saveNewAnnotations(A,t,i,s){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");let a=new Lt({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),n=new mt,r=new be;mA(this,xn,t1).call(this,i,n,r);let g=this.pageDict,o=this.annotations.filter(C=>!(C instanceof oA&&n.has(C))),I=await ei.saveNewAnnotations(a,t,i,s);for(let{ref:C}of I.annotations)C instanceof oA&&!r.has(C)&&o.push(C);let c=g.get("Annots");g.set("Annots",o);let l=[];await ot(this.ref,g,l,this.xref),c&&g.set("Annots",c);let h=I.dependencies;h.push({ref:this.ref,data:l.join("")},...I.annotations);for(let C of n)h.push({ref:C,data:null});return h}save(A,t,i){let s=new Lt({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then(function(a){let n=[];for(let r of a)r.mustBePrinted(i)&&n.push(r.save(s,t,i).catch(function(g){return k(`save - ignoring annotation data during "${t.name}" task: "${g}".`),null}));return Promise.all(n).then(function(r){return r.filter(g=>!!g)})})}loadResources(A){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(()=>new Hs(this.resources,A,this.xref).load())}getOperatorList({handler:A,sink:t,task:i,intent:s,cacheKey:a,annotationStorage:n=null,modifiedIds:r=null}){let g=this.getContentStream(),o=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),I=new Lt({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),c=this.xfaFactory?null:$E(n),l=c==null?void 0:c.get(this.pageIndex),h=Promise.resolve(null),C=null;if(l){let Q=this.pdfManager.ensureDoc("annotationGlobals"),E,f=new Set;for(let{bitmapId:d,bitmap:x}of l)d&&!x&&!f.has(d)&&f.add(d);let{isOffscreenCanvasSupported:u}=this.evaluatorOptions;if(f.size>0){let d=l.slice();for(let[x,p]of n)x.startsWith(TE)&&p.bitmap&&f.has(p.bitmapId)&&d.push(p);E=ei.generateImages(d,this.xref,u)}else E=ei.generateImages(l,this.xref,u);C=new be,mA(this,xn,t1).call(this,l,C,null),h=Q.then(d=>d?ei.printNewAnnotations(d,I,i,l,E):null)}let B=Promise.all([g,o]).then(([Q])=>{let E=new ze(s,t);return A.send("StartRenderPage",{transparency:I.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:a}),I.getOperatorList({stream:Q,task:i,resources:this.resources,operatorList:E}).then(function(){return E})});return Promise.all([B,this._parsedAnnotations,h]).then(function([Q,E,f]){if(f){E=E.filter(S=>!(S.ref&&C.has(S.ref)));for(let S=0,w=f.length;S<w;S++){let Y=f[S];if(Y.refToReplace){let U=E.findIndex(K=>K.ref&&ur(K.ref,Y.refToReplace));U>=0&&(E.splice(U,1,Y),f.splice(S--,1),w--)}}E=E.concat(f)}if(E.length===0||s&st.ANNOTATIONS_DISABLE)return Q.flush(!0),{length:Q.totalLength};let u=!!(s&st.ANNOTATIONS_FORMS),d=!!(s&st.IS_EDITING),x=!!(s&st.ANY),p=!!(s&st.DISPLAY),m=!!(s&st.PRINT),D=[];for(let S of E)(x||p&&S.mustBeViewed(n,u)&&S.mustBeViewedWhenEditing(d,r)||m&&S.mustBePrinted(n))&&D.push(S.getOperatorList(I,i,s,n).catch(function(w){return k(`getOperatorList - ignoring annotation data during "${i.name}" task: "${w}".`),{opList:null,separateForm:!1,separateCanvas:!1}}));return Promise.all(D).then(function(S){let w=!1,Y=!1;for(let{opList:U,separateForm:K,separateCanvas:Z}of S)Q.addOpList(U),w||(w=K),Y||(Y=Z);return Q.flush(!0,{form:w,canvas:Y}),{length:Q.totalLength}})})}async extractTextContent({handler:A,task:t,includeMarkedContent:i,disableNormalization:s,sink:a}){let n=this.getContentStream(),r=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[o,,I]=await Promise.all([n,r,g]);return new Lt({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:o,task:t,resources:this.resources,includeMarkedContent:i,disableNormalization:s,sink:a,viewBox:this.view,lang:I})}async getStructTree(){let A=await this.pdfManager.ensureCatalog("structTreeRoot");return A?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[A])).serializable):null}_parseStructTree(A){let t=new Cc(A,this.pageDict);return t.parse(this.ref),t}async getAnnotationsData(A,t,i){let s=await this._parsedAnnotations;if(s.length===0)return s;let a=[],n=[],r,g=!!(i&st.ANY),o=!!(i&st.DISPLAY),I=!!(i&st.PRINT);for(let c of s){let l=g||o&&c.viewable;(l||I&&c.printable)&&a.push(c.data),c.hasTextContent&&l&&(r||(r=new Lt({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions})),n.push(c.extractTextContent(r,t,[-1/0,-1/0,1/0,1/0]).catch(function(h){k(`getAnnotationsData - ignoring textContent during "${t.name}" task: "${h}".`)})))}return await Promise.all(n),a}get annotations(){let A=this._getInheritableProperty("Annots");return nA(this,"annotations",Array.isArray(A)?A:[])}get _parsedAnnotations(){let A=this.pdfManager.ensure(this,"annotations").then(async t=>{if(t.length===0)return t;let i=await this.pdfManager.ensureDoc("annotationGlobals");if(!i)return[];let s=[];for(let g of t)s.push(ei.create(this.xref,g,i,this._localIdFactory,!1,this.ref).catch(function(o){return k(`_parsedAnnotations: "${o}".`),null}));let a=[],n,r;for(let g of await Promise.all(s))if(g){if(g instanceof bt){(r||(r=[])).push(g);continue}if(g instanceof fg){(n||(n=[])).push(g);continue}a.push(g)}return r&&a.push(...r),n&&a.push(...n),a});return nA(this,"_parsedAnnotations",A)}get jsActions(){let A=Vg(this.xref,this.pageDict,Ru);return nA(this,"jsActions",A)}};xn=new WeakSet,t1=function(A,t,i){for(let s of A)if(s.id){let a=oA.fromString(s.id);if(!a){k(`A non-linked annotation cannot be modified: ${s.id}`);continue}if(s.deleted){t.put(a,a);continue}i==null||i.put(a),s.ref=a,delete s.id}};var YE=new Uint8Array([37,80,68,70,45]),KE=new Uint8Array([115,116,97,114,116,120,114,101,102]),mx=new Uint8Array([101,110,100,111,98,106]),vE=1024,px="\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0";function Lo(e,A,t=1024,i=!1){let s=A.length,a=e.peekBytes(t),n=a.length-s;if(n<=0)return!1;if(i){let r=s-1,g=a.length-1;for(;g>=r;){let o=0;for(;o<s&&a[g-o]===A[r-o];)o++;if(o>=s)return e.pos+=g-r,!0;g--}}else{let r=0;for(;r<=n;){let g=0;for(;g<s&&a[r+g]===A[g];)g++;if(g>=s)return e.pos+=r,!0;r++}}return!1}var mn,i1,mg=class{constructor(A,t){HA(this,mn);if(t.length<=0)throw new ks("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=A,this.stream=t,this.xref=new e1(t,A),this._pagePromises=new Map,this._version=null;let i={font:0};this._globalIdFactory=class{static getDocId(){return`g_${A.docId}`}static createFontId(){return`f${++i.font}`}static createObjId(){OA("Abstract method `createObjId` called.")}static getPageObjId(){OA("Abstract method `getPageObjId` called.")}}}parse(A){this.xref.parse(A),this.catalog=new Pa(this.pdfManager,this.xref)}get linearization(){let A=null;try{A=mI.create(this.stream)}catch(t){if(t instanceof ge)throw t;PA(t)}return nA(this,"linearization",A)}get startXRef(){let A=this.stream,t=0;if(this.linearization){if(A.reset(),Lo(A,mx)){A.skip(6);let i=A.peekByte();for(;pt(i);)A.pos++,i=A.peekByte();t=A.pos-A.start}}else{let s=KE.length,a=!1,n=A.end;for(;!a&&n>0;)n-=1024-s,n<0&&(n=0),A.pos=n,a=Lo(A,KE,1024,!0);if(a){A.skip(9);let r;do r=A.getByte();while(pt(r));let g="";for(;r>=32&&r<=57;)g+=String.fromCharCode(r),r=A.getByte();t=parseInt(g,10),isNaN(t)&&(t=0)}}return nA(this,"startXRef",t)}checkHeader(){let A=this.stream;if(A.reset(),!Lo(A,YE))return;A.moveStart(),A.skip(YE.length);let t="",i;for(;(i=A.getByte())>32&&t.length<7;)t+=String.fromCharCode(i);XE.test(t)?this._version=t:k(`Invalid PDF header version: ${t}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let A=0;return this.catalog.hasActualNumPages?A=this.catalog.numPages:this.xfaFactory?A=this.xfaFactory.getNumPages():this.linearization?A=this.linearization.numPages:A=this.catalog.numPages,nA(this,"numPages",A)}_hasOnlyDocumentSignatures(A,t=0){return Array.isArray(A)?A.every(s=>{if(s=this.xref.fetchIfRef(s),!(s instanceof F))return!1;if(s.has("Kids"))return++t>10?(k("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(s.get("Kids"),t);let a=ye(s.get("FT"),"Sig"),n=s.get("Rect"),r=Array.isArray(n)&&n.every(g=>g===0);return a&&r}):!1}get _xfaStreams(){let A=this.catalog.acroForm;if(!A)return null;let t=A.get("XFA"),i={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(t instanceof KA&&!t.isEmpty)return i["xdp:xdp"]=t,i;if(!Array.isArray(t)||t.length===0)return null;for(let s=0,a=t.length;s<a;s+=2){let n;if(s===0?n="xdp:xdp":s===a-2?n="/xdp:xdp":n=t[s],!i.hasOwnProperty(n))continue;let r=this.xref.fetchIfRef(t[s+1]);!(r instanceof KA)||r.isEmpty||(i[n]=r)}return i}get xfaDatasets(){let A=this._xfaStreams;if(!A)return nA(this,"xfaDatasets",null);for(let t of["datasets","xdp:xdp"]){let i=A[t];if(i)try{let s=ka(i.getString()),a={[t]:s};return nA(this,"xfaDatasets",new A1(a))}catch(s){k("XFA - Invalid utf-8 string.");break}}return nA(this,"xfaDatasets",null)}get xfaData(){let A=this._xfaStreams;if(!A)return null;let t=Object.create(null);for(let[i,s]of Object.entries(A))if(s)try{t[i]=ka(s.getString())}catch(a){return k("XFA - Invalid utf-8 string."),null}return t}get xfaFactory(){let A;return this.pdfManager.enableXfa&&this.catalog.needsRendering&&this.formInfo.hasXfa&&!this.formInfo.hasAcroForm&&(A=this.xfaData),nA(this,"xfaFactory",A?new M0(A):null)}get isPureXfa(){return this.xfaFactory?this.xfaFactory.isValid():!1}get htmlForXfa(){return this.xfaFactory?this.xfaFactory.getPages():null}async loadXfaImages(){let A=await this.pdfManager.ensureCatalog("xfaImages");if(!A)return;let t=A.getKeys();await new Hs(A,t,this.xref).load();let s=new Map;for(let a of t){let n=A.get(a);n instanceof KA&&s.set(a,n.getBytes())}this.xfaFactory.setImages(s)}async loadXfaFonts(A,t){let i=await this.pdfManager.ensureCatalog("acroForm");if(!i)return;let s=await i.getAsync("DR");if(!(s instanceof F))return;await new Hs(s,["Font"],this.xref).load();let n=s.get("Font");if(!(n instanceof F))return;let r=Object.assign(Object.create(null),this.pdfManager.evaluatorOptions);r.useSystemFonts=!1;let g=new Lt({xref:this.xref,handler:A,pageIndex:-1,idFactory:this._globalIdFactory,fontCache:this.catalog.fontCache,builtInCMapCache:this.catalog.builtInCMapCache,standardFontDataCache:this.catalog.standardFontDataCache,options:r}),o=new ze,I=[],c={get font(){return I.at(-1)},set font(Q){I.push(Q)},clone(){return this}},l=new Map;n.forEach((Q,E)=>{l.set(Q,E)});let h=[];for(let[Q,E]of l){let f=E.get("FontDescriptor");if(!(f instanceof F))continue;let u=f.get("FontFamily");u=u.replaceAll(/[ ]+(\\d)/g,"$1");let d=f.get("FontWeight"),x=-f.get("ItalicAngle"),p={fontFamily:u,fontWeight:d,italicAngle:x};Ou(p)&&h.push(g.handleSetFont(s,[M.get(Q),1],null,o,t,c,null,p).catch(function(m){return k(`loadXfaFonts: "${m}".`),null}))}await Promise.all(h);let C=this.xfaFactory.setFonts(I);if(!C)return;r.ignoreErrors=!0,h.length=0,I.length=0;let B=new Set;for(let Q of C)B1(`${Q}-Regular`)||B.add(Q);B.size&&C.push("PdfJS-Fallback");for(let Q of C)if(!B.has(Q))for(let E of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){let f=`${Q}-${E.name}`,u=pf(f);h.push(g.handleSetFont(s,[M.get(f),1],null,o,t,c,u,{fontFamily:Q,fontWeight:E.fontWeight,italicAngle:E.italicAngle}).catch(function(d){return k(`loadXfaFonts: "${d}".`),null}))}await Promise.all(h),this.xfaFactory.appendFonts(I,B)}async serializeXfaData(A){return this.xfaFactory?this.xfaFactory.serializeData(A):null}get version(){return this.catalog.version||this._version}get formInfo(){let A={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},t=this.catalog.acroForm;if(!t)return nA(this,"formInfo",A);try{let i=t.get("Fields"),s=Array.isArray(i)&&i.length>0;A.hasFields=s;let a=t.get("XFA");A.hasXfa=Array.isArray(a)&&a.length>0||a instanceof KA&&!a.isEmpty;let r=!!(t.get("SigFlags")&1),g=r&&this._hasOnlyDocumentSignatures(i);A.hasAcroForm=s&&!g,A.hasSignatures=r}catch(i){if(i instanceof ge)throw i;k(`Cannot fetch form information: "${i}".`)}return nA(this,"formInfo",A)}get documentInfo(){let A={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures},t;try{t=this.xref.trailer.get("Info")}catch(i){if(i instanceof ge)throw i;PA("The document information dictionary is invalid.")}if(!(t instanceof F))return nA(this,"documentInfo",A);for(let i of t.getKeys()){let s=t.get(i);switch(i){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if(typeof s=="string"){A[i]=jA(s);continue}break;case"Trapped":if(s instanceof M){A[i]=s;continue}break;default:let a;switch(typeof s){case"string":a=jA(s);break;case"number":case"boolean":a=s;break;default:s instanceof M&&(a=s);break}if(a===void 0){k(`Bad value, for custom key "${i}", in Info: ${s}.`);continue}A.Custom||(A.Custom=Object.create(null)),A.Custom[i]=a;continue}k(`Bad value, for key "${i}", in Info: ${s}.`)}return nA(this,"documentInfo",A)}get fingerprints(){function A(n){return typeof n=="string"&&n.length>0&&n!==px}function t(n){let r=[];for(let g of n){let o=g.toString(16);r.push(o.padStart(2,"0"))}return r.join("")}let i=this.xref.trailer.get("ID"),s,a;return Array.isArray(i)&&A(i[0])?(s=Pe(i[0]),i[1]!==i[0]&&A(i[1])&&(a=Pe(i[1]))):s=Ri(this.stream.getByteRange(0,vE),0,vE),nA(this,"fingerprints",[t(s),a?t(a):null])}async _getLinearizationPage(A){let{catalog:t,linearization:i,xref:s}=this,a=oA.get(i.objectNumberFirst,0);try{let n=await s.fetchAsync(a);if(n instanceof F){let r=n.getRaw("Type");if(r instanceof oA&&(r=await s.fetchAsync(r)),ye(r,"Page")||!n.has("Type")&&!n.has("Kids")&&n.has("Contents"))return t.pageKidsCountCache.has(a)||t.pageKidsCountCache.put(a,1),t.pageIndexCache.has(a)||t.pageIndexCache.put(a,0),[n,a]}throw new v("The Linearization dictionary doesn\'t point to a valid Page dictionary.")}catch(n){return k(`_getLinearizationPage: "${n.message}".`),t.getPageDict(A)}}getPage(A){let t=this._pagePromises.get(A);if(t)return t;let{catalog:i,linearization:s,xfaFactory:a}=this,n;return a?n=Promise.resolve([F.empty,null]):(s==null?void 0:s.pageFirst)===A?n=this._getLinearizationPage(A):n=i.getPageDict(A),n=n.then(([r,g])=>new xg({pdfManager:this.pdfManager,xref:this.xref,pageIndex:A,pageDict:r,ref:g,globalIdFactory:this._globalIdFactory,fontCache:i.fontCache,builtInCMapCache:i.builtInCMapCache,standardFontDataCache:i.standardFontDataCache,globalImageCache:i.globalImageCache,systemFontCache:i.systemFontCache,nonBlendModesSet:i.nonBlendModesSet,xfaFactory:a})),this._pagePromises.set(A,n),n}async checkFirstPage(A=!1){if(!A)try{await this.getPage(0)}catch(t){if(t instanceof ti)throw this._pagePromises.delete(0),await this.cleanup(),new Pi}}async checkLastPage(A=!1){let{catalog:t,pdfManager:i}=this;t.setActualNumPages();let s;try{if(await Promise.all([i.ensureDoc("xfaFactory"),i.ensureDoc("linearization"),i.ensureCatalog("numPages")]),this.xfaFactory)return;if(this.linearization?s=this.linearization.numPages:s=t.numPages,Number.isInteger(s)){if(s<=1)return}else throw new v("Page count is not an integer.");await this.getPage(s-1)}catch(a){if(this._pagePromises.delete(s-1),await this.cleanup(),a instanceof ti&&!A)throw new Pi;k(`checkLastPage - invalid /Pages tree /Count: ${s}.`);let n;try{n=await t.getAllPageDicts(A)}catch(r){if(r instanceof ti&&!A)throw new Pi;t.setActualNumPages(1);return}for(let[r,[g,o]]of n){let I;g instanceof Error?(I=Promise.reject(g),I.catch(()=>{})):I=Promise.resolve(new xg({pdfManager:i,xref:this.xref,pageIndex:r,pageDict:g,ref:o,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(r,I)}t.setActualNumPages(n.size)}}fontFallback(A,t){return this.catalog.fontFallback(A,t)}async cleanup(A=!1){return this.catalog?this.catalog.cleanup(A):E1()}get fieldObjects(){if(!this.formInfo.hasFields)return nA(this,"fieldObjects",Promise.resolve(null));let A=Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then(async([t,i])=>{if(!t)return null;let s=new be,a=Object.create(null),n=new Map;for(let g of await i.getAsync("Fields"))await mA(this,mn,i1).call(this,"",g,n,t,s);let r=[];for(let[g,o]of n)r.push(Promise.all(o).then(I=>{I=I.filter(c=>!!c),I.length>0&&(a[g]=I)}));return await Promise.all(r),a});return nA(this,"fieldObjects",A)}get hasJSActions(){let A=this.pdfManager.ensureDoc("_parseHasJSActions");return nA(this,"hasJSActions",A)}async _parseHasJSActions(){let[A,t]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return A?!0:t?Object.values(t).some(i=>i.some(s=>s.actions!==null)):!1}get calculationOrderIds(){let A=this.catalog.acroForm;if(!(A!=null&&A.has("CO")))return nA(this,"calculationOrderIds",null);let t=A.get("CO");if(!Array.isArray(t)||t.length===0)return nA(this,"calculationOrderIds",null);let i=[];for(let s of t)s instanceof oA&&i.push(s.toString());return i.length===0?nA(this,"calculationOrderIds",null):nA(this,"calculationOrderIds",i)}get annotationGlobals(){return nA(this,"annotationGlobals",ei.createGlobals(this.pdfManager))}};mn=new WeakSet,i1=async function(A,t,i,s,a){let{xref:n}=this;if(!(t instanceof oA)||a.has(t))return;a.put(t);let r=await n.fetchAsync(t);if(!(r instanceof F))return;if(r.has("T")){let o=jA(await r.getAsync("T"));A=A===""?o:`${A}.${o}`}else{let o=r;for(;;){if(o=o.getRaw("Parent"),o instanceof oA){if(a.has(o))break;o=await n.fetchAsync(o)}if(!(o instanceof F))break;if(o.has("T")){let I=jA(await o.getAsync("T"));A=A===""?I:`${A}.${I}`;break}}}if(i.has(A)||i.set(A,[]),i.get(A).push(ei.create(n,t,s,null,!0,null).then(o=>o==null?void 0:o.getFieldObject()).catch(function(o){return k(`#collectFieldObjects: "${o}".`),null})),!r.has("Kids"))return;let g=await r.getAsync("Kids");if(Array.isArray(g))for(let o of g)await mA(this,mn,i1).call(this,A,o,i,s,a)};function wx(e){if(e){let A=Qr(e);if(A)return A.href;k(`Invalid absolute docBaseUrl: "${e}".`)}return null}var pg=class{constructor(A){var t;this._docBaseUrl=wx(A.docBaseUrl),this._docId=A.docId,this._password=A.password,this.enableXfa=A.enableXfa,(t=A.evaluatorOptions).isOffscreenCanvasSupported&&(t.isOffscreenCanvasSupported=Ot.isOffscreenCanvasSupported),this.evaluatorOptions=Object.freeze(A.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(A,t){return this.ensure(this.pdfDocument,A,t)}ensureXRef(A,t){return this.ensure(this.pdfDocument.xref,A,t)}ensureCatalog(A,t){return this.ensure(this.pdfDocument.catalog,A,t)}getPage(A){return this.pdfDocument.getPage(A)}fontFallback(A,t){return this.pdfDocument.fontFallback(A,t)}loadXfaFonts(A,t){return this.pdfDocument.loadXfaFonts(A,t)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(A){return this.pdfDocument.serializeXfaData(A)}cleanup(A=!1){return this.pdfDocument.cleanup(A)}async ensure(A,t,i){OA("Abstract method `ensure` called")}requestRange(A,t){OA("Abstract method `requestRange` called")}requestLoadedStream(A=!1){OA("Abstract method `requestLoadedStream` called")}sendProgressiveData(A){OA("Abstract method `sendProgressiveData` called")}updatePassword(A){this._password=A}terminate(A){OA("Abstract method `terminate` called")}},wg=class extends pg{constructor(A){super(A);let t=new Ie(A.source);this.pdfDocument=new mg(this,t),this._loadedStreamPromise=Promise.resolve(t)}async ensure(A,t,i){let s=A[t];return typeof s=="function"?s.apply(A,i):s}requestRange(A,t){return Promise.resolve()}requestLoadedStream(A=!1){return this._loadedStreamPromise}terminate(A){}},s1=class extends pg{constructor(A){super(A),this.streamManager=new To(A.source,{msgHandler:A.handler,length:A.length,disableAutoFetch:A.disableAutoFetch,rangeChunkSize:A.rangeChunkSize}),this.pdfDocument=new mg(this,this.streamManager.getStream())}async ensure(A,t,i){try{let s=A[t];return typeof s=="function"?s.apply(A,i):s}catch(s){if(!(s instanceof ge))throw s;return await this.requestRange(s.begin,s.end),this.ensure(A,t,i)}}requestRange(A,t){return this.streamManager.requestRange(A,t)}requestLoadedStream(A=!1){return this.streamManager.requestAllChunks(A)}sendProgressiveData(A){this.streamManager.onReceiveData({chunk:A})}terminate(A){this.streamManager.abort(A)}},_n={UNKNOWN:0,DATA:1,ERROR:2},ke={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ut(e){switch(e instanceof Error||typeof e=="object"&&e!==null||OA(\'wrapReason: Expected "reason" to be a (possibly cloned) Error.\'),e.name){case"AbortException":return new ve(e.message);case"MissingPDFException":return new Er(e.message);case"PasswordException":return new bs(e.message,e.code);case"UnexpectedResponseException":return new fr(e.message,e.status);case"UnknownErrorException":return new Ds(e.message,e.details);default:return new Ds(e.message,e.toString())}}var Zg,gu,jg,ou,ys,hr,yg=class{constructor(A,t,i){HA(this,Zg);HA(this,jg);HA(this,ys);this.sourceName=A,this.targetName=t,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=s=>{let a=s.data;if(a.targetName!==this.sourceName)return;if(a.stream){mA(this,jg,ou).call(this,a);return}if(a.callback){let r=a.callbackId,g=this.callbackCapabilities[r];if(!g)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],a.callback===_n.DATA)g.resolve(a.data);else if(a.callback===_n.ERROR)g.reject(ut(a.reason));else throw new Error("Unexpected callback case");return}let n=this.actionHandler[a.action];if(!n)throw new Error(`Unknown action from worker: ${a.action}`);if(a.callbackId){let r=this.sourceName,g=a.sourceName;new Promise(function(o){o(n(a.data))}).then(function(o){i.postMessage({sourceName:r,targetName:g,callback:_n.DATA,callbackId:a.callbackId,data:o})},function(o){i.postMessage({sourceName:r,targetName:g,callback:_n.ERROR,callbackId:a.callbackId,reason:ut(o)})});return}if(a.streamId){mA(this,Zg,gu).call(this,a);return}n(a.data)},i.addEventListener("message",this._onComObjOnMessage)}on(A,t){let i=this.actionHandler;if(i[A])throw new Error(`There is already an actionName called "${A}"`);i[A]=t}send(A,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:t},i)}sendWithPromise(A,t,i){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:s,data:t},i)}catch(n){a.reject(n)}return a.promise}sendWithStream(A,t,i,s){let a=this.streamId++,n=this.sourceName,r=this.targetName,g=this.comObj;return new ReadableStream({start:o=>{let I=Promise.withResolvers();return this.streamControllers[a]={controller:o,startCall:I,pullCall:null,cancelCall:null,isClosed:!1},g.postMessage({sourceName:n,targetName:r,action:A,streamId:a,data:t,desiredSize:o.desiredSize},s),I.promise},pull:o=>{let I=Promise.withResolvers();return this.streamControllers[a].pullCall=I,g.postMessage({sourceName:n,targetName:r,stream:ke.PULL,streamId:a,desiredSize:o.desiredSize}),I.promise},cancel:o=>{gt(o instanceof Error,"cancel must have a valid reason");let I=Promise.withResolvers();return this.streamControllers[a].cancelCall=I,this.streamControllers[a].isClosed=!0,g.postMessage({sourceName:n,targetName:r,stream:ke.CANCEL,streamId:a,reason:ut(o)}),I.promise}},i)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}};Zg=new WeakSet,gu=function(A){let t=A.streamId,i=this.sourceName,s=A.sourceName,a=this.comObj,n=this,r=this.actionHandler[A.action],g={enqueue(o,I=1,c){if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=I,l>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:i,targetName:s,stream:ke.ENQUEUE,streamId:t,chunk:o},c)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:ke.CLOSE,streamId:t}),delete n.streamSinks[t])},error(o){gt(o instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:ke.ERROR,streamId:t,reason:ut(o)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};g.sinkCapability.resolve(),g.ready=g.sinkCapability.promise,this.streamSinks[t]=g,new Promise(function(o){o(r(A.data,g))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ke.START_COMPLETE,streamId:t,success:!0})},function(o){a.postMessage({sourceName:i,targetName:s,stream:ke.START_COMPLETE,streamId:t,reason:ut(o)})})},jg=new WeakSet,ou=function(A){let t=A.streamId,i=this.sourceName,s=A.sourceName,a=this.comObj,n=this.streamControllers[t],r=this.streamSinks[t];switch(A.stream){case ke.START_COMPLETE:A.success?n.startCall.resolve():n.startCall.reject(ut(A.reason));break;case ke.PULL_COMPLETE:A.success?n.pullCall.resolve():n.pullCall.reject(ut(A.reason));break;case ke.PULL:if(!r){a.postMessage({sourceName:i,targetName:s,stream:ke.PULL_COMPLETE,streamId:t,success:!0});break}r.desiredSize<=0&&A.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=A.desiredSize,new Promise(function(g){var o;g((o=r.onPull)==null?void 0:o.call(r))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ke.PULL_COMPLETE,streamId:t,success:!0})},function(g){a.postMessage({sourceName:i,targetName:s,stream:ke.PULL_COMPLETE,streamId:t,reason:ut(g)})});break;case ke.ENQUEUE:if(gt(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(A.chunk);break;case ke.CLOSE:if(gt(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),mA(this,ys,hr).call(this,n,t);break;case ke.ERROR:gt(n,"error should have stream controller"),n.controller.error(ut(A.reason)),mA(this,ys,hr).call(this,n,t);break;case ke.CANCEL_COMPLETE:A.success?n.cancelCall.resolve():n.cancelCall.reject(ut(A.reason)),mA(this,ys,hr).call(this,n,t);break;case ke.CANCEL:if(!r)break;new Promise(function(g){var o;g((o=r.onCancel)==null?void 0:o.call(r,ut(A.reason)))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:ke.CANCEL_COMPLETE,streamId:t,success:!0})},function(g){a.postMessage({sourceName:i,targetName:s,stream:ke.CANCEL_COMPLETE,streamId:t,reason:ut(g)})}),r.sinkCapability.reject(ut(A.reason)),r.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},ys=new WeakSet,hr=async function(A,t){var i,s,a;await Promise.allSettled([(i=A.startCall)==null?void 0:i.promise,(s=A.pullCall)==null?void 0:s.promise,(a=A.cancelCall)==null?void 0:a.promise]),delete this.streamControllers[t]};var a1=class{constructor(A){this._msgHandler=A,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return gt(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new n1(this._msgHandler),this._fullRequestReader}getRangeReader(A,t){let i=new r1(A,t,this._msgHandler);return this._rangeRequestReaders.push(i),i}cancelAllRequests(A){var t;(t=this._fullRequestReader)==null||t.cancel(A);for(let i of this._rangeRequestReaders.slice(0))i.cancel(A)}},n1=class{constructor(A){this._msgHandler=A,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;let t=this._msgHandler.sendWithStream("GetReader");this._reader=t.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(i=>{this._isStreamingSupported=i.isStreamingSupported,this._isRangeSupported=i.isRangeSupported,this._contentLength=i.contentLength})}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){let{value:A,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}},r1=class{constructor(A,t,i){this._msgHandler=i,this.onProgress=null;let s=this._msgHandler.sendWithStream("GetRangeReader",{begin:A,end:t});this._reader=s.getReader()}get isStreamingSupported(){return!1}async read(){let{value:A,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}},li=class{constructor(A){this.name=A,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}},H0=class{static setup(A,t){let i=!1;A.on("test",function(s){i||(i=!0,A.send("test",s instanceof Uint8Array))}),A.on("configure",function(s){Nu(s.verbosity)}),A.on("GetDocRequest",function(s){return H0.createDocumentHandler(s,t)})}static createDocumentHandler(A,t){let i,s=!1,a=null,n=new Set,r=Gu(),{docId:g,apiVersion:o}=A,I="4.6.82";if(o!==I)throw new Error(`The API version "${o}" does not match the Worker version "${I}".`);let c=[];for(let d in[])c.push(d);if(c.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+c.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");let l=g+"_worker",h=new yg(l,g,t);function C(){if(s)throw new Error("Worker was terminated")}function B(d){n.add(d)}function Q(d){d.finish(),n.delete(d)}async function E(d){await i.ensureDoc("checkHeader"),await i.ensureDoc("parseStartXRef"),await i.ensureDoc("parse",[d]),await i.ensureDoc("checkFirstPage",[d]),await i.ensureDoc("checkLastPage",[d]);let x=await i.ensureDoc("isPureXfa");if(x){let S=new li("loadXfaFonts");B(S),await Promise.all([i.loadXfaFonts(h,S).catch(w=>{}).then(()=>Q(S)),i.loadXfaImages()])}let[p,m]=await Promise.all([i.ensureDoc("numPages"),i.ensureDoc("fingerprints")]),D=x?await i.ensureDoc("htmlForXfa"):null;return{numPages:p,fingerprints:m,htmlForXfa:D}}function f({data:d,password:x,disableAutoFetch:p,rangeChunkSize:m,length:D,docBaseUrl:S,enableXfa:w,evaluatorOptions:Y}){let U={source:null,disableAutoFetch:p,docBaseUrl:S,docId:g,enableXfa:w,evaluatorOptions:Y,handler:h,length:D,password:x,rangeChunkSize:m},K=Promise.withResolvers(),Z;if(d){try{U.source=d,Z=new wg(U),K.resolve(Z)}catch(IA){K.reject(IA)}return K.promise}let AA,gA=[];try{AA=new a1(h)}catch(IA){return K.reject(IA),K.promise}let R=AA.getFullReader();R.headersReady.then(function(){if(R.isRangeSupported){U.source=AA,U.length=R.contentLength,U.disableAutoFetch||(U.disableAutoFetch=R.isStreamingSupported),Z=new s1(U);for(let IA of gA)Z.sendProgressiveData(IA);gA=[],K.resolve(Z),a=null}}).catch(function(IA){K.reject(IA),a=null});let _=0,tA=function(){let IA=VE(gA);D&&IA.length!==D&&k("reported HTTP length is different from actual");try{U.source=IA,Z=new wg(U),K.resolve(Z)}catch(QA){K.reject(QA)}gA=[]};return new Promise(function(IA,QA){let V=function({value:lA,done:EA}){try{if(C(),EA){Z||tA(),a=null;return}_+=lA.byteLength,R.isStreamingSupported||h.send("DocProgress",{loaded:_,total:Math.max(_,R.contentLength||0)}),Z?Z.sendProgressiveData(lA):gA.push(lA),R.read().then(V,QA)}catch(fA){QA(fA)}};R.read().then(V,QA)}).catch(function(IA){K.reject(IA),a=null}),a=function(IA){AA.cancelAllRequests(IA)},K.promise}function u(d){function x(D){C(),h.send("GetDoc",{pdfInfo:D})}function p(D){if(C(),D instanceof bs){let S=new li(`PasswordException: response ${D.code}`);B(S),h.sendWithPromise("PasswordRequest",D).then(function({password:w}){Q(S),i.updatePassword(w),m()}).catch(function(){Q(S),h.send("DocException",D)})}else D instanceof ks||D instanceof Er||D instanceof fr||D instanceof Ds?h.send("DocException",D):h.send("DocException",new Ds(D.message,D.toString()))}function m(){C(),E(!1).then(x,function(D){if(C(),!(D instanceof Pi)){p(D);return}i.requestLoadedStream().then(function(){C(),E(!0).then(x,p)})})}C(),f(d).then(function(D){if(s)throw D.terminate(new ve("Worker was terminated.")),new Error("Worker was terminated");i=D,i.requestLoadedStream(!0).then(S=>{h.send("DataLoaded",{length:S.bytes.byteLength})})}).then(m,p)}return h.on("GetPage",function(d){return i.getPage(d.pageIndex).then(function(x){return Promise.all([i.ensure(x,"rotate"),i.ensure(x,"ref"),i.ensure(x,"userUnit"),i.ensure(x,"view")]).then(function([p,m,D,S]){var w;return{rotate:p,ref:m,refStr:(w=m==null?void 0:m.toString())!=null?w:null,userUnit:D,view:S}})})}),h.on("GetPageIndex",function(d){let x=oA.get(d.num,d.gen);return i.ensureCatalog("getPageIndex",[x])}),h.on("GetDestinations",function(d){return i.ensureCatalog("destinations")}),h.on("GetDestination",function(d){return i.ensureCatalog("getDestination",[d.id])}),h.on("GetPageLabels",function(d){return i.ensureCatalog("pageLabels")}),h.on("GetPageLayout",function(d){return i.ensureCatalog("pageLayout")}),h.on("GetPageMode",function(d){return i.ensureCatalog("pageMode")}),h.on("GetViewerPreferences",function(d){return i.ensureCatalog("viewerPreferences")}),h.on("GetOpenAction",function(d){return i.ensureCatalog("openAction")}),h.on("GetAttachments",function(d){return i.ensureCatalog("attachments")}),h.on("GetDocJSActions",function(d){return i.ensureCatalog("jsActions")}),h.on("GetPageJSActions",function({pageIndex:d}){return i.getPage(d).then(function(x){return i.ensure(x,"jsActions")})}),h.on("GetOutline",function(d){return i.ensureCatalog("documentOutline")}),h.on("GetOptionalContentConfig",function(d){return i.ensureCatalog("optionalContentConfig")}),h.on("GetPermissions",function(d){return i.ensureCatalog("permissions")}),h.on("GetMetadata",function(d){return Promise.all([i.ensureDoc("documentInfo"),i.ensureCatalog("metadata")])}),h.on("GetMarkInfo",function(d){return i.ensureCatalog("markInfo")}),h.on("GetData",function(d){return i.requestLoadedStream().then(function(x){return x.bytes})}),h.on("GetAnnotations",function({pageIndex:d,intent:x}){return i.getPage(d).then(function(p){let m=new li(`GetAnnotations: page ${d}`);return B(m),p.getAnnotationsData(h,m,x).then(D=>(Q(m),D),D=>{throw Q(m),D})})}),h.on("GetFieldObjects",function(d){return i.ensureDoc("fieldObjects")}),h.on("HasJSActions",function(d){return i.ensureDoc("hasJSActions")}),h.on("GetCalculationOrderIds",function(d){return i.ensureDoc("calculationOrderIds")}),h.on("SaveDocument",async function({isPureXfa:d,numPages:x,annotationStorage:p,filename:m}){var H;let D=[i.requestLoadedStream(),i.ensureCatalog("acroForm"),i.ensureCatalog("acroFormRef"),i.ensureDoc("startXRef"),i.ensureDoc("xref"),i.ensureDoc("linearization"),i.ensureCatalog("structTreeRoot")],S=[],w=d?null:$E(p),[Y,U,K,Z,AA,gA,R]=await Promise.all(D),_=AA.trailer.getRaw("Root")||null,tA;if(w){R?await R.canUpdateStructTree({pdfManager:i,xref:AA,newAnnotationsByPage:w})&&(tA=R):await Ui.canCreateStructureTree({catalogRef:_,pdfManager:i,newAnnotationsByPage:w})&&(tA=null);let q=ei.generateImages(p.values(),AA,i.evaluatorOptions.isOffscreenCanvasSupported),T=tA===void 0?S:[];for(let[$,X]of w)T.push(i.getPage($).then(W=>{let G=new li(`Save (editor): page ${$}`);return W.saveNewAnnotations(h,G,X,q).finally(function(){Q(G)})}));tA===null?S.push(Promise.all(T).then(async $=>(await Ui.createStructureTree({newAnnotationsByPage:w,xref:AA,catalogRef:_,pdfManager:i,newRefs:$}),$))):tA&&S.push(Promise.all(T).then(async $=>(await tA.updateStructureTree({newAnnotationsByPage:w,pdfManager:i,newRefs:$}),$)))}if(d)S.push(i.serializeXfaData(p));else for(let q=0;q<x;q++)S.push(i.getPage(q).then(function(T){let $=new li(`Save: page ${q}`);return T.save(h,$,p).finally(function(){Q($)})}));let IA=await Promise.all(S),QA=[],V=null;if(d){if(V=IA[0],!V)return Y.bytes}else if(QA=IA.flat(2),QA.length===0)return Y.bytes;let lA=K&&U instanceof F&&QA.some(q=>q.needAppearances),EA=U instanceof F&&U.get("XFA")||null,fA=null,CA=!1;if(Array.isArray(EA)){for(let q=0,T=EA.length;q<T;q+=2)EA[q]==="datasets"&&(fA=EA[q+1],CA=!0);fA===null&&(fA=AA.getNewTemporaryRef())}else EA&&k("Unsupported XFA type.");let N=Object.create(null);if(AA.trailer){let q=Object.create(null),T=AA.trailer.get("Info")||null;T instanceof F&&T.forEach(($,X)=>{typeof X=="string"&&(q[$]=jA(X))}),N={rootRef:_,encryptRef:AA.trailer.getRaw("Encrypt")||null,newRef:AA.getNewTemporaryRef(),infoRef:AA.trailer.getRaw("Info")||null,info:q,fileIds:AA.trailer.get("ID")||null,startXRef:gA?Z:(H=AA.lastXRefStreamPos)!=null?H:Z,filename:m}}return T9({originalData:Y.bytes,xrefInfo:N,newRefs:QA,xref:AA,hasXfa:!!EA,xfaDatasetsRef:fA,hasXfaDatasetsEntry:CA,needAppearances:lA,acroFormRef:K,acroForm:U,xfaData:V,useXrefStream:jE(AA.topDict,"XRef")}).finally(()=>{AA.resetNewTemporaryRef()})}),h.on("GetOperatorList",function(d,x){let p=d.pageIndex;i.getPage(p).then(function(m){let D=new li(`GetOperatorList: page ${p}`);B(D);let S=r>=Da.INFOS?Date.now():0;m.getOperatorList({handler:h,sink:x,task:D,intent:d.intent,cacheKey:d.cacheKey,annotationStorage:d.annotationStorage,modifiedIds:d.modifiedIds}).then(function(w){Q(D),S&&PA(`page=${p+1} - getOperatorList: time=${Date.now()-S}ms, len=${w.length}`),x.close()},function(w){Q(D),!D.terminated&&x.error(w)})})}),h.on("GetTextContent",function(d,x){let{pageIndex:p,includeMarkedContent:m,disableNormalization:D}=d;i.getPage(p).then(function(S){let w=new li("GetTextContent: page "+p);B(w);let Y=r>=Da.INFOS?Date.now():0;S.extractTextContent({handler:h,task:w,sink:x,includeMarkedContent:m,disableNormalization:D}).then(function(){Q(w),Y&&PA(`page=${p+1} - getTextContent: time=${Date.now()-Y}ms`),x.close()},function(U){Q(w),!w.terminated&&x.error(U)})})}),h.on("GetStructTree",function(d){return i.getPage(d.pageIndex).then(function(x){return i.ensure(x,"getStructTree")})}),h.on("FontFallback",function(d){return i.fontFallback(d.id,h)}),h.on("Cleanup",function(d){return i.cleanup(!0)}),h.on("Terminate",function(d){s=!0;let x=[];if(i){i.terminate(new ve("Worker was terminated."));let p=i.cleanup();x.push(p),i=null}else E1();a&&a(new ve("Worker was terminated."));for(let p of n)x.push(p.finished),p.terminate();return Promise.all(x).then(function(){h.destroy(),h=null})}),h.on("Ready",function(d){u(A),A=null}),l}static initializeFromPort(A){let t=new yg("worker","main",A);H0.setup(t,A),t.send("ready",null)}};function yx(e){return typeof e.postMessage=="function"&&"onmessage"in e}typeof window=="undefined"&&!ku&&typeof self!="undefined"&&yx(self)&&H0.initializeFromPort(self);var bx=qE.WorkerMessageHandler;\n');
}

// src/processors/pdf.ts
var isWorkerInitialized = false;
function initializeWorker() {
  if (!isWorkerInitialized) {
    __webpack_exports__GlobalWorkerOptions.workerPort = new Worker2();
    isWorkerInitialized = true;
  }
}
async function extractTextFromPDF(arrayBuffer) {
  logger.time("Extracting text from PDF");
  try {
    initializeWorker();
    const pdf = await __webpack_exports__getDocument({ data: arrayBuffer }).promise;
    const numPages = pdf.numPages;
    const textContents = await Promise.all(
      Array.from({ length: numPages }, (_, i) => getPageText(pdf, i + 1))
    );
    const fullText = textContents.join("\n\n");
    logger.table("Extracted text from PDF", {
      textLength: fullText.length
    });
    logger.timeEnd("Extracting text from PDF");
    return fullText;
  } catch (error) {
    logger.error("Error extracting text from PDF", { error });
    throw new Error(`Failed to extract text from PDF: ${error.message}`);
  }
}
async function getPageText(pdf, pageNum) {
  const page = await pdf.getPage(pageNum);
  const content = await page.getTextContent();
  let lastY;
  const textItems = [];
  for (const item of content.items) {
    if ("str" in item) {
      if (lastY === item.transform[5] || !lastY) {
        textItems.push(item.str);
      } else {
        textItems.push(`
${item.str}`);
      }
      lastY = item.transform[5];
    }
  }
  return textItems.join("") + "\n\n";
}

// node_modules/idb/build/index.js
var instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
var idbProxyableTypes;
var cursorAdvanceMethods;
function getIdbProxyableTypes() {
  return idbProxyableTypes || (idbProxyableTypes = [
    IDBDatabase,
    IDBObjectStore,
    IDBIndex,
    IDBCursor,
    IDBTransaction
  ]);
}
function getCursorAdvanceMethods() {
  return cursorAdvanceMethods || (cursorAdvanceMethods = [
    IDBCursor.prototype.advance,
    IDBCursor.prototype.continue,
    IDBCursor.prototype.continuePrimaryKey
  ]);
}
var transactionDoneMap = /* @__PURE__ */ new WeakMap();
var transformCache = /* @__PURE__ */ new WeakMap();
var reverseTransformCache = /* @__PURE__ */ new WeakMap();
function promisifyRequest(request) {
  const promise = new Promise((resolve, reject) => {
    const unlisten = () => {
      request.removeEventListener("success", success);
      request.removeEventListener("error", error);
    };
    const success = () => {
      resolve(wrap(request.result));
      unlisten();
    };
    const error = () => {
      reject(request.error);
      unlisten();
    };
    request.addEventListener("success", success);
    request.addEventListener("error", error);
  });
  reverseTransformCache.set(promise, request);
  return promise;
}
function cacheDonePromiseForTransaction(tx) {
  if (transactionDoneMap.has(tx))
    return;
  const done = new Promise((resolve, reject) => {
    const unlisten = () => {
      tx.removeEventListener("complete", complete);
      tx.removeEventListener("error", error);
      tx.removeEventListener("abort", error);
    };
    const complete = () => {
      resolve();
      unlisten();
    };
    const error = () => {
      reject(tx.error || new DOMException("AbortError", "AbortError"));
      unlisten();
    };
    tx.addEventListener("complete", complete);
    tx.addEventListener("error", error);
    tx.addEventListener("abort", error);
  });
  transactionDoneMap.set(tx, done);
}
var idbProxyTraps = {
  get(target, prop, receiver) {
    if (target instanceof IDBTransaction) {
      if (prop === "done")
        return transactionDoneMap.get(target);
      if (prop === "store") {
        return receiver.objectStoreNames[1] ? void 0 : receiver.objectStore(receiver.objectStoreNames[0]);
      }
    }
    return wrap(target[prop]);
  },
  set(target, prop, value) {
    target[prop] = value;
    return true;
  },
  has(target, prop) {
    if (target instanceof IDBTransaction && (prop === "done" || prop === "store")) {
      return true;
    }
    return prop in target;
  }
};
function replaceTraps(callback) {
  idbProxyTraps = callback(idbProxyTraps);
}
function wrapFunction(func) {
  if (getCursorAdvanceMethods().includes(func)) {
    return function(...args) {
      func.apply(unwrap(this), args);
      return wrap(this.request);
    };
  }
  return function(...args) {
    return wrap(func.apply(unwrap(this), args));
  };
}
function transformCachableValue(value) {
  if (typeof value === "function")
    return wrapFunction(value);
  if (value instanceof IDBTransaction)
    cacheDonePromiseForTransaction(value);
  if (instanceOfAny(value, getIdbProxyableTypes()))
    return new Proxy(value, idbProxyTraps);
  return value;
}
function wrap(value) {
  if (value instanceof IDBRequest)
    return promisifyRequest(value);
  if (transformCache.has(value))
    return transformCache.get(value);
  const newValue = transformCachableValue(value);
  if (newValue !== value) {
    transformCache.set(value, newValue);
    reverseTransformCache.set(newValue, value);
  }
  return newValue;
}
var unwrap = (value) => reverseTransformCache.get(value);
function openDB(name, version3, { blocked, upgrade, blocking, terminated } = {}) {
  const request = indexedDB.open(name, version3);
  const openPromise = wrap(request);
  if (upgrade) {
    request.addEventListener("upgradeneeded", (event) => {
      upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);
    });
  }
  if (blocked) {
    request.addEventListener("blocked", (event) => blocked(
      // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
      event.oldVersion,
      event.newVersion,
      event
    ));
  }
  openPromise.then((db) => {
    if (terminated)
      db.addEventListener("close", () => terminated());
    if (blocking) {
      db.addEventListener("versionchange", (event) => blocking(event.oldVersion, event.newVersion, event));
    }
  }).catch(() => {
  });
  return openPromise;
}
var readMethods = ["get", "getKey", "getAll", "getAllKeys", "count"];
var writeMethods = ["put", "add", "delete", "clear"];
var cachedMethods = /* @__PURE__ */ new Map();
function getMethod(target, prop) {
  if (!(target instanceof IDBDatabase && !(prop in target) && typeof prop === "string")) {
    return;
  }
  if (cachedMethods.get(prop))
    return cachedMethods.get(prop);
  const targetFuncName = prop.replace(/FromIndex$/, "");
  const useIndex = prop !== targetFuncName;
  const isWrite = writeMethods.includes(targetFuncName);
  if (
    // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
    !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || !(isWrite || readMethods.includes(targetFuncName))
  ) {
    return;
  }
  const method = async function(storeName, ...args) {
    const tx = this.transaction(storeName, isWrite ? "readwrite" : "readonly");
    let target2 = tx.store;
    if (useIndex)
      target2 = target2.index(args.shift());
    return (await Promise.all([
      target2[targetFuncName](...args),
      isWrite && tx.done
    ]))[0];
  };
  cachedMethods.set(prop, method);
  return method;
}
replaceTraps((oldTraps) => ({
  ...oldTraps,
  get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),
  has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop)
}));
var advanceMethodProps = ["continue", "continuePrimaryKey", "advance"];
var methodMap = {};
var advanceResults = /* @__PURE__ */ new WeakMap();
var ittrProxiedCursorToOriginalProxy = /* @__PURE__ */ new WeakMap();
var cursorIteratorTraps = {
  get(target, prop) {
    if (!advanceMethodProps.includes(prop))
      return target[prop];
    let cachedFunc = methodMap[prop];
    if (!cachedFunc) {
      cachedFunc = methodMap[prop] = function(...args) {
        advanceResults.set(this, ittrProxiedCursorToOriginalProxy.get(this)[prop](...args));
      };
    }
    return cachedFunc;
  }
};
async function* iterate(...args) {
  let cursor = this;
  if (!(cursor instanceof IDBCursor)) {
    cursor = await cursor.openCursor(...args);
  }
  if (!cursor)
    return;
  cursor = cursor;
  const proxiedCursor = new Proxy(cursor, cursorIteratorTraps);
  ittrProxiedCursorToOriginalProxy.set(proxiedCursor, cursor);
  reverseTransformCache.set(proxiedCursor, unwrap(cursor));
  while (cursor) {
    yield proxiedCursor;
    cursor = await (advanceResults.get(proxiedCursor) || cursor.continue());
    advanceResults.delete(proxiedCursor);
  }
}
function isIteratorProp(target, prop) {
  return prop === Symbol.asyncIterator && instanceOfAny(target, [IDBIndex, IDBObjectStore, IDBCursor]) || prop === "iterate" && instanceOfAny(target, [IDBIndex, IDBObjectStore]);
}
replaceTraps((oldTraps) => ({
  ...oldTraps,
  get(target, prop, receiver) {
    if (isIteratorProp(target, prop))
      return iterate;
    return oldTraps.get(target, prop, receiver);
  },
  has(target, prop) {
    return isIteratorProp(target, prop) || oldTraps.has(target, prop);
  }
}));

// src/indexedDB.ts
var FileCache = class {
  constructor() {
    this.db = null;
    this.vaultId = "";
  }
  async init(vaultId) {
    this.vaultId = vaultId;
    const dbName = `LocalGPTCache/${this.vaultId}`;
    this.db = await openDB(dbName, 3, {
      upgrade(db, oldVersion, newVersion) {
        if (oldVersion < 1) {
          if (!db.objectStoreNames.contains("embeddings")) {
            db.createObjectStore("embeddings");
          }
        }
        if (oldVersion < 2) {
          if (!db.objectStoreNames.contains("content")) {
            db.createObjectStore("content");
          }
        }
        if (oldVersion < 3) {
          if (db.objectStoreNames.contains("embeddings")) {
            db.deleteObjectStore("embeddings");
          }
        }
      }
    });
  }
  async getContent(key) {
    if (!this.db)
      throw new Error("Database not initialized");
    return this.db.get("content", key);
  }
  async setContent(key, value) {
    if (!this.db)
      throw new Error("Database not initialized");
    await this.db.put("content", value, key);
  }
  async clearContent() {
    if (!this.db)
      throw new Error("Database not initialized");
    await this.db.clear("content");
  }
  async clearAll() {
    if (!this.db)
      throw new Error("Database not initialized");
    await this.db.clear("content");
  }
};
var fileCache = new FileCache();

// src/rag.ts
var MAX_DEPTH = 10;
async function startProcessing(linkedFiles, vault, metadataCache, activeFile, updateCompletedSteps) {
  logger.info("Starting RAG processing");
  const processedDocs = /* @__PURE__ */ new Map();
  const context = { vault, metadataCache, activeFile };
  await Promise.all(
    linkedFiles.map(async (file) => {
      await processDocumentForRAG(file, context, processedDocs, 0, false);
      updateCompletedSteps == null ? void 0 : updateCompletedSteps(1);
    })
  );
  return processedDocs;
}
async function getFileContent(file, vault) {
  if (file.extension === "pdf") {
    const cachedContent = await fileCache.getContent(file.path);
    if ((cachedContent == null ? void 0 : cachedContent.mtime) === file.stat.mtime) {
      return cachedContent.content;
    }
    const arrayBuffer = await vault.readBinary(file);
    const pdfContent = await extractTextFromPDF(arrayBuffer);
    await fileCache.setContent(file.path, {
      mtime: file.stat.mtime,
      content: pdfContent
    });
    return pdfContent;
  }
  return vault.cachedRead(file);
}
async function processDocumentForRAG(file, context, processedDocs, depth, isBacklink) {
  if (depth > MAX_DEPTH || processedDocs.has(file.path) || file.path === context.activeFile.path) {
    return processedDocs;
  }
  try {
    const content = await getFileContent(file, context.vault);
    processedDocs.set(file.path, {
      content,
      meta: {
        source: file.path,
        basename: file.basename,
        stat: file.stat,
        depth,
        isBacklink
      }
    });
    if (file.extension === "md" && !isBacklink) {
      const linkedFiles = getLinkedFiles(
        content,
        context.vault,
        context.metadataCache,
        file.path
      );
      const backlinkFiles = getBacklinkFiles(
        file,
        context,
        processedDocs
      );
      await Promise.all([
        ...linkedFiles.map(
          (linkedFile) => processDocumentForRAG(
            linkedFile,
            context,
            processedDocs,
            depth + 1,
            false
          )
        ),
        ...backlinkFiles.map(
          (backlinkFile) => processDocumentForRAG(
            backlinkFile,
            context,
            processedDocs,
            depth,
            true
          )
        )
      ]);
    }
  } catch (error) {
    console.error(`Error processing document ${file.path}:`, error);
  }
  return processedDocs;
}
function getLinkedFiles(content, vault, metadataCache, currentFilePath) {
  const linkRegex = /\[\[([^\]|#]+)(?:#[^\]|]+)?(?:\|[^\]]+)?\]\]/g;
  return Array.from(content.matchAll(linkRegex), (match) => match[1]).map((linkText) => {
    const linkPath = metadataCache.getFirstLinkpathDest(
      linkText,
      currentFilePath
    );
    return linkPath ? vault.getAbstractFileByPath(linkPath.path) : null;
  }).filter(
    (file) => file instanceof import_obsidian2.TFile && (file.extension === "md" || file.extension === "pdf")
  );
}
function getBacklinkFiles(file, context, processedDocs) {
  const resolvedLinks = context.metadataCache.resolvedLinks || {};
  const backlinks = [];
  for (const [sourcePath, links] of Object.entries(resolvedLinks)) {
    if (processedDocs.has(sourcePath) || !(links == null ? void 0 : links[file.path])) {
      continue;
    }
    const backlinkFile = context.vault.getAbstractFileByPath(
      sourcePath
    );
    if ((backlinkFile == null ? void 0 : backlinkFile.extension) === "md") {
      backlinks.push(backlinkFile);
    }
  }
  return backlinks;
}
async function searchDocuments(query, documents, aiProviders, embeddingProvider, abortController, updateCompletedSteps, addTotalProgressSteps, contextLimit) {
  if (abortController == null ? void 0 : abortController.signal.aborted)
    return "";
  try {
    let lastProcessedChunks = 0;
    let initialized = false;
    logger.info("Passed contextLimit for context", contextLimit);
    const results = await aiProviders.retrieve({
      query,
      documents,
      embeddingProvider,
      onProgress: (progress) => {
        var _a2;
        if (abortController == null ? void 0 : abortController.signal.aborted)
          return;
        if (!initialized) {
          initialized = true;
          addTotalProgressSteps == null ? void 0 : addTotalProgressSteps(progress.totalChunks || 0);
        }
        const processed = ((_a2 = progress.processedChunks) == null ? void 0 : _a2.length) || 0;
        if (processed > lastProcessedChunks) {
          updateCompletedSteps(processed - lastProcessedChunks);
          lastProcessedChunks = processed;
        }
      },
      abortController
    });
    if (!initialized && (results == null ? void 0 : results.length)) {
      updateCompletedSteps(1);
    }
    return formatResults(results, contextLimit);
  } catch (error) {
    if (!(abortController == null ? void 0 : abortController.signal.aborted)) {
      console.error("Error in searchDocuments:", error);
    }
    return "";
  }
}
function formatResults(results, contextLimit) {
  if (!(results == null ? void 0 : results.length))
    return "";
  const groupedResults = groupResultsByBasename(results);
  const sortedGroups = sortResultGroups(groupedResults);
  const { text: text2, length } = formatGroupedResults(sortedGroups, contextLimit);
  logger.info("Total length of context", length);
  return text2;
}
function groupResultsByBasename(results) {
  return results.reduce((map, result) => {
    var _a2;
    const basename = (_a2 = result.document.meta) == null ? void 0 : _a2.basename;
    const existing = map.get(basename) || [];
    existing.push(result);
    map.set(basename, existing);
    return map;
  }, /* @__PURE__ */ new Map());
}
function sortResultGroups(groupedResults) {
  return Array.from(groupedResults.entries()).sort(
    (a, b) => {
      var _a2, _b, _c, _d, _e, _f;
      return (((_c = (_b = (_a2 = b[1][0]) == null ? void 0 : _a2.document.meta) == null ? void 0 : _b.stat) == null ? void 0 : _c.ctime) || 0) - (((_f = (_e = (_d = a[1][0]) == null ? void 0 : _d.document.meta) == null ? void 0 : _e.stat) == null ? void 0 : _f.ctime) || 0);
    }
  );
}
function formatGroupedResults(groups, contextLimit) {
  let formattedResults = "";
  let totalLength = 0;
  for (const [basename, groupResults] of groups) {
    if (totalLength >= contextLimit)
      break;
    formattedResults += `[[${basename}]]
`;
    const { text: text2, length } = formatSingleGroup(
      groupResults,
      contextLimit,
      totalLength
    );
    formattedResults += text2;
    totalLength += length;
  }
  const trimmed = formattedResults.trim();
  return { text: trimmed, length: trimmed.length };
}
function formatSingleGroup(groupResults, contextLimit, currentLength) {
  let groupText = "";
  let addedLength = 0;
  const sortedResults = [...groupResults].sort((a, b) => b.score - a.score);
  for (const result of sortedResults) {
    const content = result.content.trim();
    const projectedLength = currentLength + addedLength + content.length + 2;
    if (!content || projectedLength >= contextLimit) {
      continue;
    }
    groupText += `${content}

`;
    addedLength += content.length + 2;
  }
  return { text: groupText, length: addedLength };
}

// src/main.ts
var import_sdk2 = __toESM(require_dist());

// src/utils.ts
function preparePrompt(prompt = "", selectedText, context) {
  const withSelection = mergeSelection(prompt, selectedText);
  const withContext = injectContext(withSelection, context);
  return resolveConditionalContext(withContext, context);
}
function mergeSelection(prompt, selectedText) {
  if (prompt.includes(SELECTION_KEYWORD)) {
    return prompt.replace(SELECTION_KEYWORD, selectedText || "");
  }
  return [prompt, selectedText].filter(Boolean).join("\n\n");
}
function injectContext(prompt, context) {
  if (prompt.includes(CONTEXT_KEYWORD)) {
    return prompt.replace(CONTEXT_KEYWORD, context || "");
  }
  if (context.trim()) {
    return [prompt, "Context:\n" + context].filter(Boolean).join("\n\n");
  }
  return prompt;
}
function resolveConditionalContext(prompt, context) {
  if (prompt.includes(CONTEXT_CONDITION_START) && prompt.includes(CONTEXT_CONDITION_END)) {
    const start = prompt.indexOf(CONTEXT_CONDITION_START) - 1;
    const end = prompt.indexOf(CONTEXT_CONDITION_END);
    if (start !== -1 && end !== -1 && start < end) {
      let contextBlock = prompt.substring(
        start + CONTEXT_CONDITION_START.length + 1,
        end
      );
      if (!context.trim()) {
        contextBlock = "";
      }
      prompt = prompt.substring(0, start) + contextBlock + prompt.substring(end + CONTEXT_CONDITION_END.length + 1);
    }
  }
  return prompt;
}

// src/main.ts
function removeThinkingTags(text2) {
  return text2.replace(/^<think>[\s\S]*?<\/think>\s*/, "");
}
var MIN_BASE_SPEED = 0.02 / 16;
var MAX_BASE_SPEED = 3 / 16;
var LocalGPT = class extends import_obsidian3.Plugin {
  constructor() {
    super(...arguments);
    this.actionPaletteProviderId = null;
    this.actionPaletteModel = null;
    this.actionPaletteModelProviderId = null;
    this.actionPaletteCreativityKey = null;
    // "", "low", "medium", "high"
    this.abortControllers = [];
    this.currentPercentage = 0;
    this.targetPercentage = 0;
    this.frameId = null;
    this.lastFrameTime = null;
    this.displayedPercentage = 0;
    // fractional internal value
    this.baseSpeed = 0;
    // percent per ms (smoothed)
    this.lastTargetUpdateTime = null;
    this.progressFinished = false;
    // controls when we can show 100%
    this.totalProgressSteps = 0;
    this.completedProgressSteps = 0;
    // Legacy provider defaults used by older settings migrations
    this.legacyDefaultProviders = {
      ollama: {
        url: "http://localhost:11434",
        defaultModel: "gemma2",
        embeddingModel: "",
        type: "ollama"
      },
      ollama_fallback: {
        url: "http://localhost:11434",
        defaultModel: "gemma2",
        embeddingModel: "",
        type: "ollama"
      },
      openaiCompatible: {
        url: "http://localhost:8080/v1",
        apiKey: "",
        embeddingModel: "",
        type: "openaiCompatible"
      },
      openaiCompatible_fallback: {
        url: "http://localhost:8080/v1",
        apiKey: "",
        embeddingModel: "",
        type: "openaiCompatible"
      }
    };
    this.escapeHandler = (event) => {
      if (event.key === "Escape") {
        this.abortControllers.forEach(
          (abortControllers) => {
            abortControllers.abort();
          }
        );
        this.abortControllers = [];
      }
    };
    this.animationLoop = (time) => {
      if (this.lastFrameTime === null) {
        this.lastFrameTime = time;
      }
      const delta = time - this.lastFrameTime;
      this.lastFrameTime = time;
      const target = this.targetPercentage;
      if (delta > 0 && this.displayedPercentage < target) {
        let speed = this.baseSpeed;
        if (speed === 0) {
          speed = (target - this.displayedPercentage) / 400;
        }
        this.displayedPercentage = Math.min(
          target,
          this.displayedPercentage + speed * delta
        );
        const rounded = Math.floor(this.displayedPercentage);
        if (rounded !== this.currentPercentage) {
          this.currentPercentage = rounded;
          this.updateStatusBar();
        }
      }
      if (this.displayedPercentage >= target) {
        this.displayedPercentage = target;
        this.currentPercentage = target;
        this.updateStatusBar();
      }
      if (this.currentPercentage < this.targetPercentage || this.displayedPercentage < this.targetPercentage) {
        this.frameId = requestAnimationFrame(this.animationLoop);
        return;
      }
      this.stopAnimation();
    };
  }
  async onload() {
    (0, import_sdk2.initAI)(this.app, this, async () => {
      await this.loadSettings();
      this.addSettingTab(new LocalGPTSettingTab(this.app, this));
      this.reload();
      this.app.workspace.onLayoutReady(async () => {
        await fileCache.init(this.app.appId);
        window.setTimeout(() => {
          this.checkUpdates();
        }, 5e3);
      });
      this.registerEditorExtension(spinnerPlugin);
      this.registerEditorExtension(actionPalettePlugin);
      this.initializeStatusBar();
    });
  }
  initializeStatusBar() {
    this.statusBarItem = this.addStatusBarItem();
    this.statusBarItem.addClass("local-gpt-status");
    this.statusBarItem.hide();
  }
  processText(text2, selectedText) {
    if (!text2.trim()) {
      return "";
    }
    const cleanText = removeThinkingTags(text2).trim();
    return ["\n", cleanText.replace(selectedText, "").trim(), "\n"].join(
      ""
    );
  }
  addCommands() {
    this.addCommand({
      id: "context-menu",
      name: I18n.t("commands.showContextMenu"),
      editorCallback: (editor) => {
        const editorView = editor.cm;
        const cursorPositionFrom = editor.getCursor("from");
        const cursorPositionTo = editor.getCursor("to");
        const contextMenu = new import_obsidian3.Menu();
        this.settings.actions.forEach((action) => {
          contextMenu.addItem((item) => {
            item.setTitle(action.name).onClick(
              this.runAction.bind(this, action, editor)
            );
          });
        });
        const fromRect = editorView.coordsAtPos(
          editor.posToOffset(cursorPositionFrom)
        );
        const toRect = editorView.coordsAtPos(
          editor.posToOffset(cursorPositionTo)
        );
        contextMenu.showAtPosition({
          x: fromRect.left,
          y: toRect.top + (editorView.defaultLineHeight || 0)
        });
      }
    });
    this.settings.actions.forEach((action, index2) => {
      this.addCommand({
        id: `quick-access-${index2 + 1}`,
        name: `${index2 + 1} | ${action.name}`,
        editorCallback: (editor) => {
          this.runAction(action, editor);
        }
      });
    });
    this.addCommand({
      id: "local-gpt-action-palette",
      name: I18n.t("commands.actionPalette.name"),
      editorCallback: async (editor) => {
        var _a2, _b;
        const editorView = editor.cm;
        const cursorPositionFrom = editor.getCursor("from");
        const insertPos = editor.posToOffset({
          line: cursorPositionFrom.line,
          ch: 0
        });
        let modelLabel = "";
        let currentProviderId;
        try {
          const aiRequestWaiter = await (0, import_sdk2.waitForAI)();
          const aiProviders = await aiRequestWaiter.promise;
          const selectedProviderId = this.actionPaletteProviderId || this.settings.aiProviders.main;
          const provider = aiProviders.providers.find(
            (p) => p.id === selectedProviderId
          );
          if (provider) {
            currentProviderId = provider.id;
            const modelToShow = this.actionPaletteModelProviderId === provider.id ? this.actionPaletteModel || provider.model : provider.model;
            const creativityKey = (_b = (_a2 = this.actionPaletteCreativityKey) != null ? _a2 : this.settings.defaults.creativity) != null ? _b : "";
            const creativityLabelMap = {
              "": I18n.t("settings.creativityNone"),
              low: I18n.t("settings.creativityLow"),
              medium: I18n.t("settings.creativityMedium"),
              high: I18n.t("settings.creativityHigh")
            };
            const creativityLabel = creativityLabelMap[creativityKey] || "";
            modelLabel = [
              provider.name,
              modelToShow,
              creativityLabel
            ].filter(Boolean).join(" \xB7 ");
          }
        } catch (e) {
        }
        showActionPalette(editorView, insertPos, {
          onSubmit: (text2, selectedFiles = [], systemPrompt) => {
            var _a3, _b2, _c;
            const overrideProviderId = this.actionPaletteProviderId || this.settings.aiProviders.main;
            const creativityKey = (_b2 = (_a3 = this.actionPaletteCreativityKey) != null ? _a3 : this.settings.defaults.creativity) != null ? _b2 : "";
            const temperatureOverride = (_c = CREATIVITY[creativityKey]) == null ? void 0 : _c.temperature;
            this.runFreeform(
              editor,
              text2,
              selectedFiles,
              overrideProviderId,
              temperatureOverride,
              systemPrompt
            ).finally(() => {
            });
            hideActionPalette(editorView);
            this.app.workspace.updateOptions();
          },
          onCancel: () => {
            hideActionPalette(editorView);
            this.app.workspace.updateOptions();
          },
          placeholder: I18n.t("commands.actionPalette.placeholder"),
          modelLabel,
          providerId: currentProviderId,
          getFiles: () => {
            return this.app.vault.getMarkdownFiles().concat(
              this.app.vault.getFiles().filter((f) => f.extension === "pdf")
            ).map((file) => ({
              path: file.path,
              basename: file.basename,
              extension: file.extension
            }));
          },
          getProviders: async () => {
            try {
              const aiRequestWaiter = await (0, import_sdk2.waitForAI)();
              const aiProviders = await aiRequestWaiter.promise;
              return aiProviders.providers.filter((p) => Boolean(p.model)).map((p) => ({
                id: p.id,
                name: p.model || I18n.t(
                  "commands.actionPalette.unknownModel"
                ),
                providerName: p.name,
                providerUrl: p.url || ""
              }));
            } catch (error) {
              console.error("Error fetching models:", error);
              return [];
            }
          },
          getModels: async (providerId) => {
            try {
              const aiRequestWaiter = await (0, import_sdk2.waitForAI)();
              const aiProviders = await aiRequestWaiter.promise;
              const provider = aiProviders.providers.find(
                (p) => p.id === providerId
              );
              if (!provider)
                return [];
              const models = provider.availableModels || await aiProviders.fetchModels(provider);
              return models.map((m) => ({ id: m, name: m }));
            } catch (error) {
              console.error("Error fetching models:", error);
              return [];
            }
          },
          onProviderChange: async (providerId) => {
            this.actionPaletteProviderId = providerId;
            this.actionPaletteModel = null;
            this.actionPaletteModelProviderId = null;
          },
          onModelChange: async (model) => {
            const providerId = this.actionPaletteProviderId || this.settings.aiProviders.main;
            this.actionPaletteModel = model;
            this.actionPaletteModelProviderId = providerId;
          },
          onCreativityChange: async (creativityKey) => {
            this.actionPaletteCreativityKey = creativityKey;
          },
          getSystemPrompts: () => {
            return this.settings.actions.filter((action) => action.system).map((action) => ({
              name: action.name,
              system: action.system
            }));
          }
        });
        this.app.workspace.updateOptions();
      }
    });
  }
  async runFreeform(editor, userInput, selectedFiles = [], overrideProviderId, customTemperature, systemPrompt) {
    return this.executeAction(
      {
        prompt: userInput,
        system: systemPrompt,
        replace: false,
        selectedFiles,
        overrideProviderId: overrideProviderId || void 0,
        temperature: customTemperature
      },
      editor
    );
  }
  async runAction(action, editor) {
    return this.executeAction(
      {
        prompt: action.prompt,
        system: action.system,
        replace: !!action.replace,
        temperature: action.temperature || CREATIVITY[this.settings.defaults.creativity].temperature
      },
      editor
    );
  }
  async executeAction(params, editor) {
    const {
      editorView,
      cursorPositionFrom,
      cursorPositionTo,
      cursorOffsetTo,
      selectedTextRef
    } = this.extractSelectionContext(editor);
    const { abortController, hideSpinner, onUpdate } = this.createExecutionContext(
      editorView,
      cursorOffsetTo,
      selectedTextRef
    );
    const { cleanedText, imagesInBase64 } = await this.extractImagesFromSelection(selectedTextRef.value);
    selectedTextRef.value = cleanedText;
    logger.time("Processing Embeddings");
    logger.timeEnd("Processing Embeddings");
    logger.debug("Selected text", cleanedText);
    const aiRequestWaiter = await (0, import_sdk2.waitForAI)();
    const aiProviders = await aiRequestWaiter.promise;
    const embeddingProvider = aiProviders.providers.find(
      (provider2) => provider2.id === this.settings.aiProviders.embedding
    );
    const context = await this.enhanceWithContext(
      cleanedText,
      aiProviders,
      embeddingProvider,
      abortController,
      params.selectedFiles
    );
    const provider = this.selectProvider(
      aiProviders,
      imagesInBase64.length > 0,
      params.overrideProviderId
    );
    const adjustedProvider = this.overrideProviderModel(provider, params);
    let fullText = "";
    try {
      fullText = await this.executeProviderRequest(
        aiProviders,
        adjustedProvider,
        params,
        cleanedText,
        context,
        imagesInBase64,
        abortController,
        onUpdate
      );
    } finally {
      hideSpinner && hideSpinner();
      this.app.workspace.updateOptions();
    }
    if (abortController.signal.aborted) {
      return;
    }
    const finalText = removeThinkingTags(fullText).trim();
    this.applyTextResult(
      editor,
      params.replace,
      finalText,
      selectedTextRef.value,
      cursorPositionFrom,
      cursorPositionTo
    );
  }
  extractSelectionContext(editor) {
    const editorView = editor.cm;
    const selection = editor.getSelection();
    const selectedTextRef = { value: selection || editor.getValue() };
    const cursorPositionFrom = editor.getCursor("from");
    const cursorPositionTo = editor.getCursor("to");
    const cursorOffsetTo = editor.posToOffset(cursorPositionTo);
    return {
      editorView,
      cursorPositionFrom,
      cursorPositionTo,
      cursorOffsetTo,
      selectedTextRef
    };
  }
  createExecutionContext(editorView, cursorOffsetTo, selectedTextRef) {
    const abortController = new AbortController();
    this.abortControllers.push(abortController);
    const spinner = editorView.plugin(spinnerPlugin) || void 0;
    const hideSpinner = spinner == null ? void 0 : spinner.show(cursorOffsetTo);
    this.app.workspace.updateOptions();
    abortController.signal.addEventListener("abort", () => {
      hideSpinner && hideSpinner();
      this.app.workspace.updateOptions();
    });
    const onUpdate = (updatedString) => {
      if (!spinner)
        return;
      spinner.processText(
        updatedString,
        (text2) => this.processText(text2, selectedTextRef.value)
      );
      this.app.workspace.updateOptions();
    };
    return { abortController, hideSpinner, onUpdate };
  }
  async extractImagesFromSelection(selectedText) {
    const regexp = /!\[\[(.+?\.(?:png|jpe?g))]]/gi;
    const fileNames = Array.from(
      selectedText.matchAll(regexp),
      (match) => match[1]
    );
    const cleanedText = selectedText.replace(regexp, "");
    const imagesInBase64 = (await Promise.all(
      fileNames.map(
        (fileName) => this.readImageAsDataUrl(fileName)
      )
    )).filter(Boolean) || [];
    return { cleanedText, imagesInBase64 };
  }
  async readImageAsDataUrl(fileName) {
    const filePath = this.app.metadataCache.getFirstLinkpathDest(
      fileName,
      // @ts-ignore
      this.app.workspace.getActiveFile().path
    );
    if (!filePath) {
      return "";
    }
    return this.app.vault.adapter.readBinary(filePath.path).then((buffer) => {
      const extension = filePath.extension.toLowerCase();
      const mimeType = extension === "jpg" ? "jpeg" : extension;
      const blob = new Blob([buffer], {
        type: `image/${mimeType}`
      });
      return new Promise((resolve) => {
        const reader = new FileReader();
        reader.onloadend = () => resolve(reader.result);
        reader.readAsDataURL(blob);
      });
    });
  }
  selectProvider(aiProviders, hasImages, overrideProviderId) {
    const visionCandidate = hasImages ? aiProviders.providers.find(
      (p) => p.id === this.settings.aiProviders.vision
    ) : void 0;
    const preferredProviderId = overrideProviderId || this.settings.aiProviders.main;
    const fallback = aiProviders.providers.find(
      (p) => p.id === preferredProviderId
    );
    const provider = visionCandidate || fallback;
    if (!provider) {
      throw new Error("No AI provider found");
    }
    return provider;
  }
  overrideProviderModel(provider, params) {
    if (this.actionPaletteModel && params.overrideProviderId && this.actionPaletteModelProviderId === params.overrideProviderId) {
      return { ...provider, model: this.actionPaletteModel };
    }
    return provider;
  }
  async executeProviderRequest(aiProviders, provider, params, selectedText, context, imagesInBase64, abortController, onUpdate) {
    var _a2;
    try {
      return await aiProviders.execute({
        provider,
        prompt: preparePrompt(params.prompt, selectedText, context),
        images: imagesInBase64,
        systemPrompt: params.system,
        options: {
          temperature: (_a2 = params.temperature) != null ? _a2 : CREATIVITY[this.settings.defaults.creativity].temperature
        },
        onProgress: (_chunk, accumulatedText) => {
          onUpdate(accumulatedText);
        },
        abortController
      });
    } catch (error) {
      if (!abortController.signal.aborted) {
        new import_obsidian3.Notice(
          I18n.t("notices.errorGenerating", {
            message: error.message
          })
        );
      }
      logger.separator();
      return "";
    }
  }
  applyTextResult(editor, replaceSelection, finalText, selectedText, cursorPositionFrom, cursorPositionTo) {
    if (replaceSelection) {
      editor.replaceRange(
        finalText,
        cursorPositionFrom,
        cursorPositionTo
      );
      return;
    }
    const isLastLine = editor.lastLine() === cursorPositionTo.line;
    const text2 = this.processText(finalText, selectedText);
    editor.replaceRange(isLastLine ? "\n" + text2 : text2, {
      ch: 0,
      line: cursorPositionTo.line + 1
    });
  }
  async enhanceWithContext(selectedText, aiProviders, aiProvider, abortController, selectedFiles) {
    const activeFile = this.app.workspace.getActiveFile();
    if (!activeFile || !aiProvider || (abortController == null ? void 0 : abortController.signal.aborted)) {
      return "";
    }
    const allLinkedFiles = this.collectLinkedFilesForContext(
      selectedText,
      selectedFiles,
      activeFile.path
    );
    if (allLinkedFiles.length === 0) {
      return "";
    }
    try {
      this.initializeProgress();
      const processedDocs = await startProcessing(
        allLinkedFiles,
        this.app.vault,
        this.app.metadataCache,
        activeFile,
        this.updateCompletedSteps.bind(this)
      );
      if (this.shouldAbortProcessing(processedDocs, abortController)) {
        return this.finishContextProcessing("");
      }
      const retrieveDocuments = Array.from(processedDocs.values());
      if (abortController == null ? void 0 : abortController.signal.aborted) {
        return this.finishContextProcessing("");
      }
      const contextLimit = this.resolveContextLimit();
      const relevantContext = await searchDocuments(
        selectedText,
        retrieveDocuments,
        aiProviders,
        aiProvider,
        abortController,
        this.updateCompletedSteps.bind(this),
        this.addTotalProgressSteps.bind(this),
        contextLimit
      );
      return this.finishContextProcessing(relevantContext.trim() || "");
    } catch (error) {
      return this.handleContextError(error, abortController);
    }
  }
  collectLinkedFilesForContext(selectedText, selectedFiles, activeFilePath) {
    const linkedFiles = getLinkedFiles(
      selectedText,
      this.app.vault,
      this.app.metadataCache,
      activeFilePath
    );
    const additionalFiles = (selectedFiles == null ? void 0 : selectedFiles.map(
      (filePath) => this.app.vault.getAbstractFileByPath(filePath)
    ).filter(
      (file) => file !== null && file instanceof import_obsidian3.TFile && (file.extension === "md" || file.extension === "pdf")
    )) || [];
    return [...linkedFiles, ...additionalFiles];
  }
  shouldAbortProcessing(processedDocs, abortController) {
    return processedDocs.size === 0 || (abortController == null ? void 0 : abortController.signal.aborted);
  }
  resolveContextLimit() {
    var _a2, _b;
    const preset = (_b = (_a2 = this.settings) == null ? void 0 : _a2.defaults) == null ? void 0 : _b.contextLimit;
    const map = {
      local: 1e4,
      cloud: 32e3,
      advanced: 1e5,
      max: 3e6
    };
    return map[preset];
  }
  finishContextProcessing(result) {
    this.hideStatusBar();
    return result;
  }
  handleContextError(error, abortController) {
    this.hideStatusBar();
    if (!(abortController == null ? void 0 : abortController.signal.aborted)) {
      console.error("Error processing RAG:", error);
      new import_obsidian3.Notice(
        I18n.t("notices.errorProcessingRag", {
          message: error.message
        })
      );
    }
    return "";
  }
  onunload() {
    document.removeEventListener("keydown", this.escapeHandler);
    window.clearInterval(this.updatingInterval);
    if (this.frameId !== null) {
      cancelAnimationFrame(this.frameId);
    }
  }
  async loadSettings() {
    const loadedData = await this.loadData();
    const { settings, changed } = await this.migrateSettings(loadedData);
    this.settings = Object.assign({}, DEFAULT_SETTINGS, settings);
    if (changed) {
      await this.saveData(this.settings);
    }
  }
  async migrateSettings(loadedData) {
    if (!loadedData) {
      return { settings: loadedData, changed: false };
    }
    let changed = false;
    changed = this.migrateToVersion2(loadedData) || changed;
    changed = this.migrateToVersion3(loadedData) || changed;
    changed = this.migrateToVersion4(loadedData) || changed;
    changed = this.migrateToVersion5(loadedData) || changed;
    changed = this.migrateToVersion6(loadedData) || changed;
    changed = await this.migrateToVersion7(loadedData) || changed;
    changed = this.migrateToVersion8(loadedData) || changed;
    return { settings: loadedData, changed };
  }
  migrateToVersion2(settings) {
    if (settings._version && settings._version >= 1) {
      return false;
    }
    const providers = JSON.parse(
      JSON.stringify(this.legacyDefaultProviders)
    );
    settings.providers = providers;
    settings.providers.ollama.ollamaUrl = settings.ollamaUrl;
    delete settings.ollamaUrl;
    settings.providers.ollama.defaultModel = settings.defaultModel;
    delete settings.defaultModel;
    settings.providers.openaiCompatible && (settings.providers.openaiCompatible.apiKey = "");
    settings._version = 2;
    return true;
  }
  migrateToVersion3(settings) {
    if (settings._version && settings._version >= 3) {
      return false;
    }
    settings.defaultProvider = settings.selectedProvider || "ollama";
    delete settings.selectedProvider;
    const providers = settings.providers;
    if (providers) {
      Object.keys(providers).forEach((key) => {
        providers[key].type = key;
      });
    }
    settings._version = 3;
    return true;
  }
  migrateToVersion4(settings) {
    if (settings._version && settings._version >= 4) {
      return false;
    }
    settings.defaults = {
      provider: settings.defaultProvider || "ollama",
      fallbackProvider: settings.fallbackProvider || "",
      creativity: "low"
    };
    delete settings.defaultProvider;
    delete settings.fallbackProvider;
    settings._version = 4;
    return true;
  }
  migrateToVersion5(settings) {
    if (settings._version && settings._version >= 5) {
      return false;
    }
    const providers = settings.providers;
    if (providers) {
      Object.keys(this.legacyDefaultProviders).forEach((provider) => {
        if (providers[provider]) {
          providers[provider].embeddingModel = this.legacyDefaultProviders[provider].embeddingModel;
        }
      });
    }
    settings._version = 5;
    setTimeout(() => {
      new import_obsidian3.Notice(
        `\u{1F389} LocalGPT can finally use
context from links!
Check the Settings!`,
        0
      );
    }, 1e4);
    return true;
  }
  migrateToVersion6(settings) {
    if (settings._version && settings._version >= 6) {
      return false;
    }
    const providers = settings.providers;
    if (providers) {
      Object.keys(this.legacyDefaultProviders).forEach((provider) => {
        var _a2, _b;
        if (((_a2 = providers[provider]) == null ? void 0 : _a2.type) === "ollama") {
          providers[provider].url = providers[provider].ollamaUrl;
          delete providers[provider].ollamaUrl;
        }
        if (((_b = providers[provider]) == null ? void 0 : _b.type) === "openaiCompatible") {
          providers[provider].url = providers[provider].url.replace(/\/+$/i, "") + "/v1";
        }
      });
    }
    settings._version = 6;
    return true;
  }
  async migrateToVersion7(settings) {
    if (settings._version && settings._version >= 7) {
      return false;
    }
    new import_obsidian3.Notice(I18n.t("notices.importantUpdate"), 0);
    const aiRequestWaiter = await (0, import_sdk2.waitForAI)();
    const aiProviders = await aiRequestWaiter.promise;
    settings.aiProviders = {
      main: null,
      embedding: null,
      vision: null
    };
    const oldProviders = settings.providers;
    const oldDefaults = settings.defaults;
    if (oldProviders && (oldDefaults == null ? void 0 : oldDefaults.provider)) {
      await this.migrateLegacyProviderConfig(
        settings,
        aiProviders,
        oldProviders,
        oldDefaults
      );
    }
    delete settings.defaults;
    delete settings.providers;
    settings._version = 7;
    return true;
  }
  async migrateLegacyProviderConfig(settings, aiProviders, oldProviders, oldDefaults) {
    const provider = oldDefaults.provider;
    const typesMap = {
      ollama: "ollama",
      openaiCompatible: "openai"
    };
    const providerConfig = oldProviders[provider];
    if (!providerConfig) {
      return;
    }
    const type = typesMap[providerConfig.type];
    await this.createMigratedProvider(
      settings,
      aiProviders,
      provider,
      providerConfig,
      type,
      "main",
      providerConfig.defaultModel
    );
    await this.createMigratedProvider(
      settings,
      aiProviders,
      provider,
      providerConfig,
      type,
      "embedding",
      providerConfig.embeddingModel
    );
  }
  async createMigratedProvider(settings, aiProviders, provider, providerConfig, type, targetKey, model) {
    if (!model) {
      return;
    }
    let adjustedModel = model;
    if (type === "ollama" && !adjustedModel.endsWith(":latest")) {
      adjustedModel = `${adjustedModel}:latest`;
    }
    const id = `id-${Date.now().toString()}`;
    const newProvider = await aiProviders.migrateProvider({
      id,
      name: targetKey === "main" ? `Local GPT ${provider}` : `Local GPT ${provider} embeddings`,
      apiKey: providerConfig.apiKey,
      url: providerConfig.url,
      type,
      model: adjustedModel
    });
    if (newProvider) {
      settings.aiProviders[targetKey] = newProvider.id;
    }
  }
  migrateToVersion8(settings) {
    if (settings._version && settings._version >= 8) {
      return false;
    }
    settings.defaults = settings.defaults || {};
    settings.defaults.contextLimit = settings.defaults.contextLimit || "local";
    settings._version = 8;
    return true;
  }
  async checkUpdates() {
    try {
      const { json: response } = await (0, import_obsidian3.requestUrl)({
        url: "https://api.github.com/repos/pfrankov/obsidian-local-gpt/releases/latest",
        method: "GET",
        headers: {
          "Content-Type": "application/json"
        },
        contentType: "application/json"
      });
      if (response.tag_name !== this.manifest.version) {
        new import_obsidian3.Notice(I18n.t("notices.newVersion"));
      }
    } catch (error) {
      console.error("Error checking for updates:", error);
    }
  }
  reload() {
    this.onunload();
    this.addCommands();
    this.abortControllers = [];
    this.updatingInterval = window.setInterval(
      this.checkUpdates.bind(this),
      108e5
    );
    document.addEventListener("keydown", this.escapeHandler);
  }
  async saveSettings() {
    await this.saveData(this.settings);
    this.reload();
  }
  initializeProgress() {
    this.totalProgressSteps = 0;
    this.completedProgressSteps = 0;
    this.currentPercentage = 0;
    this.targetPercentage = 0;
    this.displayedPercentage = 0;
    this.baseSpeed = 0;
    this.lastTargetUpdateTime = null;
    this.lastFrameTime = null;
    this.progressFinished = false;
    this.stopAnimation();
    this.statusBarItem.show();
    this.updateStatusBar();
  }
  addTotalProgressSteps(steps) {
    this.totalProgressSteps += steps;
    this.updateProgressBar();
  }
  updateCompletedSteps(steps) {
    this.completedProgressSteps += steps;
    if (this.completedProgressSteps > this.totalProgressSteps) {
      this.totalProgressSteps = this.completedProgressSteps;
    }
    this.updateProgressBar();
  }
  updateProgressBar() {
    const newTarget = this.calculateTargetPercentage();
    if (newTarget === this.targetPercentage) {
      return;
    }
    const now2 = performance.now();
    this.baseSpeed = this.calculateBaseSpeed(newTarget, now2);
    this.targetPercentage = newTarget;
    this.lastTargetUpdateTime = now2;
    this.ensureAnimationLoop();
  }
  calculateTargetPercentage() {
    if (this.totalProgressSteps <= 0) {
      return 0;
    }
    const ratio = Math.min(
      this.completedProgressSteps / this.totalProgressSteps,
      1
    );
    return Math.floor(ratio * 100);
  }
  calculateBaseSpeed(newTarget, now2) {
    if (this.lastTargetUpdateTime === null) {
      return this.baseSpeed;
    }
    const dt = now2 - this.lastTargetUpdateTime;
    const diff = newTarget - this.targetPercentage;
    if (dt <= 0 || diff <= 0) {
      return this.baseSpeed;
    }
    const instantaneous = diff / dt;
    const blended = this.baseSpeed === 0 ? instantaneous : this.baseSpeed * 0.75 + instantaneous * 0.25;
    return Math.min(MAX_BASE_SPEED, Math.max(MIN_BASE_SPEED, blended));
  }
  ensureAnimationLoop() {
    if (this.frameId !== null) {
      return;
    }
    this.lastFrameTime = null;
    this.frameId = requestAnimationFrame(this.animationLoop);
  }
  updateStatusBar() {
    const shown = this.progressFinished ? this.currentPercentage : Math.min(this.currentPercentage, 99);
    this.statusBarItem.setAttr(
      "data-text",
      shown ? I18n.t("statusBar.enhancingWithProgress", {
        percent: String(shown)
      }) : I18n.t("statusBar.enhancing")
    );
    this.statusBarItem.setText(` `);
  }
  stopAnimation() {
    if (this.frameId !== null) {
      cancelAnimationFrame(this.frameId);
    }
    this.frameId = null;
    this.lastFrameTime = null;
  }
  hideStatusBar() {
    this.statusBarItem.hide();
    this.totalProgressSteps = 0;
    this.completedProgressSteps = 0;
    this.currentPercentage = 0;
    this.targetPercentage = 0;
    this.displayedPercentage = 0;
    this.baseSpeed = 0;
    this.lastTargetUpdateTime = null;
    this.lastFrameTime = null;
    this.progressFinished = false;
    this.stopAnimation();
  }
  markProgressFinished() {
    if (this.progressFinished) {
      return;
    }
    this.progressFinished = true;
    this.currentPercentage = 100;
    this.displayedPercentage = 100;
    this.targetPercentage = 100;
    this.updateStatusBar();
  }
};
/*! Bundled license information:

sortablejs/modular/sortable.esm.js:
  (**!
   * Sortable 1.15.6
   * @author	RubaXa   <trash@rubaxa.org>
   * @author	owenm    <owen23355@gmail.com>
   * @license MIT
   *)
*/

/* nosourcemap */