/*
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 layout_ready_component_exports = {};
__export(layout_ready_component_exports, {
  CallbackLayoutReadyComponent: () => CallbackLayoutReadyComponent,
  LayoutReadyComponent: () => LayoutReadyComponent
});
module.exports = __toCommonJS(layout_ready_component_exports);
var import_async = require('../../async.cjs');
var import_function = require('../../function.cjs');
var import_component_ex = require('./component-ex.cjs');
class LayoutReadyComponent extends import_component_ex.ComponentEx {
  /**
   * Creates a new LayoutReadyComponent instance.
   *
   * @param app - The Obsidian App instance.
   */
  constructor(app) {
    super();
    this.app = app;
  }
  app;
  /**
   * Loads the component and registers the layout ready handler.
   */
  onload() {
    this.app.workspace.onLayoutReady(() => {
      window.setTimeout(() => {
        if (this._loaded) {
          (0, import_async.invokeAsyncSafely)(this.onLayoutReady.bind(this));
        }
      }, 0);
    });
  }
  /**
   * Executes when the Obsidian layout becomes ready.
   */
  onLayoutReady() {
    (0, import_function.noop)();
  }
}
class CallbackLayoutReadyComponent extends LayoutReadyComponent {
  /**
   * Creates a new CallbackLayoutReadyComponent instance.
   *
   * @param app - The Obsidian App instance.
   * @param callback - The callback to invoke when layout is ready.
   */
  constructor(app, callback) {
    super(app);
    this.callback = callback;
  }
  callback;
  /**
   * Executes when the Obsidian layout becomes ready.
   *
   * @returns The result of invoking the callback.
   */
  onLayoutReady() {
    return this.callback();
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  CallbackLayoutReadyComponent,
  LayoutReadyComponent
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbXBvbmVudHMvbGF5b3V0LXJlYWR5LWNvbXBvbmVudC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIEludGVyZmFjZSBmb3IgY29tcG9uZW50cyB0aGF0IG5lZWQgdG8gcGVyZm9ybSB3b3JrIHdoZW4gdGhlIHdvcmtzcGFjZSBsYXlvdXQgaXMgcmVhZHkuXG4gKi9cblxuaW1wb3J0IHR5cGUgeyBBcHAgfSBmcm9tICdvYnNpZGlhbic7XG5pbXBvcnQgdHlwZSB7IFByb21pc2FibGUgfSBmcm9tICd0eXBlLWZlc3QnO1xuXG5pbXBvcnQgeyBpbnZva2VBc3luY1NhZmVseSB9IGZyb20gJy4uLy4uL2FzeW5jLnRzJztcbmltcG9ydCB7IG5vb3AgfSBmcm9tICcuLi8uLi9mdW5jdGlvbi50cyc7XG5pbXBvcnQgeyBDb21wb25lbnRFeCB9IGZyb20gJy4vY29tcG9uZW50LWV4LnRzJztcblxuLyoqXG4gKiBBIGNvbXBvbmVudCB0aGF0IGV4ZWN1dGVzIGEgY2FsbGJhY2sgZnVuY3Rpb24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