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

(function initCjs() {
  // eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
  const globalThisRecord = globalThis;
  globalThisRecord['__name'] ??= name;
  const originalRequire = require;
  if (originalRequire && !originalRequire.__isPatched) {
    // eslint-disable-next-line no-global-assign, no-implicit-globals -- We need to patch the `require()` function.
    require = Object.assign(
      (id) => requirePatched(id),
      originalRequire,
      {
        __isPatched: true
      }
    );
  }

  const newFuncs = {
    __extractDefault() {
      return extractDefault;
    },
    process() {
      const browserProcess = {
        browser: true,
        cwd() {
          return '/';
        },
        env: {},
        platform: 'android'
      };
      return browserProcess;
    }
  };

  for (const key of Object.keys(newFuncs)) {
    globalThisRecord[key] ??= newFuncs[key]?.();
  }

  function name(obj) {
    return obj;
  }

  function extractDefault(module) {
    return module && module.__esModule && 'default' in module ? module.default : module;
  }

  const OBSIDIAN_BUILT_IN_MODULE_NAMES = [
  'obsidian',
  '@codemirror/autocomplete',
  '@codemirror/collab',
  '@codemirror/commands',
  '@codemirror/language',
  '@codemirror/lint',
  '@codemirror/search',
  '@codemirror/state',
  '@codemirror/text',
  '@codemirror/view',
  '@lezer/common',
  '@lezer/lr',
  '@lezer/highlight'];


  const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = [
  '@codemirror/closebrackets',
  '@codemirror/comment',
  '@codemirror/fold',
  '@codemirror/gutter',
  '@codemirror/highlight',
  '@codemirror/history',
  '@codemirror/matchbrackets',
  '@codemirror/panel',
  '@codemirror/rangeset',
  '@codemirror/rectangular-selection',
  '@codemirror/stream-parser',
  '@codemirror/tooltip'];


  function requirePatched(id) {
    if (OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id)) {
      return originalRequire?.(id);
    }

    // eslint-disable-next-line @typescript-eslint/no-deprecated, obsidianmd/no-global-this  -- Need access to app. Actively use globalThis.
    if (globalThis.app.isMobile) {
      if (id === 'process' || id === 'node:process') {
        // eslint-disable-next-line no-console -- Valid usage.
        console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
        // eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
        return globalThis.process;
      }
    } else {
      const module = originalRequire?.(id);
      if (module) {
        return extractDefault(module);
      }
    }

    // eslint-disable-next-line no-console -- Valid usage.
    console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
    return {};
  }
})();

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var global_command_handler_exports = {};
__export(global_command_handler_exports, {
  GlobalCommandHandler: () => GlobalCommandHandler
});
module.exports = __toCommonJS(global_command_handler_exports);
var import_async = require('../../async.cjs');
var import_command_handler = require('./command-handler.cjs');
class GlobalCommandHandler extends import_command_handler.CommandHandler {
  /**
   * Creates a new global command handler.
   *
   * @param params - The parameters for the command handler.
   */
  // eslint-disable-next-line obsidian-dev-utils/params-options-name-match -- Inherits parent's params type.
  constructor(params) {
    super(params);
  }
  /**
   * Builds a plain Obsidian {@link Command} object with a `checkCallback`.
   *
   * @returns A new {@link Command} object.
   */
  buildCommand() {
    return {
      checkCallback: (checking) => this.checkCallback(checking),
      icon: this.icon,
      id: this.id,
      name: this.name
    };
  }
  /**
   * Checks whether the command can currently execute.
   *
   * @returns Whether the command can execute.
   */
  canExecute() {
    return true;
  }
  checkCallback(checking) {
    if (!this.canExecute()) {
      return false;
    }
    if (!checking) {
      (0, import_async.invokeAsyncSafely)(() => this.execute());
    }
    return true;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GlobalCommandHandler
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbW1hbmQtaGFuZGxlcnMvZ2xvYmFsLWNvbW1hbmQtaGFuZGxlci50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIENvbW1hbmQgaGFuZGxlciBmb3IgZ2xvYmFsIChub24tZWRpdG9yLCBub24tZmlsZSkgY29tbWFuZHMuXG4gKi9cblxuaW1wb3J0IHR5cGUgeyBDb21tYW5kIH0gZnJvbSAnb2JzaWRpYW4nO1xuaW1wb3J0IHR5cGUgeyBQcm9taXNhYmxlIH0gZnJvbSAndHlwZS1mZXN0JztcblxuaW1wb3J0IHR5cGUgeyBDb21tYW5kSGFuZGxlckNvbnN0cnVjdG9yUGFyYW1zIH0gZnJvbSAnLi9jb21tYW5kLWhhbmRsZXIudHMnO1xuXG5pbXBvcnQgeyBpbnZva2VBc3luY1NhZmVseSB9IGZyb20gJy4uLy4uL2FzeW5jLnRzJztcbmltcG9ydCB7IENvbW1hbmRIYW5kbGVyIH0gZnJvbSAnLi9jb21tYW5kLWhhbmRsZXIudHMnO1xuXG4vKipcbiAqIENvbW1hbmQgaGFuZGxlciBmb3IgZ2xvYmFsIGNvbW1hbmRzIGludm9rZWQgZnJvbSB0aGUgY29tbWFuZCBwYWxldHRlLlxuICpcbiAqIFN1YmNsYXNzZXMgb3ZlcnJpZGUge0BsaW5rIGNhbkV4ZWN1dGV9IGFuZCB7QGxpbmsgZXhlY3V0ZX0gdG8gcHJvdmlkZSBiZWhhd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