/*
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 text_based_component_exports = {};
__export(text_based_component_exports, {
  getTextBasedComponentValue: () => getTextBasedComponentValue
});
module.exports = __toCommonJS(text_based_component_exports);
var import_obsidian = require('obsidian');
class AbstractTextComponentWrapper {
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- `unknown` doesn't work, getting compiler errors.
  constructor(abstractTextComponent) {
    this.abstractTextComponent = abstractTextComponent;
  }
  abstractTextComponent;
  empty() {
    this.abstractTextComponent.setValue("");
  }
  isEmpty() {
    return this.abstractTextComponent.getValue() === "";
  }
  setPlaceholderValue(placeholderValue) {
    this.abstractTextComponent.setPlaceholder(placeholderValue);
    return this;
  }
}
function getTextBasedComponentValue(obj) {
  if (isTextBasedComponent(obj)) {
    return obj;
  }
  if (obj instanceof import_obsidian.AbstractTextComponent) {
    return new AbstractTextComponentWrapper(obj);
  }
  return null;
}
function isTextBasedComponent(component) {
  const textBasedComponent = component;
  return typeof textBasedComponent.setPlaceholderValue === "function" && typeof textBasedComponent.isEmpty === "function";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getTextBasedComponentValue
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL3NldHRpbmctY29tcG9uZW50cy90ZXh0LWJhc2VkLWNvbXBvbmVudC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIFRleHQgYmFzZWQgY29tcG9uZW50IHV0aWxpdGllcy5cbiAqL1xuXG5pbXBvcnQgeyBBYnN0cmFjdFRleHRDb21wb25lbnQgfSBmcm9tICdvYnNpZGlhbic7XG5cbi8qKlxuICogQSBjb21wb25lbnQgYmFzZWQgb24gYSB0ZXh0IGlucHV0LlxuICpcbiAqIEB0eXBlUGFyYW0gVCAtIFRoZSB0eXBlIG9mIHRoZSB2YWx1ZSB0byBzZXQuXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgVGV4dEJhc2VkQ29tcG9uZW50PFQ+IHtcbiAgLyoqXG4gICAqIEVtcHRpZXMgdGhlIGNvbXBvbmVudC5cbiAgICovXG4gIGVtcHR5KCk6IHZvaWQ7XG5cbiAgLyoqXG4gICAqIENoZWNrcyBpZiB0aGUgY29tcG9uZW50IGlzIGVtcHR5LlxuICAgKlxuICAgKiBAcmV0dXJucyBgdHJ1ZWAgaWYgdGhlIGNvbXBvbmVudCBpcyBlbXB0eSwgYGZhbHNlYCBvdGhlcndpc2UuXG4gICAqL1xuICBpc0VtcHR5KCk6IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIFNldHMgdGhlIHBsYWNlaG9sZGVyIHZhbHVlIG9mIHRoZSBjb21wb25lbnQuXG4g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